y-design-ssr 1.1.7 → 1.1.9

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,11 +1,11 @@
1
- import { ref as z, reactive as N, getCurrentInstance as le, provide as Se, isVNode as oe, inject as pe, onUnmounted as Ne, computed as C, defineComponent as H, createVNode as b, watch as Z, onMounted as re, nextTick as ee, onBeforeUnmount as Ce, onBeforeUpdate as Te } from "vue";
2
- const V = (e, n) => n ? typeof n == "string" ? ` ${e}--${n}` : Array.isArray(n) ? n.reduce((a, l) => a + V(e, l), "") : Object.keys(n).reduce(
3
- (a, l) => a + (n[l] ? V(e, l) : ""),
1
+ import { ref as X, reactive as D, getCurrentInstance as oe, provide as Se, isVNode as ae, inject as Te, onUnmounted as Ne, computed as x, defineComponent as U, createVNode as N, watch as Z, onMounted as ce, nextTick as ee, onBeforeUnmount as Ce, onBeforeUpdate as Ee } from "vue";
2
+ const H = (e, o) => o ? typeof o == "string" ? ` ${e}--${o}` : Array.isArray(o) ? o.reduce((i, t) => i + H(e, t), "") : Object.keys(o).reduce(
3
+ (i, t) => i + (o[t] ? H(e, t) : ""),
4
4
  ""
5
- ) : "", ze = (e) => (n, a) => {
6
- let l = n, v = a;
7
- return l && typeof l != "string" && (v = l, l = ""), l = l ? `${e}__${l}` : e, `${l}${V(l, v)}`;
8
- }, Ee = () => (e, n) => n ? `${V(`y-${e}`, n)}` : `y-${e}`, Le = {
5
+ ) : "", Le = (e) => (o, i) => {
6
+ let t = o, m = i;
7
+ return t && typeof t != "string" && (m = t, t = ""), t = t ? `${e}__${t}` : e, `${t}${H(t, m)}`;
8
+ }, ze = () => (e, o) => o ? `${H(`y-${e}`, o)}` : `y-${e}`, Be = {
9
9
  "pull-refresh": {
10
10
  pulling: "下拉刷新...",
11
11
  loosing: "释放刷新...",
@@ -17,58 +17,58 @@ const V = (e, n) => n ? typeof n == "string" ? ` ${e}--${n}` : Array.isArray(n)
17
17
  validateMessage: "请输入正确内容"
18
18
  }
19
19
  };
20
- z("zh-CN");
21
- N({
22
- "zh-CN": Le
20
+ X("zh-CN");
21
+ D({
22
+ "zh-CN": Be
23
23
  });
24
- const U = (e) => {
25
- const n = `y-${e}`;
26
- return [n, ze(n), Ee()];
24
+ const G = (e) => {
25
+ const o = `y-${e}`;
26
+ return [o, Le(o), ze()];
27
27
  };
28
- var te = /* @__PURE__ */ ((e) => (e.left = "left", e.top = "top", e.bottom = "bottom", e.right = "right", e))(te || {}), W = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(W || {});
29
- const ie = (e, n) => typeof e == "string" && e.includes("%") && e.includes("%") ? n * Number(e.replace(/%/g, "")) / 100 : Number(e), $e = (e) => {
30
- const n = [], a = (l) => {
31
- Array.isArray(l) && l.forEach((v) => {
28
+ var te = /* @__PURE__ */ ((e) => (e.left = "left", e.top = "top", e.bottom = "bottom", e.right = "right", e))(te || {}), F = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(F || {});
29
+ const se = (e, o) => typeof e == "string" && e.includes("%") && e.includes("%") ? o * Number(e.replace(/%/g, "")) / 100 : Number(e), Ie = (e) => {
30
+ const o = [], i = (t) => {
31
+ Array.isArray(t) && t.forEach((m) => {
32
32
  var u;
33
- oe(v) && (n.push(v), (u = v.component) != null && u.subTree && a(v.component.subTree.children), v.children && a(v.children));
33
+ ae(m) && (o.push(m), (u = m.component) != null && u.subTree && i(m.component.subTree.children), m.children && i(m.children));
34
34
  });
35
35
  };
36
- return a(e), n;
37
- }, xe = (e, n) => {
38
- const a = $e(n.subTree.children);
39
- e.sort((l, v) => a.indexOf(l.vnode) - a.indexOf(v.vnode));
40
- }, ce = (e) => {
41
- const n = le(), a = N([]);
36
+ return i(e), o;
37
+ }, $e = (e, o) => {
38
+ const i = Ie(o.subTree.children);
39
+ e.sort((t, m) => i.indexOf(t.vnode) - i.indexOf(m.vnode));
40
+ }, ue = (e) => {
41
+ const o = oe(), i = D([]);
42
42
  return {
43
- children: a,
44
- initProvide: (v) => {
43
+ children: i,
44
+ initProvide: (m) => {
45
45
  Se(e, {
46
- addChild: (r) => {
47
- r.proxy && (a.push(r), n && xe(a, n));
46
+ addChild: (a) => {
47
+ a.proxy && (i.push(a), o && $e(i, o));
48
48
  },
49
- removeChild: (r) => {
50
- const f = a.indexOf(r);
51
- a.splice(f, 1);
49
+ removeChild: (a) => {
50
+ const d = i.indexOf(a);
51
+ i.splice(d, 1);
52
52
  },
53
- children: a,
54
- ...v
53
+ children: i,
54
+ ...m
55
55
  });
56
56
  }
57
57
  };
58
- }, ue = (e) => {
59
- const n = pe(e, null), a = le();
60
- if (n && a) {
61
- const { children: l, addChild: v, removeChild: u } = n;
62
- return v(a), Ne(() => u(a)), {
63
- index: C(() => l.indexOf(a)),
64
- parent: n
58
+ }, fe = (e) => {
59
+ const o = Te(e, null), i = oe();
60
+ if (o && i) {
61
+ const { children: t, addChild: m, removeChild: u } = o;
62
+ return m(i), Ne(() => u(i)), {
63
+ index: x(() => t.indexOf(i)),
64
+ parent: o
65
65
  };
66
66
  }
67
67
  return {
68
68
  parent: null,
69
- index: z(-1)
69
+ index: X(-1)
70
70
  };
71
- }, [De, Ie] = U("swipe-item"), K = /* @__PURE__ */ H({
71
+ }, [De, xe] = G("swipe-item"), K = /* @__PURE__ */ U({
72
72
  name: De,
73
73
  props: {
74
74
  clonenNode: {
@@ -81,36 +81,36 @@ const ie = (e, n) => typeof e == "string" && e.includes("%") && e.includes("%")
81
81
  }
82
82
  },
83
83
  setup(e, {
84
- slots: n
84
+ slots: o
85
85
  }) {
86
- const a = le(), {
87
- parent: l
88
- } = ue(de);
89
- !e.clonenNode && a && (l == null || l.children.push(a));
90
- const v = C(() => e.clonenNode ? e.index : l == null ? void 0 : l.children.findIndex((c) => c.proxy === (a == null ? void 0 : a.proxy))), u = C(() => {
91
- const c = `${(l == null ? void 0 : l.itemDetail.size) || 0}px`;
92
- let r = "auto";
93
- const f = `${(l == null ? void 0 : l.itemDetail.space) || 0}px`;
94
- return l != null && l.props.autoHeight && (l == null ? void 0 : l.activeIndex) !== v.value && (r = "0"), l != null && l.props.vertical ? {
95
- height: c,
96
- width: r,
97
- marginBottom: f
86
+ const i = oe(), {
87
+ parent: t
88
+ } = fe(me);
89
+ !e.clonenNode && i && (t == null || t.children.push(i));
90
+ const m = x(() => e.clonenNode ? e.index : t == null ? void 0 : t.children.findIndex((f) => f.proxy === (i == null ? void 0 : i.proxy))), u = x(() => {
91
+ const f = `${(t == null ? void 0 : t.itemDetail.size) || 0}px`;
92
+ let a = "auto";
93
+ const d = `${(t == null ? void 0 : t.itemDetail.space) || 0}px`;
94
+ return t != null && t.props.autoHeight && (t == null ? void 0 : t.activeIndex) !== m.value && (a = "0"), t != null && t.props.vertical ? {
95
+ height: f,
96
+ width: a,
97
+ marginBottom: d
98
98
  } : {
99
- width: c,
100
- height: r,
101
- marginRight: f
99
+ width: f,
100
+ height: a,
101
+ marginRight: d
102
102
  };
103
103
  });
104
104
  return () => {
105
- var r, f;
106
- const c = ((r = l == null ? void 0 : l.itemShowedList) == null ? void 0 : r.list[v.value || 0]) || !1;
107
- return b("div", {
108
- class: Ie(),
105
+ var a, d;
106
+ const f = ((a = t == null ? void 0 : t.itemShowedList) == null ? void 0 : a.list[m.value || 0]) || !1;
107
+ return N("div", {
108
+ class: xe(),
109
109
  style: u.value
110
- }, [c ? e.clonenNode || ((f = n.default) == null ? void 0 : f.call(n)) : null]);
110
+ }, [f ? e.clonenNode || ((d = o.default) == null ? void 0 : d.call(o)) : null]);
111
111
  };
112
112
  }
113
- }), Be = {
113
+ }), Ye = {
114
114
  autoplayTime: {
115
115
  type: Number,
116
116
  default: 0
@@ -175,130 +175,130 @@ const ie = (e, n) => typeof e == "string" && e.includes("%") && e.includes("%")
175
175
  type: String,
176
176
  default: "center"
177
177
  }
178
- }, [fe, q] = U("swipe"), de = fe, ke = /* @__PURE__ */ H({
179
- name: fe,
178
+ }, [de, q] = G("swipe"), me = de, Xe = /* @__PURE__ */ U({
179
+ name: de,
180
180
  components: {
181
181
  YSwipeItem: K
182
182
  },
183
- props: Be,
183
+ props: Ye,
184
184
  setup(e, {
185
- slots: n,
186
- emit: a,
187
- expose: l
185
+ slots: o,
186
+ emit: i,
187
+ expose: t
188
188
  }) {
189
189
  const {
190
- initProvide: v
191
- } = ce(de), u = N([]), c = z(Number(e.initIndex)), r = N({
190
+ initProvide: m
191
+ } = ue(me), u = D([]), f = X(Number(e.initIndex)), a = D({
192
192
  // 元素尺寸
193
193
  size: 0,
194
194
  // 间距
195
195
  space: 0,
196
196
  // 元素宽度比swipe小,占满整个视窗
197
197
  isFillViewport: !1
198
- }), f = N({
198
+ }), d = D({
199
199
  // 偏移量
200
200
  offset: 0,
201
201
  // 视窗大小
202
202
  viewportSize: 0,
203
203
  // 重复节点个数
204
204
  cloneNodeCount: 0
205
- }), T = z(), g = z(), I = () => {
206
- const t = u.length, s = [];
207
- for (let m = 0; m < t; m++)
208
- s.push(!e.lazy);
209
- return s;
210
- }, R = () => {
205
+ }), L = X(), p = X(), O = () => {
206
+ const n = u.length, r = [];
207
+ for (let h = 0; h < n; h++)
208
+ r.push(!e.lazy);
209
+ return r;
210
+ }, M = () => {
211
211
  if (!e.lazy)
212
212
  return;
213
- const t = r.size + r.space, s = u.length * t;
214
- let m = -(f.offset + o.offset) - f.cloneNodeCount * t;
215
- m < 0 && (m += s);
216
- const w = m + f.viewportSize;
217
- for (let y = 0; y < u.length; y++)
218
- if (!k.list[y]) {
219
- const p = t * y, E = p + r.size;
220
- (p >= m && p < w || E > m && E < w || p < m && E > w) && (k.list[y] = !0);
213
+ const n = a.size + a.space, r = u.length * n;
214
+ let h = -(d.offset + c.offset) - d.cloneNodeCount * n;
215
+ h < 0 && (h += r);
216
+ const B = h + d.viewportSize;
217
+ for (let T = 0; T < u.length; T++)
218
+ if (!I.list[T]) {
219
+ const $ = n * T, k = $ + a.size;
220
+ ($ >= h && $ < B || k > h && k < B || $ < h && k > B) && (I.list[T] = !0);
221
221
  }
222
- }, k = N({
223
- list: I()
224
- }), S = () => {
225
- k.list = I(), R();
222
+ }, I = D({
223
+ list: O()
224
+ }), w = () => {
225
+ I.list = O(), M();
226
226
  };
227
- Z(() => [...u], S);
228
- const B = (t, s) => {
229
- t ? r.size = ie(t, s) : r.size = s, r.space = Number(e.itemSpace) || 0, r.isFillViewport = r.size >= s, f.viewportSize = s, f.cloneNodeCount = G();
230
- }, G = () => {
231
- if (x.value) {
232
- const t = r.size + r.space;
233
- if (t === 0)
227
+ Z(() => [...u], w);
228
+ const _ = (n, r) => {
229
+ n ? a.size = se(n, r) : a.size = r, a.space = Number(e.itemSpace) || 0, a.isFillViewport = a.size >= r, d.viewportSize = r, d.cloneNodeCount = P();
230
+ }, P = () => {
231
+ if (z.value) {
232
+ const n = a.size + a.space;
233
+ if (n === 0)
234
234
  return 0;
235
- const s = f.viewportSize * 2 - t, m = Math.ceil(s / t);
236
- return Math.min(m, u.length - 1);
235
+ const r = d.viewportSize * 2 - n, h = Math.ceil(r / n);
236
+ return Math.min(h, u.length - 1);
237
237
  }
238
238
  return 0;
239
- }, L = () => {
240
- if (!T.value)
239
+ }, Y = () => {
240
+ if (!L.value)
241
241
  return;
242
242
  const {
243
- width: t,
244
- height: s
245
- } = T.value.getBoundingClientRect();
246
- e.vertical ? B(e.itemSize, s) : B(e.itemSize, t), c.value = c.value >= u.length ? u.length - 1 : c.value, c.value < 0 && (c.value = 0), D(c.value), S(), h();
243
+ width: n,
244
+ height: r
245
+ } = L.value.getBoundingClientRect();
246
+ e.vertical ? _(e.itemSize, r) : _(e.itemSize, n), f.value = f.value >= u.length ? u.length - 1 : f.value, f.value < 0 && (f.value = 0), l(f.value), w(), b();
247
247
  };
248
- re(() => {
249
- if (ee(L).catch(() => {
250
- }), e.touchable && T.value) {
251
- const t = T.value;
252
- t.addEventListener("touchstart", M, !1), t.addEventListener("mousedown", M, !1), t.addEventListener("touchmove", P, !1), t.addEventListener("mousemove", P, !1), t.addEventListener("touchend", $, !1), t.addEventListener("mouseup", $, !1), t.addEventListener("mouseleave", $, !1), t.addEventListener("touchcancel", $, !1);
248
+ ce(() => {
249
+ if (ee(Y).catch(() => {
250
+ }), e.touchable && L.value) {
251
+ const n = L.value;
252
+ n.addEventListener("touchstart", A, !1), n.addEventListener("mousedown", A, !1), n.addEventListener("touchmove", W, !1), n.addEventListener("mousemove", W, !1), n.addEventListener("touchend", R, !1), n.addEventListener("mouseup", R, !1), n.addEventListener("mouseleave", R, !1), n.addEventListener("touchcancel", R, !1);
253
253
  }
254
- window.addEventListener("resize", L, !1), window.addEventListener("orientationchange", L, !1);
254
+ window.addEventListener("resize", Y, !1), window.addEventListener("orientationchange", Y, !1);
255
255
  }), Ce(() => {
256
- if (d(), e.touchable && T.value) {
257
- const t = T.value;
258
- t.removeEventListener("touchstart", M, !1), t.removeEventListener("mousedown", M, !1), t.removeEventListener("mousemove", P, !1), t.removeEventListener("touchmove", P, !1), t.removeEventListener("mouseup", $, !1), t.removeEventListener("touchend", $, !1), t.removeEventListener("mouseleave", $, !1), t.removeEventListener("touchcancel", $, !1);
256
+ if (v(), e.touchable && L.value) {
257
+ const n = L.value;
258
+ n.removeEventListener("touchstart", A, !1), n.removeEventListener("mousedown", A, !1), n.removeEventListener("mousemove", W, !1), n.removeEventListener("touchmove", W, !1), n.removeEventListener("mouseup", R, !1), n.removeEventListener("touchend", R, !1), n.removeEventListener("mouseleave", R, !1), n.removeEventListener("touchcancel", R, !1);
259
259
  }
260
- window.removeEventListener("resize", L, !1), window.removeEventListener("orientationchange", L, !1);
260
+ window.removeEventListener("resize", Y, !1), window.removeEventListener("orientationchange", Y, !1);
261
261
  });
262
- const j = C(() => {
263
- let t = 0;
262
+ const j = x(() => {
263
+ let n = 0;
264
264
  switch (e.align) {
265
- case W.start:
266
- t = 0;
265
+ case F.start:
266
+ n = 0;
267
267
  break;
268
- case W.center:
269
- t = (f.viewportSize - r.size) / 2;
268
+ case F.center:
269
+ n = (d.viewportSize - a.size) / 2;
270
270
  break;
271
- case W.end:
272
- t = f.viewportSize - r.size;
271
+ case F.end:
272
+ n = d.viewportSize - a.size;
273
273
  break;
274
274
  default:
275
- t = 0;
275
+ n = 0;
276
276
  }
277
- return t;
278
- }), x = C(() => e.loop && u.length > 1), D = (t) => {
279
- const s = r.size + r.space;
280
- x.value ? f.offset = -s * (t + f.cloneNodeCount) + j.value : (f.offset = -s * t + j.value, e.align !== "center" && (t === 0 && (f.offset = 0), t === u.length - 1 && (f.offset = -s * t + f.viewportSize - r.size)));
281
- }, F = () => {
282
- D(c.value), a("afterChange", c.value);
283
- }, _ = (t) => (u.length + t) % u.length, A = (t, s = !0) => {
284
- c.value = _(t), D(t), R(), a("change", c.value), s ? (o.transitionEnabled = !0, g.value && g.value.addEventListener("transitionend", () => {
285
- o.transitionEnabled = !1, F();
277
+ return n;
278
+ }), z = x(() => e.loop && u.length > 1), l = (n) => {
279
+ const r = a.size + a.space;
280
+ z.value ? d.offset = -r * (n + d.cloneNodeCount) + j.value : (d.offset = -r * n + j.value, e.align !== "center" && (n === 0 && (d.offset = 0), n === u.length - 1 && (d.offset = -r * n + d.viewportSize - a.size)));
281
+ }, g = () => {
282
+ l(f.value), i("afterChange", f.value);
283
+ }, y = (n) => (u.length + n) % u.length, C = (n, r = !0) => {
284
+ f.value = y(n), l(n), M(), i("change", f.value), r ? (c.transitionEnabled = !0, p.value && p.value.addEventListener("transitionend", () => {
285
+ c.transitionEnabled = !1, g();
286
286
  }, {
287
287
  once: !0
288
- })) : F();
289
- }, Y = (t = !0) => {
290
- A(c.value - 1, t);
291
- }, O = (t = !0) => {
292
- A(c.value + 1, t);
288
+ })) : g();
289
+ }, E = (n = !0) => {
290
+ C(f.value - 1, n);
291
+ }, S = (n = !0) => {
292
+ C(f.value + 1, n);
293
293
  };
294
- let i = null;
295
- const d = () => {
296
- e.autoplayTime && i && clearInterval(i);
297
- }, h = () => {
298
- e.autoplayTime && u.length > 1 && (i && clearInterval(i), i = setInterval(() => {
299
- O();
294
+ let s = null;
295
+ const v = () => {
296
+ e.autoplayTime && s && clearInterval(s);
297
+ }, b = () => {
298
+ e.autoplayTime && u.length > 1 && (s && clearInterval(s), s = setInterval(() => {
299
+ S();
300
300
  }, Number(e.autoplayTime)));
301
- }, o = N({
301
+ }, c = D({
302
302
  // 拖拽中
303
303
  isDragging: !1,
304
304
  // 是否首次拖动
@@ -315,96 +315,96 @@ const ie = (e, n) => typeof e == "string" && e.includes("%") && e.includes("%")
315
315
  transitionEnabled: !1,
316
316
  // 当前次拖拽不满足翻页条件
317
317
  isDissatisfy: !1
318
- }), M = (t) => {
319
- if (o.transitionEnabled)
318
+ }), A = (n) => {
319
+ if (c.transitionEnabled)
320
320
  return;
321
- let s = 0, m = 0;
322
- "touches" in t ? (s = t.touches[0].clientX, m = t.touches[0].clientY) : (s = t.clientX, m = t.clientY), o.startX = s, o.startY = m, o.isDragging = !0, o.isFirstTouch = !0, o.startTime = /* @__PURE__ */ new Date(), d();
323
- }, P = (t) => {
324
- if (!o.isDragging)
321
+ let r = 0, h = 0;
322
+ "touches" in n ? (r = n.touches[0].clientX, h = n.touches[0].clientY) : (r = n.clientX, h = n.clientY), c.startX = r, c.startY = h, c.isDragging = !0, c.isFirstTouch = !0, c.startTime = /* @__PURE__ */ new Date(), v();
323
+ }, W = (n) => {
324
+ if (!c.isDragging)
325
325
  return;
326
- let s = 0, m = 0;
327
- "touches" in t ? (s = t.touches[0].clientX, m = t.touches[0].clientY) : (s = t.clientX, m = t.clientY);
328
- const w = s - o.startX, y = m - o.startY;
329
- if (o.isFirstTouch && (o.isFirstTouch = !1, Math.abs(w) < Math.abs(y) !== e.vertical)) {
330
- o.isDragging = !1;
326
+ let r = 0, h = 0;
327
+ "touches" in n ? (r = n.touches[0].clientX, h = n.touches[0].clientY) : (r = n.clientX, h = n.clientY);
328
+ const B = r - c.startX, T = h - c.startY;
329
+ if (c.isFirstTouch && (c.isFirstTouch = !1, Math.abs(B) < Math.abs(T) !== e.vertical)) {
330
+ c.isDragging = !1;
331
331
  return;
332
332
  }
333
- t.preventDefault(), o.offset = e.vertical ? y : w, R(), a("dragging", {
334
- percent: o.offset / (r.size + r.space),
335
- offset: o.offset
336
- }), o.isDissatisfy = !1;
337
- }, $ = () => {
338
- if (!o.isDragging)
333
+ n.preventDefault(), c.offset = e.vertical ? T : B, M(), i("dragging", {
334
+ percent: c.offset / (a.size + a.space),
335
+ offset: c.offset
336
+ }), c.isDissatisfy = !1;
337
+ }, R = () => {
338
+ if (!c.isDragging)
339
339
  return;
340
- o.isDragging = !1;
341
- const s = (/* @__PURE__ */ new Date()).getTime() - o.startTime.getTime();
342
- he() && (Math.abs(o.offset) > me.value || Math.abs(o.offset) / s > 0.5) ? (o.offset > 0 ? Y() : O(), o.offset = 0, o.isDissatisfy = !1) : (o.offset = 0, o.isDissatisfy = !0), h();
343
- }, me = C(() => ie(e.minSwipeDistance, r.size + r.space)), he = () => {
344
- if (x.value)
340
+ c.isDragging = !1;
341
+ const r = (/* @__PURE__ */ new Date()).getTime() - c.startTime.getTime();
342
+ he() && (Math.abs(c.offset) > ge.value || Math.abs(c.offset) / r > 0.5) ? (c.offset > 0 ? E() : S(), c.offset = 0, c.isDissatisfy = !1) : (c.offset = 0, c.isDissatisfy = !0), b();
343
+ }, ge = x(() => se(e.minSwipeDistance, a.size + a.space)), he = () => {
344
+ if (z.value)
345
345
  return !0;
346
- const t = o.offset > 0 ? c.value - 1 : c.value + 1;
347
- return t >= 0 && t < u.length;
348
- }, ge = C(() => {
349
- const t = o.isDragging && !e.isFollowHand ? f.offset : f.offset + o.offset, s = {};
350
- return e.vertical ? (s.transform = `translate3d(0, ${t}px, 0)`, s.transitionDuration = o.transitionEnabled || o.isDissatisfy ? `${e.duration}ms` : "0ms") : (s.transform = `translate3d(${t}px, 0, 0)`, s.transitionDuration = o.transitionEnabled || o.isDissatisfy ? `${e.duration}ms` : "0ms"), o.isDragging && (s.transition = "none"), e.vertical && (s.flexDirection = "column"), e.autoHeight && (s.display = "block", s.whiteSpace = "nowrap"), s;
351
- }), ye = C(() => ["y-swipe__dots", `y-swipe__dots--${e.dotsPosition || (e.vertical ? te.left : te.bottom)}`]);
352
- l({
353
- moveTo: A,
354
- next: O,
355
- prev: Y,
356
- resize: L
346
+ const n = c.offset > 0 ? f.value - 1 : f.value + 1;
347
+ return n >= 0 && n < u.length;
348
+ }, ye = x(() => {
349
+ const n = c.isDragging && !e.isFollowHand ? d.offset : d.offset + c.offset, r = {};
350
+ return e.vertical ? (r.transform = `translate3d(0, ${n}px, 0)`, r.transitionDuration = c.transitionEnabled || c.isDissatisfy ? `${e.duration}ms` : "0ms") : (r.transform = `translate3d(${n}px, 0, 0)`, r.transitionDuration = c.transitionEnabled || c.isDissatisfy ? `${e.duration}ms` : "0ms"), c.isDragging && (r.transition = "none"), e.vertical && (r.flexDirection = "column"), e.autoHeight && (r.display = "block", r.whiteSpace = "nowrap"), r;
351
+ }), pe = x(() => ["y-swipe__dots", `y-swipe__dots--${e.dotsPosition || (e.vertical ? te.left : te.bottom)}`]);
352
+ t({
353
+ moveTo: C,
354
+ next: S,
355
+ prev: E,
356
+ resize: Y
357
357
  });
358
- const be = N({
358
+ const be = D({
359
359
  children: u,
360
- activeIndex: c,
360
+ activeIndex: f,
361
361
  props: e,
362
- itemDetail: r,
363
- itemShowedList: k
362
+ itemDetail: a,
363
+ itemShowedList: I
364
364
  });
365
- v(be);
366
- const we = () => e.dots ? b("div", {
367
- class: ye.value
368
- }, [u.map((t, s) => {
369
- const m = q("dot", {
370
- active: s === c.value
365
+ m(be);
366
+ const we = () => e.dots ? N("div", {
367
+ class: pe.value
368
+ }, [u.map((n, r) => {
369
+ const h = q("dot", {
370
+ active: r === f.value
371
371
  });
372
- return b("div", {
373
- class: m,
372
+ return N("div", {
373
+ class: h,
374
374
  style: {
375
375
  backgroundColor: e.dotsColor
376
376
  },
377
- key: s
377
+ key: r
378
378
  }, null);
379
379
  })]) : null;
380
380
  return () => {
381
- var t;
382
- return b("div", {
381
+ var n;
382
+ return N("div", {
383
383
  class: q(),
384
- ref: T
385
- }, [b("div", {
384
+ ref: L
385
+ }, [N("div", {
386
386
  class: q("track"),
387
- style: ge.value,
388
- ref: g
389
- }, [Array(f.cloneNodeCount).fill("").map((s, m) => {
390
- var p, E, X;
391
- const w = _(m - f.cloneNodeCount), y = (X = (p = u[w]) == null ? void 0 : (E = p.slots).default) == null ? void 0 : X.call(E);
392
- return y ? b(K, {
393
- clonenNode: y,
394
- index: w
387
+ style: ye.value,
388
+ ref: p
389
+ }, [Array(d.cloneNodeCount).fill("").map((r, h) => {
390
+ var $, k, V;
391
+ const B = y(h - d.cloneNodeCount), T = (V = ($ = u[B]) == null ? void 0 : (k = $.slots).default) == null ? void 0 : V.call(k);
392
+ return T ? N(K, {
393
+ clonenNode: T,
394
+ index: B
395
395
  }, null) : null;
396
- }), (t = n.default) == null ? void 0 : t.call(n), Array(f.cloneNodeCount).fill("").map((s, m) => {
397
- var p, E, X;
398
- const w = _(m), y = (X = (p = u[w]) == null ? void 0 : (E = p.slots).default) == null ? void 0 : X.call(E);
399
- return y ? b(K, {
400
- clonenNode: y,
401
- index: w
396
+ }), (n = o.default) == null ? void 0 : n.call(o), Array(d.cloneNodeCount).fill("").map((r, h) => {
397
+ var $, k, V;
398
+ const B = y(h), T = (V = ($ = u[B]) == null ? void 0 : (k = $.slots).default) == null ? void 0 : V.call(k);
399
+ return T ? N(K, {
400
+ clonenNode: T,
401
+ index: B
402
402
  }, null) : null;
403
- })]), n.dots ? n.dots() : we()]);
403
+ })]), o.dots ? o.dots() : we()]);
404
404
  };
405
405
  }
406
- }), [_e, se] = U("tabs-title"), ae = /* @__PURE__ */ H({
407
- name: _e,
406
+ }), [Oe, ie] = G("tabs-title"), re = /* @__PURE__ */ U({
407
+ name: Oe,
408
408
  props: {
409
409
  active: {
410
410
  type: Boolean,
@@ -429,34 +429,34 @@ const ie = (e, n) => typeof e == "string" && e.includes("%") && e.includes("%")
429
429
  },
430
430
  setup(e) {
431
431
  const {
432
- parent: n
433
- } = ue(ve), a = C(() => [{
432
+ parent: o
433
+ } = fe(ve), i = x(() => [{
434
434
  "y-el--clickable": !e.disabled
435
- }, se({
435
+ }, ie({
436
436
  scrollable: e.scrollable,
437
437
  disabled: e.disabled
438
- }), se(`${(n == null ? void 0 : n.props.size) || "middle"}`, {
438
+ }), ie(`${(o == null ? void 0 : o.props.size) || "middle"}`, {
439
439
  active: e.active
440
- }), n == null ? void 0 : n.props.titleClass, e.active ? n == null ? void 0 : n.props.titleActiveClass : ""]), l = C(() => ({
441
- ...n == null ? void 0 : n.props.titleStyle,
440
+ }), o == null ? void 0 : o.props.titleClass, e.active ? o == null ? void 0 : o.props.titleActiveClass : ""]), t = x(() => ({
441
+ ...o == null ? void 0 : o.props.titleStyle,
442
442
  ...e.active ? {
443
- ...n == null ? void 0 : n.props.titleActiveStyle
443
+ ...o == null ? void 0 : o.props.titleActiveStyle
444
444
  } : {}
445
445
  }));
446
446
  return () => {
447
447
  const {
448
- title: v,
448
+ title: m,
449
449
  titleSlot: u
450
450
  } = e;
451
- return b("div", {
452
- class: a.value,
453
- title: v,
454
- style: l.value,
451
+ return N("div", {
452
+ class: i.value,
453
+ title: m,
454
+ style: t.value,
455
455
  role: "presentation"
456
- }, [u ? u() : v]);
456
+ }, [u ? u() : m]);
457
457
  };
458
458
  }
459
- }), J = null, Ae = {
459
+ }), J = null, _e = {
460
460
  initIndex: {
461
461
  type: Number,
462
462
  default: 0
@@ -523,157 +523,333 @@ const ie = (e, n) => typeof e == "string" && e.includes("%") && e.includes("%")
523
523
  default: "center"
524
524
  }
525
525
  };
526
- function Ye(e) {
527
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !oe(e);
526
+ var ne = {}, ke = {
527
+ get exports() {
528
+ return ne;
529
+ },
530
+ set exports(e) {
531
+ ne = e;
532
+ }
533
+ };
534
+ (function(e, o) {
535
+ (function() {
536
+ function i() {
537
+ var t = window, m = document;
538
+ if ("scrollBehavior" in m.documentElement.style && t.__forceSmoothScrollPolyfill__ !== !0)
539
+ return;
540
+ var u = t.HTMLElement || t.Element, f = 468, a = {
541
+ scroll: t.scroll || t.scrollTo,
542
+ scrollBy: t.scrollBy,
543
+ elementScroll: u.prototype.scroll || O,
544
+ scrollIntoView: u.prototype.scrollIntoView
545
+ }, d = t.performance && t.performance.now ? t.performance.now.bind(t.performance) : Date.now;
546
+ function L(l) {
547
+ var g = ["MSIE ", "Trident/", "Edge/"];
548
+ return new RegExp(g.join("|")).test(l);
549
+ }
550
+ var p = L(t.navigator.userAgent) ? 1 : 0;
551
+ function O(l, g) {
552
+ this.scrollLeft = l, this.scrollTop = g;
553
+ }
554
+ function M(l) {
555
+ return 0.5 * (1 - Math.cos(Math.PI * l));
556
+ }
557
+ function I(l) {
558
+ if (l === null || typeof l != "object" || l.behavior === void 0 || l.behavior === "auto" || l.behavior === "instant")
559
+ return !0;
560
+ if (typeof l == "object" && l.behavior === "smooth")
561
+ return !1;
562
+ throw new TypeError(
563
+ "behavior member of ScrollOptions " + l.behavior + " is not a valid value for enumeration ScrollBehavior."
564
+ );
565
+ }
566
+ function w(l, g) {
567
+ if (g === "Y")
568
+ return l.clientHeight + p < l.scrollHeight;
569
+ if (g === "X")
570
+ return l.clientWidth + p < l.scrollWidth;
571
+ }
572
+ function _(l, g) {
573
+ var y = t.getComputedStyle(l, null)["overflow" + g];
574
+ return y === "auto" || y === "scroll";
575
+ }
576
+ function P(l) {
577
+ var g = w(l, "Y") && _(l, "Y"), y = w(l, "X") && _(l, "X");
578
+ return g || y;
579
+ }
580
+ function Y(l) {
581
+ for (; l !== m.body && P(l) === !1; )
582
+ l = l.parentNode || l.host;
583
+ return l;
584
+ }
585
+ function j(l) {
586
+ var g = d(), y, C, E, S = (g - l.startTime) / f;
587
+ S = S > 1 ? 1 : S, y = M(S), C = l.startX + (l.x - l.startX) * y, E = l.startY + (l.y - l.startY) * y, l.method.call(l.scrollable, C, E), (C !== l.x || E !== l.y) && t.requestAnimationFrame(j.bind(t, l));
588
+ }
589
+ function z(l, g, y) {
590
+ var C, E, S, s, v = d();
591
+ l === m.body ? (C = t, E = t.scrollX || t.pageXOffset, S = t.scrollY || t.pageYOffset, s = a.scroll) : (C = l, E = l.scrollLeft, S = l.scrollTop, s = O), j({
592
+ scrollable: C,
593
+ method: s,
594
+ startTime: v,
595
+ startX: E,
596
+ startY: S,
597
+ x: g,
598
+ y
599
+ });
600
+ }
601
+ t.scroll = t.scrollTo = function() {
602
+ if (arguments[0] !== void 0) {
603
+ if (I(arguments[0]) === !0) {
604
+ a.scroll.call(
605
+ t,
606
+ arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] != "object" ? arguments[0] : t.scrollX || t.pageXOffset,
607
+ // use top prop, second argument if present or fallback to scrollY
608
+ arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : t.scrollY || t.pageYOffset
609
+ );
610
+ return;
611
+ }
612
+ z.call(
613
+ t,
614
+ m.body,
615
+ arguments[0].left !== void 0 ? ~~arguments[0].left : t.scrollX || t.pageXOffset,
616
+ arguments[0].top !== void 0 ? ~~arguments[0].top : t.scrollY || t.pageYOffset
617
+ );
618
+ }
619
+ }, t.scrollBy = function() {
620
+ if (arguments[0] !== void 0) {
621
+ if (I(arguments[0])) {
622
+ a.scrollBy.call(
623
+ t,
624
+ arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] != "object" ? arguments[0] : 0,
625
+ arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : 0
626
+ );
627
+ return;
628
+ }
629
+ z.call(
630
+ t,
631
+ m.body,
632
+ ~~arguments[0].left + (t.scrollX || t.pageXOffset),
633
+ ~~arguments[0].top + (t.scrollY || t.pageYOffset)
634
+ );
635
+ }
636
+ }, u.prototype.scroll = u.prototype.scrollTo = function() {
637
+ if (arguments[0] !== void 0) {
638
+ if (I(arguments[0]) === !0) {
639
+ if (typeof arguments[0] == "number" && arguments[1] === void 0)
640
+ throw new SyntaxError("Value could not be converted");
641
+ a.elementScroll.call(
642
+ this,
643
+ // use left prop, first number argument or fallback to scrollLeft
644
+ arguments[0].left !== void 0 ? ~~arguments[0].left : typeof arguments[0] != "object" ? ~~arguments[0] : this.scrollLeft,
645
+ // use top prop, second argument or fallback to scrollTop
646
+ arguments[0].top !== void 0 ? ~~arguments[0].top : arguments[1] !== void 0 ? ~~arguments[1] : this.scrollTop
647
+ );
648
+ return;
649
+ }
650
+ var l = arguments[0].left, g = arguments[0].top;
651
+ z.call(
652
+ this,
653
+ this,
654
+ typeof l > "u" ? this.scrollLeft : ~~l,
655
+ typeof g > "u" ? this.scrollTop : ~~g
656
+ );
657
+ }
658
+ }, u.prototype.scrollBy = function() {
659
+ if (arguments[0] !== void 0) {
660
+ if (I(arguments[0]) === !0) {
661
+ a.elementScroll.call(
662
+ this,
663
+ arguments[0].left !== void 0 ? ~~arguments[0].left + this.scrollLeft : ~~arguments[0] + this.scrollLeft,
664
+ arguments[0].top !== void 0 ? ~~arguments[0].top + this.scrollTop : ~~arguments[1] + this.scrollTop
665
+ );
666
+ return;
667
+ }
668
+ this.scroll({
669
+ left: ~~arguments[0].left + this.scrollLeft,
670
+ top: ~~arguments[0].top + this.scrollTop,
671
+ behavior: arguments[0].behavior
672
+ });
673
+ }
674
+ }, u.prototype.scrollIntoView = function() {
675
+ if (I(arguments[0]) === !0) {
676
+ a.scrollIntoView.call(
677
+ this,
678
+ arguments[0] === void 0 ? !0 : arguments[0]
679
+ );
680
+ return;
681
+ }
682
+ var l = Y(this), g = l.getBoundingClientRect(), y = this.getBoundingClientRect();
683
+ l !== m.body ? (z.call(
684
+ this,
685
+ l,
686
+ l.scrollLeft + y.left - g.left,
687
+ l.scrollTop + y.top - g.top
688
+ ), t.getComputedStyle(l).position !== "fixed" && t.scrollBy({
689
+ left: g.left,
690
+ top: g.top,
691
+ behavior: "smooth"
692
+ })) : t.scrollBy({
693
+ left: y.left,
694
+ top: y.top,
695
+ behavior: "smooth"
696
+ });
697
+ };
698
+ }
699
+ e.exports = { polyfill: i };
700
+ })();
701
+ })(ke);
702
+ function Re(e) {
703
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !ae(e);
528
704
  }
529
- const [ne, Q] = U("tabs"), ve = ne, Oe = /* @__PURE__ */ H({
530
- name: ne,
705
+ const [le, Q] = G("tabs"), ve = le, je = /* @__PURE__ */ U({
706
+ name: le,
531
707
  components: {
532
- YTabTitle: ae
708
+ YTabTitle: re
533
709
  },
534
- props: Ae,
710
+ props: _e,
535
711
  setup(e, {
536
- slots: n,
537
- emit: a,
538
- expose: l
712
+ slots: o,
713
+ emit: i,
714
+ expose: t
539
715
  }) {
540
716
  const {
541
- initProvide: v
542
- } = ce(ve), u = z(!1), c = N([]), r = z(), f = C(() => c.length > e.titleScrollThreshold), T = (i) => c.findIndex((d) => (d.$props ? d.$props.name : "") === i), g = z(e.initName ? T(e.initName) : e.initIndex), I = (i) => {
543
- g.value = i;
544
- const d = r.value;
545
- d && (d == null || d.moveTo(i, e.changeWithAnimation));
717
+ initProvide: m
718
+ } = ue(ve), u = X(!1), f = D([]), a = X(), d = x(() => f.length > e.titleScrollThreshold), L = (s) => f.findIndex((v) => (v.$props ? v.$props.name : "") === s), p = X(e.initName ? L(e.initName) : e.initIndex), O = (s) => {
719
+ p.value = s;
720
+ const v = a.value;
721
+ v && (v == null || v.moveTo(s, e.changeWithAnimation));
546
722
  };
547
- l({
548
- scrollToByIndex: (i) => {
549
- I(i);
723
+ t({
724
+ scrollToByIndex: (s) => {
725
+ O(s);
550
726
  },
551
- scrollToByName: (i) => {
552
- const d = T(i);
553
- I(d);
727
+ scrollToByName: (s) => {
728
+ const v = L(s);
729
+ O(v);
554
730
  }
555
731
  });
556
- const S = z([]), B = z(), G = (i) => (d) => {
557
- S.value[i] = d;
558
- }, L = (i) => {
732
+ const w = X([]), _ = X(), P = (s) => (v) => {
733
+ w.value[s] = v;
734
+ }, Y = (s) => {
559
735
  const {
560
- title: d,
561
- name: h,
562
- disabled: o
563
- } = c[i].$props || {};
564
- g.value !== i && (a(o ? "disabledClick" : "click", i, d, h), !o && I(i));
736
+ title: v,
737
+ name: b,
738
+ disabled: c
739
+ } = f[s].$props || {};
740
+ p.value !== s && (i(c ? "disabledClick" : "click", s, v, b), !c && O(s));
565
741
  }, j = async () => {
566
742
  await ee(() => {
567
- if (!f.value || !B.value)
743
+ if (!d.value || !_.value)
568
744
  return;
569
- const i = B.value;
570
- if (!i || !S.value[g.value])
745
+ const s = _.value;
746
+ if (!s || !w.value[p.value])
571
747
  return;
572
- const d = S.value[g.value].$el, h = d.offsetLeft - (i.offsetWidth - d.offsetWidth) / 2 - i.scrollLeft;
573
- i.scrollBy({
574
- left: h,
748
+ const v = w.value[p.value].$el, b = v.offsetLeft - (s.offsetWidth - v.offsetWidth) / 2;
749
+ s.scrollTo({
750
+ left: b,
575
751
  behavior: "smooth"
576
752
  });
577
753
  });
578
754
  };
579
- Te(() => {
580
- S.value = [];
755
+ Ee(() => {
756
+ w.value = [];
581
757
  });
582
- const x = N({
758
+ const z = D({
583
759
  transform: "translateX(50%)",
584
760
  transition: "all 0ms ease-out"
585
- }), D = async () => {
761
+ }), l = async () => {
586
762
  await ee(() => {
587
- if (!S.value || S.value.length === 0)
763
+ if (!w.value || w.value.length === 0)
588
764
  return;
589
- const i = g.value >= S.value.length ? 0 : g.value, d = S.value[i].$el, h = d.offsetLeft + d.offsetWidth / 2;
590
- x.transform = `translateX(${h}px) translateX(-50%)`, u.value && (x.transition = `all ${e.duration}ms ease-out`), u.value = !0;
765
+ const s = p.value >= w.value.length ? 0 : p.value, v = w.value[s].$el, b = v.offsetLeft + v.offsetWidth / 2;
766
+ z.transform = `translateX(${b}px) translateX(-50%)`, u.value && (z.transition = `all ${e.duration}ms ease-out`), u.value = !0;
591
767
  });
592
- }, F = (i) => {
768
+ }, g = (s) => {
593
769
  const {
594
- title: d,
595
- name: h
596
- } = c[i].$props || {};
597
- a("change", i, d, h), g.value = i;
598
- }, _ = (i) => {
770
+ title: v,
771
+ name: b
772
+ } = f[s].$props || {};
773
+ i("change", s, v, b), p.value = s;
774
+ }, y = (s) => {
599
775
  const {
600
- title: d,
601
- name: h
602
- } = c[i].$props || {};
603
- a("afterChange", i, d, h), g.value = i;
604
- }, A = N({
605
- children: c,
606
- activeIndex: g,
776
+ title: v,
777
+ name: b
778
+ } = f[s].$props || {};
779
+ i("afterChange", s, v, b), p.value = s;
780
+ }, C = D({
781
+ children: f,
782
+ activeIndex: p,
607
783
  props: e
608
784
  });
609
- v(A);
610
- const Y = (i) => O(i) && /^\d+(\.\d+)?$/.test(i) ? `${i}px` : i, O = (i) => Object.prototype.toString.call(i) === "[object String]";
611
- return re(async () => {
612
- await D();
613
- }), Z(() => g.value, async () => {
614
- await D(), await j();
785
+ m(C);
786
+ const E = (s) => S(s) && /^\d+(\.\d+)?$/.test(s) ? `${s}px` : s, S = (s) => Object.prototype.toString.call(s) === "[object String]";
787
+ return ce(async () => {
788
+ ne.polyfill(), await l();
789
+ }), Z(() => p.value, async () => {
790
+ await l(), await j();
615
791
  }), Z(() => {
616
- var i;
617
- return (i = n.default) == null ? void 0 : i.length;
792
+ var s;
793
+ return (s = o.default) == null ? void 0 : s.length;
618
794
  }, async () => {
619
- await D();
795
+ await l();
620
796
  }), () => {
621
- let i;
622
- return b("div", {
623
- class: ne
624
- }, [b("div", {
797
+ let s;
798
+ return N("div", {
799
+ class: le
800
+ }, [N("div", {
625
801
  class: Q("list")
626
- }, [b("div", {
627
- ref: B,
802
+ }, [N("div", {
803
+ ref: _,
628
804
  class: Q("list-child-wrapper", {
629
- scrollable: f.value,
805
+ scrollable: d.value,
630
806
  [e.size]: e.size,
631
807
  [e.align]: e.align
632
808
  })
633
- }, [c.length > 0 && c.map((d, h) => b(ae, {
634
- title: d.title,
635
- disabled: d.disabled,
636
- "title-slot": d.$slots.title,
637
- key: h,
638
- ref: G(h),
639
- active: g.value === h,
640
- scrollable: f.value,
641
- onClick: () => L(h)
642
- }, null)), b("div", {
809
+ }, [f.length > 0 && f.map((v, b) => N(re, {
810
+ title: v.title,
811
+ disabled: v.disabled,
812
+ "title-slot": v.$slots.title,
813
+ key: b,
814
+ ref: P(b),
815
+ active: p.value === b,
816
+ scrollable: d.value,
817
+ onClick: () => Y(b)
818
+ }, null)), N("div", {
643
819
  class: Q("line"),
644
820
  style: {
645
- ...x,
646
- width: Y(e.lineWidth),
647
- height: Y(e.lineHeight),
821
+ ...z,
822
+ width: E(e.lineWidth),
823
+ height: E(e.lineHeight),
648
824
  backgroundColor: e.lineColor
649
825
  }
650
- }, null)])]), n.default ? b(ke, {
651
- ref: r,
826
+ }, null)])]), o.default ? N(Xe, {
827
+ ref: a,
652
828
  dots: !1,
653
829
  loop: !1,
654
- initIndex: g.value,
830
+ initIndex: p.value,
655
831
  lazy: e.lazy,
656
832
  touchable: e.touchable,
657
833
  duration: e.duration,
658
834
  "is-follow-hand": e.changeWithAnimation,
659
- onChange: F,
660
- onAfterChange: _
661
- }, Ye(i = n.default()) ? i : {
662
- default: () => [i]
835
+ onChange: g,
836
+ onAfterChange: y
837
+ }, Re(s = o.default()) ? s : {
838
+ default: () => [s]
663
839
  }) : null]);
664
840
  };
665
841
  }
666
842
  });
667
- function Xe(e) {
668
- const n = e;
669
- return n.install = (a) => {
670
- const { name: l } = e;
671
- l && a.component(l, e);
672
- }, n;
843
+ function Me(e) {
844
+ const o = e;
845
+ return o.install = (i) => {
846
+ const { name: t } = e;
847
+ t && i.component(t, e);
848
+ }, o;
673
849
  }
674
- const je = Xe(Oe);
850
+ const Ve = Me(je);
675
851
  export {
676
- Ae as acceptProps,
677
- je as default,
852
+ _e as acceptProps,
853
+ Ve as default,
678
854
  J as unknownProp
679
855
  };