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