@mintplayer/web-components 2.1.0 → 2.2.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/accordion/index.d.ts +1 -0
- package/accordion/index.mjs +543 -0
- package/accordion/src/components/index.d.ts +3 -0
- package/accordion/src/components/mp-accordion-tab.d.ts +30 -0
- package/accordion/src/components/mp-accordion.d.ts +61 -0
- package/accordion/src/index.d.ts +3 -0
- package/accordion/src/styles/index.d.ts +1 -0
- package/carousel/index.d.ts +1 -0
- package/carousel/index.mjs +947 -0
- package/carousel/src/components/index.d.ts +1 -0
- package/carousel/src/components/mp-carousel.d.ts +57 -0
- package/carousel/src/index.d.ts +3 -0
- package/carousel/src/styles/index.d.ts +1 -0
- package/carousel/src/types/carousel.d.ts +10 -0
- package/carousel/src/types/index.d.ts +1 -0
- package/navbar/index.mjs +143 -62
- package/navbar/src/components/mp-navbar-dropdown.d.ts +2 -0
- package/package.json +13 -1
- package/splitter/src/index.d.ts +1 -1
- package/swiper-core/index.d.ts +1 -0
- package/swiper-core/index.mjs +184 -0
- package/swiper-core/src/index-machine.d.ts +59 -0
- package/swiper-core/src/index.d.ts +4 -0
- package/swiper-core/src/keymap.d.ts +2 -0
- package/swiper-core/src/models/index.d.ts +1 -0
- package/swiper-core/src/models/types.d.ts +99 -0
- package/swiper-core/src/pointer-arbiter.d.ts +45 -0
- package/dropdown/src/styles/dropdown.styles.d.ts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MpCarousel } from './mp-carousel';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* `<mp-carousel>` — Bootstrap-styled carousel web component.
|
|
4
|
+
*
|
|
5
|
+
* Slides are the consumer's light-DOM children (`<img>`, `<div>`, anything —
|
|
6
|
+
* except elements slotted `play-pause`). The element stamps `slot="s0…sN-1"`
|
|
7
|
+
* onto them and projects each into its own shadow wrapper cell, which is where
|
|
8
|
+
* per-slide ARIA and content sizing live. One shadow template serves every
|
|
9
|
+
* mode: `animation` (`slide`|`fade`|`none`) and `orientation`
|
|
10
|
+
* (`horizontal`|`vertical`) are host attributes selected by CSS.
|
|
11
|
+
*
|
|
12
|
+
* Two interaction tiers:
|
|
13
|
+
* - JS on: a swiper-core PointerArbiter + IndexMachine drive a transform
|
|
14
|
+
* track (slide) or a grid-stacked crossfade (fade).
|
|
15
|
+
* - JS off (server-rendered DSD): the same shadow radios/labels are a pure
|
|
16
|
+
* CSS state machine — indicators, prev/next with wrap-around, and native
|
|
17
|
+
* radiogroup arrow keys all work. Slides render through the default slot
|
|
18
|
+
* (`.nojs-cell`); the `slot="sN"` stamping automatically empties it once
|
|
19
|
+
* the element upgrades. `data-js` gates every no-JS-only rule.
|
|
20
|
+
*
|
|
21
|
+
* The checked radio is the pre-upgrade index store; on upgrade it seeds the
|
|
22
|
+
* machine and stays synchronized (indicator active state is `:checked` CSS in
|
|
23
|
+
* both tiers).
|
|
24
|
+
*
|
|
25
|
+
* Height contract (see docs/prd/carousel-wc.md §5.3): horizontal + fade size
|
|
26
|
+
* the viewport to the CURRENT slide, vertical to the LARGEST slide — measured
|
|
27
|
+
* by one ResizeObserver over the slotted slides (never over anything this
|
|
28
|
+
* element writes to), published as two host custom properties. The vertical
|
|
29
|
+
* max height is also the transform distance unit, so layout and motion cannot
|
|
30
|
+
* disagree.
|
|
31
|
+
*/
|
|
32
|
+
export declare class MpCarousel extends LitElement {
|
|
33
|
+
#private;
|
|
34
|
+
static styles: import('lit').CSSResult[];
|
|
35
|
+
static get observedAttributes(): string[];
|
|
36
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
37
|
+
connectedCallback(): void;
|
|
38
|
+
disconnectedCallback(): void;
|
|
39
|
+
protected firstUpdated(): void;
|
|
40
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
41
|
+
/** Committed slide index. Setting it jumps without animation. */
|
|
42
|
+
get index(): number;
|
|
43
|
+
set index(value: number);
|
|
44
|
+
get interval(): number;
|
|
45
|
+
set interval(value: number | string | null | undefined);
|
|
46
|
+
get paused(): boolean;
|
|
47
|
+
set paused(value: boolean | string | null | undefined);
|
|
48
|
+
previous(): void;
|
|
49
|
+
next(): void;
|
|
50
|
+
goto(index: number, opts?: {
|
|
51
|
+
animate?: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
play(): void;
|
|
54
|
+
pause(): void;
|
|
55
|
+
togglePaused: () => void;
|
|
56
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { carouselStyles } from './carousel.styles';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CarouselAnimation = 'slide' | 'fade' | 'none';
|
|
2
|
+
export type CarouselOrientation = 'horizontal' | 'vertical';
|
|
3
|
+
export interface CarouselSlideChangeEventDetail {
|
|
4
|
+
/** The committed slide index. */
|
|
5
|
+
index: number;
|
|
6
|
+
}
|
|
7
|
+
export interface CarouselPausedChangeEventDetail {
|
|
8
|
+
/** Whether autoplay is now paused. Emitted only for user/programmatic-API intent. */
|
|
9
|
+
paused: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './carousel';
|
package/navbar/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unsafeCSS as e, LitElement as
|
|
1
|
+
import { unsafeCSS as e, LitElement as d, html as o } from "lit";
|
|
2
2
|
import { OverlayController as v } from "../overlay/index.mjs";
|
|
3
3
|
const p = e(`.navbar {
|
|
4
4
|
--bs-navbar-padding-x: 0;
|
|
@@ -515,6 +515,11 @@ const p = e(`.navbar {
|
|
|
515
515
|
--mp-navbar-expanded: 1;
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
+
.navbar-toggle:focus-visible ~ .navbar-toggler {
|
|
519
|
+
border-radius: var(--bs-navbar-toggler-border-radius, 0.375rem);
|
|
520
|
+
box-shadow: 0 0 0 var(--bs-navbar-toggler-focus-width, 0.25rem);
|
|
521
|
+
}
|
|
522
|
+
|
|
518
523
|
.navbar-toggle {
|
|
519
524
|
position: absolute;
|
|
520
525
|
width: 1px;
|
|
@@ -531,7 +536,7 @@ const p = e(`.navbar {
|
|
|
531
536
|
flex-basis: 100%;
|
|
532
537
|
display: grid;
|
|
533
538
|
grid-template-rows: 1fr;
|
|
534
|
-
transition: grid-template-rows 0.35s ease;
|
|
539
|
+
transition: grid-template-rows 0.35s ease, visibility 0s var(--mp-collapse-hide-delay, 0s);
|
|
535
540
|
overflow: hidden;
|
|
536
541
|
}
|
|
537
542
|
|
|
@@ -558,6 +563,8 @@ const p = e(`.navbar {
|
|
|
558
563
|
.navbar-toggle:checked ~ .navbar-collapse,
|
|
559
564
|
:host(:not([data-js])) .navbar-collapse:focus-within {
|
|
560
565
|
grid-template-rows: 1fr !important;
|
|
566
|
+
visibility: visible;
|
|
567
|
+
--mp-collapse-hide-delay: 0s;
|
|
561
568
|
}
|
|
562
569
|
|
|
563
570
|
@media (min-width: 576px) {
|
|
@@ -715,6 +722,36 @@ const p = e(`.navbar {
|
|
|
715
722
|
}
|
|
716
723
|
}
|
|
717
724
|
|
|
725
|
+
@media (max-width: 575.98px) {
|
|
726
|
+
:host(:where([breakpoint=sm][data-js])) .navbar-collapse {
|
|
727
|
+
visibility: hidden;
|
|
728
|
+
--mp-collapse-hide-delay: 0.35s;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
@media (max-width: 767.98px) {
|
|
732
|
+
:host(:where([breakpoint=md][data-js])) .navbar-collapse {
|
|
733
|
+
visibility: hidden;
|
|
734
|
+
--mp-collapse-hide-delay: 0.35s;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
@media (max-width: 991.98px) {
|
|
738
|
+
:host(:where([breakpoint=lg][data-js])) .navbar-collapse {
|
|
739
|
+
visibility: hidden;
|
|
740
|
+
--mp-collapse-hide-delay: 0.35s;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
@media (max-width: 1199.98px) {
|
|
744
|
+
:host(:where([breakpoint=xl][data-js])) .navbar-collapse {
|
|
745
|
+
visibility: hidden;
|
|
746
|
+
--mp-collapse-hide-delay: 0.35s;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
@media (max-width: 1399.98px) {
|
|
750
|
+
:host(:where([breakpoint=xxl][data-js])) .navbar-collapse {
|
|
751
|
+
visibility: hidden;
|
|
752
|
+
--mp-collapse-hide-delay: 0.35s;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
718
755
|
@media (max-width: 575.98px) {
|
|
719
756
|
:host([breakpoint=sm][positioning=fixed]) {
|
|
720
757
|
max-height: 100dvh;
|
|
@@ -769,7 +806,7 @@ const p = e(`.navbar {
|
|
|
769
806
|
width: 0;
|
|
770
807
|
height: 0;
|
|
771
808
|
}
|
|
772
|
-
}`),
|
|
809
|
+
}`), c = e(`:host, *, *::before, *::after {
|
|
773
810
|
box-sizing: border-box;
|
|
774
811
|
}
|
|
775
812
|
|
|
@@ -799,7 +836,9 @@ const p = e(`.navbar {
|
|
|
799
836
|
}
|
|
800
837
|
|
|
801
838
|
:host([active]) ::slotted(a),
|
|
802
|
-
:host([active]) ::slotted(button)
|
|
839
|
+
:host([active]) ::slotted(button),
|
|
840
|
+
::slotted(a.active),
|
|
841
|
+
::slotted(button.active) {
|
|
803
842
|
color: var(--bs-nav-link-active-color, var(--bs-navbar-active-color, inherit)) !important;
|
|
804
843
|
}
|
|
805
844
|
|
|
@@ -807,7 +846,7 @@ const p = e(`.navbar {
|
|
|
807
846
|
:host([disabled]) ::slotted(button) {
|
|
808
847
|
color: var(--bs-nav-link-disabled-color, var(--bs-navbar-disabled-color, inherit)) !important;
|
|
809
848
|
pointer-events: none;
|
|
810
|
-
}`),
|
|
849
|
+
}`), g = e(`:host, *, *::before, *::after {
|
|
811
850
|
box-sizing: border-box;
|
|
812
851
|
}
|
|
813
852
|
|
|
@@ -869,6 +908,10 @@ const p = e(`.navbar {
|
|
|
869
908
|
border-left: 0.3em solid transparent;
|
|
870
909
|
}
|
|
871
910
|
|
|
911
|
+
:host([active]) .nav-link.dropdown-toggle {
|
|
912
|
+
color: var(--bs-nav-link-active-color, var(--bs-navbar-active-color, inherit));
|
|
913
|
+
}
|
|
914
|
+
|
|
872
915
|
:host([data-submenu]) .nav-link.dropdown-toggle {
|
|
873
916
|
justify-content: space-between;
|
|
874
917
|
width: 100%;
|
|
@@ -881,6 +924,11 @@ const p = e(`.navbar {
|
|
|
881
924
|
background-color: var(--bs-dropdown-link-hover-bg, transparent);
|
|
882
925
|
}
|
|
883
926
|
|
|
927
|
+
:host([data-submenu][active]) .nav-link.dropdown-toggle {
|
|
928
|
+
color: var(--bs-dropdown-link-active-color, #fff);
|
|
929
|
+
background-color: var(--bs-dropdown-link-active-bg, var(--bs-primary));
|
|
930
|
+
}
|
|
931
|
+
|
|
884
932
|
:host([data-submenu]) .nav-link.dropdown-toggle::after {
|
|
885
933
|
margin-left: 0.5rem;
|
|
886
934
|
border-top: 0.3em solid transparent;
|
|
@@ -1010,7 +1058,7 @@ const p = e(`.navbar {
|
|
|
1010
1058
|
overflow-y: auto;
|
|
1011
1059
|
}
|
|
1012
1060
|
}`);
|
|
1013
|
-
class r extends
|
|
1061
|
+
class r extends d {
|
|
1014
1062
|
static {
|
|
1015
1063
|
this.styles = [p];
|
|
1016
1064
|
}
|
|
@@ -1028,10 +1076,10 @@ class r extends b {
|
|
|
1028
1076
|
return this.constructor.observedAttributes.includes("defer-hydration") || this.shadowRoot?.replaceChildren(), super.createRenderRoot();
|
|
1029
1077
|
}
|
|
1030
1078
|
connectedCallback() {
|
|
1031
|
-
super.connectedCallback(), this.setAttribute("data-js", ""), this.style.getPropertyValue("--mp-navbar-breakpoint") || this.#
|
|
1079
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.style.getPropertyValue("--mp-navbar-breakpoint") || this.#l(this.getAttribute("breakpoint")), this.addEventListener("click", this.#t);
|
|
1032
1080
|
}
|
|
1033
1081
|
disconnectedCallback() {
|
|
1034
|
-
super.disconnectedCallback(), this.removeEventListener("click", this.#
|
|
1082
|
+
super.disconnectedCallback(), this.removeEventListener("click", this.#t);
|
|
1035
1083
|
}
|
|
1036
1084
|
/**
|
|
1037
1085
|
* Clicking a navigation link (an `<a href>` — a routerLink renders one) should
|
|
@@ -1040,7 +1088,7 @@ class r extends b {
|
|
|
1040
1088
|
* (excluded), so opening a dropdown doesn't collapse the bar. Collapsing in
|
|
1041
1089
|
* wide mode is a no-op (the collapse is always shown there).
|
|
1042
1090
|
*/
|
|
1043
|
-
#
|
|
1091
|
+
#t = (a) => {
|
|
1044
1092
|
a.composedPath().find(
|
|
1045
1093
|
(t) => t instanceof HTMLAnchorElement && t.hasAttribute("href") && !t.classList.contains("dropdown-toggle")
|
|
1046
1094
|
) && (this.querySelectorAll("mp-navbar-dropdown").forEach(
|
|
@@ -1048,25 +1096,18 @@ class r extends b {
|
|
|
1048
1096
|
), this.toggle(!1));
|
|
1049
1097
|
};
|
|
1050
1098
|
attributeChangedCallback(a, n, t) {
|
|
1051
|
-
|
|
1052
|
-
this.#a(t);
|
|
1053
|
-
else if (a === "breakpoint")
|
|
1054
|
-
this.#r(t);
|
|
1055
|
-
else if (a === "expanded") {
|
|
1056
|
-
const d = this.#t;
|
|
1057
|
-
d && (d.checked = t !== null);
|
|
1058
|
-
} else a === "aria-label" && this.requestUpdate();
|
|
1099
|
+
super.attributeChangedCallback(a, n, t), a === "color" ? this.#a(t) : a === "breakpoint" ? this.#l(t) : a === "expanded" ? this.#o(t !== null, !1) : a === "aria-label" && this.requestUpdate();
|
|
1059
1100
|
}
|
|
1060
1101
|
/** Solid colors need `data-bs-theme` for text/link contrast; adaptive names inherit the page theme. */
|
|
1061
1102
|
#a(a) {
|
|
1062
|
-
const n = this.#
|
|
1103
|
+
const n = this.#n(a);
|
|
1063
1104
|
n ? this.setAttribute("data-bs-theme", n) : this.getAttribute("data-bs-theme") && this.removeAttribute("data-bs-theme");
|
|
1064
1105
|
}
|
|
1065
|
-
#
|
|
1106
|
+
#n(a) {
|
|
1066
1107
|
return a ? a === "light" || a === "white" ? "light" : a === "body" || a === "transparent" || a.startsWith("body-") ? null : "dark" : null;
|
|
1067
1108
|
}
|
|
1068
1109
|
/** min-width px for each Bootstrap breakpoint (xs = always collapsed → 0). */
|
|
1069
|
-
static #
|
|
1110
|
+
static #i = {
|
|
1070
1111
|
xs: 0,
|
|
1071
1112
|
sm: 576,
|
|
1072
1113
|
md: 768,
|
|
@@ -1081,30 +1122,41 @@ class r extends b {
|
|
|
1081
1122
|
* inherit THROUGH shadow boundaries, so `mp-navbar-dropdown` reads the px in JS
|
|
1082
1123
|
* (matchMedia gate) without any DI/context.
|
|
1083
1124
|
*/
|
|
1084
|
-
#
|
|
1085
|
-
const n = a ?? "md", t = r.#
|
|
1125
|
+
#l(a) {
|
|
1126
|
+
const n = a ?? "md", t = r.#i[n] ?? 768;
|
|
1086
1127
|
this.setAttribute("data-breakpoint", n), this.style.setProperty("--mp-navbar-breakpoint", `${t}px`);
|
|
1087
1128
|
}
|
|
1088
|
-
get #
|
|
1129
|
+
get #e() {
|
|
1089
1130
|
return this.renderRoot?.querySelector(".navbar-toggle") ?? null;
|
|
1090
1131
|
}
|
|
1091
1132
|
/** Whether the collapse is (visually) expanded — the toggle's checked state. */
|
|
1092
1133
|
get expanded() {
|
|
1093
|
-
return this.#
|
|
1134
|
+
return this.#e?.checked ?? this.hasAttribute("expanded");
|
|
1094
1135
|
}
|
|
1095
1136
|
set expanded(a) {
|
|
1096
1137
|
this.toggle(a);
|
|
1097
1138
|
}
|
|
1139
|
+
/**
|
|
1140
|
+
* The single write path for the collapse state: checkbox + `aria-expanded`
|
|
1141
|
+
* (+ event). Programmatic writes (`toggle()`, the `expanded` attribute,
|
|
1142
|
+
* dismiss-on-navigate) don't fire the checkbox's `change` event, so syncing
|
|
1143
|
+
* aria only there left `aria-expanded` stale after every programmatic close.
|
|
1144
|
+
*/
|
|
1145
|
+
#o(a, n = !0) {
|
|
1146
|
+
const t = this.#e;
|
|
1147
|
+
t && (t.checked = a, t.setAttribute("aria-expanded", String(a)), n && this.#s(a));
|
|
1148
|
+
}
|
|
1098
1149
|
/** Programmatically open/close the collapse. */
|
|
1099
1150
|
toggle(a) {
|
|
1100
|
-
|
|
1101
|
-
n && (n.checked = a ?? !n.checked, this.#n(n.checked));
|
|
1151
|
+
this.#o(a ?? !(this.#e?.checked ?? !1));
|
|
1102
1152
|
}
|
|
1103
|
-
#
|
|
1104
|
-
|
|
1105
|
-
a?.setAttribute("aria-expanded", String(n)), this.#n(n);
|
|
1153
|
+
#d = () => {
|
|
1154
|
+
this.#o(this.#e?.checked ?? !1);
|
|
1106
1155
|
};
|
|
1107
|
-
#
|
|
1156
|
+
#r = (a) => {
|
|
1157
|
+
a.key === "Enter" && (a.preventDefault(), this.toggle());
|
|
1158
|
+
};
|
|
1159
|
+
#s(a) {
|
|
1108
1160
|
this.dispatchEvent(
|
|
1109
1161
|
new CustomEvent("expandedchange", {
|
|
1110
1162
|
detail: { expanded: a },
|
|
@@ -1122,9 +1174,12 @@ class r extends b {
|
|
|
1122
1174
|
type="checkbox"
|
|
1123
1175
|
id="mp-navbar-toggle"
|
|
1124
1176
|
class="navbar-toggle"
|
|
1177
|
+
role="button"
|
|
1125
1178
|
aria-label="Toggle navigation"
|
|
1126
1179
|
aria-expanded="false"
|
|
1127
|
-
|
|
1180
|
+
aria-controls="navbar-collapse"
|
|
1181
|
+
@change=${this.#d}
|
|
1182
|
+
@keydown=${this.#r}
|
|
1128
1183
|
/>
|
|
1129
1184
|
<label for="mp-navbar-toggle" class="navbar-toggler" part="toggler" aria-hidden="true">
|
|
1130
1185
|
<slot name="toggler">
|
|
@@ -1133,7 +1188,7 @@ class r extends b {
|
|
|
1133
1188
|
<span class="navbar-toggler-bar"></span>
|
|
1134
1189
|
</slot>
|
|
1135
1190
|
</label>
|
|
1136
|
-
<div class="navbar-collapse" part="collapse">
|
|
1191
|
+
<div class="navbar-collapse" id="navbar-collapse" part="collapse">
|
|
1137
1192
|
<div class="navbar-collapse-inner">
|
|
1138
1193
|
<ul class="navbar-nav nav-start" part="nav-start"><slot></slot></ul>
|
|
1139
1194
|
<ul class="navbar-nav nav-end" part="nav-end"><slot name="end"></slot></ul>
|
|
@@ -1144,14 +1199,14 @@ class r extends b {
|
|
|
1144
1199
|
}
|
|
1145
1200
|
}
|
|
1146
1201
|
customElements.get("mp-navbar") || customElements.define("mp-navbar", r);
|
|
1147
|
-
class i extends
|
|
1202
|
+
class i extends d {
|
|
1148
1203
|
createRenderRoot() {
|
|
1149
1204
|
return this.constructor.observedAttributes.includes("defer-hydration") || this.shadowRoot?.replaceChildren(), super.createRenderRoot();
|
|
1150
1205
|
}
|
|
1151
1206
|
}
|
|
1152
1207
|
class m extends i {
|
|
1153
1208
|
static {
|
|
1154
|
-
this.styles = [
|
|
1209
|
+
this.styles = [c];
|
|
1155
1210
|
}
|
|
1156
1211
|
render() {
|
|
1157
1212
|
return o`<slot></slot>`;
|
|
@@ -1160,7 +1215,7 @@ class m extends i {
|
|
|
1160
1215
|
customElements.get("mp-navbar-item") || customElements.define("mp-navbar-item", m);
|
|
1161
1216
|
class x extends i {
|
|
1162
1217
|
static {
|
|
1163
|
-
this.styles = [
|
|
1218
|
+
this.styles = [g];
|
|
1164
1219
|
}
|
|
1165
1220
|
render() {
|
|
1166
1221
|
return o`<slot></slot>`;
|
|
@@ -1171,11 +1226,21 @@ class s extends i {
|
|
|
1171
1226
|
static {
|
|
1172
1227
|
this.styles = [h];
|
|
1173
1228
|
}
|
|
1174
|
-
|
|
1229
|
+
static get observedAttributes() {
|
|
1230
|
+
return [...super.observedAttributes ?? [], "data-open", "data-menu-open"];
|
|
1231
|
+
}
|
|
1232
|
+
#t = !1;
|
|
1175
1233
|
#a = null;
|
|
1176
|
-
#
|
|
1234
|
+
#n = null;
|
|
1235
|
+
/** Open via either path — inline (`data-open`) or overlay (`data-menu-open`). */
|
|
1236
|
+
get #i() {
|
|
1237
|
+
return this.hasAttribute("data-open") || this.hasAttribute("data-menu-open");
|
|
1238
|
+
}
|
|
1239
|
+
attributeChangedCallback(a, n, t) {
|
|
1240
|
+
super.attributeChangedCallback(a, n, t), (a === "data-open" || a === "data-menu-open") && this.renderRoot?.querySelector(".dropdown-toggle")?.setAttribute("aria-expanded", String(this.#i));
|
|
1241
|
+
}
|
|
1177
1242
|
/** min-width px per Bootstrap breakpoint — mirrors mp-navbar's map. */
|
|
1178
|
-
static #
|
|
1243
|
+
static #l = {
|
|
1179
1244
|
xs: 0,
|
|
1180
1245
|
sm: 576,
|
|
1181
1246
|
md: 768,
|
|
@@ -1184,17 +1249,17 @@ class s extends i {
|
|
|
1184
1249
|
xxl: 1400
|
|
1185
1250
|
};
|
|
1186
1251
|
/** Wide mode = at/above the navbar breakpoint (matchMedia). Small/no-JS = false. */
|
|
1187
|
-
get #
|
|
1188
|
-
return this.#
|
|
1252
|
+
get #e() {
|
|
1253
|
+
return this.#n?.matches ?? !1;
|
|
1189
1254
|
}
|
|
1190
1255
|
connectedCallback() {
|
|
1191
|
-
super.connectedCallback(), this.setAttribute("data-js", ""), this.#
|
|
1256
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.#t = !!this.closest("mp-dropdown-menu");
|
|
1192
1257
|
const a = this.closest("mp-navbar")?.getAttribute("breakpoint") ?? "md";
|
|
1193
1258
|
if (this.setAttribute("data-expand", a), typeof window < "u" && window.matchMedia) {
|
|
1194
|
-
const n = s.#
|
|
1195
|
-
this.#
|
|
1259
|
+
const n = s.#l[a] ?? 768;
|
|
1260
|
+
this.#n = window.matchMedia(`(min-width: ${n}px)`), this.#n.addEventListener("change", this.#o);
|
|
1196
1261
|
}
|
|
1197
|
-
this.#
|
|
1262
|
+
this.addEventListener("keydown", this.#v), this.#t && (this.setAttribute("data-submenu", ""), this.#a = new v(this, {
|
|
1198
1263
|
anchor: () => this.renderRoot?.querySelector(".dropdown-toggle") ?? null,
|
|
1199
1264
|
trigger: () => this.renderRoot?.querySelector(".dropdown-toggle") ?? null,
|
|
1200
1265
|
// The default-slotted panel: `<mp-dropdown-menu>` directly (React/Vue), or a
|
|
@@ -1211,29 +1276,29 @@ class s extends i {
|
|
|
1211
1276
|
}));
|
|
1212
1277
|
}
|
|
1213
1278
|
disconnectedCallback() {
|
|
1214
|
-
super.disconnectedCallback(), document.removeEventListener("mousedown", this.#
|
|
1279
|
+
super.disconnectedCallback(), this.removeEventListener("keydown", this.#v), document.removeEventListener("mousedown", this.#s, !0), this.#n?.removeEventListener("change", this.#o);
|
|
1215
1280
|
}
|
|
1216
1281
|
// Resize crossed the breakpoint: close any open panel so state doesn't leak
|
|
1217
1282
|
// across the inline↔overlay switch (the CSS + #toggle re-resolve on next open).
|
|
1218
|
-
#
|
|
1219
|
-
this.#a?.close(), this.#
|
|
1283
|
+
#o = () => {
|
|
1284
|
+
this.#a?.close(), this.#r(!1);
|
|
1220
1285
|
};
|
|
1221
|
-
get #
|
|
1286
|
+
get #d() {
|
|
1222
1287
|
return this.hasAttribute("data-open");
|
|
1223
1288
|
}
|
|
1224
|
-
#
|
|
1225
|
-
a !== this.#
|
|
1289
|
+
#r(a) {
|
|
1290
|
+
a !== this.#d && (this.toggleAttribute("data-open", a), a ? document.addEventListener("mousedown", this.#s, !0) : document.removeEventListener("mousedown", this.#s, !0));
|
|
1226
1291
|
}
|
|
1227
|
-
#
|
|
1228
|
-
a.composedPath().includes(this) || this.#
|
|
1292
|
+
#s = (a) => {
|
|
1293
|
+
a.composedPath().includes(this) || this.#r(!1);
|
|
1229
1294
|
};
|
|
1230
|
-
#
|
|
1231
|
-
this.#
|
|
1295
|
+
#b() {
|
|
1296
|
+
this.#t && this.#e && this.#a ? this.#a.toggle() : this.#r(!this.#d);
|
|
1232
1297
|
}
|
|
1233
1298
|
/** Close the dropdown (both the overlay and the inline paths). Public so the
|
|
1234
1299
|
* parent `mp-navbar` can dismiss every dropdown when a nav link is clicked. */
|
|
1235
1300
|
close() {
|
|
1236
|
-
this.#a?.close(), this.#
|
|
1301
|
+
this.#a?.close(), this.#r(!1);
|
|
1237
1302
|
}
|
|
1238
1303
|
/**
|
|
1239
1304
|
* Toggle on MOUSEDOWN, not click — the whole gesture must resolve at press
|
|
@@ -1246,12 +1311,27 @@ class s extends i {
|
|
|
1246
1311
|
* is yanked out mid-gesture), and the dropdown silently fails to open.
|
|
1247
1312
|
* No preventDefault: it would suppress focus moving to the trigger.
|
|
1248
1313
|
*/
|
|
1249
|
-
#
|
|
1250
|
-
this.#
|
|
1314
|
+
#p = () => {
|
|
1315
|
+
this.#b();
|
|
1251
1316
|
};
|
|
1317
|
+
#c = (a) => {
|
|
1318
|
+
a.key === "Enter" || a.key === " " || a.key === "Spacebar" ? (a.preventDefault(), this.#b()) : a.key === "ArrowDown" && (a.preventDefault(), this.#i || this.#b(), this.#g());
|
|
1319
|
+
};
|
|
1320
|
+
/** Escape closes the INNERMOST open dropdown and returns focus to its
|
|
1321
|
+
* trigger — fires for the shadow trigger and slotted menu content alike
|
|
1322
|
+
* (keydown is composed). Closed hosts let the event bubble to an open
|
|
1323
|
+
* ancestor, so nested submenus unwind one level per press. */
|
|
1252
1324
|
#v = (a) => {
|
|
1253
|
-
a.key
|
|
1325
|
+
a.key !== "Escape" || !this.#i || (a.stopPropagation(), this.close(), this.renderRoot?.querySelector(".dropdown-toggle")?.focus());
|
|
1254
1326
|
};
|
|
1327
|
+
/** Move focus to the first item control of the slotted menu (this menu's own
|
|
1328
|
+
* items only — nested submenus keep theirs). */
|
|
1329
|
+
#g() {
|
|
1330
|
+
const a = this.querySelector(':scope > :not([slot="label"])'), n = a?.matches("mp-dropdown-menu") ? a : a?.querySelector("mp-dropdown-menu");
|
|
1331
|
+
if (!n) return;
|
|
1332
|
+
const t = [...n.querySelectorAll(".dropdown-item")].find((b) => b.closest("mp-dropdown-menu") === n);
|
|
1333
|
+
(t?.querySelector("a, button") ?? t)?.focus();
|
|
1334
|
+
}
|
|
1255
1335
|
render() {
|
|
1256
1336
|
return o`
|
|
1257
1337
|
<a
|
|
@@ -1260,8 +1340,9 @@ class s extends i {
|
|
|
1260
1340
|
role="button"
|
|
1261
1341
|
tabindex="0"
|
|
1262
1342
|
aria-haspopup="menu"
|
|
1263
|
-
|
|
1264
|
-
@
|
|
1343
|
+
aria-expanded="false"
|
|
1344
|
+
@mousedown=${this.#p}
|
|
1345
|
+
@keydown=${this.#c}
|
|
1265
1346
|
><slot name="label"></slot></a>
|
|
1266
1347
|
<slot></slot>
|
|
1267
1348
|
`;
|
|
@@ -1273,8 +1354,8 @@ export {
|
|
|
1273
1354
|
x as MpNavbarBrand,
|
|
1274
1355
|
s as MpNavbarDropdown,
|
|
1275
1356
|
m as MpNavbarItem,
|
|
1276
|
-
|
|
1357
|
+
g as navbarBrandStyles,
|
|
1277
1358
|
h as navbarDropdownStyles,
|
|
1278
|
-
|
|
1359
|
+
c as navbarItemStyles,
|
|
1279
1360
|
p as navbarStyles
|
|
1280
1361
|
};
|
|
@@ -24,6 +24,8 @@ import { MpNavbarElement } from './mp-navbar-element';
|
|
|
24
24
|
export declare class MpNavbarDropdown extends MpNavbarElement {
|
|
25
25
|
#private;
|
|
26
26
|
static styles: import('lit').CSSResult[];
|
|
27
|
+
static get observedAttributes(): string[];
|
|
28
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
27
29
|
connectedCallback(): void;
|
|
28
30
|
disconnectedCallback(): void;
|
|
29
31
|
/** Close the dropdown (both the overlay and the inline paths). Public so the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/web-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"types": "./a11y/index.d.ts",
|
|
30
30
|
"import": "./a11y/index.mjs"
|
|
31
31
|
},
|
|
32
|
+
"./accordion": {
|
|
33
|
+
"types": "./accordion/index.d.ts",
|
|
34
|
+
"import": "./accordion/index.mjs"
|
|
35
|
+
},
|
|
32
36
|
"./calendar": {
|
|
33
37
|
"types": "./calendar/index.d.ts",
|
|
34
38
|
"import": "./calendar/index.mjs"
|
|
@@ -37,6 +41,10 @@
|
|
|
37
41
|
"types": "./card/index.d.ts",
|
|
38
42
|
"import": "./card/index.mjs"
|
|
39
43
|
},
|
|
44
|
+
"./carousel": {
|
|
45
|
+
"types": "./carousel/index.d.ts",
|
|
46
|
+
"import": "./carousel/index.mjs"
|
|
47
|
+
},
|
|
40
48
|
"./checkbox": {
|
|
41
49
|
"types": "./checkbox/index.d.ts",
|
|
42
50
|
"import": "./checkbox/index.mjs"
|
|
@@ -121,6 +129,10 @@
|
|
|
121
129
|
"types": "./splitter/index.d.ts",
|
|
122
130
|
"import": "./splitter/index.mjs"
|
|
123
131
|
},
|
|
132
|
+
"./swiper-core": {
|
|
133
|
+
"types": "./swiper-core/index.d.ts",
|
|
134
|
+
"import": "./swiper-core/index.mjs"
|
|
135
|
+
},
|
|
124
136
|
"./tab-control": {
|
|
125
137
|
"types": "./tab-control/index.d.ts",
|
|
126
138
|
"import": "./tab-control/index.mjs"
|
package/splitter/src/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export { ResizeState } from './types';
|
|
|
7
7
|
export { ResizeManager } from './managers';
|
|
8
8
|
export type { ResizeManagerOptions } from './managers';
|
|
9
9
|
export { InputHandler, normalizePointerEvent } from './input';
|
|
10
|
-
export type { InputHandlerCallbacks, NormalizedPointerEvent } from './input';
|
|
10
|
+
export type { InputHandlerCallbacks, NormalizedPointerEvent, ResizeKey } from './input';
|
|
11
11
|
export { splitterStyles } from './styles';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|