@wikicasa-dev/components 2.4.2-alpha.9 → 2.5.1-alpha.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.
@@ -1,13 +1,13 @@
1
- import { defineComponent as W, shallowRef as z, useTemplateRef as C, useId as X, computed as Y, onMounted as x, watch as _, nextTick as M, createElementBlock as n, openBlock as l, normalizeClass as d, createElementVNode as p, createCommentVNode as $, unref as ee, renderSlot as L, Fragment as k, renderList as V, mergeProps as B, withModifiers as O } from "vue";
2
- import { createSwiper as R } from "../../../../../Swiper/factory.js";
3
- import { AutoplayModule as te } from "../../../../../Swiper/Autoplay/factory.js";
4
- import { FreemodeModule as se } from "../../../../../Swiper/FreeMode/factory.js";
5
- import { KeyboardModule as ie } from "../../../../../Swiper/Keyboard/factory.js";
6
- import { NavigationModule as re } from "../../../../../Swiper/Navigation/factory.js";
7
- import { PaginationModule as ae } from "../../../../../Swiper/Pagination/factory.js";
8
- import { ThumbsModule as oe } from "../../../../../Swiper/Thumbs/factory.js";
9
- import { ZoomModule as ne } from "../../../../../Swiper/Zoom/factory.js";
10
- const le = ["id", "data-cy"], de = ["data-idx", "alt", "width", "height", "onLoad"], ue = ["id"], ce = ["alt"], ye = /* @__PURE__ */ W({
1
+ import { defineComponent as W, shallowRef as L, useTemplateRef as V, useId as X, computed as Y, onMounted as x, watch as _, nextTick as S, createElementBlock as n, openBlock as l, Fragment as $, withDirectives as ee, renderSlot as I, createCommentVNode as h, createElementVNode as f, normalizeClass as u, unref as te, renderList as R, mergeProps as T, withModifiers as P, vShow as ie } from "vue";
2
+ import { createSwiper as B } from "../../../../../Swiper/factory.js";
3
+ import { AutoplayModule as se } from "../../../../../Swiper/Autoplay/factory.js";
4
+ import { FreemodeModule as ae } from "../../../../../Swiper/FreeMode/factory.js";
5
+ import { KeyboardModule as re } from "../../../../../Swiper/Keyboard/factory.js";
6
+ import { NavigationModule as oe } from "../../../../../Swiper/Navigation/factory.js";
7
+ import { PaginationModule as ne } from "../../../../../Swiper/Pagination/factory.js";
8
+ import { ThumbsModule as le } from "../../../../../Swiper/Thumbs/factory.js";
9
+ import { ZoomModule as ue } from "../../../../../Swiper/Zoom/factory.js";
10
+ const de = ["id", "data-cy"], ce = ["data-idx", "alt", "width", "height", "onLoad"], pe = ["id"], we = ["alt"], Oe = /* @__PURE__ */ W({
11
11
  inheritAttrs: !1,
12
12
  __name: "SwiperCarousel",
13
13
  props: {
@@ -21,191 +21,206 @@ const le = ["id", "data-cy"], de = ["data-idx", "alt", "width", "height", "onLoa
21
21
  shiftFirstImage: { type: Boolean, default: !1 }
22
22
  },
23
23
  emits: ["moved", "click", "firstSlideLoaded", "init"],
24
- setup(t, { expose: T, emit: D }) {
25
- const h = D, u = z(null), y = C("swiperRef"), A = C("thumbsRef"), F = z(!1), N = X(), w = Y(() => t.id ?? N), v = t.swiperOptions?.slidesPerView || 1, j = !!t.swiperOptions?.keyboard, S = !!t.swiperOptions.navigation, I = !!t.swiperOptions.pagination, q = !!t.swiperOptions.autoplay, G = t.swiperOptions?.effect || "slider", P = (e, s = -1, i = !1) => {
24
+ setup(t, { expose: D, emit: F }) {
25
+ const b = F, d = L(null), k = V("swiperRef"), A = V("thumbsRef"), O = L(!1), E = X(), m = Y(() => t.id ?? E), v = t.swiperOptions?.slidesPerView || 1, N = !!t.swiperOptions?.keyboard, z = !!t.swiperOptions.navigation, M = !!t.swiperOptions.pagination, j = !!t.swiperOptions.autoplay, q = t.swiperOptions?.effect || "slider", C = (e, i = -1, s = !1) => {
26
26
  if (!e.images)
27
27
  return { src: e.src || "" };
28
- let r = "", o = "", g = "";
28
+ let a = "", r = "", g = "";
29
29
  if (t.artDirection) {
30
- for (const a in t.artDirection) {
31
- const { mq: c, width: m } = t.artDirection[a];
32
- m && (g += g ? `,${c} ${parseInt(m)}px` : `${c} ${parseInt(m)}px`);
30
+ for (const o in t.artDirection) {
31
+ const { mq: c, width: p } = t.artDirection[o];
32
+ p && (g += g ? `,${c} ${parseInt(p)}px` : `${c} ${parseInt(p)}px`);
33
33
  }
34
- o = e.images.reduce((a, c, m) => {
35
- const f = Object.values(t.artDirection)[m];
36
- return !f || !f.width || (a += a ? `, ${c.storagePath} ${f.width}` : `${c.storagePath} ${f.width}`), a;
37
- }, ""), r = e.images[0].storagePath;
34
+ r = e.images.reduce((o, c, p) => {
35
+ const w = Object.values(t.artDirection)[p];
36
+ return !w || !w.width || (o += o ? `, ${c.storagePath} ${w.width}` : `${c.storagePath} ${w.width}`), o;
37
+ }, ""), a = e.images[0].storagePath;
38
38
  } else {
39
- let a = e.images;
40
- e.images.length > 3 ? a = e.images.slice(2, 5) : t.shiftFirstImage && (a[0] = a[1]), o = a.reduce((c, m, f) => (f === 0 && (r = `${m.storagePath}`), f > 0 && (c += ", "), `${c}${m.storagePath} ${f + 1}x`), "");
39
+ let o = e.images;
40
+ e.images.length > 3 ? o = e.images.slice(2, 5) : t.shiftFirstImage && (o[0] = o[1]), r = o.reduce((c, p, w) => (w === 0 && (a = `${p.storagePath}`), w > 0 && (c += ", "), `${c}${p.storagePath} ${w + 1}x`), "");
41
41
  }
42
- const J = r, Q = o;
43
- return typeof v == "number" && s > v ? (r = "", o = "", { sizes: g, "data-src": J, "data-srcset": Q }) : i ? {
44
- src: r,
45
- srcset: o,
42
+ const Q = a, U = r;
43
+ return typeof v == "number" && i > v ? (a = "", r = "", { sizes: g, "data-src": Q, "data-srcset": U }) : s ? {
44
+ src: a,
45
+ srcset: r,
46
46
  sizes: g,
47
47
  loading: "lazy",
48
48
  fetchpriority: "low"
49
49
  } : {
50
- src: r,
51
- srcset: o,
50
+ src: a,
51
+ srcset: r,
52
52
  sizes: g,
53
- loading: t.lazyLoadImages || s >= v ? "lazy" : void 0,
54
- fetchpriority: !t.lazyLoadImages && s === 0 ? "high" : "low"
53
+ loading: t.lazyLoadImages || i >= v ? "lazy" : void 0,
54
+ fetchpriority: !t.lazyLoadImages && i === 0 ? "high" : "low"
55
55
  };
56
- }, b = [], K = (e) => {
56
+ }, y = [], K = (e) => {
57
57
  if (typeof v == "string") return;
58
- const s = b[e];
59
- if (s && !s.src && (s.src = s.dataset.src || "", s.srcset = s.dataset.srcset || ""), e < v || e + 1 >= (t.images ?? []).length)
58
+ const i = y[e];
59
+ if (i && !i.src && (i.src = i.dataset.src || "", i.srcset = i.dataset.srcset || ""), e < v || e + 1 >= (t.images ?? []).length)
60
60
  return;
61
- const i = b[e + 1];
62
- i && !i.src && (i.src = i?.dataset.src || "", i.srcset = i?.dataset.srcset || "");
63
- }, U = (e) => {
64
- e || !b?.[e] || M(() => {
65
- y.value?.setAttribute("data-first-slide-loaded", "true"), h("firstSlideLoaded");
61
+ const s = y[e + 1];
62
+ s && !s.src && (s.src = s?.dataset.src || "", s.srcset = s?.dataset.srcset || "");
63
+ }, Z = (e) => {
64
+ e || !y?.[e] || S(() => {
65
+ k.value?.setAttribute("data-first-slide-loaded", "true"), b("firstSlideLoaded");
66
66
  });
67
- }, Z = (e) => t.thumbSwiperOptions ? R(e, t.thumbSwiperOptions, [
68
- se(t.thumbSwiperOptions.freeMode)
69
- ]) : null, E = async (e, s) => {
70
- console.log("DEBUG:SwiperCarousel", {
71
- rootEl: e,
72
- thumbEl: s
73
- });
74
- const i = s ? await Z(s) : null;
75
- u.value = await R(
67
+ }, G = (e) => t.thumbSwiperOptions ? B(e, t.thumbSwiperOptions, [
68
+ ae(t.thumbSwiperOptions.freeMode)
69
+ ]) : null, H = async (e, i) => {
70
+ const s = i ? await G(i) : null;
71
+ d.value = await B(
76
72
  e,
77
73
  {
78
74
  on: {
79
75
  init: () => {
80
- F.value = !0, h("init");
76
+ S(() => {
77
+ O.value = !0, b("init");
78
+ });
81
79
  },
82
- slideChange: (r) => {
83
- K(r.activeIndex), h("moved", { activeIndex: r.activeIndex });
80
+ slideChange: (a) => {
81
+ K(a.activeIndex), b("moved", { activeIndex: a.activeIndex });
84
82
  }
85
83
  },
86
- ...i ? { thumbs: { ...t.swiperOptions.thumbs, swiper: i } } : {},
84
+ ...s ? { thumbs: { ...t.swiperOptions.thumbs, swiper: s } } : {},
87
85
  ...t.swiperOptions
88
86
  },
89
87
  [
90
- ne(t.swiperOptions.zoom),
91
- j ? ie(t.swiperOptions.keyboard) : void 0,
92
- I ? ae(t.swiperOptions.pagination) : void 0,
93
- S ? re(t.swiperOptions.navigation) : void 0,
94
- q ? te(t.swiperOptions.autoplay) : void 0,
88
+ ue(t.swiperOptions.zoom),
89
+ N ? re(t.swiperOptions.keyboard) : void 0,
90
+ M ? ne({
91
+ el: ".swiper-pagination",
92
+ renderFraction: (a, r) => `<div class="uikit-rounded-xs uikit-border-w-black uikit-border uikit-border-solid uikit-px-3 uikit-bg-white uikit-pt-[3px] uikit-pb-[3px]">
93
+ <span data-cy="swiper-pagination-current" class="${a}"></span>
94
+ /
95
+ <span data-cy="swiper-pagination-total" class="${r}"></span>
96
+ </div>`,
97
+ ...typeof t.swiperOptions.pagination == "boolean" ? {} : t.swiperOptions.pagination
98
+ }) : void 0,
99
+ z ? oe({
100
+ nextEl: ".swiper-button-next",
101
+ prevEl: ".swiper-button-prev",
102
+ ...typeof t.swiperOptions.navigation == "boolean" ? {} : t.swiperOptions.navigation
103
+ }) : void 0,
104
+ j ? se(t.swiperOptions.autoplay) : void 0,
95
105
  //Thumbs specific modules
96
- i ? oe() : void 0
106
+ s ? le() : void 0
97
107
  ].filter(Boolean)
98
108
  );
99
109
  };
100
110
  x(() => {
101
- y.value && setTimeout(() => E(y.value, A.value));
111
+ k.value && setTimeout(() => H(k.value, A.value));
102
112
  });
103
- const H = (e) => {
104
- !u.value || u.value.params.slidesPerView === e || (u.value.params.slidesPerView = e, u.value.update());
113
+ const J = (e) => {
114
+ !d.value || d.value.params.slidesPerView === e || (d.value.params.slidesPerView = e, d.value.update());
105
115
  };
106
116
  return _(
107
117
  () => t.images,
108
118
  () => {
109
- M(() => {
110
- u.value?.update();
119
+ S(() => {
120
+ d.value?.update();
111
121
  });
112
122
  }
113
- ), T({
114
- swiper: u,
115
- moveTo(e, s = 0, i = !0) {
116
- u.value?.slideTo(e, s, i);
123
+ ), D({
124
+ swiper: d,
125
+ moveTo(e, i = 0, s = !0) {
126
+ d.value?.slideTo(e, i, s);
117
127
  },
118
- updateSlidesPerView: H
119
- }), (e, s) => (l(), n("div", {
120
- class: d(["swiper-carousel-root", e.$attrs["root-classes"]])
121
- }, [
122
- p("div", {
123
- ref: "swiperRef",
124
- id: w.value,
125
- "data-cy": e.$attrs["data-cy"],
126
- class: d(["swiper uikit-carousel", e.$attrs["swiper-classes"]])
128
+ updateSlidesPerView: J
129
+ }), (e, i) => (l(), n($, null, [
130
+ ee(f("div", {
131
+ class: u(["swiper-carousel-root", e.$attrs["root-classes"]])
127
132
  }, [
128
- p("div", {
129
- class: d(["swiper-wrapper", [
130
- e.$attrs["swiper-wrapper-classes"],
131
- ee(G) === "none" && "no-transition"
132
- ]]),
133
- onClick: s[0] || (s[0] = (i) => h("click"))
133
+ f("div", {
134
+ ref: "swiperRef",
135
+ id: m.value,
136
+ "data-cy": e.$attrs["data-cy"],
137
+ class: u(["swiper uikit-carousel", e.$attrs["swiper-classes"]])
134
138
  }, [
135
- L(e.$slots, "default", {}, () => [
136
- (l(!0), n(k, null, V(t.images, (i, r) => (l(), n("div", {
137
- key: `swiper_${w.value}_${r}`,
138
- class: d(["swiper-slide", e.$attrs["swiper-slide-classes"]])
139
- }, [
140
- p("div", {
141
- class: d(["swiper-zoom-container", e.$attrs["swiper-zoom-container-classes"]])
139
+ f("div", {
140
+ class: u(["swiper-wrapper", [
141
+ e.$attrs["swiper-wrapper-classes"],
142
+ te(q) === "none" && "no-transition"
143
+ ]]),
144
+ onClick: i[0] || (i[0] = (s) => b("click"))
145
+ }, [
146
+ I(e.$slots, "default", {}, () => [
147
+ (l(!0), n($, null, R(t.images, (s, a) => (l(), n("div", {
148
+ key: `swiper_${m.value}_${a}`,
149
+ class: u(["swiper-slide", e.$attrs["swiper-slide-classes"]])
142
150
  }, [
143
- t.backgroundImage ? $("", !0) : (l(), n("img", B({
144
- key: 0,
145
- ref_for: !0,
146
- ref: (o) => {
147
- b.push(o);
148
- },
149
- class: ["disable-select", [e.$attrs["slide-img-classes"] || i.classes]],
150
- "data-idx": `${w.value}-slide-img-${r}`
151
- }, { ref_for: !0 }, P(i, r), {
152
- alt: i.alt,
153
- itemprop: "image",
154
- width: i.width,
155
- height: i.height,
156
- onLoad: (o) => U(r)
157
- }), null, 16, de))
158
- ], 2)
159
- ], 2))), 128)),
160
- L(e.$slots, "last_slide", {}, void 0, !0)
161
- ], !0)
162
- ], 2),
163
- I ? (l(), n("div", {
164
- key: 0,
165
- class: d([e.$attrs["swiper-pagination-classes"], "swiper-pagination [&.swiper-pagination-fraction]:uikit-flex [&.swiper-pagination-fraction]:uikit-justify-center"]),
166
- onClick: s[1] || (s[1] = O(() => {
167
- }, ["stop"]))
168
- }, null, 2)) : $("", !0),
169
- S ? (l(), n(k, { key: 1 }, [
170
- p("div", {
171
- class: "swiper-button-prev",
172
- "data-cy": "swiper-button-prev",
173
- onClick: s[2] || (s[2] = O(() => {
151
+ f("div", {
152
+ class: u(["swiper-zoom-container", e.$attrs["swiper-zoom-container-classes"]])
153
+ }, [
154
+ t.backgroundImage ? h("", !0) : (l(), n("img", T({
155
+ key: 0,
156
+ ref_for: !0,
157
+ ref: (r) => {
158
+ y.push(r);
159
+ },
160
+ class: ["disable-select", [e.$attrs["slide-img-classes"] || s.classes]],
161
+ "data-idx": `${m.value}-slide-img-${a}`
162
+ }, { ref_for: !0 }, C(s, a), {
163
+ alt: s.alt,
164
+ itemprop: "image",
165
+ width: s.width,
166
+ height: s.height,
167
+ onLoad: (r) => Z(a)
168
+ }), null, 16, ce))
169
+ ], 2)
170
+ ], 2))), 128)),
171
+ I(e.$slots, "last_slide", {}, void 0, !0)
172
+ ], !0)
173
+ ], 2),
174
+ M ? (l(), n("div", {
175
+ key: 0,
176
+ class: u([e.$attrs["swiper-pagination-classes"], "swiper-pagination [&.swiper-pagination-fraction]:uikit-flex [&.swiper-pagination-fraction]:uikit-justify-center"]),
177
+ onClick: i[1] || (i[1] = P(() => {
174
178
  }, ["stop"]))
175
- }),
176
- p("div", {
177
- class: "swiper-button-next",
178
- "data-cy": "swiper-button-next",
179
- onClick: s[3] || (s[3] = O(() => {
180
- }, ["stop"]))
181
- })
182
- ], 64)) : $("", !0)
183
- ], 10, le),
184
- t.thumbSwiperOptions ? (l(), n("div", {
185
- key: 0,
186
- id: `thumb_${w.value}`,
187
- ref: "thumbsRef",
188
- class: d(["swiper", e.$attrs["thumb-swiper-classes"]]),
189
- thumbsSlider: ""
190
- }, [
191
- p("div", {
192
- class: d(["swiper-wrapper", e.$attrs["thumb-swiper-wrapper-classes"]])
179
+ }, null, 2)) : h("", !0),
180
+ z ? (l(), n($, { key: 1 }, [
181
+ f("div", {
182
+ class: "swiper-button-prev",
183
+ "data-cy": "swiper-button-prev",
184
+ onClick: i[2] || (i[2] = P(() => {
185
+ }, ["stop"]))
186
+ }),
187
+ f("div", {
188
+ class: "swiper-button-next",
189
+ "data-cy": "swiper-button-next",
190
+ onClick: i[3] || (i[3] = P(() => {
191
+ }, ["stop"]))
192
+ })
193
+ ], 64)) : h("", !0)
194
+ ], 10, de),
195
+ t.thumbSwiperOptions ? (l(), n("div", {
196
+ key: 0,
197
+ id: `thumb_${m.value}`,
198
+ ref: "thumbsRef",
199
+ class: u(["swiper", e.$attrs["thumb-swiper-classes"]]),
200
+ thumbsSlider: ""
193
201
  }, [
194
- (l(!0), n(k, null, V(t.images, (i, r) => (l(), n("div", {
195
- key: `thumb_${w.value}_${r}`,
196
- class: d(["swiper-slide", e.$attrs["thumb-img-wrapper-classes"]])
202
+ f("div", {
203
+ class: u(["swiper-wrapper", e.$attrs["thumb-swiper-wrapper-classes"]])
197
204
  }, [
198
- p("img", B({
199
- class: e.$attrs["thumb-img-classes"]
200
- }, { ref_for: !0 }, P(i, -1, !1), {
201
- alt: i.alt
202
- }), null, 16, ce)
203
- ], 2))), 128))
204
- ], 2)
205
- ], 10, ue)) : $("", !0)
206
- ], 2));
205
+ (l(!0), n($, null, R(t.images, (s, a) => (l(), n("div", {
206
+ key: `thumb_${m.value}_${a}`,
207
+ class: u(["swiper-slide", e.$attrs["thumb-img-wrapper-classes"]])
208
+ }, [
209
+ f("img", T({
210
+ class: e.$attrs["thumb-img-classes"]
211
+ }, { ref_for: !0 }, C(s, -1, !1), {
212
+ alt: s.alt
213
+ }), null, 16, we)
214
+ ], 2))), 128))
215
+ ], 2)
216
+ ], 10, pe)) : h("", !0)
217
+ ], 2), [
218
+ [ie, O.value]
219
+ ]),
220
+ O.value ? h("", !0) : I(e.$slots, "placeholder", { key: 0 }, void 0, !0)
221
+ ], 64));
207
222
  }
208
223
  });
209
224
  export {
210
- ye as default
225
+ Oe as default
211
226
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.4.2-alpha.9",
3
+ "version": "2.5.1-alpha.0",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -52,41 +52,41 @@
52
52
  "dependencies": {
53
53
  "chart.js": "4.5.1",
54
54
  "chartjs-adapter-date-fns": "3.0.0",
55
- "reka-ui": "^2.7.0",
56
- "swiper": "^12.0.3",
57
- "vue": "^3.5.27",
55
+ "reka-ui": "^2.8.2",
56
+ "swiper": "^12.1.2",
57
+ "vue": "^3.5.28",
58
58
  "vue-chartjs": "5.3.3"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@babel/eslint-parser": "^7.28.6",
62
62
  "@histoire/plugin-vue": "^1.0.0-beta.1",
63
- "@types/node": "^25.0.9",
64
- "@vitejs/plugin-vue": "^6.0.3",
63
+ "@types/node": "^25.3.0",
64
+ "@vitejs/plugin-vue": "^6.0.4",
65
65
  "@vue/eslint-config-prettier": "^10.2.0",
66
- "@vue/eslint-config-typescript": "^14.6.0",
67
- "@wikicasa-dev/svg-icons": "1.3.0",
68
- "@wikicasa-dev/vue-composables": "0.1.0",
66
+ "@vue/eslint-config-typescript": "^14.7.0",
67
+ "@wikicasa-dev/svg-icons": "1.3.1",
68
+ "@wikicasa-dev/vue-composables": "0.1.2",
69
69
  "@wikicasa-dev/tailwind-plugins": "^0.0.3",
70
- "@wikicasa-dev/types": "2.5.1",
70
+ "@wikicasa-dev/types": "2.5.4",
71
71
  "@wikicasa-dev/utilities": "1.2.0",
72
- "autoprefixer": "^10.4.23",
72
+ "autoprefixer": "^10.4.24",
73
73
  "date-fns": "4.1.0",
74
74
  "eslint": "^9.39",
75
- "eslint-plugin-vue": "^10.7.0",
75
+ "eslint-plugin-vue": "^10.8.0",
76
76
  "jiti": "^2.6.1",
77
- "glob": "^13.0.0",
77
+ "glob": "^13.0.6",
78
78
  "histoire": "^1.0.0-beta.1",
79
79
  "postcss": "^8.5.6",
80
- "prettier": "^3.8.0",
80
+ "prettier": "^3.8.1",
81
81
  "prettier-plugin-tailwindcss": "^0.7.2",
82
- "rollup-plugin-visualizer": "^6.0.5",
82
+ "rollup-plugin-visualizer": "^7.0.0",
83
83
  "tailwindcss": "3.4.15",
84
84
  "typescript": "^5.9.3",
85
85
  "vite": "7.3.1",
86
86
  "vite-plugin-dts": "^4.5.4",
87
87
  "vite-plugin-lib-inject-css": "^2.2.2",
88
- "vue-router": "^4.6.4",
89
- "vue-tsc": "3.2.2"
88
+ "vue-router": "^5.0.3",
89
+ "vue-tsc": "3.2.5"
90
90
  },
91
91
  "readme": "ERROR: No README data found!",
92
92
  "scripts": {