@leaflink/stash 44.9.0 → 45.1.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/dist/Carousel.js CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as Y, inject as S, reactive as L, ref as c, h as y, provide as C, onMounted as Le, nextTick as Ee, onUnmounted as Ie, computed as ye, watch as ae, cloneVNode as xe, Fragment as B, useAttrs as Be, useCssModule as De, openBlock as k, createElementBlock as j, createVNode as Re, unref as b, mergeProps as Pe, withCtx as oe, createBlock as ke, createCommentVNode as Ae, renderList as le, renderSlot as Ve, createElementVNode as Te, normalizeClass as H } from "vue";
2
- import { t as I } from "./locale.js";
1
+ import { defineComponent as Y, inject as b, reactive as L, ref as d, h as y, provide as C, onMounted as Le, nextTick as Ie, onUnmounted as Ee, computed as ye, watch as oe, cloneVNode as xe, Fragment as B, useAttrs as Be, useCssModule as De, openBlock as k, createElementBlock as j, createVNode as Re, unref as S, mergeProps as Pe, withCtx as ae, createBlock as ke, createCommentVNode as Te, renderList as le, renderSlot as Ve, createElementVNode as Ae, normalizeClass as H } from "vue";
2
+ import { t as E } from "./locale.js";
3
3
  import { _ as $e } from "./_plugin-vue_export-helper-dad06003.js";
4
4
  import "lodash-es/get";
5
5
  /**
@@ -7,7 +7,7 @@ import "lodash-es/get";
7
7
  * (c) 2023
8
8
  * @license MIT
9
9
  */
