@fox-js/navigation 4.0.1-15 → 4.0.1-17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
- import { defineComponent as P, resolveComponent as O, openBlock as b, createBlock as R, withCtx as Y, createVNode as J, Transition as K, resolveDynamicComponent as Q, unref as F, computed as X, createElementBlock as Z, createElementVNode as tt, normalizeStyle as U, renderSlot as et, reactive as nt, onMounted as ot, onBeforeUnmount as it, watch as st, normalizeClass as at } from "vue";
2
- import { FoxLeaveEnd as rt, OperationType as L } from "@fox-js/fox";
1
+ import { defineComponent as A, resolveComponent as X, openBlock as L, createBlock as R, withCtx as V, createVNode as J, Transition as K, resolveDynamicComponent as Q, unref as F, computed as P, createElementBlock as Z, createElementVNode as tt, normalizeStyle as U, renderSlot as et, reactive as nt, onMounted as ot, onBeforeUnmount as it, watch as st, normalizeClass as at } from "vue";
2
+ import { FoxLeaveEnd as rt, OperationType as D } from "@fox-js/fox";
3
3
  /*!
4
- * @fox-js/navigation v4.0.1-14 Thu Jun 13 2024 07:29:14 GMT+0800 (中国标准时间)
4
+ * @fox-js/navigation v4.0.1-16 Sat Sep 28 2024 19:51:20 GMT+0800 (中国标准时间)
5
5
  */
