@nonoun/native-ui 0.1.0 → 0.2.1
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/components/ui-controller/ui-controller-element.d.ts.map +1 -1
- package/dist/components/ui-listbox/ui-listbox-element.d.ts.map +1 -1
- package/dist/components/ui-slideshow/ui-slideshow-element.d.ts.map +1 -1
- package/dist/components/ui-tabs/ui-tabs-element.d.ts.map +1 -1
- package/dist/components-lean.css +8 -0
- package/dist/components.css +8 -0
- package/dist/core/trait-registry.d.ts +2 -0
- package/dist/core/trait-registry.d.ts.map +1 -1
- package/dist/core/ui-element.d.ts.map +1 -1
- package/dist/custom-elements.json +3998 -2529
- package/dist/dialog-controller.js +142 -89
- package/dist/native-ui-lean.css +8 -0
- package/dist/native-ui.css +8 -0
- package/dist/native-ui.js +1 -1
- package/dist/register-all2.js +1 -1
- package/dist/traits/drag-controller.d.ts +3 -3
- package/dist/traits/drag-controller.d.ts.map +1 -1
- package/dist/traits/list-navigate-controller.d.ts.map +1 -1
- package/dist/traits.js +1 -1
- package/dist/ui-icon-element.js +174 -169
- package/package.json +3 -2
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { i as e, o as t, t as n } from "./uid.js";
|
|
2
|
-
var r = /* @__PURE__ */ new Map();
|
|
3
|
-
function
|
|
2
|
+
var r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
3
|
+
function a(e) {
|
|
4
4
|
if (r.has(e.name)) {
|
|
5
5
|
console.warn(`[native-ui] Trait "${e.name}" is already registered.`);
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
8
|
r.set(e.name, e);
|
|
9
|
+
for (let t of i) t(e.name);
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
/** Subscribe to trait registration events. Returns unsubscribe function. */
|
|
12
|
+
function o(e) {
|
|
13
|
+
return i.add(e), () => i.delete(e);
|
|
14
|
+
}
|
|
15
|
+
function s(e) {
|
|
11
16
|
return r.get(e);
|
|
12
17
|
}
|
|
13
|
-
function
|
|
18
|
+
function c() {
|
|
14
19
|
return new Set(r.keys());
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
@@ -18,8 +23,8 @@ function o() {
|
|
|
18
23
|
* { trait: "draggable", key: "axis" }. Returns null if the attribute
|
|
19
24
|
* doesn't match any registered trait name prefix.
|
|
20
25
|
*/
|
|
21
|
-
function
|
|
22
|
-
let t =
|
|
26
|
+
function l(e) {
|
|
27
|
+
let t = c();
|
|
23
28
|
for (let n of t) if (e.startsWith(n + "-")) return {
|
|
24
29
|
trait: n,
|
|
25
30
|
key: e.slice(n.length + 1)
|
|
@@ -33,28 +38,30 @@ function s(e) {
|
|
|
33
38
|
* Example: element has `draggable-axis="x"` and `draggable-mode="slot"`
|
|
34
39
|
* → collectTraitOptions(el, 'draggable') returns { axis: 'x', mode: 'slot' }
|
|
35
40
|
*/
|
|
36
|
-
function
|
|
41
|
+
function u(e, t) {
|
|
37
42
|
let n = t + "-", r = {};
|
|
38
43
|
for (let t of e.attributes) t.name.startsWith(n) && (r[t.name.slice(n.length)] = t.value);
|
|
39
44
|
return r;
|
|
40
45
|
}
|
|
41
46
|
/** Base custom element class with reactive effect lifecycle, child deferral, and trait protocol. */
|
|
42
|
-
var
|
|
47
|
+
var d = class extends HTMLElement {
|
|
43
48
|
#e = [];
|
|
44
49
|
#t = /* @__PURE__ */ new Map();
|
|
45
50
|
#n = null;
|
|
46
|
-
#r =
|
|
51
|
+
#r = /* @__PURE__ */ new Set();
|
|
52
|
+
#i = null;
|
|
53
|
+
#a = !1;
|
|
47
54
|
addEffect(t) {
|
|
48
55
|
this.#e.push(e(t));
|
|
49
56
|
}
|
|
50
57
|
connectedCallback() {
|
|
51
|
-
if (this.#
|
|
52
|
-
this.#
|
|
58
|
+
if (this.#a) return;
|
|
59
|
+
this.#a = !0, this.setup();
|
|
53
60
|
let e = this.getAttribute("traits");
|
|
54
|
-
e !== null && this.#
|
|
61
|
+
e !== null && this.#o(e);
|
|
55
62
|
}
|
|
56
63
|
disconnectedCallback() {
|
|
57
|
-
this.#
|
|
64
|
+
this.#a = !1, this.#c(), this.#n?.disconnect(), this.#n = null, this.#i?.(), this.#i = null, this.#r.clear(), this.teardown();
|
|
58
65
|
for (let e of this.#e) e();
|
|
59
66
|
this.#e = [];
|
|
60
67
|
}
|
|
@@ -73,47 +80,51 @@ var l = class extends HTMLElement {
|
|
|
73
80
|
getTraitController(e) {
|
|
74
81
|
return this.#t.get(e) ?? null;
|
|
75
82
|
}
|
|
76
|
-
#
|
|
77
|
-
this.#
|
|
78
|
-
for (let t of e) if (t.attributeName === "traits") this.#
|
|
83
|
+
#o(e) {
|
|
84
|
+
this.#s(e), this.#n = new MutationObserver((e) => {
|
|
85
|
+
for (let t of e) if (t.attributeName === "traits") this.#s(this.getAttribute("traits") ?? "");
|
|
79
86
|
else if (t.attributeName) {
|
|
80
|
-
let e =
|
|
87
|
+
let e = l(t.attributeName);
|
|
81
88
|
if (e) {
|
|
82
|
-
let t =
|
|
83
|
-
t && n && t.update && t.update(n,
|
|
89
|
+
let t = s(e.trait), n = this.#t.get(e.trait);
|
|
90
|
+
t && n && t.update && t.update(n, u(this, e.trait));
|
|
84
91
|
}
|
|
85
92
|
}
|
|
86
93
|
}), this.#n.observe(this, { attributes: !0 });
|
|
87
94
|
}
|
|
88
|
-
#
|
|
95
|
+
#s(e) {
|
|
89
96
|
let t = new Set(e.split(/\s+/).filter(Boolean));
|
|
90
97
|
for (let [e, n] of this.#t) if (!t.has(e)) {
|
|
91
|
-
let t =
|
|
98
|
+
let t = s(e);
|
|
92
99
|
t && t.destroy(n), this.#t.delete(e);
|
|
93
100
|
}
|
|
101
|
+
this.#r.clear();
|
|
94
102
|
for (let e of t) {
|
|
95
103
|
if (this.#t.has(e)) continue;
|
|
96
|
-
let t =
|
|
104
|
+
let t = s(e);
|
|
97
105
|
if (!t) {
|
|
98
|
-
|
|
106
|
+
this.#r.add(e);
|
|
99
107
|
continue;
|
|
100
108
|
}
|
|
101
|
-
for (let [n] of this.#t) if (
|
|
109
|
+
for (let [n] of this.#t) if (s(n)?.conflicts?.includes(e) || t.conflicts?.includes(n)) {
|
|
102
110
|
let t = `[native-ui] Trait conflict: "${e}" and "${n}" are incompatible.`;
|
|
103
111
|
console.warn(t);
|
|
104
112
|
}
|
|
105
|
-
let n =
|
|
113
|
+
let n = u(this, e), r = t.create(this, n);
|
|
106
114
|
this.#t.set(e, r);
|
|
107
115
|
}
|
|
116
|
+
this.#r.size > 0 && !this.#i ? this.#i = o((e) => {
|
|
117
|
+
this.#r.has(e) && (this.#r.delete(e), this.#s(this.getAttribute("traits") ?? ""), this.#r.size === 0 && (this.#i?.(), this.#i = null));
|
|
118
|
+
}) : this.#r.size === 0 && this.#i && (this.#i(), this.#i = null);
|
|
108
119
|
}
|
|
109
|
-
#
|
|
120
|
+
#c() {
|
|
110
121
|
for (let [e, t] of this.#t) {
|
|
111
|
-
let n =
|
|
122
|
+
let n = s(e);
|
|
112
123
|
n && n.destroy(t);
|
|
113
124
|
}
|
|
114
125
|
this.#t.clear();
|
|
115
126
|
}
|
|
116
|
-
},
|
|
127
|
+
}, f = class {
|
|
117
128
|
#e = /* @__PURE__ */ new Set();
|
|
118
129
|
#t = null;
|
|
119
130
|
#n = !1;
|
|
@@ -153,7 +164,7 @@ var l = class extends HTMLElement {
|
|
|
153
164
|
#o() {
|
|
154
165
|
this.#n &&= (document.removeEventListener("pointerdown", this.#r, !0), document.removeEventListener("pointerup", this.#i, !0), document.removeEventListener("pointercancel", this.#i, !0), !1);
|
|
155
166
|
}
|
|
156
|
-
},
|
|
167
|
+
}, p = class {
|
|
157
168
|
#e = [];
|
|
158
169
|
#t = !1;
|
|
159
170
|
#n = (e) => {
|
|
@@ -185,7 +196,7 @@ var l = class extends HTMLElement {
|
|
|
185
196
|
#a() {
|
|
186
197
|
this.#e.length > 0 || (document.removeEventListener("pointerdown", this.#n, !0), document.removeEventListener("keydown", this.#r), this.#t = !1);
|
|
187
198
|
}
|
|
188
|
-
},
|
|
199
|
+
}, m = class {
|
|
189
200
|
#e = null;
|
|
190
201
|
#t = 0;
|
|
191
202
|
#n = [];
|
|
@@ -225,16 +236,16 @@ var l = class extends HTMLElement {
|
|
|
225
236
|
dismissAll() {
|
|
226
237
|
for (let e of [...this.#n]) this.dismiss(e.id);
|
|
227
238
|
}
|
|
228
|
-
},
|
|
229
|
-
function
|
|
230
|
-
return
|
|
231
|
-
dismissStack: new
|
|
232
|
-
toastManager: new
|
|
233
|
-
gestureRouter: new
|
|
234
|
-
},
|
|
239
|
+
}, h = null;
|
|
240
|
+
function g() {
|
|
241
|
+
return h ||= {
|
|
242
|
+
dismissStack: new p(),
|
|
243
|
+
toastManager: new m(),
|
|
244
|
+
gestureRouter: new f()
|
|
245
|
+
}, h;
|
|
235
246
|
}
|
|
236
|
-
/** Enables pointer-driven drag-and-drop with drop
|
|
237
|
-
var
|
|
247
|
+
/** Enables pointer-driven drag-and-drop with drop, slot, or preview reordering. */
|
|
248
|
+
var _ = class {
|
|
238
249
|
host;
|
|
239
250
|
selector;
|
|
240
251
|
dropZoneSelector;
|
|
@@ -251,55 +262,58 @@ var h = class {
|
|
|
251
262
|
#s = -1;
|
|
252
263
|
#c = -1;
|
|
253
264
|
#l = !1;
|
|
265
|
+
#u = null;
|
|
266
|
+
#d = null;
|
|
267
|
+
#f = -1;
|
|
254
268
|
constructor(e, t) {
|
|
255
269
|
this.host = e, this.selector = t.selector, this.dropZoneSelector = t.dropZoneSelector ?? "", this.axis = t.axis ?? "both", this.mode = t.mode ?? "drop", this.disabled = t.disabled ?? !1, this.attach();
|
|
256
270
|
}
|
|
257
271
|
attach() {
|
|
258
|
-
this.#l || (this.#l = !0, this.host.addEventListener("pointerdown", this.#
|
|
272
|
+
this.#l || (this.#l = !0, this.host.addEventListener("pointerdown", this.#_), this.host.addEventListener("pointerenter", this.#h, !0), this.host.addEventListener("pointerleave", this.#g, !0));
|
|
259
273
|
}
|
|
260
274
|
detach() {
|
|
261
|
-
this.#l && (this.#l = !1, this.host.removeEventListener("pointerdown", this.#
|
|
275
|
+
this.#l && (this.#l = !1, this.host.removeEventListener("pointerdown", this.#_), this.host.removeEventListener("pointerenter", this.#h, !0), this.host.removeEventListener("pointerleave", this.#g, !0), this.#O());
|
|
262
276
|
}
|
|
263
277
|
destroy() {
|
|
264
278
|
this.detach();
|
|
265
279
|
}
|
|
266
|
-
#
|
|
280
|
+
#p() {
|
|
267
281
|
return this.selector ? [...this.host.querySelectorAll(this.selector)] : [];
|
|
268
282
|
}
|
|
269
|
-
#
|
|
270
|
-
return this.dropZoneSelector ? [...this.host.querySelectorAll(this.dropZoneSelector)] : this.#
|
|
283
|
+
#m() {
|
|
284
|
+
return this.dropZoneSelector ? [...this.host.querySelectorAll(this.dropZoneSelector)] : this.#p();
|
|
271
285
|
}
|
|
272
|
-
#
|
|
286
|
+
#h = (e) => {
|
|
273
287
|
if (this.disabled || !this.selector || this.#t) return;
|
|
274
288
|
let t = e.target.closest?.(this.selector);
|
|
275
289
|
!t || !this.host.contains(t) || (t.style.outline = "2px solid var(--ui-focus-ring, highlight)", t.style.outlineOffset = "2px");
|
|
276
290
|
};
|
|
277
|
-
#
|
|
291
|
+
#g = (e) => {
|
|
278
292
|
if (!this.selector) return;
|
|
279
293
|
let t = e.target.closest?.(this.selector);
|
|
280
294
|
!t || !this.host.contains(t) || (t.style.removeProperty("outline"), t.style.removeProperty("outline-offset"));
|
|
281
295
|
};
|
|
282
|
-
#
|
|
296
|
+
#_ = (e) => {
|
|
283
297
|
if (e.button !== 0 || this.disabled || !this.selector) return;
|
|
284
298
|
let t = e.target.closest?.(this.selector);
|
|
285
299
|
if (!t || !this.host.contains(t)) return;
|
|
286
|
-
let n = this.#
|
|
300
|
+
let n = this.#p().indexOf(t);
|
|
287
301
|
if (n === -1) return;
|
|
288
302
|
e.preventDefault(), this.#e = t, this.#s = n, this.#r = e.clientX, this.#i = e.clientY;
|
|
289
303
|
let r = t.getBoundingClientRect();
|
|
290
|
-
this.#a = r.left + r.width / 2 - e.clientX, this.#o = r.top + r.height / 2 - e.clientY, document.addEventListener("pointermove", this.#
|
|
304
|
+
this.#a = r.left + r.width / 2 - e.clientX, this.#o = r.top + r.height / 2 - e.clientY, document.addEventListener("pointermove", this.#v), document.addEventListener("pointerup", this.#w), document.addEventListener("pointercancel", this.#T), document.addEventListener("keydown", this.#E);
|
|
291
305
|
};
|
|
292
|
-
#
|
|
306
|
+
#v = (e) => {
|
|
293
307
|
if (!this.#e) return;
|
|
294
308
|
if (!this.#t) {
|
|
295
309
|
this.#e.style.removeProperty("outline"), this.#e.style.removeProperty("outline-offset");
|
|
296
310
|
try {
|
|
297
|
-
this.#
|
|
311
|
+
this.#D(e);
|
|
298
312
|
} catch {
|
|
299
|
-
this.#
|
|
313
|
+
this.#O();
|
|
300
314
|
return;
|
|
301
315
|
}
|
|
302
|
-
this.#e.setAttribute("dragging", ""), this.host.dispatchEvent(new CustomEvent("ui-drag-start", {
|
|
316
|
+
this.#e.setAttribute("dragging", ""), this.mode === "preview" && (this.#u = this.#e.parentElement, this.#d = this.#e.nextElementSibling, this.#f = -1), this.host.dispatchEvent(new CustomEvent("ui-drag-start", {
|
|
303
317
|
bubbles: !0,
|
|
304
318
|
composed: !0,
|
|
305
319
|
detail: {
|
|
@@ -318,7 +332,7 @@ var h = class {
|
|
|
318
332
|
y: e.clientY
|
|
319
333
|
}
|
|
320
334
|
}));
|
|
321
|
-
let r = this.#
|
|
335
|
+
let r = this.#m();
|
|
322
336
|
if (this.mode === "slot") {
|
|
323
337
|
let t = e.clientX + this.#a, n = e.clientY + this.#o, i = r.filter((e) => e !== this.#e), a = 0;
|
|
324
338
|
for (let e = 0; e < i.length; e++) {
|
|
@@ -326,7 +340,10 @@ var h = class {
|
|
|
326
340
|
if (this.axis === "horizontal" ? t > o : (this.axis === "vertical" || t > o) && n > s) a = e + 1;
|
|
327
341
|
else break;
|
|
328
342
|
}
|
|
329
|
-
this.#
|
|
343
|
+
this.#b(r, a);
|
|
344
|
+
} else if (this.mode === "preview") {
|
|
345
|
+
let t = e.clientX + this.#a, n = e.clientY + this.#o;
|
|
346
|
+
this.#S(r, t, n);
|
|
330
347
|
} else {
|
|
331
348
|
let t = null, n = -1;
|
|
332
349
|
for (let i = 0; i < r.length; i++) {
|
|
@@ -336,10 +353,10 @@ var h = class {
|
|
|
336
353
|
break;
|
|
337
354
|
}
|
|
338
355
|
}
|
|
339
|
-
this.#
|
|
356
|
+
this.#y(r, t, n);
|
|
340
357
|
}
|
|
341
358
|
};
|
|
342
|
-
#
|
|
359
|
+
#y(e, t, n) {
|
|
343
360
|
for (let n of e) n !== t && (n.removeAttribute("drag-over"), n.style.removeProperty("outline"), n.style.removeProperty("outline-offset"));
|
|
344
361
|
t && (t.setAttribute("drag-over", ""), t.style.outline = "2px solid var(--ui-focus-ring, highlight)", t.style.outlineOffset = "2px", this.host.dispatchEvent(new CustomEvent("ui-drag-over", {
|
|
345
362
|
bubbles: !0,
|
|
@@ -351,9 +368,9 @@ var h = class {
|
|
|
351
368
|
}
|
|
352
369
|
})));
|
|
353
370
|
}
|
|
354
|
-
#
|
|
371
|
+
#b(e, t) {
|
|
355
372
|
if (t === -1 || t === this.#c) return;
|
|
356
|
-
this.#c = t, this.#
|
|
373
|
+
this.#c = t, this.#x(e), this.#n || (this.#n = document.createElement("div"), this.#n.className = "drag-placeholder", this.#n.setAttribute("aria-hidden", "true"));
|
|
357
374
|
let n = e.filter((e) => e !== this.#e), r = Math.min(t, n.length);
|
|
358
375
|
r < n.length ? n[r].before(this.#n) : n.length > 0 ? n[n.length - 1].after(this.#n) : this.host.appendChild(this.#n), r < n.length && n[r].setAttribute("drag-slot-before", ""), r > 0 && r - 1 < n.length && n[r - 1].setAttribute("drag-slot-after", "");
|
|
359
376
|
let i = r < n.length ? n[r] : null;
|
|
@@ -367,13 +384,38 @@ var h = class {
|
|
|
367
384
|
}
|
|
368
385
|
}));
|
|
369
386
|
}
|
|
370
|
-
#
|
|
387
|
+
#x(e) {
|
|
371
388
|
for (let t of e) t.removeAttribute("drag-slot-before"), t.removeAttribute("drag-slot-after");
|
|
372
389
|
}
|
|
373
|
-
#
|
|
390
|
+
#S(e, t, n) {
|
|
391
|
+
let r = e.filter((e) => e !== this.#e);
|
|
392
|
+
if (r.length === 0) return;
|
|
393
|
+
let i = 0, a = Infinity;
|
|
394
|
+
for (let e = 0; e < r.length; e++) {
|
|
395
|
+
let o = r[e].getBoundingClientRect(), s = o.left + o.width / 2, c = o.top + o.height / 2, l = Math.hypot(t - s, n - c);
|
|
396
|
+
l < a && (a = l, i = e);
|
|
397
|
+
}
|
|
398
|
+
let o = r[i].getBoundingClientRect(), s = o.left + o.width / 2, c = o.top + o.height / 2, l = o.height * .5, u = Math.abs(n - c) < l ? t < s ? i : i + 1 : n < c ? i : i + 1;
|
|
399
|
+
if (u === this.#f) return;
|
|
400
|
+
this.#f = u;
|
|
401
|
+
let d = u < r.length ? r[u] : null;
|
|
402
|
+
d ? d.before(this.#e) : r[r.length - 1].after(this.#e), this.host.dispatchEvent(new CustomEvent("ui-drag-over", {
|
|
403
|
+
bubbles: !0,
|
|
404
|
+
composed: !0,
|
|
405
|
+
detail: {
|
|
406
|
+
item: this.#e,
|
|
407
|
+
index: u,
|
|
408
|
+
insertBefore: d
|
|
409
|
+
}
|
|
410
|
+
}));
|
|
411
|
+
}
|
|
412
|
+
#C() {
|
|
413
|
+
this.mode !== "preview" || !this.#e || !this.#u || (this.#d && this.#d.isConnected ? this.#d.before(this.#e) : this.#u.appendChild(this.#e));
|
|
414
|
+
}
|
|
415
|
+
#w = (e) => {
|
|
374
416
|
if (this.#e) {
|
|
375
417
|
if (this.#t) if (this.mode === "slot") {
|
|
376
|
-
let e = this.#
|
|
418
|
+
let e = this.#p().filter((e) => e !== this.#e), t = this.#c >= 0 && this.#c < e.length ? e[this.#c] : null;
|
|
377
419
|
this.host.dispatchEvent(new CustomEvent("ui-drop", {
|
|
378
420
|
bubbles: !0,
|
|
379
421
|
composed: !0,
|
|
@@ -384,8 +426,19 @@ var h = class {
|
|
|
384
426
|
insertBefore: t
|
|
385
427
|
}
|
|
386
428
|
}));
|
|
429
|
+
} else if (this.mode === "preview") {
|
|
430
|
+
let e = this.#p(), t = this.#e ? e.indexOf(this.#e) : -1;
|
|
431
|
+
this.#u = null, this.#d = null, this.host.dispatchEvent(new CustomEvent("ui-drop", {
|
|
432
|
+
bubbles: !0,
|
|
433
|
+
composed: !0,
|
|
434
|
+
detail: {
|
|
435
|
+
item: this.#e,
|
|
436
|
+
fromIndex: this.#s,
|
|
437
|
+
toIndex: t
|
|
438
|
+
}
|
|
439
|
+
}));
|
|
387
440
|
} else {
|
|
388
|
-
let e = this.#
|
|
441
|
+
let e = this.#m(), t = e.find((e) => e.hasAttribute("drag-over")) ?? null, n = t ? e.indexOf(t) : -1;
|
|
389
442
|
this.host.dispatchEvent(new CustomEvent("ui-drop", {
|
|
390
443
|
bubbles: !0,
|
|
391
444
|
composed: !0,
|
|
@@ -397,29 +450,29 @@ var h = class {
|
|
|
397
450
|
}
|
|
398
451
|
}));
|
|
399
452
|
}
|
|
400
|
-
this.#
|
|
453
|
+
this.#O();
|
|
401
454
|
}
|
|
402
455
|
};
|
|
403
|
-
#
|
|
404
|
-
this.#e && (this.#t && this.host.dispatchEvent(new CustomEvent("ui-drag-cancel", {
|
|
456
|
+
#T = () => {
|
|
457
|
+
this.#e && (this.#C(), this.#t && this.host.dispatchEvent(new CustomEvent("ui-drag-cancel", {
|
|
405
458
|
bubbles: !0,
|
|
406
459
|
composed: !0,
|
|
407
460
|
detail: { item: this.#e }
|
|
408
|
-
})), this.#
|
|
461
|
+
})), this.#O());
|
|
409
462
|
};
|
|
410
|
-
#
|
|
411
|
-
e.key === "Escape" && this.#e && (e.preventDefault(), this.host.dispatchEvent(new CustomEvent("ui-drag-cancel", {
|
|
463
|
+
#E = (e) => {
|
|
464
|
+
e.key === "Escape" && this.#e && (e.preventDefault(), this.#C(), this.host.dispatchEvent(new CustomEvent("ui-drag-cancel", {
|
|
412
465
|
bubbles: !0,
|
|
413
466
|
composed: !0,
|
|
414
467
|
detail: { item: this.#e }
|
|
415
|
-
})), this.#
|
|
468
|
+
})), this.#O());
|
|
416
469
|
};
|
|
417
|
-
#
|
|
470
|
+
#D(e) {
|
|
418
471
|
if (!this.#e) return;
|
|
419
472
|
let t = this.#e.getBoundingClientRect(), n = this.#e.cloneNode(!0);
|
|
420
473
|
n.setAttribute("popover", "manual"), n.setAttribute("aria-hidden", "true"), this.host.appendChild(n), n.showPopover(), n.style.position = "fixed", n.style.inset = "unset", n.style.left = `${t.left}px`, n.style.top = `${t.top}px`, n.style.width = `${t.width}px`, n.style.height = `${t.height}px`, n.style.margin = "0", n.style.pointerEvents = "none", n.style.opacity = "0.8", n.style.transformOrigin = "center center", n.style.border = "none", n.style.outline = "none", this.#t = n, this.#r = e.clientX, this.#i = e.clientY;
|
|
421
474
|
}
|
|
422
|
-
#
|
|
475
|
+
#O() {
|
|
423
476
|
if (this.#t) {
|
|
424
477
|
if (this.#t.isConnected) try {
|
|
425
478
|
this.#t.hidePopover();
|
|
@@ -427,12 +480,12 @@ var h = class {
|
|
|
427
480
|
this.#t.remove(), this.#t = null;
|
|
428
481
|
}
|
|
429
482
|
this.#e && this.#e.removeAttribute("dragging");
|
|
430
|
-
let e = this.#
|
|
431
|
-
if (this.mode === "slot") this.#
|
|
483
|
+
let e = this.#m();
|
|
484
|
+
if (this.mode === "slot") this.#x(e);
|
|
432
485
|
else for (let t of e) t.removeAttribute("drag-over"), t.style.removeProperty("outline"), t.style.removeProperty("outline-offset");
|
|
433
|
-
this.#n &&= (this.#n.remove(), null), this.#e = null, this.#s = -1, this.#c = -1, document.removeEventListener("pointermove", this.#
|
|
486
|
+
this.#n &&= (this.#n.remove(), null), this.#e = null, this.#s = -1, this.#c = -1, this.#u = null, this.#d = null, this.#f = -1, document.removeEventListener("pointermove", this.#v), document.removeEventListener("pointerup", this.#w), document.removeEventListener("pointercancel", this.#T), document.removeEventListener("keydown", this.#E);
|
|
434
487
|
}
|
|
435
|
-
},
|
|
488
|
+
}, v = class {
|
|
436
489
|
host;
|
|
437
490
|
handleSelector;
|
|
438
491
|
axis;
|
|
@@ -515,7 +568,7 @@ var h = class {
|
|
|
515
568
|
#d() {
|
|
516
569
|
this.#i = !1, this.host.removeAttribute("resizing"), document.removeEventListener("pointermove", this.#s), document.removeEventListener("pointerup", this.#c), document.removeEventListener("pointercancel", this.#l), document.removeEventListener("keydown", this.#u);
|
|
517
570
|
}
|
|
518
|
-
},
|
|
571
|
+
}, y = class {
|
|
519
572
|
host;
|
|
520
573
|
disabled;
|
|
521
574
|
#e = !1;
|
|
@@ -562,7 +615,7 @@ var h = class {
|
|
|
562
615
|
detail: { pointerType: "keyboard" }
|
|
563
616
|
})));
|
|
564
617
|
};
|
|
565
|
-
},
|
|
618
|
+
}, b = class {
|
|
566
619
|
host;
|
|
567
620
|
selector;
|
|
568
621
|
orientation;
|
|
@@ -616,7 +669,7 @@ var h = class {
|
|
|
616
669
|
let r = e[t];
|
|
617
670
|
r && (r.setAttribute("tabindex", "0"), r.focus());
|
|
618
671
|
}
|
|
619
|
-
},
|
|
672
|
+
}, x = class {
|
|
620
673
|
host;
|
|
621
674
|
#e = 0;
|
|
622
675
|
constructor(e) {
|
|
@@ -624,21 +677,21 @@ var h = class {
|
|
|
624
677
|
}
|
|
625
678
|
enable() {
|
|
626
679
|
this.#e = requestAnimationFrame(() => {
|
|
627
|
-
this.#e = 0,
|
|
680
|
+
this.#e = 0, g().dismissStack.push(this.host);
|
|
628
681
|
});
|
|
629
682
|
}
|
|
630
683
|
disable() {
|
|
631
|
-
this.#e &&= (cancelAnimationFrame(this.#e), 0),
|
|
684
|
+
this.#e &&= (cancelAnimationFrame(this.#e), 0), g().dismissStack.remove(this.host);
|
|
632
685
|
}
|
|
633
686
|
destroy() {
|
|
634
|
-
this.#e &&= (cancelAnimationFrame(this.#e), 0),
|
|
687
|
+
this.#e &&= (cancelAnimationFrame(this.#e), 0), g().dismissStack.remove(this.host);
|
|
635
688
|
}
|
|
636
|
-
},
|
|
689
|
+
}, S = class {
|
|
637
690
|
host;
|
|
638
691
|
#e;
|
|
639
692
|
#t = null;
|
|
640
693
|
constructor(e) {
|
|
641
|
-
this.host = e, this.#e = new
|
|
694
|
+
this.host = e, this.#e = new x(e);
|
|
642
695
|
}
|
|
643
696
|
wirePopover(e, t) {
|
|
644
697
|
this.#t = t;
|
|
@@ -661,7 +714,7 @@ var h = class {
|
|
|
661
714
|
destroy() {
|
|
662
715
|
this.#e.destroy(), this.#t = null;
|
|
663
716
|
}
|
|
664
|
-
},
|
|
717
|
+
}, C = class {
|
|
665
718
|
host;
|
|
666
719
|
listValue = t(null);
|
|
667
720
|
itemSelector;
|
|
@@ -678,7 +731,7 @@ var h = class {
|
|
|
678
731
|
cancelable: !0,
|
|
679
732
|
detail: t
|
|
680
733
|
}));
|
|
681
|
-
}), this.#e = new
|
|
734
|
+
}), this.#e = new b(e, {
|
|
682
735
|
selector: this.itemSelector,
|
|
683
736
|
orientation: t.orientation ?? "vertical",
|
|
684
737
|
wrap: t.wrap ?? !0,
|
|
@@ -689,7 +742,7 @@ var h = class {
|
|
|
689
742
|
n(() => {
|
|
690
743
|
let t = this.listValue.value, n = e.querySelectorAll(this.itemSelector), r = this.ariaAttr === "aria-current";
|
|
691
744
|
for (let e of n) {
|
|
692
|
-
let n = e.value;
|
|
745
|
+
let n = e.getAttribute("value") ?? e.value;
|
|
693
746
|
if (n !== void 0) {
|
|
694
747
|
let i = n === t;
|
|
695
748
|
r ? i ? e.setAttribute("aria-current", "page") : e.removeAttribute("aria-current") : e.setAttribute(this.ariaAttr, i ? "true" : "false");
|
|
@@ -717,7 +770,7 @@ var h = class {
|
|
|
717
770
|
let t = e.detail;
|
|
718
771
|
this.onChildSelect(t);
|
|
719
772
|
};
|
|
720
|
-
},
|
|
773
|
+
}, w = class {
|
|
721
774
|
host;
|
|
722
775
|
#e = null;
|
|
723
776
|
#t;
|
|
@@ -751,4 +804,4 @@ var h = class {
|
|
|
751
804
|
t !== e && e.appendChild(t), this.host.appendChild(e), this.#e = e, e.addEventListener("cancel", this.#n), e.addEventListener("click", this.#r), this.host.addEventListener("ui-dismiss", this.#i);
|
|
752
805
|
}
|
|
753
806
|
};
|
|
754
|
-
export {
|
|
807
|
+
export { s as _, b as a, _ as c, g as d, f, c as g, l as h, x as i, p as l, u as m, C as n, y as o, d as p, S as r, v as s, w as t, m as u, o as v, a as y };
|
package/dist/native-ui-lean.css
CHANGED
|
@@ -7008,6 +7008,14 @@
|
|
|
7008
7008
|
height: 100%;
|
|
7009
7009
|
}
|
|
7010
7010
|
|
|
7011
|
+
/* WHY: Unregistered icons (no SVG content) should collapse to zero size
|
|
7012
|
+
so surrounding buttons/slots don't render with phantom dimensions */
|
|
7013
|
+
:where(ui-icon:empty) {
|
|
7014
|
+
width: 0;
|
|
7015
|
+
height: 0;
|
|
7016
|
+
overflow: hidden;
|
|
7017
|
+
}
|
|
7018
|
+
|
|
7011
7019
|
/* ── Icon Size Variants ── */
|
|
7012
7020
|
|
|
7013
7021
|
:where(ui-icon[size="xs"]) { --ui-icon-size: var(--ui-icon-xs); }
|
package/dist/native-ui.css
CHANGED
|
@@ -7084,6 +7084,14 @@
|
|
|
7084
7084
|
height: 100%;
|
|
7085
7085
|
}
|
|
7086
7086
|
|
|
7087
|
+
/* WHY: Unregistered icons (no SVG content) should collapse to zero size
|
|
7088
|
+
so surrounding buttons/slots don't render with phantom dimensions */
|
|
7089
|
+
:where(ui-icon:empty) {
|
|
7090
|
+
width: 0;
|
|
7091
|
+
height: 0;
|
|
7092
|
+
overflow: hidden;
|
|
7093
|
+
}
|
|
7094
|
+
|
|
7087
7095
|
/* ── Icon Size Variants ── */
|
|
7088
7096
|
|
|
7089
7097
|
:where(ui-icon[size="xs"]) { --ui-icon-size: var(--ui-icon-xs); }
|
package/dist/native-ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as ee, r as te, t as ne } from "./uid.js";
|
|
2
2
|
import { A as re, B as ie, C as r, D as i, E as a, F as o, G as s, H as c, I as l, L as u, M as d, N as f, O as p, P as m, R as h, S as g, T as _, U as v, V as y, W as b, _ as x, a as S, b as C, c as w, d as T, f as E, g as D, h as O, i as k, j as A, k as j, l as M, m as N, n as P, o as F, p as I, r as L, s as R, t as z, u as B, v as V, w as H, x as U, y as W, z as G } from "./register-all2.js";
|
|
3
|
-
import { _ as K, a as q, c as J, d as Y, f as ae, g as oe, h as se, i as ce, l as le, m as ue, n as de, o as fe, p as X, r as pe, s as Z, t as me, u as he,
|
|
3
|
+
import { _ as K, a as q, c as J, d as Y, f as ae, g as oe, h as se, i as ce, l as le, m as ue, n as de, o as fe, p as X, r as pe, s as Z, t as me, u as he, y as ge } from "./dialog-controller.js";
|
|
4
4
|
import { $ as _e, A as ve, B as ye, C as be, Ct as xe, D as Se, E as Ce, F as we, G as Te, H as Ee, I as De, J as Oe, K as ke, L as Ae, M as je, N as Q, O as Me, P as Ne, Q as Pe, R as Fe, S as Ie, St as Le, T as Re, Tt as ze, U as Be, V as Ve, W as He, X as Ue, Y as We, Z as Ge, _ as Ke, _t as qe, a as Je, at as Ye, b as Xe, bt as Ze, c as Qe, ct as $e, d as et, dt as tt, et as nt, f as rt, ft as it, g as at, gt as ot, h as st, ht as ct, i as lt, it as ut, j as dt, k as ft, l as pt, lt as mt, m as ht, mt as gt, n as _t, nt as vt, o as yt, ot as bt, p as xt, pt as St, q as Ct, r as wt, rt as Tt, s as Et, st as Dt, t as Ot, tt as kt, u as At, ut as jt, v as Mt, vt as Nt, w as Pt, wt as Ft, x as It, xt as Lt, y as Rt, yt as zt, z as Bt } from "./ui-icon-element.js";
|
|
5
5
|
var $ = class extends Event {
|
|
6
6
|
context;
|
package/dist/register-all2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as e, l as t, s as n, u as r } from "./uid.js";
|
|
2
|
-
import { a as i, c as a, d as o, i as s, n as c, o as l, r as ee, s as te, t as u,
|
|
2
|
+
import { a as i, c as a, d as o, i as s, n as c, o as l, r as ee, s as te, t as u, y as d } from "./dialog-controller.js";
|
|
3
3
|
function f(t) {
|
|
4
4
|
let n = e();
|
|
5
5
|
r(null);
|
|
@@ -2,17 +2,17 @@ export interface DragOptions {
|
|
|
2
2
|
selector: string;
|
|
3
3
|
dropZoneSelector?: string;
|
|
4
4
|
axis?: 'vertical' | 'horizontal' | 'both';
|
|
5
|
-
mode?: 'drop' | 'slot';
|
|
5
|
+
mode?: 'drop' | 'slot' | 'preview';
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
}
|
|
8
|
-
/** Enables pointer-driven drag-and-drop with drop
|
|
8
|
+
/** Enables pointer-driven drag-and-drop with drop, slot, or preview reordering. */
|
|
9
9
|
export declare class DragController {
|
|
10
10
|
#private;
|
|
11
11
|
readonly host: HTMLElement;
|
|
12
12
|
selector: string;
|
|
13
13
|
dropZoneSelector: string;
|
|
14
14
|
axis: 'vertical' | 'horizontal' | 'both';
|
|
15
|
-
mode: 'drop' | 'slot';
|
|
15
|
+
mode: 'drop' | 'slot' | 'preview';
|
|
16
16
|
disabled: boolean;
|
|
17
17
|
constructor(host: HTMLElement, options: DragOptions);
|
|
18
18
|
attach(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-controller.d.ts","sourceRoot":"","sources":["../../src/traits/drag-controller.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"drag-controller.d.ts","sourceRoot":"","sources":["../../src/traits/drag-controller.ts"],"names":[],"mappings":"AAAA,MAAM,WAA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AAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CAC1C;AAED,wGAAwG;AACxG,qBAAa,sBAAsB;;IACjC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,CAAgB;IAEzD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,eAAe,GAAG,cAAc,GAAG,cAAc,CAAC;IAC5D,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;gBAKtD,IAAI,EAAE,WAAW,EAAE,OAAO,GAAE,mBAAwB;IAuDhE,MAAM,IAAI,IAAI;IAMd,MAAM,IAAI,IAAI;IAMd,OAAO,IAAI,IAAI;IAKf,8EAA8E;IAC9E,IAAI,WAAW,IAAI,qBAAqB,CAEvC;CAOF"}
|
package/dist/traits.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as r, r as i, t as a } from "./uid.js";
|
|
2
2
|
import { A as o, B as s, C as c, D as l, E as u, F as d, G as f, H as p, I as m, L as h, M as g, N as _, O as v, P as y, R as b, S as x, T as S, U as C, V as w, W as T, _ as E, a as D, b as O, c as k, d as A, f as j, g as M, h as N, i as P, j as F, k as I, l as L, m as R, n as z, o as B, p as V, r as H, s as U, t as W, u as G, v as K, w as q, x as J, y as Y, z as X } from "./register-all2.js";
|
|
3
|
-
import { _ as Z, a as Q, c as $, d as ee, g as te, h as ne, i as re, l as ie, m as ae, n as oe, o as se, p as ce, r as le, s as ue, t as de, u as fe,
|
|
3
|
+
import { _ as Z, a as Q, c as $, d as ee, g as te, h as ne, i as re, l as ie, m as ae, n as oe, o as se, p as ce, r as le, s as ue, t as de, u as fe, y as pe } from "./dialog-controller.js";
|
|
4
4
|
export { d as ClipboardController, l as CollapsibleController, _ as CopyController, de as DialogController, re as DismissController, ie as DismissStack, $ as DragController, F as DropZoneController, m as EditController, v as FocusTrapController, y as HoverController, g as IntersectController, oe as ListNavigateController, le as PopoverController, se as PressController, w as RangeSelectController, ue as ResizeController, Q as RovingFocusController, b as SearchController, X as SelectionController, o as SortController, h as SwipeController, u as ToastController, fe as ToastManager, ce as UIElement, I as ValidateController, s as VirtualScrollController, i as batch, P as clippableAdapter, E as collapsibleAdapter, ae as collectTraitOptions, e as computed, c as copyableAdapter, p as debugReactive, n as define, A as dialogableAdapter, N as dismissableAdapter, G as draggableAdapter, J as droppableAdapter, z as editableAdapter, t as effect, K as focusTrappableAdapter, te as getRegisteredTraitNames, Z as getTrait, ee as getTraitRuntime, q as hoverableAdapter, x as intersectableAdapter, C as isComputed, T as isSignal, j as listNavigableAdapter, ne as parseTraitAttribute, V as popoverableAdapter, S as pressableAdapter, L as rangeSelectableAdapter, W as registerAllTraits, pe as registerTrait, k as resizableAdapter, M as rovingFocusableAdapter, D as searchableAdapter, B as selectableAdapter, r as signal, O as sortableAdapter, H as swipeableAdapter, R as toastableAdapter, a as uid, f as untrack, Y as validatableAdapter, U as virtualizableAdapter };
|