@wikicasa-dev/components 2.8.1 → 2.8.2-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,18 +1,20 @@
1
1
  import e from "../BaseSelect/SelectItem.js";
2
2
  import t from "../BaseDropDown.js";
3
- import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, isMemoSame as u, mergeModels as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onMounted as ee, onUnmounted as te, openBlock as h, renderList as g, renderSlot as _, shallowRef as v, toDisplayString as y, unref as ne, useId as re, useModel as b, useTemplateRef as x, vModelText as ie, vShow as S, watch as C, withCtx as w, withDirectives as T, withModifiers as E } from "vue";
3
+ import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, isMemoSame as ee, mergeModels as u, normalizeClass as d, normalizeStyle as f, onMounted as te, onUnmounted as ne, openBlock as p, renderList as re, renderSlot as m, shallowRef as h, toDisplayString as ie, unref as ae, useId as oe, useModel as g, useTemplateRef as _, vModelText as v, vShow as se, watch as y, withCtx as b, withDirectives as x, withModifiers as ce } from "vue";
4
4
  import '../../assets/ClearableAutocomplete.css';//#region lib/UIKit/Autocomplete/ClearableAutocomplete.vue?vue&type=script&setup=true&lang.ts
5
- var ae = [
5
+ var le = [
6
6
  "id",
7
7
  "data-cy",
8
8
  "placeholder"
9
- ], oe = ["data-cy"], se = {
9
+ ], ue = ["data-cy"], de = {
10
10
  key: 1,
11
11
  name: "loading-state",
12
12
  class: "uikit-progress-bar-track uikit-absolute uikit-left-0 uikit-top-0 uikit-w-full"
13
- }, ce = ["innerHTML"], D = /*@__PURE__*/ l({
13
+ }, fe = ["innerHTML"], S = (e) => {
14
+ typeof requestAnimationFrame == "function" && requestAnimationFrame(() => setTimeout(e, 0));
15
+ }, C = /*@__PURE__*/ l({
14
16
  __name: "ClearableAutocomplete",
15
- props: /*@__PURE__*/ d({
17
+ props: /*@__PURE__*/ u({
16
18
  dataCy: {},
17
19
  placeholder: {},
18
20
  enableKeyboardController: {
@@ -43,7 +45,7 @@ var ae = [
43
45
  inputValue: { default: "" },
44
46
  inputValueModifiers: {}
45
47
  }),
46
- emits: /*@__PURE__*/ d([
48
+ emits: /*@__PURE__*/ u([
47
49
  "input",
48
50
  "click",
49
51
  "inputClick",
@@ -53,45 +55,49 @@ var ae = [
53
55
  "update:modelValue",
54
56
  "update:inputValue"
55
57
  ]),
56
- setup(l, { expose: d, emit: D }) {
57
- let O = b(l, "open"), k = b(l, "modelValue"), A = b(l, "inputValue"), j = D, le = re(), M = x("inputRef"), N = v(0), P = v(!1), F = v(!1), I = v(!1), L = v(-1), R = v(-1), z = v([]), B = r(() => ["uikit-z-30", l.dropdownClasses]), V = null, H = 0, U = x("dropdownRef"), W = x("hiddenSpan"), G = x("inputWrapperRef"), K = x("clearButtonRef"), q = () => {
58
- L.value = -1, R.value = -1;
59
- }, J = () => {
60
- V &&= (clearTimeout(V), null), H += 1, F.value = !1, I.value = !1;
61
- }, ue = (e) => {
62
- J();
63
- let t = H;
64
- F.value = !0, V = setTimeout(async () => {
65
- V = null, O.value = !0, I.value = !0;
58
+ setup(l, { expose: u, emit: C }) {
59
+ let w = g(l, "open"), T = g(l, "modelValue"), E = g(l, "inputValue"), D = C, pe = oe(), O = _("inputRef"), k = h(0), A = h(!1), j = h(!1), M = h(!1), N = h(-1), P = h(-1), F = h([]), I = r(() => ["uikit-z-30", l.dropdownClasses]), L = null, R = 0, z = _("dropdownRef"), B = _("hiddenSpan"), V = _("inputWrapperRef"), H = _("clearButtonRef"), U = () => {
60
+ N.value = -1, P.value = -1;
61
+ }, W = () => {
62
+ L &&= (clearTimeout(L), null), R += 1, j.value = !1, M.value = !1;
63
+ }, G = !1, K = () => {
64
+ G = !1, F.value = [];
65
+ }, q = () => {
66
+ G && K();
67
+ }, me = (e) => {
68
+ W(), q();
69
+ let t = R;
70
+ j.value = !0, L = setTimeout(async () => {
71
+ L = null, w.value = !0, M.value = !0;
66
72
  let n = [];
67
73
  try {
68
74
  n = await l.onInputChangeCb(e);
69
75
  } catch {
70
76
  n = [];
71
77
  }
72
- t === H && (z.value = n, q(), F.value = !1, I.value = !1, O.value = !!z.value.length);
78
+ t === R && (F.value = n, U(), j.value = !1, M.value = !1, w.value = !!F.value.length);
73
79
  }, 300);
80
+ }, J = () => {
81
+ W(), K(), w.value = !1, E.value = "", T.value = null, A.value = !1, k.value = 0, U();
74
82
  }, Y = () => {
75
- J(), z.value = [], O.value = !1, A.value = "", k.value = null, P.value = !1, N.value = 0, q();
76
- }, de = () => {
77
- Y();
78
- }, fe = (e) => {
83
+ J();
84
+ }, he = (e) => {
79
85
  if (!e) {
80
- Y();
86
+ J();
81
87
  return;
82
88
  }
83
- if (l.disableCb && e === k.value?.label) {
84
- J();
89
+ if (l.disableCb && e === T.value?.label) {
90
+ W(), q();
85
91
  return;
86
92
  }
87
- ue(e);
88
- }, pe = (e) => {
89
- j("input", e), P.value = !1, N.value = 0, !e.isComposing && fe(e.target.value);
93
+ me(e);
94
+ }, ge = (e) => {
95
+ D("input", e), A.value = !1, k.value = 0, !e.isComposing && he(e.target.value);
90
96
  }, X = (e = -1, t) => {
91
- let n = z.value[e];
92
- !n || n.id === k.value?.id || (R.value = e, l.onOptionSelectedCb?.(n, { trigger: t }), A.value = n.label, O.value = !1, k.value = n, P.value = !0, J(), z.value = []);
97
+ let n = F.value[e];
98
+ !n || n.id === T.value?.id || (P.value = e, l.onOptionSelectedCb?.(n, { trigger: t }), E.value = n.label, w.value = !1, T.value = n, A.value = !0, W(), G = !0, S(q));
93
99
  }, Z = (e) => {
94
- if (!l.enableKeyboardController || !O.value || ![
100
+ if (!l.enableKeyboardController || !w.value || ![
95
101
  "ArrowUp",
96
102
  "ArrowDown",
97
103
  "Enter",
@@ -102,11 +108,11 @@ var ae = [
102
108
  "End"
103
109
  ].includes(e.key)) return;
104
110
  if (e.key === "Escape") {
105
- L.value = R.value, O.value = !1, e.stopPropagation();
111
+ N.value = P.value, w.value = !1, e.stopPropagation();
106
112
  return;
107
113
  }
108
- if (!z.value.length) return;
109
- let t = z.value.length - 1;
114
+ if (!F.value.length) return;
115
+ let t = F.value.length - 1;
110
116
  if ([
111
117
  "ArrowUp",
112
118
  "ArrowDown",
@@ -114,136 +120,136 @@ var ae = [
114
120
  "Home",
115
121
  "PageDown",
116
122
  "End"
117
- ].includes(e.key) && e.preventDefault(), e.key === "ArrowUp") L.value = L.value <= 0 ? t : L.value - 1;
118
- else if (e.key === "ArrowDown") L.value = L.value >= t ? 0 : L.value + 1;
123
+ ].includes(e.key) && e.preventDefault(), e.key === "ArrowUp") N.value = N.value <= 0 ? t : N.value - 1;
124
+ else if (e.key === "ArrowDown") N.value = N.value >= t ? 0 : N.value + 1;
119
125
  else if (e.key === "Enter") {
120
- if (L.value === -1) return;
121
- e.preventDefault(), X(L.value, "enter");
122
- } else e.key === "PageUp" || e.key === "Home" ? L.value = 0 : (e.key === "PageDown" || e.key === "End") && (L.value = t);
126
+ if (N.value === -1) return;
127
+ e.preventDefault(), X(N.value, "enter");
128
+ } else e.key === "PageUp" || e.key === "Home" ? N.value = 0 : (e.key === "PageDown" || e.key === "End") && (N.value = t);
123
129
  e.stopPropagation();
124
- }, me = (e) => {
125
- j("keydown", e), Z(e);
126
- }, he = () => {
127
- M.value?.select();
128
- }, ge = () => {
129
- M.value?.focus();
130
+ }, _e = (e) => {
131
+ D("keydown", e), Z(e);
132
+ }, ve = () => {
133
+ O.value?.select();
134
+ }, ye = () => {
135
+ O.value?.focus();
130
136
  }, Q = null, $ = () => {
131
- if (!P.value) return;
132
- let e = W.value, t = G.value, n = K.value;
137
+ if (!A.value) return;
138
+ let e = B.value, t = V.value, n = H.value;
133
139
  if (!e || !t) return;
134
140
  let r = e.offsetWidth, i = t.offsetWidth;
135
141
  if (!i) return;
136
142
  let a = l.clearButton?.offset || 0, o = l.clearButton?.width || n?.offsetWidth || 0, s = i - a - o, c = Math.min(r, s);
137
- c !== N.value && (N.value = c);
143
+ c !== k.value && (k.value = c);
138
144
  };
139
- return ee(() => {
140
- G.value && (Q = new ResizeObserver(() => {
145
+ return te(() => {
146
+ V.value && (Q = new ResizeObserver(() => {
141
147
  $();
142
- }), Q.observe(G.value));
143
- }), te(() => {
144
- Q?.disconnect(), J();
145
- }), C([
148
+ }), Q.observe(V.value));
149
+ }), ne(() => {
150
+ Q?.disconnect(), W();
151
+ }), y([
152
+ E,
146
153
  A,
147
- P,
148
- W,
149
- K
154
+ B,
155
+ H
150
156
  ], () => {
151
- f($);
152
- }), C(k, (e) => {
153
- if (e?.label === A.value) return;
157
+ S($);
158
+ }), y(T, (e) => {
159
+ if (e?.label === E.value) return;
154
160
  let t = e?.label || "";
155
- A.value = t, t && (P.value = !0);
156
- }, { immediate: !0 }), d({
157
- getRootElement: () => U.value?.getRootElement(),
158
- select: he,
159
- focus: ge
160
- }), (r, d) => (h(), i(t, {
161
+ E.value = t, t && (A.value = !0);
162
+ }, { immediate: !0 }), u({
163
+ getRootElement: () => z.value?.getRootElement(),
164
+ select: ve,
165
+ focus: ye
166
+ }), (r, u) => (p(), i(t, {
161
167
  ref: "dropdownRef",
162
168
  class: "uikit-clearable-autocomplete",
163
169
  "data-cy": l.dataCy,
164
170
  "dropdown-element": "ul",
165
- "dropdown-classes": B.value,
171
+ "dropdown-classes": I.value,
166
172
  "keep-state": l.keepState === "closed" ? "closed" : "opened",
167
173
  "activate-keyboard-controller": !1,
168
- open: O.value,
169
- "onUpdate:open": d[5] ||= (e) => O.value = e
174
+ open: w.value,
175
+ "onUpdate:open": u[5] ||= (e) => w.value = e
170
176
  }, {
171
- btn_slot: w(() => [s("div", {
172
- class: p(["uikit-text-16", l.triggerWrapperClasses]),
173
- onClick: d[2] ||= (e) => j("click", e)
177
+ btn_slot: b(() => [s("div", {
178
+ class: d(["uikit-text-16", l.triggerWrapperClasses]),
179
+ onClick: u[2] ||= (e) => D("click", e)
174
180
  }, [
175
- _(r.$slots, "left-icon"),
181
+ m(r.$slots, "left-icon"),
176
182
  s("div", {
177
183
  ref: "inputWrapperRef",
178
- class: p(["uikit-relative", l.inputWrapperClasses])
184
+ class: d(["uikit-relative", l.inputWrapperClasses])
179
185
  }, [
180
- T(s("input", {
186
+ x(s("input", {
181
187
  ref: "inputRef",
182
- "onUpdate:modelValue": d[0] ||= (e) => A.value = e,
183
- id: ne(le),
188
+ "onUpdate:modelValue": u[0] ||= (e) => E.value = e,
189
+ id: ae(pe),
184
190
  "data-cy": l.dataCy ? `ac_input_${l.dataCy}` : "",
185
191
  type: "text",
186
192
  autocomplete: "off",
187
- class: p(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", l.inputClasses]),
193
+ class: d(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", l.inputClasses]),
188
194
  style: {
189
195
  font: "inherit",
190
196
  fontSize: "inherit"
191
197
  },
192
198
  placeholder: l.placeholder,
193
- onKeydown: me,
194
- onInput: pe,
195
- onClick: d[1] ||= (e) => {
196
- j("inputClick", e), M.value?.select();
199
+ onKeydown: _e,
200
+ onInput: ge,
201
+ onClick: u[1] ||= (e) => {
202
+ D("inputClick", e), O.value?.select();
197
203
  }
198
- }, null, 42, ae), [[ie, A.value]]),
204
+ }, null, 42, le), [[v, E.value]]),
199
205
  s("span", {
200
206
  ref_key: "hiddenSpan",
201
- ref: W,
202
- class: p(["uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-max-w-full uikit-overflow-hidden uikit-whitespace-pre", l.hiddenTextClasses]),
207
+ ref: B,
208
+ class: d(["uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-max-w-full uikit-overflow-hidden uikit-whitespace-pre", l.hiddenTextClasses]),
203
209
  style: {
204
210
  font: "inherit",
205
211
  fontSize: "inherit"
206
212
  }
207
- }, y(A.value), 3),
208
- T(s("button", {
213
+ }, ie(E.value), 3),
214
+ x(s("button", {
209
215
  ref: "clearButtonRef",
210
216
  type: "button",
211
- class: p(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButton?.classes]),
217
+ class: d(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButton?.classes]),
212
218
  "data-cy": l.clearButton?.dataCy || "clear-btn",
213
219
  "aria-label": "Clear input",
214
- style: m({
215
- left: `${N.value + (l.clearButton?.offset || 0)}px`,
220
+ style: f({
221
+ left: `${k.value + (l.clearButton?.offset || 0)}px`,
216
222
  width: l.clearButton?.width ? `${l.clearButton.width}px` : "auto",
217
223
  height: l.clearButton?.height ? `${l.clearButton.height}px` : "auto"
218
224
  }),
219
- onClick: E(de, ["stop"])
220
- }, [_(r.$slots, "clear-icon", {}, () => [d[6] ||= c("X", -1)])], 14, oe), [[S, P.value && N.value]])
225
+ onClick: ce(Y, ["stop"])
226
+ }, [m(r.$slots, "clear-icon", {}, () => [u[6] ||= c("X", -1)])], 14, ue), [[se, A.value && k.value]])
221
227
  ], 2),
222
- _(r.$slots, "right-icon")
228
+ m(r.$slots, "right-icon")
223
229
  ], 2)]),
224
- default: w(() => [
225
- I.value && !z.value.length ? _(r.$slots, "loading-state", {}, void 0, void 0, 0) : a("", !0),
226
- F.value && z.value.length ? (h(), o("div", se, [...d[7] ||= [s("div", { class: "uikit-progress-bar-fill" }, null, -1)]])) : a("", !0),
227
- z.value.length ? (h(!0), o(n, { key: 2 }, g(z.value, (t, n, a, o) => {
230
+ default: b(() => [
231
+ M.value && !F.value.length ? m(r.$slots, "loading-state", {}, void 0, void 0, 0) : a("", !0),
232
+ j.value && F.value.length ? (p(), o("div", de, [...u[7] ||= [s("div", { class: "uikit-progress-bar-fill" }, null, -1)]])) : a("", !0),
233
+ F.value.length ? (p(!0), o(n, { key: 2 }, re(F.value, (t, n, a, o) => {
228
234
  let c = [
229
235
  t,
230
- L.value === n,
236
+ N.value === n,
231
237
  l.enableKeyboardController
232
238
  ];
233
- if (o && o.el && o.key === n && u(o, c)) return o;
234
- let d = (h(), i(e, {
239
+ if (o && o.el && o.key === n && ee(o, c)) return o;
240
+ let u = (p(), i(e, {
235
241
  key: n,
236
- active: L.value === n,
242
+ active: N.value === n,
237
243
  "focus-on-active": l.enableKeyboardController,
238
244
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
239
245
  onClick: (e) => X(n, "click"),
240
246
  onKeydown: Z,
241
- onMouseover: (e) => L.value = n
247
+ onMouseover: (e) => N.value = n
242
248
  }, {
243
- default: w(() => [_(r.$slots, "option-content", {
249
+ default: b(() => [m(r.$slots, "option-content", {
244
250
  option: t,
245
251
  idx: n
246
- }, () => [s("span", { innerHTML: t.label }, null, 8, ce)])]),
252
+ }, () => [s("span", { innerHTML: t.label }, null, 8, fe)])]),
247
253
  _: 2
248
254
  }, 1032, [
249
255
  "active",
@@ -251,8 +257,8 @@ var ae = [
251
257
  "onClick",
252
258
  "onMouseover"
253
259
  ]));
254
- return d.memo = c, d;
255
- }, d, 3), 128)) : a("", !0)
260
+ return u.memo = c, u;
261
+ }, u, 3), 128)) : a("", !0)
256
262
  ]),
257
263
  _: 3
258
264
  }, 8, [
@@ -264,4 +270,4 @@ var ae = [
264
270
  }
265
271
  });
266
272
  //#endregion
267
- export { D as default };
273
+ export { C as default };
@@ -1 +1 @@
1
- .swiper.uikit-carousel[data-v-e22604af]{opacity:0}.swiper.uikit-carousel.is-initialized[data-v-e22604af]{opacity:1}
1
+ .swiper.uikit-carousel[data-v-df5f7205]{opacity:0}.swiper.uikit-carousel.is-initialized[data-v-df5f7205]{opacity:1}
@@ -21,6 +21,14 @@ export default _default;
21
21
  declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<{
22
22
  rootClasses?: ClassTypeProp;
23
23
  swiperOptions?: SwiperRootPrimitiveProps;
24
+ /**
25
+ * Slides to promote beyond each edge of the visible window.
26
+ *
27
+ * Falls back to `swiperOptions.lazyPreloadPrevNext` when unset, which is how this was
28
+ * configured before and stays supported - but that option's documented job is Swiper's own
29
+ * `loading="lazy"` preloading, which these slides do not use. Prefer this prop.
30
+ */
31
+ preloadCount?: number;
24
32
  }, {
25
33
  swiper: import('vue').ShallowRef<Nullable<Swiper>, Nullable<Swiper>>;
26
34
  updateSlidesPerView: (value: number) => void;
@@ -33,6 +41,14 @@ declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<{
33
41
  }, string, import('vue').PublicProps, Readonly<{
34
42
  rootClasses?: ClassTypeProp;
35
43
  swiperOptions?: SwiperRootPrimitiveProps;
44
+ /**
45
+ * Slides to promote beyond each edge of the visible window.
46
+ *
47
+ * Falls back to `swiperOptions.lazyPreloadPrevNext` when unset, which is how this was
48
+ * configured before and stays supported - but that option's documented job is Swiper's own
49
+ * `loading="lazy"` preloading, which these slides do not use. Prefer this prop.
50
+ */
51
+ preloadCount?: number;
36
52
  }> & Readonly<{
37
53
  onClick?: (() => any) | undefined;
38
54
  onInit?: ((args_0: Swiper) => any) | undefined;
@@ -43,6 +59,8 @@ declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<{
43
59
  default?: (props: {}) => any;
44
60
  } & {
45
61
  placeholder?: (props: {}) => any;
62
+ } & {
63
+ thumbs?: (props: {}) => any;
46
64
  }>;
47
65
  type __VLS_WithSlots<T, S> = T & {
48
66
  new (): {
@@ -1,6 +1,6 @@
1
1
  import e from "../../../_virtual/_plugin-vue_export-helper.js";
2
2
  import t, { addModuleDescriptorKey as n, setLazyImagesLoaderKey as r } from "./SwiperRootPrimitive.vue.js";
3
3
  //#region lib/components/carousel/Primitive/SwiperRootPrimitive.vue
4
- var i = /*#__PURE__*/ e(t, [["__scopeId", "data-v-e22604af"]]);
4
+ var i = /*#__PURE__*/ e(t, [["__scopeId", "data-v-df5f7205"]]);
5
5
  //#endregion
6
6
  export { n as addModuleDescriptorKey, i as default, r as setLazyImagesLoaderKey };
@@ -2,82 +2,98 @@ import { createSwiper as e } from "../../../lazyModules/Swiper/factory.js";
2
2
  import { AutoplayModule as t } from "../../../lazyModules/Swiper/Autoplay/factory.js";
3
3
  import { KeyboardModule as n } from "../../../lazyModules/Swiper/Keyboard/factory.js";
4
4
  import { ZoomModule as r } from "../../../lazyModules/Swiper/Zoom/factory.js";
5
- import { createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, normalizeClass as c, onMounted as l, openBlock as u, provide as d, renderSlot as f, shallowRef as p, useTemplateRef as m } from "vue";
5
+ import { collectSlideImages as i, startDeferredImageLoad as a, waitForImageLoad as o } from "./deferredImages.js";
6
+ import { createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, normalizeClass as d, onBeforeUnmount as f, onMounted as p, openBlock as m, provide as h, renderSlot as g, shallowRef as _, useTemplateRef as v } from "vue";
6
7
  import '../../../assets/SwiperRootPrimitive2.css';import '../../../assets/SwiperRootPrimitive.css';//#region lib/components/carousel/Primitive/SwiperRootPrimitive.vue?vue&type=script&setup=true&lang.ts
7
- var h = { class: "uikit-relative" }, g = {
8
+ var y = { class: "uikit-relative" }, b = {
8
9
  key: 0,
9
10
  class: "uikit-absolute uikit-inset-0"
10
- }, _ = Symbol(), v = Symbol(), y = /*@__PURE__*/ s({
11
+ }, x = Symbol(), S = Symbol(), C = /*@__PURE__*/ u({
11
12
  __name: "SwiperRootPrimitive",
12
13
  props: {
13
14
  rootClasses: {},
14
- swiperOptions: {}
15
+ swiperOptions: {},
16
+ preloadCount: {}
15
17
  },
16
18
  emits: [
17
19
  "moved",
18
20
  "click",
19
21
  "init"
20
22
  ],
21
- setup(s, { expose: y, emit: b }) {
22
- let x = b, S = p(null), C = m("root"), w = p(!1), T = !!s.swiperOptions?.keyboard, E = !!s.swiperOptions?.autoplay, D = [], O = !1, k = (e) => {
23
+ setup(u, { expose: C, emit: w }) {
24
+ let T = w, E = _(null), D = v("root"), O = _(!1), k = !!u.swiperOptions?.keyboard, A = !!u.swiperOptions?.autoplay, j = [], M = !1, N = (e) => {
23
25
  "requestIdleCallback" in window ? requestIdleCallback(e) : setTimeout(e, 200);
24
- }, A = (e, t = "img") => Array.from(e?.querySelectorAll(t) ?? []), j = (e) => {
25
- e.src || (e.src = e.dataset.src || "", e.srcset = e.dataset.srcset || "", e.dataset.src = "", e.dataset.srcset = "", e.removeAttribute("lazy"));
26
- }, M = (e, t) => {
27
- let n = e.params.lazyPreloadPrevNext ?? 0, r = A(e.slides[t]), i = [];
28
- for (let r = t - n; r <= t + n; r++) r !== t && (!e.params.loop && (r < 0 || r >= e.slides.length) || i.push(...A(e.slides[r], "img[data-src]")));
26
+ }, P = (e, t) => e.params.loop ? e.slides[(t % e.slides.length + e.slides.length) % e.slides.length] : e.slides[t], F = (e, t) => {
27
+ let { params: n } = e, r = u.preloadCount ?? n.lazyPreloadPrevNext ?? 0, a = Math.ceil(typeof n.slidesPerView == "number" ? n.slidesPerView : e.slidesPerViewDynamic()), o = n.centeredSlides ? Math.floor(a / 2) : 0, s = i(P(e, t)), c = [], l = [];
28
+ for (let s = t - o - r; s <= t + a - 1 - o + r; s++) {
29
+ if (s === t || !n.loop && (s < 0 || s >= e.slides.length)) continue;
30
+ let r = i(P(e, s), "img[data-src]");
31
+ (s >= t - o && s < t + a - o ? c : l).push(...r);
32
+ }
29
33
  return {
30
- visibleImages: r,
31
- preloadImages: i
34
+ visibleImages: s,
35
+ inViewImages: c,
36
+ preloadImages: l
32
37
  };
33
- }, N = async (e) => {
34
- let t = e.complete && e.src ? Promise.resolve() : new Promise((t) => {
35
- e.addEventListener("load", () => t(), { once: !0 }), e.addEventListener("error", () => t(), { once: !0 });
38
+ }, I = (e) => {
39
+ O.value = !0, T("init", e);
40
+ }, L = async (e) => {
41
+ let { visibleImages: t, inViewImages: n, preloadImages: r } = F(e, e.activeIndex), i, s = new Promise((e) => i = setTimeout(e, 6e3)), c = Promise.all(t.map(o)).finally(() => {
42
+ clearTimeout(i);
36
43
  });
37
- j(e), await t, await e.decode?.().catch(() => void 0);
38
- }, P = () => {
39
- w.value = !0, x("init", S.value);
40
- }, F = async (i) => {
41
- S.value = await e(i, {
44
+ await Promise.race([c, s]), n.forEach(a), N(() => {
45
+ r.forEach(a);
46
+ }), I(e);
47
+ }, R = (e) => {
48
+ let { visibleImages: t, inViewImages: n, preloadImages: r } = F(e, e.activeIndex);
49
+ [
50
+ ...t,
51
+ ...n,
52
+ ...r
53
+ ].forEach(a);
54
+ }, z = async (i) => {
55
+ E.value = await e(i, {
56
+ ...u.swiperOptions,
42
57
  on: {
43
- init: async (e) => {
44
- let { visibleImages: t, preloadImages: n } = M(e, e.activeIndex), r, i = new Promise((e) => r = setTimeout(e, 6e3)), a = Promise.all(t.map(N)).finally(() => {
45
- clearTimeout(r);
46
- });
47
- await Promise.race([a, i]), k(() => {
48
- n.forEach(j);
49
- }), P();
50
- },
58
+ ...u.swiperOptions?.on,
59
+ init: (e) => (u.swiperOptions?.on?.init?.(e), L(e)),
51
60
  slideChange: (e) => {
52
- x("moved", { activeIndex: e.activeIndex });
53
- let { visibleImages: t, preloadImages: n } = M(e, e.activeIndex);
54
- [...t, ...n].forEach(j);
61
+ T("moved", { activeIndex: e.activeIndex }), R(e), u.swiperOptions?.on?.slideChange?.(e);
62
+ },
63
+ slidesUpdated: (e) => {
64
+ O.value && R(e), u.swiperOptions?.on?.slidesUpdated?.(e);
55
65
  }
56
- },
57
- ...s.swiperOptions
66
+ }
58
67
  }, [
59
- r(s.swiperOptions?.zoom),
60
- T ? n(s.swiperOptions?.keyboard) : void 0,
61
- E ? t(s.swiperOptions.autoplay) : void 0,
62
- ...D
68
+ r(u.swiperOptions?.zoom),
69
+ k ? n(u.swiperOptions?.keyboard) : void 0,
70
+ A ? t(u.swiperOptions.autoplay) : void 0,
71
+ ...j
63
72
  ].filter(Boolean));
64
73
  };
65
- return l(() => {
66
- C.value && setTimeout(() => F(C.value));
67
- }), d(v, (e) => {
68
- e && D.push(e);
69
- }), d(_, (e) => {
70
- e !== O && (O = e);
71
- }), y({
72
- swiper: S,
74
+ return p(() => {
75
+ D.value && setTimeout(() => z(D.value));
76
+ }), f(() => {
77
+ let e = E.value;
78
+ E.value = null, e?.destroy(!0, !1);
79
+ }), h(S, (e) => {
80
+ e && j.push(e);
81
+ }), h(x, (e) => {
82
+ e !== M && (M = e);
83
+ }), C({
84
+ swiper: E,
73
85
  updateSlidesPerView: (e) => {
74
- S.value && S.value.params.slidesPerView !== e && (S.value.params.slidesPerView = e, S.value.update());
86
+ E.value && E.value.params.slidesPerView !== e && (E.value.params.slidesPerView = e, E.value.update());
75
87
  }
76
- }), (e, t) => (u(), a("div", h, [o("div", {
77
- ref: "root",
78
- class: c(["swiper uikit-carousel", [{ "is-initialized": w.value }, s.rootClasses]])
79
- }, [f(e.$slots, "default", {}, void 0, !0)], 2), w.value ? i("", !0) : (u(), a("div", g, [f(e.$slots, "placeholder", {}, void 0, !0)]))]));
88
+ }), (e, t) => (m(), c("div", y, [
89
+ l("div", {
90
+ ref: "root",
91
+ class: d(["swiper uikit-carousel", [{ "is-initialized": O.value }, u.rootClasses]])
92
+ }, [g(e.$slots, "default", {}, void 0, !0)], 2),
93
+ O.value ? s("", !0) : (m(), c("div", b, [g(e.$slots, "placeholder", {}, void 0, !0)])),
94
+ g(e.$slots, "thumbs", {}, void 0, !0)
95
+ ]));
80
96
  }
81
97
  });
82
98
  //#endregion
83
- export { v as addModuleDescriptorKey, y as default, _ as setLazyImagesLoaderKey };
99
+ export { S as addModuleDescriptorKey, C as default, x as setLazyImagesLoaderKey };
@@ -0,0 +1,62 @@
1
+ import { Nullable } from '@wikicasa-dev/types';
2
+ import { Swiper, SwiperOptions } from 'swiper/types';
3
+ import { ClassTypeProp } from '../../../UIKit/types';
4
+ /**
5
+ * `modules` is discarded by `createSwiper`, which builds that list from the descriptors, and
6
+ * `thumbs` is this component's own concern - it is what wires the strip to the carousel.
7
+ *
8
+ * `watchSlidesProgress` and `slideToClickedSlide` are force-assigned by Swiper's thumbs module
9
+ * when it adopts the strip, so accepting them would be advertising a setting that is silently
10
+ * reverted.
11
+ */
12
+ export type SwiperThumbnailPrimitiveProps = Omit<SwiperOptions, "thumbs" | "modules" | "watchSlidesProgress" | "slideToClickedSlide">;
13
+ export type SwiperThumbnailPrimitiveEmits = {
14
+ /**
15
+ * Fired right after the strip's own Swiper initialization.
16
+ */
17
+ init: [Swiper];
18
+ };
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<{
22
+ dataCy?: string;
23
+ rootClasses?: ClassTypeProp;
24
+ wrapperClasses?: ClassTypeProp;
25
+ swiperOptions?: SwiperThumbnailPrimitiveProps;
26
+ /**
27
+ * Thumbnails to promote beyond each edge of the visible window. A rail whose next thumbnail
28
+ * pops in under the finger reads as broken, so this leans one slide out by default.
29
+ *
30
+ * Deliberately not Swiper's `lazyPreloadPrevNext`: that option drives Swiper's own
31
+ * `loading="lazy"` preloading, which these slides do not use - borrowing it would both
32
+ * misname the knob and switch on a second preloading pass on every slide change.
33
+ */
34
+ preloadCount?: number;
35
+ }, {
36
+ swiper: import('vue').ShallowRef<Nullable<Swiper>, Nullable<Swiper>>;
37
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
38
+ init: (args_0: Swiper) => any;
39
+ }, string, import('vue').PublicProps, Readonly<{
40
+ dataCy?: string;
41
+ rootClasses?: ClassTypeProp;
42
+ wrapperClasses?: ClassTypeProp;
43
+ swiperOptions?: SwiperThumbnailPrimitiveProps;
44
+ /**
45
+ * Thumbnails to promote beyond each edge of the visible window. A rail whose next thumbnail
46
+ * pops in under the finger reads as broken, so this leans one slide out by default.
47
+ *
48
+ * Deliberately not Swiper's `lazyPreloadPrevNext`: that option drives Swiper's own
49
+ * `loading="lazy"` preloading, which these slides do not use - borrowing it would both
50
+ * misname the knob and switch on a second preloading pass on every slide change.
51
+ */
52
+ preloadCount?: number;
53
+ }> & Readonly<{
54
+ onInit?: ((args_0: Swiper) => any) | undefined;
55
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
56
+ default?: (props: {}) => any;
57
+ }>;
58
+ type __VLS_WithSlots<T, S> = T & {
59
+ new (): {
60
+ $slots: S;
61
+ };
62
+ };
@@ -0,0 +1,5 @@
1
+ import e from "./SwiperThumbnailPrimitive.vue.js";
2
+ //#region lib/components/carousel/Primitive/SwiperThumbnailPrimitive.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,57 @@
1
+ import { createSwiper as e } from "../../../lazyModules/Swiper/factory.js";
2
+ import { FreemodeModule as t } from "../../../lazyModules/Swiper/FreeMode/factory.js";
3
+ import { ThumbsModule as n } from "../../../lazyModules/Swiper/Thumbs/factory.js";
4
+ import { collectSlideImages as r, startDeferredImageLoad as i } from "./deferredImages.js";
5
+ import { addModuleDescriptorKey as a } from "./SwiperRootPrimitive.vue.js";
6
+ import { createElementBlock as o, createElementVNode as s, defineComponent as c, inject as l, normalizeClass as u, onBeforeUnmount as d, openBlock as f, renderSlot as p, shallowRef as m, useTemplateRef as h } from "vue";
7
+ //#region lib/components/carousel/Primitive/SwiperThumbnailPrimitive.vue?vue&type=script&setup=true&lang.ts
8
+ var g = ["data-cy"], _ = /*@__PURE__*/ c({
9
+ __name: "SwiperThumbnailPrimitive",
10
+ props: {
11
+ dataCy: {},
12
+ rootClasses: {},
13
+ wrapperClasses: {},
14
+ swiperOptions: {},
15
+ preloadCount: { default: 1 }
16
+ },
17
+ emits: ["init"],
18
+ setup(c, { expose: _, emit: v }) {
19
+ let y = v, b = m(null), x = h("root"), S = /* @__PURE__ */ new WeakSet(), C = (e) => {
20
+ let { slides: t, activeIndex: n, params: a } = e, o = Math.ceil(typeof a.slidesPerView == "number" ? a.slidesPerView : e.slidesPerViewDynamic()), s = a.centeredSlides ? Math.floor(o / 2) : 0, l = Math.max(0, n - s - c.preloadCount), u = Math.min(t.length - 1, n + o - 1 - s + c.preloadCount);
21
+ for (let e = l; e <= u; e++) {
22
+ let n = t[e];
23
+ !n || S.has(n) || (S.add(n), r(n).forEach(i));
24
+ }
25
+ }, w = (e) => (t) => {
26
+ C(t), e?.(t);
27
+ }, T = {}, E = n(T);
28
+ l(a, void 0)?.({
29
+ ...E,
30
+ loader: async () => {
31
+ let [e] = await Promise.all([E.loader(), D().catch(() => void 0)]);
32
+ return e;
33
+ }
34
+ });
35
+ async function D() {
36
+ x.value && (b.value = await e(x.value, {
37
+ ...c.swiperOptions,
38
+ on: {
39
+ ...c.swiperOptions?.on,
40
+ init: w(c.swiperOptions?.on?.init),
41
+ slideChange: w(c.swiperOptions?.on?.slideChange),
42
+ slidesUpdated: w(c.swiperOptions?.on?.slidesUpdated)
43
+ }
44
+ }, c.swiperOptions?.freeMode ? [t(c.swiperOptions.freeMode)] : []), T.swiper = b.value, y("init", b.value));
45
+ }
46
+ return d(() => {
47
+ let e = b.value;
48
+ b.value = null, e?.destroy(!0, !1);
49
+ }), _({ swiper: b }), (e, t) => (f(), o("div", {
50
+ ref: "root",
51
+ "data-cy": c.dataCy,
52
+ class: u(["swiper", c.rootClasses])
53
+ }, [s("div", { class: u(["swiper-wrapper", c.wrapperClasses]) }, [p(e.$slots, "default")], 2)], 10, g));
54
+ }
55
+ });
56
+ //#endregion
57
+ export { _ as default };
@@ -0,0 +1,17 @@
1
+ import { Nullable } from '@wikicasa-dev/types';
2
+ /**
3
+ * Deferred image loading for a Swiper instance.
4
+ *
5
+ * Slides opt in by rendering `data-src` / `data-srcset` instead of `src` / `srcset`
6
+ * (see `SwiperSlideImagePrimitive`'s `lazy` prop). Nothing then loads until one of these
7
+ * helpers promotes the attributes.
8
+ *
9
+ * This exists rather than `loading="lazy"` because Safari does not honour that attribute on
10
+ * these slides - it fetches every one of them up front, which on a gallery of originals is the
11
+ * whole page weight. Every carousel that owns its own Swiper instance has to run this itself:
12
+ * the helpers walk the slides of the instance they are handed, so a second instance (a thumbs
13
+ * strip) is not covered by the main carousel's pass. Shared here so the two cannot drift.
14
+ */
15
+ export declare const collectSlideImages: (slide: Nullable<HTMLElement>, selector?: string) => HTMLImageElement[];
16
+ export declare const startDeferredImageLoad: (img: HTMLImageElement) => void;
17
+ export declare const waitForImageLoad: (img: HTMLImageElement) => Promise<void>;
@@ -0,0 +1,11 @@
1
+ //#region lib/components/carousel/Primitive/deferredImages.ts
2
+ var e = (e, t = "img") => Array.from(e?.querySelectorAll(t) ?? []), t = (e) => {
3
+ e.src || (e.src = e.dataset.src || "", e.srcset = e.dataset.srcset || "", e.dataset.src = "", e.dataset.srcset = "", e.removeAttribute("lazy"));
4
+ }, n = async (e) => {
5
+ let n = e.complete && e.src ? Promise.resolve() : new Promise((t) => {
6
+ e.addEventListener("load", () => t(), { once: !0 }), e.addEventListener("error", () => t(), { once: !0 });
7
+ });
8
+ t(e), await n, await e.decode?.().catch(() => void 0);
9
+ };
10
+ //#endregion
11
+ export { e as collectSlideImages, t as startDeferredImageLoad, n as waitForImageLoad };
package/dist/index.d.ts CHANGED
@@ -60,6 +60,7 @@ export { default as SwiperPrimitive } from './components/carousel/Primitive/Swip
60
60
  export { default as SwiperPaginationPrimitive } from './components/carousel/Primitive/SwiperPaginationPrimitive';
61
61
  export { default as SwiperNavigationPrimitive } from './components/carousel/Primitive/SwiperNavigationPrimitive';
62
62
  export { default as SwiperSlideImagePrimitive } from './components/carousel/Primitive/SwiperSlideImagePrimitive';
63
+ export { default as SwiperThumbnailPrimitive } from './components/carousel/Primitive/SwiperThumbnailPrimitive';
63
64
  export { default as BaseCard } from './UIKit/Card/BaseCard';
64
65
  export { default as CardRootPrimitive } from './UIKit/Card/CardRootPrimitive';
65
66
  export { default as CardDescriptionPrimitive } from './UIKit/Card/CardDescriptionPrimitive';
package/dist/index.js CHANGED
@@ -59,9 +59,10 @@ import re from "./components/carousel/Primitive/SwiperPrimitive.js";
59
59
  import ie from "./components/carousel/Primitive/SwiperPaginationPrimitive.js";
60
60
  import ae from "./components/carousel/Primitive/SwiperNavigationPrimitive.js";
61
61
  import oe from "./components/carousel/Primitive/SwiperSlideImagePrimitive.js";
62
- import se from "./UIKit/Card/BaseCard.js";
63
- import ce from "./UIKit/Card/CardRootPrimitive.js";
64
- import le from "./UIKit/Card/CardDescriptionPrimitive.js";
65
- import ue from "./UIKit/Card/CardImagePrimitive.js";
66
- import de from "./UIKit/BaseBreadcrumb.js";
67
- export { k as AccessibleSelect, t as AccordionContentPrimitive, r as AccordionHeaderPrimitive, i as AccordionItemPrimitive, n as AccordionTriggerPrimitive, e as BaseAccordion, a as BaseAccordionItem, A as BaseAlert, N as BaseAutocomplete, F as BaseBadge, de as BaseBreadcrumb, D as BaseButton, se as BaseCard, I as BaseComplexToggle, O as BaseDropDown, j as BaseFloatingLabel, M as BaseInput, U as BaseModal, L as BasePagination, W as BaseShimmerLoader, R as BaseSlider, Y as BaseSnackbar, h as BaseTab, m as BaseTabView, g as BaseTabs, _ as BaseTabsContent, v as BaseTabsIndicator, y as BaseTabsList, b as BaseTabsTrigger, z as BaseTextarea, B as BaseToggle, V as BaseTooltip, H as BaseUploadFile, le as CardDescriptionPrimitive, ue as CardImagePrimitive, ce as CardRootPrimitive, l as CheckboxBtn, d as CheckboxButtonGroup, u as CheckboxGroup, p as CheckboxGroupItemPrimitive, f as CheckboxGroupPrimitive, P as ClearableAutocomplete, K as DoughnutChart, X as IntersectionObservable, Z as IntersectionObserver, Q as IntersectionObserverProvider, $ as IntersectionObserverTarget, q as LineChart, c as ProgressIndicatorPrimitive, s as ProgressRootPrimitive, x as RadioButton, w as RadioButtonGroup, C as RadioButtonItem, S as RadioGroup, T as RadioGroupItemPrimitive, o as SelectItem, G as ShimmerMultiLine, J as SimpleSlider, E as StaticSpinner, ee as SwiperCarousel, ae as SwiperNavigationPrimitive, ie as SwiperPaginationPrimitive, re as SwiperPrimitive, ne as SwiperRootPrimitive, te as SwiperSlide, oe as SwiperSlideImagePrimitive };
62
+ import se from "./components/carousel/Primitive/SwiperThumbnailPrimitive.js";
63
+ import ce from "./UIKit/Card/BaseCard.js";
64
+ import le from "./UIKit/Card/CardRootPrimitive.js";
65
+ import ue from "./UIKit/Card/CardDescriptionPrimitive.js";
66
+ import de from "./UIKit/Card/CardImagePrimitive.js";
67
+ import fe from "./UIKit/BaseBreadcrumb.js";
68
+ export { k as AccessibleSelect, t as AccordionContentPrimitive, r as AccordionHeaderPrimitive, i as AccordionItemPrimitive, n as AccordionTriggerPrimitive, e as BaseAccordion, a as BaseAccordionItem, A as BaseAlert, N as BaseAutocomplete, F as BaseBadge, fe as BaseBreadcrumb, D as BaseButton, ce as BaseCard, I as BaseComplexToggle, O as BaseDropDown, j as BaseFloatingLabel, M as BaseInput, U as BaseModal, L as BasePagination, W as BaseShimmerLoader, R as BaseSlider, Y as BaseSnackbar, h as BaseTab, m as BaseTabView, g as BaseTabs, _ as BaseTabsContent, v as BaseTabsIndicator, y as BaseTabsList, b as BaseTabsTrigger, z as BaseTextarea, B as BaseToggle, V as BaseTooltip, H as BaseUploadFile, ue as CardDescriptionPrimitive, de as CardImagePrimitive, le as CardRootPrimitive, l as CheckboxBtn, d as CheckboxButtonGroup, u as CheckboxGroup, p as CheckboxGroupItemPrimitive, f as CheckboxGroupPrimitive, P as ClearableAutocomplete, K as DoughnutChart, X as IntersectionObservable, Z as IntersectionObserver, Q as IntersectionObserverProvider, $ as IntersectionObserverTarget, q as LineChart, c as ProgressIndicatorPrimitive, s as ProgressRootPrimitive, x as RadioButton, w as RadioButtonGroup, C as RadioButtonItem, S as RadioGroup, T as RadioGroupItemPrimitive, o as SelectItem, G as ShimmerMultiLine, J as SimpleSlider, E as StaticSpinner, ee as SwiperCarousel, ae as SwiperNavigationPrimitive, ie as SwiperPaginationPrimitive, re as SwiperPrimitive, ne as SwiperRootPrimitive, te as SwiperSlide, oe as SwiperSlideImagePrimitive, se as SwiperThumbnailPrimitive };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.8.1",
3
+ "version": "2.8.2-alpha.0",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -84,12 +84,12 @@
84
84
  "vue-router": "^5.1.0",
85
85
  "vue-tsc": "^3.3.3",
86
86
  "@wikicasa-dev/tsconfig": "0.0.0",
87
- "@wikicasa-dev/eslint-config": "0.0.0",
88
87
  "@wikicasa-dev/tailwind-plugins": "0.0.7",
89
- "@wikicasa-dev/types": "2.8.0",
88
+ "@wikicasa-dev/eslint-config": "0.0.0",
90
89
  "@wikicasa-dev/svg-icons": "1.3.7",
91
- "@wikicasa-dev/utilities": "1.2.11",
92
- "@wikicasa-dev/vue-composables": "0.2.0"
90
+ "@wikicasa-dev/vue-composables": "0.2.0",
91
+ "@wikicasa-dev/types": "2.8.0",
92
+ "@wikicasa-dev/utilities": "1.2.11"
93
93
  },
94
94
  "readme": "ERROR: No README data found!",
95
95
  "scripts": {