flemo 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/index.d.ts +1 -0
- package/dist/index.mjs +805 -513
- package/dist/screen/LayoutConfig.d.ts +4 -0
- package/dist/transition/typing.d.ts +4 -2
- package/package.json +3 -3
- package/dist/vendor-C8cPYUOQ.js +0 -299
|
@@ -6,8 +6,10 @@ export interface RegisterTransition {
|
|
|
6
6
|
export type TransitionName = RegisterTransition[keyof RegisterTransition] | "none" | "cupertino" | "material" | "layout";
|
|
7
7
|
export type TransitionVariant = `${NavigateStatus}-${boolean}`;
|
|
8
8
|
export type TransitionVariantValue = {
|
|
9
|
-
value: Target
|
|
10
|
-
options: AnimationOptions
|
|
9
|
+
value: Omit<Target, "transitionDuration" | "transitionDelay" | "transitionTimingFunction" | "transitionBehavior" | "transitionEnd" | "transitionProperty">;
|
|
10
|
+
options: Omit<AnimationOptions, "delay"> & {
|
|
11
|
+
delay?: number;
|
|
12
|
+
};
|
|
11
13
|
};
|
|
12
14
|
export type TransitionOptions = {
|
|
13
15
|
decoratorName?: DecoratorName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flemo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A modern React router library with built-in motion animations and smooth transitions",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/node": "^24.3.0",
|
|
51
51
|
"@types/react": "^19.1.10",
|
|
52
52
|
"@types/react-dom": "^19.1.7",
|
|
53
|
-
"@vitejs/plugin-react-swc": "^4.0.
|
|
53
|
+
"@vitejs/plugin-react-swc": "^4.0.1",
|
|
54
54
|
"eslint": "^9.33.0",
|
|
55
55
|
"eslint-config-prettier": "^10.1.8",
|
|
56
56
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"prettier": "^3.6.2",
|
|
65
65
|
"typescript": "^5.9.2",
|
|
66
66
|
"typescript-eslint": "^8.39.1",
|
|
67
|
-
"vite": "^7.1.
|
|
67
|
+
"vite": "^7.1.5",
|
|
68
68
|
"vite-plugin-dts": "^4.5.4"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
package/dist/vendor-C8cPYUOQ.js
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import C from "react";
|
|
2
|
-
var d = {}, N;
|
|
3
|
-
function H() {
|
|
4
|
-
if (N) return d;
|
|
5
|
-
N = 1, Object.defineProperty(d, "__esModule", { value: !0 }), d.TokenData = void 0, d.parse = m, d.compile = R, d.match = M, d.pathToRegexp = j, d.stringify = k;
|
|
6
|
-
const c = "/", a = (n) => n, l = /^[$_\p{ID_Start}]$/u, h = /^[$\u200c\u200d\p{ID_Continue}]$/u, $ = "https://git.new/pathToRegexpError", b = {
|
|
7
|
-
// Groups.
|
|
8
|
-
"{": "{",
|
|
9
|
-
"}": "}",
|
|
10
|
-
// Reserved.
|
|
11
|
-
"(": "(",
|
|
12
|
-
")": ")",
|
|
13
|
-
"[": "[",
|
|
14
|
-
"]": "]",
|
|
15
|
-
"+": "+",
|
|
16
|
-
"?": "?",
|
|
17
|
-
"!": "!"
|
|
18
|
-
};
|
|
19
|
-
function _(n) {
|
|
20
|
-
return n.replace(/[{}()\[\]+?!:*]/g, "\\$&");
|
|
21
|
-
}
|
|
22
|
-
function f(n) {
|
|
23
|
-
return n.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
|
|
24
|
-
}
|
|
25
|
-
function* I(n) {
|
|
26
|
-
const t = [...n];
|
|
27
|
-
let e = 0;
|
|
28
|
-
function o() {
|
|
29
|
-
let r = "";
|
|
30
|
-
if (l.test(t[++e]))
|
|
31
|
-
for (r += t[e]; h.test(t[++e]); )
|
|
32
|
-
r += t[e];
|
|
33
|
-
else if (t[e] === '"') {
|
|
34
|
-
let s = e;
|
|
35
|
-
for (; e < t.length; ) {
|
|
36
|
-
if (t[++e] === '"') {
|
|
37
|
-
e++, s = 0;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
t[e] === "\\" ? r += t[++e] : r += t[e];
|
|
41
|
-
}
|
|
42
|
-
if (s)
|
|
43
|
-
throw new TypeError(`Unterminated quote at ${s}: ${$}`);
|
|
44
|
-
}
|
|
45
|
-
if (!r)
|
|
46
|
-
throw new TypeError(`Missing parameter name at ${e}: ${$}`);
|
|
47
|
-
return r;
|
|
48
|
-
}
|
|
49
|
-
for (; e < t.length; ) {
|
|
50
|
-
const r = t[e], s = b[r];
|
|
51
|
-
if (s)
|
|
52
|
-
yield { type: s, index: e++, value: r };
|
|
53
|
-
else if (r === "\\")
|
|
54
|
-
yield { type: "ESCAPED", index: e++, value: t[e++] };
|
|
55
|
-
else if (r === ":") {
|
|
56
|
-
const u = o();
|
|
57
|
-
yield { type: "PARAM", index: e, value: u };
|
|
58
|
-
} else if (r === "*") {
|
|
59
|
-
const u = o();
|
|
60
|
-
yield { type: "WILDCARD", index: e, value: u };
|
|
61
|
-
} else
|
|
62
|
-
yield { type: "CHAR", index: e, value: t[e++] };
|
|
63
|
-
}
|
|
64
|
-
return { type: "END", index: e, value: "" };
|
|
65
|
-
}
|
|
66
|
-
class g {
|
|
67
|
-
constructor(t) {
|
|
68
|
-
this.tokens = t;
|
|
69
|
-
}
|
|
70
|
-
peek() {
|
|
71
|
-
if (!this._peek) {
|
|
72
|
-
const t = this.tokens.next();
|
|
73
|
-
this._peek = t.value;
|
|
74
|
-
}
|
|
75
|
-
return this._peek;
|
|
76
|
-
}
|
|
77
|
-
tryConsume(t) {
|
|
78
|
-
const e = this.peek();
|
|
79
|
-
if (e.type === t)
|
|
80
|
-
return this._peek = void 0, e.value;
|
|
81
|
-
}
|
|
82
|
-
consume(t) {
|
|
83
|
-
const e = this.tryConsume(t);
|
|
84
|
-
if (e !== void 0)
|
|
85
|
-
return e;
|
|
86
|
-
const { type: o, index: r } = this.peek();
|
|
87
|
-
throw new TypeError(`Unexpected ${o} at ${r}, expected ${t}: ${$}`);
|
|
88
|
-
}
|
|
89
|
-
text() {
|
|
90
|
-
let t = "", e;
|
|
91
|
-
for (; e = this.tryConsume("CHAR") || this.tryConsume("ESCAPED"); )
|
|
92
|
-
t += e;
|
|
93
|
-
return t;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
class x {
|
|
97
|
-
constructor(t) {
|
|
98
|
-
this.tokens = t;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
d.TokenData = x;
|
|
102
|
-
function m(n, t = {}) {
|
|
103
|
-
const { encodePath: e = a } = t, o = new g(I(n));
|
|
104
|
-
function r(u) {
|
|
105
|
-
const i = [];
|
|
106
|
-
for (; ; ) {
|
|
107
|
-
const p = o.text();
|
|
108
|
-
p && i.push({ type: "text", value: e(p) });
|
|
109
|
-
const y = o.tryConsume("PARAM");
|
|
110
|
-
if (y) {
|
|
111
|
-
i.push({
|
|
112
|
-
type: "param",
|
|
113
|
-
name: y
|
|
114
|
-
});
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
const S = o.tryConsume("WILDCARD");
|
|
118
|
-
if (S) {
|
|
119
|
-
i.push({
|
|
120
|
-
type: "wildcard",
|
|
121
|
-
name: S
|
|
122
|
-
});
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
if (o.tryConsume("{")) {
|
|
126
|
-
i.push({
|
|
127
|
-
type: "group",
|
|
128
|
-
tokens: r("}")
|
|
129
|
-
});
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
return o.consume(u), i;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const s = r("END");
|
|
136
|
-
return new x(s);
|
|
137
|
-
}
|
|
138
|
-
function R(n, t = {}) {
|
|
139
|
-
const { encode: e = encodeURIComponent, delimiter: o = c } = t, r = n instanceof x ? n : m(n, t), s = T(r.tokens, o, e);
|
|
140
|
-
return function(i = {}) {
|
|
141
|
-
const [p, ...y] = s(i);
|
|
142
|
-
if (y.length)
|
|
143
|
-
throw new TypeError(`Missing parameters: ${y.join(", ")}`);
|
|
144
|
-
return p;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function T(n, t, e) {
|
|
148
|
-
const o = n.map((r) => P(r, t, e));
|
|
149
|
-
return (r) => {
|
|
150
|
-
const s = [""];
|
|
151
|
-
for (const u of o) {
|
|
152
|
-
const [i, ...p] = u(r);
|
|
153
|
-
s[0] += i, s.push(...p);
|
|
154
|
-
}
|
|
155
|
-
return s;
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
function P(n, t, e) {
|
|
159
|
-
if (n.type === "text")
|
|
160
|
-
return () => [n.value];
|
|
161
|
-
if (n.type === "group") {
|
|
162
|
-
const r = T(n.tokens, t, e);
|
|
163
|
-
return (s) => {
|
|
164
|
-
const [u, ...i] = r(s);
|
|
165
|
-
return i.length ? [""] : [u];
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
const o = e || a;
|
|
169
|
-
return n.type === "wildcard" && e !== !1 ? (r) => {
|
|
170
|
-
const s = r[n.name];
|
|
171
|
-
if (s == null)
|
|
172
|
-
return ["", n.name];
|
|
173
|
-
if (!Array.isArray(s) || s.length === 0)
|
|
174
|
-
throw new TypeError(`Expected "${n.name}" to be a non-empty array`);
|
|
175
|
-
return [
|
|
176
|
-
s.map((u, i) => {
|
|
177
|
-
if (typeof u != "string")
|
|
178
|
-
throw new TypeError(`Expected "${n.name}/${i}" to be a string`);
|
|
179
|
-
return o(u);
|
|
180
|
-
}).join(t)
|
|
181
|
-
];
|
|
182
|
-
} : (r) => {
|
|
183
|
-
const s = r[n.name];
|
|
184
|
-
if (s == null)
|
|
185
|
-
return ["", n.name];
|
|
186
|
-
if (typeof s != "string")
|
|
187
|
-
throw new TypeError(`Expected "${n.name}" to be a string`);
|
|
188
|
-
return [o(s)];
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
function M(n, t = {}) {
|
|
192
|
-
const { decode: e = decodeURIComponent, delimiter: o = c } = t, { regexp: r, keys: s } = j(n, t), u = s.map((i) => e === !1 ? a : i.type === "param" ? e : (p) => p.split(o).map(e));
|
|
193
|
-
return function(p) {
|
|
194
|
-
const y = r.exec(p);
|
|
195
|
-
if (!y)
|
|
196
|
-
return !1;
|
|
197
|
-
const S = y[0], w = /* @__PURE__ */ Object.create(null);
|
|
198
|
-
for (let E = 1; E < y.length; E++) {
|
|
199
|
-
if (y[E] === void 0)
|
|
200
|
-
continue;
|
|
201
|
-
const v = s[E - 1], A = u[E - 1];
|
|
202
|
-
w[v.name] = A(y[E]);
|
|
203
|
-
}
|
|
204
|
-
return { path: S, params: w };
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function j(n, t = {}) {
|
|
208
|
-
const { delimiter: e = c, end: o = !0, sensitive: r = !1, trailing: s = !0 } = t, u = [], i = [], p = r ? "" : "i", S = (Array.isArray(n) ? n : [n]).map((v) => v instanceof x ? v : m(v, t));
|
|
209
|
-
for (const { tokens: v } of S)
|
|
210
|
-
for (const A of D(v, 0, [])) {
|
|
211
|
-
const B = L(A, e, u);
|
|
212
|
-
i.push(B);
|
|
213
|
-
}
|
|
214
|
-
let w = `^(?:${i.join("|")})`;
|
|
215
|
-
return s && (w += `(?:${f(e)}$)?`), w += o ? "$" : `(?=${f(e)}|$)`, { regexp: new RegExp(w, p), keys: u };
|
|
216
|
-
}
|
|
217
|
-
function* D(n, t, e) {
|
|
218
|
-
if (t === n.length)
|
|
219
|
-
return yield e;
|
|
220
|
-
const o = n[t];
|
|
221
|
-
if (o.type === "group") {
|
|
222
|
-
const r = e.slice();
|
|
223
|
-
for (const s of D(o.tokens, 0, r))
|
|
224
|
-
yield* D(n, t + 1, s);
|
|
225
|
-
} else
|
|
226
|
-
e.push(o);
|
|
227
|
-
yield* D(n, t + 1, e);
|
|
228
|
-
}
|
|
229
|
-
function L(n, t, e) {
|
|
230
|
-
let o = "", r = "", s = !0;
|
|
231
|
-
for (let u = 0; u < n.length; u++) {
|
|
232
|
-
const i = n[u];
|
|
233
|
-
if (i.type === "text") {
|
|
234
|
-
o += f(i.value), r += i.value, s || (s = i.value.includes(t));
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
if (i.type === "param" || i.type === "wildcard") {
|
|
238
|
-
if (!s && !r)
|
|
239
|
-
throw new TypeError(`Missing text after "${i.name}": ${$}`);
|
|
240
|
-
i.type === "param" ? o += `(${q(t, s ? "" : r)}+)` : o += "([\\s\\S]+)", e.push(i), r = "", s = !1;
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return o;
|
|
245
|
-
}
|
|
246
|
-
function q(n, t) {
|
|
247
|
-
return t.length < 2 ? n.length < 2 ? `[^${f(n + t)}]` : `(?:(?!${f(n)})[^${f(t)}])` : n.length < 2 ? `(?:(?!${f(t)})[^${f(n)}])` : `(?:(?!${f(t)}|${f(n)})[\\s\\S])`;
|
|
248
|
-
}
|
|
249
|
-
function k(n) {
|
|
250
|
-
return n.tokens.map(function t(e, o, r) {
|
|
251
|
-
if (e.type === "text")
|
|
252
|
-
return _(e.value);
|
|
253
|
-
if (e.type === "group")
|
|
254
|
-
return `{${e.tokens.map(t).join("")}}`;
|
|
255
|
-
const u = F(e.name) && V(r[o + 1]) ? e.name : JSON.stringify(e.name);
|
|
256
|
-
if (e.type === "param")
|
|
257
|
-
return `:${u}`;
|
|
258
|
-
if (e.type === "wildcard")
|
|
259
|
-
return `*${u}`;
|
|
260
|
-
throw new TypeError(`Unexpected token: ${e}`);
|
|
261
|
-
}).join("");
|
|
262
|
-
}
|
|
263
|
-
function F(n) {
|
|
264
|
-
const [t, ...e] = n;
|
|
265
|
-
return l.test(t) ? e.every((o) => h.test(o)) : !1;
|
|
266
|
-
}
|
|
267
|
-
function V(n) {
|
|
268
|
-
return n?.type !== "text" ? !0 : !h.test(n.value[0]);
|
|
269
|
-
}
|
|
270
|
-
return d;
|
|
271
|
-
}
|
|
272
|
-
var z = H();
|
|
273
|
-
const O = (c) => {
|
|
274
|
-
let a;
|
|
275
|
-
const l = /* @__PURE__ */ new Set(), h = (g, x) => {
|
|
276
|
-
const m = typeof g == "function" ? g(a) : g;
|
|
277
|
-
if (!Object.is(m, a)) {
|
|
278
|
-
const R = a;
|
|
279
|
-
a = x ?? (typeof m != "object" || m === null) ? m : Object.assign({}, a, m), l.forEach((T) => T(a, R));
|
|
280
|
-
}
|
|
281
|
-
}, $ = () => a, f = { setState: h, getState: $, getInitialState: () => I, subscribe: (g) => (l.add(g), () => l.delete(g)) }, I = a = c(h, $, f);
|
|
282
|
-
return f;
|
|
283
|
-
}, W = (c) => c ? O(c) : O, G = (c) => c;
|
|
284
|
-
function J(c, a = G) {
|
|
285
|
-
const l = C.useSyncExternalStore(
|
|
286
|
-
c.subscribe,
|
|
287
|
-
C.useCallback(() => a(c.getState()), [c, a]),
|
|
288
|
-
C.useCallback(() => a(c.getInitialState()), [c, a])
|
|
289
|
-
);
|
|
290
|
-
return C.useDebugValue(l), l;
|
|
291
|
-
}
|
|
292
|
-
const U = (c) => {
|
|
293
|
-
const a = W(c), l = (h) => J(a, h);
|
|
294
|
-
return Object.assign(l, a), l;
|
|
295
|
-
}, Q = (c) => c ? U(c) : U;
|
|
296
|
-
export {
|
|
297
|
-
Q as c,
|
|
298
|
-
z as d
|
|
299
|
-
};
|