@leaflink/stash 52.0.1 → 52.0.3

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,4 +1,4 @@
1
- import { defineComponent as F, inject as b, reactive as j, ref as d, h as _, provide as M, onMounted as Ie, nextTick as Le, onUnmounted as Ee, computed as D, watch as ae, cloneVNode as Te, Fragment as B, useAttrs as je, useCssModule as Be, createElementBlock as E, openBlock as k, createVNode as De, createCommentVNode as ke, mergeProps as Re, unref as N, withCtx as G, renderList as le, createBlock as W, renderSlot as Pe, createElementVNode as Ve, normalizeClass as ie } from "vue";
1
+ import { defineComponent as F, inject as b, reactive as j, ref as d, h as S, provide as M, onMounted as Ie, nextTick as Le, onUnmounted as Ee, computed as D, watch as ae, cloneVNode as ke, Fragment as B, useAttrs as je, useCssModule as Be, createElementBlock as E, openBlock as _, createVNode as De, createCommentVNode as _e, mergeProps as Re, unref as N, withCtx as G, renderList as le, createBlock as W, renderSlot as Pe, createElementVNode as Ve, normalizeClass as ie } from "vue";
2
2
  import { t as V } from "./locale.js";
3
3
  import Ue from "./Thumbnail.js";
4
4
  import $e from "./ThumbnailGroup.js";
