@flemo/core 1.2.0 → 1.3.0
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/history/store.d.ts +1 -0
- package/dist/index.mjs +29 -19
- package/package.json +1 -1
package/dist/history/store.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ interface HistoryStore {
|
|
|
13
13
|
replaceHistory: (index: number) => void;
|
|
14
14
|
popHistory: (index: number) => void;
|
|
15
15
|
popHistories: (count: number) => void;
|
|
16
|
+
setTransitionName: (index: number, transitionName: TransitionName) => void;
|
|
16
17
|
}
|
|
17
18
|
declare const useHistoryStore: import('zustand').UseBoundStore<import('zustand').StoreApi<HistoryStore>>;
|
|
18
19
|
export default useHistoryStore;
|
package/dist/index.mjs
CHANGED
|
@@ -68,7 +68,7 @@ class Q {
|
|
|
68
68
|
return new Promise((a, r) => {
|
|
69
69
|
this.taskQueue = this.taskQueue.then(async () => {
|
|
70
70
|
try {
|
|
71
|
-
const { control: o, validate: c, rollback: l, dependencies: u = [], delay: d } = e,
|
|
71
|
+
const { control: o, validate: c, rollback: l, dependencies: u = [], delay: d } = e, m = new AbortController(), i = {
|
|
72
72
|
id: s,
|
|
73
73
|
execute: t,
|
|
74
74
|
timestamp: Date.now(),
|
|
@@ -79,7 +79,7 @@ class Q {
|
|
|
79
79
|
validate: c,
|
|
80
80
|
rollback: l,
|
|
81
81
|
control: o,
|
|
82
|
-
abortController:
|
|
82
|
+
abortController: m
|
|
83
83
|
};
|
|
84
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 {
|
|
@@ -200,7 +200,17 @@ const yt = new Q(), Pt = w((n) => ({
|
|
|
200
200
|
histories: e.histories.filter((a, r) => r < s - t || r >= s)
|
|
201
201
|
};
|
|
202
202
|
});
|
|
203
|
-
}
|
|
203
|
+
},
|
|
204
|
+
// Override one entry's transition. Used by pop() to relabel the leaving top
|
|
205
|
+
// before the POPPING flip so the back animation uses the caller's
|
|
206
|
+
// `transitionName` from the first frame — its original transition never
|
|
207
|
+
// paints. Returns a fresh array so the renderer re-reads it.
|
|
208
|
+
setTransitionName: (t, e) => n((s) => {
|
|
209
|
+
const a = s.histories[t];
|
|
210
|
+
if (!a || a.transitionName === e) return {};
|
|
211
|
+
const r = s.histories.slice();
|
|
212
|
+
return r[t] = { ...a, transitionName: e }, { histories: r };
|
|
213
|
+
})
|
|
204
214
|
})), gt = w((n) => ({
|
|
205
215
|
status: "IDLE",
|
|
206
216
|
transitionTaskId: null,
|
|
@@ -254,7 +264,7 @@ function kt({
|
|
|
254
264
|
popOnExit: l,
|
|
255
265
|
completedOnExit: u,
|
|
256
266
|
completedOnEnter: d,
|
|
257
|
-
options:
|
|
267
|
+
options: m
|
|
258
268
|
}) {
|
|
259
269
|
return {
|
|
260
270
|
name: n,
|
|
@@ -271,7 +281,7 @@ function kt({
|
|
|
271
281
|
"COMPLETED-false": u,
|
|
272
282
|
"COMPLETED-true": d
|
|
273
283
|
},
|
|
274
|
-
...
|
|
284
|
+
...m
|
|
275
285
|
};
|
|
276
286
|
}
|
|
277
287
|
const X = (n, t, e) => {
|
|
@@ -433,7 +443,7 @@ const X = (n, t, e) => {
|
|
|
433
443
|
swipeDirection: "y",
|
|
434
444
|
onSwipeStart: async () => !0,
|
|
435
445
|
onSwipe: (n, t, { animate: e, currentScreen: s, onProgress: a }) => {
|
|
436
|
-
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),
|
|
446
|
+
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), p = Math.min(56, i);
|
|
437
447
|
return a?.(!0, 100), e(
|
|
438
448
|
s,
|
|
439
449
|
{
|
|
@@ -443,7 +453,7 @@ const X = (n, t, e) => {
|
|
|
443
453
|
{
|
|
444
454
|
duration: 0
|
|
445
455
|
}
|
|
446
|
-
),
|
|
456
|
+
), p;
|
|
447
457
|
},
|
|
448
458
|
onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
|
|
449
459
|
const { offset: o, velocity: c } = t, u = o.y > 56 || c.y > 20;
|
|
@@ -527,8 +537,8 @@ const X = (n, t, e) => {
|
|
|
527
537
|
swipeDirection: "y",
|
|
528
538
|
onSwipeStart: async () => !0,
|
|
529
539
|
onSwipe: (n, t, { animate: e, currentScreen: s, prevScreen: a, onProgress: r }) => {
|
|
530
|
-
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),
|
|
531
|
-
return r?.(!0,
|
|
540
|
+
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), p = Math.min(56, i);
|
|
541
|
+
return r?.(!0, p), e(
|
|
532
542
|
s,
|
|
533
543
|
{
|
|
534
544
|
y: i
|
|
@@ -539,11 +549,11 @@ const X = (n, t, e) => {
|
|
|
539
549
|
), e(
|
|
540
550
|
a,
|
|
541
551
|
{
|
|
542
|
-
y: -56 +
|
|
543
|
-
opacity:
|
|
552
|
+
y: -56 + p,
|
|
553
|
+
opacity: p / 56
|
|
544
554
|
},
|
|
545
555
|
{ duration: 0 }
|
|
546
|
-
),
|
|
556
|
+
), p;
|
|
547
557
|
},
|
|
548
558
|
onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
|
|
549
559
|
const { offset: o, velocity: c } = t, u = o.y > 56 || c.y > 20;
|
|
@@ -652,7 +662,7 @@ function Lt({
|
|
|
652
662
|
popOnExit: l,
|
|
653
663
|
completedOnEnter: u,
|
|
654
664
|
completedOnExit: d,
|
|
655
|
-
options:
|
|
665
|
+
options: m
|
|
656
666
|
}) {
|
|
657
667
|
return {
|
|
658
668
|
name: n,
|
|
@@ -669,7 +679,7 @@ function Lt({
|
|
|
669
679
|
"COMPLETED-false": d,
|
|
670
680
|
"COMPLETED-true": u
|
|
671
681
|
},
|
|
672
|
-
...
|
|
682
|
+
...m
|
|
673
683
|
};
|
|
674
684
|
}
|
|
675
685
|
const I = "rgba(0, 0, 0, 0.3)", q = K({
|
|
@@ -884,8 +894,8 @@ const I = "rgba(0, 0, 0, 0.3)", q = K({
|
|
|
884
894
|
const [e, s] = t.split("-");
|
|
885
895
|
return `[data-flemo-bar][data-flemo-bar-transition="${n}"][data-flemo-bar-status="${e}"][data-flemo-bar-active="${s}"][data-flemo-bar-riding="true"]`;
|
|
886
896
|
}, ut = (n, t, e) => `flemo-${n}-${J(t)}-${e}`, x = (n, t, e, s, a, r) => {
|
|
887
|
-
const o = g(s), c = g(a.value), l = H(a.options), u = U(a.options), d = it(a.options?.ease),
|
|
888
|
-
${ct(t, e)}` :
|
|
897
|
+
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},
|
|
898
|
+
${ct(t, e)}` : m;
|
|
889
899
|
if (c.length === 0 && o.length === 0)
|
|
890
900
|
return "";
|
|
891
901
|
if (l <= 0 && u <= 0)
|
|
@@ -893,8 +903,8 @@ ${ct(t, e)}` : p;
|
|
|
893
903
|
${E(c)}
|
|
894
904
|
animation: none;
|
|
895
905
|
}`;
|
|
896
|
-
const
|
|
897
|
-
`@keyframes ${
|
|
906
|
+
const p = ut(n, t, e), P = [
|
|
907
|
+
`@keyframes ${p} {`,
|
|
898
908
|
" from {",
|
|
899
909
|
E(o).replace(/^/gm, " "),
|
|
900
910
|
" }",
|
|
@@ -904,7 +914,7 @@ ${E(c)}
|
|
|
904
914
|
"}"
|
|
905
915
|
].join(`
|
|
906
916
|
`), h = [
|
|
907
|
-
`${
|
|
917
|
+
`${p}`,
|
|
908
918
|
`${l}s`,
|
|
909
919
|
d,
|
|
910
920
|
u > 0 ? `${u}s` : null,
|
package/package.json
CHANGED