@fox-js/navigation 4.0.1-9 → 4.0.1

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