@wikicasa-dev/components 2.5.3-alpha.23 → 2.5.3-alpha.25

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