aleman 1.1.43 → 1.1.44

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 CHANGED
@@ -1,3 +1,8 @@
1
+ 2025.09.02, v1.1.44
2
+
3
+ feature:
4
+ - b9af387 aleman: menu: element -> selector
5
+
1
6
  2025.09.01, v1.1.43
2
7
 
3
8
  feature:
@@ -1,10 +1,19 @@
1
- export const events = [
1
+ export const createContextMenu = (name) => {
2
+ return {
3
+ name,
4
+ events,
5
+ preventDefault,
6
+ listener,
7
+ };
8
+ };
9
+
10
+ const events = [
2
11
  'contextmenu',
3
12
  ];
4
13
 
5
- export const preventDefault = true;
14
+ const preventDefault = true;
6
15
 
7
- export const listener = ({event, state, options}) => {
16
+ const listener = ({event, state, options}) => {
8
17
  const {beforeShow} = options;
9
18
 
10
19
  const is = !beforeShow || beforeShow?.({
@@ -1,4 +1,3 @@
1
- import * as contextMenu from './context-menu.js';
2
1
  import * as click from './click.js';
3
2
  import * as escape from './escape.js';
4
3
  import * as down from './down.js';
@@ -6,7 +5,6 @@ import * as up from './up.js';
6
5
  import * as enter from './enter.js';
7
6
 
8
7
  export const addons = [
9
- contextMenu,
10
8
  click,
11
9
  escape,
12
10
  down,
@@ -6,19 +6,22 @@ import {createMouseEnter} from './addons/mouse-enter.js';
6
6
  import {createItemClick} from './addons/item-click.js';
7
7
  import * as contextMenu from './addons/context-menu.js';
8
8
  import * as click from './addons/click.js';
9
+ import {createContextMenu} from './addons/context-menu.js';
9
10
 
10
11
  const {assign} = Object;
11
12
 
12
- export const hydrateMenu = (element, options, menu) => {
13
+ export const hydrateMenu = (name, {hydrateElement, options, menu}) => {
13
14
  assign(options, {
14
15
  menu,
15
16
  });
16
17
 
17
18
  const state = initState(options);
18
- const {run} = hydrate(element, {
19
+ const contextMenu = createContextMenu(name);
20
+ const {run} = hydrate(hydrateElement, {
19
21
  options,
20
22
  state,
21
23
  addons: [
24
+ contextMenu,
22
25
  createMouseEnter(options.name),
23
26
  createItemClick(options.name),
24
27
  ...addons,
package/menu/menu.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const {stringify} = JSON;
2
2
 
3
- export const createMenu = async (element, options, menuData) => {
3
+ export const createMenu = async (elementName, options, menu) => {
4
4
  options.name = options.name || 'menu';
5
5
  const {name} = options;
6
6
 
@@ -12,7 +12,11 @@ export const createMenu = async (element, options, menuData) => {
12
12
  createStateElement(name);
13
13
  const {hydrateMenu} = await import('./hydrate-menu.js');
14
14
 
15
- return hydrateMenu(hydrateElement, options, menuData);
15
+ return hydrateMenu(elementName, {
16
+ hydrateElement,
17
+ options,
18
+ menu,
19
+ });
16
20
  };
17
21
 
18
22
  async function createLink() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aleman",
3
- "version": "1.1.43",
3
+ "version": "1.1.44",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout-based framework for web",