@ryanhelsing/ry-ui 1.0.4 → 1.0.6
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/AGENT.md +31 -1
- package/README.md +11 -0
- package/dist/components/ry-card.d.ts +17 -0
- package/dist/components/ry-card.d.ts.map +1 -0
- package/dist/components/ry-combobox.d.ts +25 -0
- package/dist/components/ry-combobox.d.ts.map +1 -0
- package/dist/core/ry-transform.d.ts.map +1 -1
- package/dist/css/ry-structure.css +142 -12
- package/dist/css/ry-theme.css +101 -12
- package/dist/css/ry-ui.css +243 -24
- package/dist/ry-ui.d.ts +2 -0
- package/dist/ry-ui.d.ts.map +1 -1
- package/dist/ry-ui.js +611 -390
- package/dist/ry-ui.js.map +1 -1
- package/docs/components/layout.md +26 -1
- package/package.json +1 -1
package/dist/ry-ui.js
CHANGED
|
@@ -147,7 +147,8 @@ const H = [
|
|
|
147
147
|
"feature-grid",
|
|
148
148
|
"pricing",
|
|
149
149
|
"pricing-card",
|
|
150
|
-
"carousel"
|
|
150
|
+
"carousel",
|
|
151
|
+
"combobox"
|
|
151
152
|
], B = new RegExp(
|
|
152
153
|
`<(/?)(${H.join("|")})(\\s|>|/)`,
|
|
153
154
|
"g"
|
|
@@ -412,7 +413,7 @@ customElements.get("ry-menu") || customElements.define("ry-menu", class extends
|
|
|
412
413
|
});
|
|
413
414
|
customElements.get("ry-menu-item") || customElements.define("ry-menu-item", class extends HTMLElement {
|
|
414
415
|
});
|
|
415
|
-
class
|
|
416
|
+
class O extends u {
|
|
416
417
|
setup() {
|
|
417
418
|
this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.setAttribute("role", "button"), this.on(this, "click", this.#t), this.on(this, "keydown", this.#e);
|
|
418
419
|
}
|
|
@@ -427,8 +428,8 @@ class N extends u {
|
|
|
427
428
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
|
|
428
429
|
};
|
|
429
430
|
}
|
|
430
|
-
customElements.define("ry-button",
|
|
431
|
-
class
|
|
431
|
+
customElements.define("ry-button", O);
|
|
432
|
+
class N extends u {
|
|
432
433
|
static get observedAttributes() {
|
|
433
434
|
return ["value"];
|
|
434
435
|
}
|
|
@@ -457,7 +458,7 @@ class O extends u {
|
|
|
457
458
|
e.getAttribute("value") === t ? (e.setAttribute("pressed", ""), e.setAttribute("aria-pressed", "true")) : (e.removeAttribute("pressed"), e.removeAttribute("aria-pressed"));
|
|
458
459
|
}
|
|
459
460
|
}
|
|
460
|
-
customElements.define("ry-button-group",
|
|
461
|
+
customElements.define("ry-button-group", N);
|
|
461
462
|
class K extends u {
|
|
462
463
|
#t = null;
|
|
463
464
|
#e = !1;
|
|
@@ -465,9 +466,9 @@ class K extends u {
|
|
|
465
466
|
#s = 0;
|
|
466
467
|
setup() {
|
|
467
468
|
if (!this.hasAttribute("resizable")) return;
|
|
468
|
-
this.#
|
|
469
|
+
this.#b(), this.#t = document.createElement("div"), this.#t.setAttribute("data-ry-target", "handle"), this.#t.className = "ry-split__handle", this.#t.setAttribute("role", "separator"), this.#t.setAttribute("aria-orientation", "vertical"), this.#t.setAttribute("tabindex", "0");
|
|
469
470
|
const t = this.lastElementChild;
|
|
470
|
-
t && this.insertBefore(this.#t, t), this.on(this.#t, "mousedown", this.#
|
|
471
|
+
t && this.insertBefore(this.#t, t), this.on(this.#t, "mousedown", this.#c), this.on(this.#t, "touchstart", this.#n), this.on(this.#t, "keydown", this.#f), this.on(this.#t, "dblclick", this.#w);
|
|
471
472
|
}
|
|
472
473
|
#r() {
|
|
473
474
|
return this.lastElementChild;
|
|
@@ -480,17 +481,17 @@ class K extends u {
|
|
|
480
481
|
const t = getComputedStyle(this).getPropertyValue("--ry-split-min-width").trim();
|
|
481
482
|
return t ? parseFloat(t) : 100;
|
|
482
483
|
}
|
|
483
|
-
#
|
|
484
|
+
#l() {
|
|
484
485
|
const t = getComputedStyle(this).getPropertyValue("--ry-split-max-width").trim();
|
|
485
486
|
return t ? parseFloat(t) : this.getBoundingClientRect().width * 0.8;
|
|
486
487
|
}
|
|
487
488
|
#h(t) {
|
|
488
|
-
const e = this.#o(), s = this.#
|
|
489
|
+
const e = this.#o(), s = this.#l(), i = Math.round(Math.max(e, Math.min(s, t)));
|
|
489
490
|
this.style.setProperty("--ry-split-width", `${i}px`);
|
|
490
491
|
}
|
|
491
|
-
#
|
|
492
|
-
t.preventDefault(), this.#
|
|
493
|
-
const e = (i) => this.#
|
|
492
|
+
#c = (t) => {
|
|
493
|
+
t.preventDefault(), this.#u(t.clientX);
|
|
494
|
+
const e = (i) => this.#p(i.clientX), s = () => {
|
|
494
495
|
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", s), this.#m();
|
|
495
496
|
};
|
|
496
497
|
document.addEventListener("mousemove", e), document.addEventListener("mouseup", s);
|
|
@@ -498,32 +499,32 @@ class K extends u {
|
|
|
498
499
|
#n = (t) => {
|
|
499
500
|
const e = t.touches[0];
|
|
500
501
|
if (!e) return;
|
|
501
|
-
t.preventDefault(), this.#
|
|
502
|
+
t.preventDefault(), this.#u(e.clientX);
|
|
502
503
|
const s = (r) => {
|
|
503
504
|
const a = r.touches[0];
|
|
504
|
-
a && this.#
|
|
505
|
+
a && this.#p(a.clientX);
|
|
505
506
|
}, i = () => {
|
|
506
507
|
document.removeEventListener("touchmove", s), document.removeEventListener("touchend", i), this.#m();
|
|
507
508
|
};
|
|
508
509
|
document.addEventListener("touchmove", s, { passive: !1 }), document.addEventListener("touchend", i);
|
|
509
510
|
};
|
|
510
|
-
#
|
|
511
|
+
#u(t) {
|
|
511
512
|
this.#e = !0, this.#i = t, this.#s = this.#a(), this.setAttribute("data-ry-resizing", ""), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
512
513
|
}
|
|
513
|
-
#
|
|
514
|
+
#p(t) {
|
|
514
515
|
if (!this.#e) return;
|
|
515
516
|
const e = this.#i - t;
|
|
516
517
|
this.#h(this.#s + e);
|
|
517
518
|
}
|
|
518
519
|
#m() {
|
|
519
|
-
this.#e = !1, this.removeAttribute("data-ry-resizing"), document.body.style.cursor = "", document.body.style.userSelect = "", this.#
|
|
520
|
+
this.#e = !1, this.removeAttribute("data-ry-resizing"), document.body.style.cursor = "", document.body.style.userSelect = "", this.#d(), this.emit("resize", { width: this.#a() });
|
|
520
521
|
}
|
|
521
|
-
#
|
|
522
|
+
#f = (t) => {
|
|
522
523
|
const e = t.shiftKey ? 50 : 10;
|
|
523
524
|
let s = this.#a();
|
|
524
|
-
t.key === "ArrowLeft" ? (t.preventDefault(), this.#h(s + e), this.#
|
|
525
|
+
t.key === "ArrowLeft" ? (t.preventDefault(), this.#h(s + e), this.#d()) : t.key === "ArrowRight" ? (t.preventDefault(), this.#h(s - e), this.#d()) : t.key === "Home" ? (t.preventDefault(), this.#h(this.#o()), this.#d()) : t.key === "End" && (t.preventDefault(), this.#h(this.#l()), this.#d());
|
|
525
526
|
};
|
|
526
|
-
#
|
|
527
|
+
#w = () => {
|
|
527
528
|
this.style.removeProperty("--ry-split-width"), this.#v(), this.emit("resize", { width: this.#a() });
|
|
528
529
|
};
|
|
529
530
|
// Persistence
|
|
@@ -531,7 +532,7 @@ class K extends u {
|
|
|
531
532
|
const t = this.getAttribute("persist");
|
|
532
533
|
return t ? `ry-split:${t}` : null;
|
|
533
534
|
}
|
|
534
|
-
#
|
|
535
|
+
#d() {
|
|
535
536
|
const t = this.#g();
|
|
536
537
|
if (t)
|
|
537
538
|
try {
|
|
@@ -539,7 +540,7 @@ class K extends u {
|
|
|
539
540
|
} catch {
|
|
540
541
|
}
|
|
541
542
|
}
|
|
542
|
-
#
|
|
543
|
+
#b() {
|
|
543
544
|
const t = this.#g();
|
|
544
545
|
if (t)
|
|
545
546
|
try {
|
|
@@ -603,6 +604,20 @@ class q extends u {
|
|
|
603
604
|
}
|
|
604
605
|
customElements.define("ry-theme-toggle", q);
|
|
605
606
|
class z extends u {
|
|
607
|
+
setup() {
|
|
608
|
+
this.hasAttribute("interactive") && (this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.setAttribute("role", "link"), this.on(this, "click", this.#t), this.on(this, "keydown", this.#e));
|
|
609
|
+
}
|
|
610
|
+
#t = (t) => {
|
|
611
|
+
if (t.target.closest("a, button, ry-button")) return;
|
|
612
|
+
const s = this.getAttribute("href");
|
|
613
|
+
s && (window.location.href = s), this.emit("click", { originalEvent: t });
|
|
614
|
+
};
|
|
615
|
+
#e = (t) => {
|
|
616
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
customElements.define("ry-card", z);
|
|
620
|
+
class V extends u {
|
|
606
621
|
setup() {
|
|
607
622
|
this.#t();
|
|
608
623
|
const t = this.$("[close]");
|
|
@@ -622,7 +637,7 @@ class z extends u {
|
|
|
622
637
|
}, 200), this.emit("close");
|
|
623
638
|
}
|
|
624
639
|
}
|
|
625
|
-
customElements.define("ry-alert",
|
|
640
|
+
customElements.define("ry-alert", V);
|
|
626
641
|
class U extends u {
|
|
627
642
|
static get observedAttributes() {
|
|
628
643
|
return ["label", "error", "hint"];
|
|
@@ -677,8 +692,8 @@ class U extends u {
|
|
|
677
692
|
}
|
|
678
693
|
}
|
|
679
694
|
customElements.define("ry-field", U);
|
|
680
|
-
let
|
|
681
|
-
class
|
|
695
|
+
let W = 0;
|
|
696
|
+
class Y extends u {
|
|
682
697
|
#t = null;
|
|
683
698
|
static observedAttributes = ["checked", "disabled"];
|
|
684
699
|
setup() {
|
|
@@ -686,7 +701,7 @@ class W extends u {
|
|
|
686
701
|
}
|
|
687
702
|
#e() {
|
|
688
703
|
if (this.$('[data-ry-target="track"]')) return;
|
|
689
|
-
const t = `ry-switch-${++
|
|
704
|
+
const t = `ry-switch-${++W}`, e = this.getAttribute("name") ?? "", s = this.hasAttribute("checked"), i = this.hasAttribute("disabled"), r = this.textContent?.trim() ?? "";
|
|
690
705
|
this.innerHTML = `
|
|
691
706
|
<label data-ry-target="wrapper" class="ry-switch__wrapper" for="${t}">
|
|
692
707
|
<input
|
|
@@ -731,16 +746,16 @@ class W extends u {
|
|
|
731
746
|
this.#t && (this.#t.value = t);
|
|
732
747
|
}
|
|
733
748
|
}
|
|
734
|
-
customElements.define("ry-switch",
|
|
735
|
-
let
|
|
736
|
-
class
|
|
749
|
+
customElements.define("ry-switch", Y);
|
|
750
|
+
let X = 0;
|
|
751
|
+
class G extends u {
|
|
737
752
|
#t = null;
|
|
738
753
|
#e = null;
|
|
739
754
|
#i = null;
|
|
740
755
|
setup() {
|
|
741
|
-
this.#i = `ry-tooltip-${++
|
|
756
|
+
this.#i = `ry-tooltip-${++X}`, this.#s();
|
|
742
757
|
const t = this.firstElementChild;
|
|
743
|
-
t && (t.setAttribute("aria-describedby", this.#i), this.on(t, "mouseenter", this.#r), this.on(t, "mouseleave", this.#o), this.on(t, "focusin", this.#r), this.on(t, "focusout", this.#o)), this.on(document, "keydown", this.#
|
|
758
|
+
t && (t.setAttribute("aria-describedby", this.#i), this.on(t, "mouseenter", this.#r), this.on(t, "mouseleave", this.#o), this.on(t, "focusin", this.#r), this.on(t, "focusout", this.#o)), this.on(document, "keydown", this.#l);
|
|
744
759
|
}
|
|
745
760
|
#s() {
|
|
746
761
|
this.#e = document.createElement("div"), this.#e.id = this.#i, this.#e.setAttribute("data-ry-target", "content"), this.#e.className = "ry-tooltip__content", this.#e.setAttribute("role", "tooltip"), this.#e.textContent = this.getAttribute("content") ?? "", this.appendChild(this.#e);
|
|
@@ -757,15 +772,15 @@ class X extends u {
|
|
|
757
772
|
#o = () => {
|
|
758
773
|
this.#t && (clearTimeout(this.#t), this.#t = null), this.state = "closed";
|
|
759
774
|
};
|
|
760
|
-
#
|
|
775
|
+
#l = (t) => {
|
|
761
776
|
t.key === "Escape" && this.state === "open" && this.#o();
|
|
762
777
|
};
|
|
763
778
|
teardown() {
|
|
764
779
|
this.#t && clearTimeout(this.#t);
|
|
765
780
|
}
|
|
766
781
|
}
|
|
767
|
-
customElements.define("ry-tooltip",
|
|
768
|
-
class
|
|
782
|
+
customElements.define("ry-tooltip", G);
|
|
783
|
+
class J extends u {
|
|
769
784
|
#t = null;
|
|
770
785
|
#e = 0;
|
|
771
786
|
setup() {
|
|
@@ -810,8 +825,8 @@ class G extends u {
|
|
|
810
825
|
this.state === "open" ? this.close() : this.open();
|
|
811
826
|
}
|
|
812
827
|
}
|
|
813
|
-
customElements.define("ry-drawer",
|
|
814
|
-
const
|
|
828
|
+
customElements.define("ry-drawer", J);
|
|
829
|
+
const Z = 4e3;
|
|
815
830
|
class f extends u {
|
|
816
831
|
#t = null;
|
|
817
832
|
static observedAttributes = ["variant", "duration"];
|
|
@@ -841,7 +856,7 @@ class f extends u {
|
|
|
841
856
|
this.#s();
|
|
842
857
|
const t = this.$("[close]");
|
|
843
858
|
t && this.on(t, "click", () => this.dismiss());
|
|
844
|
-
const e = parseInt(this.getAttribute("duration") ?? String(
|
|
859
|
+
const e = parseInt(this.getAttribute("duration") ?? String(Z), 10);
|
|
845
860
|
e > 0 && (this.#t = setTimeout(() => this.dismiss(), e)), requestAnimationFrame(() => {
|
|
846
861
|
this.state = "visible";
|
|
847
862
|
});
|
|
@@ -874,7 +889,7 @@ class f extends u {
|
|
|
874
889
|
}
|
|
875
890
|
}
|
|
876
891
|
customElements.define("ry-toast", f);
|
|
877
|
-
const
|
|
892
|
+
const k = {
|
|
878
893
|
// Close / X
|
|
879
894
|
close: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18"/><path d="M6 6l12 12"/></svg>',
|
|
880
895
|
// Chevron down
|
|
@@ -945,19 +960,19 @@ const w = {
|
|
|
945
960
|
"shape-ellipse": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="12" rx="10" ry="6"/></svg>'
|
|
946
961
|
};
|
|
947
962
|
function p(h) {
|
|
948
|
-
return
|
|
963
|
+
return k[h] ?? "";
|
|
949
964
|
}
|
|
950
|
-
function
|
|
951
|
-
|
|
965
|
+
function Bt(h, t) {
|
|
966
|
+
k[h] = t;
|
|
952
967
|
}
|
|
953
|
-
function
|
|
954
|
-
Object.assign(
|
|
968
|
+
function Rt(h) {
|
|
969
|
+
Object.assign(k, h);
|
|
955
970
|
}
|
|
956
|
-
function
|
|
957
|
-
return Object.keys(
|
|
971
|
+
function Pt() {
|
|
972
|
+
return Object.keys(k);
|
|
958
973
|
}
|
|
959
|
-
let
|
|
960
|
-
class
|
|
974
|
+
let Q = 0;
|
|
975
|
+
class tt extends u {
|
|
961
976
|
#t = null;
|
|
962
977
|
#e = -1;
|
|
963
978
|
#i = "";
|
|
@@ -970,12 +985,12 @@ class Q extends u {
|
|
|
970
985
|
}
|
|
971
986
|
static observedAttributes = ["value", "disabled"];
|
|
972
987
|
setup() {
|
|
973
|
-
this.#t = `ry-select-${++
|
|
988
|
+
this.#t = `ry-select-${++Q}`, this.#o(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.on(this, "click", this.#l), this.on(this, "keydown", this.#h), this.on(document, "click", this.#c), this.#a && this.on(this, "ry:remove", this.#n), this.hasAttribute("data-ry-state") || (this.state = "closed");
|
|
974
989
|
const t = this.getAttribute("value");
|
|
975
990
|
if (t)
|
|
976
991
|
if (this.#a)
|
|
977
992
|
for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
|
|
978
|
-
this.#
|
|
993
|
+
this.#d(e);
|
|
979
994
|
else
|
|
980
995
|
this.value = t;
|
|
981
996
|
}
|
|
@@ -1033,13 +1048,13 @@ class Q extends u {
|
|
|
1033
1048
|
`;
|
|
1034
1049
|
this._options = t;
|
|
1035
1050
|
}
|
|
1036
|
-
#
|
|
1051
|
+
#l = (t) => {
|
|
1037
1052
|
if (this.hasAttribute("disabled")) return;
|
|
1038
1053
|
const e = t.target, s = e.closest('[data-ry-target="option"]');
|
|
1039
1054
|
if (s instanceof HTMLElement && !s.hasAttribute("data-disabled")) {
|
|
1040
1055
|
if (this.#a) {
|
|
1041
1056
|
const r = s.dataset.value ?? "";
|
|
1042
|
-
this.#
|
|
1057
|
+
this.#d(r);
|
|
1043
1058
|
} else
|
|
1044
1059
|
this.#$(s), this.close();
|
|
1045
1060
|
return;
|
|
@@ -1057,7 +1072,7 @@ class Q extends u {
|
|
|
1057
1072
|
if (i)
|
|
1058
1073
|
if (this.#a) {
|
|
1059
1074
|
const r = i.dataset.value ?? "";
|
|
1060
|
-
this.#
|
|
1075
|
+
this.#d(r);
|
|
1061
1076
|
} else
|
|
1062
1077
|
this.#$(i), this.close();
|
|
1063
1078
|
} else
|
|
@@ -1070,10 +1085,10 @@ class Q extends u {
|
|
|
1070
1085
|
t.preventDefault(), e ? this.#m() : this.open();
|
|
1071
1086
|
break;
|
|
1072
1087
|
case "ArrowUp":
|
|
1073
|
-
t.preventDefault(), e && this.#
|
|
1088
|
+
t.preventDefault(), e && this.#f();
|
|
1074
1089
|
break;
|
|
1075
1090
|
case "Home":
|
|
1076
|
-
e && (t.preventDefault(), this.#
|
|
1091
|
+
e && (t.preventDefault(), this.#w());
|
|
1077
1092
|
break;
|
|
1078
1093
|
case "End":
|
|
1079
1094
|
e && (t.preventDefault(), this.#g());
|
|
@@ -1081,30 +1096,30 @@ class Q extends u {
|
|
|
1081
1096
|
case "Backspace":
|
|
1082
1097
|
if (this.#a && this.#r.size > 0) {
|
|
1083
1098
|
const s = [...this.#r], i = s[s.length - 1];
|
|
1084
|
-
i && this.#
|
|
1099
|
+
i && this.#d(i);
|
|
1085
1100
|
}
|
|
1086
1101
|
break;
|
|
1087
1102
|
default:
|
|
1088
|
-
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#
|
|
1103
|
+
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#u(t.key);
|
|
1089
1104
|
break;
|
|
1090
1105
|
}
|
|
1091
1106
|
};
|
|
1092
|
-
#
|
|
1107
|
+
#c = (t) => {
|
|
1093
1108
|
const e = t.target;
|
|
1094
1109
|
!this.contains(e) && this.state === "open" && this.close();
|
|
1095
1110
|
};
|
|
1096
1111
|
#n = (t) => {
|
|
1097
1112
|
const e = t.detail.value;
|
|
1098
|
-
this.#r.has(e) && this.#
|
|
1113
|
+
this.#r.has(e) && this.#d(e);
|
|
1099
1114
|
};
|
|
1100
|
-
#
|
|
1115
|
+
#u(t) {
|
|
1101
1116
|
this.#s && clearTimeout(this.#s), this.#i += t.toLowerCase();
|
|
1102
1117
|
const e = this.$$('[data-ry-target="option"]:not([data-disabled])'), s = e.findIndex(
|
|
1103
1118
|
(i) => i.textContent?.trim().toLowerCase().startsWith(this.#i)
|
|
1104
1119
|
);
|
|
1105
1120
|
if (s >= 0) {
|
|
1106
1121
|
if (this.state === "open")
|
|
1107
|
-
this.#
|
|
1122
|
+
this.#p(s);
|
|
1108
1123
|
else if (!this.#a) {
|
|
1109
1124
|
const i = e[s];
|
|
1110
1125
|
i && this.#$(i);
|
|
@@ -1114,7 +1129,7 @@ class Q extends u {
|
|
|
1114
1129
|
this.#i = "";
|
|
1115
1130
|
}, 500);
|
|
1116
1131
|
}
|
|
1117
|
-
#
|
|
1132
|
+
#p(t) {
|
|
1118
1133
|
const e = this.$$('[data-ry-target="option"]:not([data-disabled])');
|
|
1119
1134
|
if (t < 0 || t >= e.length) return;
|
|
1120
1135
|
this.$$('[data-ry-target="option"][data-highlighted]').forEach((r) => {
|
|
@@ -1128,21 +1143,21 @@ class Q extends u {
|
|
|
1128
1143
|
}
|
|
1129
1144
|
#m() {
|
|
1130
1145
|
const t = this.$$('[data-ry-target="option"]:not([data-disabled])'), e = Math.min(this.#e + 1, t.length - 1);
|
|
1131
|
-
this.#
|
|
1146
|
+
this.#p(e);
|
|
1132
1147
|
}
|
|
1133
|
-
#
|
|
1148
|
+
#f() {
|
|
1134
1149
|
const t = Math.max(this.#e - 1, 0);
|
|
1135
|
-
this.#
|
|
1150
|
+
this.#p(t);
|
|
1136
1151
|
}
|
|
1137
|
-
#
|
|
1138
|
-
this.#
|
|
1152
|
+
#w() {
|
|
1153
|
+
this.#p(0);
|
|
1139
1154
|
}
|
|
1140
1155
|
#g() {
|
|
1141
1156
|
const t = this.$$('[data-ry-target="option"]:not([data-disabled])');
|
|
1142
|
-
this.#
|
|
1157
|
+
this.#p(t.length - 1);
|
|
1143
1158
|
}
|
|
1144
1159
|
// --- Multi-select methods ---
|
|
1145
|
-
#
|
|
1160
|
+
#d(t) {
|
|
1146
1161
|
const e = this.getAttribute("max-selections");
|
|
1147
1162
|
if (this.#r.has(t))
|
|
1148
1163
|
this.#r.delete(t);
|
|
@@ -1150,9 +1165,9 @@ class Q extends u {
|
|
|
1150
1165
|
if (e && this.#r.size >= parseInt(e, 10)) return;
|
|
1151
1166
|
this.#r.add(t);
|
|
1152
1167
|
}
|
|
1153
|
-
this.#
|
|
1168
|
+
this.#b(), this.#v(), this.#y(), this.setAttribute("value", [...this.#r].join(",")), this.emit("change", { value: this.value, label: "" });
|
|
1154
1169
|
}
|
|
1155
|
-
#
|
|
1170
|
+
#b() {
|
|
1156
1171
|
const t = this.$('[data-ry-target="tags"]'), e = this.$('[data-ry-target="value"]');
|
|
1157
1172
|
if (t) {
|
|
1158
1173
|
t.innerHTML = "";
|
|
@@ -1178,7 +1193,7 @@ class Q extends u {
|
|
|
1178
1193
|
});
|
|
1179
1194
|
}
|
|
1180
1195
|
#M() {
|
|
1181
|
-
this.#r.clear(), this.#
|
|
1196
|
+
this.#r.clear(), this.#b(), this.#v(), this.#y(), this.setAttribute("value", ""), this.emit("change", { value: "", label: "" });
|
|
1182
1197
|
}
|
|
1183
1198
|
// --- Single-select method ---
|
|
1184
1199
|
#$(t) {
|
|
@@ -1194,14 +1209,14 @@ class Q extends u {
|
|
|
1194
1209
|
this.state = "open";
|
|
1195
1210
|
const t = this.$('[data-ry-target="trigger"]');
|
|
1196
1211
|
if (t && t.setAttribute("aria-expanded", "true"), this.#I(), this.#a)
|
|
1197
|
-
this.#
|
|
1212
|
+
this.#p(0);
|
|
1198
1213
|
else {
|
|
1199
1214
|
const e = this.getAttribute("value");
|
|
1200
1215
|
if (e) {
|
|
1201
1216
|
const i = this.$$('[data-ry-target="option"]:not([data-disabled])').findIndex((r) => r.dataset.value === e);
|
|
1202
|
-
i >= 0 && this.#
|
|
1217
|
+
i >= 0 && this.#p(i);
|
|
1203
1218
|
} else
|
|
1204
|
-
this.#
|
|
1219
|
+
this.#p(0);
|
|
1205
1220
|
}
|
|
1206
1221
|
this.emit("open");
|
|
1207
1222
|
}
|
|
@@ -1231,7 +1246,7 @@ class Q extends u {
|
|
|
1231
1246
|
this.#r.clear();
|
|
1232
1247
|
for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
|
|
1233
1248
|
this.#r.add(e);
|
|
1234
|
-
this.#
|
|
1249
|
+
this.#b(), this.#v(), this.#y(), this.setAttribute("value", t);
|
|
1235
1250
|
} else {
|
|
1236
1251
|
const e = this.$(`[data-ry-target="option"][data-value="${t}"]`);
|
|
1237
1252
|
e && this.#$(e);
|
|
@@ -1244,11 +1259,215 @@ class Q extends u {
|
|
|
1244
1259
|
this.#s && clearTimeout(this.#s);
|
|
1245
1260
|
}
|
|
1246
1261
|
}
|
|
1247
|
-
class
|
|
1262
|
+
class et extends HTMLElement {
|
|
1263
|
+
}
|
|
1264
|
+
customElements.define("ry-option", et);
|
|
1265
|
+
customElements.define("ry-select", tt);
|
|
1266
|
+
let st = 0;
|
|
1267
|
+
class it extends u {
|
|
1268
|
+
#t = null;
|
|
1269
|
+
#e = -1;
|
|
1270
|
+
#i = [];
|
|
1271
|
+
static observedAttributes = ["value", "disabled"];
|
|
1272
|
+
setup() {
|
|
1273
|
+
this.#t = `ry-combobox-${++st}`, this.#s();
|
|
1274
|
+
const t = this.$('[data-ry-target="input"]');
|
|
1275
|
+
t && (this.on(t, "input", this.#r), this.on(t, "focus", this.#c)), this.on(this, "click", this.#o), this.on(this, "keydown", this.#l), this.on(document, "click", this.#h), this.hasAttribute("data-ry-state") || (this.state = "closed");
|
|
1276
|
+
const e = this.getAttribute("value");
|
|
1277
|
+
e && (this.value = e);
|
|
1278
|
+
}
|
|
1279
|
+
#s() {
|
|
1280
|
+
const t = [...this.querySelectorAll("ry-option")].map((n) => ({
|
|
1281
|
+
value: n.getAttribute("value") ?? n.textContent?.trim() ?? "",
|
|
1282
|
+
label: n.textContent?.trim() ?? "",
|
|
1283
|
+
disabled: n.hasAttribute("disabled")
|
|
1284
|
+
})), e = this.getAttribute("placeholder") ?? "Search...", s = this.getAttribute("name") ?? "", i = this.hasAttribute("disabled"), r = t.map(
|
|
1285
|
+
(n) => `<option value="${n.value}"${n.disabled ? " disabled" : ""}>${n.label}</option>`
|
|
1286
|
+
).join(""), a = t.map((n, o) => `
|
|
1287
|
+
<div data-ry-target="option" class="ry-combobox__option"
|
|
1288
|
+
role="option"
|
|
1289
|
+
id="${this.#t}-option-${o}"
|
|
1290
|
+
data-value="${n.value}"
|
|
1291
|
+
${n.disabled ? "data-disabled" : ""}
|
|
1292
|
+
aria-disabled="${n.disabled}">
|
|
1293
|
+
${n.label}
|
|
1294
|
+
</div>
|
|
1295
|
+
`).join("");
|
|
1296
|
+
this.innerHTML = `
|
|
1297
|
+
<div data-ry-target="input-wrapper" class="ry-combobox__input-wrapper"
|
|
1298
|
+
role="combobox"
|
|
1299
|
+
aria-expanded="false"
|
|
1300
|
+
aria-haspopup="listbox"
|
|
1301
|
+
aria-owns="${this.#t}-listbox">
|
|
1302
|
+
<input data-ry-target="input" class="ry-combobox__input"
|
|
1303
|
+
type="text"
|
|
1304
|
+
placeholder="${e}"
|
|
1305
|
+
autocomplete="off"
|
|
1306
|
+
aria-autocomplete="list"
|
|
1307
|
+
aria-controls="${this.#t}-listbox"
|
|
1308
|
+
${i ? "disabled" : ""}>
|
|
1309
|
+
<span data-ry-target="arrow" class="ry-combobox__arrow">▾</span>
|
|
1310
|
+
</div>
|
|
1311
|
+
<div data-ry-target="dropdown" class="ry-combobox__dropdown"
|
|
1312
|
+
role="listbox"
|
|
1313
|
+
id="${this.#t}-listbox"
|
|
1314
|
+
tabindex="-1">
|
|
1315
|
+
${a}
|
|
1316
|
+
<div data-ry-target="empty" class="ry-combobox__empty" hidden>
|
|
1317
|
+
No results
|
|
1318
|
+
</div>
|
|
1319
|
+
</div>
|
|
1320
|
+
<select data-ry-target="native" class="ry-combobox__native"
|
|
1321
|
+
${s ? `name="${s}"` : ""}
|
|
1322
|
+
tabindex="-1" aria-hidden="true"
|
|
1323
|
+
${i ? "disabled" : ""}>
|
|
1324
|
+
<option value="">${e}</option>
|
|
1325
|
+
${r}
|
|
1326
|
+
</select>
|
|
1327
|
+
`, this.#i = t;
|
|
1328
|
+
}
|
|
1329
|
+
#r = () => {
|
|
1330
|
+
const t = this.$('[data-ry-target="input"]');
|
|
1331
|
+
if (!t) return;
|
|
1332
|
+
const e = t.value.trim();
|
|
1333
|
+
this.#a(e), this.state !== "open" && this.open(), this.emit("input", { value: e });
|
|
1334
|
+
};
|
|
1335
|
+
#a(t) {
|
|
1336
|
+
const e = this.$$('[data-ry-target="option"]'), s = t.toLowerCase();
|
|
1337
|
+
let i = 0;
|
|
1338
|
+
e.forEach((a) => {
|
|
1339
|
+
const n = a.textContent?.trim().toLowerCase() ?? "";
|
|
1340
|
+
(!t || n.includes(s)) && !a.hasAttribute("data-disabled") ? (a.removeAttribute("hidden"), i++) : a.setAttribute("hidden", "");
|
|
1341
|
+
});
|
|
1342
|
+
const r = this.$('[data-ry-target="empty"]');
|
|
1343
|
+
r && (i === 0 ? r.removeAttribute("hidden") : r.setAttribute("hidden", "")), this.#e = -1, this.$$('[data-ry-target="option"][data-highlighted]').forEach((a) => {
|
|
1344
|
+
a.removeAttribute("data-highlighted");
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
#o = (t) => {
|
|
1348
|
+
if (this.hasAttribute("disabled")) return;
|
|
1349
|
+
const e = t.target, s = e.closest('[data-ry-target="option"]');
|
|
1350
|
+
if (s instanceof HTMLElement && !s.hasAttribute("data-disabled")) {
|
|
1351
|
+
this.#n(s);
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
if (e.closest('[data-ry-target="arrow"]')) {
|
|
1355
|
+
this.toggle();
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
#l = (t) => {
|
|
1360
|
+
if (this.hasAttribute("disabled")) return;
|
|
1361
|
+
const e = this.state === "open";
|
|
1362
|
+
switch (t.key) {
|
|
1363
|
+
case "ArrowDown":
|
|
1364
|
+
t.preventDefault(), e ? this.#p() : this.open();
|
|
1365
|
+
break;
|
|
1366
|
+
case "ArrowUp":
|
|
1367
|
+
t.preventDefault(), e && this.#m();
|
|
1368
|
+
break;
|
|
1369
|
+
case "Enter":
|
|
1370
|
+
if (e && this.#e >= 0) {
|
|
1371
|
+
t.preventDefault();
|
|
1372
|
+
const i = this.$$(
|
|
1373
|
+
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1374
|
+
)[this.#e];
|
|
1375
|
+
i && this.#n(i);
|
|
1376
|
+
}
|
|
1377
|
+
break;
|
|
1378
|
+
case "Escape":
|
|
1379
|
+
e && (t.preventDefault(), this.close());
|
|
1380
|
+
break;
|
|
1381
|
+
case "Tab":
|
|
1382
|
+
e && this.close();
|
|
1383
|
+
break;
|
|
1384
|
+
}
|
|
1385
|
+
};
|
|
1386
|
+
#h = (t) => {
|
|
1387
|
+
const e = t.target;
|
|
1388
|
+
!this.contains(e) && this.state === "open" && this.close();
|
|
1389
|
+
};
|
|
1390
|
+
#c = () => {
|
|
1391
|
+
if (this.hasAttribute("disabled")) return;
|
|
1392
|
+
const t = this.$('[data-ry-target="input"]');
|
|
1393
|
+
t && t.value && t.select(), this.open();
|
|
1394
|
+
};
|
|
1395
|
+
#n(t) {
|
|
1396
|
+
const e = t.dataset.value ?? "", s = t.textContent?.trim() ?? "", i = this.$('[data-ry-target="input"]');
|
|
1397
|
+
i && (i.value = s);
|
|
1398
|
+
const r = this.$('[data-ry-target="native"]');
|
|
1399
|
+
r && (r.value = e), this.setAttribute("value", e), this.$$('[data-ry-target="option"]').forEach((a) => {
|
|
1400
|
+
a.removeAttribute("aria-selected");
|
|
1401
|
+
}), t.setAttribute("aria-selected", "true"), this.close(), this.emit("change", { value: e, label: s });
|
|
1402
|
+
}
|
|
1403
|
+
#u(t) {
|
|
1404
|
+
const e = this.$$(
|
|
1405
|
+
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1406
|
+
);
|
|
1407
|
+
if (t < 0 || t >= e.length) return;
|
|
1408
|
+
this.$$('[data-ry-target="option"][data-highlighted]').forEach((r) => {
|
|
1409
|
+
r.removeAttribute("data-highlighted");
|
|
1410
|
+
});
|
|
1411
|
+
const s = e[t];
|
|
1412
|
+
if (!s) return;
|
|
1413
|
+
s.setAttribute("data-highlighted", ""), s.scrollIntoView({ block: "nearest" }), this.#e = t;
|
|
1414
|
+
const i = this.$('[data-ry-target="input-wrapper"]');
|
|
1415
|
+
i && i.setAttribute("aria-activedescendant", s.id);
|
|
1416
|
+
}
|
|
1417
|
+
#p() {
|
|
1418
|
+
const t = this.$$('[data-ry-target="option"]:not([hidden]):not([data-disabled])'), e = Math.min(this.#e + 1, t.length - 1);
|
|
1419
|
+
this.#u(e);
|
|
1420
|
+
}
|
|
1421
|
+
#m() {
|
|
1422
|
+
const t = Math.max(this.#e - 1, 0);
|
|
1423
|
+
this.#u(t);
|
|
1424
|
+
}
|
|
1425
|
+
#f() {
|
|
1426
|
+
const t = this.$('[data-ry-target="dropdown"]');
|
|
1427
|
+
if (!t) return;
|
|
1428
|
+
this.removeAttribute("data-ry-position");
|
|
1429
|
+
const e = this.getBoundingClientRect(), s = t.scrollHeight || 240, i = window.innerHeight - e.bottom, r = e.top;
|
|
1430
|
+
i < s && r > i && this.setAttribute("data-ry-position", "top");
|
|
1431
|
+
}
|
|
1432
|
+
open() {
|
|
1433
|
+
if (this.state === "open") return;
|
|
1434
|
+
this.state = "open";
|
|
1435
|
+
const t = this.$('[data-ry-target="input-wrapper"]');
|
|
1436
|
+
t && t.setAttribute("aria-expanded", "true"), this.$$('[data-ry-target="option"]').forEach((i) => {
|
|
1437
|
+
i.hasAttribute("data-disabled") || i.removeAttribute("hidden");
|
|
1438
|
+
});
|
|
1439
|
+
const e = this.$('[data-ry-target="empty"]');
|
|
1440
|
+
e && e.setAttribute("hidden", ""), this.#f();
|
|
1441
|
+
const s = this.getAttribute("value");
|
|
1442
|
+
if (s) {
|
|
1443
|
+
const r = this.$$(
|
|
1444
|
+
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1445
|
+
).findIndex((a) => a.dataset.value === s);
|
|
1446
|
+
r >= 0 && this.#u(r);
|
|
1447
|
+
}
|
|
1448
|
+
this.emit("open");
|
|
1449
|
+
}
|
|
1450
|
+
close() {
|
|
1451
|
+
if (this.state === "closed") return;
|
|
1452
|
+
this.state = "closed";
|
|
1453
|
+
const t = this.$('[data-ry-target="input-wrapper"]');
|
|
1454
|
+
t && (t.setAttribute("aria-expanded", "false"), t.removeAttribute("aria-activedescendant")), this.$$('[data-ry-target="option"][data-highlighted]').forEach((e) => {
|
|
1455
|
+
e.removeAttribute("data-highlighted");
|
|
1456
|
+
}), this.#e = -1, this.emit("close");
|
|
1457
|
+
}
|
|
1458
|
+
toggle() {
|
|
1459
|
+
this.state === "open" ? this.close() : this.open();
|
|
1460
|
+
}
|
|
1461
|
+
get value() {
|
|
1462
|
+
return this.getAttribute("value") ?? "";
|
|
1463
|
+
}
|
|
1464
|
+
set value(t) {
|
|
1465
|
+
const e = this.$(`[data-ry-target="option"][data-value="${t}"]`);
|
|
1466
|
+
e && this.#n(e);
|
|
1467
|
+
}
|
|
1248
1468
|
}
|
|
1249
|
-
customElements.define("ry-
|
|
1250
|
-
|
|
1251
|
-
class et extends u {
|
|
1469
|
+
customElements.define("ry-combobox", it);
|
|
1470
|
+
class rt extends u {
|
|
1252
1471
|
#t = "";
|
|
1253
1472
|
static get observedAttributes() {
|
|
1254
1473
|
return ["language", "title", "line-numbers"];
|
|
@@ -1295,9 +1514,9 @@ class et extends u {
|
|
|
1295
1514
|
case "html":
|
|
1296
1515
|
return this.#o(t);
|
|
1297
1516
|
case "json":
|
|
1298
|
-
return this.#
|
|
1517
|
+
return this.#l(t);
|
|
1299
1518
|
default:
|
|
1300
|
-
return this.#
|
|
1519
|
+
return this.#c(t);
|
|
1301
1520
|
}
|
|
1302
1521
|
}
|
|
1303
1522
|
#r(t) {
|
|
@@ -1305,9 +1524,9 @@ class et extends u {
|
|
|
1305
1524
|
let s = t;
|
|
1306
1525
|
for (; s.length > 0; ) {
|
|
1307
1526
|
if (s.startsWith("/*")) {
|
|
1308
|
-
const
|
|
1309
|
-
if (
|
|
1310
|
-
e.push({ type: "comment", value: s.slice(0,
|
|
1527
|
+
const b = s.indexOf("*/");
|
|
1528
|
+
if (b !== -1) {
|
|
1529
|
+
e.push({ type: "comment", value: s.slice(0, b + 2) }), s = s.slice(b + 2);
|
|
1311
1530
|
continue;
|
|
1312
1531
|
}
|
|
1313
1532
|
}
|
|
@@ -1353,12 +1572,12 @@ class et extends u {
|
|
|
1353
1572
|
}
|
|
1354
1573
|
const g = s.match(/^([\w-]+)/);
|
|
1355
1574
|
if (g?.[1]) {
|
|
1356
|
-
const
|
|
1357
|
-
["inherit", "initial", "unset", "none", "auto", "transparent", "solid", "dashed", "dotted", "flex", "grid", "block", "inline", "inline-block", "absolute", "relative", "fixed", "sticky"].includes(
|
|
1575
|
+
const b = g[1];
|
|
1576
|
+
["inherit", "initial", "unset", "none", "auto", "transparent", "solid", "dashed", "dotted", "flex", "grid", "block", "inline", "inline-block", "absolute", "relative", "fixed", "sticky"].includes(b) ? e.push({ type: "keyword", value: b }) : e.push({ type: "value", value: b }), s = s.slice(b.length);
|
|
1358
1577
|
continue;
|
|
1359
1578
|
}
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1579
|
+
const y = s[0];
|
|
1580
|
+
y && e.push({ type: "text", value: y }), s = s.slice(1);
|
|
1362
1581
|
}
|
|
1363
1582
|
return e.map((i) => this.#h(i)).join("");
|
|
1364
1583
|
}
|
|
@@ -1462,7 +1681,7 @@ class et extends u {
|
|
|
1462
1681
|
}
|
|
1463
1682
|
return e.map((i) => this.#h(i)).join("");
|
|
1464
1683
|
}
|
|
1465
|
-
#
|
|
1684
|
+
#l(t) {
|
|
1466
1685
|
const e = [];
|
|
1467
1686
|
let s = t;
|
|
1468
1687
|
for (; s.length > 0; ) {
|
|
@@ -1497,7 +1716,7 @@ class et extends u {
|
|
|
1497
1716
|
return e.map((i) => this.#h(i)).join("");
|
|
1498
1717
|
}
|
|
1499
1718
|
#h(t) {
|
|
1500
|
-
const e = this.#
|
|
1719
|
+
const e = this.#c(t.value);
|
|
1501
1720
|
switch (t.type) {
|
|
1502
1721
|
case "keyword":
|
|
1503
1722
|
return `<span class="ry-code__keyword">${e}</span>`;
|
|
@@ -1525,7 +1744,7 @@ class et extends u {
|
|
|
1525
1744
|
return e;
|
|
1526
1745
|
}
|
|
1527
1746
|
}
|
|
1528
|
-
#
|
|
1747
|
+
#c(t) {
|
|
1529
1748
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1530
1749
|
}
|
|
1531
1750
|
#n(t) {
|
|
@@ -1547,8 +1766,8 @@ class et extends u {
|
|
|
1547
1766
|
this.#t = t, this.#e();
|
|
1548
1767
|
}
|
|
1549
1768
|
}
|
|
1550
|
-
customElements.define("ry-code",
|
|
1551
|
-
class
|
|
1769
|
+
customElements.define("ry-code", rt);
|
|
1770
|
+
class at extends u {
|
|
1552
1771
|
setup() {
|
|
1553
1772
|
const t = this.$("template");
|
|
1554
1773
|
if (!t) return;
|
|
@@ -1592,8 +1811,8 @@ class st extends u {
|
|
|
1592
1811
|
`).trim();
|
|
1593
1812
|
}
|
|
1594
1813
|
}
|
|
1595
|
-
customElements.define("ry-example",
|
|
1596
|
-
class
|
|
1814
|
+
customElements.define("ry-example", at);
|
|
1815
|
+
class nt extends u {
|
|
1597
1816
|
static get observedAttributes() {
|
|
1598
1817
|
return ["name", "size", "label"];
|
|
1599
1818
|
}
|
|
@@ -1626,24 +1845,24 @@ class it extends u {
|
|
|
1626
1845
|
this.setAttribute("size", String(t));
|
|
1627
1846
|
}
|
|
1628
1847
|
}
|
|
1629
|
-
customElements.define("ry-icon",
|
|
1630
|
-
const
|
|
1631
|
-
function
|
|
1848
|
+
customElements.define("ry-icon", nt);
|
|
1849
|
+
const ot = ["form", "section", "fieldset", "ry-section"], m = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Set();
|
|
1850
|
+
function ht(h) {
|
|
1632
1851
|
let t = h.parentElement;
|
|
1633
1852
|
for (; t; ) {
|
|
1634
|
-
if (
|
|
1853
|
+
if (ot.some((e) => t.matches(e)))
|
|
1635
1854
|
return t;
|
|
1636
1855
|
t = t.parentElement;
|
|
1637
1856
|
}
|
|
1638
1857
|
return null;
|
|
1639
1858
|
}
|
|
1640
|
-
function
|
|
1859
|
+
function lt(h) {
|
|
1641
1860
|
if (E.has(h)) return;
|
|
1642
1861
|
const t = m.get(h);
|
|
1643
1862
|
if (!t || t.size < 2) return;
|
|
1644
1863
|
const e = /* @__PURE__ */ new Map();
|
|
1645
1864
|
for (const s of t) {
|
|
1646
|
-
const i =
|
|
1865
|
+
const i = ht(s), r = e.get(i) ?? [];
|
|
1647
1866
|
r.push(s), e.set(i, r);
|
|
1648
1867
|
}
|
|
1649
1868
|
if (e.size > 1) {
|
|
@@ -1659,7 +1878,7 @@ function nt(h) {
|
|
|
1659
1878
|
), E.add(h);
|
|
1660
1879
|
}
|
|
1661
1880
|
}
|
|
1662
|
-
class
|
|
1881
|
+
class ct extends u {
|
|
1663
1882
|
static observedAttributes = ["pressed", "disabled", "name", "value"];
|
|
1664
1883
|
#t = !1;
|
|
1665
1884
|
setup() {
|
|
@@ -1670,7 +1889,7 @@ class ot extends u {
|
|
|
1670
1889
|
}
|
|
1671
1890
|
#e() {
|
|
1672
1891
|
const t = this.name;
|
|
1673
|
-
t && (m.has(t) || m.set(t, /* @__PURE__ */ new Set()), m.get(t).add(this), this.#t = !0, queueMicrotask(() =>
|
|
1892
|
+
t && (m.has(t) || m.set(t, /* @__PURE__ */ new Set()), m.get(t).add(this), this.#t = !0, queueMicrotask(() => lt(t)));
|
|
1674
1893
|
}
|
|
1675
1894
|
#i() {
|
|
1676
1895
|
if (!this.#t) return;
|
|
@@ -1731,8 +1950,8 @@ class ot extends u {
|
|
|
1731
1950
|
this.setAttribute("icon", t);
|
|
1732
1951
|
}
|
|
1733
1952
|
}
|
|
1734
|
-
customElements.define("ry-toggle-button",
|
|
1735
|
-
class
|
|
1953
|
+
customElements.define("ry-toggle-button", ct);
|
|
1954
|
+
class dt extends u {
|
|
1736
1955
|
#t = !1;
|
|
1737
1956
|
#e = null;
|
|
1738
1957
|
#i = null;
|
|
@@ -1741,7 +1960,7 @@ class ht extends u {
|
|
|
1741
1960
|
#a = /* @__PURE__ */ new Map();
|
|
1742
1961
|
static observedAttributes = ["min", "max", "step", "value", "start", "end", "disabled"];
|
|
1743
1962
|
setup() {
|
|
1744
|
-
this.#o(), this.#h(), this.#
|
|
1963
|
+
this.#o(), this.#h(), this.#b();
|
|
1745
1964
|
}
|
|
1746
1965
|
#o() {
|
|
1747
1966
|
const t = this.hasAttribute("range"), e = this.hasAttribute("labeled"), s = this.hasAttribute("tooltip");
|
|
@@ -1761,9 +1980,9 @@ class ht extends u {
|
|
|
1761
1980
|
<div data-ry-target="thumb-value" class="ry-slider__thumb" tabindex="0" role="slider" aria-label="Value">
|
|
1762
1981
|
${s ? '<span data-ry-target="tooltip-value" class="ry-slider__tooltip"></span>' : ""}
|
|
1763
1982
|
</div>
|
|
1764
|
-
`, i += "</div>", e && (i += this.#
|
|
1983
|
+
`, i += "</div>", e && (i += this.#l()), this.innerHTML = i, this.#i = this.$('[data-ry-target="track"]'), this.#s = this.$('[data-ry-target="fill"]'), t ? (this.#r.set("start", this.$('[data-ry-target="thumb-start"]')), this.#r.set("end", this.$('[data-ry-target="thumb-end"]')), s && (this.#a.set("start", this.$('[data-ry-target="tooltip-start"]')), this.#a.set("end", this.$('[data-ry-target="tooltip-end"]')))) : (this.#r.set("value", this.$('[data-ry-target="thumb-value"]')), s && this.#a.set("value", this.$('[data-ry-target="tooltip-value"]')));
|
|
1765
1984
|
}
|
|
1766
|
-
#
|
|
1985
|
+
#l() {
|
|
1767
1986
|
const t = this.min, e = this.max, s = this.getAttribute("labels")?.split(","), i = this.getAttribute("label-type") || "number";
|
|
1768
1987
|
let r = [];
|
|
1769
1988
|
if (s)
|
|
@@ -1785,30 +2004,30 @@ class ht extends u {
|
|
|
1785
2004
|
`;
|
|
1786
2005
|
}
|
|
1787
2006
|
#h() {
|
|
1788
|
-
this.#i && this.on(this.#i, "pointerdown", this.#
|
|
2007
|
+
this.#i && this.on(this.#i, "pointerdown", this.#c);
|
|
1789
2008
|
for (const [t, e] of this.#r)
|
|
1790
2009
|
this.on(e, "pointerdown", (s) => this.#n(s, t)), this.on(e, "keydown", (s) => this.#m(s, t));
|
|
1791
|
-
this.on(document, "pointermove", this.#
|
|
2010
|
+
this.on(document, "pointermove", this.#u), this.on(document, "pointerup", this.#p);
|
|
1792
2011
|
}
|
|
1793
|
-
#
|
|
2012
|
+
#c = (t) => {
|
|
1794
2013
|
if (this.disabled) return;
|
|
1795
|
-
const e = this.#
|
|
2014
|
+
const e = this.#w(t);
|
|
1796
2015
|
if (this.hasAttribute("range")) {
|
|
1797
2016
|
const i = Math.abs(e - this.start), r = Math.abs(e - this.end);
|
|
1798
2017
|
i < r ? (this.start = e, this.#e = "start") : (this.end = e, this.#e = "end");
|
|
1799
2018
|
} else
|
|
1800
2019
|
this.value = e, this.#e = "value";
|
|
1801
|
-
this.#t = !0, this.#
|
|
2020
|
+
this.#t = !0, this.#b(), this.#y();
|
|
1802
2021
|
};
|
|
1803
2022
|
#n = (t, e) => {
|
|
1804
2023
|
this.disabled || (t.stopPropagation(), this.#t = !0, this.#e = e, t.target.setPointerCapture(t.pointerId));
|
|
1805
2024
|
};
|
|
1806
|
-
#
|
|
2025
|
+
#u = (t) => {
|
|
1807
2026
|
if (!this.#t || !this.#e) return;
|
|
1808
|
-
const e = this.#
|
|
1809
|
-
this.hasAttribute("range") ? this.#e === "start" ? this.start = Math.min(e, this.end) : this.#e === "end" && (this.end = Math.max(e, this.start)) : this.value = e, this.#
|
|
2027
|
+
const e = this.#w(t);
|
|
2028
|
+
this.hasAttribute("range") ? this.#e === "start" ? this.start = Math.min(e, this.end) : this.#e === "end" && (this.end = Math.max(e, this.start)) : this.value = e, this.#b(), this.#y();
|
|
1810
2029
|
};
|
|
1811
|
-
#
|
|
2030
|
+
#p = () => {
|
|
1812
2031
|
this.#t && (this.#t = !1, this.#e = null, this.#M());
|
|
1813
2032
|
};
|
|
1814
2033
|
#m = (t, e) => {
|
|
@@ -1831,22 +2050,22 @@ class ht extends u {
|
|
|
1831
2050
|
r = -i;
|
|
1832
2051
|
break;
|
|
1833
2052
|
case "Home":
|
|
1834
|
-
r = this.min - this.#
|
|
2053
|
+
r = this.min - this.#f(e);
|
|
1835
2054
|
break;
|
|
1836
2055
|
case "End":
|
|
1837
|
-
r = this.max - this.#
|
|
2056
|
+
r = this.max - this.#f(e);
|
|
1838
2057
|
break;
|
|
1839
2058
|
default:
|
|
1840
2059
|
return;
|
|
1841
2060
|
}
|
|
1842
2061
|
t.preventDefault();
|
|
1843
|
-
const a = this.#
|
|
1844
|
-
e === "start" ? this.start = Math.min(a, this.end) : e === "end" ? this.end = Math.max(a, this.start) : this.value = a, this.#
|
|
2062
|
+
const a = this.#d(this.#f(e) + r);
|
|
2063
|
+
e === "start" ? this.start = Math.min(a, this.end) : e === "end" ? this.end = Math.max(a, this.start) : this.value = a, this.#b(), this.#y(), this.#M();
|
|
1845
2064
|
};
|
|
1846
|
-
#
|
|
2065
|
+
#f(t) {
|
|
1847
2066
|
return t === "start" ? this.start : t === "end" ? this.end : this.value;
|
|
1848
2067
|
}
|
|
1849
|
-
#
|
|
2068
|
+
#w(t) {
|
|
1850
2069
|
if (!this.#i) return this.min;
|
|
1851
2070
|
const e = this.#i.getBoundingClientRect(), s = this.hasAttribute("vertical"), i = this.hasAttribute("reversed");
|
|
1852
2071
|
let r;
|
|
@@ -1856,14 +2075,14 @@ class ht extends u {
|
|
|
1856
2075
|
}
|
|
1857
2076
|
#g(t) {
|
|
1858
2077
|
const e = this.step;
|
|
1859
|
-
if (e === 0) return this.#
|
|
2078
|
+
if (e === 0) return this.#d(t);
|
|
1860
2079
|
const s = Math.round((t - this.min) / e) * e + this.min;
|
|
1861
|
-
return this.#
|
|
2080
|
+
return this.#d(s);
|
|
1862
2081
|
}
|
|
1863
|
-
#
|
|
2082
|
+
#d(t) {
|
|
1864
2083
|
return Math.max(this.min, Math.min(this.max, t));
|
|
1865
2084
|
}
|
|
1866
|
-
#
|
|
2085
|
+
#b() {
|
|
1867
2086
|
const t = this.hasAttribute("range"), e = this.hasAttribute("vertical"), s = this.hasAttribute("reversed"), i = (r) => {
|
|
1868
2087
|
let a = (r - this.min) / (this.max - this.min) * 100;
|
|
1869
2088
|
return s && (a = 100 - a), a;
|
|
@@ -1916,19 +2135,19 @@ class ht extends u {
|
|
|
1916
2135
|
return parseFloat(this.getAttribute("value") ?? String(this.min));
|
|
1917
2136
|
}
|
|
1918
2137
|
set value(t) {
|
|
1919
|
-
this.setAttribute("value", String(this.#
|
|
2138
|
+
this.setAttribute("value", String(this.#d(t)));
|
|
1920
2139
|
}
|
|
1921
2140
|
get start() {
|
|
1922
2141
|
return parseFloat(this.getAttribute("start") ?? String(this.min));
|
|
1923
2142
|
}
|
|
1924
2143
|
set start(t) {
|
|
1925
|
-
this.setAttribute("start", String(this.#
|
|
2144
|
+
this.setAttribute("start", String(this.#d(t)));
|
|
1926
2145
|
}
|
|
1927
2146
|
get end() {
|
|
1928
2147
|
return parseFloat(this.getAttribute("end") ?? String(this.max));
|
|
1929
2148
|
}
|
|
1930
2149
|
set end(t) {
|
|
1931
|
-
this.setAttribute("end", String(this.#
|
|
2150
|
+
this.setAttribute("end", String(this.#d(t)));
|
|
1932
2151
|
}
|
|
1933
2152
|
get disabled() {
|
|
1934
2153
|
return this.hasAttribute("disabled");
|
|
@@ -1937,8 +2156,8 @@ class ht extends u {
|
|
|
1937
2156
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
1938
2157
|
}
|
|
1939
2158
|
}
|
|
1940
|
-
customElements.define("ry-slider",
|
|
1941
|
-
class
|
|
2159
|
+
customElements.define("ry-slider", dt);
|
|
2160
|
+
class ut extends u {
|
|
1942
2161
|
#t = !1;
|
|
1943
2162
|
#e = 0;
|
|
1944
2163
|
#i = 0;
|
|
@@ -1947,7 +2166,7 @@ class lt extends u {
|
|
|
1947
2166
|
#a = null;
|
|
1948
2167
|
static observedAttributes = ["min", "max", "step", "value", "disabled", "label", "labels", "description"];
|
|
1949
2168
|
setup() {
|
|
1950
|
-
this.#o(), this.#
|
|
2169
|
+
this.#o(), this.#l(), this.#d();
|
|
1951
2170
|
}
|
|
1952
2171
|
#o() {
|
|
1953
2172
|
const t = this.getAttribute("label"), e = this.getAttribute("description"), s = e ? ` title="${e}"` : "";
|
|
@@ -1961,13 +2180,13 @@ class lt extends u {
|
|
|
1961
2180
|
${t ? `<span data-ry-target="label" class="ry-knob__label"${s}>${t}</span>` : ""}
|
|
1962
2181
|
`, this.#s = this.$('[data-ry-target="ring"]'), this.#r = this.$('[data-ry-target="indicator"]'), this.#a = this.$('[data-ry-target="display"]');
|
|
1963
2182
|
}
|
|
1964
|
-
#
|
|
1965
|
-
this.#s && (this.on(this.#s, "mousedown", this.#h), this.on(document, "mousemove", this.#
|
|
2183
|
+
#l() {
|
|
2184
|
+
this.#s && (this.on(this.#s, "mousedown", this.#h), this.on(document, "mousemove", this.#c), this.on(document, "mouseup", this.#n), this.on(this.#s, "touchstart", this.#u), this.on(document, "touchmove", this.#p), this.on(document, "touchend", this.#m), this.on(this.#s, "wheel", this.#f), this.on(this, "keydown", this.#w));
|
|
1966
2185
|
}
|
|
1967
2186
|
#h = (t) => {
|
|
1968
2187
|
this.disabled || (t.preventDefault(), this.#t = !0, this.#e = t.clientY, this.#i = this.value, this.#s?.classList.add("ry-knob__ring--dragging"), this.setAttribute("data-dragging", ""));
|
|
1969
2188
|
};
|
|
1970
|
-
#
|
|
2189
|
+
#c = (t) => {
|
|
1971
2190
|
if (!this.#t) return;
|
|
1972
2191
|
const e = this.#e - t.clientY, s = (this.max - this.min) / 100;
|
|
1973
2192
|
this.#g(this.#i + e * s);
|
|
@@ -1975,10 +2194,10 @@ class lt extends u {
|
|
|
1975
2194
|
#n = () => {
|
|
1976
2195
|
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#y());
|
|
1977
2196
|
};
|
|
1978
|
-
#
|
|
2197
|
+
#u = (t) => {
|
|
1979
2198
|
this.disabled || (t.preventDefault(), this.#t = !0, this.#e = t.touches[0]?.clientY ?? 0, this.#i = this.value, this.#s?.classList.add("ry-knob__ring--dragging"), this.setAttribute("data-dragging", ""));
|
|
1980
2199
|
};
|
|
1981
|
-
#
|
|
2200
|
+
#p = (t) => {
|
|
1982
2201
|
if (!this.#t) return;
|
|
1983
2202
|
t.preventDefault();
|
|
1984
2203
|
const e = t.touches[0];
|
|
@@ -1989,13 +2208,13 @@ class lt extends u {
|
|
|
1989
2208
|
#m = () => {
|
|
1990
2209
|
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#y());
|
|
1991
2210
|
};
|
|
1992
|
-
#
|
|
2211
|
+
#f = (t) => {
|
|
1993
2212
|
if (this.disabled) return;
|
|
1994
2213
|
t.preventDefault();
|
|
1995
2214
|
const e = this.step || (this.max - this.min) / 50, s = t.deltaY < 0 ? e : -e;
|
|
1996
2215
|
this.#g(this.value + s), this.#y();
|
|
1997
2216
|
};
|
|
1998
|
-
#
|
|
2217
|
+
#w = (t) => {
|
|
1999
2218
|
if (this.disabled) return;
|
|
2000
2219
|
const e = this.step || 1, s = (this.max - this.min) / 10;
|
|
2001
2220
|
let i = 0;
|
|
@@ -2028,13 +2247,13 @@ class lt extends u {
|
|
|
2028
2247
|
#g(t) {
|
|
2029
2248
|
let e = Math.max(this.min, Math.min(this.max, t));
|
|
2030
2249
|
const s = this.step;
|
|
2031
|
-
s > 0 && (e = Math.round((e - this.min) / s) * s + this.min, e = Math.max(this.min, Math.min(this.max, e))), this.value = e, this.#
|
|
2250
|
+
s > 0 && (e = Math.round((e - this.min) / s) * s + this.min, e = Math.max(this.min, Math.min(this.max, e))), this.value = e, this.#d(), this.#v();
|
|
2032
2251
|
}
|
|
2033
|
-
#
|
|
2252
|
+
#d() {
|
|
2034
2253
|
const t = (this.value - this.min) / (this.max - this.min), e = -135 + t * 270;
|
|
2035
|
-
this.#s && (this.#s.style.setProperty("--knob-rotation", `${e}deg`), this.#s.style.setProperty("--knob-percent", String(t))), this.#a && (this.#a.textContent = this.#
|
|
2254
|
+
this.#s && (this.#s.style.setProperty("--knob-rotation", `${e}deg`), this.#s.style.setProperty("--knob-percent", String(t))), this.#a && (this.#a.textContent = this.#b(this.value)), this.setAttribute("aria-valuenow", String(this.value)), this.setAttribute("aria-valuemin", String(this.min)), this.setAttribute("aria-valuemax", String(this.max));
|
|
2036
2255
|
}
|
|
2037
|
-
#
|
|
2256
|
+
#b(t) {
|
|
2038
2257
|
const e = this.getAttribute("labels");
|
|
2039
2258
|
if (e) {
|
|
2040
2259
|
const i = e.split(","), r = Math.round(t);
|
|
@@ -2051,7 +2270,7 @@ class lt extends u {
|
|
|
2051
2270
|
this.emit("change", { value: this.value, percent: t });
|
|
2052
2271
|
}
|
|
2053
2272
|
attributeChangedCallback(t, e, s) {
|
|
2054
|
-
e !== s && t === "value" && this.#s && this.#
|
|
2273
|
+
e !== s && t === "value" && this.#s && this.#d();
|
|
2055
2274
|
}
|
|
2056
2275
|
// --- Public API ---
|
|
2057
2276
|
get min() {
|
|
@@ -2085,9 +2304,9 @@ class lt extends u {
|
|
|
2085
2304
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
2086
2305
|
}
|
|
2087
2306
|
}
|
|
2088
|
-
customElements.define("ry-knob",
|
|
2307
|
+
customElements.define("ry-knob", ut);
|
|
2089
2308
|
const S = 15, T = 3;
|
|
2090
|
-
class
|
|
2309
|
+
class pt extends u {
|
|
2091
2310
|
#t = null;
|
|
2092
2311
|
#e = null;
|
|
2093
2312
|
#i = null;
|
|
@@ -2095,16 +2314,16 @@ class ct extends u {
|
|
|
2095
2314
|
#r = null;
|
|
2096
2315
|
#a = !1;
|
|
2097
2316
|
#o = 0;
|
|
2098
|
-
#
|
|
2317
|
+
#l = 0;
|
|
2099
2318
|
#h = 0;
|
|
2100
|
-
#
|
|
2319
|
+
#c = !1;
|
|
2101
2320
|
#n = null;
|
|
2102
|
-
#
|
|
2321
|
+
#u = null;
|
|
2103
2322
|
static observedAttributes = ["min", "max", "step", "value", "disabled", "arrows", "icons", "drag", "editable", "wrap", "label", "prefix", "suffix"];
|
|
2104
2323
|
setup() {
|
|
2105
|
-
this.#
|
|
2324
|
+
this.#p(), this.#f(), this.#w(), this.#A();
|
|
2106
2325
|
}
|
|
2107
|
-
#
|
|
2326
|
+
#p() {
|
|
2108
2327
|
const t = this.getAttribute("arrows") ?? "both", e = this.getAttribute("label"), s = t === "stacked" || t === "stacked-end" || t === "stacked-start", [i, r] = this.#m(s), a = t !== "end" && t !== "none", n = t !== "start" && t !== "none", o = this.getAttribute("prefix"), l = this.getAttribute("suffix"), c = a ? `<button data-ry-target="decrement" class="ry-number-select__btn ry-number-select__decrement" aria-label="Decrease" tabindex="-1" type="button">${i}</button>` : "", d = n ? `<button data-ry-target="increment" class="ry-number-select__btn ry-number-select__increment" aria-label="Increase" tabindex="-1" type="button">${r}</button>` : "", g = `
|
|
2109
2328
|
<div data-ry-target="display" class="ry-number-select__display" tabindex="0" role="spinbutton"
|
|
2110
2329
|
aria-valuenow="${this.value}" aria-valuemin="${this.min}" aria-valuemax="${this.max}"
|
|
@@ -2113,31 +2332,31 @@ class ct extends u {
|
|
|
2113
2332
|
<span data-ry-target="value" class="ry-number-select__value">${this.#j(this.value)}</span>
|
|
2114
2333
|
${l ? `<span data-ry-target="suffix" class="ry-number-select__affix">${l}</span>` : ""}
|
|
2115
2334
|
<input data-ry-target="input" class="ry-number-select__input" type="text" inputmode="decimal" tabindex="-1">
|
|
2116
|
-
</div>`,
|
|
2335
|
+
</div>`, y = e ? `<span data-ry-target="label" class="ry-number-select__label">${e}</span>` : "";
|
|
2117
2336
|
if (t === "stacked")
|
|
2118
|
-
this.innerHTML = `${d}${g}${c}${
|
|
2337
|
+
this.innerHTML = `${d}${g}${c}${y}`;
|
|
2119
2338
|
else if (t === "stacked-end") {
|
|
2120
|
-
const
|
|
2121
|
-
this.innerHTML = `${g}${
|
|
2339
|
+
const b = `<div data-ry-target="btn-group" class="ry-number-select__btn-group">${d}${c}</div>`;
|
|
2340
|
+
this.innerHTML = `${g}${b}${y}`;
|
|
2122
2341
|
} else if (t === "stacked-start") {
|
|
2123
|
-
const
|
|
2124
|
-
this.innerHTML = `${
|
|
2342
|
+
const b = `<div data-ry-target="btn-group" class="ry-number-select__btn-group">${d}${c}</div>`;
|
|
2343
|
+
this.innerHTML = `${b}${g}${y}`;
|
|
2125
2344
|
} else
|
|
2126
|
-
this.innerHTML = `${c}${g}${d}${
|
|
2345
|
+
this.innerHTML = `${c}${g}${d}${y}`;
|
|
2127
2346
|
}
|
|
2128
2347
|
#m(t) {
|
|
2129
2348
|
const e = this.getAttribute("icons") ?? "plus-minus";
|
|
2130
2349
|
return e === "chevron" ? t ? [p("chevron-down") ?? "▾", p("chevron-up") ?? "▴"] : [p("chevron-left") ?? "‹", p("chevron-right") ?? "›"] : e === "arrow" ? t ? [p("chevron-down") ?? "▼", p("chevron-up") ?? "▲"] : [p("chevron-left") ?? "◀", p("chevron-right") ?? "▶"] : [p("minus") ?? "−", p("plus") ?? "+"];
|
|
2131
2350
|
}
|
|
2132
|
-
#
|
|
2351
|
+
#f() {
|
|
2133
2352
|
this.#t = this.$('[data-ry-target="display"]'), this.#e = this.$('[data-ry-target="value"]'), this.#i = this.$('[data-ry-target="input"]'), this.#s = this.$('[data-ry-target="decrement"]'), this.#r = this.$('[data-ry-target="increment"]');
|
|
2134
2353
|
}
|
|
2135
|
-
#
|
|
2354
|
+
#w() {
|
|
2136
2355
|
this.#s && (this.on(this.#s, "mousedown", (t) => {
|
|
2137
2356
|
t.preventDefault(), this.#g(-1);
|
|
2138
|
-
}), this.on(this.#s, "mouseup", () => this.#
|
|
2357
|
+
}), this.on(this.#s, "mouseup", () => this.#d()), this.on(this.#s, "mouseleave", () => this.#d())), this.#r && (this.on(this.#r, "mousedown", (t) => {
|
|
2139
2358
|
t.preventDefault(), this.#g(1);
|
|
2140
|
-
}), this.on(this.#r, "mouseup", () => this.#
|
|
2359
|
+
}), this.on(this.#r, "mouseup", () => this.#d()), this.on(this.#r, "mouseleave", () => this.#d())), this.#t && this.on(this.#t, "mousedown", this.#I), this.on(document, "mousemove", this.#Y), this.on(document, "mouseup", this.#C), this.#t && this.on(this.#t, "touchstart", this.#X), this.on(document, "touchmove", this.#G), this.on(document, "touchend", this.#K), this.#t && this.on(this.#t, "keydown", this.#q), this.on(this, "wheel", this.#J), this.#t && this.on(this.#t, "dblclick", () => this.#E()), this.#i && (this.on(this.#i, "blur", () => this.#z()), this.on(this.#i, "keydown", (t) => {
|
|
2141
2360
|
t.key === "Enter" && (t.preventDefault(), this.#z()), t.key === "Escape" && (t.preventDefault(), this.#P()), t.stopPropagation();
|
|
2142
2361
|
}));
|
|
2143
2362
|
}
|
|
@@ -2148,41 +2367,41 @@ class ct extends u {
|
|
|
2148
2367
|
this.#R(t * e), this.#_(), this.#n = setTimeout(() => {
|
|
2149
2368
|
let s = 150;
|
|
2150
2369
|
const i = () => {
|
|
2151
|
-
this.#R(t * e), this.#x(), s = Math.max(40, s * 0.85), this.#
|
|
2370
|
+
this.#R(t * e), this.#x(), s = Math.max(40, s * 0.85), this.#u = setTimeout(i, s);
|
|
2152
2371
|
};
|
|
2153
2372
|
i();
|
|
2154
2373
|
}, 400);
|
|
2155
2374
|
}
|
|
2156
|
-
#
|
|
2157
|
-
this.#n && (clearTimeout(this.#n), this.#n = null), this.#
|
|
2375
|
+
#d() {
|
|
2376
|
+
this.#n && (clearTimeout(this.#n), this.#n = null), this.#u && (clearTimeout(this.#u), this.#u = null);
|
|
2158
2377
|
}
|
|
2159
2378
|
// --- Drag helpers ---
|
|
2160
|
-
get #
|
|
2379
|
+
get #b() {
|
|
2161
2380
|
const t = this.getAttribute("drag");
|
|
2162
2381
|
if (t === "x" || t === "y" || t === "none") return t;
|
|
2163
2382
|
const e = this.getAttribute("arrows");
|
|
2164
2383
|
return e === "stacked" || e === "stacked-end" || e === "stacked-start" ? "y" : "x";
|
|
2165
2384
|
}
|
|
2166
2385
|
#v(t, e) {
|
|
2167
|
-
return this.#
|
|
2386
|
+
return this.#b === "y" ? this.#l - e : t - this.#o;
|
|
2168
2387
|
}
|
|
2169
2388
|
#y(t, e) {
|
|
2170
|
-
return this.#
|
|
2389
|
+
return this.#b === "y" ? Math.abs(e - this.#l) : Math.abs(t - this.#o);
|
|
2171
2390
|
}
|
|
2172
2391
|
#M(t, e) {
|
|
2173
2392
|
if (!this.#e) return;
|
|
2174
|
-
const s = t / e * 4, i = this.#
|
|
2393
|
+
const s = t / e * 4, i = this.#b;
|
|
2175
2394
|
this.#e.style.transform = i === "y" ? `translateY(${-s}px)` : `translateX(${s}px)`;
|
|
2176
2395
|
}
|
|
2177
2396
|
#$(t, e, s) {
|
|
2178
2397
|
const i = this.#v(t, e), r = this.step || 1, a = s ? r * 10 : r, n = s ? S * 2 : S, o = Math.round(i / n), l = this.#h + o * a, c = i - o * n;
|
|
2179
2398
|
this.#M(c, n);
|
|
2180
|
-
const d = this.hasAttribute("wrap") ? this.#
|
|
2399
|
+
const d = this.hasAttribute("wrap") ? this.#V(l) : this.#T(l), g = this.#F(d);
|
|
2181
2400
|
g !== this.value && (this.value = g, this.#A(), this.#x());
|
|
2182
2401
|
}
|
|
2183
2402
|
// --- Mouse drag ---
|
|
2184
2403
|
#I = (t) => {
|
|
2185
|
-
this.disabled || this.#
|
|
2404
|
+
this.disabled || this.#c || this.#b === "none" || (t.preventDefault(), this.#a = !0, this.#o = t.clientX, this.#l = t.clientY, this.#h = this.value, this.setAttribute("data-dragging", ""));
|
|
2186
2405
|
};
|
|
2187
2406
|
#Y = (t) => {
|
|
2188
2407
|
this.#a && this.#$(t.clientX, t.clientY, t.shiftKey);
|
|
@@ -2194,7 +2413,7 @@ class ct extends u {
|
|
|
2194
2413
|
};
|
|
2195
2414
|
// --- Touch drag ---
|
|
2196
2415
|
#X = (t) => {
|
|
2197
|
-
this.disabled || this.#
|
|
2416
|
+
this.disabled || this.#c || this.#b === "none" || (t.preventDefault(), this.#a = !0, this.#o = t.touches[0]?.clientX ?? 0, this.#l = t.touches[0]?.clientY ?? 0, this.#h = this.value, this.setAttribute("data-dragging", ""));
|
|
2198
2417
|
};
|
|
2199
2418
|
#G = (t) => {
|
|
2200
2419
|
if (!this.#a) return;
|
|
@@ -2207,7 +2426,7 @@ class ct extends u {
|
|
|
2207
2426
|
};
|
|
2208
2427
|
// --- Keyboard ---
|
|
2209
2428
|
#q = (t) => {
|
|
2210
|
-
if (this.disabled || this.#
|
|
2429
|
+
if (this.disabled || this.#c) return;
|
|
2211
2430
|
const e = this.step || 1, s = e * 10;
|
|
2212
2431
|
let i = 0;
|
|
2213
2432
|
switch (t.key) {
|
|
@@ -2242,18 +2461,18 @@ class ct extends u {
|
|
|
2242
2461
|
};
|
|
2243
2462
|
// --- Wheel ---
|
|
2244
2463
|
#J = (t) => {
|
|
2245
|
-
if (this.disabled || this.#
|
|
2464
|
+
if (this.disabled || this.#c || !this.matches(":hover") && !this.contains(document.activeElement)) return;
|
|
2246
2465
|
t.preventDefault();
|
|
2247
2466
|
const e = this.step || 1, s = t.shiftKey ? e * 10 : e, i = t.deltaY < 0 ? s : -s;
|
|
2248
2467
|
this.#R(i), this.#x(), this.#_();
|
|
2249
2468
|
};
|
|
2250
2469
|
// --- Edit mode ---
|
|
2251
2470
|
#E(t) {
|
|
2252
|
-
this.disabled || this.#
|
|
2471
|
+
this.disabled || this.#c || (this.#c = !0, this.state = "editing", this.#e && (this.#e.style.display = "none"), this.#i && (this.#i.style.display = "block", this.#i.value = t ?? this.#j(this.value), this.#i.focus(), t ? this.#i.setSelectionRange(1, 1) : this.#i.select()));
|
|
2253
2472
|
}
|
|
2254
2473
|
#z() {
|
|
2255
|
-
if (!this.#
|
|
2256
|
-
this.#
|
|
2474
|
+
if (!this.#c) return;
|
|
2475
|
+
this.#c = !1, this.state = "";
|
|
2257
2476
|
const t = parseFloat(this.#i?.value ?? "");
|
|
2258
2477
|
if (!isNaN(t)) {
|
|
2259
2478
|
const e = this.#T(t), s = this.#F(e);
|
|
@@ -2262,17 +2481,17 @@ class ct extends u {
|
|
|
2262
2481
|
this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#A(), this.#t?.focus();
|
|
2263
2482
|
}
|
|
2264
2483
|
#P() {
|
|
2265
|
-
this.#
|
|
2484
|
+
this.#c && (this.#c = !1, this.state = "", this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#t?.focus());
|
|
2266
2485
|
}
|
|
2267
2486
|
// --- Value management ---
|
|
2268
2487
|
#R(t) {
|
|
2269
2488
|
let e = this.value + t;
|
|
2270
|
-
this.hasAttribute("wrap") ? e = this.#
|
|
2489
|
+
this.hasAttribute("wrap") ? e = this.#V(e) : e = this.#T(e), e = this.#F(e), this.value = e, this.#A();
|
|
2271
2490
|
}
|
|
2272
2491
|
#T(t) {
|
|
2273
2492
|
return Math.max(this.min, Math.min(this.max, t));
|
|
2274
2493
|
}
|
|
2275
|
-
#
|
|
2494
|
+
#V(t) {
|
|
2276
2495
|
const e = this.step || 1, s = this.max - this.min + e;
|
|
2277
2496
|
let i = t;
|
|
2278
2497
|
for (; i > this.max; ) i -= s;
|
|
@@ -2292,9 +2511,9 @@ class ct extends u {
|
|
|
2292
2511
|
return t.toFixed(s);
|
|
2293
2512
|
}
|
|
2294
2513
|
#A() {
|
|
2295
|
-
this.#e && (this.#e.textContent = this.#j(this.value)), this.#
|
|
2514
|
+
this.#e && (this.#e.textContent = this.#j(this.value)), this.#U();
|
|
2296
2515
|
}
|
|
2297
|
-
#
|
|
2516
|
+
#U() {
|
|
2298
2517
|
this.#t && (this.#t.setAttribute("aria-valuenow", String(this.value)), this.#t.setAttribute("aria-valuemin", String(this.min)), this.#t.setAttribute("aria-valuemax", String(this.max)));
|
|
2299
2518
|
}
|
|
2300
2519
|
#x() {
|
|
@@ -2329,7 +2548,7 @@ class ct extends u {
|
|
|
2329
2548
|
this.setAttribute("step", String(t));
|
|
2330
2549
|
}
|
|
2331
2550
|
get drag() {
|
|
2332
|
-
return this.#
|
|
2551
|
+
return this.#b;
|
|
2333
2552
|
}
|
|
2334
2553
|
set drag(t) {
|
|
2335
2554
|
this.setAttribute("drag", t);
|
|
@@ -2344,10 +2563,10 @@ class ct extends u {
|
|
|
2344
2563
|
e !== s && t === "value" && this.#t && this.#A();
|
|
2345
2564
|
}
|
|
2346
2565
|
teardown() {
|
|
2347
|
-
this.#
|
|
2566
|
+
this.#d();
|
|
2348
2567
|
}
|
|
2349
2568
|
}
|
|
2350
|
-
customElements.define("ry-number-select",
|
|
2569
|
+
customElements.define("ry-number-select", pt);
|
|
2351
2570
|
function v(h) {
|
|
2352
2571
|
const t = h.h / 360, e = h.s / 100, s = h.v / 100;
|
|
2353
2572
|
let i = 0, r = 0, a = 0;
|
|
@@ -2408,7 +2627,7 @@ function L(h) {
|
|
|
2408
2627
|
l: Math.round(s * 100)
|
|
2409
2628
|
};
|
|
2410
2629
|
}
|
|
2411
|
-
function
|
|
2630
|
+
function gt(h) {
|
|
2412
2631
|
const t = h.s / 100, e = h.l / 100, s = e + t * Math.min(e, 1 - e), i = s === 0 ? 0 : 2 * (1 - e / s);
|
|
2413
2632
|
return {
|
|
2414
2633
|
h: h.h,
|
|
@@ -2420,7 +2639,7 @@ function D(h) {
|
|
|
2420
2639
|
const t = (e) => e.toString(16).padStart(2, "0");
|
|
2421
2640
|
return `#${t(h.r)}${t(h.g)}${t(h.b)}`;
|
|
2422
2641
|
}
|
|
2423
|
-
function
|
|
2642
|
+
function ft(h) {
|
|
2424
2643
|
const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);
|
|
2425
2644
|
if (!t) {
|
|
2426
2645
|
const e = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(h);
|
|
@@ -2448,7 +2667,7 @@ function A(h) {
|
|
|
2448
2667
|
}, n = parseInt(i[4], 16) / 255;
|
|
2449
2668
|
return { hsv: $(a), alpha: Math.round(n * 100) };
|
|
2450
2669
|
}
|
|
2451
|
-
const r =
|
|
2670
|
+
const r = ft(t);
|
|
2452
2671
|
return r ? { hsv: $(r), alpha: 100 } : null;
|
|
2453
2672
|
}
|
|
2454
2673
|
const e = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/.exec(t);
|
|
@@ -2467,11 +2686,11 @@ function A(h) {
|
|
|
2467
2686
|
s: parseFloat(s[2]),
|
|
2468
2687
|
l: parseFloat(s[3])
|
|
2469
2688
|
}, r = s[4] ? parseFloat(s[4]) * 100 : 100;
|
|
2470
|
-
return { hsv:
|
|
2689
|
+
return { hsv: gt(i), alpha: r };
|
|
2471
2690
|
}
|
|
2472
2691
|
return null;
|
|
2473
2692
|
}
|
|
2474
|
-
class
|
|
2693
|
+
class bt extends u {
|
|
2475
2694
|
#t = 0;
|
|
2476
2695
|
#e = 100;
|
|
2477
2696
|
#i = 100;
|
|
@@ -2479,21 +2698,21 @@ class pt extends u {
|
|
|
2479
2698
|
#r = !1;
|
|
2480
2699
|
#a = !1;
|
|
2481
2700
|
#o = !1;
|
|
2482
|
-
#
|
|
2701
|
+
#l = null;
|
|
2483
2702
|
#h = null;
|
|
2484
|
-
#
|
|
2703
|
+
#c = null;
|
|
2485
2704
|
#n = null;
|
|
2486
|
-
#p = null;
|
|
2487
2705
|
#u = null;
|
|
2706
|
+
#p = null;
|
|
2488
2707
|
#m = null;
|
|
2489
|
-
#
|
|
2490
|
-
#
|
|
2708
|
+
#f = null;
|
|
2709
|
+
#w = null;
|
|
2491
2710
|
#g = null;
|
|
2492
2711
|
static observedAttributes = ["value", "format", "opacity", "disabled", "swatches", "inline"];
|
|
2493
2712
|
setup() {
|
|
2494
|
-
this.#
|
|
2713
|
+
this.#d(), this.#b(), this.#v(), this.#A();
|
|
2495
2714
|
}
|
|
2496
|
-
#
|
|
2715
|
+
#d() {
|
|
2497
2716
|
const t = this.hasAttribute("inline"), e = this.hasAttribute("opacity"), s = this.getAttribute("swatches");
|
|
2498
2717
|
let i = `
|
|
2499
2718
|
<div data-ry-target="grid" class="ry-color-picker__grid">
|
|
@@ -2533,10 +2752,10 @@ class pt extends u {
|
|
|
2533
2752
|
<span data-ry-target="trigger-color" class="ry-color-picker__trigger-color"></span>
|
|
2534
2753
|
</button>
|
|
2535
2754
|
<div data-ry-target="panel" class="ry-color-picker__panel">${i}</div>
|
|
2536
|
-
`, this.#
|
|
2755
|
+
`, this.#l = this.$('[data-ry-target="trigger"]'), this.#h = this.$('[data-ry-target="panel"]'), this.#c = this.$('[data-ry-target="grid"]'), this.#n = this.$('[data-ry-target="grid-handle"]'), this.#u = this.$('[data-ry-target="hue-slider"]'), this.#p = this.$('[data-ry-target="hue-handle"]'), this.#m = this.$('[data-ry-target="alpha-slider"]'), this.#f = this.$('[data-ry-target="alpha-handle"]'), this.#w = this.$('[data-ry-target="preview"]'), this.#g = this.$('[data-ry-target="input"]');
|
|
2537
2756
|
}
|
|
2538
|
-
#
|
|
2539
|
-
this.#
|
|
2757
|
+
#b() {
|
|
2758
|
+
this.#l && this.on(this.#l, "click", this.#y), this.on(document, "click", this.#M), this.on(document, "keydown", this.#$), this.#c && this.on(this.#c, "pointerdown", this.#Y), this.#n && this.on(this.#n, "keydown", this.#X), this.#u && this.on(this.#u, "pointerdown", this.#G), this.#p && this.on(this.#p, "keydown", this.#q), this.#m && this.on(this.#m, "pointerdown", this.#J), this.#f && this.on(this.#f, "keydown", this.#z), this.on(document, "pointermove", this.#P), this.on(document, "pointerup", this.#R), this.#g && (this.on(this.#g, "change", this.#T), this.on(this.#g, "keydown", this.#V));
|
|
2540
2759
|
const t = this.$('[data-ry-target="format-toggle"]');
|
|
2541
2760
|
t && this.on(t, "click", this.#F);
|
|
2542
2761
|
const e = this.$('[data-ry-target="swatches"]');
|
|
@@ -2559,7 +2778,7 @@ class pt extends u {
|
|
|
2559
2778
|
this.state === "open" && (this.contains(t.target) || this.close());
|
|
2560
2779
|
};
|
|
2561
2780
|
#$ = (t) => {
|
|
2562
|
-
t.key === "Escape" && this.state === "open" && (this.close(), this.#
|
|
2781
|
+
t.key === "Escape" && this.state === "open" && (this.close(), this.#l?.focus());
|
|
2563
2782
|
};
|
|
2564
2783
|
open() {
|
|
2565
2784
|
this.hasAttribute("inline") || (this.#I(), this.state = "open");
|
|
@@ -2568,8 +2787,8 @@ class pt extends u {
|
|
|
2568
2787
|
this.hasAttribute("inline") || (this.state = "closed", this.removeAttribute("data-ry-position"));
|
|
2569
2788
|
}
|
|
2570
2789
|
#I() {
|
|
2571
|
-
if (!this.#h || !this.#
|
|
2572
|
-
const t = this.#
|
|
2790
|
+
if (!this.#h || !this.#l) return;
|
|
2791
|
+
const t = this.#l.getBoundingClientRect(), e = 320, i = window.innerHeight - t.bottom, r = t.top;
|
|
2573
2792
|
i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
|
|
2574
2793
|
}
|
|
2575
2794
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -2579,8 +2798,8 @@ class pt extends u {
|
|
|
2579
2798
|
this.disabled || (t.preventDefault(), this.#r = !0, this.#n?.focus(), this.#C(t));
|
|
2580
2799
|
};
|
|
2581
2800
|
#C(t) {
|
|
2582
|
-
if (!this.#
|
|
2583
|
-
const e = this.#
|
|
2801
|
+
if (!this.#c) return;
|
|
2802
|
+
const e = this.#c.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width)), i = Math.max(0, Math.min(1, (t.clientY - e.top) / e.height));
|
|
2584
2803
|
this.#e = Math.round(s * 100), this.#i = Math.round((1 - i) * 100), this.#A(), this.#L();
|
|
2585
2804
|
}
|
|
2586
2805
|
#X = (t) => {
|
|
@@ -2601,17 +2820,17 @@ class pt extends u {
|
|
|
2601
2820
|
this.#i = Math.max(0, this.#i - e), s = !0;
|
|
2602
2821
|
break;
|
|
2603
2822
|
}
|
|
2604
|
-
s && (t.preventDefault(), this.#A(), this.#L(), this.#
|
|
2823
|
+
s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
|
|
2605
2824
|
};
|
|
2606
2825
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2607
2826
|
// Hue handlers
|
|
2608
2827
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2609
2828
|
#G = (t) => {
|
|
2610
|
-
this.disabled || (t.preventDefault(), this.#a = !0, this.#
|
|
2829
|
+
this.disabled || (t.preventDefault(), this.#a = !0, this.#p?.focus(), this.#K(t));
|
|
2611
2830
|
};
|
|
2612
2831
|
#K(t) {
|
|
2613
|
-
if (!this.#
|
|
2614
|
-
const e = this.#
|
|
2832
|
+
if (!this.#u) return;
|
|
2833
|
+
const e = this.#u.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
|
|
2615
2834
|
this.#t = Math.round(s * 360), this.#A(), this.#L();
|
|
2616
2835
|
}
|
|
2617
2836
|
#q = (t) => {
|
|
@@ -2628,13 +2847,13 @@ class pt extends u {
|
|
|
2628
2847
|
this.#t = (this.#t - e + 360) % 360, s = !0;
|
|
2629
2848
|
break;
|
|
2630
2849
|
}
|
|
2631
|
-
s && (t.preventDefault(), this.#A(), this.#L(), this.#
|
|
2850
|
+
s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
|
|
2632
2851
|
};
|
|
2633
2852
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2634
2853
|
// Alpha handlers
|
|
2635
2854
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2636
2855
|
#J = (t) => {
|
|
2637
|
-
this.disabled || (t.preventDefault(), this.#o = !0, this.#
|
|
2856
|
+
this.disabled || (t.preventDefault(), this.#o = !0, this.#f?.focus(), this.#E(t));
|
|
2638
2857
|
};
|
|
2639
2858
|
#E(t) {
|
|
2640
2859
|
if (!this.#m) return;
|
|
@@ -2655,7 +2874,7 @@ class pt extends u {
|
|
|
2655
2874
|
this.#s = Math.max(0, this.#s - e), s = !0;
|
|
2656
2875
|
break;
|
|
2657
2876
|
}
|
|
2658
|
-
s && (t.preventDefault(), this.#A(), this.#L(), this.#
|
|
2877
|
+
s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
|
|
2659
2878
|
};
|
|
2660
2879
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2661
2880
|
// Pointer move/up
|
|
@@ -2664,7 +2883,7 @@ class pt extends u {
|
|
|
2664
2883
|
this.#r ? this.#C(t) : this.#a ? this.#K(t) : this.#o && this.#E(t);
|
|
2665
2884
|
};
|
|
2666
2885
|
#R = () => {
|
|
2667
|
-
(this.#r || this.#a || this.#o) && (this.#r = !1, this.#a = !1, this.#o = !1, this.#
|
|
2886
|
+
(this.#r || this.#a || this.#o) && (this.#r = !1, this.#a = !1, this.#o = !1, this.#k());
|
|
2668
2887
|
};
|
|
2669
2888
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2670
2889
|
// Input handlers
|
|
@@ -2672,9 +2891,9 @@ class pt extends u {
|
|
|
2672
2891
|
#T = () => {
|
|
2673
2892
|
if (!this.#g) return;
|
|
2674
2893
|
const t = A(this.#g.value);
|
|
2675
|
-
t ? (this.#t = t.hsv.h, this.#e = t.hsv.s, this.#i = t.hsv.v, this.hasAttribute("opacity") && (this.#s = t.alpha), this.#A(), this.#
|
|
2894
|
+
t ? (this.#t = t.hsv.h, this.#e = t.hsv.s, this.#i = t.hsv.v, this.hasAttribute("opacity") && (this.#s = t.alpha), this.#A(), this.#k()) : this.#W();
|
|
2676
2895
|
};
|
|
2677
|
-
#
|
|
2896
|
+
#V = (t) => {
|
|
2678
2897
|
t.key === "Enter" && (t.preventDefault(), this.#T());
|
|
2679
2898
|
};
|
|
2680
2899
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -2695,7 +2914,7 @@ class pt extends u {
|
|
|
2695
2914
|
const s = e.dataset.color;
|
|
2696
2915
|
if (s) {
|
|
2697
2916
|
const i = A(s);
|
|
2698
|
-
i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this.#A(), this.#L(), this.#
|
|
2917
|
+
i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this.#A(), this.#L(), this.#k());
|
|
2699
2918
|
}
|
|
2700
2919
|
}
|
|
2701
2920
|
};
|
|
@@ -2703,9 +2922,9 @@ class pt extends u {
|
|
|
2703
2922
|
// Update methods
|
|
2704
2923
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2705
2924
|
#A() {
|
|
2706
|
-
this.#
|
|
2925
|
+
this.#U(), this.#x(), this.#_(), this.#H(), this.#O(), this.#W(), this.#Z();
|
|
2707
2926
|
}
|
|
2708
|
-
#
|
|
2927
|
+
#U() {
|
|
2709
2928
|
const t = this.$('[data-ry-target="trigger-color"]');
|
|
2710
2929
|
if (t) {
|
|
2711
2930
|
const e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity") ? this.#s / 100 : 1;
|
|
@@ -2713,23 +2932,23 @@ class pt extends u {
|
|
|
2713
2932
|
}
|
|
2714
2933
|
}
|
|
2715
2934
|
#x() {
|
|
2716
|
-
if (this.#
|
|
2935
|
+
if (this.#c) {
|
|
2717
2936
|
const t = v({ h: this.#t, s: 100, v: 100 });
|
|
2718
|
-
this.#
|
|
2937
|
+
this.#c.style.setProperty("--grid-hue-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
|
|
2719
2938
|
}
|
|
2720
2939
|
this.#n && (this.#n.style.left = `${this.#e}%`, this.#n.style.top = `${100 - this.#i}%`);
|
|
2721
2940
|
}
|
|
2722
2941
|
#_() {
|
|
2723
|
-
this.#
|
|
2942
|
+
this.#p && (this.#p.style.left = `${this.#t / 360 * 100}%`);
|
|
2724
2943
|
}
|
|
2725
2944
|
#H() {
|
|
2726
2945
|
if (this.#m) {
|
|
2727
2946
|
const t = v({ h: this.#t, s: this.#e, v: this.#i });
|
|
2728
2947
|
this.#m.style.setProperty("--alpha-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
|
|
2729
2948
|
}
|
|
2730
|
-
this.#
|
|
2949
|
+
this.#f && (this.#f.style.left = `${this.#s}%`);
|
|
2731
2950
|
}
|
|
2732
|
-
#
|
|
2951
|
+
#O() {
|
|
2733
2952
|
const t = this.$('[data-ry-target="preview-color"]');
|
|
2734
2953
|
if (t) {
|
|
2735
2954
|
const e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity") ? this.#s / 100 : 1;
|
|
@@ -2737,13 +2956,13 @@ class pt extends u {
|
|
|
2737
2956
|
}
|
|
2738
2957
|
}
|
|
2739
2958
|
#W() {
|
|
2740
|
-
this.#g && (this.#g.value = this.#
|
|
2959
|
+
this.#g && (this.#g.value = this.#N());
|
|
2741
2960
|
}
|
|
2742
2961
|
#Z() {
|
|
2743
|
-
const t = this.#
|
|
2962
|
+
const t = this.#N();
|
|
2744
2963
|
this.getAttribute("value") !== t && this.setAttribute("value", t);
|
|
2745
2964
|
}
|
|
2746
|
-
#
|
|
2965
|
+
#N() {
|
|
2747
2966
|
const t = this.format, e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity");
|
|
2748
2967
|
switch (t) {
|
|
2749
2968
|
case "hex": {
|
|
@@ -2770,23 +2989,23 @@ class pt extends u {
|
|
|
2770
2989
|
#L() {
|
|
2771
2990
|
this.emit("input", { value: this.value, hsv: this.hsv, rgb: this.rgb });
|
|
2772
2991
|
}
|
|
2773
|
-
#
|
|
2992
|
+
#k() {
|
|
2774
2993
|
this.emit("change", { value: this.value, hsv: this.hsv, rgb: this.rgb });
|
|
2775
2994
|
}
|
|
2776
2995
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2777
2996
|
// Attribute changed
|
|
2778
2997
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2779
2998
|
attributeChangedCallback(t, e, s) {
|
|
2780
|
-
if (e !== s && t === "value" && this.#
|
|
2999
|
+
if (e !== s && t === "value" && this.#c && s) {
|
|
2781
3000
|
const i = A(s);
|
|
2782
|
-
i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this.#
|
|
3001
|
+
i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this.#U(), this.#x(), this.#_(), this.#H(), this.#O());
|
|
2783
3002
|
}
|
|
2784
3003
|
}
|
|
2785
3004
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2786
3005
|
// Public API
|
|
2787
3006
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2788
3007
|
get value() {
|
|
2789
|
-
return this.#
|
|
3008
|
+
return this.#N();
|
|
2790
3009
|
}
|
|
2791
3010
|
set value(t) {
|
|
2792
3011
|
const e = A(t);
|
|
@@ -2828,19 +3047,19 @@ class pt extends u {
|
|
|
2828
3047
|
getFormattedValue(t) {
|
|
2829
3048
|
const e = this.format;
|
|
2830
3049
|
this.format = t;
|
|
2831
|
-
const s = this.#
|
|
3050
|
+
const s = this.#N();
|
|
2832
3051
|
return this.format = e, s;
|
|
2833
3052
|
}
|
|
2834
3053
|
}
|
|
2835
|
-
customElements.define("ry-color-picker",
|
|
2836
|
-
class
|
|
3054
|
+
customElements.define("ry-color-picker", bt);
|
|
3055
|
+
class yt extends u {
|
|
2837
3056
|
#t = null;
|
|
2838
3057
|
#e = null;
|
|
2839
3058
|
#i = null;
|
|
2840
3059
|
#s = null;
|
|
2841
3060
|
static observedAttributes = ["value", "format", "opacity", "disabled", "placeholder"];
|
|
2842
3061
|
setup() {
|
|
2843
|
-
this.#r(), this.#a(), this.#
|
|
3062
|
+
this.#r(), this.#a(), this.#b(), this.state = "closed";
|
|
2844
3063
|
}
|
|
2845
3064
|
#r() {
|
|
2846
3065
|
const t = this.hasAttribute("opacity"), e = this.getAttribute("format") || "hex", s = this.getAttribute("value") || "#000000", i = this.getAttribute("placeholder") || "#000000";
|
|
@@ -2872,12 +3091,12 @@ class gt extends u {
|
|
|
2872
3091
|
`, this.#t = this.$('[data-ry-target="swatch"]'), this.#e = this.$('[data-ry-target="input"]'), this.#i = this.$('[data-ry-target="panel"]'), this.#s = this.$('[data-ry-target="picker"]');
|
|
2873
3092
|
}
|
|
2874
3093
|
#a() {
|
|
2875
|
-
this.#t && this.on(this.#t, "click", this.#o), this.#e && (this.on(this.#e, "input", this.#h), this.on(this.#e, "keydown", this.#
|
|
3094
|
+
this.#t && this.on(this.#t, "click", this.#o), this.#e && (this.on(this.#e, "input", this.#h), this.on(this.#e, "keydown", this.#u), this.on(this.#e, "focus", this.#l)), this.#s && (this.on(this.#s, "ry:input", this.#p), this.on(this.#s, "ry:change", this.#m)), this.on(document, "click", this.#f), this.on(document, "keydown", this.#w);
|
|
2876
3095
|
}
|
|
2877
3096
|
#o = () => {
|
|
2878
3097
|
this.disabled || (this.state === "open" ? this.close() : this.open());
|
|
2879
3098
|
};
|
|
2880
|
-
#
|
|
3099
|
+
#l = () => {
|
|
2881
3100
|
this.disabled || this.open();
|
|
2882
3101
|
};
|
|
2883
3102
|
#h = () => {
|
|
@@ -2889,10 +3108,10 @@ class gt extends u {
|
|
|
2889
3108
|
const n = Math.min(e, r.length);
|
|
2890
3109
|
this.#e.setSelectionRange(n, n);
|
|
2891
3110
|
}
|
|
2892
|
-
const a = this.#
|
|
2893
|
-
a && (this.#s.setColor(a), this.#
|
|
3111
|
+
const a = this.#c(r);
|
|
3112
|
+
a && (this.#s.setColor(a), this.#d(), this.#n(r) && this.#v(), this.emit("input", { value: this.value }));
|
|
2894
3113
|
};
|
|
2895
|
-
#
|
|
3114
|
+
#c(t) {
|
|
2896
3115
|
let e = t;
|
|
2897
3116
|
e.startsWith("#") || (e = "#" + e);
|
|
2898
3117
|
const s = e.slice(1);
|
|
@@ -2909,19 +3128,19 @@ class gt extends u {
|
|
|
2909
3128
|
#n(t) {
|
|
2910
3129
|
return !!(/^#[a-fA-F0-9]{6}$/.test(t) || /^#[a-fA-F0-9]{3}$/.test(t));
|
|
2911
3130
|
}
|
|
2912
|
-
#
|
|
3131
|
+
#u = (t) => {
|
|
2913
3132
|
t.key === "Enter" && (t.preventDefault(), this.#h(), this.emit("change", { value: this.value }));
|
|
2914
3133
|
};
|
|
2915
|
-
#
|
|
2916
|
-
!this.#s || !this.#e || (document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#
|
|
3134
|
+
#p = () => {
|
|
3135
|
+
!this.#s || !this.#e || (document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#d(), this.#v(), this.emit("input", { value: this.value }));
|
|
2917
3136
|
};
|
|
2918
3137
|
#m = () => {
|
|
2919
3138
|
this.emit("change", { value: this.value });
|
|
2920
3139
|
};
|
|
2921
|
-
#
|
|
3140
|
+
#f = (t) => {
|
|
2922
3141
|
this.state === "open" && (this.contains(t.target) || this.close());
|
|
2923
3142
|
};
|
|
2924
|
-
#
|
|
3143
|
+
#w = (t) => {
|
|
2925
3144
|
t.key === "Escape" && this.state === "open" && (this.close(), this.#t?.focus());
|
|
2926
3145
|
};
|
|
2927
3146
|
open() {
|
|
@@ -2935,21 +3154,21 @@ class gt extends u {
|
|
|
2935
3154
|
const t = this.getBoundingClientRect(), e = 280, i = window.innerHeight - t.bottom, r = t.top;
|
|
2936
3155
|
i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
|
|
2937
3156
|
}
|
|
2938
|
-
#
|
|
3157
|
+
#d() {
|
|
2939
3158
|
const t = this.$('[data-ry-target="swatch-color"]');
|
|
2940
3159
|
if (t && this.#s) {
|
|
2941
3160
|
const e = this.#s.rgb, s = this.hasAttribute("opacity") ? this.#s.alpha / 100 : 1;
|
|
2942
3161
|
t.style.backgroundColor = `rgba(${e.r}, ${e.g}, ${e.b}, ${s})`;
|
|
2943
3162
|
}
|
|
2944
3163
|
}
|
|
2945
|
-
#
|
|
3164
|
+
#b() {
|
|
2946
3165
|
const t = this.getAttribute("value") || "#000000";
|
|
2947
3166
|
if (this.#s) {
|
|
2948
3167
|
if (this.#s.setColor(t), this.#e) {
|
|
2949
3168
|
const e = this.#s.value;
|
|
2950
3169
|
this.#e.value = e.startsWith("#") ? e : "#" + e;
|
|
2951
3170
|
}
|
|
2952
|
-
this.#
|
|
3171
|
+
this.#d();
|
|
2953
3172
|
}
|
|
2954
3173
|
}
|
|
2955
3174
|
#v() {
|
|
@@ -2959,14 +3178,14 @@ class gt extends u {
|
|
|
2959
3178
|
}
|
|
2960
3179
|
}
|
|
2961
3180
|
attributeChangedCallback(t, e, s) {
|
|
2962
|
-
e !== s && (t === "value" && this.#s && this.#e && s && (this.#s.setColor(s), document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#
|
|
3181
|
+
e !== s && (t === "value" && this.#s && this.#e && s && (this.#s.setColor(s), document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#d()), t === "disabled" && this.#e && (s !== null ? this.#e.setAttribute("disabled", "") : this.#e.removeAttribute("disabled")));
|
|
2963
3182
|
}
|
|
2964
3183
|
// Public API
|
|
2965
3184
|
get value() {
|
|
2966
3185
|
return this.#s?.value ?? this.getAttribute("value") ?? "#000000";
|
|
2967
3186
|
}
|
|
2968
3187
|
set value(t) {
|
|
2969
|
-
this.#s?.setColor(t) && (this.#e && (this.#e.value = this.#s.value), this.#
|
|
3188
|
+
this.#s?.setColor(t) && (this.#e && (this.#e.value = this.#s.value), this.#d(), this.#v());
|
|
2970
3189
|
}
|
|
2971
3190
|
get disabled() {
|
|
2972
3191
|
return this.hasAttribute("disabled");
|
|
@@ -2984,7 +3203,7 @@ class gt extends u {
|
|
|
2984
3203
|
return this.#s?.hsv ?? { h: 0, s: 0, v: 0 };
|
|
2985
3204
|
}
|
|
2986
3205
|
}
|
|
2987
|
-
customElements.define("ry-color-input",
|
|
3206
|
+
customElements.define("ry-color-input", yt);
|
|
2988
3207
|
function x(h) {
|
|
2989
3208
|
const t = h.trim().toLowerCase();
|
|
2990
3209
|
if (t.startsWith("#")) {
|
|
@@ -3017,19 +3236,19 @@ function x(h) {
|
|
|
3017
3236
|
}
|
|
3018
3237
|
return null;
|
|
3019
3238
|
}
|
|
3020
|
-
function
|
|
3239
|
+
function mt(h) {
|
|
3021
3240
|
const t = (e) => Math.max(0, Math.min(255, e)).toString(16).padStart(2, "0");
|
|
3022
3241
|
return `#${t(h.r)}${t(h.g)}${t(h.b)}`;
|
|
3023
3242
|
}
|
|
3024
|
-
function
|
|
3243
|
+
function vt(h, t, e) {
|
|
3025
3244
|
return {
|
|
3026
3245
|
r: Math.round(h.r + (t.r - h.r) * e),
|
|
3027
3246
|
g: Math.round(h.g + (t.g - h.g) * e),
|
|
3028
3247
|
b: Math.round(h.b + (t.b - h.b) * e)
|
|
3029
3248
|
};
|
|
3030
3249
|
}
|
|
3031
|
-
const I = "linear-gradient(90deg, #000000 0%, #ffffff 100%)",
|
|
3032
|
-
class
|
|
3250
|
+
const I = "linear-gradient(90deg, #000000 0%, #ffffff 100%)", At = 50;
|
|
3251
|
+
class wt extends u {
|
|
3033
3252
|
#t = "linear";
|
|
3034
3253
|
#e = 90;
|
|
3035
3254
|
#i = "circle";
|
|
@@ -3037,13 +3256,13 @@ class mt extends u {
|
|
|
3037
3256
|
#r = null;
|
|
3038
3257
|
#a = 0;
|
|
3039
3258
|
#o = null;
|
|
3040
|
-
#
|
|
3259
|
+
#l = !1;
|
|
3041
3260
|
#h = null;
|
|
3042
|
-
#
|
|
3261
|
+
#c = !1;
|
|
3043
3262
|
// Cached DOM refs
|
|
3044
3263
|
#n = null;
|
|
3045
|
-
#p = null;
|
|
3046
3264
|
#u = null;
|
|
3265
|
+
#p = null;
|
|
3047
3266
|
static observedAttributes = ["value", "disabled", "output"];
|
|
3048
3267
|
setup() {
|
|
3049
3268
|
this.#m(), this.#Y(), this.#X(), this.#x();
|
|
@@ -3053,12 +3272,12 @@ class mt extends u {
|
|
|
3053
3272
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3054
3273
|
#m() {
|
|
3055
3274
|
const t = this.getAttribute("value") || I;
|
|
3056
|
-
this.#
|
|
3275
|
+
this.#f(t) || this.#f(I);
|
|
3057
3276
|
}
|
|
3058
|
-
#
|
|
3277
|
+
#f(t) {
|
|
3059
3278
|
const e = t.trim();
|
|
3060
3279
|
if (!e.startsWith("linear-gradient(") && !e.startsWith("radial-gradient("))
|
|
3061
|
-
return x(e) ? (this.#t = "solid", this.#s = [this.#
|
|
3280
|
+
return x(e) ? (this.#t = "solid", this.#s = [this.#d(e, 0), this.#d(e, 100)], this.#r = this.#s[0].id, !0) : !1;
|
|
3062
3281
|
let s, i;
|
|
3063
3282
|
e.startsWith("linear-gradient(") ? (s = "linear", i = e.slice(16, -1)) : (s = "radial", i = e.slice(16, -1));
|
|
3064
3283
|
let r = 90, a = "circle", n = i;
|
|
@@ -3069,8 +3288,8 @@ class mt extends u {
|
|
|
3069
3288
|
else {
|
|
3070
3289
|
const g = /^to\s+\w+(?:\s+\w+)?\s*,\s*/.exec(i);
|
|
3071
3290
|
if (g) {
|
|
3072
|
-
const
|
|
3073
|
-
r = this.#
|
|
3291
|
+
const y = g[0].trim().replace(/,\s*$/, "");
|
|
3292
|
+
r = this.#w(y), n = i.slice(g[0].length);
|
|
3074
3293
|
}
|
|
3075
3294
|
}
|
|
3076
3295
|
} else {
|
|
@@ -3080,10 +3299,10 @@ class mt extends u {
|
|
|
3080
3299
|
const o = [], l = /(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\)|hsla?\([^)]+\)|[a-z]+)\s+([\d.]+)%/g;
|
|
3081
3300
|
let c;
|
|
3082
3301
|
for (; (c = l.exec(n)) !== null; )
|
|
3083
|
-
o.push(this.#
|
|
3302
|
+
o.push(this.#d(c[1], parseFloat(c[2])));
|
|
3084
3303
|
return o.length < 2 ? !1 : (this.#t = s, this.#e = r, this.#i = a, this.#s = o, this.#r = o[0].id, !0);
|
|
3085
3304
|
}
|
|
3086
|
-
#
|
|
3305
|
+
#w(t) {
|
|
3087
3306
|
return {
|
|
3088
3307
|
"to top": 0,
|
|
3089
3308
|
"to top right": 45,
|
|
@@ -3104,16 +3323,16 @@ class mt extends u {
|
|
|
3104
3323
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3105
3324
|
// Stop management
|
|
3106
3325
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3107
|
-
#
|
|
3326
|
+
#d(t, e) {
|
|
3108
3327
|
return { id: `stop-${this.#a++}`, color: t, position: e };
|
|
3109
3328
|
}
|
|
3110
3329
|
/** CSS left value clamped so the stop handle stays within the bar */
|
|
3111
|
-
#
|
|
3330
|
+
#b(t) {
|
|
3112
3331
|
const e = "calc(var(--ry-gradient-picker-stop-size, 16px) / 2)";
|
|
3113
3332
|
return `clamp(${e}, ${t}%, calc(100% - ${e}))`;
|
|
3114
3333
|
}
|
|
3115
3334
|
#v(t, e) {
|
|
3116
|
-
const s = this.#
|
|
3335
|
+
const s = this.#d(t, e);
|
|
3117
3336
|
this.#s.push(s), this.#$(), this.#r = s.id, this.#C(), this.#x();
|
|
3118
3337
|
}
|
|
3119
3338
|
#y(t) {
|
|
@@ -3122,7 +3341,7 @@ class mt extends u {
|
|
|
3122
3341
|
return e === -1 ? !1 : (this.#s.splice(e, 1), this.#r === t && (this.#r = this.#s[Math.min(e, this.#s.length - 1)]?.id ?? null), this.#C(), this.#x(), !0);
|
|
3123
3342
|
}
|
|
3124
3343
|
#M(t) {
|
|
3125
|
-
this.#r !== t && (this.#r = t, this.#
|
|
3344
|
+
this.#r !== t && (this.#r = t, this.#N(), this.#L());
|
|
3126
3345
|
}
|
|
3127
3346
|
#$() {
|
|
3128
3347
|
this.#s.sort((t, e) => t.position - e.position);
|
|
@@ -3160,14 +3379,14 @@ class mt extends u {
|
|
|
3160
3379
|
</div>
|
|
3161
3380
|
<ry-color-picker data-ry-target="picker" inline opacity></ry-color-picker>
|
|
3162
3381
|
${o}
|
|
3163
|
-
`, this.#n = this.$('[data-ry-target="bar"]'), this.#
|
|
3382
|
+
`, this.#n = this.$('[data-ry-target="bar"]'), this.#u = this.$('[data-ry-target="picker"]'), this.#p = this.$('[data-ry-target="output"]'), this.#C();
|
|
3164
3383
|
}
|
|
3165
3384
|
#C() {
|
|
3166
3385
|
if (this.#n) {
|
|
3167
3386
|
this.#n.querySelectorAll('[data-ry-target="stop"]').forEach((t) => t.remove());
|
|
3168
3387
|
for (const t of this.#s) {
|
|
3169
3388
|
const e = document.createElement("div");
|
|
3170
|
-
e.setAttribute("data-ry-target", "stop"), e.setAttribute("data-stop-id", t.id), e.classList.add("ry-gradient-picker__stop"), e.tabIndex = 0, e.style.left = this.#
|
|
3389
|
+
e.setAttribute("data-ry-target", "stop"), e.setAttribute("data-stop-id", t.id), e.classList.add("ry-gradient-picker__stop"), e.tabIndex = 0, e.style.left = this.#b(t.position), e.style.setProperty("--stop-color", t.color), t.id === this.#r && e.setAttribute("data-selected", ""), this.#n.appendChild(e);
|
|
3171
3390
|
}
|
|
3172
3391
|
}
|
|
3173
3392
|
}
|
|
@@ -3181,9 +3400,9 @@ class mt extends u {
|
|
|
3181
3400
|
const i = this.$('[data-ry-target="angle-select"]');
|
|
3182
3401
|
i && this.on(i, "ry:input", this.#z);
|
|
3183
3402
|
const r = this.$('[data-ry-target="shape-circle"]'), a = this.$('[data-ry-target="shape-ellipse"]');
|
|
3184
|
-
r && this.on(r, "click", () => this.#P("circle")), a && this.on(a, "click", () => this.#P("ellipse")), this.#
|
|
3403
|
+
r && this.on(r, "click", () => this.#P("circle")), a && this.on(a, "click", () => this.#P("ellipse")), this.#u && (this.on(this.#u, "ry:input", this.#R), this.on(this.#u, "ry:change", this.#T)), this.#p && (this.on(this.#p, "keydown", this.#F), this.on(this.#p, "blur", this.#j));
|
|
3185
3404
|
const n = this.$('[data-ry-target="copy-btn"]');
|
|
3186
|
-
n && this.on(n, "click", this.#
|
|
3405
|
+
n && this.on(n, "click", this.#V), this.#n && this.on(this.#n, "keydown", this.#J);
|
|
3187
3406
|
}
|
|
3188
3407
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3189
3408
|
// Bar / Stop interaction handlers
|
|
@@ -3194,11 +3413,11 @@ class mt extends u {
|
|
|
3194
3413
|
if (s) {
|
|
3195
3414
|
const i = s.getAttribute("data-stop-id");
|
|
3196
3415
|
if (!i) return;
|
|
3197
|
-
t.preventDefault(), this.#o = i, this.#
|
|
3416
|
+
t.preventDefault(), this.#o = i, this.#l = !1, this.#h = this.#n.getBoundingClientRect(), this.#M(i), this.#n.setPointerCapture(t.pointerId), s.focus();
|
|
3198
3417
|
} else {
|
|
3199
3418
|
if (t.preventDefault(), !this.#n) return;
|
|
3200
|
-
const i = this.#n.getBoundingClientRect(), r = Math.round(Math.max(0, Math.min(100, (t.clientX - i.left) / i.width * 100))), a = this.#
|
|
3201
|
-
this.#v(a, r), this.#n.querySelector(`[data-stop-id="${this.#r}"]`)?.focus(), this.#o = this.#r, this.#
|
|
3419
|
+
const i = this.#n.getBoundingClientRect(), r = Math.round(Math.max(0, Math.min(100, (t.clientX - i.left) / i.width * 100))), a = this.#U(r);
|
|
3420
|
+
this.#v(a, r), this.#n.querySelector(`[data-stop-id="${this.#r}"]`)?.focus(), this.#o = this.#r, this.#l = !1, this.#h = i, this.#n.setPointerCapture(t.pointerId), this.#D();
|
|
3202
3421
|
}
|
|
3203
3422
|
};
|
|
3204
3423
|
#K = (t) => {
|
|
@@ -3208,12 +3427,12 @@ class mt extends u {
|
|
|
3208
3427
|
const s = Math.max(0, Math.min(1, (t.clientX - this.#h.left) / this.#h.width));
|
|
3209
3428
|
e.position = Math.round(s * 100);
|
|
3210
3429
|
const i = this.#h.top + this.#h.height / 2, r = Math.abs(t.clientY - i);
|
|
3211
|
-
this.#
|
|
3430
|
+
this.#l = r > At && this.#s.length > 2;
|
|
3212
3431
|
const a = this.#n?.querySelector(`[data-stop-id="${e.id}"]`);
|
|
3213
|
-
a && (a.style.left = this.#
|
|
3432
|
+
a && (a.style.left = this.#b(e.position), this.#l ? (a.style.opacity = "0.3", a.style.transform = "translate(-50%, -50%) scale(0.7)") : (a.style.opacity = "", a.style.transform = "")), this.#$(), this.#O(), this.#H(), this.#k(), this.#D();
|
|
3214
3433
|
};
|
|
3215
3434
|
#q = () => {
|
|
3216
|
-
this.#o && (this.#
|
|
3435
|
+
this.#o && (this.#l && this.#y(this.#o), this.#o = null, this.#l = !1, this.#h = null, this.#S(), this.#B());
|
|
3217
3436
|
};
|
|
3218
3437
|
#J = (t) => {
|
|
3219
3438
|
if (this.disabled) return;
|
|
@@ -3237,27 +3456,27 @@ class mt extends u {
|
|
|
3237
3456
|
this.#y(i) && (this.#D(), this.#B()), t.preventDefault();
|
|
3238
3457
|
return;
|
|
3239
3458
|
}
|
|
3240
|
-
n && (t.preventDefault(), this.#$(), this.#W(), this.#
|
|
3459
|
+
n && (t.preventDefault(), this.#$(), this.#W(), this.#O(), this.#H(), this.#k(), this.#S(), this.#D(), this.#B());
|
|
3241
3460
|
};
|
|
3242
3461
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3243
3462
|
// Type / Angle / Shape handlers
|
|
3244
3463
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3245
3464
|
#E(t) {
|
|
3246
|
-
this.#t !== t && (this.#t = t, this.setAttribute("data-ry-type", t), this.#_(), this.#H(), this.#
|
|
3465
|
+
this.#t !== t && (this.#t = t, this.setAttribute("data-ry-type", t), this.#_(), this.#H(), this.#k(), this.#S(), this.#D(), this.#B());
|
|
3247
3466
|
}
|
|
3248
3467
|
#z = (t) => {
|
|
3249
3468
|
const e = t.detail;
|
|
3250
|
-
this.#e = e.value, this.#H(), this.#
|
|
3469
|
+
this.#e = e.value, this.#H(), this.#k(), this.#S(), this.#D();
|
|
3251
3470
|
};
|
|
3252
3471
|
#P(t) {
|
|
3253
|
-
this.#i !== t && (this.#i = t, this.#_(), this.#
|
|
3472
|
+
this.#i !== t && (this.#i = t, this.#_(), this.#k(), this.#S(), this.#D(), this.#B());
|
|
3254
3473
|
}
|
|
3255
3474
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3256
3475
|
// Color picker handlers
|
|
3257
3476
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3258
3477
|
#R = () => {
|
|
3259
3478
|
const t = this.#I();
|
|
3260
|
-
!t || !this.#
|
|
3479
|
+
!t || !this.#u || (t.color = this.#u.value, this.#Z(t), this.#O(), this.#H(), this.#k(), this.#D());
|
|
3261
3480
|
};
|
|
3262
3481
|
#T = () => {
|
|
3263
3482
|
this.#S(), this.#B();
|
|
@@ -3265,7 +3484,7 @@ class mt extends u {
|
|
|
3265
3484
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3266
3485
|
// Copy handler
|
|
3267
3486
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3268
|
-
#
|
|
3487
|
+
#V = () => {
|
|
3269
3488
|
const t = this.#g();
|
|
3270
3489
|
navigator.clipboard.writeText(t).then(() => {
|
|
3271
3490
|
const e = this.$('[data-ry-target="copy-btn"]');
|
|
@@ -3282,14 +3501,14 @@ class mt extends u {
|
|
|
3282
3501
|
this.#A();
|
|
3283
3502
|
};
|
|
3284
3503
|
#A() {
|
|
3285
|
-
if (!this.#
|
|
3286
|
-
const t = this.#
|
|
3287
|
-
t && this.#
|
|
3504
|
+
if (!this.#p) return;
|
|
3505
|
+
const t = this.#p.value.trim();
|
|
3506
|
+
t && this.#f(t) ? (this.#C(), this.#x(), this.#S(), this.#D(), this.#B()) : this.#k();
|
|
3288
3507
|
}
|
|
3289
3508
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3290
3509
|
// Color interpolation
|
|
3291
3510
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3292
|
-
#
|
|
3511
|
+
#U(t) {
|
|
3293
3512
|
if (this.#s.length === 0) return "#808080";
|
|
3294
3513
|
if (this.#s.length === 1) return this.#s[0].color;
|
|
3295
3514
|
const e = [...this.#s].sort((l, c) => l.position - c.position);
|
|
@@ -3304,13 +3523,13 @@ class mt extends u {
|
|
|
3304
3523
|
const r = i.position - s.position;
|
|
3305
3524
|
if (r === 0) return s.color;
|
|
3306
3525
|
const a = (t - s.position) / r, n = x(s.color), o = x(i.color);
|
|
3307
|
-
return !n || !o ? s.color :
|
|
3526
|
+
return !n || !o ? s.color : mt(vt(n, o, a));
|
|
3308
3527
|
}
|
|
3309
3528
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3310
3529
|
// Update methods
|
|
3311
3530
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3312
3531
|
#x() {
|
|
3313
|
-
this.setAttribute("data-ry-type", this.#t), this.#_(), this.#
|
|
3532
|
+
this.setAttribute("data-ry-type", this.#t), this.#_(), this.#O(), this.#H(), this.#W(), this.#N(), this.#L(), this.#k();
|
|
3314
3533
|
}
|
|
3315
3534
|
#_() {
|
|
3316
3535
|
const t = this.$('[data-ry-target="type-solid"]'), e = this.$('[data-ry-target="type-linear"]'), s = this.$('[data-ry-target="type-radial"]');
|
|
@@ -3321,11 +3540,11 @@ class mt extends u {
|
|
|
3321
3540
|
a && a.setAttribute("value", String(this.#e));
|
|
3322
3541
|
}
|
|
3323
3542
|
#H() {
|
|
3324
|
-
if (!this.#
|
|
3325
|
-
const t = this.#
|
|
3543
|
+
if (!this.#u) return;
|
|
3544
|
+
const t = this.#u.querySelector('[data-ry-target="preview-color"]');
|
|
3326
3545
|
t && (t.style.backgroundImage = this.#t === "solid" ? "" : this.#g());
|
|
3327
3546
|
}
|
|
3328
|
-
#
|
|
3547
|
+
#O() {
|
|
3329
3548
|
if (!this.#n) return;
|
|
3330
3549
|
const t = this.#s.map((e) => `${e.color} ${e.position}%`).join(", ");
|
|
3331
3550
|
this.#n.style.backgroundImage = `linear-gradient(to right, ${t})`;
|
|
@@ -3334,7 +3553,7 @@ class mt extends u {
|
|
|
3334
3553
|
if (this.#n)
|
|
3335
3554
|
for (const t of this.#s) {
|
|
3336
3555
|
const e = this.#n.querySelector(`[data-stop-id="${t.id}"]`);
|
|
3337
|
-
e && (e.style.left = this.#
|
|
3556
|
+
e && (e.style.left = this.#b(t.position));
|
|
3338
3557
|
}
|
|
3339
3558
|
}
|
|
3340
3559
|
#Z(t) {
|
|
@@ -3342,7 +3561,7 @@ class mt extends u {
|
|
|
3342
3561
|
const e = this.#n.querySelector(`[data-stop-id="${t.id}"]`);
|
|
3343
3562
|
e && e.style.setProperty("--stop-color", t.color);
|
|
3344
3563
|
}
|
|
3345
|
-
#
|
|
3564
|
+
#N() {
|
|
3346
3565
|
if (!this.#n) return;
|
|
3347
3566
|
const t = this.#n.querySelectorAll('[data-ry-target="stop"]');
|
|
3348
3567
|
for (const e of t)
|
|
@@ -3350,14 +3569,14 @@ class mt extends u {
|
|
|
3350
3569
|
}
|
|
3351
3570
|
#L() {
|
|
3352
3571
|
const t = this.#I();
|
|
3353
|
-
!t || !this.#
|
|
3572
|
+
!t || !this.#u || this.#u.setColor(t.color);
|
|
3354
3573
|
}
|
|
3355
|
-
#
|
|
3356
|
-
this.#
|
|
3574
|
+
#k() {
|
|
3575
|
+
this.#p && document.activeElement !== this.#p && (this.#p.value = this.#g());
|
|
3357
3576
|
}
|
|
3358
3577
|
#S() {
|
|
3359
3578
|
const t = this.#g();
|
|
3360
|
-
this.getAttribute("value") !== t && (this.#
|
|
3579
|
+
this.getAttribute("value") !== t && (this.#c = !0, this.setAttribute("value", t), this.#c = !1);
|
|
3361
3580
|
}
|
|
3362
3581
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3363
3582
|
// Events
|
|
@@ -3384,7 +3603,7 @@ class mt extends u {
|
|
|
3384
3603
|
// Attribute changed
|
|
3385
3604
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3386
3605
|
attributeChangedCallback(t, e, s) {
|
|
3387
|
-
e === s || this.#
|
|
3606
|
+
e === s || this.#c || t === "value" && this.#n && s && this.#f(s) && (this.#C(), this.#x());
|
|
3388
3607
|
}
|
|
3389
3608
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3390
3609
|
// Public API
|
|
@@ -3393,7 +3612,7 @@ class mt extends u {
|
|
|
3393
3612
|
return this.#g();
|
|
3394
3613
|
}
|
|
3395
3614
|
set value(t) {
|
|
3396
|
-
this.#
|
|
3615
|
+
this.#f(t) && (this.#C(), this.#x(), this.#S());
|
|
3397
3616
|
}
|
|
3398
3617
|
get type() {
|
|
3399
3618
|
return this.#t;
|
|
@@ -3405,7 +3624,7 @@ class mt extends u {
|
|
|
3405
3624
|
return this.#e;
|
|
3406
3625
|
}
|
|
3407
3626
|
set angle(t) {
|
|
3408
|
-
this.#e = (t % 360 + 360) % 360, this.#_(), this.#
|
|
3627
|
+
this.#e = (t % 360 + 360) % 360, this.#_(), this.#k(), this.#S();
|
|
3409
3628
|
}
|
|
3410
3629
|
get shape() {
|
|
3411
3630
|
return this.#i;
|
|
@@ -3431,16 +3650,16 @@ class mt extends u {
|
|
|
3431
3650
|
}
|
|
3432
3651
|
removeStop(t) {
|
|
3433
3652
|
const e = this.#y(t);
|
|
3434
|
-
return e && (this.#
|
|
3653
|
+
return e && (this.#k(), this.#S(), this.#B()), e;
|
|
3435
3654
|
}
|
|
3436
3655
|
}
|
|
3437
|
-
customElements.define("ry-gradient-picker",
|
|
3438
|
-
let
|
|
3439
|
-
const
|
|
3656
|
+
customElements.define("ry-gradient-picker", wt);
|
|
3657
|
+
let kt = 0;
|
|
3658
|
+
const $t = 5;
|
|
3440
3659
|
function _(h) {
|
|
3441
3660
|
return p(h).replace(/width="24"/g, 'width="16"').replace(/height="24"/g, 'height="16"').replace(/viewBox/, 'class="ry-tree__icon" viewBox');
|
|
3442
3661
|
}
|
|
3443
|
-
class
|
|
3662
|
+
class w extends u {
|
|
3444
3663
|
// Drag state
|
|
3445
3664
|
#t = !1;
|
|
3446
3665
|
#e = !1;
|
|
@@ -3449,7 +3668,7 @@ class k extends u {
|
|
|
3449
3668
|
#r = null;
|
|
3450
3669
|
#a = null;
|
|
3451
3670
|
#o = null;
|
|
3452
|
-
#
|
|
3671
|
+
#l = null;
|
|
3453
3672
|
setup() {
|
|
3454
3673
|
this.#h(), this.on(this, "click", (t) => {
|
|
3455
3674
|
const s = t.target.closest('[data-ry-target="file"]');
|
|
@@ -3472,17 +3691,17 @@ class k extends u {
|
|
|
3472
3691
|
const t = Array.from(this.children), e = document.createElement("ul");
|
|
3473
3692
|
e.className = "ry-tree__root";
|
|
3474
3693
|
for (const s of t)
|
|
3475
|
-
e.appendChild(this.#
|
|
3694
|
+
e.appendChild(this.#c(s));
|
|
3476
3695
|
this.innerHTML = "", this.appendChild(e);
|
|
3477
3696
|
}
|
|
3478
|
-
#
|
|
3697
|
+
#c(t) {
|
|
3479
3698
|
const e = document.createElement("li");
|
|
3480
3699
|
e.className = "ry-tree__item";
|
|
3481
3700
|
const s = t.getAttribute("label") ?? "", i = t.hasAttribute("open"), r = t.hasAttribute("selected"), a = Array.from(t.children).filter(
|
|
3482
3701
|
(o) => o.tagName === "RY-TREE-ITEM"
|
|
3483
3702
|
);
|
|
3484
3703
|
if (a.length > 0) {
|
|
3485
|
-
const o = `ry-tree-${++
|
|
3704
|
+
const o = `ry-tree-${++kt}`, l = document.createElement("input");
|
|
3486
3705
|
l.type = "checkbox", l.id = o, l.className = "ry-tree__toggle", i && (l.checked = !0);
|
|
3487
3706
|
const c = document.createElement("label");
|
|
3488
3707
|
c.htmlFor = o, c.className = "ry-tree__label", c.setAttribute("data-ry-target", "folder"), c.dataset.ryLabel = s, c.innerHTML = `
|
|
@@ -3494,8 +3713,8 @@ class k extends u {
|
|
|
3494
3713
|
d.className = "ry-tree__children-wrapper";
|
|
3495
3714
|
const g = document.createElement("ul");
|
|
3496
3715
|
g.className = "ry-tree__children";
|
|
3497
|
-
for (const
|
|
3498
|
-
g.appendChild(this.#
|
|
3716
|
+
for (const y of a)
|
|
3717
|
+
g.appendChild(this.#c(y));
|
|
3499
3718
|
d.appendChild(g), e.appendChild(l), e.appendChild(c), e.appendChild(d);
|
|
3500
3719
|
} else {
|
|
3501
3720
|
const o = document.createElement("div");
|
|
@@ -3516,9 +3735,9 @@ class k extends u {
|
|
|
3516
3735
|
#n(t) {
|
|
3517
3736
|
return Array.from(t.children).filter(
|
|
3518
3737
|
(s) => s instanceof HTMLElement && s.classList.contains("ry-tree__item")
|
|
3519
|
-
).map((s) => this.#
|
|
3738
|
+
).map((s) => this.#u(s));
|
|
3520
3739
|
}
|
|
3521
|
-
#
|
|
3740
|
+
#u(t) {
|
|
3522
3741
|
const e = t.querySelector(':scope > [data-ry-target="folder"]'), s = t.querySelector(':scope > [data-ry-target="file"]');
|
|
3523
3742
|
if (e) {
|
|
3524
3743
|
const r = t.querySelector(":scope > .ry-tree__toggle"), a = t.querySelector(".ry-tree__children"), n = { label: e.dataset.ryLabel ?? "" };
|
|
@@ -3535,32 +3754,32 @@ class k extends u {
|
|
|
3535
3754
|
static from(t) {
|
|
3536
3755
|
const e = document.createElement("ry-tree");
|
|
3537
3756
|
for (const s of t)
|
|
3538
|
-
e.appendChild(
|
|
3757
|
+
e.appendChild(w.#p(s));
|
|
3539
3758
|
return e;
|
|
3540
3759
|
}
|
|
3541
|
-
static #
|
|
3760
|
+
static #p(t) {
|
|
3542
3761
|
const e = document.createElement("ry-tree-item");
|
|
3543
3762
|
if (e.setAttribute("label", t.label), t.open && e.setAttribute("open", ""), t.selected && e.setAttribute("selected", ""), t.children)
|
|
3544
3763
|
for (const s of t.children)
|
|
3545
|
-
e.appendChild(
|
|
3764
|
+
e.appendChild(w.#p(s));
|
|
3546
3765
|
return e;
|
|
3547
3766
|
}
|
|
3548
3767
|
// ── Drag and Drop ──────────────────────────────────────────
|
|
3549
3768
|
#m() {
|
|
3550
|
-
this.on(this, "pointerdown", this.#
|
|
3769
|
+
this.on(this, "pointerdown", this.#f), this.on(document, "pointermove", this.#w), this.on(document, "pointerup", this.#g);
|
|
3551
3770
|
}
|
|
3552
|
-
#
|
|
3771
|
+
#f = (t) => {
|
|
3553
3772
|
const s = t.target.closest(".ry-tree__label, .ry-tree__file");
|
|
3554
3773
|
if (!s) return;
|
|
3555
3774
|
const i = s.closest(".ry-tree__item");
|
|
3556
3775
|
i && (this.#t = !0, this.#i = t.clientX, this.#s = t.clientY, this.#r = i);
|
|
3557
3776
|
};
|
|
3558
|
-
#
|
|
3777
|
+
#w = (t) => {
|
|
3559
3778
|
if (!this.#t && !this.#e) return;
|
|
3560
3779
|
if (this.#t && !this.#e) {
|
|
3561
3780
|
const c = t.clientX - this.#i, d = t.clientY - this.#s;
|
|
3562
|
-
if (Math.hypot(c, d) <
|
|
3563
|
-
this.#t = !1, this.#e = !0, this.#
|
|
3781
|
+
if (Math.hypot(c, d) < $t) return;
|
|
3782
|
+
this.#t = !1, this.#e = !0, this.#d(t);
|
|
3564
3783
|
}
|
|
3565
3784
|
if (!this.#e || !this.#a) return;
|
|
3566
3785
|
this.#a.style.left = `${t.clientX + 12}px`, this.#a.style.top = `${t.clientY - 14}px`, this.#a.style.display = "none";
|
|
@@ -3588,9 +3807,9 @@ class k extends u {
|
|
|
3588
3807
|
o && a > n * 0.25 && a < n * 0.75 ? l = "inside" : a < n * 0.5 ? l = "before" : l = "after", this.#v(i, l);
|
|
3589
3808
|
};
|
|
3590
3809
|
#g = () => {
|
|
3591
|
-
this.#e && this.#
|
|
3810
|
+
this.#e && this.#b(), this.#t = !1, this.#e = !1, this.#r = null;
|
|
3592
3811
|
};
|
|
3593
|
-
#
|
|
3812
|
+
#d(t) {
|
|
3594
3813
|
if (!this.#r) return;
|
|
3595
3814
|
t.preventDefault(), this.#r.setAttribute("data-ry-dragging", ""), this.#r.classList.add("ry-tree__item--collapsed");
|
|
3596
3815
|
const e = this.#r.querySelector(".ry-tree__label, .ry-tree__file");
|
|
@@ -3598,16 +3817,16 @@ class k extends u {
|
|
|
3598
3817
|
const s = e.cloneNode(!0);
|
|
3599
3818
|
s.className = "ry-tree__ghost", s.style.display = "flex", s.style.alignItems = "center", s.style.gap = "var(--ry-space-2, 0.5rem)", s.style.padding = "var(--ry-space-1, 0.25rem) var(--ry-space-2, 0.5rem)", s.style.height = "28px", s.style.fontSize = "var(--ry-text-sm, 0.875rem)", s.style.whiteSpace = "nowrap", s.style.left = `${t.clientX + 12}px`, s.style.top = `${t.clientY - 14}px`, document.body.appendChild(s), this.#a = s;
|
|
3600
3819
|
}
|
|
3601
|
-
#
|
|
3820
|
+
#b() {
|
|
3602
3821
|
this.#a?.parentNode && this.#a.parentNode.removeChild(this.#a), this.#a = null, this.#r?.classList.remove("ry-tree__item--collapsed"), this.#r?.removeAttribute("data-ry-dragging");
|
|
3603
|
-
const t = this.#o, e = this.#
|
|
3822
|
+
const t = this.#o, e = this.#l;
|
|
3604
3823
|
this.#y(), this.#r && t && e && this.#M(this.#r, t, e);
|
|
3605
3824
|
}
|
|
3606
3825
|
#v(t, e) {
|
|
3607
|
-
this.#o === t && this.#
|
|
3826
|
+
this.#o === t && this.#l === e || (this.#y(), t.setAttribute("data-ry-drop-target", e), this.#o = t, this.#l = e);
|
|
3608
3827
|
}
|
|
3609
3828
|
#y() {
|
|
3610
|
-
this.#o?.removeAttribute("data-ry-drop-target"), this.#o = null, this.#
|
|
3829
|
+
this.#o?.removeAttribute("data-ry-drop-target"), this.#o = null, this.#l = null;
|
|
3611
3830
|
}
|
|
3612
3831
|
#M(t, e, s) {
|
|
3613
3832
|
if (s === "inside" && e.contains(t)) return;
|
|
@@ -3635,12 +3854,12 @@ class k extends u {
|
|
|
3635
3854
|
return e?.dataset.ryLabel ?? s?.dataset.ryLabel ?? "";
|
|
3636
3855
|
}
|
|
3637
3856
|
}
|
|
3638
|
-
class
|
|
3857
|
+
class xt extends u {
|
|
3639
3858
|
// Declarative container consumed by RyTree#build
|
|
3640
3859
|
}
|
|
3641
|
-
customElements.define("ry-tree",
|
|
3642
|
-
customElements.define("ry-tree-item",
|
|
3643
|
-
class
|
|
3860
|
+
customElements.define("ry-tree", w);
|
|
3861
|
+
customElements.define("ry-tree-item", xt);
|
|
3862
|
+
class _t extends u {
|
|
3644
3863
|
setup() {
|
|
3645
3864
|
this.#t();
|
|
3646
3865
|
}
|
|
@@ -3661,8 +3880,8 @@ class wt extends u {
|
|
|
3661
3880
|
return this.$('[data-ry-target="label"]')?.textContent?.trim() ?? "";
|
|
3662
3881
|
}
|
|
3663
3882
|
}
|
|
3664
|
-
customElements.define("ry-tag",
|
|
3665
|
-
class
|
|
3883
|
+
customElements.define("ry-tag", _t);
|
|
3884
|
+
class Mt extends u {
|
|
3666
3885
|
#t = [];
|
|
3667
3886
|
setup() {
|
|
3668
3887
|
this.#e(), this.#i();
|
|
@@ -3697,7 +3916,7 @@ class $t extends u {
|
|
|
3697
3916
|
else if (t.key === "Tab")
|
|
3698
3917
|
return;
|
|
3699
3918
|
}
|
|
3700
|
-
t.key === "Backspace" && !e.value && this.#t.length > 0 && this.#
|
|
3919
|
+
t.key === "Backspace" && !e.value && this.#t.length > 0 && this.#l();
|
|
3701
3920
|
};
|
|
3702
3921
|
#r = (t) => {
|
|
3703
3922
|
t.preventDefault();
|
|
@@ -3722,7 +3941,7 @@ class $t extends u {
|
|
|
3722
3941
|
}
|
|
3723
3942
|
this.#h(), this.emit("add", { value: t }), this.emit("change", { values: [...this.#t] });
|
|
3724
3943
|
}
|
|
3725
|
-
#
|
|
3944
|
+
#l() {
|
|
3726
3945
|
const e = this.$('[data-ry-target="tags"]')?.lastElementChild;
|
|
3727
3946
|
if (e) {
|
|
3728
3947
|
const s = e.dataset.value ?? "";
|
|
@@ -3741,11 +3960,11 @@ class $t extends u {
|
|
|
3741
3960
|
return [...this.#t];
|
|
3742
3961
|
}
|
|
3743
3962
|
}
|
|
3744
|
-
customElements.define("ry-tag-input",
|
|
3745
|
-
class
|
|
3963
|
+
customElements.define("ry-tag-input", Mt);
|
|
3964
|
+
class Et extends u {
|
|
3746
3965
|
}
|
|
3747
|
-
customElements.define("ry-hero",
|
|
3748
|
-
class
|
|
3966
|
+
customElements.define("ry-hero", Et);
|
|
3967
|
+
class Ct extends u {
|
|
3749
3968
|
setup() {
|
|
3750
3969
|
this.#t();
|
|
3751
3970
|
}
|
|
@@ -3758,8 +3977,8 @@ class _t extends u {
|
|
|
3758
3977
|
`;
|
|
3759
3978
|
}
|
|
3760
3979
|
}
|
|
3761
|
-
customElements.define("ry-stat",
|
|
3762
|
-
class
|
|
3980
|
+
customElements.define("ry-stat", Ct);
|
|
3981
|
+
class St extends u {
|
|
3763
3982
|
setup() {
|
|
3764
3983
|
this.#t();
|
|
3765
3984
|
}
|
|
@@ -3773,17 +3992,17 @@ class Mt extends u {
|
|
|
3773
3992
|
s.setAttribute("data-ry-target", "icon"), s.className = "ry-feature__icon", s.innerHTML = e, this.insertBefore(s, this.firstChild);
|
|
3774
3993
|
}
|
|
3775
3994
|
}
|
|
3776
|
-
class
|
|
3995
|
+
class Tt extends u {
|
|
3777
3996
|
}
|
|
3778
|
-
customElements.define("ry-feature",
|
|
3779
|
-
customElements.define("ry-feature-grid",
|
|
3780
|
-
class
|
|
3997
|
+
customElements.define("ry-feature", St);
|
|
3998
|
+
customElements.define("ry-feature-grid", Tt);
|
|
3999
|
+
class Lt extends u {
|
|
3781
4000
|
}
|
|
3782
|
-
class
|
|
4001
|
+
class Dt extends u {
|
|
3783
4002
|
}
|
|
3784
|
-
customElements.define("ry-pricing",
|
|
3785
|
-
customElements.define("ry-pricing-card",
|
|
3786
|
-
class
|
|
4003
|
+
customElements.define("ry-pricing", Lt);
|
|
4004
|
+
customElements.define("ry-pricing-card", Dt);
|
|
4005
|
+
class It extends u {
|
|
3787
4006
|
#t = 0;
|
|
3788
4007
|
#e = 0;
|
|
3789
4008
|
#i = null;
|
|
@@ -3818,29 +4037,29 @@ class Tt extends u {
|
|
|
3818
4037
|
}
|
|
3819
4038
|
this.appendChild(a);
|
|
3820
4039
|
}
|
|
3821
|
-
this.on(r, "pointerdown", this.#
|
|
4040
|
+
this.on(r, "pointerdown", this.#l), this.on(r, "pointermove", this.#h), this.on(r, "pointerup", this.#c), this.on(r, "pointercancel", this.#c), this.hasAttribute("pause-on-hover") && (this.on(this, "mouseenter", () => this.#u()), this.on(this, "mouseleave", () => this.#n())), this.goTo(0);
|
|
3822
4041
|
}
|
|
3823
4042
|
#o = (t) => {
|
|
3824
4043
|
t.key === "ArrowLeft" ? (t.preventDefault(), this.prev()) : t.key === "ArrowRight" && (t.preventDefault(), this.next());
|
|
3825
4044
|
};
|
|
3826
|
-
#
|
|
4045
|
+
#l = (t) => {
|
|
3827
4046
|
this.#s = t.clientX, this.#r = !0, t.currentTarget.setPointerCapture(t.pointerId);
|
|
3828
4047
|
};
|
|
3829
4048
|
#h = (t) => {
|
|
3830
4049
|
this.#r && t.preventDefault();
|
|
3831
4050
|
};
|
|
3832
|
-
#
|
|
4051
|
+
#c = (t) => {
|
|
3833
4052
|
if (!this.#r) return;
|
|
3834
4053
|
this.#r = !1;
|
|
3835
4054
|
const e = t.clientX - this.#s, s = 50;
|
|
3836
4055
|
e > s ? this.prev() : e < -s && this.next();
|
|
3837
4056
|
};
|
|
3838
4057
|
#n() {
|
|
3839
|
-
if (this.#
|
|
4058
|
+
if (this.#u(), !this.hasAttribute("autoplay")) return;
|
|
3840
4059
|
const t = parseInt(this.getAttribute("interval") ?? "5000", 10);
|
|
3841
4060
|
this.#i = setInterval(() => this.next(), t);
|
|
3842
4061
|
}
|
|
3843
|
-
#
|
|
4062
|
+
#u() {
|
|
3844
4063
|
this.#i && (clearInterval(this.#i), this.#i = null);
|
|
3845
4064
|
}
|
|
3846
4065
|
goTo(t) {
|
|
@@ -3860,55 +4079,57 @@ class Tt extends u {
|
|
|
3860
4079
|
this.goTo(this.#t - 1);
|
|
3861
4080
|
}
|
|
3862
4081
|
teardown() {
|
|
3863
|
-
this.#
|
|
4082
|
+
this.#u();
|
|
3864
4083
|
}
|
|
3865
4084
|
}
|
|
3866
|
-
customElements.define("ry-carousel",
|
|
4085
|
+
customElements.define("ry-carousel", It);
|
|
3867
4086
|
window.RyToast = f;
|
|
3868
4087
|
console.log("ry-ui loaded");
|
|
3869
4088
|
export {
|
|
3870
4089
|
R as RyAccordion,
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
4090
|
+
V as RyAlert,
|
|
4091
|
+
O as RyButton,
|
|
4092
|
+
N as RyButtonGroup,
|
|
4093
|
+
z as RyCard,
|
|
4094
|
+
It as RyCarousel,
|
|
4095
|
+
rt as RyCode,
|
|
4096
|
+
yt as RyColorInput,
|
|
4097
|
+
bt as RyColorPicker,
|
|
4098
|
+
it as RyCombobox,
|
|
4099
|
+
J as RyDrawer,
|
|
3879
4100
|
j as RyDropdown,
|
|
3880
4101
|
u as RyElement,
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
4102
|
+
at as RyExample,
|
|
4103
|
+
St as RyFeature,
|
|
4104
|
+
Tt as RyFeatureGrid,
|
|
3884
4105
|
U as RyField,
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
4106
|
+
wt as RyGradientPicker,
|
|
4107
|
+
Et as RyHero,
|
|
4108
|
+
nt as RyIcon,
|
|
4109
|
+
ut as RyKnob,
|
|
3889
4110
|
P as RyModal,
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
4111
|
+
pt as RyNumberSelect,
|
|
4112
|
+
Lt as RyPricing,
|
|
4113
|
+
Dt as RyPricingCard,
|
|
4114
|
+
tt as RySelect,
|
|
4115
|
+
dt as RySlider,
|
|
3895
4116
|
K as RySplit,
|
|
3896
|
-
|
|
3897
|
-
|
|
4117
|
+
Ct as RyStat,
|
|
4118
|
+
Y as RySwitch,
|
|
3898
4119
|
F as RyTabs,
|
|
3899
|
-
|
|
3900
|
-
|
|
4120
|
+
_t as RyTag,
|
|
4121
|
+
Mt as RyTagInput,
|
|
3901
4122
|
q as RyThemeToggle,
|
|
3902
4123
|
f as RyToast,
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
4124
|
+
ct as RyToggleButton,
|
|
4125
|
+
G as RyTooltip,
|
|
4126
|
+
w as RyTree,
|
|
4127
|
+
xt as RyTreeItem,
|
|
3907
4128
|
p as getIcon,
|
|
3908
|
-
|
|
4129
|
+
Pt as getIconNames,
|
|
3909
4130
|
C as processTransforms,
|
|
3910
|
-
|
|
3911
|
-
|
|
4131
|
+
Bt as registerIcon,
|
|
4132
|
+
Rt as registerIcons,
|
|
3912
4133
|
M as transform
|
|
3913
4134
|
};
|
|
3914
4135
|
//# sourceMappingURL=ry-ui.js.map
|