aleman 1.1.41 → 1.1.43
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 +10 -0
- package/menu/addons/item-click.js +5 -2
- package/menu/importmap.js +2 -1
- package/menu/rules/build-menu/fixture/build-menu-fix.js +1 -1
- package/menu/rules/build-menu/fixture/icon-fix.js +1 -1
- package/menu/rules/build-menu/fixture/nested-fix.js +1 -1
- package/menu/rules/build-menu/index.js +18 -2
- package/package.json +2 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import jessy from 'jessy';
|
|
2
|
+
|
|
1
3
|
export const createItemClick = (name) => ({
|
|
2
4
|
name,
|
|
3
5
|
events: ['click'],
|
|
@@ -6,9 +8,9 @@ export const createItemClick = (name) => ({
|
|
|
6
8
|
|
|
7
9
|
const listener = ({event, options}) => {
|
|
8
10
|
const menuItemElement = document.elementFromPoint(event.clientX, event.clientY);
|
|
9
|
-
const
|
|
11
|
+
const {menuPath} = menuItemElement.dataset;
|
|
10
12
|
const {menu} = options;
|
|
11
|
-
const fn = menu
|
|
13
|
+
const fn = jessy(menuPath, menu);
|
|
12
14
|
|
|
13
15
|
setTimeout(fn);
|
|
14
16
|
options.beforeHide?.();
|
|
@@ -18,3 +20,4 @@ const listener = ({event, options}) => {
|
|
|
18
20
|
command: 'hide',
|
|
19
21
|
};
|
|
20
22
|
};
|
|
23
|
+
|
package/menu/importmap.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export const importmap = {
|
|
2
2
|
imports: {
|
|
3
|
-
'putout': 'https://esm.sh/@putout/bundle',
|
|
3
|
+
'putout': 'https://esm.sh/@putout/bundle@4.5.3',
|
|
4
4
|
'@putout/processor-html': 'https://esm.sh/@putout/processor-html',
|
|
5
5
|
'fullstore': 'https://esm.sh/fullstore',
|
|
6
|
+
'jessy': 'https://esm.sh/jessy',
|
|
6
7
|
},
|
|
7
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<ul data-name="menu" class="menu menu-hidden"><li data-name='menu-item' className='menu-item'><label>hello</label></li><li data-name='menu-item' className='menu-item'><label>world</label></li></ul>;
|
|
1
|
+
<ul data-name="menu" class="menu menu-hidden"><li data-name='menu-item' className='menu-item'><label data-menu-path='hello'>hello</label></li><li data-name='menu-item' className='menu-item'><label data-menu-path='world'>world</label></li></ul>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<ul data-name="menu" class="menu menu-hidden"><li data-name='menu-item' className="menu-item icon icon-hello"><label>hello</label></li><li data-name='menu-item' className="menu-item icon icon-world"><label>world</label></li></ul>;
|
|
1
|
+
<ul data-name="menu" class="menu menu-hidden"><li data-name='menu-item' className="menu-item icon icon-hello"><label data-menu-path='hello'>hello</label></li><li data-name='menu-item' className="menu-item icon icon-world"><label data-menu-path='world'>world</label></li></ul>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<ul data-name="menu" class="menu menu-hidden"><li data-name='menu-item' className=
|
|
1
|
+
<ul data-name="menu" class="menu menu-hidden"><li data-name='menu-item' className='menu-item icon icon-hello menu-submenu'><label data-menu-path='hello'>hello</label><ul data-name='menu' className='menu menu-hidden'><li data-name='menu-item' className="menu-item icon icon-world"><label data-menu-path='hello.world'>world</label></li></ul></li></ul>;
|
|
@@ -10,7 +10,7 @@ const isObject = (a) => a && typeof a === 'object';
|
|
|
10
10
|
export const report = () => `Build menu`;
|
|
11
11
|
|
|
12
12
|
const createMenuItem = template(`
|
|
13
|
-
<li data-name="menu-item" className="menu-item"><label>NAME</label></li>
|
|
13
|
+
<li data-name="menu-item" className="menu-item" data-menu-path=""><label data-menu-path="">NAME</label></li>
|
|
14
14
|
`);
|
|
15
15
|
|
|
16
16
|
const createMenu = template(`
|
|
@@ -22,7 +22,7 @@ const DefaultMenu = {
|
|
|
22
22
|
world: noop,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export const fix = ({path, menu, icon}) => {
|
|
25
|
+
export const fix = ({path, menu, icon, name = ''}) => {
|
|
26
26
|
const {children} = path.parentPath.node;
|
|
27
27
|
|
|
28
28
|
for (const [key, value] of entries(menu)) {
|
|
@@ -33,6 +33,9 @@ export const fix = ({path, menu, icon}) => {
|
|
|
33
33
|
if (icon)
|
|
34
34
|
setIcon(key, menuItem);
|
|
35
35
|
|
|
36
|
+
setDataMenuPath(key, name, menuItem);
|
|
37
|
+
setDataMenuPath(key, name, menuItem.children[0]);
|
|
38
|
+
|
|
36
39
|
children.push(menuItem);
|
|
37
40
|
|
|
38
41
|
if (isObject(value)) {
|
|
@@ -48,6 +51,7 @@ export const fix = ({path, menu, icon}) => {
|
|
|
48
51
|
path: openingElement,
|
|
49
52
|
icon,
|
|
50
53
|
menu: value,
|
|
54
|
+
name: key,
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -86,6 +90,18 @@ function setSubmenu(menuItem) {
|
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
|
|
93
|
+
function setDataMenuPath(key, name, menuItem) {
|
|
94
|
+
const {attributes} = menuItem.openingElement;
|
|
95
|
+
const dataMenuPath = name ? `${name}.${key}` : key;
|
|
96
|
+
|
|
97
|
+
for (const attr of attributes) {
|
|
98
|
+
if (attr.name.name === 'data-menu-path') {
|
|
99
|
+
setLiteralValue(attr.value, dataMenuPath);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
89
105
|
function setIcon(name, menuItem) {
|
|
90
106
|
const {attributes} = menuItem.openingElement;
|
|
91
107
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aleman",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.43",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout-based framework for web",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@putout/processor-html": "^14.0.2",
|
|
28
28
|
"fullstore": "^3.0.0",
|
|
29
29
|
"html-escaper": "^3.0.3",
|
|
30
|
+
"jessy": "^4.1.0",
|
|
30
31
|
"once": "^1.4.0",
|
|
31
32
|
"putout": "^40.5.1"
|
|
32
33
|
},
|