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