10
- const f = {
10
+ const p = {
11
11
  itemsToShow: 1,
12
12
  itemsToScroll: 1,
13
13
  modelValue: 0,
@@ -35,49 +35,49 @@ const f = {
35
35
  }, Ce = {
36
36
  // count of items to showed per view
37
37
  itemsToShow: {
38
- default: f.itemsToShow,
38
+ default: p.itemsToShow,
39
39
  type: Number
40
40
  },
41
41
  // count of items to be scrolled
42
42
  itemsToScroll: {
43
- default: f.itemsToScroll,
43
+ default: p.itemsToScroll,
44
44
  type: Number
45
45
  },
46
46
  // control infinite scrolling mode
47
47
  wrapAround: {
48
- default: f.wrapAround,
48
+ default: p.wrapAround,
49
49
  type: Boolean
50
50
  },
51
51
  // control max drag
52
52
  throttle: {
53
- default: f.throttle,
53
+ default: p.throttle,
54
54
  type: Number
55
55
  },
56
56
  // control snap position alignment
57
57
  snapAlign: {
58
- default: f.snapAlign,
58
+ default: p.snapAlign,
59
59
  validator(t) {
60
60
  return ["start", "end", "center", "center-even", "center-odd"].includes(t);
61
61
  }
62
62
  },
63
63
  // sliding transition time in ms
64
64
  transition: {
65
- default: f.transition,
65
+ default: p.transition,
66
66
  type: Number
67
67
  },
68
68
  // an object to store breakpoints
69
69
  breakpoints: {
70
- default: f.breakpoints,
70
+ default: p.breakpoints,
71
71
  type: Object
72
72
  },
73
73
  // time to auto advance slides in ms
74
74
  autoplay: {
75
- default: f.autoplay,
75
+ default: p.autoplay,
76
76
  type: Number
77
77
  },
78
78
  // pause autoplay when mouse hover over the carousel
79
79
  pauseAutoplayOnHover: {
80
- default: f.pauseAutoplayOnHover,
80
+ default: p.pauseAutoplayOnHover,
81
81
  type: Boolean
82
82
  },
83
83
  // slide number number of initial slide
@@ -87,24 +87,24 @@ const f = {
87
87
  },
88
88
  // toggle mouse dragging.
89
89
  mouseDrag: {
90
- default: f.mouseDrag,
90
+ default: p.mouseDrag,
91
91
  type: Boolean
92
92
  },
93
93
  // toggle mouse dragging.
94
94
  touchDrag: {
95
- default: f.touchDrag,
95
+ default: p.touchDrag,
96
96
  type: Boolean
97
97
  },
98
98
  // control snap position alignment
99
99
  dir: {
100
- default: f.dir,
100
+ default: p.dir,
101
101
  validator(t) {
102
102
  return ["rtl", "ltr"].includes(t);
103
103
  }
104
104
  },
105
105
  // aria-labels and additional text labels
106
106
  i18n: {
107
- default: f.i18n,
107
+ default: p.i18n,
108
108
  type: Object
109
109
  },
110
110
  // an object to pass all settings
@@ -116,110 +116,110 @@ const f = {
116
116
  }
117
117
  };
118
118
  function Ue({ config: t, slidesCount: n }) {
119
- const { snapAlign: e, wrapAround: o, itemsToShow: i = 1 } = t;
120
- if (o)
119
+ const { snapAlign: e, wrapAround: a, itemsToShow: r = 1 } = t;
120
+ if (a)
121
121
  return Math.max(n - 1, 0);
122
- let r;
122
+ let i;
123
123
  switch (e) {
124
124
  case "start":
125
- r = n - i;
125
+ i = n - r;
126
126
  break;
127
127
  case "end":
128
- r = n - 1;
128
+ i = n - 1;
129
129
  break;
130
130
  case "center":
131
131
  case "center-odd":
132
- r = n - Math.ceil((i - 0.5) / 2);
132
+ i = n - Math.ceil((r - 0.5) / 2);
133
133
  break;
134
134
  case "center-even":
135
- r = n - Math.ceil(i / 2);
135
+ i = n - Math.ceil(r / 2);
136
136
  break;
137
137
  default:
138
- r = 0;
138
+ i = 0;
139
139
  break;
140
140
  }
141
- return Math.max(r, 0);
141
+ return Math.max(i, 0);
142
142
  }
143
143
  function Xe({ config: t, slidesCount: n }) {
144
- const { wrapAround: e, snapAlign: o, itemsToShow: i = 1 } = t;
145
- let r = 0;
146
- if (e || i > n)
147
- return r;
148
- switch (o) {
144
+ const { wrapAround: e, snapAlign: a, itemsToShow: r = 1 } = t;
145
+ let i = 0;
146
+ if (e || r > n)
147
+ return i;
148
+ switch (a) {
149
149
  case "start":
150
- r = 0;
150
+ i = 0;
151
151
  break;
152
152
  case "end":
153
- r = i - 1;
153
+ i = r - 1;
154
154
  break;
155
155
  case "center":
156
156
  case "center-odd":
157
- r = Math.floor((i - 1) / 2);
157
+ i = Math.floor((r - 1) / 2);
158
158
  break;
159
159
  case "center-even":
160
- r = Math.floor((i - 2) / 2);
160
+ i = Math.floor((r - 2) / 2);
161
161
  break;
162
162
  default:
163
- r = 0;
163
+ i = 0;
164
164
  break;
165
165
  }
166
- return r;
166
+ return i;
167
167
  }
168
- function re({ val: t, max: n, min: e }) {
168
+ function ie({ val: t, max: n, min: e }) {
169
169
  return n < e ? t : Math.min(Math.max(t, e), n);
170
170
  }
171
171
  function ze({ config: t, currentSlide: n, slidesCount: e }) {
172
- const { snapAlign: o, wrapAround: i, itemsToShow: r = 1 } = t;
173
- let g = n;
174
- switch (o) {
172
+ const { snapAlign: a, wrapAround: r, itemsToShow: i = 1 } = t;
173
+ let m = n;
174
+ switch (a) {
175
175
  case "center":
176
176
  case "center-odd":
177
- g -= (r - 1) / 2;
177
+ m -= (i - 1) / 2;
178
178
  break;
179
179
  case "center-even":
180
- g -= (r - 2) / 2;
180
+ m -= (i - 2) / 2;
181
181
  break;
182
182
  case "end":
183
- g -= r - 1;
183
+ m -= i - 1;
184
184
  break;
185
185
  }
186
- return i ? g : re({
187
- val: g,
188
- max: e - r,
186
+ return r ? m : ie({
187
+ val: m,
188
+ max: e - i,
189
189
  min: 0
190
190
  });
191
191
  }
192
192
  function je(t) {
193
193
  return t ? t.reduce((n, e) => {
194
- var o;
195
- return e.type === B ? [...n, ...je(e.children)] : ((o = e.type) === null || o === void 0 ? void 0 : o.name) === "CarouselSlide" ? [...n, e] : n;
194
+ var a;
195
+ return e.type === B ? [...n, ...je(e.children)] : ((a = e.type) === null || a === void 0 ? void 0 : a.name) === "CarouselSlide" ? [...n, e] : n;
196
196
  }, []) : [];
197
197
  }
198
- function ie({ val: t, max: n, min: e = 0 }) {
199
- return t > n ? ie({ val: t - (n + 1), max: n, min: e }) : t < e ? ie({ val: t + (n + 1), max: n, min: e }) : t;
198
+ function re({ val: t, max: n, min: e = 0 }) {
199
+ return t > n ? re({ val: t - (n + 1), max: n, min: e }) : t < e ? re({ val: t + (n + 1), max: n, min: e }) : t;
200
200
  }
201
201
  function He(t, n) {
202
202
  let e;
203
- return n ? function(...o) {
204
- const i = this;
205
- e || (t.apply(i, o), e = !0, setTimeout(() => e = !1, n));
203
+ return n ? function(...a) {
204
+ const r = this;
205
+ e || (t.apply(r, a), e = !0, setTimeout(() => e = !1, n));
206
206
  } : t;
207
207
  }
208
208
  function Ye(t, n) {
209
209
  let e;
210
- return function(...o) {
210
+ return function(...a) {
211
211
  e && clearTimeout(e), e = setTimeout(() => {
212
- t(...o), e = null;
212
+ t(...a), e = null;
213
213
  }, n);
214
214
  };
215
215
  }
216
216
  function We(t = "", n = {}) {
217
- return Object.entries(n).reduce((e, [o, i]) => e.replace(`{${o}}`, String(i)), t);
217
+ return Object.entries(n).reduce((e, [a, r]) => e.replace(`{${a}}`, String(r)), t);
218
218
  }
219
219
  var Ge = Y({
220
220
  name: "ARIA",
221
221
  setup() {
222
- const t = S("config", L(Object.assign({}, f))), n = S("currentSlide", c(0)), e = S("slidesCount", c(0));
222
+ const t = b("config", L(Object.assign({}, p))), n = b("currentSlide", d(0)), e = b("slidesCount", d(0));
223
223
  return () => y("div", {
224
224
  class: ["carousel__liveregion", "carousel__sr-only"],
225
225
  "aria-live": "polite",
@@ -232,113 +232,113 @@ var Ge = Y({
232
232
  }), Fe = Y({
233
233
  name: "Carousel",
234
234
  props: Ce,
235
- setup(t, { slots: n, emit: e, expose: o }) {
236
- var i;
237
- const r = c(null), g = c([]), d = c(0), v = c(0), l = L(Object.assign({}, f));
238
- let _ = Object.assign({}, f), s;
239
- const u = c((i = t.modelValue) !== null && i !== void 0 ? i : 0), m = c(0), w = c(0), A = c(0), D = c(0);
240
- let E, W;
241
- C("config", l), C("slidesCount", v), C("currentSlide", u), C("maxSlide", A), C("minSlide", D), C("slideWidth", d);
235
+ setup(t, { slots: n, emit: e, expose: a }) {
236
+ var r;
237
+ const i = d(null), m = d([]), c = d(0), v = d(0), l = L(Object.assign({}, p));
238
+ let w = Object.assign({}, p), s;
239
+ const u = d((r = t.modelValue) !== null && r !== void 0 ? r : 0), g = d(0), _ = d(0), T = d(0), D = d(0);
240
+ let I, W;
241
+ C("config", l), C("slidesCount", v), C("currentSlide", u), C("maxSlide", T), C("minSlide", D), C("slideWidth", c);
242
242
  function G() {
243
- s = Object.assign({}, t.breakpoints), _ = Object.assign(Object.assign(Object.assign({}, _), t), { i18n: Object.assign(Object.assign({}, _.i18n), t.i18n), breakpoints: void 0 }), ce(_);
243
+ s = Object.assign({}, t.breakpoints), w = Object.assign(Object.assign(Object.assign({}, w), t), { i18n: Object.assign(Object.assign({}, w.i18n), t.i18n), breakpoints: void 0 }), ce(w);
244
244
  }
245
245
  function V() {
246
246
  if (!s || !Object.keys(s).length)
247
247
  return;
248
- const a = Object.keys(s).map((p) => Number(p)).sort((p, T) => +T - +p);
249
- let h = Object.assign({}, _);
250
- a.some((p) => {
251
- const T = window.matchMedia(`(min-width: ${p}px)`).matches;
252
- return T && (h = Object.assign(Object.assign({}, h), s[p])), T;
248
+ const o = Object.keys(s).map((f) => Number(f)).sort((f, A) => +A - +f);
249
+ let h = Object.assign({}, w);
250
+ o.some((f) => {
251
+ const A = window.matchMedia(`(min-width: ${f}px)`).matches;
252
+ return A && (h = Object.assign(Object.assign({}, h), s[f])), A;
253
253
  }), ce(h);
254
254
  }
255
- function ce(a) {
256
- Object.entries(a).forEach(([h, p]) => l[h] = p);
255
+ function ce(o) {
256
+ Object.entries(o).forEach(([h, f]) => l[h] = f);
257
257
  }
258
258
  const de = Ye(() => {
259
259
  V(), R();
260
260
  }, 16);
261
261
  function R() {
262
- if (!r.value)
262
+ if (!i.value)
263
263
  return;
264
- const a = r.value.getBoundingClientRect();
265
- d.value = a.width / l.itemsToShow;
264
+ const o = i.value.getBoundingClientRect();
265
+ c.value = o.width / l.itemsToShow;
266
266
  }
267
267
  function F() {
268
- v.value <= 0 || (w.value = Math.ceil((v.value - 1) / 2), A.value = Ue({ config: l, slidesCount: v.value }), D.value = Xe({ config: l, slidesCount: v.value }), l.wrapAround || (u.value = re({
268
+ v.value <= 0 || (_.value = Math.ceil((v.value - 1) / 2), T.value = Ue({ config: l, slidesCount: v.value }), D.value = Xe({ config: l, slidesCount: v.value }), l.wrapAround || (u.value = ie({
269
269
  val: u.value,
270
- max: A.value,
270
+ max: T.value,
271
271
  min: D.value
272
272
  })));
273
273
  }
274
274
  Le(() => {
275
- Ee(() => R()), setTimeout(() => R(), 1e3), V(), ge(), window.addEventListener("resize", de, { passive: !0 }), e("init");
276
- }), Ie(() => {
277
- W && clearTimeout(W), E && clearInterval(E), window.removeEventListener("resize", de, {
275
+ Ie(() => R()), setTimeout(() => R(), 1e3), V(), me(), window.addEventListener("resize", de, { passive: !0 }), e("init");
276
+ }), Ee(() => {
277
+ W && clearTimeout(W), I && clearInterval(I), window.removeEventListener("resize", de, {
278
278
  passive: !0
279
279
  });
280
280
  });
281
281
  let x = !1;
282
- const $ = { x: 0, y: 0 }, U = { x: 0, y: 0 }, M = L({ x: 0, y: 0 }), X = c(!1), q = c(!1), Me = () => {
282
+ const $ = { x: 0, y: 0 }, U = { x: 0, y: 0 }, M = L({ x: 0, y: 0 }), X = d(!1), q = d(!1), Me = () => {
283
283
  X.value = !0;
284
284
  }, Ne = () => {
285
285
  X.value = !1;
286
286
  };
287
- function ve(a) {
288
- ["INPUT", "TEXTAREA", "SELECT"].includes(a.target.tagName) || (x = a.type === "touchstart", x || a.preventDefault(), !(!x && a.button !== 0 || N.value) && ($.x = x ? a.touches[0].clientX : a.clientX, $.y = x ? a.touches[0].clientY : a.clientY, document.addEventListener(x ? "touchmove" : "mousemove", pe, !0), document.addEventListener(x ? "touchend" : "mouseup", fe, !0)));
287
+ function ve(o) {
288
+ ["INPUT", "TEXTAREA", "SELECT"].includes(o.target.tagName) || (x = o.type === "touchstart", x || o.preventDefault(), !(!x && o.button !== 0 || N.value) && ($.x = x ? o.touches[0].clientX : o.clientX, $.y = x ? o.touches[0].clientY : o.clientY, document.addEventListener(x ? "touchmove" : "mousemove", fe, !0), document.addEventListener(x ? "touchend" : "mouseup", pe, !0)));
289
289
  }
290
- const pe = He((a) => {
291
- q.value = !0, U.x = x ? a.touches[0].clientX : a.clientX, U.y = x ? a.touches[0].clientY : a.clientY;
292
- const h = U.x - $.x, p = U.y - $.y;
293
- M.y = p, M.x = h;
290
+ const fe = He((o) => {
291
+ q.value = !0, U.x = x ? o.touches[0].clientX : o.clientX, U.y = x ? o.touches[0].clientY : o.clientY;
292
+ const h = U.x - $.x, f = U.y - $.y;
293
+ M.y = f, M.x = h;
294
294
  }, l.throttle);
295
- function fe() {
296
- const a = l.dir === "rtl" ? -1 : 1, h = Math.sign(M.x) * 0.4, p = Math.round(M.x / d.value + h) * a;
297
- if (p && !x) {
298
- const T = (Z) => {
299
- Z.stopPropagation(), window.removeEventListener("click", T, !0);
295
+ function pe() {
296
+ const o = l.dir === "rtl" ? -1 : 1, h = Math.sign(M.x) * 0.4, f = Math.round(M.x / c.value + h) * o;
297
+ if (f && !x) {
298
+ const A = (Z) => {
299
+ Z.stopPropagation(), window.removeEventListener("click", A, !0);
300
300
  };
301
- window.addEventListener("click", T, !0);
301
+ window.addEventListener("click", A, !0);
302
302
  }
303
- O(u.value - p), M.x = 0, M.y = 0, q.value = !1, document.removeEventListener(x ? "touchmove" : "mousemove", pe, !0), document.removeEventListener(x ? "touchend" : "mouseup", fe, !0);
303
+ O(u.value - f), M.x = 0, M.y = 0, q.value = !1, document.removeEventListener(x ? "touchmove" : "mousemove", fe, !0), document.removeEventListener(x ? "touchend" : "mouseup", pe, !0);
304
304
  }
305
- function ge() {
306
- !l.autoplay || l.autoplay <= 0 || (E = setInterval(() => {
305
+ function me() {
306
+ !l.autoplay || l.autoplay <= 0 || (I = setInterval(() => {
307
307
  l.pauseAutoplayOnHover && X.value || z();
308
308
  }, l.autoplay));
309
309
  }
310
- function me() {
311
- E && (clearInterval(E), E = null), ge();
310
+ function ge() {
311
+ I && (clearInterval(I), I = null), me();
312
312
  }
313
- const N = c(!1);
314
- function O(a) {
315
- const h = l.wrapAround ? a : re({
316
- val: a,
317
- max: A.value,
313
+ const N = d(!1);
314
+ function O(o) {
315
+ const h = l.wrapAround ? o : ie({
316
+ val: o,
317
+ max: T.value,
318
318
  min: D.value
319
319
  });
320
320
  u.value === h || N.value || (e("slide-start", {
321
- slidingToIndex: a,
321
+ slidingToIndex: o,
322
322
  currentSlideIndex: u.value,
323
- prevSlideIndex: m.value,
323
+ prevSlideIndex: g.value,
324
324
  slidesCount: v.value
325
- }), N.value = !0, m.value = u.value, u.value = h, W = setTimeout(() => {
325
+ }), N.value = !0, g.value = u.value, u.value = h, W = setTimeout(() => {
326
326
  if (l.wrapAround) {
327
- const p = ie({
327
+ const f = re({
328
328
  val: h,
329
- max: A.value,
329
+ max: T.value,
330
330
  min: 0
331
331
  });
332
- p !== u.value && (u.value = p, e("loop", {
332
+ f !== u.value && (u.value = f, e("loop", {
333
333
  currentSlideIndex: u.value,
334
- slidingToIndex: a
334
+ slidingToIndex: o
335
335
  }));
336
336
  }
337
337
  e("update:modelValue", u.value), e("slide-end", {
338
338
  currentSlideIndex: u.value,
339
- prevSlideIndex: m.value,
339
+ prevSlideIndex: g.value,
340
340
  slidesCount: v.value
341
- }), N.value = !1, me();
341
+ }), N.value = !1, ge();
342
342
  }, l.transition));
343
343
  }
344
344
  function z() {
@@ -349,79 +349,79 @@ var Ge = Y({
349
349
  }
350
350
  const he = { slideTo: O, next: z, prev: J };
351
351
  C("nav", he), C("isSliding", N);
352
- const _e = ye(() => ze({
352
+ const we = ye(() => ze({
353
353
  config: l,
354
354
  currentSlide: u.value,
355
355
  slidesCount: v.value
356
356
  }));
357
- C("slidesToScroll", _e);
357
+ C("slidesToScroll", we);
358
358
  const Oe = ye(() => {
359
- const a = l.dir === "rtl" ? -1 : 1, h = _e.value * d.value * a;
359
+ const o = l.dir === "rtl" ? -1 : 1, h = we.value * c.value * o;
360
360
  return {
361
361
  transform: `translateX(${M.x - h}px)`,
362
362
  transition: `${N.value ? l.transition : 0}ms`,
363
- margin: l.wrapAround ? `0 -${v.value * d.value}px` : "",
363
+ margin: l.wrapAround ? `0 -${v.value * c.value}px` : "",
364
364
  width: "100%"
365
365
  };
366
366
  });
367
- function we() {
368
- G(), V(), F(), R(), me();
367
+ function _e() {
368
+ G(), V(), F(), R(), ge();
369
369
  }
370
- Object.keys(Ce).forEach((a) => {
371
- ["modelValue"].includes(a) || ae(() => t[a], we);
372
- }), ae(() => t.modelValue, (a) => {
373
- a !== u.value && O(Number(a));
374
- }), ae(v, F), e("before-init"), G();
375
- const be = {
370
+ Object.keys(Ce).forEach((o) => {
371
+ ["modelValue"].includes(o) || oe(() => t[o], _e);
372
+ }), oe(() => t.modelValue, (o) => {
373
+ o !== u.value && O(Number(o));
374
+ }), oe(v, F), e("before-init"), G();
375
+ const Se = {
376
376
  config: l,
377
377
  slidesCount: v,
378
- slideWidth: d,
378
+ slideWidth: c,
379
379
  next: z,
380
380
  prev: J,
381
381
  slideTo: O,
382
382
  currentSlide: u,
383
- maxSlide: A,
383
+ maxSlide: T,
384
384
  minSlide: D,
385
- middleSlide: w
385
+ middleSlide: _
386
386
  };
387
- o({
387
+ a({
388
388
  updateBreakpointsConfigs: V,
389
389
  updateSlidesData: F,
390
390
  updateSlideWidth: R,
391
391
  initDefaultConfigs: G,
392
- restartCarousel: we,
392
+ restartCarousel: _e,
393
393
  slideTo: O,
394
394
  next: z,
395
395
  prev: J,
396
396
  nav: he,
397
- data: be
397
+ data: Se
398
398
  });
399
- const K = n.default || n.slides, Q = n.addons, Se = L(be);
399
+ const K = n.default || n.slides, Q = n.addons, be = L(Se);
400
400
  return () => {
401
- const a = je(K == null ? void 0 : K(Se)), h = (Q == null ? void 0 : Q(Se)) || [];
402
- a.forEach((ee, te) => ee.props.index = te);
403
- let p = a;
401
+ const o = je(K == null ? void 0 : K(be)), h = (Q == null ? void 0 : Q(be)) || [];
402
+ o.forEach((ee, te) => ee.props.index = te);
403
+ let f = o;
404
404
  if (l.wrapAround) {
405
- const ee = a.map((ne, P) => xe(ne, {
406
- index: -a.length + P,
405
+ const ee = o.map((ne, P) => xe(ne, {
406
+ index: -o.length + P,
407
407
  isClone: !0,
408
408
  key: `clone-before-${P}`
409
- })), te = a.map((ne, P) => xe(ne, {
410
- index: a.length + P,
409
+ })), te = o.map((ne, P) => xe(ne, {
410
+ index: o.length + P,
411
411
  isClone: !0,
412
412
  key: `clone-after-${P}`
413
413
  }));
414
- p = [...ee, ...a, ...te];
414
+ f = [...ee, ...o, ...te];
415
415
  }
416
- g.value = a, v.value = Math.max(a.length, 1);
417
- const T = y("ol", {
416
+ m.value = o, v.value = Math.max(o.length, 1);
417
+ const A = y("ol", {
418
418
  class: "carousel__track",
419
419
  style: Oe.value,
420
420
  onMousedownCapture: l.mouseDrag ? ve : null,
421
421
  onTouchstartPassiveCapture: l.touchDrag ? ve : null
422
- }, p), Z = y("div", { class: "carousel__viewport" }, T);
422
+ }, f), Z = y("div", { class: "carousel__viewport" }, A);
423
423
  return y("section", {
424
- ref: r,
424
+ ref: i,
425
425
  class: {
426
426
  carousel: !0,
427
427
  "is-sliding": N.value,
@@ -451,39 +451,39 @@ function Je(t) {
451
451
  return t in se;
452
452
  }
453
453
  const ue = (t) => {
454
- const n = S("config", L(Object.assign({}, f))), e = String(t.name), o = `icon${e.charAt(0).toUpperCase() + e.slice(1)}`;
454
+ const n = b("config", L(Object.assign({}, p))), e = String(t.name), a = `icon${e.charAt(0).toUpperCase() + e.slice(1)}`;
455
455
  if (!e || typeof e != "string" || !Je(e))
456
456
  return;
457
- const i = qe[e], r = y("path", { d: i }), g = n.i18n[o] || t.title || e, d = y("title", g);
457
+ const r = qe[e], i = y("path", { d: r }), m = n.i18n[a] || t.title || e, c = y("title", m);
458
458
  return y("svg", {
459
459
  class: "carousel__icon",
460
460
  viewBox: "0 0 24 24",
461
461
  role: "img",
462
- "aria-label": g
463
- }, [d, r]);
462
+ "aria-label": m
463
+ }, [c, i]);
464
464
  };
465
465
  ue.props = { name: String, title: String };
466
466
  const Ke = (t, { slots: n, attrs: e }) => {
467
- const { next: o, prev: i } = n || {}, r = S("config", L(Object.assign({}, f))), g = S("maxSlide", c(1)), d = S("minSlide", c(1)), v = S("currentSlide", c(1)), l = S("nav", {}), { dir: _, wrapAround: s, i18n: u } = r, m = _ === "rtl", w = y("button", {
467
+ const { next: a, prev: r } = n || {}, i = b("config", L(Object.assign({}, p))), m = b("maxSlide", d(1)), c = b("minSlide", d(1)), v = b("currentSlide", d(1)), l = b("nav", {}), { dir: w, wrapAround: s, i18n: u } = i, g = w === "rtl", _ = y("button", {
468
468
  type: "button",
469
469
  class: [
470
470
  "carousel__prev",
471
- !s && v.value <= d.value && "carousel__prev--disabled",
471
+ !s && v.value <= c.value && "carousel__prev--disabled",
472
472
  e == null ? void 0 : e.class
473
473
  ],
474
474
  "aria-label": u.ariaPreviousSlide,
475
475
  onClick: l.prev
476
- }, (i == null ? void 0 : i()) || y(ue, { name: m ? "arrowRight" : "arrowLeft" })), A = y("button", {
476
+ }, (r == null ? void 0 : r()) || y(ue, { name: g ? "arrowRight" : "arrowLeft" })), T = y("button", {
477
477
  type: "button",
478
478
  class: [
479
479
  "carousel__next",
480
- !s && v.value >= g.value && "carousel__next--disabled",
480
+ !s && v.value >= m.value && "carousel__next--disabled",
481
481
  e == null ? void 0 : e.class
482
482
  ],
483
483
  "aria-label": u.ariaNextSlide,
484
484
  onClick: l.next
485
- }, (o == null ? void 0 : o()) || y(ue, { name: m ? "arrowLeft" : "arrowRight" }));
486
- return [w, A];
485
+ }, (a == null ? void 0 : a()) || y(ue, { name: g ? "arrowLeft" : "arrowRight" }));
486
+ return [_, T];
487
487
  };
488
488
  var Qe = Y({
489
489
  name: "CarouselSlide",
@@ -498,25 +498,25 @@ var Qe = Y({
498
498
  }
499
499
  },
500
500
  setup(t, { slots: n }) {
501
- const e = S("config", L(Object.assign({}, f))), o = S("currentSlide", c(0)), i = S("slidesToScroll", c(0)), r = S("isSliding", c(!1)), g = () => t.index === o.value, d = () => t.index === o.value - 1, v = () => t.index === o.value + 1, l = () => {
502
- const _ = Math.floor(i.value), s = Math.ceil(i.value + e.itemsToShow - 1);
503
- return t.index >= _ && t.index <= s;
501
+ const e = b("config", L(Object.assign({}, p))), a = b("currentSlide", d(0)), r = b("slidesToScroll", d(0)), i = b("isSliding", d(!1)), m = () => t.index === a.value, c = () => t.index === a.value - 1, v = () => t.index === a.value + 1, l = () => {
502
+ const w = Math.floor(r.value), s = Math.ceil(r.value + e.itemsToShow - 1);
503
+ return t.index >= w && t.index <= s;
504
504
  };
505
505
  return () => {
506
- var _;
506
+ var w;
507
507
  return y("li", {
508
508
  style: { width: `${100 / e.itemsToShow}%` },
509
509
  class: {
510
510
  carousel__slide: !0,
511
511
  "carousel__slide--clone": t.isClone,
512
512
  "carousel__slide--visible": l(),
513
- "carousel__slide--active": g(),
514
- "carousel__slide--prev": d(),
513
+ "carousel__slide--active": m(),
514
+ "carousel__slide--prev": c(),
515
515
  "carousel__slide--next": v(),
516
- "carousel__slide--sliding": r.value
516
+ "carousel__slide--sliding": i.value
517
517
  },
518
518
  "aria-hidden": !l()
519
- }, (_ = n.default) === null || _ === void 0 ? void 0 : _.call(n));
519
+ }, (w = n.default) === null || w === void 0 ? void 0 : w.call(n));
520
520
  };
521
521
  }
522
522
  });
@@ -524,7 +524,7 @@ const Ze = ["src", "title"], et = {
524
524
  key: 0,
525
525
  class: "tw-flex tw-list-none",
526
526
  "data-test": "stash-carousel|pagination-tiles"
527
- }, tt = ["aria-current", "onClick"], nt = ["data-test", "src", "title"], at = /* @__PURE__ */ Y({
527
+ }, tt = ["aria-current", "onClick"], nt = ["data-test", "src", "title"], ot = /* @__PURE__ */ Y({
528
528
  inheritAttrs: !1,
529
529
  __name: "Carousel",
530
530
  props: {
@@ -532,6 +532,8 @@ const Ze = ["src", "title"], et = {
532
532
  autoplayInterval: { default: 0 },
533
533
  hideNavigation: { type: Boolean, default: !1 },
534
534
  hidePagination: { type: Boolean, default: !1 },
535
+ itemsToScroll: { default: 1 },
536
+ itemsToShow: { default: 1 },
535
537
  loop: { type: Boolean, default: !1 },
536
538
  pagination: { default: "tile" },
537
539
  paginationTileRadius: { default: "standard" },
@@ -539,68 +541,78 @@ const Ze = ["src", "title"], et = {
539
541
  roundBorders: { type: Boolean, default: !1 },
540
542
  staticPaginationDots: { type: Boolean, default: !1 }
541
543
  },
542
- emits: ["click", "transition"],
544
+ emits: ["click", "transition", "transition:multi"],
543
545
  setup(t, { expose: n, emit: e }) {
544
- const o = t, i = Be(), r = De(), g = c();
546
+ const a = t, r = Be(), i = De(), m = d();
545
547
  n({
546
548
  next: () => {
547
549
  var s;
548
- return (s = g.value) == null ? void 0 : s.next();
550
+ return (s = m.value) == null ? void 0 : s.next();
549
551
  },
550
552
  prev: () => {
551
553
  var s;
552
- return (s = g.value) == null ? void 0 : s.prev();
554
+ return (s = m.value) == null ? void 0 : s.prev();
553
555
  }
554
556
  });
555
- const d = c(0), v = () => {
556
- _();
557
+ const c = d(0), v = () => {
558
+ w();
557
559
  }, l = () => {
558
- e("click", o.slides[d.value]);
559
- }, _ = () => {
560
- e("transition", o.slides[d.value]);
560
+ e("click", a.slides[c.value]);
561
+ }, w = () => {
562
+ if (a.itemsToShow === 1) {
563
+ e("transition", a.slides[c.value]);
564
+ return;
565
+ }
566
+ const s = a.slides.slice(c.value, c.value + a.itemsToShow);
567
+ e("transition:multi", s);
561
568
  };
562
569
  return (s, u) => (k(), j(B, null, [
563
- Re(b(Fe), Pe({
570
+ Re(S(Fe), Pe({
564
571
  ref_key: "carouselRef",
565
- ref: g,
566
- modelValue: d.value,
567
- "onUpdate:modelValue": u[0] || (u[0] = (m) => d.value = m),
572
+ ref: m,
573
+ modelValue: c.value,
574
+ "onUpdate:modelValue": u[0] || (u[0] = (g) => c.value = g),
568
575
  "aria-live": "polite",
569
576
  "aria-roledescription": "carousel",
570
- class: ["stash-carousel tw-mb-6", b(r).root],
577
+ class: ["stash-carousel tw-mb-6", S(i).root],
571
578
  "data-test": "stash-carousel",
579
+ autoplay: s.autoplayInterval,
572
580
  i18n: {
573
- ariaNextSlide: b(I)("ll.next"),
574
- ariaPreviousSlide: b(I)("ll.previous"),
575
- iconArrowLeft: b(I)("ll.previous"),
576
- iconArrowRight: b(I)("ll.next")
581
+ ariaNextSlide: S(E)("ll.next"),
582
+ ariaPreviousSlide: S(E)("ll.previous"),
583
+ iconArrowLeft: S(E)("ll.previous"),
584
+ iconArrowRight: S(E)("ll.next")
577
585
  },
578
- autoplay: s.autoplayInterval,
586
+ "items-to-scroll": a.itemsToScroll,
587
+ "items-to-show": a.itemsToShow,
579
588
  "pause-autoplay-on-hover": s.pauseAutoplayOnHover,
580
- "wrap-around": o.loop
581
- }, b(i), {
589
+ "wrap-around": a.loop
590
+ }, S(r), {
582
591
  onInit: v,
583
- onSlideEnd: _
592
+ onSlideEnd: w
584
593
  }), {
585
- addons: oe(() => [
586
- o.slides.length > 1 && !o.hideNavigation ? (k(), ke(b(Ke), { key: 0 })) : Ae("", !0)
594
+ addons: ae(() => [
595
+ a.slides.length > 1 && !a.hideNavigation ? (k(), ke(S(Ke), { key: 0 })) : Te("", !0)
587
596
  ]),
588
- default: oe(() => [
589
- (k(!0), j(B, null, le(o.slides, (m, w) => (k(), ke(b(Qe), {
590
- key: m.id,
597
+ default: ae(() => [
598
+ (k(!0), j(B, null, le(a.slides, (g, _) => (k(), ke(S(Qe), {
599
+ key: g.id,
591
600
  "data-test": "stash-carousel|slide",
592
601
  class: "tw-cursor-pointer",
593
602
  onClick: l
594
603
  }, {
595
- default: oe(() => [
604
+ default: ae(() => [
596
605
  Ve(s.$slots, "slide", {
597
- slide: m,
598
- index: w
606
+ slide: g,
607
+ index: _
599
608
  }, () => [
600
- Te("img", {
601
- class: H(["tw-h-full tw-w-full", [{ "tw-rounded": o.roundBorders }]]),
602
- src: m.imageUrl,
603
- title: b(I)("ll.carousel.imageLabel", { index: w + 1, total: s.slides.length })
609
+ Ae("img", {
610
+ class: H(["tw-h-full tw-w-full", [{ "tw-rounded": a.roundBorders }]]),
611
+ src: g.imageUrl,
612
+ title: S(E)("ll.carousel.imageLabel", {
613
+ index: _ + 1,
614
+ total: s.slides.length
615
+ })
604
616
  }, null, 10, Ze)
605
617
  ])
606
618
  ]),
@@ -608,26 +620,26 @@ const Ze = ["src", "title"], et = {
608
620
  }, 1024))), 128))
609
621
  ]),
610
622
  _: 3
611
- }, 16, ["modelValue", "class", "i18n", "autoplay", "pause-autoplay-on-hover", "wrap-around"]),
612
- o.hidePagination ? Ae("", !0) : (k(), j(B, { key: 0 }, [
613
- o.pagination === "tile" ? (k(), j("ul", et, [
614
- (k(!0), j(B, null, le(s.slides, (m, w) => (k(), j("li", {
615
- key: m.imageUrl,
623
+ }, 16, ["modelValue", "autoplay", "class", "i18n", "items-to-scroll", "items-to-show", "pause-autoplay-on-hover", "wrap-around"]),
624
+ a.hidePagination ? Te("", !0) : (k(), j(B, { key: 0 }, [
625
+ a.pagination === "tile" ? (k(), j("ul", et, [
626
+ (k(!0), j(B, null, le(s.slides, (g, _) => (k(), j("li", {
627
+ key: g.imageUrl,
616
628
  class: "tw-mr-3 tw-cursor-pointer",
617
- "aria-current": d.value === w,
618
- onClick: (A) => d.value = w
629
+ "aria-current": c.value === _,
630
+ onClick: (T) => c.value = _
619
631
  }, [
620
- Te("img", {
632
+ Ae("img", {
621
633
  class: H(["tw-rounded", [
622
- b(r)["pagination-tile"],
634
+ S(i)["pagination-tile"],
623
635
  {
624
- "is-current-tile": d.value === w,
625
- "tw-rounded-full": o.paginationTileRadius === "full"
636
+ "is-current-tile": c.value === _,
637
+ "tw-rounded-full": a.paginationTileRadius === "full"
626
638
  }
627
639
  ]]),
628
- "data-test": `stash-carousel|pagination-tile-${w}`,
629
- src: m.imageUrl,
630
- title: b(I)("ll.carousel.paginationLabel", { index: w + 1 })
640
+ "data-test": `stash-carousel|pagination-tile-${_}`,
641
+ src: g.imageUrl,
642
+ title: S(E)("ll.carousel.paginationLabel", { index: _ + 1 })
631
643
  }, null, 10, nt)
632
644
  ], 8, tt))), 128))
633
645
  ])) : (k(), j("ul", {
@@ -635,28 +647,28 @@ const Ze = ["src", "title"], et = {
635
647
  class: H(["tw-text-center", [!s.staticPaginationDots && "lg:tw-hidden"]]),
636
648
  "data-test": "stash-carousel|pagination-dots"
637
649
  }, [
638
- (k(!0), j(B, null, le(s.slides, (m, w) => (k(), j("li", {
639
- key: m.imageUrl,
640
- class: H(["tw-inline-block tw-rounded-full", [b(r)["pagination-dot"], [d.value === w ? "tw-bg-blue-500" : "tw-bg-blue-100"]]])
650
+ (k(!0), j(B, null, le(s.slides, (g, _) => (k(), j("li", {
651
+ key: g.imageUrl,
652
+ class: H(["tw-inline-block tw-rounded-full", [S(i)["pagination-dot"], [c.value === _ ? "tw-bg-blue-500" : "tw-bg-blue-100"]]])
641
653
  }, null, 2))), 128))
642
654
  ], 2))
643
655
  ], 64))
644
656
  ], 64));
645
657
  }
646
- }), ot = "_root_a92j2_2", lt = "_carousel__icon_a92j2_2", rt = "_carousel__next_a92j2_18", it = "_carousel__prev_a92j2_26", st = {
647
- root: ot,
658
+ }), at = "_root_a92j2_2", lt = "_carousel__icon_a92j2_2", it = "_carousel__next_a92j2_18", rt = "_carousel__prev_a92j2_26", st = {
659
+ root: at,
648
660
  carousel__icon: lt,
649
- carousel__next: rt,
661
+ carousel__next: it,
650
662
  "carousel__next--disabled": "_carousel__next--disabled_a92j2_22",
651
- carousel__prev: it,
663
+ carousel__prev: rt,
652
664
  "carousel__prev--disabled": "_carousel__prev--disabled_a92j2_30",
653
665
  "pagination-dot": "_pagination-dot_a92j2_34",
654
666
  "pagination-tile": "_pagination-tile_a92j2_40",
655
667
  "is-current-tile": "_is-current-tile_a92j2_47"
656
668
  }, ut = {
657
669
  $style: st
658
- }, ft = /* @__PURE__ */ $e(at, [["__cssModules", ut]]);
670
+ }, pt = /* @__PURE__ */ $e(ot, [["__cssModules", ut]]);
659
671
  export {
660
- ft as default
672
+ pt as default
661
673
  };
662
674
  //# sourceMappingURL=Carousel.js.map