sibujs 2.0.0 → 2.2.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/browser.cjs +369 -276
- package/dist/browser.js +4 -4
- package/dist/build.cjs +411 -300
- package/dist/build.js +10 -10
- package/dist/cdn.global.js +8 -8
- package/dist/{chunk-JA6667UN.js → chunk-2JQUV4Y3.js} +4 -4
- package/dist/{chunk-3NSGB5JN.js → chunk-2KM2724A.js} +2 -2
- package/dist/{chunk-52YJLLRO.js → chunk-4YTVESDX.js} +1 -1
- package/dist/chunk-5WD7BYTZ.js +152 -0
- package/dist/{chunk-CC65Y57T.js → chunk-6QZO7MMG.js} +48 -16
- package/dist/{chunk-54EDRCEF.js → chunk-DF3GTP4Q.js} +7 -2
- package/dist/{chunk-ND2664SF.js → chunk-J63GPPCJ.js} +13 -9
- package/dist/{chunk-O2MNQFLP.js → chunk-KH4OE6WY.js} +5 -5
- package/dist/{chunk-3LR7GLWQ.js → chunk-KZA7ANXP.js} +3 -3
- package/dist/chunk-L4DAT4WU.js +400 -0
- package/dist/{chunk-WOMYAHHI.js → chunk-L52H775O.js} +4 -4
- package/dist/{chunk-ITX6OO3F.js → chunk-NEWH4O5U.js} +1 -1
- package/dist/{chunk-7JDB7I65.js → chunk-RJIRT46U.js} +4 -4
- package/dist/{chunk-KLRMB5ZS.js → chunk-STFTTMO2.js} +2 -2
- package/dist/{chunk-DFPFITST.js → chunk-UKMXT5T6.js} +1 -1
- package/dist/{chunk-SAHNHTFC.js → chunk-V65KTDZW.js} +3 -3
- package/dist/{chunk-R73P76YZ.js → chunk-VSNLICTS.js} +1 -1
- package/dist/{chunk-MIUAXB7K.js → chunk-XDKP4T7G.js} +2 -2
- package/dist/{chunk-JXMMDLBY.js → chunk-XVYB3J6C.js} +27 -29
- package/dist/{chunk-GTBNNBJ6.js → chunk-YMOIAHWA.js} +1 -1
- package/dist/data.cjs +382 -274
- package/dist/data.js +6 -6
- package/dist/devtools.cjs +398 -284
- package/dist/devtools.d.cts +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +382 -274
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +421 -299
- package/dist/extras.d.cts +1 -1
- package/dist/extras.d.ts +1 -1
- package/dist/extras.js +19 -19
- package/dist/index.cjs +413 -300
- package/dist/index.d.cts +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.js +14 -10
- package/dist/{introspect-cY2pg9pW.d.ts → introspect-BZWKvQUZ.d.ts} +2 -1
- package/dist/{introspect-BWNjNw64.d.cts → introspect-DsJlDD2T.d.cts} +2 -1
- package/dist/motion.cjs +189 -149
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +382 -274
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +360 -260
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +376 -257
- package/dist/plugins.js +6 -6
- package/dist/ssr.cjs +383 -271
- package/dist/ssr.js +7 -7
- package/dist/testing.cjs +168 -109
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +373 -258
- package/dist/ui.js +6 -6
- package/dist/widgets.cjs +382 -274
- package/dist/widgets.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-HB24TBAF.js +0 -121
- package/dist/chunk-VLPPXTYG.js +0 -332
package/dist/ssr.js
CHANGED
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
wasm,
|
|
23
23
|
worker,
|
|
24
24
|
workerFn
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-V65KTDZW.js";
|
|
26
|
+
import "./chunk-VSNLICTS.js";
|
|
27
27
|
import {
|
|
28
28
|
collectStream,
|
|
29
29
|
deserializeState,
|
|
@@ -43,14 +43,14 @@ import {
|
|
|
43
43
|
suspenseSwapScript,
|
|
44
44
|
trustHTML
|
|
45
45
|
} from "./chunk-JYD2PWXH.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-STFTTMO2.js";
|
|
47
|
+
import "./chunk-UKMXT5T6.js";
|
|
48
48
|
import "./chunk-2UPRY23K.js";
|
|
49
49
|
import "./chunk-UCS6AMJ7.js";
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-5WD7BYTZ.js";
|
|
51
51
|
import "./chunk-2RA7SHDA.js";
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
52
|
+
import "./chunk-6QZO7MMG.js";
|
|
53
|
+
import "./chunk-L4DAT4WU.js";
|
|
54
54
|
import "./chunk-LMLD24FC.js";
|
|
55
55
|
export {
|
|
56
56
|
Head,
|
package/dist/testing.cjs
CHANGED
|
@@ -1549,59 +1549,88 @@ function testComponent(component, options = {}) {
|
|
|
1549
1549
|
|
|
1550
1550
|
// src/reactivity/track.ts
|
|
1551
1551
|
var _isDev3 = isDev();
|
|
1552
|
-
var
|
|
1553
|
-
var
|
|
1554
|
-
|
|
1552
|
+
var POOL_MAX = 4096;
|
|
1553
|
+
var nodePool = [];
|
|
1554
|
+
function freeNode(node) {
|
|
1555
|
+
node.sig = null;
|
|
1556
|
+
node.sub = null;
|
|
1557
|
+
node.sigPrev = null;
|
|
1558
|
+
node.sigNext = null;
|
|
1559
|
+
node.subPrev = null;
|
|
1560
|
+
node.subNext = null;
|
|
1561
|
+
node.prevActive = null;
|
|
1562
|
+
if (nodePool.length < POOL_MAX) nodePool.push(node);
|
|
1563
|
+
}
|
|
1564
|
+
function unlinkSignal(node) {
|
|
1565
|
+
const sig = node.sig;
|
|
1566
|
+
if (!sig) return;
|
|
1567
|
+
const prev = node.sigPrev;
|
|
1568
|
+
const next = node.sigNext;
|
|
1569
|
+
if (prev) prev.sigNext = next;
|
|
1570
|
+
else sig.subsHead = next;
|
|
1571
|
+
if (next) next.sigPrev = prev;
|
|
1572
|
+
else sig.subsTail = prev;
|
|
1573
|
+
sig.__sc = (sig.__sc ?? 1) - 1;
|
|
1574
|
+
if (sig.__activeNode === node) sig.__activeNode = node.prevActive;
|
|
1575
|
+
if (sig.__sc === 0) {
|
|
1576
|
+
sig.subsHead = null;
|
|
1577
|
+
sig.subsTail = null;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
function unlinkSub(node) {
|
|
1581
|
+
const sub = node.sub;
|
|
1582
|
+
if (!sub) return;
|
|
1583
|
+
const prev = node.subPrev;
|
|
1584
|
+
const next = node.subNext;
|
|
1585
|
+
if (prev) prev.subNext = next;
|
|
1586
|
+
else sub.depsHead = next;
|
|
1587
|
+
if (next) next.subPrev = prev;
|
|
1588
|
+
else sub.depsTail = prev;
|
|
1589
|
+
}
|
|
1555
1590
|
var currentSubscriber = null;
|
|
1556
|
-
var
|
|
1557
|
-
function
|
|
1558
|
-
|
|
1559
|
-
cleanup(subscriber);
|
|
1560
|
-
++stackTop;
|
|
1561
|
-
if (stackTop >= stackCapacity) {
|
|
1562
|
-
stackCapacity *= 2;
|
|
1563
|
-
subscriberStack.length = stackCapacity;
|
|
1564
|
-
}
|
|
1565
|
-
subscriberStack[stackTop] = subscriber;
|
|
1591
|
+
var subscriberEpochCounter = 0;
|
|
1592
|
+
function retrack(effectFn, subscriber) {
|
|
1593
|
+
const prev = currentSubscriber;
|
|
1566
1594
|
currentSubscriber = subscriber;
|
|
1595
|
+
const sub = subscriber;
|
|
1596
|
+
const epoch = ++subscriberEpochCounter;
|
|
1597
|
+
sub._epoch = epoch;
|
|
1598
|
+
sub._structDirty = false;
|
|
1599
|
+
for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
|
|
1600
|
+
const sig = n.sig;
|
|
1601
|
+
n.prevActive = sig.__activeNode ?? null;
|
|
1602
|
+
sig.__activeNode = n;
|
|
1603
|
+
}
|
|
1567
1604
|
try {
|
|
1568
1605
|
effectFn();
|
|
1569
1606
|
} finally {
|
|
1570
|
-
|
|
1571
|
-
|
|
1607
|
+
currentSubscriber = prev;
|
|
1608
|
+
let node = sub.depsHead ?? null;
|
|
1609
|
+
while (node !== null) {
|
|
1610
|
+
const next = node.subNext;
|
|
1611
|
+
const sig = node.sig;
|
|
1612
|
+
sig.__activeNode = node.prevActive;
|
|
1613
|
+
node.prevActive = null;
|
|
1614
|
+
if (node.epoch !== epoch) {
|
|
1615
|
+
unlinkSub(node);
|
|
1616
|
+
unlinkSignal(node);
|
|
1617
|
+
freeNode(node);
|
|
1618
|
+
}
|
|
1619
|
+
node = next;
|
|
1620
|
+
}
|
|
1572
1621
|
}
|
|
1573
|
-
return () => cleanup(subscriber);
|
|
1574
1622
|
}
|
|
1575
1623
|
function cleanup(subscriber) {
|
|
1576
1624
|
const sub = subscriber;
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
singleDep.__f = subs.values().next().value;
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
sub._dep = void 0;
|
|
1589
|
-
return;
|
|
1590
|
-
}
|
|
1591
|
-
const deps = sub._deps;
|
|
1592
|
-
if (!deps || deps.size === 0) return;
|
|
1593
|
-
for (const signal of deps) {
|
|
1594
|
-
const subs = signal[SUBS];
|
|
1595
|
-
if (subs) {
|
|
1596
|
-
subs.delete(subscriber);
|
|
1597
|
-
if (signal.__f === subscriber) {
|
|
1598
|
-
signal.__f = subs.size === 1 ? subs.values().next().value : void 0;
|
|
1599
|
-
} else if (subs.size === 1 && signal.__f === void 0) {
|
|
1600
|
-
signal.__f = subs.values().next().value;
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1625
|
+
let node = sub.depsHead ?? null;
|
|
1626
|
+
sub.depsHead = null;
|
|
1627
|
+
sub.depsTail = null;
|
|
1628
|
+
while (node) {
|
|
1629
|
+
const next = node.subNext;
|
|
1630
|
+
unlinkSignal(node);
|
|
1631
|
+
freeNode(node);
|
|
1632
|
+
node = next;
|
|
1603
1633
|
}
|
|
1604
|
-
deps.clear();
|
|
1605
1634
|
}
|
|
1606
1635
|
|
|
1607
1636
|
// src/core/ssr-context.ts
|
|
@@ -1631,92 +1660,122 @@ function isSSR() {
|
|
|
1631
1660
|
|
|
1632
1661
|
// src/core/signals/effect.ts
|
|
1633
1662
|
var _g = globalThis;
|
|
1663
|
+
var MAX_RERUNS = 100;
|
|
1664
|
+
function flushUserCleanups(ctx) {
|
|
1665
|
+
const list = ctx.userCleanups;
|
|
1666
|
+
if (list.length === 0) return;
|
|
1667
|
+
ctx.userCleanups = [];
|
|
1668
|
+
for (let i = list.length - 1; i >= 0; i--) {
|
|
1669
|
+
try {
|
|
1670
|
+
list[i]();
|
|
1671
|
+
} catch (err) {
|
|
1672
|
+
if (typeof console !== "undefined") console.warn("[SibuJS effect] onCleanup threw:", err);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
function drainReruns(ctx) {
|
|
1677
|
+
let reruns = 1;
|
|
1678
|
+
do {
|
|
1679
|
+
ctx.rerunPending = false;
|
|
1680
|
+
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
1681
|
+
retrack(ctx.bodyFn, ctx.subscriber);
|
|
1682
|
+
} while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
|
|
1683
|
+
if (ctx.rerunPending) {
|
|
1684
|
+
ctx.rerunPending = false;
|
|
1685
|
+
if (_g.__SIBU_DEV_WARN__ !== false && typeof console !== "undefined") {
|
|
1686
|
+
console.error(
|
|
1687
|
+
`[SibuJS] effect re-requested itself ${MAX_RERUNS}+ times \u2014 likely a write-reads-self cycle. Breaking to prevent infinite loop.`
|
|
1688
|
+
);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
function disposeEffect(ctx) {
|
|
1693
|
+
if (ctx.disposed) return;
|
|
1694
|
+
ctx.disposed = true;
|
|
1695
|
+
const h = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1696
|
+
if (h) {
|
|
1697
|
+
try {
|
|
1698
|
+
h.emit("effect:destroy", { effectFn: ctx.fn });
|
|
1699
|
+
} catch {
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
try {
|
|
1703
|
+
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
1704
|
+
} catch (err) {
|
|
1705
|
+
if (typeof console !== "undefined") {
|
|
1706
|
+
console.warn("[SibuJS effect] onCleanup threw during dispose:", err);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
try {
|
|
1710
|
+
cleanup(ctx.subscriber);
|
|
1711
|
+
} catch (err) {
|
|
1712
|
+
if (typeof console !== "undefined") {
|
|
1713
|
+
console.warn("[SibuJS effect] dispose threw:", err);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1634
1717
|
function effect(effectFn, options) {
|
|
1635
1718
|
devAssert(typeof effectFn === "function", "effect: argument must be a function.");
|
|
1636
1719
|
if (isSSR()) return () => {
|
|
1637
1720
|
};
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
userCleanups
|
|
1721
|
+
const ctx = {
|
|
1722
|
+
fn: effectFn,
|
|
1723
|
+
onError: options?.onError,
|
|
1724
|
+
userCleanups: [],
|
|
1725
|
+
running: false,
|
|
1726
|
+
rerunPending: false,
|
|
1727
|
+
disposed: false,
|
|
1728
|
+
onCleanup: null,
|
|
1729
|
+
subscriber: null,
|
|
1730
|
+
bodyFn: null
|
|
1642
1731
|
};
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
const list = userCleanups;
|
|
1646
|
-
userCleanups = [];
|
|
1647
|
-
for (let i = list.length - 1; i >= 0; i--) {
|
|
1648
|
-
try {
|
|
1649
|
-
list[i]();
|
|
1650
|
-
} catch (err) {
|
|
1651
|
-
if (typeof console !== "undefined") {
|
|
1652
|
-
console.warn("[SibuJS effect] onCleanup threw:", err);
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1732
|
+
ctx.onCleanup = (fn) => {
|
|
1733
|
+
ctx.userCleanups.push(fn);
|
|
1656
1734
|
};
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1735
|
+
const onErrorCaptured = ctx.onError;
|
|
1736
|
+
ctx.bodyFn = onErrorCaptured ? () => {
|
|
1659
1737
|
try {
|
|
1660
|
-
|
|
1738
|
+
ctx.fn(ctx.onCleanup);
|
|
1661
1739
|
} catch (err) {
|
|
1662
|
-
|
|
1740
|
+
onErrorCaptured(err);
|
|
1663
1741
|
}
|
|
1664
|
-
} :
|
|
1665
|
-
|
|
1742
|
+
} : () => {
|
|
1743
|
+
ctx.fn(ctx.onCleanup);
|
|
1666
1744
|
};
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
if (_g.__SIBU_DEV_WARN__ !== false && typeof console !== "undefined") {
|
|
1671
|
-
console.warn(
|
|
1672
|
-
"[SibuJS] effect re-entered itself while running \u2014 the triggering update will be ignored. Wrap mutual writes in `batch()` or split the effect to avoid this."
|
|
1673
|
-
);
|
|
1674
|
-
}
|
|
1745
|
+
const sub = (() => {
|
|
1746
|
+
if (ctx.running) {
|
|
1747
|
+
ctx.rerunPending = true;
|
|
1675
1748
|
return;
|
|
1676
1749
|
}
|
|
1677
|
-
running = true;
|
|
1750
|
+
ctx.running = true;
|
|
1678
1751
|
try {
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1752
|
+
ctx.rerunPending = false;
|
|
1753
|
+
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
1754
|
+
retrack(ctx.bodyFn, sub);
|
|
1755
|
+
if (ctx.rerunPending) drainReruns(ctx);
|
|
1682
1756
|
} finally {
|
|
1683
|
-
running = false;
|
|
1757
|
+
ctx.running = false;
|
|
1758
|
+
ctx.rerunPending = false;
|
|
1684
1759
|
}
|
|
1685
|
-
};
|
|
1686
|
-
|
|
1760
|
+
});
|
|
1761
|
+
sub.depsHead = null;
|
|
1762
|
+
sub.depsTail = null;
|
|
1763
|
+
sub._epoch = 0;
|
|
1764
|
+
sub._structDirty = false;
|
|
1765
|
+
sub._runEpoch = 0;
|
|
1766
|
+
sub._runs = 0;
|
|
1767
|
+
ctx.subscriber = sub;
|
|
1768
|
+
ctx.running = true;
|
|
1687
1769
|
try {
|
|
1688
|
-
|
|
1770
|
+
retrack(ctx.bodyFn, ctx.subscriber);
|
|
1771
|
+
if (ctx.rerunPending) drainReruns(ctx);
|
|
1689
1772
|
} finally {
|
|
1690
|
-
running = false;
|
|
1773
|
+
ctx.running = false;
|
|
1774
|
+
ctx.rerunPending = false;
|
|
1691
1775
|
}
|
|
1692
1776
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1693
1777
|
if (hook) hook.emit("effect:create", { effectFn });
|
|
1694
|
-
|
|
1695
|
-
return () => {
|
|
1696
|
-
if (disposed) return;
|
|
1697
|
-
disposed = true;
|
|
1698
|
-
const h = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1699
|
-
if (h) {
|
|
1700
|
-
try {
|
|
1701
|
-
h.emit("effect:destroy", { effectFn });
|
|
1702
|
-
} catch {
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
try {
|
|
1706
|
-
runUserCleanups();
|
|
1707
|
-
} catch (err) {
|
|
1708
|
-
if (typeof console !== "undefined") {
|
|
1709
|
-
console.warn("[SibuJS effect] onCleanup threw during dispose:", err);
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
try {
|
|
1713
|
-
cleanupHandle();
|
|
1714
|
-
} catch (err) {
|
|
1715
|
-
if (typeof console !== "undefined") {
|
|
1716
|
-
console.warn("[SibuJS effect] dispose threw:", err);
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
};
|
|
1778
|
+
return () => disposeEffect(ctx);
|
|
1720
1779
|
}
|
|
1721
1780
|
|
|
1722
1781
|
// src/testing/queries.ts
|
package/dist/testing.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
} from "./chunk-2UPRY23K.js";
|
|
4
4
|
import {
|
|
5
5
|
effect
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5WD7BYTZ.js";
|
|
7
7
|
import "./chunk-2RA7SHDA.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-L4DAT4WU.js";
|
|
9
9
|
import "./chunk-LMLD24FC.js";
|
|
10
10
|
|
|
11
11
|
// src/testing/a11y.ts
|