@ne1410s/menu 0.1.119 → 0.1.121
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.
|
@@ -77,7 +77,7 @@ class NeMenu extends custElems.CustomElementBase {
|
|
|
77
77
|
const isSplit = li.classList.contains('split');
|
|
78
78
|
const isGrouper = !isSplit && ul && ul.querySelector('li');
|
|
79
79
|
const isDisabled = !isSplit && (parentDisabled || li.classList.contains('disabled'));
|
|
80
|
-
const aChildren = Array.from((a === null || a ===
|
|
80
|
+
const aChildren = Array.from((a === null || a === undefined ? undefined : a.children) || []).map((el) => el);
|
|
81
81
|
const imgs = children
|
|
82
82
|
.concat(aChildren)
|
|
83
83
|
.filter((n) => n instanceof HTMLImageElement)
|
|
@@ -92,13 +92,13 @@ class NeMenu extends custElems.CustomElementBase {
|
|
|
92
92
|
classes.push('disabled');
|
|
93
93
|
if (isGrouper)
|
|
94
94
|
classes.push('group');
|
|
95
|
-
if ((a === null || a ===
|
|
95
|
+
if ((a === null || a === undefined ? undefined : a.target) === '_blank')
|
|
96
96
|
classes.push('click-out');
|
|
97
97
|
else if (a)
|
|
98
98
|
classes.push('click-in');
|
|
99
99
|
}
|
|
100
100
|
const bestTextNode = [...children, li].find((c) => c.innerText);
|
|
101
|
-
const bestText = isSplit ? null : ((_a = bestTextNode === null || bestTextNode ===
|
|
101
|
+
const bestText = isSplit ? null : ((_a = bestTextNode === null || bestTextNode === undefined ? undefined : bestTextNode.innerText) !== null && _a !== undefined ? _a : `Item ${levelItemNo}`);
|
|
102
102
|
const shortcut = isSplit || isGrouper ? null : li.getAttribute('aria-keyshortcuts');
|
|
103
103
|
const liRef = `${ref}${levelItemNo}`;
|
|
104
104
|
const eventDetail = { ref: liRef, title: bestText, origin: a || li };
|
|
@@ -158,7 +158,7 @@ class NeMenu extends custElems.CustomElementBase {
|
|
|
158
158
|
if (isGrouper)
|
|
159
159
|
$domItem.appendIn({ tag: 'ul' }).append(...this.walk(ul, isDisabled, `${liRef}-`));
|
|
160
160
|
// Do not push two consecutive splits
|
|
161
|
-
if (!isSplit || !((_c = (_b = acc[acc.length - 1]) === null || _b ===
|
|
161
|
+
if (!isSplit || !((_c = (_b = acc[acc.length - 1]) === null || _b === undefined ? undefined : _b.classList) === null || _c === undefined ? undefined : _c.contains('split'))) {
|
|
162
162
|
acc.push($domItem.elements[0]);
|
|
163
163
|
}
|
|
164
164
|
return acc;
|
|
@@ -75,7 +75,7 @@ class NeMenu extends CustomElementBase {
|
|
|
75
75
|
const isSplit = li.classList.contains('split');
|
|
76
76
|
const isGrouper = !isSplit && ul && ul.querySelector('li');
|
|
77
77
|
const isDisabled = !isSplit && (parentDisabled || li.classList.contains('disabled'));
|
|
78
|
-
const aChildren = Array.from((a === null || a ===
|
|
78
|
+
const aChildren = Array.from((a === null || a === undefined ? undefined : a.children) || []).map((el) => el);
|
|
79
79
|
const imgs = children
|
|
80
80
|
.concat(aChildren)
|
|
81
81
|
.filter((n) => n instanceof HTMLImageElement)
|
|
@@ -90,13 +90,13 @@ class NeMenu extends CustomElementBase {
|
|
|
90
90
|
classes.push('disabled');
|
|
91
91
|
if (isGrouper)
|
|
92
92
|
classes.push('group');
|
|
93
|
-
if ((a === null || a ===
|
|
93
|
+
if ((a === null || a === undefined ? undefined : a.target) === '_blank')
|
|
94
94
|
classes.push('click-out');
|
|
95
95
|
else if (a)
|
|
96
96
|
classes.push('click-in');
|
|
97
97
|
}
|
|
98
98
|
const bestTextNode = [...children, li].find((c) => c.innerText);
|
|
99
|
-
const bestText = isSplit ? null : ((_a = bestTextNode === null || bestTextNode ===
|
|
99
|
+
const bestText = isSplit ? null : ((_a = bestTextNode === null || bestTextNode === undefined ? undefined : bestTextNode.innerText) !== null && _a !== undefined ? _a : `Item ${levelItemNo}`);
|
|
100
100
|
const shortcut = isSplit || isGrouper ? null : li.getAttribute('aria-keyshortcuts');
|
|
101
101
|
const liRef = `${ref}${levelItemNo}`;
|
|
102
102
|
const eventDetail = { ref: liRef, title: bestText, origin: a || li };
|
|
@@ -156,7 +156,7 @@ class NeMenu extends CustomElementBase {
|
|
|
156
156
|
if (isGrouper)
|
|
157
157
|
$domItem.appendIn({ tag: 'ul' }).append(...this.walk(ul, isDisabled, `${liRef}-`));
|
|
158
158
|
// Do not push two consecutive splits
|
|
159
|
-
if (!isSplit || !((_c = (_b = acc[acc.length - 1]) === null || _b ===
|
|
159
|
+
if (!isSplit || !((_c = (_b = acc[acc.length - 1]) === null || _b === undefined ? undefined : _b.classList) === null || _c === undefined ? undefined : _c.contains('split'))) {
|
|
160
160
|
acc.push($domItem.elements[0]);
|
|
161
161
|
}
|
|
162
162
|
return acc;
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
return this;
|
|
149
149
|
};
|
|
150
150
|
ChainedQuery.prototype.remove = function () {
|
|
151
|
-
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([
|
|
151
|
+
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([undefined, this.mapper], this._items.filter(function (it) {
|
|
152
152
|
var handle = it instanceof Node;
|
|
153
153
|
if (handle)
|
|
154
154
|
it.parentNode.removeChild(it);
|
|
@@ -171,21 +171,21 @@
|
|
|
171
171
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
172
172
|
sources[_i] = arguments[_i];
|
|
173
173
|
}
|
|
174
|
-
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([
|
|
175
|
-
var nodes = new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([
|
|
174
|
+
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([undefined, this.mapper], this.containers.reduce(function (acc, parent) {
|
|
175
|
+
var nodes = new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([undefined, _this.mapper], sources, false)))().nodes;
|
|
176
176
|
parent.append.apply(parent, nodes);
|
|
177
177
|
acc.push.apply(acc, nodes);
|
|
178
178
|
return acc;
|
|
179
179
|
}, []), false)))();
|
|
180
180
|
};
|
|
181
181
|
ChainedQuery.prototype.find = function (selector) {
|
|
182
|
-
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([
|
|
182
|
+
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([undefined, this.mapper], this.containers.reduce(function (acc, parent) {
|
|
183
183
|
acc.push.apply(acc, Array.from(parent.querySelectorAll(selector)));
|
|
184
184
|
return acc;
|
|
185
185
|
}, []), false)))();
|
|
186
186
|
};
|
|
187
187
|
ChainedQuery.prototype.first = function (selector) {
|
|
188
|
-
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([
|
|
188
|
+
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([undefined, this.mapper], this.containers.map(function (parent) { return parent.querySelector(selector); }).filter(function (found) { return !!found; }), false)))();
|
|
189
189
|
};
|
|
190
190
|
ChainedQuery.WHITESPACE_RGX = /\s+/;
|
|
191
191
|
return ChainedQuery;
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
248
248
|
input[_i] = arguments[_i];
|
|
249
249
|
}
|
|
250
|
-
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([
|
|
250
|
+
return new (ChainedQuery.bind.apply(ChainedQuery, __spreadArray([undefined, mapper], input, false)))();
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
class CustomElementBase extends HTMLElement {
|
|
@@ -349,7 +349,7 @@
|
|
|
349
349
|
const isSplit = li.classList.contains('split');
|
|
350
350
|
const isGrouper = !isSplit && ul && ul.querySelector('li');
|
|
351
351
|
const isDisabled = !isSplit && (parentDisabled || li.classList.contains('disabled'));
|
|
352
|
-
const aChildren = Array.from((a === null || a ===
|
|
352
|
+
const aChildren = Array.from((a === null || a === undefined ? undefined : a.children) || []).map((el) => el);
|
|
353
353
|
const imgs = children
|
|
354
354
|
.concat(aChildren)
|
|
355
355
|
.filter((n) => n instanceof HTMLImageElement)
|
|
@@ -364,13 +364,13 @@
|
|
|
364
364
|
classes.push('disabled');
|
|
365
365
|
if (isGrouper)
|
|
366
366
|
classes.push('group');
|
|
367
|
-
if ((a === null || a ===
|
|
367
|
+
if ((a === null || a === undefined ? undefined : a.target) === '_blank')
|
|
368
368
|
classes.push('click-out');
|
|
369
369
|
else if (a)
|
|
370
370
|
classes.push('click-in');
|
|
371
371
|
}
|
|
372
372
|
const bestTextNode = [...children, li].find((c) => c.innerText);
|
|
373
|
-
const bestText = isSplit ? null : ((_a = bestTextNode === null || bestTextNode ===
|
|
373
|
+
const bestText = isSplit ? null : ((_a = bestTextNode === null || bestTextNode === undefined ? undefined : bestTextNode.innerText) !== null && _a !== undefined ? _a : `Item ${levelItemNo}`);
|
|
374
374
|
const shortcut = isSplit || isGrouper ? null : li.getAttribute('aria-keyshortcuts');
|
|
375
375
|
const liRef = `${ref}${levelItemNo}`;
|
|
376
376
|
const eventDetail = { ref: liRef, title: bestText, origin: a || li };
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
if (isGrouper)
|
|
431
431
|
$domItem.appendIn({ tag: 'ul' }).append(...this.walk(ul, isDisabled, `${liRef}-`));
|
|
432
432
|
// Do not push two consecutive splits
|
|
433
|
-
if (!isSplit || !((_c = (_b = acc[acc.length - 1]) === null || _b ===
|
|
433
|
+
if (!isSplit || !((_c = (_b = acc[acc.length - 1]) === null || _b === undefined ? undefined : _b.classList) === null || _c === undefined ? undefined : _c.contains('split'))) {
|
|
434
434
|
acc.push($domItem.elements[0]);
|
|
435
435
|
}
|
|
436
436
|
return acc;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ne1410s/menu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.121",
|
|
4
4
|
"description": "Lightweight ES context menu.",
|
|
5
5
|
"main": "dist/ne14_menu.cjs.min.js",
|
|
6
6
|
"module": "dist/ne14_menu.esm.min.js",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"@rollup/plugin-url": "^8.0.2",
|
|
47
47
|
"prettier": "^3.4.2",
|
|
48
48
|
"rimraf": "^5.0.10",
|
|
49
|
-
"rollup": "^4.
|
|
49
|
+
"rollup": "^4.30.0",
|
|
50
50
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
51
51
|
"typescript": "^5.7.2"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@ne1410s/cust-elems": "^0.3.
|
|
55
|
-
"@ne1410s/dom": "^0.3.
|
|
54
|
+
"@ne1410s/cust-elems": "^0.3.96",
|
|
55
|
+
"@ne1410s/dom": "^0.3.111"
|
|
56
56
|
}
|
|
57
57
|
}
|