@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/README.md +53 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +461 -548
- package/dist/index.umd.js +1 -1
- package/dist/style.css +2 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FoxLeaveEnd as
|
|
3
|
-
|
|
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: {
|
|
7
|
+
transition: {
|
|
8
|
+
type: [Function, Boolean],
|
|
9
|
+
default: !0
|
|
10
|
+
}
|
|
8
11
|
},
|
|
9
12
|
setup(t) {
|
|
10
|
-
return (e,
|
|
11
|
-
const
|
|
12
|
-
return
|
|
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:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
}),
|
|
30
|
-
function
|
|
31
|
-
return t > e && t >
|
|
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
|
|
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",
|
|
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
|
|
53
|
-
t.deltaX =
|
|
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 =
|
|
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 (
|
|
60
|
-
const
|
|
61
|
-
t.startX =
|
|
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:
|
|
65
|
+
reset: n,
|
|
67
66
|
isVertical: e,
|
|
68
|
-
isHorizontal:
|
|
67
|
+
isHorizontal: i,
|
|
69
68
|
state: t
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
|
-
function
|
|
71
|
+
function ht(t) {
|
|
73
72
|
return t === window;
|
|
74
73
|
}
|
|
75
|
-
|
|
74
|
+
var G = (t) => {
|
|
76
75
|
const e = H(t);
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
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:
|
|
83
|
-
bottom:
|
|
84
|
-
width:
|
|
85
|
-
height:
|
|
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
|
-
},
|
|
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
|
|
103
|
-
let
|
|
104
|
-
for (let
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
|
112
|
-
return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t *
|
|
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
|
|
115
|
-
|
|
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
|
|
115
|
+
function B(t) {
|
|
118
116
|
t.style.transition = "", t.style.transform = "";
|
|
119
117
|
}
|
|
120
|
-
|
|
121
|
-
function
|
|
118
|
+
var _t = /^matrix\((.+)\)$/;
|
|
119
|
+
function S(t) {
|
|
122
120
|
let e = 0;
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
|
|
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
|
-
|
|
131
|
-
function
|
|
132
|
-
const
|
|
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,
|
|
141
|
-
let
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
144
|
-
let x =
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
p &&
|
|
148
|
-
},
|
|
149
|
-
}, p &&
|
|
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
|
-
|
|
149
|
+
d < 0 && (d = 0), I(a, d, "", 0);
|
|
152
150
|
}, u = () => {
|
|
153
|
-
|
|
154
|
-
}, c = (
|
|
155
|
-
if (
|
|
156
|
-
|
|
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
|
-
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
if (!
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
|
171
|
-
|
|
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",
|
|
178
|
-
state:
|
|
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:
|
|
183
|
-
touchend:
|
|
184
|
-
touchcancel:
|
|
175
|
+
touchmove: T,
|
|
176
|
+
touchend: s,
|
|
177
|
+
touchcancel: s
|
|
185
178
|
});
|
|
186
179
|
}
|
|
187
|
-
function
|
|
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
|
-
|
|
184
|
+
var Et = /* @__PURE__ */ M({
|
|
192
185
|
__name: "index",
|
|
193
186
|
props: {
|
|
194
|
-
dragRemove: {
|
|
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: {
|
|
203
|
-
|
|
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: {
|
|
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
|
|
210
|
-
function r
|
|
211
|
-
return (
|
|
214
|
+
let i = null, n = null;
|
|
215
|
+
function l(r) {
|
|
216
|
+
return (r && r.params && r.params.animationType) ?? "slide";
|
|
212
217
|
}
|
|
213
|
-
function h(
|
|
214
|
-
return (
|
|
218
|
+
function h(r) {
|
|
219
|
+
return (r && r.params && r.params.dragRemove) ?? e.dragRemove;
|
|
215
220
|
}
|
|
216
|
-
const v = (
|
|
217
|
-
if (c
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
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
|
-
|
|
222
|
-
const
|
|
223
|
-
|
|
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
|
-
},
|
|
226
|
-
if (c
|
|
227
|
-
const
|
|
228
|
-
if (
|
|
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
|
|
231
|
-
|
|
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
|
-
},
|
|
234
|
-
if (c
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
const
|
|
238
|
-
|
|
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
|
|
242
|
-
let
|
|
243
|
-
e.draggableArea && (
|
|
244
|
-
const
|
|
245
|
-
return !(e.draggableArea?.left &&
|
|
246
|
-
}),
|
|
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
|
-
},
|
|
259
|
-
if (c
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
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
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
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 = (
|
|
268
|
-
if (c
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
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
|
|
273
|
-
|
|
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
|
-
},
|
|
276
|
-
if (c
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
|
|
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 &&
|
|
278
|
+
h(c) && !u && $t(r);
|
|
284
279
|
};
|
|
285
|
-
return (
|
|
286
|
-
const c =
|
|
287
|
-
return
|
|
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:
|
|
292
|
-
"after-enter":
|
|
293
|
-
"before-leave":
|
|
286
|
+
enter: w,
|
|
287
|
+
"after-enter": y,
|
|
288
|
+
"before-leave": o,
|
|
294
289
|
leave: p,
|
|
295
|
-
"after-leave":
|
|
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, [
|
|
296
|
+
}, null, 8, [
|
|
297
|
+
"view-class",
|
|
298
|
+
"name",
|
|
299
|
+
"view-tag",
|
|
300
|
+
"transition",
|
|
301
|
+
"transition-duration"
|
|
302
|
+
]);
|
|
302
303
|
};
|
|
303
304
|
}
|
|
304
|
-
}),
|
|
305
|
+
}), Lt = Et, Dt = /* @__PURE__ */ M({
|
|
305
306
|
__name: "index",
|
|
306
307
|
props: {
|
|
307
308
|
routerViewName: {},
|
|
308
|
-
transition: {
|
|
309
|
+
transition: {
|
|
310
|
+
type: [Function, Boolean],
|
|
311
|
+
default: !1
|
|
312
|
+
}
|
|
309
313
|
},
|
|
310
314
|
setup(t) {
|
|
311
|
-
return (e,
|
|
312
|
-
const
|
|
313
|
-
return
|
|
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,
|
|
326
|
-
function
|
|
329
|
+
}), bt = Dt, Mt = 15, At = 300, Rt = 200;
|
|
330
|
+
function Ct(t) {
|
|
327
331
|
t.stopPropagation();
|
|
328
332
|
}
|
|
329
|
-
function
|
|
330
|
-
return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t *
|
|
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
|
|
333
|
-
|
|
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
|
|
339
|
+
function U(t) {
|
|
336
340
|
t.style.transition = "", t.style.transform = "";
|
|
337
341
|
}
|
|
338
|
-
|
|
342
|
+
var Pt = /^matrix\((.+)\)$/;
|
|
339
343
|
function Y(t) {
|
|
340
344
|
let e = 0;
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
343
|
-
const
|
|
344
|
-
|
|
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
|
-
|
|
349
|
-
function
|
|
350
|
-
const
|
|
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,
|
|
359
|
-
let
|
|
360
|
-
if (
|
|
361
|
-
const
|
|
362
|
-
let x =
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
p &&
|
|
366
|
-
},
|
|
367
|
-
}, p &&
|
|
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
|
-
|
|
373
|
+
d < 0 && (d = 0), V(a, d, "", 0);
|
|
370
374
|
}, u = () => {
|
|
371
|
-
|
|
372
|
-
}, c = (
|
|
373
|
-
if (
|
|
374
|
-
|
|
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
|
-
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
},
|
|
381
|
-
if (!
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
|
389
|
-
|
|
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",
|
|
396
|
-
state:
|
|
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:
|
|
401
|
-
touchend:
|
|
402
|
-
touchcancel:
|
|
399
|
+
touchmove: T,
|
|
400
|
+
touchend: s,
|
|
401
|
+
touchcancel: s
|
|
403
402
|
});
|
|
404
403
|
}
|
|
405
|
-
function
|
|
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
|
-
|
|
408
|
+
var Vt = /* @__PURE__ */ M({
|
|
410
409
|
__name: "index",
|
|
411
410
|
props: {
|
|
412
|
-
dragRemove: {
|
|
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: {
|
|
421
|
-
|
|
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: {
|
|
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
|
|
428
|
-
function r
|
|
429
|
-
return (
|
|
438
|
+
let i = null, n = null;
|
|
439
|
+
function l(r) {
|
|
440
|
+
return (r && r.params && r.params.animationType) ?? "slide";
|
|
430
441
|
}
|
|
431
|
-
function h(
|
|
432
|
-
return (
|
|
442
|
+
function h(r) {
|
|
443
|
+
return (r && r.params && r.params.dragRemove) ?? e.dragRemove;
|
|
433
444
|
}
|
|
434
|
-
const v = (
|
|
435
|
-
if (c
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
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
|
-
|
|
440
|
-
const
|
|
441
|
-
|
|
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
|
-
},
|
|
444
|
-
if (c
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
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
|
|
449
|
-
|
|
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
|
-
},
|
|
452
|
-
if (c
|
|
453
|
-
const
|
|
454
|
-
if (
|
|
455
|
-
const
|
|
456
|
-
|
|
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
|
|
460
|
-
let
|
|
461
|
-
e.draggableArea && (
|
|
462
|
-
const
|
|
463
|
-
return !(e.draggableArea?.left &&
|
|
464
|
-
}),
|
|
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
|
-
},
|
|
477
|
-
if (c
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
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
|
-
|
|
482
|
-
const
|
|
483
|
-
|
|
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 = (
|
|
486
|
-
if (c
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
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
|
|
491
|
-
|
|
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
|
-
},
|
|
494
|
-
if (c
|
|
495
|
-
const
|
|
496
|
-
if (
|
|
497
|
-
const
|
|
498
|
-
|
|
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 &&
|
|
502
|
+
h(c) && !u && St(r);
|
|
502
503
|
};
|
|
503
|
-
return (
|
|
504
|
-
const c =
|
|
505
|
-
return
|
|
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:
|
|
510
|
-
"after-enter":
|
|
511
|
-
"before-leave":
|
|
510
|
+
enter: w,
|
|
511
|
+
"after-enter": y,
|
|
512
|
+
"before-leave": o,
|
|
512
513
|
leave: p,
|
|
513
|
-
"after-leave":
|
|
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, [
|
|
520
|
+
}, null, 8, [
|
|
521
|
+
"view-class",
|
|
522
|
+
"name",
|
|
523
|
+
"view-tag",
|
|
524
|
+
"transition",
|
|
525
|
+
"transition-duration"
|
|
526
|
+
]);
|
|
520
527
|
};
|
|
521
528
|
}
|
|
522
|
-
}),
|
|
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,
|
|
532
|
-
const
|
|
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 && (
|
|
543
|
+
return e.scrollDuration > 0 && (n["transition-duration"] = `${e.scrollDuration}ms`), n;
|
|
537
544
|
});
|
|
538
|
-
return (
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
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
|
-
|
|
549
|
-
|
|
550
|
-
return ++Vt;
|
|
550
|
+
}), Nt = kt, Ft = 0;
|
|
551
|
+
function Wt() {
|
|
552
|
+
return ++Ft;
|
|
551
553
|
}
|
|
552
|
-
|
|
553
|
-
function
|
|
554
|
+
var Bt = 15, Ut = 300, zt = 200;
|
|
555
|
+
function qt(t) {
|
|
554
556
|
t.stopPropagation();
|
|
555
557
|
}
|
|
556
|
-
function
|
|
557
|
-
return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t *
|
|
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
|
|
560
|
-
|
|
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
|
|
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
|
|
665
|
-
let
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
668
|
-
if (
|
|
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(
|
|
673
|
-
let
|
|
674
|
-
|
|
675
|
-
const
|
|
676
|
-
this.isPageOpened(
|
|
677
|
-
this.moving = !1, this.pageOpened(
|
|
678
|
-
}),
|
|
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(
|
|
681
|
-
let
|
|
682
|
-
if (
|
|
683
|
-
const
|
|
684
|
-
this.isPageOpened(
|
|
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
|
|
688
|
-
|
|
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
|
-
|
|
693
|
-
}, this.touchstart = (
|
|
694
|
-
this.moving || (
|
|
695
|
-
}, this.touchmove = (
|
|
696
|
-
|
|
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 (
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
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
|
|
716
|
-
this.transitionend &&
|
|
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
|
|
720
|
-
|
|
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 -
|
|
642
|
+
width: e.clientWidth - n - l,
|
|
726
643
|
height: e.clientHeight - h - v
|
|
727
644
|
};
|
|
728
645
|
}
|
|
729
|
-
|
|
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: {
|
|
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: {
|
|
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
|
|
673
|
+
const i = t, n = ct({
|
|
751
674
|
scrollDistance: 0,
|
|
752
675
|
index: -1,
|
|
753
676
|
openedIndexList: [],
|
|
754
|
-
width:
|
|
755
|
-
height:
|
|
756
|
-
}),
|
|
757
|
-
if (
|
|
758
|
-
|
|
759
|
-
const
|
|
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
|
-
|
|
684
|
+
i.openViewPage(_, d);
|
|
762
685
|
} catch (x) {
|
|
763
686
|
console.error(x);
|
|
764
687
|
}
|
|
765
688
|
}
|
|
766
|
-
},
|
|
767
|
-
|
|
768
|
-
const
|
|
769
|
-
|
|
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
|
|
772
|
-
|
|
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
|
-
|
|
782
|
-
const
|
|
783
|
-
const x =
|
|
784
|
-
|
|
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(
|
|
787
|
-
const x =
|
|
788
|
-
|
|
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
|
-
}),
|
|
791
|
-
p && (p.disconnect(), p = null),
|
|
792
|
-
}),
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
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
|
-
|
|
817
|
-
},
|
|
818
|
-
const
|
|
819
|
-
return
|
|
820
|
-
}), c =
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
const x =
|
|
824
|
-
return x > 0 && (
|
|
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
|
|
827
|
-
function
|
|
828
|
-
return
|
|
738
|
+
let T = null;
|
|
739
|
+
function s() {
|
|
740
|
+
return T || (T = document.querySelector(`.${r}`), T);
|
|
829
741
|
}
|
|
830
|
-
let
|
|
831
|
-
function
|
|
832
|
-
return
|
|
742
|
+
let a = null;
|
|
743
|
+
function f() {
|
|
744
|
+
return a || (a = document.querySelector(`.${r}>.fox-swiper-navigator__inner`), a);
|
|
833
745
|
}
|
|
834
|
-
const
|
|
835
|
-
const x =
|
|
836
|
-
const
|
|
837
|
-
return
|
|
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
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
};
|
|
751
|
+
return n.width <= 0 ? {} : { style: {
|
|
752
|
+
left: `${x * n.width}px`,
|
|
753
|
+
width: `${n.width}px`
|
|
754
|
+
} };
|
|
845
755
|
};
|
|
846
|
-
return (
|
|
847
|
-
const x =
|
|
848
|
-
return
|
|
849
|
-
class:
|
|
850
|
-
style:
|
|
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:
|
|
853
|
-
"view-tag-props":
|
|
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":
|
|
767
|
+
"scroll-distance": n.scrollDistance,
|
|
858
768
|
"scroll-duration": t.scrollDuration,
|
|
859
769
|
direction: t.direction,
|
|
860
|
-
width:
|
|
861
|
-
}, null, 8, [
|
|
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
|
-
}),
|
|
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
|
-
|
|
875
|
-
|
|
787
|
+
bt as FoxCardNavigator,
|
|
788
|
+
vt as FoxDefaultNavigator,
|
|
876
789
|
Lt as FoxRootNavigator,
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
790
|
+
Yt as FoxStackNavigator,
|
|
791
|
+
Qt as FoxSwiperNavigator,
|
|
792
|
+
ee as default
|
|
880
793
|
};
|