@mintplayer/web-components 2.2.0 → 2.3.0

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 (107) hide show
  1. package/a11y/index.mjs +26 -2
  2. package/a11y/src/dismiss-stack.d.ts +25 -0
  3. package/a11y/src/error-text.d.ts +41 -0
  4. package/a11y/src/focus-restore.d.ts +116 -0
  5. package/a11y/src/focus-trap.d.ts +69 -0
  6. package/a11y/src/form-associated.d.ts +48 -0
  7. package/a11y/src/host-aria.d.ts +154 -0
  8. package/a11y/src/index.d.ts +16 -0
  9. package/a11y/src/inert-regions.d.ts +52 -0
  10. package/a11y/src/live-announcer.d.ts +8 -0
  11. package/a11y/src/roving-focus.d.ts +118 -0
  12. package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
  13. package/a11y/src/testing/index.d.ts +1 -0
  14. package/accordion/index.mjs +180 -174
  15. package/accordion/src/components/mp-accordion.d.ts +18 -13
  16. package/calendar/index.mjs +1 -1
  17. package/calendar/src/mp-calendar.element.d.ts +2 -0
  18. package/carousel/index.mjs +211 -164
  19. package/carousel/src/components/mp-carousel.d.ts +1 -0
  20. package/checkbox/index.mjs +1 -1
  21. package/checkbox/src/components/mp-checkbox.d.ts +59 -1
  22. package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
  23. package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
  24. package/chunks/form-associated-axmc5sY0.mjs +58 -0
  25. package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
  26. package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
  27. package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
  28. package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
  29. package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
  30. package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
  31. package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
  32. package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
  33. package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
  34. package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
  35. package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
  36. package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
  37. package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
  38. package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
  39. package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
  40. package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
  41. package/chunks/roving-focus-CrL9982a.mjs +129 -0
  42. package/code-snippet/index.mjs +21 -13
  43. package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
  44. package/datatable/index.mjs +1 -1
  45. package/datatable/src/components/mp-datatable.d.ts +50 -0
  46. package/datatable/src/types/index.d.ts +2 -0
  47. package/datatable/src/types/labels.d.ts +30 -0
  48. package/datepicker/index.mjs +45 -22
  49. package/datepicker/src/mp-datepicker.element.d.ts +30 -0
  50. package/datetime-picker/index.mjs +15 -9
  51. package/dock/index.mjs +365 -209
  52. package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
  53. package/dropdown-menu/index.mjs +135 -90
  54. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
  55. package/file-manager/index.mjs +279 -214
  56. package/file-manager/src/components/mp-file-manager.d.ts +22 -0
  57. package/file-manager/src/types/messages.d.ts +9 -0
  58. package/multi-range/index.mjs +26 -10
  59. package/multi-range/src/mint-multi-range.element.d.ts +7 -0
  60. package/navbar/index.mjs +53 -39
  61. package/navbar/src/components/mp-navbar.d.ts +1 -0
  62. package/otp-input/index.mjs +82 -48
  63. package/otp-input/src/mint-otp-input.element.d.ts +31 -3
  64. package/overlay/index.mjs +2 -258
  65. package/overlay/src/overlay-controller.d.ts +64 -4
  66. package/package.json +9 -1
  67. package/pagination/index.mjs +1 -1
  68. package/query-builder/index.mjs +117 -87
  69. package/query-builder/src/model/messages.d.ts +9 -0
  70. package/radio/index.mjs +2 -160
  71. package/radio/src/components/mp-radio.d.ts +58 -3
  72. package/radio-group/index.d.ts +1 -0
  73. package/radio-group/index.mjs +145 -0
  74. package/radio-group/src/components/mp-radio-group.d.ts +52 -0
  75. package/radio-group/src/index.d.ts +1 -0
  76. package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
  77. package/ribbon/index.mjs +316 -304
  78. package/ribbon/src/mp-ribbon.element.d.ts +16 -0
  79. package/scheduler/index.mjs +219 -132
  80. package/scheduler/src/components/mp-scheduler.d.ts +3 -0
  81. package/scheduler/src/views/base-view.d.ts +23 -0
  82. package/select/index.mjs +1 -1
  83. package/select/src/components/mp-select.d.ts +60 -3
  84. package/shell/index.mjs +142 -31
  85. package/shell/src/components/mp-shell.d.ts +1 -0
  86. package/signature-pad/index.d.ts +1 -0
  87. package/signature-pad/index.mjs +230 -0
  88. package/signature-pad/src/index.d.ts +2 -0
  89. package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
  90. package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
  91. package/signature-pad/src/types/signature.d.ts +12 -0
  92. package/splitter/index.mjs +1 -1
  93. package/splitter/src/components/mp-splitter.d.ts +7 -0
  94. package/tab-control/index.mjs +1 -1
  95. package/tile-manager/index.mjs +110 -93
  96. package/timeline/index.mjs +138 -54
  97. package/timeline/src/components/mp-timeline.d.ts +15 -0
  98. package/timepicker/index.mjs +1 -1
  99. package/timepicker/src/mp-time-list.element.d.ts +13 -4
  100. package/timepicker/src/mp-timepicker.element.d.ts +29 -0
  101. package/toggle-button/index.mjs +1 -1
  102. package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
  103. package/tree-select/index.mjs +233 -121
  104. package/tree-select/src/components/mp-tree-select.d.ts +37 -0
  105. package/treeview/index.mjs +1 -1
  106. package/treeview/src/components/mp-treeview.d.ts +10 -1
  107. package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
