@fox-js/navigation 4.0.1-23 → 4.0.1-24

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,36 +1,35 @@
1
- import { defineComponent as A, resolveComponent as X, createBlock as _, openBlock as R, withCtx as W, createVNode as et, Transition as nt, resolveDynamicComponent as ot, unref as H, computed as C, createElementBlock as it, createElementVNode as at, normalizeStyle as j, renderSlot as st, reactive as rt, onMounted as ct, onBeforeUnmount as lt, watch as dt, normalizeClass as ut } from "vue";
2
- import { FoxLeaveEnd as G, OperationType as $ } from "@fox-js/fox";
3
- const ft = /* @__PURE__ */ A({
1
+ import { Transition as et, computed as X, createBlock as b, createElementBlock as nt, createElementVNode as it, createVNode as at, defineComponent as M, normalizeClass as ot, normalizeStyle as q, onBeforeUnmount as rt, onMounted as st, openBlock as D, reactive as ct, renderSlot as lt, resolveComponent as C, resolveDynamicComponent as dt, unref as H, watch as ut, withCtx as F } from "vue";
2
+ import { FoxLeaveEnd as j, OperationType as $ } from "@fox-js/fox";
3
+ var ft = /* @__PURE__ */ M({
4
4
  __name: "index",
5
5
  props: {
6
6
  routerViewName: {},
7
- transition: { type: [Function, Boolean], default: !0 }
7
+ transition: {
8
+ type: [Function, Boolean],
9
+ default: !0
10
+ }
8
11
  },
9
12
  setup(t) {
10
- return (e, n) => {
11
- const o = X("fox-router-view");
12
- return R(), _(o, {
13
+ return (e, i) => {
14
+ const n = C("fox-router-view");
15
+ return D(), b(n, {
13
16
  transition: !1,
14
17
  multi: !1,
15
18
  name: t.routerViewName
16
19
  }, {
17
- default: W(({ Component: r }) => [
18
- et(nt, { name: "fox-default-navigator__trans" }, {
19
- default: W(() => [
20
- (R(), _(ot(r)))
21
- ]),
22
- _: 2
23
- }, 1024)
24
- ]),
20
+ default: F(({ Component: l }) => [at(et, { name: "fox-default-navigator__trans" }, {
21
+ default: F(() => [(D(), b(dt(l)))]),
22
+ _: 2
23
+ }, 1024)]),
25
24
  _: 1
26
25
  }, 8, ["name"]);
27
26
  };
28
27
  }
29
- }), B = 10;
30
- function mt(t, e) {
31
- return t > e && t > B ? "horizontal" : e > t && e > B ? "vertical" : "";
28
+ }), vt = ft, W = 10;
29
+ function gt(t, e) {
30
+ return t > e && t > W ? "horizontal" : e > t && e > W ? "vertical" : "";
32
31
  }
33
- function F() {
32
+ function N() {
34
33
  const t = {
35
34
  startX: 0,
36
35
  startY: 0,
@@ -43,46 +42,46 @@ function F() {
43
42
  offsetX: 0,
44
43
  offsetY: 0,
45
44
  direction: ""
46
- }, e = () => t.direction === "vertical", n = () => t.direction === "horizontal", o = () => {
45
+ }, e = () => t.direction === "vertical", i = () => t.direction === "horizontal", n = () => {
47
46
  t.deltaX = 0, t.deltaY = 0, t.offsetX = 0, t.offsetY = 0, t.direction = "", t.startTime = 0;
48
47
  };
49
48
  return {
50
49
  move: ((v) => {
51
50
  if (v.touches) {
52
- const T = v.touches[0];
53
- t.deltaX = T.clientX - t.startX, t.deltaY = T.clientY - t.startY, t.moveX = T.clientX, t.moveY = T.clientY;
51
+ const w = v.touches[0];
52
+ t.deltaX = w.clientX - t.startX, t.deltaY = w.clientY - t.startY, t.moveX = w.clientX, t.moveY = w.clientY;
54
53
  } else
55
54
  t.deltaX = v.clientX - t.startX, t.deltaY = v.clientY - t.startY, t.moveX = v.clientX, t.moveY = v.clientY;
56
- t.offsetX = Math.abs(t.deltaX), t.offsetY = Math.abs(t.deltaY), t.duration = Date.now() - t.startTime, t.direction || (t.direction = mt(t.offsetX, t.offsetY));
55
+ t.offsetX = Math.abs(t.deltaX), t.offsetY = Math.abs(t.deltaY), t.duration = Date.now() - t.startTime, t.direction || (t.direction = gt(t.offsetX, t.offsetY));
57
56
  }),
58
57
  start: ((v) => {
59
- if (o(), v.touches) {
60
- const T = v.touches[0];
61
- t.startX = T.clientX, t.startY = T.clientY;
58
+ if (n(), v.touches) {
59
+ const w = v.touches[0];
60
+ t.startX = w.clientX, t.startY = w.clientY;
62
61
  } else
63
62
  t.startX = v.clientX, t.startY = v.clientY;
64
63
  t.startTime = Date.now();
65
64
  }),
66
- reset: o,
65
+ reset: n,
67
66
  isVertical: e,
68
- isHorizontal: n,
67
+ isHorizontal: i,
69
68
  state: t
70
69
  };
71
70
  }
72
- function gt(t) {
71
+ function ht(t) {
73
72
  return t === window;
74
73
  }
75
- const J = (t) => {
74
+ var G = (t) => {
76
75
  const e = H(t);
77
- if (gt(e)) {
78
- const n = e.innerWidth, o = e.innerHeight;
76
+ if (ht(e)) {
77
+ const i = e.innerWidth, n = e.innerHeight;
79
78
  return {
80
79
  top: 0,
81
80
  left: 0,
82
- right: n,
83
- bottom: o,
84
- width: n,
85
- height: o
81
+ right: i,
82
+ bottom: n,
83
+ width: i,
84
+ height: n
86
85
  };
87
86
  }
88
87
  return e && e.getBoundingClientRect ? e.getBoundingClientRect() : {
@@ -93,43 +92,42 @@ const J = (t) => {
93
92
  width: 0,
94
93
  height: 0
95
94
  };
96
- }, K = (t, e, n) => {
95
+ }, J = (t, e, i) => {
97
96
  e = e ?? {
98
97
  bubbles: !1,
99
98
  cancelable: !1,
100
99
  detail: void 0
101
100
  };
102
- const o = document.createEvent("Events");
103
- let r = !0, h = !0;
104
- for (let T in e)
105
- T === "bubbles" ? r = !!e[T] : T === "cancelable" ? h = !!e[T] : o[T] = e[T];
106
- o.initEvent(t, r, h), (n ?? document).dispatchEvent(o);
107
- }, ht = 15, vt = 300, pt = 200;
108
- function Tt(t) {
101
+ const n = document.createEvent("Events");
102
+ let l = !0, h = !0;
103
+ for (let v in e) v === "bubbles" ? l = !!e[v] : v === "cancelable" ? h = !!e[v] : n[v] = e[v];
104
+ n.initEvent(t, l, h), (i ?? document).dispatchEvent(n);
105
+ }, mt = 15, pt = 300, wt = 200;
106
+ function xt(t) {
109
107
  t.stopPropagation();
110
108
  }
111
- function wt(t, e, n = 1) {
112
- return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
109
+ function Tt(t, e, i = 1) {
110
+ return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * i;
113
111
  }
114
- function S(t, e = 0, n, o = pt) {
115
- n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
112
+ function I(t, e = 0, i, n = wt) {
113
+ i === "end" ? t.style.transition = `transform ${n}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
116
114
  }
117
- function U(t) {
115
+ function B(t) {
118
116
  t.style.transition = "", t.style.transform = "";
119
117
  }
120
- const yt = /^matrix\((.+)\)$/;
121
- function V(t) {
118
+ var _t = /^matrix\((.+)\)$/;
119
+ function S(t) {
122
120
  let e = 0;
123
- const n = t, { transform: o } = window.getComputedStyle(n);
124
- if (o) {
125
- const r = yt.exec(o);
126
- r && (e = +r[1].split(/,\s*/)[4]);
121
+ const i = t, { transform: n } = window.getComputedStyle(i);
122
+ if (n) {
123
+ const l = _t.exec(n);
124
+ l && (e = +l[1].split(/,\s*/)[4]);
127
125
  }
128
126
  return e;
129
127
  }
130
- const O = /* @__PURE__ */ new WeakMap();
131
- function xt(t, e, n, o, r, h, v = 600, T = 60, L = null) {
132
- const s = {
128
+ var O = /* @__PURE__ */ new WeakMap();
129
+ function yt(t, e, i, n, l, h, v = 600, w = 60, y = null) {
130
+ const o = {
133
131
  active: !0,
134
132
  startDistance: 0,
135
133
  scrollDistance: 0,
@@ -137,61 +135,59 @@ function xt(t, e, n, o, r, h, v = 600, T = 60, L = null) {
137
135
  moving: !1,
138
136
  dragging: !1,
139
137
  transitionEndTrigger: null
140
- }, p = t.previousSibling, m = F(), a = (i, d, g, y) => {
141
- let l = d + s.startDistance;
142
- if (g === "end") {
143
- const w = J(i);
144
- let x = w.width * e;
145
- l < x ? l = 0 : l = w.width, s.transitionEndTrigger = () => {
146
- s.moving = !1, i.classList.remove(h), setTimeout(() => {
147
- p && U(p), l == 0 ? U(i) : K(G, {}, i), s.moving = !1;
148
- }, T);
149
- }, p && S(p, 0, "", 0), l > 0 && typeof o == "function" && o(r), S(i, l, "end", y);
138
+ }, p = t.previousSibling, g = N(), r = (a, f, m, E) => {
139
+ let d = f + o.startDistance;
140
+ if (m === "end") {
141
+ const _ = G(a);
142
+ let x = _.width * e;
143
+ d < x ? d = 0 : d = _.width, o.transitionEndTrigger = () => {
144
+ o.moving = !1, h && a.classList.remove(h), setTimeout(() => {
145
+ p && B(p), d == 0 ? B(a) : J(j, {}, a), o.moving = !1;
146
+ }, w);
147
+ }, p && I(p, 0, "", 0), d > 0 && typeof n == "function" && n(l), I(a, d, "end", E);
150
148
  } else
151
- l < 0 && (l = 0), S(i, l, "", 0);
149
+ d < 0 && (d = 0), I(a, d, "", 0);
152
150
  }, u = () => {
153
- s.transitionEndTrigger && (s.transitionEndTrigger(), s.transitionEndTrigger = null);
154
- }, c = (i) => {
155
- if (m.start(i), s.draging = L ? L(t, m.state.startX, m.state.startY) : !0, !s.draging) {
156
- m.reset();
151
+ o.transitionEndTrigger && (o.transitionEndTrigger(), o.transitionEndTrigger = null);
152
+ }, c = (a) => {
153
+ if (g.start(a), o.draging = y ? y(t, g.state.startX, g.state.startY) : !0, !o.draging) {
154
+ g.reset();
157
155
  return;
158
156
  }
159
- s.scrollDistance = 0, s.moving && (s.scrollDistance = V(t)), t.classList.add(h), s.transitionEndTrigger = null, s.moving = !0;
160
- }, E = (i) => {
161
- !s.draging || (s.moving = !0, m.move(i), m.isVertical()) || V(t) === 0 && m.state.deltaX < 0 || (Tt(i), a(t, m.state.deltaX, "", 0));
162
- }, f = () => {
163
- if (!s.draging || (s.draging = !1, m.isVertical()) || V(t) === 0 && m.state.deltaX < 0)
164
- return;
165
- const d = m.state.deltaX;
166
- if (d === 0) {
167
- t.classList.remove(h), s.moving = !1;
157
+ o.scrollDistance = 0, o.moving && (o.scrollDistance = S(t)), h && t.classList.add(h), o.transitionEndTrigger = null, o.moving = !0;
158
+ }, T = (a) => {
159
+ o.draging && (o.moving = !0, g.move(a), !g.isVertical() && (S(t) === 0 && g.state.deltaX < 0 || (xt(a), r(t, g.state.deltaX, "", 0))));
160
+ }, s = () => {
161
+ if (!o.draging || (o.draging = !1, g.isVertical()) || S(t) === 0 && g.state.deltaX < 0) return;
162
+ const a = g.state.deltaX;
163
+ if (a === 0) {
164
+ h && t.classList.remove(h), o.moving = !1;
168
165
  return;
169
166
  }
170
- const g = m.state.duration;
171
- if (g < vt && Math.abs(d) > ht) {
172
- const l = wt(d, g, n);
173
- a(t, l, "end", v);
174
- } else
175
- a(t, d, "end", v);
167
+ const f = g.state.duration;
168
+ f < pt && Math.abs(a) > mt ? r(t, Tt(a, f, i), "end", v) : r(t, a, "end", v);
176
169
  };
177
- t.addEventListener("transitionend", u), t.addEventListener("transitioncancel", u), t.addEventListener("touchstart", c), t.addEventListener("touchmove", E), t.addEventListener("touchend", f), t.addEventListener("touchcancel", f), O.set(t, {
178
- state: s,
170
+ t.addEventListener("transitionend", u), t.addEventListener("transitioncancel", u), t.addEventListener("touchstart", c), t.addEventListener("touchmove", T), t.addEventListener("touchend", s), t.addEventListener("touchcancel", s), O.set(t, {
171
+ state: o,
179
172
  transitionend: u,
180
173
  transitioncancel: u,
181
174
  touchstart: c,
182
- touchmove: E,
183
- touchend: f,
184
- touchcancel: f
175
+ touchmove: T,
176
+ touchend: s,
177
+ touchcancel: s
185
178
  });
186
179
  }
187
- function Et(t) {
180
+ function $t(t) {
188
181
  const e = O.get(t);
189
182
  e && (O.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));
190
183
  }
191
- const Lt = /* @__PURE__ */ A({
184
+ var Et = /* @__PURE__ */ M({
192
185
  __name: "index",
193
186
  props: {
194
- dragRemove: { type: Boolean, default: !0 },
187
+ dragRemove: {
188
+ type: Boolean,
189
+ default: !0
190
+ },
195
191
  removeViewPage: {},
196
192
  removeMoveRatio: { default: 0.5 },
197
193
  momentumReduceRatio: { default: 1 },
@@ -199,118 +195,126 @@ const Lt = /* @__PURE__ */ A({
199
195
  swipeDuration: { default: 60 },
200
196
  draggableArea: {},
201
197
  routerViewName: {},
202
- viewTag: { type: [Function, String], default: "div" },
203
- transition: { type: [Function, Boolean], default: !0 },
198
+ viewTag: {
199
+ type: [Function, String],
200
+ default: "div"
201
+ },
202
+ transition: {
203
+ type: [Function, Boolean],
204
+ default: !0
205
+ },
204
206
  transitionDuration: {},
205
- viewClass: { type: [Function, String], default: "fox-root-navigator__item" }
207
+ viewClass: {
208
+ type: [Function, String],
209
+ default: "fox-root-navigator__item"
210
+ }
206
211
  },
207
212
  setup(t) {
208
213
  const e = t;
209
- let n = null, o = null;
210
- function r(a) {
211
- return (a.params && a.params.animationType) ?? "slide";
214
+ let i = null, n = null;
215
+ function l(r) {
216
+ return (r && r.params && r.params.animationType) ?? "slide";
212
217
  }
213
- function h(a) {
214
- return (a.params && a.params.dragRemove) ?? e.dragRemove;
218
+ function h(r) {
219
+ return (r && r.params && r.params.dragRemove) ?? e.dragRemove;
215
220
  }
216
- const v = (a, u, c, E) => {
217
- if (c.opsType === $.Append || u) {
218
- const f = r(c), i = u ? "show" : "enter";
219
- if (i === "show" && (f === "pop" || o !== "leave" || (n ? r(n) : "") === "pop"))
221
+ const v = (r, u, c, T) => {
222
+ if (c?.opsType === $.Append || u) {
223
+ const s = l(c), a = u ? "show" : "enter";
224
+ if (a === "show" && (s === "pop" || n !== "leave" || (i ? l(i) : "") === "pop"))
220
225
  return;
221
- i === "enter" && (n = c, o = "enter");
222
- const d = `fox-root-navigator--${f}-${i}-from`, g = `fox-root-navigator--${f}-${i}-active`;
223
- a.classList.add(d), a.classList.add(g);
226
+ a === "enter" && (i = c, n = "enter");
227
+ const f = `fox-root-navigator--${s}-${a}-from`, m = `fox-root-navigator--${s}-${a}-active`;
228
+ r.classList.add(f), r.classList.add(m);
224
229
  }
225
- }, T = (a, u, c, E) => {
226
- if (c.opsType === $.Append || u) {
227
- const f = r(c), i = u ? "show" : "enter";
228
- if (i === "show" && (f === "pop" || o !== "leave" || (n ? r(n) : "") === "pop"))
230
+ }, w = (r, u, c, T) => {
231
+ if (c?.opsType === $.Append || u) {
232
+ const s = l(c), a = u ? "show" : "enter";
233
+ if (a === "show" && (s === "pop" || n !== "leave" || (i ? l(i) : "") === "pop"))
229
234
  return;
230
- const d = `fox-root-navigator--${f}-${i}-from`, g = `fox-root-navigator--${f}-${i}-to`;
231
- a.classList.remove(d), a.classList.add(g);
235
+ const f = `fox-root-navigator--${s}-${a}-from`, m = `fox-root-navigator--${s}-${a}-to`;
236
+ r.classList.remove(f), r.classList.add(m);
232
237
  }
233
- }, L = (a, u, c, E) => {
234
- if (c.opsType === $.Append || u) {
235
- const i = r(c), d = u ? "show" : "enter";
236
- if (d === "enter" && (n = null, o = null), i !== "pop") {
237
- const g = `fox-root-navigator--${i}-${d}-active`, y = `fox-root-navigator--${i}-${d}-to`;
238
- a.classList.remove(g), a.classList.remove(y);
238
+ }, y = (r, u, c, T) => {
239
+ if (c?.opsType === $.Append || u) {
240
+ const s = l(c), a = u ? "show" : "enter";
241
+ if (a === "enter" && (i = null, n = null), s !== "pop") {
242
+ const f = `fox-root-navigator--${s}-${a}-active`, m = `fox-root-navigator--${s}-${a}-to`;
243
+ r.classList.remove(f), r.classList.remove(m);
239
244
  }
240
245
  }
241
- if (h(c) === !0 && !u && c.opsType === $.Append) {
242
- let i = null;
243
- e.draggableArea && (i = function(d, g, y) {
244
- const l = g - d.offsetLeft, w = y - d.offsetTop;
245
- return !(e.draggableArea?.left && l < e.draggableArea?.left || e.draggableArea?.right && l > e.draggableArea?.right || e.draggableArea?.top && w < e.draggableArea?.top || e.draggableArea?.bottom && w > e.draggableArea?.bottom);
246
- }), xt(
247
- a,
248
- e.removeMoveRatio,
249
- e.momentumReduceRatio,
250
- e.removeViewPage,
251
- c,
252
- "fox-root-navigator__item--moving",
253
- e.swipeDuration,
254
- e.resetDelay,
255
- i
256
- );
246
+ if (h(c) === !0 && !u && c?.opsType === $.Append) {
247
+ let s = null;
248
+ e.draggableArea && (s = function(a, f, m) {
249
+ const E = f - a.offsetLeft, d = m - a.offsetTop;
250
+ return !(e.draggableArea?.left && E < e.draggableArea?.left || e.draggableArea?.right && E > e.draggableArea?.right || e.draggableArea?.top && d < e.draggableArea?.top || e.draggableArea?.bottom && d > e.draggableArea?.bottom);
251
+ }), yt(r, e.removeMoveRatio, e.momentumReduceRatio, e.removeViewPage, c, "fox-root-navigator__item--moving", e.swipeDuration, e.resetDelay, s);
257
252
  }
258
- }, s = (a, u, c, E) => {
259
- if (c.opsType === $.Append || u) {
260
- const f = r(c), i = u ? "hide" : "leave";
261
- if (i === "hide" && (f === "pop" || o !== "enter" || (n ? r(n) : "") === "pop"))
253
+ }, o = (r, u, c, T) => {
254
+ if (c?.opsType === $.Append || u) {
255
+ const s = l(c), a = u ? "hide" : "leave";
256
+ if (a === "hide" && (s === "pop" || n !== "enter" || (i ? l(i) : "") === "pop"))
262
257
  return;
263
- i === "leave" && (n = c, o = "leave");
264
- const d = `fox-root-navigator--${f}-${i}-from`, g = `fox-root-navigator--${f}-${i}-active`;
265
- a.classList.add(d), a.classList.add(g);
258
+ a === "leave" && (i = c, n = "leave");
259
+ const f = `fox-root-navigator--${s}-${a}-from`, m = `fox-root-navigator--${s}-${a}-active`;
260
+ r.classList.add(f), r.classList.add(m);
266
261
  }
267
- }, p = (a, u, c, E) => {
268
- if (c.opsType === $.Append || u) {
269
- const f = r(c), i = u ? "hide" : "leave";
270
- if (i === "hide" && (f === "pop" || o !== "enter" || (n ? r(n) : "") === "pop"))
262
+ }, p = (r, u, c, T) => {
263
+ if (c?.opsType === $.Append || u) {
264
+ const s = l(c), a = u ? "hide" : "leave";
265
+ if (a === "hide" && (s === "pop" || n !== "enter" || (i ? l(i) : "") === "pop"))
271
266
  return;
272
- const d = `fox-root-navigator--${f}-${i}-from`, g = `fox-root-navigator--${f}-${i}-to`;
273
- a.classList.remove(d), a.classList.add(g);
267
+ const f = `fox-root-navigator--${s}-${a}-from`, m = `fox-root-navigator--${s}-${a}-to`;
268
+ r.classList.remove(f), r.classList.add(m);
274
269
  }
275
- }, m = (a, u, c, E) => {
276
- if (c.opsType === $.Append || u) {
277
- const i = r(c), d = u ? "hide" : "leave";
278
- if (d === "leave" && (n = null, o = null), i !== "pop") {
279
- const g = `fox-root-navigator--${i}-${d}-active`, y = `fox-root-navigator--${i}-${d}-to`;
280
- a.classList.remove(g), a.classList.remove(y);
270
+ }, g = (r, u, c, T) => {
271
+ if (c?.opsType === $.Append || u) {
272
+ const s = l(c), a = u ? "hide" : "leave";
273
+ if (a === "leave" && (i = null, n = null), s !== "pop") {
274
+ const f = `fox-root-navigator--${s}-${a}-active`, m = `fox-root-navigator--${s}-${a}-to`;
275
+ r.classList.remove(f), r.classList.remove(m);
281
276
  }
282
277
  }
283
- h(c) && !u && Et(a);
278
+ h(c) && !u && $t(r);
284
279
  };
285
- return (a, u) => {
286
- const c = X("fox-router-view");
287
- return R(), _(c, {
280
+ return (r, u) => {
281
+ const c = C("fox-router-view");
282
+ return D(), b(c, {
288
283
  class: "fox-root-navigator",
289
284
  "view-class": t.viewClass,
290
285
  "before-enter": v,
291
- enter: T,
292
- "after-enter": L,
293
- "before-leave": s,
286
+ enter: w,
287
+ "after-enter": y,
288
+ "before-leave": o,
294
289
  leave: p,
295
- "after-leave": m,
290
+ "after-leave": g,
296
291
  multi: !0,
297
292
  name: t.routerViewName,
298
293
  "view-tag": t.viewTag,
299
294
  transition: t.transition,
300
295
  "transition-duration": t.transitionDuration
301
- }, null, 8, ["view-class", "name", "view-tag", "transition", "transition-duration"]);
296
+ }, null, 8, [
297
+ "view-class",
298
+ "name",
299
+ "view-tag",
300
+ "transition",
301
+ "transition-duration"
302
+ ]);
302
303
  };
303
304
  }
304
- }), $t = /* @__PURE__ */ A({
305
+ }), Lt = Et, Dt = /* @__PURE__ */ M({
305
306
  __name: "index",
306
307
  props: {
307
308
  routerViewName: {},
308
- transition: { type: [Function, Boolean], default: !1 }
309
+ transition: {
310
+ type: [Function, Boolean],
311
+ default: !1
312
+ }
309
313
  },
310
314
  setup(t) {
311
- return (e, n) => {
312
- const o = X("fox-router-view");
313
- return R(), _(o, {
315
+ return (e, i) => {
316
+ const n = C("fox-router-view");
317
+ return D(), b(n, {
314
318
  class: "fox-card-navigator",
315
319
  "view-class": "fox-card-navigator__item",
316
320
  "view-active-class": "fox-card-navigator__item-active",
@@ -322,32 +326,32 @@ const Lt = /* @__PURE__ */ A({
322
326
  }, null, 8, ["transition", "name"]);
323
327
  };
324
328
  }
325
- }), Dt = 15, Rt = 300, _t = 200;
326
- function At(t) {
329
+ }), bt = Dt, Mt = 15, At = 300, Rt = 200;
330
+ function Ct(t) {
327
331
  t.stopPropagation();
328
332
  }
329
- function bt(t, e, n = 1) {
330
- return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
333
+ function Xt(t, e, i = 1) {
334
+ return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * i;
331
335
  }
332
- function N(t, e = 0, n, o = _t) {
333
- n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
336
+ function V(t, e = 0, i, n = Rt) {
337
+ i === "end" ? t.style.transition = `transform ${n}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
334
338
  }
335
- function z(t) {
339
+ function U(t) {
336
340
  t.style.transition = "", t.style.transform = "";
337
341
  }
338
- const Mt = /^matrix\((.+)\)$/;
342
+ var Pt = /^matrix\((.+)\)$/;
339
343
  function Y(t) {
340
344
  let e = 0;
341
- const n = t, { transform: o } = window.getComputedStyle(n);
342
- if (o) {
343
- const r = Mt.exec(o);
344
- r && (e = +r[1].split(/,\s*/)[4]);
345
+ const i = t, { transform: n } = window.getComputedStyle(i);
346
+ if (n) {
347
+ const l = Pt.exec(n);
348
+ l && (e = +l[1].split(/,\s*/)[4]);
345
349
  }
346
350
  return e;
347
351
  }
348
- const k = /* @__PURE__ */ new WeakMap();
349
- function Xt(t, e, n, o, r, h, v = 600, T = 60, L = null) {
350
- const s = {
352
+ var k = /* @__PURE__ */ new WeakMap();
353
+ function It(t, e, i, n, l, h, v = 600, w = 60, y = null) {
354
+ const o = {
351
355
  active: !0,
352
356
  startDistance: 0,
353
357
  scrollDistance: 0,
@@ -355,61 +359,59 @@ function Xt(t, e, n, o, r, h, v = 600, T = 60, L = null) {
355
359
  moving: !1,
356
360
  dragging: !1,
357
361
  transitionEndTrigger: null
358
- }, p = t.previousSibling, m = F(), a = (i, d, g, y) => {
359
- let l = d + s.startDistance;
360
- if (g === "end") {
361
- const w = J(i);
362
- let x = w.width * e;
363
- l < x ? l = 0 : l = w.width, s.transitionEndTrigger = () => {
364
- s.moving = !1, i.classList.remove(h), setTimeout(() => {
365
- p && z(p), l == 0 ? z(i) : K(G, {}, i), s.moving = !1;
366
- }, T);
367
- }, p && N(p, 0, "", 0), l > 0 && typeof o == "function" && o(r), N(i, l, "end", y);
362
+ }, p = t.previousSibling, g = N(), r = (a, f, m, E) => {
363
+ let d = f + o.startDistance;
364
+ if (m === "end") {
365
+ const _ = G(a);
366
+ let x = _.width * e;
367
+ d < x ? d = 0 : d = _.width, o.transitionEndTrigger = () => {
368
+ o.moving = !1, h && a.classList.remove(h), setTimeout(() => {
369
+ p && U(p), d == 0 ? U(a) : J(j, {}, a), o.moving = !1;
370
+ }, w);
371
+ }, p && V(p, 0, "", 0), d > 0 && typeof n == "function" && n(l), V(a, d, "end", E);
368
372
  } else
369
- l < 0 && (l = 0), N(i, l, "", 0);
373
+ d < 0 && (d = 0), V(a, d, "", 0);
370
374
  }, u = () => {
371
- s.transitionEndTrigger && (s.transitionEndTrigger(), s.transitionEndTrigger = null);
372
- }, c = (i) => {
373
- if (m.start(i), s.draging = L ? L(t, m.state.startX, m.state.startY) : !0, !s.draging) {
374
- m.reset();
375
+ o.transitionEndTrigger && (o.transitionEndTrigger(), o.transitionEndTrigger = null);
376
+ }, c = (a) => {
377
+ if (g.start(a), o.draging = y ? y(t, g.state.startX, g.state.startY) : !0, !o.draging) {
378
+ g.reset();
375
379
  return;
376
380
  }
377
- s.scrollDistance = 0, s.moving && (s.scrollDistance = Y(t)), t.classList.add(h), s.transitionEndTrigger = null, s.moving = !0;
378
- }, E = (i) => {
379
- !s.draging || (s.moving = !0, m.move(i), m.isVertical()) || Y(t) === 0 && m.state.deltaX < 0 || (At(i), a(t, m.state.deltaX, "", 0));
380
- }, f = () => {
381
- if (!s.draging || (s.draging = !1, m.isVertical()) || Y(t) === 0 && m.state.deltaX < 0)
382
- return;
383
- const d = m.state.deltaX;
384
- if (d === 0) {
385
- t.classList.remove(h), s.moving = !1;
381
+ o.scrollDistance = 0, o.moving && (o.scrollDistance = Y(t)), h && t.classList.add(h), o.transitionEndTrigger = null, o.moving = !0;
382
+ }, T = (a) => {
383
+ o.draging && (o.moving = !0, g.move(a), !g.isVertical() && (Y(t) === 0 && g.state.deltaX < 0 || (Ct(a), r(t, g.state.deltaX, "", 0))));
384
+ }, s = () => {
385
+ if (!o.draging || (o.draging = !1, g.isVertical()) || Y(t) === 0 && g.state.deltaX < 0) return;
386
+ const a = g.state.deltaX;
387
+ if (a === 0) {
388
+ h && t.classList.remove(h), o.moving = !1;
386
389
  return;
387
390
  }
388
- const g = m.state.duration;
389
- if (g < Rt && Math.abs(d) > Dt) {
390
- const l = bt(d, g, n);
391
- a(t, l, "end", v);
392
- } else
393
- a(t, d, "end", v);
391
+ const f = g.state.duration;
392
+ f < At && Math.abs(a) > Mt ? r(t, Xt(a, f, i), "end", v) : r(t, a, "end", v);
394
393
  };
395
- t.addEventListener("transitionend", u), t.addEventListener("transitioncancel", u), t.addEventListener("touchstart", c), t.addEventListener("touchmove", E), t.addEventListener("touchend", f), t.addEventListener("touchcancel", f), k.set(t, {
396
- state: s,
394
+ t.addEventListener("transitionend", u), t.addEventListener("transitioncancel", u), t.addEventListener("touchstart", c), t.addEventListener("touchmove", T), t.addEventListener("touchend", s), t.addEventListener("touchcancel", s), k.set(t, {
395
+ state: o,
397
396
  transitionend: u,
398
397
  transitioncancel: u,
399
398
  touchstart: c,
400
- touchmove: E,
401
- touchend: f,
402
- touchcancel: f
399
+ touchmove: T,
400
+ touchend: s,
401
+ touchcancel: s
403
402
  });
404
403
  }
405
- function Ct(t) {
404
+ function St(t) {
406
405
  const e = k.get(t);
407
406
  e && (k.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));
408
407
  }
409
- const Pt = /* @__PURE__ */ A({
408
+ var Vt = /* @__PURE__ */ M({
410
409
  __name: "index",
411
410
  props: {
412
- dragRemove: { type: Boolean, default: !0 },
411
+ dragRemove: {
412
+ type: Boolean,
413
+ default: !0
414
+ },
413
415
  removeViewPage: {},
414
416
  removeMoveRatio: { default: 0.5 },
415
417
  momentumReduceRatio: { default: 1 },
@@ -417,109 +419,114 @@ const Pt = /* @__PURE__ */ A({
417
419
  swipeDuration: { default: 60 },
418
420
  draggableArea: {},
419
421
  routerViewName: {},
420
- viewTag: { type: [Function, String], default: "div" },
421
- transition: { type: [Function, Boolean], default: !0 },
422
+ viewTag: {
423
+ type: [Function, String],
424
+ default: "div"
425
+ },
426
+ transition: {
427
+ type: [Function, Boolean],
428
+ default: !0
429
+ },
422
430
  transitionDuration: {},
423
- viewClass: { type: [Function, String], default: "fox-stack-navigator__item" }
431
+ viewClass: {
432
+ type: [Function, String],
433
+ default: "fox-stack-navigator__item"
434
+ }
424
435
  },
425
436
  setup(t) {
426
437
  const e = t;
427
- let n = null, o = null;
428
- function r(a) {
429
- return (a.params && a.params.animationType) ?? "slide";
438
+ let i = null, n = null;
439
+ function l(r) {
440
+ return (r && r.params && r.params.animationType) ?? "slide";
430
441
  }
431
- function h(a) {
432
- return (a.params && a.params.dragRemove) ?? e.dragRemove;
442
+ function h(r) {
443
+ return (r && r.params && r.params.dragRemove) ?? e.dragRemove;
433
444
  }
434
- const v = (a, u, c, E) => {
435
- if (c.opsType === $.Append || u) {
436
- const f = r(c), i = u ? "show" : "enter";
437
- if (i === "show" && (f === "pop" || o !== "leave" || (n ? r(n) : "") === "pop"))
445
+ const v = (r, u, c, T) => {
446
+ if (c?.opsType === $.Append || u) {
447
+ const s = l(c), a = u ? "show" : "enter";
448
+ if (a === "show" && (s === "pop" || n !== "leave" || (i ? l(i) : "") === "pop"))
438
449
  return;
439
- i === "enter" && (n = c, o = "enter");
440
- const d = `fox-stack-navigator--${f}-${i}-from`, g = `fox-stack-navigator--${f}-${i}-active`;
441
- a.classList.add(d), a.classList.add(g);
450
+ a === "enter" && (i = c, n = "enter");
451
+ const f = `fox-stack-navigator--${s}-${a}-from`, m = `fox-stack-navigator--${s}-${a}-active`;
452
+ r.classList.add(f), r.classList.add(m);
442
453
  }
443
- }, T = (a, u, c, E) => {
444
- if (c.opsType === $.Append || u) {
445
- const f = r(c), i = u ? "show" : "enter";
446
- if (i === "show" && (f === "pop" || o !== "leave" || (n ? r(n) : "") === "pop"))
454
+ }, w = (r, u, c, T) => {
455
+ if (c?.opsType === $.Append || u) {
456
+ const s = l(c), a = u ? "show" : "enter";
457
+ if (a === "show" && (s === "pop" || n !== "leave" || (i ? l(i) : "") === "pop"))
447
458
  return;
448
- const d = `fox-stack-navigator--${f}-${i}-from`, g = `fox-stack-navigator--${f}-${i}-to`;
449
- a.classList.remove(d), a.classList.add(g);
459
+ const f = `fox-stack-navigator--${s}-${a}-from`, m = `fox-stack-navigator--${s}-${a}-to`;
460
+ r.classList.remove(f), r.classList.add(m);
450
461
  }
451
- }, L = (a, u, c, E) => {
452
- if (c.opsType === $.Append || u) {
453
- const i = r(c), d = u ? "show" : "enter";
454
- if (d === "enter" && (n = null, o = null), i !== "pop") {
455
- const g = `fox-stack-navigator--${i}-${d}-active`, y = `fox-stack-navigator--${i}-${d}-to`;
456
- a.classList.remove(g), a.classList.remove(y);
462
+ }, y = (r, u, c, T) => {
463
+ if (c?.opsType === $.Append || u) {
464
+ const s = l(c), a = u ? "show" : "enter";
465
+ if (a === "enter" && (i = null, n = null), s !== "pop") {
466
+ const f = `fox-stack-navigator--${s}-${a}-active`, m = `fox-stack-navigator--${s}-${a}-to`;
467
+ r.classList.remove(f), r.classList.remove(m);
457
468
  }
458
469
  }
459
- if (h(c) === !0 && !u && c.opsType === $.Append) {
460
- let i = null;
461
- e.draggableArea && (i = function(d, g, y) {
462
- const l = g - d.offsetLeft, w = y - d.offsetTop;
463
- return !(e.draggableArea?.left && l < e.draggableArea?.left || e.draggableArea?.right && l > e.draggableArea?.right || e.draggableArea?.top && w < e.draggableArea?.top || e.draggableArea?.bottom && w > e.draggableArea?.bottom);
464
- }), Xt(
465
- a,
466
- e.removeMoveRatio,
467
- e.momentumReduceRatio,
468
- e.removeViewPage,
469
- c,
470
- "fox-stack-navigator__item--moving",
471
- e.swipeDuration,
472
- e.resetDelay,
473
- i
474
- );
470
+ if (h(c) === !0 && !u && c?.opsType === $.Append) {
471
+ let s = null;
472
+ e.draggableArea && (s = function(a, f, m) {
473
+ const E = f - a.offsetLeft, d = m - a.offsetTop;
474
+ return !(e.draggableArea?.left && E < e.draggableArea?.left || e.draggableArea?.right && E > e.draggableArea?.right || e.draggableArea?.top && d < e.draggableArea?.top || e.draggableArea?.bottom && d > e.draggableArea?.bottom);
475
+ }), It(r, e.removeMoveRatio, e.momentumReduceRatio, e.removeViewPage, c, "fox-stack-navigator__item--moving", e.swipeDuration, e.resetDelay, s);
475
476
  }
476
- }, s = (a, u, c, E) => {
477
- if (c.opsType === $.Append || u) {
478
- const f = r(c), i = u ? "hide" : "leave";
479
- if (i === "hide" && (f === "pop" || o !== "enter" || (n ? r(n) : "") === "pop"))
477
+ }, o = (r, u, c, T) => {
478
+ if (c?.opsType === $.Append || u) {
479
+ const s = l(c), a = u ? "hide" : "leave";
480
+ if (a === "hide" && (s === "pop" || n !== "enter" || (i ? l(i) : "") === "pop"))
480
481
  return;
481
- i === "leave" && (n = c, o = "leave");
482
- const d = `fox-stack-navigator--${f}-${i}-from`, g = `fox-stack-navigator--${f}-${i}-active`;
483
- a.classList.add(d), a.classList.add(g);
482
+ a === "leave" && (i = c, n = "leave");
483
+ const f = `fox-stack-navigator--${s}-${a}-from`, m = `fox-stack-navigator--${s}-${a}-active`;
484
+ r.classList.add(f), r.classList.add(m);
484
485
  }
485
- }, p = (a, u, c, E) => {
486
- if (c.opsType === $.Append || u) {
487
- const f = r(c), i = u ? "hide" : "leave";
488
- if (i === "hide" && (f === "pop" || o !== "enter" || (n ? r(n) : "") === "pop"))
486
+ }, p = (r, u, c, T) => {
487
+ if (c?.opsType === $.Append || u) {
488
+ const s = l(c), a = u ? "hide" : "leave";
489
+ if (a === "hide" && (s === "pop" || n !== "enter" || (i ? l(i) : "") === "pop"))
489
490
  return;
490
- const d = `fox-stack-navigator--${f}-${i}-from`, g = `fox-stack-navigator--${f}-${i}-to`;
491
- a.classList.remove(d), a.classList.add(g);
491
+ const f = `fox-stack-navigator--${s}-${a}-from`, m = `fox-stack-navigator--${s}-${a}-to`;
492
+ r.classList.remove(f), r.classList.add(m);
492
493
  }
493
- }, m = (a, u, c, E) => {
494
- if (c.opsType === $.Append || u) {
495
- const i = r(c), d = u ? "hide" : "leave";
496
- if (d === "leave" && (n = null, o = null), i !== "pop") {
497
- const g = `fox-stack-navigator--${i}-${d}-active`, y = `fox-stack-navigator--${i}-${d}-to`;
498
- a.classList.remove(g), a.classList.remove(y);
494
+ }, g = (r, u, c, T) => {
495
+ if (c?.opsType === $.Append || u) {
496
+ const s = l(c), a = u ? "hide" : "leave";
497
+ if (a === "leave" && (i = null, n = null), s !== "pop") {
498
+ const f = `fox-stack-navigator--${s}-${a}-active`, m = `fox-stack-navigator--${s}-${a}-to`;
499
+ r.classList.remove(f), r.classList.remove(m);
499
500
  }
500
501
  }
501
- h(c) && !u && Ct(a);
502
+ h(c) && !u && St(r);
502
503
  };
503
- return (a, u) => {
504
- const c = X("fox-router-view");
505
- return R(), _(c, {
504
+ return (r, u) => {
505
+ const c = C("fox-router-view");
506
+ return D(), b(c, {
506
507
  class: "fox-stack-navigator",
507
508
  "view-class": t.viewClass,
508
509
  "before-enter": v,
509
- enter: T,
510
- "after-enter": L,
511
- "before-leave": s,
510
+ enter: w,
511
+ "after-enter": y,
512
+ "before-leave": o,
512
513
  leave: p,
513
- "after-leave": m,
514
+ "after-leave": g,
514
515
  multi: !0,
515
516
  name: t.routerViewName,
516
517
  "view-tag": t.viewTag,
517
518
  transition: t.transition,
518
519
  "transition-duration": t.transitionDuration
519
- }, null, 8, ["view-class", "name", "view-tag", "transition", "transition-duration"]);
520
+ }, null, 8, [
521
+ "view-class",
522
+ "name",
523
+ "view-tag",
524
+ "transition",
525
+ "transition-duration"
526
+ ]);
520
527
  };
521
528
  }
522
- }), It = { class: "fox-swiper-navigator" }, St = /* @__PURE__ */ A({
529
+ }), Yt = Vt, Ot = { class: "fox-swiper-navigator" }, kt = /* @__PURE__ */ M({
523
530
  __name: "swiper",
524
531
  props: {
525
532
  width: {},
@@ -528,218 +535,134 @@ const Pt = /* @__PURE__ */ A({
528
535
  direction: {}
529
536
  },
530
537
  setup(t) {
531
- const e = t, n = C(() => {
532
- const o = {
538
+ const e = t, i = X(() => {
539
+ const n = {
533
540
  transform: `translate3d(${e.scrollDistance}px, 0, 0)`,
534
541
  width: `${e.width}`
535
542
  };
536
- return e.scrollDuration > 0 && (o["transition-duration"] = `${e.scrollDuration}ms`), o;
543
+ return e.scrollDuration > 0 && (n["transition-duration"] = `${e.scrollDuration}ms`), n;
537
544
  });
538
- return (o, r) => (R(), it("div", It, [
539
- at("div", {
540
- class: "fox-swiper-navigator__inner",
541
- style: j(n.value)
542
- }, [
543
- st(o.$slots, "default")
544
- ], 4)
545
- ]));
545
+ return (n, l) => (D(), nt("div", Ot, [it("div", {
546
+ class: "fox-swiper-navigator__inner",
547
+ style: q(i.value)
548
+ }, [lt(n.$slots, "default")], 4)]));
546
549
  }
547
- });
548
- let Vt = 0;
549
- function Nt() {
550
- return ++Vt;
550
+ }), Nt = kt, Ft = 0;
551
+ function Wt() {
552
+ return ++Ft;
551
553
  }
552
- const Yt = 15, Ot = 300, kt = 200;
553
- function Ft(t) {
554
+ var Bt = 15, Ut = 300, zt = 200;
555
+ function qt(t) {
554
556
  t.stopPropagation();
555
557
  }
556
- function Wt(t, e, n = 1) {
557
- return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
558
+ function Ht(t, e, i = 1) {
559
+ return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * i;
558
560
  }
559
- function q(t, e = 0, n, o = kt) {
560
- n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
561
+ function z(t, e = 0, i, n = zt) {
562
+ i === "end" ? t.style.transition = `transform ${n}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
561
563
  }
562
- class Bt {
563
- /**
564
- * width
565
- */
564
+ var jt = class {
566
565
  width = 0;
567
- /**
568
- * column width
569
- */
570
566
  columnWidth = 0;
571
- /**
572
- * max
573
- */
574
567
  max = 0;
575
- /**
576
- * min
577
- */
578
568
  min = 0;
579
- /**
580
- * element
581
- */
582
569
  el = null;
583
- /**
584
- * swipe duration
585
- */
586
570
  swipeDuration = 360;
587
- /**
588
- * transitionEndTrigger
589
- */
590
571
  transitionEndTrigger = null;
591
- /**
592
- * moving
593
- */
594
572
  moving = !1;
595
- /**
596
- * start distance
597
- */
598
573
  startDistance = 0;
599
- /**
600
- * scroll distance
601
- */
602
574
  scrollDistance = 0;
603
- /**
604
- * 获取start distance
605
- */
606
575
  getStartDistance;
607
- /**
608
- * open page
609
- */
610
576
  openPage;
611
- /**
612
- * is page opened
613
- */
614
577
  isPageOpened;
615
- /**
616
- * page opened
617
- */
618
578
  pageOpened;
619
- /**
620
- *触发移动页面的移动比例(相对页面)
621
- */
622
579
  moveRatio = 0.5;
623
- /**
624
- * 惯性削减比例
625
- */
626
580
  momentumReduceRatio = 1;
627
- /**
628
- * transitionend
629
- */
630
581
  transitionend = null;
631
- /**
632
- * touchstart
633
- */
634
582
  touchstart = null;
635
- /**
636
- * touchmove
637
- */
638
583
  touchmove = null;
639
- /**
640
- * touchend
641
- */
642
584
  touchend = null;
643
- /**
644
- * touchcancel
645
- */
646
585
  touchcancel = null;
647
- /**
648
- * 构造函数
649
- * @param getStartDistance
650
- * @param openPage
651
- * @param isPageOpened
652
- * @param pageOpened
653
- * @param moveRatio
654
- * @param momentumReduceRatio
655
- *
656
- */
657
- constructor(e, n, o, r, h, v) {
658
- this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = r, this.moveRatio = h, this.momentumReduceRatio = v;
586
+ constructor(t, e, i, n, l, h) {
587
+ this.getStartDistance = t, this.openPage = e, this.isPageOpened = i, this.pageOpened = n, this.moveRatio = l, this.momentumReduceRatio = h;
659
588
  }
660
- /**
661
- * 打开drag支持
662
- */
663
589
  open() {
664
- const e = this.el, n = F(), o = (r, h, v, T) => {
665
- let L = h + this.startDistance;
666
- const s = this.columnWidth * this.moveRatio;
667
- if (v === "end") {
668
- if (h == 0) {
590
+ const t = this.el, e = N(), i = (n, l, h, v) => {
591
+ let w = l + this.startDistance;
592
+ const y = this.columnWidth * this.moveRatio;
593
+ if (h === "end") {
594
+ if (l == 0) {
669
595
  this.moving = !1;
670
596
  return;
671
597
  }
672
- Math.abs(h) > s ? h > 0 ? L = this.startDistance + this.columnWidth : L = this.startDistance - this.columnWidth : L = this.startDistance;
673
- let p = -L;
674
- p < 0 ? p = 0 : p > this.width - this.columnWidth && (p = this.width - this.columnWidth);
675
- const m = Math.floor(p / this.columnWidth);
676
- this.isPageOpened(m) || this.openPage(m), L = -m * this.columnWidth, T && T > 0 && (this.transitionEndTrigger = () => {
677
- this.moving = !1, this.pageOpened(m);
678
- }), q(r, L, "end", T), this.scrollDistance = L;
598
+ Math.abs(l) > y ? l > 0 ? w = this.startDistance + this.columnWidth : w = this.startDistance - this.columnWidth : w = this.startDistance;
599
+ let o = -w;
600
+ o < 0 ? o = 0 : o > this.width - this.columnWidth && (o = this.width - this.columnWidth);
601
+ const p = Math.floor(o / this.columnWidth);
602
+ this.isPageOpened(p) || this.openPage(p), w = -p * this.columnWidth, v && v > 0 && (this.transitionEndTrigger = () => {
603
+ this.moving = !1, this.pageOpened(p);
604
+ }), z(n, w, "end", v), this.scrollDistance = w;
679
605
  } else {
680
- if (Math.abs(h) > s) {
681
- let m = 0;
682
- if (h > 0 ? m = Math.abs(this.startDistance + this.columnWidth) : m = Math.abs(this.startDistance - this.columnWidth), m >= 0 && m < this.width) {
683
- const a = Math.floor(m / this.columnWidth);
684
- this.isPageOpened(a) || this.openPage(a);
606
+ if (Math.abs(l) > y) {
607
+ let p = 0;
608
+ if (l > 0 ? p = Math.abs(this.startDistance + this.columnWidth) : p = Math.abs(this.startDistance - this.columnWidth), p >= 0 && p < this.width) {
609
+ const g = Math.floor(p / this.columnWidth);
610
+ this.isPageOpened(g) || this.openPage(g);
685
611
  }
686
612
  }
687
- let p = -L;
688
- p < this.min ? p = this.min : p > this.max && (p = this.max), q(r, -p, "", 0);
613
+ let o = -w;
614
+ o < this.min ? o = this.min : o > this.max && (o = this.max), z(n, -o, "", 0);
689
615
  }
690
616
  };
691
617
  this.transitionend = () => {
692
- e.style.transition = "", this.transitionEndTrigger && (this.transitionEndTrigger(), this.transitionEndTrigger = null);
693
- }, this.touchstart = (r) => {
694
- this.moving || (n.start(r), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
695
- }, this.touchmove = (r) => {
696
- n.move(r), !n.isVertical() && (Ft(r), o(e, n.state.deltaX, "", 0));
618
+ t.style.transition = "", this.transitionEndTrigger && (this.transitionEndTrigger(), this.transitionEndTrigger = null);
619
+ }, this.touchstart = (n) => {
620
+ this.moving || (e.start(n), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
621
+ }, this.touchmove = (n) => {
622
+ e.move(n), !e.isVertical() && (qt(n), i(t, e.state.deltaX, "", 0));
697
623
  }, this.touchend = () => {
698
- if (n.isVertical())
699
- return;
700
- const r = n.state.deltaX;
701
- if (r == 0)
702
- return;
703
- const h = n.state.duration;
704
- if (h < Ot && Math.abs(r) > Yt) {
705
- const T = Wt(r, h, this.momentumReduceRatio);
706
- o(e, T, "end", this.swipeDuration);
707
- } else
708
- o(e, r, "end", this.swipeDuration);
709
- }, 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);
624
+ if (e.isVertical()) return;
625
+ const n = e.state.deltaX;
626
+ if (n == 0) return;
627
+ const l = e.state.duration;
628
+ l < Ut && Math.abs(n) > Bt ? i(t, Ht(n, l, this.momentumReduceRatio), "end", this.swipeDuration) : i(t, n, "end", this.swipeDuration);
629
+ }, t.addEventListener("transitionend", this.transitionend), t.addEventListener("touchstart", this.touchstart), t.addEventListener("touchmove", this.touchmove), t.addEventListener("touchend", this.touchend), t.addEventListener("touchcancel", this.touchend);
710
630
  }
711
- /**
712
- * 关闭drag支持
713
- */
714
631
  close() {
715
- const e = this.el;
716
- 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;
632
+ const t = this.el;
633
+ this.transitionend && t.addEventListener("transitionend", this.transitionend), this.touchstart && t.addEventListener("touchstart", this.touchstart), this.touchmove && t.addEventListener("touchmove", this.touchmove), this.touchend && t.addEventListener("touchend", this.touchend), this.touchcancel && t.addEventListener("touchcancel", this.touchcancel), this.el = null;
717
634
  }
635
+ };
636
+ function Gt(t, e, i, n, l, h) {
637
+ return new jt(t, e, i, n, l, h);
718
638
  }
719
- function Ut(t, e, n, o, r, h) {
720
- return new Bt(t, e, n, o, r, h);
721
- }
722
- function zt(t) {
723
- const e = H(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), r = parseFloat(n.getPropertyValue("padding-right")), h = parseFloat(n.getPropertyValue("padding-top")), v = parseFloat(n.getPropertyValue("padding-bottom"));
639
+ function Jt(t) {
640
+ const e = H(t), i = window.getComputedStyle(e, null), n = parseFloat(i.getPropertyValue("padding-left")), l = parseFloat(i.getPropertyValue("padding-right")), h = parseFloat(i.getPropertyValue("padding-top")), v = parseFloat(i.getPropertyValue("padding-bottom"));
724
641
  return {
725
- width: e.clientWidth - o - r,
642
+ width: e.clientWidth - n - l,
726
643
  height: e.clientHeight - h - v
727
644
  };
728
645
  }
729
- const qt = /* @__PURE__ */ A({
646
+ var Kt = /* @__PURE__ */ M({
730
647
  __name: "index",
731
648
  props: {
732
649
  activePath: {},
733
650
  routes: {},
734
651
  height: { default: -1 },
735
652
  width: { default: -1 },
736
- draggable: { type: Boolean, default: !0 },
653
+ draggable: {
654
+ type: Boolean,
655
+ default: !0
656
+ },
737
657
  openViewPage: {},
738
658
  routerViewName: {},
739
659
  moveRatio: { default: 0.5 },
740
660
  momentumReduceRatio: { default: 1 },
741
661
  direction: { default: "horizontal" },
742
- transition: { type: [Function, Boolean], default: !0 },
662
+ transition: {
663
+ type: [Function, Boolean],
664
+ default: !0
665
+ },
743
666
  swipeDuration: { default: 360 },
744
667
  scrollDuration: {},
745
668
  customClass: {},
@@ -747,134 +670,124 @@ const qt = /* @__PURE__ */ A({
747
670
  },
748
671
  emits: ["update:activePath"],
749
672
  setup(t, { emit: e }) {
750
- const n = t, o = rt({
673
+ const i = t, n = ct({
751
674
  scrollDistance: 0,
752
675
  index: -1,
753
676
  openedIndexList: [],
754
- width: n.width,
755
- height: n.height
756
- }), r = e, h = () => o.scrollDistance, v = (l) => {
757
- if (o.openedIndexList.indexOf(l) === -1) {
758
- o.openedIndexList.push(l);
759
- const w = n.routes[l];
677
+ width: i.width,
678
+ height: i.height
679
+ }), l = e, h = () => n.scrollDistance, v = (d) => {
680
+ if (n.openedIndexList.indexOf(d) === -1) {
681
+ n.openedIndexList.push(d);
682
+ const _ = i.routes[d];
760
683
  try {
761
- n.openViewPage(w, l);
684
+ i.openViewPage(_, d);
762
685
  } catch (x) {
763
686
  console.error(x);
764
687
  }
765
688
  }
766
- }, T = (l) => o.openedIndexList.indexOf(l) !== -1, L = (l) => {
767
- o.index = l, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
768
- const w = n.routes[l];
769
- r("update:activePath", w.path);
689
+ }, w = (d) => n.openedIndexList.indexOf(d) !== -1, y = (d) => {
690
+ n.index = d, n.width > 0 ? n.scrollDistance = -n.index * n.width : n.scrollDistance = 0;
691
+ const _ = i.routes[d];
692
+ l("update:activePath", _.path);
770
693
  };
771
- let s = null;
772
- n.draggable && (s = Ut(
773
- h,
774
- v,
775
- T,
776
- L,
777
- n.moveRatio,
778
- n.momentumReduceRatio
779
- ));
694
+ let o = null;
695
+ i.draggable && (o = Gt(h, v, w, y, i.moveRatio, i.momentumReduceRatio));
780
696
  let p = null;
781
- ct(() => {
782
- const l = f(), w = () => {
783
- const x = zt(l);
784
- m(n.activePath, n.routes, x.width, x.height, n.swipeDuration, n.direction);
697
+ st(() => {
698
+ const d = s(), _ = () => {
699
+ const x = Jt(d);
700
+ g(i.activePath, i.routes, x.width, x.height, i.swipeDuration, i.direction);
785
701
  };
786
- if (window.ResizeObserver && (p = new window.ResizeObserver(w), p.observe(l)), w(), s) {
787
- const x = d();
788
- s.el = x, s.open();
702
+ if (window.ResizeObserver && (p = new window.ResizeObserver(_), p.observe(d)), _(), o) {
703
+ const x = f();
704
+ o.el = x, o.open();
789
705
  }
790
- }), lt(() => {
791
- p && (p.disconnect(), p = null), s && s.close();
792
- }), dt(
793
- [
794
- () => n.activePath,
795
- () => n.routes,
796
- () => n.width,
797
- () => n.height,
798
- () => n.swipeDuration,
799
- () => n.direction
800
- ],
801
- ([l, w, x, b, M, P]) => {
802
- const I = x <= 0 ? o.width : x, D = b <= 0 ? o.height : b;
803
- m(l, w, I, D, M, P);
804
- }
805
- );
806
- const m = (l, w, x, b, M, P = "horizontal") => {
807
- const I = l;
808
- if (o.index = w.findIndex((D) => D.path === I), P === "horizontal") {
809
- const D = x;
810
- if (D > 0) {
811
- o.width = x;
812
- const Q = D * n.routes.length, Z = -D / 3, tt = D * (w.length - 1) + D / 3;
813
- s && (s.columnWidth = D, s.width = Q, s.min = Z, s.max = tt), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -D * o.index);
706
+ }), rt(() => {
707
+ p && (p.disconnect(), p = null), o && o.close();
708
+ }), ut([
709
+ () => i.activePath,
710
+ () => i.routes,
711
+ () => i.width,
712
+ () => i.height,
713
+ () => i.swipeDuration,
714
+ () => i.direction
715
+ ], ([d, _, x, A, R, P]) => {
716
+ g(d, _, x <= 0 ? n.width : x, A <= 0 ? n.height : A, R, P);
717
+ });
718
+ const g = (d, _, x, A, R, P = "horizontal") => {
719
+ const K = d;
720
+ if (n.index = _.findIndex((L) => L.path === K), P === "horizontal") {
721
+ const L = x;
722
+ if (L > 0) {
723
+ n.width = x;
724
+ const Q = L * i.routes.length, Z = -L / 3, tt = L * (_.length - 1) + L / 3;
725
+ o && (o.columnWidth = L, o.width = Q, o.min = Z, o.max = tt), n.index !== -1 && (n.openedIndexList.push(n.index), n.scrollDistance = -L * n.index);
814
726
  }
815
727
  }
816
- s && (s.swipeDuration = M);
817
- }, a = `fox-swiper-navigator-${Nt()}`, u = C(() => {
818
- const l = [a];
819
- return n.customClass && l.push(n.customClass), l;
820
- }), c = C(() => {
821
- const l = {}, w = o.width > 0 ? o.width : n.width;
822
- w > 0 && (l.width = `${w}px`);
823
- const x = o.height > 0 ? o.height : n.height;
824
- return x > 0 && (l.height = `${x}px`), n.customStyle && Object.assign(l, n.customStyle), l;
728
+ o && (o.swipeDuration = R);
729
+ }, r = `fox-swiper-navigator-${Wt()}`, u = X(() => {
730
+ const d = [r];
731
+ return i.customClass && d.push(i.customClass), d;
732
+ }), c = X(() => {
733
+ const d = {}, _ = n.width > 0 ? n.width : i.width;
734
+ _ > 0 && (d.width = `${_}px`);
735
+ const x = n.height > 0 ? n.height : i.height;
736
+ return x > 0 && (d.height = `${x}px`), i.customStyle && Object.assign(d, i.customStyle), d;
825
737
  });
826
- let E = null;
827
- function f() {
828
- return E || (E = document.querySelector(`.${a}`), E);
738
+ let T = null;
739
+ function s() {
740
+ return T || (T = document.querySelector(`.${r}`), T);
829
741
  }
830
- let i = null;
831
- function d() {
832
- return i || (i = document.querySelector(`.${a}>.fox-swiper-navigator__inner`), i);
742
+ let a = null;
743
+ function f() {
744
+ return a || (a = document.querySelector(`.${r}>.fox-swiper-navigator__inner`), a);
833
745
  }
834
- const g = C(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), y = (l, w) => {
835
- const x = n.routes.findIndex((b) => {
836
- const M = l.path ?? l.name ?? "";
837
- return b.path == M;
746
+ const m = X(() => n.width > 0 ? `${n.width * i.routes.length}px` : "100%"), E = (d, _) => {
747
+ const x = i.routes.findIndex((A) => {
748
+ const R = d.path ?? d.name ?? "";
749
+ return A.path == R;
838
750
  });
839
- return o.width <= 0 ? {} : {
840
- style: {
841
- left: `${x * o.width}px`,
842
- width: `${o.width}px`
843
- }
844
- };
751
+ return n.width <= 0 ? {} : { style: {
752
+ left: `${x * n.width}px`,
753
+ width: `${n.width}px`
754
+ } };
845
755
  };
846
- return (l, w) => {
847
- const x = X("fox-router-view");
848
- return R(), _(x, {
849
- class: ut(u.value),
850
- style: j(c.value),
756
+ return (d, _) => {
757
+ const x = C("fox-router-view");
758
+ return D(), b(x, {
759
+ class: ot(u.value),
760
+ style: q(c.value),
851
761
  "view-class": "fox-swiper-navigator__item",
852
- tag: St,
853
- "view-tag-props": y,
762
+ tag: Nt,
763
+ "view-tag-props": E,
854
764
  multi: !0,
855
765
  name: t.routerViewName,
856
766
  transition: t.transition,
857
- "scroll-distance": o.scrollDistance,
767
+ "scroll-distance": n.scrollDistance,
858
768
  "scroll-duration": t.scrollDuration,
859
769
  direction: t.direction,
860
- width: g.value
861
- }, null, 8, ["class", "style", "name", "transition", "scroll-distance", "scroll-duration", "direction", "width"]);
770
+ width: m.value
771
+ }, null, 8, [
772
+ "class",
773
+ "style",
774
+ "name",
775
+ "transition",
776
+ "scroll-distance",
777
+ "scroll-duration",
778
+ "direction",
779
+ "width"
780
+ ]);
862
781
  };
863
782
  }
864
- }), Gt = {
865
- /**
866
- * 安装
867
- * @param app
868
- */
869
- install(t, e = "fox") {
870
- t.component(`${e}-default-navigator`, ft), t.component(`${e}-root-navigator`, Lt), t.component(`${e}-card-navigator`, $t), t.component(`${e}-stack-navigator`, Pt), t.component(`${e}-swiper-navigator`, qt);
871
- }
872
- };
783
+ }), Qt = Kt, ee = { install(t, e = "fox") {
784
+ t.component(`${e}-default-navigator`, vt), t.component(`${e}-root-navigator`, Lt), t.component(`${e}-card-navigator`, bt), t.component(`${e}-stack-navigator`, Yt), t.component(`${e}-swiper-navigator`, Qt);
785
+ } };
873
786
  export {
874
- $t as FoxCardNavigator,
875
- ft as FoxDefaultNavigator,
787
+ bt as FoxCardNavigator,
788
+ vt as FoxDefaultNavigator,
876
789
  Lt as FoxRootNavigator,
877
- Pt as FoxStackNavigator,
878
- qt as FoxSwiperNavigator,
879
- Gt as default
790
+ Yt as FoxStackNavigator,
791
+ Qt as FoxSwiperNavigator,
792
+ ee as default
880
793
  };