aleman 1.1.22 → 1.1.24

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.
@@ -17,6 +17,7 @@ export const addListeners = ({namedAddons, options, readState, writeState}) => {
17
17
  key,
18
18
  listener,
19
19
  preventDefault,
20
+ filter,
20
21
  } = addon;
21
22
 
22
23
  for (const event of events) {
@@ -28,6 +29,14 @@ export const addListeners = ({namedAddons, options, readState, writeState}) => {
28
29
  return;
29
30
 
30
31
  const state = readState();
32
+ const is = filter?.({
33
+ event,
34
+ state,
35
+ options,
36
+ });
37
+
38
+ if (filter && !is)
39
+ return false;
31
40
 
32
41
  const newState = listener({
33
42
  event,
@@ -92,3 +101,4 @@ export const addGlobalListeners = ({globalAddons, options, readState, writeState
92
101
  }
93
102
  }
94
103
  };
104
+
@@ -4,12 +4,15 @@ export const events = [
4
4
 
5
5
  export const preventDefault = true;
6
6
 
7
- export const listener = ({event, state, options}) => {
8
- options.beforeShow?.({
7
+ export const filter = ({event, state, options}) => {
8
+ return options.beforeShow?.({
9
9
  ...state,
10
10
  x: state.position.left,
11
11
  y: state.position.top,
12
12
  });
13
+ };
14
+
15
+ export const listener = ({event, state, options}) => {
13
16
  return {
14
17
  command: 'show',
15
18
  position: {
package/menu/addons/f9.js CHANGED
@@ -1,11 +1,14 @@
1
1
  export const key = 'F9';
2
2
 
3
- export const listener = ({options, state}) => {
4
- options.beforeShow?.({
3
+ export const filter = ({state, options}) => {
4
+ return options.beforeShow?.({
5
5
  ...state,
6
6
  x: state.position.left,
7
7
  y: state.position.top,
8
8
  });
9
+ };
10
+
11
+ export const listener = ({options, state}) => {
9
12
  return {
10
13
  command: 'show',
11
14
  position: {
package/menu/state.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const {keys} = Object;
2
2
 
3
3
  export const initState = ({menu, name = 'menu'}) => {
4
- const count = keys(menu);
4
+ const count = keys(menu).length;
5
5
 
6
6
  return {
7
7
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aleman",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout-based framework for web",