@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.
package/dist/packages/components/lib/components/carousel/Primitive/SwiperRootPrimitive.vue.js
CHANGED
|
@@ -1,109 +1,97 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { createSwiper as
|
|
3
|
-
import { AutoplayModule as
|
|
4
|
-
import { KeyboardModule as
|
|
5
|
-
import { ZoomModule as
|
|
6
|
-
const
|
|
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(
|
|
14
|
-
const
|
|
15
|
-
let
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
|
|
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
|
-
(
|
|
62
|
-
console.log("DEBUG:not all images have loaded => TIMEOUT!"),
|
|
47
|
+
(o) => setTimeout(() => {
|
|
48
|
+
console.log("DEBUG:not all images have loaded => TIMEOUT!"), o("");
|
|
63
49
|
}, 6e3)
|
|
64
50
|
)
|
|
65
|
-
]),
|
|
51
|
+
]), i.value = !0, l("init");
|
|
66
52
|
});
|
|
67
53
|
},
|
|
68
54
|
slideChange: (t) => {
|
|
69
|
-
|
|
55
|
+
l("moved", { activeIndex: t.activeIndex }), p(t, t.activeIndex).forEach(
|
|
56
|
+
m
|
|
57
|
+
);
|
|
70
58
|
}
|
|
71
59
|
},
|
|
72
|
-
...
|
|
60
|
+
...r.swiperOptions
|
|
73
61
|
},
|
|
74
62
|
[
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
83
|
-
|
|
70
|
+
V(() => {
|
|
71
|
+
d.value && setTimeout(() => O(d.value));
|
|
84
72
|
});
|
|
85
|
-
const
|
|
86
|
-
!
|
|
73
|
+
const k = (e) => {
|
|
74
|
+
!s.value || s.value.params.slidesPerView === e || (s.value.params.slidesPerView = e, s.value.update());
|
|
87
75
|
};
|
|
88
|
-
return
|
|
76
|
+
return y(j, (e) => {
|
|
89
77
|
e && u.push(e);
|
|
90
|
-
}),
|
|
91
|
-
e !==
|
|
92
|
-
}),
|
|
93
|
-
swiper:
|
|
94
|
-
updateSlidesPerView:
|
|
95
|
-
}), (e, t) => (
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
[
|
|
87
|
+
[K, i.value]
|
|
100
88
|
]),
|
|
101
|
-
|
|
89
|
+
i.value ? B("", !0) : w(e.$slots, "placeholder", { key: 0 })
|
|
102
90
|
], 64));
|
|
103
91
|
}
|
|
104
92
|
});
|
|
105
93
|
export {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
j as addModuleDescriptorKey,
|
|
95
|
+
_ as default,
|
|
96
|
+
Z as setLazyImagesLoaderKey
|
|
109
97
|
};
|