@@ -2,8 +2,10 @@ import { unsafeCSS as p, LitElement as f, adoptStyles as m, nothing as l, html a
2
2
  import { map as h } from "lit/directives/map.js";
3
3
  import { range as u } from "lit/directives/range.js";
4
4
  import { unsafeHTML as g } from "lit/directives/unsafe-html.js";
5
- import { keyToIntent as b, IndexMachine as v, PointerArbiter as y } from "../swiper-core/index.mjs";
6
- const x = p(`.carousel {
5
+ import { keyToIntent as v, IndexMachine as b, PointerArbiter as y } from "../swiper-core/index.mjs";
6
+ import "lit/directives/ref.js";
7
+ import { i as x } from "../chunks/inert-regions-DXCnn1LN.mjs";
8
+ const w = p(`.carousel {
7
9
  position: relative;
8
10
  }
9
11
 
@@ -324,12 +326,18 @@ const x = p(`.carousel {
324
326
  :host(:not([data-js])) .nojs-cell slot::slotted(*) {
325
327
  flex: 0 0 100%;
326
328
  width: 100% !important;
329
+ visibility: hidden;
330
+ transition: visibility 0s 0.5s;
327
331
  }
328
332
 
329
333
  :host(:not([data-js])[animation=none]) .nojs-cell {
330
334
  transition-duration: 0s;
331
335
  }
332
336
 
337
+ :host(:not([data-js])[animation=none]) .nojs-cell slot::slotted(*) {
338
+ transition-delay: 0s;
339
+ }
340
+
333
341
  :host(:not([data-js])[animation=fade]) .nojs-cell,
334
342
  :host(:not([data-js])[orientation=vertical]) .nojs-cell {
335
343
  display: grid;
@@ -340,7 +348,8 @@ const x = p(`.carousel {
340
348
  grid-row: 1;
341
349
  grid-column: 1;
342
350
  opacity: 0;
343
- transition: opacity 0.4s ease-in-out;
351
+ visibility: hidden;
352
+ transition: opacity 0.4s ease-in-out, visibility 0s 0.4s;
344
353
  }
345
354
 
346
355
  .carousel-controls .carousel-control-prev,
@@ -475,34 +484,43 @@ const x = p(`.carousel {
475
484
  transition: none !important;
476
485
  }
477
486
  }`);
478
- class w extends f {
487
+ class k extends f {
479
488
  constructor() {
480
- super(...arguments), this.#e = [], this.#i = 0, this.#f = null, this.#t = null, this.#a = null, this.#l = null, this.#n = null, this.#m = /* @__PURE__ */ new Map(), this.#g = 0, this.#c = null, this.#r = null, this.#s = null, this.#b = !1, this.togglePaused = () => {
481
- this.#x(!this.paused);
482
- }, this.#M = () => {
483
- this.#p(), this.requestUpdate();
484
- }, this.#P = (t) => {
489
+ super(...arguments), this.#e = [], this.#i = 0, this.#v = null, this.#t = null, this.#a = null, this.#d = null, this.#u = null, this.#b = /* @__PURE__ */ new Map(), this.#y = 0, this.#p = null, this.#n = null, this.#s = null, this.#l = x(), this.#o = !1, this.#x = !1, this.togglePaused = () => {
490
+ this.#$(!this.paused);
491
+ }, this.#I = () => {
492
+ this.#r(), this.requestUpdate();
493
+ }, this.#A = !1, this.#E = !1, this.#T = () => {
494
+ this.#A = !0, this.#r();
495
+ }, this.#q = () => {
496
+ this.#A = !1, this.#r();
497
+ }, this.#P = () => {
498
+ this.#E = !0, this.#r();
499
+ }, this.#N = (t) => {
500
+ const e = t.relatedTarget;
501
+ e instanceof Node && (e === this || this.contains(e) || this.renderRoot?.contains(e)) || (this.#E = !1, this.#r());
502
+ }, this.#Y = (t) => {
485
503
  if (t.touches.length !== 1) return;
486
504
  const e = t.touches[0];
487
505
  this.#a?.pointerDown(e.clientX, e.clientY);
488
- }, this.#I = (t) => {
506
+ }, this.#W = (t) => {
489
507
  const e = t.touches[0];
490
- e && this.#a?.pointerMove(e.clientX, e.clientY) && (t.preventDefault(), t.stopPropagation());
491
- }, this.#U = (t) => {
492
- this.#a?.pointerUp() && (t.preventDefault(), t.stopPropagation());
493
- }, this.#B = () => {
494
- this.#a?.abort(), this.#t?.goto(this.#i, { animate: !1 });
495
- }, this.#H = (t) => {
496
- if (t.target !== t.currentTarget || !this.#S) return;
497
- const e = b(t.key, this.#o);
508
+ e && this.#a?.pointerMove(e.clientX, e.clientY) && (this.#o || (this.#o = !0, this.#l.suspend()), t.preventDefault(), t.stopPropagation());
509
+ }, this.#K = (t) => {
510
+ this.#a?.pointerUp() && (t.preventDefault(), t.stopPropagation()), this.#o && (this.#o = !1, this.#h());
511
+ }, this.#G = () => {
512
+ this.#a?.abort(), this.#t?.goto(this.#i, { animate: !1 }), this.#o && (this.#o = !1, this.#h());
513
+ }, this.#J = (t) => {
514
+ if (t.target !== t.currentTarget || !this.#B) return;
515
+ const e = v(t.key, this.#c);
498
516
  e && (t.preventDefault(), this.#t?.intent(e));
499
- }, this.#N = (t) => {
517
+ }, this.#Q = (t) => {
500
518
  const i = [...this.renderRoot?.querySelectorAll(".car-radio") ?? []].indexOf(t.target);
501
519
  i >= 0 && i !== this.#i && this.#t?.goto(i);
502
520
  };
