@mintplayer/web-components 2.1.1 → 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.d.ts +1 -0
- package/accordion/index.mjs +549 -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 +66 -0
- package/accordion/src/index.d.ts +3 -0
- package/accordion/src/styles/index.d.ts +1 -0
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.d.ts +1 -0
- package/carousel/index.mjs +994 -0
- package/carousel/src/components/index.d.ts +1 -0
- package/carousel/src/components/mp-carousel.d.ts +58 -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/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 +21 -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/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/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/dropdown/src/styles/dropdown.styles.d.ts +0 -2
|
@@ -0,0 +1,994 @@
|
|
|
1
|
+
import { unsafeCSS as p, LitElement as f, adoptStyles as m, nothing as l, html as c } from "lit";
|
|
2
|
+
import { map as h } from "lit/directives/map.js";
|
|
3
|
+
import { range as u } from "lit/directives/range.js";
|
|
4
|
+
import { unsafeHTML as g } from "lit/directives/unsafe-html.js";
|
|
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 {
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.carousel.pointer-event {
|
|
13
|
+
touch-action: pan-y;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.carousel-inner {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 100%;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
.carousel-inner::after {
|
|
22
|
+
display: block;
|
|
23
|
+
clear: both;
|
|
24
|
+
content: "";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.carousel-item {
|
|
28
|
+
position: relative;
|
|
29
|
+
display: none;
|
|
30
|
+
float: left;
|
|
31
|
+
width: 100%;
|
|
32
|
+
margin-right: -100%;
|
|
33
|
+
backface-visibility: hidden;
|
|
34
|
+
transition: transform 0.6s ease-in-out;
|
|
35
|
+
}
|
|
36
|
+
@media (prefers-reduced-motion: reduce) {
|
|
37
|
+
.carousel-item {
|
|
38
|
+
transition: none;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.carousel-item.active,
|
|
43
|
+
.carousel-item-next,
|
|
44
|
+
.carousel-item-prev {
|
|
45
|
+
display: block;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.carousel-item-next:not(.carousel-item-start),
|
|
49
|
+
.active.carousel-item-end {
|
|
50
|
+
transform: translateX(100%);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.carousel-item-prev:not(.carousel-item-end),
|
|
54
|
+
.active.carousel-item-start {
|
|
55
|
+
transform: translateX(-100%);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.carousel-fade .carousel-item {
|
|
59
|
+
opacity: 0;
|
|
60
|
+
transition-property: opacity;
|
|
61
|
+
transform: none;
|
|
62
|
+
}
|
|
63
|
+
.carousel-fade .carousel-item.active,
|
|
64
|
+
.carousel-fade .carousel-item-next.carousel-item-start,
|
|
65
|
+
.carousel-fade .carousel-item-prev.carousel-item-end {
|
|
66
|
+
z-index: 1;
|
|
67
|
+
opacity: 1;
|
|
68
|
+
}
|
|
69
|
+
.carousel-fade .active.carousel-item-start,
|
|
70
|
+
.carousel-fade .active.carousel-item-end {
|
|
71
|
+
z-index: 0;
|
|
72
|
+
opacity: 0;
|
|
73
|
+
transition: opacity 0s 0.6s;
|
|
74
|
+
}
|
|
75
|
+
@media (prefers-reduced-motion: reduce) {
|
|
76
|
+
.carousel-fade .active.carousel-item-start,
|
|
77
|
+
.carousel-fade .active.carousel-item-end {
|
|
78
|
+
transition: none;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.carousel-control-prev,
|
|
83
|
+
.carousel-control-next {
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 0;
|
|
86
|
+
bottom: 0;
|
|
87
|
+
z-index: 1;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
width: 15%;
|
|
92
|
+
padding: 0;
|
|
93
|
+
color: #fff;
|
|
94
|
+
text-align: center;
|
|
95
|
+
background: none;
|
|
96
|
+
filter: var(--bs-carousel-control-icon-filter);
|
|
97
|
+
border: 0;
|
|
98
|
+
opacity: 0.5;
|
|
99
|
+
transition: opacity 0.15s ease;
|
|
100
|
+
}
|
|
101
|
+
@media (prefers-reduced-motion: reduce) {
|
|
102
|
+
.carousel-control-prev,
|
|
103
|
+
.carousel-control-next {
|
|
104
|
+
transition: none;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.carousel-control-prev:hover, .carousel-control-prev:focus,
|
|
108
|
+
.carousel-control-next:hover,
|
|
109
|
+
.carousel-control-next:focus {
|
|
110
|
+
color: #fff;
|
|
111
|
+
text-decoration: none;
|
|
112
|
+
outline: 0;
|
|
113
|
+
opacity: 0.9;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.carousel-control-prev {
|
|
117
|
+
left: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.carousel-control-next {
|
|
121
|
+
right: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.carousel-control-prev-icon,
|
|
125
|
+
.carousel-control-next-icon {
|
|
126
|
+
display: inline-block;
|
|
127
|
+
width: 2rem;
|
|
128
|
+
height: 2rem;
|
|
129
|
+
background-repeat: no-repeat;
|
|
130
|
+
background-position: 50%;
|
|
131
|
+
background-size: 100% 100%;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.carousel-control-prev-icon {
|
|
135
|
+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0'/%3e%3c/svg%3e") /*rtl:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708'/%3e%3c/svg%3e")*/;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.carousel-control-next-icon {
|
|
139
|
+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708'/%3e%3c/svg%3e") /*rtl:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0'/%3e%3c/svg%3e")*/;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.carousel-indicators {
|
|
143
|
+
position: absolute;
|
|
144
|
+
right: 0;
|
|
145
|
+
bottom: 0;
|
|
146
|
+
left: 0;
|
|
147
|
+
z-index: 2;
|
|
148
|
+
display: flex;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
padding: 0;
|
|
151
|
+
margin-right: 15%;
|
|
152
|
+
margin-bottom: 1rem;
|
|
153
|
+
margin-left: 15%;
|
|
154
|
+
}
|
|
155
|
+
.carousel-indicators [data-bs-target] {
|
|
156
|
+
box-sizing: content-box;
|
|
157
|
+
flex: 0 1 auto;
|
|
158
|
+
width: 30px;
|
|
159
|
+
height: 3px;
|
|
160
|
+
padding: 0;
|
|
161
|
+
margin-right: 3px;
|
|
162
|
+
margin-left: 3px;
|
|
163
|
+
text-indent: -999px;
|
|
164
|
+
cursor: pointer;
|
|
165
|
+
background-color: var(--bs-carousel-indicator-active-bg);
|
|
166
|
+
background-clip: padding-box;
|
|
167
|
+
border: 0;
|
|
168
|
+
border-top: 10px solid transparent;
|
|
169
|
+
border-bottom: 10px solid transparent;
|
|
170
|
+
opacity: 0.5;
|
|
171
|
+
transition: opacity 0.6s ease;
|
|
172
|
+
}
|
|
173
|
+
@media (prefers-reduced-motion: reduce) {
|
|
174
|
+
.carousel-indicators [data-bs-target] {
|
|
175
|
+
transition: none;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
.carousel-indicators .active {
|
|
179
|
+
opacity: 1;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.carousel-caption {
|
|
183
|
+
position: absolute;
|
|
184
|
+
right: 15%;
|
|
185
|
+
bottom: 1.25rem;
|
|
186
|
+
left: 15%;
|
|
187
|
+
padding-top: 1.25rem;
|
|
188
|
+
padding-bottom: 1.25rem;
|
|
189
|
+
color: var(--bs-carousel-caption-color);
|
|
190
|
+
text-align: center;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.carousel-dark {
|
|
194
|
+
--bs-carousel-indicator-active-bg: #000;
|
|
195
|
+
--bs-carousel-caption-color: #000;
|
|
196
|
+
--bs-carousel-control-icon-filter: invert(1) grayscale(100);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
:root,
|
|
200
|
+
[data-bs-theme=light] {
|
|
201
|
+
--bs-carousel-indicator-active-bg: #fff;
|
|
202
|
+
--bs-carousel-caption-color: #fff;
|
|
203
|
+
--bs-carousel-control-icon-filter: ;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
[data-bs-theme=dark] {
|
|
207
|
+
--bs-carousel-indicator-active-bg: #000;
|
|
208
|
+
--bs-carousel-caption-color: #000;
|
|
209
|
+
--bs-carousel-control-icon-filter: invert(1) grayscale(100);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
:host,
|
|
213
|
+
*,
|
|
214
|
+
*::before,
|
|
215
|
+
*::after {
|
|
216
|
+
box-sizing: border-box;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
:host {
|
|
220
|
+
display: block;
|
|
221
|
+
position: relative;
|
|
222
|
+
min-height: 100px;
|
|
223
|
+
max-width: 500px;
|
|
224
|
+
margin-inline: auto;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.visually-hidden {
|
|
228
|
+
position: absolute;
|
|
229
|
+
width: 1px;
|
|
230
|
+
height: 1px;
|
|
231
|
+
margin: -1px;
|
|
232
|
+
padding: 0;
|
|
233
|
+
overflow: hidden;
|
|
234
|
+
clip: rect(0 0 0 0);
|
|
235
|
+
white-space: nowrap;
|
|
236
|
+
border: 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.carousel-inner {
|
|
240
|
+
position: relative;
|
|
241
|
+
width: 100%;
|
|
242
|
+
overflow: hidden;
|
|
243
|
+
height: var(--mp-carousel-viewport-height, auto);
|
|
244
|
+
overscroll-behavior: contain;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.carousel-track {
|
|
248
|
+
display: flex;
|
|
249
|
+
touch-action: pan-y;
|
|
250
|
+
overscroll-behavior: contain;
|
|
251
|
+
will-change: transform;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:host([orientation=vertical]) .carousel-track {
|
|
255
|
+
flex-direction: column;
|
|
256
|
+
touch-action: pan-x;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.carousel-track .carousel-item {
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: flex-start;
|
|
262
|
+
justify-content: center;
|
|
263
|
+
float: none;
|
|
264
|
+
flex: 0 0 100%;
|
|
265
|
+
min-width: 0;
|
|
266
|
+
margin-right: 0;
|
|
267
|
+
position: relative;
|
|
268
|
+
transition: none;
|
|
269
|
+
backface-visibility: visible;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.carousel-item slot::slotted(*) {
|
|
273
|
+
width: 100% !important;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.carousel-item slot::slotted(img) {
|
|
277
|
+
height: auto;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
:host([animation=fade]) .carousel-item {
|
|
281
|
+
align-items: center;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
:host([orientation=vertical]) .carousel-item {
|
|
285
|
+
flex: 0 0 auto;
|
|
286
|
+
flex-direction: column;
|
|
287
|
+
align-items: center;
|
|
288
|
+
height: var(--mp-carousel-slide-height, auto);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
:host([animation=fade][data-js]) .carousel-track {
|
|
292
|
+
display: grid;
|
|
293
|
+
}
|
|
294
|
+
:host([animation=fade][data-js]) .carousel-item {
|
|
295
|
+
grid-row: 1;
|
|
296
|
+
grid-column: 1;
|
|
297
|
+
opacity: 0;
|
|
298
|
+
transition: opacity 500ms ease-in-out;
|
|
299
|
+
pointer-events: none;
|
|
300
|
+
}
|
|
301
|
+
:host([animation=fade][data-js]) .carousel-item.active {
|
|
302
|
+
opacity: 1;
|
|
303
|
+
pointer-events: auto;
|
|
304
|
+
z-index: 1;
|
|
305
|
+
}
|
|
306
|
+
:host([animation=fade][data-js]) .carousel-clone {
|
|
307
|
+
display: none;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
:host(:not([data-js])) .carousel-inner {
|
|
311
|
+
height: auto;
|
|
312
|
+
}
|
|
313
|
+
:host(:not([data-js])) .carousel-clone,
|
|
314
|
+
:host(:not([data-js])) .carousel-item[data-i] {
|
|
315
|
+
display: none;
|
|
316
|
+
}
|
|
317
|
+
:host(:not([data-js])) .carousel-track {
|
|
318
|
+
display: block;
|
|
319
|
+
transform: none;
|
|
320
|
+
}
|
|
321
|
+
:host(:not([data-js])) .nojs-cell {
|
|
322
|
+
display: flex;
|
|
323
|
+
justify-content: flex-start;
|
|
324
|
+
transition: transform 0.5s ease;
|
|
325
|
+
}
|
|
326
|
+
:host(:not([data-js])) .nojs-cell slot::slotted(*) {
|
|
327
|
+
flex: 0 0 100%;
|
|
328
|
+
width: 100% !important;
|
|
329
|
+
visibility: hidden;
|
|
330
|
+
transition: visibility 0s 0.5s;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
:host(:not([data-js])[animation=none]) .nojs-cell {
|
|
334
|
+
transition-duration: 0s;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
:host(:not([data-js])[animation=none]) .nojs-cell slot::slotted(*) {
|
|
338
|
+
transition-delay: 0s;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
:host(:not([data-js])[animation=fade]) .nojs-cell,
|
|
342
|
+
:host(:not([data-js])[orientation=vertical]) .nojs-cell {
|
|
343
|
+
display: grid;
|
|
344
|
+
transform: none !important;
|
|
345
|
+
}
|
|
346
|
+
:host(:not([data-js])[animation=fade]) .nojs-cell slot::slotted(*),
|
|
347
|
+
:host(:not([data-js])[orientation=vertical]) .nojs-cell slot::slotted(*) {
|
|
348
|
+
grid-row: 1;
|
|
349
|
+
grid-column: 1;
|
|
350
|
+
opacity: 0;
|
|
351
|
+
visibility: hidden;
|
|
352
|
+
transition: opacity 0.4s ease-in-out, visibility 0s 0.4s;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.carousel-controls .carousel-control-prev,
|
|
356
|
+
.carousel-controls .carousel-control-next {
|
|
357
|
+
display: none;
|
|
358
|
+
cursor: pointer;
|
|
359
|
+
z-index: 10;
|
|
360
|
+
border: 0;
|
|
361
|
+
background: transparent;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
:host([orientation=vertical]) .carousel-control-prev,
|
|
365
|
+
:host([orientation=vertical]) .carousel-control-next {
|
|
366
|
+
width: 100%;
|
|
367
|
+
left: 0;
|
|
368
|
+
right: 0;
|
|
369
|
+
justify-content: center;
|
|
370
|
+
top: 0;
|
|
371
|
+
bottom: auto;
|
|
372
|
+
height: 2.5rem;
|
|
373
|
+
align-items: center;
|
|
374
|
+
}
|
|
375
|
+
:host([orientation=vertical]) .carousel-control-next {
|
|
376
|
+
top: auto;
|
|
377
|
+
bottom: 0;
|
|
378
|
+
}
|
|
379
|
+
:host([orientation=vertical]) .carousel-control-prev-icon,
|
|
380
|
+
:host([orientation=vertical]) .carousel-control-next-icon {
|
|
381
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
382
|
+
border-radius: 50%;
|
|
383
|
+
padding: 1.5rem;
|
|
384
|
+
background-size: 50%;
|
|
385
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
386
|
+
transform: rotate(90deg);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
:host(:not([indicators])) .carousel-indicators {
|
|
390
|
+
display: none;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.carousel-indicators {
|
|
394
|
+
z-index: 10;
|
|
395
|
+
}
|
|
396
|
+
.carousel-indicators [data-bs-target] {
|
|
397
|
+
background-color: var(--bs-carousel-indicator-active-bg, #fff);
|
|
398
|
+
cursor: pointer;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
:host([orientation=vertical]) .carousel-indicators {
|
|
402
|
+
position: absolute;
|
|
403
|
+
left: 0;
|
|
404
|
+
top: 50%;
|
|
405
|
+
right: auto;
|
|
406
|
+
bottom: auto;
|
|
407
|
+
transform: translateY(-50%);
|
|
408
|
+
flex-direction: column;
|
|
409
|
+
justify-content: center;
|
|
410
|
+
align-items: center;
|
|
411
|
+
margin: 0;
|
|
412
|
+
margin-left: 0.5rem;
|
|
413
|
+
gap: 0.5rem;
|
|
414
|
+
}
|
|
415
|
+
:host([orientation=vertical]) .carousel-indicators [data-bs-target] {
|
|
416
|
+
width: 12px;
|
|
417
|
+
height: 12px;
|
|
418
|
+
border-radius: 50%;
|
|
419
|
+
border: none;
|
|
420
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.carousel-play-pause {
|
|
424
|
+
position: absolute;
|
|
425
|
+
bottom: 3rem;
|
|
426
|
+
left: 50%;
|
|
427
|
+
transform: translateX(-50%);
|
|
428
|
+
z-index: 11;
|
|
429
|
+
margin: 0;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
:host([orientation=vertical]) .carousel-play-pause {
|
|
433
|
+
bottom: auto;
|
|
434
|
+
top: 0.5rem;
|
|
435
|
+
left: auto;
|
|
436
|
+
right: 0.5rem;
|
|
437
|
+
transform: none;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.carousel-play-pause-btn {
|
|
441
|
+
display: inline-flex;
|
|
442
|
+
align-items: center;
|
|
443
|
+
justify-content: center;
|
|
444
|
+
width: 1.75rem;
|
|
445
|
+
height: 1.75rem;
|
|
446
|
+
padding: 0;
|
|
447
|
+
border: none;
|
|
448
|
+
border-radius: 50%;
|
|
449
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
450
|
+
color: #fff;
|
|
451
|
+
cursor: pointer;
|
|
452
|
+
transition: background-color 0.15s ease;
|
|
453
|
+
}
|
|
454
|
+
.carousel-play-pause-btn:hover, .carousel-play-pause-btn:focus-visible {
|
|
455
|
+
background-color: rgba(0, 0, 0, 0.75);
|
|
456
|
+
}
|
|
457
|
+
.carousel-play-pause-btn:focus-visible {
|
|
458
|
+
outline: 2px solid #fff;
|
|
459
|
+
outline-offset: 2px;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.carousel-play-pause-icon {
|
|
463
|
+
display: inline-block;
|
|
464
|
+
width: 0.75rem;
|
|
465
|
+
height: 0.75rem;
|
|
466
|
+
background-repeat: no-repeat;
|
|
467
|
+
background-position: 50%;
|
|
468
|
+
background-size: 100% 100%;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.carousel-play-pause-paused .carousel-play-pause-icon {
|
|
472
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M3 1.5v13a.5.5 0 0 0 .77.42l11-6.5a.5.5 0 0 0 0-.84l-11-6.5A.5.5 0 0 0 3 1.5z'/%3E%3C/svg%3E");
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.carousel-play-pause-playing .carousel-play-pause-icon {
|
|
476
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M5 2h2v12H5zM9 2h2v12H9z'/%3E%3C/svg%3E");
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
@media (prefers-reduced-motion: reduce) {
|
|
480
|
+
.nojs-cell,
|
|
481
|
+
.nojs-cell slot::slotted(*),
|
|
482
|
+
.carousel-item,
|
|
483
|
+
.carousel-play-pause-btn {
|
|
484
|
+
transition: none !important;
|
|
485
|
+
}
|
|
486
|
+
}`);
|
|
487
|
+
class k extends f {
|
|
488
|
+
constructor() {
|
|
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) => {
|
|
503
|
+
if (t.touches.length !== 1) return;
|
|
504
|
+
const e = t.touches[0];
|
|
505
|
+
this.#a?.pointerDown(e.clientX, e.clientY);
|
|
506
|
+
}, this.#W = (t) => {
|
|
507
|
+
const e = t.touches[0];
|
|
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);
|
|
516
|
+
e && (t.preventDefault(), this.#t?.intent(e));
|
|
517
|
+
}, this.#Q = (t) => {
|
|
518
|
+
const i = [...this.renderRoot?.querySelectorAll(".car-radio") ?? []].indexOf(t.target);
|
|
519
|
+
i >= 0 && i !== this.#i && this.#t?.goto(i);
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
static {
|
|
523
|
+
this.styles = [w];
|
|
524
|
+
}
|
|
525
|
+
static get observedAttributes() {
|
|
526
|
+
return [
|
|
527
|
+
...super.observedAttributes ?? [],
|
|
528
|
+
"animation",
|
|
529
|
+
"orientation",
|
|
530
|
+
"interval",
|
|
531
|
+
"wrap",
|
|
532
|
+
"indicators",
|
|
533
|
+
"keyboard-events",
|
|
534
|
+
"paused"
|
|
535
|
+
];
|
|
536
|
+
}
|
|
537
|
+
#e;
|
|
538
|
+
#i;
|
|
539
|
+
#v;
|
|
540
|
+
#t;
|
|
541
|
+
#a;
|
|
542
|
+
#d;
|
|
543
|
+
#u;
|
|
544
|
+
#b;
|
|
545
|
+
#y;
|
|
546
|
+
#p;
|
|
547
|
+
#n;
|
|
548
|
+
#s;
|
|
549
|
+
#l;
|
|
550
|
+
#o;
|
|
551
|
+
#x;
|
|
552
|
+
// ---- element lifecycle ----------------------------------------------------
|
|
553
|
+
createRenderRoot() {
|
|
554
|
+
if (this.shadowRoot) {
|
|
555
|
+
const e = [...this.shadowRoot.querySelectorAll(".car-radio")].findIndex((i) => i.checked);
|
|
556
|
+
return e > 0 && (this.#v = e), this.shadowRoot.replaceChildren(), m(this.shadowRoot, this.constructor.elementStyles ?? []), this.shadowRoot;
|
|
557
|
+
}
|
|
558
|
+
return super.createRenderRoot();
|
|
559
|
+
}
|
|
560
|
+
connectedCallback() {
|
|
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());
|
|
562
|
+
}
|
|
563
|
+
disconnectedCallback() {
|
|
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();
|
|
565
|
+
}
|
|
566
|
+
firstUpdated() {
|
|
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();
|
|
593
|
+
}
|
|
594
|
+
attributeChangedCallback(t, e, i) {
|
|
595
|
+
if (super.attributeChangedCallback(t, e, i), e !== i)
|
|
596
|
+
switch (t) {
|
|
597
|
+
case "orientation":
|
|
598
|
+
this.#a?.setOrientation(this.#c), this.#f(), this.#m(this.#i), this.requestUpdate();
|
|
599
|
+
break;
|
|
600
|
+
case "animation":
|
|
601
|
+
this.#t?.setConfig({ durationMs: this.#H }), this.#f(), this.#m(this.#i), this.requestUpdate();
|
|
602
|
+
break;
|
|
603
|
+
case "wrap":
|
|
604
|
+
this.#t?.setConfig({ wrap: this.#C });
|
|
605
|
+
break;
|
|
606
|
+
case "interval":
|
|
607
|
+
this.#r(), this.requestUpdate();
|
|
608
|
+
break;
|
|
609
|
+
case "paused":
|
|
610
|
+
this.#r(), this.requestUpdate(), this.#x;
|
|
611
|
+
break;
|
|
612
|
+
case "keyboard-events":
|
|
613
|
+
case "indicators":
|
|
614
|
+
this.requestUpdate();
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
// ---- public API -------------------------------------------------------------
|
|
619
|
+
/** Committed slide index. Setting it jumps without animation. */
|
|
620
|
+
get index() {
|
|
621
|
+
return this.#i;
|
|
622
|
+
}
|
|
623
|
+
set index(t) {
|
|
624
|
+
this.#t?.goto(t, { animate: !1 });
|
|
625
|
+
}
|
|
626
|
+
// Config is attribute-only, DELIBERATELY not exposed as prototype
|
|
627
|
+
// properties: the no-JS CSS and the DSD injector select on the attributes,
|
|
628
|
+
// and framework bridges (@lit/react) strip prototype-matching props from
|
|
629
|
+
// server HTML to set them as client-side properties — which would erase
|
|
630
|
+
// exactly the attributes the no-JS tier needs (navbar/shell doctrine).
|
|
631
|
+
// `interval` and `paused` are the exception (client-only semantics), with
|
|
632
|
+
// reflecting setters for property bindings.
|
|
633
|
+
get #w() {
|
|
634
|
+
const t = this.getAttribute("animation");
|
|
635
|
+
return t === "fade" || t === "none" ? t : "slide";
|
|
636
|
+
}
|
|
637
|
+
get #c() {
|
|
638
|
+
return this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal";
|
|
639
|
+
}
|
|
640
|
+
get #C() {
|
|
641
|
+
return this.getAttribute("wrap") !== "false";
|
|
642
|
+
}
|
|
643
|
+
get #B() {
|
|
644
|
+
return this.getAttribute("keyboard-events") !== "false";
|
|
645
|
+
}
|
|
646
|
+
get interval() {
|
|
647
|
+
const t = Number(this.getAttribute("interval"));
|
|
648
|
+
return Number.isFinite(t) && t > 0 ? t : 0;
|
|
649
|
+
}
|
|
650
|
+
set interval(t) {
|
|
651
|
+
const e = Number(t);
|
|
652
|
+
Number.isFinite(e) && e > 0 ? this.setAttribute("interval", String(e)) : this.removeAttribute("interval");
|
|
653
|
+
}
|
|
654
|
+
get paused() {
|
|
655
|
+
return this.hasAttribute("paused");
|
|
656
|
+
}
|
|
657
|
+
set paused(t) {
|
|
658
|
+
this.#$(t === !0 || t === "" || t === "true", !1);
|
|
659
|
+
}
|
|
660
|
+
previous() {
|
|
661
|
+
this.#t?.previous();
|
|
662
|
+
}
|
|
663
|
+
next() {
|
|
664
|
+
this.#t?.next();
|
|
665
|
+
}
|
|
666
|
+
goto(t, e = {}) {
|
|
667
|
+
this.#t?.goto(t, e);
|
|
668
|
+
}
|
|
669
|
+
play() {
|
|
670
|
+
this.#$(!1);
|
|
671
|
+
}
|
|
672
|
+
pause() {
|
|
673
|
+
this.#$(!0);
|
|
674
|
+
}
|
|
675
|
+
// ---- engine wiring ----------------------------------------------------------
|
|
676
|
+
#_() {
|
|
677
|
+
this.#t || (this.#t = new b(
|
|
678
|
+
{
|
|
679
|
+
applyOffsetRatio: (t) => this.#m(t),
|
|
680
|
+
runTransition: (t, e, i, s) => this.#tt(t, e, i, s)
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
onIndexChange: (t) => this.#st(t),
|
|
684
|
+
onAnimationStart: () => {
|
|
685
|
+
this.#S?.setAttribute("aria-busy", "true"), this.#j("animation-start", void 0);
|
|
686
|
+
},
|
|
687
|
+
onAnimationEnd: () => {
|
|
688
|
+
this.#S?.removeAttribute("aria-busy"), this.#j("animation-end", void 0);
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
count: this.#e.length,
|
|
693
|
+
wrap: this.#C,
|
|
694
|
+
durationMs: this.#H,
|
|
695
|
+
minimumOffsetPx: 50,
|
|
696
|
+
prefersReducedMotion: () => this.#n?.matches ?? !1
|
|
697
|
+
}
|
|
698
|
+
), this.#a = new y(
|
|
699
|
+
{ orientation: this.#c },
|
|
700
|
+
{
|
|
701
|
+
onDragStart: () => this.#t?.beginDrag(),
|
|
702
|
+
onDragMove: (t) => this.#t?.dragBy(t, this.#D()),
|
|
703
|
+
onDragEnd: (t) => this.#t?.endDrag(t, this.#D())
|
|
704
|
+
}
|
|
705
|
+
));
|
|
706
|
+
}
|
|
707
|
+
get #H() {
|
|
708
|
+
return this.#w === "none" ? 0 : 500;
|
|
709
|
+
}
|
|
710
|
+
/** Drag/transform distance for one slide, in px. */
|
|
711
|
+
#D() {
|
|
712
|
+
return this.#c === "horizontal" ? this.#S?.clientWidth ?? 0 : this.#y;
|
|
713
|
+
}
|
|
714
|
+
get #S() {
|
|
715
|
+
return this.renderRoot?.querySelector(".carousel-inner") ?? null;
|
|
716
|
+
}
|
|
717
|
+
get #M() {
|
|
718
|
+
return this.renderRoot?.querySelector(".carousel-track") ?? null;
|
|
719
|
+
}
|
|
720
|
+
// ---- slides -----------------------------------------------------------------
|
|
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) => {
|
|
723
|
+
for (const e of t)
|
|
724
|
+
this.#b.set(e.target, e.contentRect.height);
|
|
725
|
+
this.#f();
|
|
726
|
+
}));
|
|
727
|
+
}
|
|
728
|
+
#V() {
|
|
729
|
+
return [...this.children].filter(
|
|
730
|
+
(t) => t instanceof HTMLElement && t.getAttribute("slot") !== "play-pause"
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
#L() {
|
|
734
|
+
const t = this.#V();
|
|
735
|
+
if (!(t.length !== this.#e.length || t.some((i, s) => i !== this.#e[s])) && !this.#s) {
|
|
736
|
+
t.forEach((i, s) => {
|
|
737
|
+
i.getAttribute("slot") !== `s${s}` && i.setAttribute("slot", `s${s}`);
|
|
738
|
+
});
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
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) => {
|
|
742
|
+
(i instanceof HTMLImageElement ? i : i.querySelector("img"))?.setAttribute("fetchpriority", s === 0 ? "high" : "low");
|
|
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));
|
|
744
|
+
}
|
|
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");
|
|
750
|
+
}
|
|
751
|
+
// ---- position / transitions ---------------------------------------------------
|
|
752
|
+
/**
|
|
753
|
+
* Park the track at a logical ratio (slide units; may transiently sit
|
|
754
|
+
* outside [0, N-1] during a wrap). Physical mapping: the wrap-before cell
|
|
755
|
+
* occupies position 0, so physical = ratio + 1.
|
|
756
|
+
*/
|
|
757
|
+
#m(t) {
|
|
758
|
+
const e = this.#M;
|
|
759
|
+
if (e) {
|
|
760
|
+
if (this.#w === "fade") {
|
|
761
|
+
e.style.transform = "", Number.isInteger(t) && this.#z(this.#X(t));
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
this.#it(t), e.style.transform = this.#R(t);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
#R(t) {
|
|
768
|
+
const e = t + 1;
|
|
769
|
+
return this.#c === "horizontal" ? `translate3d(${-e * 100}%, 0, 0)` : `translate3d(0, ${-e * this.#y}px, 0)`;
|
|
770
|
+
}
|
|
771
|
+
#X(t) {
|
|
772
|
+
const e = this.#e.length;
|
|
773
|
+
return e > 0 ? (t % e + e) % e : 0;
|
|
774
|
+
}
|
|
775
|
+
/** Visual `.active` (fade opacity target) — managed imperatively, not bound. */
|
|
776
|
+
#z(t) {
|
|
777
|
+
this.renderRoot?.querySelectorAll(".carousel-item[data-i]").forEach((e) => {
|
|
778
|
+
e.classList.toggle("active", Number(e.dataset.i) === t);
|
|
779
|
+
});
|
|
780
|
+
}
|
|
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();
|
|
786
|
+
}, i);
|
|
787
|
+
return {
|
|
788
|
+
finish: () => {
|
|
789
|
+
r !== null && (clearTimeout(r), r = null, s(), this.#h());
|
|
790
|
+
},
|
|
791
|
+
cancel: () => {
|
|
792
|
+
r !== null && (clearTimeout(r), r = null, this.#h());
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
const a = this.#M;
|
|
797
|
+
if (!a)
|
|
798
|
+
return s(), { finish: () => {
|
|
799
|
+
}, cancel: () => {
|
|
800
|
+
} };
|
|
801
|
+
if (this.#l.suspend(), this.#et(e), typeof a.animate != "function")
|
|
802
|
+
return this.#g(), s(), this.#h(), { finish: () => {
|
|
803
|
+
}, cancel: () => {
|
|
804
|
+
} };
|
|
805
|
+
const o = a.animate(
|
|
806
|
+
[{ transform: this.#R(t) }, { transform: this.#R(e) }],
|
|
807
|
+
{ duration: i, easing: "ease", fill: "forwards" }
|
|
808
|
+
);
|
|
809
|
+
let n = !1;
|
|
810
|
+
const d = (r) => {
|
|
811
|
+
n || (n = !0, o.cancel(), this.#g(), r && s(), this.#h());
|
|
812
|
+
};
|
|
813
|
+
return o.onfinish = () => d(!0), {
|
|
814
|
+
finish: () => d(!0),
|
|
815
|
+
cancel: () => d(!1)
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
/** Teleport the destination slide into a wrap cell for a wrapping move. */
|
|
819
|
+
#et(t) {
|
|
820
|
+
const e = this.#e.length;
|
|
821
|
+
e < 2 || (t === e ? this.#k(this.#e[0], "wrapA") : t === -1 && this.#k(this.#e[e - 1], "wrapB"));
|
|
822
|
+
}
|
|
823
|
+
/** During a live drag past the deck's edges, keep the wrap cell populated. */
|
|
824
|
+
#it(t) {
|
|
825
|
+
const e = this.#e.length;
|
|
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());
|
|
827
|
+
}
|
|
828
|
+
#k(t, e) {
|
|
829
|
+
!t || this.#s?.el === t || (this.#g(), this.#s = { el: t, home: t.getAttribute("slot") ?? "" }, t.setAttribute("slot", e));
|
|
830
|
+
}
|
|
831
|
+
#g() {
|
|
832
|
+
this.#s && (this.#s.el.setAttribute("slot", this.#s.home), this.#s = null);
|
|
833
|
+
}
|
|
834
|
+
// ---- state sync -----------------------------------------------------------
|
|
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 });
|
|
837
|
+
}
|
|
838
|
+
/** Single write path for `paused` + its event (programmatic writes stay silent). */
|
|
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 }));
|
|
841
|
+
}
|
|
842
|
+
#I;
|
|
843
|
+
#r() {
|
|
844
|
+
this.#F();
|
|
845
|
+
const t = this.interval;
|
|
846
|
+
t > 0 && !this.paused && !this.#A && !this.#E && !(this.#n?.matches ?? !1) && this.isConnected && (this.#p = setInterval(() => this.next(), t));
|
|
847
|
+
}
|
|
848
|
+
#A;
|
|
849
|
+
#E;
|
|
850
|
+
#T;
|
|
851
|
+
#q;
|
|
852
|
+
#P;
|
|
853
|
+
#N;
|
|
854
|
+
#F() {
|
|
855
|
+
this.#p !== null && (clearInterval(this.#p), this.#p = null);
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* `polite` announces manual navigation; `off` keeps rotation from spamming
|
|
859
|
+
* the screen reader. Rotation is only actually happening when an interval is
|
|
860
|
+
* set, not paused, and motion isn't reduced.
|
|
861
|
+
*/
|
|
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) {
|
|
872
|
+
e.preventDefault(), this.#t?.goto(t);
|
|
873
|
+
}
|
|
874
|
+
#Z(t, e) {
|
|
875
|
+
e.preventDefault(), this.#t?.[t]();
|
|
876
|
+
}
|
|
877
|
+
#j(t, e) {
|
|
878
|
+
this.dispatchEvent(new CustomEvent(t, { detail: e, bubbles: !0, composed: !0 }));
|
|
879
|
+
}
|
|
880
|
+
// ---- template ---------------------------------------------------------------
|
|
881
|
+
/**
|
|
882
|
+
* Count-dependent CSS for the no-JS tier (and the `:checked`-driven control
|
|
883
|
+
* pair reveal, which serves both tiers). Lives HERE — in render()'s single
|
|
884
|
+
* source of truth — so the pre-rendered DSD chrome variants carry it too.
|
|
885
|
+
*/
|
|
886
|
+
#at(t) {
|
|
887
|
+
let e = "";
|
|
888
|
+
for (let i = 0; i < t; i++) {
|
|
889
|
+
const s = `#s${i}:checked`;
|
|
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}%); }`;
|
|
891
|
+
}
|
|
892
|
+
return e;
|
|
893
|
+
}
|
|
894
|
+
render() {
|
|
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;
|
|
896
|
+
return c`
|
|
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
|
+
|
|
914
|
+
${h(u(t), (o) => c`
|
|
915
|
+
<input
|
|
916
|
+
type="radio"
|
|
917
|
+
id="s${o}"
|
|
918
|
+
name="car"
|
|
919
|
+
class="car-radio visually-hidden"
|
|
920
|
+
aria-label="Slide ${o + 1}"
|
|
921
|
+
?checked=${o === e}
|
|
922
|
+
@change=${this.#Q}
|
|
923
|
+
/>
|
|
924
|
+
`)}
|
|
925
|
+
<div
|
|
926
|
+
class="carousel-inner"
|
|
927
|
+
part="inner"
|
|
928
|
+
tabindex=${s ? "0" : l}
|
|
929
|
+
aria-live=${s ? this.#ot : l}
|
|
930
|
+
aria-atomic=${s ? "false" : l}
|
|
931
|
+
aria-keyshortcuts=${s && this.#B ? this.#c === "horizontal" ? "ArrowLeft ArrowRight Home End" : "ArrowUp ArrowDown Home End" : l}
|
|
932
|
+
@keydown=${this.#J}
|
|
933
|
+
>
|
|
934
|
+
<div class="carousel-track" part="track">
|
|
935
|
+
<div class="carousel-item carousel-clone" aria-hidden="true"><slot name="wrapB"></slot></div>
|
|
936
|
+
${h(u(t), (o) => c`
|
|
937
|
+
<div
|
|
938
|
+
class="carousel-item"
|
|
939
|
+
data-i=${o}
|
|
940
|
+
role="group"
|
|
941
|
+
aria-roledescription="slide"
|
|
942
|
+
aria-label="${o + 1} of ${t}"
|
|
943
|
+
aria-hidden=${o === e ? l : "true"}
|
|
944
|
+
>
|
|
945
|
+
<slot name="s${o}"></slot>
|
|
946
|
+
</div>
|
|
947
|
+
`)}
|
|
948
|
+
<div class="carousel-item carousel-clone" aria-hidden="true"><slot name="wrapA"></slot></div>
|
|
949
|
+
<div class="carousel-item nojs-cell"><slot></slot></div>
|
|
950
|
+
</div>
|
|
951
|
+
</div>
|
|
952
|
+
<div class="carousel-indicators" part="indicators">
|
|
953
|
+
${h(u(t), (o) => c`
|
|
954
|
+
<label
|
|
955
|
+
for="s${o}"
|
|
956
|
+
data-bs-target
|
|
957
|
+
aria-label="Slide ${o + 1}"
|
|
958
|
+
aria-current=${s && o === e ? "true" : l}
|
|
959
|
+
@click=${(n) => this.#rt(o, n)}
|
|
960
|
+
></label>
|
|
961
|
+
`)}
|
|
962
|
+
</div>
|
|
963
|
+
<div class="carousel-controls" part="controls">
|
|
964
|
+
${h(u(t), (o) => c`
|
|
965
|
+
<label
|
|
966
|
+
class="carousel-control-prev ctl-prev-${o}"
|
|
967
|
+
for="s${(o - 1 + t) % t}"
|
|
968
|
+
role="button"
|
|
969
|
+
aria-label="Previous"
|
|
970
|
+
@click=${(n) => this.#Z("previous", n)}
|
|
971
|
+
>
|
|
972
|
+
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
|
973
|
+
<span class="visually-hidden">Previous</span>
|
|
974
|
+
</label>
|
|
975
|
+
<label
|
|
976
|
+
class="carousel-control-next ctl-next-${o}"
|
|
977
|
+
for="s${(o + 1) % t}"
|
|
978
|
+
role="button"
|
|
979
|
+
aria-label="Next"
|
|
980
|
+
@click=${(n) => this.#Z("next", n)}
|
|
981
|
+
>
|
|
982
|
+
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
|
983
|
+
<span class="visually-hidden">Next</span>
|
|
984
|
+
</label>
|
|
985
|
+
`)}
|
|
986
|
+
</div>
|
|
987
|
+
`;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
customElements.get("mp-carousel") || customElements.define("mp-carousel", k);
|
|
991
|
+
export {
|
|
992
|
+
k as MpCarousel,
|
|
993
|
+
w as carouselStyles
|
|
994
|
+
};
|