@flemo/core 1.0.0 → 1.0.1
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 +153 -112
- package/dist/navigate/__tests__/store.test.d.ts +1 -0
- package/dist/transition/__tests__/compileTransitionStyles.test.d.ts +4 -0
- package/dist/transition/__tests__/createRawTransition.test.d.ts +6 -0
- package/dist/transition/__tests__/createTransition.test.d.ts +8 -0
- package/dist/transition/__tests__/presets.test.d.ts +1 -0
- package/dist/transition/__tests__/store.test.d.ts +1 -0
- package/dist/transition/cssTypes.d.ts +5 -4
- package/dist/transition/decorator/__tests__/createDecorator.test.d.ts +6 -0
- package/dist/transition/decorator/__tests__/createRawDecorator.test.d.ts +6 -0
- package/dist/transition/decorator/decorator.d.ts +2 -2
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { create as D } from "zustand";
|
|
2
|
-
import { pathToRegexp as w, match as
|
|
3
|
-
class
|
|
2
|
+
import { pathToRegexp as w, match as U } from "path-to-regexp";
|
|
3
|
+
class Y {
|
|
4
4
|
tasks = /* @__PURE__ */ new Map();
|
|
5
5
|
instanceId = Date.now().toString();
|
|
6
6
|
isLocked = !1;
|
|
@@ -68,7 +68,7 @@ class U {
|
|
|
68
68
|
return new Promise((a, r) => {
|
|
69
69
|
this.taskQueue = this.taskQueue.then(async () => {
|
|
70
70
|
try {
|
|
71
|
-
const { control: i, validate: c, rollback: l, dependencies: u = [], delay: d } = e,
|
|
71
|
+
const { control: i, validate: c, rollback: l, dependencies: u = [], delay: d } = e, m = new AbortController(), o = {
|
|
72
72
|
id: s,
|
|
73
73
|
execute: t,
|
|
74
74
|
timestamp: Date.now(),
|
|
@@ -79,9 +79,9 @@ class U {
|
|
|
79
79
|
validate: c,
|
|
80
80
|
rollback: l,
|
|
81
81
|
control: i,
|
|
82
|
-
abortController:
|
|
82
|
+
abortController: m
|
|
83
83
|
};
|
|
84
|
-
this.tasks.set(o.id, o), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(o), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((
|
|
84
|
+
this.tasks.set(o.id, o), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(o), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((g) => g.id !== o.id));
|
|
85
85
|
try {
|
|
86
86
|
if (!await this.acquireLock(o.id))
|
|
87
87
|
throw o.status = "FAILED", new Error("FAILED");
|
|
@@ -95,7 +95,7 @@ class U {
|
|
|
95
95
|
if (o.validate && !await o.validate())
|
|
96
96
|
throw o.status = "FAILED", new Error("FAILED");
|
|
97
97
|
d && d > 0 && await new Promise((f) => setTimeout(f, d));
|
|
98
|
-
const
|
|
98
|
+
const p = await o.execute(o.abortController);
|
|
99
99
|
if (o.abortController.signal.aborted) {
|
|
100
100
|
o.status = "COMPLETED", await this.onTaskStatusChange(o.id, "COMPLETED"), a({
|
|
101
101
|
success: !0,
|
|
@@ -109,37 +109,37 @@ class U {
|
|
|
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
|
-
o.status = "MANUAL_PENDING", o.manualResolver = { resolve: a, reject: r, result:
|
|
112
|
+
o.status = "MANUAL_PENDING", o.manualResolver = { resolve: a, reject: r, result: p }, this.pendingTaskQueue.push(o), await this.onTaskStatusChange(o.id, "MANUAL_PENDING");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
if (f.signal) {
|
|
116
|
-
o.status = "SIGNAL_PENDING", o.manualResolver = { resolve: a, reject: r, result:
|
|
116
|
+
o.status = "SIGNAL_PENDING", o.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(o.id), this.pendingTaskQueue.push(o), await this.onTaskStatusChange(o.id, "SIGNAL_PENDING");
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
if (f.condition && !await f.condition()) {
|
|
120
|
-
o.status = "MANUAL_PENDING", o.manualResolver = { resolve: a, reject: r, result:
|
|
120
|
+
o.status = "MANUAL_PENDING", o.manualResolver = { resolve: a, reject: r, result: p }, this.pendingTaskQueue.push(o), await this.onTaskStatusChange(o.id, "MANUAL_PENDING");
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
o.status = "COMPLETED", await this.onTaskStatusChange(o.id, "COMPLETED"), a({
|
|
125
125
|
success: !0,
|
|
126
|
-
result:
|
|
126
|
+
result: p,
|
|
127
127
|
taskId: o.id,
|
|
128
128
|
timestamp: Date.now(),
|
|
129
129
|
instanceId: this.instanceId
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
131
|
+
} catch (p) {
|
|
132
132
|
if (o.status = "FAILED", o.rollback)
|
|
133
133
|
try {
|
|
134
134
|
await o.rollback(), o.status = "ROLLEDBACK";
|
|
135
135
|
} catch {
|
|
136
136
|
}
|
|
137
|
-
throw await this.onTaskStatusChange(o.id, o.status),
|
|
137
|
+
throw await this.onTaskStatusChange(o.id, o.status), p;
|
|
138
138
|
} finally {
|
|
139
139
|
this.releaseLock(o.id);
|
|
140
140
|
}
|
|
141
|
-
} catch (
|
|
142
|
-
r(
|
|
141
|
+
} catch (g) {
|
|
142
|
+
r(g);
|
|
143
143
|
}
|
|
144
144
|
} catch (i) {
|
|
145
145
|
r(i);
|
|
@@ -173,7 +173,7 @@ class U {
|
|
|
173
173
|
await Promise.all(t.map((e) => this.resolveTask(e.id)));
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
const
|
|
176
|
+
const dt = new Y(), mt = D((n) => ({
|
|
177
177
|
index: -1,
|
|
178
178
|
histories: [],
|
|
179
179
|
addHistory: (t) => n((e) => ({
|
|
@@ -188,17 +188,17 @@ const ut = new U(), lt = D((n) => ({
|
|
|
188
188
|
index: e.index - 1,
|
|
189
189
|
histories: e.histories.filter((s, a) => a !== t)
|
|
190
190
|
}))
|
|
191
|
-
})),
|
|
191
|
+
})), ht = D((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
197
|
let N = 0;
|
|
198
|
-
function
|
|
198
|
+
function pt() {
|
|
199
199
|
N += 1;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function yt() {
|
|
202
202
|
return N > 0 ? (N -= 1, !0) : !1;
|
|
203
203
|
}
|
|
204
204
|
function k({
|
|
@@ -229,7 +229,7 @@ function k({
|
|
|
229
229
|
...c
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function gt({
|
|
233
233
|
name: n,
|
|
234
234
|
initial: t,
|
|
235
235
|
idle: e,
|
|
@@ -241,7 +241,7 @@ function mt({
|
|
|
241
241
|
popOnExit: l,
|
|
242
242
|
completedOnExit: u,
|
|
243
243
|
completedOnEnter: d,
|
|
244
|
-
options:
|
|
244
|
+
options: m
|
|
245
245
|
}) {
|
|
246
246
|
return {
|
|
247
247
|
name: n,
|
|
@@ -258,15 +258,15 @@ function mt({
|
|
|
258
258
|
"COMPLETED-false": u,
|
|
259
259
|
"COMPLETED-true": d
|
|
260
260
|
},
|
|
261
|
-
...
|
|
261
|
+
...m
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
const
|
|
264
|
+
const B = (n, t, e) => {
|
|
265
265
|
const [s, a] = t, [r, i] = e;
|
|
266
266
|
if (a === s) return r;
|
|
267
267
|
const c = (n - s) / (a - s);
|
|
268
268
|
return r + c * (i - r);
|
|
269
|
-
},
|
|
269
|
+
}, Q = k({
|
|
270
270
|
name: "cupertino",
|
|
271
271
|
initial: {
|
|
272
272
|
x: "100%"
|
|
@@ -320,7 +320,7 @@ const Y = (n, t, e) => {
|
|
|
320
320
|
swipeDirection: "x",
|
|
321
321
|
onSwipeStart: async () => !0,
|
|
322
322
|
onSwipe: (n, t, { animate: e, currentScreen: s, prevScreen: a, onProgress: r }) => {
|
|
323
|
-
const { offset: i } = t, c = i.x, l =
|
|
323
|
+
const { offset: i } = t, c = i.x, l = B(c, [0, window.innerWidth], [0, 100]);
|
|
324
324
|
return r?.(!0, l), e(
|
|
325
325
|
s,
|
|
326
326
|
{
|
|
@@ -365,12 +365,12 @@ const Y = (n, t, e) => {
|
|
|
365
365
|
]), u;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
}),
|
|
368
|
+
}), X = (n, t, e) => {
|
|
369
369
|
const [s, a] = t, [r, i] = e;
|
|
370
370
|
if (a === s) return r;
|
|
371
371
|
const c = (n - s) / (a - s);
|
|
372
372
|
return r + c * (i - r);
|
|
373
|
-
},
|
|
373
|
+
}, F = k({
|
|
374
374
|
name: "layout",
|
|
375
375
|
initial: {
|
|
376
376
|
opacity: 0.97
|
|
@@ -420,7 +420,7 @@ const Y = (n, t, e) => {
|
|
|
420
420
|
swipeDirection: "y",
|
|
421
421
|
onSwipeStart: async () => !0,
|
|
422
422
|
onSwipe: (n, t, { animate: e, currentScreen: s, onProgress: a }) => {
|
|
423
|
-
const { offset: r } = t, i = r.y, c = Math.max(0, Math.min(56, i)), l =
|
|
423
|
+
const { offset: r } = t, i = r.y, c = Math.max(0, Math.min(56, i)), l = X(c, [0, 56], [1, 0.96]), u = Math.max(0, i - 56), d = Math.min(1, u / 160), m = Math.sqrt(d) * 12, o = Math.max(0, c + m), h = Math.min(56, o);
|
|
424
424
|
return a?.(!0, 100), e(
|
|
425
425
|
s,
|
|
426
426
|
{
|
|
@@ -430,7 +430,7 @@ const Y = (n, t, e) => {
|
|
|
430
430
|
{
|
|
431
431
|
duration: 0
|
|
432
432
|
}
|
|
433
|
-
),
|
|
433
|
+
), h;
|
|
434
434
|
},
|
|
435
435
|
onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
|
|
436
436
|
const { offset: i, velocity: c } = t, u = i.y > 56 || c.y > 20;
|
|
@@ -458,7 +458,7 @@ const Y = (n, t, e) => {
|
|
|
458
458
|
]), u;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
}),
|
|
461
|
+
}), z = k({
|
|
462
462
|
name: "material",
|
|
463
463
|
initial: {
|
|
464
464
|
y: "100%"
|
|
@@ -511,8 +511,8 @@ const Y = (n, t, e) => {
|
|
|
511
511
|
swipeDirection: "y",
|
|
512
512
|
onSwipeStart: async () => !0,
|
|
513
513
|
onSwipe: (n, t, { animate: e, currentScreen: s, prevScreen: a, onProgress: r }) => {
|
|
514
|
-
const { offset: i } = t, c = i.y, l = Math.max(0, Math.min(56, c)), u = Math.max(0, c - 56), d = Math.min(1, u / 160),
|
|
515
|
-
return r?.(!0,
|
|
514
|
+
const { offset: i } = t, c = i.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, o = Math.max(0, l + m), h = Math.min(56, o);
|
|
515
|
+
return r?.(!0, h), e(
|
|
516
516
|
s,
|
|
517
517
|
{
|
|
518
518
|
y: o
|
|
@@ -523,10 +523,10 @@ const Y = (n, t, e) => {
|
|
|
523
523
|
), e(
|
|
524
524
|
a,
|
|
525
525
|
{
|
|
526
|
-
y: -56 +
|
|
526
|
+
y: -56 + h
|
|
527
527
|
},
|
|
528
528
|
{ duration: 0 }
|
|
529
|
-
),
|
|
529
|
+
), h;
|
|
530
530
|
},
|
|
531
531
|
onSwipeEnd: async (n, t, { animate: e, currentScreen: s, prevScreen: a, onStart: r }) => {
|
|
532
532
|
const { offset: i, velocity: c } = t, u = i.y > 56 || c.y > 20;
|
|
@@ -587,16 +587,16 @@ const Y = (n, t, e) => {
|
|
|
587
587
|
duration: 0
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
|
-
}),
|
|
590
|
+
}), Pt = /* @__PURE__ */ new Map([
|
|
591
591
|
["none", V],
|
|
592
|
-
["cupertino",
|
|
593
|
-
["material",
|
|
594
|
-
["layout",
|
|
595
|
-
]),
|
|
592
|
+
["cupertino", Q],
|
|
593
|
+
["material", z],
|
|
594
|
+
["layout", F]
|
|
595
|
+
]), Et = D((n) => ({
|
|
596
596
|
defaultTransitionName: "cupertino",
|
|
597
597
|
setDefaultTransitionName: (t) => n({ defaultTransitionName: t })
|
|
598
598
|
}));
|
|
599
|
-
function
|
|
599
|
+
function Z({
|
|
600
600
|
name: n,
|
|
601
601
|
initial: t,
|
|
602
602
|
enter: e,
|
|
@@ -621,7 +621,7 @@ function j({
|
|
|
621
621
|
...a
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function It({
|
|
625
625
|
name: n,
|
|
626
626
|
initial: t,
|
|
627
627
|
idle: e,
|
|
@@ -633,7 +633,7 @@ function Pt({
|
|
|
633
633
|
popOnExit: l,
|
|
634
634
|
completedOnEnter: u,
|
|
635
635
|
completedOnExit: d,
|
|
636
|
-
options:
|
|
636
|
+
options: m
|
|
637
637
|
}) {
|
|
638
638
|
return {
|
|
639
639
|
name: n,
|
|
@@ -650,10 +650,10 @@ function Pt({
|
|
|
650
650
|
"COMPLETED-false": d,
|
|
651
651
|
"COMPLETED-true": u
|
|
652
652
|
},
|
|
653
|
-
...
|
|
653
|
+
...m
|
|
654
654
|
};
|
|
655
655
|
}
|
|
656
|
-
const
|
|
656
|
+
const j = Z({
|
|
657
657
|
name: "overlay",
|
|
658
658
|
initial: {
|
|
659
659
|
opacity: 0,
|
|
@@ -706,7 +706,7 @@ const z = j({
|
|
|
706
706
|
}
|
|
707
707
|
)
|
|
708
708
|
}
|
|
709
|
-
}),
|
|
709
|
+
}), kt = /* @__PURE__ */ new Map([["overlay", j]]), I = {
|
|
710
710
|
"IDLE-true": "self",
|
|
711
711
|
"IDLE-false": "self",
|
|
712
712
|
"PUSHING-true": "initial",
|
|
@@ -717,7 +717,44 @@ const z = j({
|
|
|
717
717
|
"POPPING-false": "PUSHING-false",
|
|
718
718
|
"COMPLETED-true": "self",
|
|
719
719
|
"COMPLETED-false": "self"
|
|
720
|
-
},
|
|
720
|
+
}, C = Object.keys(I), K = C, q = (n) => n.replace(/[^a-zA-Z0-9_-]/g, "_"), G = (n) => typeof n == "object" && n !== null && !Array.isArray(n), W = /* @__PURE__ */ new Set([
|
|
721
|
+
"opacity",
|
|
722
|
+
"scale",
|
|
723
|
+
"scaleX",
|
|
724
|
+
"scaleY",
|
|
725
|
+
"scaleZ",
|
|
726
|
+
"aspectRatio",
|
|
727
|
+
"columnCount",
|
|
728
|
+
"columns",
|
|
729
|
+
"flex",
|
|
730
|
+
"flexGrow",
|
|
731
|
+
"flexShrink",
|
|
732
|
+
"fontWeight",
|
|
733
|
+
"gridArea",
|
|
734
|
+
"gridColumn",
|
|
735
|
+
"gridColumnEnd",
|
|
736
|
+
"gridColumnStart",
|
|
737
|
+
"gridRow",
|
|
738
|
+
"gridRowEnd",
|
|
739
|
+
"gridRowStart",
|
|
740
|
+
"lineHeight",
|
|
741
|
+
"lineClamp",
|
|
742
|
+
"order",
|
|
743
|
+
"orphans",
|
|
744
|
+
"tabSize",
|
|
745
|
+
"widows",
|
|
746
|
+
"zIndex",
|
|
747
|
+
"zoom",
|
|
748
|
+
// SVG numerics
|
|
749
|
+
"fillOpacity",
|
|
750
|
+
"floodOpacity",
|
|
751
|
+
"stopOpacity",
|
|
752
|
+
"strokeOpacity",
|
|
753
|
+
"strokeDasharray",
|
|
754
|
+
"strokeDashoffset",
|
|
755
|
+
"strokeMiterlimit",
|
|
756
|
+
"strokeWidth"
|
|
757
|
+
]), J = (n, t) => t.startsWith("--") ? `${n}` : W.has(t) ? `${n}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${n}deg` : `${n}px`, O = (n, t) => typeof t == "number" ? J(t, n) : typeof t == "string" ? t : "", b = (n) => n.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`), $ = /* @__PURE__ */ new Set([
|
|
721
758
|
"x",
|
|
722
759
|
"y",
|
|
723
760
|
"z",
|
|
@@ -728,7 +765,7 @@ const z = j({
|
|
|
728
765
|
"rotateX",
|
|
729
766
|
"rotateY",
|
|
730
767
|
"rotateZ"
|
|
731
|
-
]),
|
|
768
|
+
]), tt = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, et = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, nt = /^1(\.0+)?$/, st = (n, t) => n === "scale" || n === "scaleX" || n === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? nt.test(t.trim()) : !1 : n === "rotate" || n === "rotateX" || n === "rotateY" || n === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? et.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? tt.test(t.trim()) : !1, at = (n, t) => {
|
|
732
769
|
switch (n) {
|
|
733
770
|
case "x":
|
|
734
771
|
return `translateX(${t})`;
|
|
@@ -752,11 +789,11 @@ const z = j({
|
|
|
752
789
|
default:
|
|
753
790
|
return "";
|
|
754
791
|
}
|
|
755
|
-
},
|
|
792
|
+
}, Tt = (n) => {
|
|
756
793
|
const t = /* @__PURE__ */ new Set();
|
|
757
794
|
let e = !1;
|
|
758
795
|
const s = (a) => {
|
|
759
|
-
if (
|
|
796
|
+
if (G(a))
|
|
760
797
|
for (const r of Object.keys(a)) {
|
|
761
798
|
const i = a[r];
|
|
762
799
|
O(r, i) !== "" && ($.has(r) ? e = !0 : t.add(b(r)));
|
|
@@ -766,21 +803,21 @@ const z = j({
|
|
|
766
803
|
for (const a of Object.values(n.variants))
|
|
767
804
|
s(a.value);
|
|
768
805
|
return e && t.add("transform"), Array.from(t);
|
|
769
|
-
},
|
|
770
|
-
if (!
|
|
806
|
+
}, P = (n) => {
|
|
807
|
+
if (!G(n)) return [];
|
|
771
808
|
const t = [];
|
|
772
809
|
let e = !0;
|
|
773
810
|
const s = [];
|
|
774
811
|
for (const a of Object.keys(n)) {
|
|
775
812
|
const r = n[a], i = O(a, r);
|
|
776
|
-
i !== "" && ($.has(a) ? (t.push(
|
|
813
|
+
i !== "" && ($.has(a) ? (t.push(at(a, i)), st(a, r) || (e = !1)) : s.push({ property: b(a), value: i }));
|
|
777
814
|
}
|
|
778
815
|
return t.length > 0 && s.push({
|
|
779
816
|
property: "transform",
|
|
780
817
|
value: e ? "none" : t.join(" ")
|
|
781
818
|
}), s;
|
|
782
819
|
}, E = (n) => n.map((t) => ` ${t.property}: ${t.value};`).join(`
|
|
783
|
-
`),
|
|
820
|
+
`), rt = (n) => Array.isArray(n) ? n.length === 4 && n.every((t) => typeof t == "number") ? `cubic-bezier(${n.join(", ")})` : "linear" : typeof n == "string" ? {
|
|
784
821
|
linear: "linear",
|
|
785
822
|
easeIn: "ease-in",
|
|
786
823
|
easeOut: "ease-out",
|
|
@@ -794,23 +831,27 @@ const z = j({
|
|
|
794
831
|
if (!n) return 0;
|
|
795
832
|
const t = n.duration;
|
|
796
833
|
return typeof t == "number" && t >= 0 ? t : 0;
|
|
797
|
-
}, _ = (n) => n && typeof n.delay == "number" && n.delay > 0 ? n.delay : 0,
|
|
834
|
+
}, _ = (n) => n && typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, S = (n, t) => {
|
|
798
835
|
const [e, s] = t.split("-");
|
|
799
836
|
return `[data-flemo-screen][data-flemo-transition="${n}"][data-flemo-status="${e}"][data-flemo-active="${s}"]`;
|
|
800
|
-
},
|
|
837
|
+
}, v = (n, t) => {
|
|
801
838
|
const [e, s] = t.split("-");
|
|
802
839
|
return `[data-flemo-decorator][data-flemo-decorator-name="${n}"][data-flemo-status="${e}"][data-flemo-active="${s}"]`;
|
|
803
|
-
},
|
|
804
|
-
const
|
|
840
|
+
}, it = (n, t) => {
|
|
841
|
+
const [e, s] = t.split("-");
|
|
842
|
+
return `[data-flemo-bar][data-flemo-bar-transition="${n}"][data-flemo-bar-status="${e}"][data-flemo-bar-active="${s}"][data-flemo-bar-riding="true"]`;
|
|
843
|
+
}, ot = (n, t, e) => `flemo-${n}-${q(t)}-${e}`, A = (n, t, e, s, a, r) => {
|
|
844
|
+
const i = P(s), c = P(a.value), l = R(a.options), u = _(a.options), d = rt(a.options?.ease), m = r(t, e), o = n === "screen" ? `${m},
|
|
845
|
+
${it(t, e)}` : m;
|
|
805
846
|
if (c.length === 0 && i.length === 0)
|
|
806
847
|
return "";
|
|
807
848
|
if (l <= 0 && u <= 0)
|
|
808
|
-
return c.length === 0 ? "" : `${
|
|
849
|
+
return c.length === 0 ? "" : `${o} {
|
|
809
850
|
${E(c)}
|
|
810
851
|
animation: none;
|
|
811
852
|
}`;
|
|
812
|
-
const
|
|
813
|
-
`@keyframes ${
|
|
853
|
+
const h = ot(n, t, e), g = [
|
|
854
|
+
`@keyframes ${h} {`,
|
|
814
855
|
" from {",
|
|
815
856
|
E(i).replace(/^/gm, " "),
|
|
816
857
|
" }",
|
|
@@ -819,58 +860,58 @@ ${E(c)}
|
|
|
819
860
|
" }",
|
|
820
861
|
"}"
|
|
821
862
|
].join(`
|
|
822
|
-
`),
|
|
823
|
-
`${
|
|
863
|
+
`), p = [
|
|
864
|
+
`${h}`,
|
|
824
865
|
`${l}s`,
|
|
825
866
|
d,
|
|
826
867
|
u > 0 ? `${u}s` : null,
|
|
827
868
|
"both"
|
|
828
|
-
].filter(Boolean).join(" "),
|
|
869
|
+
].filter(Boolean).join(" "), f = Array.from(
|
|
829
870
|
/* @__PURE__ */ new Set([...i.map((T) => T.property), ...c.map((T) => T.property)])
|
|
830
|
-
),
|
|
831
|
-
` : "",
|
|
832
|
-
animation: ${
|
|
833
|
-
${
|
|
834
|
-
return `${
|
|
835
|
-
${
|
|
836
|
-
},
|
|
837
|
-
const a =
|
|
871
|
+
), y = f.length > 0 ? ` will-change: ${f.join(", ")};
|
|
872
|
+
` : "", H = `${o} {
|
|
873
|
+
animation: ${p};
|
|
874
|
+
${y}}`;
|
|
875
|
+
return `${g}
|
|
876
|
+
${H}`;
|
|
877
|
+
}, M = (n, t, e, s) => {
|
|
878
|
+
const a = P(s.value);
|
|
838
879
|
return a.length === 0 ? "" : `${n(t, e)} {
|
|
839
880
|
${E(a)}
|
|
840
881
|
}`;
|
|
841
|
-
},
|
|
882
|
+
}, Nt = (n, t) => {
|
|
842
883
|
const e = [];
|
|
843
884
|
for (const s of n) {
|
|
844
885
|
const a = s.name;
|
|
845
|
-
for (const r of
|
|
886
|
+
for (const r of C) {
|
|
846
887
|
const i = s.variants[r], c = I[r];
|
|
847
888
|
if (c === "self") {
|
|
848
|
-
e.push(S
|
|
889
|
+
e.push(M(S, a, r, i));
|
|
849
890
|
continue;
|
|
850
891
|
}
|
|
851
892
|
const l = c === "initial" ? s.initial : s.variants[c].value;
|
|
852
893
|
e.push(
|
|
853
|
-
|
|
894
|
+
A("screen", a, r, l, i, S)
|
|
854
895
|
);
|
|
855
896
|
}
|
|
856
897
|
}
|
|
857
898
|
for (const s of t) {
|
|
858
899
|
const a = s.name;
|
|
859
|
-
for (const r of
|
|
900
|
+
for (const r of K) {
|
|
860
901
|
const i = s.variants[r], c = I[r];
|
|
861
902
|
if (c === "self") {
|
|
862
|
-
e.push(
|
|
903
|
+
e.push(M(v, a, r, i));
|
|
863
904
|
continue;
|
|
864
905
|
}
|
|
865
906
|
const l = c === "initial" ? s.initial : s.variants[c].value;
|
|
866
907
|
e.push(
|
|
867
|
-
|
|
908
|
+
A(
|
|
868
909
|
"decorator",
|
|
869
910
|
a,
|
|
870
911
|
r,
|
|
871
912
|
l,
|
|
872
913
|
i,
|
|
873
|
-
|
|
914
|
+
v
|
|
874
915
|
)
|
|
875
916
|
);
|
|
876
917
|
}
|
|
@@ -878,31 +919,31 @@ ${E(a)}
|
|
|
878
919
|
return e.filter((s) => s.length > 0).join(`
|
|
879
920
|
|
|
880
921
|
`);
|
|
881
|
-
},
|
|
922
|
+
}, Lt = (n, t) => {
|
|
882
923
|
const e = I[t];
|
|
883
924
|
if (e === "self") return !1;
|
|
884
925
|
const s = n.variants[t], a = R(s.options), r = _(s.options);
|
|
885
926
|
if (a <= 0 && r <= 0) return !1;
|
|
886
|
-
const i = e === "initial" ? n.initial : n.variants[e].value, c =
|
|
927
|
+
const i = e === "initial" ? n.initial : n.variants[e].value, c = P(i), l = P(s.value);
|
|
887
928
|
return c.length > 0 || l.length > 0;
|
|
888
929
|
};
|
|
889
|
-
function
|
|
930
|
+
function Dt() {
|
|
890
931
|
return typeof document > "u";
|
|
891
932
|
}
|
|
892
|
-
function
|
|
933
|
+
function ct(n, t) {
|
|
893
934
|
return Array.isArray(n) ? n.find((e) => w(e).regexp.test(t)) ?? "" : w(n).regexp.test(t) ? n : "";
|
|
894
935
|
}
|
|
895
|
-
function
|
|
896
|
-
const s =
|
|
936
|
+
function wt(n, t, e) {
|
|
937
|
+
const s = ct(n, t), a = U(s)(t), r = new URLSearchParams(e), i = Object.fromEntries(r.entries());
|
|
897
938
|
return a ? { ...a.params, ...i } : {};
|
|
898
939
|
}
|
|
899
|
-
function
|
|
940
|
+
function St(n, t) {
|
|
900
941
|
const {
|
|
901
942
|
direction: e = "x",
|
|
902
943
|
markerSelector: s = "[data-swipe-at-edge]",
|
|
903
944
|
depthLimit: a = 24,
|
|
904
945
|
verifyByScroll: r = !1
|
|
905
|
-
} = t ?? {}, i =
|
|
946
|
+
} = t ?? {}, i = ut(n);
|
|
906
947
|
if (!i) return { element: null, hasMarker: !1 };
|
|
907
948
|
const c = i.closest?.(s);
|
|
908
949
|
if (c instanceof HTMLElement && L(c, e) && (!r || x(c, e)))
|
|
@@ -915,7 +956,7 @@ function Lt(n, t) {
|
|
|
915
956
|
}
|
|
916
957
|
return { element: null, hasMarker: !1 };
|
|
917
958
|
}
|
|
918
|
-
function
|
|
959
|
+
function ut(n) {
|
|
919
960
|
if (!n) return null;
|
|
920
961
|
const t = n, e = typeof t.composedPath == "function" ? t.composedPath() : void 0;
|
|
921
962
|
if (e && e.length) {
|
|
@@ -933,33 +974,33 @@ function x(n, t) {
|
|
|
933
974
|
return s === "auto" || s === "scroll" || s === "overlay";
|
|
934
975
|
}
|
|
935
976
|
export {
|
|
936
|
-
|
|
937
|
-
|
|
977
|
+
dt as TaskManger,
|
|
978
|
+
ot as animationName,
|
|
938
979
|
x as canProgrammaticallyScroll,
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
980
|
+
Tt as collectAnimatedProperties,
|
|
981
|
+
Nt as compileTransitionStyles,
|
|
982
|
+
yt as consumeSelfInducedPop,
|
|
983
|
+
Z as createDecorator,
|
|
984
|
+
It as createRawDecorator,
|
|
985
|
+
gt as createRawTransition,
|
|
945
986
|
k as createTransition,
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
987
|
+
Q as cupertino,
|
|
988
|
+
kt as decoratorMap,
|
|
989
|
+
rt as easingToCss,
|
|
990
|
+
St as findScrollable,
|
|
991
|
+
ct as getMatchedPathPattern,
|
|
992
|
+
wt as getParams,
|
|
993
|
+
Dt as isServer,
|
|
994
|
+
F as layout,
|
|
995
|
+
pt as markSelfInducedPop,
|
|
996
|
+
z as material,
|
|
956
997
|
V as none,
|
|
957
998
|
L as overflowsAxis,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
999
|
+
j as overlay,
|
|
1000
|
+
P as targetToDecls,
|
|
1001
|
+
Pt as transitionMap,
|
|
1002
|
+
mt as useHistoryStore,
|
|
1003
|
+
ht as useNavigateStore,
|
|
1004
|
+
Et as useTransitionStore,
|
|
1005
|
+
Lt as variantHasAnimation
|
|
965
1006
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,10 @@ declare module '../typing' {
|
|
|
2
2
|
interface RegisterTransition {
|
|
3
3
|
"custom-fade-blur": "custom-fade-blur";
|
|
4
4
|
"custom-slide-fade": "custom-slide-fade";
|
|
5
|
+
"custom-rich-css": "custom-rich-css";
|
|
6
|
+
"custom-unitless": "custom-unitless";
|
|
7
|
+
"custom-lengths": "custom-lengths";
|
|
8
|
+
"custom-css-vars": "custom-css-vars";
|
|
5
9
|
}
|
|
6
10
|
}
|
|
7
11
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { Properties } from 'csstype';
|
|
1
2
|
export type AnimationEasing = string | readonly [number, number, number, number] | [number, number, number, number];
|
|
2
3
|
export interface AnimationOptions {
|
|
3
4
|
duration?: number;
|
|
4
5
|
ease?: AnimationEasing;
|
|
5
6
|
delay?: number;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
type CssProperties = Omit<Properties<string | number, string | number>, "rotate" | "scale" | "translate">;
|
|
9
|
+
export interface TransitionTarget extends CssProperties {
|
|
8
10
|
x?: string | number;
|
|
9
11
|
y?: string | number;
|
|
10
12
|
z?: string | number;
|
|
@@ -15,8 +17,7 @@ export interface TransitionTarget {
|
|
|
15
17
|
rotateX?: string | number;
|
|
16
18
|
rotateY?: string | number;
|
|
17
19
|
rotateZ?: string | number;
|
|
18
|
-
|
|
19
|
-
backgroundColor?: string;
|
|
20
|
-
[key: string]: string | number | undefined;
|
|
20
|
+
[key: `--${string}`]: string | number | undefined;
|
|
21
21
|
}
|
|
22
22
|
export type InitialTarget = TransitionTarget;
|
|
23
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Decorator } from './typing';
|
|
2
|
-
export declare const decoratorMap: Map<
|
|
1
|
+
import { Decorator, DecoratorName } from './typing';
|
|
2
|
+
export declare const decoratorMap: Map<DecoratorName, Decorator>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemo/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Framework-agnostic primitives for flemo: history, navigation, transitions, task manager.",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^24.3.0",
|
|
40
|
+
"csstype": "^3.2.3",
|
|
40
41
|
"eslint": "^9.33.0",
|
|
41
42
|
"jsdom": "^25.0.1",
|
|
42
43
|
"typescript": "^5.9.2",
|