503
521
  }
504
522
  static {
505
- this.styles = [x];
523
+ this.styles = [w];
506
524
  }
507
525
  static get observedAttributes() {
508
526
  return [
@@ -518,55 +536,78 @@ class w extends f {
518
536
  }
519
537
  #e;
520
538
  #i;
521
- #f;
539
+ #v;
522
540
  #t;
523
541
  #a;
524
- #l;
542
+ #d;
543
+ #u;
544
+ #b;
545
+ #y;
546
+ #p;
525
547
  #n;
526
- #m;
527
- #g;
528
- #c;
529
- #r;
530
548
  #s;
531
- #b;
549
+ #l;
550
+ #o;
551
+ #x;
532
552
  // ---- element lifecycle ----------------------------------------------------
533
553
  createRenderRoot() {
534
554
  if (this.shadowRoot) {
535
555
  const e = [...this.shadowRoot.querySelectorAll(".car-radio")].findIndex((i) => i.checked);
536
- return e > 0 && (this.#f = e), this.shadowRoot.replaceChildren(), m(this.shadowRoot, this.constructor.elementStyles ?? []), this.shadowRoot;
556
+ return e > 0 && (this.#v = e), this.shadowRoot.replaceChildren(), m(this.shadowRoot, this.constructor.elementStyles ?? []), this.shadowRoot;
537
557
  }
538
558
  return super.createRenderRoot();
539
559
  }
540
560
  connectedCallback() {
541
- super.connectedCallback(), this.setAttribute("data-js", ""), this.hasAttribute("role") || this.setAttribute("role", "region"), this.hasAttribute("aria-roledescription") || this.setAttribute("aria-roledescription", "carousel"), typeof window < "u" && window.matchMedia && !this.#r && (this.#r = window.matchMedia("(prefers-reduced-motion: reduce)")), this.#r?.addEventListener("change", this.#M), this.hasUpdated && (this.#L(), this.#j(), this.#p());
561
+ super.connectedCallback(), this.setAttribute("data-js", ""), this.hasAttribute("role") || this.setAttribute("role", "region"), this.hasAttribute("aria-roledescription") || this.setAttribute("aria-roledescription", "carousel"), typeof window < "u" && window.matchMedia && !this.#n && (this.#n = window.matchMedia("(prefers-reduced-motion: reduce)")), this.#n?.addEventListener("change", this.#I), this.addEventListener("pointerenter", this.#T), this.addEventListener("pointerleave", this.#q), this.addEventListener("focusin", this.#P), this.addEventListener("focusout", this.#N), this.hasUpdated && (this.#O(), this.#L(), this.#r());
542
562
  }
543
563
  disconnectedCallback() {
544
- super.disconnectedCallback(), this.#r?.removeEventListener("change", this.#M), this.#l?.disconnect(), this.#n?.disconnect(), this.#a?.abort(), this.#q();
564
+ super.disconnectedCallback(), this.#n?.removeEventListener("change", this.#I), this.removeEventListener("pointerenter", this.#T), this.removeEventListener("pointerleave", this.#q), this.removeEventListener("focusin", this.#P), this.removeEventListener("focusout", this.#N), this.#d?.disconnect(), this.#u?.disconnect(), this.#a?.abort(), this.#F(), this.#o && (this.#o = !1, this.#l.resume()), this.#l.dispose();
545
565
  }
546
566
  firstUpdated() {
547
- this.#O(), this.#L(), this.#j();
548
- const t = this.#f;
549
- this.#f = null, t !== null && t < this.#e.length ? this.#t?.goto(t, { animate: !1 }) : this.#u(this.#i), this.#p();
550
- const e = this.#A;
551
- e && (e.addEventListener("touchstart", this.#P, { passive: !0 }), e.addEventListener("touchmove", this.#I, { passive: !1 }), e.addEventListener("touchend", this.#U, { passive: !1 }), e.addEventListener("touchcancel", this.#B, { passive: !0 }));
567
+ this.#_(), this.#O(), this.#L();
568
+ const t = this.#v;
569
+ this.#v = null, t !== null && t < this.#e.length ? this.#t?.goto(t, { animate: !1 }) : this.#m(this.#i), this.#r();
570
+ const e = this.#M;
571
+ e && (e.addEventListener("touchstart", this.#Y, { passive: !0 }), e.addEventListener("touchmove", this.#W, { passive: !1 }), e.addEventListener("touchend", this.#K, { passive: !1 }), e.addEventListener("touchcancel", this.#G, { passive: !0 }));
572
+ }
573
+ updated() {
574
+ this.#U();
575
+ }
576
+ /**
577
+ * Declare the complete hidden set: every non-active slide cell plus both
578
+ * wrap-clone cells. Complete-set semantics (never deltas) means an
579
+ * interrupted transition cannot leave a stale inert behind.
580
+ */
581
+ #U() {
582
+ if (!this.hasAttribute("data-js")) return;
583
+ const t = this.renderRoot;
584
+ if (!t) return;
585
+ const e = [...t.querySelectorAll(".carousel-item.carousel-clone")];
586
+ t.querySelectorAll(".carousel-item[data-i]").forEach((i) => {
587
+ Number(i.dataset.i) !== this.#i && e.push(i);
588
+ }), this.#l.setHidden(e);
589
+ }
590
+ /** Re-declare from the committed index, then lift the suspension. */
591
+ #h() {
592
+ this.#U(), this.#l.resume();
552
593
  }
553
594
  attributeChangedCallback(t, e, i) {
554
595
  if (super.attributeChangedCallback(t, e, i), e !== i)
555
596
  switch (t) {
556
597
  case "orientation":
557
- this.#a?.setOrientation(this.#o), this.#h(), this.#u(this.#i), this.requestUpdate();
598
+ this.#a?.setOrientation(this.#c), this.#f(), this.#m(this.#i), this.requestUpdate();
558
599
  break;
559
600
  case "animation":
560
- this.#t?.setConfig({ durationMs: this.#z }), this.#h(), this.#u(this.#i), this.requestUpdate();
601
+ this.#t?.setConfig({ durationMs: this.#H }), this.#f(), this.#m(this.#i), this.requestUpdate();
561
602
  break;
562
603
  case "wrap":
563
- this.#t?.setConfig({ wrap: this.#k });
604
+ this.#t?.setConfig({ wrap: this.#C });
564
605
  break;
565
606
  case "interval":
566
- this.#p(), this.requestUpdate();
607
+ this.#r(), this.requestUpdate();
567
608
  break;
568
609
  case "paused":
569
- this.#p(), this.requestUpdate(), this.#b;
610
+ this.#r(), this.requestUpdate(), this.#x;
570
611
  break;
571
612
  case "keyboard-events":
572
613
  case "indicators":
@@ -589,17 +630,17 @@ class w extends f {
589
630
  // exactly the attributes the no-JS tier needs (navbar/shell doctrine).
590
631
  // `interval` and `paused` are the exception (client-only semantics), with
591
632
  // reflecting setters for property bindings.
592
- get #v() {
633
+ get #w() {
593
634
  const t = this.getAttribute("animation");
594
635
  return t === "fade" || t === "none" ? t : "slide";
595
636
  }
596
- get #o() {
637
+ get #c() {
597
638
  return this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal";
598
639
  }
599
- get #k() {
640
+ get #C() {
600
641
  return this.getAttribute("wrap") !== "false";
601
642
  }
602
- get #S() {
643
+ get #B() {
603
644
  return this.getAttribute("keyboard-events") !== "false";
604
645
  }
605
646
  get interval() {
@@ -614,7 +655,7 @@ class w extends f {
614
655
  return this.hasAttribute("paused");
615
656
  }
616
657
  set paused(t) {
617
- this.#x(t === !0 || t === "" || t === "true", !1);
658
+ this.#$(t === !0 || t === "" || t === "true", !1);
618
659
  }
619
660
  previous() {
620
661
  this.#t?.previous();
@@ -626,86 +667,86 @@ class w extends f {
626
667
  this.#t?.goto(t, e);
627
668
  }
628
669
  play() {
629
- this.#x(!1);
670
+ this.#$(!1);
630
671
  }
631
672
  pause() {
632
- this.#x(!0);
673
+ this.#$(!0);
633
674
  }
634
675
  // ---- engine wiring ----------------------------------------------------------
635
- #O() {
636
- this.#t || (this.#t = new v(
676
+ #_() {
677
+ this.#t || (this.#t = new b(
637
678
  {
638
- applyOffsetRatio: (t) => this.#u(t),
639
- runTransition: (t, e, i, s) => this.#F(t, e, i, s)
679
+ applyOffsetRatio: (t) => this.#m(t),
680
+ runTransition: (t, e, i, s) => this.#tt(t, e, i, s)
640
681
  },
641
682
  {
642
- onIndexChange: (t) => this.#K(t),
683
+ onIndexChange: (t) => this.#st(t),
643
684
  onAnimationStart: () => {
644
- this.#$?.setAttribute("aria-busy", "true"), this.#w("animation-start", void 0);
685
+ this.#S?.setAttribute("aria-busy", "true"), this.#j("animation-start", void 0);
645
686
  },
646
687
  onAnimationEnd: () => {
647
- this.#$?.removeAttribute("aria-busy"), this.#w("animation-end", void 0);
688
+ this.#S?.removeAttribute("aria-busy"), this.#j("animation-end", void 0);
648
689
  }
649
690
  },
650
691
  {
651
692
  count: this.#e.length,
652
- wrap: this.#k,
653
- durationMs: this.#z,
693
+ wrap: this.#C,
694
+ durationMs: this.#H,
654
695
  minimumOffsetPx: 50,
655
- prefersReducedMotion: () => this.#r?.matches ?? !1
696
+ prefersReducedMotion: () => this.#n?.matches ?? !1
656
697
  }
657
698
  ), this.#a = new y(
658
- { orientation: this.#o },
699
+ { orientation: this.#c },
659
700
  {
660
701
  onDragStart: () => this.#t?.beginDrag(),
661
- onDragMove: (t) => this.#t?.dragBy(t, this.#R()),
662
- onDragEnd: (t) => this.#t?.endDrag(t, this.#R())
702
+ onDragMove: (t) => this.#t?.dragBy(t, this.#D()),
703
+ onDragEnd: (t) => this.#t?.endDrag(t, this.#D())
663
704
  }
664
705
  ));
665
706
  }
666
- get #z() {
667
- return this.#v === "none" ? 0 : 500;
707
+ get #H() {
708
+ return this.#w === "none" ? 0 : 500;
668
709
  }
669
710
  /** Drag/transform distance for one slide, in px. */
670
- #R() {
671
- return this.#o === "horizontal" ? this.#$?.clientWidth ?? 0 : this.#g;
711
+ #D() {
712
+ return this.#c === "horizontal" ? this.#S?.clientWidth ?? 0 : this.#y;
672
713
  }
673
- get #$() {
714
+ get #S() {
674
715
  return this.renderRoot?.querySelector(".carousel-inner") ?? null;
675
716
  }
676
- get #A() {
717
+ get #M() {
677
718
  return this.renderRoot?.querySelector(".carousel-track") ?? null;
678
719
  }
679
720
  // ---- slides -----------------------------------------------------------------
680
- #L() {
681
- this.#l || (this.#l = new MutationObserver(() => this.#j())), this.#l.observe(this, { childList: !0 }), !this.#n && typeof ResizeObserver < "u" && (this.#n = new ResizeObserver((t) => {
721
+ #O() {
722
+ this.#d || (this.#d = new MutationObserver(() => this.#L())), this.#d.observe(this, { childList: !0 }), !this.#u && typeof ResizeObserver < "u" && (this.#u = new ResizeObserver((t) => {
682
723
  for (const e of t)
683
- this.#m.set(e.target, e.contentRect.height);
684
- this.#h();
724
+ this.#b.set(e.target, e.contentRect.height);
725
+ this.#f();
685
726
  }));
