@fox-js/navigation 4.0.1-14 → 4.0.1-16

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-13 Tue Apr 30 2024 11:30:06 GMT+0800 (中国标准时间)
4
+ * @fox-js/navigation v4.0.1-15 Sat Jun 15 2024 16:18:22 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,9 +53,9 @@ 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
58
+ default: dt
59
59
  }, Symbol.toStringTag, { value: "Module" })), W = 10;
60
60
  function ft(t, e) {
61
61
  return t > e && t > W ? "horizontal" : e > t && e > W ? "vertical" : "";
@@ -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
  }
@@ -157,62 +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, _) => {
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", _);
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, i && d.classList.remove(i), setTimeout(() => {
177
+ v && z(v), _ == 0 ? z(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
- }, T = () => {
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)), i && 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
+ i && 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), t.addEventListener("touchstart", a), t.addEventListener("touchmove", m), t.addEventListener("touchend", l), t.addEventListener("touchcancel", l), V.set(t, {
203
- state: s,
204
- transitionend: T,
205
- touchstart: a,
206
- touchmove: m,
207
- touchend: l,
208
- 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
209
215
  });
210
216
  }
211
217
  function Et(t) {
212
- const e = V.get(t);
213
- e && (V.delete(t), t.addEventListener("transitionend", e.transitionend), 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));
214
220
  }
