@lemonadejs/contextmenu 5.0.0 → 5.2.0
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/dist/index.d.ts +3 -0
- package/dist/index.js +5 -5
- package/dist/style.css +25 -13
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ declare namespace Contextmenu {
|
|
|
10
10
|
interface Item {
|
|
11
11
|
submenu?: Item[];
|
|
12
12
|
title?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
tooltip?: string;
|
|
15
|
+
shortcut?: string;
|
|
13
16
|
type: 'line' | undefined;
|
|
14
17
|
onclick?: (e: MouseEvent, element: HTMLElement) => void;
|
|
15
18
|
icon?: string;
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ if (! Modal && typeof (require) === 'function') {
|
|
|
47
47
|
} else if (self.type === 'inline') {
|
|
48
48
|
return `<div></div>`;
|
|
49
49
|
} else {
|
|
50
|
-
return `<div class="lm-menu-item" data-disabled="{{self.disabled}}" data-cursor="{{self.cursor}}" data-icon="{{self.icon}}" data-submenu="${!!self.submenu}" onmouseup="self.parent.mouseUp" onmouseenter="self.parent.mouseEnter" onmouseleave="self.parent.mouseLeave">
|
|
50
|
+
return `<div class="lm-menu-item" data-disabled="{{self.disabled}}" data-cursor="{{self.cursor}}" data-icon="{{self.icon}}" title="{{self.tooltip}}" data-submenu="${!!self.submenu}" onmouseup="self.parent.mouseUp" onmouseenter="self.parent.mouseEnter" onmouseleave="self.parent.mouseLeave">
|
|
51
51
|
<a>{{self.title}}</a> <div>{{self.shortcut}}</div>
|
|
52
52
|
</div>`;
|
|
53
53
|
}
|
|
@@ -239,7 +239,7 @@ if (! Modal && typeof (require) === 'function') {
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
const Contextmenu = function() {
|
|
242
|
+
const Contextmenu = function(children, { onload }) {
|
|
243
243
|
let self = this;
|
|
244
244
|
|
|
245
245
|
// Container for all modals
|
|
@@ -302,7 +302,7 @@ if (! Modal && typeof (require) === 'function') {
|
|
|
302
302
|
self.modalIndex = level ? level - 1 : 0;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
|
|
305
|
+
onload(() => {
|
|
306
306
|
if (! self.root) {
|
|
307
307
|
self.root = self.el.parentNode;
|
|
308
308
|
}
|
|
@@ -356,7 +356,7 @@ if (! Modal && typeof (require) === 'function') {
|
|
|
356
356
|
// Contextmenu modal
|
|
357
357
|
let item = menu.options[menu.cursor];
|
|
358
358
|
// Cursor is found so reset it
|
|
359
|
-
if (typeof
|
|
359
|
+
if (typeof(item) !== 'undefined') {
|
|
360
360
|
// Execute action
|
|
361
361
|
if (typeof (item.onclick) === 'function') {
|
|
362
362
|
item.onclick.call(item, e, item.el);
|
|
@@ -400,7 +400,7 @@ if (! Modal && typeof (require) === 'function') {
|
|
|
400
400
|
e.preventDefault();
|
|
401
401
|
e.stopImmediatePropagation();
|
|
402
402
|
});
|
|
403
|
-
}
|
|
403
|
+
});
|
|
404
404
|
|
|
405
405
|
return `<div class="lm-menu"></div>`;
|
|
406
406
|
}
|
package/dist/style.css
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
user-select: none;
|
|
4
4
|
border: 1px solid var(--lm-border-color-light, #e9e9e9);
|
|
5
5
|
border-radius: 4px;
|
|
6
|
-
box-shadow: 0 2px
|
|
7
|
-
max-height:
|
|
6
|
+
box-shadow: 0 2px 4px 2px rgba(60,64,67,.2);
|
|
7
|
+
max-height: 350px;
|
|
8
8
|
width: initial;
|
|
9
9
|
height: initial;
|
|
10
10
|
min-width: 250px;
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
.lm-menu-submenu > div.lm-menu-item {
|
|
23
23
|
box-sizing: border-box;
|
|
24
24
|
display: flex;
|
|
25
|
-
padding:
|
|
25
|
+
padding: 1px 8px 1px 40px;
|
|
26
26
|
width: 250px;
|
|
27
|
-
font-size:
|
|
27
|
+
font-size: 0.9em;
|
|
28
28
|
font-family:sans-serif;
|
|
29
29
|
text-align: left;
|
|
30
30
|
align-items: center;
|
|
@@ -34,17 +34,19 @@
|
|
|
34
34
|
text-decoration: none;
|
|
35
35
|
flex: 1;
|
|
36
36
|
cursor: pointer;
|
|
37
|
-
line-height:
|
|
37
|
+
line-height: 30px;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.lm-menu-submenu > div.lm-menu-item div {
|
|
41
41
|
margin-right: 5px;
|
|
42
|
-
font-size: 0.9em;
|
|
43
42
|
color: #888;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
.lm-menu-submenu > div.lm-menu-item[data-submenu="true"]::after {
|
|
47
|
-
content: '
|
|
46
|
+
content: 'arrow_right';
|
|
47
|
+
font-family: "Material Symbols Outlined", "Material Icons", "FontAwesome";
|
|
48
|
+
font-size: 18px;
|
|
49
|
+
color: var(--lm-icon-color, #777);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
.lm-menu-submenu > div.lm-menu-item[data-disabled="true"] {
|
|
@@ -66,12 +68,22 @@
|
|
|
66
68
|
|
|
67
69
|
.lm-menu-submenu > div.lm-menu-item::before {
|
|
68
70
|
content: attr(data-icon);
|
|
69
|
-
font-family:
|
|
70
|
-
font-size:
|
|
71
|
+
font-family: "Material Symbols Outlined", "Material Icons", "FontAwesome";
|
|
72
|
+
font-size: 18px;
|
|
73
|
+
width: 24px;
|
|
74
|
+
height: 24px;
|
|
71
75
|
line-height: 24px;
|
|
72
|
-
margin-right: 10px;
|
|
73
|
-
width: 16px;
|
|
74
|
-
color: var(--lm-icon-color, #777);
|
|
75
76
|
position: absolute;
|
|
76
|
-
left:
|
|
77
|
+
left: 11px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.lm-dark-mode .lm-menu .lm-modal {
|
|
81
|
+
color: #e8e7e9;
|
|
82
|
+
background-color: #111;
|
|
83
|
+
border: 1px solid #3c3c3c;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.lm-dark-mode .lm-menu-submenu > div.lm-menu-item:hover,
|
|
87
|
+
.lm-dark-mode .lm-menu-submenu > div.lm-menu-item[data-cursor="true"] {
|
|
88
|
+
background-color: var(--lm-background-color-hover, #2d2d2d);
|
|
77
89
|
}
|
package/package.json
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"build": "webpack --config webpack.config.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"lemonadejs": "^5.0
|
|
18
|
-
"@lemonadejs/modal": "^5.
|
|
17
|
+
"lemonadejs": "^5.2.0",
|
|
18
|
+
"@lemonadejs/modal": "^5.2.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "dist/index.js",
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
|
-
"version": "5.
|
|
22
|
+
"version": "5.2.0"
|
|
23
23
|
}
|