aleman 1.1.42 → 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 +10 -0
- package/menu/addons/context-menu.js +12 -3
- package/menu/addons/index.js +0 -2
- package/menu/addons/item-click.js +5 -2
- package/menu/hydrate-menu.js +5 -2
- package/menu/importmap.js +2 -1
- package/menu/menu.js +6 -2
- package/menu/rules/build-menu/index.js +3 -2
- package/package.json +2 -1
package/ChangeLog
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
export const
|
|
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
|
-
|
|
14
|
+
const preventDefault = true;
|
|
6
15
|
|
|
7
|
-
|
|
16
|
+
const listener = ({event, state, options}) => {
|
|
8
17
|
const {beforeShow} = options;
|
|
9
18
|
|
|
10
19
|
const is = !beforeShow || beforeShow?.({
|
package/menu/addons/index.js
CHANGED
|
@@ -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,
|
|
@@ -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/hydrate-menu.js
CHANGED
|
@@ -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 = (
|
|
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
|
|
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/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
|
};
|
package/menu/menu.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {stringify} = JSON;
|
|
2
2
|
|
|
3
|
-
export const createMenu = async (
|
|
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(
|
|
15
|
+
return hydrateMenu(elementName, {
|
|
16
|
+
hydrateElement,
|
|
17
|
+
options,
|
|
18
|
+
menu,
|
|
19
|
+
});
|
|
16
20
|
};
|
|
17
21
|
|
|
18
22
|
async function createLink() {
|
|
@@ -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 data-menu-path="">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(`
|
|
@@ -34,6 +34,7 @@ export const fix = ({path, menu, icon, name = ''}) => {
|
|
|
34
34
|
setIcon(key, menuItem);
|
|
35
35
|
|
|
36
36
|
setDataMenuPath(key, name, menuItem);
|
|
37
|
+
setDataMenuPath(key, name, menuItem.children[0]);
|
|
37
38
|
|
|
38
39
|
children.push(menuItem);
|
|
39
40
|
|
|
@@ -90,7 +91,7 @@ function setSubmenu(menuItem) {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
function setDataMenuPath(key, name, menuItem) {
|
|
93
|
-
const {attributes} = menuItem.
|
|
94
|
+
const {attributes} = menuItem.openingElement;
|
|
94
95
|
const dataMenuPath = name ? `${name}.${key}` : key;
|
|
95
96
|
|
|
96
97
|
for (const attr of attributes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aleman",
|
|
3
|
-
"version": "1.1.
|
|
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",
|
|
@@ -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
|
},
|