@ryanhelsing/ry-ui 1.0.2 → 1.0.3

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.
Files changed (51) hide show
  1. package/AGENTS.md +56 -0
  2. package/README.md +26 -1
  3. package/dist/components/ry-carousel.d.ts +21 -0
  4. package/dist/components/ry-carousel.d.ts.map +1 -0
  5. package/dist/components/ry-feature.d.ts +21 -0
  6. package/dist/components/ry-feature.d.ts.map +1 -0
  7. package/dist/components/ry-hero.d.ts +16 -0
  8. package/dist/components/ry-hero.d.ts.map +1 -0
  9. package/dist/components/ry-number-select.d.ts.map +1 -1
  10. package/dist/components/ry-pricing.d.ts +21 -0
  11. package/dist/components/ry-pricing.d.ts.map +1 -0
  12. package/dist/components/ry-select.d.ts +8 -1
  13. package/dist/components/ry-select.d.ts.map +1 -1
  14. package/dist/components/ry-stat.d.ts +17 -0
  15. package/dist/components/ry-stat.d.ts.map +1 -0
  16. package/dist/components/ry-tag-input.d.ts +18 -0
  17. package/dist/components/ry-tag-input.d.ts.map +1 -0
  18. package/dist/components/ry-tag.d.ts +19 -0
  19. package/dist/components/ry-tag.d.ts.map +1 -0
  20. package/dist/core/ry-transform.d.ts.map +1 -1
  21. package/dist/css/ry-structure.css +620 -148
  22. package/dist/css/ry-theme.css +456 -180
  23. package/dist/css/ry-tokens.css +112 -24
  24. package/dist/css/ry-ui.css +4708 -1059
  25. package/dist/ry-ui.d.ts +7 -0
  26. package/dist/ry-ui.d.ts.map +1 -1
  27. package/dist/ry-ui.js +1071 -713
  28. package/dist/ry-ui.js.map +1 -1
  29. package/dist/themes/dark.css +7 -90
  30. package/dist/themes/light.css +6 -35
  31. package/dist/themes/ocean.css +22 -26
  32. package/docs/components/accordion.md +31 -0
  33. package/docs/components/button.md +65 -0
  34. package/docs/components/color.md +84 -0
  35. package/docs/components/display.md +69 -0
  36. package/docs/components/drawer.md +36 -0
  37. package/docs/components/dropdown.md +33 -0
  38. package/docs/components/forms.md +86 -0
  39. package/docs/components/knob.md +42 -0
  40. package/docs/components/layout.md +189 -0
  41. package/docs/components/modal.md +38 -0
  42. package/docs/components/number-select.md +42 -0
  43. package/docs/components/slider.md +48 -0
  44. package/docs/components/tabs.md +30 -0
  45. package/docs/components/theme-toggle.md +36 -0
  46. package/docs/components/toast.md +27 -0
  47. package/docs/components/tooltip.md +14 -0
  48. package/docs/components/tree.md +46 -0
  49. package/docs/theming.md +182 -0
  50. package/package.json +5 -3
  51. package/USING_CDN.md +0 -591