215
- const Dt = /* @__PURE__ */ P({
221
+ const bt = /* @__PURE__ */ A({
216
222
  __name: "index",
217
223
  props: {
218
224
  dragRemove: { type: Boolean, default: !0 },
@@ -221,6 +227,7 @@ const Dt = /* @__PURE__ */ P({
221
227
  momentumReduceRatio: { default: 1 },
222
228
  resetDelay: { default: 120 },
223
229
  swipeDuration: { default: 60 },
230
+ draggableArea: {},
224
231
  routerViewName: {},
225
232
  viewTag: { type: [Function, String], default: "div" },
226
233
  transition: { type: [Function, Boolean], default: !0 },
@@ -229,95 +236,102 @@ const Dt = /* @__PURE__ */ P({
229
236
  setup(t) {
230
237
  const e = t;
231
238
  let n = null, o = null;
232
- function i(a) {
233
- return (a.params && a.params.animationType) ?? "slide";
239
+ function i(s) {
240
+ return (s.params && s.params.animationType) ?? "slide";
234
241
  }
235
- function u(a) {
236
- return (a.params && a.params.dragRemove) ?? e.dragRemove;
242
+ function f(s) {
243
+ return (s.params && s.params.dragRemove) ?? e.dragRemove;
237
244
  }
238
- const h = (a, m, l, g) => {
239
- if (l.opsType === L.Append || m) {
240
- const f = i(l), r = m ? "show" : "enter";
241
- 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"))
242
249
  return;
243
- r === "enter" && (n = l, o = "enter");
244
- const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
245
- a.classList.add(_), 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);
246
253
  }
247
- }, s = (a, m, l, g) => {
248
- if (l.opsType === L.Append || m) {
249
- const f = i(l), r = m ? "show" : "enter";
250
- 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"))
251
258
  return;
252
- const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
253
- a.classList.remove(_), 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);
254
261
  }
255
- }, x = (a, m, l, g) => {
256
- if (l.opsType === L.Append || m) {
257
- const r = i(l), _ = m ? "show" : "enter";
258
- if (_ === "enter" && (n = null, o = null), r !== "pop") {
259
- const p = `fox-root-navigator__${r}-${_}-active`, E = `fox-root-navigator__${r}-${_}-to`;
260
- 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(_);
261
268
  }
262
269
  }
263
- u(l) === !0 && !m && l.opsType === L.Append && yt(
264
- a,
265
- e.removeMoveRatio,
266
- e.momentumReduceRatio,
267
- e.removeViewPage,
268
- "fox-root-navigator__item-moving",
269
- e.swipeDuration,
270
- e.resetDelay
271
- );
272
- }, d = (a, m, l, g) => {
273
- if (l.opsType === L.Append || m) {
274
- const f = i(l), r = m ? "hide" : "leave";
275
- 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"))
276
290
  return;
277
- r === "leave" && (n = l, o = "leave");
278
- const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
279
- a.classList.add(_), 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);
280
294
  }
281
- }, v = (a, m, l, g) => {
282
- if (l.opsType === L.Append || m) {
283
- const f = i(l), r = m ? "hide" : "leave";
284
- 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"))
285
299
  return;
286
- const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
287
- a.classList.remove(_), 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);
288
302
  }
289
- }, T = (a, m, l, g) => {
290
- if (l.opsType === L.Append || m) {
291
- const r = i(l), _ = m ? "hide" : "leave";
292
- if (_ === "leave" && (n = null, o = null), r !== "pop") {
293
- const p = `fox-root-navigator__${r}-${_}-active`, E = `fox-root-navigator__${r}-${_}-to`;
294
- 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(_);
295
309
  }
296
310
  }
297
- u(l) && !m && Et(a);
311
+ f(u) && !p && Et(s);
298
312
  };
299
- return (a, m) => {
300
- const l = O("fox-router-view");
301
- return b(), R(l, {
313
+ return (s, p) => {
314
+ const u = X("fox-router-view");
315
+ return L(), R(u, {
302
316
  class: "fox-root-navigator",
303
- "view-class": a.viewClass,
304
- "before-enter": h,
305
- enter: s,
306
- "after-enter": x,
307
- "before-leave": d,
308
- leave: v,
317
+ "view-class": s.viewClass,
318
+ "before-enter": m,
319
+ enter: h,
320
+ "after-enter": c,
321
+ "before-leave": v,
322
+ leave: l,
309
323
  "after-leave": T,
310
324
  multi: !0,
311
- name: a.routerViewName,
312
- "view-tag": a.viewTag,
313
- transition: a.transition
325
+ name: s.routerViewName,
326
+ "view-tag": s.viewTag,
327
+ transition: s.transition
314
328
  }, null, 8, ["view-class", "name", "view-tag", "transition"]);
315
329
  };
316
330
  }
317
- }), Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
331
+ }), Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
318
332
  __proto__: null,
319
- default: Dt
320
- }, 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({
321
335
  __name: "swiper",
322
336
  props: {
323
337
  width: {},
@@ -326,14 +340,14 @@ const Dt = /* @__PURE__ */ P({
326
340
  direction: {}
327
341
  },
328
342
  setup(t) {
329
- const e = t, n = X(() => {
343
+ const e = t, n = P(() => {
330
344
  const o = {
331
345
  transform: `translate3d(${e.scrollDistance}px, 0, 0)`,
332
346
  width: `${e.width}`
333
347
  };
334
348
  return e.scrollDuration > 0 && (o["transition-duration"] = `${e.scrollDuration}ms`), o;
335
349
  });
336
- return (o, i) => (b(), Z("div", bt, [
350
+ return (o, i) => (L(), Z("div", Lt, [
337
351
  tt("div", {
338
352
  class: "fox-swiper-navigator__inner",
339
353
  style: U(n.value)
@@ -347,14 +361,14 @@ let Mt = 0;
347
361
  function Rt() {
348
362
  return ++Mt;
349
363
  }
350
- const Pt = 15, Xt = 300, Ot = 200;
351
- function St(t) {
364
+ const At = 15, Pt = 300, Xt = 200;
365
+ function Ot(t) {
352
366
  t.stopPropagation();
353
367
  }
354
- function At(t, e, n = 1) {
368
+ function St(t, e, n = 1) {
355
369
  return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
356
370
  }
357
- function N(t, e = 0, n, o = Ot) {
371
+ function N(t, e = 0, n, o = Xt) {
358
372
  n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
359
373
  }
360
374
  class Ct {
@@ -452,38 +466,38 @@ class Ct {
452
466
  * @param momentumReduceRatio
453
467
  *
454
468
  */
455
- constructor(e, n, o, i, u, h) {
456
- 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;
457
471
  }
458
472
  /**
459
473
  * 打开drag支持
460
474
  */
461
475
  open() {
462
- const e = this.el, n = j(), o = (i, u, h, s) => {
463
- let x = u + this.startDistance;
464
- const d = this.columnWidth * this.moveRatio;
465
- if (h === "end") {
466
- 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) {
467
481
  this.moving = !1;
468
482
  return;
469
483
  }
470
- Math.abs(u) > d ? u > 0 ? x = this.startDistance + this.columnWidth : x = this.startDistance - this.columnWidth : x = this.startDistance;
471
- let v = -x;
472
- v < 0 ? v = 0 : v > this.width - this.columnWidth && (v = this.width - this.columnWidth);
473
- const T = Math.floor(v / this.columnWidth);
474
- this.isPageOpened(T) || this.openPage(T), x = -T * this.columnWidth, s && s > 0 && (this.transitionEndTrigger = () => {
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 = () => {
475
489
  this.moving = !1, this.pageOpened(T);
476
- }), N(i, x, "end", s), this.scrollDistance = x;
490
+ }), N(i, c, "end", h), this.scrollDistance = c;
477
491
  } else {
478
- if (Math.abs(u) > d) {
492
+ if (Math.abs(f) > v) {
479
493
  let T = 0;
480
- if (u > 0 ? T = Math.abs(this.startDistance + this.columnWidth) : T = Math.abs(this.startDistance - this.columnWidth), T >= 0 && T < this.width) {
481
- const a = Math.floor(T / this.columnWidth);
482
- this.isPageOpened(a) || this.openPage(a);
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);
483
497
  }
484
498
  }
485
- let v = -x;
486
- 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), N(i, -l, "", 0);
487
501
  }
488
502
  };
489
503
  this.transitionend = () => {
@@ -491,17 +505,17 @@ class Ct {
491
505
  }, this.touchstart = (i) => {
492
506
  this.moving || (n.start(i), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
493
507
  }, this.touchmove = (i) => {
494
- 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));
495
509
  }, this.touchend = () => {
496
510
  if (n.isVertical())
497
511
  return;
498
512
  const i = n.state.deltaX;
499
513
  if (i == 0)
500
514
  return;
501
- const u = n.state.duration;
502
- if (u < Xt && Math.abs(i) > Pt) {
503
- const s = At(i, u, this.momentumReduceRatio);
504
- 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);
505
519
  } else
506
520
  o(e, i, "end", this.swipeDuration);
507
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);
@@ -514,17 +528,17 @@ class Ct {
514
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;
515
529
  }
516
530
  }
517
- function It(t, e, n, o, i, u) {
518
- 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);
519
533
  }
520
- function Vt(t) {
521
- 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"));
522
536
  return {
523
537
  width: e.clientWidth - o - i,
524
- height: e.clientHeight - u - h
538
+ height: e.clientHeight - f - m
525
539
  };
526
540
  }
527
- const Yt = /* @__PURE__ */ P({
541
+ const Vt = /* @__PURE__ */ A({
528
542
  __name: "index",
529
543
  props: {
530
544
  activePath: {},
@@ -551,42 +565,42 @@ const Yt = /* @__PURE__ */ P({
551
565
  openedIndexList: [],
552
566
  width: n.width,
553
567
  height: n.height
554
- }), i = e, u = () => o.scrollDistance, h = (c) => {
555
- if (o.openedIndexList.indexOf(c) === -1) {
556
- o.openedIndexList.push(c);
557
- 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];
558
572
  try {
559
- n.openViewPage(y, c);
560
- } catch (w) {
561
- console.error(w);
573
+ n.openViewPage(w, r);
574
+ } catch (x) {
575
+ console.error(x);
562
576
  }
563
577
  }
564
- }, s = (c) => o.openedIndexList.indexOf(c) !== -1, x = (c) => {
565
- o.index = c, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
566
- const y = n.routes[c];
567
- 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);
568
582
  };
569
- let d = null;
570
- n.draggable && (d = It(
571
- u,
583
+ let v = null;
584
+ n.draggable && (v = It(
585
+ f,
586
+ m,
572
587
  h,
573
- s,
574
- x,
588
+ c,
575
589
  n.moveRatio,
576
590
  n.momentumReduceRatio
577
591
  ));
578
- let v = null;
592
+ let l = null;
579
593
  ot(() => {
580
- const c = f(), y = () => {
581
- const w = Vt(c);
582
- T(n.activePath, n.routes, w.width, w.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);
583
597
  };
584
- if (window.ResizeObserver && (v = new window.ResizeObserver(y), v.observe(c)), y(), d) {
585
- const w = _();
586
- d.el = w, 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();
587
601
  }
588
602
  }), it(() => {
589
- v && (v.disconnect(), v = null), d && d.close();
603
+ l && (l.disconnect(), l = null), v && v.close();
590
604
  }), st(
591
605
  [
592
606
  () => n.activePath,
@@ -596,75 +610,75 @@ const Yt = /* @__PURE__ */ P({
596
610
  () => n.swipeDuration,
597
611
  () => n.direction
598
612
  ],
599
- ([c, y, w, $, M, S]) => {
600
- const A = w <= 0 ? o.width : w, D = $ <= 0 ? o.height : $;
601
- T(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);
602
616
  }
603
617
  );
604
- const T = (c, y, w, $, M, S = "horizontal") => {
605
- const A = c;
606
- if (o.index = y.findIndex((D) => D.path === A), S === "horizontal") {
607
- const D = w;
608
- if (D > 0) {
609
- o.width = w;
610
- const q = D * n.routes.length, H = -D / 3, G = D * (y.length - 1) + D / 3;
611
- 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);
612
626
  }
613
627
  }
614
- d && (d.swipeDuration = M);
615
- }, a = `fox-swiper-navigator-${Rt()}`, m = X(() => {
616
- const c = [a];
617
- return n.customClass && c.push(n.customClass), c;
618
- }), l = X(() => {
619
- const c = {}, y = o.width > 0 ? o.width : n.width;
620
- y > 0 && (c.width = `${y}px`);
621
- const w = o.height > 0 ? o.height : n.height;
622
- return w > 0 && (c.height = `${w}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;
623
637
  });
624
- let g = null;
625
- function f() {
626
- return g || (g = document.querySelector(`.${a}`), g);
638
+ let E = null;
639
+ function d() {
640
+ return E || (E = document.querySelector(`.${s}`), E);
627
641
  }
628
- let r = null;
629
- function _() {
630
- 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);
631
645
  }
632
- const p = X(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), E = (c, y) => {
633
- const w = n.routes.findIndex(($) => {
634
- 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 ?? "";
635
649
  return $.path == M;
636
650
  });
637
651
  return o.width <= 0 ? {} : {
638
652
  style: {
639
- left: `${w * o.width}px`,
653
+ left: `${x * o.width}px`,
640
654
  width: `${o.width}px`
641
655
  }
642
656
  };
643
657
  };
644
- return (c, y) => {
645
- const w = O("fox-router-view");
646
- return b(), R(w, {
647
- class: at(m.value),
648
- 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),
649
663
  "view-class": "fox-swiper-navigator__item",
650
664
  tag: $t,
651
- "view-tag-props": E,
665
+ "view-tag-props": _,
652
666
  multi: !0,
653
- name: c.routerViewName,
654
- transition: c.transition,
667
+ name: r.routerViewName,
668
+ transition: r.transition,
655
669
  "scroll-distance": o.scrollDistance,
656
- "scroll-duration": c.scrollDuration,
657
- direction: c.direction,
658
- width: p.value
670
+ "scroll-duration": r.scrollDuration,
671
+ direction: r.direction,
672
+ width: y.value
659
673
  }, null, 8, ["class", "style", "name", "transition", "scroll-distance", "scroll-duration", "direction", "width"]);
660
674
  };
661
675
  }
662
676
  }), Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
663
677
  __proto__: null,
664
- default: Yt
678
+ default: Vt
665
679
  }, Symbol.toStringTag, { value: "Module" }));
666
680
  let zt = "fox-";
667
- 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 = [];
681
+ const Nt = [], 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": Wt }), k = [];
668
682
  for (const t in B) {
669
683
  let e = /src\/components\/(.*)\/index.vue/.exec(t)[1];
670
684
  Nt.indexOf(e) === -1 && k.push({