@flemo/core 1.1.0 → 1.1.2
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/index.mjs +229 -221
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { create as
|
|
2
|
-
import { pathToRegexp as
|
|
3
|
-
class
|
|
1
|
+
import { create as w } from "zustand";
|
|
2
|
+
import { pathToRegexp as v, match as B } from "path-to-regexp";
|
|
3
|
+
class Q {
|
|
4
4
|
tasks = /* @__PURE__ */ new Map();
|
|
5
5
|
instanceId = Date.now().toString();
|
|
6
6
|
isLocked = !1;
|
|
@@ -10,7 +10,7 @@ class Y {
|
|
|
10
10
|
pendingTaskQueue = [];
|
|
11
11
|
isProcessingPending = !1;
|
|
12
12
|
async acquireLock(t) {
|
|
13
|
-
for (let
|
|
13
|
+
for (let a = 0; a < 10; a++) {
|
|
14
14
|
if (!this.isLocked)
|
|
15
15
|
return this.isLocked = !0, this.currentTaskId = t, !0;
|
|
16
16
|
await new Promise((r) => setTimeout(r, 100));
|
|
@@ -25,8 +25,8 @@ class Y {
|
|
|
25
25
|
}
|
|
26
26
|
emitSignal(t) {
|
|
27
27
|
const e = this.signalListeners.get(t);
|
|
28
|
-
e && (e.forEach((
|
|
29
|
-
this.resolveTask(
|
|
28
|
+
e && (e.forEach((s) => {
|
|
29
|
+
this.resolveTask(s);
|
|
30
30
|
}), this.signalListeners.delete(t));
|
|
31
31
|
}
|
|
32
32
|
// 대기 중인 태스크들을 처리하는 메서드
|
|
@@ -53,7 +53,7 @@ class Y {
|
|
|
53
53
|
return new Promise((t) => {
|
|
54
54
|
const e = () => {
|
|
55
55
|
this.pendingTaskQueue.filter(
|
|
56
|
-
(
|
|
56
|
+
(a) => a.status === "MANUAL_PENDING" || a.status === "SIGNAL_PENDING"
|
|
57
57
|
).length === 0 ? t() : setTimeout(e, 100);
|
|
58
58
|
};
|
|
59
59
|
e();
|
|
@@ -61,15 +61,15 @@ class Y {
|
|
|
61
61
|
}
|
|
62
62
|
// 태스크 상태 변경 시 대기 큐 처리
|
|
63
63
|
async onTaskStatusChange(t, e) {
|
|
64
|
-
(e === "COMPLETED" || e === "FAILED" || e === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((
|
|
64
|
+
(e === "COMPLETED" || e === "FAILED" || e === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((s) => s.id !== t), await this.processPendingTasks());
|
|
65
65
|
}
|
|
66
66
|
async addTask(t, e = {}) {
|
|
67
|
-
const
|
|
68
|
-
return new Promise((
|
|
67
|
+
const s = e.id || this.generateTaskId();
|
|
68
|
+
return new Promise((a, r) => {
|
|
69
69
|
this.taskQueue = this.taskQueue.then(async () => {
|
|
70
70
|
try {
|
|
71
71
|
const { control: o, validate: c, rollback: l, dependencies: u = [], delay: d } = e, m = new AbortController(), i = {
|
|
72
|
-
id:
|
|
72
|
+
id: s,
|
|
73
73
|
execute: t,
|
|
74
74
|
timestamp: Date.now(),
|
|
75
75
|
retryCount: 0,
|
|
@@ -81,7 +81,7 @@ class Y {
|
|
|
81
81
|
control: o,
|
|
82
82
|
abortController: m
|
|
83
83
|
};
|
|
84
|
-
this.tasks.set(i.id, i), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(i), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((
|
|
84
|
+
this.tasks.set(i.id, i), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(i), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((P) => P.id !== i.id));
|
|
85
85
|
try {
|
|
86
86
|
if (!await this.acquireLock(i.id))
|
|
87
87
|
throw i.status = "FAILED", new Error("FAILED");
|
|
@@ -97,7 +97,7 @@ class Y {
|
|
|
97
97
|
d && d > 0 && await new Promise((f) => setTimeout(f, d));
|
|
98
98
|
const p = await i.execute(i.abortController);
|
|
99
99
|
if (i.abortController.signal.aborted) {
|
|
100
|
-
i.status = "COMPLETED", await this.onTaskStatusChange(i.id, "COMPLETED"),
|
|
100
|
+
i.status = "COMPLETED", await this.onTaskStatusChange(i.id, "COMPLETED"), a({
|
|
101
101
|
success: !0,
|
|
102
102
|
result: void 0,
|
|
103
103
|
taskId: i.id,
|
|
@@ -109,19 +109,19 @@ class Y {
|
|
|
109
109
|
if (e.control) {
|
|
110
110
|
const f = e.control;
|
|
111
111
|
if (f.delay && f.delay > 0 && await new Promise((y) => setTimeout(y, f.delay)), f.manual) {
|
|
112
|
-
i.status = "MANUAL_PENDING", i.manualResolver = { resolve:
|
|
112
|
+
i.status = "MANUAL_PENDING", i.manualResolver = { resolve: a, reject: r, result: p }, this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "MANUAL_PENDING");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
if (f.signal) {
|
|
116
|
-
i.status = "SIGNAL_PENDING", i.manualResolver = { resolve:
|
|
116
|
+
i.status = "SIGNAL_PENDING", i.manualResolver = { resolve: a, reject: r, result: p }, this.signalListeners.has(f.signal) || this.signalListeners.set(f.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(f.signal).add(i.id), this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "SIGNAL_PENDING");
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
if (f.condition && !await f.condition()) {
|
|
120
|
-
i.status = "MANUAL_PENDING", i.manualResolver = { resolve:
|
|
120
|
+
i.status = "MANUAL_PENDING", i.manualResolver = { resolve: a, reject: r, result: p }, this.pendingTaskQueue.push(i), await this.onTaskStatusChange(i.id, "MANUAL_PENDING");
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
i.status = "COMPLETED", await this.onTaskStatusChange(i.id, "COMPLETED"),
|
|
124
|
+
i.status = "COMPLETED", await this.onTaskStatusChange(i.id, "COMPLETED"), a({
|
|
125
125
|
success: !0,
|
|
126
126
|
result: p,
|
|
127
127
|
taskId: i.id,
|
|
@@ -138,8 +138,8 @@ class Y {
|
|
|
138
138
|
} finally {
|
|
139
139
|
this.releaseLock(i.id);
|
|
140
140
|
}
|
|
141
|
-
} catch (
|
|
142
|
-
r(
|
|
141
|
+
} catch (P) {
|
|
142
|
+
r(P);
|
|
143
143
|
}
|
|
144
144
|
} catch (o) {
|
|
145
145
|
r(o);
|
|
@@ -155,10 +155,10 @@ class Y {
|
|
|
155
155
|
if (e.control?.condition && !await e.control.condition())
|
|
156
156
|
return !1;
|
|
157
157
|
e.status = "COMPLETED";
|
|
158
|
-
const
|
|
159
|
-
return
|
|
158
|
+
const s = e.manualResolver;
|
|
159
|
+
return s.resolve({
|
|
160
160
|
success: !0,
|
|
161
|
-
result:
|
|
161
|
+
result: s.result,
|
|
162
162
|
taskId: e.id,
|
|
163
163
|
timestamp: Date.now(),
|
|
164
164
|
instanceId: this.instanceId
|
|
@@ -173,7 +173,7 @@ class Y {
|
|
|
173
173
|
await Promise.all(t.map((e) => this.resolveTask(e.id)));
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
const
|
|
176
|
+
const yt = new Q(), Pt = w((n) => ({
|
|
177
177
|
index: -1,
|
|
178
178
|
histories: [],
|
|
179
179
|
addHistory: (t) => n((e) => ({
|
|
@@ -186,27 +186,27 @@ const dt = new Y(), mt = D((n) => ({
|
|
|
186
186
|
})),
|
|
187
187
|
popHistory: (t) => n((e) => ({
|
|
188
188
|
index: e.index - 1,
|
|
189
|
-
histories: e.histories.filter((
|
|
189
|
+
histories: e.histories.filter((s, a) => a !== t)
|
|
190
190
|
}))
|
|
191
|
-
})),
|
|
191
|
+
})), gt = w((n) => ({
|
|
192
192
|
status: "IDLE",
|
|
193
193
|
transitionTaskId: null,
|
|
194
194
|
setStatus: (t) => n({ status: t }),
|
|
195
195
|
setTransitionTaskId: (t) => n({ transitionTaskId: t })
|
|
196
196
|
}));
|
|
197
|
-
let
|
|
198
|
-
function
|
|
199
|
-
|
|
197
|
+
let L = 0;
|
|
198
|
+
function It() {
|
|
199
|
+
L += 1;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
201
|
+
function Et() {
|
|
202
|
+
return L > 0 ? (L -= 1, !0) : !1;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function T({
|
|
205
205
|
name: n,
|
|
206
206
|
initial: t,
|
|
207
207
|
idle: e,
|
|
208
|
-
enter:
|
|
209
|
-
enterBack:
|
|
208
|
+
enter: s,
|
|
209
|
+
enterBack: a,
|
|
210
210
|
exit: r,
|
|
211
211
|
exitBack: o,
|
|
212
212
|
options: c
|
|
@@ -218,23 +218,23 @@ function k({
|
|
|
218
218
|
"IDLE-true": e,
|
|
219
219
|
"IDLE-false": e,
|
|
220
220
|
"PUSHING-false": r,
|
|
221
|
-
"PUSHING-true":
|
|
221
|
+
"PUSHING-true": s,
|
|
222
222
|
"REPLACING-false": r,
|
|
223
|
-
"REPLACING-true":
|
|
223
|
+
"REPLACING-true": s,
|
|
224
224
|
"POPPING-false": o,
|
|
225
|
-
"POPPING-true":
|
|
225
|
+
"POPPING-true": a,
|
|
226
226
|
"COMPLETED-false": r,
|
|
227
|
-
"COMPLETED-true":
|
|
227
|
+
"COMPLETED-true": s
|
|
228
228
|
},
|
|
229
229
|
...c
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function kt({
|
|
233
233
|
name: n,
|
|
234
234
|
initial: t,
|
|
235
235
|
idle: e,
|
|
236
|
-
pushOnEnter:
|
|
237
|
-
pushOnExit:
|
|
236
|
+
pushOnEnter: s,
|
|
237
|
+
pushOnExit: a,
|
|
238
238
|
replaceOnEnter: r,
|
|
239
239
|
replaceOnExit: o,
|
|
240
240
|
popOnEnter: c,
|
|
@@ -249,8 +249,8 @@ function gt({
|
|
|
249
249
|
variants: {
|
|
250
250
|
"IDLE-true": e,
|
|
251
251
|
"IDLE-false": e,
|
|
252
|
-
"PUSHING-false":
|
|
253
|
-
"PUSHING-true":
|
|
252
|
+
"PUSHING-false": a,
|
|
253
|
+
"PUSHING-true": s,
|
|
254
254
|
"REPLACING-false": o,
|
|
255
255
|
"REPLACING-true": r,
|
|
256
256
|
"POPPING-false": l,
|
|
@@ -261,12 +261,12 @@ function gt({
|
|
|
261
261
|
...m
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
const
|
|
265
|
-
const [
|
|
266
|
-
if (
|
|
267
|
-
const c = (n -
|
|
264
|
+
const X = (n, t, e) => {
|
|
265
|
+
const [s, a] = t, [r, o] = e;
|
|
266
|
+
if (a === s) return r;
|
|
267
|
+
const c = (n - s) / (a - s);
|
|
268
268
|
return r + c * (o - r);
|
|
269
|
-
},
|
|
269
|
+
}, F = T({
|
|
270
270
|
name: "cupertino",
|
|
271
271
|
initial: {
|
|
272
272
|
x: "100%"
|
|
@@ -319,10 +319,10 @@ const B = (n, t, e) => {
|
|
|
319
319
|
decoratorName: "overlay",
|
|
320
320
|
swipeDirection: "x",
|
|
321
321
|
onSwipeStart: async () => !0,
|
|
322
|
-
onSwipe: (n, t, { animate: e, currentScreen:
|
|
323
|
-
const { offset: o } = t, c = o.x, l =
|
|
322
|
+
onSwipe: (n, t, { animate: e, currentScreen: s, prevScreen: a, onProgress: r }) => {
|
|
323
|
+
const { offset: o } = t, c = o.x, l = X(c, [0, window.innerWidth], [0, 100]);
|
|
324
324
|
return r?.(!0, l), e(
|
|
325
|
-
|
|
325
|
+
s,
|
|
326
326
|
{
|
|
327
327
|
x: Math.max(0, c)
|
|
328
328
|
},
|
|
@@ -330,7 +330,7 @@ const B = (n, t, e) => {
|
|
|
330
330
|
duration: 0
|
|
331
331
|
}
|
|
332
332
|
), e(
|
|
333
|
-
|
|
333
|
+
a,
|
|
334
334
|
{
|
|
335
335
|
x: -100 + l
|
|
336
336
|
},
|
|
@@ -339,11 +339,11 @@ const B = (n, t, e) => {
|
|
|
339
339
|
}
|
|
340
340
|
), l;
|
|
341
341
|
},
|
|
342
|
-
onSwipeEnd: async (n, t, { animate: e, currentScreen:
|
|
342
|
+
onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
|
|
343
343
|
const { offset: o, velocity: c } = t, u = o.x > 50 || c.x > 20;
|
|
344
344
|
return r?.(u), await Promise.all([
|
|
345
345
|
e(
|
|
346
|
-
|
|
346
|
+
s,
|
|
347
347
|
{
|
|
348
348
|
x: u ? "100%" : 0
|
|
349
349
|
},
|
|
@@ -353,7 +353,7 @@ const B = (n, t, e) => {
|
|
|
353
353
|
}
|
|
354
354
|
),
|
|
355
355
|
e(
|
|
356
|
-
|
|
356
|
+
a,
|
|
357
357
|
{
|
|
358
358
|
x: u ? 0 : -100
|
|
359
359
|
},
|
|
@@ -365,12 +365,12 @@ const B = (n, t, e) => {
|
|
|
365
365
|
]), u;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
}),
|
|
369
|
-
const [
|
|
370
|
-
if (
|
|
371
|
-
const c = (n -
|
|
368
|
+
}), z = (n, t, e) => {
|
|
369
|
+
const [s, a] = t, [r, o] = e;
|
|
370
|
+
if (a === s) return r;
|
|
371
|
+
const c = (n - s) / (a - s);
|
|
372
372
|
return r + c * (o - r);
|
|
373
|
-
},
|
|
373
|
+
}, V = T({
|
|
374
374
|
name: "layout",
|
|
375
375
|
initial: {
|
|
376
376
|
opacity: 0.97
|
|
@@ -419,10 +419,10 @@ const B = (n, t, e) => {
|
|
|
419
419
|
decoratorName: "overlay",
|
|
420
420
|
swipeDirection: "y",
|
|
421
421
|
onSwipeStart: async () => !0,
|
|
422
|
-
onSwipe: (n, t, { animate: e, currentScreen:
|
|
423
|
-
const { offset: r } = t, o = r.y, c = Math.max(0, Math.min(56, o)), l =
|
|
424
|
-
return
|
|
425
|
-
|
|
422
|
+
onSwipe: (n, t, { animate: e, currentScreen: s, onProgress: a }) => {
|
|
423
|
+
const { offset: r } = t, o = r.y, c = Math.max(0, Math.min(56, o)), l = z(c, [0, 56], [1, 0.96]), u = Math.max(0, o - 56), d = Math.min(1, u / 160), m = Math.sqrt(d) * 12, i = Math.max(0, c + m), h = Math.min(56, i);
|
|
424
|
+
return a?.(!0, 100), e(
|
|
425
|
+
s,
|
|
426
426
|
{
|
|
427
427
|
y: i,
|
|
428
428
|
opacity: l
|
|
@@ -432,11 +432,11 @@ const B = (n, t, e) => {
|
|
|
432
432
|
}
|
|
433
433
|
), h;
|
|
434
434
|
},
|
|
435
|
-
onSwipeEnd: async (n, t, { animate: e, currentScreen:
|
|
435
|
+
onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
|
|
436
436
|
const { offset: o, velocity: c } = t, u = o.y > 56 || c.y > 20;
|
|
437
437
|
return r?.(u), await Promise.all([
|
|
438
438
|
e(
|
|
439
|
-
|
|
439
|
+
s,
|
|
440
440
|
{
|
|
441
441
|
y: u ? "100%" : 0,
|
|
442
442
|
opacity: u ? 0.96 : 1
|
|
@@ -446,7 +446,7 @@ const B = (n, t, e) => {
|
|
|
446
446
|
}
|
|
447
447
|
),
|
|
448
448
|
e(
|
|
449
|
-
|
|
449
|
+
a,
|
|
450
450
|
{
|
|
451
451
|
y: 0,
|
|
452
452
|
opacity: u ? 1 : 0.97
|
|
@@ -458,7 +458,7 @@ const B = (n, t, e) => {
|
|
|
458
458
|
]), u;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
}),
|
|
461
|
+
}), Z = T({
|
|
462
462
|
name: "material",
|
|
463
463
|
initial: {
|
|
464
464
|
y: "100%"
|
|
@@ -510,10 +510,10 @@ const B = (n, t, e) => {
|
|
|
510
510
|
options: {
|
|
511
511
|
swipeDirection: "y",
|
|
512
512
|
onSwipeStart: async () => !0,
|
|
513
|
-
onSwipe: (n, t, { animate: e, currentScreen:
|
|
513
|
+
onSwipe: (n, t, { animate: e, currentScreen: s, prevScreen: a, onProgress: r }) => {
|
|
514
514
|
const { offset: o } = t, c = o.y, l = Math.max(0, Math.min(56, c)), u = Math.max(0, c - 56), d = Math.min(1, u / 160), m = Math.sqrt(d) * 12, i = Math.max(0, l + m), h = Math.min(56, i);
|
|
515
515
|
return r?.(!0, h), e(
|
|
516
|
-
|
|
516
|
+
s,
|
|
517
517
|
{
|
|
518
518
|
y: i
|
|
519
519
|
},
|
|
@@ -521,18 +521,18 @@ const B = (n, t, e) => {
|
|
|
521
521
|
duration: 0
|
|
522
522
|
}
|
|
523
523
|
), e(
|
|
524
|
-
|
|
524
|
+
a,
|
|
525
525
|
{
|
|
526
526
|
y: -56 + h
|
|
527
527
|
},
|
|
528
528
|
{ duration: 0 }
|
|
529
529
|
), h;
|
|
530
530
|
},
|
|
531
|
-
onSwipeEnd: async (n, t, { animate: e, currentScreen:
|
|
531
|
+
onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
|
|
532
532
|
const { offset: o, velocity: c } = t, u = o.y > 56 || c.y > 20;
|
|
533
533
|
return r?.(u), await Promise.all([
|
|
534
534
|
e(
|
|
535
|
-
|
|
535
|
+
s,
|
|
536
536
|
{
|
|
537
537
|
y: u ? "100%" : 0
|
|
538
538
|
},
|
|
@@ -542,7 +542,7 @@ const B = (n, t, e) => {
|
|
|
542
542
|
}
|
|
543
543
|
),
|
|
544
544
|
e(
|
|
545
|
-
|
|
545
|
+
a,
|
|
546
546
|
{
|
|
547
547
|
y: u ? 0 : -56
|
|
548
548
|
},
|
|
@@ -554,7 +554,7 @@ const B = (n, t, e) => {
|
|
|
554
554
|
]), u;
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
}),
|
|
557
|
+
}), j = T({
|
|
558
558
|
name: "none",
|
|
559
559
|
initial: {},
|
|
560
560
|
idle: {
|
|
@@ -587,21 +587,21 @@ const B = (n, t, e) => {
|
|
|
587
587
|
duration: 0
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
|
-
}),
|
|
591
|
-
["none",
|
|
592
|
-
["cupertino",
|
|
593
|
-
["material",
|
|
594
|
-
["layout",
|
|
595
|
-
]),
|
|
590
|
+
}), Tt = /* @__PURE__ */ new Map([
|
|
591
|
+
["none", j],
|
|
592
|
+
["cupertino", F],
|
|
593
|
+
["material", Z],
|
|
594
|
+
["layout", V]
|
|
595
|
+
]), Nt = w((n) => ({
|
|
596
596
|
defaultTransitionName: "cupertino",
|
|
597
597
|
setDefaultTransitionName: (t) => n({ defaultTransitionName: t })
|
|
598
598
|
}));
|
|
599
|
-
function
|
|
599
|
+
function K({
|
|
600
600
|
name: n,
|
|
601
601
|
initial: t,
|
|
602
602
|
idle: e,
|
|
603
|
-
enter:
|
|
604
|
-
exit:
|
|
603
|
+
enter: s,
|
|
604
|
+
exit: a,
|
|
605
605
|
options: r
|
|
606
606
|
}) {
|
|
607
607
|
return {
|
|
@@ -611,23 +611,23 @@ function Z({
|
|
|
611
611
|
"IDLE-true": e,
|
|
612
612
|
"IDLE-false": e,
|
|
613
613
|
"PUSHING-true": e,
|
|
614
|
-
"PUSHING-false":
|
|
614
|
+
"PUSHING-false": s,
|
|
615
615
|
"REPLACING-true": e,
|
|
616
|
-
"REPLACING-false":
|
|
616
|
+
"REPLACING-false": s,
|
|
617
617
|
"POPPING-true": e,
|
|
618
|
-
"POPPING-false":
|
|
618
|
+
"POPPING-false": a,
|
|
619
619
|
"COMPLETED-true": e,
|
|
620
|
-
"COMPLETED-false":
|
|
620
|
+
"COMPLETED-false": s
|
|
621
621
|
},
|
|
622
622
|
...r
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function Lt({
|
|
626
626
|
name: n,
|
|
627
627
|
initial: t,
|
|
628
628
|
idle: e,
|
|
629
|
-
pushOnEnter:
|
|
630
|
-
pushOnExit:
|
|
629
|
+
pushOnEnter: s,
|
|
630
|
+
pushOnExit: a,
|
|
631
631
|
replaceOnEnter: r,
|
|
632
632
|
replaceOnExit: o,
|
|
633
633
|
popOnEnter: c,
|
|
@@ -642,8 +642,8 @@ function It({
|
|
|
642
642
|
variants: {
|
|
643
643
|
"IDLE-true": e,
|
|
644
644
|
"IDLE-false": e,
|
|
645
|
-
"PUSHING-false":
|
|
646
|
-
"PUSHING-true":
|
|
645
|
+
"PUSHING-false": a,
|
|
646
|
+
"PUSHING-true": s,
|
|
647
647
|
"REPLACING-false": o,
|
|
648
648
|
"REPLACING-true": r,
|
|
649
649
|
"POPPING-false": l,
|
|
@@ -654,16 +654,16 @@ function It({
|
|
|
654
654
|
...m
|
|
655
655
|
};
|
|
656
656
|
}
|
|
657
|
-
const
|
|
657
|
+
const I = "rgba(0, 0, 0, 0.3)", q = K({
|
|
658
658
|
name: "overlay",
|
|
659
659
|
initial: {
|
|
660
660
|
opacity: 0,
|
|
661
|
-
backgroundColor:
|
|
661
|
+
backgroundColor: I
|
|
662
662
|
},
|
|
663
663
|
idle: {
|
|
664
664
|
value: {
|
|
665
665
|
opacity: 0,
|
|
666
|
-
backgroundColor:
|
|
666
|
+
backgroundColor: I
|
|
667
667
|
},
|
|
668
668
|
options: {
|
|
669
669
|
duration: 0
|
|
@@ -671,25 +671,31 @@ const j = Z({
|
|
|
671
671
|
},
|
|
672
672
|
// Visible dim — applied when this screen is the one going behind / sitting
|
|
673
673
|
// behind a new active screen (PUSHING-false / REPLACING-false / COMPLETED-false).
|
|
674
|
+
// Duration + easing track cupertino's enter/exit so the dim arrives in
|
|
675
|
+
// lockstep with the underlying screen slide and there's no
|
|
676
|
+
// animation-vs-hold-by-fill window for the rest-rule handoff to race against.
|
|
674
677
|
enter: {
|
|
675
678
|
value: {
|
|
676
679
|
opacity: 1,
|
|
677
|
-
backgroundColor:
|
|
680
|
+
backgroundColor: I
|
|
678
681
|
},
|
|
679
682
|
options: {
|
|
680
|
-
duration: 0.
|
|
683
|
+
duration: 0.7,
|
|
684
|
+
ease: [0.32, 0.72, 0, 1]
|
|
681
685
|
}
|
|
682
686
|
},
|
|
683
687
|
// POPPING-false target: the previously-behind screen is returning to active.
|
|
684
688
|
// Fades from `enter` (visible dim) back to invisible so the overlay clears
|
|
685
|
-
// before the screen lands at COMPLETED-true (= idle).
|
|
689
|
+
// before the screen lands at COMPLETED-true (= idle). Mirrors cupertino's
|
|
690
|
+
// enterBack (the returning screen's slide-in) duration.
|
|
686
691
|
exit: {
|
|
687
692
|
value: {
|
|
688
693
|
opacity: 0,
|
|
689
|
-
backgroundColor:
|
|
694
|
+
backgroundColor: I
|
|
690
695
|
},
|
|
691
696
|
options: {
|
|
692
|
-
duration: 0.
|
|
697
|
+
duration: 0.6,
|
|
698
|
+
ease: [0.32, 0.72, 0, 1]
|
|
693
699
|
}
|
|
694
700
|
},
|
|
695
701
|
options: {
|
|
@@ -702,8 +708,8 @@ const j = Z({
|
|
|
702
708
|
duration: 0.3
|
|
703
709
|
}
|
|
704
710
|
),
|
|
705
|
-
onSwipe: (n, t, { animate: e, prevDecorator:
|
|
706
|
-
|
|
711
|
+
onSwipe: (n, t, { animate: e, prevDecorator: s }) => e(
|
|
712
|
+
s,
|
|
707
713
|
{
|
|
708
714
|
opacity: Math.max(0, 1 - t / 100)
|
|
709
715
|
},
|
|
@@ -721,7 +727,7 @@ const j = Z({
|
|
|
721
727
|
}
|
|
722
728
|
)
|
|
723
729
|
}
|
|
724
|
-
}),
|
|
730
|
+
}), Dt = /* @__PURE__ */ new Map([["overlay", q]]), k = {
|
|
725
731
|
"IDLE-true": "self",
|
|
726
732
|
"IDLE-false": "self",
|
|
727
733
|
"PUSHING-true": "initial",
|
|
@@ -732,7 +738,7 @@ const j = Z({
|
|
|
732
738
|
"POPPING-false": "PUSHING-false",
|
|
733
739
|
"COMPLETED-true": "self",
|
|
734
740
|
"COMPLETED-false": "self"
|
|
735
|
-
},
|
|
741
|
+
}, O = Object.keys(k), W = O, J = (n) => n.replace(/[^a-zA-Z0-9_-]/g, "_"), b = (n) => typeof n == "object" && n !== null && !Array.isArray(n), tt = /* @__PURE__ */ new Set([
|
|
736
742
|
"opacity",
|
|
737
743
|
"scale",
|
|
738
744
|
"scaleX",
|
|
@@ -769,7 +775,7 @@ const j = Z({
|
|
|
769
775
|
"strokeDashoffset",
|
|
770
776
|
"strokeMiterlimit",
|
|
771
777
|
"strokeWidth"
|
|
772
|
-
]),
|
|
778
|
+
]), et = (n, t) => t.startsWith("--") ? `${n}` : tt.has(t) ? `${n}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${n}deg` : `${n}px`, $ = (n, t) => typeof t == "number" ? et(t, n) : typeof t == "string" ? t : "", R = (n) => n.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`), _ = /* @__PURE__ */ new Set([
|
|
773
779
|
"x",
|
|
774
780
|
"y",
|
|
775
781
|
"z",
|
|
@@ -780,7 +786,7 @@ const j = Z({
|
|
|
780
786
|
"rotateX",
|
|
781
787
|
"rotateY",
|
|
782
788
|
"rotateZ"
|
|
783
|
-
]),
|
|
789
|
+
]), nt = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, st = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, at = /^1(\.0+)?$/, rt = (n, t) => n === "scale" || n === "scaleX" || n === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? at.test(t.trim()) : !1 : n === "rotate" || n === "rotateX" || n === "rotateY" || n === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? st.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? nt.test(t.trim()) : !1, ot = (n, t) => {
|
|
784
790
|
switch (n) {
|
|
785
791
|
case "x":
|
|
786
792
|
return `translateX(${t})`;
|
|
@@ -804,35 +810,35 @@ const j = Z({
|
|
|
804
810
|
default:
|
|
805
811
|
return "";
|
|
806
812
|
}
|
|
807
|
-
},
|
|
813
|
+
}, wt = (n) => {
|
|
808
814
|
const t = /* @__PURE__ */ new Set();
|
|
809
815
|
let e = !1;
|
|
810
|
-
const
|
|
811
|
-
if (
|
|
812
|
-
for (const r of Object.keys(
|
|
813
|
-
const o =
|
|
814
|
-
|
|
816
|
+
const s = (a) => {
|
|
817
|
+
if (b(a))
|
|
818
|
+
for (const r of Object.keys(a)) {
|
|
819
|
+
const o = a[r];
|
|
820
|
+
$(r, o) !== "" && (_.has(r) ? e = !0 : t.add(R(r)));
|
|
815
821
|
}
|
|
816
822
|
};
|
|
817
|
-
|
|
818
|
-
for (const
|
|
819
|
-
a
|
|
823
|
+
s(n.initial);
|
|
824
|
+
for (const a of Object.values(n.variants))
|
|
825
|
+
s(a.value);
|
|
820
826
|
return e && t.add("transform"), Array.from(t);
|
|
821
|
-
},
|
|
822
|
-
if (!
|
|
827
|
+
}, g = (n) => {
|
|
828
|
+
if (!b(n)) return [];
|
|
823
829
|
const t = [];
|
|
824
830
|
let e = !0;
|
|
825
|
-
const
|
|
826
|
-
for (const
|
|
827
|
-
const r = n[
|
|
828
|
-
o !== "" && (
|
|
831
|
+
const s = [];
|
|
832
|
+
for (const a of Object.keys(n)) {
|
|
833
|
+
const r = n[a], o = $(a, r);
|
|
834
|
+
o !== "" && (_.has(a) ? (t.push(ot(a, o)), rt(a, r) || (e = !1)) : s.push({ property: R(a), value: o }));
|
|
829
835
|
}
|
|
830
|
-
return t.length > 0 &&
|
|
836
|
+
return t.length > 0 && s.push({
|
|
831
837
|
property: "transform",
|
|
832
838
|
value: e ? "none" : t.join(" ")
|
|
833
|
-
}),
|
|
839
|
+
}), s;
|
|
834
840
|
}, E = (n) => n.map((t) => ` ${t.property}: ${t.value};`).join(`
|
|
835
|
-
`),
|
|
841
|
+
`), it = (n) => Array.isArray(n) ? n.length === 4 && n.every((t) => typeof t == "number") ? `cubic-bezier(${n.join(", ")})` : "linear" : typeof n == "string" ? {
|
|
836
842
|
linear: "linear",
|
|
837
843
|
easeIn: "ease-in",
|
|
838
844
|
easeOut: "ease-out",
|
|
@@ -842,22 +848,22 @@ const j = Z({
|
|
|
842
848
|
backIn: "cubic-bezier(0.31, 0.01, 0.66, -0.59)",
|
|
843
849
|
backOut: "cubic-bezier(0.33, 1.53, 0.69, 0.99)",
|
|
844
850
|
anticipate: "cubic-bezier(0.36, 0, 0.66, -0.56)"
|
|
845
|
-
}[n] ?? "ease" : "ease",
|
|
851
|
+
}[n] ?? "ease" : "ease", H = (n) => {
|
|
846
852
|
if (!n) return 0;
|
|
847
853
|
const t = n.duration;
|
|
848
854
|
return typeof t == "number" && t >= 0 ? t : 0;
|
|
849
|
-
},
|
|
850
|
-
const [e,
|
|
851
|
-
return `[data-flemo-screen][data-flemo-transition="${n}"][data-flemo-status="${e}"][data-flemo-active="${
|
|
852
|
-
},
|
|
853
|
-
const [e,
|
|
854
|
-
return `[data-flemo-decorator][data-flemo-decorator-name="${n}"][data-flemo-status="${e}"][data-flemo-active="${
|
|
855
|
-
},
|
|
856
|
-
const [e,
|
|
857
|
-
return `[data-flemo-bar][data-flemo-bar-transition="${n}"][data-flemo-bar-status="${e}"][data-flemo-bar-active="${
|
|
858
|
-
},
|
|
859
|
-
const o =
|
|
860
|
-
${
|
|
855
|
+
}, U = (n) => n && typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, A = (n, t) => {
|
|
856
|
+
const [e, s] = t.split("-");
|
|
857
|
+
return `[data-flemo-screen][data-flemo-transition="${n}"][data-flemo-status="${e}"][data-flemo-active="${s}"]`;
|
|
858
|
+
}, M = (n, t) => {
|
|
859
|
+
const [e, s] = t.split("-");
|
|
860
|
+
return `[data-flemo-decorator][data-flemo-decorator-name="${n}"][data-flemo-status="${e}"][data-flemo-active="${s}"]`;
|
|
861
|
+
}, ct = (n, t) => {
|
|
862
|
+
const [e, s] = t.split("-");
|
|
863
|
+
return `[data-flemo-bar][data-flemo-bar-transition="${n}"][data-flemo-bar-status="${e}"][data-flemo-bar-active="${s}"][data-flemo-bar-riding="true"]`;
|
|
864
|
+
}, ut = (n, t, e) => `flemo-${n}-${J(t)}-${e}`, C = (n, t, e, s, a, r) => {
|
|
865
|
+
const o = g(s), c = g(a.value), l = H(a.options), u = U(a.options), d = it(a.options?.ease), m = r(t, e), i = n === "screen" ? `${m},
|
|
866
|
+
${ct(t, e)}` : m;
|
|
861
867
|
if (c.length === 0 && o.length === 0)
|
|
862
868
|
return "";
|
|
863
869
|
if (l <= 0 && u <= 0)
|
|
@@ -865,7 +871,7 @@ ${ot(t, e)}` : m;
|
|
|
865
871
|
${E(c)}
|
|
866
872
|
animation: none;
|
|
867
873
|
}`;
|
|
868
|
-
const h =
|
|
874
|
+
const h = ut(n, t, e), P = [
|
|
869
875
|
`@keyframes ${h} {`,
|
|
870
876
|
" from {",
|
|
871
877
|
E(o).replace(/^/gm, " "),
|
|
@@ -882,140 +888,142 @@ ${E(c)}
|
|
|
882
888
|
u > 0 ? `${u}s` : null,
|
|
883
889
|
"both"
|
|
884
890
|
].filter(Boolean).join(" "), f = Array.from(
|
|
885
|
-
/* @__PURE__ */ new Set([...o.map((
|
|
891
|
+
/* @__PURE__ */ new Set([...o.map((N) => N.property), ...c.map((N) => N.property)])
|
|
886
892
|
), y = f.length > 0 ? ` will-change: ${f.join(", ")};
|
|
887
|
-
` : "",
|
|
893
|
+
` : "", S = e.split("-")[0], Y = `${i} {
|
|
888
894
|
animation: ${p};
|
|
889
|
-
${y}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
895
|
+
${y}${S === "PUSHING" || S === "REPLACING" ? ` contain: layout;
|
|
896
|
+
pointer-events: none;
|
|
897
|
+
` : ""}}`;
|
|
898
|
+
return `${P}
|
|
899
|
+
${Y}`;
|
|
900
|
+
}, x = (n, t, e, s) => {
|
|
901
|
+
const a = g(s.value);
|
|
902
|
+
return a.length === 0 ? "" : `${n(t, e)} {
|
|
903
|
+
${E(a)}
|
|
896
904
|
}`;
|
|
897
|
-
},
|
|
905
|
+
}, St = (n, t) => {
|
|
898
906
|
const e = [];
|
|
899
|
-
for (const
|
|
900
|
-
const
|
|
901
|
-
for (const r of
|
|
902
|
-
const o =
|
|
907
|
+
for (const s of n) {
|
|
908
|
+
const a = s.name;
|
|
909
|
+
for (const r of O) {
|
|
910
|
+
const o = s.variants[r], c = k[r];
|
|
903
911
|
if (c === "self") {
|
|
904
|
-
e.push(
|
|
912
|
+
e.push(x(A, a, r, o));
|
|
905
913
|
continue;
|
|
906
914
|
}
|
|
907
|
-
const l = c === "initial" ?
|
|
915
|
+
const l = c === "initial" ? s.initial : s.variants[c].value;
|
|
908
916
|
e.push(
|
|
909
|
-
|
|
917
|
+
C("screen", a, r, l, o, A)
|
|
910
918
|
);
|
|
911
919
|
}
|
|
912
920
|
}
|
|
913
|
-
for (const
|
|
914
|
-
const
|
|
915
|
-
for (const r of
|
|
916
|
-
const o =
|
|
921
|
+
for (const s of t) {
|
|
922
|
+
const a = s.name;
|
|
923
|
+
for (const r of W) {
|
|
924
|
+
const o = s.variants[r], c = k[r];
|
|
917
925
|
if (c === "self") {
|
|
918
|
-
e.push(M
|
|
926
|
+
e.push(x(M, a, r, o));
|
|
919
927
|
continue;
|
|
920
928
|
}
|
|
921
|
-
const l = c === "initial" ?
|
|
929
|
+
const l = c === "initial" ? s.initial : s.variants[c].value;
|
|
922
930
|
e.push(
|
|
923
|
-
|
|
931
|
+
C(
|
|
924
932
|
"decorator",
|
|
925
|
-
|
|
933
|
+
a,
|
|
926
934
|
r,
|
|
927
935
|
l,
|
|
928
936
|
o,
|
|
929
|
-
|
|
937
|
+
M
|
|
930
938
|
)
|
|
931
939
|
);
|
|
932
940
|
}
|
|
933
941
|
}
|
|
934
|
-
return e.filter((
|
|
942
|
+
return e.filter((s) => s.length > 0).join(`
|
|
935
943
|
|
|
936
944
|
`);
|
|
937
|
-
},
|
|
938
|
-
const e =
|
|
945
|
+
}, vt = (n, t) => {
|
|
946
|
+
const e = k[t];
|
|
939
947
|
if (e === "self") return !1;
|
|
940
|
-
const
|
|
941
|
-
if (
|
|
942
|
-
const o = e === "initial" ? n.initial : n.variants[e].value, c =
|
|
948
|
+
const s = n.variants[t], a = H(s.options), r = U(s.options);
|
|
949
|
+
if (a <= 0 && r <= 0) return !1;
|
|
950
|
+
const o = e === "initial" ? n.initial : n.variants[e].value, c = g(o), l = g(s.value);
|
|
943
951
|
return c.length > 0 || l.length > 0;
|
|
944
952
|
};
|
|
945
|
-
function
|
|
953
|
+
function At() {
|
|
946
954
|
return typeof document > "u";
|
|
947
955
|
}
|
|
948
|
-
function
|
|
949
|
-
return Array.isArray(n) ? n.find((e) =>
|
|
956
|
+
function lt(n, t) {
|
|
957
|
+
return Array.isArray(n) ? n.find((e) => v(e).regexp.test(t)) ?? "" : v(n).regexp.test(t) ? n : "";
|
|
950
958
|
}
|
|
951
|
-
function
|
|
952
|
-
const
|
|
953
|
-
return
|
|
959
|
+
function Mt(n, t, e) {
|
|
960
|
+
const s = lt(n, t), a = B(s)(t), r = new URLSearchParams(e), o = Object.fromEntries(r.entries());
|
|
961
|
+
return a ? { ...a.params, ...o } : {};
|
|
954
962
|
}
|
|
955
|
-
function
|
|
963
|
+
function Ct(n, t) {
|
|
956
964
|
const {
|
|
957
965
|
direction: e = "x",
|
|
958
|
-
markerSelector:
|
|
959
|
-
depthLimit:
|
|
966
|
+
markerSelector: s = "[data-swipe-at-edge]",
|
|
967
|
+
depthLimit: a = 24,
|
|
960
968
|
verifyByScroll: r = !1
|
|
961
|
-
} = t ?? {}, o =
|
|
969
|
+
} = t ?? {}, o = ft(n);
|
|
962
970
|
if (!o) return { element: null, hasMarker: !1 };
|
|
963
|
-
const c = o.closest?.(
|
|
964
|
-
if (c instanceof HTMLElement &&
|
|
971
|
+
const c = o.closest?.(s);
|
|
972
|
+
if (c instanceof HTMLElement && D(c, e) && (!r || G(c, e)))
|
|
965
973
|
return { element: c, hasMarker: !0 };
|
|
966
974
|
let l = o, u = 0;
|
|
967
|
-
for (; l && u <
|
|
968
|
-
if (
|
|
975
|
+
for (; l && u < a; ) {
|
|
976
|
+
if (D(l, e) && (!r || G(l, e)))
|
|
969
977
|
return { element: l, hasMarker: !1 };
|
|
970
978
|
l = l.parentElement, u++;
|
|
971
979
|
}
|
|
972
980
|
return { element: null, hasMarker: !1 };
|
|
973
981
|
}
|
|
974
|
-
function
|
|
982
|
+
function ft(n) {
|
|
975
983
|
if (!n) return null;
|
|
976
984
|
const t = n, e = typeof t.composedPath == "function" ? t.composedPath() : void 0;
|
|
977
985
|
if (e && e.length) {
|
|
978
|
-
for (const
|
|
979
|
-
if (
|
|
986
|
+
for (const s of e)
|
|
987
|
+
if (s instanceof HTMLElement) return s;
|
|
980
988
|
}
|
|
981
989
|
return n instanceof HTMLElement ? n : null;
|
|
982
990
|
}
|
|
983
|
-
function
|
|
991
|
+
function D(n, t) {
|
|
984
992
|
return t === "y" ? n.scrollHeight - n.clientHeight > 1 : n.scrollWidth - n.clientWidth > 1;
|
|
985
993
|
}
|
|
986
|
-
function
|
|
987
|
-
if (!
|
|
988
|
-
const e = window.getComputedStyle(n),
|
|
989
|
-
return
|
|
994
|
+
function G(n, t) {
|
|
995
|
+
if (!D(n, t) || typeof window > "u") return !1;
|
|
996
|
+
const e = window.getComputedStyle(n), s = t === "y" ? e.overflowY : e.overflowX;
|
|
997
|
+
return s === "auto" || s === "scroll" || s === "overlay";
|
|
990
998
|
}
|
|
991
999
|
export {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1000
|
+
yt as TaskManger,
|
|
1001
|
+
ut as animationName,
|
|
1002
|
+
G as canProgrammaticallyScroll,
|
|
1003
|
+
wt as collectAnimatedProperties,
|
|
1004
|
+
St as compileTransitionStyles,
|
|
1005
|
+
Et as consumeSelfInducedPop,
|
|
1006
|
+
K as createDecorator,
|
|
1007
|
+
Lt as createRawDecorator,
|
|
1008
|
+
kt as createRawTransition,
|
|
1009
|
+
T as createTransition,
|
|
1010
|
+
F as cupertino,
|
|
1011
|
+
Dt as decoratorMap,
|
|
1012
|
+
it as easingToCss,
|
|
1013
|
+
Ct as findScrollable,
|
|
1014
|
+
lt as getMatchedPathPattern,
|
|
1015
|
+
Mt as getParams,
|
|
1016
|
+
At as isServer,
|
|
1017
|
+
V as layout,
|
|
1018
|
+
It as markSelfInducedPop,
|
|
1019
|
+
Z as material,
|
|
1020
|
+
j as none,
|
|
1021
|
+
D as overflowsAxis,
|
|
1022
|
+
q as overlay,
|
|
1023
|
+
g as targetToDecls,
|
|
1024
|
+
Tt as transitionMap,
|
|
1025
|
+
Pt as useHistoryStore,
|
|
1026
|
+
gt as useNavigateStore,
|
|
1027
|
+
Nt as useTransitionStore,
|
|
1028
|
+
vt as variantHasAnimation
|
|
1021
1029
|
};
|
package/package.json
CHANGED