@wikicasa-dev/components 2.5.3-alpha.15 → 2.5.3-alpha.16

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.
@@ -1,109 +1,97 @@
1
- import { defineComponent as S, useAttrs as O, shallowRef as p, useTemplateRef as k, onMounted as L, provide as v, createElementBlock as B, openBlock as D, Fragment as M, withDirectives as U, renderSlot as f, createCommentVNode as b, createElementVNode as V, mergeProps as x, unref as z, vShow as A, nextTick as G } from "vue";
2
- import { createSwiper as N } from "../../../../../../Swiper/factory.js";
3
- import { AutoplayModule as C } from "../../../../../../Swiper/Autoplay/factory.js";
4
- import { KeyboardModule as K } from "../../../../../../Swiper/Keyboard/factory.js";
5
- import { ZoomModule as R } from "../../../../../../Swiper/Zoom/factory.js";
6
- const $ = /* @__PURE__ */ Symbol(), q = /* @__PURE__ */ Symbol(), W = /* @__PURE__ */ S({
1
+ import { defineComponent as b, useAttrs as g, shallowRef as f, useTemplateRef as L, onMounted as V, provide as y, createElementBlock as x, openBlock as z, Fragment as A, withDirectives as N, renderSlot as w, createCommentVNode as B, createElementVNode as C, mergeProps as D, unref as U, vShow as K, nextTick as R } from "vue";
2
+ import { createSwiper as $ } from "../../../../../../Swiper/factory.js";
3
+ import { AutoplayModule as q } from "../../../../../../Swiper/Autoplay/factory.js";
4
+ import { KeyboardModule as F } from "../../../../../../Swiper/Keyboard/factory.js";
5
+ import { ZoomModule as G } from "../../../../../../Swiper/Zoom/factory.js";
6
+ const Z = /* @__PURE__ */ Symbol(), j = /* @__PURE__ */ Symbol(), _ = /* @__PURE__ */ b({
7
7
  inheritAttrs: !1,
8
8
  __name: "SwiperRootPrimitive",
9
9
  props: {
10
10
  swiperOptions: {}
11
11
  },
12
12
  emits: ["moved", "click", "init"],
13
- setup(s, { expose: y, emit: w }) {
14
- const n = w, g = O(), a = p(null), c = k("root"), l = p(!1), T = !!s.swiperOptions?.keyboard, E = !!s.swiperOptions?.autoplay, u = [];
15
- let d = !1;
16
- const I = (e) => {
17
- const t = [
18
- ...e?.querySelectorAll("img[data-src]") ?? []
19
- ];
20
- return t.forEach((o) => {
21
- o.src = o.dataset.src || "", o.srcset = o.dataset.srcset || "", o.dataset.src = "", o.dataset.srcset = "", o.removeAttribute("lazy");
22
- }), t;
23
- }, m = (e, t) => {
24
- const o = [];
25
- if (!d) return o;
26
- const r = e.params.lazyPreloadPrevNext ?? 0;
27
- for (let i = t - r; i <= t + r; i++)
28
- o.push(...I(e.slides[i]));
29
- return o;
30
- }, P = async (e) => {
31
- a.value = await N(
13
+ setup(r, { expose: I, emit: P }) {
14
+ const l = P, T = g(), s = f(null), d = L("root"), i = f(!1), h = !!r.swiperOptions?.keyboard, S = !!r.swiperOptions?.autoplay, u = [];
15
+ let c = !1;
16
+ const E = (e) => [
17
+ ...e?.querySelectorAll("img[data-src]") ?? []
18
+ ], m = (e) => {
19
+ e.src = e.dataset.src || "", e.srcset = e.dataset.srcset || "", e.dataset.src = "", e.dataset.srcset = "", e.removeAttribute("lazy");
20
+ }, p = (e, t) => {
21
+ if (!c) return [];
22
+ const a = e.params.lazyPreloadPrevNext ?? 0, n = [];
23
+ for (let o = t - a; o <= t + a; o++)
24
+ n.push(...E(e.slides[o]));
25
+ return n;
26
+ }, O = async (e) => {
27
+ s.value = await $(
32
28
  e,
33
29
  {
34
30
  on: {
35
31
  init: (t) => {
36
- G(async () => {
37
- const o = m(t, t.activeIndex);
38
- if (console.log("DEBUG:imagesToLoad", o), !o.length) {
39
- l.value = !0, n("init");
32
+ R(async () => {
33
+ const a = p(t, t.activeIndex);
34
+ if (!a.length) {
35
+ i.value = !0, l("init");
40
36
  return;
41
37
  }
38
+ const n = a.map((o) => {
39
+ const M = o.complete ? Promise.resolve() : new Promise((v) => {
40
+ o.addEventListener("load", () => v(), { once: !0 }), o.addEventListener("error", () => v(), { once: !0 });
41
+ });
42
+ return m(o), M;
43
+ });
42
44
  await Promise.race([
43
- Promise.all(
44
- o.map((r) => r.complete ? (console.log("DEBUG:img.complete", r), Promise.resolve()) : new Promise((i) => {
45
- r.addEventListener(
46
- "load",
47
- () => {
48
- console.log("DEBUG:img.load", r), i("");
49
- },
50
- { once: !0 }
51
- ), r.addEventListener(
52
- "error",
53
- () => {
54
- console.log("DEBUG:img.error", r), i("");
55
- },
56
- { once: !0 }
57
- );
58
- }))
59
- ),
45
+ Promise.all(n),
60
46
  new Promise(
61
- (r) => setTimeout(() => {
62
- console.log("DEBUG:not all images have loaded => TIMEOUT!"), r("");
47
+ (o) => setTimeout(() => {
48
+ console.log("DEBUG:not all images have loaded => TIMEOUT!"), o("");
63
49
  }, 6e3)
64
50
  )
65
- ]), l.value = !0, n("init");
51
+ ]), i.value = !0, l("init");
66
52
  });
67
53
  },
68
54
  slideChange: (t) => {
69
- n("moved", { activeIndex: t.activeIndex }), m(t, t.activeIndex);
55
+ l("moved", { activeIndex: t.activeIndex }), p(t, t.activeIndex).forEach(
56
+ m
57
+ );
70
58
  }
71
59
  },
72
- ...s.swiperOptions
60
+ ...r.swiperOptions
73
61
  },
74
62
  [
75
- R(s.swiperOptions?.zoom),
76
- T ? K(s.swiperOptions?.keyboard) : void 0,
77
- E ? C(s.swiperOptions.autoplay) : void 0,
63
+ G(r.swiperOptions?.zoom),
64
+ h ? F(r.swiperOptions?.keyboard) : void 0,
65
+ S ? q(r.swiperOptions.autoplay) : void 0,
78
66
  ...u
79
67
  ].filter(Boolean)
80
68
  );
81
69
  };
82
- L(() => {
83
- c.value && setTimeout(() => P(c.value));
70
+ V(() => {
71
+ d.value && setTimeout(() => O(d.value));
84
72
  });
85
- const h = (e) => {
86
- !a.value || a.value.params.slidesPerView === e || (a.value.params.slidesPerView = e, a.value.update());
73
+ const k = (e) => {
74
+ !s.value || s.value.params.slidesPerView === e || (s.value.params.slidesPerView = e, s.value.update());
87
75
  };
88
- return v(q, (e) => {
76
+ return y(j, (e) => {
89
77
  e && u.push(e);
90
- }), v($, (e) => {
91
- e !== d && (d = e);
92
- }), y({
93
- swiper: a,
94
- updateSlidesPerView: h
95
- }), (e, t) => (D(), B(M, null, [
96
- U(V("div", x({ ref: "root" }, z(g), { class: "swiper uikit-carousel" }), [
97
- f(e.$slots, "default")
78
+ }), y(Z, (e) => {
79
+ e !== c && (c = e);
80
+ }), I({
81
+ swiper: s,
82
+ updateSlidesPerView: k
83
+ }), (e, t) => (z(), x(A, null, [
84
+ N(C("div", D({ ref: "root" }, U(T), { class: "swiper uikit-carousel" }), [
85
+ w(e.$slots, "default")
98
86
  ], 16), [
99
- [A, l.value]
87
+ [K, i.value]
100
88
  ]),
101
- l.value ? b("", !0) : f(e.$slots, "placeholder", { key: 0 })
89
+ i.value ? B("", !0) : w(e.$slots, "placeholder", { key: 0 })
102
90
  ], 64));
103
91
  }
104
92
  });
105
93
  export {
106
- q as addModuleDescriptorKey,
107
- W as default,
108
- $ as setLazyImagesLoaderKey
94
+ j as addModuleDescriptorKey,
95
+ _ as default,
96
+ Z as setLazyImagesLoaderKey
109
97
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.5.3-alpha.15",
3
+ "version": "2.5.3-alpha.16",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",