@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.
- package/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +9 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
package/carousel/index.mjs
CHANGED
|
@@ -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
|
|
6
|
-
|
|
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
|
-
|
|
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
|
|
487
|
+
class k extends f {
|
|
479
488
|
constructor() {
|
|
480
|
-
super(...arguments), this.#e = [], this.#i = 0, this.#
|
|
481
|
-
this
|
|
482
|
-
}, this.#
|
|
483
|
-
this.#
|
|
484
|
-
}, this.#
|
|
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.#
|
|
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.#
|
|
492
|
-
this.#a?.pointerUp() && (t.preventDefault(), t.stopPropagation());
|
|
493
|
-
}, this.#
|
|
494
|
-
this.#a?.abort(), this.#t?.goto(this.#i, { animate: !1 });
|
|
495
|
-
}, this.#
|
|
496
|
-
if (t.target !== t.currentTarget || !this.#
|
|
497
|
-
const e =
|
|
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.#
|
|
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 = [
|
|
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
|
-
#
|
|
539
|
+
#v;
|
|
522
540
|
#t;
|
|
523
541
|
#a;
|
|
524
|
-
#
|
|
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
|
-
#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
548
|
-
const t = this.#
|
|
549
|
-
this.#
|
|
550
|
-
const e = this.#
|
|
551
|
-
e && (e.addEventListener("touchstart", this.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
604
|
+
this.#t?.setConfig({ wrap: this.#C });
|
|
564
605
|
break;
|
|
565
606
|
case "interval":
|
|
566
|
-
this.#
|
|
607
|
+
this.#r(), this.requestUpdate();
|
|
567
608
|
break;
|
|
568
609
|
case "paused":
|
|
569
|
-
this.#
|
|
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 #
|
|
633
|
+
get #w() {
|
|
593
634
|
const t = this.getAttribute("animation");
|
|
594
635
|
return t === "fade" || t === "none" ? t : "slide";
|
|
595
636
|
}
|
|
596
|
-
get #
|
|
637
|
+
get #c() {
|
|
597
638
|
return this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal";
|
|
598
639
|
}
|
|
599
|
-
get #
|
|
640
|
+
get #C() {
|
|
600
641
|
return this.getAttribute("wrap") !== "false";
|
|
601
642
|
}
|
|
602
|
-
get #
|
|
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
|
|
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
|
|
670
|
+
this.#$(!1);
|
|
630
671
|
}
|
|
631
672
|
pause() {
|
|
632
|
-
this
|
|
673
|
+
this.#$(!0);
|
|
633
674
|
}
|
|
634
675
|
// ---- engine wiring ----------------------------------------------------------
|
|
635
|
-
#
|
|
636
|
-
this.#t || (this.#t = new
|
|
676
|
+
#_() {
|
|
677
|
+
this.#t || (this.#t = new b(
|
|
637
678
|
{
|
|
638
|
-
applyOffsetRatio: (t) => this.#
|
|
639
|
-
runTransition: (t, e, i, s) => this.#
|
|
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.#
|
|
683
|
+
onIndexChange: (t) => this.#st(t),
|
|
643
684
|
onAnimationStart: () => {
|
|
644
|
-
this
|
|
685
|
+
this.#S?.setAttribute("aria-busy", "true"), this.#j("animation-start", void 0);
|
|
645
686
|
},
|
|
646
687
|
onAnimationEnd: () => {
|
|
647
|
-
this
|
|
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.#
|
|
653
|
-
durationMs: this.#
|
|
693
|
+
wrap: this.#C,
|
|
694
|
+
durationMs: this.#H,
|
|
654
695
|
minimumOffsetPx: 50,
|
|
655
|
-
prefersReducedMotion: () => this.#
|
|
696
|
+
prefersReducedMotion: () => this.#n?.matches ?? !1
|
|
656
697
|
}
|
|
657
698
|
), this.#a = new y(
|
|
658
|
-
{ orientation: this.#
|
|
699
|
+
{ orientation: this.#c },
|
|
659
700
|
{
|
|
660
701
|
onDragStart: () => this.#t?.beginDrag(),
|
|
661
|
-
onDragMove: (t) => this.#t?.dragBy(t, this.#
|
|
662
|
-
onDragEnd: (t) => this.#t?.endDrag(t, this.#
|
|
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 #
|
|
667
|
-
return this.#
|
|
707
|
+
get #H() {
|
|
708
|
+
return this.#w === "none" ? 0 : 500;
|
|
668
709
|
}
|
|
669
710
|
/** Drag/transform distance for one slide, in px. */
|
|
670
|
-
#
|
|
671
|
-
return this.#
|
|
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 #
|
|
717
|
+
get #M() {
|
|
677
718
|
return this.renderRoot?.querySelector(".carousel-track") ?? null;
|
|
678
719
|
}
|
|
679
720
|
// ---- slides -----------------------------------------------------------------
|
|
680
|
-
#
|
|
681
|
-
this.#
|
|
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.#
|
|
684
|
-
this.#
|
|
724
|
+
this.#b.set(e.target, e.contentRect.height);
|
|
725
|
+
this.#f();
|
|
685
726
|
}));
|
|
686
727
|
}
|
|
687
|
-
#
|
|
728
|
+
#V() {
|
|
688
729
|
return [...this.children].filter(
|
|
689
730
|
(t) => t instanceof HTMLElement && t.getAttribute("slot") !== "play-pause"
|
|
690
731
|
);
|
|
691
732
|
}
|
|
692
|
-
#
|
|
693
|
-
const t = this.#
|
|
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.#
|
|
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.#
|
|
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
|
-
#
|
|
705
|
-
const t = this.#e.map((
|
|
706
|
-
this.#
|
|
707
|
-
const s = this.#
|
|
708
|
-
s > 10 ? this.style.setProperty("--mp-carousel-viewport-height", `${s}px`) : this.style.removeProperty("--mp-carousel-viewport-height"), this.#
|
|
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
|
-
#
|
|
717
|
-
const e = this.#
|
|
757
|
+
#m(t) {
|
|
758
|
+
const e = this.#M;
|
|
718
759
|
if (e) {
|
|
719
|
-
if (this.#
|
|
720
|
-
e.style.transform = "", Number.isInteger(t) && this.#
|
|
760
|
+
if (this.#w === "fade") {
|
|
761
|
+
e.style.transform = "", Number.isInteger(t) && this.#z(this.#X(t));
|
|
721
762
|
return;
|
|
722
763
|
}
|
|
723
|
-
this.#
|
|
764
|
+
this.#it(t), e.style.transform = this.#R(t);
|
|
724
765
|
}
|
|
725
766
|
}
|
|
726
|
-
#
|
|
767
|
+
#R(t) {
|
|
727
768
|
const e = t + 1;
|
|
728
|
-
return this.#
|
|
769
|
+
return this.#c === "horizontal" ? `translate3d(${-e * 100}%, 0, 0)` : `translate3d(0, ${-e * this.#y}px, 0)`;
|
|
729
770
|
}
|
|
730
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
741
|
-
if (this.#
|
|
742
|
-
this.#
|
|
743
|
-
let
|
|
744
|
-
|
|
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
|
-
|
|
789
|
+
r !== null && (clearTimeout(r), r = null, s(), this.#h());
|
|
749
790
|
},
|
|
750
791
|
cancel: () => {
|
|
751
|
-
|
|
792
|
+
r !== null && (clearTimeout(r), r = null, this.#h());
|
|
752
793
|
}
|
|
753
794
|
};
|
|
754
795
|
}
|
|
755
|
-
const
|
|
756
|
-
if (!
|
|
796
|
+
const a = this.#M;
|
|
797
|
+
if (!a)
|
|
757
798
|
return s(), { finish: () => {
|
|
758
799
|
}, cancel: () => {
|
|
759
800
|
} };
|
|
760
|
-
if (this.#
|
|
761
|
-
return this.#
|
|
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 =
|
|
765
|
-
[{ transform: this.#
|
|
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 = (
|
|
770
|
-
n || (n = !0, o.cancel(), this.#
|
|
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
|
-
#
|
|
819
|
+
#et(t) {
|
|
779
820
|
const e = this.#e.length;
|
|
780
|
-
e < 2 || (t === e ? this.#
|
|
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
|
-
#
|
|
824
|
+
#it(t) {
|
|
784
825
|
const e = this.#e.length;
|
|
785
|
-
e < 2 || !this.#
|
|
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
|
-
#
|
|
788
|
-
!t || this.#s?.el === t || (this.#
|
|
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
|
-
#
|
|
831
|
+
#g() {
|
|
791
832
|
this.#s && (this.#s.el.setAttribute("slot", this.#s.home), this.#s = null);
|
|
792
833
|
}
|
|
793
834
|
// ---- state sync -----------------------------------------------------------
|
|
794
|
-
#
|
|
795
|
-
this.#i = t, this.renderRoot?.querySelectorAll(".car-radio")?.forEach((i, s) => i.checked = s === t), this.#
|
|
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
|
-
|
|
799
|
-
t !== this.paused && (this.#
|
|
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
|
-
#
|
|
802
|
-
#
|
|
803
|
-
this.#
|
|
842
|
+
#I;
|
|
843
|
+
#r() {
|
|
844
|
+
this.#F();
|
|
804
845
|
const t = this.interval;
|
|
805
|
-
t > 0 && !this.paused && !(this.#
|
|
846
|
+
t > 0 && !this.paused && !this.#A && !this.#E && !(this.#n?.matches ?? !1) && this.isConnected && (this.#p = setInterval(() => this.next(), t));
|
|
806
847
|
}
|
|
807
|
-
#
|
|
808
|
-
|
|
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 #
|
|
816
|
-
return this.interval <= 0 || this.paused || this.#
|
|
817
|
-
}
|
|
818
|
-
#
|
|
819
|
-
#
|
|
820
|
-
#
|
|
821
|
-
#
|
|
822
|
-
#
|
|
823
|
-
#
|
|
824
|
-
#
|
|
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
|
-
#
|
|
874
|
+
#Z(t, e) {
|
|
828
875
|
e.preventDefault(), this.#t?.[t]();
|
|
829
876
|
}
|
|
830
|
-
#
|
|
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
|
-
#
|
|
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"),
|
|
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.#
|
|
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.#
|
|
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.#
|
|
929
|
+
aria-live=${s ? this.#ot : l}
|
|
867
930
|
aria-atomic=${s ? "false" : l}
|
|
868
|
-
aria-
|
|
869
|
-
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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",
|
|
990
|
+
customElements.get("mp-carousel") || customElements.define("mp-carousel", k);
|
|
944
991
|
export {
|
|
945
|
-
|
|
946
|
-
|
|
992
|
+
k as MpCarousel,
|
|
993
|
+
w as carouselStyles
|
|
947
994
|
};
|