aleman 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +5 -0
- package/menu/addons/enter.js +8 -5
- package/menu/addons/run/index.js +14 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/menu/addons/enter.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {run} from './run/index.js';
|
|
2
|
+
|
|
3
|
+
const isObject = (a) => a && typeof a === 'object';
|
|
1
4
|
const {values} = Object;
|
|
2
5
|
|
|
3
6
|
export const keys = ['Enter'];
|
|
@@ -7,11 +10,10 @@ export const filter = ({state}) => state.command === 'show';
|
|
|
7
10
|
export const stopPropagation = true;
|
|
8
11
|
|
|
9
12
|
export const listener = ({options, state}) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
setTimeout(fn);
|
|
13
|
+
run({
|
|
14
|
+
options,
|
|
15
|
+
state,
|
|
16
|
+
});
|
|
15
17
|
options.beforeHide?.(state);
|
|
16
18
|
|
|
17
19
|
return {
|
|
@@ -19,3 +21,4 @@ export const listener = ({options, state}) => {
|
|
|
19
21
|
index: -1,
|
|
20
22
|
};
|
|
21
23
|
};
|
|
24
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const isObject = (a) => a && typeof a === 'object';
|
|
2
|
+
const {values} = Object;
|
|
3
|
+
|
|
4
|
+
export const run = ({options, state}) => {
|
|
5
|
+
const {index, submenuIndex} = state;
|
|
6
|
+
const {menu} = options;
|
|
7
|
+
|
|
8
|
+
const fn = values(menu)[index];
|
|
9
|
+
|
|
10
|
+
if (isObject(fn))
|
|
11
|
+
return setTimeout(values(fn)[submenuIndex]);
|
|
12
|
+
|
|
13
|
+
setTimeout(fn);
|
|
14
|
+
};
|