@nonoun/native-ui 0.2.1 → 0.2.2
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/custom-elements.json +3015 -3015
- package/dist/dialog-controller.js +18 -15
- package/dist/traits/drag-controller.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -332,7 +332,7 @@ var _ = class {
|
|
|
332
332
|
y: e.clientY
|
|
333
333
|
}
|
|
334
334
|
}));
|
|
335
|
-
let r = this.#m();
|
|
335
|
+
let r = this.#m().filter((e) => e !== this.#t);
|
|
336
336
|
if (this.mode === "slot") {
|
|
337
337
|
let t = e.clientX + this.#a, n = e.clientY + this.#o, i = r.filter((e) => e !== this.#e), a = 0;
|
|
338
338
|
for (let e = 0; e < i.length; e++) {
|
|
@@ -390,27 +390,30 @@ var _ = class {
|
|
|
390
390
|
#S(e, t, n) {
|
|
391
391
|
let r = e.filter((e) => e !== this.#e);
|
|
392
392
|
if (r.length === 0) return;
|
|
393
|
-
let i = 0, a =
|
|
394
|
-
for (let
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
let
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
d ? d.before(this.#e) : r[r.length - 1].after(this.#e), this.host.dispatchEvent(new CustomEvent("ui-drag-over", {
|
|
393
|
+
let i = e[0].getBoundingClientRect(), a = 1;
|
|
394
|
+
for (let t = 1; t < e.length && Math.abs(e[t].getBoundingClientRect().top - i.top) < i.height * .5; t++) a = t + 1;
|
|
395
|
+
let o = a > 1 ? e[1].getBoundingClientRect().left - i.left : i.width, s = a < e.length ? e[a].getBoundingClientRect().top - i.top : i.height, c = Math.round((t - (i.left + i.width / 2)) / o), l = Math.round((n - (i.top + i.height / 2)) / s), u = Math.ceil(r.length / a) - 1, d = Math.max(0, Math.min(c, a - 1)), f = Math.max(0, Math.min(l, u)) * a + d;
|
|
396
|
+
if (f = Math.max(0, Math.min(f, r.length)), f === this.#f) return;
|
|
397
|
+
this.#f = f;
|
|
398
|
+
let p = f < r.length ? r[f] : null, m = () => {
|
|
399
|
+
p ? p.before(this.#e) : r[r.length - 1].after(this.#e);
|
|
400
|
+
};
|
|
401
|
+
typeof document.startViewTransition == "function" ? document.startViewTransition(m) : m(), this.host.dispatchEvent(new CustomEvent("ui-drag-over", {
|
|
403
402
|
bubbles: !0,
|
|
404
403
|
composed: !0,
|
|
405
404
|
detail: {
|
|
406
405
|
item: this.#e,
|
|
407
|
-
index:
|
|
408
|
-
insertBefore:
|
|
406
|
+
index: f,
|
|
407
|
+
insertBefore: p
|
|
409
408
|
}
|
|
410
409
|
}));
|
|
411
410
|
}
|
|
412
411
|
#C() {
|
|
413
|
-
this.mode !== "preview" || !this.#e || !this.#u
|
|
412
|
+
if (this.mode !== "preview" || !this.#e || !this.#u) return;
|
|
413
|
+
let e = this.#e, t = this.#d, n = this.#u, r = () => {
|
|
414
|
+
t && t.isConnected ? t.before(e) : n.appendChild(e);
|
|
415
|
+
};
|
|
416
|
+
typeof document.startViewTransition == "function" ? document.startViewTransition(r) : r();
|
|
414
417
|
}
|
|
415
418
|
#w = (e) => {
|
|
416
419
|
if (this.#e) {
|
|
@@ -470,7 +473,7 @@ var _ = class {
|
|
|
470
473
|
#D(e) {
|
|
471
474
|
if (!this.#e) return;
|
|
472
475
|
let t = this.#e.getBoundingClientRect(), n = this.#e.cloneNode(!0);
|
|
473
|
-
n.setAttribute("popover", "manual"), n.setAttribute("aria-hidden", "true"),
|
|
476
|
+
n.setAttribute("popover", "manual"), n.setAttribute("aria-hidden", "true"), document.body.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;
|
|
474
477
|
}
|
|
475
478
|
#O() {
|
|
476
479
|
if (this.#t) {
|
|
@@ -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,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,mFAAmF;AACnF,qBAAa,cAAc;;IACzB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IACzC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;gBAkBN,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW;IAUnD,MAAM,IAAI,IAAI;IAQd,MAAM,IAAI,IAAI;IASd,OAAO,IAAI,IAAI;
|
|
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,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,mFAAmF;AACnF,qBAAa,cAAc;;IACzB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IACzC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;gBAkBN,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW;IAUnD,MAAM,IAAI,IAAI;IAQd,MAAM,IAAI,IAAI;IASd,OAAO,IAAI,IAAI;CA8fhB"}
|
package/package.json
CHANGED