aleman 1.1.20 → 1.1.21

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.
@@ -5,8 +5,6 @@ import * as down from './down.js';
5
5
  import * as up from './up.js';
6
6
  import * as f9 from './f9.js';
7
7
  import * as enter from './enter.js';
8
- import * as mouseEnter from './mouse-enter.js';
9
- import * as itemClick from './item-click.js';
10
8
 
11
9
  export const addons = [
12
10
  contextMenu,
@@ -16,6 +14,4 @@ export const addons = [
16
14
  up,
17
15
  f9,
18
16
  enter,
19
- mouseEnter,
20
- itemClick,
21
17
  ];
@@ -1,7 +1,10 @@
1
- export const name = 'menu';
2
- export const events = ['click'];
1
+ export const createItemClick = (name) => ({
2
+ name,
3
+ events: ['click'],
4
+ listener,
5
+ });
3
6
 
4
- export const listener = ({event, options}) => {
7
+ const listener = ({event, options}) => {
5
8
  const menuItemElement = document.elementFromPoint(event.clientX, event.clientY);
6
9
  const name = menuItemElement.textContent.trim();
7
10
  const {menu} = options;
@@ -1,5 +1,7 @@
1
- export const name = 'menu';
2
- export const events = ['mouseenter'];
3
- export const listener = () => ({
4
- index: -1,
1
+ export const createMouseEnter = (name) => ({
2
+ name,
3
+ events: ['mouseenter'],
4
+ listener: () => ({
5
+ index: -1,
6
+ }),
5
7
  });
@@ -2,6 +2,8 @@ import {rules} from './rules/index.js';
2
2
  import {hydrate} from '../aleman/index.js';
3
3
  import {initState} from './state.js';
4
4
  import {addons} from './addons/index.js';
5
+ import {createMouseEnter} from './addons/mouse-enter.js';
6
+ import {createItemClick} from './addons/item-click.js';
5
7
 
6
8
  const {assign} = Object;
7
9
 
@@ -14,7 +16,11 @@ export const hydrateMenu = (element, options, menu) => {
14
16
  const {run} = hydrate(element, {
15
17
  options,
16
18
  state,
17
- addons,
19
+ addons: [
20
+ createMouseEnter(options.name),
21
+ createItemClick(options.name),
22
+ ...addons,
23
+ ],
18
24
  rules,
19
25
  stateName: `aleman-state-${options.name}`,
20
26
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aleman",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout-based framework for web",