686
727
  }
687
- #X() {
728
+ #V() {
688
729
  return [...this.children].filter(
689
730
  (t) => t instanceof HTMLElement && t.getAttribute("slot") !== "play-pause"
690
731
  );
691
732
  }
692
- #j() {
693
- const t = this.#X();
733
+ #L() {
734
+ const t = this.#V();
694
735
  if (!(t.length !== this.#e.length || t.some((i, s) => i !== this.#e[s])) && !this.#s) {
695
736
  t.forEach((i, s) => {
696
737
  i.getAttribute("slot") !== `s${s}` && i.setAttribute("slot", `s${s}`);
697
738
  });
698
739
  return;
699
740
  }
700
- this.#t?.interrupt(), this.#d(), this.#e = t, t.forEach((i, s) => i.setAttribute("slot", `s${s}`)), this.#n?.disconnect(), this.#m = new Map(t.map((i) => [i, i.offsetHeight || 0])), t.forEach((i) => this.#n?.observe(i)), this.#h(), t.forEach((i, s) => {
741
+ this.#t?.interrupt(), this.#g(), this.#e = t, t.forEach((i, s) => i.setAttribute("slot", `s${s}`)), this.#u?.disconnect(), this.#b = new Map(t.map((i) => [i, i.offsetHeight || 0])), t.forEach((i) => this.#u?.observe(i)), this.#f(), t.forEach((i, s) => {
701
742
  (i instanceof HTMLImageElement ? i : i.querySelector("img"))?.setAttribute("fetchpriority", s === 0 ? "high" : "low");
702
- }), this.#t?.setConfig({ count: t.length }), this.#i >= t.length && (this.#i = Math.max(0, t.length - 1)), this.requestUpdate(), this.updateComplete.then(() => this.#u(this.#t?.getIndex() ?? this.#i));
743
+ }), this.#t?.setConfig({ count: t.length }), this.#i >= t.length && (this.#i = Math.max(0, t.length - 1)), this.requestUpdate(), this.updateComplete.then(() => this.#m(this.#t?.getIndex() ?? this.#i));
703
744
  }
