@fox-js/navigation 4.0.1-14 → 4.0.1-16
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 +294 -294
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +253 -239
- package/dist/index.umd.js +2 -2
- package/package.json +34 -34
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { FoxLeaveEnd as rt, OperationType as
|
|
1
|
+
import { defineComponent as A, resolveComponent as X, openBlock as L, createBlock as R, withCtx as V, createVNode as J, Transition as K, resolveDynamicComponent as Q, unref as F, computed as P, createElementBlock as Z, createElementVNode as tt, normalizeStyle as U, renderSlot as et, reactive as nt, onMounted as ot, onBeforeUnmount as it, watch as st, normalizeClass as at } from "vue";
|
|
2
|
+
import { FoxLeaveEnd as rt, OperationType as D } from "@fox-js/fox";
|
|
3
3
|
/*!
|
|
4
|
-
* @fox-js/navigation v4.0.1-
|
|
4
|
+
* @fox-js/navigation v4.0.1-15 Sat Jun 15 2024 16:18:22 GMT+0800 (中国标准时间)
|
|
5
5
|
*/
|
|
6
|
-
const ct = /* @__PURE__ */
|
|
6
|
+
const ct = /* @__PURE__ */ A({
|
|
7
7
|
__name: "index",
|
|
8
8
|
props: {
|
|
9
9
|
routerViewName: {},
|
|
@@ -11,8 +11,8 @@ const ct = /* @__PURE__ */ P({
|
|
|
11
11
|
},
|
|
12
12
|
setup(t) {
|
|
13
13
|
return (e, n) => {
|
|
14
|
-
const o =
|
|
15
|
-
return
|
|
14
|
+
const o = X("fox-router-view");
|
|
15
|
+
return L(), R(o, {
|
|
16
16
|
class: "fox-card-navigator",
|
|
17
17
|
"view-class": "fox-card-navigator__item",
|
|
18
18
|
"view-active-class": "fox-card-navigator__item-active",
|
|
@@ -27,7 +27,7 @@ const ct = /* @__PURE__ */ P({
|
|
|
27
27
|
}), lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
28
28
|
__proto__: null,
|
|
29
29
|
default: ct
|
|
30
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
30
|
+
}, Symbol.toStringTag, { value: "Module" })), dt = /* @__PURE__ */ A({
|
|
31
31
|
__name: "index",
|
|
32
32
|
props: {
|
|
33
33
|
routerViewName: {},
|
|
@@ -35,16 +35,16 @@ const ct = /* @__PURE__ */ P({
|
|
|
35
35
|
},
|
|
36
36
|
setup(t) {
|
|
37
37
|
return (e, n) => {
|
|
38
|
-
const o =
|
|
39
|
-
return
|
|
38
|
+
const o = X("fox-router-view");
|
|
39
|
+
return L(), R(o, {
|
|
40
40
|
transition: !1,
|
|
41
41
|
multi: !1,
|
|
42
42
|
name: e.routerViewName
|
|
43
43
|
}, {
|
|
44
|
-
default:
|
|
44
|
+
default: V(({ Component: i }) => [
|
|
45
45
|
J(K, { name: "fox-default-navigator__trans" }, {
|
|
46
|
-
default:
|
|
47
|
-
(
|
|
46
|
+
default: V(() => [
|
|
47
|
+
(L(), R(Q(i)))
|
|
48
48
|
]),
|
|
49
49
|
_: 2
|
|
50
50
|
}, 1024)
|
|
@@ -53,9 +53,9 @@ const ct = /* @__PURE__ */ P({
|
|
|
53
53
|
}, 8, ["name"]);
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
}),
|
|
56
|
+
}), ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
57
57
|
__proto__: null,
|
|
58
|
-
default:
|
|
58
|
+
default: dt
|
|
59
59
|
}, Symbol.toStringTag, { value: "Module" })), W = 10;
|
|
60
60
|
function ft(t, e) {
|
|
61
61
|
return t > e && t > W ? "horizontal" : e > t && e > W ? "vertical" : "";
|
|
@@ -77,20 +77,20 @@ function j() {
|
|
|
77
77
|
t.deltaX = 0, t.deltaY = 0, t.offsetX = 0, t.offsetY = 0, t.direction = "", t.startTime = 0;
|
|
78
78
|
};
|
|
79
79
|
return {
|
|
80
|
-
move: (
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
t.deltaX = s.clientX - t.startX, t.deltaY = s.clientY - t.startY, t.moveX = s.clientX, t.moveY = s.clientY;
|
|
84
|
-
} else
|
|
80
|
+
move: (m) => {
|
|
81
|
+
if (m.touches) {
|
|
82
|
+
const h = m.touches[0];
|
|
85
83
|
t.deltaX = h.clientX - t.startX, t.deltaY = h.clientY - t.startY, t.moveX = h.clientX, t.moveY = h.clientY;
|
|
84
|
+
} else
|
|
85
|
+
t.deltaX = m.clientX - t.startX, t.deltaY = m.clientY - t.startY, t.moveX = m.clientX, t.moveY = m.clientY;
|
|
86
86
|
t.offsetX = Math.abs(t.deltaX), t.offsetY = Math.abs(t.deltaY), t.duration = Date.now() - t.startTime, t.direction || (t.direction = ft(t.offsetX, t.offsetY));
|
|
87
87
|
},
|
|
88
|
-
start: (
|
|
89
|
-
if (o(),
|
|
90
|
-
const
|
|
91
|
-
t.startX = s.clientX, t.startY = s.clientY;
|
|
92
|
-
} else
|
|
88
|
+
start: (m) => {
|
|
89
|
+
if (o(), m.touches) {
|
|
90
|
+
const h = m.touches[0];
|
|
93
91
|
t.startX = h.clientX, t.startY = h.clientY;
|
|
92
|
+
} else
|
|
93
|
+
t.startX = m.clientX, t.startY = m.clientY;
|
|
94
94
|
t.startTime = Date.now();
|
|
95
95
|
},
|
|
96
96
|
reset: o,
|
|
@@ -130,11 +130,11 @@ const mt = (t) => {
|
|
|
130
130
|
detail: void 0
|
|
131
131
|
};
|
|
132
132
|
const o = document.createEvent("Events");
|
|
133
|
-
let i = !0,
|
|
134
|
-
for (let
|
|
135
|
-
|
|
136
|
-
o.initEvent(t, i,
|
|
137
|
-
},
|
|
133
|
+
let i = !0, f = !0;
|
|
134
|
+
for (let h in e)
|
|
135
|
+
h === "bubbles" ? i = !!e[h] : h === "cancelable" ? f = !!e[h] : o[h] = e[h];
|
|
136
|
+
o.initEvent(t, i, f), (n ?? document).dispatchEvent(o);
|
|
137
|
+
}, gt = 15, vt = 300, _t = 200;
|
|
138
138
|
function wt(t) {
|
|
139
139
|
t.stopPropagation();
|
|
140
140
|
}
|
|
@@ -157,62 +157,68 @@ function I(t) {
|
|
|
157
157
|
}
|
|
158
158
|
return e;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
function yt(t, e, n, o, i,
|
|
162
|
-
const
|
|
160
|
+
const Y = /* @__PURE__ */ new WeakMap();
|
|
161
|
+
function yt(t, e, n, o, i, f = 600, m = 60, h = null) {
|
|
162
|
+
const c = {
|
|
163
163
|
active: !0,
|
|
164
164
|
startDistance: 0,
|
|
165
165
|
scrollDistance: 0,
|
|
166
166
|
scrollTime: 0,
|
|
167
167
|
moving: !1,
|
|
168
|
+
dragging: !1,
|
|
168
169
|
transitionEndTrigger: null
|
|
169
|
-
},
|
|
170
|
-
let
|
|
171
|
-
if (
|
|
172
|
-
const
|
|
173
|
-
let
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
-
},
|
|
170
|
+
}, v = t.previousSibling, l = j(), T = (d, a, g, y) => {
|
|
171
|
+
let _ = a + c.startDistance;
|
|
172
|
+
if (g === "end") {
|
|
173
|
+
const r = mt(d);
|
|
174
|
+
let w = r.width * e;
|
|
175
|
+
_ < w ? _ = 0 : _ = r.width, c.transitionEndTrigger = () => {
|
|
176
|
+
c.moving = !1, i && d.classList.remove(i), setTimeout(() => {
|
|
177
|
+
v && z(v), _ == 0 ? z(d) : pt(rt, {}, d), c.moving = !1;
|
|
178
|
+
}, m);
|
|
179
|
+
}, v && C(v, 0, "", 0), _ > 0 && typeof o == "function" && o(), C(d, _, "end", y);
|
|
179
180
|
} else
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
s.moving = !0, d.move(g), !(d.isVertical() || I(t) === 0 && d.state.deltaX < 0) && (wt(g), v(t, d.state.deltaX, "", 0));
|
|
187
|
-
}, l = () => {
|
|
188
|
-
if (d.isVertical() || I(t) === 0 && d.state.deltaX < 0)
|
|
181
|
+
_ < 0 && (_ = 0), C(d, _, "", 0);
|
|
182
|
+
}, s = () => {
|
|
183
|
+
c.transitionEndTrigger && (c.transitionEndTrigger(), c.transitionEndTrigger = null);
|
|
184
|
+
}, p = (d) => {
|
|
185
|
+
if (l.start(d), c.draging = h ? h(t, l.state.startX, l.state.startY) : !0, !c.draging) {
|
|
186
|
+
l.reset();
|
|
189
187
|
return;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
}
|
|
189
|
+
c.scrollDistance = 0, c.moving && (c.scrollDistance = I(t)), i && t.classList.add(i), c.transitionEndTrigger = null, c.moving = !0;
|
|
190
|
+
}, u = (d) => {
|
|
191
|
+
!c.draging || (c.moving = !0, l.move(d), l.isVertical()) || I(t) === 0 && l.state.deltaX < 0 || (wt(d), T(t, l.state.deltaX, "", 0));
|
|
192
|
+
}, E = () => {
|
|
193
|
+
if (!c.draging || (c.draging = !1, l.isVertical()) || I(t) === 0 && l.state.deltaX < 0)
|
|
194
|
+
return;
|
|
195
|
+
const a = l.state.deltaX;
|
|
196
|
+
if (a === 0) {
|
|
197
|
+
i && t.classList.remove(i), c.moving = !1;
|
|
193
198
|
return;
|
|
194
199
|
}
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
|
|
200
|
+
const g = l.state.duration;
|
|
201
|
+
if (g < vt && Math.abs(a) > gt) {
|
|
202
|
+
const _ = Tt(a, g, n);
|
|
203
|
+
T(t, _, "end", f);
|
|
199
204
|
} else
|
|
200
|
-
|
|
205
|
+
T(t, a, "end", f);
|
|
201
206
|
};
|
|
202
|
-
t.addEventListener("transitionend",
|
|
203
|
-
state:
|
|
204
|
-
transitionend:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
t.addEventListener("transitionend", s), t.addEventListener("transitioncancel", s), t.addEventListener("touchstart", p), t.addEventListener("touchmove", u), t.addEventListener("touchend", E), t.addEventListener("touchcancel", E), Y.set(t, {
|
|
208
|
+
state: c,
|
|
209
|
+
transitionend: s,
|
|
210
|
+
transitioncancel: s,
|
|
211
|
+
touchstart: p,
|
|
212
|
+
touchmove: u,
|
|
213
|
+
touchend: E,
|
|
214
|
+
touchcancel: E
|
|
209
215
|
});
|
|
210
216
|
}
|
|
211
217
|
function Et(t) {
|
|
212
|
-
const e =
|
|
213
|
-
e && (
|
|
218
|
+
const e = Y.get(t);
|
|
219
|
+
e && (Y.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));
|
|
214
220
|
}
|
|
215
|
-
const
|
|
221
|
+
const bt = /* @__PURE__ */ A({
|
|
216
222
|
__name: "index",
|
|
217
223
|
props: {
|
|
218
224
|
dragRemove: { type: Boolean, default: !0 },
|
|
@@ -221,6 +227,7 @@ const Dt = /* @__PURE__ */ P({
|
|
|
221
227
|
momentumReduceRatio: { default: 1 },
|
|
222
228
|
resetDelay: { default: 120 },
|
|
223
229
|
swipeDuration: { default: 60 },
|
|
230
|
+
draggableArea: {},
|
|
224
231
|
routerViewName: {},
|
|
225
232
|
viewTag: { type: [Function, String], default: "div" },
|
|
226
233
|
transition: { type: [Function, Boolean], default: !0 },
|
|
@@ -229,95 +236,102 @@ const Dt = /* @__PURE__ */ P({
|
|
|
229
236
|
setup(t) {
|
|
230
237
|
const e = t;
|
|
231
238
|
let n = null, o = null;
|
|
232
|
-
function i(
|
|
233
|
-
return (
|
|
239
|
+
function i(s) {
|
|
240
|
+
return (s.params && s.params.animationType) ?? "slide";
|
|
234
241
|
}
|
|
235
|
-
function
|
|
236
|
-
return (
|
|
242
|
+
function f(s) {
|
|
243
|
+
return (s.params && s.params.dragRemove) ?? e.dragRemove;
|
|
237
244
|
}
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
245
|
+
const m = (s, p, u, E) => {
|
|
246
|
+
if (u.opsType === D.Append || p) {
|
|
247
|
+
const d = i(u), a = p ? "show" : "enter";
|
|
248
|
+
if (a === "show" && (d === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
|
|
242
249
|
return;
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
|
|
250
|
+
a === "enter" && (n = u, o = "enter");
|
|
251
|
+
const g = `fox-root-navigator__${d}-${a}-from`, y = `fox-root-navigator__${d}-${a}-active`;
|
|
252
|
+
s.classList.add(g), s.classList.add(y);
|
|
246
253
|
}
|
|
247
|
-
},
|
|
248
|
-
if (
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
254
|
+
}, h = (s, p, u, E) => {
|
|
255
|
+
if (u.opsType === D.Append || p) {
|
|
256
|
+
const d = i(u), a = p ? "show" : "enter";
|
|
257
|
+
if (a === "show" && (d === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
|
|
251
258
|
return;
|
|
252
|
-
const
|
|
253
|
-
|
|
259
|
+
const g = `fox-root-navigator__${d}-${a}-from`, y = `fox-root-navigator__${d}-${a}-to`;
|
|
260
|
+
s.classList.remove(g), s.classList.add(y);
|
|
254
261
|
}
|
|
255
|
-
},
|
|
256
|
-
if (
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
|
|
262
|
+
}, c = (s, p, u, E) => {
|
|
263
|
+
if (u.opsType === D.Append || p) {
|
|
264
|
+
const a = i(u), g = p ? "show" : "enter";
|
|
265
|
+
if (g === "enter" && (n = null, o = null), a !== "pop") {
|
|
266
|
+
const y = `fox-root-navigator__${a}-${g}-active`, _ = `fox-root-navigator__${a}-${g}-to`;
|
|
267
|
+
s.classList.remove(y), s.classList.remove(_);
|
|
261
268
|
}
|
|
262
269
|
}
|
|
263
|
-
u
|
|
264
|
-
a
|
|
265
|
-
e.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
270
|
+
if (f(u) === !0 && !p && u.opsType === D.Append) {
|
|
271
|
+
let a = null;
|
|
272
|
+
e.draggableArea && (a = function(g, y, _) {
|
|
273
|
+
const r = y - g.offsetLeft, w = _ - g.offsetTop;
|
|
274
|
+
return !(e.draggableArea?.left && r < e.draggableArea?.left || e.draggableArea?.right && r > e.draggableArea?.right || e.draggableArea?.top && w < e.draggableArea?.top || e.draggableArea?.bottom && w > e.draggableArea?.bottom);
|
|
275
|
+
}), yt(
|
|
276
|
+
s,
|
|
277
|
+
e.removeMoveRatio,
|
|
278
|
+
e.momentumReduceRatio,
|
|
279
|
+
e.removeViewPage,
|
|
280
|
+
"fox-root-navigator__item-moving",
|
|
281
|
+
e.swipeDuration,
|
|
282
|
+
e.resetDelay,
|
|
283
|
+
a
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
}, v = (s, p, u, E) => {
|
|
287
|
+
if (u.opsType === D.Append || p) {
|
|
288
|
+
const d = i(u), a = p ? "hide" : "leave";
|
|
289
|
+
if (a === "hide" && (d === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
|
|
276
290
|
return;
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
|
|
291
|
+
a === "leave" && (n = u, o = "leave");
|
|
292
|
+
const g = `fox-root-navigator__${d}-${a}-from`, y = `fox-root-navigator__${d}-${a}-active`;
|
|
293
|
+
s.classList.add(g), s.classList.add(y);
|
|
280
294
|
}
|
|
281
|
-
},
|
|
282
|
-
if (
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
295
|
+
}, l = (s, p, u, E) => {
|
|
296
|
+
if (u.opsType === D.Append || p) {
|
|
297
|
+
const d = i(u), a = p ? "hide" : "leave";
|
|
298
|
+
if (a === "hide" && (d === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
|
|
285
299
|
return;
|
|
286
|
-
const
|
|
287
|
-
|
|
300
|
+
const g = `fox-root-navigator__${d}-${a}-from`, y = `fox-root-navigator__${d}-${a}-to`;
|
|
301
|
+
s.classList.remove(g), s.classList.add(y);
|
|
288
302
|
}
|
|
289
|
-
}, T = (
|
|
290
|
-
if (
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
294
|
-
|
|
303
|
+
}, T = (s, p, u, E) => {
|
|
304
|
+
if (u.opsType === D.Append || p) {
|
|
305
|
+
const a = i(u), g = p ? "hide" : "leave";
|
|
306
|
+
if (g === "leave" && (n = null, o = null), a !== "pop") {
|
|
307
|
+
const y = `fox-root-navigator__${a}-${g}-active`, _ = `fox-root-navigator__${a}-${g}-to`;
|
|
308
|
+
s.classList.remove(y), s.classList.remove(_);
|
|
295
309
|
}
|
|
296
310
|
}
|
|
297
|
-
u
|
|
311
|
+
f(u) && !p && Et(s);
|
|
298
312
|
};
|
|
299
|
-
return (
|
|
300
|
-
const
|
|
301
|
-
return
|
|
313
|
+
return (s, p) => {
|
|
314
|
+
const u = X("fox-router-view");
|
|
315
|
+
return L(), R(u, {
|
|
302
316
|
class: "fox-root-navigator",
|
|
303
|
-
"view-class":
|
|
304
|
-
"before-enter":
|
|
305
|
-
enter:
|
|
306
|
-
"after-enter":
|
|
307
|
-
"before-leave":
|
|
308
|
-
leave:
|
|
317
|
+
"view-class": s.viewClass,
|
|
318
|
+
"before-enter": m,
|
|
319
|
+
enter: h,
|
|
320
|
+
"after-enter": c,
|
|
321
|
+
"before-leave": v,
|
|
322
|
+
leave: l,
|
|
309
323
|
"after-leave": T,
|
|
310
324
|
multi: !0,
|
|
311
|
-
name:
|
|
312
|
-
"view-tag":
|
|
313
|
-
transition:
|
|
325
|
+
name: s.routerViewName,
|
|
326
|
+
"view-tag": s.viewTag,
|
|
327
|
+
transition: s.transition
|
|
314
328
|
}, null, 8, ["view-class", "name", "view-tag", "transition"]);
|
|
315
329
|
};
|
|
316
330
|
}
|
|
317
|
-
}),
|
|
331
|
+
}), Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
318
332
|
__proto__: null,
|
|
319
|
-
default:
|
|
320
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
333
|
+
default: bt
|
|
334
|
+
}, Symbol.toStringTag, { value: "Module" })), Lt = { class: "fox-swiper-navigator" }, $t = /* @__PURE__ */ A({
|
|
321
335
|
__name: "swiper",
|
|
322
336
|
props: {
|
|
323
337
|
width: {},
|
|
@@ -326,14 +340,14 @@ const Dt = /* @__PURE__ */ P({
|
|
|
326
340
|
direction: {}
|
|
327
341
|
},
|
|
328
342
|
setup(t) {
|
|
329
|
-
const e = t, n =
|
|
343
|
+
const e = t, n = P(() => {
|
|
330
344
|
const o = {
|
|
331
345
|
transform: `translate3d(${e.scrollDistance}px, 0, 0)`,
|
|
332
346
|
width: `${e.width}`
|
|
333
347
|
};
|
|
334
348
|
return e.scrollDuration > 0 && (o["transition-duration"] = `${e.scrollDuration}ms`), o;
|
|
335
349
|
});
|
|
336
|
-
return (o, i) => (
|
|
350
|
+
return (o, i) => (L(), Z("div", Lt, [
|
|
337
351
|
tt("div", {
|
|
338
352
|
class: "fox-swiper-navigator__inner",
|
|
339
353
|
style: U(n.value)
|
|
@@ -347,14 +361,14 @@ let Mt = 0;
|
|
|
347
361
|
function Rt() {
|
|
348
362
|
return ++Mt;
|
|
349
363
|
}
|
|
350
|
-
const
|
|
351
|
-
function
|
|
364
|
+
const At = 15, Pt = 300, Xt = 200;
|
|
365
|
+
function Ot(t) {
|
|
352
366
|
t.stopPropagation();
|
|
353
367
|
}
|
|
354
|
-
function
|
|
368
|
+
function St(t, e, n = 1) {
|
|
355
369
|
return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
|
|
356
370
|
}
|
|
357
|
-
function N(t, e = 0, n, o =
|
|
371
|
+
function N(t, e = 0, n, o = Xt) {
|
|
358
372
|
n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
|
|
359
373
|
}
|
|
360
374
|
class Ct {
|
|
@@ -452,38 +466,38 @@ class Ct {
|
|
|
452
466
|
* @param momentumReduceRatio
|
|
453
467
|
*
|
|
454
468
|
*/
|
|
455
|
-
constructor(e, n, o, i,
|
|
456
|
-
this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = i, this.moveRatio =
|
|
469
|
+
constructor(e, n, o, i, f, m) {
|
|
470
|
+
this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = i, this.moveRatio = f, this.momentumReduceRatio = m;
|
|
457
471
|
}
|
|
458
472
|
/**
|
|
459
473
|
* 打开drag支持
|
|
460
474
|
*/
|
|
461
475
|
open() {
|
|
462
|
-
const e = this.el, n = j(), o = (i,
|
|
463
|
-
let
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
466
|
-
if (
|
|
476
|
+
const e = this.el, n = j(), o = (i, f, m, h) => {
|
|
477
|
+
let c = f + this.startDistance;
|
|
478
|
+
const v = this.columnWidth * this.moveRatio;
|
|
479
|
+
if (m === "end") {
|
|
480
|
+
if (f == 0) {
|
|
467
481
|
this.moving = !1;
|
|
468
482
|
return;
|
|
469
483
|
}
|
|
470
|
-
Math.abs(
|
|
471
|
-
let
|
|
472
|
-
|
|
473
|
-
const T = Math.floor(
|
|
474
|
-
this.isPageOpened(T) || this.openPage(T),
|
|
484
|
+
Math.abs(f) > v ? f > 0 ? c = this.startDistance + this.columnWidth : c = this.startDistance - this.columnWidth : c = this.startDistance;
|
|
485
|
+
let l = -c;
|
|
486
|
+
l < 0 ? l = 0 : l > this.width - this.columnWidth && (l = this.width - this.columnWidth);
|
|
487
|
+
const T = Math.floor(l / this.columnWidth);
|
|
488
|
+
this.isPageOpened(T) || this.openPage(T), c = -T * this.columnWidth, h && h > 0 && (this.transitionEndTrigger = () => {
|
|
475
489
|
this.moving = !1, this.pageOpened(T);
|
|
476
|
-
}), N(i,
|
|
490
|
+
}), N(i, c, "end", h), this.scrollDistance = c;
|
|
477
491
|
} else {
|
|
478
|
-
if (Math.abs(
|
|
492
|
+
if (Math.abs(f) > v) {
|
|
479
493
|
let T = 0;
|
|
480
|
-
if (
|
|
481
|
-
const
|
|
482
|
-
this.isPageOpened(
|
|
494
|
+
if (f > 0 ? T = Math.abs(this.startDistance + this.columnWidth) : T = Math.abs(this.startDistance - this.columnWidth), T >= 0 && T < this.width) {
|
|
495
|
+
const s = Math.floor(T / this.columnWidth);
|
|
496
|
+
this.isPageOpened(s) || this.openPage(s);
|
|
483
497
|
}
|
|
484
498
|
}
|
|
485
|
-
let
|
|
486
|
-
|
|
499
|
+
let l = -c;
|
|
500
|
+
l < this.min ? l = this.min : l > this.max && (l = this.max), N(i, -l, "", 0);
|
|
487
501
|
}
|
|
488
502
|
};
|
|
489
503
|
this.transitionend = () => {
|
|
@@ -491,17 +505,17 @@ class Ct {
|
|
|
491
505
|
}, this.touchstart = (i) => {
|
|
492
506
|
this.moving || (n.start(i), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
|
|
493
507
|
}, this.touchmove = (i) => {
|
|
494
|
-
n.move(i), !n.isVertical() && (
|
|
508
|
+
n.move(i), !n.isVertical() && (Ot(i), o(e, n.state.deltaX, "", 0));
|
|
495
509
|
}, this.touchend = () => {
|
|
496
510
|
if (n.isVertical())
|
|
497
511
|
return;
|
|
498
512
|
const i = n.state.deltaX;
|
|
499
513
|
if (i == 0)
|
|
500
514
|
return;
|
|
501
|
-
const
|
|
502
|
-
if (
|
|
503
|
-
const
|
|
504
|
-
o(e,
|
|
515
|
+
const f = n.state.duration;
|
|
516
|
+
if (f < Pt && Math.abs(i) > At) {
|
|
517
|
+
const h = St(i, f, this.momentumReduceRatio);
|
|
518
|
+
o(e, h, "end", this.swipeDuration);
|
|
505
519
|
} else
|
|
506
520
|
o(e, i, "end", this.swipeDuration);
|
|
507
521
|
}, 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);
|
|
@@ -514,17 +528,17 @@ class Ct {
|
|
|
514
528
|
this.transitionend && e.addEventListener("transitionend", this.transitionend), this.touchstart && e.addEventListener("touchstart", this.touchstart), this.touchmove && e.addEventListener("touchmove", this.touchmove), this.touchend && e.addEventListener("touchend", this.touchend), this.touchcancel && e.addEventListener("touchcancel", this.touchcancel), this.el = null;
|
|
515
529
|
}
|
|
516
530
|
}
|
|
517
|
-
function It(t, e, n, o, i,
|
|
518
|
-
return new Ct(t, e, n, o, i,
|
|
531
|
+
function It(t, e, n, o, i, f) {
|
|
532
|
+
return new Ct(t, e, n, o, i, f);
|
|
519
533
|
}
|
|
520
|
-
function
|
|
521
|
-
const e = F(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), i = parseFloat(n.getPropertyValue("padding-right")),
|
|
534
|
+
function Yt(t) {
|
|
535
|
+
const e = F(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), i = parseFloat(n.getPropertyValue("padding-right")), f = parseFloat(n.getPropertyValue("padding-top")), m = parseFloat(n.getPropertyValue("padding-bottom"));
|
|
522
536
|
return {
|
|
523
537
|
width: e.clientWidth - o - i,
|
|
524
|
-
height: e.clientHeight -
|
|
538
|
+
height: e.clientHeight - f - m
|
|
525
539
|
};
|
|
526
540
|
}
|
|
527
|
-
const
|
|
541
|
+
const Vt = /* @__PURE__ */ A({
|
|
528
542
|
__name: "index",
|
|
529
543
|
props: {
|
|
530
544
|
activePath: {},
|
|
@@ -551,42 +565,42 @@ const Yt = /* @__PURE__ */ P({
|
|
|
551
565
|
openedIndexList: [],
|
|
552
566
|
width: n.width,
|
|
553
567
|
height: n.height
|
|
554
|
-
}), i = e,
|
|
555
|
-
if (o.openedIndexList.indexOf(
|
|
556
|
-
o.openedIndexList.push(
|
|
557
|
-
const
|
|
568
|
+
}), i = e, f = () => o.scrollDistance, m = (r) => {
|
|
569
|
+
if (o.openedIndexList.indexOf(r) === -1) {
|
|
570
|
+
o.openedIndexList.push(r);
|
|
571
|
+
const w = n.routes[r];
|
|
558
572
|
try {
|
|
559
|
-
n.openViewPage(
|
|
560
|
-
} catch (
|
|
561
|
-
console.error(
|
|
573
|
+
n.openViewPage(w, r);
|
|
574
|
+
} catch (x) {
|
|
575
|
+
console.error(x);
|
|
562
576
|
}
|
|
563
577
|
}
|
|
564
|
-
},
|
|
565
|
-
o.index =
|
|
566
|
-
const
|
|
567
|
-
i("update:activePath",
|
|
578
|
+
}, h = (r) => o.openedIndexList.indexOf(r) !== -1, c = (r) => {
|
|
579
|
+
o.index = r, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
|
|
580
|
+
const w = n.routes[r];
|
|
581
|
+
i("update:activePath", w.path);
|
|
568
582
|
};
|
|
569
|
-
let
|
|
570
|
-
n.draggable && (
|
|
571
|
-
|
|
583
|
+
let v = null;
|
|
584
|
+
n.draggable && (v = It(
|
|
585
|
+
f,
|
|
586
|
+
m,
|
|
572
587
|
h,
|
|
573
|
-
|
|
574
|
-
x,
|
|
588
|
+
c,
|
|
575
589
|
n.moveRatio,
|
|
576
590
|
n.momentumReduceRatio
|
|
577
591
|
));
|
|
578
|
-
let
|
|
592
|
+
let l = null;
|
|
579
593
|
ot(() => {
|
|
580
|
-
const
|
|
581
|
-
const
|
|
582
|
-
T(n.activePath, n.routes,
|
|
594
|
+
const r = d(), w = () => {
|
|
595
|
+
const x = Yt(r);
|
|
596
|
+
T(n.activePath, n.routes, x.width, x.height, n.swipeDuration, n.direction);
|
|
583
597
|
};
|
|
584
|
-
if (window.ResizeObserver && (
|
|
585
|
-
const
|
|
586
|
-
|
|
598
|
+
if (window.ResizeObserver && (l = new window.ResizeObserver(w), l.observe(r)), w(), v) {
|
|
599
|
+
const x = g();
|
|
600
|
+
v.el = x, v.open();
|
|
587
601
|
}
|
|
588
602
|
}), it(() => {
|
|
589
|
-
|
|
603
|
+
l && (l.disconnect(), l = null), v && v.close();
|
|
590
604
|
}), st(
|
|
591
605
|
[
|
|
592
606
|
() => n.activePath,
|
|
@@ -596,75 +610,75 @@ const Yt = /* @__PURE__ */ P({
|
|
|
596
610
|
() => n.swipeDuration,
|
|
597
611
|
() => n.direction
|
|
598
612
|
],
|
|
599
|
-
([
|
|
600
|
-
const
|
|
601
|
-
T(
|
|
613
|
+
([r, w, x, $, M, O]) => {
|
|
614
|
+
const S = x <= 0 ? o.width : x, b = $ <= 0 ? o.height : $;
|
|
615
|
+
T(r, w, S, b, M, O);
|
|
602
616
|
}
|
|
603
617
|
);
|
|
604
|
-
const T = (
|
|
605
|
-
const
|
|
606
|
-
if (o.index =
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
609
|
-
o.width =
|
|
610
|
-
const q =
|
|
611
|
-
|
|
618
|
+
const T = (r, w, x, $, M, O = "horizontal") => {
|
|
619
|
+
const S = r;
|
|
620
|
+
if (o.index = w.findIndex((b) => b.path === S), O === "horizontal") {
|
|
621
|
+
const b = x;
|
|
622
|
+
if (b > 0) {
|
|
623
|
+
o.width = x;
|
|
624
|
+
const q = b * n.routes.length, H = -b / 3, G = b * (w.length - 1) + b / 3;
|
|
625
|
+
v && (v.columnWidth = b, v.width = q, v.min = H, v.max = G), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -b * o.index);
|
|
612
626
|
}
|
|
613
627
|
}
|
|
614
|
-
|
|
615
|
-
},
|
|
616
|
-
const
|
|
617
|
-
return n.customClass &&
|
|
618
|
-
}),
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
return
|
|
628
|
+
v && (v.swipeDuration = M);
|
|
629
|
+
}, s = `fox-swiper-navigator-${Rt()}`, p = P(() => {
|
|
630
|
+
const r = [s];
|
|
631
|
+
return n.customClass && r.push(n.customClass), r;
|
|
632
|
+
}), u = P(() => {
|
|
633
|
+
const r = {}, w = o.width > 0 ? o.width : n.width;
|
|
634
|
+
w > 0 && (r.width = `${w}px`);
|
|
635
|
+
const x = o.height > 0 ? o.height : n.height;
|
|
636
|
+
return x > 0 && (r.height = `${x}px`), n.customStyle && Object.assign(r, n.customStyle), r;
|
|
623
637
|
});
|
|
624
|
-
let
|
|
625
|
-
function
|
|
626
|
-
return
|
|
638
|
+
let E = null;
|
|
639
|
+
function d() {
|
|
640
|
+
return E || (E = document.querySelector(`.${s}`), E);
|
|
627
641
|
}
|
|
628
|
-
let
|
|
629
|
-
function
|
|
630
|
-
return
|
|
642
|
+
let a = null;
|
|
643
|
+
function g() {
|
|
644
|
+
return a || (a = document.querySelector(`.${s}>.fox-swiper-navigator__inner`), a);
|
|
631
645
|
}
|
|
632
|
-
const
|
|
633
|
-
const
|
|
634
|
-
const M =
|
|
646
|
+
const y = P(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), _ = (r, w) => {
|
|
647
|
+
const x = n.routes.findIndex(($) => {
|
|
648
|
+
const M = r.path ?? r.name ?? "";
|
|
635
649
|
return $.path == M;
|
|
636
650
|
});
|
|
637
651
|
return o.width <= 0 ? {} : {
|
|
638
652
|
style: {
|
|
639
|
-
left: `${
|
|
653
|
+
left: `${x * o.width}px`,
|
|
640
654
|
width: `${o.width}px`
|
|
641
655
|
}
|
|
642
656
|
};
|
|
643
657
|
};
|
|
644
|
-
return (
|
|
645
|
-
const
|
|
646
|
-
return
|
|
647
|
-
class: at(
|
|
648
|
-
style: U(
|
|
658
|
+
return (r, w) => {
|
|
659
|
+
const x = X("fox-router-view");
|
|
660
|
+
return L(), R(x, {
|
|
661
|
+
class: at(p.value),
|
|
662
|
+
style: U(u.value),
|
|
649
663
|
"view-class": "fox-swiper-navigator__item",
|
|
650
664
|
tag: $t,
|
|
651
|
-
"view-tag-props":
|
|
665
|
+
"view-tag-props": _,
|
|
652
666
|
multi: !0,
|
|
653
|
-
name:
|
|
654
|
-
transition:
|
|
667
|
+
name: r.routerViewName,
|
|
668
|
+
transition: r.transition,
|
|
655
669
|
"scroll-distance": o.scrollDistance,
|
|
656
|
-
"scroll-duration":
|
|
657
|
-
direction:
|
|
658
|
-
width:
|
|
670
|
+
"scroll-duration": r.scrollDuration,
|
|
671
|
+
direction: r.direction,
|
|
672
|
+
width: y.value
|
|
659
673
|
}, null, 8, ["class", "style", "name", "transition", "scroll-distance", "scroll-duration", "direction", "width"]);
|
|
660
674
|
};
|
|
661
675
|
}
|
|
662
676
|
}), Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
663
677
|
__proto__: null,
|
|
664
|
-
default:
|
|
678
|
+
default: Vt
|
|
665
679
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
666
680
|
let zt = "fox-";
|
|
667
|
-
const Nt = [], B = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": lt, "/src/components/default-navigator/index.vue":
|
|
681
|
+
const Nt = [], B = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": lt, "/src/components/default-navigator/index.vue": ut, "/src/components/root-navigator/index.vue": Dt, "/src/components/swiper-navigator/index.vue": Wt }), k = [];
|
|
668
682
|
for (const t in B) {
|
|
669
683
|
let e = /src\/components\/(.*)\/index.vue/.exec(t)[1];
|
|
670
684
|
Nt.indexOf(e) === -1 && k.push({
|