sibujs 1.3.0 → 1.5.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/README.md +105 -119
- package/dist/browser.cjs +53 -14
- package/dist/browser.d.cts +14 -9
- package/dist/browser.d.ts +14 -9
- package/dist/browser.js +4 -4
- package/dist/build.cjs +125 -135
- package/dist/build.d.cts +1 -1
- package/dist/build.d.ts +1 -1
- package/dist/build.js +11 -91
- package/dist/cdn.global.js +6 -6
- package/dist/chunk-5ZYQ6KDD.js +154 -0
- package/dist/chunk-6BMPXPUW.js +26 -0
- package/dist/chunk-7GRNSCFT.js +1097 -0
- package/dist/chunk-BGTHZHJ5.js +1016 -0
- package/dist/chunk-BMPL52BF.js +654 -0
- package/dist/chunk-CNZ35WI2.js +178 -0
- package/dist/chunk-GJPXRJ45.js +37 -0
- package/dist/chunk-JCDUJN2F.js +2779 -0
- package/dist/chunk-K4G4ZQNR.js +286 -0
- package/dist/chunk-M4NLBH4I.js +725 -0
- package/dist/chunk-MB6QFH3I.js +2776 -0
- package/dist/chunk-MYRV7VDM.js +742 -0
- package/dist/chunk-NZIIMDWI.js +84 -0
- package/dist/chunk-P3XWXJZU.js +282 -0
- package/dist/chunk-PDZQY43A.js +616 -0
- package/dist/chunk-RJ46C3CS.js +1293 -0
- package/dist/chunk-SFKNRVCU.js +292 -0
- package/dist/chunk-TDGZL5CU.js +365 -0
- package/dist/chunk-UHNL42EF.js +2730 -0
- package/dist/chunk-VAPYJN4X.js +368 -0
- package/dist/chunk-VQDZK23A.js +1023 -0
- package/dist/chunk-VQNQZCWJ.js +61 -0
- package/dist/chunk-XHK6BDAJ.js +76 -0
- package/dist/chunk-XUEEGU5O.js +409 -0
- package/dist/chunk-ZWKZCBO6.js +317 -0
- package/dist/contracts-ey_Qh8ef.d.cts +239 -0
- package/dist/contracts-ey_Qh8ef.d.ts +239 -0
- package/dist/contracts-xo5ckdRP.d.cts +240 -0
- package/dist/contracts-xo5ckdRP.d.ts +240 -0
- package/dist/customElement-BL3Uo8dL.d.cts +318 -0
- package/dist/customElement-BL3Uo8dL.d.ts +318 -0
- package/dist/data.cjs +52 -11
- package/dist/data.js +6 -6
- package/dist/devtools.cjs +22 -24
- package/dist/devtools.d.cts +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +26 -28
- package/dist/ecosystem.cjs +31 -6
- package/dist/ecosystem.d.cts +4 -4
- package/dist/ecosystem.d.ts +4 -4
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +305 -131
- package/dist/extras.d.cts +3 -3
- package/dist/extras.d.ts +3 -3
- package/dist/extras.js +21 -29
- package/dist/index.cjs +124 -56
- package/dist/index.d.cts +60 -72
- package/dist/index.d.ts +60 -72
- package/dist/index.js +10 -14
- package/dist/motion.cjs +13 -2
- package/dist/motion.d.cts +1 -1
- package/dist/motion.d.ts +1 -1
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +91 -46
- package/dist/patterns.d.cts +46 -60
- package/dist/patterns.d.ts +46 -60
- package/dist/patterns.js +6 -14
- package/dist/performance.cjs +97 -12
- package/dist/performance.d.cts +6 -1
- package/dist/performance.d.ts +6 -1
- package/dist/performance.js +5 -3
- package/dist/plugins.cjs +20 -14
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +17 -19
- package/dist/ssr.cjs +9 -0
- package/dist/ssr.d.cts +1 -1
- package/dist/ssr.d.ts +1 -1
- package/dist/ssr.js +7 -7
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +130 -53
- package/dist/ui.d.cts +13 -16
- package/dist/ui.d.ts +13 -16
- package/dist/ui.js +7 -9
- package/dist/widgets.cjs +31 -6
- package/dist/widgets.js +5 -5
- package/package.json +1 -1
package/dist/patterns.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createEffect,
|
|
3
|
-
createMemo,
|
|
4
|
-
createSignal,
|
|
5
2
|
globalStore,
|
|
6
3
|
machine,
|
|
7
4
|
optimistic,
|
|
8
5
|
optimisticList,
|
|
9
6
|
persisted,
|
|
10
7
|
timeline
|
|
11
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VAPYJN4X.js";
|
|
12
9
|
import {
|
|
13
10
|
RenderProp,
|
|
14
11
|
assertType,
|
|
15
|
-
composable,
|
|
16
12
|
compose,
|
|
17
13
|
createGuard,
|
|
18
14
|
createSlots,
|
|
@@ -25,22 +21,18 @@ import {
|
|
|
25
21
|
withDefaults,
|
|
26
22
|
withProps,
|
|
27
23
|
withWrapper
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-CNZ35WI2.js";
|
|
25
|
+
import "./chunk-XHK6BDAJ.js";
|
|
26
|
+
import "./chunk-VQNQZCWJ.js";
|
|
31
27
|
import "./chunk-EUZND3CB.js";
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-NZIIMDWI.js";
|
|
29
|
+
import "./chunk-K4G4ZQNR.js";
|
|
34
30
|
import "./chunk-5X6PP2UK.js";
|
|
35
31
|
export {
|
|
36
32
|
RenderProp,
|
|
37
33
|
assertType,
|
|
38
|
-
composable,
|
|
39
34
|
compose,
|
|
40
|
-
createEffect,
|
|
41
35
|
createGuard,
|
|
42
|
-
createMemo,
|
|
43
|
-
createSignal,
|
|
44
36
|
createSlots,
|
|
45
37
|
defineComponent,
|
|
46
38
|
defineSlottedComponent,
|
package/dist/performance.cjs
CHANGED
|
@@ -189,6 +189,11 @@ function isDev() {
|
|
|
189
189
|
return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
|
|
190
190
|
}
|
|
191
191
|
var _isDev = isDev();
|
|
192
|
+
function devAssert(condition, message) {
|
|
193
|
+
if (_isDev && !condition) {
|
|
194
|
+
throw new Error(`[Sibu] ${message}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
192
197
|
function devWarn(message) {
|
|
193
198
|
if (_isDev) {
|
|
194
199
|
console.warn(`[Sibu] ${message}`);
|
|
@@ -198,6 +203,8 @@ function devWarn(message) {
|
|
|
198
203
|
// src/reactivity/track.ts
|
|
199
204
|
var _isDev2 = isDev();
|
|
200
205
|
var subscriberStack = new Array(32);
|
|
206
|
+
var stackCapacity = 32;
|
|
207
|
+
var stackTop = -1;
|
|
201
208
|
var currentSubscriber = null;
|
|
202
209
|
var signalSubscribers = /* @__PURE__ */ new WeakMap();
|
|
203
210
|
var SUBS = "__s";
|
|
@@ -211,6 +218,24 @@ function safeInvoke(sub) {
|
|
|
211
218
|
if (_isDev2) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
212
219
|
}
|
|
213
220
|
}
|
|
221
|
+
function track(effectFn, subscriber) {
|
|
222
|
+
if (!subscriber) subscriber = effectFn;
|
|
223
|
+
cleanup(subscriber);
|
|
224
|
+
++stackTop;
|
|
225
|
+
if (stackTop >= stackCapacity) {
|
|
226
|
+
stackCapacity *= 2;
|
|
227
|
+
subscriberStack.length = stackCapacity;
|
|
228
|
+
}
|
|
229
|
+
subscriberStack[stackTop] = subscriber;
|
|
230
|
+
currentSubscriber = subscriber;
|
|
231
|
+
try {
|
|
232
|
+
effectFn();
|
|
233
|
+
} finally {
|
|
234
|
+
stackTop--;
|
|
235
|
+
currentSubscriber = stackTop >= 0 ? subscriberStack[stackTop] : null;
|
|
236
|
+
}
|
|
237
|
+
return () => cleanup(subscriber);
|
|
238
|
+
}
|
|
214
239
|
function recordDependency(signal2) {
|
|
215
240
|
if (!currentSubscriber) return;
|
|
216
241
|
const sub = currentSubscriber;
|
|
@@ -352,6 +377,69 @@ function notifySubscribers(signal2) {
|
|
|
352
377
|
notifyDepth--;
|
|
353
378
|
}
|
|
354
379
|
}
|
|
380
|
+
function cleanup(subscriber) {
|
|
381
|
+
const sub = subscriber;
|
|
382
|
+
const singleDep = sub._dep;
|
|
383
|
+
if (singleDep !== void 0) {
|
|
384
|
+
const subs = singleDep[SUBS];
|
|
385
|
+
if (subs) {
|
|
386
|
+
subs.delete(subscriber);
|
|
387
|
+
if (singleDep.__f === subscriber) {
|
|
388
|
+
singleDep.__f = void 0;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
sub._dep = void 0;
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
const deps = sub._deps;
|
|
395
|
+
if (!deps || deps.size === 0) return;
|
|
396
|
+
for (const signal2 of deps) {
|
|
397
|
+
const subs = signal2[SUBS];
|
|
398
|
+
if (subs) {
|
|
399
|
+
subs.delete(subscriber);
|
|
400
|
+
if (signal2.__f === subscriber) {
|
|
401
|
+
signal2.__f = void 0;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
deps.clear();
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// src/core/ssr-context.ts
|
|
409
|
+
var ssrMode = false;
|
|
410
|
+
function isSSR() {
|
|
411
|
+
return ssrMode;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// src/core/signals/effect.ts
|
|
415
|
+
var _g = globalThis;
|
|
416
|
+
function effect(effectFn, options) {
|
|
417
|
+
devAssert(typeof effectFn === "function", "effect: argument must be a function.");
|
|
418
|
+
if (isSSR()) return () => {
|
|
419
|
+
};
|
|
420
|
+
const onError = options?.onError;
|
|
421
|
+
const wrappedFn = onError ? () => {
|
|
422
|
+
try {
|
|
423
|
+
effectFn();
|
|
424
|
+
} catch (err) {
|
|
425
|
+
onError(err);
|
|
426
|
+
}
|
|
427
|
+
} : effectFn;
|
|
428
|
+
let cleanupHandle = () => {
|
|
429
|
+
};
|
|
430
|
+
const subscriber = () => {
|
|
431
|
+
cleanupHandle();
|
|
432
|
+
cleanupHandle = track(wrappedFn, subscriber);
|
|
433
|
+
};
|
|
434
|
+
cleanupHandle = track(wrappedFn, subscriber);
|
|
435
|
+
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
436
|
+
if (hook) hook.emit("effect:create", { effectFn });
|
|
437
|
+
return () => {
|
|
438
|
+
const h = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
439
|
+
if (h) h.emit("effect:destroy", { effectFn });
|
|
440
|
+
cleanupHandle();
|
|
441
|
+
};
|
|
442
|
+
}
|
|
355
443
|
|
|
356
444
|
// src/reactivity/batch.ts
|
|
357
445
|
var batchDepth = 0;
|
|
@@ -363,7 +451,7 @@ function enqueueBatchedSignal(signal2) {
|
|
|
363
451
|
}
|
|
364
452
|
|
|
365
453
|
// src/core/signals/signal.ts
|
|
366
|
-
var
|
|
454
|
+
var _g2 = globalThis;
|
|
367
455
|
var _isDev3 = isDev();
|
|
368
456
|
function signal(initial, options) {
|
|
369
457
|
const state = { value: initial };
|
|
@@ -384,7 +472,7 @@ function signal(initial, options) {
|
|
|
384
472
|
if (_isDev3) {
|
|
385
473
|
const oldValue = state.value;
|
|
386
474
|
state.value = newValue;
|
|
387
|
-
const hook =
|
|
475
|
+
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
388
476
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue, newValue });
|
|
389
477
|
} else {
|
|
390
478
|
state.value = newValue;
|
|
@@ -394,7 +482,7 @@ function signal(initial, options) {
|
|
|
394
482
|
}
|
|
395
483
|
}
|
|
396
484
|
if (_isDev3) {
|
|
397
|
-
const hook =
|
|
485
|
+
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
398
486
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
399
487
|
}
|
|
400
488
|
return [get, set];
|
|
@@ -406,15 +494,12 @@ function startTransition(callback) {
|
|
|
406
494
|
}
|
|
407
495
|
function deferredValue(getter) {
|
|
408
496
|
const [deferred, setDeferred] = signal(getter());
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
return
|
|
415
|
-
scheduleUpdate(Priority.LOW, sync);
|
|
416
|
-
return deferred();
|
|
417
|
-
};
|
|
497
|
+
let latest = deferred();
|
|
498
|
+
effect(() => {
|
|
499
|
+
latest = getter();
|
|
500
|
+
scheduleUpdate(Priority.LOW, () => setDeferred(latest));
|
|
501
|
+
});
|
|
502
|
+
return deferred;
|
|
418
503
|
}
|
|
419
504
|
function transitionState() {
|
|
420
505
|
const [isPending, setIsPending] = signal(false);
|
package/dist/performance.d.cts
CHANGED
|
@@ -56,6 +56,11 @@ declare function startTransition(callback: () => void): void;
|
|
|
56
56
|
* The deferred value mirrors the source but updates at LOW priority,
|
|
57
57
|
* allowing the UI to remain responsive while expensive derived state
|
|
58
58
|
* catches up.
|
|
59
|
+
*
|
|
60
|
+
* Uses an effect to subscribe to the source getter. When the source
|
|
61
|
+
* changes, a LOW-priority update is scheduled. The deferred signal
|
|
62
|
+
* only updates when the scheduler flushes, so fast bursts of source
|
|
63
|
+
* changes collapse into a single deferred update.
|
|
59
64
|
*/
|
|
60
65
|
declare function deferredValue<T>(getter: () => T): () => T;
|
|
61
66
|
/**
|
|
@@ -89,7 +94,7 @@ declare function setIdPrefix(prefix: string): void;
|
|
|
89
94
|
* @example
|
|
90
95
|
* ```ts
|
|
91
96
|
* const id = id();
|
|
92
|
-
* label({ htmlFor: id,
|
|
97
|
+
* label({ htmlFor: id }, "Name");
|
|
93
98
|
* input({ id, type: "text" });
|
|
94
99
|
* ```
|
|
95
100
|
*/
|
package/dist/performance.d.ts
CHANGED
|
@@ -56,6 +56,11 @@ declare function startTransition(callback: () => void): void;
|
|
|
56
56
|
* The deferred value mirrors the source but updates at LOW priority,
|
|
57
57
|
* allowing the UI to remain responsive while expensive derived state
|
|
58
58
|
* catches up.
|
|
59
|
+
*
|
|
60
|
+
* Uses an effect to subscribe to the source getter. When the source
|
|
61
|
+
* changes, a LOW-priority update is scheduled. The deferred signal
|
|
62
|
+
* only updates when the scheduler flushes, so fast bursts of source
|
|
63
|
+
* changes collapse into a single deferred update.
|
|
59
64
|
*/
|
|
60
65
|
declare function deferredValue<T>(getter: () => T): () => T;
|
|
61
66
|
/**
|
|
@@ -89,7 +94,7 @@ declare function setIdPrefix(prefix: string): void;
|
|
|
89
94
|
* @example
|
|
90
95
|
* ```ts
|
|
91
96
|
* const id = id();
|
|
92
|
-
* label({ htmlFor: id,
|
|
97
|
+
* label({ htmlFor: id }, "Name");
|
|
93
98
|
* input({ id, type: "text" });
|
|
94
99
|
* ```
|
|
95
100
|
*/
|
package/dist/performance.js
CHANGED
|
@@ -33,9 +33,11 @@ import {
|
|
|
33
33
|
transitionState,
|
|
34
34
|
uniqueId,
|
|
35
35
|
yieldToMain
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
36
|
+
} from "./chunk-BMPL52BF.js";
|
|
37
|
+
import "./chunk-VQNQZCWJ.js";
|
|
38
|
+
import "./chunk-EUZND3CB.js";
|
|
39
|
+
import "./chunk-NZIIMDWI.js";
|
|
40
|
+
import "./chunk-K4G4ZQNR.js";
|
|
39
41
|
import "./chunk-5X6PP2UK.js";
|
|
40
42
|
export {
|
|
41
43
|
DOMPool,
|
package/dist/plugins.cjs
CHANGED
|
@@ -1014,7 +1014,15 @@ function dispose(node) {
|
|
|
1014
1014
|
const disposers = elementDisposers.get(current);
|
|
1015
1015
|
if (disposers) {
|
|
1016
1016
|
if (_isDev5) activeBindingCount -= disposers.length;
|
|
1017
|
-
for (const d of disposers)
|
|
1017
|
+
for (const d of disposers) {
|
|
1018
|
+
try {
|
|
1019
|
+
d();
|
|
1020
|
+
} catch (err) {
|
|
1021
|
+
if (_isDev5 && typeof console !== "undefined") {
|
|
1022
|
+
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1018
1026
|
elementDisposers.delete(current);
|
|
1019
1027
|
}
|
|
1020
1028
|
}
|
|
@@ -1425,9 +1433,7 @@ function t(key, params) {
|
|
|
1425
1433
|
return params ? message.replace(/\{(\w+)\}/g, (_, p2) => String(params[p2] ?? "")) : message;
|
|
1426
1434
|
}
|
|
1427
1435
|
function Trans(key, params) {
|
|
1428
|
-
return span(
|
|
1429
|
-
nodes: () => t(key, params)
|
|
1430
|
-
});
|
|
1436
|
+
return span(() => t(key, params));
|
|
1431
1437
|
}
|
|
1432
1438
|
function hasTranslation(key) {
|
|
1433
1439
|
const locale = currentLocale();
|
|
@@ -1598,9 +1604,12 @@ var RouteMatcher = class {
|
|
|
1598
1604
|
return this.namedRoutes.get(name) || null;
|
|
1599
1605
|
}
|
|
1600
1606
|
matchPattern(path2, routePath) {
|
|
1601
|
-
if (routePath === "*"
|
|
1607
|
+
if (routePath === "*") {
|
|
1608
|
+
return { params: { pathMatch: path2 } };
|
|
1609
|
+
}
|
|
1610
|
+
if (routePath.endsWith("/*")) {
|
|
1602
1611
|
const basePath = routePath.slice(0, -2);
|
|
1603
|
-
if (path2.startsWith(basePath)) {
|
|
1612
|
+
if (path2 === basePath || path2.startsWith(`${basePath}/`)) {
|
|
1604
1613
|
return { params: { pathMatch: path2.slice(basePath.length) } };
|
|
1605
1614
|
}
|
|
1606
1615
|
return null;
|
|
@@ -1719,6 +1728,8 @@ var GuardManager = class {
|
|
|
1719
1728
|
const next = (result) => {
|
|
1720
1729
|
if (resolved || signal2.aborted) return;
|
|
1721
1730
|
resolved = true;
|
|
1731
|
+
clearTimeout(timeoutId);
|
|
1732
|
+
signal2.removeEventListener("abort", abortHandler);
|
|
1722
1733
|
if (result instanceof Error) {
|
|
1723
1734
|
reject(result);
|
|
1724
1735
|
} else if (result === false) {
|
|
@@ -1732,10 +1743,10 @@ var GuardManager = class {
|
|
|
1732
1743
|
const abortHandler = () => {
|
|
1733
1744
|
if (!resolved) {
|
|
1734
1745
|
resolved = true;
|
|
1746
|
+
clearTimeout(timeoutId);
|
|
1735
1747
|
reject(new Error("Navigation aborted"));
|
|
1736
1748
|
}
|
|
1737
1749
|
};
|
|
1738
|
-
signal2.addEventListener("abort", abortHandler);
|
|
1739
1750
|
const timeoutId = setTimeout(() => {
|
|
1740
1751
|
if (!resolved) {
|
|
1741
1752
|
resolved = true;
|
|
@@ -1743,6 +1754,7 @@ var GuardManager = class {
|
|
|
1743
1754
|
reject(new Error("Guard timeout"));
|
|
1744
1755
|
}
|
|
1745
1756
|
}, this.timeout);
|
|
1757
|
+
signal2.addEventListener("abort", abortHandler);
|
|
1746
1758
|
try {
|
|
1747
1759
|
guard(to, from, next);
|
|
1748
1760
|
} catch (error) {
|
|
@@ -1753,12 +1765,6 @@ var GuardManager = class {
|
|
|
1753
1765
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
1754
1766
|
}
|
|
1755
1767
|
}
|
|
1756
|
-
Promise.resolve().then(() => {
|
|
1757
|
-
if (resolved) {
|
|
1758
|
-
clearTimeout(timeoutId);
|
|
1759
|
-
signal2.removeEventListener("abort", abortHandler);
|
|
1760
|
-
}
|
|
1761
|
-
});
|
|
1762
1768
|
});
|
|
1763
1769
|
}
|
|
1764
1770
|
addBeforeEach(guard) {
|
|
@@ -3428,7 +3434,7 @@ var bundlerMetadata = {
|
|
|
3428
3434
|
sideEffects: false,
|
|
3429
3435
|
modules: {
|
|
3430
3436
|
core: ["html", "mount", "each", "slots", "fragment", "catch", "portal", "directives"],
|
|
3431
|
-
hooks: ["signal", "effect", "derived", "watch", "store", "ref", "
|
|
3437
|
+
hooks: ["signal", "effect", "derived", "watch", "store", "ref", "array", "deepSignal"],
|
|
3432
3438
|
plugins: ["router", "i18n"],
|
|
3433
3439
|
components: ["ErrorBoundary", "Loading"],
|
|
3434
3440
|
ssr: ["ssr"],
|
package/dist/plugins.d.cts
CHANGED
|
@@ -24,7 +24,7 @@ declare function t(key: string, params?: Params$1): string;
|
|
|
24
24
|
* registerTranslations("en", { greeting: "Hello, {name}!" });
|
|
25
25
|
* registerTranslations("es", { greeting: "Hola, {name}!" });
|
|
26
26
|
*
|
|
27
|
-
* div(
|
|
27
|
+
* div([Trans("greeting", { name: "World" })]);
|
|
28
28
|
* // When locale changes, the text updates automatically
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
@@ -235,11 +235,11 @@ declare function Route(): Node;
|
|
|
235
235
|
* ```ts
|
|
236
236
|
* // Cache all routes (max 10)
|
|
237
237
|
* createRouter(routes, { keepAlive: 10 });
|
|
238
|
-
* mount(() => div(
|
|
238
|
+
* mount(() => div([nav, KeepAliveRoute()]), root);
|
|
239
239
|
*
|
|
240
240
|
* // Or cache specific routes by name
|
|
241
241
|
* createRouter(routes, { keepAlive: ["dashboard", "settings"] });
|
|
242
|
-
* mount(() => div(
|
|
242
|
+
* mount(() => div([nav, KeepAliveRoute()]), root);
|
|
243
243
|
*
|
|
244
244
|
* // Or override per-outlet
|
|
245
245
|
* KeepAliveRoute({ max: 5, include: ["dashboard"] })
|
package/dist/plugins.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare function t(key: string, params?: Params$1): string;
|
|
|
24
24
|
* registerTranslations("en", { greeting: "Hello, {name}!" });
|
|
25
25
|
* registerTranslations("es", { greeting: "Hola, {name}!" });
|
|
26
26
|
*
|
|
27
|
-
* div(
|
|
27
|
+
* div([Trans("greeting", { name: "World" })]);
|
|
28
28
|
* // When locale changes, the text updates automatically
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
@@ -235,11 +235,11 @@ declare function Route(): Node;
|
|
|
235
235
|
* ```ts
|
|
236
236
|
* // Cache all routes (max 10)
|
|
237
237
|
* createRouter(routes, { keepAlive: 10 });
|
|
238
|
-
* mount(() => div(
|
|
238
|
+
* mount(() => div([nav, KeepAliveRoute()]), root);
|
|
239
239
|
*
|
|
240
240
|
* // Or cache specific routes by name
|
|
241
241
|
* createRouter(routes, { keepAlive: ["dashboard", "settings"] });
|
|
242
|
-
* mount(() => div(
|
|
242
|
+
* mount(() => div([nav, KeepAliveRoute()]), root);
|
|
243
243
|
*
|
|
244
244
|
* // Or override per-outlet
|
|
245
245
|
* KeepAliveRoute({ max: 5, include: ["dashboard"] })
|
package/dist/plugins.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
preloadCritical,
|
|
19
19
|
prerenderRoutes,
|
|
20
20
|
satisfies
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-M4NLBH4I.js";
|
|
22
22
|
import {
|
|
23
23
|
escapeScriptJson,
|
|
24
24
|
renderToString
|
|
@@ -34,25 +34,25 @@ import {
|
|
|
34
34
|
} from "./chunk-K5ZUMYVS.js";
|
|
35
35
|
import {
|
|
36
36
|
span
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-P3XWXJZU.js";
|
|
38
|
+
import "./chunk-SFKNRVCU.js";
|
|
39
39
|
import {
|
|
40
40
|
dispose,
|
|
41
41
|
registerDisposer
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-5ZYQ6KDD.js";
|
|
43
43
|
import {
|
|
44
44
|
sanitizeUrl
|
|
45
45
|
} from "./chunk-CMBFNA7L.js";
|
|
46
46
|
import {
|
|
47
47
|
effect
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-VQNQZCWJ.js";
|
|
49
49
|
import "./chunk-EUZND3CB.js";
|
|
50
50
|
import {
|
|
51
51
|
signal
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-NZIIMDWI.js";
|
|
53
53
|
import {
|
|
54
54
|
track
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-K4G4ZQNR.js";
|
|
56
56
|
import "./chunk-5X6PP2UK.js";
|
|
57
57
|
|
|
58
58
|
// src/plugins/i18n.ts
|
|
@@ -73,9 +73,7 @@ function t(key, params) {
|
|
|
73
73
|
return params ? message.replace(/\{(\w+)\}/g, (_, p) => String(params[p] ?? "")) : message;
|
|
74
74
|
}
|
|
75
75
|
function Trans(key, params) {
|
|
76
|
-
return span(
|
|
77
|
-
nodes: () => t(key, params)
|
|
78
|
-
});
|
|
76
|
+
return span(() => t(key, params));
|
|
79
77
|
}
|
|
80
78
|
function hasTranslation(key) {
|
|
81
79
|
const locale = currentLocale();
|
|
@@ -206,9 +204,12 @@ var RouteMatcher = class {
|
|
|
206
204
|
return this.namedRoutes.get(name) || null;
|
|
207
205
|
}
|
|
208
206
|
matchPattern(path, routePath) {
|
|
209
|
-
if (routePath === "*"
|
|
207
|
+
if (routePath === "*") {
|
|
208
|
+
return { params: { pathMatch: path } };
|
|
209
|
+
}
|
|
210
|
+
if (routePath.endsWith("/*")) {
|
|
210
211
|
const basePath = routePath.slice(0, -2);
|
|
211
|
-
if (path.startsWith(basePath)) {
|
|
212
|
+
if (path === basePath || path.startsWith(`${basePath}/`)) {
|
|
212
213
|
return { params: { pathMatch: path.slice(basePath.length) } };
|
|
213
214
|
}
|
|
214
215
|
return null;
|
|
@@ -327,6 +328,8 @@ var GuardManager = class {
|
|
|
327
328
|
const next = (result) => {
|
|
328
329
|
if (resolved || signal2.aborted) return;
|
|
329
330
|
resolved = true;
|
|
331
|
+
clearTimeout(timeoutId);
|
|
332
|
+
signal2.removeEventListener("abort", abortHandler);
|
|
330
333
|
if (result instanceof Error) {
|
|
331
334
|
reject(result);
|
|
332
335
|
} else if (result === false) {
|
|
@@ -340,10 +343,10 @@ var GuardManager = class {
|
|
|
340
343
|
const abortHandler = () => {
|
|
341
344
|
if (!resolved) {
|
|
342
345
|
resolved = true;
|
|
346
|
+
clearTimeout(timeoutId);
|
|
343
347
|
reject(new Error("Navigation aborted"));
|
|
344
348
|
}
|
|
345
349
|
};
|
|
346
|
-
signal2.addEventListener("abort", abortHandler);
|
|
347
350
|
const timeoutId = setTimeout(() => {
|
|
348
351
|
if (!resolved) {
|
|
349
352
|
resolved = true;
|
|
@@ -351,6 +354,7 @@ var GuardManager = class {
|
|
|
351
354
|
reject(new Error("Guard timeout"));
|
|
352
355
|
}
|
|
353
356
|
}, this.timeout);
|
|
357
|
+
signal2.addEventListener("abort", abortHandler);
|
|
354
358
|
try {
|
|
355
359
|
guard(to, from, next);
|
|
356
360
|
} catch (error) {
|
|
@@ -361,12 +365,6 @@ var GuardManager = class {
|
|
|
361
365
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
362
366
|
}
|
|
363
367
|
}
|
|
364
|
-
Promise.resolve().then(() => {
|
|
365
|
-
if (resolved) {
|
|
366
|
-
clearTimeout(timeoutId);
|
|
367
|
-
signal2.removeEventListener("abort", abortHandler);
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
368
|
});
|
|
371
369
|
}
|
|
372
370
|
addBeforeEach(guard) {
|
package/dist/ssr.cjs
CHANGED
|
@@ -658,12 +658,21 @@ function queueSignalNotification(signal2) {
|
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
+
var MAX_DRAIN_ITERATIONS = 1e3;
|
|
661
662
|
function drainNotificationQueue() {
|
|
662
663
|
if (notifyDepth > 0) return;
|
|
663
664
|
notifyDepth++;
|
|
664
665
|
try {
|
|
665
666
|
let i2 = 0;
|
|
666
667
|
while (i2 < pendingQueue.length) {
|
|
668
|
+
if (i2 >= MAX_DRAIN_ITERATIONS) {
|
|
669
|
+
if (typeof console !== "undefined") {
|
|
670
|
+
console.error(
|
|
671
|
+
`[SibuJS] Notification queue exceeded ${MAX_DRAIN_ITERATIONS} iterations \u2014 likely an effect that writes to a signal it reads. Breaking to prevent infinite loop.`
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
667
676
|
safeInvoke(pendingQueue[i2]);
|
|
668
677
|
i2++;
|
|
669
678
|
}
|
package/dist/ssr.d.cts
CHANGED
|
@@ -217,7 +217,7 @@ interface SharedScope<T extends Record<string, unknown>> {
|
|
|
217
217
|
* const app = createMicroApp({ name: "widget", shadow: true });
|
|
218
218
|
* document.body.appendChild(app.element);
|
|
219
219
|
*
|
|
220
|
-
* app.mount(() => div(
|
|
220
|
+
* app.mount(() => div("Hello from micro-app!"));
|
|
221
221
|
*
|
|
222
222
|
* // Later, tear it down:
|
|
223
223
|
* app.unmount();
|
package/dist/ssr.d.ts
CHANGED
|
@@ -217,7 +217,7 @@ interface SharedScope<T extends Record<string, unknown>> {
|
|
|
217
217
|
* const app = createMicroApp({ name: "widget", shadow: true });
|
|
218
218
|
* document.body.appendChild(app.element);
|
|
219
219
|
*
|
|
220
|
-
* app.mount(() => div(
|
|
220
|
+
* app.mount(() => div("Hello from micro-app!"));
|
|
221
221
|
*
|
|
222
222
|
* // Later, tear it down:
|
|
223
223
|
* app.unmount();
|
package/dist/ssr.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
wasm,
|
|
23
23
|
worker,
|
|
24
24
|
workerFn
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MYRV7VDM.js";
|
|
26
26
|
import {
|
|
27
27
|
collectStream,
|
|
28
28
|
deserializeState,
|
|
@@ -42,14 +42,14 @@ import {
|
|
|
42
42
|
suspenseSwapScript,
|
|
43
43
|
trustHTML
|
|
44
44
|
} from "./chunk-3X2YG6YM.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
45
|
+
import "./chunk-P3XWXJZU.js";
|
|
46
|
+
import "./chunk-SFKNRVCU.js";
|
|
47
|
+
import "./chunk-5ZYQ6KDD.js";
|
|
48
48
|
import "./chunk-CMBFNA7L.js";
|
|
49
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-VQNQZCWJ.js";
|
|
50
50
|
import "./chunk-EUZND3CB.js";
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-NZIIMDWI.js";
|
|
52
|
+
import "./chunk-K4G4ZQNR.js";
|
|
53
53
|
import "./chunk-5X6PP2UK.js";
|
|
54
54
|
export {
|
|
55
55
|
Head,
|
package/dist/testing.js
CHANGED