aleman 1.1.9 → 1.1.11

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/aleman/index.js CHANGED
@@ -48,6 +48,7 @@ export const hydrate = (element, {addons, options, state, rules, stateName = 'al
48
48
  ...readState(),
49
49
  ...partialState,
50
50
  };
51
+
51
52
  const [is, result] = render(state);
52
53
 
53
54
  if (!is)
@@ -1,6 +1,9 @@
1
1
  export const events = ['click'];
2
2
 
3
- export const listener = () => ({
4
- command: 'hide',
5
- index: -1,
6
- });
3
+ export const listener = ({options, state}) => {
4
+ options.beforeClick?.(state);
5
+ return {
6
+ command: 'hide',
7
+ index: -1,
8
+ };
9
+ };
@@ -4,10 +4,17 @@ export const events = [
4
4
 
5
5
  export const preventDefault = true;
6
6
 
7
- export const listener = ({event}) => ({
8
- command: 'show',
9
- position: {
10
- left: event.clientX,
11
- top: event.clientY - 14,
12
- },
13
- });
7
+ export const listener = ({event, state, options}) => {
8
+ options.beforeShow?.({
9
+ ...state,
10
+ x: state.position.left,
11
+ y: state.position.top,
12
+ });
13
+ return {
14
+ command: 'show',
15
+ position: {
16
+ left: event.clientX,
17
+ top: event.clientY - 14,
18
+ },
19
+ };
20
+ };
@@ -1,6 +1,9 @@
1
1
  export const key = 'Escape';
2
2
 
3
- export const listener = () => ({
4
- command: 'hide',
5
- index: -1,
6
- });
3
+ export const listener = ({options}) => {
4
+ options.beforeHide?.();
5
+ return {
6
+ command: 'hide',
7
+ index: -1,
8
+ };
9
+ };
package/menu/addons/f9.js CHANGED
@@ -1,9 +1,16 @@
1
1
  export const key = 'F9';
2
2
 
3
- export const listener = () => ({
4
- command: 'show',
5
- position: {
6
- left: 0,
7
- top: 0,
8
- },
9
- });
3
+ export const listener = ({options, state}) => {
4
+ options.beforeShow?.({
5
+ ...state,
6
+ x: state.position.left,
7
+ y: state.position.top,
8
+ });
9
+ return {
10
+ command: 'show',
11
+ position: {
12
+ left: 0,
13
+ top: 0,
14
+ },
15
+ };
16
+ };
@@ -8,6 +8,7 @@ export const listener = ({event, options}) => {
8
8
  const fn = menu[name];
9
9
 
10
10
  setTimeout(fn);
11
+ options.beforeClose?.();
11
12
 
12
13
  return {
13
14
  index: -1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aleman",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout-based framework for web",