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/build.cjs
CHANGED
|
@@ -633,7 +633,6 @@ function injectPureAnnotations(code2) {
|
|
|
633
633
|
const sibuFactories = [
|
|
634
634
|
"tagFactory",
|
|
635
635
|
"context",
|
|
636
|
-
"composable",
|
|
637
636
|
"defineComponent",
|
|
638
637
|
"withProps",
|
|
639
638
|
"withDefaults",
|
|
@@ -855,7 +854,6 @@ function deepMerge(target, source2) {
|
|
|
855
854
|
var PURE_FACTORIES = [
|
|
856
855
|
"tagFactory",
|
|
857
856
|
"context",
|
|
858
|
-
"composable",
|
|
859
857
|
"defineComponent",
|
|
860
858
|
"withProps",
|
|
861
859
|
"withDefaults",
|
|
@@ -1171,8 +1169,6 @@ __export(index_exports, {
|
|
|
1171
1169
|
mask: () => mask,
|
|
1172
1170
|
match: () => match,
|
|
1173
1171
|
math: () => math,
|
|
1174
|
-
memo: () => memo,
|
|
1175
|
-
memoFn: () => memoFn,
|
|
1176
1172
|
menu: () => menu,
|
|
1177
1173
|
meta: () => meta,
|
|
1178
1174
|
meter: () => meter,
|
|
@@ -1410,12 +1406,21 @@ function queueSignalNotification(signal2) {
|
|
|
1410
1406
|
}
|
|
1411
1407
|
}
|
|
1412
1408
|
}
|
|
1409
|
+
var MAX_DRAIN_ITERATIONS = 1e3;
|
|
1413
1410
|
function drainNotificationQueue() {
|
|
1414
1411
|
if (notifyDepth > 0) return;
|
|
1415
1412
|
notifyDepth++;
|
|
1416
1413
|
try {
|
|
1417
1414
|
let i2 = 0;
|
|
1418
1415
|
while (i2 < pendingQueue.length) {
|
|
1416
|
+
if (i2 >= MAX_DRAIN_ITERATIONS) {
|
|
1417
|
+
if (typeof console !== "undefined") {
|
|
1418
|
+
console.error(
|
|
1419
|
+
`[SibuJS] Notification queue exceeded ${MAX_DRAIN_ITERATIONS} iterations \u2014 likely an effect that writes to a signal it reads. Breaking to prevent infinite loop.`
|
|
1420
|
+
);
|
|
1421
|
+
}
|
|
1422
|
+
break;
|
|
1423
|
+
}
|
|
1419
1424
|
safeInvoke(pendingQueue[i2]);
|
|
1420
1425
|
i2++;
|
|
1421
1426
|
}
|
|
@@ -1745,7 +1750,15 @@ function dispose(node) {
|
|
|
1745
1750
|
const disposers = elementDisposers.get(current);
|
|
1746
1751
|
if (disposers) {
|
|
1747
1752
|
if (_isDev5) activeBindingCount -= disposers.length;
|
|
1748
|
-
for (const d of disposers)
|
|
1753
|
+
for (const d of disposers) {
|
|
1754
|
+
try {
|
|
1755
|
+
d();
|
|
1756
|
+
} catch (err) {
|
|
1757
|
+
if (_isDev5 && typeof console !== "undefined") {
|
|
1758
|
+
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1749
1762
|
elementDisposers.delete(current);
|
|
1750
1763
|
}
|
|
1751
1764
|
}
|
|
@@ -2679,19 +2692,16 @@ function Portal(nodes, target) {
|
|
|
2679
2692
|
portalContent = nodes();
|
|
2680
2693
|
container.appendChild(portalContent);
|
|
2681
2694
|
} catch (err) {
|
|
2682
|
-
|
|
2695
|
+
if (typeof console !== "undefined") {
|
|
2696
|
+
console.error("[Portal] Render error:", err);
|
|
2697
|
+
}
|
|
2683
2698
|
}
|
|
2684
2699
|
});
|
|
2685
|
-
|
|
2686
|
-
if (
|
|
2700
|
+
registerDisposer(anchor, () => {
|
|
2701
|
+
if (portalContent) {
|
|
2702
|
+
dispose(portalContent);
|
|
2687
2703
|
portalContent.remove();
|
|
2688
2704
|
portalContent = null;
|
|
2689
|
-
observer.disconnect();
|
|
2690
|
-
}
|
|
2691
|
-
});
|
|
2692
|
-
queueMicrotask(() => {
|
|
2693
|
-
if (anchor.parentNode) {
|
|
2694
|
-
observer.observe(anchor.parentNode, { childList: true });
|
|
2695
2705
|
}
|
|
2696
2706
|
});
|
|
2697
2707
|
return anchor;
|
|
@@ -3158,21 +3168,37 @@ function derived(getter, options) {
|
|
|
3158
3168
|
cs._v = getter();
|
|
3159
3169
|
}, markDirty);
|
|
3160
3170
|
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
3171
|
+
let evaluating = false;
|
|
3161
3172
|
function computedGetter() {
|
|
3173
|
+
if (evaluating) {
|
|
3174
|
+
throw new Error(
|
|
3175
|
+
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
3176
|
+
);
|
|
3177
|
+
}
|
|
3162
3178
|
if (trackingSuspended) {
|
|
3163
3179
|
if (cs._d) {
|
|
3164
|
-
|
|
3165
|
-
|
|
3180
|
+
evaluating = true;
|
|
3181
|
+
try {
|
|
3182
|
+
cs._d = false;
|
|
3183
|
+
cs._v = getter();
|
|
3184
|
+
} finally {
|
|
3185
|
+
evaluating = false;
|
|
3186
|
+
}
|
|
3166
3187
|
}
|
|
3167
3188
|
return cs._v;
|
|
3168
3189
|
}
|
|
3169
3190
|
recordDependency(cs);
|
|
3170
3191
|
if (cs._d) {
|
|
3171
3192
|
const oldValue = cs._v;
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3193
|
+
evaluating = true;
|
|
3194
|
+
try {
|
|
3195
|
+
track(() => {
|
|
3196
|
+
cs._d = false;
|
|
3197
|
+
cs._v = getter();
|
|
3198
|
+
}, markDirty);
|
|
3199
|
+
} finally {
|
|
3200
|
+
evaluating = false;
|
|
3201
|
+
}
|
|
3176
3202
|
if (hook && oldValue !== cs._v) {
|
|
3177
3203
|
hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
|
|
3178
3204
|
}
|
|
@@ -3303,16 +3329,6 @@ function ref(initial) {
|
|
|
3303
3329
|
};
|
|
3304
3330
|
}
|
|
3305
3331
|
|
|
3306
|
-
// src/core/signals/memo.ts
|
|
3307
|
-
function memo(factory) {
|
|
3308
|
-
return derived(factory);
|
|
3309
|
-
}
|
|
3310
|
-
|
|
3311
|
-
// src/core/signals/memoFn.ts
|
|
3312
|
-
function memoFn(callback) {
|
|
3313
|
-
return derived(callback);
|
|
3314
|
-
}
|
|
3315
|
-
|
|
3316
3332
|
// src/core/signals/array.ts
|
|
3317
3333
|
function array(initial = []) {
|
|
3318
3334
|
const [arr, setArr] = signal([...initial]);
|
|
@@ -3510,21 +3526,67 @@ function deepEqual(a2, b2, seen) {
|
|
|
3510
3526
|
if (a2 == null || b2 == null) return false;
|
|
3511
3527
|
if (typeof a2 !== typeof b2) return false;
|
|
3512
3528
|
if (typeof a2 !== "object") return false;
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
if (
|
|
3516
|
-
if (
|
|
3517
|
-
|
|
3529
|
+
const objA = a2;
|
|
3530
|
+
const objB = b2;
|
|
3531
|
+
if (objA.constructor !== objB.constructor) return false;
|
|
3532
|
+
if (a2 instanceof Date) return a2.getTime() === b2.getTime();
|
|
3533
|
+
if (a2 instanceof RegExp) {
|
|
3534
|
+
const rb = b2;
|
|
3535
|
+
return a2.source === rb.source && a2.flags === rb.flags;
|
|
3536
|
+
}
|
|
3537
|
+
if (!seen) seen = /* @__PURE__ */ new Map();
|
|
3538
|
+
let peers = seen.get(objA);
|
|
3539
|
+
if (peers?.has(objB)) return true;
|
|
3540
|
+
if (!peers) {
|
|
3541
|
+
peers = /* @__PURE__ */ new Set();
|
|
3542
|
+
seen.set(objA, peers);
|
|
3543
|
+
}
|
|
3544
|
+
peers.add(objB);
|
|
3545
|
+
if (a2 instanceof Map) {
|
|
3546
|
+
const mb = b2;
|
|
3547
|
+
if (a2.size !== mb.size) return false;
|
|
3548
|
+
for (const [k, v] of a2) {
|
|
3549
|
+
if (!mb.has(k)) return false;
|
|
3550
|
+
if (!deepEqual(v, mb.get(k), seen)) return false;
|
|
3551
|
+
}
|
|
3552
|
+
return true;
|
|
3553
|
+
}
|
|
3554
|
+
if (a2 instanceof Set) {
|
|
3555
|
+
const sb = b2;
|
|
3556
|
+
if (a2.size !== sb.size) return false;
|
|
3557
|
+
for (const item of a2) {
|
|
3558
|
+
if (!sb.has(item)) return false;
|
|
3559
|
+
}
|
|
3560
|
+
return true;
|
|
3561
|
+
}
|
|
3562
|
+
if (a2 instanceof ArrayBuffer) {
|
|
3563
|
+
const viewA = new Uint8Array(a2);
|
|
3564
|
+
const viewB = new Uint8Array(b2);
|
|
3565
|
+
if (viewA.length !== viewB.length) return false;
|
|
3566
|
+
for (let i2 = 0; i2 < viewA.length; i2++) {
|
|
3567
|
+
if (viewA[i2] !== viewB[i2]) return false;
|
|
3568
|
+
}
|
|
3569
|
+
return true;
|
|
3570
|
+
}
|
|
3571
|
+
if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
|
|
3572
|
+
const ta = a2;
|
|
3573
|
+
const tb = b2;
|
|
3574
|
+
if (ta.length !== tb.length) return false;
|
|
3575
|
+
for (let i2 = 0; i2 < ta.length; i2++) {
|
|
3576
|
+
if (ta[i2] !== tb[i2]) return false;
|
|
3577
|
+
}
|
|
3578
|
+
return true;
|
|
3579
|
+
}
|
|
3518
3580
|
if (Array.isArray(a2)) {
|
|
3519
3581
|
if (!Array.isArray(b2)) return false;
|
|
3520
3582
|
if (a2.length !== b2.length) return false;
|
|
3521
3583
|
return a2.every((val, i2) => deepEqual(val, b2[i2], seen));
|
|
3522
3584
|
}
|
|
3523
|
-
const keysA = Object.keys(
|
|
3524
|
-
const keysB = Object.keys(
|
|
3585
|
+
const keysA = Object.keys(objA);
|
|
3586
|
+
const keysB = Object.keys(objB);
|
|
3525
3587
|
if (keysA.length !== keysB.length) return false;
|
|
3526
3588
|
return keysA.every(
|
|
3527
|
-
(key) => deepEqual(
|
|
3589
|
+
(key) => deepEqual(objA[key], objB[key], seen)
|
|
3528
3590
|
);
|
|
3529
3591
|
}
|
|
3530
3592
|
function deepSignal(initial) {
|
|
@@ -3584,29 +3646,35 @@ function asyncDerived(factory, initial) {
|
|
|
3584
3646
|
// src/core/rendering/lifecycle.ts
|
|
3585
3647
|
function safeCall(cb, hookName) {
|
|
3586
3648
|
try {
|
|
3587
|
-
cb();
|
|
3649
|
+
return cb();
|
|
3588
3650
|
} catch (err) {
|
|
3589
3651
|
devWarn(`${hookName}: callback threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
3652
|
+
return void 0;
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
function runMountCallback(callback, hookName, element) {
|
|
3656
|
+
const cleanup2 = safeCall(callback, hookName);
|
|
3657
|
+
if (typeof cleanup2 === "function" && element) {
|
|
3658
|
+
registerDisposer(element, cleanup2);
|
|
3590
3659
|
}
|
|
3591
3660
|
}
|
|
3592
3661
|
function onMount(callback, element) {
|
|
3593
3662
|
if (typeof document === "undefined") return;
|
|
3594
3663
|
if (element) {
|
|
3595
3664
|
if (element.isConnected) {
|
|
3596
|
-
queueMicrotask(() =>
|
|
3597
|
-
safeCall(callback, "onMount");
|
|
3598
|
-
});
|
|
3665
|
+
queueMicrotask(() => runMountCallback(callback, "onMount", element));
|
|
3599
3666
|
return;
|
|
3600
3667
|
}
|
|
3601
3668
|
const observer = new MutationObserver(() => {
|
|
3602
3669
|
if (element.isConnected) {
|
|
3603
3670
|
observer.disconnect();
|
|
3604
|
-
|
|
3671
|
+
runMountCallback(callback, "onMount", element);
|
|
3605
3672
|
}
|
|
3606
3673
|
});
|
|
3674
|
+
registerDisposer(element, () => observer.disconnect());
|
|
3607
3675
|
queueMicrotask(() => {
|
|
3608
3676
|
if (element.isConnected) {
|
|
3609
|
-
|
|
3677
|
+
runMountCallback(callback, "onMount", element);
|
|
3610
3678
|
} else {
|
|
3611
3679
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
3612
3680
|
}
|
|
@@ -3618,6 +3686,7 @@ function onMount(callback, element) {
|
|
|
3618
3686
|
}
|
|
3619
3687
|
}
|
|
3620
3688
|
function onUnmount(callback, element) {
|
|
3689
|
+
registerDisposer(element, () => safeCall(callback, "onUnmount"));
|
|
3621
3690
|
const startObserving = () => {
|
|
3622
3691
|
const observer = new MutationObserver(() => {
|
|
3623
3692
|
if (!element.isConnected) {
|
|
@@ -3626,6 +3695,7 @@ function onUnmount(callback, element) {
|
|
|
3626
3695
|
}
|
|
3627
3696
|
});
|
|
3628
3697
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
3698
|
+
registerDisposer(element, () => observer.disconnect());
|
|
3629
3699
|
};
|
|
3630
3700
|
if (element.isConnected) {
|
|
3631
3701
|
startObserving();
|
|
@@ -3776,26 +3846,24 @@ function lazy(importFn) {
|
|
|
3776
3846
|
if (cached) {
|
|
3777
3847
|
return cached();
|
|
3778
3848
|
}
|
|
3779
|
-
const [_status, setStatus] = signal("loading");
|
|
3780
|
-
const [_error, setError] = signal(null);
|
|
3781
3849
|
const container = div({ class: "sibu-lazy" });
|
|
3850
|
+
let disposed = false;
|
|
3782
3851
|
importFn().then((mod) => {
|
|
3852
|
+
if (disposed) return;
|
|
3783
3853
|
cached = mod.default;
|
|
3784
3854
|
const rendered = cached();
|
|
3785
3855
|
container.replaceChildren(rendered);
|
|
3786
|
-
setStatus("loaded");
|
|
3787
3856
|
}).catch((err) => {
|
|
3857
|
+
if (disposed) return;
|
|
3788
3858
|
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
3789
|
-
|
|
3790
|
-
setStatus("error");
|
|
3791
|
-
container.replaceChildren(
|
|
3792
|
-
div({
|
|
3793
|
-
class: "sibu-lazy-error",
|
|
3794
|
-
nodes: `Failed to load component: ${errorObj.message}`
|
|
3795
|
-
})
|
|
3796
|
-
);
|
|
3859
|
+
container.replaceChildren(div("sibu-lazy-error", `Failed to load component: ${errorObj.message}`));
|
|
3797
3860
|
});
|
|
3798
|
-
container.appendChild(span(
|
|
3861
|
+
container.appendChild(span("sibu-lazy-loading", "Loading..."));
|
|
3862
|
+
const origRemove = container.remove.bind(container);
|
|
3863
|
+
container.remove = () => {
|
|
3864
|
+
disposed = true;
|
|
3865
|
+
origRemove();
|
|
3866
|
+
};
|
|
3799
3867
|
return container;
|
|
3800
3868
|
};
|
|
3801
3869
|
}
|
|
@@ -4907,14 +4975,11 @@ var moduleSizes = {
|
|
|
4907
4975
|
"core/watch": 300,
|
|
4908
4976
|
"core/store": 380,
|
|
4909
4977
|
"core/ref": 150,
|
|
4910
|
-
"core/memo": 180,
|
|
4911
|
-
"core/memoFn": 160,
|
|
4912
4978
|
"core/array": 420,
|
|
4913
4979
|
"core/deepSignal": 500,
|
|
4914
4980
|
"core/lifecycle": 300,
|
|
4915
4981
|
"core/context": 350,
|
|
4916
4982
|
"core/persist": 400,
|
|
4917
|
-
"core/primitives": 200,
|
|
4918
4983
|
"core/hoc": 280,
|
|
4919
4984
|
"core/transition": 600,
|
|
4920
4985
|
"core/form": 750,
|
|
@@ -5065,7 +5130,7 @@ var lintRules = {
|
|
|
5065
5130
|
description: "Signal functions should not be called inside conditionals, loops, or nested functions",
|
|
5066
5131
|
check(source2) {
|
|
5067
5132
|
const violations = [];
|
|
5068
|
-
const hookNames = ["signal", "effect", "derived", "
|
|
5133
|
+
const hookNames = ["signal", "effect", "derived", "ref", "watch", "store"];
|
|
5069
5134
|
const hookPattern = new RegExp(`\\b(${hookNames.join("|")})\\s*\\(`, "g");
|
|
5070
5135
|
const lines = source2.split("\n");
|
|
5071
5136
|
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
@@ -5424,30 +5489,6 @@ function getComponentMetadata() {
|
|
|
5424
5489
|
}
|
|
5425
5490
|
]
|
|
5426
5491
|
},
|
|
5427
|
-
{
|
|
5428
|
-
name: "memo",
|
|
5429
|
-
description: "Returns a memoized value that only recomputes when its reactive dependencies change. Alias for derived.",
|
|
5430
|
-
props: [
|
|
5431
|
-
{
|
|
5432
|
-
name: "factory",
|
|
5433
|
-
type: "() => T",
|
|
5434
|
-
required: true,
|
|
5435
|
-
description: "Function that computes the memoized value"
|
|
5436
|
-
}
|
|
5437
|
-
]
|
|
5438
|
-
},
|
|
5439
|
-
{
|
|
5440
|
-
name: "memoFn",
|
|
5441
|
-
description: "Returns a memoized callback that only updates when its reactive dependencies change.",
|
|
5442
|
-
props: [
|
|
5443
|
-
{
|
|
5444
|
-
name: "callback",
|
|
5445
|
-
type: "() => T",
|
|
5446
|
-
required: true,
|
|
5447
|
-
description: "The callback factory function to memoize"
|
|
5448
|
-
}
|
|
5449
|
-
]
|
|
5450
|
-
},
|
|
5451
5492
|
{
|
|
5452
5493
|
name: "ref",
|
|
5453
5494
|
description: "Creates a mutable reference object that persists across renders. Updating a ref does NOT trigger re-renders.",
|
|
@@ -5491,43 +5532,6 @@ function getComponentMetadata() {
|
|
|
5491
5532
|
}
|
|
5492
5533
|
]
|
|
5493
5534
|
},
|
|
5494
|
-
// ── SolidJS-style Primitives ─────────────────────────────────────
|
|
5495
|
-
{
|
|
5496
|
-
name: "createSignal",
|
|
5497
|
-
description: "Creates a reactive signal. SolidJS-style alias for signal. Returns [getter, setter].",
|
|
5498
|
-
props: [
|
|
5499
|
-
{
|
|
5500
|
-
name: "value",
|
|
5501
|
-
type: "T",
|
|
5502
|
-
required: true,
|
|
5503
|
-
description: "Initial value"
|
|
5504
|
-
}
|
|
5505
|
-
]
|
|
5506
|
-
},
|
|
5507
|
-
{
|
|
5508
|
-
name: "createMemo",
|
|
5509
|
-
description: "Creates a derived/computed reactive value. SolidJS-style alias for derived.",
|
|
5510
|
-
props: [
|
|
5511
|
-
{
|
|
5512
|
-
name: "fn",
|
|
5513
|
-
type: "() => T",
|
|
5514
|
-
required: true,
|
|
5515
|
-
description: "Computation function that reads other signals"
|
|
5516
|
-
}
|
|
5517
|
-
]
|
|
5518
|
-
},
|
|
5519
|
-
{
|
|
5520
|
-
name: "createEffect",
|
|
5521
|
-
description: "Creates a reactive side effect. SolidJS-style alias for effect.",
|
|
5522
|
-
props: [
|
|
5523
|
-
{
|
|
5524
|
-
name: "fn",
|
|
5525
|
-
type: "() => void",
|
|
5526
|
-
required: true,
|
|
5527
|
-
description: "Effect function that reads reactive signals"
|
|
5528
|
-
}
|
|
5529
|
-
]
|
|
5530
|
-
},
|
|
5531
5535
|
// ── Lifecycle ────────────────────────────────────────────────────
|
|
5532
5536
|
{
|
|
5533
5537
|
name: "onMount",
|
|
@@ -5859,11 +5863,6 @@ function generateVSCodeSnippets() {
|
|
|
5859
5863
|
"});"
|
|
5860
5864
|
],
|
|
5861
5865
|
description: "Create a reactive form with validation"
|
|
5862
|
-
},
|
|
5863
|
-
"SibuJS createSignal": {
|
|
5864
|
-
prefix: "sibu-signal",
|
|
5865
|
-
body: ["const [${1:value}, ${2:setValue}] = createSignal(${3:initialValue});"],
|
|
5866
|
-
description: "Create a reactive signal (SolidJS-style alias for signal)"
|
|
5867
5866
|
}
|
|
5868
5867
|
};
|
|
5869
5868
|
}
|
|
@@ -5895,10 +5894,6 @@ function generateTypeStubs() {
|
|
|
5895
5894
|
signal: ["declare function signal<T>(initial: T): [() => T, (next: T | ((prev: T) => T)) => void];"].join("\n"),
|
|
5896
5895
|
effect: ["declare function effect(effectFn: () => void): () => void;"].join("\n"),
|
|
5897
5896
|
derived: ["declare function derived<T>(getter: () => T): () => T;"].join("\n"),
|
|
5898
|
-
memo: ["declare function memo<T>(factory: () => T): () => T;"].join("\n"),
|
|
5899
|
-
memoFn: ["declare function memoFn<T extends (...args: unknown[]) => unknown>(callback: () => T): () => T;"].join(
|
|
5900
|
-
"\n"
|
|
5901
|
-
),
|
|
5902
5897
|
ref: [
|
|
5903
5898
|
"interface Ref<T> { current: T; }",
|
|
5904
5899
|
"declare function ref<T>(initial: T): Ref<T>;",
|
|
@@ -5917,11 +5912,6 @@ function generateTypeStubs() {
|
|
|
5917
5912
|
"}",
|
|
5918
5913
|
"declare function store<T extends object>(initialState: T): [{ readonly [K in keyof T]: T[K] }, StoreActions<T>];"
|
|
5919
5914
|
].join("\n"),
|
|
5920
|
-
createSignal: ["declare function createSignal<T>(value: T): [() => T, (next: T | ((prev: T) => T)) => void];"].join(
|
|
5921
|
-
"\n"
|
|
5922
|
-
),
|
|
5923
|
-
createMemo: ["declare function createMemo<T>(fn: () => T): () => T;"].join("\n"),
|
|
5924
|
-
createEffect: ["declare function createEffect(fn: () => void): () => void;"].join("\n"),
|
|
5925
5915
|
mount: [
|
|
5926
5916
|
"declare function mount(component: (() => HTMLElement) | HTMLElement | Node, container: HTMLElement | null): { node: Node; unmount: () => void };"
|
|
5927
5917
|
].join("\n"),
|
package/dist/build.d.cts
CHANGED
|
@@ -503,7 +503,7 @@ interface StaticAnalysisResult {
|
|
|
503
503
|
* converted to template cloning at build time.
|
|
504
504
|
*
|
|
505
505
|
* Detects patterns like:
|
|
506
|
-
* div({ class: "card", id: "main",
|
|
506
|
+
* div({ class: "card", id: "main" }, "Hello")
|
|
507
507
|
*
|
|
508
508
|
* And identifies them as candidates for:
|
|
509
509
|
* staticTemplate('<div class="card" id="main">Hello</div>')
|
package/dist/build.d.ts
CHANGED
|
@@ -503,7 +503,7 @@ interface StaticAnalysisResult {
|
|
|
503
503
|
* converted to template cloning at build time.
|
|
504
504
|
*
|
|
505
505
|
* Detects patterns like:
|
|
506
|
-
* div({ class: "card", id: "main",
|
|
506
|
+
* div({ class: "card", id: "main" }, "Hello")
|
|
507
507
|
*
|
|
508
508
|
* And identifies them as candidates for:
|
|
509
509
|
* staticTemplate('<div class="card" id="main">Hello</div>')
|
package/dist/build.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
index_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JCDUJN2F.js";
|
|
4
4
|
import "./chunk-YT6HQ6AM.js";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-P3XWXJZU.js";
|
|
6
|
+
import "./chunk-GJPXRJ45.js";
|
|
7
|
+
import "./chunk-6BMPXPUW.js";
|
|
8
|
+
import "./chunk-SFKNRVCU.js";
|
|
9
|
+
import "./chunk-5ZYQ6KDD.js";
|
|
10
|
+
import "./chunk-XHK6BDAJ.js";
|
|
11
11
|
import "./chunk-CMBFNA7L.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-VQNQZCWJ.js";
|
|
13
13
|
import "./chunk-EUZND3CB.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-NZIIMDWI.js";
|
|
15
|
+
import "./chunk-K4G4ZQNR.js";
|
|
16
16
|
import "./chunk-5X6PP2UK.js";
|
|
17
17
|
|
|
18
18
|
// src/build/compileTemplates.ts
|
|
@@ -589,7 +589,6 @@ function injectPureAnnotations(code) {
|
|
|
589
589
|
const sibuFactories = [
|
|
590
590
|
"tagFactory",
|
|
591
591
|
"context",
|
|
592
|
-
"composable",
|
|
593
592
|
"defineComponent",
|
|
594
593
|
"withProps",
|
|
595
594
|
"withDefaults",
|
|
@@ -811,7 +810,6 @@ function deepMerge(target, source) {
|
|
|
811
810
|
var PURE_FACTORIES = [
|
|
812
811
|
"tagFactory",
|
|
813
812
|
"context",
|
|
814
|
-
"composable",
|
|
815
813
|
"defineComponent",
|
|
816
814
|
"withProps",
|
|
817
815
|
"withDefaults",
|
|
@@ -1291,14 +1289,11 @@ var moduleSizes = {
|
|
|
1291
1289
|
"core/watch": 300,
|
|
1292
1290
|
"core/store": 380,
|
|
1293
1291
|
"core/ref": 150,
|
|
1294
|
-
"core/memo": 180,
|
|
1295
|
-
"core/memoFn": 160,
|
|
1296
1292
|
"core/array": 420,
|
|
1297
1293
|
"core/deepSignal": 500,
|
|
1298
1294
|
"core/lifecycle": 300,
|
|
1299
1295
|
"core/context": 350,
|
|
1300
1296
|
"core/persist": 400,
|
|
1301
|
-
"core/primitives": 200,
|
|
1302
1297
|
"core/hoc": 280,
|
|
1303
1298
|
"core/transition": 600,
|
|
1304
1299
|
"core/form": 750,
|
|
@@ -1449,7 +1444,7 @@ var lintRules = {
|
|
|
1449
1444
|
description: "Signal functions should not be called inside conditionals, loops, or nested functions",
|
|
1450
1445
|
check(source) {
|
|
1451
1446
|
const violations = [];
|
|
1452
|
-
const hookNames = ["signal", "effect", "derived", "
|
|
1447
|
+
const hookNames = ["signal", "effect", "derived", "ref", "watch", "store"];
|
|
1453
1448
|
const hookPattern = new RegExp(`\\b(${hookNames.join("|")})\\s*\\(`, "g");
|
|
1454
1449
|
const lines = source.split("\n");
|
|
1455
1450
|
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
@@ -1808,30 +1803,6 @@ function getComponentMetadata() {
|
|
|
1808
1803
|
}
|
|
1809
1804
|
]
|
|
1810
1805
|
},
|
|
1811
|
-
{
|
|
1812
|
-
name: "memo",
|
|
1813
|
-
description: "Returns a memoized value that only recomputes when its reactive dependencies change. Alias for derived.",
|
|
1814
|
-
props: [
|
|
1815
|
-
{
|
|
1816
|
-
name: "factory",
|
|
1817
|
-
type: "() => T",
|
|
1818
|
-
required: true,
|
|
1819
|
-
description: "Function that computes the memoized value"
|
|
1820
|
-
}
|
|
1821
|
-
]
|
|
1822
|
-
},
|
|
1823
|
-
{
|
|
1824
|
-
name: "memoFn",
|
|
1825
|
-
description: "Returns a memoized callback that only updates when its reactive dependencies change.",
|
|
1826
|
-
props: [
|
|
1827
|
-
{
|
|
1828
|
-
name: "callback",
|
|
1829
|
-
type: "() => T",
|
|
1830
|
-
required: true,
|
|
1831
|
-
description: "The callback factory function to memoize"
|
|
1832
|
-
}
|
|
1833
|
-
]
|
|
1834
|
-
},
|
|
1835
1806
|
{
|
|
1836
1807
|
name: "ref",
|
|
1837
1808
|
description: "Creates a mutable reference object that persists across renders. Updating a ref does NOT trigger re-renders.",
|
|
@@ -1875,43 +1846,6 @@ function getComponentMetadata() {
|
|
|
1875
1846
|
}
|
|
1876
1847
|
]
|
|
1877
1848
|
},
|
|
1878
|
-
// ── SolidJS-style Primitives ─────────────────────────────────────
|
|
1879
|
-
{
|
|
1880
|
-
name: "createSignal",
|
|
1881
|
-
description: "Creates a reactive signal. SolidJS-style alias for signal. Returns [getter, setter].",
|
|
1882
|
-
props: [
|
|
1883
|
-
{
|
|
1884
|
-
name: "value",
|
|
1885
|
-
type: "T",
|
|
1886
|
-
required: true,
|
|
1887
|
-
description: "Initial value"
|
|
1888
|
-
}
|
|
1889
|
-
]
|
|
1890
|
-
},
|
|
1891
|
-
{
|
|
1892
|
-
name: "createMemo",
|
|
1893
|
-
description: "Creates a derived/computed reactive value. SolidJS-style alias for derived.",
|
|
1894
|
-
props: [
|
|
1895
|
-
{
|
|
1896
|
-
name: "fn",
|
|
1897
|
-
type: "() => T",
|
|
1898
|
-
required: true,
|
|
1899
|
-
description: "Computation function that reads other signals"
|
|
1900
|
-
}
|
|
1901
|
-
]
|
|
1902
|
-
},
|
|
1903
|
-
{
|
|
1904
|
-
name: "createEffect",
|
|
1905
|
-
description: "Creates a reactive side effect. SolidJS-style alias for effect.",
|
|
1906
|
-
props: [
|
|
1907
|
-
{
|
|
1908
|
-
name: "fn",
|
|
1909
|
-
type: "() => void",
|
|
1910
|
-
required: true,
|
|
1911
|
-
description: "Effect function that reads reactive signals"
|
|
1912
|
-
}
|
|
1913
|
-
]
|
|
1914
|
-
},
|
|
1915
1849
|
// ── Lifecycle ────────────────────────────────────────────────────
|
|
1916
1850
|
{
|
|
1917
1851
|
name: "onMount",
|
|
@@ -2243,11 +2177,6 @@ function generateVSCodeSnippets() {
|
|
|
2243
2177
|
"});"
|
|
2244
2178
|
],
|
|
2245
2179
|
description: "Create a reactive form with validation"
|
|
2246
|
-
},
|
|
2247
|
-
"SibuJS createSignal": {
|
|
2248
|
-
prefix: "sibu-signal",
|
|
2249
|
-
body: ["const [${1:value}, ${2:setValue}] = createSignal(${3:initialValue});"],
|
|
2250
|
-
description: "Create a reactive signal (SolidJS-style alias for signal)"
|
|
2251
2180
|
}
|
|
2252
2181
|
};
|
|
2253
2182
|
}
|
|
@@ -2279,10 +2208,6 @@ function generateTypeStubs() {
|
|
|
2279
2208
|
signal: ["declare function signal<T>(initial: T): [() => T, (next: T | ((prev: T) => T)) => void];"].join("\n"),
|
|
2280
2209
|
effect: ["declare function effect(effectFn: () => void): () => void;"].join("\n"),
|
|
2281
2210
|
derived: ["declare function derived<T>(getter: () => T): () => T;"].join("\n"),
|
|
2282
|
-
memo: ["declare function memo<T>(factory: () => T): () => T;"].join("\n"),
|
|
2283
|
-
memoFn: ["declare function memoFn<T extends (...args: unknown[]) => unknown>(callback: () => T): () => T;"].join(
|
|
2284
|
-
"\n"
|
|
2285
|
-
),
|
|
2286
2211
|
ref: [
|
|
2287
2212
|
"interface Ref<T> { current: T; }",
|
|
2288
2213
|
"declare function ref<T>(initial: T): Ref<T>;",
|
|
@@ -2301,11 +2226,6 @@ function generateTypeStubs() {
|
|
|
2301
2226
|
"}",
|
|
2302
2227
|
"declare function store<T extends object>(initialState: T): [{ readonly [K in keyof T]: T[K] }, StoreActions<T>];"
|
|
2303
2228
|
].join("\n"),
|
|
2304
|
-
createSignal: ["declare function createSignal<T>(value: T): [() => T, (next: T | ((prev: T) => T)) => void];"].join(
|
|
2305
|
-
"\n"
|
|
2306
|
-
),
|
|
2307
|
-
createMemo: ["declare function createMemo<T>(fn: () => T): () => T;"].join("\n"),
|
|
2308
|
-
createEffect: ["declare function createEffect(fn: () => void): () => void;"].join("\n"),
|
|
2309
2229
|
mount: [
|
|
2310
2230
|
"declare function mount(component: (() => HTMLElement) | HTMLElement | Node, container: HTMLElement | null): { node: Node; unmount: () => void };"
|
|
2311
2231
|
].join("\n"),
|