flemo 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/TaskManger.d.ts +10 -4
- package/dist/index.mjs +498 -456
- package/dist/screen/store.d.ts +4 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { d as
|
|
1
|
+
import { jsx as w, jsxs as et } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as G, createContext as X, useReducer as Pt, Children as nt, useContext as q, Suspense as Et, useImperativeHandle as St, useRef as I } from "react";
|
|
3
|
+
import { d as x, c as _ } from "./vendor-C8cPYUOQ.js";
|
|
4
4
|
import { animate as F } from "motion";
|
|
5
|
-
import { animate as
|
|
6
|
-
function
|
|
7
|
-
const a = Array.isArray(
|
|
8
|
-
return
|
|
5
|
+
import { animate as A, transform as st, useAnimate as at, motion as rt, useDragControls as wt } from "motion/react";
|
|
6
|
+
function yt(s, e, t) {
|
|
7
|
+
const a = Array.isArray(s) ? s.find((c) => x.pathToRegexp(c).regexp.test(e)) || "" : x.pathToRegexp(s).regexp.test(e) ? s : "", n = x.match(a)(e), i = new URLSearchParams(t), o = Object.fromEntries(i.entries());
|
|
8
|
+
return n ? { ...n.params, ...o } : {};
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function Z() {
|
|
11
11
|
return typeof document > "u";
|
|
12
12
|
}
|
|
13
|
-
class
|
|
13
|
+
class Lt {
|
|
14
14
|
tasks = /* @__PURE__ */ new Map();
|
|
15
15
|
instanceId = Date.now().toString();
|
|
16
16
|
isLocked = !1;
|
|
17
17
|
currentTaskId = null;
|
|
18
18
|
taskQueue = Promise.resolve();
|
|
19
19
|
signalListeners = /* @__PURE__ */ new Map();
|
|
20
|
-
|
|
20
|
+
pendingTaskQueue = [];
|
|
21
|
+
isProcessingPending = !1;
|
|
21
22
|
async acquireLock(e) {
|
|
22
|
-
for (let
|
|
23
|
+
for (let n = 0; n < 10; n++) {
|
|
23
24
|
if (!this.isLocked)
|
|
24
25
|
return this.isLocked = !0, this.currentTaskId = e, !0;
|
|
25
|
-
await new Promise((
|
|
26
|
+
await new Promise((i) => setTimeout(i, 100));
|
|
26
27
|
}
|
|
27
28
|
return !1;
|
|
28
29
|
}
|
|
@@ -38,76 +39,122 @@ class Et {
|
|
|
38
39
|
this.resolveTask(a);
|
|
39
40
|
}), this.signalListeners.delete(e));
|
|
40
41
|
}
|
|
42
|
+
// 대기 중인 태스크들을 처리하는 메서드
|
|
43
|
+
async processPendingTasks() {
|
|
44
|
+
if (!(this.isProcessingPending || this.pendingTaskQueue.length === 0)) {
|
|
45
|
+
this.isProcessingPending = !0;
|
|
46
|
+
try {
|
|
47
|
+
for (; this.pendingTaskQueue.length > 0; ) {
|
|
48
|
+
const e = this.pendingTaskQueue[0];
|
|
49
|
+
if (e.status === "COMPLETED" || e.status === "FAILED" || e.status === "ROLLEDBACK") {
|
|
50
|
+
this.pendingTaskQueue.shift();
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (e.status === "MANUAL_PENDING" || e.status === "SIGNAL_PENDING" || e.status === "PROCESSING" || e.status === "PENDING")
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
} finally {
|
|
57
|
+
this.isProcessingPending = !1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// 모든 대기 중인 태스크가 완료될 때까지 대기
|
|
62
|
+
async waitForPendingTasks() {
|
|
63
|
+
return new Promise((e) => {
|
|
64
|
+
const t = () => {
|
|
65
|
+
this.pendingTaskQueue.filter(
|
|
66
|
+
(n) => n.status === "MANUAL_PENDING" || n.status === "SIGNAL_PENDING"
|
|
67
|
+
).length === 0 ? e() : setTimeout(t, 100);
|
|
68
|
+
};
|
|
69
|
+
t();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// 태스크 상태 변경 시 대기 큐 처리
|
|
73
|
+
async onTaskStatusChange(e, t) {
|
|
74
|
+
(t === "COMPLETED" || t === "FAILED" || t === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((a) => a.id !== e), await this.processPendingTasks());
|
|
75
|
+
}
|
|
41
76
|
async addTask(e, t = {}) {
|
|
42
77
|
const a = t.id || this.generateTaskId();
|
|
43
|
-
return new Promise((
|
|
78
|
+
return new Promise((n, i) => {
|
|
44
79
|
this.taskQueue = this.taskQueue.then(async () => {
|
|
45
80
|
try {
|
|
46
|
-
const { control: o, validate:
|
|
81
|
+
const { control: o, validate: c, rollback: u, dependencies: l = [], delay: p } = t, f = new AbortController(), r = {
|
|
47
82
|
id: a,
|
|
48
83
|
execute: e,
|
|
49
84
|
timestamp: Date.now(),
|
|
50
85
|
retryCount: 0,
|
|
51
86
|
status: "PENDING",
|
|
52
|
-
dependencies:
|
|
87
|
+
dependencies: l,
|
|
53
88
|
instanceId: this.instanceId,
|
|
54
|
-
validate:
|
|
55
|
-
rollback:
|
|
56
|
-
control: o
|
|
89
|
+
validate: c,
|
|
90
|
+
rollback: u,
|
|
91
|
+
control: o,
|
|
92
|
+
abortController: f
|
|
57
93
|
};
|
|
58
|
-
this.tasks.set(
|
|
94
|
+
this.tasks.set(r.id, r), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(r), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((P) => P.id !== r.id));
|
|
59
95
|
try {
|
|
60
|
-
if (!await this.acquireLock(
|
|
61
|
-
throw
|
|
96
|
+
if (!await this.acquireLock(r.id))
|
|
97
|
+
throw r.status = "FAILED", new Error("FAILED");
|
|
62
98
|
try {
|
|
63
|
-
|
|
64
|
-
for (const
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
67
|
-
throw
|
|
99
|
+
r.status = "PROCESSING";
|
|
100
|
+
for (const h of r.dependencies) {
|
|
101
|
+
const m = this.tasks.get(h);
|
|
102
|
+
if (!m || m.status !== "COMPLETED")
|
|
103
|
+
throw r.status = "FAILED", new Error("FAILED");
|
|
104
|
+
}
|
|
105
|
+
if (r.validate && !await r.validate())
|
|
106
|
+
throw r.status = "FAILED", new Error("FAILED");
|
|
107
|
+
p && p > 0 && await new Promise((h) => setTimeout(h, p));
|
|
108
|
+
const E = await r.execute(r.abortController);
|
|
109
|
+
if (r.abortController.signal.aborted) {
|
|
110
|
+
r.status = "COMPLETED", await this.onTaskStatusChange(r.id, "COMPLETED"), n({
|
|
111
|
+
success: !0,
|
|
112
|
+
result: void 0,
|
|
113
|
+
taskId: r.id,
|
|
114
|
+
timestamp: Date.now(),
|
|
115
|
+
instanceId: this.instanceId
|
|
116
|
+
});
|
|
117
|
+
return;
|
|
68
118
|
}
|
|
69
|
-
if (u.validate && !await u.validate())
|
|
70
|
-
throw u.status = "FAILED", new Error("FAILED");
|
|
71
|
-
const d = await u.execute();
|
|
72
119
|
if (t.control) {
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
|
|
120
|
+
const h = t.control;
|
|
121
|
+
if (h.delay && h.delay > 0 && await new Promise((m) => setTimeout(m, h.delay)), h.manual) {
|
|
122
|
+
r.status = "MANUAL_PENDING", r.manualResolver = { resolve: n, reject: i, result: E }, this.pendingTaskQueue.push(r), await this.onTaskStatusChange(r.id, "MANUAL_PENDING");
|
|
76
123
|
return;
|
|
77
124
|
}
|
|
78
|
-
if (
|
|
79
|
-
|
|
125
|
+
if (h.signal) {
|
|
126
|
+
r.status = "SIGNAL_PENDING", r.manualResolver = { resolve: n, reject: i, result: E }, this.signalListeners.has(h.signal) || this.signalListeners.set(h.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(h.signal).add(r.id), this.pendingTaskQueue.push(r), await this.onTaskStatusChange(r.id, "SIGNAL_PENDING");
|
|
80
127
|
return;
|
|
81
128
|
}
|
|
82
|
-
if (
|
|
83
|
-
|
|
129
|
+
if (h.condition && !await h.condition()) {
|
|
130
|
+
r.status = "MANUAL_PENDING", r.manualResolver = { resolve: n, reject: i, result: E }, this.pendingTaskQueue.push(r), await this.onTaskStatusChange(r.id, "MANUAL_PENDING");
|
|
84
131
|
return;
|
|
85
132
|
}
|
|
86
133
|
}
|
|
87
|
-
|
|
134
|
+
r.status = "COMPLETED", await this.onTaskStatusChange(r.id, "COMPLETED"), n({
|
|
88
135
|
success: !0,
|
|
89
|
-
result:
|
|
90
|
-
taskId:
|
|
136
|
+
result: E,
|
|
137
|
+
taskId: r.id,
|
|
91
138
|
timestamp: Date.now(),
|
|
92
139
|
instanceId: this.instanceId
|
|
93
140
|
});
|
|
94
|
-
} catch (
|
|
95
|
-
if (
|
|
141
|
+
} catch (E) {
|
|
142
|
+
if (r.status = "FAILED", r.rollback)
|
|
96
143
|
try {
|
|
97
|
-
await
|
|
144
|
+
await r.rollback(), r.status = "ROLLEDBACK";
|
|
98
145
|
} catch {
|
|
99
146
|
}
|
|
100
|
-
throw
|
|
147
|
+
throw await this.onTaskStatusChange(r.id, r.status), E;
|
|
101
148
|
} finally {
|
|
102
|
-
this.releaseLock(
|
|
149
|
+
this.releaseLock(r.id);
|
|
103
150
|
}
|
|
104
|
-
} catch (
|
|
105
|
-
|
|
151
|
+
} catch (P) {
|
|
152
|
+
i(P);
|
|
106
153
|
}
|
|
107
154
|
} catch (o) {
|
|
108
|
-
|
|
155
|
+
i(o);
|
|
109
156
|
}
|
|
110
|
-
}).catch(
|
|
157
|
+
}).catch(i);
|
|
111
158
|
});
|
|
112
159
|
}
|
|
113
160
|
async resolveTask(e) {
|
|
@@ -125,117 +172,102 @@ class Et {
|
|
|
125
172
|
taskId: t.id,
|
|
126
173
|
timestamp: Date.now(),
|
|
127
174
|
instanceId: this.instanceId
|
|
128
|
-
}), delete t.manualResolver, !0;
|
|
175
|
+
}), delete t.manualResolver, await this.onTaskStatusChange(e, "COMPLETED"), !0;
|
|
129
176
|
}
|
|
130
177
|
return !1;
|
|
131
178
|
}
|
|
132
179
|
async resolveAllPending() {
|
|
133
180
|
const e = Array.from(this.tasks.values()).filter(
|
|
134
|
-
(t) => ["PENDING", "MANUAL_PENDING"].includes(t.status)
|
|
181
|
+
(t) => ["PENDING", "MANUAL_PENDING", "SIGNAL_PENDING"].includes(t.status)
|
|
135
182
|
);
|
|
136
183
|
await Promise.all(e.map((t) => this.resolveTask(t.id)));
|
|
137
184
|
}
|
|
138
|
-
getManualPendingTasks() {
|
|
139
|
-
return Array.from(this.tasks.values()).filter((e) => e.status === "MANUAL_PENDING");
|
|
140
|
-
}
|
|
141
185
|
}
|
|
142
|
-
const
|
|
186
|
+
const N = new Lt(), R = _((s) => ({
|
|
143
187
|
index: -1,
|
|
144
188
|
histories: [],
|
|
145
|
-
addHistory: (e) =>
|
|
189
|
+
addHistory: (e) => s((t) => ({
|
|
146
190
|
index: t.index + 1,
|
|
147
191
|
histories: t.histories.concat(e)
|
|
148
192
|
})),
|
|
149
|
-
replaceHistory: (e) =>
|
|
193
|
+
replaceHistory: (e) => s((t) => (t.histories.splice(e, 1), {
|
|
150
194
|
index: t.index - 1,
|
|
151
195
|
histories: t.histories
|
|
152
196
|
})),
|
|
153
|
-
popHistory: (e) =>
|
|
197
|
+
popHistory: (e) => s((t) => ({
|
|
154
198
|
index: t.index - 1,
|
|
155
|
-
histories: t.histories.filter((a,
|
|
199
|
+
histories: t.histories.filter((a, n) => n !== e)
|
|
156
200
|
}))
|
|
157
|
-
})),
|
|
201
|
+
})), T = _((s) => ({
|
|
158
202
|
status: "IDLE",
|
|
159
|
-
setStatus: (e) =>
|
|
203
|
+
setStatus: (e) => s({ status: e })
|
|
160
204
|
}));
|
|
161
|
-
function
|
|
162
|
-
return
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
r
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
id: o,
|
|
172
|
-
control: {
|
|
173
|
-
manual: !0
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
))?.result?.() : d ? (await m.addTask(
|
|
177
|
-
async () => (s("PUSHING"), a({
|
|
178
|
-
id: o,
|
|
179
|
-
pathname: window.location.pathname,
|
|
180
|
-
params: p,
|
|
181
|
-
transitionName: u
|
|
182
|
-
}), async () => {
|
|
183
|
-
m.getManualPendingTasks().length || s("COMPLETED");
|
|
184
|
-
}),
|
|
185
|
-
{
|
|
186
|
-
id: o,
|
|
187
|
-
control: {
|
|
188
|
-
manual: !0
|
|
205
|
+
function Tt() {
|
|
206
|
+
return G(() => {
|
|
207
|
+
const s = async (e) => {
|
|
208
|
+
const t = e.state?.id;
|
|
209
|
+
(await N.addTask(
|
|
210
|
+
async (a) => {
|
|
211
|
+
const n = e.state?.index, i = e.state?.status, o = e.state?.params, c = e.state?.transitionName, u = T.getState().setStatus, { index: l, addHistory: p, popHistory: f } = R.getState(), r = n < l, g = i === "PUSHING" && n > l, P = i === "REPLACING" && n > l, E = window.location.pathname;
|
|
212
|
+
if (!r && !g && !P) {
|
|
213
|
+
a.abort();
|
|
214
|
+
return;
|
|
189
215
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
216
|
+
return r ? u("POPPING") : g ? (u("PUSHING"), p({
|
|
217
|
+
id: t,
|
|
218
|
+
pathname: E,
|
|
219
|
+
params: o,
|
|
220
|
+
transitionName: c
|
|
221
|
+
})) : P && (u("REPLACING"), p({
|
|
222
|
+
id: t,
|
|
223
|
+
pathname: E,
|
|
224
|
+
params: o,
|
|
225
|
+
transitionName: c
|
|
226
|
+
})), async () => {
|
|
227
|
+
r && f(n + 1), u("COMPLETED");
|
|
228
|
+
};
|
|
229
|
+
},
|
|
200
230
|
{
|
|
201
|
-
id:
|
|
231
|
+
id: t,
|
|
202
232
|
control: {
|
|
203
233
|
manual: !0
|
|
204
234
|
}
|
|
205
235
|
}
|
|
206
|
-
))
|
|
236
|
+
)).result?.();
|
|
207
237
|
};
|
|
208
|
-
return window.addEventListener("popstate",
|
|
209
|
-
window.removeEventListener("popstate",
|
|
238
|
+
return window.addEventListener("popstate", s), () => {
|
|
239
|
+
window.removeEventListener("popstate", s);
|
|
210
240
|
};
|
|
211
241
|
}, []), null;
|
|
212
242
|
}
|
|
213
|
-
const
|
|
243
|
+
const it = X({}), ot = X(() => {
|
|
214
244
|
});
|
|
215
|
-
function
|
|
245
|
+
function Dt(s, e) {
|
|
216
246
|
switch (e.type) {
|
|
217
247
|
case "SET":
|
|
218
248
|
return e.params;
|
|
219
249
|
default:
|
|
220
|
-
return
|
|
250
|
+
return s;
|
|
221
251
|
}
|
|
222
252
|
}
|
|
223
|
-
function
|
|
224
|
-
children:
|
|
253
|
+
function It({
|
|
254
|
+
children: s,
|
|
225
255
|
active: e,
|
|
226
256
|
params: t
|
|
227
257
|
}) {
|
|
228
|
-
const [a,
|
|
229
|
-
return
|
|
230
|
-
const
|
|
231
|
-
o.state?.step &&
|
|
258
|
+
const [a, n] = Pt(Dt, t);
|
|
259
|
+
return G(() => {
|
|
260
|
+
const i = async (o) => {
|
|
261
|
+
o.state?.step && await N.addTask(async () => {
|
|
262
|
+
n({ type: "SET", params: o.state?.params || {} });
|
|
263
|
+
});
|
|
232
264
|
};
|
|
233
|
-
return e && window.addEventListener("popstate",
|
|
234
|
-
window.removeEventListener("popstate",
|
|
265
|
+
return e && window.addEventListener("popstate", i), () => {
|
|
266
|
+
window.removeEventListener("popstate", i);
|
|
235
267
|
};
|
|
236
|
-
}, [e,
|
|
268
|
+
}, [e, n]), /* @__PURE__ */ w(ot.Provider, { value: n, children: /* @__PURE__ */ w(it.Provider, { value: a, children: s }) });
|
|
237
269
|
}
|
|
238
|
-
const
|
|
270
|
+
const ct = X({
|
|
239
271
|
id: "",
|
|
240
272
|
isActive: !1,
|
|
241
273
|
isRoot: !0,
|
|
@@ -246,42 +278,42 @@ const it = X({
|
|
|
246
278
|
transitionName: "none",
|
|
247
279
|
prevTransitionName: "none"
|
|
248
280
|
});
|
|
249
|
-
function
|
|
250
|
-
const e =
|
|
281
|
+
function Nt({ children: s }) {
|
|
282
|
+
const e = R((a) => a.index), t = R((a) => a.histories);
|
|
251
283
|
return t.map(
|
|
252
|
-
(a) =>
|
|
253
|
-
(
|
|
284
|
+
(a) => nt.toArray(s).filter(
|
|
285
|
+
(n) => x.pathToRegexp(n.props.path).regexp.test(
|
|
254
286
|
a.pathname
|
|
255
287
|
)
|
|
256
288
|
)
|
|
257
|
-
).map(([a],
|
|
258
|
-
|
|
289
|
+
).map(([a], n) => /* @__PURE__ */ w(
|
|
290
|
+
ct.Provider,
|
|
259
291
|
{
|
|
260
292
|
value: {
|
|
261
|
-
id: t[
|
|
262
|
-
isActive:
|
|
263
|
-
isRoot:
|
|
264
|
-
isPrev:
|
|
265
|
-
zIndex:
|
|
266
|
-
pathname: t[
|
|
267
|
-
params: t[
|
|
293
|
+
id: t[n].id,
|
|
294
|
+
isActive: n === e,
|
|
295
|
+
isRoot: n === 0,
|
|
296
|
+
isPrev: n < e - 1,
|
|
297
|
+
zIndex: n,
|
|
298
|
+
pathname: t[n].pathname,
|
|
299
|
+
params: t[n].params,
|
|
268
300
|
transitionName: t[e].transitionName,
|
|
269
301
|
prevTransitionName: t[e - 1]?.transitionName
|
|
270
302
|
},
|
|
271
|
-
children: /* @__PURE__ */
|
|
303
|
+
children: /* @__PURE__ */ w(It, { active: n === e, params: t[n].params, children: a })
|
|
272
304
|
},
|
|
273
|
-
t[
|
|
305
|
+
t[n].id
|
|
274
306
|
));
|
|
275
307
|
}
|
|
276
|
-
function
|
|
277
|
-
name:
|
|
308
|
+
function kt({
|
|
309
|
+
name: s,
|
|
278
310
|
initial: e,
|
|
279
311
|
enter: t,
|
|
280
312
|
exit: a,
|
|
281
|
-
options:
|
|
313
|
+
options: n
|
|
282
314
|
}) {
|
|
283
315
|
return {
|
|
284
|
-
name:
|
|
316
|
+
name: s,
|
|
285
317
|
initial: e,
|
|
286
318
|
variants: {
|
|
287
319
|
"IDLE-true": t,
|
|
@@ -295,10 +327,10 @@ function Nt({
|
|
|
295
327
|
"COMPLETED-false": a,
|
|
296
328
|
"COMPLETED-true": t
|
|
297
329
|
},
|
|
298
|
-
...
|
|
330
|
+
...n
|
|
299
331
|
};
|
|
300
332
|
}
|
|
301
|
-
const
|
|
333
|
+
const vt = kt({
|
|
302
334
|
name: "overlay",
|
|
303
335
|
initial: {
|
|
304
336
|
opacity: 0,
|
|
@@ -326,16 +358,16 @@ const kt = Nt({
|
|
|
326
358
|
}
|
|
327
359
|
},
|
|
328
360
|
options: {
|
|
329
|
-
onSwipeStart: (
|
|
361
|
+
onSwipeStart: (s, { prevDecorator: e }) => F(
|
|
330
362
|
e,
|
|
331
363
|
{
|
|
332
|
-
opacity:
|
|
364
|
+
opacity: s ? 1 : 0
|
|
333
365
|
},
|
|
334
366
|
{
|
|
335
367
|
duration: 0.3
|
|
336
368
|
}
|
|
337
369
|
),
|
|
338
|
-
onSwipe: (
|
|
370
|
+
onSwipe: (s, e, { prevDecorator: t }) => F(
|
|
339
371
|
t,
|
|
340
372
|
{
|
|
341
373
|
opacity: Math.max(0, 1 - e / 100)
|
|
@@ -344,49 +376,49 @@ const kt = Nt({
|
|
|
344
376
|
duration: 0
|
|
345
377
|
}
|
|
346
378
|
),
|
|
347
|
-
onSwipeEnd: (
|
|
379
|
+
onSwipeEnd: (s, { prevDecorator: e }) => F(
|
|
348
380
|
e,
|
|
349
381
|
{
|
|
350
|
-
opacity:
|
|
382
|
+
opacity: s ? 0 : 1
|
|
351
383
|
},
|
|
352
384
|
{
|
|
353
385
|
duration: 0.3
|
|
354
386
|
}
|
|
355
387
|
)
|
|
356
388
|
}
|
|
357
|
-
}),
|
|
389
|
+
}), K = /* @__PURE__ */ new Map([["overlay", vt]]), B = _((s) => ({
|
|
358
390
|
defaultTransitionName: "cupertino",
|
|
359
|
-
setDefaultTransitionName: (e) =>
|
|
391
|
+
setDefaultTransitionName: (e) => s({ defaultTransitionName: e })
|
|
360
392
|
}));
|
|
361
|
-
function
|
|
362
|
-
name:
|
|
393
|
+
function j({
|
|
394
|
+
name: s,
|
|
363
395
|
initial: e,
|
|
364
396
|
idle: t,
|
|
365
397
|
enter: a,
|
|
366
|
-
enterBack:
|
|
367
|
-
exit:
|
|
398
|
+
enterBack: n,
|
|
399
|
+
exit: i,
|
|
368
400
|
exitBack: o,
|
|
369
|
-
options:
|
|
401
|
+
options: c
|
|
370
402
|
}) {
|
|
371
403
|
return {
|
|
372
|
-
name:
|
|
404
|
+
name: s,
|
|
373
405
|
initial: e,
|
|
374
406
|
variants: {
|
|
375
407
|
"IDLE-true": t,
|
|
376
408
|
"IDLE-false": t,
|
|
377
|
-
"PUSHING-false":
|
|
409
|
+
"PUSHING-false": i,
|
|
378
410
|
"PUSHING-true": a,
|
|
379
|
-
"REPLACING-false":
|
|
411
|
+
"REPLACING-false": i,
|
|
380
412
|
"REPLACING-true": a,
|
|
381
413
|
"POPPING-false": o,
|
|
382
|
-
"POPPING-true":
|
|
383
|
-
"COMPLETED-false":
|
|
414
|
+
"POPPING-true": n,
|
|
415
|
+
"COMPLETED-false": i,
|
|
384
416
|
"COMPLETED-true": a
|
|
385
417
|
},
|
|
386
|
-
...
|
|
418
|
+
...c
|
|
387
419
|
};
|
|
388
420
|
}
|
|
389
|
-
const
|
|
421
|
+
const Mt = j({
|
|
390
422
|
name: "cupertino",
|
|
391
423
|
initial: {
|
|
392
424
|
x: "100%",
|
|
@@ -442,9 +474,9 @@ const It = K({
|
|
|
442
474
|
decoratorName: "overlay",
|
|
443
475
|
swipeDirection: "x",
|
|
444
476
|
onSwipeStart: async () => !0,
|
|
445
|
-
onSwipe: (
|
|
446
|
-
const { offset:
|
|
447
|
-
return
|
|
477
|
+
onSwipe: (s, e, { currentScreen: t, prevScreen: a, onProgress: n }) => {
|
|
478
|
+
const { offset: i } = e, o = i.x, c = st(o, [0, window.innerWidth], [0, 100]);
|
|
479
|
+
return n?.(!0, c), A(
|
|
448
480
|
t,
|
|
449
481
|
{
|
|
450
482
|
x: Math.max(0, o)
|
|
@@ -452,43 +484,43 @@ const It = K({
|
|
|
452
484
|
{
|
|
453
485
|
duration: 0
|
|
454
486
|
}
|
|
455
|
-
),
|
|
487
|
+
), A(
|
|
456
488
|
a,
|
|
457
489
|
{
|
|
458
|
-
x: -100 +
|
|
490
|
+
x: -100 + c
|
|
459
491
|
},
|
|
460
492
|
{
|
|
461
493
|
duration: 0
|
|
462
494
|
}
|
|
463
|
-
),
|
|
495
|
+
), c;
|
|
464
496
|
},
|
|
465
|
-
onSwipeEnd: async (
|
|
466
|
-
const { offset:
|
|
467
|
-
return
|
|
468
|
-
|
|
497
|
+
onSwipeEnd: async (s, e, { currentScreen: t, prevScreen: a, onStart: n }) => {
|
|
498
|
+
const { offset: i, velocity: o } = e, u = i.x > 50 || o.x > 20;
|
|
499
|
+
return n?.(u), await Promise.all([
|
|
500
|
+
A(
|
|
469
501
|
t,
|
|
470
502
|
{
|
|
471
|
-
x:
|
|
503
|
+
x: u ? "100%" : 0
|
|
472
504
|
},
|
|
473
505
|
{
|
|
474
506
|
duration: 0.3,
|
|
475
507
|
ease: [0.32, 0.72, 0, 1]
|
|
476
508
|
}
|
|
477
509
|
),
|
|
478
|
-
|
|
510
|
+
A(
|
|
479
511
|
a,
|
|
480
512
|
{
|
|
481
|
-
x:
|
|
513
|
+
x: u ? 0 : -100
|
|
482
514
|
},
|
|
483
515
|
{
|
|
484
516
|
duration: 0.3,
|
|
485
517
|
ease: [0.32, 0.72, 0, 1]
|
|
486
518
|
}
|
|
487
519
|
)
|
|
488
|
-
]),
|
|
520
|
+
]), u;
|
|
489
521
|
}
|
|
490
522
|
}
|
|
491
|
-
}),
|
|
523
|
+
}), Ct = j({
|
|
492
524
|
name: "material",
|
|
493
525
|
initial: {
|
|
494
526
|
y: "100%",
|
|
@@ -549,55 +581,55 @@ const It = K({
|
|
|
549
581
|
options: {
|
|
550
582
|
swipeDirection: "y",
|
|
551
583
|
onSwipeStart: async () => !0,
|
|
552
|
-
onSwipe: (
|
|
553
|
-
const { offset:
|
|
554
|
-
return
|
|
584
|
+
onSwipe: (s, e, { currentScreen: t, prevScreen: a, onProgress: n }) => {
|
|
585
|
+
const { offset: i } = e, o = i.y, c = Math.max(0, Math.min(56, o)), u = st(c, [0, 56], [1, 0.96]), l = Math.max(0, o - 56), p = Math.min(1, l / 160), f = Math.sqrt(p) * 12, r = Math.max(0, c + f), g = Math.min(56, r);
|
|
586
|
+
return n?.(!0, g), A(
|
|
555
587
|
t,
|
|
556
588
|
{
|
|
557
|
-
y:
|
|
558
|
-
opacity:
|
|
589
|
+
y: r,
|
|
590
|
+
opacity: u
|
|
559
591
|
},
|
|
560
592
|
{
|
|
561
593
|
duration: 0
|
|
562
594
|
}
|
|
563
|
-
),
|
|
595
|
+
), A(
|
|
564
596
|
a,
|
|
565
597
|
{
|
|
566
|
-
y: -56 +
|
|
567
|
-
opacity:
|
|
598
|
+
y: -56 + g,
|
|
599
|
+
opacity: g / 56
|
|
568
600
|
},
|
|
569
601
|
{ duration: 0 }
|
|
570
|
-
),
|
|
602
|
+
), g;
|
|
571
603
|
},
|
|
572
|
-
onSwipeEnd: async (
|
|
573
|
-
const { offset:
|
|
574
|
-
return
|
|
575
|
-
|
|
604
|
+
onSwipeEnd: async (s, e, { currentScreen: t, prevScreen: a, onStart: n }) => {
|
|
605
|
+
const { offset: i, velocity: o } = e, u = i.y > 56 || o.y > 20;
|
|
606
|
+
return n?.(u), await Promise.all([
|
|
607
|
+
A(
|
|
576
608
|
t,
|
|
577
609
|
{
|
|
578
|
-
y:
|
|
579
|
-
opacity:
|
|
610
|
+
y: u ? "100%" : 0,
|
|
611
|
+
opacity: u ? 0.96 : 1
|
|
580
612
|
},
|
|
581
613
|
{
|
|
582
|
-
duration:
|
|
583
|
-
ease:
|
|
614
|
+
duration: u ? 0.22 : 0.24,
|
|
615
|
+
ease: u ? [0.4, 0, 1, 1] : [0, 0, 0.2, 1]
|
|
584
616
|
}
|
|
585
617
|
),
|
|
586
|
-
|
|
618
|
+
A(
|
|
587
619
|
a,
|
|
588
620
|
{
|
|
589
|
-
y:
|
|
590
|
-
opacity:
|
|
621
|
+
y: u ? 0 : -56,
|
|
622
|
+
opacity: u ? 1 : 0.96
|
|
591
623
|
},
|
|
592
624
|
{
|
|
593
|
-
duration:
|
|
594
|
-
ease:
|
|
625
|
+
duration: u ? 0.22 : 0.24,
|
|
626
|
+
ease: u ? [0, 0, 0.2, 1] : [0.4, 0, 1, 1]
|
|
595
627
|
}
|
|
596
628
|
)
|
|
597
|
-
]),
|
|
629
|
+
]), u;
|
|
598
630
|
}
|
|
599
631
|
}
|
|
600
|
-
}), xt =
|
|
632
|
+
}), xt = j({
|
|
601
633
|
name: "none",
|
|
602
634
|
initial: {
|
|
603
635
|
transition: {
|
|
@@ -634,48 +666,48 @@ const It = K({
|
|
|
634
666
|
duration: 0
|
|
635
667
|
}
|
|
636
668
|
}
|
|
637
|
-
}),
|
|
669
|
+
}), Q = /* @__PURE__ */ new Map([
|
|
638
670
|
["none", xt],
|
|
639
|
-
["cupertino",
|
|
640
|
-
["material",
|
|
641
|
-
]),
|
|
642
|
-
const
|
|
643
|
-
for (const t of
|
|
671
|
+
["cupertino", Mt],
|
|
672
|
+
["material", Ct]
|
|
673
|
+
]), At = (() => {
|
|
674
|
+
const s = /* @__PURE__ */ Object.create(null), e = Object.prototype.hasOwnProperty;
|
|
675
|
+
for (const t of Q.values()) {
|
|
644
676
|
const a = t.variants["IDLE-true"].value;
|
|
645
|
-
for (const
|
|
646
|
-
e.call(a,
|
|
677
|
+
for (const n in a)
|
|
678
|
+
e.call(a, n) && (s[n] = a[n]);
|
|
647
679
|
}
|
|
648
|
-
return
|
|
680
|
+
return s;
|
|
649
681
|
})();
|
|
650
682
|
function Yt({
|
|
651
|
-
children:
|
|
683
|
+
children: s,
|
|
652
684
|
initPath: e = "/",
|
|
653
685
|
defaultTransitionName: t = "cupertino",
|
|
654
686
|
transitions: a = [],
|
|
655
|
-
decorators:
|
|
687
|
+
decorators: n = []
|
|
656
688
|
}) {
|
|
657
|
-
const
|
|
658
|
-
return
|
|
689
|
+
const i = Z() ? e || "/" : window.location.pathname, o = Z() ? i.split("?")[1] || "" : window.location.search;
|
|
690
|
+
return B.setState({
|
|
659
691
|
defaultTransitionName: t
|
|
660
|
-
}),
|
|
692
|
+
}), R.setState({
|
|
661
693
|
index: 0,
|
|
662
694
|
histories: [
|
|
663
695
|
{
|
|
664
696
|
id: "root",
|
|
665
|
-
pathname:
|
|
666
|
-
params:
|
|
667
|
-
|
|
668
|
-
|
|
697
|
+
pathname: i,
|
|
698
|
+
params: yt(
|
|
699
|
+
nt.toArray(s).map((c) => c.props.path).flat(),
|
|
700
|
+
i,
|
|
669
701
|
o
|
|
670
702
|
),
|
|
671
703
|
transitionName: t
|
|
672
704
|
}
|
|
673
705
|
]
|
|
674
|
-
}),
|
|
675
|
-
a.forEach((
|
|
676
|
-
}, [a]),
|
|
677
|
-
|
|
678
|
-
}, [
|
|
706
|
+
}), G(() => {
|
|
707
|
+
a.forEach((c) => Q.set(c.name, c));
|
|
708
|
+
}, [a]), G(() => {
|
|
709
|
+
n.forEach((c) => K.set(c.name, c));
|
|
710
|
+
}, [n]), /* @__PURE__ */ et(
|
|
679
711
|
"div",
|
|
680
712
|
{
|
|
681
713
|
style: {
|
|
@@ -686,95 +718,97 @@ function Yt({
|
|
|
686
718
|
height: "100%"
|
|
687
719
|
},
|
|
688
720
|
children: [
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */
|
|
721
|
+
/* @__PURE__ */ w(Tt, {}),
|
|
722
|
+
/* @__PURE__ */ w(Nt, { children: s })
|
|
691
723
|
]
|
|
692
724
|
}
|
|
693
725
|
);
|
|
694
726
|
}
|
|
695
|
-
function Xt({ element:
|
|
696
|
-
return
|
|
727
|
+
function Xt({ element: s }) {
|
|
728
|
+
return s;
|
|
697
729
|
}
|
|
698
730
|
function qt() {
|
|
699
731
|
return {
|
|
700
|
-
push: async (a,
|
|
701
|
-
|
|
732
|
+
push: async (a, n, i = {}) => {
|
|
733
|
+
const { status: o, setStatus: c } = T.getState();
|
|
734
|
+
if (o !== "COMPLETED" && o !== "IDLE")
|
|
702
735
|
return;
|
|
703
|
-
const { index:
|
|
704
|
-
(await
|
|
736
|
+
const { index: u, addHistory: l } = R.getState(), p = B.getState().defaultTransitionName, { transitionName: f = p } = i, r = N.generateTaskId();
|
|
737
|
+
(await N.addTask(
|
|
705
738
|
async () => {
|
|
706
739
|
c("PUSHING");
|
|
707
|
-
const
|
|
708
|
-
Object.entries(
|
|
709
|
-
),
|
|
740
|
+
const g = x.compile(a)(n), P = x.parse(a).tokens.filter((D) => D.type === "param").map((D) => D.name), E = Object.fromEntries(
|
|
741
|
+
Object.entries(n).filter(([D]) => !P.includes(D))
|
|
742
|
+
), h = new URLSearchParams(E).toString(), m = `${g}${h ? `?${h}` : ""}`;
|
|
710
743
|
return window.history.state?.id || window.history.replaceState(
|
|
711
744
|
{
|
|
712
745
|
id: "root",
|
|
713
746
|
index: 0,
|
|
714
747
|
status: "IDLE",
|
|
715
748
|
params: {},
|
|
716
|
-
transitionName:
|
|
749
|
+
transitionName: f
|
|
717
750
|
},
|
|
718
751
|
"",
|
|
719
752
|
window.location.pathname
|
|
720
753
|
), window.history.pushState(
|
|
721
754
|
{
|
|
722
|
-
id:
|
|
723
|
-
index:
|
|
755
|
+
id: r,
|
|
756
|
+
index: u + 1,
|
|
724
757
|
status: "PUSHING",
|
|
725
|
-
params:
|
|
726
|
-
transitionName:
|
|
758
|
+
params: n,
|
|
759
|
+
transitionName: f
|
|
727
760
|
},
|
|
728
761
|
"",
|
|
729
|
-
|
|
730
|
-
),
|
|
731
|
-
id:
|
|
732
|
-
pathname:
|
|
733
|
-
params:
|
|
734
|
-
transitionName:
|
|
762
|
+
m
|
|
763
|
+
), l({
|
|
764
|
+
id: r,
|
|
765
|
+
pathname: g,
|
|
766
|
+
params: n,
|
|
767
|
+
transitionName: f
|
|
735
768
|
}), () => {
|
|
736
|
-
|
|
769
|
+
c("COMPLETED");
|
|
737
770
|
};
|
|
738
771
|
},
|
|
739
772
|
{
|
|
740
|
-
id:
|
|
773
|
+
id: r,
|
|
741
774
|
control: {
|
|
742
775
|
manual: !0
|
|
743
776
|
}
|
|
744
777
|
}
|
|
745
778
|
)).result?.();
|
|
746
779
|
},
|
|
747
|
-
replace: async (a,
|
|
748
|
-
|
|
780
|
+
replace: async (a, n, i = {}) => {
|
|
781
|
+
const { status: o, setStatus: c } = T.getState();
|
|
782
|
+
if (o !== "COMPLETED" && o !== "IDLE")
|
|
749
783
|
return;
|
|
750
|
-
const { index:
|
|
751
|
-
(await
|
|
784
|
+
const { index: u, addHistory: l } = R.getState(), p = R.getState().replaceHistory, f = B.getState().defaultTransitionName, { transitionName: r = f } = i, g = N.generateTaskId();
|
|
785
|
+
(await N.addTask(
|
|
752
786
|
async () => {
|
|
753
|
-
|
|
754
|
-
const
|
|
755
|
-
Object.entries(
|
|
756
|
-
),
|
|
787
|
+
c("REPLACING");
|
|
788
|
+
const P = x.compile(a)(n), E = x.parse(a).tokens.filter((L) => L.type === "param").map((L) => L.name), h = Object.fromEntries(
|
|
789
|
+
Object.entries(n).filter(([L]) => !E.includes(L))
|
|
790
|
+
), m = new URLSearchParams(h).toString(), D = `${P}${m ? `?${m}` : ""}`;
|
|
757
791
|
return window.history.replaceState(
|
|
758
792
|
{
|
|
759
|
-
id:
|
|
760
|
-
index:
|
|
793
|
+
id: g,
|
|
794
|
+
index: u,
|
|
761
795
|
status: "REPLACING",
|
|
762
|
-
params:
|
|
763
|
-
transitionName:
|
|
796
|
+
params: n,
|
|
797
|
+
transitionName: r
|
|
764
798
|
},
|
|
765
799
|
"",
|
|
766
|
-
|
|
767
|
-
),
|
|
768
|
-
id:
|
|
769
|
-
pathname:
|
|
770
|
-
params:
|
|
771
|
-
transitionName:
|
|
800
|
+
D
|
|
801
|
+
), l({
|
|
802
|
+
id: g,
|
|
803
|
+
pathname: P,
|
|
804
|
+
params: n,
|
|
805
|
+
transitionName: r
|
|
772
806
|
}), async () => {
|
|
773
|
-
|
|
807
|
+
p(u), c("COMPLETED");
|
|
774
808
|
};
|
|
775
809
|
},
|
|
776
810
|
{
|
|
777
|
-
id:
|
|
811
|
+
id: g,
|
|
778
812
|
control: {
|
|
779
813
|
manual: !0
|
|
780
814
|
}
|
|
@@ -782,16 +816,18 @@ function qt() {
|
|
|
782
816
|
)).result?.();
|
|
783
817
|
},
|
|
784
818
|
pop: () => {
|
|
785
|
-
|
|
819
|
+
const a = T.getState().status;
|
|
820
|
+
a !== "COMPLETED" && a !== "IDLE" || window.history.back();
|
|
786
821
|
}
|
|
787
822
|
};
|
|
788
823
|
}
|
|
789
|
-
function
|
|
790
|
-
const
|
|
824
|
+
function Kt() {
|
|
825
|
+
const s = q(ot);
|
|
791
826
|
return {
|
|
792
|
-
pushStep: async (
|
|
793
|
-
|
|
794
|
-
|
|
827
|
+
pushStep: async (n) => {
|
|
828
|
+
const i = T.getState().status;
|
|
829
|
+
i !== "COMPLETED" && i !== "IDLE" || (await N.addTask(async () => {
|
|
830
|
+
const o = new URLSearchParams(n).toString(), c = `${window.location.pathname}${o ? `?${o}` : ""}`;
|
|
795
831
|
return window.history.state?.step || window.history.replaceState(
|
|
796
832
|
{
|
|
797
833
|
...window.history.state,
|
|
@@ -803,177 +839,179 @@ function jt() {
|
|
|
803
839
|
{
|
|
804
840
|
...window.history.state,
|
|
805
841
|
step: !0,
|
|
806
|
-
params:
|
|
842
|
+
params: n
|
|
807
843
|
},
|
|
808
844
|
"",
|
|
809
|
-
|
|
810
|
-
), async () =>
|
|
845
|
+
c
|
|
846
|
+
), async () => s({ type: "SET", params: n });
|
|
811
847
|
})).result?.();
|
|
812
848
|
},
|
|
813
|
-
replaceStep: async (
|
|
814
|
-
|
|
815
|
-
|
|
849
|
+
replaceStep: async (n) => {
|
|
850
|
+
const i = T.getState().status;
|
|
851
|
+
i !== "COMPLETED" && i !== "IDLE" || (await N.addTask(async () => {
|
|
852
|
+
const o = new URLSearchParams(n).toString(), c = `${window.location.pathname}${o ? `?${o}` : ""}`;
|
|
816
853
|
return window.history.replaceState(
|
|
817
854
|
{
|
|
818
855
|
...window.history.state,
|
|
819
856
|
step: !0,
|
|
820
|
-
params:
|
|
857
|
+
params: n
|
|
821
858
|
},
|
|
822
859
|
"",
|
|
823
|
-
|
|
824
|
-
), async () =>
|
|
860
|
+
c
|
|
861
|
+
), async () => s({ type: "SET", params: n });
|
|
825
862
|
})).result?.();
|
|
826
863
|
},
|
|
827
864
|
popStep: () => {
|
|
828
|
-
|
|
865
|
+
const n = T.getState().status;
|
|
866
|
+
n !== "COMPLETED" && n !== "IDLE" || window.history.back();
|
|
829
867
|
}
|
|
830
868
|
};
|
|
831
869
|
}
|
|
832
|
-
function
|
|
833
|
-
return q(
|
|
870
|
+
function V() {
|
|
871
|
+
return q(ct);
|
|
834
872
|
}
|
|
835
|
-
function
|
|
836
|
-
return q(
|
|
873
|
+
function jt() {
|
|
874
|
+
return q(it);
|
|
837
875
|
}
|
|
838
|
-
function
|
|
839
|
-
name:
|
|
876
|
+
function Vt({
|
|
877
|
+
name: s,
|
|
840
878
|
initial: e,
|
|
841
879
|
idle: t,
|
|
842
880
|
pushOnEnter: a,
|
|
843
|
-
pushOnExit:
|
|
844
|
-
replaceOnEnter:
|
|
881
|
+
pushOnExit: n,
|
|
882
|
+
replaceOnEnter: i,
|
|
845
883
|
replaceOnExit: o,
|
|
846
|
-
popOnEnter:
|
|
847
|
-
popOnExit:
|
|
848
|
-
completedOnExit:
|
|
849
|
-
completedOnEnter:
|
|
850
|
-
options:
|
|
884
|
+
popOnEnter: c,
|
|
885
|
+
popOnExit: u,
|
|
886
|
+
completedOnExit: l,
|
|
887
|
+
completedOnEnter: p,
|
|
888
|
+
options: f
|
|
851
889
|
}) {
|
|
852
890
|
return {
|
|
853
|
-
name:
|
|
891
|
+
name: s,
|
|
854
892
|
initial: e,
|
|
855
893
|
variants: {
|
|
856
894
|
"IDLE-true": t,
|
|
857
895
|
"IDLE-false": t,
|
|
858
|
-
"PUSHING-false":
|
|
896
|
+
"PUSHING-false": n,
|
|
859
897
|
"PUSHING-true": a,
|
|
860
898
|
"REPLACING-false": o,
|
|
861
|
-
"REPLACING-true":
|
|
862
|
-
"POPPING-false":
|
|
863
|
-
"POPPING-true":
|
|
864
|
-
"COMPLETED-false":
|
|
865
|
-
"COMPLETED-true":
|
|
899
|
+
"REPLACING-true": i,
|
|
900
|
+
"POPPING-false": u,
|
|
901
|
+
"POPPING-true": c,
|
|
902
|
+
"COMPLETED-false": l,
|
|
903
|
+
"COMPLETED-true": p
|
|
866
904
|
},
|
|
867
|
-
...
|
|
905
|
+
...f
|
|
868
906
|
};
|
|
869
907
|
}
|
|
870
|
-
function
|
|
871
|
-
name:
|
|
908
|
+
function Wt({
|
|
909
|
+
name: s,
|
|
872
910
|
initial: e,
|
|
873
911
|
idle: t,
|
|
874
912
|
pushOnEnter: a,
|
|
875
|
-
pushOnExit:
|
|
876
|
-
replaceOnEnter:
|
|
913
|
+
pushOnExit: n,
|
|
914
|
+
replaceOnEnter: i,
|
|
877
915
|
replaceOnExit: o,
|
|
878
|
-
popOnEnter:
|
|
879
|
-
popOnExit:
|
|
880
|
-
completedOnEnter:
|
|
881
|
-
completedOnExit:
|
|
882
|
-
options:
|
|
916
|
+
popOnEnter: c,
|
|
917
|
+
popOnExit: u,
|
|
918
|
+
completedOnEnter: l,
|
|
919
|
+
completedOnExit: p,
|
|
920
|
+
options: f
|
|
883
921
|
}) {
|
|
884
922
|
return {
|
|
885
|
-
name:
|
|
923
|
+
name: s,
|
|
886
924
|
initial: e,
|
|
887
925
|
variants: {
|
|
888
926
|
"IDLE-true": t,
|
|
889
927
|
"IDLE-false": t,
|
|
890
|
-
"PUSHING-false":
|
|
928
|
+
"PUSHING-false": n,
|
|
891
929
|
"PUSHING-true": a,
|
|
892
930
|
"REPLACING-false": o,
|
|
893
|
-
"REPLACING-true":
|
|
894
|
-
"POPPING-false":
|
|
895
|
-
"POPPING-true":
|
|
896
|
-
"COMPLETED-false":
|
|
897
|
-
"COMPLETED-true":
|
|
931
|
+
"REPLACING-true": i,
|
|
932
|
+
"POPPING-false": u,
|
|
933
|
+
"POPPING-true": c,
|
|
934
|
+
"COMPLETED-false": p,
|
|
935
|
+
"COMPLETED-true": l
|
|
898
936
|
},
|
|
899
|
-
...
|
|
937
|
+
...f
|
|
900
938
|
};
|
|
901
939
|
}
|
|
902
|
-
const
|
|
940
|
+
const Rt = { then() {
|
|
903
941
|
} };
|
|
904
|
-
function
|
|
905
|
-
freeze:
|
|
942
|
+
function Gt({
|
|
943
|
+
freeze: s,
|
|
906
944
|
children: e
|
|
907
945
|
}) {
|
|
908
|
-
if (
|
|
909
|
-
throw
|
|
946
|
+
if (s)
|
|
947
|
+
throw Rt;
|
|
910
948
|
return e;
|
|
911
949
|
}
|
|
912
|
-
function
|
|
913
|
-
return /* @__PURE__ */
|
|
950
|
+
function bt({ freeze: s, children: e, placeholder: t }) {
|
|
951
|
+
return /* @__PURE__ */ w(Et, { fallback: t, children: /* @__PURE__ */ w(Gt, { freeze: s, children: e }) });
|
|
914
952
|
}
|
|
915
|
-
function
|
|
953
|
+
function z(s, e) {
|
|
916
954
|
const {
|
|
917
955
|
direction: t = "x",
|
|
918
956
|
markerSelector: a = "[data-swipe-at-edge]",
|
|
919
|
-
depthLimit:
|
|
920
|
-
verifyByScroll:
|
|
921
|
-
} = e ?? {}, o =
|
|
957
|
+
depthLimit: n = 24,
|
|
958
|
+
verifyByScroll: i = !1
|
|
959
|
+
} = e ?? {}, o = Ot(s);
|
|
922
960
|
if (!o) return { element: null, hasMarker: !1 };
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
return { element:
|
|
926
|
-
let
|
|
927
|
-
for (;
|
|
928
|
-
if (
|
|
929
|
-
return { element:
|
|
930
|
-
|
|
961
|
+
const c = o.closest?.(a);
|
|
962
|
+
if (c instanceof HTMLElement && Y(c, t) && (!i || tt(c, t)))
|
|
963
|
+
return { element: c, hasMarker: !0 };
|
|
964
|
+
let u = o, l = 0;
|
|
965
|
+
for (; u && u !== document.body && l < n; ) {
|
|
966
|
+
if (Y(u, t) && (!i || tt(u, t)))
|
|
967
|
+
return { element: u, hasMarker: !1 };
|
|
968
|
+
u = u.parentElement, l++;
|
|
931
969
|
}
|
|
932
970
|
return { element: null, hasMarker: !1 };
|
|
933
971
|
}
|
|
934
|
-
function
|
|
935
|
-
if (!
|
|
936
|
-
const e =
|
|
972
|
+
function Ot(s) {
|
|
973
|
+
if (!s) return null;
|
|
974
|
+
const e = s, t = typeof e.composedPath == "function" ? e.composedPath() : void 0;
|
|
937
975
|
if (t && t.length) {
|
|
938
976
|
for (const a of t)
|
|
939
977
|
if (a instanceof HTMLElement) return a;
|
|
940
978
|
}
|
|
941
|
-
return
|
|
979
|
+
return s;
|
|
942
980
|
}
|
|
943
|
-
function
|
|
944
|
-
return e === "y" ?
|
|
981
|
+
function Y(s, e) {
|
|
982
|
+
return e === "y" ? s.scrollHeight - s.clientHeight > 1 : s.scrollWidth - s.clientWidth > 1;
|
|
945
983
|
}
|
|
946
|
-
function
|
|
947
|
-
if (!
|
|
984
|
+
function tt(s, e) {
|
|
985
|
+
if (!Y(s, e)) return !1;
|
|
948
986
|
if (e === "y") {
|
|
949
|
-
const t =
|
|
950
|
-
if (
|
|
951
|
-
return
|
|
952
|
-
|
|
953
|
-
const
|
|
954
|
-
return
|
|
987
|
+
const t = s.scrollTop;
|
|
988
|
+
if (s.scrollTop = t + 1, s.scrollTop !== t)
|
|
989
|
+
return s.scrollTop = t, !0;
|
|
990
|
+
s.scrollTop = t - 1;
|
|
991
|
+
const n = s.scrollTop !== t;
|
|
992
|
+
return s.scrollTop = t, n;
|
|
955
993
|
} else {
|
|
956
|
-
const t =
|
|
957
|
-
if (
|
|
958
|
-
return
|
|
959
|
-
|
|
960
|
-
const
|
|
961
|
-
return
|
|
994
|
+
const t = s.scrollLeft;
|
|
995
|
+
if (s.scrollLeft = t + 1, s.scrollLeft !== t)
|
|
996
|
+
return s.scrollLeft = t, !0;
|
|
997
|
+
s.scrollLeft = t - 1;
|
|
998
|
+
const n = s.scrollLeft !== t;
|
|
999
|
+
return s.scrollLeft = t, n;
|
|
962
1000
|
}
|
|
963
1001
|
}
|
|
964
|
-
function
|
|
965
|
-
const { isActive: a, transitionName:
|
|
966
|
-
|
|
967
|
-
const
|
|
968
|
-
return
|
|
969
|
-
if (!
|
|
970
|
-
const { value:
|
|
971
|
-
o(
|
|
972
|
-
}, [
|
|
973
|
-
|
|
1002
|
+
function Ht({ children: s, ref: e, ...t }) {
|
|
1003
|
+
const { isActive: a, transitionName: n } = V(), [i, o] = at();
|
|
1004
|
+
St(e, () => i.current);
|
|
1005
|
+
const c = T((r) => r.status), u = Q.get(n), { decoratorName: l } = u, { initial: p, variants: f } = K.get(l);
|
|
1006
|
+
return G(() => {
|
|
1007
|
+
if (!i.current) return;
|
|
1008
|
+
const { value: r, options: g } = f[`${c}-${a}`];
|
|
1009
|
+
o(i.current, r, g);
|
|
1010
|
+
}, [c, a, o, f, i]), /* @__PURE__ */ w(
|
|
1011
|
+
rt.div,
|
|
974
1012
|
{
|
|
975
|
-
ref:
|
|
976
|
-
initial:
|
|
1013
|
+
ref: i,
|
|
1014
|
+
initial: p,
|
|
977
1015
|
style: {
|
|
978
1016
|
position: "absolute",
|
|
979
1017
|
top: 0,
|
|
@@ -987,114 +1025,117 @@ function Ot({ children: n, ref: e, ...t }) {
|
|
|
987
1025
|
}
|
|
988
1026
|
);
|
|
989
1027
|
}
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
|
|
1028
|
+
const O = _((s) => ({
|
|
1029
|
+
dragStatus: "IDLE",
|
|
1030
|
+
replaceTransitionStatus: "IDLE",
|
|
1031
|
+
setDragStatus: (e) => s({ dragStatus: e }),
|
|
1032
|
+
setReplaceTransitionStatus: (e) => s({ replaceTransitionStatus: e })
|
|
993
1033
|
}));
|
|
994
|
-
function
|
|
995
|
-
children:
|
|
1034
|
+
function Ut({
|
|
1035
|
+
children: s,
|
|
996
1036
|
...e
|
|
997
1037
|
}) {
|
|
998
|
-
const [t, a] =
|
|
1038
|
+
const [t, a] = at(), { id: n, isActive: i, isRoot: o, transitionName: c, prevTransitionName: u } = V(), l = wt(), p = T((d) => d.status), f = O((d) => d.dragStatus), r = O.getState().setDragStatus, g = O.getState().setReplaceTransitionStatus, P = Q.get(c), { variants: E, initial: h, swipeDirection: m, decoratorName: D } = P, L = K.get(D), H = I(null), U = I(null), $ = I(null), k = I(!1), b = I(!1), v = I({
|
|
999
1039
|
element: null,
|
|
1000
1040
|
hasMarker: !1
|
|
1001
|
-
}),
|
|
1002
|
-
if (!
|
|
1041
|
+
}), M = I({ element: null, hasMarker: !1 }), W = I(0), J = I(0), ut = async (d, y) => {
|
|
1042
|
+
if (!m)
|
|
1003
1043
|
return;
|
|
1004
|
-
|
|
1005
|
-
const
|
|
1044
|
+
H.current = t.current?.previousSibling, $.current = t.current?.previousSibling?.querySelector("[data-decorator]");
|
|
1045
|
+
const S = await P?.onSwipeStart(d, y, {
|
|
1006
1046
|
currentScreen: t.current,
|
|
1007
|
-
prevScreen:
|
|
1008
|
-
dragControls:
|
|
1009
|
-
onStart: (
|
|
1010
|
-
currentDecorator:
|
|
1011
|
-
prevDecorator:
|
|
1047
|
+
prevScreen: H.current,
|
|
1048
|
+
dragControls: l,
|
|
1049
|
+
onStart: (C) => L?.onSwipeStart?.(C, {
|
|
1050
|
+
currentDecorator: U.current,
|
|
1051
|
+
prevDecorator: $.current
|
|
1012
1052
|
})
|
|
1013
1053
|
});
|
|
1014
|
-
|
|
1015
|
-
},
|
|
1016
|
-
!
|
|
1054
|
+
r(S ? "PENDING" : "IDLE");
|
|
1055
|
+
}, lt = (d, y) => {
|
|
1056
|
+
!m || f !== "PENDING" || P?.onSwipe(d, y, {
|
|
1017
1057
|
currentScreen: t.current,
|
|
1018
|
-
prevScreen:
|
|
1019
|
-
dragControls:
|
|
1020
|
-
onProgress: (
|
|
1021
|
-
currentDecorator:
|
|
1022
|
-
prevDecorator:
|
|
1058
|
+
prevScreen: H.current,
|
|
1059
|
+
dragControls: l,
|
|
1060
|
+
onProgress: (S, C) => L?.onSwipe?.(S, C, {
|
|
1061
|
+
currentDecorator: U.current,
|
|
1062
|
+
prevDecorator: $.current
|
|
1023
1063
|
})
|
|
1024
1064
|
});
|
|
1025
|
-
},
|
|
1026
|
-
if (!
|
|
1065
|
+
}, dt = async (d, y) => {
|
|
1066
|
+
if (!m || f !== "PENDING")
|
|
1027
1067
|
return;
|
|
1028
|
-
await
|
|
1068
|
+
await P?.onSwipeEnd(d, y, {
|
|
1029
1069
|
currentScreen: t.current,
|
|
1030
|
-
prevScreen:
|
|
1031
|
-
onStart: (
|
|
1032
|
-
currentDecorator:
|
|
1033
|
-
prevDecorator:
|
|
1070
|
+
prevScreen: H.current,
|
|
1071
|
+
onStart: (C) => L?.onSwipeEnd?.(C, {
|
|
1072
|
+
currentDecorator: U.current,
|
|
1073
|
+
prevDecorator: $.current
|
|
1034
1074
|
})
|
|
1035
|
-
}) ? window.history.back() :
|
|
1036
|
-
},
|
|
1037
|
-
if (!(!o &&
|
|
1075
|
+
}) ? window.history.back() : r("IDLE");
|
|
1076
|
+
}, pt = (d) => {
|
|
1077
|
+
if (!(!o && i && p === "COMPLETED" && f === "IDLE" && !!m))
|
|
1038
1078
|
return;
|
|
1039
|
-
|
|
1079
|
+
v.current = z(d.target, {
|
|
1040
1080
|
direction: "x"
|
|
1041
|
-
}),
|
|
1081
|
+
}), M.current = z(d.target, {
|
|
1042
1082
|
direction: "y"
|
|
1043
|
-
}),
|
|
1044
|
-
},
|
|
1045
|
-
const y = !
|
|
1046
|
-
if (
|
|
1047
|
-
|
|
1048
|
-
else if (
|
|
1049
|
-
const
|
|
1050
|
-
(
|
|
1083
|
+
}), W.current = d.clientX, J.current = d.clientY, (!v.current.element && !M.current.element || v.current.element || M.current.element) && (k.current = !0);
|
|
1084
|
+
}, ft = (d) => {
|
|
1085
|
+
const y = !v.current.element && !M.current.element;
|
|
1086
|
+
if (k.current && y)
|
|
1087
|
+
k.current = !1, b.current = !0, l.start(d);
|
|
1088
|
+
else if (k.current && !y) {
|
|
1089
|
+
const S = d.clientX - W.current, C = d.clientY - J.current, gt = M.current.element && M.current.element.scrollTop <= 0 && M.current.hasMarker, mt = v.current.element && v.current.element.scrollLeft <= 0 && v.current.hasMarker;
|
|
1090
|
+
(m === "y" && (gt || v.current.element) && C > 0 && Math.abs(S) < 4 || m === "x" && (mt || M.current.element) && S > 0 && Math.abs(C) < 4) && (k.current = !1, b.current = !0, l.start(d));
|
|
1051
1091
|
}
|
|
1052
|
-
},
|
|
1053
|
-
|
|
1092
|
+
}, ht = () => {
|
|
1093
|
+
k.current = !1, b.current = !1;
|
|
1054
1094
|
};
|
|
1055
|
-
return
|
|
1056
|
-
const
|
|
1057
|
-
if (!
|
|
1058
|
-
const y = (
|
|
1059
|
-
|
|
1095
|
+
return G(() => {
|
|
1096
|
+
const d = t.current;
|
|
1097
|
+
if (!d) return;
|
|
1098
|
+
const y = (S) => {
|
|
1099
|
+
b.current && S.preventDefault(), S.target?.dataset.swipeAtEdgeBar === "true" && S.preventDefault();
|
|
1060
1100
|
};
|
|
1061
|
-
return
|
|
1101
|
+
return d.addEventListener("touchmove", y, {
|
|
1062
1102
|
passive: !1
|
|
1063
1103
|
}), () => {
|
|
1064
|
-
|
|
1104
|
+
d.removeEventListener("touchmove", y);
|
|
1065
1105
|
};
|
|
1066
|
-
}, [t]),
|
|
1106
|
+
}, [t]), G(() => {
|
|
1067
1107
|
t.current && (async () => {
|
|
1068
|
-
const { value:
|
|
1069
|
-
!
|
|
1070
|
-
duration: 0.
|
|
1071
|
-
})), await a(t.current,
|
|
1108
|
+
const { value: d, options: y } = E[`${p}-${i}`], S = u !== c;
|
|
1109
|
+
!i && p === "REPLACING" && S && (g("PENDING"), await a(t.current, At, {
|
|
1110
|
+
duration: 0.1
|
|
1111
|
+
})), await a(t.current, d, y), await N.resolveTask(n), !i && S && g("IDLE"), i && p === "COMPLETED" && r("IDLE");
|
|
1072
1112
|
})();
|
|
1073
1113
|
}, [
|
|
1114
|
+
p,
|
|
1115
|
+
i,
|
|
1116
|
+
n,
|
|
1074
1117
|
u,
|
|
1075
|
-
s,
|
|
1076
|
-
r,
|
|
1077
1118
|
c,
|
|
1078
|
-
i,
|
|
1079
1119
|
a,
|
|
1080
1120
|
t,
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1121
|
+
E,
|
|
1122
|
+
r,
|
|
1123
|
+
g
|
|
1124
|
+
]), /* @__PURE__ */ et(
|
|
1125
|
+
rt.div,
|
|
1085
1126
|
{
|
|
1086
1127
|
ref: t,
|
|
1087
1128
|
...e,
|
|
1088
|
-
initial:
|
|
1089
|
-
drag:
|
|
1129
|
+
initial: h,
|
|
1130
|
+
drag: m,
|
|
1090
1131
|
dragListener: !1,
|
|
1091
|
-
dragControls:
|
|
1092
|
-
onDragStart:
|
|
1093
|
-
onDrag:
|
|
1094
|
-
onDragEnd:
|
|
1095
|
-
onPointerDown:
|
|
1096
|
-
onPointerMove:
|
|
1097
|
-
onPointerUp:
|
|
1132
|
+
dragControls: l,
|
|
1133
|
+
onDragStart: ut,
|
|
1134
|
+
onDrag: lt,
|
|
1135
|
+
onDragEnd: dt,
|
|
1136
|
+
onPointerDown: pt,
|
|
1137
|
+
onPointerMove: ft,
|
|
1138
|
+
onPointerUp: ht,
|
|
1098
1139
|
style: {
|
|
1099
1140
|
position: "absolute",
|
|
1100
1141
|
top: 0,
|
|
@@ -1108,10 +1149,11 @@ function Ht({
|
|
|
1108
1149
|
touchAction: "none",
|
|
1109
1150
|
isolation: "isolate",
|
|
1110
1151
|
contain: "strict",
|
|
1152
|
+
overscrollBehavior: "contain",
|
|
1111
1153
|
...e.style
|
|
1112
1154
|
},
|
|
1113
1155
|
children: [
|
|
1114
|
-
/* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ w(
|
|
1115
1157
|
"div",
|
|
1116
1158
|
{
|
|
1117
1159
|
"data-swipe-at-edge-bar": !0,
|
|
@@ -1125,7 +1167,7 @@ function Ht({
|
|
|
1125
1167
|
}
|
|
1126
1168
|
}
|
|
1127
1169
|
),
|
|
1128
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ w(
|
|
1129
1171
|
"div",
|
|
1130
1172
|
{
|
|
1131
1173
|
style: {
|
|
@@ -1135,11 +1177,11 @@ function Ht({
|
|
|
1135
1177
|
width: "100%",
|
|
1136
1178
|
height: "100%"
|
|
1137
1179
|
},
|
|
1138
|
-
children:
|
|
1180
|
+
children: s
|
|
1139
1181
|
}
|
|
1140
1182
|
),
|
|
1141
|
-
|
|
1142
|
-
/* @__PURE__ */
|
|
1183
|
+
L && /* @__PURE__ */ w(Ht, { ref: U }),
|
|
1184
|
+
/* @__PURE__ */ w(
|
|
1143
1185
|
"div",
|
|
1144
1186
|
{
|
|
1145
1187
|
"data-swipe-at-edge-bar": !0,
|
|
@@ -1157,23 +1199,23 @@ function Ht({
|
|
|
1157
1199
|
}
|
|
1158
1200
|
);
|
|
1159
1201
|
}
|
|
1160
|
-
function
|
|
1161
|
-
children:
|
|
1202
|
+
function Jt({
|
|
1203
|
+
children: s,
|
|
1162
1204
|
...e
|
|
1163
1205
|
}) {
|
|
1164
|
-
const { isActive: t, isPrev: a } =
|
|
1165
|
-
return /* @__PURE__ */
|
|
1206
|
+
const { isActive: t, isPrev: a } = V(), n = T((l) => l.status), i = O((l) => l.dragStatus), o = O((l) => l.replaceTransitionStatus);
|
|
1207
|
+
return /* @__PURE__ */ w(bt, { freeze: !t && (n === "COMPLETED" && i === "IDLE" && o === "IDLE" || a && o === "IDLE"), children: /* @__PURE__ */ w(Ut, { ...e, children: s }) });
|
|
1166
1208
|
}
|
|
1167
1209
|
export {
|
|
1168
1210
|
Xt as Route,
|
|
1169
1211
|
Yt as Router,
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1212
|
+
Jt as Screen,
|
|
1213
|
+
kt as createDecorator,
|
|
1214
|
+
Wt as createRawDecorator,
|
|
1215
|
+
Vt as createRawTransition,
|
|
1216
|
+
j as createTransition,
|
|
1175
1217
|
qt as useNavigate,
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1218
|
+
jt as useParams,
|
|
1219
|
+
V as useScreen,
|
|
1220
|
+
Kt as useStep
|
|
1179
1221
|
};
|