704
- #h() {
705
- const t = this.#e.map((r) => this.#m.get(r) ?? 0), e = t.length ? Math.max(...t) : 0, i = t[this.#i] ?? e;
706
- this.#g = e;
707
- const s = this.#o === "vertical" ? e : i;
708
- s > 10 ? this.style.setProperty("--mp-carousel-viewport-height", `${s}px`) : this.style.removeProperty("--mp-carousel-viewport-height"), this.#o === "vertical" && e > 10 ? this.style.setProperty("--mp-carousel-slide-height", `${e}px`) : this.style.removeProperty("--mp-carousel-slide-height");
745
+ #f() {
746
+ const t = this.#e.map((a) => this.#b.get(a) ?? 0), e = t.length ? Math.max(...t) : 0, i = t[this.#i] ?? e;
747
+ this.#y = e;
748
+ const s = this.#c === "vertical" ? e : i;
749
+ s > 10 ? this.style.setProperty("--mp-carousel-viewport-height", `${s}px`) : this.style.removeProperty("--mp-carousel-viewport-height"), this.#c === "vertical" && e > 10 ? this.style.setProperty("--mp-carousel-slide-height", `${e}px`) : this.style.removeProperty("--mp-carousel-slide-height");
709
750
  }
710
751
  // ---- position / transitions ---------------------------------------------------
711
752
  /**
@@ -713,61 +754,61 @@ class w extends f {
713
754
  * outside [0, N-1] during a wrap). Physical mapping: the wrap-before cell
714
755
  * occupies position 0, so physical = ratio + 1.
715
756
  */