package/dist/ry-ui.js CHANGED
@@ -1,4 +1,4 @@
1
- class p extends HTMLElement {
1
+ class u extends HTMLElement {
2
2
  // Store for cleanup functions
3
3
  #t = [];
4
4
  // Store for MutationObserver
@@ -137,25 +137,34 @@ const D = [
137
137
  "color-input",
138
138
  "gradient-picker",
139
139
  "tree",
140
- "tree-item"
140
+ "tree-item",
141
+ "tag",
142
+ "tag-input",
143
+ "hero",
144
+ "stat",
145
+ "feature",
146
+ "feature-grid",
147
+ "pricing",
148
+ "pricing-card",
149
+ "carousel"
141
150
  ], B = new RegExp(
142
151
  `<(/?)(${D.join("|")})(\\s|>|/)`,
143
152
  "g"
144
153
  );
145
- function M(o) {
146
- return o.replace(B, "<$1ry-$2$3");
154
+ function M(h) {
155
+ return h.replace(B, "<$1ry-$2$3");
147
156
  }
148
- function C() {
149
- document.querySelectorAll("ry").forEach((o) => {
150
- const t = M(o.innerHTML), e = document.createElement("template");
151
- e.innerHTML = t, o.replaceWith(e.content);
152
- }), document.querySelectorAll("template[ry]").forEach((o) => {
153
- const t = M(o.innerHTML), e = document.createElement("template");
154
- e.innerHTML = t, o.replaceWith(e.content);
157
+ function E() {
158
+ document.querySelectorAll("ry").forEach((h) => {
159
+ const t = M(h.innerHTML), e = document.createElement("template");
160
+ e.innerHTML = t, h.replaceWith(e.content);
161
+ }), document.querySelectorAll("template[ry]").forEach((h) => {
162
+ const t = M(h.innerHTML), e = document.createElement("template");
163
+ e.innerHTML = t, h.replaceWith(e.content);
155
164
  });
156
165
  }
157
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", C) : C();
158
- class F extends p {
166
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", E) : E();
167
+ class R extends u {
159
168
  setup() {
160
169
  this.#t(), this.$$('[data-ry-target="trigger"]').forEach((t) => {
161
170
  this.on(t, "click", this.#i);
@@ -231,10 +240,10 @@ class F extends p {
231
240
  this.$$('[data-ry-target="item"]').forEach((t) => this.close(t));
232
241
  }
233
242
  }
234
- customElements.define("ry-accordion", F);
243
+ customElements.define("ry-accordion", R);
235
244
  customElements.get("ry-accordion-item") || customElements.define("ry-accordion-item", class extends HTMLElement {
236
245
  });
237
- class P extends p {
246
+ class P extends u {
238
247
  #t = null;
239
248
  #e = 0;
240
249
  setup() {
@@ -284,7 +293,7 @@ class P extends p {
284
293
  }
285
294
  }
286
295
  customElements.define("ry-modal", P);
287
- class R extends p {
296
+ class F extends u {
288
297
  setup() {
289
298
  this.#t(), this.$$('[data-ry-target="trigger"]').forEach((t) => {
290
299
  this.on(t, "click", this.#i);
@@ -295,8 +304,8 @@ class R extends p {
295
304
  if (t.length === 0) return;
296
305
  const e = t.findIndex((r) => r.hasAttribute("active")), s = e === -1 ? 0 : e, i = document.createElement("div");
297
306
  i.setAttribute("data-ry-target", "list"), i.className = "ry-tabs__list", i.setAttribute("role", "tablist"), t.forEach((r, a) => {
298
- const n = r.getAttribute("title") ?? `Tab ${a + 1}`, h = a === s, l = document.createElement("button");
299
- l.setAttribute("data-ry-target", "trigger"), l.className = "ry-tabs__trigger", l.setAttribute("role", "tab"), l.setAttribute("aria-selected", String(h)), l.textContent = n, i.appendChild(l), r.setAttribute("data-ry-target", "panel"), r.className = "ry-tabs__panel", r.setAttribute("role", "tabpanel"), r.dataset.ryState = h ? "active" : "", r.removeAttribute("title"), r.removeAttribute("active");
307
+ const n = r.getAttribute("title") ?? `Tab ${a + 1}`, o = a === s, l = document.createElement("button");
308
+ l.setAttribute("data-ry-target", "trigger"), l.className = "ry-tabs__trigger", l.setAttribute("role", "tab"), l.setAttribute("aria-selected", String(o)), l.textContent = n, i.appendChild(l), r.setAttribute("data-ry-target", "panel"), r.className = "ry-tabs__panel", r.setAttribute("role", "tabpanel"), r.dataset.ryState = o ? "active" : "", r.removeAttribute("title"), r.removeAttribute("active");
300
309
  }), this.insertBefore(i, this.firstChild);
301
310
  }
302
311
  #e() {
@@ -304,8 +313,8 @@ class R extends p {
304
313
  t.forEach((i, r) => {
305
314
  const a = e[r];
306
315
  if (!a) return;
307
- const n = i.id || `ry-tab-${this.id || ""}-${r}`, h = a.id || `ry-tabpanel-${this.id || ""}-${r}`;
308
- i.id = n, a.id = h, i.setAttribute("aria-controls", h), a.setAttribute("aria-labelledby", n), i.setAttribute("tabindex", i.getAttribute("aria-selected") === "true" ? "0" : "-1");
316
+ const n = i.id || `ry-tab-${this.id || ""}-${r}`, o = a.id || `ry-tabpanel-${this.id || ""}-${r}`;
317
+ i.id = n, a.id = o, i.setAttribute("aria-controls", o), a.setAttribute("aria-labelledby", n), i.setAttribute("tabindex", i.getAttribute("aria-selected") === "true" ? "0" : "-1");
309
318
  }), t.findIndex((i) => i.getAttribute("aria-selected") === "true") === -1 && t.length > 0 && this.select(0);
310
319
  }
311
320
  #i = (t) => {
@@ -346,10 +355,10 @@ class R extends p {
346
355
  return this.$$('[data-ry-target="trigger"]').findIndex((e) => e.getAttribute("aria-selected") === "true");
347
356
  }
348
357
  }
349
- customElements.define("ry-tabs", R);
358
+ customElements.define("ry-tabs", F);
350
359
  customElements.get("ry-tab") || customElements.define("ry-tab", class extends HTMLElement {
351
360
  });
352
- class j extends p {
361
+ class j extends u {
353
362
  setup() {
354
363
  this.#t();
355
364
  const t = this.$('[data-ry-target="trigger"]');
@@ -402,7 +411,7 @@ customElements.get("ry-menu") || customElements.define("ry-menu", class extends
402
411
  });
403
412
  customElements.get("ry-menu-item") || customElements.define("ry-menu-item", class extends HTMLElement {
404
413
  });
405
- class O extends p {
414
+ class N extends u {
406
415
  setup() {
407
416
  this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.setAttribute("role", "button"), this.on(this, "click", this.#t), this.on(this, "keydown", this.#e);
408
417
  }
@@ -417,8 +426,8 @@ class O extends p {
417
426
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
418
427
  };
419
428
  }
420
- customElements.define("ry-button", O);
421
- class N extends p {
429
+ customElements.define("ry-button", N);
430
+ class O extends u {
422
431
  #t = ["light", "dark"];
423
432
  #e = 0;
424
433
  setup() {
@@ -458,8 +467,8 @@ class N extends p {
458
467
  }
459
468
  }
460
469
  }
461
- customElements.define("ry-theme-toggle", N);
462
- class K extends p {
470
+ customElements.define("ry-theme-toggle", O);
471
+ class K extends u {
463
472
  setup() {
464
473
  this.#t();
465
474
  const t = this.$("[close]");
@@ -480,7 +489,7 @@ class K extends p {
480
489
  }
481
490
  }
482
491
  customElements.define("ry-alert", K);
483
- class q extends p {
492
+ class q extends u {
484
493
  setup() {
485
494
  this.#t();
486
495
  }
@@ -497,8 +506,8 @@ class q extends p {
497
506
  }
498
507
  }
499
508
  customElements.define("ry-field", q);
500
- let U = 0;
501
- class V extends p {
509
+ let V = 0;
510
+ class z extends u {
502
511
  #t = null;
503
512
  static observedAttributes = ["checked", "disabled"];
504
513
  setup() {
@@ -506,7 +515,7 @@ class V extends p {
506
515
  }
507
516
  #e() {
508
517
  if (this.$('[data-ry-target="track"]')) return;
509
- const t = `ry-switch-${++U}`, e = this.getAttribute("name") ?? "", s = this.hasAttribute("checked"), i = this.hasAttribute("disabled"), r = this.textContent?.trim() ?? "";
518
+ const t = `ry-switch-${++V}`, e = this.getAttribute("name") ?? "", s = this.hasAttribute("checked"), i = this.hasAttribute("disabled"), r = this.textContent?.trim() ?? "";
510
519
  this.innerHTML = `
511
520
  <label data-ry-target="wrapper" class="ry-switch__wrapper" for="${t}">
512
521
  <input
@@ -551,41 +560,41 @@ class V extends p {
551
560
  this.#t && (this.#t.value = t);
552
561
  }
553
562
  }
554
- customElements.define("ry-switch", V);
555
- let Y = 0;
556
- class z extends p {
563
+ customElements.define("ry-switch", z);
564
+ let U = 0;
565
+ class Y extends u {
557
566
  #t = null;
558
567
  #e = null;
559
568
  #i = null;
560
569
  setup() {
561
- this.#i = `ry-tooltip-${++Y}`, this.#s();
570
+ this.#i = `ry-tooltip-${++U}`, this.#s();
562
571
  const t = this.firstElementChild;
563
- t && (t.setAttribute("aria-describedby", this.#i), this.on(t, "mouseenter", this.#r), this.on(t, "mouseleave", this.#h), this.on(t, "focusin", this.#r), this.on(t, "focusout", this.#h)), this.on(document, "keydown", this.#l);
572
+ 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);
564
573
  }
565
574
  #s() {
566
575
  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);
567
576
  }
568
577
  #r = () => {
569
578
  this.#t && clearTimeout(this.#t), this.#t = setTimeout(() => {
570
- this.#n();
579
+ this.#a();
571
580
  }, 200);
572
581
  };
573
- #n = () => {
582
+ #a = () => {
574
583
  const t = this.getAttribute("position") ?? "top";
575
584
  this.setAttribute("data-ry-position", t), this.state = "open";
576
585
  };
577
- #h = () => {
586
+ #o = () => {
578
587
  this.#t && (clearTimeout(this.#t), this.#t = null), this.state = "closed";
579
588
  };
580
589
  #l = (t) => {
581
- t.key === "Escape" && this.state === "open" && this.#h();
590
+ t.key === "Escape" && this.state === "open" && this.#o();
582
591
  };
583
592
  teardown() {
584
593
  this.#t && clearTimeout(this.#t);
585
594
  }
586
595
  }
587
- customElements.define("ry-tooltip", z);
588
- class W extends p {
596
+ customElements.define("ry-tooltip", Y);
597
+ class W extends u {
589
598
  #t = null;
590
599
  #e = 0;
591
600
  setup() {
@@ -632,7 +641,7 @@ class W extends p {
632
641
  }
633
642
  customElements.define("ry-drawer", W);
634
643
  const X = 4e3;
635
- class f extends p {
644
+ class f extends u {
636
645
  #t = null;
637
646
  static observedAttributes = ["variant", "duration"];
638
647
  // Static container for programmatic toasts
@@ -694,61 +703,179 @@ class f extends p {
694
703
  }
695
704
  }
696
705
  customElements.define("ry-toast", f);
706
+ const w = {
707
+ // Close / X
708
+ 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>',
709
+ // Chevron down
710
+ "chevron-down": '<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="M6 9l6 6 6-6"/></svg>',
711
+ // Chevron up
712
+ "chevron-up": '<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 15l-6-6-6 6"/></svg>',
713
+ // Chevron right
714
+ "chevron-right": '<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="M9 18l6-6-6-6"/></svg>',
715
+ // Chevron left
716
+ "chevron-left": '<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="M15 18l-6-6 6-6"/></svg>',
717
+ // Check / Checkmark
718
+ check: '<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="M20 6L9 17l-5-5"/></svg>',
719
+ // Copy
720
+ copy: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>',
721
+ // Sun (light mode)
722
+ sun: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="M4.93 4.93l1.41 1.41"/><path d="M17.66 17.66l1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="M6.34 17.66l-1.41 1.41"/><path d="M19.07 4.93l-1.41 1.41"/></svg>',
723
+ // Moon (dark mode)
724
+ moon: '<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="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg>',
725
+ // Info
726
+ info: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>',
727
+ // Warning / Alert triangle
728
+ warning: '<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="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>',
729
+ // Error / X circle
730
+ error: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M15 9l-6 6"/><path d="M9 9l6 6"/></svg>',
731
+ // Success / Check circle
732
+ success: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',
733
+ // Search
734
+ search: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg>',
735
+ // Menu / Hamburger
736
+ menu: '<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="M3 12h18"/><path d="M3 6h18"/><path d="M3 18h18"/></svg>',
737
+ // Plus
738
+ plus: '<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="M12 5v14"/><path d="M5 12h14"/></svg>',
739
+ // Minus
740
+ minus: '<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="M5 12h14"/></svg>',
741
+ // Settings / Gear
742
+ settings: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/></svg>',
743
+ // User
744
+ user: '<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="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>',
745
+ // Heart
746
+ heart: '<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="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 000-7.78z"/></svg>',
747
+ // Star
748
+ star: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>',
749
+ // Trash
750
+ trash: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>',
751
+ // Edit / Pencil
752
+ edit: '<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="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>',
753
+ // External link
754
+ "external-link": '<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 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>',
755
+ // Download
756
+ download: '<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="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',
757
+ // Upload
758
+ upload: '<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="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>',
759
+ // Folder (closed)
760
+ folder: '<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="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 2H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"/></svg>',
761
+ // Folder open
762
+ "folder-open": '<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="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 2H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"/><path d="M2 10h20"/></svg>',
763
+ // File
764
+ file: '<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="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/></svg>',
765
+ // Gradient: solid color
766
+ "gradient-solid": '<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none"><rect x="4" y="4" width="16" height="16" rx="2"/></svg>',
767
+ // Gradient: linear
768
+ "gradient-linear": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="21" x2="21" y2="3"/><line x1="3" y1="15" x2="15" y2="3"/><line x1="9" y1="21" x2="21" y2="9"/></svg>',
769
+ // Gradient: radial
770
+ "gradient-radial": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="12" cy="12" r="3"/><circle cx="12" cy="12" r="6.5"/></svg>',
771
+ // Shape: circle
772
+ "shape-circle": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/></svg>',
773
+ // Shape: ellipse
774
+ "shape-ellipse": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="12" rx="10" ry="6"/></svg>'
775
+ };
776
+ function p(h) {
777
+ return w[h] ?? "";
778
+ }
779
+ function Tt(h, t) {
780
+ w[h] = t;
781
+ }
782
+ function Lt(h) {
783
+ Object.assign(w, h);
784
+ }
785
+ function It() {
786
+ return Object.keys(w);
787
+ }
697
788
  let G = 0;
698
- class J extends p {
789
+ class J extends u {
699
790
  #t = null;
700
791
  #e = -1;
701
792
  #i = "";
702
793
  #s = null;
794
+ #r = /* @__PURE__ */ new Set();
703
795
  // Store options reference
704
796
  _options = [];
797
+ get #a() {
798
+ return this.hasAttribute("multiple");
799
+ }
705
800
  static observedAttributes = ["value", "disabled"];
706
801
  setup() {
707
- this.#t = `ry-select-${++G}`, this.#r(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.on(this, "click", this.#n), this.on(this, "keydown", this.#h), this.on(document, "click", this.#l), this.hasAttribute("data-ry-state") || (this.state = "closed");
802
+ this.#t = `ry-select-${++G}`, 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.#h), this.#a && this.on(this, "ry:remove", this.#n), this.hasAttribute("data-ry-state") || (this.state = "closed");
708
803
  const t = this.getAttribute("value");
709
- t && (this.value = t);
710
- }
711
- #r() {
712
- const t = [...this.querySelectorAll("ry-option")].map((n) => ({
713
- value: n.getAttribute("value") ?? n.textContent?.trim() ?? "",
714
- label: n.textContent?.trim() ?? "",
715
- disabled: n.hasAttribute("disabled")
716
- })), e = this.getAttribute("placeholder") ?? "Select...", s = this.getAttribute("name") ?? "", i = this.hasAttribute("disabled"), r = t.map(
717
- (n) => `<option value="${n.value}"${n.disabled ? " disabled" : ""}>${n.label}</option>`
718
- ).join(""), a = t.map((n, h) => `
804
+ if (t)
805
+ if (this.#a)
806
+ for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
807
+ this.#d(e);
808
+ else
809
+ this.value = t;
810
+ }
811
+ #o() {
812
+ const t = [...this.querySelectorAll("ry-option")].map((o) => ({
813
+ value: o.getAttribute("value") ?? o.textContent?.trim() ?? "",
814
+ label: o.textContent?.trim() ?? "",
815
+ disabled: o.hasAttribute("disabled")
816
+ })), e = this.getAttribute("placeholder") ?? "Select...", s = this.getAttribute("name") ?? "", i = this.hasAttribute("disabled"), r = this.#a, a = t.map(
817
+ (o) => `<option value="${o.value}"${o.disabled ? " disabled" : ""}>${o.label}</option>`
818
+ ).join(""), n = t.map((o, l) => `
719
819
  <div data-ry-target="option" class="ry-select__option"
720
820
  role="option"
721
- id="${this.#t}-option-${h}"
722
- data-value="${n.value}"
723
- ${n.disabled ? "data-disabled" : ""}
724
- aria-disabled="${n.disabled}">
725
- ${n.label}
821
+ id="${this.#t}-option-${l}"
822
+ data-value="${o.value}"
823
+ ${o.disabled ? "data-disabled" : ""}
824
+ aria-disabled="${o.disabled}">
825
+ ${r ? `<span data-ry-target="check" class="ry-select__check">${p("check")}</span>` : ""}
826
+ <span class="ry-select__option-label">${o.label}</span>
726
827
  </div>
727
828
  `).join("");
728
- this.innerHTML = `
729
- <div data-ry-target="trigger" class="ry-select__trigger" aria-haspopup="listbox" aria-expanded="false">
730
- <span data-ry-target="value" class="ry-select__value">${e}</span>
731
- <span data-ry-target="arrow" class="ry-select__arrow">▾</span>
732
- </div>
733
- <div data-ry-target="dropdown" class="ry-select__dropdown" role="listbox" id="${this.#t}-listbox" tabindex="-1">
734
- ${a}
735
- </div>
736
- <select data-ry-target="native" class="ry-select__native" ${s ? `name="${s}"` : ""} tabindex="-1" aria-hidden="true" ${i ? "disabled" : ""}>
737
- <option value="">${e}</option>
738
- ${r}
739
- </select>
740
- `, this._options = t;
829
+ if (r) {
830
+ const o = this.hasAttribute("clearable");
831
+ this.innerHTML = `
832
+ <div data-ry-target="trigger" class="ry-select__trigger ry-select__trigger--multi" aria-haspopup="listbox" aria-expanded="false">
833
+ <div data-ry-target="tags" class="ry-select__tags"></div>
834
+ <span data-ry-target="value" class="ry-select__value">${e}</span>
835
+ ${o ? `<button data-ry-target="clear" class="ry-select__clear" aria-label="Clear all" type="button">${p("close")}</button>` : ""}
836
+ <span data-ry-target="arrow" class="ry-select__arrow">▾</span>
837
+ </div>
838
+ <div data-ry-target="dropdown" class="ry-select__dropdown" role="listbox" id="${this.#t}-listbox" tabindex="-1" aria-multiselectable="true">
839
+ ${n}
840
+ </div>
841
+ <select data-ry-target="native" class="ry-select__native" ${s ? `name="${s}"` : ""} multiple tabindex="-1" aria-hidden="true" ${i ? "disabled" : ""}>
842
+ ${a}
843
+ </select>
844
+ `;
845
+ const l = this.$('[data-ry-target="clear"]');
846
+ l && this.on(l, "click", (c) => {
847
+ c.stopPropagation(), this.#M();
848
+ });
849
+ } else
850
+ this.innerHTML = `
851
+ <div data-ry-target="trigger" class="ry-select__trigger" aria-haspopup="listbox" aria-expanded="false">
852
+ <span data-ry-target="value" class="ry-select__value">${e}</span>
853
+ <span data-ry-target="arrow" class="ry-select__arrow">▾</span>
854
+ </div>
855
+ <div data-ry-target="dropdown" class="ry-select__dropdown" role="listbox" id="${this.#t}-listbox" tabindex="-1">
856
+ ${n}
857
+ </div>
858
+ <select data-ry-target="native" class="ry-select__native" ${s ? `name="${s}"` : ""} tabindex="-1" aria-hidden="true" ${i ? "disabled" : ""}>
859
+ <option value="">${e}</option>
860
+ ${a}
861
+ </select>
862
+ `;
863
+ this._options = t;
741
864
  }
742
- #n = (t) => {
865
+ #l = (t) => {
743
866
  if (this.hasAttribute("disabled")) return;
744
867
  const e = t.target, s = e.closest('[data-ry-target="option"]');
745
868
  if (s instanceof HTMLElement && !s.hasAttribute("data-disabled")) {
746
- this.#f(s), this.close();
869
+ if (this.#a) {
870
+ const r = s.dataset.value ?? "";
871
+ this.#d(r);
872
+ } else
873
+ this.#$(s), this.close();
747
874
  return;
748
875
  }
749
876
  e.closest('[data-ry-target="trigger"]') && this.toggle();
750
877
  };
751
- #h = (t) => {
878
+ #c = (t) => {
752
879
  if (this.hasAttribute("disabled")) return;
753
880
  const e = this.state === "open";
754
881
  switch (t.key) {
@@ -756,7 +883,12 @@ class J extends p {
756
883
  case " ":
757
884
  if (t.preventDefault(), e && this.#e >= 0) {
758
885
  const i = this.$$('[data-ry-target="option"]:not([data-disabled])')[this.#e];
759
- i && (this.#f(i), this.close());
886
+ if (i)
887
+ if (this.#a) {
888
+ const r = i.dataset.value ?? "";
889
+ this.#d(r);
890
+ } else
891
+ this.#$(i), this.close();
760
892
  } else
761
893
  this.toggle();
762
894
  break;
@@ -764,43 +896,54 @@ class J extends p {
764
896
  e && (t.preventDefault(), this.close());
765
897
  break;
766
898
  case "ArrowDown":
767
- t.preventDefault(), e ? this.#a() : this.open();
899
+ t.preventDefault(), e ? this.#v() : this.open();
768
900
  break;
769
901
  case "ArrowUp":
770
- t.preventDefault(), e && this.#u();
902
+ t.preventDefault(), e && this.#b();
771
903
  break;
772
904
  case "Home":
773
- e && (t.preventDefault(), this.#g());
905
+ e && (t.preventDefault(), this.#w());
774
906
  break;
775
907
  case "End":
776
- e && (t.preventDefault(), this.#m());
908
+ e && (t.preventDefault(), this.#g());
909
+ break;
910
+ case "Backspace":
911
+ if (this.#a && this.#r.size > 0) {
912
+ const s = [...this.#r], i = s[s.length - 1];
913
+ i && this.#d(i);
914
+ }
777
915
  break;
778
916
  default:
779
- t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#d(t.key);
917
+ t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#p(t.key);
780
918
  break;
781
919
  }
782
920
  };
783
- #l = (t) => {
921
+ #h = (t) => {
784
922
  const e = t.target;
785
923
  !this.contains(e) && this.state === "open" && this.close();
786
924
  };
787
- #d(t) {
925
+ #n = (t) => {
926
+ const e = t.detail.value;
927
+ this.#r.has(e) && this.#d(e);
928
+ };
929
+ #p(t) {
788
930
  this.#s && clearTimeout(this.#s), this.#i += t.toLowerCase();
789
931
  const e = this.$$('[data-ry-target="option"]:not([data-disabled])'), s = e.findIndex(
790
932
  (i) => i.textContent?.trim().toLowerCase().startsWith(this.#i)
791
933
  );
792
- if (s >= 0)
934
+ if (s >= 0) {
793
935
  if (this.state === "open")
794
- this.#o(s);
795
- else {
936
+ this.#u(s);
937
+ else if (!this.#a) {
796
938
  const i = e[s];
797
- i && this.#f(i);
939
+ i && this.#$(i);
798
940
  }
941
+ }
799
942
  this.#s = setTimeout(() => {
800
943
  this.#i = "";
801
944
  }, 500);
802
945
  }
803
- #o(t) {
946
+ #u(t) {
804
947
  const e = this.$$('[data-ry-target="option"]:not([data-disabled])');
805
948
  if (t < 0 || t >= e.length) return;
806
949
  this.$$('[data-ry-target="option"][data-highlighted]').forEach((r) => {
@@ -812,22 +955,62 @@ class J extends p {
812
955
  const i = this.$('[data-ry-target="trigger"]');
813
956
  i && i.setAttribute("aria-activedescendant", s.id);
814
957
  }
815
- #a() {
958
+ #v() {
816
959
  const t = this.$$('[data-ry-target="option"]:not([data-disabled])'), e = Math.min(this.#e + 1, t.length - 1);
817
- this.#o(e);
960
+ this.#u(e);
818
961
  }
819
- #u() {
962
+ #b() {
820
963
  const t = Math.max(this.#e - 1, 0);
821
- this.#o(t);
964
+ this.#u(t);
965
+ }
966
+ #w() {
967
+ this.#u(0);
822
968
  }
823
969
  #g() {
824
- this.#o(0);
970
+ const t = this.$$('[data-ry-target="option"]:not([data-disabled])');
971
+ this.#u(t.length - 1);
972
+ }
973
+ // --- Multi-select methods ---
974
+ #d(t) {
975
+ const e = this.getAttribute("max-selections");
976
+ if (this.#r.has(t))
977
+ this.#r.delete(t);
978
+ else {
979
+ if (e && this.#r.size >= parseInt(e, 10)) return;
980
+ this.#r.add(t);
981
+ }
982
+ this.#y(), this.#m(), this.#f(), this.setAttribute("value", [...this.#r].join(",")), this.emit("change", { value: this.value, label: "" });
983
+ }
984
+ #y() {
985
+ const t = this.$('[data-ry-target="tags"]'), e = this.$('[data-ry-target="value"]');
986
+ if (t) {
987
+ t.innerHTML = "";
988
+ for (const s of this.#r) {
989
+ const i = this._options.find((a) => a.value === s);
990
+ if (!i) continue;
991
+ const r = document.createElement("ry-tag");
992
+ r.setAttribute("removable", ""), r.setAttribute("size", "sm"), r.setAttribute("data-value", s), r.textContent = i.label, t.appendChild(r);
993
+ }
994
+ e && (this.#r.size > 0 ? e.style.display = "none" : e.style.display = "");
995
+ }
825
996
  }
826
997
  #m() {
827
- const t = this.$$('[data-ry-target="option"]:not([data-disabled])');
828
- this.#o(t.length - 1);
998
+ const t = this.$('[data-ry-target="native"]');
999
+ if (t)
1000
+ for (const e of t.options)
1001
+ e.selected = this.#r.has(e.value);
829
1002
  }
830
- #f(t) {
1003
+ #f() {
1004
+ this.$$('[data-ry-target="option"]').forEach((t) => {
1005
+ const e = t.dataset.value ?? "";
1006
+ this.#r.has(e) ? t.setAttribute("aria-selected", "true") : t.removeAttribute("aria-selected");
1007
+ });
1008
+ }
1009
+ #M() {
1010
+ this.#r.clear(), this.#y(), this.#m(), this.#f(), this.setAttribute("value", ""), this.emit("change", { value: "", label: "" });
1011
+ }
1012
+ // --- Single-select method ---
1013
+ #$(t) {
831
1014
  const e = t.dataset.value ?? "", s = t.textContent?.trim() ?? "", i = this.$('[data-ry-target="value"]');
832
1015
  i && (i.textContent = s, i.setAttribute("data-selected", ""));
833
1016
  const r = this.$('[data-ry-target="native"]');
@@ -839,16 +1022,19 @@ class J extends p {
839
1022
  if (this.state === "open") return;
840
1023
  this.state = "open";
841
1024
  const t = this.$('[data-ry-target="trigger"]');
842
- t && t.setAttribute("aria-expanded", "true"), this.#A();
843
- const e = this.getAttribute("value");
844
- if (e) {
845
- const i = this.$$('[data-ry-target="option"]:not([data-disabled])').findIndex((r) => r.dataset.value === e);
846
- i >= 0 && this.#o(i);
847
- } else
848
- this.#o(0);
1025
+ if (t && t.setAttribute("aria-expanded", "true"), this.#H(), this.#a)
1026
+ this.#u(0);
1027
+ else {
1028
+ const e = this.getAttribute("value");
1029
+ if (e) {
1030
+ const i = this.$$('[data-ry-target="option"]:not([data-disabled])').findIndex((r) => r.dataset.value === e);
1031
+ i >= 0 && this.#u(i);
1032
+ } else
1033
+ this.#u(0);
1034
+ }
849
1035
  this.emit("open");
850
1036
  }
851
- #A() {
1037
+ #H() {
852
1038
  const t = this.$('[data-ry-target="dropdown"]');
853
1039
  if (!t) return;
854
1040
  this.removeAttribute("data-ry-position");
@@ -867,11 +1053,21 @@ class J extends p {
867
1053
  this.state === "open" ? this.close() : this.open();
868
1054
  }
869
1055
  get value() {
870
- return this.getAttribute("value") ?? "";
1056
+ return this.#a ? [...this.#r].join(",") : this.getAttribute("value") ?? "";
871
1057
  }
872
1058
  set value(t) {
873
- const e = this.$(`[data-ry-target="option"][data-value="${t}"]`);
874
- e && this.#f(e);
1059
+ if (this.#a) {
1060
+ this.#r.clear();
1061
+ for (const e of t.split(",").map((s) => s.trim()).filter(Boolean))
1062
+ this.#r.add(e);
1063
+ this.#y(), this.#m(), this.#f(), this.setAttribute("value", t);
1064
+ } else {
1065
+ const e = this.$(`[data-ry-target="option"][data-value="${t}"]`);
1066
+ e && this.#$(e);
1067
+ }
1068
+ }
1069
+ get values() {
1070
+ return [...this.#r];
875
1071
  }
876
1072
  teardown() {
877
1073
  this.#s && clearTimeout(this.#s);
@@ -881,96 +1077,14 @@ class Z extends HTMLElement {
881
1077
  }
882
1078
  customElements.define("ry-option", Z);
883
1079
  customElements.define("ry-select", J);
884
- const A = {
885
- // Close / X
886
- 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>',
887
- // Chevron down
888
- "chevron-down": '<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="M6 9l6 6 6-6"/></svg>',
889
- // Chevron up
890
- "chevron-up": '<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 15l-6-6-6 6"/></svg>',
891
- // Chevron right
892
- "chevron-right": '<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="M9 18l6-6-6-6"/></svg>',
893
- // Chevron left
894
- "chevron-left": '<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="M15 18l-6-6 6-6"/></svg>',
895
- // Check / Checkmark
896
- check: '<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="M20 6L9 17l-5-5"/></svg>',
897
- // Copy
898
- copy: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>',
899
- // Sun (light mode)
900
- sun: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="M4.93 4.93l1.41 1.41"/><path d="M17.66 17.66l1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="M6.34 17.66l-1.41 1.41"/><path d="M19.07 4.93l-1.41 1.41"/></svg>',
901
- // Moon (dark mode)
902
- moon: '<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="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg>',
903
- // Info
904
- info: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>',
905
- // Warning / Alert triangle
906
- warning: '<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="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>',
907
- // Error / X circle
908
- error: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M15 9l-6 6"/><path d="M9 9l6 6"/></svg>',
909
- // Success / Check circle
910
- success: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',
911
- // Search
912
- search: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg>',
913
- // Menu / Hamburger
914
- menu: '<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="M3 12h18"/><path d="M3 6h18"/><path d="M3 18h18"/></svg>',
915
- // Plus
916
- plus: '<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="M12 5v14"/><path d="M5 12h14"/></svg>',
917
- // Minus
918
- minus: '<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="M5 12h14"/></svg>',
919
- // Settings / Gear
920
- settings: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/></svg>',
921
- // User
922
- user: '<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="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>',
923
- // Heart
924
- heart: '<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="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 000-7.78z"/></svg>',
925
- // Star
926
- star: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>',
927
- // Trash
928
- trash: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>',
929
- // Edit / Pencil
930
- edit: '<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="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>',
931
- // External link
932
- "external-link": '<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 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>',
933
- // Download
934
- download: '<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="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',
935
- // Upload
936
- upload: '<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="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>',
937
- // Folder (closed)
938
- folder: '<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="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 2H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"/></svg>',
939
- // Folder open
940
- "folder-open": '<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="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 2H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"/><path d="M2 10h20"/></svg>',
941
- // File
942
- file: '<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="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/></svg>',
943
- // Gradient: solid color
944
- "gradient-solid": '<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none"><rect x="4" y="4" width="16" height="16" rx="2"/></svg>',
945
- // Gradient: linear
946
- "gradient-linear": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="21" x2="21" y2="3"/><line x1="3" y1="15" x2="15" y2="3"/><line x1="9" y1="21" x2="21" y2="9"/></svg>',
947
- // Gradient: radial
948
- "gradient-radial": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="12" cy="12" r="3"/><circle cx="12" cy="12" r="6.5"/></svg>',
949
- // Shape: circle
950
- "shape-circle": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/></svg>',
951
- // Shape: ellipse
952
- "shape-ellipse": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="12" rx="10" ry="6"/></svg>'
953
- };
954
- function g(o) {
955
- return A[o] ?? "";
956
- }
957
- function kt(o, t) {
958
- A[o] = t;
959
- }
960
- function At(o) {
961
- Object.assign(A, o);
962
- }
963
- function $t() {
964
- return Object.keys(A);
965
- }
966
- class Q extends p {
1080
+ class Q extends u {
967
1081
  #t = "";
968
1082
  static get observedAttributes() {
969
1083
  return ["language", "title", "line-numbers"];
970
1084
  }
971
1085
  setup() {
972
1086
  const t = this.querySelector("template");
973
- t ? this.#t = this.#a(t.innerHTML) : this.#t = this.textContent?.trim() ?? "", this.#e();
1087
+ t ? this.#t = this.#n(t.innerHTML) : this.#t = this.textContent?.trim() ?? "", this.#e();
974
1088
  const e = this.$('[data-ry-target="copy"]');
975
1089
  e && this.on(e, "click", this.#i);
976
1090
  }
@@ -981,7 +1095,7 @@ class Q extends p {
981
1095
  <div data-ry-target="header" class="ry-code__header">
982
1096
  <span data-ry-target="title" class="ry-code__title">${e}</span>
983
1097
  <button data-ry-target="copy" class="ry-code__copy" type="button" aria-label="Copy code">
984
- ${g("copy")}
1098
+ ${p("copy")}
985
1099
  </button>
986
1100
  </div>
987
1101
  <div data-ry-target="content" class="ry-code__content">
@@ -993,8 +1107,8 @@ class Q extends p {
993
1107
  const t = this.$('[data-ry-target="copy"]');
994
1108
  if (t)
995
1109
  try {
996
- await navigator.clipboard.writeText(this.#t), t.innerHTML = g("check"), t.classList.add("ry-code__copy--success"), this.emit("copy", { code: this.#t }), setTimeout(() => {
997
- t.innerHTML = g("copy"), t.classList.remove("ry-code__copy--success");
1110
+ await navigator.clipboard.writeText(this.#t), t.innerHTML = p("check"), t.classList.add("ry-code__copy--success"), this.emit("copy", { code: this.#t }), setTimeout(() => {
1111
+ t.innerHTML = p("copy"), t.classList.remove("ry-code__copy--success");
998
1112
  }, 2e3);
999
1113
  } catch {
1000
1114
  this.emit("copy-error");
@@ -1006,13 +1120,13 @@ class Q extends p {
1006
1120
  return this.#r(t);
1007
1121
  case "js":
1008
1122
  case "javascript":
1009
- return this.#n(t);
1123
+ return this.#a(t);
1010
1124
  case "html":
1011
- return this.#h(t);
1125
+ return this.#o(t);
1012
1126
  case "json":
1013
1127
  return this.#l(t);
1014
1128
  default:
1015
- return this.#o(t);
1129
+ return this.#h(t);
1016
1130
  }
1017
1131
  }
1018
1132
  #r(t) {
@@ -1020,9 +1134,9 @@ class Q extends p {
1020
1134
  let s = t;
1021
1135
  for (; s.length > 0; ) {
1022
1136
  if (s.startsWith("/*")) {
1023
- const m = s.indexOf("*/");
1024
- if (m !== -1) {
1025
- e.push({ type: "comment", value: s.slice(0, m + 2) }), s = s.slice(m + 2);
1137
+ const y = s.indexOf("*/");
1138
+ if (y !== -1) {
1139
+ e.push({ type: "comment", value: s.slice(0, y + 2) }), s = s.slice(y + 2);
1026
1140
  continue;
1027
1141
  }
1028
1142
  }
@@ -1046,9 +1160,9 @@ class Q extends p {
1046
1160
  e.push({ type: "color", value: n[1], color: n[1] }), s = s.slice(n[1].length);
1047
1161
  continue;
1048
1162
  }
1049
- const h = s.match(/^(-?[\d.]+(?:px|em|rem|%|vh|vw|deg|s|ms)?)/);
1050
- if (h?.[1]) {
1051
- e.push({ type: "number", value: h[1] }), s = s.slice(h[1].length);
1163
+ const o = s.match(/^(-?[\d.]+(?:px|em|rem|%|vh|vw|deg|s|ms)?)/);
1164
+ if (o?.[1]) {
1165
+ e.push({ type: "number", value: o[1] }), s = s.slice(o[1].length);
1052
1166
  continue;
1053
1167
  }
1054
1168
  const l = s.match(/^(['"])((?:[^\\]|\\.)*?)\1/);
@@ -1066,18 +1180,18 @@ class Q extends p {
1066
1180
  e.push({ type: "text", value: d[1] }), s = s.slice(d[1].length);
1067
1181
  continue;
1068
1182
  }
1069
- const u = s.match(/^([\w-]+)/);
1070
- if (u?.[1]) {
1071
- const m = u[1];
1072
- ["inherit", "initial", "unset", "none", "auto", "transparent", "solid", "dashed", "dotted", "flex", "grid", "block", "inline", "inline-block", "absolute", "relative", "fixed", "sticky"].includes(m) ? e.push({ type: "keyword", value: m }) : e.push({ type: "value", value: m }), s = s.slice(m.length);
1183
+ const g = s.match(/^([\w-]+)/);
1184
+ if (g?.[1]) {
1185
+ const y = g[1];
1186
+ ["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);
1073
1187
  continue;
1074
1188
  }
1075
1189
  const b = s[0];
1076
1190
  b && e.push({ type: "text", value: b }), s = s.slice(1);
1077
1191
  }
1078
- return e.map((i) => this.#d(i)).join("");
1192
+ return e.map((i) => this.#c(i)).join("");
1079
1193
  }
1080
- #n(t) {
1194
+ #a(t) {
1081
1195
  const e = [];
1082
1196
  let s = t;
1083
1197
  const i = ["const", "let", "var", "function", "return", "if", "else", "for", "while", "do", "switch", "case", "break", "continue", "try", "catch", "finally", "throw", "new", "class", "extends", "import", "export", "default", "from", "async", "await", "typeof", "instanceof", "in", "of", "true", "false", "null", "undefined", "this", "super", "static", "get", "set"];
@@ -1116,9 +1230,9 @@ class Q extends p {
1116
1230
  i.includes(d) ? e.push({ type: "keyword", value: d }) : e.push({ type: "text", value: d }), s = s.slice(d.length);
1117
1231
  continue;
1118
1232
  }
1119
- const h = s[0];
1120
- if (h && /^[{}[\]();,.:?!<>=+\-*/&|^%~@#]/.test(h)) {
1121
- e.push({ type: "punctuation", value: h }), s = s.slice(1);
1233
+ const o = s[0];
1234
+ if (o && /^[{}[\]();,.:?!<>=+\-*/&|^%~@#]/.test(o)) {
1235
+ e.push({ type: "punctuation", value: o }), s = s.slice(1);
1122
1236
  continue;
1123
1237
  }
1124
1238
  const l = s.match(/^(\s+)/);
@@ -1129,9 +1243,9 @@ class Q extends p {
1129
1243
  const c = s[0];
1130
1244
  c && e.push({ type: "text", value: c }), s = s.slice(1);
1131
1245
  }
1132
- return e.map((r) => this.#d(r)).join("");
1246
+ return e.map((r) => this.#c(r)).join("");
1133
1247
  }
1134
- #h(t) {
1248
+ #o(t) {
1135
1249
  const e = [];
1136
1250
  let s = t;
1137
1251
  for (; s.length > 0; ) {
@@ -1167,15 +1281,15 @@ class Q extends p {
1167
1281
  e.push({ type: "text", value: n[1] }), s = s.slice(n[1].length);
1168
1282
  continue;
1169
1283
  }
1170
- const h = s.match(/^([^<]+)/);
1171
- if (h?.[1]) {
1172
- e.push({ type: "text", value: h[1] }), s = s.slice(h[1].length);
1284
+ const o = s.match(/^([^<]+)/);
1285
+ if (o?.[1]) {
1286
+ e.push({ type: "text", value: o[1] }), s = s.slice(o[1].length);
1173
1287
  continue;
1174
1288
  }
1175
1289
  const l = s[0];
1176
1290
  l && e.push({ type: "text", value: l }), s = s.slice(1);
1177
1291
  }
1178
- return e.map((i) => this.#d(i)).join("");
1292
+ return e.map((i) => this.#c(i)).join("");
1179
1293
  }
1180
1294
  #l(t) {
1181
1295
  const e = [];
@@ -1201,18 +1315,18 @@ class Q extends p {
1201
1315
  e.push({ type: "punctuation", value: n }), s = s.slice(1);
1202
1316
  continue;
1203
1317
  }
1204
- const h = s.match(/^(\s+)/);
1205
- if (h?.[1]) {
1206
- e.push({ type: "text", value: h[1] }), s = s.slice(h[1].length);
1318
+ const o = s.match(/^(\s+)/);
1319
+ if (o?.[1]) {
1320
+ e.push({ type: "text", value: o[1] }), s = s.slice(o[1].length);
1207
1321
  continue;
1208
1322
  }
1209
1323
  const l = s[0];
1210
1324
  l && e.push({ type: "text", value: l }), s = s.slice(1);
1211
1325
  }
1212
- return e.map((i) => this.#d(i)).join("");
1326
+ return e.map((i) => this.#c(i)).join("");
1213
1327
  }
1214
- #d(t) {
1215
- const e = this.#o(t.value);
1328
+ #c(t) {
1329
+ const e = this.#h(t.value);
1216
1330
  switch (t.type) {
1217
1331
  case "keyword":
1218
1332
  return `<span class="ry-code__keyword">${e}</span>`;
@@ -1240,10 +1354,10 @@ class Q extends p {
1240
1354
  return e;
1241
1355
  }
1242
1356
  }
1243
- #o(t) {
1357
+ #h(t) {
1244
1358
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
1245
1359
  }
1246
- #a(t) {
1360
+ #n(t) {
1247
1361
  const e = t.split(`
1248
1362
  `);
1249
1363
  for (; e.length && !e[0]?.trim(); ) e.shift();
@@ -1263,7 +1377,7 @@ class Q extends p {
1263
1377
  }
1264
1378
  }
1265
1379
  customElements.define("ry-code", Q);
1266
- class tt extends p {
1380
+ class tt extends u {
1267
1381
  setup() {
1268
1382
  const t = this.$("template");
1269
1383
  if (!t) return;
@@ -1275,8 +1389,8 @@ class tt extends p {
1275
1389
  `, a && this.setAttribute("data-stacked", "");
1276
1390
  const n = document.createElement("ry-code");
1277
1391
  n.setAttribute("language", "html"), n.setAttribute("title", this.getAttribute("title") ?? "Example"), n.textContent = i, this.$('[data-ry-target="code"]').appendChild(n);
1278
- const h = document.createElement("template");
1279
- h.innerHTML = r, this.$('[data-ry-target="preview"]').appendChild(h.content), s && this.#t(s);
1392
+ const o = document.createElement("template");
1393
+ o.innerHTML = r, this.$('[data-ry-target="preview"]').appendChild(o.content), s && this.#t(s);
1280
1394
  }
1281
1395
  #t(t) {
1282
1396
  const e = this.$('[data-ry-target="usage"]');
@@ -1308,7 +1422,7 @@ class tt extends p {
1308
1422
  }
1309
1423
  }
1310
1424
  customElements.define("ry-example", tt);
1311
- class et extends p {
1425
+ class et extends u {
1312
1426
  static get observedAttributes() {
1313
1427
  return ["name", "size", "label"];
1314
1428
  }
@@ -1319,7 +1433,7 @@ class et extends p {
1319
1433
  e !== s && this.hasAttribute("data-ry-initialized") && this.#t();
1320
1434
  }
1321
1435
  #t() {
1322
- const t = this.getAttribute("name") ?? "", e = this.getAttribute("size") ?? "24", s = this.getAttribute("label"), i = g(t);
1436
+ const t = this.getAttribute("name") ?? "", e = this.getAttribute("size") ?? "24", s = this.getAttribute("label"), i = p(t);
1323
1437
  if (!i) {
1324
1438
  this.innerHTML = "";
1325
1439
  return;
@@ -1342,9 +1456,9 @@ class et extends p {
1342
1456
  }
1343
1457
  }
1344
1458
  customElements.define("ry-icon", et);
1345
- const st = ["form", "section", "fieldset", "ry-section"], y = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Set();
1346
- function it(o) {
1347
- let t = o.parentElement;
1459
+ const st = ["form", "section", "fieldset", "ry-section"], m = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Set();
1460
+ function it(h) {
1461
+ let t = h.parentElement;
1348
1462
  for (; t; ) {
1349
1463
  if (st.some((e) => t.matches(e)))
1350
1464
  return t;
@@ -1352,9 +1466,9 @@ function it(o) {
1352
1466
  }
1353
1467
  return null;
1354
1468
  }
1355
- function rt(o) {
1356
- if (E.has(o)) return;
1357
- const t = y.get(o);
1469
+ function rt(h) {
1470
+ if (C.has(h)) return;
1471
+ const t = m.get(h);
1358
1472
  if (!t || t.size < 2) return;
1359
1473
  const e = /* @__PURE__ */ new Map();
1360
1474
  for (const s of t) {
@@ -1370,11 +1484,11 @@ function rt(o) {
1370
1484
  } else
1371
1485
  s.push("(no container)");
1372
1486
  console.warn(
1373
- `ry-toggle-button: Buttons with name="${o}" span multiple containers (${s.join(", ")}). Intentional?`
1374
- ), E.add(o);
1487
+ `ry-toggle-button: Buttons with name="${h}" span multiple containers (${s.join(", ")}). Intentional?`
1488
+ ), C.add(h);
1375
1489
  }
1376
1490
  }
1377
- class at extends p {
1491
+ class at extends u {
1378
1492
  static observedAttributes = ["pressed", "disabled", "name", "value"];
1379
1493
  #t = !1;
1380
1494
  setup() {
@@ -1385,12 +1499,12 @@ class at extends p {
1385
1499
  }
1386
1500
  #e() {
1387
1501
  const t = this.name;
1388
- t && (y.has(t) || y.set(t, /* @__PURE__ */ new Set()), y.get(t).add(this), this.#t = !0, queueMicrotask(() => rt(t)));
1502
+ t && (m.has(t) || m.set(t, /* @__PURE__ */ new Set()), m.get(t).add(this), this.#t = !0, queueMicrotask(() => rt(t)));
1389
1503
  }
1390
1504
  #i() {
1391
1505
  if (!this.#t) return;
1392
1506
  const t = this.name;
1393
- t && y.has(t) && (y.get(t).delete(this), y.get(t).size === 0 && (y.delete(t), E.delete(t))), this.#t = !1;
1507
+ t && m.has(t) && (m.get(t).delete(this), m.get(t).size === 0 && (m.delete(t), C.delete(t))), this.#t = !1;
1394
1508
  }
1395
1509
  #s = (t) => {
1396
1510
  if (this.disabled) {
@@ -1402,10 +1516,10 @@ class at extends p {
1402
1516
  #r = (t) => {
1403
1517
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
1404
1518
  };
1405
- #n() {
1519
+ #a() {
1406
1520
  const t = this.name;
1407
1521
  if (!t) return;
1408
- const e = y.get(t);
1522
+ const e = m.get(t);
1409
1523
  if (e)
1410
1524
  for (const s of e)
1411
1525
  s !== this && s.pressed && (s.pressed = !1);
@@ -1416,7 +1530,7 @@ class at extends p {
1416
1530
  }
1417
1531
  set pressed(t) {
1418
1532
  const e = this.pressed;
1419
- t ? (this.setAttribute("pressed", ""), this.setAttribute("aria-pressed", "true"), this.#n()) : (this.removeAttribute("pressed"), this.setAttribute("aria-pressed", "false")), e !== t && this.emit("change", {
1533
+ t ? (this.setAttribute("pressed", ""), this.setAttribute("aria-pressed", "true"), this.#a()) : (this.removeAttribute("pressed"), this.setAttribute("aria-pressed", "false")), e !== t && this.emit("change", {
1420
1534
  value: this.value,
1421
1535
  label: t ? "pressed" : "unpressed"
1422
1536
  });
@@ -1447,18 +1561,18 @@ class at extends p {
1447
1561
  }
1448
1562
  }
1449
1563
  customElements.define("ry-toggle-button", at);
1450
- class nt extends p {
1564
+ class nt extends u {
1451
1565
  #t = !1;
1452
1566
  #e = null;
1453
1567
  #i = null;
1454
1568
  #s = null;
1455
1569
  #r = /* @__PURE__ */ new Map();
1456
- #n = /* @__PURE__ */ new Map();
1570
+ #a = /* @__PURE__ */ new Map();
1457
1571
  static observedAttributes = ["min", "max", "step", "value", "start", "end", "disabled"];
1458
1572
  setup() {
1459
- this.#h(), this.#d(), this.#y();
1573
+ this.#o(), this.#c(), this.#y();
1460
1574
  }
1461
- #h() {
1575
+ #o() {
1462
1576
  const t = this.hasAttribute("range"), e = this.hasAttribute("labeled"), s = this.hasAttribute("tooltip");
1463
1577
  this.hasAttribute("vertical");
1464
1578
  let i = `
@@ -1476,7 +1590,7 @@ class nt extends p {
1476
1590
  <div data-ry-target="thumb-value" class="ry-slider__thumb" tabindex="0" role="slider" aria-label="Value">
1477
1591
  ${s ? '<span data-ry-target="tooltip-value" class="ry-slider__tooltip"></span>' : ""}
1478
1592
  </div>
1479
- `, 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.#n.set("start", this.$('[data-ry-target="tooltip-start"]')), this.#n.set("end", this.$('[data-ry-target="tooltip-end"]')))) : (this.#r.set("value", this.$('[data-ry-target="thumb-value"]')), s && this.#n.set("value", this.$('[data-ry-target="tooltip-value"]')));
1593
+ `, 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"]')));
1480
1594
  }
1481
1595
  #l() {
1482
1596
  const t = this.min, e = this.max, s = this.getAttribute("labels")?.split(","), i = this.getAttribute("label-type") || "number";
@@ -1485,7 +1599,7 @@ class nt extends p {
1485
1599
  r = s;
1486
1600
  else
1487
1601
  for (let n = 0; n < 5; n++) {
1488
- const h = n / 4, l = t + h * (e - t);
1602
+ const o = n / 4, l = t + o * (e - t);
1489
1603
  if (i === "letter")
1490
1604
  r.push(String.fromCharCode(65 + n));
1491
1605
  else {
@@ -1499,34 +1613,34 @@ class nt extends p {
1499
1613
  </div>
1500
1614
  `;
1501
1615
  }
1502
- #d() {
1503
- this.#i && this.on(this.#i, "pointerdown", this.#o);
1616
+ #c() {
1617
+ this.#i && this.on(this.#i, "pointerdown", this.#h);
1504
1618
  for (const [t, e] of this.#r)
1505
- this.on(e, "pointerdown", (s) => this.#a(s, t)), this.on(e, "keydown", (s) => this.#m(s, t));
1506
- this.on(document, "pointermove", this.#u), this.on(document, "pointerup", this.#g);
1619
+ this.on(e, "pointerdown", (s) => this.#n(s, t)), this.on(e, "keydown", (s) => this.#v(s, t));
1620
+ this.on(document, "pointermove", this.#p), this.on(document, "pointerup", this.#u);
1507
1621
  }
1508
- #o = (t) => {
1622
+ #h = (t) => {
1509
1623
  if (this.disabled) return;
1510
- const e = this.#A(t);
1624
+ const e = this.#w(t);
1511
1625
  if (this.hasAttribute("range")) {
1512
1626
  const i = Math.abs(e - this.start), r = Math.abs(e - this.end);
1513
1627
  i < r ? (this.start = e, this.#e = "start") : (this.end = e, this.#e = "end");
1514
1628
  } else
1515
1629
  this.value = e, this.#e = "value";
1516
- this.#t = !0, this.#y(), this.#b();
1630
+ this.#t = !0, this.#y(), this.#f();
1517
1631
  };
1518
- #a = (t, e) => {
1632
+ #n = (t, e) => {
1519
1633
  this.disabled || (t.stopPropagation(), this.#t = !0, this.#e = e, t.target.setPointerCapture(t.pointerId));
1520
1634
  };
1521
- #u = (t) => {
1635
+ #p = (t) => {
1522
1636
  if (!this.#t || !this.#e) return;
1523
- const e = this.#A(t);
1524
- 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.#b();
1637
+ const e = this.#w(t);
1638
+ 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.#f();
1525
1639
  };
1526
- #g = () => {
1527
- this.#t && (this.#t = !1, this.#e = null, this.#S());
1640
+ #u = () => {
1641
+ this.#t && (this.#t = !1, this.#e = null, this.#M());
1528
1642
  };
1529
- #m = (t, e) => {
1643
+ #v = (t, e) => {
1530
1644
  if (this.disabled) return;
1531
1645
  const s = this.step || 1, i = (this.max - this.min) / 10;
1532
1646
  let r = 0;
@@ -1546,36 +1660,36 @@ class nt extends p {
1546
1660
  r = -i;
1547
1661
  break;
1548
1662
  case "Home":
1549
- r = this.min - this.#f(e);
1663
+ r = this.min - this.#b(e);
1550
1664
  break;
1551
1665
  case "End":
1552
- r = this.max - this.#f(e);
1666
+ r = this.max - this.#b(e);
1553
1667
  break;
1554
1668
  default:
1555
1669
  return;
1556
1670
  }
1557
1671
  t.preventDefault();
1558
- const a = this.#p(this.#f(e) + r);
1559
- e === "start" ? this.start = Math.min(a, this.end) : e === "end" ? this.end = Math.max(a, this.start) : this.value = a, this.#y(), this.#b(), this.#S();
1672
+ const a = this.#d(this.#b(e) + r);
1673
+ e === "start" ? this.start = Math.min(a, this.end) : e === "end" ? this.end = Math.max(a, this.start) : this.value = a, this.#y(), this.#f(), this.#M();
1560
1674
  };
1561
- #f(t) {
1675
+ #b(t) {
1562
1676
  return t === "start" ? this.start : t === "end" ? this.end : this.value;
1563
1677
  }
1564
- #A(t) {
1678
+ #w(t) {
1565
1679
  if (!this.#i) return this.min;
1566
1680
  const e = this.#i.getBoundingClientRect(), s = this.hasAttribute("vertical"), i = this.hasAttribute("reversed");
1567
1681
  let r;
1568
1682
  s ? r = (e.bottom - t.clientY) / e.height : r = (t.clientX - e.left) / e.width, i && (r = 1 - r), r = Math.max(0, Math.min(1, r));
1569
1683
  const a = this.min + r * (this.max - this.min);
1570
- return this.#c(a);
1684
+ return this.#g(a);
1571
1685
  }
1572
- #c(t) {
1686
+ #g(t) {
1573
1687
  const e = this.step;
1574
- if (e === 0) return this.#p(t);
1688
+ if (e === 0) return this.#d(t);
1575
1689
  const s = Math.round((t - this.min) / e) * e + this.min;
1576
- return this.#p(s);
1690
+ return this.#d(s);
1577
1691
  }
1578
- #p(t) {
1692
+ #d(t) {
1579
1693
  return Math.max(this.min, Math.min(this.max, t));
1580
1694
  }
1581
1695
  #y() {
@@ -1584,28 +1698,28 @@ class nt extends p {
1584
1698
  return s && (a = 100 - a), a;
1585
1699
  };
1586
1700
  if (t) {
1587
- const r = i(this.start), a = i(this.end), n = Math.min(r, a), h = Math.max(r, a);
1588
- this.#s && (e ? (this.#s.style.bottom = `${n}%`, this.#s.style.height = `${h - n}%`, this.#s.style.left = "", this.#s.style.width = "") : (this.#s.style.left = `${n}%`, this.#s.style.width = `${h - n}%`, this.#s.style.bottom = "", this.#s.style.height = ""));
1701
+ const r = i(this.start), a = i(this.end), n = Math.min(r, a), o = Math.max(r, a);
1702
+ this.#s && (e ? (this.#s.style.bottom = `${n}%`, this.#s.style.height = `${o - n}%`, this.#s.style.left = "", this.#s.style.width = "") : (this.#s.style.left = `${n}%`, this.#s.style.width = `${o - n}%`, this.#s.style.bottom = "", this.#s.style.height = ""));
1589
1703
  const l = this.#r.get("start"), c = this.#r.get("end");
1590
- l && (e ? (l.style.bottom = `${r}%`, l.style.left = "") : (l.style.left = `${r}%`, l.style.bottom = "")), c && (e ? (c.style.bottom = `${a}%`, c.style.left = "") : (c.style.left = `${a}%`, c.style.bottom = "")), this.#w("start", this.start), this.#w("end", this.end), l?.setAttribute("aria-valuenow", String(this.start)), l?.setAttribute("aria-valuemin", String(this.min)), l?.setAttribute("aria-valuemax", String(this.end)), c?.setAttribute("aria-valuenow", String(this.end)), c?.setAttribute("aria-valuemin", String(this.start)), c?.setAttribute("aria-valuemax", String(this.max));
1704
+ l && (e ? (l.style.bottom = `${r}%`, l.style.left = "") : (l.style.left = `${r}%`, l.style.bottom = "")), c && (e ? (c.style.bottom = `${a}%`, c.style.left = "") : (c.style.left = `${a}%`, c.style.bottom = "")), this.#m("start", this.start), this.#m("end", this.end), l?.setAttribute("aria-valuenow", String(this.start)), l?.setAttribute("aria-valuemin", String(this.min)), l?.setAttribute("aria-valuemax", String(this.end)), c?.setAttribute("aria-valuenow", String(this.end)), c?.setAttribute("aria-valuemin", String(this.start)), c?.setAttribute("aria-valuemax", String(this.max));
1591
1705
  } else {
1592
1706
  const r = i(this.value);
1593
1707
  this.#s && (e ? (this.#s.style.bottom = "0", this.#s.style.height = `${r}%`, this.#s.style.left = "", this.#s.style.width = "") : (this.#s.style.left = "0", this.#s.style.width = `${r}%`, this.#s.style.bottom = "", this.#s.style.height = ""));
1594
1708
  const a = this.#r.get("value");
1595
- a && (e ? (a.style.bottom = `${r}%`, a.style.left = "") : (a.style.left = `${r}%`, a.style.bottom = "")), this.#w("value", this.value), a?.setAttribute("aria-valuenow", String(this.value)), a?.setAttribute("aria-valuemin", String(this.min)), a?.setAttribute("aria-valuemax", String(this.max));
1709
+ a && (e ? (a.style.bottom = `${r}%`, a.style.left = "") : (a.style.left = `${r}%`, a.style.bottom = "")), this.#m("value", this.value), a?.setAttribute("aria-valuenow", String(this.value)), a?.setAttribute("aria-valuemin", String(this.min)), a?.setAttribute("aria-valuemax", String(this.max));
1596
1710
  }
1597
1711
  }
1598
- #w(t, e) {
1599
- const s = this.#n.get(t);
1712
+ #m(t, e) {
1713
+ const s = this.#a.get(t);
1600
1714
  if (s) {
1601
1715
  const i = this.step === 0 ? 2 : String(this.step).split(".")[1]?.length || 0;
1602
1716
  s.textContent = e.toFixed(i);
1603
1717
  }
1604
1718
  }
1605
- #b() {
1719
+ #f() {
1606
1720
  this.hasAttribute("range") ? this.emit("input", { start: this.start, end: this.end }) : this.emit("input", { value: this.value });
1607
1721
  }
1608
- #S() {
1722
+ #M() {
1609
1723
  this.hasAttribute("range") ? this.emit("change", { start: this.start, end: this.end }) : this.emit("change", { value: this.value });
1610
1724
  }
1611
1725
  // --- Public API ---
@@ -1631,19 +1745,19 @@ class nt extends p {
1631
1745
  return parseFloat(this.getAttribute("value") ?? String(this.min));
1632
1746
  }
1633
1747
  set value(t) {
1634
- this.setAttribute("value", String(this.#p(t)));
1748
+ this.setAttribute("value", String(this.#d(t)));
1635
1749
  }
1636
1750
  get start() {
1637
1751
  return parseFloat(this.getAttribute("start") ?? String(this.min));
1638
1752
  }
1639
1753
  set start(t) {
1640
- this.setAttribute("start", String(this.#p(t)));
1754
+ this.setAttribute("start", String(this.#d(t)));
1641
1755
  }
1642
1756
  get end() {
1643
1757
  return parseFloat(this.getAttribute("end") ?? String(this.max));
1644
1758
  }
1645
1759
  set end(t) {
1646
- this.setAttribute("end", String(this.#p(t)));
1760
+ this.setAttribute("end", String(this.#d(t)));
1647
1761
  }
1648
1762
  get disabled() {
1649
1763
  return this.hasAttribute("disabled");
@@ -1653,18 +1767,18 @@ class nt extends p {
1653
1767
  }
1654
1768
  }
1655
1769
  customElements.define("ry-slider", nt);
1656
- class ot extends p {
1770
+ class ot extends u {
1657
1771
  #t = !1;
1658
1772
  #e = 0;
1659
1773
  #i = 0;
1660
1774
  #s = null;
1661
1775
  #r = null;
1662
- #n = null;
1776
+ #a = null;
1663
1777
  static observedAttributes = ["min", "max", "step", "value", "disabled", "label", "labels", "description"];
1664
1778
  setup() {
1665
- this.#h(), this.#l(), this.#p();
1779
+ this.#o(), this.#l(), this.#d();
1666
1780
  }
1667
- #h() {
1781
+ #o() {
1668
1782
  const t = this.getAttribute("label"), e = this.getAttribute("description"), s = e ? ` title="${e}"` : "";
1669
1783
  this.innerHTML = `
1670
1784
  <div data-ry-target="ring" class="ry-knob__ring"${s}>
@@ -1674,43 +1788,43 @@ class ot extends p {
1674
1788
  </div>
1675
1789
  <span data-ry-target="display" class="ry-knob__value"></span>
1676
1790
  ${t ? `<span data-ry-target="label" class="ry-knob__label"${s}>${t}</span>` : ""}
1677
- `, this.#s = this.$('[data-ry-target="ring"]'), this.#r = this.$('[data-ry-target="indicator"]'), this.#n = this.$('[data-ry-target="display"]');
1791
+ `, this.#s = this.$('[data-ry-target="ring"]'), this.#r = this.$('[data-ry-target="indicator"]'), this.#a = this.$('[data-ry-target="display"]');
1678
1792
  }
1679
1793
  #l() {
1680
- this.#s && (this.on(this.#s, "mousedown", this.#d), this.on(document, "mousemove", this.#o), this.on(document, "mouseup", this.#a), this.on(this.#s, "touchstart", this.#u), this.on(document, "touchmove", this.#g), this.on(document, "touchend", this.#m), this.on(this.#s, "wheel", this.#f), this.on(this, "keydown", this.#A));
1794
+ this.#s && (this.on(this.#s, "mousedown", this.#c), this.on(document, "mousemove", this.#h), this.on(document, "mouseup", this.#n), this.on(this.#s, "touchstart", this.#p), this.on(document, "touchmove", this.#u), this.on(document, "touchend", this.#v), this.on(this.#s, "wheel", this.#b), this.on(this, "keydown", this.#w));
1681
1795
  }
1682
- #d = (t) => {
1796
+ #c = (t) => {
1683
1797
  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", ""));
1684
1798
  };
1685
- #o = (t) => {
1799
+ #h = (t) => {
1686
1800
  if (!this.#t) return;
1687
1801
  const e = this.#e - t.clientY, s = (this.max - this.min) / 100;
1688
- this.#c(this.#i + e * s);
1802
+ this.#g(this.#i + e * s);
1689
1803
  };
1690
- #a = () => {
1691
- this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#b());
1804
+ #n = () => {
1805
+ this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#f());
1692
1806
  };
1693
- #u = (t) => {
1807
+ #p = (t) => {
1694
1808
  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", ""));
1695
1809
  };
1696
- #g = (t) => {
1810
+ #u = (t) => {
1697
1811
  if (!this.#t) return;
1698
1812
  t.preventDefault();
1699
1813
  const e = t.touches[0];
1700
1814
  if (!e) return;
1701
1815
  const s = this.#e - e.clientY, i = (this.max - this.min) / 100;
1702
- this.#c(this.#i + s * i);
1816
+ this.#g(this.#i + s * i);
1703
1817
  };
1704
- #m = () => {
1705
- this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#b());
1818
+ #v = () => {
1819
+ this.#t && (this.#t = !1, this.#s?.classList.remove("ry-knob__ring--dragging"), this.removeAttribute("data-dragging"), this.#f());
1706
1820
  };
1707
- #f = (t) => {
1821
+ #b = (t) => {
1708
1822
  if (this.disabled) return;
1709
1823
  t.preventDefault();
1710
1824
  const e = this.step || (this.max - this.min) / 50, s = t.deltaY < 0 ? e : -e;
1711
- this.#c(this.value + s), this.#b();
1825
+ this.#g(this.value + s), this.#f();
1712
1826
  };
1713
- #A = (t) => {
1827
+ #w = (t) => {
1714
1828
  if (this.disabled) return;
1715
1829
  const e = this.step || 1, s = (this.max - this.min) / 10;
1716
1830
  let i = 0;
@@ -1730,24 +1844,24 @@ class ot extends p {
1730
1844
  i = -s;
1731
1845
  break;
1732
1846
  case "Home":
1733
- this.#c(this.min), this.#b();
1847
+ this.#g(this.min), this.#f();
1734
1848
  return;
1735
1849
  case "End":
1736
- this.#c(this.max), this.#b();
1850
+ this.#g(this.max), this.#f();
1737
1851
  return;
1738
1852
  default:
1739
1853
  return;
1740
1854
  }
1741
- t.preventDefault(), this.#c(this.value + i), this.#b();
1855
+ t.preventDefault(), this.#g(this.value + i), this.#f();
1742
1856
  };
1743
- #c(t) {
1857
+ #g(t) {
1744
1858
  let e = Math.max(this.min, Math.min(this.max, t));
1745
1859
  const s = this.step;
1746
- 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.#w();
1860
+ s > 0 && (e = Math.round((e - this.min) / s) * s + this.min, e = Math.max(this.min, Math.min(this.max, e))), this.value = e, this.#d(), this.#m();
1747
1861
  }
1748
- #p() {
1862
+ #d() {
1749
1863
  const t = (this.value - this.min) / (this.max - this.min), e = -135 + t * 270;
1750
- this.#s && (this.#s.style.setProperty("--knob-rotation", `${e}deg`), this.#s.style.setProperty("--knob-percent", String(t))), this.#n && (this.#n.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));
1864
+ 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));
1751
1865
  }
1752
1866
  #y(t) {
1753
1867
  const e = this.getAttribute("labels");
@@ -1757,16 +1871,16 @@ class ot extends p {
1757
1871
  }
1758
1872
  return this.step >= 1 ? Math.round(t).toString() : Math.abs(t) >= 1e3 ? (t / 1e3).toFixed(1) + "k" : Math.abs(t) >= 100 ? Math.round(t).toString() : Math.abs(t) >= 10 ? t.toFixed(1) : t.toFixed(2);
1759
1873
  }
1760
- #w() {
1874
+ #m() {
1761
1875
  const t = (this.value - this.min) / (this.max - this.min);
1762
1876
  this.emit("input", { value: this.value, percent: t });
1763
1877
  }
1764
- #b() {
1878
+ #f() {
1765
1879
  const t = (this.value - this.min) / (this.max - this.min);
1766
1880
  this.emit("change", { value: this.value, percent: t });
1767
1881
  }
1768
1882
  attributeChangedCallback(t, e, s) {
1769
- e !== s && t === "value" && this.#s && this.#p();
1883
+ e !== s && t === "value" && this.#s && this.#d();
1770
1884
  }
1771
1885
  // --- Public API ---
1772
1886
  get min() {
@@ -1802,116 +1916,127 @@ class ot extends p {
1802
1916
  }
1803
1917
  customElements.define("ry-knob", ot);
1804
1918
  const S = 15, T = 3;
1805
- class ht extends p {
1919
+ class ht extends u {
1806
1920
  #t = null;
1807
1921
  #e = null;
1808
1922
  #i = null;
1809
1923
  #s = null;
1810
1924
  #r = null;
1811
- #n = !1;
1812
- #h = 0;
1925
+ #a = !1;
1926
+ #o = 0;
1813
1927
  #l = 0;
1814
- #d = 0;
1815
- #o = !1;
1816
- #a = null;
1817
- #u = null;
1928
+ #c = 0;
1929
+ #h = !1;
1930
+ #n = null;
1931
+ #p = null;
1818
1932
  static observedAttributes = ["min", "max", "step", "value", "disabled", "arrows", "icons", "drag", "editable", "wrap", "label", "prefix", "suffix"];
1819
1933
  setup() {
1820
- this.#g(), this.#f(), this.#A(), this.#v();
1934
+ this.#u(), this.#b(), this.#w(), this.#A();
1821
1935
  }
1822
- #g() {
1823
- const t = this.getAttribute("arrows") ?? "both", e = this.getAttribute("label"), s = t === "stacked", [i, r] = this.#m(s), a = t === "both" || t === "start" || s, n = t === "both" || t === "end" || s, h = 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>` : "", u = `
1936
+ #u() {
1937
+ const t = this.getAttribute("arrows") ?? "both", e = this.getAttribute("label"), s = t === "stacked" || t === "stacked-end" || t === "stacked-start", [i, r] = this.#v(s), a = t !== "end" && t !== "none", n = t !== "start" && t !== "none", o = this.getAttribute("prefix"), l = this.getAttribute("suffix"), c = a ? `<button data-ry-target="decrement" class="ry-number-select__btn ry-number-select__decrement" aria-label="Decrease" tabindex="-1" type="button">${i}</button>` : "", d = n ? `<button data-ry-target="increment" class="ry-number-select__btn ry-number-select__increment" aria-label="Increase" tabindex="-1" type="button">${r}</button>` : "", g = `
1824
1938
  <div data-ry-target="display" class="ry-number-select__display" tabindex="0" role="spinbutton"
1825
1939
  aria-valuenow="${this.value}" aria-valuemin="${this.min}" aria-valuemax="${this.max}"
1826
1940
  ${e ? `aria-label="${e}"` : ""}>
1827
- ${h ? `<span data-ry-target="prefix" class="ry-number-select__affix">${h}</span>` : ""}
1941
+ ${o ? `<span data-ry-target="prefix" class="ry-number-select__affix">${o}</span>` : ""}
1828
1942
  <span data-ry-target="value" class="ry-number-select__value">${this.#j(this.value)}</span>
1829
1943
  ${l ? `<span data-ry-target="suffix" class="ry-number-select__affix">${l}</span>` : ""}
1830
1944
  <input data-ry-target="input" class="ry-number-select__input" type="text" inputmode="decimal" tabindex="-1">
1831
1945
  </div>`, b = e ? `<span data-ry-target="label" class="ry-number-select__label">${e}</span>` : "";
1832
- s ? this.innerHTML = `${d}${u}${c}${b}` : this.innerHTML = `${c}${u}${d}${b}`;
1946
+ if (t === "stacked")
1947
+ this.innerHTML = `${d}${g}${c}${b}`;
1948
+ else if (t === "stacked-end") {
1949
+ const y = `<div data-ry-target="btn-group" class="ry-number-select__btn-group">${d}${c}</div>`;
1950
+ this.innerHTML = `${g}${y}${b}`;
1951
+ } else if (t === "stacked-start") {
1952
+ const y = `<div data-ry-target="btn-group" class="ry-number-select__btn-group">${d}${c}</div>`;
1953
+ this.innerHTML = `${y}${g}${b}`;
1954
+ } else
1955
+ this.innerHTML = `${c}${g}${d}${b}`;
1833
1956
  }
1834
- #m(t) {
1957
+ #v(t) {
1835
1958
  const e = this.getAttribute("icons") ?? "plus-minus";
1836
- 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") ?? "+"];
1959
+ return e === "chevron" ? t ? [p("chevron-down") ?? "▾", p("chevron-up") ?? "▴"] : [p("chevron-left") ?? "‹", p("chevron-right") ?? "›"] : e === "arrow" ? t ? [p("chevron-down") ?? "▼", p("chevron-up") ?? "▲"] : [p("chevron-left") ?? "◀", p("chevron-right") ?? "▶"] : [p("minus") ?? "−", p("plus") ?? "+"];
1837
1960
  }
1838
- #f() {
1961
+ #b() {
1839
1962
  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"]');
1840
1963
  }
1841
- #A() {
1964
+ #w() {
1842
1965
  this.#s && (this.on(this.#s, "mousedown", (t) => {
1843
- t.preventDefault(), this.#c(-1);
1844
- }), this.on(this.#s, "mouseup", () => this.#p()), this.on(this.#s, "mouseleave", () => this.#p())), this.#r && (this.on(this.#r, "mousedown", (t) => {
1845
- t.preventDefault(), this.#c(1);
1846
- }), this.on(this.#r, "mouseup", () => this.#p()), this.on(this.#r, "mouseleave", () => this.#p())), this.#t && this.on(this.#t, "mousedown", this.#F), this.on(document, "mousemove", this.#W), this.on(document, "mouseup", this.#E), this.#t && this.on(this.#t, "touchstart", this.#X), this.on(document, "touchmove", this.#G), this.on(document, "touchend", this.#K), this.#t && this.on(this.#t, "keydown", this.#q), this.on(this, "wheel", this.#J), this.#t && this.on(this.#t, "dblclick", () => this.#_()), this.#i && (this.on(this.#i, "blur", () => this.#U()), this.on(this.#i, "keydown", (t) => {
1847
- t.key === "Enter" && (t.preventDefault(), this.#U()), t.key === "Escape" && (t.preventDefault(), this.#P()), t.stopPropagation();
1966
+ t.preventDefault(), this.#g(-1);
1967
+ }), this.on(this.#s, "mouseup", () => this.#d()), this.on(this.#s, "mouseleave", () => this.#d())), this.#r && (this.on(this.#r, "mousedown", (t) => {
1968
+ t.preventDefault(), this.#g(1);
1969
+ }), this.on(this.#r, "mouseup", () => this.#d()), this.on(this.#r, "mouseleave", () => this.#d())), this.#t && this.on(this.#t, "mousedown", this.#H), this.on(document, "mousemove", this.#W), this.on(document, "mouseup", this.#E), this.#t && this.on(this.#t, "touchstart", this.#X), this.on(document, "touchmove", this.#G), this.on(document, "touchend", this.#K), this.#t && this.on(this.#t, "keydown", this.#q), this.on(this, "wheel", this.#J), this.#t && this.on(this.#t, "dblclick", () => this.#C()), this.#i && (this.on(this.#i, "blur", () => this.#V()), this.on(this.#i, "keydown", (t) => {
1970
+ t.key === "Enter" && (t.preventDefault(), this.#V()), t.key === "Escape" && (t.preventDefault(), this.#P()), t.stopPropagation();
1848
1971
  }));
1849
1972
  }
1850
1973
  // --- Button hold-to-repeat ---
1851
- #c(t) {
1974
+ #g(t) {
1852
1975
  if (this.disabled) return;
1853
1976
  const e = this.step || 1;
1854
- this.#B(t * e), this.#x(), this.#a = setTimeout(() => {
1977
+ this.#R(t * e), this.#_(), this.#n = setTimeout(() => {
1855
1978
  let s = 150;
1856
1979
  const i = () => {
1857
- this.#B(t * e), this.#$(), s = Math.max(40, s * 0.85), this.#u = setTimeout(i, s);
1980
+ this.#R(t * e), this.#x(), s = Math.max(40, s * 0.85), this.#p = setTimeout(i, s);
1858
1981
  };
1859
1982
  i();
1860
1983
  }, 400);
1861
1984
  }
1862
- #p() {
1863
- this.#a && (clearTimeout(this.#a), this.#a = null), this.#u && (clearTimeout(this.#u), this.#u = null);
1985
+ #d() {
1986
+ this.#n && (clearTimeout(this.#n), this.#n = null), this.#p && (clearTimeout(this.#p), this.#p = null);
1864
1987
  }
1865
1988
  // --- Drag helpers ---
1866
1989
  get #y() {
1867
1990
  const t = this.getAttribute("drag");
1868
- return t === "x" || t === "y" || t === "none" ? t : this.getAttribute("arrows") === "stacked" ? "y" : "x";
1991
+ if (t === "x" || t === "y" || t === "none") return t;
1992
+ const e = this.getAttribute("arrows");
1993
+ return e === "stacked" || e === "stacked-end" || e === "stacked-start" ? "y" : "x";
1869
1994
  }
1870
- #w(t, e) {
1871
- return this.#y === "y" ? this.#l - e : t - this.#h;
1995
+ #m(t, e) {
1996
+ return this.#y === "y" ? this.#l - e : t - this.#o;
1872
1997
  }
1873
- #b(t, e) {
1874
- return this.#y === "y" ? Math.abs(e - this.#l) : Math.abs(t - this.#h);
1998
+ #f(t, e) {
1999
+ return this.#y === "y" ? Math.abs(e - this.#l) : Math.abs(t - this.#o);
1875
2000
  }
1876
- #S(t, e) {
2001
+ #M(t, e) {
1877
2002
  if (!this.#e) return;
1878
2003
  const s = t / e * 4, i = this.#y;
1879
2004
  this.#e.style.transform = i === "y" ? `translateY(${-s}px)` : `translateX(${s}px)`;
1880
2005
  }
1881
- #M(t, e, s) {
1882
- const i = this.#w(t, e), r = this.step || 1, a = s ? r * 10 : r, n = s ? S * 2 : S, h = Math.round(i / n), l = this.#d + h * a, c = i - h * n;
1883
- this.#S(c, n);
1884
- const d = this.hasAttribute("wrap") ? this.#V(l) : this.#T(l), u = this.#R(d);
1885
- u !== this.value && (this.value = u, this.#v(), this.#$());
2006
+ #$(t, e, s) {
2007
+ const i = this.#m(t, e), r = this.step || 1, a = s ? r * 10 : r, n = s ? S * 2 : S, o = Math.round(i / n), l = this.#c + o * a, c = i - o * n;
2008
+ this.#M(c, n);
2009
+ const d = this.hasAttribute("wrap") ? this.#z(l) : this.#T(l), g = this.#F(d);
2010
+ g !== this.value && (this.value = g, this.#A(), this.#x());
1886
2011
  }
1887
2012
  // --- Mouse drag ---
1888
- #F = (t) => {
1889
- this.disabled || this.#o || this.#y === "none" || (t.preventDefault(), this.#n = !0, this.#h = t.clientX, this.#l = t.clientY, this.#d = this.value, this.setAttribute("data-dragging", ""));
2013
+ #H = (t) => {
2014
+ this.disabled || this.#h || this.#y === "none" || (t.preventDefault(), this.#a = !0, this.#o = t.clientX, this.#l = t.clientY, this.#c = this.value, this.setAttribute("data-dragging", ""));
1890
2015
  };
1891
2016
  #W = (t) => {
1892
- this.#n && this.#M(t.clientX, t.clientY, t.shiftKey);
2017
+ this.#a && this.#$(t.clientX, t.clientY, t.shiftKey);
1893
2018
  };
1894
2019
  #E = (t) => {
1895
- if (!this.#n) return;
1896
- const e = this.#b(t.clientX, t.clientY);
1897
- this.#n = !1, this.removeAttribute("data-dragging"), this.#e && (this.#e.style.transform = ""), e < T && this.hasAttribute("editable") ? this.#_() : e >= T && this.#x();
2020
+ if (!this.#a) return;
2021
+ const e = this.#f(t.clientX, t.clientY);
2022
+ this.#a = !1, this.removeAttribute("data-dragging"), this.#e && (this.#e.style.transform = ""), e < T && this.hasAttribute("editable") ? this.#C() : e >= T && this.#_();
1898
2023
  };
1899
2024
  // --- Touch drag ---
1900
2025
  #X = (t) => {
1901
- this.disabled || this.#o || this.#y === "none" || (t.preventDefault(), this.#n = !0, this.#h = t.touches[0]?.clientX ?? 0, this.#l = t.touches[0]?.clientY ?? 0, this.#d = this.value, this.setAttribute("data-dragging", ""));
2026
+ this.disabled || this.#h || 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", ""));
1902
2027
  };
1903
2028
  #G = (t) => {
1904
- if (!this.#n) return;
2029
+ if (!this.#a) return;
1905
2030
  t.preventDefault();
1906
2031
  const e = t.touches[0];
1907
- e && this.#M(e.clientX, e.clientY, !1);
2032
+ e && this.#$(e.clientX, e.clientY, !1);
1908
2033
  };
1909
2034
  #K = () => {
1910
- this.#n && (this.#n = !1, this.removeAttribute("data-dragging"), this.#e && (this.#e.style.transform = ""), this.#x());
2035
+ this.#a && (this.#a = !1, this.removeAttribute("data-dragging"), this.#e && (this.#e.style.transform = ""), this.#_());
1911
2036
  };
1912
2037
  // --- Keyboard ---
1913
2038
  #q = (t) => {
1914
- if (this.disabled || this.#o) return;
2039
+ if (this.disabled || this.#h) return;
1915
2040
  const e = this.step || 1, s = e * 10;
1916
2041
  let i = 0;
1917
2042
  switch (t.key) {
@@ -1936,54 +2061,54 @@ class ht extends p {
1936
2061
  i = this.max - this.value;
1937
2062
  break;
1938
2063
  case "Enter":
1939
- this.hasAttribute("editable") && this.#_();
2064
+ this.hasAttribute("editable") && this.#C();
1940
2065
  return;
1941
2066
  default:
1942
- this.hasAttribute("editable") && /^[0-9.\-]$/.test(t.key) && (this.#_(t.key), t.preventDefault());
2067
+ this.hasAttribute("editable") && /^[0-9.\-]$/.test(t.key) && (this.#C(t.key), t.preventDefault());
1943
2068
  return;
1944
2069
  }
1945
- t.preventDefault(), this.#B(i), this.#$(), this.#x();
2070
+ t.preventDefault(), this.#R(i), this.#x(), this.#_();
1946
2071
  };
1947
2072
  // --- Wheel ---
1948
2073
  #J = (t) => {
1949
- if (this.disabled || this.#o || !this.matches(":hover") && !this.contains(document.activeElement)) return;
2074
+ if (this.disabled || this.#h || !this.matches(":hover") && !this.contains(document.activeElement)) return;
1950
2075
  t.preventDefault();
1951
2076
  const e = this.step || 1, s = t.shiftKey ? e * 10 : e, i = t.deltaY < 0 ? s : -s;
1952
- this.#B(i), this.#$(), this.#x();
2077
+ this.#R(i), this.#x(), this.#_();
1953
2078
  };
1954
2079
  // --- Edit mode ---
1955
- #_(t) {
1956
- this.disabled || this.#o || (this.#o = !0, this.state = "editing", this.#e && (this.#e.style.display = "none"), this.#i && (this.#i.style.display = "block", this.#i.value = t ?? this.#j(this.value), this.#i.focus(), t ? this.#i.setSelectionRange(1, 1) : this.#i.select()));
2080
+ #C(t) {
2081
+ this.disabled || this.#h || (this.#h = !0, this.state = "editing", this.#e && (this.#e.style.display = "none"), this.#i && (this.#i.style.display = "block", this.#i.value = t ?? this.#j(this.value), this.#i.focus(), t ? this.#i.setSelectionRange(1, 1) : this.#i.select()));
1957
2082
  }
1958
- #U() {
1959
- if (!this.#o) return;
1960
- this.#o = !1, this.state = "";
2083
+ #V() {
2084
+ if (!this.#h) return;
2085
+ this.#h = !1, this.state = "";
1961
2086
  const t = parseFloat(this.#i?.value ?? "");
1962
2087
  if (!isNaN(t)) {
1963
- const e = this.#T(t), s = this.#R(e);
1964
- this.value = s, this.#x();
2088
+ const e = this.#T(t), s = this.#F(e);
2089
+ this.value = s, this.#_();
1965
2090
  }
1966
- this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#v(), this.#t?.focus();
2091
+ this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#A(), this.#t?.focus();
1967
2092
  }
1968
2093
  #P() {
1969
- this.#o && (this.#o = !1, this.state = "", this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#t?.focus());
2094
+ this.#h && (this.#h = !1, this.state = "", this.#e && (this.#e.style.display = ""), this.#i && (this.#i.style.display = "none"), this.#t?.focus());
1970
2095
  }
1971
2096
  // --- Value management ---
1972
- #B(t) {
2097
+ #R(t) {
1973
2098
  let e = this.value + t;
1974
- this.hasAttribute("wrap") ? e = this.#V(e) : e = this.#T(e), e = this.#R(e), this.value = e, this.#v();
2099
+ this.hasAttribute("wrap") ? e = this.#z(e) : e = this.#T(e), e = this.#F(e), this.value = e, this.#A();
1975
2100
  }
1976
2101
  #T(t) {
1977
2102
  return Math.max(this.min, Math.min(this.max, t));
1978
2103
  }
1979
- #V(t) {
2104
+ #z(t) {
1980
2105
  const e = this.step || 1, s = this.max - this.min + e;
1981
2106
  let i = t;
1982
2107
  for (; i > this.max; ) i -= s;
1983
2108
  for (; i < this.min; ) i += s;
1984
2109
  return i;
1985
2110
  }
1986
- #R(t) {
2111
+ #F(t) {
1987
2112
  const e = this.step;
1988
2113
  if (e <= 0) return this.#T(t);
1989
2114
  const s = Math.round((t - this.min) / e) * e + this.min;
@@ -1995,16 +2120,16 @@ class ht extends p {
1995
2120
  const s = Math.max(0, -Math.floor(Math.log10(e)));
1996
2121
  return t.toFixed(s);
1997
2122
  }
1998
- #v() {
1999
- this.#e && (this.#e.textContent = this.#j(this.value)), this.#Y();
2123
+ #A() {
2124
+ this.#e && (this.#e.textContent = this.#j(this.value)), this.#U();
2000
2125
  }
2001
- #Y() {
2126
+ #U() {
2002
2127
  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)));
2003
2128
  }
2004
- #$() {
2129
+ #x() {
2005
2130
  this.emit("input", { value: this.value });
2006
2131
  }
2007
- #x() {
2132
+ #_() {
2008
2133
  this.emit("change", { value: this.value });
2009
2134
  }
2010
2135
  // --- Public API ---
@@ -2045,17 +2170,17 @@ class ht extends p {
2045
2170
  t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
2046
2171
  }
2047
2172
  attributeChangedCallback(t, e, s) {
2048
- e !== s && t === "value" && this.#t && this.#v();
2173
+ e !== s && t === "value" && this.#t && this.#A();
2049
2174
  }
2050
2175
  teardown() {
2051
- this.#p();
2176
+ this.#d();
2052
2177
  }
2053
2178
  }
2054
2179
  customElements.define("ry-number-select", ht);
2055
- function v(o) {
2056
- const t = o.h / 360, e = o.s / 100, s = o.v / 100;
2180
+ function v(h) {
2181
+ const t = h.h / 360, e = h.s / 100, s = h.v / 100;
2057
2182
  let i = 0, r = 0, a = 0;
2058
- const n = Math.floor(t * 6), h = t * 6 - n, l = s * (1 - e), c = s * (1 - h * e), d = s * (1 - (1 - h) * e);
2183
+ 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);
2059
2184
  switch (n % 6) {
2060
2185
  case 0:
2061
2186
  i = s, r = d, a = l;
@@ -2082,10 +2207,10 @@ function v(o) {
2082
2207
  b: Math.round(a * 255)
2083
2208
  };
2084
2209
  }
2085
- function $(o) {
2086
- const t = o.r / 255, e = o.g / 255, s = o.b / 255, i = Math.max(t, e, s), r = Math.min(t, e, s), a = i - r;
2210
+ function $(h) {
2211
+ 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;
2087
2212
  let n = 0;
2088
- const h = i === 0 ? 0 : a / i, l = i;
2213
+ const o = i === 0 ? 0 : a / i, l = i;
2089
2214
  if (i !== r)
2090
2215
  switch (i) {
2091
2216
  case t:
@@ -2100,34 +2225,34 @@ function $(o) {
2100
2225
  }
2101
2226
  return {
2102
2227
  h: Math.round(n * 360),
2103
- s: Math.round(h * 100),
2228
+ s: Math.round(o * 100),
2104
2229
  v: Math.round(l * 100)
2105
2230
  };
2106
2231
  }
2107
- function L(o) {
2108
- const t = o.s / 100, e = o.v / 100, s = e * (1 - t / 2), i = s === 0 || s === 1 ? 0 : (e - s) / Math.min(s, 1 - s);
2232
+ function L(h) {
2233
+ 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);
2109
2234
  return {
2110
- h: o.h,
2235
+ h: h.h,
2111
2236
  s: Math.round(i * 100),
2112
2237
  l: Math.round(s * 100)
2113
2238
  };
2114
2239
  }
2115
- function lt(o) {
2116
- const t = o.s / 100, e = o.l / 100, s = e + t * Math.min(e, 1 - e), i = s === 0 ? 0 : 2 * (1 - e / s);
2240
+ function lt(h) {
2241
+ 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);
2117
2242
  return {
2118
- h: o.h,
2243
+ h: h.h,
2119
2244
  s: Math.round(i * 100),
2120
2245
  v: Math.round(s * 100)
2121
2246
  };
2122
2247
  }
2123
- function I(o) {
2248
+ function I(h) {
2124
2249
  const t = (e) => e.toString(16).padStart(2, "0");
2125
- return `#${t(o.r)}${t(o.g)}${t(o.b)}`;
2250
+ return `#${t(h.r)}${t(h.g)}${t(h.b)}`;
2126
2251
  }
2127
- function ct(o) {
2128
- const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);
2252
+ function ct(h) {
2253
+ const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);
2129
2254
  if (!t) {
2130
- const e = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(o);
2255
+ const e = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(h);
2131
2256
  return e ? {
2132
2257
  r: parseInt(e[1] + e[1], 16),
2133
2258
  g: parseInt(e[2] + e[2], 16),
@@ -2140,8 +2265,8 @@ function ct(o) {
2140
2265
  b: parseInt(t[3], 16)
2141
2266
  };
2142
2267
  }
2143
- function w(o) {
2144
- const t = o.trim().toLowerCase();
2268
+ function A(h) {
2269
+ const t = h.trim().toLowerCase();
2145
2270
  if (t.startsWith("#")) {
2146
2271
  const i = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
2147
2272
  if (i) {
@@ -2175,29 +2300,29 @@ function w(o) {
2175
2300
  }
2176
2301
  return null;
2177
2302
  }
2178
- class dt extends p {
2303
+ class dt extends u {
2179
2304
  #t = 0;
2180
2305
  #e = 100;
2181
2306
  #i = 100;
2182
2307
  #s = 100;
2183
2308
  #r = !1;
2184
- #n = !1;
2185
- #h = !1;
2309
+ #a = !1;
2310
+ #o = !1;
2186
2311
  #l = null;
2187
- #d = null;
2188
- #o = null;
2189
- #a = null;
2312
+ #c = null;
2313
+ #h = null;
2314
+ #n = null;
2315
+ #p = null;
2190
2316
  #u = null;
2317
+ #v = null;
2318
+ #b = null;
2319
+ #w = null;
2191
2320
  #g = null;
2192
- #m = null;
2193
- #f = null;
2194
- #A = null;
2195
- #c = null;
2196
2321
  static observedAttributes = ["value", "format", "opacity", "disabled", "swatches", "inline"];
2197
2322
  setup() {
2198
- this.#p(), this.#y(), this.#w(), this.#v();
2323
+ this.#d(), this.#y(), this.#m(), this.#A();
2199
2324
  }
2200
- #p() {
2325
+ #d() {
2201
2326
  const t = this.hasAttribute("inline"), e = this.hasAttribute("opacity"), s = this.getAttribute("swatches");
2202
2327
  let i = `
2203
2328
  <div data-ry-target="grid" class="ry-color-picker__grid">
@@ -2237,42 +2362,42 @@ class dt extends p {
2237
2362
  <span data-ry-target="trigger-color" class="ry-color-picker__trigger-color"></span>
2238
2363
  </button>
2239
2364
  <div data-ry-target="panel" class="ry-color-picker__panel">${i}</div>
2240
- `, this.#l = this.$('[data-ry-target="trigger"]'), this.#d = this.$('[data-ry-target="panel"]'), this.#o = this.$('[data-ry-target="grid"]'), this.#a = this.$('[data-ry-target="grid-handle"]'), this.#u = this.$('[data-ry-target="hue-slider"]'), this.#g = this.$('[data-ry-target="hue-handle"]'), this.#m = this.$('[data-ry-target="alpha-slider"]'), this.#f = this.$('[data-ry-target="alpha-handle"]'), this.#A = this.$('[data-ry-target="preview"]'), this.#c = this.$('[data-ry-target="input"]');
2365
+ `, this.#l = this.$('[data-ry-target="trigger"]'), this.#c = this.$('[data-ry-target="panel"]'), this.#h = this.$('[data-ry-target="grid"]'), this.#n = this.$('[data-ry-target="grid-handle"]'), this.#p = this.$('[data-ry-target="hue-slider"]'), this.#u = this.$('[data-ry-target="hue-handle"]'), this.#v = this.$('[data-ry-target="alpha-slider"]'), this.#b = this.$('[data-ry-target="alpha-handle"]'), this.#w = this.$('[data-ry-target="preview"]'), this.#g = this.$('[data-ry-target="input"]');
2241
2366
  }
2242
2367
  #y() {
2243
- this.#l && this.on(this.#l, "click", this.#b), this.on(document, "click", this.#S), this.on(document, "keydown", this.#M), this.#o && this.on(this.#o, "pointerdown", this.#W), this.#a && this.on(this.#a, "keydown", this.#X), this.#u && this.on(this.#u, "pointerdown", this.#G), this.#g && this.on(this.#g, "keydown", this.#q), this.#m && this.on(this.#m, "pointerdown", this.#J), this.#f && this.on(this.#f, "keydown", this.#U), this.on(document, "pointermove", this.#P), this.on(document, "pointerup", this.#B), this.#c && (this.on(this.#c, "change", this.#T), this.on(this.#c, "keydown", this.#V));
2368
+ this.#l && this.on(this.#l, "click", this.#f), this.on(document, "click", this.#M), this.on(document, "keydown", this.#$), this.#h && this.on(this.#h, "pointerdown", this.#W), this.#n && this.on(this.#n, "keydown", this.#X), this.#p && this.on(this.#p, "pointerdown", this.#G), this.#u && this.on(this.#u, "keydown", this.#q), this.#v && this.on(this.#v, "pointerdown", this.#J), this.#b && this.on(this.#b, "keydown", this.#V), 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.#z));
2244
2369
  const t = this.$('[data-ry-target="format-toggle"]');
2245
- t && this.on(t, "click", this.#R);
2370
+ t && this.on(t, "click", this.#F);
2246
2371
  const e = this.$('[data-ry-target="swatches"]');
2247
2372
  e && this.on(e, "click", this.#j);
2248
2373
  }
2249
- #w() {
2374
+ #m() {
2250
2375
  const t = this.getAttribute("value");
2251
2376
  if (t) {
2252
- const e = w(t);
2377
+ const e = A(t);
2253
2378
  e && (this.#t = e.hsv.h, this.#e = e.hsv.s, this.#i = e.hsv.v, this.#s = e.alpha);
2254
2379
  }
2255
2380
  }
2256
2381
  // ───────────────────────────────────────────────────────────────────────────
2257
2382
  // Dropdown handlers
2258
2383
  // ───────────────────────────────────────────────────────────────────────────
2259
- #b = () => {
2384
+ #f = () => {
2260
2385
  this.disabled || (this.state === "open" ? this.close() : this.open());
2261
2386
  };
2262
- #S = (t) => {
2387
+ #M = (t) => {
2263
2388
  this.state === "open" && (this.contains(t.target) || this.close());
2264
2389
  };
2265
- #M = (t) => {
2390
+ #$ = (t) => {
2266
2391
  t.key === "Escape" && this.state === "open" && (this.close(), this.#l?.focus());
2267
2392
  };
2268
2393
  open() {
2269
- this.hasAttribute("inline") || (this.#F(), this.state = "open");
2394
+ this.hasAttribute("inline") || (this.#H(), this.state = "open");
2270
2395
  }
2271
2396
  close() {
2272
2397
  this.hasAttribute("inline") || (this.state = "closed", this.removeAttribute("data-ry-position"));
2273
2398
  }
2274
- #F() {
2275
- if (!this.#d || !this.#l) return;
2399
+ #H() {
2400
+ if (!this.#c || !this.#l) return;
2276
2401
  const t = this.#l.getBoundingClientRect(), e = 320, i = window.innerHeight - t.bottom, r = t.top;
2277
2402
  i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
2278
2403
  }
@@ -2280,12 +2405,12 @@ class dt extends p {
2280
2405
  // Grid handlers
2281
2406
  // ───────────────────────────────────────────────────────────────────────────
2282
2407
  #W = (t) => {
2283
- this.disabled || (t.preventDefault(), this.#r = !0, this.#a?.focus(), this.#E(t));
2408
+ this.disabled || (t.preventDefault(), this.#r = !0, this.#n?.focus(), this.#E(t));
2284
2409
  };
2285
2410
  #E(t) {
2286
- if (!this.#o) return;
2287
- const e = this.#o.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));
2288
- this.#e = Math.round(s * 100), this.#i = Math.round((1 - i) * 100), this.#v(), this.#L();
2411
+ if (!this.#h) return;
2412
+ const e = this.#h.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));
2413
+ this.#e = Math.round(s * 100), this.#i = Math.round((1 - i) * 100), this.#A(), this.#L();
2289
2414
  }
2290
2415
  #X = (t) => {
2291
2416
  if (this.disabled) return;
@@ -2305,18 +2430,18 @@ class dt extends p {
2305
2430
  this.#i = Math.max(0, this.#i - e), s = !0;
2306
2431
  break;
2307
2432
  }
2308
- s && (t.preventDefault(), this.#v(), this.#L(), this.#k());
2433
+ s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
2309
2434
  };
2310
2435
  // ───────────────────────────────────────────────────────────────────────────
2311
2436
  // Hue handlers
2312
2437
  // ───────────────────────────────────────────────────────────────────────────
2313
2438
  #G = (t) => {
2314
- this.disabled || (t.preventDefault(), this.#n = !0, this.#g?.focus(), this.#K(t));
2439
+ this.disabled || (t.preventDefault(), this.#a = !0, this.#u?.focus(), this.#K(t));
2315
2440
  };
2316
2441
  #K(t) {
2317
- if (!this.#u) return;
2318
- const e = this.#u.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
2319
- this.#t = Math.round(s * 360), this.#v(), this.#L();
2442
+ if (!this.#p) return;
2443
+ const e = this.#p.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
2444
+ this.#t = Math.round(s * 360), this.#A(), this.#L();
2320
2445
  }
2321
2446
  #q = (t) => {
2322
2447
  if (this.disabled) return;
@@ -2332,20 +2457,20 @@ class dt extends p {
2332
2457
  this.#t = (this.#t - e + 360) % 360, s = !0;
2333
2458
  break;
2334
2459
  }
2335
- s && (t.preventDefault(), this.#v(), this.#L(), this.#k());
2460
+ s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
2336
2461
  };
2337
2462
  // ───────────────────────────────────────────────────────────────────────────
2338
2463
  // Alpha handlers
2339
2464
  // ───────────────────────────────────────────────────────────────────────────
2340
2465
  #J = (t) => {
2341
- this.disabled || (t.preventDefault(), this.#h = !0, this.#f?.focus(), this.#_(t));
2466
+ this.disabled || (t.preventDefault(), this.#o = !0, this.#b?.focus(), this.#C(t));
2342
2467
  };
2343
- #_(t) {
2344
- if (!this.#m) return;
2345
- const e = this.#m.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
2346
- this.#s = Math.round(s * 100), this.#v(), this.#L();
2468
+ #C(t) {
2469
+ if (!this.#v) return;
2470
+ const e = this.#v.getBoundingClientRect(), s = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
2471
+ this.#s = Math.round(s * 100), this.#A(), this.#L();
2347
2472
  }
2348
- #U = (t) => {
2473
+ #V = (t) => {
2349
2474
  if (this.disabled) return;
2350
2475
  const e = t.shiftKey ? 10 : 1;
2351
2476
  let s = !1;
@@ -2359,36 +2484,36 @@ class dt extends p {
2359
2484
  this.#s = Math.max(0, this.#s - e), s = !0;
2360
2485
  break;
2361
2486
  }
2362
- s && (t.preventDefault(), this.#v(), this.#L(), this.#k());
2487
+ s && (t.preventDefault(), this.#A(), this.#L(), this.#k());
2363
2488
  };
2364
2489
  // ───────────────────────────────────────────────────────────────────────────
2365
2490
  // Pointer move/up
2366
2491
  // ───────────────────────────────────────────────────────────────────────────
2367
2492
  #P = (t) => {
2368
- this.#r ? this.#E(t) : this.#n ? this.#K(t) : this.#h && this.#_(t);
2493
+ this.#r ? this.#E(t) : this.#a ? this.#K(t) : this.#o && this.#C(t);
2369
2494
  };
2370
- #B = () => {
2371
- (this.#r || this.#n || this.#h) && (this.#r = !1, this.#n = !1, this.#h = !1, this.#k());
2495
+ #R = () => {
2496
+ (this.#r || this.#a || this.#o) && (this.#r = !1, this.#a = !1, this.#o = !1, this.#k());
2372
2497
  };
2373
2498
  // ───────────────────────────────────────────────────────────────────────────
2374
2499
  // Input handlers
2375
2500
  // ───────────────────────────────────────────────────────────────────────────
2376
2501
  #T = () => {
2377
- if (!this.#c) return;
2378
- const t = w(this.#c.value);
2379
- t ? (this.#t = t.hsv.h, this.#e = t.hsv.s, this.#i = t.hsv.v, this.hasAttribute("opacity") && (this.#s = t.alpha), this.#v(), this.#k()) : this.#z();
2502
+ if (!this.#g) return;
2503
+ const t = A(this.#g.value);
2504
+ t ? (this.#t = t.hsv.h, this.#e = t.hsv.s, this.#i = t.hsv.v, this.hasAttribute("opacity") && (this.#s = t.alpha), this.#A(), this.#k()) : this.#Y();
2380
2505
  };
2381
- #V = (t) => {
2506
+ #z = (t) => {
2382
2507
  t.key === "Enter" && (t.preventDefault(), this.#T());
2383
2508
  };
2384
2509
  // ───────────────────────────────────────────────────────────────────────────
2385
2510
  // Format toggle
2386
2511
  // ───────────────────────────────────────────────────────────────────────────
2387
- #R = () => {
2512
+ #F = () => {
2388
2513
  const t = ["hex", "rgb", "hsl"], e = this.format, s = t.indexOf(e), i = t[(s + 1) % t.length];
2389
2514
  this.format = i;
2390
2515
  const r = this.$('[data-ry-target="format-toggle"]');
2391
- r && (r.textContent = i.toUpperCase()), this.#z();
2516
+ r && (r.textContent = i.toUpperCase()), this.#Y();
2392
2517
  };
2393
2518
  // ───────────────────────────────────────────────────────────────────────────
2394
2519
  // Swatches
@@ -2398,56 +2523,56 @@ class dt extends p {
2398
2523
  if (e.classList.contains("ry-color-picker__swatch")) {
2399
2524
  const s = e.dataset.color;
2400
2525
  if (s) {
2401
- const i = w(s);
2402
- i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this.#v(), this.#L(), this.#k());
2526
+ const i = A(s);
2527
+ i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this.#A(), this.#L(), this.#k());
2403
2528
  }
2404
2529
  }
2405
2530
  };
2406
2531
  // ───────────────────────────────────────────────────────────────────────────
2407
2532
  // Update methods
2408
2533
  // ───────────────────────────────────────────────────────────────────────────
2409
- #v() {
2410
- this.#Y(), this.#$(), this.#x(), this.#H(), this.#O(), this.#z(), this.#Z();
2534
+ #A() {
2535
+ this.#U(), this.#x(), this.#_(), this.#D(), this.#N(), this.#Y(), this.#Z();
2411
2536
  }
2412
- #Y() {
2537
+ #U() {
2413
2538
  const t = this.$('[data-ry-target="trigger-color"]');
2414
2539
  if (t) {
2415
2540
  const e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity") ? this.#s / 100 : 1;
2416
2541
  t.style.backgroundColor = `rgba(${e.r}, ${e.g}, ${e.b}, ${s})`;
2417
2542
  }
2418
2543
  }
2419
- #$() {
2420
- if (this.#o) {
2544
+ #x() {
2545
+ if (this.#h) {
2421
2546
  const t = v({ h: this.#t, s: 100, v: 100 });
2422
- this.#o.style.setProperty("--grid-hue-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
2547
+ this.#h.style.setProperty("--grid-hue-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
2423
2548
  }
2424
- this.#a && (this.#a.style.left = `${this.#e}%`, this.#a.style.top = `${100 - this.#i}%`);
2549
+ this.#n && (this.#n.style.left = `${this.#e}%`, this.#n.style.top = `${100 - this.#i}%`);
2425
2550
  }
2426
- #x() {
2427
- this.#g && (this.#g.style.left = `${this.#t / 360 * 100}%`);
2551
+ #_() {
2552
+ this.#u && (this.#u.style.left = `${this.#t / 360 * 100}%`);
2428
2553
  }
2429
- #H() {
2430
- if (this.#m) {
2554
+ #D() {
2555
+ if (this.#v) {
2431
2556
  const t = v({ h: this.#t, s: this.#e, v: this.#i });
2432
- this.#m.style.setProperty("--alpha-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
2557
+ this.#v.style.setProperty("--alpha-color", `rgb(${t.r}, ${t.g}, ${t.b})`);
2433
2558
  }
2434
- this.#f && (this.#f.style.left = `${this.#s}%`);
2559
+ this.#b && (this.#b.style.left = `${this.#s}%`);
2435
2560
  }
2436
- #O() {
2561
+ #N() {
2437
2562
  const t = this.$('[data-ry-target="preview-color"]');
2438
2563
  if (t) {
2439
2564
  const e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity") ? this.#s / 100 : 1;
2440
2565
  t.style.backgroundColor = `rgba(${e.r}, ${e.g}, ${e.b}, ${s})`;
2441
2566
  }
2442
2567
  }
2443
- #z() {
2444
- this.#c && (this.#c.value = this.#N());
2568
+ #Y() {
2569
+ this.#g && (this.#g.value = this.#O());
2445
2570
  }
2446
2571
  #Z() {
2447
- const t = this.#N();
2572
+ const t = this.#O();
2448
2573
  this.getAttribute("value") !== t && this.setAttribute("value", t);
2449
2574
  }
2450
- #N() {
2575
+ #O() {
2451
2576
  const t = this.format, e = v({ h: this.#t, s: this.#e, v: this.#i }), s = this.hasAttribute("opacity");
2452
2577
  switch (t) {
2453
2578
  case "hex": {
@@ -2481,20 +2606,20 @@ class dt extends p {
2481
2606
  // Attribute changed
2482
2607
  // ───────────────────────────────────────────────────────────────────────────
2483
2608
  attributeChangedCallback(t, e, s) {
2484
- if (e !== s && t === "value" && this.#o && s) {
2485
- const i = w(s);
2486
- i && (this.#t = i.hsv.h, this.#e = i.hsv.s, this.#i = i.hsv.v, this.hasAttribute("opacity") && (this.#s = i.alpha), this.#Y(), this.#$(), this.#x(), this.#H(), this.#O());
2609
+ if (e !== s && t === "value" && this.#h && s) {
2610
+ const i = A(s);
2611
+ 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.#N());
2487
2612
  }
2488
2613
  }
2489
2614
  // ───────────────────────────────────────────────────────────────────────────
2490
2615
  // Public API
2491
2616
  // ───────────────────────────────────────────────────────────────────────────
2492
2617
  get value() {
2493
- return this.#N();
2618
+ return this.#O();
2494
2619
  }
2495
2620
  set value(t) {
2496
- const e = w(t);
2497
- e && (this.#t = e.hsv.h, this.#e = e.hsv.s, this.#i = e.hsv.v, this.hasAttribute("opacity") && (this.#s = e.alpha), this.#v());
2621
+ const e = A(t);
2622
+ e && (this.#t = e.hsv.h, this.#e = e.hsv.s, this.#i = e.hsv.v, this.hasAttribute("opacity") && (this.#s = e.alpha), this.#A());
2498
2623
  }
2499
2624
  get format() {
2500
2625
  return this.getAttribute("format") || "hex";
@@ -2521,30 +2646,30 @@ class dt extends p {
2521
2646
  return this.#s;
2522
2647
  }
2523
2648
  set alpha(t) {
2524
- this.#s = Math.max(0, Math.min(100, t)), this.#v();
2649
+ this.#s = Math.max(0, Math.min(100, t)), this.#A();
2525
2650
  }
2526
2651
  /** Set color from any valid color string */
2527
2652
  setColor(t) {
2528
- const e = w(t);
2529
- 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.#v(), !0) : !1;
2653
+ const e = A(t);
2654
+ 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.#A(), !0) : !1;
2530
2655
  }
2531
2656
  /** Get color in specific format */
2532
2657
  getFormattedValue(t) {
2533
2658
  const e = this.format;
2534
2659
  this.format = t;
2535
- const s = this.#N();
2660
+ const s = this.#O();
2536
2661
  return this.format = e, s;
2537
2662
  }
2538
2663
  }
2539
2664
  customElements.define("ry-color-picker", dt);
2540
- class ut extends p {
2665
+ class ut extends u {
2541
2666
  #t = null;
2542
2667
  #e = null;
2543
2668
  #i = null;
2544
2669
  #s = null;
2545
2670
  static observedAttributes = ["value", "format", "opacity", "disabled", "placeholder"];
2546
2671
  setup() {
2547
- this.#r(), this.#n(), this.#y(), this.state = "closed";
2672
+ this.#r(), this.#a(), this.#y(), this.state = "closed";
2548
2673
  }
2549
2674
  #r() {
2550
2675
  const t = this.hasAttribute("opacity"), e = this.getAttribute("format") || "hex", s = this.getAttribute("value") || "#000000", i = this.getAttribute("placeholder") || "#000000";
@@ -2575,16 +2700,16 @@ class ut extends p {
2575
2700
  </div>
2576
2701
  `, 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"]');
2577
2702
  }
2578
- #n() {
2579
- this.#t && this.on(this.#t, "click", this.#h), this.#e && (this.on(this.#e, "input", this.#d), this.on(this.#e, "keydown", this.#u), this.on(this.#e, "focus", this.#l)), this.#s && (this.on(this.#s, "ry:input", this.#g), this.on(this.#s, "ry:change", this.#m)), this.on(document, "click", this.#f), this.on(document, "keydown", this.#A);
2703
+ #a() {
2704
+ this.#t && this.on(this.#t, "click", this.#o), this.#e && (this.on(this.#e, "input", this.#c), this.on(this.#e, "keydown", this.#p), this.on(this.#e, "focus", this.#l)), this.#s && (this.on(this.#s, "ry:input", this.#u), this.on(this.#s, "ry:change", this.#v)), this.on(document, "click", this.#b), this.on(document, "keydown", this.#w);
2580
2705
  }
2581
- #h = () => {
2706
+ #o = () => {
2582
2707
  this.disabled || (this.state === "open" ? this.close() : this.open());
2583
2708
  };
2584
2709
  #l = () => {
2585
2710
  this.disabled || this.open();
2586
2711
  };
2587
- #d = () => {
2712
+ #c = () => {
2588
2713
  if (!this.#e || !this.#s) return;
2589
2714
  let t = this.#e.value;
2590
2715
  const e = this.#e.selectionStart ?? t.length, r = "#" + t.replace(/[^#a-fA-F0-9]/g, "").replace(/#/g, "").slice(0, 6);
@@ -2593,10 +2718,10 @@ class ut extends p {
2593
2718
  const n = Math.min(e, r.length);
2594
2719
  this.#e.setSelectionRange(n, n);
2595
2720
  }
2596
- const a = this.#o(r);
2597
- a && (this.#s.setColor(a), this.#p(), this.#a(r) && this.#w(), this.emit("input", { value: this.value }));
2721
+ const a = this.#h(r);
2722
+ a && (this.#s.setColor(a), this.#d(), this.#n(r) && this.#m(), this.emit("input", { value: this.value }));
2598
2723
  };
2599
- #o(t) {
2724
+ #h(t) {
2600
2725
  let e = t;
2601
2726
  e.startsWith("#") || (e = "#" + e);
2602
2727
  const s = e.slice(1);
@@ -2610,36 +2735,36 @@ class ut extends p {
2610
2735
  }
2611
2736
  return "#" + s.padEnd(6, "0");
2612
2737
  }
2613
- #a(t) {
2738
+ #n(t) {
2614
2739
  return !!(/^#[a-fA-F0-9]{6}$/.test(t) || /^#[a-fA-F0-9]{3}$/.test(t));
2615
2740
  }
2616
- #u = (t) => {
2617
- t.key === "Enter" && (t.preventDefault(), this.#d(), this.emit("change", { value: this.value }));
2741
+ #p = (t) => {
2742
+ t.key === "Enter" && (t.preventDefault(), this.#c(), this.emit("change", { value: this.value }));
2618
2743
  };
2619
- #g = () => {
2620
- !this.#s || !this.#e || (document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#p(), this.#w(), this.emit("input", { value: this.value }));
2744
+ #u = () => {
2745
+ !this.#s || !this.#e || (document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#d(), this.#m(), this.emit("input", { value: this.value }));
2621
2746
  };
2622
- #m = () => {
2747
+ #v = () => {
2623
2748
  this.emit("change", { value: this.value });
2624
2749
  };
2625
- #f = (t) => {
2750
+ #b = (t) => {
2626
2751
  this.state === "open" && (this.contains(t.target) || this.close());
2627
2752
  };
2628
- #A = (t) => {
2753
+ #w = (t) => {
2629
2754
  t.key === "Escape" && this.state === "open" && (this.close(), this.#t?.focus());
2630
2755
  };
2631
2756
  open() {
2632
- this.#c(), this.state = "open";
2757
+ this.#g(), this.state = "open";
2633
2758
  }
2634
2759
  close() {
2635
2760
  this.state = "closed", this.removeAttribute("data-ry-position");
2636
2761
  }
2637
- #c() {
2762
+ #g() {
2638
2763
  if (!this.#i) return;
2639
2764
  const t = this.getBoundingClientRect(), e = 280, i = window.innerHeight - t.bottom, r = t.top;
2640
2765
  i < e && r > i ? this.setAttribute("data-ry-position", "top") : this.setAttribute("data-ry-position", "bottom");
2641
2766
  }
2642
- #p() {
2767
+ #d() {
2643
2768
  const t = this.$('[data-ry-target="swatch-color"]');
2644
2769
  if (t && this.#s) {
2645
2770
  const e = this.#s.rgb, s = this.hasAttribute("opacity") ? this.#s.alpha / 100 : 1;
@@ -2653,24 +2778,24 @@ class ut extends p {
2653
2778
  const e = this.#s.value;
2654
2779
  this.#e.value = e.startsWith("#") ? e : "#" + e;
2655
2780
  }
2656
- this.#p();
2781
+ this.#d();
2657
2782
  }
2658
2783
  }
2659
- #w() {
2784
+ #m() {
2660
2785
  if (this.#s) {
2661
2786
  const t = this.#s.value;
2662
2787
  this.getAttribute("value") !== t && this.setAttribute("value", t);
2663
2788
  }
2664
2789
  }
2665
2790
  attributeChangedCallback(t, e, s) {
2666
- 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")));
2791
+ e !== s && (t === "value" && this.#s && this.#e && s && (this.#s.setColor(s), document.activeElement !== this.#e && (this.#e.value = this.#s.value), this.#d()), t === "disabled" && this.#e && (s !== null ? this.#e.setAttribute("disabled", "") : this.#e.removeAttribute("disabled")));
2667
2792
  }
2668
2793
  // Public API
2669
2794
  get value() {
2670
2795
  return this.#s?.value ?? this.getAttribute("value") ?? "#000000";
2671
2796
  }
2672
2797
  set value(t) {
2673
- this.#s?.setColor(t) && (this.#e && (this.#e.value = this.#s.value), this.#p(), this.#w());
2798
+ this.#s?.setColor(t) && (this.#e && (this.#e.value = this.#s.value), this.#d(), this.#m());
2674
2799
  }
2675
2800
  get disabled() {
2676
2801
  return this.hasAttribute("disabled");
@@ -2689,8 +2814,8 @@ class ut extends p {
2689
2814
  }
2690
2815
  }
2691
2816
  customElements.define("ry-color-input", ut);
2692
- function x(o) {
2693
- const t = o.trim().toLowerCase();
2817
+ function x(h) {
2818
+ const t = h.trim().toLowerCase();
2694
2819
  if (t.startsWith("#")) {
2695
2820
  const i = t.slice(1);
2696
2821
  return i.length === 3 ? {
@@ -2712,57 +2837,57 @@ function x(o) {
2712
2837
  };
2713
2838
  const s = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%/.exec(t);
2714
2839
  if (s) {
2715
- const i = parseFloat(s[1]) / 360, r = parseFloat(s[2]) / 100, a = parseFloat(s[3]) / 100, n = (c, d, u) => (u < 0 && (u += 1), u > 1 && (u -= 1), u < 1 / 6 ? c + (d - c) * 6 * u : u < 1 / 2 ? d : u < 2 / 3 ? c + (d - c) * (2 / 3 - u) * 6 : c), h = a < 0.5 ? a * (1 + r) : a + r - a * r, l = 2 * a - h;
2840
+ const i = parseFloat(s[1]) / 360, r = parseFloat(s[2]) / 100, a = parseFloat(s[3]) / 100, n = (c, d, g) => (g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? c + (d - c) * 6 * g : g < 1 / 2 ? d : g < 2 / 3 ? c + (d - c) * (2 / 3 - g) * 6 : c), o = a < 0.5 ? a * (1 + r) : a + r - a * r, l = 2 * a - o;
2716
2841
  return {
2717
- r: Math.round(n(l, h, i + 1 / 3) * 255),
2718
- g: Math.round(n(l, h, i) * 255),
2719
- b: Math.round(n(l, h, i - 1 / 3) * 255)
2842
+ r: Math.round(n(l, o, i + 1 / 3) * 255),
2843
+ g: Math.round(n(l, o, i) * 255),
2844
+ b: Math.round(n(l, o, i - 1 / 3) * 255)
2720
2845
  };
2721
2846
  }
2722
2847
  return null;
2723
2848
  }
2724
- function pt(o) {
2849
+ function pt(h) {
2725
2850
  const t = (e) => Math.max(0, Math.min(255, e)).toString(16).padStart(2, "0");
2726
- return `#${t(o.r)}${t(o.g)}${t(o.b)}`;
2851
+ return `#${t(h.r)}${t(h.g)}${t(h.b)}`;
2727
2852
  }
2728
- function gt(o, t, e) {
2853
+ function gt(h, t, e) {
2729
2854
  return {
2730
- r: Math.round(o.r + (t.r - o.r) * e),
2731
- g: Math.round(o.g + (t.g - o.g) * e),
2732
- b: Math.round(o.b + (t.b - o.b) * e)
2855
+ r: Math.round(h.r + (t.r - h.r) * e),
2856
+ g: Math.round(h.g + (t.g - h.g) * e),
2857
+ b: Math.round(h.b + (t.b - h.b) * e)
2733
2858
  };
2734
2859
  }
2735
2860
  const H = "linear-gradient(90deg, #000000 0%, #ffffff 100%)", ft = 50;
2736
- class bt extends p {
2861
+ class yt extends u {
2737
2862
  #t = "linear";
2738
2863
  #e = 90;
2739
2864
  #i = "circle";
2740
2865
  #s = [];
2741
2866
  #r = null;
2742
- #n = 0;
2743
- #h = null;
2867
+ #a = 0;
2868
+ #o = null;
2744
2869
  #l = !1;
2745
- #d = null;
2746
- #o = !1;
2870
+ #c = null;
2871
+ #h = !1;
2747
2872
  // Cached DOM refs
2748
- #a = null;
2873
+ #n = null;
2874
+ #p = null;
2749
2875
  #u = null;
2750
- #g = null;
2751
2876
  static observedAttributes = ["value", "disabled", "output"];
2752
2877
  setup() {
2753
- this.#m(), this.#W(), this.#X(), this.#$();
2878
+ this.#v(), this.#W(), this.#X(), this.#x();
2754
2879
  }
2755
2880
  // ───────────────────────────────────────────────────────────────────────────
2756
2881
  // Parsing / Serialization
2757
2882
  // ───────────────────────────────────────────────────────────────────────────
2758
- #m() {
2883
+ #v() {
2759
2884
  const t = this.getAttribute("value") || H;
2760
- this.#f(t) || this.#f(H);
2885
+ this.#b(t) || this.#b(H);
2761
2886
  }
2762
- #f(t) {
2887
+ #b(t) {
2763
2888
  const e = t.trim();
2764
2889
  if (!e.startsWith("linear-gradient(") && !e.startsWith("radial-gradient("))
2765
- return x(e) ? (this.#t = "solid", this.#s = [this.#p(e, 0), this.#p(e, 100)], this.#r = this.#s[0].id, !0) : !1;
2890
+ return x(e) ? (this.#t = "solid", this.#s = [this.#d(e, 0), this.#d(e, 100)], this.#r = this.#s[0].id, !0) : !1;
2766
2891
  let s, i;
2767
2892
  e.startsWith("linear-gradient(") ? (s = "linear", i = e.slice(16, -1)) : (s = "radial", i = e.slice(16, -1));
2768
2893
  let r = 90, a = "circle", n = i;
@@ -2771,23 +2896,23 @@ class bt extends p {
2771
2896
  if (d)
2772
2897
  r = parseFloat(d[1]), n = i.slice(d[0].length);
2773
2898
  else {
2774
- const u = /^to\s+\w+(?:\s+\w+)?\s*,\s*/.exec(i);
2775
- if (u) {
2776
- const b = u[0].trim().replace(/,\s*$/, "");
2777
- r = this.#A(b), n = i.slice(u[0].length);
2899
+ const g = /^to\s+\w+(?:\s+\w+)?\s*,\s*/.exec(i);
2900
+ if (g) {
2901
+ const b = g[0].trim().replace(/,\s*$/, "");
2902
+ r = this.#w(b), n = i.slice(g[0].length);
2778
2903
  }
2779
2904
  }
2780
2905
  } else {
2781
2906
  const d = /^(circle|ellipse)(?:\s+at\s+[^,]+)?\s*,\s*/.exec(i);
2782
2907
  d && (a = d[1], n = i.slice(d[0].length));
2783
2908
  }
2784
- const h = [], l = /(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\)|hsla?\([^)]+\)|[a-z]+)\s+([\d.]+)%/g;
2909
+ const o = [], l = /(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\)|hsla?\([^)]+\)|[a-z]+)\s+([\d.]+)%/g;
2785
2910
  let c;
2786
2911
  for (; (c = l.exec(n)) !== null; )
2787
- h.push(this.#p(c[1], parseFloat(c[2])));
2788
- return h.length < 2 ? !1 : (this.#t = s, this.#e = r, this.#i = a, this.#s = h, this.#r = h[0].id, !0);
2912
+ o.push(this.#d(c[1], parseFloat(c[2])));
2913
+ return o.length < 2 ? !1 : (this.#t = s, this.#e = r, this.#i = a, this.#s = o, this.#r = o[0].id, !0);
2789
2914
  }
2790
- #A(t) {
2915
+ #w(t) {
2791
2916
  return {
2792
2917
  "to top": 0,
2793
2918
  "to top right": 45,
@@ -2799,7 +2924,7 @@ class bt extends p {
2799
2924
  "to top left": 315
2800
2925
  }[t] ?? 90;
2801
2926
  }
2802
- #c() {
2927
+ #g() {
2803
2928
  if (this.#t === "solid")
2804
2929
  return this.#s[0]?.color ?? "#000000";
2805
2930
  const t = this.#s.map((e) => `${e.color} ${Math.round(e.position)}%`).join(", ");
@@ -2808,39 +2933,39 @@ class bt extends p {
2808
2933
  // ───────────────────────────────────────────────────────────────────────────
2809
2934
  // Stop management
2810
2935
  // ───────────────────────────────────────────────────────────────────────────
2811
- #p(t, e) {
2812
- return { id: `stop-${this.#n++}`, color: t, position: e };
2936
+ #d(t, e) {
2937
+ return { id: `stop-${this.#a++}`, color: t, position: e };
2813
2938
  }
2814
2939
  /** CSS left value clamped so the stop handle stays within the bar */
2815
2940
  #y(t) {
2816
2941
  const e = "calc(var(--ry-gradient-picker-stop-size, 16px) / 2)";
2817
2942
  return `clamp(${e}, ${t}%, calc(100% - ${e}))`;
2818
2943
  }
2819
- #w(t, e) {
2820
- const s = this.#p(t, e);
2821
- this.#s.push(s), this.#M(), this.#r = s.id, this.#E(), this.#$();
2944
+ #m(t, e) {
2945
+ const s = this.#d(t, e);
2946
+ this.#s.push(s), this.#$(), this.#r = s.id, this.#E(), this.#x();
2822
2947
  }
2823
- #b(t) {
2948
+ #f(t) {
2824
2949
  if (this.#s.length <= 2) return !1;
2825
2950
  const e = this.#s.findIndex((s) => s.id === t);
2826
- 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.#E(), this.#$(), !0);
2951
+ 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.#E(), this.#x(), !0);
2827
2952
  }
2828
- #S(t) {
2829
- this.#r !== t && (this.#r = t, this.#N(), this.#L());
2953
+ #M(t) {
2954
+ this.#r !== t && (this.#r = t, this.#O(), this.#L());
2830
2955
  }
2831
- #M() {
2956
+ #$() {
2832
2957
  this.#s.sort((t, e) => t.position - e.position);
2833
2958
  }
2834
- #F() {
2959
+ #H() {
2835
2960
  return this.#s.find((t) => t.id === this.#r) ?? null;
2836
2961
  }
2837
2962
  // ───────────────────────────────────────────────────────────────────────────
2838
2963
  // Markup
2839
2964
  // ───────────────────────────────────────────────────────────────────────────
2840
2965
  #W() {
2841
- 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");
2842
- let h = "";
2843
- t && (h = `
2966
+ const t = this.hasAttribute("output"), e = p("copy"), s = p("gradient-solid"), i = p("gradient-linear"), r = p("gradient-radial"), a = p("shape-circle"), n = p("shape-ellipse");
2967
+ let o = "";
2968
+ t && (o = `
2844
2969
  <div data-ry-target="output-row" class="ry-gradient-picker__output-row">
2845
2970
  <input data-ry-target="output" type="text" class="ry-gradient-picker__output" spellcheck="false" />
2846
2971
  <button data-ry-target="copy-btn" type="button" class="ry-gradient-picker__copy-btn">${e}</button>
@@ -2863,15 +2988,15 @@ class bt extends p {
2863
2988
  <div data-ry-target="bar" class="ry-gradient-picker__bar"></div>
2864
2989
  </div>
2865
2990
  <ry-color-picker data-ry-target="picker" inline opacity></ry-color-picker>
2866
- ${h}
2867
- `, this.#a = this.$('[data-ry-target="bar"]'), this.#u = this.$('[data-ry-target="picker"]'), this.#g = this.$('[data-ry-target="output"]'), this.#E();
2991
+ ${o}
2992
+ `, this.#n = this.$('[data-ry-target="bar"]'), this.#p = this.$('[data-ry-target="picker"]'), this.#u = this.$('[data-ry-target="output"]'), this.#E();
2868
2993
  }
2869
2994
  #E() {
2870
- if (this.#a) {
2871
- this.#a.querySelectorAll('[data-ry-target="stop"]').forEach((t) => t.remove());
2995
+ if (this.#n) {
2996
+ this.#n.querySelectorAll('[data-ry-target="stop"]').forEach((t) => t.remove());
2872
2997
  for (const t of this.#s) {
2873
2998
  const e = document.createElement("div");
2874
- 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.#a.appendChild(e);
2999
+ 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);
2875
3000
  }
2876
3001
  }
2877
3002
  }
@@ -2879,15 +3004,15 @@ class bt extends p {
2879
3004
  // Event binding
2880
3005
  // ───────────────────────────────────────────────────────────────────────────
2881
3006
  #X() {
2882
- this.#a && (this.on(this.#a, "pointerdown", this.#G), this.on(this.#a, "pointermove", this.#K), this.on(this.#a, "pointerup", this.#q), this.on(this.#a, "lostpointercapture", this.#q));
3007
+ this.#n && (this.on(this.#n, "pointerdown", this.#G), this.on(this.#n, "pointermove", this.#K), this.on(this.#n, "pointerup", this.#q), this.on(this.#n, "lostpointercapture", this.#q));
2883
3008
  const t = this.$('[data-ry-target="type-solid"]'), e = this.$('[data-ry-target="type-linear"]'), s = this.$('[data-ry-target="type-radial"]');
2884
- t && this.on(t, "click", () => this.#_("solid")), e && this.on(e, "click", () => this.#_("linear")), s && this.on(s, "click", () => this.#_("radial"));
3009
+ t && this.on(t, "click", () => this.#C("solid")), e && this.on(e, "click", () => this.#C("linear")), s && this.on(s, "click", () => this.#C("radial"));
2885
3010
  const i = this.$('[data-ry-target="angle-select"]');
2886
- i && this.on(i, "ry:input", this.#U);
3011
+ i && this.on(i, "ry:input", this.#V);
2887
3012
  const r = this.$('[data-ry-target="shape-circle"]'), a = this.$('[data-ry-target="shape-ellipse"]');
2888
- r && this.on(r, "click", () => this.#P("circle")), a && this.on(a, "click", () => this.#P("ellipse")), this.#u && (this.on(this.#u, "ry:input", this.#B), this.on(this.#u, "ry:change", this.#T)), this.#g && (this.on(this.#g, "keydown", this.#R), this.on(this.#g, "blur", this.#j));
3013
+ r && this.on(r, "click", () => this.#P("circle")), a && this.on(a, "click", () => this.#P("ellipse")), this.#p && (this.on(this.#p, "ry:input", this.#R), this.on(this.#p, "ry:change", this.#T)), this.#u && (this.on(this.#u, "keydown", this.#F), this.on(this.#u, "blur", this.#j));
2889
3014
  const n = this.$('[data-ry-target="copy-btn"]');
2890
- n && this.on(n, "click", this.#V), this.#a && this.on(this.#a, "keydown", this.#J);
3015
+ n && this.on(n, "click", this.#z), this.#n && this.on(this.#n, "keydown", this.#J);
2891
3016
  }
2892
3017
  // ───────────────────────────────────────────────────────────────────────────
2893
3018
  // Bar / Stop interaction handlers
@@ -2898,26 +3023,26 @@ class bt extends p {
2898
3023
  if (s) {
2899
3024
  const i = s.getAttribute("data-stop-id");
2900
3025
  if (!i) return;
2901
- t.preventDefault(), this.#h = i, this.#l = !1, this.#d = this.#a.getBoundingClientRect(), this.#S(i), this.#a.setPointerCapture(t.pointerId), s.focus();
3026
+ t.preventDefault(), this.#o = i, this.#l = !1, this.#c = this.#n.getBoundingClientRect(), this.#M(i), this.#n.setPointerCapture(t.pointerId), s.focus();
2902
3027
  } else {
2903
- if (t.preventDefault(), !this.#a) return;
2904
- const i = this.#a.getBoundingClientRect(), r = Math.round(Math.max(0, Math.min(100, (t.clientX - i.left) / i.width * 100))), a = this.#Y(r);
2905
- this.#w(a, r), this.#a.querySelector(`[data-stop-id="${this.#r}"]`)?.focus(), this.#h = this.#r, this.#l = !1, this.#d = i, this.#a.setPointerCapture(t.pointerId), this.#I();
3028
+ if (t.preventDefault(), !this.#n) return;
3029
+ 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);
3030
+ this.#m(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();
2906
3031
  }
2907
3032
  };
2908
3033
  #K = (t) => {
2909
- if (!this.#h || !this.#d) return;
2910
- const e = this.#s.find((n) => n.id === this.#h);
3034
+ if (!this.#o || !this.#c) return;
3035
+ const e = this.#s.find((n) => n.id === this.#o);
2911
3036
  if (!e) return;
2912
- const s = Math.max(0, Math.min(1, (t.clientX - this.#d.left) / this.#d.width));
3037
+ const s = Math.max(0, Math.min(1, (t.clientX - this.#c.left) / this.#c.width));
2913
3038
  e.position = Math.round(s * 100);
2914
- const i = this.#d.top + this.#d.height / 2, r = Math.abs(t.clientY - i);
3039
+ const i = this.#c.top + this.#c.height / 2, r = Math.abs(t.clientY - i);
2915
3040
  this.#l = r > ft && this.#s.length > 2;
2916
- const a = this.#a?.querySelector(`[data-stop-id="${e.id}"]`);
2917
- 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.#M(), this.#O(), this.#H(), this.#k(), this.#I();
3041
+ const a = this.#n?.querySelector(`[data-stop-id="${e.id}"]`);
3042
+ 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.#$(), this.#N(), this.#D(), this.#k(), this.#I();
2918
3043
  };
2919
3044
  #q = () => {
2920
- this.#h && (this.#l && this.#b(this.#h), this.#h = null, this.#l = !1, this.#d = null, this.#C(), this.#D());
3045
+ this.#o && (this.#l && this.#f(this.#o), this.#o = null, this.#l = !1, this.#c = null, this.#S(), this.#B());
2921
3046
  };
2922
3047
  #J = (t) => {
2923
3048
  if (this.disabled) return;
@@ -2925,7 +3050,7 @@ class bt extends p {
2925
3050
  if (!s) return;
2926
3051
  const i = s.getAttribute("data-stop-id");
2927
3052
  if (!i) return;
2928
- const r = this.#s.find((h) => h.id === i);
3053
+ const r = this.#s.find((o) => o.id === i);
2929
3054
  if (!r) return;
2930
3055
  const a = t.shiftKey ? 10 : 1;
2931
3056
  let n = !1;
@@ -2938,39 +3063,39 @@ class bt extends p {
2938
3063
  break;
2939
3064
  case "Delete":
2940
3065
  case "Backspace":
2941
- this.#b(i) && (this.#I(), this.#D()), t.preventDefault();
3066
+ this.#f(i) && (this.#I(), this.#B()), t.preventDefault();
2942
3067
  return;
2943
3068
  }
2944
- n && (t.preventDefault(), this.#M(), this.#z(), this.#O(), this.#H(), this.#k(), this.#C(), this.#I(), this.#D());
3069
+ n && (t.preventDefault(), this.#$(), this.#Y(), this.#N(), this.#D(), this.#k(), this.#S(), this.#I(), this.#B());
2945
3070
  };
2946
3071
  // ───────────────────────────────────────────────────────────────────────────
2947
3072
  // Type / Angle / Shape handlers
2948
3073
  // ───────────────────────────────────────────────────────────────────────────
2949
- #_(t) {
2950
- this.#t !== t && (this.#t = t, this.setAttribute("data-ry-type", t), this.#x(), this.#H(), this.#k(), this.#C(), this.#I(), this.#D());
3074
+ #C(t) {
3075
+ this.#t !== t && (this.#t = t, this.setAttribute("data-ry-type", t), this.#_(), this.#D(), this.#k(), this.#S(), this.#I(), this.#B());
2951
3076
  }
2952
- #U = (t) => {
3077
+ #V = (t) => {
2953
3078
  const e = t.detail;
2954
- this.#e = e.value, this.#H(), this.#k(), this.#C(), this.#I();
3079
+ this.#e = e.value, this.#D(), this.#k(), this.#S(), this.#I();
2955
3080
  };
2956
3081
  #P(t) {
2957
- this.#i !== t && (this.#i = t, this.#x(), this.#k(), this.#C(), this.#I(), this.#D());
3082
+ this.#i !== t && (this.#i = t, this.#_(), this.#k(), this.#S(), this.#I(), this.#B());
2958
3083
  }
2959
3084
  // ───────────────────────────────────────────────────────────────────────────
2960
3085
  // Color picker handlers
2961
3086
  // ───────────────────────────────────────────────────────────────────────────
2962
- #B = () => {
2963
- const t = this.#F();
2964
- !t || !this.#u || (t.color = this.#u.value, this.#Z(t), this.#O(), this.#H(), this.#k(), this.#I());
3087
+ #R = () => {
3088
+ const t = this.#H();
3089
+ !t || !this.#p || (t.color = this.#p.value, this.#Z(t), this.#N(), this.#D(), this.#k(), this.#I());
2965
3090
  };
2966
3091
  #T = () => {
2967
- this.#C(), this.#D();
3092
+ this.#S(), this.#B();
2968
3093
  };
2969
3094
  // ───────────────────────────────────────────────────────────────────────────
2970
3095
  // Copy handler
2971
3096
  // ───────────────────────────────────────────────────────────────────────────
2972
- #V = () => {
2973
- const t = this.#c();
3097
+ #z = () => {
3098
+ const t = this.#g();
2974
3099
  navigator.clipboard.writeText(t).then(() => {
2975
3100
  const e = this.$('[data-ry-target="copy-btn"]');
2976
3101
  e && (e.setAttribute("data-copied", ""), setTimeout(() => e.removeAttribute("data-copied"), 1500));
@@ -2979,21 +3104,21 @@ class bt extends p {
2979
3104
  // ───────────────────────────────────────────────────────────────────────────
2980
3105
  // Output (editable CSS) handlers
2981
3106
  // ───────────────────────────────────────────────────────────────────────────
2982
- #R = (t) => {
2983
- t.key === "Enter" && (t.preventDefault(), this.#v());
3107
+ #F = (t) => {
3108
+ t.key === "Enter" && (t.preventDefault(), this.#A());
2984
3109
  };
2985
3110
  #j = () => {
2986
- this.#v();
3111
+ this.#A();
2987
3112
  };
2988
- #v() {
2989
- if (!this.#g) return;
2990
- const t = this.#g.value.trim();
2991
- t && this.#f(t) ? (this.#E(), this.#$(), this.#C(), this.#I(), this.#D()) : this.#k();
3113
+ #A() {
3114
+ if (!this.#u) return;
3115
+ const t = this.#u.value.trim();
3116
+ t && this.#b(t) ? (this.#E(), this.#x(), this.#S(), this.#I(), this.#B()) : this.#k();
2992
3117
  }
2993
3118
  // ───────────────────────────────────────────────────────────────────────────
2994
3119
  // Color interpolation
2995
3120
  // ───────────────────────────────────────────────────────────────────────────
2996
- #Y(t) {
3121
+ #U(t) {
2997
3122
  if (this.#s.length === 0) return "#808080";
2998
3123
  if (this.#s.length === 1) return this.#s[0].color;
2999
3124
  const e = [...this.#s].sort((l, c) => l.position - c.position);
@@ -3007,16 +3132,16 @@ class bt extends p {
3007
3132
  }
3008
3133
  const r = i.position - s.position;
3009
3134
  if (r === 0) return s.color;
3010
- const a = (t - s.position) / r, n = x(s.color), h = x(i.color);
3011
- return !n || !h ? s.color : pt(gt(n, h, a));
3135
+ const a = (t - s.position) / r, n = x(s.color), o = x(i.color);
3136
+ return !n || !o ? s.color : pt(gt(n, o, a));
3012
3137
  }
3013
3138
  // ───────────────────────────────────────────────────────────────────────────
3014
3139
  // Update methods
3015
3140
  // ───────────────────────────────────────────────────────────────────────────
3016
- #$() {
3017
- this.setAttribute("data-ry-type", this.#t), this.#x(), this.#O(), this.#H(), this.#z(), this.#N(), this.#L(), this.#k();
3018
- }
3019
3141
  #x() {
3142
+ this.setAttribute("data-ry-type", this.#t), this.#_(), this.#N(), this.#D(), this.#Y(), this.#O(), this.#L(), this.#k();
3143
+ }
3144
+ #_() {
3020
3145
  const t = this.$('[data-ry-target="type-solid"]'), e = this.$('[data-ry-target="type-linear"]'), s = this.$('[data-ry-target="type-radial"]');
3021
3146
  t && t.toggleAttribute("data-active", this.#t === "solid"), e && e.toggleAttribute("data-active", this.#t === "linear"), s && s.toggleAttribute("data-active", this.#t === "radial");
3022
3147
  const i = this.$('[data-ry-target="shape-circle"]'), r = this.$('[data-ry-target="shape-ellipse"]');
@@ -3024,60 +3149,60 @@ class bt extends p {
3024
3149
  const a = this.$('[data-ry-target="angle-select"]');
3025
3150
  a && a.setAttribute("value", String(this.#e));
3026
3151
  }
3027
- #H() {
3028
- if (!this.#u) return;
3029
- const t = this.#u.querySelector('[data-ry-target="preview-color"]');
3030
- t && (t.style.backgroundImage = this.#t === "solid" ? "" : this.#c());
3152
+ #D() {
3153
+ if (!this.#p) return;
3154
+ const t = this.#p.querySelector('[data-ry-target="preview-color"]');
3155
+ t && (t.style.backgroundImage = this.#t === "solid" ? "" : this.#g());
3031
3156
  }
3032
- #O() {
3033
- if (!this.#a) return;
3157
+ #N() {
3158
+ if (!this.#n) return;
3034
3159
  const t = this.#s.map((e) => `${e.color} ${e.position}%`).join(", ");
3035
- this.#a.style.backgroundImage = `linear-gradient(to right, ${t})`;
3160
+ this.#n.style.backgroundImage = `linear-gradient(to right, ${t})`;
3036
3161
  }
3037
- #z() {
3038
- if (this.#a)
3162
+ #Y() {
3163
+ if (this.#n)
3039
3164
  for (const t of this.#s) {
3040
- const e = this.#a.querySelector(`[data-stop-id="${t.id}"]`);
3165
+ const e = this.#n.querySelector(`[data-stop-id="${t.id}"]`);
3041
3166
  e && (e.style.left = this.#y(t.position));
3042
3167
  }
3043
3168
  }
3044
3169
  #Z(t) {
3045
- if (!this.#a) return;
3046
- const e = this.#a.querySelector(`[data-stop-id="${t.id}"]`);
3170
+ if (!this.#n) return;
3171
+ const e = this.#n.querySelector(`[data-stop-id="${t.id}"]`);
3047
3172
  e && e.style.setProperty("--stop-color", t.color);
3048
3173
  }
3049
- #N() {
3050
- if (!this.#a) return;
3051
- const t = this.#a.querySelectorAll('[data-ry-target="stop"]');
3174
+ #O() {
3175
+ if (!this.#n) return;
3176
+ const t = this.#n.querySelectorAll('[data-ry-target="stop"]');
3052
3177
  for (const e of t)
3053
3178
  e.getAttribute("data-stop-id") === this.#r ? e.setAttribute("data-selected", "") : e.removeAttribute("data-selected");
3054
3179
  }
3055
3180
  #L() {
3056
- const t = this.#F();
3057
- !t || !this.#u || this.#u.setColor(t.color);
3181
+ const t = this.#H();
3182
+ !t || !this.#p || this.#p.setColor(t.color);
3058
3183
  }
3059
3184
  #k() {
3060
- this.#g && document.activeElement !== this.#g && (this.#g.value = this.#c());
3185
+ this.#u && document.activeElement !== this.#u && (this.#u.value = this.#g());
3061
3186
  }
3062
- #C() {
3063
- const t = this.#c();
3064
- this.getAttribute("value") !== t && (this.#o = !0, this.setAttribute("value", t), this.#o = !1);
3187
+ #S() {
3188
+ const t = this.#g();
3189
+ this.getAttribute("value") !== t && (this.#h = !0, this.setAttribute("value", t), this.#h = !1);
3065
3190
  }
3066
3191
  // ───────────────────────────────────────────────────────────────────────────
3067
3192
  // Events
3068
3193
  // ───────────────────────────────────────────────────────────────────────────
3069
3194
  #I() {
3070
3195
  this.emit("input", {
3071
- value: this.#c(),
3196
+ value: this.#g(),
3072
3197
  type: this.#t,
3073
3198
  angle: this.#e,
3074
3199
  shape: this.#i,
3075
3200
  stops: this.stops
3076
3201
  });
3077
3202
  }
3078
- #D() {
3203
+ #B() {
3079
3204
  this.emit("change", {
3080
- value: this.#c(),
3205
+ value: this.#g(),
3081
3206
  type: this.#t,
3082
3207
  angle: this.#e,
3083
3208
  shape: this.#i,
@@ -3088,28 +3213,28 @@ class bt extends p {
3088
3213
  // Attribute changed
3089
3214
  // ───────────────────────────────────────────────────────────────────────────
3090
3215
  attributeChangedCallback(t, e, s) {
3091
- e === s || this.#o || t === "value" && this.#a && s && this.#f(s) && (this.#E(), this.#$());
3216
+ e === s || this.#h || t === "value" && this.#n && s && this.#b(s) && (this.#E(), this.#x());
3092
3217
  }
3093
3218
  // ───────────────────────────────────────────────────────────────────────────
3094
3219
  // Public API
3095
3220
  // ───────────────────────────────────────────────────────────────────────────
3096
3221
  get value() {
3097
- return this.#c();
3222
+ return this.#g();
3098
3223
  }
3099
3224
  set value(t) {
3100
- this.#f(t) && (this.#E(), this.#$(), this.#C());
3225
+ this.#b(t) && (this.#E(), this.#x(), this.#S());
3101
3226
  }
3102
3227
  get type() {
3103
3228
  return this.#t;
3104
3229
  }
3105
3230
  set type(t) {
3106
- this.#_(t);
3231
+ this.#C(t);
3107
3232
  }
3108
3233
  get angle() {
3109
3234
  return this.#e;
3110
3235
  }
3111
3236
  set angle(t) {
3112
- this.#e = (t % 360 + 360) % 360, this.#x(), this.#k(), this.#C();
3237
+ this.#e = (t % 360 + 360) % 360, this.#_(), this.#k(), this.#S();
3113
3238
  }
3114
3239
  get shape() {
3115
3240
  return this.#i;
@@ -3121,7 +3246,7 @@ class bt extends p {
3121
3246
  return this.#s.map((t) => ({ ...t }));
3122
3247
  }
3123
3248
  get selectedStop() {
3124
- const t = this.#F();
3249
+ const t = this.#H();
3125
3250
  return t ? { ...t } : null;
3126
3251
  }
3127
3252
  get disabled() {
@@ -3131,31 +3256,31 @@ class bt extends p {
3131
3256
  t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
3132
3257
  }
3133
3258
  addStop(t, e) {
3134
- this.#w(t, e), this.#C(), this.#I(), this.#D();
3259
+ this.#m(t, e), this.#S(), this.#I(), this.#B();
3135
3260
  }
3136
3261
  removeStop(t) {
3137
- const e = this.#b(t);
3138
- return e && (this.#k(), this.#C(), this.#D()), e;
3262
+ const e = this.#f(t);
3263
+ return e && (this.#k(), this.#S(), this.#B()), e;
3139
3264
  }
3140
3265
  }
3141
- customElements.define("ry-gradient-picker", bt);
3142
- let yt = 0;
3266
+ customElements.define("ry-gradient-picker", yt);
3267
+ let bt = 0;
3143
3268
  const mt = 5;
3144
- function _(o) {
3145
- return g(o).replace(/width="24"/g, 'width="16"').replace(/height="24"/g, 'height="16"').replace(/viewBox/, 'class="ry-tree__icon" viewBox');
3269
+ function _(h) {
3270
+ return p(h).replace(/width="24"/g, 'width="16"').replace(/height="24"/g, 'height="16"').replace(/viewBox/, 'class="ry-tree__icon" viewBox');
3146
3271
  }
3147
- class k extends p {
3272
+ class k extends u {
3148
3273
  // Drag state
3149
3274
  #t = !1;
3150
3275
  #e = !1;
3151
3276
  #i = 0;
3152
3277
  #s = 0;
3153
3278
  #r = null;
3154
- #n = null;
3155
- #h = null;
3279
+ #a = null;
3280
+ #o = null;
3156
3281
  #l = null;
3157
3282
  setup() {
3158
- this.#d(), this.on(this, "click", (t) => {
3283
+ this.#c(), this.on(this, "click", (t) => {
3159
3284
  const s = t.target.closest('[data-ry-target="file"]');
3160
3285
  s && (this.$$("[data-ry-selected]").forEach((i) => i.removeAttribute("data-ry-selected")), s.setAttribute("data-ry-selected", ""), this.emit("select", {
3161
3286
  label: s.dataset.ryLabel ?? ""
@@ -3168,42 +3293,42 @@ class k extends p {
3168
3293
  label: i,
3169
3294
  open: e.checked
3170
3295
  });
3171
- }), this.hasAttribute("sortable") && this.#m();
3296
+ }), this.hasAttribute("sortable") && this.#v();
3172
3297
  }
3173
3298
  // ── Build ──────────────────────────────────────────────────
3174
- #d() {
3299
+ #c() {
3175
3300
  if (this.$(".ry-tree__root")) return;
3176
3301
  const t = Array.from(this.children), e = document.createElement("ul");
3177
3302
  e.className = "ry-tree__root";
3178
3303
  for (const s of t)
3179
- e.appendChild(this.#o(s));
3304
+ e.appendChild(this.#h(s));
3180
3305
  this.innerHTML = "", this.appendChild(e);
3181
3306
  }
3182
- #o(t) {
3307
+ #h(t) {
3183
3308
  const e = document.createElement("li");
3184
3309
  e.className = "ry-tree__item";
3185
3310
  const s = t.getAttribute("label") ?? "", i = t.hasAttribute("open"), r = t.hasAttribute("selected"), a = Array.from(t.children).filter(
3186
- (h) => h.tagName === "RY-TREE-ITEM"
3311
+ (o) => o.tagName === "RY-TREE-ITEM"
3187
3312
  );
3188
3313
  if (a.length > 0) {
3189
- const h = `ry-tree-${++yt}`, l = document.createElement("input");
3190
- l.type = "checkbox", l.id = h, l.className = "ry-tree__toggle", i && (l.checked = !0);
3314
+ const o = `ry-tree-${++bt}`, l = document.createElement("input");
3315
+ l.type = "checkbox", l.id = o, l.className = "ry-tree__toggle", i && (l.checked = !0);
3191
3316
  const c = document.createElement("label");
3192
- c.htmlFor = h, c.className = "ry-tree__label", c.setAttribute("data-ry-target", "folder"), c.dataset.ryLabel = s, c.innerHTML = `
3317
+ c.htmlFor = o, c.className = "ry-tree__label", c.setAttribute("data-ry-target", "folder"), c.dataset.ryLabel = s, c.innerHTML = `
3193
3318
  <span class="ry-tree__icon-closed">${_("folder")}</span>
3194
3319
  <span class="ry-tree__icon-open">${_("folder-open")}</span>
3195
3320
  ${s}
3196
3321
  `;
3197
3322
  const d = document.createElement("div");
3198
3323
  d.className = "ry-tree__children-wrapper";
3199
- const u = document.createElement("ul");
3200
- u.className = "ry-tree__children";
3324
+ const g = document.createElement("ul");
3325
+ g.className = "ry-tree__children";
3201
3326
  for (const b of a)
3202
- u.appendChild(this.#o(b));
3203
- d.appendChild(u), e.appendChild(l), e.appendChild(c), e.appendChild(d);
3327
+ g.appendChild(this.#h(b));
3328
+ d.appendChild(g), e.appendChild(l), e.appendChild(c), e.appendChild(d);
3204
3329
  } else {
3205
- const h = document.createElement("div");
3206
- h.className = "ry-tree__file", h.setAttribute("data-ry-target", "file"), h.dataset.ryLabel = s, r && h.setAttribute("data-ry-selected", ""), h.innerHTML = `${_("file")} ${s}`, e.appendChild(h);
3330
+ const o = document.createElement("div");
3331
+ o.className = "ry-tree__file", o.setAttribute("data-ry-target", "file"), o.dataset.ryLabel = s, r && o.setAttribute("data-ry-selected", ""), o.innerHTML = `${_("file")} ${s}`, e.appendChild(o);
3207
3332
  }
3208
3333
  return e;
3209
3334
  }
@@ -3211,24 +3336,24 @@ class k extends p {
3211
3336
  /** Serialize the current tree state to JSON. */
3212
3337
  toJSON() {
3213
3338
  const t = this.$(".ry-tree__root");
3214
- return t ? this.#a(t) : [];
3339
+ return t ? this.#n(t) : [];
3215
3340
  }
3216
3341
  /** Alias for toJSON(). */
3217
3342
  get value() {
3218
3343
  return this.toJSON();
3219
3344
  }
3220
- #a(t) {
3345
+ #n(t) {
3221
3346
  return Array.from(t.children).filter(
3222
3347
  (s) => s instanceof HTMLElement && s.classList.contains("ry-tree__item")
3223
- ).map((s) => this.#u(s));
3348
+ ).map((s) => this.#p(s));
3224
3349
  }
3225
- #u(t) {
3350
+ #p(t) {
3226
3351
  const e = t.querySelector(':scope > [data-ry-target="folder"]'), s = t.querySelector(':scope > [data-ry-target="file"]');
3227
3352
  if (e) {
3228
3353
  const r = t.querySelector(":scope > .ry-tree__toggle"), a = t.querySelector(".ry-tree__children"), n = { label: e.dataset.ryLabel ?? "" };
3229
3354
  if (r?.checked && (n.open = !0), a) {
3230
- const h = this.#a(a);
3231
- h.length > 0 && (n.children = h);
3355
+ const o = this.#n(a);
3356
+ o.length > 0 && (n.children = o);
3232
3357
  }
3233
3358
  return n;
3234
3359
  }
@@ -3239,83 +3364,83 @@ class k extends p {
3239
3364
  static from(t) {
3240
3365
  const e = document.createElement("ry-tree");
3241
3366
  for (const s of t)
3242
- e.appendChild(k.#g(s));
3367
+ e.appendChild(k.#u(s));
3243
3368
  return e;
3244
3369
  }
3245
- static #g(t) {
3370
+ static #u(t) {
3246
3371
  const e = document.createElement("ry-tree-item");
3247
3372
  if (e.setAttribute("label", t.label), t.open && e.setAttribute("open", ""), t.selected && e.setAttribute("selected", ""), t.children)
3248
3373
  for (const s of t.children)
3249
- e.appendChild(k.#g(s));
3374
+ e.appendChild(k.#u(s));
3250
3375
  return e;
3251
3376
  }
3252
3377
  // ── Drag and Drop ──────────────────────────────────────────
3253
- #m() {
3254
- this.on(this, "pointerdown", this.#f), this.on(document, "pointermove", this.#A), this.on(document, "pointerup", this.#c);
3378
+ #v() {
3379
+ this.on(this, "pointerdown", this.#b), this.on(document, "pointermove", this.#w), this.on(document, "pointerup", this.#g);
3255
3380
  }
3256
- #f = (t) => {
3381
+ #b = (t) => {
3257
3382
  const s = t.target.closest(".ry-tree__label, .ry-tree__file");
3258
3383
  if (!s) return;
3259
3384
  const i = s.closest(".ry-tree__item");
3260
3385
  i && (this.#t = !0, this.#i = t.clientX, this.#s = t.clientY, this.#r = i);
3261
3386
  };
3262
- #A = (t) => {
3387
+ #w = (t) => {
3263
3388
  if (!this.#t && !this.#e) return;
3264
3389
  if (this.#t && !this.#e) {
3265
3390
  const c = t.clientX - this.#i, d = t.clientY - this.#s;
3266
3391
  if (Math.hypot(c, d) < mt) return;
3267
- this.#t = !1, this.#e = !0, this.#p(t);
3392
+ this.#t = !1, this.#e = !0, this.#d(t);
3268
3393
  }
3269
- if (!this.#e || !this.#n) return;
3270
- this.#n.style.left = `${t.clientX + 12}px`, this.#n.style.top = `${t.clientY - 14}px`, this.#n.style.display = "none";
3394
+ if (!this.#e || !this.#a) return;
3395
+ this.#a.style.left = `${t.clientX + 12}px`, this.#a.style.top = `${t.clientY - 14}px`, this.#a.style.display = "none";
3271
3396
  const e = document.elementFromPoint(t.clientX, t.clientY);
3272
- if (this.#n.style.display = "", !e) {
3273
- this.#b();
3397
+ if (this.#a.style.display = "", !e) {
3398
+ this.#f();
3274
3399
  return;
3275
3400
  }
3276
3401
  const s = e.closest(".ry-tree__label, .ry-tree__file");
3277
3402
  if (!s) {
3278
- this.#b();
3403
+ this.#f();
3279
3404
  return;
3280
3405
  }
3281
3406
  const i = s.closest(".ry-tree__item");
3282
3407
  if (!i || i === this.#r) {
3283
- this.#b();
3408
+ this.#f();
3284
3409
  return;
3285
3410
  }
3286
3411
  if (this.#r?.contains(i)) {
3287
- this.#b();
3412
+ this.#f();
3288
3413
  return;
3289
3414
  }
3290
- const r = s.getBoundingClientRect(), a = t.clientY - r.top, n = r.height, h = i.querySelector(":scope > .ry-tree__toggle") !== null;
3415
+ const r = s.getBoundingClientRect(), a = t.clientY - r.top, n = r.height, o = i.querySelector(":scope > .ry-tree__toggle") !== null;
3291
3416
  let l;
3292
- h && a > n * 0.25 && a < n * 0.75 ? l = "inside" : a < n * 0.5 ? l = "before" : l = "after", this.#w(i, l);
3417
+ o && a > n * 0.25 && a < n * 0.75 ? l = "inside" : a < n * 0.5 ? l = "before" : l = "after", this.#m(i, l);
3293
3418
  };
3294
- #c = () => {
3419
+ #g = () => {
3295
3420
  this.#e && this.#y(), this.#t = !1, this.#e = !1, this.#r = null;
3296
3421
  };
3297
- #p(t) {
3422
+ #d(t) {
3298
3423
  if (!this.#r) return;
3299
3424
  t.preventDefault(), this.#r.setAttribute("data-ry-dragging", ""), this.#r.classList.add("ry-tree__item--collapsed");
3300
3425
  const e = this.#r.querySelector(".ry-tree__label, .ry-tree__file");
3301
3426
  if (!e) return;
3302
3427
  const s = e.cloneNode(!0);
3303
- 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.#n = s;
3428
+ 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;
3304
3429
  }
3305
3430
  #y() {
3306
- this.#n?.parentNode && this.#n.parentNode.removeChild(this.#n), this.#n = null, this.#r?.classList.remove("ry-tree__item--collapsed"), this.#r?.removeAttribute("data-ry-dragging");
3307
- const t = this.#h, e = this.#l;
3308
- this.#b(), this.#r && t && e && this.#S(this.#r, t, e);
3431
+ 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");
3432
+ const t = this.#o, e = this.#l;
3433
+ this.#f(), this.#r && t && e && this.#M(this.#r, t, e);
3309
3434
  }
3310
- #w(t, e) {
3311
- this.#h === t && this.#l === e || (this.#b(), t.setAttribute("data-ry-drop-target", e), this.#h = t, this.#l = e);
3435
+ #m(t, e) {
3436
+ this.#o === t && this.#l === e || (this.#f(), t.setAttribute("data-ry-drop-target", e), this.#o = t, this.#l = e);
3312
3437
  }
3313
- #b() {
3314
- this.#h?.removeAttribute("data-ry-drop-target"), this.#h = null, this.#l = null;
3438
+ #f() {
3439
+ this.#o?.removeAttribute("data-ry-drop-target"), this.#o = null, this.#l = null;
3315
3440
  }
3316
- #S(t, e, s) {
3441
+ #M(t, e, s) {
3317
3442
  if (s === "inside" && e.contains(t)) return;
3318
- const i = this.#M(t), r = this.#M(e);
3443
+ const i = this.#$(t), r = this.#$(e);
3319
3444
  if (s === "before")
3320
3445
  e.parentNode?.insertBefore(t, e);
3321
3446
  else if (s === "after")
@@ -3334,50 +3459,283 @@ class k extends p {
3334
3459
  position: s
3335
3460
  });
3336
3461
  }
3337
- #M(t) {
3462
+ #$(t) {
3338
3463
  const e = t.querySelector(':scope > [data-ry-target="folder"]'), s = t.querySelector(':scope > [data-ry-target="file"]');
3339
3464
  return e?.dataset.ryLabel ?? s?.dataset.ryLabel ?? "";
3340
3465
  }
3341
3466
  }
3342
- class vt extends p {
3467
+ class vt extends u {
3343
3468
  // Declarative container consumed by RyTree#build
3344
3469
  }
3345
3470
  customElements.define("ry-tree", k);
3346
3471
  customElements.define("ry-tree-item", vt);
3472
+ class At extends u {
3473
+ setup() {
3474
+ this.#t();
3475
+ }
3476
+ #t() {
3477
+ if (this.$('[data-ry-target="label"]')) return;
3478
+ const t = this.textContent?.trim() ?? "", e = this.hasAttribute("removable");
3479
+ 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">${p("close")}</button>` : ""}`, e) {
3480
+ const s = this.$('[data-ry-target="remove"]');
3481
+ s && this.on(s, "click", (i) => {
3482
+ i.stopPropagation(), this.emit("remove", {
3483
+ value: this.dataset.value ?? "",
3484
+ label: t
3485
+ }), this.remove();
3486
+ });
3487
+ }
3488
+ }
3489
+ get label() {
3490
+ return this.$('[data-ry-target="label"]')?.textContent?.trim() ?? "";
3491
+ }
3492
+ }
3493
+ customElements.define("ry-tag", At);
3494
+ class kt extends u {
3495
+ #t = [];
3496
+ setup() {
3497
+ this.#e(), this.#i();
3498
+ }
3499
+ #e() {
3500
+ if (this.$('[data-ry-target="container"]')) return;
3501
+ const t = this.getAttribute("placeholder") ?? "Add tag...", e = this.getAttribute("name") ?? "", s = this.hasAttribute("disabled");
3502
+ this.innerHTML = `
3503
+ <div data-ry-target="container" class="ry-tag-input__container">
3504
+ <div data-ry-target="tags" class="ry-tag-input__tags"></div>
3505
+ <input data-ry-target="input" class="ry-tag-input__input" type="text" placeholder="${t}" ${s ? "disabled" : ""}>
3506
+ </div>
3507
+ <input data-ry-target="hidden" type="hidden" ${e ? `name="${e}"` : ""}>
3508
+ `;
3509
+ const i = this.$('[data-ry-target="input"]');
3510
+ i && (this.on(i, "keydown", this.#s), this.on(i, "paste", this.#r));
3511
+ const r = this.$('[data-ry-target="container"]');
3512
+ r && this.on(r, "click", () => i?.focus()), this.on(this, "ry:remove", this.#a);
3513
+ }
3514
+ #i() {
3515
+ const t = this.getAttribute("value");
3516
+ if (!t) return;
3517
+ const e = this.getAttribute("delimiter") ?? ",", s = t.split(e).map((i) => i.trim()).filter(Boolean);
3518
+ for (const i of s)
3519
+ this.#o(i);
3520
+ }
3521
+ #s = (t) => {
3522
+ const e = t.target, s = this.getAttribute("delimiter") ?? ",", i = e.value.trim();
3523
+ if (t.key === "Enter" || t.key === s || t.key === "Tab") {
3524
+ if (i)
3525
+ t.preventDefault(), this.#o(i), e.value = "";
3526
+ else if (t.key === "Tab")
3527
+ return;
3528
+ }
3529
+ t.key === "Backspace" && !e.value && this.#t.length > 0 && this.#l();
3530
+ };
3531
+ #r = (t) => {
3532
+ t.preventDefault();
3533
+ const e = t.clipboardData?.getData("text") ?? "", s = this.getAttribute("delimiter") ?? ",", i = e.split(new RegExp(`[${s}\\t\\n]+`)).map((a) => a.trim()).filter(Boolean);
3534
+ for (const a of i)
3535
+ this.#o(a);
3536
+ const r = this.$('[data-ry-target="input"]');
3537
+ r && (r.value = "");
3538
+ };
3539
+ #a = (t) => {
3540
+ const e = t.detail.value, s = this.#t.indexOf(e);
3541
+ s >= 0 && (this.#t.splice(s, 1), this.#c(), this.emit("change", { values: [...this.#t] }));
3542
+ };
3543
+ #o(t) {
3544
+ const e = this.getAttribute("max-tags");
3545
+ if (e && this.#t.length >= parseInt(e, 10) || !this.hasAttribute("allow-duplicates") && this.#t.includes(t)) return;
3546
+ this.#t.push(t);
3547
+ const s = this.$('[data-ry-target="tags"]');
3548
+ if (s) {
3549
+ const i = document.createElement("ry-tag");
3550
+ i.setAttribute("removable", ""), i.setAttribute("size", "sm"), i.setAttribute("data-value", t), i.textContent = t, s.appendChild(i);
3551
+ }
3552
+ this.#c(), this.emit("add", { value: t }), this.emit("change", { values: [...this.#t] });
3553
+ }
3554
+ #l() {
3555
+ const e = this.$('[data-ry-target="tags"]')?.lastElementChild;
3556
+ if (e) {
3557
+ const s = e.dataset.value ?? "";
3558
+ e.remove(), this.#t.pop(), this.#c(), this.emit("remove", { value: s, label: s }), this.emit("change", { values: [...this.#t] });
3559
+ }
3560
+ }
3561
+ #c() {
3562
+ const t = this.$('[data-ry-target="hidden"]'), e = this.getAttribute("delimiter") ?? ",";
3563
+ t && (t.value = this.#t.join(e));
3564
+ }
3565
+ get value() {
3566
+ const t = this.getAttribute("delimiter") ?? ",";
3567
+ return this.#t.join(t);
3568
+ }
3569
+ get values() {
3570
+ return [...this.#t];
3571
+ }
3572
+ }
3573
+ customElements.define("ry-tag-input", kt);
3574
+ class wt extends u {
3575
+ }
3576
+ customElements.define("ry-hero", wt);
3577
+ class $t extends u {
3578
+ setup() {
3579
+ this.#t();
3580
+ }
3581
+ #t() {
3582
+ if (this.$('[data-ry-target="value"]')) return;
3583
+ const t = this.querySelector('[slot="value"]'), e = this.querySelector('[slot="label"]'), s = this.getAttribute("trend"), i = t?.textContent?.trim() ?? "", r = e?.textContent?.trim() ?? "", a = s === "up" ? `<span data-ry-target="trend" class="ry-stat__trend ry-stat__trend--up">${p("chevron-up")}</span>` : s === "down" ? `<span data-ry-target="trend" class="ry-stat__trend ry-stat__trend--down">${p("chevron-down")}</span>` : "";
3584
+ this.innerHTML = `
3585
+ <div data-ry-target="value" class="ry-stat__value">${i}${a}</div>
3586
+ <div data-ry-target="label" class="ry-stat__label">${r}</div>
3587
+ `;
3588
+ }
3589
+ }
3590
+ customElements.define("ry-stat", $t);
3591
+ class xt extends u {
3592
+ setup() {
3593
+ this.#t();
3594
+ }
3595
+ #t() {
3596
+ if (this.$('[data-ry-target="icon"]')) return;
3597
+ const t = this.getAttribute("icon");
3598
+ if (!t) return;
3599
+ const e = p(t);
3600
+ if (!e) return;
3601
+ const s = document.createElement("div");
3602
+ s.setAttribute("data-ry-target", "icon"), s.className = "ry-feature__icon", s.innerHTML = e, this.insertBefore(s, this.firstChild);
3603
+ }
3604
+ }
3605
+ class _t extends u {
3606
+ }
3607
+ customElements.define("ry-feature", xt);
3608
+ customElements.define("ry-feature-grid", _t);
3609
+ class Mt extends u {
3610
+ }
3611
+ class Ct extends u {
3612
+ }
3613
+ customElements.define("ry-pricing", Mt);
3614
+ customElements.define("ry-pricing-card", Ct);
3615
+ class Et extends u {
3616
+ #t = 0;
3617
+ #e = 0;
3618
+ #i = null;
3619
+ #s = 0;
3620
+ #r = !1;
3621
+ setup() {
3622
+ this.#a(), this.#n(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.on(this, "keydown", this.#o);
3623
+ }
3624
+ #a() {
3625
+ if (this.$('[data-ry-target="viewport"]')) return;
3626
+ const t = [...this.children];
3627
+ if (this.#e = t.length, this.#e === 0) return;
3628
+ const e = this.hasAttribute("arrows"), s = this.hasAttribute("dots"), i = document.createElement("div");
3629
+ i.setAttribute("data-ry-target", "track"), i.className = "ry-carousel__track";
3630
+ for (const a of t) {
3631
+ const n = document.createElement("div");
3632
+ n.setAttribute("data-ry-target", "slide"), n.className = "ry-carousel__slide", n.appendChild(a), i.appendChild(n);
3633
+ }
3634
+ const r = document.createElement("div");
3635
+ if (r.setAttribute("data-ry-target", "viewport"), r.className = "ry-carousel__viewport", r.appendChild(i), this.innerHTML = "", this.appendChild(r), e) {
3636
+ const a = document.createElement("button");
3637
+ 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 = p("chevron-left"), this.appendChild(a), this.on(a, "click", () => this.prev());
3638
+ const n = document.createElement("button");
3639
+ 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 = p("chevron-right"), this.appendChild(n), this.on(n, "click", () => this.next());
3640
+ }
3641
+ if (s) {
3642
+ const a = document.createElement("div");
3643
+ a.setAttribute("data-ry-target", "dots"), a.className = "ry-carousel__dots";
3644
+ for (let n = 0; n < this.#e; n++) {
3645
+ const o = document.createElement("button");
3646
+ o.setAttribute("data-ry-target", "dot"), o.className = "ry-carousel__dot", o.setAttribute("aria-label", `Go to slide ${n + 1}`), o.setAttribute("type", "button"), n === 0 && o.setAttribute("data-active", ""), this.on(o, "click", () => this.goTo(n)), a.appendChild(o);
3647
+ }
3648
+ this.appendChild(a);
3649
+ }
3650
+ this.on(r, "pointerdown", this.#l), this.on(r, "pointermove", this.#c), this.on(r, "pointerup", this.#h), this.on(r, "pointercancel", this.#h), this.hasAttribute("pause-on-hover") && (this.on(this, "mouseenter", () => this.#p()), this.on(this, "mouseleave", () => this.#n())), this.goTo(0);
3651
+ }
3652
+ #o = (t) => {
3653
+ t.key === "ArrowLeft" ? (t.preventDefault(), this.prev()) : t.key === "ArrowRight" && (t.preventDefault(), this.next());
3654
+ };
3655
+ #l = (t) => {
3656
+ this.#s = t.clientX, this.#r = !0, t.currentTarget.setPointerCapture(t.pointerId);
3657
+ };
3658
+ #c = (t) => {
3659
+ this.#r && t.preventDefault();
3660
+ };
3661
+ #h = (t) => {
3662
+ if (!this.#r) return;
3663
+ this.#r = !1;
3664
+ const e = t.clientX - this.#s, s = 50;
3665
+ e > s ? this.prev() : e < -s && this.next();
3666
+ };
3667
+ #n() {
3668
+ if (this.#p(), !this.hasAttribute("autoplay")) return;
3669
+ const t = parseInt(this.getAttribute("interval") ?? "5000", 10);
3670
+ this.#i = setInterval(() => this.next(), t);
3671
+ }
3672
+ #p() {
3673
+ this.#i && (clearInterval(this.#i), this.#i = null);
3674
+ }
3675
+ goTo(t) {
3676
+ if (this.hasAttribute("loop"))
3677
+ t < 0 && (t = this.#e - 1), t >= this.#e && (t = 0);
3678
+ else if (t < 0 || t >= this.#e) return;
3679
+ this.#t = t;
3680
+ const s = this.$('[data-ry-target="track"]');
3681
+ s && (s.style.transform = `translateX(-${t * 100}%)`), this.$$('[data-ry-target="dot"]').forEach((r, a) => {
3682
+ a === t ? r.setAttribute("data-active", "") : r.removeAttribute("data-active");
3683
+ }), this.emit("change", { index: t, slide: this.#t });
3684
+ }
3685
+ next() {
3686
+ this.goTo(this.#t + 1);
3687
+ }
3688
+ prev() {
3689
+ this.goTo(this.#t - 1);
3690
+ }
3691
+ teardown() {
3692
+ this.#p();
3693
+ }
3694
+ }
3695
+ customElements.define("ry-carousel", Et);
3347
3696
  window.RyToast = f;
3348
3697
  console.log("ry-ui loaded");
3349
3698
  export {
3350
- F as RyAccordion,
3699
+ R as RyAccordion,
3351
3700
  K as RyAlert,
3352
- O as RyButton,
3701
+ N as RyButton,
3702
+ Et as RyCarousel,
3353
3703
  Q as RyCode,
3354
3704
  ut as RyColorInput,
3355
3705
  dt as RyColorPicker,
3356
3706
  W as RyDrawer,
3357
3707
  j as RyDropdown,
3358
- p as RyElement,
3708
+ u as RyElement,
3359
3709
  tt as RyExample,
3710
+ xt as RyFeature,
3711
+ _t as RyFeatureGrid,
3360
3712
  q as RyField,
3361
- bt as RyGradientPicker,
3713
+ yt as RyGradientPicker,
3714
+ wt as RyHero,
3362
3715
  et as RyIcon,
3363
3716
  ot as RyKnob,
3364
3717
  P as RyModal,
3365
3718
  ht as RyNumberSelect,
3719
+ Mt as RyPricing,
3720
+ Ct as RyPricingCard,
3366
3721
  J as RySelect,
3367
3722
  nt as RySlider,
3368
- V as RySwitch,
3369
- R as RyTabs,
3370
- N as RyThemeToggle,
3723
+ $t as RyStat,
3724
+ z as RySwitch,
3725
+ F as RyTabs,
3726
+ At as RyTag,
3727
+ kt as RyTagInput,
3728
+ O as RyThemeToggle,
3371
3729
  f as RyToast,
3372
3730
  at as RyToggleButton,
3373
- z as RyTooltip,
3731
+ Y as RyTooltip,
3374
3732
  k as RyTree,
3375
3733
  vt as RyTreeItem,
3376
- g as getIcon,
3377
- $t as getIconNames,
3378
- C as processTransforms,
3379
- kt as registerIcon,
3380
- At as registerIcons,
3734
+ p as getIcon,
3735
+ It as getIconNames,
3736
+ E as processTransforms,
3737
+ Tt as registerIcon,
3738
+ Lt as registerIcons,
3381
3739
  M as transform
3382
3740
  };
3383
3741
  //# sourceMappingURL=ry-ui.js.map