@@ -221,7 +221,7 @@ var qe = F({
221
221
  name: "ARIA",
222
222
  setup() {
223
223
  const e = b("config", j(Object.assign({}, p))), n = b("currentSlide", d(0)), t = b("slidesCount", d(0));
224
- return () => _("div", {
224
+ return () => S("div", {
225
225
  class: ["carousel__liveregion", "carousel__sr-only"],
226
226
  "aria-live": "polite",
227
227
  "aria-atomic": "true"
@@ -236,21 +236,21 @@ var qe = F({
236
236
  setup(e, { slots: n, emit: t, expose: a }) {
237
237
  var r;
238
238
  const i = d(null), v = d([]), m = d(0), s = d(0), l = j(Object.assign({}, p));
239
- let g = Object.assign({}, p), S;
240
- const c = d((r = e.modelValue) !== null && r !== void 0 ? r : 0), A = d(0), u = d(0), y = d(0), w = d(0);
241
- let T, q;
242
- M("config", l), M("slidesCount", s), M("currentSlide", c), M("maxSlide", y), M("minSlide", w), M("slideWidth", m);
239
+ let g = Object.assign({}, p), y;
240
+ const c = d((r = e.modelValue) !== null && r !== void 0 ? r : 0), A = d(0), u = d(0), x = d(0), w = d(0);
241
+ let k, q;
242
+ M("config", l), M("slidesCount", s), M("currentSlide", c), M("maxSlide", x), M("minSlide", w), M("slideWidth", m);
243
243
  function J() {
244
- S = Object.assign({}, e.breakpoints), g = Object.assign(Object.assign(Object.assign({}, g), e), { i18n: Object.assign(Object.assign({}, g.i18n), e.i18n), breakpoints: void 0 }), de(g);
244
+ y = Object.assign({}, e.breakpoints), g = Object.assign(Object.assign(Object.assign({}, g), e), { i18n: Object.assign(Object.assign({}, g.i18n), e.i18n), breakpoints: void 0 }), de(g);
245
245
  }
246
246
  function U() {
247
- if (!S || !Object.keys(S).length)
247
+ if (!y || !Object.keys(y).length)
248
248
  return;
249
- const o = Object.keys(S).map((f) => Number(f)).sort((f, C) => +C - +f);
249
+ const o = Object.keys(y).map((f) => Number(f)).sort((f, C) => +C - +f);
250
250
  let h = Object.assign({}, g);
251
251
  o.some((f) => {
252
252
  const C = window.matchMedia(`(min-width: ${f}px)`).matches;
253
- return C && (h = Object.assign(Object.assign({}, h), S[f])), C;
253
+ return C && (h = Object.assign(Object.assign({}, h), y[f])), C;
254
254
  }), de(h);
255
255
  }
256
256
  function de(o) {
@@ -266,56 +266,56 @@ var qe = F({
266
266
  m.value = o.width / l.itemsToShow;
267
267
  }
268
268
  function $() {
269
- s.value <= 0 || (u.value = Math.ceil((s.value - 1) / 2), y.value = Xe({ config: l, slidesCount: s.value }), w.value = He({ config: l, slidesCount: s.value }), l.wrapAround || (c.value = re({
269
+ s.value <= 0 || (u.value = Math.ceil((s.value - 1) / 2), x.value = Xe({ config: l, slidesCount: s.value }), w.value = He({ config: l, slidesCount: s.value }), l.wrapAround || (c.value = re({
270
270
  val: c.value,
271
- max: y.value,
271
+ max: x.value,
272
272
  min: w.value
273
273
  })));
274
274
  }
275
275
  Ie(() => {
276
276
  Le(() => R()), setTimeout(() => R(), 1e3), U(), ge(), window.addEventListener("resize", ve, { passive: !0 }), t("init");
277
277
  }), Ee(() => {
278
- q && clearTimeout(q), T && clearInterval(T), window.removeEventListener("resize", ve, {
278
+ q && clearTimeout(q), k && clearInterval(k), window.removeEventListener("resize", ve, {
279
279
  passive: !0
280
280
  });
281
281
  });
282
- let x = !1;
282
+ let T = !1;
283
283
  const z = { x: 0, y: 0 }, X = { x: 0, y: 0 }, O = j({ x: 0, y: 0 }), H = d(!1), K = d(!1), Me = () => {
284
284
  H.value = !0;
285
285
  }, Ne = () => {
286
286
  H.value = !1;
287
287
  };
288
288
  function fe(o) {
289
- ["INPUT", "TEXTAREA", "SELECT"].includes(o.target.tagName) || (x = o.type === "touchstart", x || o.preventDefault(), !(!x && o.button !== 0 || I.value) && (z.x = x ? o.touches[0].clientX : o.clientX, z.y = x ? o.touches[0].clientY : o.clientY, document.addEventListener(x ? "touchmove" : "mousemove", pe, !0), document.addEventListener(x ? "touchend" : "mouseup", me, !0)));
289
+ ["INPUT", "TEXTAREA", "SELECT"].includes(o.target.tagName) || (T = o.type === "touchstart", T || o.preventDefault(), !(!T && o.button !== 0 || I.value) && (z.x = T ? o.touches[0].clientX : o.clientX, z.y = T ? o.touches[0].clientY : o.clientY, document.addEventListener(T ? "touchmove" : "mousemove", pe, !0), document.addEventListener(T ? "touchend" : "mouseup", me, !0)));
290
290
  }
291
291
  const pe = Ge((o) => {
292
- K.value = !0, X.x = x ? o.touches[0].clientX : o.clientX, X.y = x ? o.touches[0].clientY : o.clientY;
292
+ K.value = !0, X.x = T ? o.touches[0].clientX : o.clientX, X.y = T ? o.touches[0].clientY : o.clientY;
293
293
  const h = X.x - z.x, f = X.y - z.y;
294
294
  O.y = f, O.x = h;
295
295
  }, l.throttle);
296
296
  function me() {
297
297
  const o = l.dir === "rtl" ? -1 : 1, h = Math.sign(O.x) * 0.4, f = Math.round(O.x / m.value + h) * o;
298
- if (f && !x) {
299
- const C = (xe) => {
298
+ if (f && !T) {
299
+ const C = (Te) => {
300
300
  window.removeEventListener("click", C, !0);
301
301
  };
302
302
  window.addEventListener("click", C, !0);
303
303
  }
304
- L(c.value - f), O.x = 0, O.y = 0, K.value = !1, document.removeEventListener(x ? "touchmove" : "mousemove", pe, !0), document.removeEventListener(x ? "touchend" : "mouseup", me, !0);
304
+ L(c.value - f), O.x = 0, O.y = 0, K.value = !1, document.removeEventListener(T ? "touchmove" : "mousemove", pe, !0), document.removeEventListener(T ? "touchend" : "mouseup", me, !0);
305
305
  }
306
306
  function ge() {
307
- !l.autoplay || l.autoplay <= 0 || (T = setInterval(() => {
307
+ !l.autoplay || l.autoplay <= 0 || (k = setInterval(() => {
308
308
  l.pauseAutoplayOnHover && H.value || Y();
309
309
  }, l.autoplay));
310
310
  }
311
311
  function he() {
312
- T && (clearInterval(T), T = null), ge();
312
+ k && (clearInterval(k), k = null), ge();
313
313
  }
314
314
  const I = d(!1);
315
315
  function L(o) {
316
316
  const h = l.wrapAround ? o : re({
317
317
  val: o,
318
- max: y.value,
318
+ max: x.value,
319
319
  min: w.value
320
320
  });
321
321
  c.value === h || I.value || (t("slide-start", {
@@ -327,7 +327,7 @@ var qe = F({
327
327
  if (l.wrapAround) {
328
328
  const f = se({
329
329
  val: h,
330
- max: y.value,
330
+ max: x.value,
331
331
  min: 0
332
332
  });
333
333
  f !== c.value && (c.value = f, t("loop", {
@@ -365,15 +365,15 @@ var qe = F({
365
365
  width: "100%"
366
366
  };
367
367
  });
368
- function _e() {
368
+ function Se() {
369
369
  J(), U(), $(), R(), he();
370
370
  }
371
371
  Object.keys(Ae).forEach((o) => {
372
- ["modelValue"].includes(o) || ae(() => e[o], _e);
372
+ ["modelValue"].includes(o) || ae(() => e[o], Se);
373
373
  }), ae(() => e.modelValue, (o) => {
374
374
  o !== c.value && L(Number(o));
375
375
  }), ae(s, $), t("before-init"), J();
376
- const Se = {
376
+ const ye = {
377
377
  config: l,
378
378
  slidesCount: s,
379
379
  slideWidth: m,
@@ -381,7 +381,7 @@ var qe = F({
381
381
  prev: Q,
382
382
  slideTo: L,
383
383
  currentSlide: c,
384
- maxSlide: y,
384
+ maxSlide: x,
385
385
  minSlide: w,
386
386
  middleSlide: u
387
387
  };
@@ -390,24 +390,24 @@ var qe = F({
390
390
  updateSlidesData: $,
391
391
  updateSlideWidth: R,
392
392
  initDefaultConfigs: J,
393
- restartCarousel: _e,
393
+ restartCarousel: Se,
394
394
  slideTo: L,
395
395
  next: Y,
396
396
  prev: Q,
397
397
  nav: we,
398
- data: Se
398
+ data: ye
399
399
  });
400
- const Z = n.default || n.slides, ee = n.addons, ye = j(Se);
400
+ const Z = n.default || n.slides, ee = n.addons, xe = j(ye);
401
401
  return () => {
402
- const o = Ce(Z == null ? void 0 : Z(ye)), h = (ee == null ? void 0 : ee(ye)) || [];
402
+ const o = Ce(Z == null ? void 0 : Z(xe)), h = (ee == null ? void 0 : ee(xe)) || [];
403
403
  o.forEach((te, ne) => te.props.index = ne);
404
404
  let f = o;
405
405
  if (l.wrapAround) {
406
- const te = o.map((oe, P) => Te(oe, {
406
+ const te = o.map((oe, P) => ke(oe, {
407
407
  index: -o.length + P,
408
408
  isClone: !0,
409
409
  key: `clone-before-${P}`
410
- })), ne = o.map((oe, P) => Te(oe, {
410
+ })), ne = o.map((oe, P) => ke(oe, {
411
411
  index: o.length + P,
412
412
  isClone: !0,
413
413
  key: `clone-after-${P}`
@@ -415,13 +415,13 @@ var qe = F({
415
415
  f = [...te, ...o, ...ne];
416
416
  }
417
417
  v.value = o, s.value = Math.max(o.length, 1);
418
- const C = _("ol", {
418
+ const C = S("ol", {
419
419
  class: "carousel__track",
420
420
  style: Oe.value,
421
421
  onMousedownCapture: l.mouseDrag ? fe : null,
422
422
  onTouchstartPassiveCapture: l.touchDrag ? fe : null
423
- }, f), xe = _("div", { class: "carousel__viewport" }, C);
424
- return _("section", {
423
+ }, f), Te = S("div", { class: "carousel__viewport" }, C);
424
+ return S("section", {
425
425
  ref: i,
426
426
  class: {
427
427
  carousel: !0,
@@ -435,7 +435,7 @@ var qe = F({
435
435
  tabindex: "0",
436
436
  onMouseenter: Me,
437
437
  onMouseleave: Ne
438
- }, [xe, h, _(qe)]);
438
+ }, [Te, h, S(qe)]);
439
439
  };
440
440
  }
441
441
  }), ue;
@@ -455,8 +455,8 @@ const ce = (e) => {
455
455
  const n = b("config", j(Object.assign({}, p))), t = String(e.name), a = `icon${t.charAt(0).toUpperCase() + t.slice(1)}`;
456
456
  if (!t || typeof t != "string" || !Qe(t))
457
457
  return;
458
- const r = Ke[t], i = _("path", { d: r }), v = n.i18n[a] || e.title || t, m = _("title", v);
459
- return _("svg", {
458
+ const r = Ke[t], i = S("path", { d: r }), v = n.i18n[a] || e.title || t, m = S("title", v);
459
+ return S("svg", {
460
460
  class: "carousel__icon",
461
461
  viewBox: "0 0 24 24",
462
462
  role: "img",
@@ -465,26 +465,26 @@ const ce = (e) => {
465
465
  };
466
466
  ce.props = { name: String, title: String };
467
467
  const Ze = (e, { slots: n, attrs: t }) => {
468
- const { next: a, prev: r } = n || {}, i = b("config", j(Object.assign({}, p))), v = b("maxSlide", d(1)), m = b("minSlide", d(1)), s = b("currentSlide", d(1)), l = b("nav", {}), { dir: g, wrapAround: S, i18n: c } = i, A = g === "rtl", u = _("button", {
468
+ const { next: a, prev: r } = n || {}, i = b("config", j(Object.assign({}, p))), v = b("maxSlide", d(1)), m = b("minSlide", d(1)), s = b("currentSlide", d(1)), l = b("nav", {}), { dir: g, wrapAround: y, i18n: c } = i, A = g === "rtl", u = S("button", {
469
469
  type: "button",
470
470
  class: [
471
471
  "carousel__prev",
472
- !S && s.value <= m.value && "carousel__prev--disabled",
472
+ !y && s.value <= m.value && "carousel__prev--disabled",
473
473
  t == null ? void 0 : t.class
474
474
  ],
475
475
  "aria-label": c.ariaPreviousSlide,
476
476
  onClick: l.prev
477
- }, (r == null ? void 0 : r()) || _(ce, { name: A ? "arrowRight" : "arrowLeft" })), y = _("button", {
477
+ }, (r == null ? void 0 : r()) || S(ce, { name: A ? "arrowRight" : "arrowLeft" })), x = S("button", {
478
478
  type: "button",
479
479
  class: [
480
480
  "carousel__next",
481
- !S && s.value >= v.value && "carousel__next--disabled",
481
+ !y && s.value >= v.value && "carousel__next--disabled",
482
482
  t == null ? void 0 : t.class
483
483
  ],
484
484
  "aria-label": c.ariaNextSlide,
485
485
  onClick: l.next
486
- }, (a == null ? void 0 : a()) || _(ce, { name: A ? "arrowLeft" : "arrowRight" }));
487
- return [u, y];
486
+ }, (a == null ? void 0 : a()) || S(ce, { name: A ? "arrowLeft" : "arrowRight" }));
487
+ return [u, x];
488
488
  };
489
489
  var et = F({
490
490
  name: "CarouselSlide",
@@ -500,12 +500,12 @@ var et = F({
500
500
  },
501
501
  setup(e, { slots: n }) {
502
502
  const t = b("config", j(Object.assign({}, p))), a = b("currentSlide", d(0)), r = b("slidesToScroll", d(0)), i = b("isSliding", d(!1)), v = D(() => e.index === a.value), m = D(() => e.index === a.value - 1), s = D(() => e.index === a.value + 1), l = D(() => {
503
- const g = Math.floor(r.value), S = Math.ceil(r.value + t.itemsToShow - 1);
504
- return e.index >= g && e.index <= S;
503
+ const g = Math.floor(r.value), y = Math.ceil(r.value + t.itemsToShow - 1);
504
+ return e.index >= g && e.index <= y;
505
505
  });
506
506
  return () => {
507
507
  var g;
508
- return _("li", {
508
+ return S("li", {
509
509
  style: { width: `${100 / t.itemsToShow}%` },
510
510
  class: {
511
511
  carousel__slide: !0,
@@ -549,12 +549,12 @@ const tt = ["src", "title"], nt = /* @__PURE__ */ F({
549
549
  setup(e, { expose: n, emit: t }) {
550
550
  const a = e, r = je(), i = Be(), v = d(), m = t, s = d(0);
551
551
  function l(...u) {
552
- const [y] = u;
553
- y !== void 0 && g(y);
552
+ const [x] = u;
553
+ x !== void 0 && g(x);
554
554
  }
555
555
  const g = (u) => {
556
556
  s.value = u;
557
- }, S = () => {
557
+ }, y = () => {
558
558
  A();
559
559
  }, c = () => {
560
560
  m("click", a.slides[s.value]);
@@ -576,7 +576,7 @@ const tt = ["src", "title"], nt = /* @__PURE__ */ F({
576
576
  return (u = v.value) == null ? void 0 : u.prev();
577
577
  },
578
578
  slideTo: g
579
- }), (u, y) => (k(), E(B, null, [
579
+ }), (u, x) => (_(), E(B, null, [
580
580
  De(Je, Re({
581
581
  ref_key: "carouselRef",
582
582
  ref: v,
@@ -597,15 +597,15 @@ const tt = ["src", "title"], nt = /* @__PURE__ */ F({
597
597
  "pause-autoplay-on-hover": u.pauseAutoplayOnHover,
598
598
  "wrap-around": a.loop
599
599
  }, N(r), {
600
- onInit: S,
600
+ onInit: y,
601
601
  onSlideEnd: A,
602
602
  "onUpdate:modelValue": l
603
603
  }), {
604
604
  addons: G(() => [
605
- a.slides.length > 1 && !a.hideNavigation ? (k(), W(Ze, { key: 0 })) : ke("", !0)
605
+ a.slides.length > 1 && !a.hideNavigation ? (_(), W(Ze, { key: 0 })) : _e("", !0)
606
606
  ]),
607
607
  default: G(() => [
608
- (k(!0), E(B, null, le(a.slides, (w, T) => (k(), W(et, {
608
+ (_(!0), E(B, null, le(a.slides, (w, k) => (_(), W(et, {
609
609
  key: w.id,
610
610
  "data-test": "stash-carousel|slide",
611
611
  class: "tw-cursor-pointer",
@@ -614,13 +614,13 @@ const tt = ["src", "title"], nt = /* @__PURE__ */ F({
614
614
  default: G(() => [
615
615
  Pe(u.$slots, "slide", {
616
616
  slide: w,
617
- index: T
617
+ index: k
618
618
  }, () => [
619
619
  Ve("img", {
620
620
  class: ie(["tw-size-full", [{ "tw-rounded": a.roundBorders }]]),
621
621
  src: w.imageUrl,
622
622
  title: N(V)("ll.carousel.imageLabel", {
623
- index: T + 1,
623
+ index: k + 1,
624
624
  total: u.slides.length
625
625
  })
626
626
  }, null, 10, tt)
@@ -631,8 +631,8 @@ const tt = ["src", "title"], nt = /* @__PURE__ */ F({
631
631
  ]),
632
632
  _: 3
633
633
  }, 16, ["model-value", "autoplay", "class", "i18n", "items-to-scroll", "items-to-show", "pause-autoplay-on-hover", "wrap-around"]),
634
- a.hidePagination ? ke("", !0) : (k(), E(B, { key: 0 }, [
635
- a.pagination === "tile" ? (k(), W($e, {
634
+ a.hidePagination ? _e("", !0) : (_(), E(B, { key: 0 }, [
635
+ a.pagination === "tile" ? (_(), W($e, {
636
636
  key: 0,
637
637
  "active-thumbnail": s.value,
638
638
  thumbnails: u.slides,
@@ -640,38 +640,33 @@ const tt = ["src", "title"], nt = /* @__PURE__ */ F({
640
640
  "onUpdate:activeThumbnail": g
641
641
  }, {
642
642
  default: G(() => [
643
- (k(!0), E(B, null, le(u.slides, (w) => (k(), W(Ue, {
643
+ (_(!0), E(B, null, le(u.slides, (w) => (_(), W(Ue, {
644
644
  key: w.id,
645
645
  thumbnail: w,
646
646
  variant: "translucent"
647
647
  }, null, 8, ["thumbnail"]))), 128))
648
648
  ]),
649
649
  _: 1
650
- }, 8, ["active-thumbnail", "thumbnails", "radius"])) : (k(), E("ul", {
650
+ }, 8, ["active-thumbnail", "thumbnails", "radius"])) : (_(), E("ul", {
651
651
  key: 1,
652
652
  class: ie(["tw-text-center", [!u.staticPaginationDots && "lg:tw-hidden"]]),
653
653
  "data-test": "stash-carousel|pagination-dots"
654
654
  }, [
655
- (k(!0), E(B, null, le(u.slides, (w, T) => (k(), E("li", {
655
+ (_(!0), E(B, null, le(u.slides, (w, k) => (_(), E("li", {
656
656
  key: w.imageUrl,
657
- class: ie(["tw-inline-block tw-rounded-full", [N(i)["pagination-dot"], [s.value === T ? "tw-bg-blue-500" : "tw-bg-blue-100"]]])
657
+ class: ie(["tw-inline-block tw-rounded-full", [N(i)["pagination-dot"], [s.value === k ? "tw-bg-blue-500" : "tw-bg-blue-100"]]])
658
658
  }, null, 2))), 128))
659
659
  ], 2))
660
660
  ], 64))
661
661
  ], 64));
662
662
  }
663
- }), ot = "_root_4piw3_2", at = "_carousel__icon_4piw3_2", lt = "_carousel__next_4piw3_18", it = "_carousel__prev_4piw3_26", rt = {
663
+ }), ot = "_root_15vkg_2", at = {
664
664
  root: ot,
665
- carousel__icon: at,
666
- carousel__next: lt,
667
- "carousel__next--disabled": "_carousel__next--disabled_4piw3_22",
668
- carousel__prev: it,
669
- "carousel__prev--disabled": "_carousel__prev--disabled_4piw3_30",
670
- "pagination-dot": "_pagination-dot_4piw3_34"
671
- }, st = {
672
- $style: rt
673
- }, pt = /* @__PURE__ */ ze(nt, [["__cssModules", st]]);
665
+ "pagination-dot": "_pagination-dot_15vkg_34"
666
+ }, lt = {
667
+ $style: at
668
+ }, dt = /* @__PURE__ */ ze(nt, [["__cssModules", lt]]);
674
669
  export {
675
- pt as default
670
+ dt as default
676
671
  };
677
672
  //# sourceMappingURL=Carousel.js.map