716
- #u(t) {
717
- const e = this.#A;
757
+ #m(t) {
758
+ const e = this.#M;
718
759
  if (e) {
719
- if (this.#v === "fade") {
720
- e.style.transform = "", Number.isInteger(t) && this.#C(this.#T(t));
760
+ if (this.#w === "fade") {
761
+ e.style.transform = "", Number.isInteger(t) && this.#z(this.#X(t));
721
762
  return;
722
763
  }
723
- this.#W(t), e.style.transform = this.#E(t);
764
+ this.#it(t), e.style.transform = this.#R(t);
724
765
  }
725
766
  }
726
- #E(t) {
767
+ #R(t) {
727
768
  const e = t + 1;
728
- return this.#o === "horizontal" ? `translate3d(${-e * 100}%, 0, 0)` : `translate3d(0, ${-e * this.#g}px, 0)`;
769
+ return this.#c === "horizontal" ? `translate3d(${-e * 100}%, 0, 0)` : `translate3d(0, ${-e * this.#y}px, 0)`;
729
770
  }
730
- #T(t) {
771
+ #X(t) {
731
772
  const e = this.#e.length;
732
773
  return e > 0 ? (t % e + e) % e : 0;
733
774
  }
734
775
  /** Visual `.active` (fade opacity target) — managed imperatively, not bound. */
735
- #C(t) {
776
+ #z(t) {
736
777
  this.renderRoot?.querySelectorAll(".carousel-item[data-i]").forEach((e) => {
737
778
  e.classList.toggle("active", Number(e.dataset.i) === t);
738
779
  });
739
780
  }