6
- const ct = /* @__PURE__ */ P({
6
+ const ct = /* @__PURE__ */ A({
7
7
  __name: "index",
8
8
  props: {
9
9
  routerViewName: {},
@@ -11,8 +11,8 @@ const ct = /* @__PURE__ */ P({
11
11
  },
12
12
  setup(t) {
13
13
  return (e, n) => {
14
- const o = O("fox-router-view");
15
- return b(), R(o, {
14
+ const o = X("fox-router-view");
15
+ return L(), R(o, {
16
16
  class: "fox-card-navigator",
17
17
  "view-class": "fox-card-navigator__item",
18
18
  "view-active-class": "fox-card-navigator__item-active",
@@ -27,7 +27,7 @@ const ct = /* @__PURE__ */ P({
27
27
  }), lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
28
28
  __proto__: null,
29
29
  default: ct
30
- }, Symbol.toStringTag, { value: "Module" })), ut = /* @__PURE__ */ P({
30
+ }, Symbol.toStringTag, { value: "Module" })), dt = /* @__PURE__ */ A({
31
31
  __name: "index",
32
32
  props: {
33
33
  routerViewName: {},
@@ -35,16 +35,16 @@ const ct = /* @__PURE__ */ P({
35
35
  },
36
36
  setup(t) {
37
37
  return (e, n) => {
38
- const o = O("fox-router-view");
39
- return b(), R(o, {
38
+ const o = X("fox-router-view");
39
+ return L(), R(o, {
40
40
  transition: !1,
41
41
  multi: !1,
42
42
  name: e.routerViewName
43
43
  }, {
44
- default: Y(({ Component: i }) => [
44
+ default: V(({ Component: i }) => [
45
45
  J(K, { name: "fox-default-navigator__trans" }, {
46
- default: Y(() => [
47
- (b(), R(Q(i)))
46
+ default: V(() => [
47
+ (L(), R(Q(i)))
48
48
  ]),
49
49
  _: 2
50
50
  }, 1024)
@@ -53,12 +53,12 @@ const ct = /* @__PURE__ */ P({
53
53
  }, 8, ["name"]);
54
54
  };
55
55
  }
56
- }), dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
+ }), ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
57
57
  __proto__: null,
58
- default: ut
59
- }, Symbol.toStringTag, { value: "Module" })), W = 10;
58
+ default: dt
59
+ }, Symbol.toStringTag, { value: "Module" })), N = 10;
60
60
  function ft(t, e) {
61
- return t > e && t > W ? "horizontal" : e > t && e > W ? "vertical" : "";
61
+ return t > e && t > N ? "horizontal" : e > t && e > N ? "vertical" : "";
62
62
  }
63
63
  function j() {
64
64
  const t = {
@@ -77,20 +77,20 @@ function j() {
77
77
  t.deltaX = 0, t.deltaY = 0, t.offsetX = 0, t.offsetY = 0, t.direction = "", t.startTime = 0;
78
78
  };
79
79
  return {
80
- move: (h) => {
81
- if (h.touches) {
82
- const s = h.touches[0];
83
- t.deltaX = s.clientX - t.startX, t.deltaY = s.clientY - t.startY, t.moveX = s.clientX, t.moveY = s.clientY;
84
- } else
80
+ move: (m) => {
81
+ if (m.touches) {
82
+ const h = m.touches[0];
85
83
  t.deltaX = h.clientX - t.startX, t.deltaY = h.clientY - t.startY, t.moveX = h.clientX, t.moveY = h.clientY;
84
+ } else
85
+ t.deltaX = m.clientX - t.startX, t.deltaY = m.clientY - t.startY, t.moveX = m.clientX, t.moveY = m.clientY;
86
86
  t.offsetX = Math.abs(t.deltaX), t.offsetY = Math.abs(t.deltaY), t.duration = Date.now() - t.startTime, t.direction || (t.direction = ft(t.offsetX, t.offsetY));
87
87
  },
88
- start: (h) => {
89
- if (o(), h.touches) {
90
- const s = h.touches[0];
91
- t.startX = s.clientX, t.startY = s.clientY;
92
- } else
88
+ start: (m) => {
89
+ if (o(), m.touches) {
90
+ const h = m.touches[0];
93
91
  t.startX = h.clientX, t.startY = h.clientY;
92
+ } else
93
+ t.startX = m.clientX, t.startY = m.clientY;
94
94
  t.startTime = Date.now();
95
95
  },
96
96
  reset: o,
@@ -130,11 +130,11 @@ const mt = (t) => {
130
130
  detail: void 0
131
131
  };
132
132
  const o = document.createEvent("Events");
133
- let i = !0, u = !0;
134
- for (let s in e)
135
- s === "bubbles" ? i = !!e[s] : s === "cancelable" ? u = !!e[s] : o[s] = e[s];
136
- o.initEvent(t, i, u), (n ?? document).dispatchEvent(o);
137
- }, vt = 15, gt = 300, _t = 200;
133
+ let i = !0, f = !0;
134
+ for (let h in e)
135
+ h === "bubbles" ? i = !!e[h] : h === "cancelable" ? f = !!e[h] : o[h] = e[h];
136
+ o.initEvent(t, i, f), (n ?? document).dispatchEvent(o);
137
+ }, gt = 15, vt = 300, _t = 200;
138
138
  function wt(t) {
139
139
  t.stopPropagation();
140
140
  }
@@ -144,7 +144,7 @@ function Tt(t, e, n = 1) {
144
144
  function C(t, e = 0, n, o = _t) {
145
145
  n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
146
146
  }
147
- function z(t) {
147
+ function W(t) {
148
148
  t.style.transition = "", t.style.transform = "";
149
149
  }
150
150
  const xt = /^matrix\((.+)\)$/;
@@ -157,63 +157,68 @@ function I(t) {
157
157
  }
158
158
  return e;
159
159
  }
160
- const V = /* @__PURE__ */ new WeakMap();
161
- function yt(t, e, n, o, i, u = 600, h = 60) {
162
- const s = {
160
+ const Y = /* @__PURE__ */ new WeakMap();
161
+ function yt(t, e, n, o, i, f = 600, m = 60, h = null) {
162
+ const c = {
163
163
  active: !0,
164
164
  startDistance: 0,
165
165
  scrollDistance: 0,
166
166
  scrollTime: 0,
167
167
  moving: !1,
168
+ dragging: !1,
168
169
  transitionEndTrigger: null
169
- }, x = t.previousSibling, d = j(), v = (g, f, r, w) => {
170
- let p = f + s.startDistance;
171
- if (r === "end") {
172
- const E = mt(g);
173
- let c = E.width * e;
174
- p < c ? p = 0 : p = E.width, s.transitionEndTrigger = () => {
175
- s.moving = !1, i && g.classList.remove(i), setTimeout(() => {
176
- x && z(x), p == 0 ? z(g) : pt(rt, {}, g), s.moving = !1;
177
- }, h);
178
- }, x && C(x, 0, "", 0), p > 0 && typeof o == "function" && o(), C(g, p, "end", w);
170
+ }, v = t.previousSibling, l = j(), T = (d, a, g, y) => {
171
+ let _ = a + c.startDistance;
172
+ if (g === "end") {
173
+ const r = mt(d);
174
+ let w = r.width * e;
175
+ _ < w ? _ = 0 : _ = r.width, c.transitionEndTrigger = () => {
176
+ c.moving = !1, d.classList.remove(i), setTimeout(() => {
177
+ v && W(v), _ == 0 ? W(d) : pt(rt, {}, d), c.moving = !1;
178
+ }, m);
179
+ }, v && C(v, 0, "", 0), _ > 0 && typeof o == "function" && o(), C(d, _, "end", y);
179
180
  } else
180
- p < 0 && (p = 0), C(g, p, "", 0);
181
- }, _ = () => {
182
- s.transitionEndTrigger && (s.transitionEndTrigger(), s.transitionEndTrigger = null);
183
- }, a = (g) => {
184
- d.start(g), s.scrollDistance = 0, s.moving && (s.scrollDistance = I(t)), i && t.classList.add(i), s.transitionEndTrigger = null, s.moving = !0;
185
- }, m = (g) => {
186
- s.moving = !0, d.move(g), !(d.isVertical() || I(t) === 0 && d.state.deltaX < 0) && (wt(g), v(t, d.state.deltaX, "", 0));
187
- }, l = () => {
188
- if (d.isVertical() || I(t) === 0 && d.state.deltaX < 0)
181
+ _ < 0 && (_ = 0), C(d, _, "", 0);
182
+ }, s = () => {
183
+ c.transitionEndTrigger && (c.transitionEndTrigger(), c.transitionEndTrigger = null);
184
+ }, p = (d) => {
185
+ if (l.start(d), c.draging = h ? h(t, l.state.startX, l.state.startY) : !0, !c.draging) {
186
+ l.reset();
189
187
  return;
190
- const f = d.state.deltaX;
191
- if (f === 0) {
192
- i && t.classList.remove(i), s.moving = !1;
188
+ }
189
+ c.scrollDistance = 0, c.moving && (c.scrollDistance = I(t)), t.classList.add(i), c.transitionEndTrigger = null, c.moving = !0;
190
+ }, u = (d) => {
191
+ !c.draging || (c.moving = !0, l.move(d), l.isVertical()) || I(t) === 0 && l.state.deltaX < 0 || (wt(d), T(t, l.state.deltaX, "", 0));
192
+ }, E = () => {
193
+ if (!c.draging || (c.draging = !1, l.isVertical()) || I(t) === 0 && l.state.deltaX < 0)
194
+ return;
195
+ const a = l.state.deltaX;
196
+ if (a === 0) {
197
+ t.classList.remove(i), c.moving = !1;
193
198
  return;
194
199
  }
195
- const r = d.state.duration;
196
- if (r < gt && Math.abs(f) > vt) {
197
- const p = Tt(f, r, n);
198
- v(t, p, "end", u);
200
+ const g = l.state.duration;
201
+ if (g < vt && Math.abs(a) > gt) {
202
+ const _ = Tt(a, g, n);
203
+ T(t, _, "end", f);
199
204
  } else
200
- v(t, f, "end", u);
205
+ T(t, a, "end", f);
201
206
  };
202
- t.addEventListener("transitionend", _), t.addEventListener("transitioncancel", _), t.addEventListener("touchstart", a), t.addEventListener("touchmove", m), t.addEventListener("touchend", l), t.addEventListener("touchcancel", l), V.set(t, {
203
- state: s,
204
- transitionend: _,
205
- transitioncancel: _,
206
- touchstart: a,
207
- touchmove: m,
208
- touchend: l,
209
- touchcancel: l
207
+ t.addEventListener("transitionend", s), t.addEventListener("transitioncancel", s), t.addEventListener("touchstart", p), t.addEventListener("touchmove", u), t.addEventListener("touchend", E), t.addEventListener("touchcancel", E), Y.set(t, {
208
+ state: c,
209
+ transitionend: s,
210
+ transitioncancel: s,
211
+ touchstart: p,
212
+ touchmove: u,
213
+ touchend: E,
214
+ touchcancel: E
210
215
  });
211
216
  }
212
217
  function Et(t) {
213
- const e = V.get(t);
214
- e && (V.delete(t), t.addEventListener("transitionend", e.transitionend), t.addEventListener("transitioncancel", e.transitioncancel), t.addEventListener("touchstart", e.touchstart), t.addEventListener("touchmove", e.touchmove), t.addEventListener("touchend", e.touchend), t.addEventListener("touchcancel", e.touchcancel));
218
+ const e = Y.get(t);
219
+ e && (Y.delete(t), t.addEventListener("transitionend", e.transitionend), t.addEventListener("transitioncancel", e.transitioncancel), t.addEventListener("touchstart", e.touchstart), t.addEventListener("touchmove", e.touchmove), t.addEventListener("touchend", e.touchend), t.addEventListener("touchcancel", e.touchcancel));
215
220
  }
216
- const Dt = /* @__PURE__ */ P({
221
+ const bt = /* @__PURE__ */ A({
217
222
  __name: "index",
218
223
  props: {
219
224
  dragRemove: { type: Boolean, default: !0 },
@@ -222,6 +227,7 @@ const Dt = /* @__PURE__ */ P({
222
227
  momentumReduceRatio: { default: 1 },
223
228
  resetDelay: { default: 120 },
224
229
  swipeDuration: { default: 60 },
230
+ draggableArea: {},
225
231
  routerViewName: {},
226
232
  viewTag: { type: [Function, String], default: "div" },
227
233
  transition: { type: [Function, Boolean], default: !0 },
@@ -230,95 +236,102 @@ const Dt = /* @__PURE__ */ P({
230
236
  setup(t) {
231
237
  const e = t;
232
238
  let n = null, o = null;
233
- function i(a) {
234
- return (a.params && a.params.animationType) ?? "slide";
239
+ function i(s) {
240
+ return (s.params && s.params.animationType) ?? "slide";
235
241
  }
236
- function u(a) {
237
- return (a.params && a.params.dragRemove) ?? e.dragRemove;
242
+ function f(s) {
243
+ return (s.params && s.params.dragRemove) ?? e.dragRemove;
238
244
  }
239
- const h = (a, m, l, g) => {
240
- if (l.opsType === L.Append || m) {
241
- const f = i(l), r = m ? "show" : "enter";
242
- if (r === "show" && (f === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
245
+ const m = (s, p, u, E) => {
246
+ if (u.opsType === D.Append || p) {
247
+ const d = i(u), a = p ? "show" : "enter";
248
+ if (a === "show" && (d === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
243
249
  return;
244
- r === "enter" && (n = l, o = "enter");
245
- const w = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
246
- a.classList.add(w), a.classList.add(p);
250
+ a === "enter" && (n = u, o = "enter");
251
+ const g = `fox-root-navigator__${d}-${a}-from`, y = `fox-root-navigator__${d}-${a}-active`;
252
+ s.classList.add(g), s.classList.add(y);
247
253
  }
248
- }, s = (a, m, l, g) => {
249
- if (l.opsType === L.Append || m) {
250
- const f = i(l), r = m ? "show" : "enter";
251
- if (r === "show" && (f === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
254
+ }, h = (s, p, u, E) => {
255
+ if (u.opsType === D.Append || p) {
256
+ const d = i(u), a = p ? "show" : "enter";
257
+ if (a === "show" && (d === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
252
258
  return;
253
- const w = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
254
- a.classList.remove(w), a.classList.add(p);
259
+ const g = `fox-root-navigator__${d}-${a}-from`, y = `fox-root-navigator__${d}-${a}-to`;
260
+ s.classList.remove(g), s.classList.add(y);
255
261
  }
256
- }, x = (a, m, l, g) => {
257
- if (l.opsType === L.Append || m) {
258
- const r = i(l), w = m ? "show" : "enter";
259
- if (w === "enter" && (n = null, o = null), r !== "pop") {
260
- const p = `fox-root-navigator__${r}-${w}-active`, E = `fox-root-navigator__${r}-${w}-to`;
261
- a.classList.remove(p), a.classList.remove(E);
262
+ }, c = (s, p, u, E) => {
263
+ if (u.opsType === D.Append || p) {
264
+ const a = i(u), g = p ? "show" : "enter";
265
+ if (g === "enter" && (n = null, o = null), a !== "pop") {
266
+ const y = `fox-root-navigator__${a}-${g}-active`, _ = `fox-root-navigator__${a}-${g}-to`;
267
+ s.classList.remove(y), s.classList.remove(_);
262
268
  }
263
269
  }
264
- u(l) === !0 && !m && l.opsType === L.Append && yt(
265
- a,
266
- e.removeMoveRatio,
267
- e.momentumReduceRatio,
268
- e.removeViewPage,
269
- "fox-root-navigator__item-moving",
270
- e.swipeDuration,
271
- e.resetDelay
272
- );
273
- }, d = (a, m, l, g) => {
274
- if (l.opsType === L.Append || m) {
275
- const f = i(l), r = m ? "hide" : "leave";
276
- if (r === "hide" && (f === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
270
+ if (f(u) === !0 && !p && u.opsType === D.Append) {
271
+ let a = null;
272
+ e.draggableArea && (a = function(g, y, _) {
273
+ const r = y - g.offsetLeft, w = _ - g.offsetTop;
274
+ return !(e.draggableArea?.left && r < e.draggableArea?.left || e.draggableArea?.right && r > e.draggableArea?.right || e.draggableArea?.top && w < e.draggableArea?.top || e.draggableArea?.bottom && w > e.draggableArea?.bottom);
275
+ }), yt(
276
+ s,
277
+ e.removeMoveRatio,
278
+ e.momentumReduceRatio,
279
+ e.removeViewPage,
280
+ "fox-root-navigator__item-moving",
281
+ e.swipeDuration,
282
+ e.resetDelay,
283
+ a
284
+ );
285
+ }
286
+ }, v = (s, p, u, E) => {
287
+ if (u.opsType === D.Append || p) {
288
+ const d = i(u), a = p ? "hide" : "leave";
289
+ if (a === "hide" && (d === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
277
290
  return;
278
- r === "leave" && (n = l, o = "leave");
279
- const w = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
280
- a.classList.add(w), a.classList.add(p);
291
+ a === "leave" && (n = u, o = "leave");
292
+ const g = `fox-root-navigator__${d}-${a}-from`, y = `fox-root-navigator__${d}-${a}-active`;
293
+ s.classList.add(g), s.classList.add(y);
281
294
  }
282
- }, v = (a, m, l, g) => {
283
- if (l.opsType === L.Append || m) {
284
- const f = i(l), r = m ? "hide" : "leave";
285
- if (r === "hide" && (f === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
295
+ }, l = (s, p, u, E) => {
296
+ if (u.opsType === D.Append || p) {
297
+ const d = i(u), a = p ? "hide" : "leave";
298
+ if (a === "hide" && (d === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
286
299
  return;
287
- const w = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
288
- a.classList.remove(w), a.classList.add(p);
300
+ const g = `fox-root-navigator__${d}-${a}-from`, y = `fox-root-navigator__${d}-${a}-to`;
301
+ s.classList.remove(g), s.classList.add(y);
289
302
  }
290
- }, _ = (a, m, l, g) => {
291
- if (l.opsType === L.Append || m) {
292
- const r = i(l), w = m ? "hide" : "leave";
293
- if (w === "leave" && (n = null, o = null), r !== "pop") {
294
- const p = `fox-root-navigator__${r}-${w}-active`, E = `fox-root-navigator__${r}-${w}-to`;
295
- a.classList.remove(p), a.classList.remove(E);
303
+ }, T = (s, p, u, E) => {
304
+ if (u.opsType === D.Append || p) {
305
+ const a = i(u), g = p ? "hide" : "leave";
306
+ if (g === "leave" && (n = null, o = null), a !== "pop") {
307
+ const y = `fox-root-navigator__${a}-${g}-active`, _ = `fox-root-navigator__${a}-${g}-to`;
308
+ s.classList.remove(y), s.classList.remove(_);
296
309
  }
297
310
  }
298
- u(l) && !m && Et(a);
311
+ f(u) && !p && Et(s);
299
312
  };
300
- return (a, m) => {
301
- const l = O("fox-router-view");
302
- return b(), R(l, {
313
+ return (s, p) => {
314
+ const u = X("fox-router-view");
315
+ return L(), R(u, {
303
316
  class: "fox-root-navigator",
304
- "view-class": a.viewClass,
305
- "before-enter": h,
306
- enter: s,
307
- "after-enter": x,
308
- "before-leave": d,
309
- leave: v,
310
- "after-leave": _,
317
+ "view-class": s.viewClass,
318
+ "before-enter": m,
319
+ enter: h,
320
+ "after-enter": c,
321
+ "before-leave": v,
322
+ leave: l,
323
+ "after-leave": T,
311
324
  multi: !0,
312
- name: a.routerViewName,
313
- "view-tag": a.viewTag,
314
- transition: a.transition
325
+ name: s.routerViewName,
326
+ "view-tag": s.viewTag,
327
+ transition: s.transition
315
328
  }, null, 8, ["view-class", "name", "view-tag", "transition"]);
316
329
  };
317
330
  }
318
- }), Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
331
+ }), Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
319
332
  __proto__: null,
320
- default: Dt
321
- }, Symbol.toStringTag, { value: "Module" })), bt = { class: "fox-swiper-navigator" }, $t = /* @__PURE__ */ P({
333
+ default: bt
334
+ }, Symbol.toStringTag, { value: "Module" })), Lt = { class: "fox-swiper-navigator" }, $t = /* @__PURE__ */ A({
322
335
  __name: "swiper",
323
336
  props: {
324
337
  width: {},
@@ -327,14 +340,14 @@ const Dt = /* @__PURE__ */ P({
327
340
  direction: {}
328
341
  },
329
342
  setup(t) {
330
- const e = t, n = X(() => {
343
+ const e = t, n = P(() => {
331
344
  const o = {
332
345
  transform: `translate3d(${e.scrollDistance}px, 0, 0)`,
333
346
  width: `${e.width}`
334
347
  };
335
348
  return e.scrollDuration > 0 && (o["transition-duration"] = `${e.scrollDuration}ms`), o;
336
349
  });
337
- return (o, i) => (b(), Z("div", bt, [
350
+ return (o, i) => (L(), Z("div", Lt, [
338
351
  tt("div", {
339
352
  class: "fox-swiper-navigator__inner",
340
353
  style: U(n.value)
@@ -348,14 +361,14 @@ let Mt = 0;
348
361
  function Rt() {
349
362
  return ++Mt;
350
363
  }
351
- const Pt = 15, Xt = 300, Ot = 200;
352
- function St(t) {
364
+ const At = 15, Pt = 300, Xt = 200;
365
+ function Ot(t) {
353
366
  t.stopPropagation();
354
367
  }
355
- function At(t, e, n = 1) {
368
+ function St(t, e, n = 1) {
356
369
  return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
357
370
  }
358
- function N(t, e = 0, n, o = Ot) {
371
+ function z(t, e = 0, n, o = Xt) {
359
372
  n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
360
373
  }
361
374
  class Ct {
@@ -453,38 +466,38 @@ class Ct {
453
466
  * @param momentumReduceRatio
454
467
  *
455
468
  */
456
- constructor(e, n, o, i, u, h) {
457
- this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = i, this.moveRatio = u, this.momentumReduceRatio = h;
469
+ constructor(e, n, o, i, f, m) {
470
+ this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = i, this.moveRatio = f, this.momentumReduceRatio = m;
458
471
  }
459
472
  /**
460
473
  * 打开drag支持
461
474
  */
462
475
  open() {
463
- const e = this.el, n = j(), o = (i, u, h, s) => {
464
- let x = u + this.startDistance;
465
- const d = this.columnWidth * this.moveRatio;
466
- if (h === "end") {
467
- if (u == 0) {
476
+ const e = this.el, n = j(), o = (i, f, m, h) => {
477
+ let c = f + this.startDistance;
478
+ const v = this.columnWidth * this.moveRatio;
479
+ if (m === "end") {
480
+ if (f == 0) {
468
481
  this.moving = !1;
469
482
  return;
470
483
  }
471
- Math.abs(u) > d ? u > 0 ? x = this.startDistance + this.columnWidth : x = this.startDistance - this.columnWidth : x = this.startDistance;
472
- let v = -x;
473
- v < 0 ? v = 0 : v > this.width - this.columnWidth && (v = this.width - this.columnWidth);
474
- const _ = Math.floor(v / this.columnWidth);
475
- this.isPageOpened(_) || this.openPage(_), x = -_ * this.columnWidth, s && s > 0 && (this.transitionEndTrigger = () => {
476
- this.moving = !1, this.pageOpened(_);
477
- }), N(i, x, "end", s), this.scrollDistance = x;
484
+ Math.abs(f) > v ? f > 0 ? c = this.startDistance + this.columnWidth : c = this.startDistance - this.columnWidth : c = this.startDistance;
485
+ let l = -c;
486
+ l < 0 ? l = 0 : l > this.width - this.columnWidth && (l = this.width - this.columnWidth);
487
+ const T = Math.floor(l / this.columnWidth);
488
+ this.isPageOpened(T) || this.openPage(T), c = -T * this.columnWidth, h && h > 0 && (this.transitionEndTrigger = () => {
489
+ this.moving = !1, this.pageOpened(T);
490
+ }), z(i, c, "end", h), this.scrollDistance = c;
478
491
  } else {
479
- if (Math.abs(u) > d) {
480
- let _ = 0;
481
- if (u > 0 ? _ = Math.abs(this.startDistance + this.columnWidth) : _ = Math.abs(this.startDistance - this.columnWidth), _ >= 0 && _ < this.width) {
482
- const a = Math.floor(_ / this.columnWidth);
483
- this.isPageOpened(a) || this.openPage(a);
492
+ if (Math.abs(f) > v) {
493
+ let T = 0;
494
+ if (f > 0 ? T = Math.abs(this.startDistance + this.columnWidth) : T = Math.abs(this.startDistance - this.columnWidth), T >= 0 && T < this.width) {
495
+ const s = Math.floor(T / this.columnWidth);
496
+ this.isPageOpened(s) || this.openPage(s);
484
497
  }
485
498
  }
486
- let v = -x;
487
- v < this.min ? v = this.min : v > this.max && (v = this.max), N(i, -v, "", 0);
499
+ let l = -c;
500
+ l < this.min ? l = this.min : l > this.max && (l = this.max), z(i, -l, "", 0);
488
501
  }
489
502
  };
490
503
  this.transitionend = () => {
@@ -492,17 +505,17 @@ class Ct {
492
505
  }, this.touchstart = (i) => {
493
506
  this.moving || (n.start(i), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
494
507
  }, this.touchmove = (i) => {
495
- n.move(i), !n.isVertical() && (St(i), o(e, n.state.deltaX, "", 0));
508
+ n.move(i), !n.isVertical() && (Ot(i), o(e, n.state.deltaX, "", 0));
496
509
  }, this.touchend = () => {
497
510
  if (n.isVertical())
498
511
  return;
499
512
  const i = n.state.deltaX;
500
513
  if (i == 0)
501
514
  return;
502
- const u = n.state.duration;
503
- if (u < Xt && Math.abs(i) > Pt) {
504
- const s = At(i, u, this.momentumReduceRatio);
505
- o(e, s, "end", this.swipeDuration);
515
+ const f = n.state.duration;
516
+ if (f < Pt && Math.abs(i) > At) {
517
+ const h = St(i, f, this.momentumReduceRatio);
518
+ o(e, h, "end", this.swipeDuration);
506
519
  } else
507
520
  o(e, i, "end", this.swipeDuration);
508
521
  }, e.addEventListener("transitionend", this.transitionend), e.addEventListener("touchstart", this.touchstart), e.addEventListener("touchmove", this.touchmove), e.addEventListener("touchend", this.touchend), e.addEventListener("touchcancel", this.touchend);
@@ -515,17 +528,17 @@ class Ct {
515
528
  this.transitionend && e.addEventListener("transitionend", this.transitionend), this.touchstart && e.addEventListener("touchstart", this.touchstart), this.touchmove && e.addEventListener("touchmove", this.touchmove), this.touchend && e.addEventListener("touchend", this.touchend), this.touchcancel && e.addEventListener("touchcancel", this.touchcancel), this.el = null;
516
529
  }
517
530
  }
518
- function It(t, e, n, o, i, u) {
519
- return new Ct(t, e, n, o, i, u);
531
+ function It(t, e, n, o, i, f) {
532
+ return new Ct(t, e, n, o, i, f);
520
533
  }
521
- function Vt(t) {
522
- const e = F(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), i = parseFloat(n.getPropertyValue("padding-right")), u = parseFloat(n.getPropertyValue("padding-top")), h = parseFloat(n.getPropertyValue("padding-bottom"));
534
+ function Yt(t) {
535
+ const e = F(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), i = parseFloat(n.getPropertyValue("padding-right")), f = parseFloat(n.getPropertyValue("padding-top")), m = parseFloat(n.getPropertyValue("padding-bottom"));
523
536
  return {
524
537
  width: e.clientWidth - o - i,
525
- height: e.clientHeight - u - h
538
+ height: e.clientHeight - f - m
526
539
  };
527
540
  }
528
- const Yt = /* @__PURE__ */ P({
541
+ const Vt = /* @__PURE__ */ A({
529
542
  __name: "index",
530
543
  props: {
531
544
  activePath: {},
@@ -552,42 +565,42 @@ const Yt = /* @__PURE__ */ P({
552
565
  openedIndexList: [],
553
566
  width: n.width,
554
567
  height: n.height
555
- }), i = e, u = () => o.scrollDistance, h = (c) => {
556
- if (o.openedIndexList.indexOf(c) === -1) {
557
- o.openedIndexList.push(c);
558
- const y = n.routes[c];
568
+ }), i = e, f = () => o.scrollDistance, m = (r) => {
569
+ if (o.openedIndexList.indexOf(r) === -1) {
570
+ o.openedIndexList.push(r);
571
+ const w = n.routes[r];
559
572
  try {
560
- n.openViewPage(y, c);
561
- } catch (T) {
562
- console.error(T);
573
+ n.openViewPage(w, r);
574
+ } catch (x) {
575
+ console.error(x);
563
576
  }
564
577
  }
565
- }, s = (c) => o.openedIndexList.indexOf(c) !== -1, x = (c) => {
566
- o.index = c, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
567
- const y = n.routes[c];
568
- i("update:activePath", y.path);
578
+ }, h = (r) => o.openedIndexList.indexOf(r) !== -1, c = (r) => {
579
+ o.index = r, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
580
+ const w = n.routes[r];
581
+ i("update:activePath", w.path);
569
582
  };
570
- let d = null;
571
- n.draggable && (d = It(
572
- u,
583
+ let v = null;
584
+ n.draggable && (v = It(
585
+ f,
586
+ m,
573
587
  h,
574
- s,
575
- x,
588
+ c,
576
589
  n.moveRatio,
577
590
  n.momentumReduceRatio
578
591
  ));
579
- let v = null;
592
+ let l = null;
580
593
  ot(() => {
581
- const c = f(), y = () => {
582
- const T = Vt(c);
583
- _(n.activePath, n.routes, T.width, T.height, n.swipeDuration, n.direction);
594
+ const r = d(), w = () => {
595
+ const x = Yt(r);
596
+ T(n.activePath, n.routes, x.width, x.height, n.swipeDuration, n.direction);
584
597
  };
585
- if (window.ResizeObserver && (v = new window.ResizeObserver(y), v.observe(c)), y(), d) {
586
- const T = w();
587
- d.el = T, d.open();
598
+ if (window.ResizeObserver && (l = new window.ResizeObserver(w), l.observe(r)), w(), v) {
599
+ const x = g();
600
+ v.el = x, v.open();
588
601
  }
589
602
  }), it(() => {
590
- v && (v.disconnect(), v = null), d && d.close();
603
+ l && (l.disconnect(), l = null), v && v.close();
591
604
  }), st(
592
605
  [
593
606
  () => n.activePath,
@@ -597,78 +610,78 @@ const Yt = /* @__PURE__ */ P({
597
610
  () => n.swipeDuration,
598
611
  () => n.direction
599
612
  ],
600
- ([c, y, T, $, M, S]) => {
601
- const A = T <= 0 ? o.width : T, D = $ <= 0 ? o.height : $;
602
- _(c, y, A, D, M, S);
613
+ ([r, w, x, $, M, O]) => {
614
+ const S = x <= 0 ? o.width : x, b = $ <= 0 ? o.height : $;
615
+ T(r, w, S, b, M, O);
603
616
  }
604
617
  );
605
- const _ = (c, y, T, $, M, S = "horizontal") => {
606
- const A = c;
607
- if (o.index = y.findIndex((D) => D.path === A), S === "horizontal") {
608
- const D = T;
609
- if (D > 0) {
610
- o.width = T;
611
- const q = D * n.routes.length, H = -D / 3, G = D * (y.length - 1) + D / 3;
612
- d && (d.columnWidth = D, d.width = q, d.min = H, d.max = G), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -D * o.index);
618
+ const T = (r, w, x, $, M, O = "horizontal") => {
619
+ const S = r;
620
+ if (o.index = w.findIndex((b) => b.path === S), O === "horizontal") {
621
+ const b = x;
622
+ if (b > 0) {
623
+ o.width = x;
624
+ const q = b * n.routes.length, H = -b / 3, G = b * (w.length - 1) + b / 3;
625
+ v && (v.columnWidth = b, v.width = q, v.min = H, v.max = G), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -b * o.index);
613
626
  }
614
627
  }
615
- d && (d.swipeDuration = M);
616
- }, a = `fox-swiper-navigator-${Rt()}`, m = X(() => {
617
- const c = [a];
618
- return n.customClass && c.push(n.customClass), c;
619
- }), l = X(() => {
620
- const c = {}, y = o.width > 0 ? o.width : n.width;
621
- y > 0 && (c.width = `${y}px`);
622
- const T = o.height > 0 ? o.height : n.height;
623
- return T > 0 && (c.height = `${T}px`), n.customStyle && Object.assign(c, n.customStyle), c;
628
+ v && (v.swipeDuration = M);
629
+ }, s = `fox-swiper-navigator-${Rt()}`, p = P(() => {
630
+ const r = [s];
631
+ return n.customClass && r.push(n.customClass), r;
632
+ }), u = P(() => {
633
+ const r = {}, w = o.width > 0 ? o.width : n.width;
634
+ w > 0 && (r.width = `${w}px`);
635
+ const x = o.height > 0 ? o.height : n.height;
636
+ return x > 0 && (r.height = `${x}px`), n.customStyle && Object.assign(r, n.customStyle), r;
624
637
  });
625
- let g = null;
626
- function f() {
627
- return g || (g = document.querySelector(`.${a}`), g);
638
+ let E = null;
639
+ function d() {
640
+ return E || (E = document.querySelector(`.${s}`), E);
628
641
  }
629
- let r = null;
630
- function w() {
631
- return r || (r = document.querySelector(`.${a}>.fox-swiper-navigator__inner`), r);
642
+ let a = null;
643
+ function g() {
644
+ return a || (a = document.querySelector(`.${s}>.fox-swiper-navigator__inner`), a);
632
645
  }
633
- const p = X(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), E = (c, y) => {
634
- const T = n.routes.findIndex(($) => {
635
- const M = c.path ?? c.name ?? "";
646
+ const y = P(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), _ = (r, w) => {
647
+ const x = n.routes.findIndex(($) => {
648
+ const M = r.path ?? r.name ?? "";
636
649
  return $.path == M;
637
650
  });
638
651
  return o.width <= 0 ? {} : {
639
652
  style: {
640
- left: `${T * o.width}px`,
653
+ left: `${x * o.width}px`,
641
654
  width: `${o.width}px`
642
655
  }
643
656
  };
644
657
  };
645
- return (c, y) => {
646
- const T = O("fox-router-view");
647
- return b(), R(T, {
648
- class: at(m.value),
649
- style: U(l.value),
658
+ return (r, w) => {
659
+ const x = X("fox-router-view");
660
+ return L(), R(x, {
661
+ class: at(p.value),
662
+ style: U(u.value),
650
663
  "view-class": "fox-swiper-navigator__item",
651
664
  tag: $t,
652
- "view-tag-props": E,
665
+ "view-tag-props": _,
653
666
  multi: !0,
654
- name: c.routerViewName,
655
- transition: c.transition,
667
+ name: r.routerViewName,
668
+ transition: r.transition,
656
669
  "scroll-distance": o.scrollDistance,
657
- "scroll-duration": c.scrollDuration,
658
- direction: c.direction,
659
- width: p.value
670
+ "scroll-duration": r.scrollDuration,
671
+ direction: r.direction,
672
+ width: y.value
660
673
  }, null, 8, ["class", "style", "name", "transition", "scroll-distance", "scroll-duration", "direction", "width"]);
661
674
  };
662
675
  }
663
- }), Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
676
+ }), Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
664
677
  __proto__: null,
665
- default: Yt
678
+ default: Vt
666
679
  }, Symbol.toStringTag, { value: "Module" }));
667
- let zt = "fox-";
668
- const Nt = [], B = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": lt, "/src/components/default-navigator/index.vue": dt, "/src/components/root-navigator/index.vue": Lt, "/src/components/swiper-navigator/index.vue": Wt }), k = [];
680
+ let Wt = "fox-";
681
+ const zt = [], B = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": lt, "/src/components/default-navigator/index.vue": ut, "/src/components/root-navigator/index.vue": Dt, "/src/components/swiper-navigator/index.vue": Nt }), k = [];
669
682
  for (const t in B) {
670
683
  let e = /src\/components\/(.*)\/index.vue/.exec(t)[1];
671
- Nt.indexOf(e) === -1 && k.push({
684
+ zt.indexOf(e) === -1 && k.push({
672
685
  name: e,
673
686
  component: B[t].default
674
687
  });
@@ -680,7 +693,7 @@ const Ut = {
680
693
  */
681
694
  install(t) {
682
695
  k.forEach((e) => {
683
- t.component(`${zt}${e.name}`, e.component);
696
+ t.component(`${Wt}${e.name}`, e.component);
684
697
  });
685
698
  }
686
699
  };