@ryanhelsing/ry-ui 1.0.5 → 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 +1 -0
- package/README.md +11 -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 +125 -12
- package/dist/css/ry-theme.css +89 -12
- package/dist/css/ry-ui.css +214 -24
- package/dist/ry-ui.d.ts +1 -0
- package/dist/ry-ui.d.ts.map +1 -1
- package/dist/ry-ui.js +579 -373
- package/dist/ry-ui.js.map +1 -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 {
|
|
@@ -616,7 +617,7 @@ class z extends u {
|
|
|
616
617
|
};
|
|
617
618
|
}
|
|
618
619
|
customElements.define("ry-card", z);
|
|
619
|
-
class
|
|
620
|
+
class V extends u {
|
|
620
621
|
setup() {
|
|
621
622
|
this.#t();
|
|
622
623
|
const t = this.$("[close]");
|
|
@@ -636,8 +637,8 @@ class U extends u {
|
|
|
636
637
|
}, 200), this.emit("close");
|
|
637
638
|
}
|
|
638
639
|
}
|
|
639
|
-
customElements.define("ry-alert",
|
|
640
|
-
class
|
|
640
|
+
customElements.define("ry-alert", V);
|
|
641
|
+
class U extends u {
|
|
641
642
|
static get observedAttributes() {
|
|
642
643
|
return ["label", "error", "hint"];
|
|
643
644
|
}
|
|
@@ -690,7 +691,7 @@ class V extends u {
|
|
|
690
691
|
e && (e.textContent = t ?? "");
|
|
691
692
|
}
|
|
692
693
|
}
|
|
693
|
-
customElements.define("ry-field",
|
|
694
|
+
customElements.define("ry-field", U);
|
|
694
695
|
let W = 0;
|
|
695
696
|
class Y extends u {
|
|
696
697
|
#t = null;
|
|
@@ -754,7 +755,7 @@ class G extends u {
|
|
|
754
755
|
setup() {
|
|
755
756
|
this.#i = `ry-tooltip-${++X}`, this.#s();
|
|
756
757
|
const t = this.firstElementChild;
|
|
757
|
-
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);
|
|
758
759
|
}
|
|
759
760
|
#s() {
|
|
760
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);
|
|
@@ -771,7 +772,7 @@ class G extends u {
|
|
|
771
772
|
#o = () => {
|
|
772
773
|
this.#t && (clearTimeout(this.#t), this.#t = null), this.state = "closed";
|
|
773
774
|
};
|
|
774
|
-
#
|
|
775
|
+
#l = (t) => {
|
|
775
776
|
t.key === "Escape" && this.state === "open" && this.#o();
|
|
776
777
|
};
|
|
777
778
|
teardown() {
|
|
@@ -888,7 +889,7 @@ class f extends u {
|
|
|
888
889
|
}
|
|
889
890
|
}
|
|
890
891
|
customElements.define("ry-toast", f);
|
|
891
|
-
const
|
|
892
|
+
const k = {
|
|
892
893
|
// Close / X
|
|
893
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>',
|
|
894
895
|
// Chevron down
|
|
@@ -959,16 +960,16 @@ const w = {
|
|
|
959
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>'
|
|
960
961
|
};
|
|
961
962
|
function p(h) {
|
|
962
|
-
return
|
|
963
|
+
return k[h] ?? "";
|
|
963
964
|
}
|
|
964
|
-
function
|
|
965
|
-
|
|
965
|
+
function Bt(h, t) {
|
|
966
|
+
k[h] = t;
|
|
966
967
|
}
|
|
967
|
-
function
|
|
968
|
-
Object.assign(
|
|
968
|
+
function Rt(h) {
|
|
969
|
+
Object.assign(k, h);
|
|
969
970
|
}
|
|
970
|
-
function
|
|
971
|
-
return Object.keys(
|
|
971
|
+
function Pt() {
|
|
972
|
+
return Object.keys(k);
|
|
972
973
|
}
|
|
973
974
|
let Q = 0;
|
|
974
975
|
class tt extends u {
|
|
@@ -984,12 +985,12 @@ class tt extends u {
|
|
|
984
985
|
}
|
|
985
986
|
static observedAttributes = ["value", "disabled"];
|
|
986
987
|
setup() {
|
|
987
|
-
this.#t = `ry-select-${++Q}`, this.#o(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.on(this, "click", this.#
|
|
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");
|
|
988
989
|
const t = this.getAttribute("value");
|
|
989
990
|
if (t)
|
|
990
991
|
if (this.#a)
|
|
991
992
|
for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
|
|
992
|
-
this.#
|
|
993
|
+
this.#d(e);
|
|
993
994
|
else
|
|
994
995
|
this.value = t;
|
|
995
996
|
}
|
|
@@ -1047,13 +1048,13 @@ class tt extends u {
|
|
|
1047
1048
|
`;
|
|
1048
1049
|
this._options = t;
|
|
1049
1050
|
}
|
|
1050
|
-
#
|
|
1051
|
+
#l = (t) => {
|
|
1051
1052
|
if (this.hasAttribute("disabled")) return;
|
|
1052
1053
|
const e = t.target, s = e.closest('[data-ry-target="option"]');
|
|
1053
1054
|
if (s instanceof HTMLElement && !s.hasAttribute("data-disabled")) {
|
|
1054
1055
|
if (this.#a) {
|
|
1055
1056
|
const r = s.dataset.value ?? "";
|
|
1056
|
-
this.#
|
|
1057
|
+
this.#d(r);
|
|
1057
1058
|
} else
|
|
1058
1059
|
this.#$(s), this.close();
|
|
1059
1060
|
return;
|
|
@@ -1071,7 +1072,7 @@ class tt extends u {
|
|
|
1071
1072
|
if (i)
|
|
1072
1073
|
if (this.#a) {
|
|
1073
1074
|
const r = i.dataset.value ?? "";
|
|
1074
|
-
this.#
|
|
1075
|
+
this.#d(r);
|
|
1075
1076
|
} else
|
|
1076
1077
|
this.#$(i), this.close();
|
|
1077
1078
|
} else
|
|
@@ -1084,10 +1085,10 @@ class tt extends u {
|
|
|
1084
1085
|
t.preventDefault(), e ? this.#m() : this.open();
|
|
1085
1086
|
break;
|
|
1086
1087
|
case "ArrowUp":
|
|
1087
|
-
t.preventDefault(), e && this.#
|
|
1088
|
+
t.preventDefault(), e && this.#f();
|
|
1088
1089
|
break;
|
|
1089
1090
|
case "Home":
|
|
1090
|
-
e && (t.preventDefault(), this.#
|
|
1091
|
+
e && (t.preventDefault(), this.#w());
|
|
1091
1092
|
break;
|
|
1092
1093
|
case "End":
|
|
1093
1094
|
e && (t.preventDefault(), this.#g());
|
|
@@ -1095,30 +1096,30 @@ class tt extends u {
|
|
|
1095
1096
|
case "Backspace":
|
|
1096
1097
|
if (this.#a && this.#r.size > 0) {
|
|
1097
1098
|
const s = [...this.#r], i = s[s.length - 1];
|
|
1098
|
-
i && this.#
|
|
1099
|
+
i && this.#d(i);
|
|
1099
1100
|
}
|
|
1100
1101
|
break;
|
|
1101
1102
|
default:
|
|
1102
|
-
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#
|
|
1103
|
+
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#u(t.key);
|
|
1103
1104
|
break;
|
|
1104
1105
|
}
|
|
1105
1106
|
};
|
|
1106
|
-
#
|
|
1107
|
+
#c = (t) => {
|
|
1107
1108
|
const e = t.target;
|
|
1108
1109
|
!this.contains(e) && this.state === "open" && this.close();
|
|
1109
1110
|
};
|
|
1110
1111
|
#n = (t) => {
|
|
1111
1112
|
const e = t.detail.value;
|
|
1112
|
-
this.#r.has(e) && this.#
|
|
1113
|
+
this.#r.has(e) && this.#d(e);
|
|
1113
1114
|
};
|
|
1114
|
-
#
|
|
1115
|
+
#u(t) {
|
|
1115
1116
|
this.#s && clearTimeout(this.#s), this.#i += t.toLowerCase();
|
|
1116
1117
|
const e = this.$$('[data-ry-target="option"]:not([data-disabled])'), s = e.findIndex(
|
|
1117
1118
|
(i) => i.textContent?.trim().toLowerCase().startsWith(this.#i)
|
|
1118
1119
|
);
|
|
1119
1120
|
if (s >= 0) {
|
|
1120
1121
|
if (this.state === "open")
|
|
1121
|
-
this.#
|
|
1122
|
+
this.#p(s);
|
|
1122
1123
|
else if (!this.#a) {
|
|
1123
1124
|
const i = e[s];
|
|
1124
1125
|
i && this.#$(i);
|
|
@@ -1128,7 +1129,7 @@ class tt extends u {
|
|
|
1128
1129
|
this.#i = "";
|
|
1129
1130
|
}, 500);
|
|
1130
1131
|
}
|
|
1131
|
-
#
|
|
1132
|
+
#p(t) {
|
|
1132
1133
|
const e = this.$$('[data-ry-target="option"]:not([data-disabled])');
|
|
1133
1134
|
if (t < 0 || t >= e.length) return;
|
|
1134
1135
|
this.$$('[data-ry-target="option"][data-highlighted]').forEach((r) => {
|
|
@@ -1142,21 +1143,21 @@ class tt extends u {
|
|
|
1142
1143
|
}
|
|
1143
1144
|
#m() {
|
|
1144
1145
|
const t = this.$$('[data-ry-target="option"]:not([data-disabled])'), e = Math.min(this.#e + 1, t.length - 1);
|
|
1145
|
-
this.#
|
|
1146
|
+
this.#p(e);
|
|
1146
1147
|
}
|
|
1147
|
-
#
|
|
1148
|
+
#f() {
|
|
1148
1149
|
const t = Math.max(this.#e - 1, 0);
|
|
1149
|
-
this.#
|
|
1150
|
+
this.#p(t);
|
|
1150
1151
|
}
|
|
1151
|
-
#
|
|
1152
|
-
this.#
|
|
1152
|
+
#w() {
|
|
1153
|
+
this.#p(0);
|
|
1153
1154
|
}
|
|
1154
1155
|
#g() {
|
|
1155
1156
|
const t = this.$$('[data-ry-target="option"]:not([data-disabled])');
|
|
1156
|
-
this.#
|
|
1157
|
+
this.#p(t.length - 1);
|
|
1157
1158
|
}
|
|
1158
1159
|
// --- Multi-select methods ---
|
|
1159
|
-
#
|
|
1160
|
+
#d(t) {
|
|
1160
1161
|
const e = this.getAttribute("max-selections");
|
|
1161
1162
|
if (this.#r.has(t))
|
|
1162
1163
|
this.#r.delete(t);
|
|
@@ -1164,9 +1165,9 @@ class tt extends u {
|
|
|
1164
1165
|
if (e && this.#r.size >= parseInt(e, 10)) return;
|
|
1165
1166
|
this.#r.add(t);
|
|
1166
1167
|
}
|
|
1167
|
-
this.#
|
|
1168
|
+
this.#b(), this.#v(), this.#y(), this.setAttribute("value", [...this.#r].join(",")), this.emit("change", { value: this.value, label: "" });
|
|
1168
1169
|
}
|
|
1169
|
-
#
|
|
1170
|
+
#b() {
|
|
1170
1171
|
const t = this.$('[data-ry-target="tags"]'), e = this.$('[data-ry-target="value"]');
|
|
1171
1172
|
if (t) {
|
|
1172
1173
|
t.innerHTML = "";
|
|
@@ -1192,7 +1193,7 @@ class tt extends u {
|
|
|
1192
1193
|
});
|
|
1193
1194
|
}
|
|
1194
1195
|
#M() {
|
|
1195
|
-
this.#r.clear(), this.#
|
|
1196
|
+
this.#r.clear(), this.#b(), this.#v(), this.#y(), this.setAttribute("value", ""), this.emit("change", { value: "", label: "" });
|
|
1196
1197
|
}
|
|
1197
1198
|
// --- Single-select method ---
|
|
1198
1199
|
#$(t) {
|
|
@@ -1208,14 +1209,14 @@ class tt extends u {
|
|
|
1208
1209
|
this.state = "open";
|
|
1209
1210
|
const t = this.$('[data-ry-target="trigger"]');
|
|
1210
1211
|
if (t && t.setAttribute("aria-expanded", "true"), this.#I(), this.#a)
|
|
1211
|
-
this.#
|
|
1212
|
+
this.#p(0);
|
|
1212
1213
|
else {
|
|
1213
1214
|
const e = this.getAttribute("value");
|
|
1214
1215
|
if (e) {
|
|
1215
1216
|
const i = this.$$('[data-ry-target="option"]:not([data-disabled])').findIndex((r) => r.dataset.value === e);
|
|
1216
|
-
i >= 0 && this.#
|
|
1217
|
+
i >= 0 && this.#p(i);
|
|
1217
1218
|
} else
|
|
1218
|
-
this.#
|
|
1219
|
+
this.#p(0);
|
|
1219
1220
|
}
|
|
1220
1221
|
this.emit("open");
|
|
1221
1222
|
}
|
|
@@ -1245,7 +1246,7 @@ class tt extends u {
|
|
|
1245
1246
|
this.#r.clear();
|
|
1246
1247
|
for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
|
|
1247
1248
|
this.#r.add(e);
|
|
1248
|
-
this.#
|
|
1249
|
+
this.#b(), this.#v(), this.#y(), this.setAttribute("value", t);
|
|
1249
1250
|
} else {
|
|
1250
1251
|
const e = this.$(`[data-ry-target="option"][data-value="${t}"]`);
|
|
1251
1252
|
e && this.#$(e);
|
|
@@ -1262,7 +1263,211 @@ class et extends HTMLElement {
|
|
|
1262
1263
|
}
|
|
1263
1264
|
customElements.define("ry-option", et);
|
|
1264
1265
|
customElements.define("ry-select", tt);
|
|
1265
|
-
|
|
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
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
customElements.define("ry-combobox", it);
|
|
1470
|
+
class rt extends u {
|
|
1266
1471
|
#t = "";
|
|
1267
1472
|
static get observedAttributes() {
|
|
1268
1473
|
return ["language", "title", "line-numbers"];
|
|
@@ -1309,9 +1514,9 @@ class st extends u {
|
|
|
1309
1514
|
case "html":
|
|
1310
1515
|
return this.#o(t);
|
|
1311
1516
|
case "json":
|
|
1312
|
-
return this.#
|
|
1517
|
+
return this.#l(t);
|
|
1313
1518
|
default:
|
|
1314
|
-
return this.#
|
|
1519
|
+
return this.#c(t);
|
|
1315
1520
|
}
|
|
1316
1521
|
}
|
|
1317
1522
|
#r(t) {
|
|
@@ -1319,9 +1524,9 @@ class st extends u {
|
|
|
1319
1524
|
let s = t;
|
|
1320
1525
|
for (; s.length > 0; ) {
|
|
1321
1526
|
if (s.startsWith("/*")) {
|
|
1322
|
-
const
|
|
1323
|
-
if (
|
|
1324
|
-
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);
|
|
1325
1530
|
continue;
|
|
1326
1531
|
}
|
|
1327
1532
|
}
|
|
@@ -1367,12 +1572,12 @@ class st extends u {
|
|
|
1367
1572
|
}
|
|
1368
1573
|
const g = s.match(/^([\w-]+)/);
|
|
1369
1574
|
if (g?.[1]) {
|
|
1370
|
-
const
|
|
1371
|
-
["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);
|
|
1372
1577
|
continue;
|
|
1373
1578
|
}
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1579
|
+
const y = s[0];
|
|
1580
|
+
y && e.push({ type: "text", value: y }), s = s.slice(1);
|
|
1376
1581
|
}
|
|
1377
1582
|
return e.map((i) => this.#h(i)).join("");
|
|
1378
1583
|
}
|
|
@@ -1476,7 +1681,7 @@ class st extends u {
|
|
|
1476
1681
|
}
|
|
1477
1682
|
return e.map((i) => this.#h(i)).join("");
|
|
1478
1683
|
}
|
|
1479
|
-
#
|
|
1684
|
+
#l(t) {
|
|
1480
1685
|
const e = [];
|
|
1481
1686
|
let s = t;
|
|
1482
1687
|
for (; s.length > 0; ) {
|
|
@@ -1511,7 +1716,7 @@ class st extends u {
|
|
|
1511
1716
|
return e.map((i) => this.#h(i)).join("");
|
|
1512
1717
|
}
|
|
1513
1718
|
#h(t) {
|
|
1514
|
-
const e = this.#
|
|
1719
|
+
const e = this.#c(t.value);
|
|
1515
1720
|
switch (t.type) {
|
|
1516
1721
|
case "keyword":
|
|
1517
1722
|
return `<span class="ry-code__keyword">${e}</span>`;
|
|
@@ -1539,7 +1744,7 @@ class st extends u {
|
|
|
1539
1744
|
return e;
|
|
1540
1745
|
}
|
|
1541
1746
|
}
|
|
1542
|
-
#
|
|
1747
|
+
#c(t) {
|
|
1543
1748
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1544
1749
|
}
|
|
1545
1750
|
#n(t) {
|
|
@@ -1561,8 +1766,8 @@ class st extends u {
|
|
|
1561
1766
|
this.#t = t, this.#e();
|
|
1562
1767
|
}
|
|
1563
1768
|
}
|
|
1564
|
-
customElements.define("ry-code",
|
|
1565
|
-
class
|
|
1769
|
+
customElements.define("ry-code", rt);
|
|
1770
|
+
class at extends u {
|
|
1566
1771
|
setup() {
|
|
1567
1772
|
const t = this.$("template");
|
|
1568
1773
|
if (!t) return;
|
|
@@ -1606,8 +1811,8 @@ class it extends u {
|
|
|
1606
1811
|
`).trim();
|
|
1607
1812
|
}
|
|
1608
1813
|
}
|
|
1609
|
-
customElements.define("ry-example",
|
|
1610
|
-
class
|
|
1814
|
+
customElements.define("ry-example", at);
|
|
1815
|
+
class nt extends u {
|
|
1611
1816
|
static get observedAttributes() {
|
|
1612
1817
|
return ["name", "size", "label"];
|
|
1613
1818
|
}
|
|
@@ -1640,24 +1845,24 @@ class rt extends u {
|
|
|
1640
1845
|
this.setAttribute("size", String(t));
|
|
1641
1846
|
}
|
|
1642
1847
|
}
|
|
1643
|
-
customElements.define("ry-icon",
|
|
1644
|
-
const
|
|
1645
|
-
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) {
|
|
1646
1851
|
let t = h.parentElement;
|
|
1647
1852
|
for (; t; ) {
|
|
1648
|
-
if (
|
|
1853
|
+
if (ot.some((e) => t.matches(e)))
|
|
1649
1854
|
return t;
|
|
1650
1855
|
t = t.parentElement;
|
|
1651
1856
|
}
|
|
1652
1857
|
return null;
|
|
1653
1858
|
}
|
|
1654
|
-
function
|
|
1859
|
+
function lt(h) {
|
|
1655
1860
|
if (E.has(h)) return;
|
|
1656
1861
|
const t = m.get(h);
|
|
1657
1862
|
if (!t || t.size < 2) return;
|
|
1658
1863
|
const e = /* @__PURE__ */ new Map();
|
|
1659
1864
|
for (const s of t) {
|
|
1660
|
-
const i =
|
|
1865
|
+
const i = ht(s), r = e.get(i) ?? [];
|
|
1661
1866
|
r.push(s), e.set(i, r);
|
|
1662
1867
|
}
|
|
1663
1868
|
if (e.size > 1) {
|
|
@@ -1673,7 +1878,7 @@ function ot(h) {
|
|
|
1673
1878
|
), E.add(h);
|
|
1674
1879
|
}
|
|
1675
1880
|
}
|
|
1676
|
-
class
|
|
1881
|
+
class ct extends u {
|
|
1677
1882
|
static observedAttributes = ["pressed", "disabled", "name", "value"];
|
|
1678
1883
|
#t = !1;
|
|
1679
1884
|
setup() {
|
|
@@ -1684,7 +1889,7 @@ class ht extends u {
|
|
|
1684
1889
|
}
|
|
1685
1890
|
#e() {
|
|
1686
1891
|
const t = this.name;
|
|
1687
|
-
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)));
|
|
1688
1893
|
}
|
|
1689
1894
|
#i() {
|
|
1690
1895
|
if (!this.#t) return;
|
|
@@ -1745,8 +1950,8 @@ class ht extends u {
|
|
|
1745
1950
|
this.setAttribute("icon", t);
|
|
1746
1951
|
}
|
|
1747
1952
|
}
|
|
1748
|
-
customElements.define("ry-toggle-button",
|
|
1749
|
-
class
|
|
1953
|
+
customElements.define("ry-toggle-button", ct);
|
|
1954
|
+
class dt extends u {
|
|
1750
1955
|
#t = !1;
|
|
1751
1956
|
#e = null;
|
|
1752
1957
|
#i = null;
|
|
@@ -1755,7 +1960,7 @@ class lt extends u {
|
|
|
1755
1960
|
#a = /* @__PURE__ */ new Map();
|
|
1756
1961
|
static observedAttributes = ["min", "max", "step", "value", "start", "end", "disabled"];
|
|
1757
1962
|
setup() {
|
|
1758
|
-
this.#o(), this.#h(), this.#
|
|
1963
|
+
this.#o(), this.#h(), this.#b();
|
|
1759
1964
|
}
|
|
1760
1965
|
#o() {
|
|
1761
1966
|
const t = this.hasAttribute("range"), e = this.hasAttribute("labeled"), s = this.hasAttribute("tooltip");
|
|
@@ -1775,9 +1980,9 @@ class lt extends u {
|
|
|
1775
1980
|
<div data-ry-target="thumb-value" class="ry-slider__thumb" tabindex="0" role="slider" aria-label="Value">
|
|
1776
1981
|
${s ? '<span data-ry-target="tooltip-value" class="ry-slider__tooltip"></span>' : ""}
|
|
1777
1982
|
</div>
|
|
1778
|
-
`, 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"]')));
|
|
1779
1984
|
}
|
|
1780
|
-
#
|
|
1985
|
+
#l() {
|
|
1781
1986
|
const t = this.min, e = this.max, s = this.getAttribute("labels")?.split(","), i = this.getAttribute("label-type") || "number";
|
|
1782
1987
|
let r = [];
|
|
1783
1988
|
if (s)
|
|
@@ -1799,30 +2004,30 @@ class lt extends u {
|
|
|
1799
2004
|
`;
|
|
1800
2005
|
}
|
|
1801
2006
|
#h() {
|
|
1802
|
-
this.#i && this.on(this.#i, "pointerdown", this.#
|
|
2007
|
+
this.#i && this.on(this.#i, "pointerdown", this.#c);
|
|
1803
2008
|
for (const [t, e] of this.#r)
|
|
1804
2009
|
this.on(e, "pointerdown", (s) => this.#n(s, t)), this.on(e, "keydown", (s) => this.#m(s, t));
|
|
1805
|
-
this.on(document, "pointermove", this.#
|
|
2010
|
+
this.on(document, "pointermove", this.#u), this.on(document, "pointerup", this.#p);
|
|
1806
2011
|
}
|
|
1807
|
-
#
|
|
2012
|
+
#c = (t) => {
|
|
1808
2013
|
if (this.disabled) return;
|
|
1809
|
-
const e = this.#
|
|
2014
|
+
const e = this.#w(t);
|
|
1810
2015
|
if (this.hasAttribute("range")) {
|
|
1811
2016
|
const i = Math.abs(e - this.start), r = Math.abs(e - this.end);
|
|
1812
2017
|
i < r ? (this.start = e, this.#e = "start") : (this.end = e, this.#e = "end");
|
|
1813
2018
|
} else
|
|
1814
2019
|
this.value = e, this.#e = "value";
|
|
1815
|
-
this.#t = !0, this.#
|
|
2020
|
+
this.#t = !0, this.#b(), this.#y();
|
|
1816
2021
|
};
|
|
1817
2022
|
#n = (t, e) => {
|
|
1818
2023
|
this.disabled || (t.stopPropagation(), this.#t = !0, this.#e = e, t.target.setPointerCapture(t.pointerId));
|
|
1819
2024
|
};
|
|
1820
|
-
#
|
|
2025
|
+
#u = (t) => {
|
|
1821
2026
|
if (!this.#t || !this.#e) return;
|
|
1822
|
-
const e = this.#
|
|
1823
|
-
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();
|
|
1824
2029
|
};
|
|
1825
|
-
#
|
|
2030
|
+
#p = () => {
|
|
1826
2031
|
this.#t && (this.#t = !1, this.#e = null, this.#M());
|
|
1827
2032
|
};
|
|
1828
2033
|
#m = (t, e) => {
|
|
@@ -1845,22 +2050,22 @@ class lt extends u {
|
|
|
1845
2050
|
r = -i;
|
|
1846
2051
|
break;
|
|
1847
2052
|
case "Home":
|
|
1848
|
-
r = this.min - this.#
|
|
2053
|
+
r = this.min - this.#f(e);
|
|
1849
2054
|
break;
|
|
1850
2055
|
case "End":
|
|
1851
|
-
r = this.max - this.#
|
|
2056
|
+
r = this.max - this.#f(e);
|
|
1852
2057
|
break;
|
|
1853
2058
|
default:
|
|
1854
2059
|
return;
|
|
1855
2060
|
}
|
|
1856
2061
|
t.preventDefault();
|
|
1857
|
-
const a = this.#
|
|
1858
|
-
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();
|
|
1859
2064
|
};
|
|
1860
|
-
#
|
|
2065
|
+
#f(t) {
|
|
1861
2066
|
return t === "start" ? this.start : t === "end" ? this.end : this.value;
|
|
1862
2067
|
}
|
|
1863
|
-
#
|
|
2068
|
+
#w(t) {
|
|
1864
2069
|
if (!this.#i) return this.min;
|
|
1865
2070
|
const e = this.#i.getBoundingClientRect(), s = this.hasAttribute("vertical"), i = this.hasAttribute("reversed");
|
|
1866
2071
|
let r;
|
|
@@ -1870,14 +2075,14 @@ class lt extends u {
|
|
|
1870
2075
|
}
|
|
1871
2076
|
#g(t) {
|
|
1872
2077
|
const e = this.step;
|
|
1873
|
-
if (e === 0) return this.#
|
|
2078
|
+
if (e === 0) return this.#d(t);
|
|
1874
2079
|
const s = Math.round((t - this.min) / e) * e + this.min;
|
|
1875
|
-
return this.#
|
|
2080
|
+
return this.#d(s);
|
|
1876
2081
|
}
|
|
1877
|
-
#
|
|
2082
|
+
#d(t) {
|
|
1878
2083
|
return Math.max(this.min, Math.min(this.max, t));
|
|
1879
2084
|
}
|
|
1880
|
-
#
|
|
2085
|
+
#b() {
|
|
1881
2086
|
const t = this.hasAttribute("range"), e = this.hasAttribute("vertical"), s = this.hasAttribute("reversed"), i = (r) => {
|
|
1882
2087
|
let a = (r - this.min) / (this.max - this.min) * 100;
|
|
1883
2088
|
return s && (a = 100 - a), a;
|
|
@@ -1930,19 +2135,19 @@ class lt extends u {
|
|
|
1930
2135
|
return parseFloat(this.getAttribute("value") ?? String(this.min));
|
|
1931
2136
|
}
|
|
1932
2137
|
set value(t) {
|
|
1933
|
-
this.setAttribute("value", String(this.#
|
|
2138
|
+
this.setAttribute("value", String(this.#d(t)));
|
|
1934
2139
|
}
|
|
1935
2140
|
get start() {
|
|
1936
2141
|
return parseFloat(this.getAttribute("start") ?? String(this.min));
|
|
1937
2142
|
}
|
|
1938
2143
|
set start(t) {
|
|
1939
|
-
this.setAttribute("start", String(this.#
|
|
2144
|
+
this.setAttribute("start", String(this.#d(t)));
|
|
1940
2145
|
}
|
|
1941
2146
|
get end() {
|
|
1942
2147
|
return parseFloat(this.getAttribute("end") ?? String(this.max));
|
|
1943
2148
|
}
|
|
1944
2149
|
set end(t) {
|
|
1945
|
-
this.setAttribute("end", String(this.#
|
|
2150
|
+
this.setAttribute("end", String(this.#d(t)));
|
|
1946
2151
|
}
|
|
1947
2152
|
get disabled() {
|
|
1948
2153
|
return this.hasAttribute("disabled");
|
|
@@ -1951,8 +2156,8 @@ class lt extends u {
|
|
|
1951
2156
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
1952
2157
|
}
|
|
1953
2158
|
}
|
|
1954
|
-
customElements.define("ry-slider",
|
|
1955
|
-
class
|
|
2159
|
+
customElements.define("ry-slider", dt);
|
|
2160
|
+
class ut extends u {
|
|
1956
2161
|
#t = !1;
|
|
1957
2162
|
#e = 0;
|
|
1958
2163
|
#i = 0;
|
|
@@ -1961,7 +2166,7 @@ class ct extends u {
|
|
|
1961
2166
|
#a = null;
|
|
1962
2167
|
static observedAttributes = ["min", "max", "step", "value", "disabled", "label", "labels", "description"];
|
|
1963
2168
|
setup() {
|
|
1964
|
-
this.#o(), this.#
|
|
2169
|
+
this.#o(), this.#l(), this.#d();
|
|
1965
2170
|
}
|
|
1966
2171
|
#o() {
|
|
1967
2172
|
const t = this.getAttribute("label"), e = this.getAttribute("description"), s = e ? ` title="${e}"` : "";
|
|
@@ -1975,13 +2180,13 @@ class ct extends u {
|
|
|
1975
2180
|
${t ? `<span data-ry-target="label" class="ry-knob__label"${s}>${t}</span>` : ""}
|
|
1976
2181
|
`, this.#s = this.$('[data-ry-target="ring"]'), this.#r = this.$('[data-ry-target="indicator"]'), this.#a = this.$('[data-ry-target="display"]');
|
|
1977
2182
|
}
|
|
1978
|
-
#
|
|
1979
|
-
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));
|
|
1980
2185
|
}
|
|
1981
2186
|
#h = (t) => {
|
|
1982
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", ""));
|
|
1983
2188
|
};
|
|
1984
|
-
#
|
|
2189
|
+
#c = (t) => {
|
|
1985
2190
|
if (!this.#t) return;
|
|
1986
2191
|
const e = this.#e - t.clientY, s = (this.max - this.min) / 100;
|
|
1987
2192
|
this.#g(this.#i + e * s);
|
|
@@ -1989,10 +2194,10 @@ class ct extends u {
|
|
|
1989
2194
|
#n = () => {
|
|
1990
2195
|
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#y());
|
|
1991
2196
|
};
|
|
1992
|
-
#
|
|
2197
|
+
#u = (t) => {
|
|
1993
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", ""));
|
|
1994
2199
|
};
|
|
1995
|
-
#
|
|
2200
|
+
#p = (t) => {
|
|
1996
2201
|
if (!this.#t) return;
|
|
1997
2202
|
t.preventDefault();
|
|
1998
2203
|
const e = t.touches[0];
|
|
@@ -2003,13 +2208,13 @@ class ct extends u {
|
|
|
2003
2208
|
#m = () => {
|
|
2004
2209
|
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#y());
|
|
2005
2210
|
};
|
|
2006
|
-
#
|
|
2211
|
+
#f = (t) => {
|
|
2007
2212
|
if (this.disabled) return;
|
|
2008
2213
|
t.preventDefault();
|
|
2009
2214
|
const e = this.step || (this.max - this.min) / 50, s = t.deltaY < 0 ? e : -e;
|
|
2010
2215
|
this.#g(this.value + s), this.#y();
|
|
2011
2216
|
};
|
|
2012
|
-
#
|
|
2217
|
+
#w = (t) => {
|
|
2013
2218
|
if (this.disabled) return;
|
|
2014
2219
|
const e = this.step || 1, s = (this.max - this.min) / 10;
|
|
2015
2220
|
let i = 0;
|
|
@@ -2042,13 +2247,13 @@ class ct extends u {
|
|
|
2042
2247
|
#g(t) {
|
|
2043
2248
|
let e = Math.max(this.min, Math.min(this.max, t));
|
|
2044
2249
|
const s = this.step;
|
|
2045
|
-
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();
|
|
2046
2251
|
}
|
|
2047
|
-
#
|
|
2252
|
+
#d() {
|
|
2048
2253
|
const t = (this.value - this.min) / (this.max - this.min), e = -135 + t * 270;
|
|
2049
|
-
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));
|
|
2050
2255
|
}
|
|
2051
|
-
#
|
|
2256
|
+
#b(t) {
|
|
2052
2257
|
const e = this.getAttribute("labels");
|
|
2053
2258
|
if (e) {
|
|
2054
2259
|
const i = e.split(","), r = Math.round(t);
|
|
@@ -2065,7 +2270,7 @@ class ct extends u {
|
|
|
2065
2270
|
this.emit("change", { value: this.value, percent: t });
|
|
2066
2271
|
}
|
|
2067
2272
|
attributeChangedCallback(t, e, s) {
|
|
2068
|
-
e !== s && t === "value" && this.#s && this.#
|
|
2273
|
+
e !== s && t === "value" && this.#s && this.#d();
|
|
2069
2274
|
}
|
|
2070
2275
|
// --- Public API ---
|
|
2071
2276
|
get min() {
|
|
@@ -2099,9 +2304,9 @@ class ct extends u {
|
|
|
2099
2304
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
2100
2305
|
}
|
|
2101
2306
|
}
|
|
2102
|
-
customElements.define("ry-knob",
|
|
2307
|
+
customElements.define("ry-knob", ut);
|
|
2103
2308
|
const S = 15, T = 3;
|
|
2104
|
-
class
|
|
2309
|
+
class pt extends u {
|
|
2105
2310
|
#t = null;
|
|
2106
2311
|
#e = null;
|
|
2107
2312
|
#i = null;
|
|
@@ -2109,16 +2314,16 @@ class dt extends u {
|
|
|
2109
2314
|
#r = null;
|
|
2110
2315
|
#a = !1;
|
|
2111
2316
|
#o = 0;
|
|
2112
|
-
#
|
|
2317
|
+
#l = 0;
|
|
2113
2318
|
#h = 0;
|
|
2114
|
-
#
|
|
2319
|
+
#c = !1;
|
|
2115
2320
|
#n = null;
|
|
2116
|
-
#
|
|
2321
|
+
#u = null;
|
|
2117
2322
|
static observedAttributes = ["min", "max", "step", "value", "disabled", "arrows", "icons", "drag", "editable", "wrap", "label", "prefix", "suffix"];
|
|
2118
2323
|
setup() {
|
|
2119
|
-
this.#
|
|
2324
|
+
this.#p(), this.#f(), this.#w(), this.#A();
|
|
2120
2325
|
}
|
|
2121
|
-
#
|
|
2326
|
+
#p() {
|
|
2122
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 = `
|
|
2123
2328
|
<div data-ry-target="display" class="ry-number-select__display" tabindex="0" role="spinbutton"
|
|
2124
2329
|
aria-valuenow="${this.value}" aria-valuemin="${this.min}" aria-valuemax="${this.max}"
|
|
@@ -2127,31 +2332,31 @@ class dt extends u {
|
|
|
2127
2332
|
<span data-ry-target="value" class="ry-number-select__value">${this.#j(this.value)}</span>
|
|
2128
2333
|
${l ? `<span data-ry-target="suffix" class="ry-number-select__affix">${l}</span>` : ""}
|
|
2129
2334
|
<input data-ry-target="input" class="ry-number-select__input" type="text" inputmode="decimal" tabindex="-1">
|
|
2130
|
-
</div>`,
|
|
2335
|
+
</div>`, y = e ? `<span data-ry-target="label" class="ry-number-select__label">${e}</span>` : "";
|
|
2131
2336
|
if (t === "stacked")
|
|
2132
|
-
this.innerHTML = `${d}${g}${c}${
|
|
2337
|
+
this.innerHTML = `${d}${g}${c}${y}`;
|
|
2133
2338
|
else if (t === "stacked-end") {
|
|
2134
|
-
const
|
|
2135
|
-
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}`;
|
|
2136
2341
|
} else if (t === "stacked-start") {
|
|
2137
|
-
const
|
|
2138
|
-
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}`;
|
|
2139
2344
|
} else
|
|
2140
|
-
this.innerHTML = `${c}${g}${d}${
|
|
2345
|
+
this.innerHTML = `${c}${g}${d}${y}`;
|
|
2141
2346
|
}
|
|
2142
2347
|
#m(t) {
|
|
2143
2348
|
const e = this.getAttribute("icons") ?? "plus-minus";
|
|
2144
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") ?? "+"];
|
|
2145
2350
|
}
|
|
2146
|
-
#
|
|
2351
|
+
#f() {
|
|
2147
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"]');
|
|
2148
2353
|
}
|
|
2149
|
-
#
|
|
2354
|
+
#w() {
|
|
2150
2355
|
this.#s && (this.on(this.#s, "mousedown", (t) => {
|
|
2151
2356
|
t.preventDefault(), this.#g(-1);
|
|
2152
|
-
}), 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) => {
|
|
2153
2358
|
t.preventDefault(), this.#g(1);
|
|
2154
|
-
}), 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) => {
|
|
2155
2360
|
t.key === "Enter" && (t.preventDefault(), this.#z()), t.key === "Escape" && (t.preventDefault(), this.#P()), t.stopPropagation();
|
|
2156
2361
|
}));
|
|
2157
2362
|
}
|
|
@@ -2162,41 +2367,41 @@ class dt extends u {
|
|
|
2162
2367
|
this.#R(t * e), this.#_(), this.#n = setTimeout(() => {
|
|
2163
2368
|
let s = 150;
|
|
2164
2369
|
const i = () => {
|
|
2165
|
-
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);
|
|
2166
2371
|
};
|
|
2167
2372
|
i();
|
|
2168
2373
|
}, 400);
|
|
2169
2374
|
}
|
|
2170
|
-
#
|
|
2171
|
-
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);
|
|
2172
2377
|
}
|
|
2173
2378
|
// --- Drag helpers ---
|
|
2174
|
-
get #
|
|
2379
|
+
get #b() {
|
|
2175
2380
|
const t = this.getAttribute("drag");
|
|
2176
2381
|
if (t === "x" || t === "y" || t === "none") return t;
|
|
2177
2382
|
const e = this.getAttribute("arrows");
|
|
2178
2383
|
return e === "stacked" || e === "stacked-end" || e === "stacked-start" ? "y" : "x";
|
|
2179
2384
|
}
|
|
2180
2385
|
#v(t, e) {
|
|
2181
|
-
return this.#
|
|
2386
|
+
return this.#b === "y" ? this.#l - e : t - this.#o;
|
|
2182
2387
|
}
|
|
2183
2388
|
#y(t, e) {
|
|
2184
|
-
return this.#
|
|
2389
|
+
return this.#b === "y" ? Math.abs(e - this.#l) : Math.abs(t - this.#o);
|
|
2185
2390
|
}
|
|
2186
2391
|
#M(t, e) {
|
|
2187
2392
|
if (!this.#e) return;
|
|
2188
|
-
const s = t / e * 4, i = this.#
|
|
2393
|
+
const s = t / e * 4, i = this.#b;
|
|
2189
2394
|
this.#e.style.transform = i === "y" ? `translateY(${-s}px)` : `translateX(${s}px)`;
|
|
2190
2395
|
}
|
|
2191
2396
|
#$(t, e, s) {
|
|
2192
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;
|
|
2193
2398
|
this.#M(c, n);
|
|
2194
|
-
const d = this.hasAttribute("wrap") ? this.#
|
|
2399
|
+
const d = this.hasAttribute("wrap") ? this.#V(l) : this.#T(l), g = this.#F(d);
|
|
2195
2400
|
g !== this.value && (this.value = g, this.#A(), this.#x());
|
|
2196
2401
|
}
|
|
2197
2402
|
// --- Mouse drag ---
|
|
2198
2403
|
#I = (t) => {
|
|
2199
|
-
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", ""));
|
|
2200
2405
|
};
|
|
2201
2406
|
#Y = (t) => {
|
|
2202
2407
|
this.#a && this.#$(t.clientX, t.clientY, t.shiftKey);
|
|
@@ -2208,7 +2413,7 @@ class dt extends u {
|
|
|
2208
2413
|
};
|
|
2209
2414
|
// --- Touch drag ---
|
|
2210
2415
|
#X = (t) => {
|
|
2211
|
-
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", ""));
|
|
2212
2417
|
};
|
|
2213
2418
|
#G = (t) => {
|
|
2214
2419
|
if (!this.#a) return;
|
|
@@ -2221,7 +2426,7 @@ class dt extends u {
|
|
|
2221
2426
|
};
|
|
2222
2427
|
// --- Keyboard ---
|
|
2223
2428
|
#q = (t) => {
|
|
2224
|
-
if (this.disabled || this.#
|
|
2429
|
+
if (this.disabled || this.#c) return;
|
|
2225
2430
|
const e = this.step || 1, s = e * 10;
|
|
2226
2431
|
let i = 0;
|
|
2227
2432
|
switch (t.key) {
|
|
@@ -2256,18 +2461,18 @@ class dt extends u {
|
|
|
2256
2461
|
};
|
|
2257
2462
|
// --- Wheel ---
|
|
2258
2463
|
#J = (t) => {
|
|
2259
|
-
if (this.disabled || this.#
|
|
2464
|
+
if (this.disabled || this.#c || !this.matches(":hover") && !this.contains(document.activeElement)) return;
|
|
2260
2465
|
t.preventDefault();
|
|
2261
2466
|
const e = this.step || 1, s = t.shiftKey ? e * 10 : e, i = t.deltaY < 0 ? s : -s;
|
|
2262
2467
|
this.#R(i), this.#x(), this.#_();
|
|
2263
2468
|
};
|
|
2264
2469
|
// --- Edit mode ---
|
|
2265
2470
|
#E(t) {
|
|
2266
|
-
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()));
|
|
2267
2472
|
}
|
|
2268
2473
|
#z() {
|
|
2269
|
-
if (!this.#
|
|
2270
|
-
this.#
|
|
2474
|
+
if (!this.#c) return;
|
|
2475
|
+
this.#c = !1, this.state = "";
|
|
2271
2476
|
const t = parseFloat(this.#i?.value ?? "");
|
|
2272
2477
|
if (!isNaN(t)) {
|
|
2273
2478
|
const e = this.#T(t), s = this.#F(e);
|
|
@@ -2276,17 +2481,17 @@ class dt extends u {
|
|
|
2276
2481
|
this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#A(), this.#t?.focus();
|
|
2277
2482
|
}
|
|
2278
2483
|
#P() {
|
|
2279
|
-
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());
|
|
2280
2485
|
}
|
|
2281
2486
|
// --- Value management ---
|
|
2282
2487
|
#R(t) {
|
|
2283
2488
|
let e = this.value + t;
|
|
2284
|
-
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();
|
|
2285
2490
|
}
|
|
2286
2491
|
#T(t) {
|
|
2287
2492
|
return Math.max(this.min, Math.min(this.max, t));
|
|
2288
2493
|
}
|
|
2289
|
-
#
|
|
2494
|
+
#V(t) {
|
|
2290
2495
|
const e = this.step || 1, s = this.max - this.min + e;
|
|
2291
2496
|
let i = t;
|
|
2292
2497
|
for (; i > this.max; ) i -= s;
|
|
@@ -2306,9 +2511,9 @@ class dt extends u {
|
|
|
2306
2511
|
return t.toFixed(s);
|
|
2307
2512
|
}
|
|
2308
2513
|
#A() {
|
|
2309
|
-
this.#e && (this.#e.textContent = this.#j(this.value)), this.#
|
|
2514
|
+
this.#e && (this.#e.textContent = this.#j(this.value)), this.#U();
|
|
2310
2515
|
}
|
|
2311
|
-
#
|
|
2516
|
+
#U() {
|
|
2312
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)));
|
|
2313
2518
|
}
|
|
2314
2519
|
#x() {
|
|
@@ -2343,7 +2548,7 @@ class dt extends u {
|
|
|
2343
2548
|
this.setAttribute("step", String(t));
|
|
2344
2549
|
}
|
|
2345
2550
|
get drag() {
|
|
2346
|
-
return this.#
|
|
2551
|
+
return this.#b;
|
|
2347
2552
|
}
|
|
2348
2553
|
set drag(t) {
|
|
2349
2554
|
this.setAttribute("drag", t);
|
|
@@ -2358,10 +2563,10 @@ class dt extends u {
|
|
|
2358
2563
|
e !== s && t === "value" && this.#t && this.#A();
|
|
2359
2564
|
}
|
|
2360
2565
|
teardown() {
|
|
2361
|
-
this.#
|
|
2566
|
+
this.#d();
|
|
2362
2567
|
}
|
|
2363
2568
|
}
|
|
2364
|
-
customElements.define("ry-number-select",
|
|
2569
|
+
customElements.define("ry-number-select", pt);
|
|
2365
2570
|
function v(h) {
|
|
2366
2571
|
const t = h.h / 360, e = h.s / 100, s = h.v / 100;
|
|
2367
2572
|
let i = 0, r = 0, a = 0;
|
|
@@ -2422,7 +2627,7 @@ function L(h) {
|
|
|
2422
2627
|
l: Math.round(s * 100)
|
|
2423
2628
|
};
|
|
2424
2629
|
}
|
|
2425
|
-
function
|
|
2630
|
+
function gt(h) {
|
|
2426
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);
|
|
2427
2632
|
return {
|
|
2428
2633
|
h: h.h,
|
|
@@ -2434,7 +2639,7 @@ function D(h) {
|
|
|
2434
2639
|
const t = (e) => e.toString(16).padStart(2, "0");
|
|
2435
2640
|
return `#${t(h.r)}${t(h.g)}${t(h.b)}`;
|
|
2436
2641
|
}
|
|
2437
|
-
function
|
|
2642
|
+
function ft(h) {
|
|
2438
2643
|
const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);
|
|
2439
2644
|
if (!t) {
|
|
2440
2645
|
const e = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(h);
|
|
@@ -2462,7 +2667,7 @@ function A(h) {
|
|
|
2462
2667
|
}, n = parseInt(i[4], 16) / 255;
|
|
2463
2668
|
return { hsv: $(a), alpha: Math.round(n * 100) };
|
|
2464
2669
|
}
|
|
2465
|
-
const r =
|
|
2670
|
+
const r = ft(t);
|
|
2466
2671
|
return r ? { hsv: $(r), alpha: 100 } : null;
|
|
2467
2672
|
}
|
|
2468
2673
|
const e = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/.exec(t);
|
|
@@ -2481,11 +2686,11 @@ function A(h) {
|
|
|
2481
2686
|
s: parseFloat(s[2]),
|
|
2482
2687
|
l: parseFloat(s[3])
|
|
2483
2688
|
}, r = s[4] ? parseFloat(s[4]) * 100 : 100;
|
|
2484
|
-
return { hsv:
|
|
2689
|
+
return { hsv: gt(i), alpha: r };
|
|
2485
2690
|
}
|
|
2486
2691
|
return null;
|
|
2487
2692
|
}
|
|
2488
|
-
class
|
|
2693
|
+
class bt extends u {
|
|
2489
2694
|
#t = 0;
|
|
2490
2695
|
#e = 100;
|
|
2491
2696
|
#i = 100;
|
|
@@ -2493,21 +2698,21 @@ class gt extends u {
|
|
|
2493
2698
|
#r = !1;
|
|
2494
2699
|
#a = !1;
|
|
2495
2700
|
#o = !1;
|
|
2496
|
-
#
|
|
2701
|
+
#l = null;
|
|
2497
2702
|
#h = null;
|
|
2498
|
-
#
|
|
2703
|
+
#c = null;
|
|
2499
2704
|
#n = null;
|
|
2500
|
-
#p = null;
|
|
2501
2705
|
#u = null;
|
|
2706
|
+
#p = null;
|
|
2502
2707
|
#m = null;
|
|
2503
|
-
#
|
|
2504
|
-
#
|
|
2708
|
+
#f = null;
|
|
2709
|
+
#w = null;
|
|
2505
2710
|
#g = null;
|
|
2506
2711
|
static observedAttributes = ["value", "format", "opacity", "disabled", "swatches", "inline"];
|
|
2507
2712
|
setup() {
|
|
2508
|
-
this.#
|
|
2713
|
+
this.#d(), this.#b(), this.#v(), this.#A();
|
|
2509
2714
|
}
|
|
2510
|
-
#
|
|
2715
|
+
#d() {
|
|
2511
2716
|
const t = this.hasAttribute("inline"), e = this.hasAttribute("opacity"), s = this.getAttribute("swatches");
|
|
2512
2717
|
let i = `
|
|
2513
2718
|
<div data-ry-target="grid" class="ry-color-picker__grid">
|
|
@@ -2547,10 +2752,10 @@ class gt extends u {
|
|
|
2547
2752
|
<span data-ry-target="trigger-color" class="ry-color-picker__trigger-color"></span>
|
|
2548
2753
|
</button>
|
|
2549
2754
|
<div data-ry-target="panel" class="ry-color-picker__panel">${i}</div>
|
|
2550
|
-
`, 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"]');
|
|
2551
2756
|
}
|
|
2552
|
-
#
|
|
2553
|
-
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));
|
|
2554
2759
|
const t = this.$('[data-ry-target="format-toggle"]');
|
|
2555
2760
|
t && this.on(t, "click", this.#F);
|
|
2556
2761
|
const e = this.$('[data-ry-target="swatches"]');
|
|
@@ -2573,7 +2778,7 @@ class gt extends u {
|
|
|
2573
2778
|
this.state === "open" && (this.contains(t.target) || this.close());
|
|
2574
2779
|
};
|
|
2575
2780
|
#$ = (t) => {
|
|
2576
|
-
t.key === "Escape" && this.state === "open" && (this.close(), this.#
|
|
2781
|
+
t.key === "Escape" && this.state === "open" && (this.close(), this.#l?.focus());
|
|
2577
2782
|
};
|
|
2578
2783
|
open() {
|
|
2579
2784
|
this.hasAttribute("inline") || (this.#I(), this.state = "open");
|
|
@@ -2582,8 +2787,8 @@ class gt extends u {
|
|
|
2582
2787
|
this.hasAttribute("inline") || (this.state = "closed", this.removeAttribute("data-ry-position"));
|
|
2583
2788
|
}
|
|
2584
2789
|
#I() {
|
|
2585
|
-
if (!this.#h || !this.#
|
|
2586
|
-
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;
|
|
2587
2792
|
i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
|
|
2588
2793
|
}
|
|
2589
2794
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -2593,8 +2798,8 @@ class gt extends u {
|
|
|
2593
2798
|
this.disabled || (t.preventDefault(), this.#r = !0, this.#n?.focus(), this.#C(t));
|
|
2594
2799
|
};
|
|
2595
2800
|
#C(t) {
|
|
2596
|
-
if (!this.#
|
|
2597
|
-
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));
|
|
2598
2803
|
this.#e = Math.round(s * 100), this.#i = Math.round((1 - i) * 100), this.#A(), this.#L();
|
|
2599
2804
|
}
|
|
2600
2805
|
#X = (t) => {
|
|
@@ -2615,17 +2820,17 @@ class gt extends u {
|
|
|
2615
2820
|
this.#i = Math.max(0, this.#i - e), s = !0;
|
|
2616
2821
|
break;
|
|
2617
2822
|
}
|
|
2618
|
-
s && (t.preventDefault(), this.#A(), this.#L(), this.#
|
|
2823
|
+
s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
|
|
2619
2824
|
};
|
|
2620
2825
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2621
2826
|
// Hue handlers
|
|
2622
2827
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2623
2828
|
#G = (t) => {
|
|
2624
|
-
this.disabled || (t.preventDefault(), this.#a = !0, this.#
|
|
2829
|
+
this.disabled || (t.preventDefault(), this.#a = !0, this.#p?.focus(), this.#K(t));
|
|
2625
2830
|
};
|
|
2626
2831
|
#K(t) {
|
|
2627
|
-
if (!this.#
|
|
2628
|
-
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));
|
|
2629
2834
|
this.#t = Math.round(s * 360), this.#A(), this.#L();
|
|
2630
2835
|
}
|
|
2631
2836
|
#q = (t) => {
|
|
@@ -2642,13 +2847,13 @@ class gt extends u {
|
|
|
2642
2847
|
this.#t = (this.#t - e + 360) % 360, s = !0;
|
|
2643
2848
|
break;
|
|
2644
2849
|
}
|
|
2645
|
-
s && (t.preventDefault(), this.#A(), this.#L(), this.#
|
|
2850
|
+
s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
|
|
2646
2851
|
};
|
|
2647
2852
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2648
2853
|
// Alpha handlers
|
|
2649
2854
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2650
2855
|
#J = (t) => {
|
|
2651
|
-
this.disabled || (t.preventDefault(), this.#o = !0, this.#
|
|
2856
|
+
this.disabled || (t.preventDefault(), this.#o = !0, this.#f?.focus(), this.#E(t));
|
|
2652
2857
|
};
|
|
2653
2858
|
#E(t) {
|
|
2654
2859
|
if (!this.#m) return;
|
|
@@ -2669,7 +2874,7 @@ class gt extends u {
|
|
|
2669
2874
|
this.#s = Math.max(0, this.#s - e), s = !0;
|
|
2670
2875
|
break;
|
|
2671
2876
|
}
|
|
2672
|
-
s && (t.preventDefault(), this.#A(), this.#L(), this.#
|
|
2877
|
+
s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
|
|
2673
2878
|
};
|
|
2674
2879
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2675
2880
|
// Pointer move/up
|
|
@@ -2678,7 +2883,7 @@ class gt extends u {
|
|
|
2678
2883
|
this.#r ? this.#C(t) : this.#a ? this.#K(t) : this.#o && this.#E(t);
|
|
2679
2884
|
};
|
|
2680
2885
|
#R = () => {
|
|
2681
|
-
(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());
|
|
2682
2887
|
};
|
|
2683
2888
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2684
2889
|
// Input handlers
|
|
@@ -2686,9 +2891,9 @@ class gt extends u {
|
|
|
2686
2891
|
#T = () => {
|
|
2687
2892
|
if (!this.#g) return;
|
|
2688
2893
|
const t = A(this.#g.value);
|
|
2689
|
-
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();
|
|
2690
2895
|
};
|
|
2691
|
-
#
|
|
2896
|
+
#V = (t) => {
|
|
2692
2897
|
t.key === "Enter" && (t.preventDefault(), this.#T());
|
|
2693
2898
|
};
|
|
2694
2899
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -2709,7 +2914,7 @@ class gt extends u {
|
|
|
2709
2914
|
const s = e.dataset.color;
|
|
2710
2915
|
if (s) {
|
|
2711
2916
|
const i = A(s);
|
|
2712
|
-
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());
|
|
2713
2918
|
}
|
|
2714
2919
|
}
|
|
2715
2920
|
};
|
|
@@ -2717,9 +2922,9 @@ class gt extends u {
|
|
|
2717
2922
|
// Update methods
|
|
2718
2923
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2719
2924
|
#A() {
|
|
2720
|
-
this.#
|
|
2925
|
+
this.#U(), this.#x(), this.#_(), this.#H(), this.#O(), this.#W(), this.#Z();
|
|
2721
2926
|
}
|
|
2722
|
-
#
|
|
2927
|
+
#U() {
|
|
2723
2928
|
const t = this.$('[data-ry-target="trigger-color"]');
|
|
2724
2929
|
if (t) {
|
|
2725
2930
|
const e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity") ? this.#s / 100 : 1;
|
|
@@ -2727,23 +2932,23 @@ class gt extends u {
|
|
|
2727
2932
|
}
|
|
2728
2933
|
}
|
|
2729
2934
|
#x() {
|
|
2730
|
-
if (this.#
|
|
2935
|
+
if (this.#c) {
|
|
2731
2936
|
const t = v({ h: this.#t, s: 100, v: 100 });
|
|
2732
|
-
this.#
|
|
2937
|
+
this.#c.style.setProperty("--grid-hue-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
|
|
2733
2938
|
}
|
|
2734
2939
|
this.#n && (this.#n.style.left = `${this.#e}%`, this.#n.style.top = `${100 - this.#i}%`);
|
|
2735
2940
|
}
|
|
2736
2941
|
#_() {
|
|
2737
|
-
this.#
|
|
2942
|
+
this.#p && (this.#p.style.left = `${this.#t / 360 * 100}%`);
|
|
2738
2943
|
}
|
|
2739
2944
|
#H() {
|
|
2740
2945
|
if (this.#m) {
|
|
2741
2946
|
const t = v({ h: this.#t, s: this.#e, v: this.#i });
|
|
2742
2947
|
this.#m.style.setProperty("--alpha-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
|
|
2743
2948
|
}
|
|
2744
|
-
this.#
|
|
2949
|
+
this.#f && (this.#f.style.left = `${this.#s}%`);
|
|
2745
2950
|
}
|
|
2746
|
-
#
|
|
2951
|
+
#O() {
|
|
2747
2952
|
const t = this.$('[data-ry-target="preview-color"]');
|
|
2748
2953
|
if (t) {
|
|
2749
2954
|
const e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity") ? this.#s / 100 : 1;
|
|
@@ -2751,13 +2956,13 @@ class gt extends u {
|
|
|
2751
2956
|
}
|
|
2752
2957
|
}
|
|
2753
2958
|
#W() {
|
|
2754
|
-
this.#g && (this.#g.value = this.#
|
|
2959
|
+
this.#g && (this.#g.value = this.#N());
|
|
2755
2960
|
}
|
|
2756
2961
|
#Z() {
|
|
2757
|
-
const t = this.#
|
|
2962
|
+
const t = this.#N();
|
|
2758
2963
|
this.getAttribute("value") !== t && this.setAttribute("value", t);
|
|
2759
2964
|
}
|
|
2760
|
-
#
|
|
2965
|
+
#N() {
|
|
2761
2966
|
const t = this.format, e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity");
|
|
2762
2967
|
switch (t) {
|
|
2763
2968
|
case "hex": {
|
|
@@ -2784,23 +2989,23 @@ class gt extends u {
|
|
|
2784
2989
|
#L() {
|
|
2785
2990
|
this.emit("input", { value: this.value, hsv: this.hsv, rgb: this.rgb });
|
|
2786
2991
|
}
|
|
2787
|
-
#
|
|
2992
|
+
#k() {
|
|
2788
2993
|
this.emit("change", { value: this.value, hsv: this.hsv, rgb: this.rgb });
|
|
2789
2994
|
}
|
|
2790
2995
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2791
2996
|
// Attribute changed
|
|
2792
2997
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2793
2998
|
attributeChangedCallback(t, e, s) {
|
|
2794
|
-
if (e !== s && t === "value" && this.#
|
|
2999
|
+
if (e !== s && t === "value" && this.#c && s) {
|
|
2795
3000
|
const i = A(s);
|
|
2796
|
-
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());
|
|
2797
3002
|
}
|
|
2798
3003
|
}
|
|
2799
3004
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2800
3005
|
// Public API
|
|
2801
3006
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2802
3007
|
get value() {
|
|
2803
|
-
return this.#
|
|
3008
|
+
return this.#N();
|
|
2804
3009
|
}
|
|
2805
3010
|
set value(t) {
|
|
2806
3011
|
const e = A(t);
|
|
@@ -2842,19 +3047,19 @@ class gt extends u {
|
|
|
2842
3047
|
getFormattedValue(t) {
|
|
2843
3048
|
const e = this.format;
|
|
2844
3049
|
this.format = t;
|
|
2845
|
-
const s = this.#
|
|
3050
|
+
const s = this.#N();
|
|
2846
3051
|
return this.format = e, s;
|
|
2847
3052
|
}
|
|
2848
3053
|
}
|
|
2849
|
-
customElements.define("ry-color-picker",
|
|
2850
|
-
class
|
|
3054
|
+
customElements.define("ry-color-picker", bt);
|
|
3055
|
+
class yt extends u {
|
|
2851
3056
|
#t = null;
|
|
2852
3057
|
#e = null;
|
|
2853
3058
|
#i = null;
|
|
2854
3059
|
#s = null;
|
|
2855
3060
|
static observedAttributes = ["value", "format", "opacity", "disabled", "placeholder"];
|
|
2856
3061
|
setup() {
|
|
2857
|
-
this.#r(), this.#a(), this.#
|
|
3062
|
+
this.#r(), this.#a(), this.#b(), this.state = "closed";
|
|
2858
3063
|
}
|
|
2859
3064
|
#r() {
|
|
2860
3065
|
const t = this.hasAttribute("opacity"), e = this.getAttribute("format") || "hex", s = this.getAttribute("value") || "#000000", i = this.getAttribute("placeholder") || "#000000";
|
|
@@ -2886,12 +3091,12 @@ class ft extends u {
|
|
|
2886
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"]');
|
|
2887
3092
|
}
|
|
2888
3093
|
#a() {
|
|
2889
|
-
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);
|
|
2890
3095
|
}
|
|
2891
3096
|
#o = () => {
|
|
2892
3097
|
this.disabled || (this.state === "open" ? this.close() : this.open());
|
|
2893
3098
|
};
|
|
2894
|
-
#
|
|
3099
|
+
#l = () => {
|
|
2895
3100
|
this.disabled || this.open();
|
|
2896
3101
|
};
|
|
2897
3102
|
#h = () => {
|
|
@@ -2903,10 +3108,10 @@ class ft extends u {
|
|
|
2903
3108
|
const n = Math.min(e, r.length);
|
|
2904
3109
|
this.#e.setSelectionRange(n, n);
|
|
2905
3110
|
}
|
|
2906
|
-
const a = this.#
|
|
2907
|
-
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 }));
|
|
2908
3113
|
};
|
|
2909
|
-
#
|
|
3114
|
+
#c(t) {
|
|
2910
3115
|
let e = t;
|
|
2911
3116
|
e.startsWith("#") || (e = "#" + e);
|
|
2912
3117
|
const s = e.slice(1);
|
|
@@ -2923,19 +3128,19 @@ class ft extends u {
|
|
|
2923
3128
|
#n(t) {
|
|
2924
3129
|
return !!(/^#[a-fA-F0-9]{6}$/.test(t) || /^#[a-fA-F0-9]{3}$/.test(t));
|
|
2925
3130
|
}
|
|
2926
|
-
#
|
|
3131
|
+
#u = (t) => {
|
|
2927
3132
|
t.key === "Enter" && (t.preventDefault(), this.#h(), this.emit("change", { value: this.value }));
|
|
2928
3133
|
};
|
|
2929
|
-
#
|
|
2930
|
-
!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 }));
|
|
2931
3136
|
};
|
|
2932
3137
|
#m = () => {
|
|
2933
3138
|
this.emit("change", { value: this.value });
|
|
2934
3139
|
};
|
|
2935
|
-
#
|
|
3140
|
+
#f = (t) => {
|
|
2936
3141
|
this.state === "open" && (this.contains(t.target) || this.close());
|
|
2937
3142
|
};
|
|
2938
|
-
#
|
|
3143
|
+
#w = (t) => {
|
|
2939
3144
|
t.key === "Escape" && this.state === "open" && (this.close(), this.#t?.focus());
|
|
2940
3145
|
};
|
|
2941
3146
|
open() {
|
|
@@ -2949,21 +3154,21 @@ class ft extends u {
|
|
|
2949
3154
|
const t = this.getBoundingClientRect(), e = 280, i = window.innerHeight - t.bottom, r = t.top;
|
|
2950
3155
|
i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
|
|
2951
3156
|
}
|
|
2952
|
-
#
|
|
3157
|
+
#d() {
|
|
2953
3158
|
const t = this.$('[data-ry-target="swatch-color"]');
|
|
2954
3159
|
if (t && this.#s) {
|
|
2955
3160
|
const e = this.#s.rgb, s = this.hasAttribute("opacity") ? this.#s.alpha / 100 : 1;
|
|
2956
3161
|
t.style.backgroundColor = `rgba(${e.r}, ${e.g}, ${e.b}, ${s})`;
|
|
2957
3162
|
}
|
|
2958
3163
|
}
|
|
2959
|
-
#
|
|
3164
|
+
#b() {
|
|
2960
3165
|
const t = this.getAttribute("value") || "#000000";
|
|
2961
3166
|
if (this.#s) {
|
|
2962
3167
|
if (this.#s.setColor(t), this.#e) {
|
|
2963
3168
|
const e = this.#s.value;
|
|
2964
3169
|
this.#e.value = e.startsWith("#") ? e : "#" + e;
|
|
2965
3170
|
}
|
|
2966
|
-
this.#
|
|
3171
|
+
this.#d();
|
|
2967
3172
|
}
|
|
2968
3173
|
}
|
|
2969
3174
|
#v() {
|
|
@@ -2973,14 +3178,14 @@ class ft extends u {
|
|
|
2973
3178
|
}
|
|
2974
3179
|
}
|
|
2975
3180
|
attributeChangedCallback(t, e, s) {
|
|
2976
|
-
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")));
|
|
2977
3182
|
}
|
|
2978
3183
|
// Public API
|
|
2979
3184
|
get value() {
|
|
2980
3185
|
return this.#s?.value ?? this.getAttribute("value") ?? "#000000";
|
|
2981
3186
|
}
|
|
2982
3187
|
set value(t) {
|
|
2983
|
-
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());
|
|
2984
3189
|
}
|
|
2985
3190
|
get disabled() {
|
|
2986
3191
|
return this.hasAttribute("disabled");
|
|
@@ -2998,7 +3203,7 @@ class ft extends u {
|
|
|
2998
3203
|
return this.#s?.hsv ?? { h: 0, s: 0, v: 0 };
|
|
2999
3204
|
}
|
|
3000
3205
|
}
|
|
3001
|
-
customElements.define("ry-color-input",
|
|
3206
|
+
customElements.define("ry-color-input", yt);
|
|
3002
3207
|
function x(h) {
|
|
3003
3208
|
const t = h.trim().toLowerCase();
|
|
3004
3209
|
if (t.startsWith("#")) {
|
|
@@ -3031,19 +3236,19 @@ function x(h) {
|
|
|
3031
3236
|
}
|
|
3032
3237
|
return null;
|
|
3033
3238
|
}
|
|
3034
|
-
function
|
|
3239
|
+
function mt(h) {
|
|
3035
3240
|
const t = (e) => Math.max(0, Math.min(255, e)).toString(16).padStart(2, "0");
|
|
3036
3241
|
return `#${t(h.r)}${t(h.g)}${t(h.b)}`;
|
|
3037
3242
|
}
|
|
3038
|
-
function
|
|
3243
|
+
function vt(h, t, e) {
|
|
3039
3244
|
return {
|
|
3040
3245
|
r: Math.round(h.r + (t.r - h.r) * e),
|
|
3041
3246
|
g: Math.round(h.g + (t.g - h.g) * e),
|
|
3042
3247
|
b: Math.round(h.b + (t.b - h.b) * e)
|
|
3043
3248
|
};
|
|
3044
3249
|
}
|
|
3045
|
-
const I = "linear-gradient(90deg, #000000 0%, #ffffff 100%)",
|
|
3046
|
-
class
|
|
3250
|
+
const I = "linear-gradient(90deg, #000000 0%, #ffffff 100%)", At = 50;
|
|
3251
|
+
class wt extends u {
|
|
3047
3252
|
#t = "linear";
|
|
3048
3253
|
#e = 90;
|
|
3049
3254
|
#i = "circle";
|
|
@@ -3051,13 +3256,13 @@ class vt extends u {
|
|
|
3051
3256
|
#r = null;
|
|
3052
3257
|
#a = 0;
|
|
3053
3258
|
#o = null;
|
|
3054
|
-
#
|
|
3259
|
+
#l = !1;
|
|
3055
3260
|
#h = null;
|
|
3056
|
-
#
|
|
3261
|
+
#c = !1;
|
|
3057
3262
|
// Cached DOM refs
|
|
3058
3263
|
#n = null;
|
|
3059
|
-
#p = null;
|
|
3060
3264
|
#u = null;
|
|
3265
|
+
#p = null;
|
|
3061
3266
|
static observedAttributes = ["value", "disabled", "output"];
|
|
3062
3267
|
setup() {
|
|
3063
3268
|
this.#m(), this.#Y(), this.#X(), this.#x();
|
|
@@ -3067,12 +3272,12 @@ class vt extends u {
|
|
|
3067
3272
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3068
3273
|
#m() {
|
|
3069
3274
|
const t = this.getAttribute("value") || I;
|
|
3070
|
-
this.#
|
|
3275
|
+
this.#f(t) || this.#f(I);
|
|
3071
3276
|
}
|
|
3072
|
-
#
|
|
3277
|
+
#f(t) {
|
|
3073
3278
|
const e = t.trim();
|
|
3074
3279
|
if (!e.startsWith("linear-gradient(") && !e.startsWith("radial-gradient("))
|
|
3075
|
-
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;
|
|
3076
3281
|
let s, i;
|
|
3077
3282
|
e.startsWith("linear-gradient(") ? (s = "linear", i = e.slice(16, -1)) : (s = "radial", i = e.slice(16, -1));
|
|
3078
3283
|
let r = 90, a = "circle", n = i;
|
|
@@ -3083,8 +3288,8 @@ class vt extends u {
|
|
|
3083
3288
|
else {
|
|
3084
3289
|
const g = /^to\s+\w+(?:\s+\w+)?\s*,\s*/.exec(i);
|
|
3085
3290
|
if (g) {
|
|
3086
|
-
const
|
|
3087
|
-
r = this.#
|
|
3291
|
+
const y = g[0].trim().replace(/,\s*$/, "");
|
|
3292
|
+
r = this.#w(y), n = i.slice(g[0].length);
|
|
3088
3293
|
}
|
|
3089
3294
|
}
|
|
3090
3295
|
} else {
|
|
@@ -3094,10 +3299,10 @@ class vt extends u {
|
|
|
3094
3299
|
const o = [], l = /(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\)|hsla?\([^)]+\)|[a-z]+)\s+([\d.]+)%/g;
|
|
3095
3300
|
let c;
|
|
3096
3301
|
for (; (c = l.exec(n)) !== null; )
|
|
3097
|
-
o.push(this.#
|
|
3302
|
+
o.push(this.#d(c[1], parseFloat(c[2])));
|
|
3098
3303
|
return o.length < 2 ? !1 : (this.#t = s, this.#e = r, this.#i = a, this.#s = o, this.#r = o[0].id, !0);
|
|
3099
3304
|
}
|
|
3100
|
-
#
|
|
3305
|
+
#w(t) {
|
|
3101
3306
|
return {
|
|
3102
3307
|
"to top": 0,
|
|
3103
3308
|
"to top right": 45,
|
|
@@ -3118,16 +3323,16 @@ class vt extends u {
|
|
|
3118
3323
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3119
3324
|
// Stop management
|
|
3120
3325
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3121
|
-
#
|
|
3326
|
+
#d(t, e) {
|
|
3122
3327
|
return { id: `stop-${this.#a++}`, color: t, position: e };
|
|
3123
3328
|
}
|
|
3124
3329
|
/** CSS left value clamped so the stop handle stays within the bar */
|
|
3125
|
-
#
|
|
3330
|
+
#b(t) {
|
|
3126
3331
|
const e = "calc(var(--ry-gradient-picker-stop-size, 16px) / 2)";
|
|
3127
3332
|
return `clamp(${e}, ${t}%, calc(100% - ${e}))`;
|
|
3128
3333
|
}
|
|
3129
3334
|
#v(t, e) {
|
|
3130
|
-
const s = this.#
|
|
3335
|
+
const s = this.#d(t, e);
|
|
3131
3336
|
this.#s.push(s), this.#$(), this.#r = s.id, this.#C(), this.#x();
|
|
3132
3337
|
}
|
|
3133
3338
|
#y(t) {
|
|
@@ -3136,7 +3341,7 @@ class vt extends u {
|
|
|
3136
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);
|
|
3137
3342
|
}
|
|
3138
3343
|
#M(t) {
|
|
3139
|
-
this.#r !== t && (this.#r = t, this.#
|
|
3344
|
+
this.#r !== t && (this.#r = t, this.#N(), this.#L());
|
|
3140
3345
|
}
|
|
3141
3346
|
#$() {
|
|
3142
3347
|
this.#s.sort((t, e) => t.position - e.position);
|
|
@@ -3174,14 +3379,14 @@ class vt extends u {
|
|
|
3174
3379
|
</div>
|
|
3175
3380
|
<ry-color-picker data-ry-target="picker" inline opacity></ry-color-picker>
|
|
3176
3381
|
${o}
|
|
3177
|
-
`, 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();
|
|
3178
3383
|
}
|
|
3179
3384
|
#C() {
|
|
3180
3385
|
if (this.#n) {
|
|
3181
3386
|
this.#n.querySelectorAll('[data-ry-target="stop"]').forEach((t) => t.remove());
|
|
3182
3387
|
for (const t of this.#s) {
|
|
3183
3388
|
const e = document.createElement("div");
|
|
3184
|
-
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);
|
|
3185
3390
|
}
|
|
3186
3391
|
}
|
|
3187
3392
|
}
|
|
@@ -3195,9 +3400,9 @@ class vt extends u {
|
|
|
3195
3400
|
const i = this.$('[data-ry-target="angle-select"]');
|
|
3196
3401
|
i && this.on(i, "ry:input", this.#z);
|
|
3197
3402
|
const r = this.$('[data-ry-target="shape-circle"]'), a = this.$('[data-ry-target="shape-ellipse"]');
|
|
3198
|
-
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));
|
|
3199
3404
|
const n = this.$('[data-ry-target="copy-btn"]');
|
|
3200
|
-
n && this.on(n, "click", this.#
|
|
3405
|
+
n && this.on(n, "click", this.#V), this.#n && this.on(this.#n, "keydown", this.#J);
|
|
3201
3406
|
}
|
|
3202
3407
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3203
3408
|
// Bar / Stop interaction handlers
|
|
@@ -3208,11 +3413,11 @@ class vt extends u {
|
|
|
3208
3413
|
if (s) {
|
|
3209
3414
|
const i = s.getAttribute("data-stop-id");
|
|
3210
3415
|
if (!i) return;
|
|
3211
|
-
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();
|
|
3212
3417
|
} else {
|
|
3213
3418
|
if (t.preventDefault(), !this.#n) return;
|
|
3214
|
-
const i = this.#n.getBoundingClientRect(), r = Math.round(Math.max(0, Math.min(100, (t.clientX - i.left) / i.width * 100))), a = this.#
|
|
3215
|
-
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();
|
|
3216
3421
|
}
|
|
3217
3422
|
};
|
|
3218
3423
|
#K = (t) => {
|
|
@@ -3222,12 +3427,12 @@ class vt extends u {
|
|
|
3222
3427
|
const s = Math.max(0, Math.min(1, (t.clientX - this.#h.left) / this.#h.width));
|
|
3223
3428
|
e.position = Math.round(s * 100);
|
|
3224
3429
|
const i = this.#h.top + this.#h.height / 2, r = Math.abs(t.clientY - i);
|
|
3225
|
-
this.#
|
|
3430
|
+
this.#l = r > At && this.#s.length > 2;
|
|
3226
3431
|
const a = this.#n?.querySelector(`[data-stop-id="${e.id}"]`);
|
|
3227
|
-
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();
|
|
3228
3433
|
};
|
|
3229
3434
|
#q = () => {
|
|
3230
|
-
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());
|
|
3231
3436
|
};
|
|
3232
3437
|
#J = (t) => {
|
|
3233
3438
|
if (this.disabled) return;
|
|
@@ -3251,27 +3456,27 @@ class vt extends u {
|
|
|
3251
3456
|
this.#y(i) && (this.#D(), this.#B()), t.preventDefault();
|
|
3252
3457
|
return;
|
|
3253
3458
|
}
|
|
3254
|
-
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());
|
|
3255
3460
|
};
|
|
3256
3461
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3257
3462
|
// Type / Angle / Shape handlers
|
|
3258
3463
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3259
3464
|
#E(t) {
|
|
3260
|
-
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());
|
|
3261
3466
|
}
|
|
3262
3467
|
#z = (t) => {
|
|
3263
3468
|
const e = t.detail;
|
|
3264
|
-
this.#e = e.value, this.#H(), this.#
|
|
3469
|
+
this.#e = e.value, this.#H(), this.#k(), this.#S(), this.#D();
|
|
3265
3470
|
};
|
|
3266
3471
|
#P(t) {
|
|
3267
|
-
this.#i !== t && (this.#i = t, this.#_(), this.#
|
|
3472
|
+
this.#i !== t && (this.#i = t, this.#_(), this.#k(), this.#S(), this.#D(), this.#B());
|
|
3268
3473
|
}
|
|
3269
3474
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3270
3475
|
// Color picker handlers
|
|
3271
3476
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3272
3477
|
#R = () => {
|
|
3273
3478
|
const t = this.#I();
|
|
3274
|
-
!t || !this.#
|
|
3479
|
+
!t || !this.#u || (t.color = this.#u.value, this.#Z(t), this.#O(), this.#H(), this.#k(), this.#D());
|
|
3275
3480
|
};
|
|
3276
3481
|
#T = () => {
|
|
3277
3482
|
this.#S(), this.#B();
|
|
@@ -3279,7 +3484,7 @@ class vt extends u {
|
|
|
3279
3484
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3280
3485
|
// Copy handler
|
|
3281
3486
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3282
|
-
#
|
|
3487
|
+
#V = () => {
|
|
3283
3488
|
const t = this.#g();
|
|
3284
3489
|
navigator.clipboard.writeText(t).then(() => {
|
|
3285
3490
|
const e = this.$('[data-ry-target="copy-btn"]');
|
|
@@ -3296,14 +3501,14 @@ class vt extends u {
|
|
|
3296
3501
|
this.#A();
|
|
3297
3502
|
};
|
|
3298
3503
|
#A() {
|
|
3299
|
-
if (!this.#
|
|
3300
|
-
const t = this.#
|
|
3301
|
-
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();
|
|
3302
3507
|
}
|
|
3303
3508
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3304
3509
|
// Color interpolation
|
|
3305
3510
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3306
|
-
#
|
|
3511
|
+
#U(t) {
|
|
3307
3512
|
if (this.#s.length === 0) return "#808080";
|
|
3308
3513
|
if (this.#s.length === 1) return this.#s[0].color;
|
|
3309
3514
|
const e = [...this.#s].sort((l, c) => l.position - c.position);
|
|
@@ -3318,13 +3523,13 @@ class vt extends u {
|
|
|
3318
3523
|
const r = i.position - s.position;
|
|
3319
3524
|
if (r === 0) return s.color;
|
|
3320
3525
|
const a = (t - s.position) / r, n = x(s.color), o = x(i.color);
|
|
3321
|
-
return !n || !o ? s.color :
|
|
3526
|
+
return !n || !o ? s.color : mt(vt(n, o, a));
|
|
3322
3527
|
}
|
|
3323
3528
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3324
3529
|
// Update methods
|
|
3325
3530
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3326
3531
|
#x() {
|
|
3327
|
-
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();
|
|
3328
3533
|
}
|
|
3329
3534
|
#_() {
|
|
3330
3535
|
const t = this.$('[data-ry-target="type-solid"]'), e = this.$('[data-ry-target="type-linear"]'), s = this.$('[data-ry-target="type-radial"]');
|
|
@@ -3335,11 +3540,11 @@ class vt extends u {
|
|
|
3335
3540
|
a && a.setAttribute("value", String(this.#e));
|
|
3336
3541
|
}
|
|
3337
3542
|
#H() {
|
|
3338
|
-
if (!this.#
|
|
3339
|
-
const t = this.#
|
|
3543
|
+
if (!this.#u) return;
|
|
3544
|
+
const t = this.#u.querySelector('[data-ry-target="preview-color"]');
|
|
3340
3545
|
t && (t.style.backgroundImage = this.#t === "solid" ? "" : this.#g());
|
|
3341
3546
|
}
|
|
3342
|
-
#
|
|
3547
|
+
#O() {
|
|
3343
3548
|
if (!this.#n) return;
|
|
3344
3549
|
const t = this.#s.map((e) => `${e.color} ${e.position}%`).join(", ");
|
|
3345
3550
|
this.#n.style.backgroundImage = `linear-gradient(to right, ${t})`;
|
|
@@ -3348,7 +3553,7 @@ class vt extends u {
|
|
|
3348
3553
|
if (this.#n)
|
|
3349
3554
|
for (const t of this.#s) {
|
|
3350
3555
|
const e = this.#n.querySelector(`[data-stop-id="${t.id}"]`);
|
|
3351
|
-
e && (e.style.left = this.#
|
|
3556
|
+
e && (e.style.left = this.#b(t.position));
|
|
3352
3557
|
}
|
|
3353
3558
|
}
|
|
3354
3559
|
#Z(t) {
|
|
@@ -3356,7 +3561,7 @@ class vt extends u {
|
|
|
3356
3561
|
const e = this.#n.querySelector(`[data-stop-id="${t.id}"]`);
|
|
3357
3562
|
e && e.style.setProperty("--stop-color", t.color);
|
|
3358
3563
|
}
|
|
3359
|
-
#
|
|
3564
|
+
#N() {
|
|
3360
3565
|
if (!this.#n) return;
|
|
3361
3566
|
const t = this.#n.querySelectorAll('[data-ry-target="stop"]');
|
|
3362
3567
|
for (const e of t)
|
|
@@ -3364,14 +3569,14 @@ class vt extends u {
|
|
|
3364
3569
|
}
|
|
3365
3570
|
#L() {
|
|
3366
3571
|
const t = this.#I();
|
|
3367
|
-
!t || !this.#
|
|
3572
|
+
!t || !this.#u || this.#u.setColor(t.color);
|
|
3368
3573
|
}
|
|
3369
|
-
#
|
|
3370
|
-
this.#
|
|
3574
|
+
#k() {
|
|
3575
|
+
this.#p && document.activeElement !== this.#p && (this.#p.value = this.#g());
|
|
3371
3576
|
}
|
|
3372
3577
|
#S() {
|
|
3373
3578
|
const t = this.#g();
|
|
3374
|
-
this.getAttribute("value") !== t && (this.#
|
|
3579
|
+
this.getAttribute("value") !== t && (this.#c = !0, this.setAttribute("value", t), this.#c = !1);
|
|
3375
3580
|
}
|
|
3376
3581
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3377
3582
|
// Events
|
|
@@ -3398,7 +3603,7 @@ class vt extends u {
|
|
|
3398
3603
|
// Attribute changed
|
|
3399
3604
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3400
3605
|
attributeChangedCallback(t, e, s) {
|
|
3401
|
-
e === s || this.#
|
|
3606
|
+
e === s || this.#c || t === "value" && this.#n && s && this.#f(s) && (this.#C(), this.#x());
|
|
3402
3607
|
}
|
|
3403
3608
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3404
3609
|
// Public API
|
|
@@ -3407,7 +3612,7 @@ class vt extends u {
|
|
|
3407
3612
|
return this.#g();
|
|
3408
3613
|
}
|
|
3409
3614
|
set value(t) {
|
|
3410
|
-
this.#
|
|
3615
|
+
this.#f(t) && (this.#C(), this.#x(), this.#S());
|
|
3411
3616
|
}
|
|
3412
3617
|
get type() {
|
|
3413
3618
|
return this.#t;
|
|
@@ -3419,7 +3624,7 @@ class vt extends u {
|
|
|
3419
3624
|
return this.#e;
|
|
3420
3625
|
}
|
|
3421
3626
|
set angle(t) {
|
|
3422
|
-
this.#e = (t % 360 + 360) % 360, this.#_(), this.#
|
|
3627
|
+
this.#e = (t % 360 + 360) % 360, this.#_(), this.#k(), this.#S();
|
|
3423
3628
|
}
|
|
3424
3629
|
get shape() {
|
|
3425
3630
|
return this.#i;
|
|
@@ -3445,16 +3650,16 @@ class vt extends u {
|
|
|
3445
3650
|
}
|
|
3446
3651
|
removeStop(t) {
|
|
3447
3652
|
const e = this.#y(t);
|
|
3448
|
-
return e && (this.#
|
|
3653
|
+
return e && (this.#k(), this.#S(), this.#B()), e;
|
|
3449
3654
|
}
|
|
3450
3655
|
}
|
|
3451
|
-
customElements.define("ry-gradient-picker",
|
|
3452
|
-
let
|
|
3453
|
-
const
|
|
3656
|
+
customElements.define("ry-gradient-picker", wt);
|
|
3657
|
+
let kt = 0;
|
|
3658
|
+
const $t = 5;
|
|
3454
3659
|
function _(h) {
|
|
3455
3660
|
return p(h).replace(/width="24"/g, 'width="16"').replace(/height="24"/g, 'height="16"').replace(/viewBox/, 'class="ry-tree__icon" viewBox');
|
|
3456
3661
|
}
|
|
3457
|
-
class
|
|
3662
|
+
class w extends u {
|
|
3458
3663
|
// Drag state
|
|
3459
3664
|
#t = !1;
|
|
3460
3665
|
#e = !1;
|
|
@@ -3463,7 +3668,7 @@ class k extends u {
|
|
|
3463
3668
|
#r = null;
|
|
3464
3669
|
#a = null;
|
|
3465
3670
|
#o = null;
|
|
3466
|
-
#
|
|
3671
|
+
#l = null;
|
|
3467
3672
|
setup() {
|
|
3468
3673
|
this.#h(), this.on(this, "click", (t) => {
|
|
3469
3674
|
const s = t.target.closest('[data-ry-target="file"]');
|
|
@@ -3486,17 +3691,17 @@ class k extends u {
|
|
|
3486
3691
|
const t = Array.from(this.children), e = document.createElement("ul");
|
|
3487
3692
|
e.className = "ry-tree__root";
|
|
3488
3693
|
for (const s of t)
|
|
3489
|
-
e.appendChild(this.#
|
|
3694
|
+
e.appendChild(this.#c(s));
|
|
3490
3695
|
this.innerHTML = "", this.appendChild(e);
|
|
3491
3696
|
}
|
|
3492
|
-
#
|
|
3697
|
+
#c(t) {
|
|
3493
3698
|
const e = document.createElement("li");
|
|
3494
3699
|
e.className = "ry-tree__item";
|
|
3495
3700
|
const s = t.getAttribute("label") ?? "", i = t.hasAttribute("open"), r = t.hasAttribute("selected"), a = Array.from(t.children).filter(
|
|
3496
3701
|
(o) => o.tagName === "RY-TREE-ITEM"
|
|
3497
3702
|
);
|
|
3498
3703
|
if (a.length > 0) {
|
|
3499
|
-
const o = `ry-tree-${++
|
|
3704
|
+
const o = `ry-tree-${++kt}`, l = document.createElement("input");
|
|
3500
3705
|
l.type = "checkbox", l.id = o, l.className = "ry-tree__toggle", i && (l.checked = !0);
|
|
3501
3706
|
const c = document.createElement("label");
|
|
3502
3707
|
c.htmlFor = o, c.className = "ry-tree__label", c.setAttribute("data-ry-target", "folder"), c.dataset.ryLabel = s, c.innerHTML = `
|
|
@@ -3508,8 +3713,8 @@ class k extends u {
|
|
|
3508
3713
|
d.className = "ry-tree__children-wrapper";
|
|
3509
3714
|
const g = document.createElement("ul");
|
|
3510
3715
|
g.className = "ry-tree__children";
|
|
3511
|
-
for (const
|
|
3512
|
-
g.appendChild(this.#
|
|
3716
|
+
for (const y of a)
|
|
3717
|
+
g.appendChild(this.#c(y));
|
|
3513
3718
|
d.appendChild(g), e.appendChild(l), e.appendChild(c), e.appendChild(d);
|
|
3514
3719
|
} else {
|
|
3515
3720
|
const o = document.createElement("div");
|
|
@@ -3530,9 +3735,9 @@ class k extends u {
|
|
|
3530
3735
|
#n(t) {
|
|
3531
3736
|
return Array.from(t.children).filter(
|
|
3532
3737
|
(s) => s instanceof HTMLElement && s.classList.contains("ry-tree__item")
|
|
3533
|
-
).map((s) => this.#
|
|
3738
|
+
).map((s) => this.#u(s));
|
|
3534
3739
|
}
|
|
3535
|
-
#
|
|
3740
|
+
#u(t) {
|
|
3536
3741
|
const e = t.querySelector(':scope > [data-ry-target="folder"]'), s = t.querySelector(':scope > [data-ry-target="file"]');
|
|
3537
3742
|
if (e) {
|
|
3538
3743
|
const r = t.querySelector(":scope > .ry-tree__toggle"), a = t.querySelector(".ry-tree__children"), n = { label: e.dataset.ryLabel ?? "" };
|
|
@@ -3549,32 +3754,32 @@ class k extends u {
|
|
|
3549
3754
|
static from(t) {
|
|
3550
3755
|
const e = document.createElement("ry-tree");
|
|
3551
3756
|
for (const s of t)
|
|
3552
|
-
e.appendChild(
|
|
3757
|
+
e.appendChild(w.#p(s));
|
|
3553
3758
|
return e;
|
|
3554
3759
|
}
|
|
3555
|
-
static #
|
|
3760
|
+
static #p(t) {
|
|
3556
3761
|
const e = document.createElement("ry-tree-item");
|
|
3557
3762
|
if (e.setAttribute("label", t.label), t.open && e.setAttribute("open", ""), t.selected && e.setAttribute("selected", ""), t.children)
|
|
3558
3763
|
for (const s of t.children)
|
|
3559
|
-
e.appendChild(
|
|
3764
|
+
e.appendChild(w.#p(s));
|
|
3560
3765
|
return e;
|
|
3561
3766
|
}
|
|
3562
3767
|
// ── Drag and Drop ──────────────────────────────────────────
|
|
3563
3768
|
#m() {
|
|
3564
|
-
this.on(this, "pointerdown", this.#
|
|
3769
|
+
this.on(this, "pointerdown", this.#f), this.on(document, "pointermove", this.#w), this.on(document, "pointerup", this.#g);
|
|
3565
3770
|
}
|
|
3566
|
-
#
|
|
3771
|
+
#f = (t) => {
|
|
3567
3772
|
const s = t.target.closest(".ry-tree__label, .ry-tree__file");
|
|
3568
3773
|
if (!s) return;
|
|
3569
3774
|
const i = s.closest(".ry-tree__item");
|
|
3570
3775
|
i && (this.#t = !0, this.#i = t.clientX, this.#s = t.clientY, this.#r = i);
|
|
3571
3776
|
};
|
|
3572
|
-
#
|
|
3777
|
+
#w = (t) => {
|
|
3573
3778
|
if (!this.#t && !this.#e) return;
|
|
3574
3779
|
if (this.#t && !this.#e) {
|
|
3575
3780
|
const c = t.clientX - this.#i, d = t.clientY - this.#s;
|
|
3576
|
-
if (Math.hypot(c, d) <
|
|
3577
|
-
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);
|
|
3578
3783
|
}
|
|
3579
3784
|
if (!this.#e || !this.#a) return;
|
|
3580
3785
|
this.#a.style.left = `${t.clientX + 12}px`, this.#a.style.top = `${t.clientY - 14}px`, this.#a.style.display = "none";
|
|
@@ -3602,9 +3807,9 @@ class k extends u {
|
|
|
3602
3807
|
o && a > n * 0.25 && a < n * 0.75 ? l = "inside" : a < n * 0.5 ? l = "before" : l = "after", this.#v(i, l);
|
|
3603
3808
|
};
|
|
3604
3809
|
#g = () => {
|
|
3605
|
-
this.#e && this.#
|
|
3810
|
+
this.#e && this.#b(), this.#t = !1, this.#e = !1, this.#r = null;
|
|
3606
3811
|
};
|
|
3607
|
-
#
|
|
3812
|
+
#d(t) {
|
|
3608
3813
|
if (!this.#r) return;
|
|
3609
3814
|
t.preventDefault(), this.#r.setAttribute("data-ry-dragging", ""), this.#r.classList.add("ry-tree__item--collapsed");
|
|
3610
3815
|
const e = this.#r.querySelector(".ry-tree__label, .ry-tree__file");
|
|
@@ -3612,16 +3817,16 @@ class k extends u {
|
|
|
3612
3817
|
const s = e.cloneNode(!0);
|
|
3613
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;
|
|
3614
3819
|
}
|
|
3615
|
-
#
|
|
3820
|
+
#b() {
|
|
3616
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");
|
|
3617
|
-
const t = this.#o, e = this.#
|
|
3822
|
+
const t = this.#o, e = this.#l;
|
|
3618
3823
|
this.#y(), this.#r && t && e && this.#M(this.#r, t, e);
|
|
3619
3824
|
}
|
|
3620
3825
|
#v(t, e) {
|
|
3621
|
-
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);
|
|
3622
3827
|
}
|
|
3623
3828
|
#y() {
|
|
3624
|
-
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;
|
|
3625
3830
|
}
|
|
3626
3831
|
#M(t, e, s) {
|
|
3627
3832
|
if (s === "inside" && e.contains(t)) return;
|
|
@@ -3649,12 +3854,12 @@ class k extends u {
|
|
|
3649
3854
|
return e?.dataset.ryLabel ?? s?.dataset.ryLabel ?? "";
|
|
3650
3855
|
}
|
|
3651
3856
|
}
|
|
3652
|
-
class
|
|
3857
|
+
class xt extends u {
|
|
3653
3858
|
// Declarative container consumed by RyTree#build
|
|
3654
3859
|
}
|
|
3655
|
-
customElements.define("ry-tree",
|
|
3656
|
-
customElements.define("ry-tree-item",
|
|
3657
|
-
class
|
|
3860
|
+
customElements.define("ry-tree", w);
|
|
3861
|
+
customElements.define("ry-tree-item", xt);
|
|
3862
|
+
class _t extends u {
|
|
3658
3863
|
setup() {
|
|
3659
3864
|
this.#t();
|
|
3660
3865
|
}
|
|
@@ -3675,8 +3880,8 @@ class $t extends u {
|
|
|
3675
3880
|
return this.$('[data-ry-target="label"]')?.textContent?.trim() ?? "";
|
|
3676
3881
|
}
|
|
3677
3882
|
}
|
|
3678
|
-
customElements.define("ry-tag",
|
|
3679
|
-
class
|
|
3883
|
+
customElements.define("ry-tag", _t);
|
|
3884
|
+
class Mt extends u {
|
|
3680
3885
|
#t = [];
|
|
3681
3886
|
setup() {
|
|
3682
3887
|
this.#e(), this.#i();
|
|
@@ -3711,7 +3916,7 @@ class xt extends u {
|
|
|
3711
3916
|
else if (t.key === "Tab")
|
|
3712
3917
|
return;
|
|
3713
3918
|
}
|
|
3714
|
-
t.key === "Backspace" && !e.value && this.#t.length > 0 && this.#
|
|
3919
|
+
t.key === "Backspace" && !e.value && this.#t.length > 0 && this.#l();
|
|
3715
3920
|
};
|
|
3716
3921
|
#r = (t) => {
|
|
3717
3922
|
t.preventDefault();
|
|
@@ -3736,7 +3941,7 @@ class xt extends u {
|
|
|
3736
3941
|
}
|
|
3737
3942
|
this.#h(), this.emit("add", { value: t }), this.emit("change", { values: [...this.#t] });
|
|
3738
3943
|
}
|
|
3739
|
-
#
|
|
3944
|
+
#l() {
|
|
3740
3945
|
const e = this.$('[data-ry-target="tags"]')?.lastElementChild;
|
|
3741
3946
|
if (e) {
|
|
3742
3947
|
const s = e.dataset.value ?? "";
|
|
@@ -3755,11 +3960,11 @@ class xt extends u {
|
|
|
3755
3960
|
return [...this.#t];
|
|
3756
3961
|
}
|
|
3757
3962
|
}
|
|
3758
|
-
customElements.define("ry-tag-input",
|
|
3759
|
-
class
|
|
3963
|
+
customElements.define("ry-tag-input", Mt);
|
|
3964
|
+
class Et extends u {
|
|
3760
3965
|
}
|
|
3761
|
-
customElements.define("ry-hero",
|
|
3762
|
-
class
|
|
3966
|
+
customElements.define("ry-hero", Et);
|
|
3967
|
+
class Ct extends u {
|
|
3763
3968
|
setup() {
|
|
3764
3969
|
this.#t();
|
|
3765
3970
|
}
|
|
@@ -3772,8 +3977,8 @@ class Mt extends u {
|
|
|
3772
3977
|
`;
|
|
3773
3978
|
}
|
|
3774
3979
|
}
|
|
3775
|
-
customElements.define("ry-stat",
|
|
3776
|
-
class
|
|
3980
|
+
customElements.define("ry-stat", Ct);
|
|
3981
|
+
class St extends u {
|
|
3777
3982
|
setup() {
|
|
3778
3983
|
this.#t();
|
|
3779
3984
|
}
|
|
@@ -3787,17 +3992,17 @@ class Et extends u {
|
|
|
3787
3992
|
s.setAttribute("data-ry-target", "icon"), s.className = "ry-feature__icon", s.innerHTML = e, this.insertBefore(s, this.firstChild);
|
|
3788
3993
|
}
|
|
3789
3994
|
}
|
|
3790
|
-
class Ct extends u {
|
|
3791
|
-
}
|
|
3792
|
-
customElements.define("ry-feature", Et);
|
|
3793
|
-
customElements.define("ry-feature-grid", Ct);
|
|
3794
|
-
class St extends u {
|
|
3795
|
-
}
|
|
3796
3995
|
class Tt extends u {
|
|
3797
3996
|
}
|
|
3798
|
-
customElements.define("ry-
|
|
3799
|
-
customElements.define("ry-
|
|
3997
|
+
customElements.define("ry-feature", St);
|
|
3998
|
+
customElements.define("ry-feature-grid", Tt);
|
|
3800
3999
|
class Lt extends u {
|
|
4000
|
+
}
|
|
4001
|
+
class Dt extends u {
|
|
4002
|
+
}
|
|
4003
|
+
customElements.define("ry-pricing", Lt);
|
|
4004
|
+
customElements.define("ry-pricing-card", Dt);
|
|
4005
|
+
class It extends u {
|
|
3801
4006
|
#t = 0;
|
|
3802
4007
|
#e = 0;
|
|
3803
4008
|
#i = null;
|
|
@@ -3832,29 +4037,29 @@ class Lt extends u {
|
|
|
3832
4037
|
}
|
|
3833
4038
|
this.appendChild(a);
|
|
3834
4039
|
}
|
|
3835
|
-
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);
|
|
3836
4041
|
}
|
|
3837
4042
|
#o = (t) => {
|
|
3838
4043
|
t.key === "ArrowLeft" ? (t.preventDefault(), this.prev()) : t.key === "ArrowRight" && (t.preventDefault(), this.next());
|
|
3839
4044
|
};
|
|
3840
|
-
#
|
|
4045
|
+
#l = (t) => {
|
|
3841
4046
|
this.#s = t.clientX, this.#r = !0, t.currentTarget.setPointerCapture(t.pointerId);
|
|
3842
4047
|
};
|
|
3843
4048
|
#h = (t) => {
|
|
3844
4049
|
this.#r && t.preventDefault();
|
|
3845
4050
|
};
|
|
3846
|
-
#
|
|
4051
|
+
#c = (t) => {
|
|
3847
4052
|
if (!this.#r) return;
|
|
3848
4053
|
this.#r = !1;
|
|
3849
4054
|
const e = t.clientX - this.#s, s = 50;
|
|
3850
4055
|
e > s ? this.prev() : e < -s && this.next();
|
|
3851
4056
|
};
|
|
3852
4057
|
#n() {
|
|
3853
|
-
if (this.#
|
|
4058
|
+
if (this.#u(), !this.hasAttribute("autoplay")) return;
|
|
3854
4059
|
const t = parseInt(this.getAttribute("interval") ?? "5000", 10);
|
|
3855
4060
|
this.#i = setInterval(() => this.next(), t);
|
|
3856
4061
|
}
|
|
3857
|
-
#
|
|
4062
|
+
#u() {
|
|
3858
4063
|
this.#i && (clearInterval(this.#i), this.#i = null);
|
|
3859
4064
|
}
|
|
3860
4065
|
goTo(t) {
|
|
@@ -3874,56 +4079,57 @@ class Lt extends u {
|
|
|
3874
4079
|
this.goTo(this.#t - 1);
|
|
3875
4080
|
}
|
|
3876
4081
|
teardown() {
|
|
3877
|
-
this.#
|
|
4082
|
+
this.#u();
|
|
3878
4083
|
}
|
|
3879
4084
|
}
|
|
3880
|
-
customElements.define("ry-carousel",
|
|
4085
|
+
customElements.define("ry-carousel", It);
|
|
3881
4086
|
window.RyToast = f;
|
|
3882
4087
|
console.log("ry-ui loaded");
|
|
3883
4088
|
export {
|
|
3884
4089
|
R as RyAccordion,
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
4090
|
+
V as RyAlert,
|
|
4091
|
+
O as RyButton,
|
|
4092
|
+
N as RyButtonGroup,
|
|
3888
4093
|
z as RyCard,
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
4094
|
+
It as RyCarousel,
|
|
4095
|
+
rt as RyCode,
|
|
4096
|
+
yt as RyColorInput,
|
|
4097
|
+
bt as RyColorPicker,
|
|
4098
|
+
it as RyCombobox,
|
|
3893
4099
|
J as RyDrawer,
|
|
3894
4100
|
j as RyDropdown,
|
|
3895
4101
|
u as RyElement,
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
4102
|
+
at as RyExample,
|
|
4103
|
+
St as RyFeature,
|
|
4104
|
+
Tt as RyFeatureGrid,
|
|
4105
|
+
U as RyField,
|
|
4106
|
+
wt as RyGradientPicker,
|
|
4107
|
+
Et as RyHero,
|
|
4108
|
+
nt as RyIcon,
|
|
4109
|
+
ut as RyKnob,
|
|
3904
4110
|
P as RyModal,
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
4111
|
+
pt as RyNumberSelect,
|
|
4112
|
+
Lt as RyPricing,
|
|
4113
|
+
Dt as RyPricingCard,
|
|
3908
4114
|
tt as RySelect,
|
|
3909
|
-
|
|
4115
|
+
dt as RySlider,
|
|
3910
4116
|
K as RySplit,
|
|
3911
|
-
|
|
4117
|
+
Ct as RyStat,
|
|
3912
4118
|
Y as RySwitch,
|
|
3913
4119
|
F as RyTabs,
|
|
3914
|
-
|
|
3915
|
-
|
|
4120
|
+
_t as RyTag,
|
|
4121
|
+
Mt as RyTagInput,
|
|
3916
4122
|
q as RyThemeToggle,
|
|
3917
4123
|
f as RyToast,
|
|
3918
|
-
|
|
4124
|
+
ct as RyToggleButton,
|
|
3919
4125
|
G as RyTooltip,
|
|
3920
|
-
|
|
3921
|
-
|
|
4126
|
+
w as RyTree,
|
|
4127
|
+
xt as RyTreeItem,
|
|
3922
4128
|
p as getIcon,
|
|
3923
|
-
|
|
4129
|
+
Pt as getIconNames,
|
|
3924
4130
|
C as processTransforms,
|
|
3925
|
-
|
|
3926
|
-
|
|
4131
|
+
Bt as registerIcon,
|
|
4132
|
+
Rt as registerIcons,
|
|
3927
4133
|
M as transform
|
|
3928
4134
|
};
|
|
3929
4135
|
//# sourceMappingURL=ry-ui.js.map
|