740
- #F(t, e, i, s) {
741
- if (this.#v === "fade") {
742
- this.#C(this.#T(e));
743
- let a = setTimeout(() => {
744
- a = null, s();
781
+ #tt(t, e, i, s) {
782
+ if (this.#w === "fade") {
783
+ this.#l.suspend(), this.#z(this.#X(e));
784
+ let r = setTimeout(() => {
785
+ r = null, s(), this.#h();
745
786
  }, i);
746
787
  return {
747
788
  finish: () => {
748
- a !== null && (clearTimeout(a), a = null, s());
789
+ r !== null && (clearTimeout(r), r = null, s(), this.#h());
749
790
  },
750
791
  cancel: () => {
751
- a !== null && (clearTimeout(a), a = null);
792
+ r !== null && (clearTimeout(r), r = null, this.#h());
752
793
  }
753
794
  };
754
795
  }
755
- const r = this.#A;
756
- if (!r)
796
+ const a = this.#M;
797
+ if (!a)
757
798
  return s(), { finish: () => {
758
799
  }, cancel: () => {
759
800
  } };
760
- if (this.#Y(e), typeof r.animate != "function")
761
- return this.#d(), s(), { finish: () => {
801
+ if (this.#l.suspend(), this.#et(e), typeof a.animate != "function")
802
+ return this.#g(), s(), this.#h(), { finish: () => {
762
803
  }, cancel: () => {
763
804
  } };
764
- const o = r.animate(
765
- [{ transform: this.#E(t) }, { transform: this.#E(e) }],
805
+ const o = a.animate(
806
+ [{ transform: this.#R(t) }, { transform: this.#R(e) }],
766
807
  { duration: i, easing: "ease", fill: "forwards" }
767
808
  );
768
809
  let n = !1;
769
- const d = (a) => {
770
- n || (n = !0, o.cancel(), this.#d(), a && s());
810
+ const d = (r) => {
811
+ n || (n = !0, o.cancel(), this.#g(), r && s(), this.#h());
771
812
  };
772
813
  return o.onfinish = () => d(!0), {
773
814
  finish: () => d(!0),
@@ -775,59 +816,65 @@ class w extends f {
775
816
  };
776
817
  }
777
818
  /** Teleport the destination slide into a wrap cell for a wrapping move. */
778
- #Y(t) {
819
+ #et(t) {
779
820
  const e = this.#e.length;
780
- e < 2 || (t === e ? this.#y(this.#e[0], "wrapA") : t === -1 && this.#y(this.#e[e - 1], "wrapB"));
821
+ e < 2 || (t === e ? this.#k(this.#e[0], "wrapA") : t === -1 && this.#k(this.#e[e - 1], "wrapB"));
781
822
  }
782
823
  /** During a live drag past the deck's edges, keep the wrap cell populated. */
783
- #W(t) {
824
+ #it(t) {
784
825
  const e = this.#e.length;
785
- e < 2 || !this.#k || (t > e - 1 ? this.#y(this.#e[0], "wrapA") : t < 0 ? this.#y(this.#e[e - 1], "wrapB") : this.#s && Number.isInteger(t) && this.#d());
826
+ e < 2 || !this.#C || (t > e - 1 ? this.#k(this.#e[0], "wrapA") : t < 0 ? this.#k(this.#e[e - 1], "wrapB") : this.#s && Number.isInteger(t) && this.#g());
786
827
  }
787
- #y(t, e) {
788
- !t || this.#s?.el === t || (this.#d(), this.#s = { el: t, home: t.getAttribute("slot") ?? "" }, t.setAttribute("slot", e));
828
+ #k(t, e) {
829
+ !t || this.#s?.el === t || (this.#g(), this.#s = { el: t, home: t.getAttribute("slot") ?? "" }, t.setAttribute("slot", e));
789
830
  }
790
- #d() {
831
+ #g() {
791
832
  this.#s && (this.#s.el.setAttribute("slot", this.#s.home), this.#s = null);
792
833
  }
793
834
  // ---- state sync -----------------------------------------------------------
794
- #K(t) {
795
- this.#i = t, this.renderRoot?.querySelectorAll(".car-radio")?.forEach((i, s) => i.checked = s === t), this.#v !== "fade" && this.#C(t), this.#h(), this.requestUpdate(), this.#w("slide-change", { index: t });
835
+ #st(t) {
836
+ this.#i = t, this.renderRoot?.querySelectorAll(".car-radio")?.forEach((i, s) => i.checked = s === t), this.#w !== "fade" && this.#z(t), this.#f(), this.requestUpdate(), this.#j("slide-change", { index: t });
796
837
  }
797
838
  /** Single write path for `paused` + its event (programmatic writes stay silent). */
798
- #x(t, e = !0) {
799
- t !== this.paused && (this.#b = !0, t ? this.setAttribute("paused", "") : this.removeAttribute("paused"), this.#b = !1, e && this.#w("paused-change", { paused: t }));
839
+ #$(t, e = !0) {
840
+ t !== this.paused && (this.#x = !0, t ? this.setAttribute("paused", "") : this.removeAttribute("paused"), this.#x = !1, e && this.#j("paused-change", { paused: t }));
800
841
  }
801
- #M;
802
- #p() {
803
- this.#q();
842
+ #I;
843
+ #r() {
844
+ this.#F();
804
845
  const t = this.interval;
805
- t > 0 && !this.paused && !(this.#r?.matches ?? !1) && this.isConnected && (this.#c = setInterval(() => this.next(), t));
846
+ t > 0 && !this.paused && !this.#A && !this.#E && !(this.#n?.matches ?? !1) && this.isConnected && (this.#p = setInterval(() => this.next(), t));
806
847
  }
807
- #q() {
808
- this.#c !== null && (clearInterval(this.#c), this.#c = null);
848
+ #A;
849
+ #E;
850
+ #T;
851
+ #q;
852
+ #P;
853
+ #N;
854
+ #F() {
855
+ this.#p !== null && (clearInterval(this.#p), this.#p = null);
809
856
  }
810
857
  /**
811
858
  * `polite` announces manual navigation; `off` keeps rotation from spamming
812
859
  * the screen reader. Rotation is only actually happening when an interval is
813
860
  * set, not paused, and motion isn't reduced.
814
861
  */
815
- get #G() {
816
- return this.interval <= 0 || this.paused || this.#r?.matches ? "polite" : "off";
817
- }
818
- #P;
819
- #I;
820
- #U;
821
- #B;
822
- #H;
823
- #N;
824
- #J(t, e) {
862
+ get #ot() {
863
+ return this.interval <= 0 || this.paused || this.#n?.matches ? "polite" : "off";
864
+ }
865
+ #Y;
866
+ #W;
867
+ #K;
868
+ #G;
869
+ #J;
870
+ #Q;
871
+ #rt(t, e) {
825
872
  e.preventDefault(), this.#t?.goto(t);
826
873
  }
827
- #D(t, e) {
874
+ #Z(t, e) {
828
875
  e.preventDefault(), this.#t?.[t]();
829
876
  }
830
- #w(t, e) {
877
+ #j(t, e) {
831
878
  this.dispatchEvent(new CustomEvent(t, { detail: e, bubbles: !0, composed: !0 }));
832
879
  }
833
880
  // ---- template ---------------------------------------------------------------
@@ -836,18 +883,34 @@ class w extends f {
836
883
  * pair reveal, which serves both tiers). Lives HERE — in render()'s single
837
884
  * source of truth — so the pre-rendered DSD chrome variants carry it too.
838
885
  */
839
- #Q(t) {
886
+ #at(t) {
840
887
  let e = "";
841
888
  for (let i = 0; i < t; i++) {
842
889
  const s = `#s${i}:checked`;
843
- e += `${s} ~ .carousel-controls .ctl-prev-${i}, ${s} ~ .carousel-controls .ctl-next-${i} { display: flex; }`, e += `${s} ~ .carousel-indicators label[for="s${i}"] { opacity: 1; }`, e += `#s${i}:focus-visible ~ .carousel-indicators label[for="s${i}"] { outline: 2px solid #fff; outline-offset: 2px; }`, e += `:host(:not([data-js])) ${s} ~ .carousel-inner .nojs-cell slot::slotted(:nth-child(${i + 1})) { opacity: 1; position: relative; z-index: 1; }`, e += `:host(:not([data-js]):not([animation="fade"]):not([orientation="vertical"])) ${s} ~ .carousel-inner .nojs-cell { transform: translateX(${-i * 100}%); }`;
890
+ e += `${s} ~ .carousel-controls .ctl-prev-${i}, ${s} ~ .carousel-controls .ctl-next-${i} { display: flex; }`, e += `${s} ~ .carousel-indicators label[for="s${i}"] { opacity: 1; }`, e += `#s${i}:focus-visible ~ .carousel-indicators label[for="s${i}"] { outline: 2px solid #fff; outline-offset: 2px; }`, e += `:host(:not([data-js])) ${s} ~ .carousel-inner .nojs-cell slot::slotted(:nth-child(${i + 1})) { opacity: 1; position: relative; z-index: 1; visibility: visible; transition-delay: 0s; }`, e += `:host(:not([data-js]):not([animation="fade"]):not([orientation="vertical"])) ${s} ~ .carousel-inner .nojs-cell { transform: translateX(${-i * 100}%); }`;
844
891
  }
845
892
  return e;
846
893
  }
847
894
  render() {
848
- const t = this.#e.length || Number(this.getAttribute("slide-count")) || 0, e = this.#i, i = this.interval, s = this.hasAttribute("data-js"), r = i > 0 || s && this.querySelector('[slot="play-pause"]') !== null;
895
+ const t = this.#e.length || Number(this.getAttribute("slide-count")) || 0, e = this.#i, i = this.interval, s = this.hasAttribute("data-js"), a = i > 0 || s && this.querySelector('[slot="play-pause"]') !== null;
849
896
  return c`
850
- ${g(`<style>${this.#Q(t)}</style>`)}
897
+ ${g(`<style>${this.#at(t)}</style>`)}
898
+ ${a ? c`
899
+ <div class="carousel-play-pause" part="play-pause">
900
+ <slot name="play-pause">
901
+ <button
902
+ type="button"
903
+ class="carousel-play-pause-btn ${this.paused ? "carousel-play-pause-paused" : "carousel-play-pause-playing"}"
904
+ aria-pressed=${String(this.paused)}
905
+ aria-label=${this.paused ? "Start automatic slide show" : "Stop automatic slide show"}
906
+ @click=${this.togglePaused}
907
+ >
908
+ <span class="carousel-play-pause-icon" aria-hidden="true"></span>
909
+ </button>
910
+ </slot>
911
+ </div>
912
+ ` : l}
913
+
851
914
  ${h(u(t), (o) => c`
852
915
  <input
853
916
  type="radio"
@@ -856,18 +919,17 @@ class w extends f {
856
919
  class="car-radio visually-hidden"
857
920
  aria-label="Slide ${o + 1}"
858
921
  ?checked=${o === e}
859
- @change=${this.#N}
922
+ @change=${this.#Q}
860
923
  />
861
924
  `)}
862
925
  <div
863
926
  class="carousel-inner"
864
927
  part="inner"
865
928
  tabindex=${s ? "0" : l}
866
- aria-live=${s ? this.#G : l}
929
+ aria-live=${s ? this.#ot : l}
867
930
  aria-atomic=${s ? "false" : l}
868
- aria-orientation=${s ? this.#o : l}
869
- aria-keyshortcuts=${s && this.#S ? this.#o === "horizontal" ? "ArrowLeft ArrowRight Home End" : "ArrowUp ArrowDown Home End" : l}
870
- @keydown=${this.#H}
931
+ aria-keyshortcuts=${s && this.#B ? this.#c === "horizontal" ? "ArrowLeft ArrowRight Home End" : "ArrowUp ArrowDown Home End" : l}
932
+ @keydown=${this.#J}
871
933
  >
872
934
  <div class="carousel-track" part="track">
873
935
  <div class="carousel-item carousel-clone" aria-hidden="true"><slot name="wrapB"></slot></div>
@@ -893,8 +955,8 @@ class w extends f {
893
955
  for="s${o}"
894
956
  data-bs-target
895
957
  aria-label="Slide ${o + 1}"
896
- aria-current=${o === e ? "true" : l}
897
- @click=${(n) => this.#J(o, n)}
958
+ aria-current=${s && o === e ? "true" : l}
959
+ @click=${(n) => this.#rt(o, n)}
898
960
  ></label>
899
961
  `)}
900
962
  </div>
@@ -905,7 +967,7 @@ class w extends f {
905
967
  for="s${(o - 1 + t) % t}"
906
968
  role="button"
907
969
  aria-label="Previous"
908
- @click=${(n) => this.#D("previous", n)}
970
+ @click=${(n) => this.#Z("previous", n)}
909
971
  >
910
972
  <span class="carousel-control-prev-icon" aria-hidden="true"></span>
911
973
  <span class="visually-hidden">Previous</span>
@@ -915,33 +977,18 @@ class w extends f {
915
977
  for="s${(o + 1) % t}"
916
978
  role="button"
917
979
  aria-label="Next"
918
- @click=${(n) => this.#D("next", n)}
980
+ @click=${(n) => this.#Z("next", n)}
919
981
  >
920
982
  <span class="carousel-control-next-icon" aria-hidden="true"></span>
921
983
  <span class="visually-hidden">Next</span>
922
984
  </label>
923
985
  `)}
924
986
  </div>
925
- ${r ? c`
926
- <div class="carousel-play-pause" part="play-pause">
927
- <slot name="play-pause">
928
- <button
929
- type="button"
930
- class="carousel-play-pause-btn ${this.paused ? "carousel-play-pause-paused" : "carousel-play-pause-playing"}"
931
- aria-pressed=${String(this.paused)}
932
- aria-label=${this.paused ? "Start automatic slide show" : "Stop automatic slide show"}
933
- @click=${this.togglePaused}
934
- >
935
- <span class="carousel-play-pause-icon" aria-hidden="true"></span>
936
- </button>
937
- </slot>
938
- </div>
939
- ` : l}
940
987
  `;
941
988
  }
942
989
  }
943
- customElements.get("mp-carousel") || customElements.define("mp-carousel", w);
990
+ customElements.get("mp-carousel") || customElements.define("mp-carousel", k);
944
991
  export {
945
- w as MpCarousel,
946
- x as carouselStyles
992
+ k as MpCarousel,
993
+ w as carouselStyles
947
994
  };