@ryanhelsing/ry-ui 1.0.14 → 1.0.15
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/.claude/skills/ry-ui-builder/SKILL.md +4 -6
- package/README.md +21 -26
- package/dist/components/ry-dropdown.d.ts +1 -1
- package/dist/components/ry-heading.d.ts +1 -5
- package/dist/components/ry-heading.d.ts.map +1 -1
- package/dist/components/ry-logo-bar.d.ts +25 -0
- package/dist/components/ry-logo-bar.d.ts.map +1 -0
- package/dist/components/ry-modal.d.ts +1 -1
- package/dist/components/ry-pricing.d.ts +4 -4
- package/dist/components/ry-pricing.d.ts.map +1 -1
- package/dist/components/ry-search-list.d.ts +30 -0
- package/dist/components/ry-search-list.d.ts.map +1 -0
- package/dist/components/ry-stat.d.ts +1 -4
- package/dist/components/ry-stat.d.ts.map +1 -1
- package/dist/components/ry-testimonial.d.ts +2 -5
- package/dist/components/ry-testimonial.d.ts.map +1 -1
- package/dist/components/ry-theme-panel.d.ts.map +1 -1
- package/dist/core/ry-transform.d.ts.map +1 -1
- package/dist/css/ry-structure.css +516 -28
- package/dist/css/ry-theme.css +186 -40
- package/dist/css/ry-tokens.css +4 -4
- package/dist/css/ry-ui.css +706 -72
- package/dist/pages/components.html +19 -82
- package/dist/pages/landing.html +13 -40
- package/dist/ry-ui.d.ts +2 -1
- package/dist/ry-ui.d.ts.map +1 -1
- package/dist/ry-ui.js +936 -667
- package/dist/ry-ui.js.map +1 -1
- package/docs/components/dropdown.md +2 -2
- package/docs/components/modal.md +2 -2
- package/package.json +1 -1
- package/docs/components/button-group.md +0 -36
package/dist/ry-ui.js
CHANGED
|
@@ -89,7 +89,7 @@ class u extends HTMLElement {
|
|
|
89
89
|
this.on(t, "keydown", a), i?.focus();
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
const
|
|
92
|
+
const P = [
|
|
93
93
|
// Layout
|
|
94
94
|
"page",
|
|
95
95
|
"header",
|
|
@@ -119,7 +119,6 @@ const B = [
|
|
|
119
119
|
"alert",
|
|
120
120
|
"card",
|
|
121
121
|
"button",
|
|
122
|
-
"button-group",
|
|
123
122
|
"badge",
|
|
124
123
|
"field",
|
|
125
124
|
"switch",
|
|
@@ -151,25 +150,29 @@ const B = [
|
|
|
151
150
|
"combobox",
|
|
152
151
|
"theme-panel",
|
|
153
152
|
"testimonial",
|
|
154
|
-
"heading"
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
"heading",
|
|
154
|
+
"search-list",
|
|
155
|
+
"search-item",
|
|
156
|
+
"search-group",
|
|
157
|
+
"logo-bar"
|
|
158
|
+
], F = new RegExp(
|
|
159
|
+
`<(/?)(${P.join("|")})(\\s|>|/)`,
|
|
157
160
|
"g"
|
|
158
161
|
);
|
|
159
|
-
function
|
|
160
|
-
return h.replace(
|
|
162
|
+
function C(h) {
|
|
163
|
+
return h.replace(F, "<$1ry-$2$3");
|
|
161
164
|
}
|
|
162
|
-
function
|
|
165
|
+
function T() {
|
|
163
166
|
document.querySelectorAll("ry").forEach((h) => {
|
|
164
|
-
const t =
|
|
167
|
+
const t = C(h.innerHTML), e = document.createElement("template");
|
|
165
168
|
e.innerHTML = t, h.replaceWith(e.content);
|
|
166
169
|
}), document.querySelectorAll("template[ry]").forEach((h) => {
|
|
167
|
-
const t =
|
|
170
|
+
const t = C(h.innerHTML), e = document.createElement("template");
|
|
168
171
|
e.innerHTML = t, h.replaceWith(e.content);
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
172
|
-
class
|
|
174
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", T) : T();
|
|
175
|
+
class O extends u {
|
|
173
176
|
setup() {
|
|
174
177
|
this.#t(), this.$$('[data-ry-target="trigger"]').forEach((t) => {
|
|
175
178
|
this.on(t, "click", this.#i);
|
|
@@ -245,10 +248,10 @@ class P extends u {
|
|
|
245
248
|
this.$$('[data-ry-target="item"]').forEach((t) => this.close(t));
|
|
246
249
|
}
|
|
247
250
|
}
|
|
248
|
-
customElements.define("ry-accordion",
|
|
251
|
+
customElements.define("ry-accordion", O);
|
|
249
252
|
customElements.get("ry-accordion-item") || customElements.define("ry-accordion-item", class extends HTMLElement {
|
|
250
253
|
});
|
|
251
|
-
class
|
|
254
|
+
class j extends u {
|
|
252
255
|
#t = null;
|
|
253
256
|
#e = 0;
|
|
254
257
|
setup() {
|
|
@@ -266,7 +269,7 @@ class F extends u {
|
|
|
266
269
|
}
|
|
267
270
|
#i() {
|
|
268
271
|
if (this.$('[data-ry-target="dialog"]')) return;
|
|
269
|
-
const t = this.getAttribute("title") ?? "", s = this.$(
|
|
272
|
+
const t = this.getAttribute("title") ?? "", s = this.$("footer")?.innerHTML ?? "", i = Array.from(this.childNodes).filter((r) => !(r instanceof HTMLElement && r.tagName === "FOOTER")).map((r) => r instanceof Element ? r.outerHTML : r.textContent).join("");
|
|
270
273
|
this.innerHTML = `
|
|
271
274
|
<div data-ry-target="backdrop" class="ry-modal__backdrop"></div>
|
|
272
275
|
<div data-ry-target="dialog" class="ry-modal__dialog" role="dialog" aria-modal="true" aria-labelledby="ry-modal-title-${this.id}">
|
|
@@ -297,8 +300,8 @@ class F extends u {
|
|
|
297
300
|
this.state === "open" ? this.close() : this.open();
|
|
298
301
|
}
|
|
299
302
|
}
|
|
300
|
-
customElements.define("ry-modal",
|
|
301
|
-
class
|
|
303
|
+
customElements.define("ry-modal", j);
|
|
304
|
+
class N extends u {
|
|
302
305
|
setup() {
|
|
303
306
|
this.#t(), this.$$('[data-ry-target="trigger"]').forEach((t) => {
|
|
304
307
|
this.on(t, "click", this.#i);
|
|
@@ -360,10 +363,10 @@ class j extends u {
|
|
|
360
363
|
return this.$$('[data-ry-target="trigger"]').findIndex((e) => e.getAttribute("aria-selected") === "true");
|
|
361
364
|
}
|
|
362
365
|
}
|
|
363
|
-
customElements.define("ry-tabs",
|
|
366
|
+
customElements.define("ry-tabs", N);
|
|
364
367
|
customElements.get("ry-tab") || customElements.define("ry-tab", class extends HTMLElement {
|
|
365
368
|
});
|
|
366
|
-
class
|
|
369
|
+
class q extends u {
|
|
367
370
|
setup() {
|
|
368
371
|
this.#t();
|
|
369
372
|
const t = this.$('[data-ry-target="trigger"]');
|
|
@@ -372,7 +375,7 @@ class O extends u {
|
|
|
372
375
|
}), this.state = "closed";
|
|
373
376
|
}
|
|
374
377
|
#t() {
|
|
375
|
-
const t = this.$(
|
|
378
|
+
const t = this.$("ry-button:first-of-type");
|
|
376
379
|
t && !this.$('[data-ry-target="trigger"]') && t.setAttribute("data-ry-target", "trigger");
|
|
377
380
|
const e = this.$("ry-menu");
|
|
378
381
|
e && !e.hasAttribute("data-ry-target") && (e.setAttribute("data-ry-target", "menu"), e.classList.add("ry-dropdown__menu"), e.setAttribute("role", "menu")), this.$$("ry-menu-item").forEach((s) => {
|
|
@@ -411,12 +414,12 @@ class O extends u {
|
|
|
411
414
|
this.state === "open" ? this.close() : this.open();
|
|
412
415
|
}
|
|
413
416
|
}
|
|
414
|
-
customElements.define("ry-dropdown",
|
|
417
|
+
customElements.define("ry-dropdown", q);
|
|
415
418
|
customElements.get("ry-menu") || customElements.define("ry-menu", class extends HTMLElement {
|
|
416
419
|
});
|
|
417
420
|
customElements.get("ry-menu-item") || customElements.define("ry-menu-item", class extends HTMLElement {
|
|
418
421
|
});
|
|
419
|
-
class
|
|
422
|
+
class K extends u {
|
|
420
423
|
setup() {
|
|
421
424
|
this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.setAttribute("role", "button"), this.on(this, "click", this.#t), this.on(this, "keydown", this.#e);
|
|
422
425
|
}
|
|
@@ -431,47 +434,17 @@ class N extends u {
|
|
|
431
434
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
|
|
432
435
|
};
|
|
433
436
|
}
|
|
434
|
-
customElements.define("ry-button",
|
|
435
|
-
class
|
|
436
|
-
static get observedAttributes() {
|
|
437
|
-
return ["value"];
|
|
438
|
-
}
|
|
439
|
-
get value() {
|
|
440
|
-
return this.getAttribute("value") ?? "";
|
|
441
|
-
}
|
|
442
|
-
set value(t) {
|
|
443
|
-
this.setAttribute("value", t);
|
|
444
|
-
}
|
|
445
|
-
setup() {
|
|
446
|
-
this.setAttribute("role", "group"), this.#e(), this.on(this, "click", this.#t);
|
|
447
|
-
}
|
|
448
|
-
attributeChangedCallback(t, e, s) {
|
|
449
|
-
t === "value" && e !== s && this.#e();
|
|
450
|
-
}
|
|
451
|
-
#t = (t) => {
|
|
452
|
-
const e = t.target.closest("ry-button, ry-toggle-button");
|
|
453
|
-
if (!e || !this.contains(e)) return;
|
|
454
|
-
const s = e.getAttribute("value");
|
|
455
|
-
s != null && this.value !== s && (this.value = s, this.emit("change", { value: s }));
|
|
456
|
-
};
|
|
457
|
-
#e() {
|
|
458
|
-
const t = this.value;
|
|
459
|
-
if (t)
|
|
460
|
-
for (const e of this.querySelectorAll("ry-button, ry-toggle-button"))
|
|
461
|
-
e.getAttribute("value") === t ? (e.setAttribute("pressed", ""), e.setAttribute("aria-pressed", "true")) : (e.removeAttribute("pressed"), e.removeAttribute("aria-pressed"));
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
customElements.define("ry-button-group", q);
|
|
465
|
-
class K extends u {
|
|
437
|
+
customElements.define("ry-button", K);
|
|
438
|
+
class z extends u {
|
|
466
439
|
#t = null;
|
|
467
440
|
#e = !1;
|
|
468
441
|
#i = 0;
|
|
469
442
|
#s = 0;
|
|
470
443
|
setup() {
|
|
471
444
|
if (!this.hasAttribute("resizable")) return;
|
|
472
|
-
this.#
|
|
445
|
+
this.#y(), 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");
|
|
473
446
|
const t = this.lastElementChild;
|
|
474
|
-
t && this.insertBefore(this.#t, t), this.on(this.#t, "mousedown", this.#
|
|
447
|
+
t && this.insertBefore(this.#t, t), this.on(this.#t, "mousedown", this.#u), this.on(this.#t, "touchstart", this.#n), this.on(this.#t, "keydown", this.#f), this.on(this.#t, "dblclick", this.#A);
|
|
475
448
|
}
|
|
476
449
|
#r() {
|
|
477
450
|
return this.lastElementChild;
|
|
@@ -484,50 +457,50 @@ class K extends u {
|
|
|
484
457
|
const t = getComputedStyle(this).getPropertyValue("--ry-split-min-width").trim();
|
|
485
458
|
return t ? parseFloat(t) : 100;
|
|
486
459
|
}
|
|
487
|
-
#
|
|
460
|
+
#l() {
|
|
488
461
|
const t = getComputedStyle(this).getPropertyValue("--ry-split-max-width").trim();
|
|
489
462
|
return t ? parseFloat(t) : this.getBoundingClientRect().width * 0.8;
|
|
490
463
|
}
|
|
491
|
-
#
|
|
492
|
-
const e = this.#o(), s = this.#
|
|
464
|
+
#c(t) {
|
|
465
|
+
const e = this.#o(), s = this.#l(), i = Math.round(Math.max(e, Math.min(s, t)));
|
|
493
466
|
this.style.setProperty("--ry-split-width", `${i}px`);
|
|
494
467
|
}
|
|
495
|
-
#
|
|
496
|
-
t.preventDefault(), this.#
|
|
497
|
-
const e = (i) => this.#
|
|
498
|
-
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", s), this.#
|
|
468
|
+
#u = (t) => {
|
|
469
|
+
t.preventDefault(), this.#d(t.clientX);
|
|
470
|
+
const e = (i) => this.#h(i.clientX), s = () => {
|
|
471
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", s), this.#b();
|
|
499
472
|
};
|
|
500
473
|
document.addEventListener("mousemove", e), document.addEventListener("mouseup", s);
|
|
501
474
|
};
|
|
502
475
|
#n = (t) => {
|
|
503
476
|
const e = t.touches[0];
|
|
504
477
|
if (!e) return;
|
|
505
|
-
t.preventDefault(), this.#
|
|
478
|
+
t.preventDefault(), this.#d(e.clientX);
|
|
506
479
|
const s = (r) => {
|
|
507
480
|
const a = r.touches[0];
|
|
508
|
-
a && this.#
|
|
481
|
+
a && this.#h(a.clientX);
|
|
509
482
|
}, i = () => {
|
|
510
|
-
document.removeEventListener("touchmove", s), document.removeEventListener("touchend", i), this.#
|
|
483
|
+
document.removeEventListener("touchmove", s), document.removeEventListener("touchend", i), this.#b();
|
|
511
484
|
};
|
|
512
485
|
document.addEventListener("touchmove", s, { passive: !1 }), document.addEventListener("touchend", i);
|
|
513
486
|
};
|
|
514
|
-
#
|
|
487
|
+
#d(t) {
|
|
515
488
|
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";
|
|
516
489
|
}
|
|
517
|
-
#
|
|
490
|
+
#h(t) {
|
|
518
491
|
if (!this.#e) return;
|
|
519
492
|
const e = this.#i - t;
|
|
520
|
-
this.#
|
|
493
|
+
this.#c(this.#s + e);
|
|
521
494
|
}
|
|
522
|
-
#
|
|
523
|
-
this.#e = !1, this.removeAttribute("data-ry-resizing"), document.body.style.cursor = "", document.body.style.userSelect = "", this.#
|
|
495
|
+
#b() {
|
|
496
|
+
this.#e = !1, this.removeAttribute("data-ry-resizing"), document.body.style.cursor = "", document.body.style.userSelect = "", this.#p(), this.emit("resize", { width: this.#a() });
|
|
524
497
|
}
|
|
525
498
|
#f = (t) => {
|
|
526
499
|
const e = t.shiftKey ? 50 : 10;
|
|
527
500
|
let s = this.#a();
|
|
528
|
-
t.key === "ArrowLeft" ? (t.preventDefault(), this.#
|
|
501
|
+
t.key === "ArrowLeft" ? (t.preventDefault(), this.#c(s + e), this.#p()) : t.key === "ArrowRight" ? (t.preventDefault(), this.#c(s - e), this.#p()) : t.key === "Home" ? (t.preventDefault(), this.#c(this.#o()), this.#p()) : t.key === "End" && (t.preventDefault(), this.#c(this.#l()), this.#p());
|
|
529
502
|
};
|
|
530
|
-
#
|
|
503
|
+
#A = () => {
|
|
531
504
|
this.style.removeProperty("--ry-split-width"), this.#v(), this.emit("resize", { width: this.#a() });
|
|
532
505
|
};
|
|
533
506
|
// Persistence
|
|
@@ -535,7 +508,7 @@ class K extends u {
|
|
|
535
508
|
const t = this.getAttribute("persist");
|
|
536
509
|
return t ? `ry-split:${t}` : null;
|
|
537
510
|
}
|
|
538
|
-
#
|
|
511
|
+
#p() {
|
|
539
512
|
const t = this.#g();
|
|
540
513
|
if (t)
|
|
541
514
|
try {
|
|
@@ -543,7 +516,7 @@ class K extends u {
|
|
|
543
516
|
} catch {
|
|
544
517
|
}
|
|
545
518
|
}
|
|
546
|
-
#
|
|
519
|
+
#y() {
|
|
547
520
|
const t = this.#g();
|
|
548
521
|
if (t)
|
|
549
522
|
try {
|
|
@@ -564,8 +537,8 @@ class K extends u {
|
|
|
564
537
|
}
|
|
565
538
|
}
|
|
566
539
|
}
|
|
567
|
-
customElements.define("ry-split",
|
|
568
|
-
class
|
|
540
|
+
customElements.define("ry-split", z);
|
|
541
|
+
class V extends u {
|
|
569
542
|
#t = ["light", "dark"];
|
|
570
543
|
#e = 0;
|
|
571
544
|
setup() {
|
|
@@ -605,8 +578,8 @@ class z extends u {
|
|
|
605
578
|
}
|
|
606
579
|
}
|
|
607
580
|
}
|
|
608
|
-
customElements.define("ry-theme-toggle",
|
|
609
|
-
class
|
|
581
|
+
customElements.define("ry-theme-toggle", V);
|
|
582
|
+
class U extends u {
|
|
610
583
|
setup() {
|
|
611
584
|
this.hasAttribute("interactive") && (this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.setAttribute("role", "link"), this.on(this, "click", this.#t), this.on(this, "keydown", this.#e));
|
|
612
585
|
}
|
|
@@ -619,8 +592,8 @@ class V extends u {
|
|
|
619
592
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
|
|
620
593
|
};
|
|
621
594
|
}
|
|
622
|
-
customElements.define("ry-card",
|
|
623
|
-
class
|
|
595
|
+
customElements.define("ry-card", U);
|
|
596
|
+
class W extends u {
|
|
624
597
|
setup() {
|
|
625
598
|
this.#t();
|
|
626
599
|
const t = this.$("[close]");
|
|
@@ -640,8 +613,8 @@ class U extends u {
|
|
|
640
613
|
}, 200), this.emit("close");
|
|
641
614
|
}
|
|
642
615
|
}
|
|
643
|
-
customElements.define("ry-alert",
|
|
644
|
-
class
|
|
616
|
+
customElements.define("ry-alert", W);
|
|
617
|
+
class Y extends u {
|
|
645
618
|
static get observedAttributes() {
|
|
646
619
|
return ["label", "error", "hint"];
|
|
647
620
|
}
|
|
@@ -694,9 +667,9 @@ class W extends u {
|
|
|
694
667
|
e && (e.textContent = t ?? "");
|
|
695
668
|
}
|
|
696
669
|
}
|
|
697
|
-
customElements.define("ry-field",
|
|
698
|
-
let
|
|
699
|
-
class
|
|
670
|
+
customElements.define("ry-field", Y);
|
|
671
|
+
let X = 0;
|
|
672
|
+
class G extends u {
|
|
700
673
|
#t = null;
|
|
701
674
|
static observedAttributes = ["checked", "disabled"];
|
|
702
675
|
setup() {
|
|
@@ -704,7 +677,7 @@ class X extends u {
|
|
|
704
677
|
}
|
|
705
678
|
#e() {
|
|
706
679
|
if (this.$('[data-ry-target="track"]')) return;
|
|
707
|
-
const t = `ry-switch-${++
|
|
680
|
+
const t = `ry-switch-${++X}`, e = this.getAttribute("name") ?? "", s = this.hasAttribute("checked"), i = this.hasAttribute("disabled"), r = this.textContent?.trim() ?? "";
|
|
708
681
|
this.innerHTML = `
|
|
709
682
|
<label data-ry-target="wrapper" class="ry-switch__wrapper" for="${t}">
|
|
710
683
|
<input
|
|
@@ -749,16 +722,16 @@ class X extends u {
|
|
|
749
722
|
this.#t && (this.#t.value = t);
|
|
750
723
|
}
|
|
751
724
|
}
|
|
752
|
-
customElements.define("ry-switch",
|
|
753
|
-
let
|
|
754
|
-
class
|
|
725
|
+
customElements.define("ry-switch", G);
|
|
726
|
+
let J = 0;
|
|
727
|
+
class Z extends u {
|
|
755
728
|
#t = null;
|
|
756
729
|
#e = null;
|
|
757
730
|
#i = null;
|
|
758
731
|
setup() {
|
|
759
|
-
this.#i = `ry-tooltip-${++
|
|
732
|
+
this.#i = `ry-tooltip-${++J}`, this.#s();
|
|
760
733
|
const t = this.firstElementChild;
|
|
761
|
-
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.#
|
|
734
|
+
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);
|
|
762
735
|
}
|
|
763
736
|
#s() {
|
|
764
737
|
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);
|
|
@@ -775,15 +748,15 @@ class J extends u {
|
|
|
775
748
|
#o = () => {
|
|
776
749
|
this.#t && (clearTimeout(this.#t), this.#t = null), this.state = "closed";
|
|
777
750
|
};
|
|
778
|
-
#
|
|
751
|
+
#l = (t) => {
|
|
779
752
|
t.key === "Escape" && this.state === "open" && this.#o();
|
|
780
753
|
};
|
|
781
754
|
teardown() {
|
|
782
755
|
this.#t && clearTimeout(this.#t);
|
|
783
756
|
}
|
|
784
757
|
}
|
|
785
|
-
customElements.define("ry-tooltip",
|
|
786
|
-
class
|
|
758
|
+
customElements.define("ry-tooltip", Z);
|
|
759
|
+
class Q extends u {
|
|
787
760
|
#t = null;
|
|
788
761
|
#e = 0;
|
|
789
762
|
setup() {
|
|
@@ -828,38 +801,38 @@ class Z extends u {
|
|
|
828
801
|
this.state === "open" ? this.close() : this.open();
|
|
829
802
|
}
|
|
830
803
|
}
|
|
831
|
-
customElements.define("ry-drawer",
|
|
832
|
-
const
|
|
833
|
-
class
|
|
804
|
+
customElements.define("ry-drawer", Q);
|
|
805
|
+
const tt = 4e3;
|
|
806
|
+
class m extends u {
|
|
834
807
|
#t = null;
|
|
835
808
|
static observedAttributes = ["variant", "duration"];
|
|
836
809
|
// Static container for programmatic toasts
|
|
837
810
|
static #e = null;
|
|
838
811
|
static #i() {
|
|
839
|
-
return
|
|
812
|
+
return m.#e || (m.#e = document.createElement("div"), m.#e.setAttribute("data-ry-target", "toast-container"), m.#e.className = "ry-toast-container", document.body.appendChild(m.#e)), m.#e;
|
|
840
813
|
}
|
|
841
814
|
// Static API
|
|
842
815
|
static show(t) {
|
|
843
816
|
const e = document.createElement("ry-toast");
|
|
844
|
-
return e.textContent = t.message, t.variant && e.setAttribute("variant", t.variant), t.duration !== void 0 && e.setAttribute("duration", String(t.duration)),
|
|
817
|
+
return e.textContent = t.message, t.variant && e.setAttribute("variant", t.variant), t.duration !== void 0 && e.setAttribute("duration", String(t.duration)), m.#i().appendChild(e), e;
|
|
845
818
|
}
|
|
846
819
|
static success(t, e) {
|
|
847
|
-
return
|
|
820
|
+
return m.show({ message: t, variant: "success", duration: e });
|
|
848
821
|
}
|
|
849
822
|
static error(t, e) {
|
|
850
|
-
return
|
|
823
|
+
return m.show({ message: t, variant: "error", duration: e });
|
|
851
824
|
}
|
|
852
825
|
static info(t, e) {
|
|
853
|
-
return
|
|
826
|
+
return m.show({ message: t, variant: "info", duration: e });
|
|
854
827
|
}
|
|
855
828
|
static warning(t, e) {
|
|
856
|
-
return
|
|
829
|
+
return m.show({ message: t, variant: "warning", duration: e });
|
|
857
830
|
}
|
|
858
831
|
setup() {
|
|
859
832
|
this.#s();
|
|
860
833
|
const t = this.$("[close]");
|
|
861
834
|
t && this.on(t, "click", () => this.dismiss());
|
|
862
|
-
const e = parseInt(this.getAttribute("duration") ?? String(
|
|
835
|
+
const e = parseInt(this.getAttribute("duration") ?? String(tt), 10);
|
|
863
836
|
e > 0 && (this.#t = setTimeout(() => this.dismiss(), e)), requestAnimationFrame(() => {
|
|
864
837
|
this.state = "visible";
|
|
865
838
|
});
|
|
@@ -891,8 +864,8 @@ class f extends u {
|
|
|
891
864
|
this.#t && clearTimeout(this.#t);
|
|
892
865
|
}
|
|
893
866
|
}
|
|
894
|
-
customElements.define("ry-toast",
|
|
895
|
-
const
|
|
867
|
+
customElements.define("ry-toast", m);
|
|
868
|
+
const w = {
|
|
896
869
|
// Close / X
|
|
897
870
|
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>',
|
|
898
871
|
// Chevron down
|
|
@@ -964,20 +937,20 @@ const $ = {
|
|
|
964
937
|
// Quote
|
|
965
938
|
quote: '<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none"><path d="M4.583 17.321C3.553 16.227 3 15 3 13.011c0-3.5 2.457-6.637 6.03-8.188l.893 1.378c-3.335 1.804-3.987 4.145-4.247 5.621.537-.278 1.24-.375 1.929-.311C9.591 11.69 11 13.17 11 15c0 1.933-1.567 3.5-3.5 3.5-1.073 0-2.099-.49-2.917-1.179zM14.583 17.321C13.553 16.227 13 15 13 13.011c0-3.5 2.457-6.637 6.03-8.188l.893 1.378c-3.335 1.804-3.987 4.145-4.247 5.621.537-.278 1.24-.375 1.929-.311C19.591 11.69 21 13.17 21 15c0 1.933-1.567 3.5-3.5 3.5-1.073 0-2.099-.49-2.917-1.179z"/></svg>'
|
|
966
939
|
};
|
|
967
|
-
function
|
|
968
|
-
return
|
|
940
|
+
function g(h) {
|
|
941
|
+
return w[h] ?? "";
|
|
969
942
|
}
|
|
970
|
-
function
|
|
971
|
-
|
|
943
|
+
function Ut(h, t) {
|
|
944
|
+
w[h] = t;
|
|
972
945
|
}
|
|
973
|
-
function
|
|
974
|
-
Object.assign(
|
|
946
|
+
function Wt(h) {
|
|
947
|
+
Object.assign(w, h);
|
|
975
948
|
}
|
|
976
|
-
function
|
|
977
|
-
return Object.keys(
|
|
949
|
+
function Yt() {
|
|
950
|
+
return Object.keys(w);
|
|
978
951
|
}
|
|
979
|
-
let
|
|
980
|
-
class
|
|
952
|
+
let et = 0;
|
|
953
|
+
class st extends u {
|
|
981
954
|
#t = null;
|
|
982
955
|
#e = -1;
|
|
983
956
|
#i = "";
|
|
@@ -990,12 +963,12 @@ class et extends u {
|
|
|
990
963
|
}
|
|
991
964
|
static observedAttributes = ["value", "disabled"];
|
|
992
965
|
setup() {
|
|
993
|
-
this.#t = `ry-select-${++
|
|
966
|
+
this.#t = `ry-select-${++et}`, this.#o(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.on(this, "click", this.#l), this.on(this, "keydown", this.#c), this.on(document, "click", this.#u), this.#a && this.on(this, "ry:remove", this.#n), this.hasAttribute("data-ry-state") || (this.state = "closed");
|
|
994
967
|
const t = this.getAttribute("value");
|
|
995
968
|
if (t)
|
|
996
969
|
if (this.#a)
|
|
997
970
|
for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
|
|
998
|
-
this.#
|
|
971
|
+
this.#p(e);
|
|
999
972
|
else
|
|
1000
973
|
this.value = t;
|
|
1001
974
|
}
|
|
@@ -1013,7 +986,7 @@ class et extends u {
|
|
|
1013
986
|
data-value="${o.value}"
|
|
1014
987
|
${o.disabled ? "data-disabled" : ""}
|
|
1015
988
|
aria-disabled="${o.disabled}">
|
|
1016
|
-
${r ? `<span data-ry-target="check" class="ry-select__check">${
|
|
989
|
+
${r ? `<span data-ry-target="check" class="ry-select__check">${g("check")}</span>` : ""}
|
|
1017
990
|
<span class="ry-select__option-label">${o.label}</span>
|
|
1018
991
|
</div>
|
|
1019
992
|
`).join("");
|
|
@@ -1023,7 +996,7 @@ class et extends u {
|
|
|
1023
996
|
<div data-ry-target="trigger" class="ry-select__trigger ry-select__trigger--multi" aria-haspopup="listbox" aria-expanded="false">
|
|
1024
997
|
<div data-ry-target="tags" class="ry-select__tags"></div>
|
|
1025
998
|
<span data-ry-target="value" class="ry-select__value">${e}</span>
|
|
1026
|
-
${o ? `<button data-ry-target="clear" class="ry-select__clear" aria-label="Clear all" type="button">${
|
|
999
|
+
${o ? `<button data-ry-target="clear" class="ry-select__clear" aria-label="Clear all" type="button">${g("close")}</button>` : ""}
|
|
1027
1000
|
<span data-ry-target="arrow" class="ry-select__arrow">▾</span>
|
|
1028
1001
|
</div>
|
|
1029
1002
|
<div data-ry-target="dropdown" class="ry-select__dropdown" role="listbox" id="${this.#t}-listbox" tabindex="-1" aria-multiselectable="true">
|
|
@@ -1053,20 +1026,20 @@ class et extends u {
|
|
|
1053
1026
|
`;
|
|
1054
1027
|
this._options = t;
|
|
1055
1028
|
}
|
|
1056
|
-
#
|
|
1029
|
+
#l = (t) => {
|
|
1057
1030
|
if (this.hasAttribute("disabled")) return;
|
|
1058
1031
|
const e = t.target, s = e.closest('[data-ry-target="option"]');
|
|
1059
1032
|
if (s instanceof HTMLElement && !s.hasAttribute("data-disabled")) {
|
|
1060
1033
|
if (this.#a) {
|
|
1061
1034
|
const r = s.dataset.value ?? "";
|
|
1062
|
-
this.#
|
|
1035
|
+
this.#p(r);
|
|
1063
1036
|
} else
|
|
1064
|
-
this.#
|
|
1037
|
+
this.#w(s), this.close();
|
|
1065
1038
|
return;
|
|
1066
1039
|
}
|
|
1067
1040
|
e.closest('[data-ry-target="trigger"]') && this.toggle();
|
|
1068
1041
|
};
|
|
1069
|
-
#
|
|
1042
|
+
#c = (t) => {
|
|
1070
1043
|
if (this.hasAttribute("disabled")) return;
|
|
1071
1044
|
const e = this.state === "open";
|
|
1072
1045
|
switch (t.key) {
|
|
@@ -1077,9 +1050,9 @@ class et extends u {
|
|
|
1077
1050
|
if (i)
|
|
1078
1051
|
if (this.#a) {
|
|
1079
1052
|
const r = i.dataset.value ?? "";
|
|
1080
|
-
this.#
|
|
1053
|
+
this.#p(r);
|
|
1081
1054
|
} else
|
|
1082
|
-
this.#
|
|
1055
|
+
this.#w(i), this.close();
|
|
1083
1056
|
} else
|
|
1084
1057
|
this.toggle();
|
|
1085
1058
|
break;
|
|
@@ -1087,13 +1060,13 @@ class et extends u {
|
|
|
1087
1060
|
e && (t.preventDefault(), this.close());
|
|
1088
1061
|
break;
|
|
1089
1062
|
case "ArrowDown":
|
|
1090
|
-
t.preventDefault(), e ? this.#
|
|
1063
|
+
t.preventDefault(), e ? this.#b() : this.open();
|
|
1091
1064
|
break;
|
|
1092
1065
|
case "ArrowUp":
|
|
1093
1066
|
t.preventDefault(), e && this.#f();
|
|
1094
1067
|
break;
|
|
1095
1068
|
case "Home":
|
|
1096
|
-
e && (t.preventDefault(), this.#
|
|
1069
|
+
e && (t.preventDefault(), this.#A());
|
|
1097
1070
|
break;
|
|
1098
1071
|
case "End":
|
|
1099
1072
|
e && (t.preventDefault(), this.#g());
|
|
@@ -1101,40 +1074,40 @@ class et extends u {
|
|
|
1101
1074
|
case "Backspace":
|
|
1102
1075
|
if (this.#a && this.#r.size > 0) {
|
|
1103
1076
|
const s = [...this.#r], i = s[s.length - 1];
|
|
1104
|
-
i && this.#
|
|
1077
|
+
i && this.#p(i);
|
|
1105
1078
|
}
|
|
1106
1079
|
break;
|
|
1107
1080
|
default:
|
|
1108
|
-
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#
|
|
1081
|
+
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#d(t.key);
|
|
1109
1082
|
break;
|
|
1110
1083
|
}
|
|
1111
1084
|
};
|
|
1112
|
-
#
|
|
1085
|
+
#u = (t) => {
|
|
1113
1086
|
const e = t.target;
|
|
1114
1087
|
!this.contains(e) && this.state === "open" && this.close();
|
|
1115
1088
|
};
|
|
1116
1089
|
#n = (t) => {
|
|
1117
1090
|
const e = t.detail.value;
|
|
1118
|
-
this.#r.has(e) && this.#
|
|
1091
|
+
this.#r.has(e) && this.#p(e);
|
|
1119
1092
|
};
|
|
1120
|
-
#
|
|
1093
|
+
#d(t) {
|
|
1121
1094
|
this.#s && clearTimeout(this.#s), this.#i += t.toLowerCase();
|
|
1122
1095
|
const e = this.$$('[data-ry-target="option"]:not([data-disabled])'), s = e.findIndex(
|
|
1123
1096
|
(i) => i.textContent?.trim().toLowerCase().startsWith(this.#i)
|
|
1124
1097
|
);
|
|
1125
1098
|
if (s >= 0) {
|
|
1126
1099
|
if (this.state === "open")
|
|
1127
|
-
this.#
|
|
1100
|
+
this.#h(s);
|
|
1128
1101
|
else if (!this.#a) {
|
|
1129
1102
|
const i = e[s];
|
|
1130
|
-
i && this.#
|
|
1103
|
+
i && this.#w(i);
|
|
1131
1104
|
}
|
|
1132
1105
|
}
|
|
1133
1106
|
this.#s = setTimeout(() => {
|
|
1134
1107
|
this.#i = "";
|
|
1135
1108
|
}, 500);
|
|
1136
1109
|
}
|
|
1137
|
-
#
|
|
1110
|
+
#h(t) {
|
|
1138
1111
|
const e = this.$$('[data-ry-target="option"]:not([data-disabled])');
|
|
1139
1112
|
if (t < 0 || t >= e.length) return;
|
|
1140
1113
|
this.$$('[data-ry-target="option"][data-highlighted]').forEach((r) => {
|
|
@@ -1146,23 +1119,23 @@ class et extends u {
|
|
|
1146
1119
|
const i = this.$('[data-ry-target="trigger"]');
|
|
1147
1120
|
i && i.setAttribute("aria-activedescendant", s.id);
|
|
1148
1121
|
}
|
|
1149
|
-
#
|
|
1122
|
+
#b() {
|
|
1150
1123
|
const t = this.$$('[data-ry-target="option"]:not([data-disabled])'), e = Math.min(this.#e + 1, t.length - 1);
|
|
1151
|
-
this.#
|
|
1124
|
+
this.#h(e);
|
|
1152
1125
|
}
|
|
1153
1126
|
#f() {
|
|
1154
1127
|
const t = Math.max(this.#e - 1, 0);
|
|
1155
|
-
this.#
|
|
1128
|
+
this.#h(t);
|
|
1156
1129
|
}
|
|
1157
|
-
#
|
|
1158
|
-
this.#
|
|
1130
|
+
#A() {
|
|
1131
|
+
this.#h(0);
|
|
1159
1132
|
}
|
|
1160
1133
|
#g() {
|
|
1161
1134
|
const t = this.$$('[data-ry-target="option"]:not([data-disabled])');
|
|
1162
|
-
this.#
|
|
1135
|
+
this.#h(t.length - 1);
|
|
1163
1136
|
}
|
|
1164
1137
|
// --- Multi-select methods ---
|
|
1165
|
-
#
|
|
1138
|
+
#p(t) {
|
|
1166
1139
|
const e = this.getAttribute("max-selections");
|
|
1167
1140
|
if (this.#r.has(t))
|
|
1168
1141
|
this.#r.delete(t);
|
|
@@ -1170,9 +1143,9 @@ class et extends u {
|
|
|
1170
1143
|
if (e && this.#r.size >= parseInt(e, 10)) return;
|
|
1171
1144
|
this.#r.add(t);
|
|
1172
1145
|
}
|
|
1173
|
-
this.#
|
|
1146
|
+
this.#y(), this.#v(), this.#m(), this.setAttribute("value", [...this.#r].join(",")), this.emit("change", { value: this.value, label: "" });
|
|
1174
1147
|
}
|
|
1175
|
-
#
|
|
1148
|
+
#y() {
|
|
1176
1149
|
const t = this.$('[data-ry-target="tags"]'), e = this.$('[data-ry-target="value"]');
|
|
1177
1150
|
if (t) {
|
|
1178
1151
|
t.innerHTML = "";
|
|
@@ -1191,17 +1164,17 @@ class et extends u {
|
|
|
1191
1164
|
for (const e of t.options)
|
|
1192
1165
|
e.selected = this.#r.has(e.value);
|
|
1193
1166
|
}
|
|
1194
|
-
#
|
|
1167
|
+
#m() {
|
|
1195
1168
|
this.$$('[data-ry-target="option"]').forEach((t) => {
|
|
1196
1169
|
const e = t.dataset.value ?? "";
|
|
1197
1170
|
this.#r.has(e) ? t.setAttribute("aria-selected", "true") : t.removeAttribute("aria-selected");
|
|
1198
1171
|
});
|
|
1199
1172
|
}
|
|
1200
1173
|
#M() {
|
|
1201
|
-
this.#r.clear(), this.#
|
|
1174
|
+
this.#r.clear(), this.#y(), this.#v(), this.#m(), this.setAttribute("value", ""), this.emit("change", { value: "", label: "" });
|
|
1202
1175
|
}
|
|
1203
1176
|
// --- Single-select method ---
|
|
1204
|
-
#
|
|
1177
|
+
#w(t) {
|
|
1205
1178
|
const e = t.dataset.value ?? "", s = t.textContent?.trim() ?? "", i = this.$('[data-ry-target="value"]');
|
|
1206
1179
|
i && (i.textContent = s, i.setAttribute("data-selected", ""));
|
|
1207
1180
|
const r = this.$('[data-ry-target="native"]');
|
|
@@ -1213,19 +1186,19 @@ class et extends u {
|
|
|
1213
1186
|
if (this.state === "open") return;
|
|
1214
1187
|
this.state = "open";
|
|
1215
1188
|
const t = this.$('[data-ry-target="trigger"]');
|
|
1216
|
-
if (t && t.setAttribute("aria-expanded", "true"), this.#
|
|
1217
|
-
this.#
|
|
1189
|
+
if (t && t.setAttribute("aria-expanded", "true"), this.#H(), this.#a)
|
|
1190
|
+
this.#h(0);
|
|
1218
1191
|
else {
|
|
1219
1192
|
const e = this.getAttribute("value");
|
|
1220
1193
|
if (e) {
|
|
1221
1194
|
const i = this.$$('[data-ry-target="option"]:not([data-disabled])').findIndex((r) => r.dataset.value === e);
|
|
1222
|
-
i >= 0 && this.#
|
|
1195
|
+
i >= 0 && this.#h(i);
|
|
1223
1196
|
} else
|
|
1224
|
-
this.#
|
|
1197
|
+
this.#h(0);
|
|
1225
1198
|
}
|
|
1226
1199
|
this.emit("open");
|
|
1227
1200
|
}
|
|
1228
|
-
#
|
|
1201
|
+
#H() {
|
|
1229
1202
|
const t = this.$('[data-ry-target="dropdown"]');
|
|
1230
1203
|
if (!t) return;
|
|
1231
1204
|
this.removeAttribute("data-ry-position");
|
|
@@ -1251,10 +1224,10 @@ class et extends u {
|
|
|
1251
1224
|
this.#r.clear();
|
|
1252
1225
|
for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
|
|
1253
1226
|
this.#r.add(e);
|
|
1254
|
-
this.#
|
|
1227
|
+
this.#y(), this.#v(), this.#m(), this.setAttribute("value", t);
|
|
1255
1228
|
} else {
|
|
1256
1229
|
const e = this.$(`[data-ry-target="option"][data-value="${t}"]`);
|
|
1257
|
-
e && this.#
|
|
1230
|
+
e && this.#w(e);
|
|
1258
1231
|
}
|
|
1259
1232
|
}
|
|
1260
1233
|
get values() {
|
|
@@ -1264,20 +1237,20 @@ class et extends u {
|
|
|
1264
1237
|
this.#s && clearTimeout(this.#s);
|
|
1265
1238
|
}
|
|
1266
1239
|
}
|
|
1267
|
-
class
|
|
1240
|
+
class it extends HTMLElement {
|
|
1268
1241
|
}
|
|
1269
|
-
customElements.define("ry-option",
|
|
1270
|
-
customElements.define("ry-select",
|
|
1271
|
-
let
|
|
1272
|
-
class
|
|
1242
|
+
customElements.define("ry-option", it);
|
|
1243
|
+
customElements.define("ry-select", st);
|
|
1244
|
+
let rt = 0;
|
|
1245
|
+
class at extends u {
|
|
1273
1246
|
#t = null;
|
|
1274
1247
|
#e = -1;
|
|
1275
1248
|
#i = [];
|
|
1276
1249
|
static observedAttributes = ["value", "disabled"];
|
|
1277
1250
|
setup() {
|
|
1278
|
-
this.#t = `ry-combobox-${++
|
|
1251
|
+
this.#t = `ry-combobox-${++rt}`, this.#s();
|
|
1279
1252
|
const t = this.$('[data-ry-target="input"]');
|
|
1280
|
-
t && (this.on(t, "input", this.#r), this.on(t, "focus", this.#n)), this.on(this, "click", this.#o), this.on(this, "keydown", this.#
|
|
1253
|
+
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.#c), this.on(document, "click", this.#u), this.hasAttribute("data-ry-state") || (this.state = "closed");
|
|
1281
1254
|
const e = this.getAttribute("value");
|
|
1282
1255
|
e && (this.value = e);
|
|
1283
1256
|
}
|
|
@@ -1353,7 +1326,7 @@ class rt extends u {
|
|
|
1353
1326
|
if (this.hasAttribute("disabled")) return;
|
|
1354
1327
|
const e = t.target, s = e.closest('[data-ry-target="option"]');
|
|
1355
1328
|
if (s instanceof HTMLElement && !s.hasAttribute("data-disabled")) {
|
|
1356
|
-
this.#
|
|
1329
|
+
this.#d(s);
|
|
1357
1330
|
return;
|
|
1358
1331
|
}
|
|
1359
1332
|
if (e.closest('[data-ry-target="arrow"]')) {
|
|
@@ -1361,12 +1334,12 @@ class rt extends u {
|
|
|
1361
1334
|
return;
|
|
1362
1335
|
}
|
|
1363
1336
|
};
|
|
1364
|
-
#
|
|
1337
|
+
#l = (t) => {
|
|
1365
1338
|
if (this.hasAttribute("disabled")) return;
|
|
1366
1339
|
const e = this.state === "open";
|
|
1367
1340
|
switch (t.key) {
|
|
1368
1341
|
case "ArrowDown":
|
|
1369
|
-
t.preventDefault(), e ? this.#
|
|
1342
|
+
t.preventDefault(), e ? this.#b() : this.open();
|
|
1370
1343
|
break;
|
|
1371
1344
|
case "ArrowUp":
|
|
1372
1345
|
t.preventDefault(), e && this.#f();
|
|
@@ -1377,7 +1350,7 @@ class rt extends u {
|
|
|
1377
1350
|
const i = this.$$(
|
|
1378
1351
|
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1379
1352
|
)[this.#e];
|
|
1380
|
-
i && this.#
|
|
1353
|
+
i && this.#d(i);
|
|
1381
1354
|
}
|
|
1382
1355
|
break;
|
|
1383
1356
|
case "Escape":
|
|
@@ -1388,15 +1361,15 @@ class rt extends u {
|
|
|
1388
1361
|
break;
|
|
1389
1362
|
}
|
|
1390
1363
|
};
|
|
1391
|
-
#
|
|
1364
|
+
#c = (t) => {
|
|
1392
1365
|
const s = t.target.closest('[data-ry-target="option"]');
|
|
1393
1366
|
if (!(s instanceof HTMLElement) || s.hasAttribute("data-disabled") || s.hasAttribute("hidden")) return;
|
|
1394
1367
|
const r = this.$$(
|
|
1395
1368
|
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1396
1369
|
).indexOf(s);
|
|
1397
|
-
r >= 0 && this.#
|
|
1370
|
+
r >= 0 && this.#h(r);
|
|
1398
1371
|
};
|
|
1399
|
-
#
|
|
1372
|
+
#u = (t) => {
|
|
1400
1373
|
const e = t.target;
|
|
1401
1374
|
!this.contains(e) && this.state === "open" && this.close();
|
|
1402
1375
|
};
|
|
@@ -1405,7 +1378,7 @@ class rt extends u {
|
|
|
1405
1378
|
const t = this.$('[data-ry-target="input"]');
|
|
1406
1379
|
t && t.value && t.select(), this.open();
|
|
1407
1380
|
};
|
|
1408
|
-
#
|
|
1381
|
+
#d(t) {
|
|
1409
1382
|
const e = t.dataset.value ?? "", s = t.textContent?.trim() ?? "", i = this.$('[data-ry-target="input"]');
|
|
1410
1383
|
i && (i.value = s);
|
|
1411
1384
|
const r = this.$('[data-ry-target="native"]');
|
|
@@ -1413,7 +1386,7 @@ class rt extends u {
|
|
|
1413
1386
|
a.removeAttribute("aria-selected");
|
|
1414
1387
|
}), t.setAttribute("aria-selected", "true"), this.close(), this.emit("change", { value: e, label: s });
|
|
1415
1388
|
}
|
|
1416
|
-
#
|
|
1389
|
+
#h(t) {
|
|
1417
1390
|
const e = this.$$(
|
|
1418
1391
|
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1419
1392
|
);
|
|
@@ -1427,15 +1400,15 @@ class rt extends u {
|
|
|
1427
1400
|
const i = this.$('[data-ry-target="input-wrapper"]');
|
|
1428
1401
|
i && i.setAttribute("aria-activedescendant", s.id);
|
|
1429
1402
|
}
|
|
1430
|
-
#
|
|
1403
|
+
#b() {
|
|
1431
1404
|
const t = this.$$('[data-ry-target="option"]:not([hidden]):not([data-disabled])'), e = Math.min(this.#e + 1, t.length - 1);
|
|
1432
|
-
this.#
|
|
1405
|
+
this.#h(e);
|
|
1433
1406
|
}
|
|
1434
1407
|
#f() {
|
|
1435
1408
|
const t = Math.max(this.#e - 1, 0);
|
|
1436
|
-
this.#
|
|
1409
|
+
this.#h(t);
|
|
1437
1410
|
}
|
|
1438
|
-
#
|
|
1411
|
+
#A() {
|
|
1439
1412
|
const t = this.$('[data-ry-target="dropdown"]');
|
|
1440
1413
|
if (!t) return;
|
|
1441
1414
|
this.removeAttribute("data-ry-position");
|
|
@@ -1450,13 +1423,13 @@ class rt extends u {
|
|
|
1450
1423
|
i.hasAttribute("data-disabled") || i.removeAttribute("hidden");
|
|
1451
1424
|
});
|
|
1452
1425
|
const e = this.$('[data-ry-target="empty"]');
|
|
1453
|
-
e && e.setAttribute("hidden", ""), this.#
|
|
1426
|
+
e && e.setAttribute("hidden", ""), this.#A();
|
|
1454
1427
|
const s = this.getAttribute("value");
|
|
1455
1428
|
if (s) {
|
|
1456
1429
|
const r = this.$$(
|
|
1457
1430
|
'[data-ry-target="option"]:not([hidden]):not([data-disabled])'
|
|
1458
1431
|
).findIndex((a) => a.dataset.value === s);
|
|
1459
|
-
r >= 0 && this.#
|
|
1432
|
+
r >= 0 && this.#h(r);
|
|
1460
1433
|
}
|
|
1461
1434
|
this.emit("open");
|
|
1462
1435
|
}
|
|
@@ -1476,11 +1449,11 @@ class rt extends u {
|
|
|
1476
1449
|
}
|
|
1477
1450
|
set value(t) {
|
|
1478
1451
|
const e = this.$(`[data-ry-target="option"][data-value="${t}"]`);
|
|
1479
|
-
e && this.#
|
|
1452
|
+
e && this.#d(e);
|
|
1480
1453
|
}
|
|
1481
1454
|
}
|
|
1482
|
-
customElements.define("ry-combobox",
|
|
1483
|
-
class
|
|
1455
|
+
customElements.define("ry-combobox", at);
|
|
1456
|
+
class nt extends u {
|
|
1484
1457
|
#t = "";
|
|
1485
1458
|
static get observedAttributes() {
|
|
1486
1459
|
return ["language", "title", "line-numbers"];
|
|
@@ -1498,7 +1471,7 @@ class at extends u {
|
|
|
1498
1471
|
<div data-ry-target="header" class="ry-code__header">
|
|
1499
1472
|
<span data-ry-target="title" class="ry-code__title">${e}</span>
|
|
1500
1473
|
<button data-ry-target="copy" class="ry-code__copy" type="button" aria-label="Copy code">
|
|
1501
|
-
${
|
|
1474
|
+
${g("copy")}
|
|
1502
1475
|
</button>
|
|
1503
1476
|
</div>
|
|
1504
1477
|
<div data-ry-target="content" class="ry-code__content">
|
|
@@ -1510,8 +1483,8 @@ class at extends u {
|
|
|
1510
1483
|
const t = this.$('[data-ry-target="copy"]');
|
|
1511
1484
|
if (t)
|
|
1512
1485
|
try {
|
|
1513
|
-
await navigator.clipboard.writeText(this.#t), t.innerHTML =
|
|
1514
|
-
t.innerHTML =
|
|
1486
|
+
await navigator.clipboard.writeText(this.#t), t.innerHTML = g("check"), t.classList.add("ry-code__copy--success"), this.emit("copy", { code: this.#t }), setTimeout(() => {
|
|
1487
|
+
t.innerHTML = g("copy"), t.classList.remove("ry-code__copy--success");
|
|
1515
1488
|
}, 2e3);
|
|
1516
1489
|
} catch {
|
|
1517
1490
|
this.emit("copy-error");
|
|
@@ -1527,9 +1500,9 @@ class at extends u {
|
|
|
1527
1500
|
case "html":
|
|
1528
1501
|
return this.#o(t);
|
|
1529
1502
|
case "json":
|
|
1530
|
-
return this.#
|
|
1503
|
+
return this.#l(t);
|
|
1531
1504
|
default:
|
|
1532
|
-
return this.#
|
|
1505
|
+
return this.#u(t);
|
|
1533
1506
|
}
|
|
1534
1507
|
}
|
|
1535
1508
|
#r(t) {
|
|
@@ -1537,9 +1510,9 @@ class at extends u {
|
|
|
1537
1510
|
let s = t;
|
|
1538
1511
|
for (; s.length > 0; ) {
|
|
1539
1512
|
if (s.startsWith("/*")) {
|
|
1540
|
-
const
|
|
1541
|
-
if (
|
|
1542
|
-
e.push({ type: "comment", value: s.slice(0,
|
|
1513
|
+
const y = s.indexOf("*/");
|
|
1514
|
+
if (y !== -1) {
|
|
1515
|
+
e.push({ type: "comment", value: s.slice(0, y + 2) }), s = s.slice(y + 2);
|
|
1543
1516
|
continue;
|
|
1544
1517
|
}
|
|
1545
1518
|
}
|
|
@@ -1583,16 +1556,16 @@ class at extends u {
|
|
|
1583
1556
|
e.push({ type: "text", value: d[1] }), s = s.slice(d[1].length);
|
|
1584
1557
|
continue;
|
|
1585
1558
|
}
|
|
1586
|
-
const
|
|
1587
|
-
if (
|
|
1588
|
-
const
|
|
1589
|
-
["inherit", "initial", "unset", "none", "auto", "transparent", "solid", "dashed", "dotted", "flex", "grid", "block", "inline", "inline-block", "absolute", "relative", "fixed", "sticky"].includes(
|
|
1559
|
+
const p = s.match(/^([\w-]+)/);
|
|
1560
|
+
if (p?.[1]) {
|
|
1561
|
+
const y = p[1];
|
|
1562
|
+
["inherit", "initial", "unset", "none", "auto", "transparent", "solid", "dashed", "dotted", "flex", "grid", "block", "inline", "inline-block", "absolute", "relative", "fixed", "sticky"].includes(y) ? e.push({ type: "keyword", value: y }) : e.push({ type: "value", value: y }), s = s.slice(y.length);
|
|
1590
1563
|
continue;
|
|
1591
1564
|
}
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1565
|
+
const f = s[0];
|
|
1566
|
+
f && e.push({ type: "text", value: f }), s = s.slice(1);
|
|
1594
1567
|
}
|
|
1595
|
-
return e.map((i) => this.#
|
|
1568
|
+
return e.map((i) => this.#c(i)).join("");
|
|
1596
1569
|
}
|
|
1597
1570
|
#a(t) {
|
|
1598
1571
|
const e = [];
|
|
@@ -1646,7 +1619,7 @@ class at extends u {
|
|
|
1646
1619
|
const c = s[0];
|
|
1647
1620
|
c && e.push({ type: "text", value: c }), s = s.slice(1);
|
|
1648
1621
|
}
|
|
1649
|
-
return e.map((r) => this.#
|
|
1622
|
+
return e.map((r) => this.#c(r)).join("");
|
|
1650
1623
|
}
|
|
1651
1624
|
#o(t) {
|
|
1652
1625
|
const e = [];
|
|
@@ -1692,9 +1665,9 @@ class at extends u {
|
|
|
1692
1665
|
const l = s[0];
|
|
1693
1666
|
l && e.push({ type: "text", value: l }), s = s.slice(1);
|
|
1694
1667
|
}
|
|
1695
|
-
return e.map((i) => this.#
|
|
1668
|
+
return e.map((i) => this.#c(i)).join("");
|
|
1696
1669
|
}
|
|
1697
|
-
#
|
|
1670
|
+
#l(t) {
|
|
1698
1671
|
const e = [];
|
|
1699
1672
|
let s = t;
|
|
1700
1673
|
for (; s.length > 0; ) {
|
|
@@ -1726,10 +1699,10 @@ class at extends u {
|
|
|
1726
1699
|
const l = s[0];
|
|
1727
1700
|
l && e.push({ type: "text", value: l }), s = s.slice(1);
|
|
1728
1701
|
}
|
|
1729
|
-
return e.map((i) => this.#
|
|
1702
|
+
return e.map((i) => this.#c(i)).join("");
|
|
1730
1703
|
}
|
|
1731
|
-
#
|
|
1732
|
-
const e = this.#
|
|
1704
|
+
#c(t) {
|
|
1705
|
+
const e = this.#u(t.value);
|
|
1733
1706
|
switch (t.type) {
|
|
1734
1707
|
case "keyword":
|
|
1735
1708
|
return `<span class="ry-code__keyword">${e}</span>`;
|
|
@@ -1757,7 +1730,7 @@ class at extends u {
|
|
|
1757
1730
|
return e;
|
|
1758
1731
|
}
|
|
1759
1732
|
}
|
|
1760
|
-
#
|
|
1733
|
+
#u(t) {
|
|
1761
1734
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1762
1735
|
}
|
|
1763
1736
|
#n(t) {
|
|
@@ -1779,12 +1752,12 @@ class at extends u {
|
|
|
1779
1752
|
this.#t = t, this.#e();
|
|
1780
1753
|
}
|
|
1781
1754
|
}
|
|
1782
|
-
customElements.define("ry-code",
|
|
1783
|
-
class
|
|
1755
|
+
customElements.define("ry-code", nt);
|
|
1756
|
+
class ot extends u {
|
|
1784
1757
|
setup() {
|
|
1785
1758
|
const t = this.$("template");
|
|
1786
1759
|
if (!t) return;
|
|
1787
|
-
const e = this.$('script[slot="js"]'), s = e ? this.#e(e.textContent ?? "") : null, i = this.#e(t.innerHTML), r =
|
|
1760
|
+
const e = this.$('script[slot="js"]'), s = e ? this.#e(e.textContent ?? "") : null, i = this.#e(t.innerHTML), r = C(i), a = this.hasAttribute("stacked");
|
|
1788
1761
|
this.innerHTML = `
|
|
1789
1762
|
<div data-ry-target="preview" class="ry-example__preview"></div>
|
|
1790
1763
|
<div data-ry-target="code" class="ry-example__code"></div>
|
|
@@ -1824,8 +1797,8 @@ class nt extends u {
|
|
|
1824
1797
|
`).trim();
|
|
1825
1798
|
}
|
|
1826
1799
|
}
|
|
1827
|
-
customElements.define("ry-example",
|
|
1828
|
-
class
|
|
1800
|
+
customElements.define("ry-example", ot);
|
|
1801
|
+
class ht extends u {
|
|
1829
1802
|
static get observedAttributes() {
|
|
1830
1803
|
return ["name", "size", "label"];
|
|
1831
1804
|
}
|
|
@@ -1836,7 +1809,7 @@ class ot extends u {
|
|
|
1836
1809
|
e !== s && this.hasAttribute("data-ry-initialized") && this.#t();
|
|
1837
1810
|
}
|
|
1838
1811
|
#t() {
|
|
1839
|
-
const t = this.getAttribute("name") ?? "", e = this.getAttribute("size") ?? "24", s = this.getAttribute("label"), i =
|
|
1812
|
+
const t = this.getAttribute("name") ?? "", e = this.getAttribute("size") ?? "24", s = this.getAttribute("label"), i = g(t);
|
|
1840
1813
|
if (!i) {
|
|
1841
1814
|
this.innerHTML = "";
|
|
1842
1815
|
return;
|
|
@@ -1858,24 +1831,24 @@ class ot extends u {
|
|
|
1858
1831
|
this.setAttribute("size", String(t));
|
|
1859
1832
|
}
|
|
1860
1833
|
}
|
|
1861
|
-
customElements.define("ry-icon",
|
|
1862
|
-
const
|
|
1863
|
-
function
|
|
1834
|
+
customElements.define("ry-icon", ht);
|
|
1835
|
+
const lt = ["form", "section", "fieldset", "ry-section"], v = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Set();
|
|
1836
|
+
function ct(h) {
|
|
1864
1837
|
let t = h.parentElement;
|
|
1865
1838
|
for (; t; ) {
|
|
1866
|
-
if (
|
|
1839
|
+
if (lt.some((e) => t.matches(e)))
|
|
1867
1840
|
return t;
|
|
1868
1841
|
t = t.parentElement;
|
|
1869
1842
|
}
|
|
1870
1843
|
return null;
|
|
1871
1844
|
}
|
|
1872
|
-
function
|
|
1873
|
-
if (
|
|
1874
|
-
const t =
|
|
1845
|
+
function dt(h) {
|
|
1846
|
+
if (S.has(h)) return;
|
|
1847
|
+
const t = v.get(h);
|
|
1875
1848
|
if (!t || t.size < 2) return;
|
|
1876
1849
|
const e = /* @__PURE__ */ new Map();
|
|
1877
1850
|
for (const s of t) {
|
|
1878
|
-
const i =
|
|
1851
|
+
const i = ct(s), r = e.get(i) ?? [];
|
|
1879
1852
|
r.push(s), e.set(i, r);
|
|
1880
1853
|
}
|
|
1881
1854
|
if (e.size > 1) {
|
|
@@ -1888,10 +1861,10 @@ function ct(h) {
|
|
|
1888
1861
|
s.push("(no container)");
|
|
1889
1862
|
console.warn(
|
|
1890
1863
|
`ry-toggle-button: Buttons with name="${h}" span multiple containers (${s.join(", ")}). Intentional?`
|
|
1891
|
-
),
|
|
1864
|
+
), S.add(h);
|
|
1892
1865
|
}
|
|
1893
1866
|
}
|
|
1894
|
-
class
|
|
1867
|
+
class ut extends u {
|
|
1895
1868
|
static observedAttributes = ["pressed", "disabled", "name", "value"];
|
|
1896
1869
|
#t = !1;
|
|
1897
1870
|
setup() {
|
|
@@ -1902,12 +1875,12 @@ class dt extends u {
|
|
|
1902
1875
|
}
|
|
1903
1876
|
#e() {
|
|
1904
1877
|
const t = this.name;
|
|
1905
|
-
t && (
|
|
1878
|
+
t && (v.has(t) || v.set(t, /* @__PURE__ */ new Set()), v.get(t).add(this), this.#t = !0, queueMicrotask(() => dt(t)));
|
|
1906
1879
|
}
|
|
1907
1880
|
#i() {
|
|
1908
1881
|
if (!this.#t) return;
|
|
1909
1882
|
const t = this.name;
|
|
1910
|
-
t &&
|
|
1883
|
+
t && v.has(t) && (v.get(t).delete(this), v.get(t).size === 0 && (v.delete(t), S.delete(t))), this.#t = !1;
|
|
1911
1884
|
}
|
|
1912
1885
|
#s = (t) => {
|
|
1913
1886
|
if (this.disabled) {
|
|
@@ -1922,7 +1895,7 @@ class dt extends u {
|
|
|
1922
1895
|
#a() {
|
|
1923
1896
|
const t = this.name;
|
|
1924
1897
|
if (!t) return;
|
|
1925
|
-
const e =
|
|
1898
|
+
const e = v.get(t);
|
|
1926
1899
|
if (e)
|
|
1927
1900
|
for (const s of e)
|
|
1928
1901
|
s !== this && s.pressed && (s.pressed = !1);
|
|
@@ -1963,8 +1936,8 @@ class dt extends u {
|
|
|
1963
1936
|
this.setAttribute("icon", t);
|
|
1964
1937
|
}
|
|
1965
1938
|
}
|
|
1966
|
-
customElements.define("ry-toggle-button",
|
|
1967
|
-
class
|
|
1939
|
+
customElements.define("ry-toggle-button", ut);
|
|
1940
|
+
class pt extends u {
|
|
1968
1941
|
#t = !1;
|
|
1969
1942
|
#e = null;
|
|
1970
1943
|
#i = null;
|
|
@@ -1973,7 +1946,7 @@ class ut extends u {
|
|
|
1973
1946
|
#a = /* @__PURE__ */ new Map();
|
|
1974
1947
|
static observedAttributes = ["min", "max", "step", "value", "start", "end", "disabled"];
|
|
1975
1948
|
setup() {
|
|
1976
|
-
this.#o(), this.#
|
|
1949
|
+
this.#o(), this.#c(), this.#y();
|
|
1977
1950
|
}
|
|
1978
1951
|
#o() {
|
|
1979
1952
|
const t = this.hasAttribute("range"), e = this.hasAttribute("labeled"), s = this.hasAttribute("tooltip");
|
|
@@ -1993,9 +1966,9 @@ class ut extends u {
|
|
|
1993
1966
|
<div data-ry-target="thumb-value" class="ry-slider__thumb" tabindex="0" role="slider" aria-label="Value">
|
|
1994
1967
|
${s ? '<span data-ry-target="tooltip-value" class="ry-slider__tooltip"></span>' : ""}
|
|
1995
1968
|
</div>
|
|
1996
|
-
`, i += "</div>", e && (i += this.#
|
|
1969
|
+
`, 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"]')));
|
|
1997
1970
|
}
|
|
1998
|
-
#
|
|
1971
|
+
#l() {
|
|
1999
1972
|
const t = this.min, e = this.max, s = this.getAttribute("labels")?.split(","), i = this.getAttribute("label-type") || "number";
|
|
2000
1973
|
let r = [];
|
|
2001
1974
|
if (s)
|
|
@@ -2016,34 +1989,34 @@ class ut extends u {
|
|
|
2016
1989
|
</div>
|
|
2017
1990
|
`;
|
|
2018
1991
|
}
|
|
2019
|
-
#
|
|
2020
|
-
this.#i && this.on(this.#i, "pointerdown", this.#
|
|
1992
|
+
#c() {
|
|
1993
|
+
this.#i && this.on(this.#i, "pointerdown", this.#u);
|
|
2021
1994
|
for (const [t, e] of this.#r)
|
|
2022
|
-
this.on(e, "pointerdown", (s) => this.#n(s, t)), this.on(e, "keydown", (s) => this.#
|
|
2023
|
-
this.on(document, "pointermove", this.#
|
|
1995
|
+
this.on(e, "pointerdown", (s) => this.#n(s, t)), this.on(e, "keydown", (s) => this.#b(s, t));
|
|
1996
|
+
this.on(document, "pointermove", this.#d), this.on(document, "pointerup", this.#h);
|
|
2024
1997
|
}
|
|
2025
|
-
#
|
|
1998
|
+
#u = (t) => {
|
|
2026
1999
|
if (this.disabled) return;
|
|
2027
|
-
const e = this.#
|
|
2000
|
+
const e = this.#A(t);
|
|
2028
2001
|
if (this.hasAttribute("range")) {
|
|
2029
2002
|
const i = Math.abs(e - this.start), r = Math.abs(e - this.end);
|
|
2030
2003
|
i < r ? (this.start = e, this.#e = "start") : (this.end = e, this.#e = "end");
|
|
2031
2004
|
} else
|
|
2032
2005
|
this.value = e, this.#e = "value";
|
|
2033
|
-
this.#t = !0, this.#
|
|
2006
|
+
this.#t = !0, this.#y(), this.#m();
|
|
2034
2007
|
};
|
|
2035
2008
|
#n = (t, e) => {
|
|
2036
2009
|
this.disabled || (t.stopPropagation(), this.#t = !0, this.#e = e, t.target.setPointerCapture(t.pointerId));
|
|
2037
2010
|
};
|
|
2038
|
-
#
|
|
2011
|
+
#d = (t) => {
|
|
2039
2012
|
if (!this.#t || !this.#e) return;
|
|
2040
|
-
const e = this.#
|
|
2041
|
-
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.#
|
|
2013
|
+
const e = this.#A(t);
|
|
2014
|
+
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.#y(), this.#m();
|
|
2042
2015
|
};
|
|
2043
|
-
#
|
|
2016
|
+
#h = () => {
|
|
2044
2017
|
this.#t && (this.#t = !1, this.#e = null, this.#M());
|
|
2045
2018
|
};
|
|
2046
|
-
#
|
|
2019
|
+
#b = (t, e) => {
|
|
2047
2020
|
if (this.disabled) return;
|
|
2048
2021
|
const s = this.step || 1, i = (this.max - this.min) / 10;
|
|
2049
2022
|
let r = 0;
|
|
@@ -2072,13 +2045,13 @@ class ut extends u {
|
|
|
2072
2045
|
return;
|
|
2073
2046
|
}
|
|
2074
2047
|
t.preventDefault();
|
|
2075
|
-
const a = this.#
|
|
2076
|
-
e === "start" ? this.start = Math.min(a, this.end) : e === "end" ? this.end = Math.max(a, this.start) : this.value = a, this.#
|
|
2048
|
+
const a = this.#p(this.#f(e) + r);
|
|
2049
|
+
e === "start" ? this.start = Math.min(a, this.end) : e === "end" ? this.end = Math.max(a, this.start) : this.value = a, this.#y(), this.#m(), this.#M();
|
|
2077
2050
|
};
|
|
2078
2051
|
#f(t) {
|
|
2079
2052
|
return t === "start" ? this.start : t === "end" ? this.end : this.value;
|
|
2080
2053
|
}
|
|
2081
|
-
#
|
|
2054
|
+
#A(t) {
|
|
2082
2055
|
if (!this.#i) return this.min;
|
|
2083
2056
|
const e = this.#i.getBoundingClientRect(), s = this.hasAttribute("vertical"), i = this.hasAttribute("reversed");
|
|
2084
2057
|
let r;
|
|
@@ -2088,14 +2061,14 @@ class ut extends u {
|
|
|
2088
2061
|
}
|
|
2089
2062
|
#g(t) {
|
|
2090
2063
|
const e = this.step;
|
|
2091
|
-
if (e === 0) return this.#
|
|
2064
|
+
if (e === 0) return this.#p(t);
|
|
2092
2065
|
const s = Math.round((t - this.min) / e) * e + this.min;
|
|
2093
|
-
return this.#
|
|
2066
|
+
return this.#p(s);
|
|
2094
2067
|
}
|
|
2095
|
-
#
|
|
2068
|
+
#p(t) {
|
|
2096
2069
|
return Math.max(this.min, Math.min(this.max, t));
|
|
2097
2070
|
}
|
|
2098
|
-
#
|
|
2071
|
+
#y() {
|
|
2099
2072
|
const t = this.hasAttribute("range"), e = this.hasAttribute("vertical"), s = this.hasAttribute("reversed"), i = (r) => {
|
|
2100
2073
|
let a = (r - this.min) / (this.max - this.min) * 100;
|
|
2101
2074
|
return s && (a = 100 - a), a;
|
|
@@ -2119,7 +2092,7 @@ class ut extends u {
|
|
|
2119
2092
|
s.textContent = e.toFixed(i);
|
|
2120
2093
|
}
|
|
2121
2094
|
}
|
|
2122
|
-
#
|
|
2095
|
+
#m() {
|
|
2123
2096
|
this.hasAttribute("range") ? this.emit("input", { start: this.start, end: this.end }) : this.emit("input", { value: this.value });
|
|
2124
2097
|
}
|
|
2125
2098
|
#M() {
|
|
@@ -2148,19 +2121,19 @@ class ut extends u {
|
|
|
2148
2121
|
return parseFloat(this.getAttribute("value") ?? String(this.min));
|
|
2149
2122
|
}
|
|
2150
2123
|
set value(t) {
|
|
2151
|
-
this.setAttribute("value", String(this.#
|
|
2124
|
+
this.setAttribute("value", String(this.#p(t)));
|
|
2152
2125
|
}
|
|
2153
2126
|
get start() {
|
|
2154
2127
|
return parseFloat(this.getAttribute("start") ?? String(this.min));
|
|
2155
2128
|
}
|
|
2156
2129
|
set start(t) {
|
|
2157
|
-
this.setAttribute("start", String(this.#
|
|
2130
|
+
this.setAttribute("start", String(this.#p(t)));
|
|
2158
2131
|
}
|
|
2159
2132
|
get end() {
|
|
2160
2133
|
return parseFloat(this.getAttribute("end") ?? String(this.max));
|
|
2161
2134
|
}
|
|
2162
2135
|
set end(t) {
|
|
2163
|
-
this.setAttribute("end", String(this.#
|
|
2136
|
+
this.setAttribute("end", String(this.#p(t)));
|
|
2164
2137
|
}
|
|
2165
2138
|
get disabled() {
|
|
2166
2139
|
return this.hasAttribute("disabled");
|
|
@@ -2169,8 +2142,8 @@ class ut extends u {
|
|
|
2169
2142
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
2170
2143
|
}
|
|
2171
2144
|
}
|
|
2172
|
-
customElements.define("ry-slider",
|
|
2173
|
-
class
|
|
2145
|
+
customElements.define("ry-slider", pt);
|
|
2146
|
+
class gt extends u {
|
|
2174
2147
|
#t = !1;
|
|
2175
2148
|
#e = 0;
|
|
2176
2149
|
#i = 0;
|
|
@@ -2179,7 +2152,7 @@ class pt extends u {
|
|
|
2179
2152
|
#a = null;
|
|
2180
2153
|
static observedAttributes = ["min", "max", "step", "value", "disabled", "label", "labels", "description"];
|
|
2181
2154
|
setup() {
|
|
2182
|
-
this.#o(), this.#
|
|
2155
|
+
this.#o(), this.#l(), this.#p();
|
|
2183
2156
|
}
|
|
2184
2157
|
#o() {
|
|
2185
2158
|
const t = this.getAttribute("label"), e = this.getAttribute("description"), s = e ? ` title="${e}"` : "";
|
|
@@ -2193,24 +2166,24 @@ class pt extends u {
|
|
|
2193
2166
|
${t ? `<span data-ry-target="label" class="ry-knob__label"${s}>${t}</span>` : ""}
|
|
2194
2167
|
`, this.#s = this.$('[data-ry-target="ring"]'), this.#r = this.$('[data-ry-target="indicator"]'), this.#a = this.$('[data-ry-target="display"]');
|
|
2195
2168
|
}
|
|
2196
|
-
#
|
|
2197
|
-
this.#s && (this.on(this.#s, "mousedown", this.#
|
|
2169
|
+
#l() {
|
|
2170
|
+
this.#s && (this.on(this.#s, "mousedown", this.#c), this.on(document, "mousemove", this.#u), this.on(document, "mouseup", this.#n), this.on(this.#s, "touchstart", this.#d), this.on(document, "touchmove", this.#h), this.on(document, "touchend", this.#b), this.on(this.#s, "wheel", this.#f), this.on(this, "keydown", this.#A));
|
|
2198
2171
|
}
|
|
2199
|
-
#
|
|
2172
|
+
#c = (t) => {
|
|
2200
2173
|
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", ""));
|
|
2201
2174
|
};
|
|
2202
|
-
#
|
|
2175
|
+
#u = (t) => {
|
|
2203
2176
|
if (!this.#t) return;
|
|
2204
2177
|
const e = this.#e - t.clientY, s = (this.max - this.min) / 100;
|
|
2205
2178
|
this.#g(this.#i + e * s);
|
|
2206
2179
|
};
|
|
2207
2180
|
#n = () => {
|
|
2208
|
-
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#
|
|
2181
|
+
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#m());
|
|
2209
2182
|
};
|
|
2210
|
-
#
|
|
2183
|
+
#d = (t) => {
|
|
2211
2184
|
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", ""));
|
|
2212
2185
|
};
|
|
2213
|
-
#
|
|
2186
|
+
#h = (t) => {
|
|
2214
2187
|
if (!this.#t) return;
|
|
2215
2188
|
t.preventDefault();
|
|
2216
2189
|
const e = t.touches[0];
|
|
@@ -2218,16 +2191,16 @@ class pt extends u {
|
|
|
2218
2191
|
const s = this.#e - e.clientY, i = (this.max - this.min) / 100;
|
|
2219
2192
|
this.#g(this.#i + s * i);
|
|
2220
2193
|
};
|
|
2221
|
-
#
|
|
2222
|
-
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#
|
|
2194
|
+
#b = () => {
|
|
2195
|
+
this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#m());
|
|
2223
2196
|
};
|
|
2224
2197
|
#f = (t) => {
|
|
2225
2198
|
if (this.disabled) return;
|
|
2226
2199
|
t.preventDefault();
|
|
2227
2200
|
const e = this.step || (this.max - this.min) / 50, s = t.deltaY < 0 ? e : -e;
|
|
2228
|
-
this.#g(this.value + s), this.#
|
|
2201
|
+
this.#g(this.value + s), this.#m();
|
|
2229
2202
|
};
|
|
2230
|
-
#
|
|
2203
|
+
#A = (t) => {
|
|
2231
2204
|
if (this.disabled) return;
|
|
2232
2205
|
const e = this.step || 1, s = (this.max - this.min) / 10;
|
|
2233
2206
|
let i = 0;
|
|
@@ -2247,26 +2220,26 @@ class pt extends u {
|
|
|
2247
2220
|
i = -s;
|
|
2248
2221
|
break;
|
|
2249
2222
|
case "Home":
|
|
2250
|
-
this.#g(this.min), this.#
|
|
2223
|
+
this.#g(this.min), this.#m();
|
|
2251
2224
|
return;
|
|
2252
2225
|
case "End":
|
|
2253
|
-
this.#g(this.max), this.#
|
|
2226
|
+
this.#g(this.max), this.#m();
|
|
2254
2227
|
return;
|
|
2255
2228
|
default:
|
|
2256
2229
|
return;
|
|
2257
2230
|
}
|
|
2258
|
-
t.preventDefault(), this.#g(this.value + i), this.#
|
|
2231
|
+
t.preventDefault(), this.#g(this.value + i), this.#m();
|
|
2259
2232
|
};
|
|
2260
2233
|
#g(t) {
|
|
2261
2234
|
let e = Math.max(this.min, Math.min(this.max, t));
|
|
2262
2235
|
const s = this.step;
|
|
2263
|
-
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.#
|
|
2236
|
+
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.#p(), this.#v();
|
|
2264
2237
|
}
|
|
2265
|
-
#
|
|
2238
|
+
#p() {
|
|
2266
2239
|
const t = (this.value - this.min) / (this.max - this.min), e = -135 + t * 270;
|
|
2267
|
-
this.#s && (this.#s.style.setProperty("--knob-rotation", `${e}deg`), this.#s.style.setProperty("--knob-percent", String(t))), this.#a && (this.#a.textContent = this.#
|
|
2240
|
+
this.#s && (this.#s.style.setProperty("--knob-rotation", `${e}deg`), this.#s.style.setProperty("--knob-percent", String(t))), this.#a && (this.#a.textContent = this.#y(this.value)), this.setAttribute("aria-valuenow", String(this.value)), this.setAttribute("aria-valuemin", String(this.min)), this.setAttribute("aria-valuemax", String(this.max));
|
|
2268
2241
|
}
|
|
2269
|
-
#
|
|
2242
|
+
#y(t) {
|
|
2270
2243
|
const e = this.getAttribute("labels");
|
|
2271
2244
|
if (e) {
|
|
2272
2245
|
const i = e.split(","), r = Math.round(t);
|
|
@@ -2278,12 +2251,12 @@ class pt extends u {
|
|
|
2278
2251
|
const t = (this.value - this.min) / (this.max - this.min);
|
|
2279
2252
|
this.emit("input", { value: this.value, percent: t });
|
|
2280
2253
|
}
|
|
2281
|
-
#
|
|
2254
|
+
#m() {
|
|
2282
2255
|
const t = (this.value - this.min) / (this.max - this.min);
|
|
2283
2256
|
this.emit("change", { value: this.value, percent: t });
|
|
2284
2257
|
}
|
|
2285
2258
|
attributeChangedCallback(t, e, s) {
|
|
2286
|
-
e !== s && t === "value" && this.#s && this.#
|
|
2259
|
+
e !== s && t === "value" && this.#s && this.#p();
|
|
2287
2260
|
}
|
|
2288
2261
|
// --- Public API ---
|
|
2289
2262
|
get min() {
|
|
@@ -2317,9 +2290,9 @@ class pt extends u {
|
|
|
2317
2290
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
2318
2291
|
}
|
|
2319
2292
|
}
|
|
2320
|
-
customElements.define("ry-knob",
|
|
2321
|
-
const
|
|
2322
|
-
class
|
|
2293
|
+
customElements.define("ry-knob", gt);
|
|
2294
|
+
const L = 15, I = 3;
|
|
2295
|
+
class ft extends u {
|
|
2323
2296
|
#t = null;
|
|
2324
2297
|
#e = null;
|
|
2325
2298
|
#i = null;
|
|
@@ -2327,49 +2300,49 @@ class gt extends u {
|
|
|
2327
2300
|
#r = null;
|
|
2328
2301
|
#a = !1;
|
|
2329
2302
|
#o = 0;
|
|
2330
|
-
#h = 0;
|
|
2331
2303
|
#l = 0;
|
|
2332
|
-
#c =
|
|
2304
|
+
#c = 0;
|
|
2305
|
+
#u = !1;
|
|
2333
2306
|
#n = null;
|
|
2334
|
-
#
|
|
2307
|
+
#d = null;
|
|
2335
2308
|
static observedAttributes = ["min", "max", "step", "value", "disabled", "arrows", "icons", "drag", "editable", "wrap", "label", "prefix", "suffix"];
|
|
2336
2309
|
setup() {
|
|
2337
|
-
this.#
|
|
2310
|
+
this.#h(), this.#f(), this.#A(), this.#$();
|
|
2338
2311
|
}
|
|
2339
|
-
#
|
|
2340
|
-
const t = this.getAttribute("arrows") ?? "both", e = this.getAttribute("label"), s = t === "stacked" || t === "stacked-end" || t === "stacked-start", [i, r] = this.#
|
|
2312
|
+
#h() {
|
|
2313
|
+
const t = this.getAttribute("arrows") ?? "both", e = this.getAttribute("label"), s = t === "stacked" || t === "stacked-end" || t === "stacked-start", [i, r] = this.#b(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>` : "", p = `
|
|
2341
2314
|
<div data-ry-target="display" class="ry-number-select__display" tabindex="0" role="spinbutton"
|
|
2342
2315
|
aria-valuenow="${this.value}" aria-valuemin="${this.min}" aria-valuemax="${this.max}"
|
|
2343
2316
|
${e ? `aria-label="${e}"` : ""}>
|
|
2344
2317
|
${o ? `<span data-ry-target="prefix" class="ry-number-select__affix">${o}</span>` : ""}
|
|
2345
|
-
<span data-ry-target="value" class="ry-number-select__value">${this.#
|
|
2318
|
+
<span data-ry-target="value" class="ry-number-select__value">${this.#O(this.value)}</span>
|
|
2346
2319
|
${l ? `<span data-ry-target="suffix" class="ry-number-select__affix">${l}</span>` : ""}
|
|
2347
2320
|
<input data-ry-target="input" class="ry-number-select__input" type="text" inputmode="decimal" tabindex="-1">
|
|
2348
|
-
</div>`,
|
|
2321
|
+
</div>`, f = e ? `<span data-ry-target="label" class="ry-number-select__label">${e}</span>` : "";
|
|
2349
2322
|
if (t === "stacked")
|
|
2350
|
-
this.innerHTML = `${d}${
|
|
2323
|
+
this.innerHTML = `${d}${p}${c}${f}`;
|
|
2351
2324
|
else if (t === "stacked-end") {
|
|
2352
|
-
const
|
|
2353
|
-
this.innerHTML = `${
|
|
2325
|
+
const y = `<div data-ry-target="btn-group" class="ry-number-select__btn-group">${d}${c}</div>`;
|
|
2326
|
+
this.innerHTML = `${p}${y}${f}`;
|
|
2354
2327
|
} else if (t === "stacked-start") {
|
|
2355
|
-
const
|
|
2356
|
-
this.innerHTML = `${
|
|
2328
|
+
const y = `<div data-ry-target="btn-group" class="ry-number-select__btn-group">${d}${c}</div>`;
|
|
2329
|
+
this.innerHTML = `${y}${p}${f}`;
|
|
2357
2330
|
} else
|
|
2358
|
-
this.innerHTML = `${c}${
|
|
2331
|
+
this.innerHTML = `${c}${p}${d}${f}`;
|
|
2359
2332
|
}
|
|
2360
|
-
#
|
|
2333
|
+
#b(t) {
|
|
2361
2334
|
const e = this.getAttribute("icons") ?? "plus-minus";
|
|
2362
|
-
return e === "chevron" ? t ? [
|
|
2335
|
+
return e === "chevron" ? t ? [g("chevron-down") ?? "▾", g("chevron-up") ?? "▴"] : [g("chevron-left") ?? "‹", g("chevron-right") ?? "›"] : e === "arrow" ? t ? [g("chevron-down") ?? "▼", g("chevron-up") ?? "▲"] : [g("chevron-left") ?? "◀", g("chevron-right") ?? "▶"] : [g("minus") ?? "−", g("plus") ?? "+"];
|
|
2363
2336
|
}
|
|
2364
2337
|
#f() {
|
|
2365
2338
|
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"]');
|
|
2366
2339
|
}
|
|
2367
|
-
#
|
|
2340
|
+
#A() {
|
|
2368
2341
|
this.#s && (this.on(this.#s, "mousedown", (t) => {
|
|
2369
2342
|
t.preventDefault(), this.#g(-1);
|
|
2370
|
-
}), this.on(this.#s, "mouseup", () => this.#
|
|
2343
|
+
}), this.on(this.#s, "mouseup", () => this.#p()), this.on(this.#s, "mouseleave", () => this.#p())), this.#r && (this.on(this.#r, "mousedown", (t) => {
|
|
2371
2344
|
t.preventDefault(), this.#g(1);
|
|
2372
|
-
}), this.on(this.#r, "mouseup", () => this.#
|
|
2345
|
+
}), this.on(this.#r, "mouseup", () => this.#p()), this.on(this.#r, "mouseleave", () => this.#p())), this.#t && this.on(this.#t, "mousedown", this.#H), 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.#q), this.#t && this.on(this.#t, "keydown", this.#K), 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) => {
|
|
2373
2346
|
t.key === "Enter" && (t.preventDefault(), this.#z()), t.key === "Escape" && (t.preventDefault(), this.#P()), t.stopPropagation();
|
|
2374
2347
|
}));
|
|
2375
2348
|
}
|
|
@@ -2380,66 +2353,66 @@ class gt extends u {
|
|
|
2380
2353
|
this.#R(t * e), this.#_(), this.#n = setTimeout(() => {
|
|
2381
2354
|
let s = 150;
|
|
2382
2355
|
const i = () => {
|
|
2383
|
-
this.#R(t * e), this.#x(), s = Math.max(40, s * 0.85), this.#
|
|
2356
|
+
this.#R(t * e), this.#x(), s = Math.max(40, s * 0.85), this.#d = setTimeout(i, s);
|
|
2384
2357
|
};
|
|
2385
2358
|
i();
|
|
2386
2359
|
}, 400);
|
|
2387
2360
|
}
|
|
2388
|
-
#
|
|
2389
|
-
this.#n && (clearTimeout(this.#n), this.#n = null), this.#
|
|
2361
|
+
#p() {
|
|
2362
|
+
this.#n && (clearTimeout(this.#n), this.#n = null), this.#d && (clearTimeout(this.#d), this.#d = null);
|
|
2390
2363
|
}
|
|
2391
2364
|
// --- Drag helpers ---
|
|
2392
|
-
get #
|
|
2365
|
+
get #y() {
|
|
2393
2366
|
const t = this.getAttribute("drag");
|
|
2394
2367
|
if (t === "x" || t === "y" || t === "none") return t;
|
|
2395
2368
|
const e = this.getAttribute("arrows");
|
|
2396
2369
|
return e === "stacked" || e === "stacked-end" || e === "stacked-start" ? "y" : "x";
|
|
2397
2370
|
}
|
|
2398
2371
|
#v(t, e) {
|
|
2399
|
-
return this.#
|
|
2372
|
+
return this.#y === "y" ? this.#l - e : t - this.#o;
|
|
2400
2373
|
}
|
|
2401
|
-
#
|
|
2402
|
-
return this.#
|
|
2374
|
+
#m(t, e) {
|
|
2375
|
+
return this.#y === "y" ? Math.abs(e - this.#l) : Math.abs(t - this.#o);
|
|
2403
2376
|
}
|
|
2404
2377
|
#M(t, e) {
|
|
2405
2378
|
if (!this.#e) return;
|
|
2406
|
-
const s = t / e * 4, i = this.#
|
|
2379
|
+
const s = t / e * 4, i = this.#y;
|
|
2407
2380
|
this.#e.style.transform = i === "y" ? `translateY(${-s}px)` : `translateX(${s}px)`;
|
|
2408
2381
|
}
|
|
2409
|
-
#
|
|
2410
|
-
const i = this.#v(t, e), r = this.step || 1, a = s ? r * 10 : r, n = s ?
|
|
2382
|
+
#w(t, e, s) {
|
|
2383
|
+
const i = this.#v(t, e), r = this.step || 1, a = s ? r * 10 : r, n = s ? L * 2 : L, o = Math.round(i / n), l = this.#c + o * a, c = i - o * n;
|
|
2411
2384
|
this.#M(c, n);
|
|
2412
|
-
const d = this.hasAttribute("wrap") ? this.#V(l) : this.#T(l),
|
|
2413
|
-
|
|
2385
|
+
const d = this.hasAttribute("wrap") ? this.#V(l) : this.#T(l), p = this.#F(d);
|
|
2386
|
+
p !== this.value && (this.value = p, this.#$(), this.#x());
|
|
2414
2387
|
}
|
|
2415
2388
|
// --- Mouse drag ---
|
|
2416
|
-
#
|
|
2417
|
-
this.disabled || this.#
|
|
2389
|
+
#H = (t) => {
|
|
2390
|
+
this.disabled || this.#u || this.#y === "none" || (t.preventDefault(), this.#a = !0, this.#o = t.clientX, this.#l = t.clientY, this.#c = this.value, this.setAttribute("data-dragging", ""));
|
|
2418
2391
|
};
|
|
2419
2392
|
#Y = (t) => {
|
|
2420
|
-
this.#a && this.#
|
|
2393
|
+
this.#a && this.#w(t.clientX, t.clientY, t.shiftKey);
|
|
2421
2394
|
};
|
|
2422
2395
|
#C = (t) => {
|
|
2423
2396
|
if (!this.#a) return;
|
|
2424
|
-
const e = this.#
|
|
2425
|
-
this.#a = !1, this.removeAttribute("data-dragging"), this.#e && (this.#e.style.transform = ""), e <
|
|
2397
|
+
const e = this.#m(t.clientX, t.clientY);
|
|
2398
|
+
this.#a = !1, this.removeAttribute("data-dragging"), this.#e && (this.#e.style.transform = ""), e < I && this.hasAttribute("editable") ? this.#E() : e >= I && this.#_();
|
|
2426
2399
|
};
|
|
2427
2400
|
// --- Touch drag ---
|
|
2428
2401
|
#X = (t) => {
|
|
2429
|
-
this.disabled || this.#
|
|
2402
|
+
this.disabled || this.#u || this.#y === "none" || (t.preventDefault(), this.#a = !0, this.#o = t.touches[0]?.clientX ?? 0, this.#l = t.touches[0]?.clientY ?? 0, this.#c = this.value, this.setAttribute("data-dragging", ""));
|
|
2430
2403
|
};
|
|
2431
2404
|
#G = (t) => {
|
|
2432
2405
|
if (!this.#a) return;
|
|
2433
2406
|
t.preventDefault();
|
|
2434
2407
|
const e = t.touches[0];
|
|
2435
|
-
e && this.#
|
|
2408
|
+
e && this.#w(e.clientX, e.clientY, !1);
|
|
2436
2409
|
};
|
|
2437
2410
|
#q = () => {
|
|
2438
2411
|
this.#a && (this.#a = !1, this.removeAttribute("data-dragging"), this.#e && (this.#e.style.transform = ""), this.#_());
|
|
2439
2412
|
};
|
|
2440
2413
|
// --- Keyboard ---
|
|
2441
2414
|
#K = (t) => {
|
|
2442
|
-
if (this.disabled || this.#
|
|
2415
|
+
if (this.disabled || this.#u) return;
|
|
2443
2416
|
const e = this.step || 1, s = e * 10;
|
|
2444
2417
|
let i = 0;
|
|
2445
2418
|
switch (t.key) {
|
|
@@ -2474,32 +2447,32 @@ class gt extends u {
|
|
|
2474
2447
|
};
|
|
2475
2448
|
// --- Wheel ---
|
|
2476
2449
|
#J = (t) => {
|
|
2477
|
-
if (this.disabled || this.#
|
|
2450
|
+
if (this.disabled || this.#u || !this.matches(":hover") && !this.contains(document.activeElement)) return;
|
|
2478
2451
|
t.preventDefault();
|
|
2479
2452
|
const e = this.step || 1, s = t.shiftKey ? e * 10 : e, i = t.deltaY < 0 ? s : -s;
|
|
2480
2453
|
this.#R(i), this.#x(), this.#_();
|
|
2481
2454
|
};
|
|
2482
2455
|
// --- Edit mode ---
|
|
2483
2456
|
#E(t) {
|
|
2484
|
-
this.disabled || this.#
|
|
2457
|
+
this.disabled || this.#u || (this.#u = !0, this.state = "editing", this.#e && (this.#e.style.display = "none"), this.#i && (this.#i.style.display = "block", this.#i.value = t ?? this.#O(this.value), this.#i.focus(), t ? this.#i.setSelectionRange(1, 1) : this.#i.select()));
|
|
2485
2458
|
}
|
|
2486
2459
|
#z() {
|
|
2487
|
-
if (!this.#
|
|
2488
|
-
this.#
|
|
2460
|
+
if (!this.#u) return;
|
|
2461
|
+
this.#u = !1, this.state = "";
|
|
2489
2462
|
const t = parseFloat(this.#i?.value ?? "");
|
|
2490
2463
|
if (!isNaN(t)) {
|
|
2491
2464
|
const e = this.#T(t), s = this.#F(e);
|
|
2492
2465
|
this.value = s, this.#_();
|
|
2493
2466
|
}
|
|
2494
|
-
this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this
|
|
2467
|
+
this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#$(), this.#t?.focus();
|
|
2495
2468
|
}
|
|
2496
2469
|
#P() {
|
|
2497
|
-
this.#
|
|
2470
|
+
this.#u && (this.#u = !1, this.state = "", this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#t?.focus());
|
|
2498
2471
|
}
|
|
2499
2472
|
// --- Value management ---
|
|
2500
2473
|
#R(t) {
|
|
2501
2474
|
let e = this.value + t;
|
|
2502
|
-
this.hasAttribute("wrap") ? e = this.#V(e) : e = this.#T(e), e = this.#F(e), this.value = e, this
|
|
2475
|
+
this.hasAttribute("wrap") ? e = this.#V(e) : e = this.#T(e), e = this.#F(e), this.value = e, this.#$();
|
|
2503
2476
|
}
|
|
2504
2477
|
#T(t) {
|
|
2505
2478
|
return Math.max(this.min, Math.min(this.max, t));
|
|
@@ -2517,14 +2490,14 @@ class gt extends u {
|
|
|
2517
2490
|
const s = Math.round((t - this.min) / e) * e + this.min;
|
|
2518
2491
|
return this.#T(s);
|
|
2519
2492
|
}
|
|
2520
|
-
#
|
|
2493
|
+
#O(t) {
|
|
2521
2494
|
const e = this.step;
|
|
2522
2495
|
if (e >= 1) return Math.round(t).toString();
|
|
2523
2496
|
const s = Math.max(0, -Math.floor(Math.log10(e)));
|
|
2524
2497
|
return t.toFixed(s);
|
|
2525
2498
|
}
|
|
2526
|
-
|
|
2527
|
-
this.#e && (this.#e.textContent = this.#
|
|
2499
|
+
#$() {
|
|
2500
|
+
this.#e && (this.#e.textContent = this.#O(this.value)), this.#U();
|
|
2528
2501
|
}
|
|
2529
2502
|
#U() {
|
|
2530
2503
|
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)));
|
|
@@ -2561,7 +2534,7 @@ class gt extends u {
|
|
|
2561
2534
|
this.setAttribute("step", String(t));
|
|
2562
2535
|
}
|
|
2563
2536
|
get drag() {
|
|
2564
|
-
return this.#
|
|
2537
|
+
return this.#y;
|
|
2565
2538
|
}
|
|
2566
2539
|
set drag(t) {
|
|
2567
2540
|
this.setAttribute("drag", t);
|
|
@@ -2573,14 +2546,14 @@ class gt extends u {
|
|
|
2573
2546
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
2574
2547
|
}
|
|
2575
2548
|
attributeChangedCallback(t, e, s) {
|
|
2576
|
-
e !== s && t === "value" && this.#t && this
|
|
2549
|
+
e !== s && t === "value" && this.#t && this.#$();
|
|
2577
2550
|
}
|
|
2578
2551
|
teardown() {
|
|
2579
|
-
this.#
|
|
2552
|
+
this.#p();
|
|
2580
2553
|
}
|
|
2581
2554
|
}
|
|
2582
|
-
customElements.define("ry-number-select",
|
|
2583
|
-
function
|
|
2555
|
+
customElements.define("ry-number-select", ft);
|
|
2556
|
+
function A(h) {
|
|
2584
2557
|
const t = h.h / 360, e = h.s / 100, s = h.v / 100;
|
|
2585
2558
|
let i = 0, r = 0, a = 0;
|
|
2586
2559
|
const n = Math.floor(t * 6), o = t * 6 - n, l = s * (1 - e), c = s * (1 - o * e), d = s * (1 - (1 - o) * e);
|
|
@@ -2610,7 +2583,7 @@ function v(h) {
|
|
|
2610
2583
|
b: Math.round(a * 255)
|
|
2611
2584
|
};
|
|
2612
2585
|
}
|
|
2613
|
-
function
|
|
2586
|
+
function _(h) {
|
|
2614
2587
|
const t = h.r / 255, e = h.g / 255, s = h.b / 255, i = Math.max(t, e, s), r = Math.min(t, e, s), a = i - r;
|
|
2615
2588
|
let n = 0;
|
|
2616
2589
|
const o = i === 0 ? 0 : a / i, l = i;
|
|
@@ -2632,7 +2605,7 @@ function k(h) {
|
|
|
2632
2605
|
v: Math.round(l * 100)
|
|
2633
2606
|
};
|
|
2634
2607
|
}
|
|
2635
|
-
function
|
|
2608
|
+
function H(h) {
|
|
2636
2609
|
const t = h.s / 100, e = h.v / 100, s = e * (1 - t / 2), i = s === 0 || s === 1 ? 0 : (e - s) / Math.min(s, 1 - s);
|
|
2637
2610
|
return {
|
|
2638
2611
|
h: h.h,
|
|
@@ -2640,7 +2613,7 @@ function L(h) {
|
|
|
2640
2613
|
l: Math.round(s * 100)
|
|
2641
2614
|
};
|
|
2642
2615
|
}
|
|
2643
|
-
function
|
|
2616
|
+
function yt(h) {
|
|
2644
2617
|
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);
|
|
2645
2618
|
return {
|
|
2646
2619
|
h: h.h,
|
|
@@ -2648,11 +2621,11 @@ function ft(h) {
|
|
|
2648
2621
|
v: Math.round(s * 100)
|
|
2649
2622
|
};
|
|
2650
2623
|
}
|
|
2651
|
-
function
|
|
2624
|
+
function D(h) {
|
|
2652
2625
|
const t = (e) => e.toString(16).padStart(2, "0");
|
|
2653
2626
|
return `#${t(h.r)}${t(h.g)}${t(h.b)}`;
|
|
2654
2627
|
}
|
|
2655
|
-
function
|
|
2628
|
+
function mt(h) {
|
|
2656
2629
|
const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);
|
|
2657
2630
|
if (!t) {
|
|
2658
2631
|
const e = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(h);
|
|
@@ -2668,7 +2641,7 @@ function bt(h) {
|
|
|
2668
2641
|
b: parseInt(t[3], 16)
|
|
2669
2642
|
};
|
|
2670
2643
|
}
|
|
2671
|
-
function
|
|
2644
|
+
function $(h) {
|
|
2672
2645
|
const t = h.trim().toLowerCase();
|
|
2673
2646
|
if (t.startsWith("#")) {
|
|
2674
2647
|
const i = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
|
|
@@ -2678,10 +2651,10 @@ function A(h) {
|
|
|
2678
2651
|
g: parseInt(i[2], 16),
|
|
2679
2652
|
b: parseInt(i[3], 16)
|
|
2680
2653
|
}, n = parseInt(i[4], 16) / 255;
|
|
2681
|
-
return { hsv:
|
|
2654
|
+
return { hsv: _(a), alpha: Math.round(n * 100) };
|
|
2682
2655
|
}
|
|
2683
|
-
const r =
|
|
2684
|
-
return r ? { hsv:
|
|
2656
|
+
const r = mt(t);
|
|
2657
|
+
return r ? { hsv: _(r), alpha: 100 } : null;
|
|
2685
2658
|
}
|
|
2686
2659
|
const e = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/.exec(t);
|
|
2687
2660
|
if (e) {
|
|
@@ -2690,7 +2663,7 @@ function A(h) {
|
|
|
2690
2663
|
g: parseInt(e[2], 10),
|
|
2691
2664
|
b: parseInt(e[3], 10)
|
|
2692
2665
|
}, r = e[4] ? parseFloat(e[4]) * 100 : 100;
|
|
2693
|
-
return { hsv:
|
|
2666
|
+
return { hsv: _(i), alpha: r };
|
|
2694
2667
|
}
|
|
2695
2668
|
const s = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*([\d.]+))?\s*\)$/.exec(t);
|
|
2696
2669
|
if (s) {
|
|
@@ -2699,11 +2672,11 @@ function A(h) {
|
|
|
2699
2672
|
s: parseFloat(s[2]),
|
|
2700
2673
|
l: parseFloat(s[3])
|
|
2701
2674
|
}, r = s[4] ? parseFloat(s[4]) * 100 : 100;
|
|
2702
|
-
return { hsv:
|
|
2675
|
+
return { hsv: yt(i), alpha: r };
|
|
2703
2676
|
}
|
|
2704
2677
|
return null;
|
|
2705
2678
|
}
|
|
2706
|
-
class
|
|
2679
|
+
class bt extends u {
|
|
2707
2680
|
#t = 0;
|
|
2708
2681
|
#e = 100;
|
|
2709
2682
|
#i = 100;
|
|
@@ -2711,21 +2684,21 @@ class yt extends u {
|
|
|
2711
2684
|
#r = !1;
|
|
2712
2685
|
#a = !1;
|
|
2713
2686
|
#o = !1;
|
|
2714
|
-
#h = null;
|
|
2715
2687
|
#l = null;
|
|
2716
2688
|
#c = null;
|
|
2689
|
+
#u = null;
|
|
2717
2690
|
#n = null;
|
|
2718
|
-
#p = null;
|
|
2719
2691
|
#d = null;
|
|
2720
|
-
#
|
|
2692
|
+
#h = null;
|
|
2693
|
+
#b = null;
|
|
2721
2694
|
#f = null;
|
|
2722
|
-
#
|
|
2695
|
+
#A = null;
|
|
2723
2696
|
#g = null;
|
|
2724
2697
|
static observedAttributes = ["value", "format", "opacity", "disabled", "swatches", "inline"];
|
|
2725
2698
|
setup() {
|
|
2726
|
-
this.#
|
|
2699
|
+
this.#p(), this.#y(), this.#v(), this.#$();
|
|
2727
2700
|
}
|
|
2728
|
-
#
|
|
2701
|
+
#p() {
|
|
2729
2702
|
const t = this.hasAttribute("inline"), e = this.hasAttribute("opacity"), s = this.getAttribute("swatches");
|
|
2730
2703
|
let i = `
|
|
2731
2704
|
<div data-ry-target="grid" class="ry-color-picker__grid">
|
|
@@ -2765,43 +2738,43 @@ class yt extends u {
|
|
|
2765
2738
|
<span data-ry-target="trigger-color" class="ry-color-picker__trigger-color"></span>
|
|
2766
2739
|
</button>
|
|
2767
2740
|
<div data-ry-target="panel" class="ry-color-picker__panel">${i}</div>
|
|
2768
|
-
`, this.#
|
|
2741
|
+
`, this.#l = this.$('[data-ry-target="trigger"]'), this.#c = this.$('[data-ry-target="panel"]'), this.#u = this.$('[data-ry-target="grid"]'), this.#n = this.$('[data-ry-target="grid-handle"]'), this.#d = this.$('[data-ry-target="hue-slider"]'), this.#h = this.$('[data-ry-target="hue-handle"]'), this.#b = this.$('[data-ry-target="alpha-slider"]'), this.#f = this.$('[data-ry-target="alpha-handle"]'), this.#A = this.$('[data-ry-target="preview"]'), this.#g = this.$('[data-ry-target="input"]');
|
|
2769
2742
|
}
|
|
2770
|
-
#
|
|
2771
|
-
this.#
|
|
2743
|
+
#y() {
|
|
2744
|
+
this.#l && this.on(this.#l, "click", this.#m), this.on(document, "click", this.#M), this.on(document, "keydown", this.#w), this.#u && this.on(this.#u, "pointerdown", this.#Y), this.#n && this.on(this.#n, "keydown", this.#X), this.#d && this.on(this.#d, "pointerdown", this.#G), this.#h && this.on(this.#h, "keydown", this.#K), this.#b && this.on(this.#b, "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));
|
|
2772
2745
|
const t = this.$('[data-ry-target="format-toggle"]');
|
|
2773
2746
|
t && this.on(t, "click", this.#F);
|
|
2774
2747
|
const e = this.$('[data-ry-target="swatches"]');
|
|
2775
|
-
e && this.on(e, "click", this.#
|
|
2748
|
+
e && this.on(e, "click", this.#O);
|
|
2776
2749
|
}
|
|
2777
2750
|
#v() {
|
|
2778
2751
|
const t = this.getAttribute("value");
|
|
2779
2752
|
if (t) {
|
|
2780
|
-
const e =
|
|
2753
|
+
const e = $(t);
|
|
2781
2754
|
e && (this.#t = e.hsv.h, this.#e = e.hsv.s, this.#i = e.hsv.v, this.#s = e.alpha);
|
|
2782
2755
|
}
|
|
2783
2756
|
}
|
|
2784
2757
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2785
2758
|
// Dropdown handlers
|
|
2786
2759
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2787
|
-
#
|
|
2760
|
+
#m = () => {
|
|
2788
2761
|
this.disabled || (this.state === "open" ? this.close() : this.open());
|
|
2789
2762
|
};
|
|
2790
2763
|
#M = (t) => {
|
|
2791
2764
|
this.state === "open" && (this.contains(t.target) || this.close());
|
|
2792
2765
|
};
|
|
2793
|
-
#
|
|
2794
|
-
t.key === "Escape" && this.state === "open" && (this.close(), this.#
|
|
2766
|
+
#w = (t) => {
|
|
2767
|
+
t.key === "Escape" && this.state === "open" && (this.close(), this.#l?.focus());
|
|
2795
2768
|
};
|
|
2796
2769
|
open() {
|
|
2797
|
-
this.hasAttribute("inline") || (this.#
|
|
2770
|
+
this.hasAttribute("inline") || (this.#H(), this.state = "open");
|
|
2798
2771
|
}
|
|
2799
2772
|
close() {
|
|
2800
2773
|
this.hasAttribute("inline") || (this.state = "closed", this.removeAttribute("data-ry-position"));
|
|
2801
2774
|
}
|
|
2802
|
-
#
|
|
2803
|
-
if (!this.#
|
|
2804
|
-
const t = this.#
|
|
2775
|
+
#H() {
|
|
2776
|
+
if (!this.#c || !this.#l) return;
|
|
2777
|
+
const t = this.#l.getBoundingClientRect(), e = 320, i = window.innerHeight - t.bottom, r = t.top;
|
|
2805
2778
|
i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
|
|
2806
2779
|
}
|
|
2807
2780
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -2811,9 +2784,9 @@ class yt extends u {
|
|
|
2811
2784
|
this.disabled || (t.preventDefault(), this.#r = !0, this.#n?.focus(), this.#C(t));
|
|
2812
2785
|
};
|
|
2813
2786
|
#C(t) {
|
|
2814
|
-
if (!this.#
|
|
2815
|
-
const e = this.#
|
|
2816
|
-
this.#e = Math.round(s * 100), this.#i = Math.round((1 - i) * 100), this
|
|
2787
|
+
if (!this.#u) return;
|
|
2788
|
+
const e = this.#u.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));
|
|
2789
|
+
this.#e = Math.round(s * 100), this.#i = Math.round((1 - i) * 100), this.#$(), this.#L();
|
|
2817
2790
|
}
|
|
2818
2791
|
#X = (t) => {
|
|
2819
2792
|
if (this.disabled) return;
|
|
@@ -2833,18 +2806,18 @@ class yt extends u {
|
|
|
2833
2806
|
this.#i = Math.max(0, this.#i - e), s = !0;
|
|
2834
2807
|
break;
|
|
2835
2808
|
}
|
|
2836
|
-
s && (t.preventDefault(), this
|
|
2809
|
+
s && (t.preventDefault(), this.#$(), this.#L(), this.#k());
|
|
2837
2810
|
};
|
|
2838
2811
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2839
2812
|
// Hue handlers
|
|
2840
2813
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2841
2814
|
#G = (t) => {
|
|
2842
|
-
this.disabled || (t.preventDefault(), this.#a = !0, this.#
|
|
2815
|
+
this.disabled || (t.preventDefault(), this.#a = !0, this.#h?.focus(), this.#q(t));
|
|
2843
2816
|
};
|
|
2844
2817
|
#q(t) {
|
|
2845
|
-
if (!this.#
|
|
2846
|
-
const e = this.#
|
|
2847
|
-
this.#t = Math.round(s * 360), this
|
|
2818
|
+
if (!this.#d) return;
|
|
2819
|
+
const e = this.#d.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
|
|
2820
|
+
this.#t = Math.round(s * 360), this.#$(), this.#L();
|
|
2848
2821
|
}
|
|
2849
2822
|
#K = (t) => {
|
|
2850
2823
|
if (this.disabled) return;
|
|
@@ -2860,7 +2833,7 @@ class yt extends u {
|
|
|
2860
2833
|
this.#t = (this.#t - e + 360) % 360, s = !0;
|
|
2861
2834
|
break;
|
|
2862
2835
|
}
|
|
2863
|
-
s && (t.preventDefault(), this
|
|
2836
|
+
s && (t.preventDefault(), this.#$(), this.#L(), this.#k());
|
|
2864
2837
|
};
|
|
2865
2838
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2866
2839
|
// Alpha handlers
|
|
@@ -2869,9 +2842,9 @@ class yt extends u {
|
|
|
2869
2842
|
this.disabled || (t.preventDefault(), this.#o = !0, this.#f?.focus(), this.#E(t));
|
|
2870
2843
|
};
|
|
2871
2844
|
#E(t) {
|
|
2872
|
-
if (!this.#
|
|
2873
|
-
const e = this.#
|
|
2874
|
-
this.#s = Math.round(s * 100), this
|
|
2845
|
+
if (!this.#b) return;
|
|
2846
|
+
const e = this.#b.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
|
|
2847
|
+
this.#s = Math.round(s * 100), this.#$(), this.#L();
|
|
2875
2848
|
}
|
|
2876
2849
|
#z = (t) => {
|
|
2877
2850
|
if (this.disabled) return;
|
|
@@ -2887,7 +2860,7 @@ class yt extends u {
|
|
|
2887
2860
|
this.#s = Math.max(0, this.#s - e), s = !0;
|
|
2888
2861
|
break;
|
|
2889
2862
|
}
|
|
2890
|
-
s && (t.preventDefault(), this
|
|
2863
|
+
s && (t.preventDefault(), this.#$(), this.#L(), this.#k());
|
|
2891
2864
|
};
|
|
2892
2865
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2893
2866
|
// Pointer move/up
|
|
@@ -2896,15 +2869,15 @@ class yt extends u {
|
|
|
2896
2869
|
this.#r ? this.#C(t) : this.#a ? this.#q(t) : this.#o && this.#E(t);
|
|
2897
2870
|
};
|
|
2898
2871
|
#R = () => {
|
|
2899
|
-
(this.#r || this.#a || this.#o) && (this.#r = !1, this.#a = !1, this.#o = !1, this
|
|
2872
|
+
(this.#r || this.#a || this.#o) && (this.#r = !1, this.#a = !1, this.#o = !1, this.#k());
|
|
2900
2873
|
};
|
|
2901
2874
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2902
2875
|
// Input handlers
|
|
2903
2876
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2904
2877
|
#T = () => {
|
|
2905
2878
|
if (!this.#g) return;
|
|
2906
|
-
const t =
|
|
2907
|
-
t ? (this.#t = t.hsv.h, this.#e = t.hsv.s, this.#i = t.hsv.v, this.hasAttribute("opacity") && (this.#s = t.alpha), this
|
|
2879
|
+
const t = $(this.#g.value);
|
|
2880
|
+
t ? (this.#t = t.hsv.h, this.#e = t.hsv.s, this.#i = t.hsv.v, this.hasAttribute("opacity") && (this.#s = t.alpha), this.#$(), this.#k()) : this.#W();
|
|
2908
2881
|
};
|
|
2909
2882
|
#V = (t) => {
|
|
2910
2883
|
t.key === "Enter" && (t.preventDefault(), this.#T());
|
|
@@ -2921,50 +2894,50 @@ class yt extends u {
|
|
|
2921
2894
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2922
2895
|
// Swatches
|
|
2923
2896
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2924
|
-
#
|
|
2897
|
+
#O = (t) => {
|
|
2925
2898
|
const e = t.target;
|
|
2926
2899
|
if (e.classList.contains("ry-color-picker__swatch")) {
|
|
2927
2900
|
const s = e.dataset.color;
|
|
2928
2901
|
if (s) {
|
|
2929
|
-
const i =
|
|
2930
|
-
i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this
|
|
2902
|
+
const i = $(s);
|
|
2903
|
+
i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this.#$(), this.#L(), this.#k());
|
|
2931
2904
|
}
|
|
2932
2905
|
}
|
|
2933
2906
|
};
|
|
2934
2907
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2935
2908
|
// Update methods
|
|
2936
2909
|
// ───────────────────────────────────────────────────────────────────────────
|
|
2937
|
-
|
|
2938
|
-
this.#U(), this.#x(), this.#_(), this.#D(), this.#
|
|
2910
|
+
#$() {
|
|
2911
|
+
this.#U(), this.#x(), this.#_(), this.#D(), this.#j(), this.#W(), this.#Z();
|
|
2939
2912
|
}
|
|
2940
2913
|
#U() {
|
|
2941
2914
|
const t = this.$('[data-ry-target="trigger-color"]');
|
|
2942
2915
|
if (t) {
|
|
2943
|
-
const e =
|
|
2916
|
+
const e = A({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity") ? this.#s / 100 : 1;
|
|
2944
2917
|
t.style.backgroundColor = `rgba(${e.r}, ${e.g}, ${e.b}, ${s})`;
|
|
2945
2918
|
}
|
|
2946
2919
|
}
|
|
2947
2920
|
#x() {
|
|
2948
|
-
if (this.#
|
|
2949
|
-
const t =
|
|
2950
|
-
this.#
|
|
2921
|
+
if (this.#u) {
|
|
2922
|
+
const t = A({ h: this.#t, s: 100, v: 100 });
|
|
2923
|
+
this.#u.style.setProperty("--grid-hue-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
|
|
2951
2924
|
}
|
|
2952
2925
|
this.#n && (this.#n.style.left = `${this.#e}%`, this.#n.style.top = `${100 - this.#i}%`);
|
|
2953
2926
|
}
|
|
2954
2927
|
#_() {
|
|
2955
|
-
this.#
|
|
2928
|
+
this.#h && (this.#h.style.left = `${this.#t / 360 * 100}%`);
|
|
2956
2929
|
}
|
|
2957
2930
|
#D() {
|
|
2958
|
-
if (this.#
|
|
2959
|
-
const t =
|
|
2960
|
-
this.#
|
|
2931
|
+
if (this.#b) {
|
|
2932
|
+
const t = A({ h: this.#t, s: this.#e, v: this.#i });
|
|
2933
|
+
this.#b.style.setProperty("--alpha-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
|
|
2961
2934
|
}
|
|
2962
2935
|
this.#f && (this.#f.style.left = `${this.#s}%`);
|
|
2963
2936
|
}
|
|
2964
|
-
#
|
|
2937
|
+
#j() {
|
|
2965
2938
|
const t = this.$('[data-ry-target="preview-color"]');
|
|
2966
2939
|
if (t) {
|
|
2967
|
-
const e =
|
|
2940
|
+
const e = A({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity") ? this.#s / 100 : 1;
|
|
2968
2941
|
t.style.backgroundColor = `rgba(${e.r}, ${e.g}, ${e.b}, ${s})`;
|
|
2969
2942
|
}
|
|
2970
2943
|
}
|
|
@@ -2976,10 +2949,10 @@ class yt extends u {
|
|
|
2976
2949
|
this.getAttribute("value") !== t && this.setAttribute("value", t);
|
|
2977
2950
|
}
|
|
2978
2951
|
#N() {
|
|
2979
|
-
const t = this.format, e =
|
|
2952
|
+
const t = this.format, e = A({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity");
|
|
2980
2953
|
switch (t) {
|
|
2981
2954
|
case "hex": {
|
|
2982
|
-
const i =
|
|
2955
|
+
const i = D(e);
|
|
2983
2956
|
if (s && this.#s < 100) {
|
|
2984
2957
|
const r = Math.round(this.#s / 100 * 255).toString(16).padStart(2, "0");
|
|
2985
2958
|
return i + r;
|
|
@@ -2989,11 +2962,11 @@ class yt extends u {
|
|
|
2989
2962
|
case "rgb":
|
|
2990
2963
|
return s ? `rgba(${e.r}, ${e.g}, ${e.b}, ${(this.#s / 100).toFixed(2)})` : `rgb(${e.r}, ${e.g}, ${e.b})`;
|
|
2991
2964
|
case "hsl": {
|
|
2992
|
-
const i =
|
|
2965
|
+
const i = H({ h: this.#t, s: this.#e, v: this.#i });
|
|
2993
2966
|
return s ? `hsla(${i.h}, ${i.s}%, ${i.l}%, ${(this.#s / 100).toFixed(2)})` : `hsl(${i.h}, ${i.s}%, ${i.l}%)`;
|
|
2994
2967
|
}
|
|
2995
2968
|
default:
|
|
2996
|
-
return
|
|
2969
|
+
return D(e);
|
|
2997
2970
|
}
|
|
2998
2971
|
}
|
|
2999
2972
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -3002,16 +2975,16 @@ class yt extends u {
|
|
|
3002
2975
|
#L() {
|
|
3003
2976
|
this.emit("input", { value: this.value, hsv: this.hsv, rgb: this.rgb });
|
|
3004
2977
|
}
|
|
3005
|
-
|
|
2978
|
+
#k() {
|
|
3006
2979
|
this.emit("change", { value: this.value, hsv: this.hsv, rgb: this.rgb });
|
|
3007
2980
|
}
|
|
3008
2981
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3009
2982
|
// Attribute changed
|
|
3010
2983
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3011
2984
|
attributeChangedCallback(t, e, s) {
|
|
3012
|
-
if (e !== s && t === "value" && this.#
|
|
3013
|
-
const i =
|
|
3014
|
-
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.#D(), this.#
|
|
2985
|
+
if (e !== s && t === "value" && this.#u && s) {
|
|
2986
|
+
const i = $(s);
|
|
2987
|
+
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.#D(), this.#j());
|
|
3015
2988
|
}
|
|
3016
2989
|
}
|
|
3017
2990
|
// ───────────────────────────────────────────────────────────────────────────
|
|
@@ -3021,8 +2994,8 @@ class yt extends u {
|
|
|
3021
2994
|
return this.#N();
|
|
3022
2995
|
}
|
|
3023
2996
|
set value(t) {
|
|
3024
|
-
const e =
|
|
3025
|
-
e && (this.#t = e.hsv.h, this.#e = e.hsv.s, this.#i = e.hsv.v, this.hasAttribute("opacity") && (this.#s = e.alpha), this
|
|
2997
|
+
const e = $(t);
|
|
2998
|
+
e && (this.#t = e.hsv.h, this.#e = e.hsv.s, this.#i = e.hsv.v, this.hasAttribute("opacity") && (this.#s = e.alpha), this.#$());
|
|
3026
2999
|
}
|
|
3027
3000
|
get format() {
|
|
3028
3001
|
return this.getAttribute("format") || "hex";
|
|
@@ -3040,21 +3013,21 @@ class yt extends u {
|
|
|
3040
3013
|
return { h: this.#t, s: this.#e, v: this.#i };
|
|
3041
3014
|
}
|
|
3042
3015
|
get rgb() {
|
|
3043
|
-
return
|
|
3016
|
+
return A(this.hsv);
|
|
3044
3017
|
}
|
|
3045
3018
|
get hsl() {
|
|
3046
|
-
return
|
|
3019
|
+
return H(this.hsv);
|
|
3047
3020
|
}
|
|
3048
3021
|
get alpha() {
|
|
3049
3022
|
return this.#s;
|
|
3050
3023
|
}
|
|
3051
3024
|
set alpha(t) {
|
|
3052
|
-
this.#s = Math.max(0, Math.min(100, t)), this
|
|
3025
|
+
this.#s = Math.max(0, Math.min(100, t)), this.#$();
|
|
3053
3026
|
}
|
|
3054
3027
|
/** Set color from any valid color string */
|
|
3055
3028
|
setColor(t) {
|
|
3056
|
-
const e =
|
|
3057
|
-
return e ? (this.#t = e.hsv.h, this.#e = e.hsv.s, this.#i = e.hsv.v, this.hasAttribute("opacity") && (this.#s = e.alpha), this
|
|
3029
|
+
const e = $(t);
|
|
3030
|
+
return e ? (this.#t = e.hsv.h, this.#e = e.hsv.s, this.#i = e.hsv.v, this.hasAttribute("opacity") && (this.#s = e.alpha), this.#$(), !0) : !1;
|
|
3058
3031
|
}
|
|
3059
3032
|
/** Get color in specific format */
|
|
3060
3033
|
getFormattedValue(t) {
|
|
@@ -3064,15 +3037,15 @@ class yt extends u {
|
|
|
3064
3037
|
return this.format = e, s;
|
|
3065
3038
|
}
|
|
3066
3039
|
}
|
|
3067
|
-
customElements.define("ry-color-picker",
|
|
3068
|
-
class
|
|
3040
|
+
customElements.define("ry-color-picker", bt);
|
|
3041
|
+
class vt extends u {
|
|
3069
3042
|
#t = null;
|
|
3070
3043
|
#e = null;
|
|
3071
3044
|
#i = null;
|
|
3072
3045
|
#s = null;
|
|
3073
3046
|
static observedAttributes = ["value", "format", "opacity", "disabled", "placeholder"];
|
|
3074
3047
|
setup() {
|
|
3075
|
-
this.#r(), this.#a(), this.#
|
|
3048
|
+
this.#r(), this.#a(), this.#y(), this.state = "closed";
|
|
3076
3049
|
}
|
|
3077
3050
|
#r() {
|
|
3078
3051
|
const t = this.hasAttribute("opacity"), e = this.getAttribute("format") || "hex", s = this.getAttribute("value") || "#000000", i = this.getAttribute("placeholder") || "#000000";
|
|
@@ -3104,15 +3077,15 @@ class mt extends u {
|
|
|
3104
3077
|
`, 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"]');
|
|
3105
3078
|
}
|
|
3106
3079
|
#a() {
|
|
3107
|
-
this.#t && this.on(this.#t, "click", this.#o), this.#e && (this.on(this.#e, "input", this.#
|
|
3080
|
+
this.#t && this.on(this.#t, "click", this.#o), this.#e && (this.on(this.#e, "input", this.#c), this.on(this.#e, "keydown", this.#d), this.on(this.#e, "focus", this.#l)), this.#s && (this.on(this.#s, "ry:input", this.#h), this.on(this.#s, "ry:change", this.#b)), this.on(document, "click", this.#f), this.on(document, "keydown", this.#A);
|
|
3108
3081
|
}
|
|
3109
3082
|
#o = () => {
|
|
3110
3083
|
this.disabled || (this.state === "open" ? this.close() : this.open());
|
|
3111
3084
|
};
|
|
3112
|
-
#
|
|
3085
|
+
#l = () => {
|
|
3113
3086
|
this.disabled || this.open();
|
|
3114
3087
|
};
|
|
3115
|
-
#
|
|
3088
|
+
#c = () => {
|
|
3116
3089
|
if (!this.#e || !this.#s) return;
|
|
3117
3090
|
let t = this.#e.value;
|
|
3118
3091
|
const e = this.#e.selectionStart ?? t.length, r = "#" + t.replace(/[^#a-fA-F0-9]/g, "").replace(/#/g, "").slice(0, 6);
|
|
@@ -3121,10 +3094,10 @@ class mt extends u {
|
|
|
3121
3094
|
const n = Math.min(e, r.length);
|
|
3122
3095
|
this.#e.setSelectionRange(n, n);
|
|
3123
3096
|
}
|
|
3124
|
-
const a = this.#
|
|
3125
|
-
a && (this.#s.setColor(a), this.#
|
|
3097
|
+
const a = this.#u(r);
|
|
3098
|
+
a && (this.#s.setColor(a), this.#p(), this.#n(r) && this.#v(), this.emit("input", { value: this.value }));
|
|
3126
3099
|
};
|
|
3127
|
-
#
|
|
3100
|
+
#u(t) {
|
|
3128
3101
|
let e = t;
|
|
3129
3102
|
e.startsWith("#") || (e = "#" + e);
|
|
3130
3103
|
const s = e.slice(1);
|
|
@@ -3141,19 +3114,19 @@ class mt extends u {
|
|
|
3141
3114
|
#n(t) {
|
|
3142
3115
|
return !!(/^#[a-fA-F0-9]{6}$/.test(t) || /^#[a-fA-F0-9]{3}$/.test(t));
|
|
3143
3116
|
}
|
|
3144
|
-
#
|
|
3145
|
-
t.key === "Enter" && (t.preventDefault(), this.#
|
|
3117
|
+
#d = (t) => {
|
|
3118
|
+
t.key === "Enter" && (t.preventDefault(), this.#c(), this.emit("change", { value: this.value }));
|
|
3146
3119
|
};
|
|
3147
|
-
#
|
|
3148
|
-
!this.#s || !this.#e || (document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#
|
|
3120
|
+
#h = () => {
|
|
3121
|
+
!this.#s || !this.#e || (document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#p(), this.#v(), this.emit("input", { value: this.value }));
|
|
3149
3122
|
};
|
|
3150
|
-
#
|
|
3123
|
+
#b = () => {
|
|
3151
3124
|
this.emit("change", { value: this.value });
|
|
3152
3125
|
};
|
|
3153
3126
|
#f = (t) => {
|
|
3154
3127
|
this.state === "open" && (this.contains(t.target) || this.close());
|
|
3155
3128
|
};
|
|
3156
|
-
#
|
|
3129
|
+
#A = (t) => {
|
|
3157
3130
|
t.key === "Escape" && this.state === "open" && (this.close(), this.#t?.focus());
|
|
3158
3131
|
};
|
|
3159
3132
|
open() {
|
|
@@ -3167,21 +3140,21 @@ class mt extends u {
|
|
|
3167
3140
|
const t = this.getBoundingClientRect(), e = 280, i = window.innerHeight - t.bottom, r = t.top;
|
|
3168
3141
|
i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
|
|
3169
3142
|
}
|
|
3170
|
-
#
|
|
3143
|
+
#p() {
|
|
3171
3144
|
const t = this.$('[data-ry-target="swatch-color"]');
|
|
3172
3145
|
if (t && this.#s) {
|
|
3173
3146
|
const e = this.#s.rgb, s = this.hasAttribute("opacity") ? this.#s.alpha / 100 : 1;
|
|
3174
3147
|
t.style.backgroundColor = `rgba(${e.r}, ${e.g}, ${e.b}, ${s})`;
|
|
3175
3148
|
}
|
|
3176
3149
|
}
|
|
3177
|
-
#
|
|
3150
|
+
#y() {
|
|
3178
3151
|
const t = this.getAttribute("value") || "#000000";
|
|
3179
3152
|
if (this.#s) {
|
|
3180
3153
|
if (this.#s.setColor(t), this.#e) {
|
|
3181
3154
|
const e = this.#s.value;
|
|
3182
3155
|
this.#e.value = e.startsWith("#") ? e : "#" + e;
|
|
3183
3156
|
}
|
|
3184
|
-
this.#
|
|
3157
|
+
this.#p();
|
|
3185
3158
|
}
|
|
3186
3159
|
}
|
|
3187
3160
|
#v() {
|
|
@@ -3191,14 +3164,14 @@ class mt extends u {
|
|
|
3191
3164
|
}
|
|
3192
3165
|
}
|
|
3193
3166
|
attributeChangedCallback(t, e, s) {
|
|
3194
|
-
e !== s && (t === "value" && this.#s && this.#e && s && (this.#s.setColor(s), document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#
|
|
3167
|
+
e !== s && (t === "value" && this.#s && this.#e && s && (this.#s.setColor(s), document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#p()), t === "disabled" && this.#e && (s !== null ? this.#e.setAttribute("disabled", "") : this.#e.removeAttribute("disabled")));
|
|
3195
3168
|
}
|
|
3196
3169
|
// Public API
|
|
3197
3170
|
get value() {
|
|
3198
3171
|
return this.#s?.value ?? this.getAttribute("value") ?? "#000000";
|
|
3199
3172
|
}
|
|
3200
3173
|
set value(t) {
|
|
3201
|
-
this.#s?.setColor(t) && (this.#e && (this.#e.value = this.#s.value), this.#
|
|
3174
|
+
this.#s?.setColor(t) && (this.#e && (this.#e.value = this.#s.value), this.#p(), this.#v());
|
|
3202
3175
|
}
|
|
3203
3176
|
get disabled() {
|
|
3204
3177
|
return this.hasAttribute("disabled");
|
|
@@ -3216,8 +3189,8 @@ class mt extends u {
|
|
|
3216
3189
|
return this.#s?.hsv ?? { h: 0, s: 0, v: 0 };
|
|
3217
3190
|
}
|
|
3218
3191
|
}
|
|
3219
|
-
customElements.define("ry-color-input",
|
|
3220
|
-
function
|
|
3192
|
+
customElements.define("ry-color-input", vt);
|
|
3193
|
+
function M(h) {
|
|
3221
3194
|
const t = h.trim().toLowerCase();
|
|
3222
3195
|
if (t.startsWith("#")) {
|
|
3223
3196
|
const i = t.slice(1);
|
|
@@ -3240,7 +3213,7 @@ function x(h) {
|
|
|
3240
3213
|
};
|
|
3241
3214
|
const s = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%/.exec(t);
|
|
3242
3215
|
if (s) {
|
|
3243
|
-
const i = parseFloat(s[1]) / 360, r = parseFloat(s[2]) / 100, a = parseFloat(s[3]) / 100, n = (c, d,
|
|
3216
|
+
const i = parseFloat(s[1]) / 360, r = parseFloat(s[2]) / 100, a = parseFloat(s[3]) / 100, n = (c, d, p) => (p < 0 && (p += 1), p > 1 && (p -= 1), p < 1 / 6 ? c + (d - c) * 6 * p : p < 1 / 2 ? d : p < 2 / 3 ? c + (d - c) * (2 / 3 - p) * 6 : c), o = a < 0.5 ? a * (1 + r) : a + r - a * r, l = 2 * a - o;
|
|
3244
3217
|
return {
|
|
3245
3218
|
r: Math.round(n(l, o, i + 1 / 3) * 255),
|
|
3246
3219
|
g: Math.round(n(l, o, i) * 255),
|
|
@@ -3249,19 +3222,19 @@ function x(h) {
|
|
|
3249
3222
|
}
|
|
3250
3223
|
return null;
|
|
3251
3224
|
}
|
|
3252
|
-
function
|
|
3225
|
+
function At(h) {
|
|
3253
3226
|
const t = (e) => Math.max(0, Math.min(255, e)).toString(16).padStart(2, "0");
|
|
3254
3227
|
return `#${t(h.r)}${t(h.g)}${t(h.b)}`;
|
|
3255
3228
|
}
|
|
3256
|
-
function
|
|
3229
|
+
function $t(h, t, e) {
|
|
3257
3230
|
return {
|
|
3258
3231
|
r: Math.round(h.r + (t.r - h.r) * e),
|
|
3259
3232
|
g: Math.round(h.g + (t.g - h.g) * e),
|
|
3260
3233
|
b: Math.round(h.b + (t.b - h.b) * e)
|
|
3261
3234
|
};
|
|
3262
3235
|
}
|
|
3263
|
-
const
|
|
3264
|
-
class
|
|
3236
|
+
const B = "linear-gradient(90deg, #000000 0%, #ffffff 100%)", kt = 50;
|
|
3237
|
+
class wt extends u {
|
|
3265
3238
|
#t = "linear";
|
|
3266
3239
|
#e = 90;
|
|
3267
3240
|
#i = "circle";
|
|
@@ -3269,28 +3242,28 @@ class $t extends u {
|
|
|
3269
3242
|
#r = null;
|
|
3270
3243
|
#a = 0;
|
|
3271
3244
|
#o = null;
|
|
3272
|
-
#
|
|
3273
|
-
#
|
|
3274
|
-
#
|
|
3245
|
+
#l = !1;
|
|
3246
|
+
#c = null;
|
|
3247
|
+
#u = !1;
|
|
3275
3248
|
// Cached DOM refs
|
|
3276
3249
|
#n = null;
|
|
3277
|
-
#p = null;
|
|
3278
3250
|
#d = null;
|
|
3251
|
+
#h = null;
|
|
3279
3252
|
static observedAttributes = ["value", "disabled", "output"];
|
|
3280
3253
|
setup() {
|
|
3281
|
-
this.#
|
|
3254
|
+
this.#b(), this.#Y(), this.#X(), this.#x();
|
|
3282
3255
|
}
|
|
3283
3256
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3284
3257
|
// Parsing / Serialization
|
|
3285
3258
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3286
|
-
#
|
|
3287
|
-
const t = this.getAttribute("value") ||
|
|
3288
|
-
this.#f(t) || this.#f(
|
|
3259
|
+
#b() {
|
|
3260
|
+
const t = this.getAttribute("value") || B;
|
|
3261
|
+
this.#f(t) || this.#f(B);
|
|
3289
3262
|
}
|
|
3290
3263
|
#f(t) {
|
|
3291
3264
|
const e = t.trim();
|
|
3292
3265
|
if (!e.startsWith("linear-gradient(") && !e.startsWith("radial-gradient("))
|
|
3293
|
-
return
|
|
3266
|
+
return M(e) ? (this.#t = "solid", this.#s = [this.#p(e, 0), this.#p(e, 100)], this.#r = this.#s[0].id, !0) : !1;
|
|
3294
3267
|
let s, i;
|
|
3295
3268
|
e.startsWith("linear-gradient(") ? (s = "linear", i = e.slice(16, -1)) : (s = "radial", i = e.slice(16, -1));
|
|
3296
3269
|
let r = 90, a = "circle", n = i;
|
|
@@ -3299,10 +3272,10 @@ class $t extends u {
|
|
|
3299
3272
|
if (d)
|
|
3300
3273
|
r = parseFloat(d[1]), n = i.slice(d[0].length);
|
|
3301
3274
|
else {
|
|
3302
|
-
const
|
|
3303
|
-
if (
|
|
3304
|
-
const
|
|
3305
|
-
r = this.#
|
|
3275
|
+
const p = /^to\s+\w+(?:\s+\w+)?\s*,\s*/.exec(i);
|
|
3276
|
+
if (p) {
|
|
3277
|
+
const f = p[0].trim().replace(/,\s*$/, "");
|
|
3278
|
+
r = this.#A(f), n = i.slice(p[0].length);
|
|
3306
3279
|
}
|
|
3307
3280
|
}
|
|
3308
3281
|
} else {
|
|
@@ -3312,10 +3285,10 @@ class $t extends u {
|
|
|
3312
3285
|
const o = [], l = /(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\)|hsla?\([^)]+\)|[a-z]+)\s+([\d.]+)%/g;
|
|
3313
3286
|
let c;
|
|
3314
3287
|
for (; (c = l.exec(n)) !== null; )
|
|
3315
|
-
o.push(this.#
|
|
3288
|
+
o.push(this.#p(c[1], parseFloat(c[2])));
|
|
3316
3289
|
return o.length < 2 ? !1 : (this.#t = s, this.#e = r, this.#i = a, this.#s = o, this.#r = o[0].id, !0);
|
|
3317
3290
|
}
|
|
3318
|
-
#
|
|
3291
|
+
#A(t) {
|
|
3319
3292
|
return {
|
|
3320
3293
|
"to top": 0,
|
|
3321
3294
|
"to top right": 45,
|
|
@@ -3336,19 +3309,19 @@ class $t extends u {
|
|
|
3336
3309
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3337
3310
|
// Stop management
|
|
3338
3311
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3339
|
-
#
|
|
3312
|
+
#p(t, e) {
|
|
3340
3313
|
return { id: `stop-${this.#a++}`, color: t, position: e };
|
|
3341
3314
|
}
|
|
3342
3315
|
/** CSS left value clamped so the stop handle stays within the bar */
|
|
3343
|
-
#
|
|
3316
|
+
#y(t) {
|
|
3344
3317
|
const e = "calc(var(--ry-gradient-picker-stop-size, 16px) / 2)";
|
|
3345
3318
|
return `clamp(${e}, ${t}%, calc(100% - ${e}))`;
|
|
3346
3319
|
}
|
|
3347
3320
|
#v(t, e) {
|
|
3348
|
-
const s = this.#
|
|
3349
|
-
this.#s.push(s), this.#
|
|
3321
|
+
const s = this.#p(t, e);
|
|
3322
|
+
this.#s.push(s), this.#w(), this.#r = s.id, this.#C(), this.#x();
|
|
3350
3323
|
}
|
|
3351
|
-
#
|
|
3324
|
+
#m(t) {
|
|
3352
3325
|
if (this.#s.length <= 2) return !1;
|
|
3353
3326
|
const e = this.#s.findIndex((s) => s.id === t);
|
|
3354
3327
|
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);
|
|
@@ -3356,17 +3329,17 @@ class $t extends u {
|
|
|
3356
3329
|
#M(t) {
|
|
3357
3330
|
this.#r !== t && (this.#r = t, this.#N(), this.#L());
|
|
3358
3331
|
}
|
|
3359
|
-
#
|
|
3332
|
+
#w() {
|
|
3360
3333
|
this.#s.sort((t, e) => t.position - e.position);
|
|
3361
3334
|
}
|
|
3362
|
-
#
|
|
3335
|
+
#H() {
|
|
3363
3336
|
return this.#s.find((t) => t.id === this.#r) ?? null;
|
|
3364
3337
|
}
|
|
3365
3338
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3366
3339
|
// Markup
|
|
3367
3340
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3368
3341
|
#Y() {
|
|
3369
|
-
const t = this.hasAttribute("output"), e =
|
|
3342
|
+
const t = this.hasAttribute("output"), e = g("copy"), s = g("gradient-solid"), i = g("gradient-linear"), r = g("gradient-radial"), a = g("shape-circle"), n = g("shape-ellipse");
|
|
3370
3343
|
let o = "";
|
|
3371
3344
|
t && (o = `
|
|
3372
3345
|
<div data-ry-target="output-row" class="ry-gradient-picker__output-row">
|
|
@@ -3392,14 +3365,14 @@ class $t extends u {
|
|
|
3392
3365
|
</div>
|
|
3393
3366
|
<ry-color-picker data-ry-target="picker" inline opacity></ry-color-picker>
|
|
3394
3367
|
${o}
|
|
3395
|
-
`, this.#n = this.$('[data-ry-target="bar"]'), this.#
|
|
3368
|
+
`, this.#n = this.$('[data-ry-target="bar"]'), this.#d = this.$('[data-ry-target="picker"]'), this.#h = this.$('[data-ry-target="output"]'), this.#C();
|
|
3396
3369
|
}
|
|
3397
3370
|
#C() {
|
|
3398
3371
|
if (this.#n) {
|
|
3399
3372
|
this.#n.querySelectorAll('[data-ry-target="stop"]').forEach((t) => t.remove());
|
|
3400
3373
|
for (const t of this.#s) {
|
|
3401
3374
|
const e = document.createElement("div");
|
|
3402
|
-
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.#
|
|
3375
|
+
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.#y(t.position), e.style.setProperty("--stop-color", t.color), t.id === this.#r && e.setAttribute("data-selected", ""), this.#n.appendChild(e);
|
|
3403
3376
|
}
|
|
3404
3377
|
}
|
|
3405
3378
|
}
|
|
@@ -3413,7 +3386,7 @@ class $t extends u {
|
|
|
3413
3386
|
const i = this.$('[data-ry-target="angle-select"]');
|
|
3414
3387
|
i && this.on(i, "ry:input", this.#z);
|
|
3415
3388
|
const r = this.$('[data-ry-target="shape-circle"]'), a = this.$('[data-ry-target="shape-ellipse"]');
|
|
3416
|
-
r && this.on(r, "click", () => this.#P("circle")), a && this.on(a, "click", () => this.#P("ellipse")), this.#
|
|
3389
|
+
r && this.on(r, "click", () => this.#P("circle")), a && this.on(a, "click", () => this.#P("ellipse")), this.#d && (this.on(this.#d, "ry:input", this.#R), this.on(this.#d, "ry:change", this.#T)), this.#h && (this.on(this.#h, "keydown", this.#F), this.on(this.#h, "blur", this.#O));
|
|
3417
3390
|
const n = this.$('[data-ry-target="copy-btn"]');
|
|
3418
3391
|
n && this.on(n, "click", this.#V), this.#n && this.on(this.#n, "keydown", this.#J);
|
|
3419
3392
|
}
|
|
@@ -3426,26 +3399,26 @@ class $t extends u {
|
|
|
3426
3399
|
if (s) {
|
|
3427
3400
|
const i = s.getAttribute("data-stop-id");
|
|
3428
3401
|
if (!i) return;
|
|
3429
|
-
t.preventDefault(), this.#o = i, this.#
|
|
3402
|
+
t.preventDefault(), this.#o = i, this.#l = !1, this.#c = this.#n.getBoundingClientRect(), this.#M(i), this.#n.setPointerCapture(t.pointerId), s.focus();
|
|
3430
3403
|
} else {
|
|
3431
3404
|
if (t.preventDefault(), !this.#n) return;
|
|
3432
3405
|
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);
|
|
3433
|
-
this.#v(a, r), this.#n.querySelector(`[data-stop-id="${this.#r}"]`)?.focus(), this.#o = this.#r, this.#
|
|
3406
|
+
this.#v(a, r), this.#n.querySelector(`[data-stop-id="${this.#r}"]`)?.focus(), this.#o = this.#r, this.#l = !1, this.#c = i, this.#n.setPointerCapture(t.pointerId), this.#I();
|
|
3434
3407
|
}
|
|
3435
3408
|
};
|
|
3436
3409
|
#q = (t) => {
|
|
3437
|
-
if (!this.#o || !this.#
|
|
3410
|
+
if (!this.#o || !this.#c) return;
|
|
3438
3411
|
const e = this.#s.find((n) => n.id === this.#o);
|
|
3439
3412
|
if (!e) return;
|
|
3440
|
-
const s = Math.max(0, Math.min(1, (t.clientX - this.#
|
|
3413
|
+
const s = Math.max(0, Math.min(1, (t.clientX - this.#c.left) / this.#c.width));
|
|
3441
3414
|
e.position = Math.round(s * 100);
|
|
3442
|
-
const i = this.#
|
|
3443
|
-
this.#
|
|
3415
|
+
const i = this.#c.top + this.#c.height / 2, r = Math.abs(t.clientY - i);
|
|
3416
|
+
this.#l = r > kt && this.#s.length > 2;
|
|
3444
3417
|
const a = this.#n?.querySelector(`[data-stop-id="${e.id}"]`);
|
|
3445
|
-
a && (a.style.left = this.#
|
|
3418
|
+
a && (a.style.left = this.#y(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.#w(), this.#j(), this.#D(), this.#k(), this.#I();
|
|
3446
3419
|
};
|
|
3447
3420
|
#K = () => {
|
|
3448
|
-
this.#o && (this.#
|
|
3421
|
+
this.#o && (this.#l && this.#m(this.#o), this.#o = null, this.#l = !1, this.#c = null, this.#S(), this.#B());
|
|
3449
3422
|
};
|
|
3450
3423
|
#J = (t) => {
|
|
3451
3424
|
if (this.disabled) return;
|
|
@@ -3466,30 +3439,30 @@ class $t extends u {
|
|
|
3466
3439
|
break;
|
|
3467
3440
|
case "Delete":
|
|
3468
3441
|
case "Backspace":
|
|
3469
|
-
this.#
|
|
3442
|
+
this.#m(i) && (this.#I(), this.#B()), t.preventDefault();
|
|
3470
3443
|
return;
|
|
3471
3444
|
}
|
|
3472
|
-
n && (t.preventDefault(), this.#
|
|
3445
|
+
n && (t.preventDefault(), this.#w(), this.#W(), this.#j(), this.#D(), this.#k(), this.#S(), this.#I(), this.#B());
|
|
3473
3446
|
};
|
|
3474
3447
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3475
3448
|
// Type / Angle / Shape handlers
|
|
3476
3449
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3477
3450
|
#E(t) {
|
|
3478
|
-
this.#t !== t && (this.#t = t, this.setAttribute("data-ry-type", t), this.#_(), this.#D(), this
|
|
3451
|
+
this.#t !== t && (this.#t = t, this.setAttribute("data-ry-type", t), this.#_(), this.#D(), this.#k(), this.#S(), this.#I(), this.#B());
|
|
3479
3452
|
}
|
|
3480
3453
|
#z = (t) => {
|
|
3481
3454
|
const e = t.detail;
|
|
3482
|
-
this.#e = e.value, this.#D(), this
|
|
3455
|
+
this.#e = e.value, this.#D(), this.#k(), this.#S(), this.#I();
|
|
3483
3456
|
};
|
|
3484
3457
|
#P(t) {
|
|
3485
|
-
this.#i !== t && (this.#i = t, this.#_(), this
|
|
3458
|
+
this.#i !== t && (this.#i = t, this.#_(), this.#k(), this.#S(), this.#I(), this.#B());
|
|
3486
3459
|
}
|
|
3487
3460
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3488
3461
|
// Color picker handlers
|
|
3489
3462
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3490
3463
|
#R = () => {
|
|
3491
|
-
const t = this.#
|
|
3492
|
-
!t || !this.#
|
|
3464
|
+
const t = this.#H();
|
|
3465
|
+
!t || !this.#d || (t.color = this.#d.value, this.#Z(t), this.#j(), this.#D(), this.#k(), this.#I());
|
|
3493
3466
|
};
|
|
3494
3467
|
#T = () => {
|
|
3495
3468
|
this.#S(), this.#B();
|
|
@@ -3508,15 +3481,15 @@ class $t extends u {
|
|
|
3508
3481
|
// Output (editable CSS) handlers
|
|
3509
3482
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3510
3483
|
#F = (t) => {
|
|
3511
|
-
t.key === "Enter" && (t.preventDefault(), this
|
|
3484
|
+
t.key === "Enter" && (t.preventDefault(), this.#$());
|
|
3512
3485
|
};
|
|
3513
|
-
#
|
|
3514
|
-
this
|
|
3486
|
+
#O = () => {
|
|
3487
|
+
this.#$();
|
|
3515
3488
|
};
|
|
3516
|
-
|
|
3517
|
-
if (!this.#
|
|
3518
|
-
const t = this.#
|
|
3519
|
-
t && this.#f(t) ? (this.#C(), this.#x(), this.#S(), this.#
|
|
3489
|
+
#$() {
|
|
3490
|
+
if (!this.#h) return;
|
|
3491
|
+
const t = this.#h.value.trim();
|
|
3492
|
+
t && this.#f(t) ? (this.#C(), this.#x(), this.#S(), this.#I(), this.#B()) : this.#k();
|
|
3520
3493
|
}
|
|
3521
3494
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3522
3495
|
// Color interpolation
|
|
@@ -3535,14 +3508,14 @@ class $t extends u {
|
|
|
3535
3508
|
}
|
|
3536
3509
|
const r = i.position - s.position;
|
|
3537
3510
|
if (r === 0) return s.color;
|
|
3538
|
-
const a = (t - s.position) / r, n =
|
|
3539
|
-
return !n || !o ? s.color :
|
|
3511
|
+
const a = (t - s.position) / r, n = M(s.color), o = M(i.color);
|
|
3512
|
+
return !n || !o ? s.color : At($t(n, o, a));
|
|
3540
3513
|
}
|
|
3541
3514
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3542
3515
|
// Update methods
|
|
3543
3516
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3544
3517
|
#x() {
|
|
3545
|
-
this.setAttribute("data-ry-type", this.#t), this.#_(), this.#
|
|
3518
|
+
this.setAttribute("data-ry-type", this.#t), this.#_(), this.#j(), this.#D(), this.#W(), this.#N(), this.#L(), this.#k();
|
|
3546
3519
|
}
|
|
3547
3520
|
#_() {
|
|
3548
3521
|
const t = this.$('[data-ry-target="type-solid"]'), e = this.$('[data-ry-target="type-linear"]'), s = this.$('[data-ry-target="type-radial"]');
|
|
@@ -3553,11 +3526,11 @@ class $t extends u {
|
|
|
3553
3526
|
a && a.setAttribute("value", String(this.#e));
|
|
3554
3527
|
}
|
|
3555
3528
|
#D() {
|
|
3556
|
-
if (!this.#
|
|
3557
|
-
const t = this.#
|
|
3529
|
+
if (!this.#d) return;
|
|
3530
|
+
const t = this.#d.querySelector('[data-ry-target="preview-color"]');
|
|
3558
3531
|
t && (t.style.backgroundImage = this.#t === "solid" ? "" : this.#g());
|
|
3559
3532
|
}
|
|
3560
|
-
#
|
|
3533
|
+
#j() {
|
|
3561
3534
|
if (!this.#n) return;
|
|
3562
3535
|
const t = this.#s.map((e) => `${e.color} ${e.position}%`).join(", ");
|
|
3563
3536
|
this.#n.style.backgroundImage = `linear-gradient(to right, ${t})`;
|
|
@@ -3566,7 +3539,7 @@ class $t extends u {
|
|
|
3566
3539
|
if (this.#n)
|
|
3567
3540
|
for (const t of this.#s) {
|
|
3568
3541
|
const e = this.#n.querySelector(`[data-stop-id="${t.id}"]`);
|
|
3569
|
-
e && (e.style.left = this.#
|
|
3542
|
+
e && (e.style.left = this.#y(t.position));
|
|
3570
3543
|
}
|
|
3571
3544
|
}
|
|
3572
3545
|
#Z(t) {
|
|
@@ -3581,20 +3554,20 @@ class $t extends u {
|
|
|
3581
3554
|
e.getAttribute("data-stop-id") === this.#r ? e.setAttribute("data-selected", "") : e.removeAttribute("data-selected");
|
|
3582
3555
|
}
|
|
3583
3556
|
#L() {
|
|
3584
|
-
const t = this.#
|
|
3585
|
-
!t || !this.#
|
|
3557
|
+
const t = this.#H();
|
|
3558
|
+
!t || !this.#d || this.#d.setColor(t.color);
|
|
3586
3559
|
}
|
|
3587
|
-
|
|
3588
|
-
this.#
|
|
3560
|
+
#k() {
|
|
3561
|
+
this.#h && document.activeElement !== this.#h && (this.#h.value = this.#g());
|
|
3589
3562
|
}
|
|
3590
3563
|
#S() {
|
|
3591
3564
|
const t = this.#g();
|
|
3592
|
-
this.getAttribute("value") !== t && (this.#
|
|
3565
|
+
this.getAttribute("value") !== t && (this.#u = !0, this.setAttribute("value", t), this.#u = !1);
|
|
3593
3566
|
}
|
|
3594
3567
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3595
3568
|
// Events
|
|
3596
3569
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3597
|
-
#
|
|
3570
|
+
#I() {
|
|
3598
3571
|
this.emit("input", {
|
|
3599
3572
|
value: this.#g(),
|
|
3600
3573
|
type: this.#t,
|
|
@@ -3616,7 +3589,7 @@ class $t extends u {
|
|
|
3616
3589
|
// Attribute changed
|
|
3617
3590
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3618
3591
|
attributeChangedCallback(t, e, s) {
|
|
3619
|
-
e === s || this.#
|
|
3592
|
+
e === s || this.#u || t === "value" && this.#n && s && this.#f(s) && (this.#C(), this.#x());
|
|
3620
3593
|
}
|
|
3621
3594
|
// ───────────────────────────────────────────────────────────────────────────
|
|
3622
3595
|
// Public API
|
|
@@ -3637,7 +3610,7 @@ class $t extends u {
|
|
|
3637
3610
|
return this.#e;
|
|
3638
3611
|
}
|
|
3639
3612
|
set angle(t) {
|
|
3640
|
-
this.#e = (t % 360 + 360) % 360, this.#_(), this
|
|
3613
|
+
this.#e = (t % 360 + 360) % 360, this.#_(), this.#k(), this.#S();
|
|
3641
3614
|
}
|
|
3642
3615
|
get shape() {
|
|
3643
3616
|
return this.#i;
|
|
@@ -3649,7 +3622,7 @@ class $t extends u {
|
|
|
3649
3622
|
return this.#s.map((t) => ({ ...t }));
|
|
3650
3623
|
}
|
|
3651
3624
|
get selectedStop() {
|
|
3652
|
-
const t = this.#
|
|
3625
|
+
const t = this.#H();
|
|
3653
3626
|
return t ? { ...t } : null;
|
|
3654
3627
|
}
|
|
3655
3628
|
get disabled() {
|
|
@@ -3659,20 +3632,20 @@ class $t extends u {
|
|
|
3659
3632
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
3660
3633
|
}
|
|
3661
3634
|
addStop(t, e) {
|
|
3662
|
-
this.#v(t, e), this.#S(), this.#
|
|
3635
|
+
this.#v(t, e), this.#S(), this.#I(), this.#B();
|
|
3663
3636
|
}
|
|
3664
3637
|
removeStop(t) {
|
|
3665
|
-
const e = this.#
|
|
3666
|
-
return e && (this
|
|
3638
|
+
const e = this.#m(t);
|
|
3639
|
+
return e && (this.#k(), this.#S(), this.#B()), e;
|
|
3667
3640
|
}
|
|
3668
3641
|
}
|
|
3669
|
-
customElements.define("ry-gradient-picker",
|
|
3670
|
-
let
|
|
3671
|
-
const
|
|
3672
|
-
function
|
|
3673
|
-
return
|
|
3642
|
+
customElements.define("ry-gradient-picker", wt);
|
|
3643
|
+
let xt = 0;
|
|
3644
|
+
const _t = 5;
|
|
3645
|
+
function E(h) {
|
|
3646
|
+
return g(h).replace(/width="24"/g, 'width="16"').replace(/height="24"/g, 'height="16"').replace(/viewBox/, 'class="ry-tree__icon" viewBox');
|
|
3674
3647
|
}
|
|
3675
|
-
class
|
|
3648
|
+
class k extends u {
|
|
3676
3649
|
// Drag state
|
|
3677
3650
|
#t = !1;
|
|
3678
3651
|
#e = !1;
|
|
@@ -3681,9 +3654,9 @@ class w extends u {
|
|
|
3681
3654
|
#r = null;
|
|
3682
3655
|
#a = null;
|
|
3683
3656
|
#o = null;
|
|
3684
|
-
#
|
|
3657
|
+
#l = null;
|
|
3685
3658
|
setup() {
|
|
3686
|
-
this.#
|
|
3659
|
+
this.#c(), this.on(this, "click", (t) => {
|
|
3687
3660
|
const s = t.target.closest('[data-ry-target="file"]');
|
|
3688
3661
|
s && (this.$$("[data-ry-selected]").forEach((i) => i.removeAttribute("data-ry-selected")), s.setAttribute("data-ry-selected", ""), this.emit("select", {
|
|
3689
3662
|
label: s.dataset.ryLabel ?? ""
|
|
@@ -3696,42 +3669,42 @@ class w extends u {
|
|
|
3696
3669
|
label: i,
|
|
3697
3670
|
open: e.checked
|
|
3698
3671
|
});
|
|
3699
|
-
}), this.hasAttribute("sortable") && this.#
|
|
3672
|
+
}), this.hasAttribute("sortable") && this.#b();
|
|
3700
3673
|
}
|
|
3701
3674
|
// ── Build ──────────────────────────────────────────────────
|
|
3702
|
-
#
|
|
3675
|
+
#c() {
|
|
3703
3676
|
if (this.$(".ry-tree__root")) return;
|
|
3704
3677
|
const t = Array.from(this.children), e = document.createElement("ul");
|
|
3705
3678
|
e.className = "ry-tree__root";
|
|
3706
3679
|
for (const s of t)
|
|
3707
|
-
e.appendChild(this.#
|
|
3680
|
+
e.appendChild(this.#u(s));
|
|
3708
3681
|
this.innerHTML = "", this.appendChild(e);
|
|
3709
3682
|
}
|
|
3710
|
-
#
|
|
3683
|
+
#u(t) {
|
|
3711
3684
|
const e = document.createElement("li");
|
|
3712
3685
|
e.className = "ry-tree__item";
|
|
3713
3686
|
const s = t.getAttribute("label") ?? "", i = t.hasAttribute("open"), r = t.hasAttribute("selected"), a = Array.from(t.children).filter(
|
|
3714
3687
|
(o) => o.tagName === "RY-TREE-ITEM"
|
|
3715
3688
|
);
|
|
3716
3689
|
if (a.length > 0) {
|
|
3717
|
-
const o = `ry-tree-${++
|
|
3690
|
+
const o = `ry-tree-${++xt}`, l = document.createElement("input");
|
|
3718
3691
|
l.type = "checkbox", l.id = o, l.className = "ry-tree__toggle", i && (l.checked = !0);
|
|
3719
3692
|
const c = document.createElement("label");
|
|
3720
3693
|
c.htmlFor = o, c.className = "ry-tree__label", c.setAttribute("data-ry-target", "folder"), c.dataset.ryLabel = s, c.innerHTML = `
|
|
3721
|
-
<span class="ry-tree__icon-closed">${
|
|
3722
|
-
<span class="ry-tree__icon-open">${
|
|
3694
|
+
<span class="ry-tree__icon-closed">${E("folder")}</span>
|
|
3695
|
+
<span class="ry-tree__icon-open">${E("folder-open")}</span>
|
|
3723
3696
|
${s}
|
|
3724
3697
|
`;
|
|
3725
3698
|
const d = document.createElement("div");
|
|
3726
3699
|
d.className = "ry-tree__children-wrapper";
|
|
3727
|
-
const
|
|
3728
|
-
|
|
3729
|
-
for (const
|
|
3730
|
-
|
|
3731
|
-
d.appendChild(
|
|
3700
|
+
const p = document.createElement("ul");
|
|
3701
|
+
p.className = "ry-tree__children";
|
|
3702
|
+
for (const f of a)
|
|
3703
|
+
p.appendChild(this.#u(f));
|
|
3704
|
+
d.appendChild(p), e.appendChild(l), e.appendChild(c), e.appendChild(d);
|
|
3732
3705
|
} else {
|
|
3733
3706
|
const o = document.createElement("div");
|
|
3734
|
-
o.className = "ry-tree__file", o.setAttribute("data-ry-target", "file"), o.dataset.ryLabel = s, r && o.setAttribute("data-ry-selected", ""), o.innerHTML = `${
|
|
3707
|
+
o.className = "ry-tree__file", o.setAttribute("data-ry-target", "file"), o.dataset.ryLabel = s, r && o.setAttribute("data-ry-selected", ""), o.innerHTML = `${E("file")} ${s}`, e.appendChild(o);
|
|
3735
3708
|
}
|
|
3736
3709
|
return e;
|
|
3737
3710
|
}
|
|
@@ -3748,9 +3721,9 @@ class w extends u {
|
|
|
3748
3721
|
#n(t) {
|
|
3749
3722
|
return Array.from(t.children).filter(
|
|
3750
3723
|
(s) => s instanceof HTMLElement && s.classList.contains("ry-tree__item")
|
|
3751
|
-
).map((s) => this.#
|
|
3724
|
+
).map((s) => this.#d(s));
|
|
3752
3725
|
}
|
|
3753
|
-
#
|
|
3726
|
+
#d(t) {
|
|
3754
3727
|
const e = t.querySelector(':scope > [data-ry-target="folder"]'), s = t.querySelector(':scope > [data-ry-target="file"]');
|
|
3755
3728
|
if (e) {
|
|
3756
3729
|
const r = t.querySelector(":scope > .ry-tree__toggle"), a = t.querySelector(".ry-tree__children"), n = { label: e.dataset.ryLabel ?? "" };
|
|
@@ -3767,19 +3740,19 @@ class w extends u {
|
|
|
3767
3740
|
static from(t) {
|
|
3768
3741
|
const e = document.createElement("ry-tree");
|
|
3769
3742
|
for (const s of t)
|
|
3770
|
-
e.appendChild(
|
|
3743
|
+
e.appendChild(k.#h(s));
|
|
3771
3744
|
return e;
|
|
3772
3745
|
}
|
|
3773
|
-
static #
|
|
3746
|
+
static #h(t) {
|
|
3774
3747
|
const e = document.createElement("ry-tree-item");
|
|
3775
3748
|
if (e.setAttribute("label", t.label), t.open && e.setAttribute("open", ""), t.selected && e.setAttribute("selected", ""), t.children)
|
|
3776
3749
|
for (const s of t.children)
|
|
3777
|
-
e.appendChild(
|
|
3750
|
+
e.appendChild(k.#h(s));
|
|
3778
3751
|
return e;
|
|
3779
3752
|
}
|
|
3780
3753
|
// ── Drag and Drop ──────────────────────────────────────────
|
|
3781
|
-
#
|
|
3782
|
-
this.on(this, "pointerdown", this.#f), this.on(document, "pointermove", this.#
|
|
3754
|
+
#b() {
|
|
3755
|
+
this.on(this, "pointerdown", this.#f), this.on(document, "pointermove", this.#A), this.on(document, "pointerup", this.#g);
|
|
3783
3756
|
}
|
|
3784
3757
|
#f = (t) => {
|
|
3785
3758
|
const s = t.target.closest(".ry-tree__label, .ry-tree__file");
|
|
@@ -3787,32 +3760,32 @@ class w extends u {
|
|
|
3787
3760
|
const i = s.closest(".ry-tree__item");
|
|
3788
3761
|
i && (this.#t = !0, this.#i = t.clientX, this.#s = t.clientY, this.#r = i);
|
|
3789
3762
|
};
|
|
3790
|
-
#
|
|
3763
|
+
#A = (t) => {
|
|
3791
3764
|
if (!this.#t && !this.#e) return;
|
|
3792
3765
|
if (this.#t && !this.#e) {
|
|
3793
3766
|
const c = t.clientX - this.#i, d = t.clientY - this.#s;
|
|
3794
|
-
if (Math.hypot(c, d) <
|
|
3795
|
-
this.#t = !1, this.#e = !0, this.#
|
|
3767
|
+
if (Math.hypot(c, d) < _t) return;
|
|
3768
|
+
this.#t = !1, this.#e = !0, this.#p(t);
|
|
3796
3769
|
}
|
|
3797
3770
|
if (!this.#e || !this.#a) return;
|
|
3798
3771
|
this.#a.style.left = `${t.clientX + 12}px`, this.#a.style.top = `${t.clientY - 14}px`, this.#a.style.display = "none";
|
|
3799
3772
|
const e = document.elementFromPoint(t.clientX, t.clientY);
|
|
3800
3773
|
if (this.#a.style.display = "", !e) {
|
|
3801
|
-
this.#
|
|
3774
|
+
this.#m();
|
|
3802
3775
|
return;
|
|
3803
3776
|
}
|
|
3804
3777
|
const s = e.closest(".ry-tree__label, .ry-tree__file");
|
|
3805
3778
|
if (!s) {
|
|
3806
|
-
this.#
|
|
3779
|
+
this.#m();
|
|
3807
3780
|
return;
|
|
3808
3781
|
}
|
|
3809
3782
|
const i = s.closest(".ry-tree__item");
|
|
3810
3783
|
if (!i || i === this.#r) {
|
|
3811
|
-
this.#
|
|
3784
|
+
this.#m();
|
|
3812
3785
|
return;
|
|
3813
3786
|
}
|
|
3814
3787
|
if (this.#r?.contains(i)) {
|
|
3815
|
-
this.#
|
|
3788
|
+
this.#m();
|
|
3816
3789
|
return;
|
|
3817
3790
|
}
|
|
3818
3791
|
const r = s.getBoundingClientRect(), a = t.clientY - r.top, n = r.height, o = i.querySelector(":scope > .ry-tree__toggle") !== null;
|
|
@@ -3820,9 +3793,9 @@ class w extends u {
|
|
|
3820
3793
|
o && a > n * 0.25 && a < n * 0.75 ? l = "inside" : a < n * 0.5 ? l = "before" : l = "after", this.#v(i, l);
|
|
3821
3794
|
};
|
|
3822
3795
|
#g = () => {
|
|
3823
|
-
this.#e && this.#
|
|
3796
|
+
this.#e && this.#y(), this.#t = !1, this.#e = !1, this.#r = null;
|
|
3824
3797
|
};
|
|
3825
|
-
#
|
|
3798
|
+
#p(t) {
|
|
3826
3799
|
if (!this.#r) return;
|
|
3827
3800
|
t.preventDefault(), this.#r.setAttribute("data-ry-dragging", ""), this.#r.classList.add("ry-tree__item--collapsed");
|
|
3828
3801
|
const e = this.#r.querySelector(".ry-tree__label, .ry-tree__file");
|
|
@@ -3830,20 +3803,20 @@ class w extends u {
|
|
|
3830
3803
|
const s = e.cloneNode(!0);
|
|
3831
3804
|
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;
|
|
3832
3805
|
}
|
|
3833
|
-
#
|
|
3806
|
+
#y() {
|
|
3834
3807
|
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");
|
|
3835
|
-
const t = this.#o, e = this.#
|
|
3836
|
-
this.#
|
|
3808
|
+
const t = this.#o, e = this.#l;
|
|
3809
|
+
this.#m(), this.#r && t && e && this.#M(this.#r, t, e);
|
|
3837
3810
|
}
|
|
3838
3811
|
#v(t, e) {
|
|
3839
|
-
this.#o === t && this.#
|
|
3812
|
+
this.#o === t && this.#l === e || (this.#m(), t.setAttribute("data-ry-drop-target", e), this.#o = t, this.#l = e);
|
|
3840
3813
|
}
|
|
3841
|
-
#
|
|
3842
|
-
this.#o?.removeAttribute("data-ry-drop-target"), this.#o = null, this.#
|
|
3814
|
+
#m() {
|
|
3815
|
+
this.#o?.removeAttribute("data-ry-drop-target"), this.#o = null, this.#l = null;
|
|
3843
3816
|
}
|
|
3844
3817
|
#M(t, e, s) {
|
|
3845
3818
|
if (s === "inside" && e.contains(t)) return;
|
|
3846
|
-
const i = this.#
|
|
3819
|
+
const i = this.#w(t), r = this.#w(e);
|
|
3847
3820
|
if (s === "before")
|
|
3848
3821
|
e.parentNode?.insertBefore(t, e);
|
|
3849
3822
|
else if (s === "after")
|
|
@@ -3862,24 +3835,24 @@ class w extends u {
|
|
|
3862
3835
|
position: s
|
|
3863
3836
|
});
|
|
3864
3837
|
}
|
|
3865
|
-
#
|
|
3838
|
+
#w(t) {
|
|
3866
3839
|
const e = t.querySelector(':scope > [data-ry-target="folder"]'), s = t.querySelector(':scope > [data-ry-target="file"]');
|
|
3867
3840
|
return e?.dataset.ryLabel ?? s?.dataset.ryLabel ?? "";
|
|
3868
3841
|
}
|
|
3869
3842
|
}
|
|
3870
|
-
class
|
|
3843
|
+
class Mt extends u {
|
|
3871
3844
|
// Declarative container consumed by RyTree#build
|
|
3872
3845
|
}
|
|
3873
|
-
customElements.define("ry-tree",
|
|
3874
|
-
customElements.define("ry-tree-item",
|
|
3875
|
-
class
|
|
3846
|
+
customElements.define("ry-tree", k);
|
|
3847
|
+
customElements.define("ry-tree-item", Mt);
|
|
3848
|
+
class Et extends u {
|
|
3876
3849
|
setup() {
|
|
3877
3850
|
this.#t();
|
|
3878
3851
|
}
|
|
3879
3852
|
#t() {
|
|
3880
3853
|
if (this.$('[data-ry-target="label"]')) return;
|
|
3881
3854
|
const t = this.textContent?.trim() ?? "", e = this.hasAttribute("removable");
|
|
3882
|
-
if (this.innerHTML = `<span data-ry-target="label" class="ry-tag__label">${t}</span>${e ? `<button data-ry-target="remove" class="ry-tag__remove" aria-label="Remove" type="button">${
|
|
3855
|
+
if (this.innerHTML = `<span data-ry-target="label" class="ry-tag__label">${t}</span>${e ? `<button data-ry-target="remove" class="ry-tag__remove" aria-label="Remove" type="button">${g("close")}</button>` : ""}`, e) {
|
|
3883
3856
|
const s = this.$('[data-ry-target="remove"]');
|
|
3884
3857
|
s && this.on(s, "click", (i) => {
|
|
3885
3858
|
i.stopPropagation(), this.emit("remove", {
|
|
@@ -3893,8 +3866,8 @@ class Mt extends u {
|
|
|
3893
3866
|
return this.$('[data-ry-target="label"]')?.textContent?.trim() ?? "";
|
|
3894
3867
|
}
|
|
3895
3868
|
}
|
|
3896
|
-
customElements.define("ry-tag",
|
|
3897
|
-
class
|
|
3869
|
+
customElements.define("ry-tag", Et);
|
|
3870
|
+
class Ct extends u {
|
|
3898
3871
|
#t = [];
|
|
3899
3872
|
setup() {
|
|
3900
3873
|
this.#e(), this.#i();
|
|
@@ -3929,7 +3902,7 @@ class Et extends u {
|
|
|
3929
3902
|
else if (t.key === "Tab")
|
|
3930
3903
|
return;
|
|
3931
3904
|
}
|
|
3932
|
-
t.key === "Backspace" && !e.value && this.#t.length > 0 && this.#
|
|
3905
|
+
t.key === "Backspace" && !e.value && this.#t.length > 0 && this.#l();
|
|
3933
3906
|
};
|
|
3934
3907
|
#r = (t) => {
|
|
3935
3908
|
t.preventDefault();
|
|
@@ -3941,7 +3914,7 @@ class Et extends u {
|
|
|
3941
3914
|
};
|
|
3942
3915
|
#a = (t) => {
|
|
3943
3916
|
const e = t.detail.value, s = this.#t.indexOf(e);
|
|
3944
|
-
s >= 0 && (this.#t.splice(s, 1), this.#
|
|
3917
|
+
s >= 0 && (this.#t.splice(s, 1), this.#c(), this.emit("change", { values: [...this.#t] }));
|
|
3945
3918
|
};
|
|
3946
3919
|
#o(t) {
|
|
3947
3920
|
const e = this.getAttribute("max-tags");
|
|
@@ -3952,16 +3925,16 @@ class Et extends u {
|
|
|
3952
3925
|
const i = document.createElement("ry-tag");
|
|
3953
3926
|
i.setAttribute("removable", ""), i.setAttribute("size", "sm"), i.setAttribute("data-value", t), i.textContent = t, s.appendChild(i);
|
|
3954
3927
|
}
|
|
3955
|
-
this.#
|
|
3928
|
+
this.#c(), this.emit("add", { value: t }), this.emit("change", { values: [...this.#t] });
|
|
3956
3929
|
}
|
|
3957
|
-
#
|
|
3930
|
+
#l() {
|
|
3958
3931
|
const e = this.$('[data-ry-target="tags"]')?.lastElementChild;
|
|
3959
3932
|
if (e) {
|
|
3960
3933
|
const s = e.dataset.value ?? "";
|
|
3961
|
-
e.remove(), this.#t.pop(), this.#
|
|
3934
|
+
e.remove(), this.#t.pop(), this.#c(), this.emit("remove", { value: s, label: s }), this.emit("change", { values: [...this.#t] });
|
|
3962
3935
|
}
|
|
3963
3936
|
}
|
|
3964
|
-
#
|
|
3937
|
+
#c() {
|
|
3965
3938
|
const t = this.$('[data-ry-target="hidden"]'), e = this.getAttribute("delimiter") ?? ",";
|
|
3966
3939
|
t && (t.value = this.#t.join(e));
|
|
3967
3940
|
}
|
|
@@ -3973,25 +3946,25 @@ class Et extends u {
|
|
|
3973
3946
|
return [...this.#t];
|
|
3974
3947
|
}
|
|
3975
3948
|
}
|
|
3976
|
-
customElements.define("ry-tag-input",
|
|
3977
|
-
class Ct extends u {
|
|
3978
|
-
}
|
|
3979
|
-
customElements.define("ry-hero", Ct);
|
|
3949
|
+
customElements.define("ry-tag-input", Ct);
|
|
3980
3950
|
class St extends u {
|
|
3951
|
+
}
|
|
3952
|
+
customElements.define("ry-hero", St);
|
|
3953
|
+
class Tt extends u {
|
|
3981
3954
|
setup() {
|
|
3982
3955
|
this.#t();
|
|
3983
3956
|
}
|
|
3984
3957
|
#t() {
|
|
3985
3958
|
if (this.$('[data-ry-target="value"]')) return;
|
|
3986
|
-
const t = this.
|
|
3959
|
+
const t = this.getAttribute("value") ?? "", e = this.getAttribute("label") ?? "", s = this.getAttribute("trend"), i = s === "up" ? `<span data-ry-target="trend" class="ry-stat__trend ry-stat__trend--up">${g("chevron-up")}</span>` : s === "down" ? `<span data-ry-target="trend" class="ry-stat__trend ry-stat__trend--down">${g("chevron-down")}</span>` : "";
|
|
3987
3960
|
this.innerHTML = `
|
|
3988
|
-
<div data-ry-target="value" class="ry-stat__value">${
|
|
3989
|
-
<div data-ry-target="label" class="ry-stat__label">${
|
|
3961
|
+
<div data-ry-target="value" class="ry-stat__value">${t}${i}</div>
|
|
3962
|
+
<div data-ry-target="label" class="ry-stat__label">${e}</div>
|
|
3990
3963
|
`;
|
|
3991
3964
|
}
|
|
3992
3965
|
}
|
|
3993
|
-
customElements.define("ry-stat",
|
|
3994
|
-
class
|
|
3966
|
+
customElements.define("ry-stat", Tt);
|
|
3967
|
+
class Lt extends u {
|
|
3995
3968
|
setup() {
|
|
3996
3969
|
this.#t();
|
|
3997
3970
|
}
|
|
@@ -3999,23 +3972,35 @@ class Tt extends u {
|
|
|
3999
3972
|
if (this.$('[data-ry-target="icon"]')) return;
|
|
4000
3973
|
const t = this.getAttribute("icon");
|
|
4001
3974
|
if (!t) return;
|
|
4002
|
-
const e =
|
|
3975
|
+
const e = g(t);
|
|
4003
3976
|
if (!e) return;
|
|
4004
3977
|
const s = document.createElement("div");
|
|
4005
3978
|
s.setAttribute("data-ry-target", "icon"), s.className = "ry-feature__icon", s.innerHTML = e, this.insertBefore(s, this.firstChild);
|
|
4006
3979
|
}
|
|
4007
3980
|
}
|
|
4008
|
-
class
|
|
3981
|
+
class It extends u {
|
|
4009
3982
|
}
|
|
4010
|
-
customElements.define("ry-feature",
|
|
4011
|
-
customElements.define("ry-feature-grid",
|
|
3983
|
+
customElements.define("ry-feature", Lt);
|
|
3984
|
+
customElements.define("ry-feature-grid", It);
|
|
4012
3985
|
class Ht extends u {
|
|
4013
3986
|
}
|
|
4014
|
-
class
|
|
3987
|
+
class Dt extends u {
|
|
3988
|
+
setup() {
|
|
3989
|
+
this.#t();
|
|
3990
|
+
}
|
|
3991
|
+
#t() {
|
|
3992
|
+
if (this.$('[data-ry-target="title"]')) return;
|
|
3993
|
+
const t = this.getAttribute("title") ?? "", e = this.getAttribute("price") ?? "", s = this.innerHTML;
|
|
3994
|
+
this.innerHTML = `
|
|
3995
|
+
${t ? `<h3 data-ry-target="title" class="ry-pricing-card__title">${t}</h3>` : ""}
|
|
3996
|
+
${e ? `<div data-ry-target="price" class="ry-pricing-card__price">${e}</div>` : ""}
|
|
3997
|
+
${s}
|
|
3998
|
+
`;
|
|
3999
|
+
}
|
|
4015
4000
|
}
|
|
4016
4001
|
customElements.define("ry-pricing", Ht);
|
|
4017
|
-
customElements.define("ry-pricing-card",
|
|
4018
|
-
class
|
|
4002
|
+
customElements.define("ry-pricing-card", Dt);
|
|
4003
|
+
class Bt extends u {
|
|
4019
4004
|
#t = 0;
|
|
4020
4005
|
#e = 0;
|
|
4021
4006
|
#i = null;
|
|
@@ -4037,9 +4022,9 @@ class Dt extends u {
|
|
|
4037
4022
|
const r = document.createElement("div");
|
|
4038
4023
|
if (r.setAttribute("data-ry-target", "viewport"), r.className = "ry-carousel__viewport", r.appendChild(i), this.innerHTML = "", this.appendChild(r), e) {
|
|
4039
4024
|
const a = document.createElement("button");
|
|
4040
|
-
a.setAttribute("data-ry-target", "prev"), a.className = "ry-carousel__arrow ry-carousel__arrow--prev", a.setAttribute("aria-label", "Previous slide"), a.setAttribute("type", "button"), a.innerHTML =
|
|
4025
|
+
a.setAttribute("data-ry-target", "prev"), a.className = "ry-carousel__arrow ry-carousel__arrow--prev", a.setAttribute("aria-label", "Previous slide"), a.setAttribute("type", "button"), a.innerHTML = g("chevron-left"), this.appendChild(a), this.on(a, "click", () => this.prev());
|
|
4041
4026
|
const n = document.createElement("button");
|
|
4042
|
-
n.setAttribute("data-ry-target", "next"), n.className = "ry-carousel__arrow ry-carousel__arrow--next", n.setAttribute("aria-label", "Next slide"), n.setAttribute("type", "button"), n.innerHTML =
|
|
4027
|
+
n.setAttribute("data-ry-target", "next"), n.className = "ry-carousel__arrow ry-carousel__arrow--next", n.setAttribute("aria-label", "Next slide"), n.setAttribute("type", "button"), n.innerHTML = g("chevron-right"), this.appendChild(n), this.on(n, "click", () => this.next());
|
|
4043
4028
|
}
|
|
4044
4029
|
if (s) {
|
|
4045
4030
|
const a = document.createElement("div");
|
|
@@ -4050,29 +4035,29 @@ class Dt extends u {
|
|
|
4050
4035
|
}
|
|
4051
4036
|
this.appendChild(a);
|
|
4052
4037
|
}
|
|
4053
|
-
this.on(r, "pointerdown", this.#
|
|
4038
|
+
this.on(r, "pointerdown", this.#l), this.on(r, "pointermove", this.#c), this.on(r, "pointerup", this.#u), this.on(r, "pointercancel", this.#u), this.hasAttribute("pause-on-hover") && (this.on(this, "mouseenter", () => this.#d()), this.on(this, "mouseleave", () => this.#n())), this.goTo(0);
|
|
4054
4039
|
}
|
|
4055
4040
|
#o = (t) => {
|
|
4056
4041
|
t.key === "ArrowLeft" ? (t.preventDefault(), this.prev()) : t.key === "ArrowRight" && (t.preventDefault(), this.next());
|
|
4057
4042
|
};
|
|
4058
|
-
#
|
|
4043
|
+
#l = (t) => {
|
|
4059
4044
|
this.#s = t.clientX, this.#r = !0, t.currentTarget.setPointerCapture(t.pointerId);
|
|
4060
4045
|
};
|
|
4061
|
-
#
|
|
4046
|
+
#c = (t) => {
|
|
4062
4047
|
this.#r && t.preventDefault();
|
|
4063
4048
|
};
|
|
4064
|
-
#
|
|
4049
|
+
#u = (t) => {
|
|
4065
4050
|
if (!this.#r) return;
|
|
4066
4051
|
this.#r = !1;
|
|
4067
4052
|
const e = t.clientX - this.#s, s = 50;
|
|
4068
4053
|
e > s ? this.prev() : e < -s && this.next();
|
|
4069
4054
|
};
|
|
4070
4055
|
#n() {
|
|
4071
|
-
if (this.#
|
|
4056
|
+
if (this.#d(), !this.hasAttribute("autoplay")) return;
|
|
4072
4057
|
const t = parseInt(this.getAttribute("interval") ?? "5000", 10);
|
|
4073
4058
|
this.#i = setInterval(() => this.next(), t);
|
|
4074
4059
|
}
|
|
4075
|
-
#
|
|
4060
|
+
#d() {
|
|
4076
4061
|
this.#i && (clearInterval(this.#i), this.#i = null);
|
|
4077
4062
|
}
|
|
4078
4063
|
goTo(t) {
|
|
@@ -4092,29 +4077,29 @@ class Dt extends u {
|
|
|
4092
4077
|
this.goTo(this.#t - 1);
|
|
4093
4078
|
}
|
|
4094
4079
|
teardown() {
|
|
4095
|
-
this.#
|
|
4080
|
+
this.#d();
|
|
4096
4081
|
}
|
|
4097
4082
|
}
|
|
4098
|
-
customElements.define("ry-carousel",
|
|
4099
|
-
const
|
|
4100
|
-
class
|
|
4083
|
+
customElements.define("ry-carousel", Bt);
|
|
4084
|
+
const R = "ry-theme-panel";
|
|
4085
|
+
class Rt extends u {
|
|
4101
4086
|
#t = "default";
|
|
4102
4087
|
#e = "auto";
|
|
4103
4088
|
setup() {
|
|
4104
|
-
const t = this.#
|
|
4105
|
-
this.#t = t?.theme ?? this.getAttribute("theme") ?? document.documentElement.dataset.ryTheme ?? "default", this.#e = t?.mode ?? this.getAttribute("mode") ?? document.documentElement.dataset.ryMode ?? "auto", (this.#t === "light" || this.#t === "dark") && (this.#e = this.#t, this.#t = "default"), this.innerHTML = this.#
|
|
4089
|
+
const t = this.#c();
|
|
4090
|
+
this.#t = t?.theme ?? this.getAttribute("theme") ?? document.documentElement.dataset.ryTheme ?? "default", this.#e = t?.mode ?? this.getAttribute("mode") ?? document.documentElement.dataset.ryMode ?? "auto", (this.#t === "light" || this.#t === "dark") && (this.#e = this.#t, this.#t = "default"), this.innerHTML = this.#u(), this.#i(), this.#s();
|
|
4106
4091
|
}
|
|
4107
4092
|
#i() {
|
|
4108
4093
|
this.$$('[data-ry-target="theme-btn"]').forEach((t) => {
|
|
4109
4094
|
this.on(t, "click", () => {
|
|
4110
|
-
this.#t = t.dataset.value ?? "default", this.#s(), this.#o(), this.#
|
|
4095
|
+
this.#t = t.dataset.value ?? "default", this.#s(), this.#o(), this.#l(), this.emit("theme-panel-change", {
|
|
4111
4096
|
theme: this.#t,
|
|
4112
4097
|
mode: this.#e
|
|
4113
4098
|
});
|
|
4114
4099
|
});
|
|
4115
4100
|
}), this.$$('[data-ry-target="mode-btn"]').forEach((t) => {
|
|
4116
4101
|
this.on(t, "click", () => {
|
|
4117
|
-
this.#e = t.dataset.value ?? "auto", this.#s(), this.#o(), this.#
|
|
4102
|
+
this.#e = t.dataset.value ?? "auto", this.#s(), this.#o(), this.#l(), this.emit("theme-panel-change", {
|
|
4118
4103
|
theme: this.#t,
|
|
4119
4104
|
mode: this.#e
|
|
4120
4105
|
});
|
|
@@ -4135,13 +4120,7 @@ class Bt extends u {
|
|
|
4135
4120
|
}
|
|
4136
4121
|
#a(t) {
|
|
4137
4122
|
const e = this.getAttribute("base-path");
|
|
4138
|
-
|
|
4139
|
-
const s = document.querySelector('link[href*="ry-"]');
|
|
4140
|
-
if (s) {
|
|
4141
|
-
const i = s.getAttribute("href") ?? "";
|
|
4142
|
-
return `${i.substring(0, i.lastIndexOf("/"))}/../themes/${t}`;
|
|
4143
|
-
}
|
|
4144
|
-
return `/src/themes/${t}`;
|
|
4123
|
+
return e ? `${e}/${t}` : `/themes/${t}`;
|
|
4145
4124
|
}
|
|
4146
4125
|
#o() {
|
|
4147
4126
|
this.$$('[data-ry-target="theme-btn"]').forEach((t) => {
|
|
@@ -4152,24 +4131,24 @@ class Bt extends u {
|
|
|
4152
4131
|
e.setAttribute("aria-pressed", String(e.dataset.value === this.#e));
|
|
4153
4132
|
});
|
|
4154
4133
|
}
|
|
4155
|
-
#
|
|
4134
|
+
#l() {
|
|
4156
4135
|
try {
|
|
4157
|
-
localStorage.setItem(
|
|
4136
|
+
localStorage.setItem(R, JSON.stringify({
|
|
4158
4137
|
theme: this.#t,
|
|
4159
4138
|
mode: this.#e
|
|
4160
4139
|
}));
|
|
4161
4140
|
} catch {
|
|
4162
4141
|
}
|
|
4163
4142
|
}
|
|
4164
|
-
#
|
|
4143
|
+
#c() {
|
|
4165
4144
|
try {
|
|
4166
|
-
const t = localStorage.getItem(
|
|
4145
|
+
const t = localStorage.getItem(R);
|
|
4167
4146
|
return t ? JSON.parse(t) : null;
|
|
4168
4147
|
} catch {
|
|
4169
4148
|
return null;
|
|
4170
4149
|
}
|
|
4171
4150
|
}
|
|
4172
|
-
#
|
|
4151
|
+
#u() {
|
|
4173
4152
|
return `
|
|
4174
4153
|
<div data-ry-target="panel" class="ry-theme-panel">
|
|
4175
4154
|
<div data-ry-target="theme-row" class="ry-theme-panel__row">
|
|
@@ -4200,101 +4179,391 @@ class Bt extends u {
|
|
|
4200
4179
|
return this.#t;
|
|
4201
4180
|
}
|
|
4202
4181
|
set theme(t) {
|
|
4203
|
-
this.#t = t, this.#s(), this.#o(), this.#
|
|
4182
|
+
this.#t = t, this.#s(), this.#o(), this.#l();
|
|
4204
4183
|
}
|
|
4205
4184
|
get mode() {
|
|
4206
4185
|
return this.#e;
|
|
4207
4186
|
}
|
|
4208
4187
|
set mode(t) {
|
|
4209
|
-
this.#e = t, this.#s(), this.#o(), this.#
|
|
4188
|
+
this.#e = t, this.#s(), this.#o(), this.#l();
|
|
4210
4189
|
}
|
|
4211
4190
|
}
|
|
4212
|
-
customElements.define("ry-theme-panel",
|
|
4213
|
-
class
|
|
4191
|
+
customElements.define("ry-theme-panel", Rt);
|
|
4192
|
+
class Pt extends u {
|
|
4214
4193
|
setup() {
|
|
4215
4194
|
this.#t();
|
|
4216
4195
|
}
|
|
4217
4196
|
#t() {
|
|
4218
4197
|
if (this.$('[data-ry-target="quote"]')) return;
|
|
4219
|
-
const t = this.
|
|
4198
|
+
const t = this.getAttribute("avatar") ?? "", e = this.getAttribute("name") ?? "", s = this.getAttribute("role") ?? "", i = parseInt(this.getAttribute("stars") ?? "0", 10), r = this.textContent?.trim() ?? "", a = t ? `<div data-ry-target="avatar" class="ry-testimonial__avatar"><img src="${t}" alt="${e}"></div>` : "", n = i > 0 ? `<div data-ry-target="stars" class="ry-testimonial__stars">${Array.from({ length: i }, () => `<span class="ry-testimonial__star">${g("star")}</span>`).join("")}</div>` : "";
|
|
4220
4199
|
this.innerHTML = `
|
|
4221
|
-
${
|
|
4222
|
-
${
|
|
4223
|
-
<blockquote data-ry-target="quote" class="ry-testimonial__quote">${
|
|
4200
|
+
${a}
|
|
4201
|
+
${n}
|
|
4202
|
+
<blockquote data-ry-target="quote" class="ry-testimonial__quote">${r}</blockquote>
|
|
4224
4203
|
<div data-ry-target="attribution" class="ry-testimonial__attribution">
|
|
4225
|
-
<span data-ry-target="name" class="ry-testimonial__name">${
|
|
4226
|
-
${
|
|
4204
|
+
<span data-ry-target="name" class="ry-testimonial__name">${e}</span>
|
|
4205
|
+
${s ? `<span data-ry-target="role" class="ry-testimonial__role">${s}</span>` : ""}
|
|
4227
4206
|
</div>
|
|
4228
4207
|
`;
|
|
4229
4208
|
}
|
|
4230
4209
|
}
|
|
4231
|
-
customElements.define("ry-testimonial",
|
|
4232
|
-
class
|
|
4210
|
+
customElements.define("ry-testimonial", Pt);
|
|
4211
|
+
class Ft extends u {
|
|
4233
4212
|
setup() {
|
|
4234
4213
|
this.#t();
|
|
4235
4214
|
}
|
|
4236
4215
|
#t() {
|
|
4237
4216
|
if (this.$('[data-ry-target="title"]')) return;
|
|
4238
|
-
const t = this.
|
|
4239
|
-
t?.remove();
|
|
4240
|
-
const s = this.innerHTML.trim();
|
|
4217
|
+
const t = this.getAttribute("sub") ?? "", e = this.innerHTML.trim();
|
|
4241
4218
|
this.innerHTML = `
|
|
4242
|
-
<div data-ry-target="title" class="ry-heading__title">${
|
|
4243
|
-
${
|
|
4219
|
+
<div data-ry-target="title" class="ry-heading__title">${e}</div>
|
|
4220
|
+
${t ? `<div data-ry-target="sub" class="ry-heading__sub">${t}</div>` : ""}
|
|
4244
4221
|
`;
|
|
4245
4222
|
}
|
|
4246
4223
|
}
|
|
4247
|
-
customElements.define("ry-heading",
|
|
4248
|
-
|
|
4224
|
+
customElements.define("ry-heading", Ft);
|
|
4225
|
+
function Ot(h, t) {
|
|
4226
|
+
const e = h.toLowerCase(), s = t.toLowerCase();
|
|
4227
|
+
if (s.startsWith(e))
|
|
4228
|
+
return { score: 1, indices: Array.from({ length: e.length }, (l, c) => c) };
|
|
4229
|
+
const i = s.indexOf(e);
|
|
4230
|
+
if (i >= 0)
|
|
4231
|
+
return { score: 0.8, indices: Array.from({ length: e.length }, (l, c) => i + c) };
|
|
4232
|
+
const r = [];
|
|
4233
|
+
let a = 0;
|
|
4234
|
+
for (let l = 0; l < s.length && a < e.length; l++)
|
|
4235
|
+
s[l] === e[a] && (r.push(l), a++);
|
|
4236
|
+
if (a < e.length) return null;
|
|
4237
|
+
let n = 0;
|
|
4238
|
+
for (let l = 1; l < r.length; l++)
|
|
4239
|
+
r[l] === (r[l - 1] ?? 0) + 1 && n++;
|
|
4240
|
+
return { score: 0.3 + n / Math.max(r.length - 1, 1) * 0.4, indices: r };
|
|
4241
|
+
}
|
|
4242
|
+
function jt(h, t) {
|
|
4243
|
+
if (t.length === 0) return b(h);
|
|
4244
|
+
const e = new Set(t);
|
|
4245
|
+
let s = "", i = !1;
|
|
4246
|
+
for (let r = 0; r < h.length; r++) {
|
|
4247
|
+
const a = e.has(r);
|
|
4248
|
+
a && !i && (s += "<mark>", i = !0), !a && i && (s += "</mark>", i = !1), s += b(h[r] ?? "");
|
|
4249
|
+
}
|
|
4250
|
+
return i && (s += "</mark>"), s;
|
|
4251
|
+
}
|
|
4252
|
+
function b(h) {
|
|
4253
|
+
return h.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4254
|
+
}
|
|
4255
|
+
class Nt extends HTMLElement {
|
|
4256
|
+
}
|
|
4257
|
+
customElements.get("ry-search-item") || customElements.define("ry-search-item", Nt);
|
|
4258
|
+
class qt extends HTMLElement {
|
|
4259
|
+
}
|
|
4260
|
+
customElements.get("ry-search-group") || customElements.define("ry-search-group", qt);
|
|
4261
|
+
let Kt = 0;
|
|
4262
|
+
class zt extends u {
|
|
4263
|
+
#t = "";
|
|
4264
|
+
#e = -1;
|
|
4265
|
+
#i = "keyboard";
|
|
4266
|
+
#s = [];
|
|
4267
|
+
setup() {
|
|
4268
|
+
this.#t = `ry-search-list-${++Kt}`, this.#r();
|
|
4269
|
+
const t = this.$('[data-ry-target="input"]');
|
|
4270
|
+
t && this.on(t, "input", this.#a), this.on(document, "keydown", this.#c), this.on(this, "click", this.#u), this.on(this, "mouseover", this.#n);
|
|
4271
|
+
}
|
|
4272
|
+
#r() {
|
|
4273
|
+
const t = this.getAttribute("placeholder") ?? "Search...", e = [...this.querySelectorAll("ry-search-group")], s = e.length > 0;
|
|
4274
|
+
let i = 0;
|
|
4275
|
+
const r = [];
|
|
4276
|
+
let a = "";
|
|
4277
|
+
s ? e.forEach((o, l) => {
|
|
4278
|
+
const c = o.getAttribute("label") ?? "", d = [...o.querySelectorAll("ry-search-item")];
|
|
4279
|
+
let p = `
|
|
4280
|
+
<div data-ry-target="group-header" class="ry-search-list__group-header">${b(c)}</div>
|
|
4281
|
+
`;
|
|
4282
|
+
d.forEach((f) => {
|
|
4283
|
+
const y = f.getAttribute("value") ?? f.textContent?.trim() ?? "", x = f.textContent?.trim() ?? "";
|
|
4284
|
+
p += `
|
|
4285
|
+
<div data-ry-target="item" class="ry-search-list__item"
|
|
4286
|
+
role="option" id="${this.#t}-item-${i}"
|
|
4287
|
+
data-value="${b(y)}" data-ry-order="${i}"
|
|
4288
|
+
aria-selected="false">
|
|
4289
|
+
<span data-ry-target="item-label">${b(x)}</span>
|
|
4290
|
+
</div>
|
|
4291
|
+
`, r.push({ value: y, label: x, el: null, order: i, groupEl: null }), i++;
|
|
4292
|
+
}), a += `<div data-ry-target="group" class="ry-search-list__group" data-group-index="${l}">${p}</div>`;
|
|
4293
|
+
}) : [...this.querySelectorAll("ry-search-item")].forEach((l) => {
|
|
4294
|
+
const c = l.getAttribute("value") ?? l.textContent?.trim() ?? "", d = l.textContent?.trim() ?? "";
|
|
4295
|
+
a += `
|
|
4296
|
+
<div data-ry-target="item" class="ry-search-list__item"
|
|
4297
|
+
role="option" id="${this.#t}-item-${i}"
|
|
4298
|
+
data-value="${b(c)}" data-ry-order="${i}"
|
|
4299
|
+
aria-selected="false">
|
|
4300
|
+
<span data-ry-target="item-label">${b(d)}</span>
|
|
4301
|
+
</div>
|
|
4302
|
+
`, r.push({ value: c, label: d, el: null, order: i, groupEl: null }), i++;
|
|
4303
|
+
}), this.innerHTML = `
|
|
4304
|
+
<div data-ry-target="search" class="ry-search-list__search">
|
|
4305
|
+
<input data-ry-target="input" class="ry-search-list__input"
|
|
4306
|
+
type="text" placeholder="${b(t)}"
|
|
4307
|
+
autocomplete="off"
|
|
4308
|
+
role="combobox" aria-expanded="true"
|
|
4309
|
+
aria-controls="${this.#t}" aria-autocomplete="list">
|
|
4310
|
+
</div>
|
|
4311
|
+
<div data-ry-target="list" class="ry-search-list__list"
|
|
4312
|
+
role="listbox" id="${this.#t}">
|
|
4313
|
+
${a}
|
|
4314
|
+
</div>
|
|
4315
|
+
<div data-ry-target="empty" class="ry-search-list__empty" hidden>No results</div>
|
|
4316
|
+
`, this.$$('[data-ry-target="item"]').forEach((o, l) => {
|
|
4317
|
+
const c = r[l];
|
|
4318
|
+
c && (c.el = o, c.groupEl = o.closest('[data-ry-target="group"]'));
|
|
4319
|
+
}), this.#s = r;
|
|
4320
|
+
}
|
|
4321
|
+
// --- Filter ---
|
|
4322
|
+
#a = () => {
|
|
4323
|
+
const t = this.$('[data-ry-target="input"]');
|
|
4324
|
+
if (!t) return;
|
|
4325
|
+
const e = t.value.trim();
|
|
4326
|
+
this.#o(e);
|
|
4327
|
+
};
|
|
4328
|
+
#o(t) {
|
|
4329
|
+
let e = 0;
|
|
4330
|
+
if (!t)
|
|
4331
|
+
this.#s.forEach((i) => {
|
|
4332
|
+
i.el.removeAttribute("hidden");
|
|
4333
|
+
const r = i.el.querySelector('[data-ry-target="item-label"]');
|
|
4334
|
+
r && (r.innerHTML = b(i.label));
|
|
4335
|
+
}), this.$$('[data-ry-target="group"]').forEach((i) => i.removeAttribute("hidden")), e = this.#s.length, this.#l();
|
|
4336
|
+
else {
|
|
4337
|
+
const i = [];
|
|
4338
|
+
this.#s.forEach((a) => {
|
|
4339
|
+
const n = Ot(t, a.label);
|
|
4340
|
+
if (n) {
|
|
4341
|
+
a.el.removeAttribute("hidden");
|
|
4342
|
+
const o = a.el.querySelector('[data-ry-target="item-label"]');
|
|
4343
|
+
o && (o.innerHTML = jt(a.label, n.indices)), i.push({ item: a, result: n }), e++;
|
|
4344
|
+
} else {
|
|
4345
|
+
a.el.setAttribute("hidden", "");
|
|
4346
|
+
const o = a.el.querySelector('[data-ry-target="item-label"]');
|
|
4347
|
+
o && (o.innerHTML = b(a.label));
|
|
4348
|
+
}
|
|
4349
|
+
}), i.sort((a, n) => n.result.score - a.result.score);
|
|
4350
|
+
const r = /* @__PURE__ */ new Map();
|
|
4351
|
+
i.forEach((a) => {
|
|
4352
|
+
const n = a.item.groupEl, o = r.get(n) ?? [];
|
|
4353
|
+
o.push(a), r.set(n, o);
|
|
4354
|
+
}), r.forEach((a, n) => {
|
|
4355
|
+
const o = n ?? this.$('[data-ry-target="list"]');
|
|
4356
|
+
o && a.forEach((l) => o.appendChild(l.item.el));
|
|
4357
|
+
}), this.$$('[data-ry-target="group"]').forEach((a) => {
|
|
4358
|
+
a.querySelector('[data-ry-target="item"]:not([hidden])') ? a.removeAttribute("hidden") : a.setAttribute("hidden", "");
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4361
|
+
const s = this.$('[data-ry-target="empty"]');
|
|
4362
|
+
s && (e === 0 ? s.removeAttribute("hidden") : s.setAttribute("hidden", "")), this.#e = -1, this.$$('[data-ry-target="item"][data-highlighted]').forEach((i) => {
|
|
4363
|
+
i.removeAttribute("data-highlighted");
|
|
4364
|
+
}), this.emit("filter", { query: t, count: e });
|
|
4365
|
+
}
|
|
4366
|
+
#l() {
|
|
4367
|
+
const t = this.$('[data-ry-target="list"]');
|
|
4368
|
+
if (!t) return;
|
|
4369
|
+
const e = this.$$('[data-ry-target="group"]');
|
|
4370
|
+
if (e.length > 0)
|
|
4371
|
+
e.forEach((s) => {
|
|
4372
|
+
const i = [...s.querySelectorAll('[data-ry-target="item"]')];
|
|
4373
|
+
i.sort((r, a) => Number(r.dataset.ryOrder ?? 0) - Number(a.dataset.ryOrder ?? 0)), i.forEach((r) => s.appendChild(r));
|
|
4374
|
+
});
|
|
4375
|
+
else {
|
|
4376
|
+
const s = [...t.querySelectorAll('[data-ry-target="item"]')];
|
|
4377
|
+
s.sort((i, r) => Number(i.dataset.ryOrder ?? 0) - Number(r.dataset.ryOrder ?? 0)), s.forEach((i) => t.appendChild(i));
|
|
4378
|
+
}
|
|
4379
|
+
}
|
|
4380
|
+
// --- Keyboard ---
|
|
4381
|
+
#c = (t) => {
|
|
4382
|
+
const e = document.activeElement, s = this.$('[data-ry-target="input"]');
|
|
4383
|
+
if (!(e && e !== s && e !== document.body && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e.isContentEditable)))
|
|
4384
|
+
switch (t.key) {
|
|
4385
|
+
case "ArrowDown":
|
|
4386
|
+
t.preventDefault(), this.#i = "keyboard", this.#b();
|
|
4387
|
+
break;
|
|
4388
|
+
case "ArrowUp":
|
|
4389
|
+
t.preventDefault(), this.#i = "keyboard", this.#f();
|
|
4390
|
+
break;
|
|
4391
|
+
case "Home":
|
|
4392
|
+
t.preventDefault(), this.#i = "keyboard", this.#h(0);
|
|
4393
|
+
break;
|
|
4394
|
+
case "End": {
|
|
4395
|
+
t.preventDefault(), this.#i = "keyboard";
|
|
4396
|
+
const i = this.#d();
|
|
4397
|
+
this.#h(i.length - 1);
|
|
4398
|
+
break;
|
|
4399
|
+
}
|
|
4400
|
+
case "Enter":
|
|
4401
|
+
if (this.#e >= 0) {
|
|
4402
|
+
t.preventDefault();
|
|
4403
|
+
const r = this.#d()[this.#e];
|
|
4404
|
+
r && this.#g(r);
|
|
4405
|
+
}
|
|
4406
|
+
break;
|
|
4407
|
+
case "Escape": {
|
|
4408
|
+
t.preventDefault();
|
|
4409
|
+
const i = this.$('[data-ry-target="input"]');
|
|
4410
|
+
i && (i.value = "", i.blur()), this.#o("");
|
|
4411
|
+
break;
|
|
4412
|
+
}
|
|
4413
|
+
default:
|
|
4414
|
+
if (t.key.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey) {
|
|
4415
|
+
const i = this.$('[data-ry-target="input"]');
|
|
4416
|
+
i && e !== i && i.focus();
|
|
4417
|
+
}
|
|
4418
|
+
}
|
|
4419
|
+
};
|
|
4420
|
+
// --- Click / Hover ---
|
|
4421
|
+
#u = (t) => {
|
|
4422
|
+
const s = t.target.closest('[data-ry-target="item"]');
|
|
4423
|
+
s instanceof HTMLElement && !s.hasAttribute("hidden") && this.#g(s);
|
|
4424
|
+
};
|
|
4425
|
+
#n = (t) => {
|
|
4426
|
+
const s = t.target.closest('[data-ry-target="item"]');
|
|
4427
|
+
if (!(s instanceof HTMLElement) || s.hasAttribute("hidden")) return;
|
|
4428
|
+
const r = this.#d().indexOf(s);
|
|
4429
|
+
r >= 0 && (this.#i = "mouse", this.#h(r));
|
|
4430
|
+
};
|
|
4431
|
+
// --- Highlight ---
|
|
4432
|
+
#d() {
|
|
4433
|
+
return this.$$('[data-ry-target="item"]:not([hidden])');
|
|
4434
|
+
}
|
|
4435
|
+
#h(t) {
|
|
4436
|
+
const e = this.#d();
|
|
4437
|
+
if (t < 0 || t >= e.length) return;
|
|
4438
|
+
this.$$('[data-ry-target="item"][data-highlighted]').forEach((r) => {
|
|
4439
|
+
r.removeAttribute("data-highlighted");
|
|
4440
|
+
});
|
|
4441
|
+
const s = e[t];
|
|
4442
|
+
if (!s) return;
|
|
4443
|
+
s.setAttribute("data-highlighted", ""), this.#i === "keyboard" && s.scrollIntoView({ block: "center" }), this.#e = t;
|
|
4444
|
+
const i = this.$('[data-ry-target="input"]');
|
|
4445
|
+
if (i && i.setAttribute("aria-activedescendant", s.id), this.#i === "keyboard") {
|
|
4446
|
+
const r = s.dataset.value ?? "", n = s.querySelector('[data-ry-target="item-label"]')?.textContent?.trim() ?? "";
|
|
4447
|
+
this.emit("highlight", { value: r, label: n });
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4450
|
+
#b() {
|
|
4451
|
+
const t = this.#d();
|
|
4452
|
+
if (this.#e < 0) {
|
|
4453
|
+
this.#h(this.#A(t));
|
|
4454
|
+
return;
|
|
4455
|
+
}
|
|
4456
|
+
const e = Math.min(this.#e + 1, t.length - 1);
|
|
4457
|
+
this.#h(e);
|
|
4458
|
+
}
|
|
4459
|
+
#f() {
|
|
4460
|
+
if (this.#e < 0) {
|
|
4461
|
+
this.#h(this.#A(this.#d()));
|
|
4462
|
+
return;
|
|
4463
|
+
}
|
|
4464
|
+
const t = Math.max(this.#e - 1, 0);
|
|
4465
|
+
this.#h(t);
|
|
4466
|
+
}
|
|
4467
|
+
#A(t) {
|
|
4468
|
+
const e = this.$('[data-ry-target="item"][aria-selected="true"]');
|
|
4469
|
+
if (e instanceof HTMLElement) {
|
|
4470
|
+
const s = t.indexOf(e);
|
|
4471
|
+
if (s >= 0) return s;
|
|
4472
|
+
}
|
|
4473
|
+
return 0;
|
|
4474
|
+
}
|
|
4475
|
+
// --- Selection ---
|
|
4476
|
+
#g(t) {
|
|
4477
|
+
const e = t.dataset.value ?? "", i = t.querySelector('[data-ry-target="item-label"]')?.textContent?.trim() ?? "";
|
|
4478
|
+
this.$$('[data-ry-target="item"]').forEach((a) => {
|
|
4479
|
+
a.setAttribute("aria-selected", "false");
|
|
4480
|
+
}), t.setAttribute("aria-selected", "true"), this.setAttribute("value", e);
|
|
4481
|
+
const r = this.$('[data-ry-target="input"]');
|
|
4482
|
+
r && r.value && (r.value = "", this.#o("")), this.#i === "keyboard" && t.scrollIntoView({ block: "center" }), this.emit("select", { value: e, label: i });
|
|
4483
|
+
}
|
|
4484
|
+
// --- Public API ---
|
|
4485
|
+
get value() {
|
|
4486
|
+
return this.getAttribute("value") ?? "";
|
|
4487
|
+
}
|
|
4488
|
+
set value(t) {
|
|
4489
|
+
const e = this.$(`[data-ry-target="item"][data-value="${t}"]`);
|
|
4490
|
+
e && this.#g(e);
|
|
4491
|
+
}
|
|
4492
|
+
clear() {
|
|
4493
|
+
const t = this.$('[data-ry-target="input"]');
|
|
4494
|
+
t && (t.value = ""), this.#o("");
|
|
4495
|
+
}
|
|
4496
|
+
}
|
|
4497
|
+
customElements.define("ry-search-list", zt);
|
|
4498
|
+
class Vt extends u {
|
|
4499
|
+
setup() {
|
|
4500
|
+
this.getAttribute("layout") === "marquee" && this.#t();
|
|
4501
|
+
}
|
|
4502
|
+
#t() {
|
|
4503
|
+
const t = this.$("p"), e = [...this.children].filter((i) => i.tagName !== "P");
|
|
4504
|
+
if (e.length === 0) return;
|
|
4505
|
+
const s = document.createElement("div");
|
|
4506
|
+
s.setAttribute("data-ry-target", "track"), s.classList.add("ry-logo-bar__track"), e.forEach((i) => s.appendChild(i));
|
|
4507
|
+
for (let i = 0; i < 3; i++)
|
|
4508
|
+
e.forEach((r) => {
|
|
4509
|
+
const a = r.cloneNode(!0);
|
|
4510
|
+
a.setAttribute("aria-hidden", "true"), s.appendChild(a);
|
|
4511
|
+
});
|
|
4512
|
+
this.innerHTML = "", t && this.appendChild(t), this.appendChild(s);
|
|
4513
|
+
}
|
|
4514
|
+
}
|
|
4515
|
+
customElements.define("ry-logo-bar", Vt);
|
|
4516
|
+
window.RyToast = m;
|
|
4249
4517
|
console.log("ry-ui loaded");
|
|
4250
4518
|
export {
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
O as RyDropdown,
|
|
4519
|
+
O as RyAccordion,
|
|
4520
|
+
W as RyAlert,
|
|
4521
|
+
K as RyButton,
|
|
4522
|
+
U as RyCard,
|
|
4523
|
+
Bt as RyCarousel,
|
|
4524
|
+
nt as RyCode,
|
|
4525
|
+
vt as RyColorInput,
|
|
4526
|
+
bt as RyColorPicker,
|
|
4527
|
+
at as RyCombobox,
|
|
4528
|
+
Q as RyDrawer,
|
|
4529
|
+
q as RyDropdown,
|
|
4263
4530
|
u as RyElement,
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4531
|
+
ot as RyExample,
|
|
4532
|
+
Lt as RyFeature,
|
|
4533
|
+
It as RyFeatureGrid,
|
|
4534
|
+
Y as RyField,
|
|
4535
|
+
wt as RyGradientPicker,
|
|
4536
|
+
Ft as RyHeading,
|
|
4537
|
+
St as RyHero,
|
|
4538
|
+
ht as RyIcon,
|
|
4539
|
+
gt as RyKnob,
|
|
4540
|
+
Vt as RyLogoBar,
|
|
4541
|
+
j as RyModal,
|
|
4542
|
+
ft as RyNumberSelect,
|
|
4275
4543
|
Ht as RyPricing,
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
Et as
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4544
|
+
Dt as RyPricingCard,
|
|
4545
|
+
zt as RySearchList,
|
|
4546
|
+
st as RySelect,
|
|
4547
|
+
pt as RySlider,
|
|
4548
|
+
z as RySplit,
|
|
4549
|
+
Tt as RyStat,
|
|
4550
|
+
G as RySwitch,
|
|
4551
|
+
N as RyTabs,
|
|
4552
|
+
Et as RyTag,
|
|
4553
|
+
Ct as RyTagInput,
|
|
4554
|
+
Pt as RyTestimonial,
|
|
4555
|
+
Rt as RyThemePanel,
|
|
4556
|
+
V as RyThemeToggle,
|
|
4557
|
+
m as RyToast,
|
|
4558
|
+
ut as RyToggleButton,
|
|
4559
|
+
Z as RyTooltip,
|
|
4560
|
+
k as RyTree,
|
|
4561
|
+
Mt as RyTreeItem,
|
|
4562
|
+
g as getIcon,
|
|
4563
|
+
Yt as getIconNames,
|
|
4564
|
+
T as processTransforms,
|
|
4565
|
+
Ut as registerIcon,
|
|
4566
|
+
Wt as registerIcons,
|
|
4567
|
+
C as transform
|
|
4299
4568
|
};
|
|
4300
4569
|
//# sourceMappingURL=ry-ui.js.map
|