@ryanhelsing/ry-ui 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ry-combobox.d.ts.map +1 -1
- package/dist/css/ry-structure.css +3 -1
- package/dist/css/ry-theme.css +1 -1
- package/dist/css/ry-ui.css +4 -2
- package/dist/ry-ui.js +119 -111
- package/dist/ry-ui.js.map +1 -1
- package/package.json +1 -1
package/dist/ry-ui.js
CHANGED
|
@@ -490,8 +490,8 @@ class K extends u {
|
|
|
490
490
|
this.style.setProperty("--ry-split-width", `${i}px`);
|
|
491
491
|
}
|
|
492
492
|
#c = (t) => {
|
|
493
|
-
t.preventDefault(), this.#
|
|
494
|
-
const e = (i) => this.#
|
|
493
|
+
t.preventDefault(), this.#p(t.clientX);
|
|
494
|
+
const e = (i) => this.#d(i.clientX), s = () => {
|
|
495
495
|
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", s), this.#m();
|
|
496
496
|
};
|
|
497
497
|
document.addEventListener("mousemove", e), document.addEventListener("mouseup", s);
|
|
@@ -499,30 +499,30 @@ class K extends u {
|
|
|
499
499
|
#n = (t) => {
|
|
500
500
|
const e = t.touches[0];
|
|
501
501
|
if (!e) return;
|
|
502
|
-
t.preventDefault(), this.#
|
|
502
|
+
t.preventDefault(), this.#p(e.clientX);
|
|
503
503
|
const s = (r) => {
|
|
504
504
|
const a = r.touches[0];
|
|
505
|
-
a && this.#
|
|
505
|
+
a && this.#d(a.clientX);
|
|
506
506
|
}, i = () => {
|
|
507
507
|
document.removeEventListener("touchmove", s), document.removeEventListener("touchend", i), this.#m();
|
|
508
508
|
};
|
|
509
509
|
document.addEventListener("touchmove", s, { passive: !1 }), document.addEventListener("touchend", i);
|
|
510
510
|
};
|
|
511
|
-
#
|
|
511
|
+
#p(t) {
|
|
512
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";
|
|
513
513
|
}
|
|
514
|
-
#
|
|
514
|
+
#d(t) {
|
|
515
515
|
if (!this.#e) return;
|
|
516
516
|
const e = this.#i - t;
|
|
517
517
|
this.#h(this.#s + e);
|
|
518
518
|
}
|
|
519
519
|
#m() {
|
|
520
|
-
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.#u(), this.emit("resize", { width: this.#a() });
|
|
521
521
|
}
|
|
522
522
|
#f = (t) => {
|
|
523
523
|
const e = t.shiftKey ? 50 : 10;
|
|
524
524
|
let s = this.#a();
|
|
525
|
-
t.key === "ArrowLeft" ? (t.preventDefault(), this.#h(s + e), this.#
|
|
525
|
+
t.key === "ArrowLeft" ? (t.preventDefault(), this.#h(s + e), this.#u()) : t.key === "ArrowRight" ? (t.preventDefault(), this.#h(s - e), this.#u()) : t.key === "Home" ? (t.preventDefault(), this.#h(this.#o()), this.#u()) : t.key === "End" && (t.preventDefault(), this.#h(this.#l()), this.#u());
|
|
526
526
|
};
|
|
527
527
|
#w = () => {
|
|
528
528
|
this.style.removeProperty("--ry-split-width"), this.#v(), this.emit("resize", { width: this.#a() });
|
|
@@ -532,7 +532,7 @@ class K extends u {
|
|
|
532
532
|
const t = this.getAttribute("persist");
|
|
533
533
|
return t ? `ry-split:${t}` : null;
|
|
534
534
|
}
|
|
535
|
-
#
|
|
535
|
+
#u() {
|
|
536
536
|
const t = this.#g();
|
|
537
537
|
if (t)
|
|
538
538
|
try {
|
|
@@ -990,7 +990,7 @@ class tt extends u {
|
|
|
990
990
|
if (t)
|
|
991
991
|
if (this.#a)
|
|
992
992
|
for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
|
|
993
|
-
this.#
|
|
993
|
+
this.#u(e);
|
|
994
994
|
else
|
|
995
995
|
this.value = t;
|
|
996
996
|
}
|
|
@@ -1054,7 +1054,7 @@ class tt extends u {
|
|
|
1054
1054
|
if (s instanceof HTMLElement && !s.hasAttribute("data-disabled")) {
|
|
1055
1055
|
if (this.#a) {
|
|
1056
1056
|
const r = s.dataset.value ?? "";
|
|
1057
|
-
this.#
|
|
1057
|
+
this.#u(r);
|
|
1058
1058
|
} else
|
|
1059
1059
|
this.#$(s), this.close();
|
|
1060
1060
|
return;
|
|
@@ -1072,7 +1072,7 @@ class tt extends u {
|
|
|
1072
1072
|
if (i)
|
|
1073
1073
|
if (this.#a) {
|
|
1074
1074
|
const r = i.dataset.value ?? "";
|
|
1075
|
-
this.#
|
|
1075
|
+
this.#u(r);
|
|
1076
1076
|
} else
|
|
1077
1077
|
this.#$(i), this.close();
|
|
1078
1078
|
} else
|
|
@@ -1096,11 +1096,11 @@ class tt extends u {
|
|
|
1096
1096
|
case "Backspace":
|
|
1097
1097
|
if (this.#a && this.#r.size > 0) {
|
|
1098
1098
|
const s = [...this.#r], i = s[s.length - 1];
|
|
1099
|
-
i && this.#
|
|
1099
|
+
i && this.#u(i);
|
|
1100
1100
|
}
|
|
1101
1101
|
break;
|
|
1102
1102
|
default:
|
|
1103
|
-
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#
|
|
1103
|
+
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#p(t.key);
|
|
1104
1104
|
break;
|
|
1105
1105
|
}
|
|
1106
1106
|
};
|
|
@@ -1110,16 +1110,16 @@ class tt extends u {
|
|
|
1110
1110
|
};
|
|
1111
1111
|
#n = (t) => {
|
|
1112
1112
|
const e = t.detail.value;
|
|
1113
|
-
this.#r.has(e) && this.#
|
|
1113
|
+
this.#r.has(e) && this.#u(e);
|
|
1114
1114
|
};
|
|
1115
|
-
#
|
|
1115
|
+
#p(t) {
|
|
1116
1116
|
this.#s && clearTimeout(this.#s), this.#i += t.toLowerCase();
|
|
1117
1117
|
const e = this.$$('[data-ry-target="option"]:not([data-disabled])'), s = e.findIndex(
|
|
1118
1118
|
(i) => i.textContent?.trim().toLowerCase().startsWith(this.#i)
|
|
1119
1119
|
);
|
|
1120
1120
|
if (s >= 0) {
|
|
1121
1121
|
if (this.state === "open")
|
|
1122
|
-
this.#
|
|
1122
|
+
this.#d(s);
|
|
1123
1123
|
else if (!this.#a) {
|
|
1124
1124
|
const i = e[s];
|
|
1125
1125
|
i && this.#$(i);
|
|
@@ -1129,7 +1129,7 @@ class tt extends u {
|
|
|
1129
1129
|
this.#i = "";
|
|
1130
1130
|
}, 500);
|
|
1131
1131
|
}
|
|
1132
|
-
#
|
|
1132
|
+
#d(t) {
|
|
1133
1133
|
const e = this.$$('[data-ry-target="option"]:not([data-disabled])');
|
|
1134
1134
|
if (t < 0 || t >= e.length) return;
|
|
1135
1135
|
this.$$('[data-ry-target="option"][data-highlighted]').forEach((r) => {
|
|
@@ -1143,21 +1143,21 @@ class tt extends u {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
#m() {
|
|
1145
1145
|
const t = this.$$('[data-ry-target="option"]:not([data-disabled])'), e = Math.min(this.#e + 1, t.length - 1);
|
|
1146
|
-
this.#
|
|
1146
|
+
this.#d(e);
|
|
1147
1147
|
}
|
|
1148
1148
|
#f() {
|
|
1149
1149
|
const t = Math.max(this.#e - 1, 0);
|
|
1150
|
-
this.#
|
|
1150
|
+
this.#d(t);
|
|
1151
1151
|
}
|
|
1152
1152
|
#w() {
|
|
1153
|
-
this.#
|
|
1153
|
+
this.#d(0);
|
|
1154
1154
|
}
|
|
1155
1155
|
#g() {
|
|
1156
1156
|
const t = this.$$('[data-ry-target="option"]:not([data-disabled])');
|
|
1157
|
-
this.#
|
|
1157
|
+
this.#d(t.length - 1);
|
|
1158
1158
|
}
|
|
1159
1159
|
// --- Multi-select methods ---
|
|
1160
|
-
#
|
|
1160
|
+
#u(t) {
|
|
1161
1161
|
const e = this.getAttribute("max-selections");
|
|
1162
1162
|
if (this.#r.has(t))
|
|
1163
1163
|
this.#r.delete(t);
|
|
@@ -1209,14 +1209,14 @@ class tt extends u {
|
|
|
1209
1209
|
this.state = "open";
|
|
1210
1210
|
const t = this.$('[data-ry-target="trigger"]');
|
|
1211
1211
|
if (t && t.setAttribute("aria-expanded", "true"), this.#I(), this.#a)
|
|
1212
|
-
this.#
|
|
1212
|
+
this.#d(0);
|
|
1213
1213
|
else {
|
|
1214
1214
|
const e = this.getAttribute("value");
|
|
1215
1215
|
if (e) {
|
|
1216
1216
|
const i = this.$$('[data-ry-target="option"]:not([data-disabled])').findIndex((r) => r.dataset.value === e);
|
|
1217
|
-
i >= 0 && this.#
|
|
1217
|
+
i >= 0 && this.#d(i);
|
|
1218
1218
|
} else
|
|
1219
|
-
this.#
|
|
1219
|
+
this.#d(0);
|
|
1220
1220
|
}
|
|
1221
1221
|
this.emit("open");
|
|
1222
1222
|
}
|
|
@@ -1272,7 +1272,7 @@ class it extends u {
|
|
|
1272
1272
|
setup() {
|
|
1273
1273
|
this.#t = `ry-combobox-${++st}`, this.#s();
|
|
1274
1274
|
const t = this.$('[data-ry-target="input"]');
|
|
1275
|
-
t && (this.on(t, "input", this.#r), this.on(t, "focus", this.#
|
|
1275
|
+
t && (this.on(t, "input", this.#r), this.on(t, "focus", this.#n)), this.on(this, "click", this.#o), this.on(this, "keydown", this.#l), this.on(this, "mouseover", this.#h), this.on(document, "click", this.#c), this.hasAttribute("data-ry-state") || (this.state = "closed");
|
|
1276
1276
|
const e = this.getAttribute("value");
|
|
1277
1277
|
e && (this.value = e);
|
|
1278
1278
|
}
|
|
@@ -1348,7 +1348,7 @@ class it extends u {
|
|
|
1348
1348
|
if (this.hasAttribute("disabled")) return;
|
|
1349
1349
|
const e = t.target, s = e.closest('[data-ry-target="option"]');
|
|
1350
1350
|
if (s instanceof HTMLElement && !s.hasAttribute("data-disabled")) {
|
|
1351
|
-
this.#
|
|
1351
|
+
this.#p(s);
|
|
1352
1352
|
return;
|
|
1353
1353
|
}
|
|
1354
1354
|
if (e.closest('[data-ry-target="arrow"]')) {
|
|
@@ -1361,10 +1361,10 @@ class it extends u {
|
|
|
1361
1361
|
const e = this.state === "open";
|
|
1362
1362
|
switch (t.key) {
|
|
1363
1363
|
case "ArrowDown":
|
|
1364
|
-
t.preventDefault(), e ? this.#
|
|
1364
|
+
t.preventDefault(), e ? this.#m() : this.open();
|
|
1365
1365
|
break;
|
|
1366
1366
|
case "ArrowUp":
|
|
1367
|
-
t.preventDefault(), e && this.#
|
|
1367
|
+
t.preventDefault(), e && this.#f();
|
|
1368
1368
|
break;
|
|
1369
1369
|
case "Enter":
|
|
1370
1370
|
if (e && this.#e >= 0) {
|
|
@@ -1372,7 +1372,7 @@ class it extends u {
|
|
|
1372
1372
|
const i = this.$$(
|
|
1373
1373
|
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1374
1374
|
)[this.#e];
|
|
1375
|
-
i && this.#
|
|
1375
|
+
i && this.#p(i);
|
|
1376
1376
|
}
|
|
1377
1377
|
break;
|
|
1378
1378
|
case "Escape":
|
|
@@ -1384,15 +1384,23 @@ class it extends u {
|
|
|
1384
1384
|
}
|
|
1385
1385
|
};
|
|
1386
1386
|
#h = (t) => {
|
|
1387
|
+
const s = t.target.closest('[data-ry-target="option"]');
|
|
1388
|
+
if (!(s instanceof HTMLElement) || s.hasAttribute("data-disabled") || s.hasAttribute("hidden")) return;
|
|
1389
|
+
const r = this.$$(
|
|
1390
|
+
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1391
|
+
).indexOf(s);
|
|
1392
|
+
r >= 0 && this.#d(r);
|
|
1393
|
+
};
|
|
1394
|
+
#c = (t) => {
|
|
1387
1395
|
const e = t.target;
|
|
1388
1396
|
!this.contains(e) && this.state === "open" && this.close();
|
|
1389
1397
|
};
|
|
1390
|
-
#
|
|
1398
|
+
#n = () => {
|
|
1391
1399
|
if (this.hasAttribute("disabled")) return;
|
|
1392
1400
|
const t = this.$('[data-ry-target="input"]');
|
|
1393
1401
|
t && t.value && t.select(), this.open();
|
|
1394
1402
|
};
|
|
1395
|
-
#
|
|
1403
|
+
#p(t) {
|
|
1396
1404
|
const e = t.dataset.value ?? "", s = t.textContent?.trim() ?? "", i = this.$('[data-ry-target="input"]');
|
|
1397
1405
|
i && (i.value = s);
|
|
1398
1406
|
const r = this.$('[data-ry-target="native"]');
|
|
@@ -1400,7 +1408,7 @@ class it extends u {
|
|
|
1400
1408
|
a.removeAttribute("aria-selected");
|
|
1401
1409
|
}), t.setAttribute("aria-selected", "true"), this.close(), this.emit("change", { value: e, label: s });
|
|
1402
1410
|
}
|
|
1403
|
-
#
|
|
1411
|
+
#d(t) {
|
|
1404
1412
|
const e = this.$$(
|
|
1405
1413
|
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1406
1414
|
);
|
|
@@ -1414,15 +1422,15 @@ class it extends u {
|
|
|
1414
1422
|
const i = this.$('[data-ry-target="input-wrapper"]');
|
|
1415
1423
|
i && i.setAttribute("aria-activedescendant", s.id);
|
|
1416
1424
|
}
|
|
1417
|
-
#
|
|
1425
|
+
#m() {
|
|
1418
1426
|
const t = this.$$('[data-ry-target="option"]:not([hidden]):not([data-disabled])'), e = Math.min(this.#e + 1, t.length - 1);
|
|
1419
|
-
this.#
|
|
1427
|
+
this.#d(e);
|
|
1420
1428
|
}
|
|
1421
|
-
#
|
|
1429
|
+
#f() {
|
|
1422
1430
|
const t = Math.max(this.#e - 1, 0);
|
|
1423
|
-
this.#
|
|
1431
|
+
this.#d(t);
|
|
1424
1432
|
}
|
|
1425
|
-
#
|
|
1433
|
+
#w() {
|
|
1426
1434
|
const t = this.$('[data-ry-target="dropdown"]');
|
|
1427
1435
|
if (!t) return;
|
|
1428
1436
|
this.removeAttribute("data-ry-position");
|
|
@@ -1437,13 +1445,13 @@ class it extends u {
|
|
|
1437
1445
|
i.hasAttribute("data-disabled") || i.removeAttribute("hidden");
|
|
1438
1446
|
});
|
|
1439
1447
|
const e = this.$('[data-ry-target="empty"]');
|
|
1440
|
-
e && e.setAttribute("hidden", ""), this.#
|
|
1448
|
+
e && e.setAttribute("hidden", ""), this.#w();
|
|
1441
1449
|
const s = this.getAttribute("value");
|
|
1442
1450
|
if (s) {
|
|
1443
1451
|
const r = this.$$(
|
|
1444
1452
|
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1445
1453
|
).findIndex((a) => a.dataset.value === s);
|
|
1446
|
-
r >= 0 && this.#
|
|
1454
|
+
r >= 0 && this.#d(r);
|
|
1447
1455
|
}
|
|
1448
1456
|
this.emit("open");
|
|
1449
1457
|
}
|
|
@@ -1463,7 +1471,7 @@ class it extends u {
|
|
|
1463
1471
|
}
|
|
1464
1472
|
set value(t) {
|
|
1465
1473
|
const e = this.$(`[data-ry-target="option"][data-value="${t}"]`);
|
|
1466
|
-
e && this.#
|
|
1474
|
+
e && this.#p(e);
|
|
1467
1475
|
}
|
|
1468
1476
|
}
|
|
1469
1477
|
customElements.define("ry-combobox", it);
|
|
@@ -2007,7 +2015,7 @@ class dt extends u {
|
|
|
2007
2015
|
this.#i && this.on(this.#i, "pointerdown", this.#c);
|
|
2008
2016
|
for (const [t, e] of this.#r)
|
|
2009
2017
|
this.on(e, "pointerdown", (s) => this.#n(s, t)), this.on(e, "keydown", (s) => this.#m(s, t));
|
|
2010
|
-
this.on(document, "pointermove", this.#
|
|
2018
|
+
this.on(document, "pointermove", this.#p), this.on(document, "pointerup", this.#d);
|
|
2011
2019
|
}
|
|
2012
2020
|
#c = (t) => {
|
|
2013
2021
|
if (this.disabled) return;
|
|
@@ -2022,12 +2030,12 @@ class dt extends u {
|
|
|
2022
2030
|
#n = (t, e) => {
|
|
2023
2031
|
this.disabled || (t.stopPropagation(), this.#t = !0, this.#e = e, t.target.setPointerCapture(t.pointerId));
|
|
2024
2032
|
};
|
|
2025
|
-
#
|
|
2033
|
+
#p = (t) => {
|
|
2026
2034
|
if (!this.#t || !this.#e) return;
|
|
2027
2035
|
const e = this.#w(t);
|
|
2028
2036
|
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();
|
|
2029
2037
|
};
|
|
2030
|
-
#
|
|
2038
|
+
#d = () => {
|
|
2031
2039
|
this.#t && (this.#t = !1, this.#e = null, this.#M());
|
|
2032
2040
|
};
|
|
2033
2041
|
#m = (t, e) => {
|
|
@@ -2059,7 +2067,7 @@ class dt extends u {
|
|
|
2059
2067
|
return;
|
|
2060
2068
|
}
|
|
2061
2069
|
t.preventDefault();
|
|
2062
|
-
const a = this.#
|
|
2070
|
+
const a = this.#u(this.#f(e) + r);
|
|
2063
2071
|
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();
|
|
2064
2072
|
};
|
|
2065
2073
|
#f(t) {
|
|
@@ -2075,11 +2083,11 @@ class dt extends u {
|
|
|
2075
2083
|
}
|
|
2076
2084
|
#g(t) {
|
|
2077
2085
|
const e = this.step;
|
|
2078
|
-
if (e === 0) return this.#
|
|
2086
|
+
if (e === 0) return this.#u(t);
|
|
2079
2087
|
const s = Math.round((t - this.min) / e) * e + this.min;
|
|
2080
|
-
return this.#
|
|
2088
|
+
return this.#u(s);
|
|
2081
2089
|
}
|
|
2082
|
-
#
|
|
2090
|
+
#u(t) {
|
|
2083
2091
|
return Math.max(this.min, Math.min(this.max, t));
|
|
2084
2092
|
}
|
|
2085
2093
|
#b() {
|
|
@@ -2135,19 +2143,19 @@ class dt extends u {
|
|
|
2135
2143
|
return parseFloat(this.getAttribute("value") ?? String(this.min));
|
|
2136
2144
|
}
|
|
2137
2145
|
set value(t) {
|
|
2138
|
-
this.setAttribute("value", String(this.#
|
|
2146
|
+
this.setAttribute("value", String(this.#u(t)));
|
|
2139
2147
|
}
|
|
2140
2148
|
get start() {
|
|
2141
2149
|
return parseFloat(this.getAttribute("start") ?? String(this.min));
|
|
2142
2150
|
}
|
|
2143
2151
|
set start(t) {
|
|
2144
|
-
this.setAttribute("start", String(this.#
|
|
2152
|
+
this.setAttribute("start", String(this.#u(t)));
|
|
2145
2153
|
}
|
|
2146
2154
|
get end() {
|
|
2147
2155
|
return parseFloat(this.getAttribute("end") ?? String(this.max));
|
|
2148
2156
|
}
|
|
2149
2157
|
set end(t) {
|
|
2150
|
-
this.setAttribute("end", String(this.#
|
|
2158
|
+
this.setAttribute("end", String(this.#u(t)));
|
|
2151
2159
|
}
|
|
2152
2160
|
get disabled() {
|
|
2153
2161
|
return this.hasAttribute("disabled");
|
|
@@ -2166,7 +2174,7 @@ class ut extends u {
|
|
|
2166
2174
|
#a = null;
|
|
2167
2175
|
static observedAttributes = ["min", "max", "step", "value", "disabled", "label", "labels", "description"];
|
|
2168
2176
|
setup() {
|
|
2169
|
-
this.#o(), this.#l(), this.#
|
|
2177
|
+
this.#o(), this.#l(), this.#u();
|
|
2170
2178
|
}
|
|
2171
2179
|
#o() {
|
|
2172
2180
|
const t = this.getAttribute("label"), e = this.getAttribute("description"), s = e ? ` title="${e}"` : "";
|
|
@@ -2181,7 +2189,7 @@ class ut extends u {
|
|
|
2181
2189
|
`, this.#s = this.$('[data-ry-target="ring"]'), this.#r = this.$('[data-ry-target="indicator"]'), this.#a = this.$('[data-ry-target="display"]');
|
|
2182
2190
|
}
|
|
2183
2191
|
#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.#
|
|
2192
|
+
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.#p), this.on(document, "touchmove", this.#d), this.on(document, "touchend", this.#m), this.on(this.#s, "wheel", this.#f), this.on(this, "keydown", this.#w));
|
|
2185
2193
|
}
|
|
2186
2194
|
#h = (t) => {
|
|
2187
2195
|
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", ""));
|
|
@@ -2194,10 +2202,10 @@ class ut extends u {
|
|
|
2194
2202
|
#n = () => {
|
|
2195
2203
|
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#y());
|
|
2196
2204
|
};
|
|
2197
|
-
#
|
|
2205
|
+
#p = (t) => {
|
|
2198
2206
|
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", ""));
|
|
2199
2207
|
};
|
|
2200
|
-
#
|
|
2208
|
+
#d = (t) => {
|
|
2201
2209
|
if (!this.#t) return;
|
|
2202
2210
|
t.preventDefault();
|
|
2203
2211
|
const e = t.touches[0];
|
|
@@ -2247,9 +2255,9 @@ class ut extends u {
|
|
|
2247
2255
|
#g(t) {
|
|
2248
2256
|
let e = Math.max(this.min, Math.min(this.max, t));
|
|
2249
2257
|
const s = this.step;
|
|
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.#
|
|
2258
|
+
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.#u(), this.#v();
|
|
2251
2259
|
}
|
|
2252
|
-
#
|
|
2260
|
+
#u() {
|
|
2253
2261
|
const t = (this.value - this.min) / (this.max - this.min), e = -135 + t * 270;
|
|
2254
2262
|
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));
|
|
2255
2263
|
}
|
|
@@ -2270,7 +2278,7 @@ class ut extends u {
|
|
|
2270
2278
|
this.emit("change", { value: this.value, percent: t });
|
|
2271
2279
|
}
|
|
2272
2280
|
attributeChangedCallback(t, e, s) {
|
|
2273
|
-
e !== s && t === "value" && this.#s && this.#
|
|
2281
|
+
e !== s && t === "value" && this.#s && this.#u();
|
|
2274
2282
|
}
|
|
2275
2283
|
// --- Public API ---
|
|
2276
2284
|
get min() {
|
|
@@ -2318,12 +2326,12 @@ class pt extends u {
|
|
|
2318
2326
|
#h = 0;
|
|
2319
2327
|
#c = !1;
|
|
2320
2328
|
#n = null;
|
|
2321
|
-
#
|
|
2329
|
+
#p = null;
|
|
2322
2330
|
static observedAttributes = ["min", "max", "step", "value", "disabled", "arrows", "icons", "drag", "editable", "wrap", "label", "prefix", "suffix"];
|
|
2323
2331
|
setup() {
|
|
2324
|
-
this.#
|
|
2332
|
+
this.#d(), this.#f(), this.#w(), this.#A();
|
|
2325
2333
|
}
|
|
2326
|
-
#
|
|
2334
|
+
#d() {
|
|
2327
2335
|
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 = `
|
|
2328
2336
|
<div data-ry-target="display" class="ry-number-select__display" tabindex="0" role="spinbutton"
|
|
2329
2337
|
aria-valuenow="${this.value}" aria-valuemin="${this.min}" aria-valuemax="${this.max}"
|
|
@@ -2354,9 +2362,9 @@ class pt extends u {
|
|
|
2354
2362
|
#w() {
|
|
2355
2363
|
this.#s && (this.on(this.#s, "mousedown", (t) => {
|
|
2356
2364
|
t.preventDefault(), this.#g(-1);
|
|
2357
|
-
}), this.on(this.#s, "mouseup", () => this.#
|
|
2365
|
+
}), this.on(this.#s, "mouseup", () => this.#u()), this.on(this.#s, "mouseleave", () => this.#u())), this.#r && (this.on(this.#r, "mousedown", (t) => {
|
|
2358
2366
|
t.preventDefault(), this.#g(1);
|
|
2359
|
-
}), this.on(this.#r, "mouseup", () => this.#
|
|
2367
|
+
}), this.on(this.#r, "mouseup", () => this.#u()), this.on(this.#r, "mouseleave", () => this.#u())), 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) => {
|
|
2360
2368
|
t.key === "Enter" && (t.preventDefault(), this.#z()), t.key === "Escape" && (t.preventDefault(), this.#P()), t.stopPropagation();
|
|
2361
2369
|
}));
|
|
2362
2370
|
}
|
|
@@ -2367,13 +2375,13 @@ class pt extends u {
|
|
|
2367
2375
|
this.#R(t * e), this.#_(), this.#n = setTimeout(() => {
|
|
2368
2376
|
let s = 150;
|
|
2369
2377
|
const i = () => {
|
|
2370
|
-
this.#R(t * e), this.#x(), s = Math.max(40, s * 0.85), this.#
|
|
2378
|
+
this.#R(t * e), this.#x(), s = Math.max(40, s * 0.85), this.#p = setTimeout(i, s);
|
|
2371
2379
|
};
|
|
2372
2380
|
i();
|
|
2373
2381
|
}, 400);
|
|
2374
2382
|
}
|
|
2375
|
-
#
|
|
2376
|
-
this.#n && (clearTimeout(this.#n), this.#n = null), this.#
|
|
2383
|
+
#u() {
|
|
2384
|
+
this.#n && (clearTimeout(this.#n), this.#n = null), this.#p && (clearTimeout(this.#p), this.#p = null);
|
|
2377
2385
|
}
|
|
2378
2386
|
// --- Drag helpers ---
|
|
2379
2387
|
get #b() {
|
|
@@ -2563,7 +2571,7 @@ class pt extends u {
|
|
|
2563
2571
|
e !== s && t === "value" && this.#t && this.#A();
|
|
2564
2572
|
}
|
|
2565
2573
|
teardown() {
|
|
2566
|
-
this.#
|
|
2574
|
+
this.#u();
|
|
2567
2575
|
}
|
|
2568
2576
|
}
|
|
2569
2577
|
customElements.define("ry-number-select", pt);
|
|
@@ -2702,17 +2710,17 @@ class bt extends u {
|
|
|
2702
2710
|
#h = null;
|
|
2703
2711
|
#c = null;
|
|
2704
2712
|
#n = null;
|
|
2705
|
-
#u = null;
|
|
2706
2713
|
#p = null;
|
|
2714
|
+
#d = null;
|
|
2707
2715
|
#m = null;
|
|
2708
2716
|
#f = null;
|
|
2709
2717
|
#w = null;
|
|
2710
2718
|
#g = null;
|
|
2711
2719
|
static observedAttributes = ["value", "format", "opacity", "disabled", "swatches", "inline"];
|
|
2712
2720
|
setup() {
|
|
2713
|
-
this.#
|
|
2721
|
+
this.#u(), this.#b(), this.#v(), this.#A();
|
|
2714
2722
|
}
|
|
2715
|
-
#
|
|
2723
|
+
#u() {
|
|
2716
2724
|
const t = this.hasAttribute("inline"), e = this.hasAttribute("opacity"), s = this.getAttribute("swatches");
|
|
2717
2725
|
let i = `
|
|
2718
2726
|
<div data-ry-target="grid" class="ry-color-picker__grid">
|
|
@@ -2752,10 +2760,10 @@ class bt extends u {
|
|
|
2752
2760
|
<span data-ry-target="trigger-color" class="ry-color-picker__trigger-color"></span>
|
|
2753
2761
|
</button>
|
|
2754
2762
|
<div data-ry-target="panel" class="ry-color-picker__panel">${i}</div>
|
|
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.#
|
|
2763
|
+
`, 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.#p = this.$('[data-ry-target="hue-slider"]'), this.#d = 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"]');
|
|
2756
2764
|
}
|
|
2757
2765
|
#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.#
|
|
2766
|
+
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.#p && this.on(this.#p, "pointerdown", this.#G), this.#d && this.on(this.#d, "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));
|
|
2759
2767
|
const t = this.$('[data-ry-target="format-toggle"]');
|
|
2760
2768
|
t && this.on(t, "click", this.#F);
|
|
2761
2769
|
const e = this.$('[data-ry-target="swatches"]');
|
|
@@ -2826,11 +2834,11 @@ class bt extends u {
|
|
|
2826
2834
|
// Hue handlers
|
|
2827
2835
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2828
2836
|
#G = (t) => {
|
|
2829
|
-
this.disabled || (t.preventDefault(), this.#a = !0, this.#
|
|
2837
|
+
this.disabled || (t.preventDefault(), this.#a = !0, this.#d?.focus(), this.#K(t));
|
|
2830
2838
|
};
|
|
2831
2839
|
#K(t) {
|
|
2832
|
-
if (!this.#
|
|
2833
|
-
const e = this.#
|
|
2840
|
+
if (!this.#p) return;
|
|
2841
|
+
const e = this.#p.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
|
|
2834
2842
|
this.#t = Math.round(s * 360), this.#A(), this.#L();
|
|
2835
2843
|
}
|
|
2836
2844
|
#q = (t) => {
|
|
@@ -2939,7 +2947,7 @@ class bt extends u {
|
|
|
2939
2947
|
this.#n && (this.#n.style.left = `${this.#e}%`, this.#n.style.top = `${100 - this.#i}%`);
|
|
2940
2948
|
}
|
|
2941
2949
|
#_() {
|
|
2942
|
-
this.#
|
|
2950
|
+
this.#d && (this.#d.style.left = `${this.#t / 360 * 100}%`);
|
|
2943
2951
|
}
|
|
2944
2952
|
#H() {
|
|
2945
2953
|
if (this.#m) {
|
|
@@ -3091,7 +3099,7 @@ class yt extends u {
|
|
|
3091
3099
|
`, 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"]');
|
|
3092
3100
|
}
|
|
3093
3101
|
#a() {
|
|
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.#
|
|
3102
|
+
this.#t && this.on(this.#t, "click", this.#o), this.#e && (this.on(this.#e, "input", this.#h), this.on(this.#e, "keydown", this.#p), this.on(this.#e, "focus", this.#l)), this.#s && (this.on(this.#s, "ry:input", this.#d), this.on(this.#s, "ry:change", this.#m)), this.on(document, "click", this.#f), this.on(document, "keydown", this.#w);
|
|
3095
3103
|
}
|
|
3096
3104
|
#o = () => {
|
|
3097
3105
|
this.disabled || (this.state === "open" ? this.close() : this.open());
|
|
@@ -3109,7 +3117,7 @@ class yt extends u {
|
|
|
3109
3117
|
this.#e.setSelectionRange(n, n);
|
|
3110
3118
|
}
|
|
3111
3119
|
const a = this.#c(r);
|
|
3112
|
-
a && (this.#s.setColor(a), this.#
|
|
3120
|
+
a && (this.#s.setColor(a), this.#u(), this.#n(r) && this.#v(), this.emit("input", { value: this.value }));
|
|
3113
3121
|
};
|
|
3114
3122
|
#c(t) {
|
|
3115
3123
|
let e = t;
|
|
@@ -3128,11 +3136,11 @@ class yt extends u {
|
|
|
3128
3136
|
#n(t) {
|
|
3129
3137
|
return !!(/^#[a-fA-F0-9]{6}$/.test(t) || /^#[a-fA-F0-9]{3}$/.test(t));
|
|
3130
3138
|
}
|
|
3131
|
-
#
|
|
3139
|
+
#p = (t) => {
|
|
3132
3140
|
t.key === "Enter" && (t.preventDefault(), this.#h(), this.emit("change", { value: this.value }));
|
|
3133
3141
|
};
|
|
3134
|
-
#
|
|
3135
|
-
!this.#s || !this.#e || (document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#
|
|
3142
|
+
#d = () => {
|
|
3143
|
+
!this.#s || !this.#e || (document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#u(), this.#v(), this.emit("input", { value: this.value }));
|
|
3136
3144
|
};
|
|
3137
3145
|
#m = () => {
|
|
3138
3146
|
this.emit("change", { value: this.value });
|
|
@@ -3154,7 +3162,7 @@ class yt extends u {
|
|
|
3154
3162
|
const t = this.getBoundingClientRect(), e = 280, i = window.innerHeight - t.bottom, r = t.top;
|
|
3155
3163
|
i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
|
|
3156
3164
|
}
|
|
3157
|
-
#
|
|
3165
|
+
#u() {
|
|
3158
3166
|
const t = this.$('[data-ry-target="swatch-color"]');
|
|
3159
3167
|
if (t && this.#s) {
|
|
3160
3168
|
const e = this.#s.rgb, s = this.hasAttribute("opacity") ? this.#s.alpha / 100 : 1;
|
|
@@ -3168,7 +3176,7 @@ class yt extends u {
|
|
|
3168
3176
|
const e = this.#s.value;
|
|
3169
3177
|
this.#e.value = e.startsWith("#") ? e : "#" + e;
|
|
3170
3178
|
}
|
|
3171
|
-
this.#
|
|
3179
|
+
this.#u();
|
|
3172
3180
|
}
|
|
3173
3181
|
}
|
|
3174
3182
|
#v() {
|
|
@@ -3178,14 +3186,14 @@ class yt extends u {
|
|
|
3178
3186
|
}
|
|
3179
3187
|
}
|
|
3180
3188
|
attributeChangedCallback(t, e, s) {
|
|
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.#
|
|
3189
|
+
e !== s && (t === "value" && this.#s && this.#e && s && (this.#s.setColor(s), document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#u()), t === "disabled" && this.#e && (s !== null ? this.#e.setAttribute("disabled", "") : this.#e.removeAttribute("disabled")));
|
|
3182
3190
|
}
|
|
3183
3191
|
// Public API
|
|
3184
3192
|
get value() {
|
|
3185
3193
|
return this.#s?.value ?? this.getAttribute("value") ?? "#000000";
|
|
3186
3194
|
}
|
|
3187
3195
|
set value(t) {
|
|
3188
|
-
this.#s?.setColor(t) && (this.#e && (this.#e.value = this.#s.value), this.#
|
|
3196
|
+
this.#s?.setColor(t) && (this.#e && (this.#e.value = this.#s.value), this.#u(), this.#v());
|
|
3189
3197
|
}
|
|
3190
3198
|
get disabled() {
|
|
3191
3199
|
return this.hasAttribute("disabled");
|
|
@@ -3261,8 +3269,8 @@ class wt extends u {
|
|
|
3261
3269
|
#c = !1;
|
|
3262
3270
|
// Cached DOM refs
|
|
3263
3271
|
#n = null;
|
|
3264
|
-
#u = null;
|
|
3265
3272
|
#p = null;
|
|
3273
|
+
#d = null;
|
|
3266
3274
|
static observedAttributes = ["value", "disabled", "output"];
|
|
3267
3275
|
setup() {
|
|
3268
3276
|
this.#m(), this.#Y(), this.#X(), this.#x();
|
|
@@ -3277,7 +3285,7 @@ class wt extends u {
|
|
|
3277
3285
|
#f(t) {
|
|
3278
3286
|
const e = t.trim();
|
|
3279
3287
|
if (!e.startsWith("linear-gradient(") && !e.startsWith("radial-gradient("))
|
|
3280
|
-
return x(e) ? (this.#t = "solid", this.#s = [this.#
|
|
3288
|
+
return x(e) ? (this.#t = "solid", this.#s = [this.#u(e, 0), this.#u(e, 100)], this.#r = this.#s[0].id, !0) : !1;
|
|
3281
3289
|
let s, i;
|
|
3282
3290
|
e.startsWith("linear-gradient(") ? (s = "linear", i = e.slice(16, -1)) : (s = "radial", i = e.slice(16, -1));
|
|
3283
3291
|
let r = 90, a = "circle", n = i;
|
|
@@ -3299,7 +3307,7 @@ class wt extends u {
|
|
|
3299
3307
|
const o = [], l = /(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\)|hsla?\([^)]+\)|[a-z]+)\s+([\d.]+)%/g;
|
|
3300
3308
|
let c;
|
|
3301
3309
|
for (; (c = l.exec(n)) !== null; )
|
|
3302
|
-
o.push(this.#
|
|
3310
|
+
o.push(this.#u(c[1], parseFloat(c[2])));
|
|
3303
3311
|
return o.length < 2 ? !1 : (this.#t = s, this.#e = r, this.#i = a, this.#s = o, this.#r = o[0].id, !0);
|
|
3304
3312
|
}
|
|
3305
3313
|
#w(t) {
|
|
@@ -3323,7 +3331,7 @@ class wt extends u {
|
|
|
3323
3331
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3324
3332
|
// Stop management
|
|
3325
3333
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3326
|
-
#
|
|
3334
|
+
#u(t, e) {
|
|
3327
3335
|
return { id: `stop-${this.#a++}`, color: t, position: e };
|
|
3328
3336
|
}
|
|
3329
3337
|
/** CSS left value clamped so the stop handle stays within the bar */
|
|
@@ -3332,7 +3340,7 @@ class wt extends u {
|
|
|
3332
3340
|
return `clamp(${e}, ${t}%, calc(100% - ${e}))`;
|
|
3333
3341
|
}
|
|
3334
3342
|
#v(t, e) {
|
|
3335
|
-
const s = this.#
|
|
3343
|
+
const s = this.#u(t, e);
|
|
3336
3344
|
this.#s.push(s), this.#$(), this.#r = s.id, this.#C(), this.#x();
|
|
3337
3345
|
}
|
|
3338
3346
|
#y(t) {
|
|
@@ -3379,7 +3387,7 @@ class wt extends u {
|
|
|
3379
3387
|
</div>
|
|
3380
3388
|
<ry-color-picker data-ry-target="picker" inline opacity></ry-color-picker>
|
|
3381
3389
|
${o}
|
|
3382
|
-
`, this.#n = this.$('[data-ry-target="bar"]'), this.#
|
|
3390
|
+
`, this.#n = this.$('[data-ry-target="bar"]'), this.#p = this.$('[data-ry-target="picker"]'), this.#d = this.$('[data-ry-target="output"]'), this.#C();
|
|
3383
3391
|
}
|
|
3384
3392
|
#C() {
|
|
3385
3393
|
if (this.#n) {
|
|
@@ -3400,7 +3408,7 @@ class wt extends u {
|
|
|
3400
3408
|
const i = this.$('[data-ry-target="angle-select"]');
|
|
3401
3409
|
i && this.on(i, "ry:input", this.#z);
|
|
3402
3410
|
const r = this.$('[data-ry-target="shape-circle"]'), a = this.$('[data-ry-target="shape-ellipse"]');
|
|
3403
|
-
r && this.on(r, "click", () => this.#P("circle")), a && this.on(a, "click", () => this.#P("ellipse")), this.#
|
|
3411
|
+
r && this.on(r, "click", () => this.#P("circle")), a && this.on(a, "click", () => this.#P("ellipse")), this.#p && (this.on(this.#p, "ry:input", this.#R), this.on(this.#p, "ry:change", this.#T)), this.#d && (this.on(this.#d, "keydown", this.#F), this.on(this.#d, "blur", this.#j));
|
|
3404
3412
|
const n = this.$('[data-ry-target="copy-btn"]');
|
|
3405
3413
|
n && this.on(n, "click", this.#V), this.#n && this.on(this.#n, "keydown", this.#J);
|
|
3406
3414
|
}
|
|
@@ -3476,7 +3484,7 @@ class wt extends u {
|
|
|
3476
3484
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3477
3485
|
#R = () => {
|
|
3478
3486
|
const t = this.#I();
|
|
3479
|
-
!t || !this.#
|
|
3487
|
+
!t || !this.#p || (t.color = this.#p.value, this.#Z(t), this.#O(), this.#H(), this.#k(), this.#D());
|
|
3480
3488
|
};
|
|
3481
3489
|
#T = () => {
|
|
3482
3490
|
this.#S(), this.#B();
|
|
@@ -3501,8 +3509,8 @@ class wt extends u {
|
|
|
3501
3509
|
this.#A();
|
|
3502
3510
|
};
|
|
3503
3511
|
#A() {
|
|
3504
|
-
if (!this.#
|
|
3505
|
-
const t = this.#
|
|
3512
|
+
if (!this.#d) return;
|
|
3513
|
+
const t = this.#d.value.trim();
|
|
3506
3514
|
t && this.#f(t) ? (this.#C(), this.#x(), this.#S(), this.#D(), this.#B()) : this.#k();
|
|
3507
3515
|
}
|
|
3508
3516
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -3540,8 +3548,8 @@ class wt extends u {
|
|
|
3540
3548
|
a && a.setAttribute("value", String(this.#e));
|
|
3541
3549
|
}
|
|
3542
3550
|
#H() {
|
|
3543
|
-
if (!this.#
|
|
3544
|
-
const t = this.#
|
|
3551
|
+
if (!this.#p) return;
|
|
3552
|
+
const t = this.#p.querySelector('[data-ry-target="preview-color"]');
|
|
3545
3553
|
t && (t.style.backgroundImage = this.#t === "solid" ? "" : this.#g());
|
|
3546
3554
|
}
|
|
3547
3555
|
#O() {
|
|
@@ -3569,10 +3577,10 @@ class wt extends u {
|
|
|
3569
3577
|
}
|
|
3570
3578
|
#L() {
|
|
3571
3579
|
const t = this.#I();
|
|
3572
|
-
!t || !this.#
|
|
3580
|
+
!t || !this.#p || this.#p.setColor(t.color);
|
|
3573
3581
|
}
|
|
3574
3582
|
#k() {
|
|
3575
|
-
this.#
|
|
3583
|
+
this.#d && document.activeElement !== this.#d && (this.#d.value = this.#g());
|
|
3576
3584
|
}
|
|
3577
3585
|
#S() {
|
|
3578
3586
|
const t = this.#g();
|
|
@@ -3735,9 +3743,9 @@ class w extends u {
|
|
|
3735
3743
|
#n(t) {
|
|
3736
3744
|
return Array.from(t.children).filter(
|
|
3737
3745
|
(s) => s instanceof HTMLElement && s.classList.contains("ry-tree__item")
|
|
3738
|
-
).map((s) => this.#
|
|
3746
|
+
).map((s) => this.#p(s));
|
|
3739
3747
|
}
|
|
3740
|
-
#
|
|
3748
|
+
#p(t) {
|
|
3741
3749
|
const e = t.querySelector(':scope > [data-ry-target="folder"]'), s = t.querySelector(':scope > [data-ry-target="file"]');
|
|
3742
3750
|
if (e) {
|
|
3743
3751
|
const r = t.querySelector(":scope > .ry-tree__toggle"), a = t.querySelector(".ry-tree__children"), n = { label: e.dataset.ryLabel ?? "" };
|
|
@@ -3754,14 +3762,14 @@ class w extends u {
|
|
|
3754
3762
|
static from(t) {
|
|
3755
3763
|
const e = document.createElement("ry-tree");
|
|
3756
3764
|
for (const s of t)
|
|
3757
|
-
e.appendChild(w.#
|
|
3765
|
+
e.appendChild(w.#d(s));
|
|
3758
3766
|
return e;
|
|
3759
3767
|
}
|
|
3760
|
-
static #
|
|
3768
|
+
static #d(t) {
|
|
3761
3769
|
const e = document.createElement("ry-tree-item");
|
|
3762
3770
|
if (e.setAttribute("label", t.label), t.open && e.setAttribute("open", ""), t.selected && e.setAttribute("selected", ""), t.children)
|
|
3763
3771
|
for (const s of t.children)
|
|
3764
|
-
e.appendChild(w.#
|
|
3772
|
+
e.appendChild(w.#d(s));
|
|
3765
3773
|
return e;
|
|
3766
3774
|
}
|
|
3767
3775
|
// ── Drag and Drop ──────────────────────────────────────────
|
|
@@ -3779,7 +3787,7 @@ class w extends u {
|
|
|
3779
3787
|
if (this.#t && !this.#e) {
|
|
3780
3788
|
const c = t.clientX - this.#i, d = t.clientY - this.#s;
|
|
3781
3789
|
if (Math.hypot(c, d) < $t) return;
|
|
3782
|
-
this.#t = !1, this.#e = !0, this.#
|
|
3790
|
+
this.#t = !1, this.#e = !0, this.#u(t);
|
|
3783
3791
|
}
|
|
3784
3792
|
if (!this.#e || !this.#a) return;
|
|
3785
3793
|
this.#a.style.left = `${t.clientX + 12}px`, this.#a.style.top = `${t.clientY - 14}px`, this.#a.style.display = "none";
|
|
@@ -3809,7 +3817,7 @@ class w extends u {
|
|
|
3809
3817
|
#g = () => {
|
|
3810
3818
|
this.#e && this.#b(), this.#t = !1, this.#e = !1, this.#r = null;
|
|
3811
3819
|
};
|
|
3812
|
-
#
|
|
3820
|
+
#u(t) {
|
|
3813
3821
|
if (!this.#r) return;
|
|
3814
3822
|
t.preventDefault(), this.#r.setAttribute("data-ry-dragging", ""), this.#r.classList.add("ry-tree__item--collapsed");
|
|
3815
3823
|
const e = this.#r.querySelector(".ry-tree__label, .ry-tree__file");
|
|
@@ -4037,7 +4045,7 @@ class It extends u {
|
|
|
4037
4045
|
}
|
|
4038
4046
|
this.appendChild(a);
|
|
4039
4047
|
}
|
|
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.#
|
|
4048
|
+
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.#p()), this.on(this, "mouseleave", () => this.#n())), this.goTo(0);
|
|
4041
4049
|
}
|
|
4042
4050
|
#o = (t) => {
|
|
4043
4051
|
t.key === "ArrowLeft" ? (t.preventDefault(), this.prev()) : t.key === "ArrowRight" && (t.preventDefault(), this.next());
|
|
@@ -4055,11 +4063,11 @@ class It extends u {
|
|
|
4055
4063
|
e > s ? this.prev() : e < -s && this.next();
|
|
4056
4064
|
};
|
|
4057
4065
|
#n() {
|
|
4058
|
-
if (this.#
|
|
4066
|
+
if (this.#p(), !this.hasAttribute("autoplay")) return;
|
|
4059
4067
|
const t = parseInt(this.getAttribute("interval") ?? "5000", 10);
|
|
4060
4068
|
this.#i = setInterval(() => this.next(), t);
|
|
4061
4069
|
}
|
|
4062
|
-
#
|
|
4070
|
+
#p() {
|
|
4063
4071
|
this.#i && (clearInterval(this.#i), this.#i = null);
|
|
4064
4072
|
}
|
|
4065
4073
|
goTo(t) {
|
|
@@ -4079,7 +4087,7 @@ class It extends u {
|
|
|
4079
4087
|
this.goTo(this.#t - 1);
|
|
4080
4088
|
}
|
|
4081
4089
|
teardown() {
|
|
4082
|
-
this.#
|
|
4090
|
+
this.#p();
|
|
4083
4091
|
}
|
|
4084
4092
|
}
|
|
4085
4093
|
customElements.define("ry-carousel", It);
|