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