aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--rollup.config.js2
-rw-r--r--src/MenuItem.mjs7
-rw-r--r--src/dumbyUtils.mjs10
-rw-r--r--src/utils.mjs4
4 files changed, 11 insertions, 12 deletions
diff --git a/rollup.config.js b/rollup.config.js
index 539e2d3..145224b 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -55,7 +55,7 @@ const general = {
55 node(), 55 node(),
56 commonjs(), 56 commonjs(),
57 production && terser({ 57 production && terser({
58 keep_fnames: true, 58 keep_fnames: true
59 }), 59 }),
60 production && bundleStats() 60 production && bundleStats()
61 ] 61 ]
diff --git a/src/MenuItem.mjs b/src/MenuItem.mjs
index 864bc05..1b58e0b 100644
--- a/src/MenuItem.mjs
+++ b/src/MenuItem.mjs
@@ -99,7 +99,8 @@ export const pickBlockItem = ({ blocks, utils }) =>
99 const preview = block.querySelector('p') 99 const preview = block.querySelector('p')
100 ?.textContent.substring(0, 15) 100 ?.textContent.substring(0, 15)
101 ?.concat(' ', '... ') ?? '' 101 ?.concat(' ', '... ') ?? ''
102 const item = new Item({ 102
103 return new Item({
103 className: ['keep-menu', focus ? 'checked' : 'unchecked'], 104 className: ['keep-menu', focus ? 'checked' : 'unchecked'],
104 innerHTML: 105 innerHTML:
105 `<strong>(${index})</strong><span style='display: inline-block; margin-inline: 1.2em;'>${preview}</span>`, 106 `<strong>(${index})</strong><span style='display: inline-block; margin-inline: 1.2em;'>${preview}</span>`,
@@ -114,11 +115,9 @@ export const pickBlockItem = ({ blocks, utils }) =>
114 115
115 // UX: remove menu after user select/deselect blocks 116 // UX: remove menu after user select/deselect blocks
116 const submenu = e.target.closest('.sub-menu') 117 const submenu = e.target.closest('.sub-menu')
117 submenu.onmouseleave = () => submenu.closest('.menu').style.display = 'none' 118 submenu.onmouseleave = () => { submenu.closest('.menu').style.display = 'none' }
118 } 119 }
119 }) 120 })
120
121 return item
122 } 121 }
123 ) 122 )
124 }) 123 })
diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs
index c7b45f4..5de5b05 100644
--- a/src/dumbyUtils.mjs
+++ b/src/dumbyUtils.mjs
@@ -6,7 +6,7 @@ import { insideWindow, insideParent } from './utils'
6 * 6 *
7 * @param {Boolean} reverse -- focus previous map 7 * @param {Boolean} reverse -- focus previous map
8 */ 8 */
9export function focusNextMap(reverse = false) { 9export function focusNextMap (reverse = false) {
10 const renderedList = this.utils.renderedMaps() 10 const renderedList = this.utils.renderedMaps()
11 const index = renderedList.findIndex(e => e.classList.contains('focus')) 11 const index = renderedList.findIndex(e => e.classList.contains('focus'))
12 const nextIndex = (index + (reverse ? -1 : 1)) % renderedList.length 12 const nextIndex = (index + (reverse ? -1 : 1)) % renderedList.length
@@ -21,7 +21,7 @@ export function focusNextMap(reverse = false) {
21 * 21 *
22 * @param {Boolean} reverse -- focus previous block 22 * @param {Boolean} reverse -- focus previous block
23 */ 23 */
24export function focusNextBlock(reverse = false) { 24export function focusNextBlock (reverse = false) {
25 const blocks = this.blocks.filter(b => 25 const blocks = this.blocks.filter(b =>
26 b.checkVisibility({ 26 b.checkVisibility({
27 contentVisibilityAuto: true, 27 contentVisibilityAuto: true,
@@ -56,7 +56,7 @@ export const scrollToBlock = block => {
56/** 56/**
57 * focusDelay. Delay of throttle, value changes by cases 57 * focusDelay. Delay of throttle, value changes by cases
58 */ 58 */
59export function focusDelay() { 59export function focusDelay () {
60 return window.window.getComputedStyle(this.showcase).display === 'none' ? 50 : 300 60 return window.window.getComputedStyle(this.showcase).display === 'none' ? 50 : 300
61} 61}
62 62
@@ -65,7 +65,7 @@ export function focusDelay() {
65 * 65 *
66 * @param {Boolean} reverse -- Switch to previous one 66 * @param {Boolean} reverse -- Switch to previous one
67 */ 67 */
68export function switchToNextLayout(reverse = false) { 68export function switchToNextLayout (reverse = false) {
69 const layouts = this.layouts 69 const layouts = this.layouts
70 const currentLayoutName = this.container.getAttribute('data-layout') 70 const currentLayoutName = this.container.getAttribute('data-layout')
71 const currentIndex = layouts.map(l => l.name).indexOf(currentLayoutName) 71 const currentIndex = layouts.map(l => l.name).indexOf(currentLayoutName)
@@ -81,7 +81,7 @@ export function switchToNextLayout(reverse = false) {
81/** 81/**
82 * removeBlockFocus. 82 * removeBlockFocus.
83 */ 83 */
84export function removeBlockFocus() { 84export function removeBlockFocus () {
85 this.blocks.forEach(b => b.classList.remove('focus')) 85 this.blocks.forEach(b => b.classList.remove('focus'))
86} 86}
87 87
diff --git a/src/utils.mjs b/src/utils.mjs
index 4eedf82..ddd3034 100644
--- a/src/utils.mjs
+++ b/src/utils.mjs
@@ -72,10 +72,10 @@ export const animateRectTransition = (element, rect, options = {}) => {
72 * @param {Number} delay milliseconds 72 * @param {Number} delay milliseconds
73 * @returns {Any} return value of function call, or null if throttled 73 * @returns {Any} return value of function call, or null if throttled
74 */ 74 */
75export function throttle(func, delay) { 75export function throttle (func, delay) {
76 let timerFlag = null 76 let timerFlag = null
77 77
78 return function(...args) { 78 return function (...args) {
79 const context = this 79 const context = this
80 if (timerFlag !== null) return null 80 if (timerFlag !== null) return null
81 81