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 +5 -0
- package/menu/addons/context-menu.js +12 -3
- package/menu/addons/index.js +0 -2
- package/menu/hydrate-menu.js +5 -2
- package/menu/menu.js +6 -2
- package/package.json +1 -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,
|
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/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() {
|