sibujs 3.3.2 → 3.4.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 +21 -4
- package/dist/browser.js +4 -4
- package/dist/build.cjs +3343 -3009
- package/dist/build.js +12 -11
- package/dist/cdn.global.js +7 -7
- package/dist/{chunk-AEOLHSSQ.js → chunk-3DVGCW7O.js} +72 -25
- package/dist/{chunk-6TCOWMGY.js → chunk-3Z2NGWQI.js} +1 -1
- package/dist/chunk-7ZHH77QA.js +9 -0
- package/dist/{chunk-2ARSB7NG.js → chunk-APFRCIRI.js} +2906 -2569
- package/dist/{chunk-62V653X2.js → chunk-AXFWGY32.js} +79 -44
- package/dist/{chunk-N5TQVEKE.js → chunk-BUKYCWHX.js} +1 -1
- package/dist/{chunk-655B7MMR.js → chunk-CEBWDD63.js} +15 -8
- package/dist/{chunk-YUBEOWII.js → chunk-ELXMRSVN.js} +16 -5
- package/dist/{chunk-FJIRS3FM.js → chunk-F7HW2NI5.js} +1 -3
- package/dist/{chunk-P7C7SEJV.js → chunk-FKQG7FTY.js} +5 -5
- package/dist/{chunk-RLTFJYDN.js → chunk-H5FI5WDP.js} +1 -1
- package/dist/{chunk-G6N3LMO2.js → chunk-ITWCTZYH.js} +1 -1
- package/dist/{chunk-YUR5SX7F.js → chunk-JCO7AHNU.js} +70 -59
- package/dist/{chunk-ZEUP4TUD.js → chunk-JNGGM2XE.js} +6 -6
- package/dist/{chunk-QCFBIVIQ.js → chunk-K35BAR4P.js} +1 -1
- package/dist/{chunk-JCQG2I2G.js → chunk-KZBEVFXZ.js} +1 -1
- package/dist/{chunk-FJO2ZL4Q.js → chunk-OAVXAFAY.js} +73 -16
- package/dist/{chunk-A7CZH3GN.js → chunk-ODXVQ3CS.js} +41 -20
- package/dist/{chunk-4NJEAPLI.js → chunk-OOUQUCNN.js} +1 -1
- package/dist/{chunk-5VH3GIDX.js → chunk-RT3IYFN2.js} +1 -1
- package/dist/{chunk-Q46YIQYW.js → chunk-S3V6ZXPI.js} +22 -5
- package/dist/{chunk-IQJ36UTJ.js → chunk-WSGLJYFI.js} +31 -24
- package/dist/{chunk-3JHCYHWN.js → chunk-WWV3SJ3L.js} +19 -13
- package/dist/data.cjs +16 -2
- package/dist/data.js +7 -6
- package/dist/devtools.cjs +71 -21
- package/dist/devtools.d.cts +12 -5
- package/dist/devtools.d.ts +12 -5
- package/dist/devtools.js +6 -5
- package/dist/ecosystem.cjs +11 -2
- package/dist/ecosystem.d.cts +1 -1
- package/dist/ecosystem.d.ts +1 -1
- package/dist/ecosystem.js +10 -9
- package/dist/extras.cjs +454 -250
- package/dist/extras.d.cts +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/extras.js +26 -22
- package/dist/index.cjs +3385 -3045
- package/dist/index.d.cts +1179 -1057
- package/dist/index.d.ts +1179 -1057
- package/dist/index.js +32 -19
- package/dist/motion.cjs +223 -204
- package/dist/motion.d.cts +8 -1
- package/dist/motion.d.ts +8 -1
- package/dist/motion.js +6 -3
- package/dist/patterns.cjs +13 -6
- package/dist/patterns.d.cts +4 -1
- package/dist/patterns.d.ts +4 -1
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +70 -56
- package/dist/performance.js +6 -5
- package/dist/plugins.cjs +98 -42
- package/dist/plugins.d.cts +2 -1
- package/dist/plugins.d.ts +2 -1
- package/dist/plugins.js +89 -36
- package/dist/ssr.cjs +112 -91
- package/dist/ssr.d.cts +8 -1
- package/dist/ssr.d.ts +8 -1
- package/dist/ssr.js +9 -8
- package/dist/{tagFactory-S17H2qxu.d.ts → tagFactory-Bzupt4Pj.d.cts} +1 -1
- package/dist/{tagFactory-S17H2qxu.d.cts → tagFactory-Bzupt4Pj.d.ts} +1 -1
- package/dist/testing.cjs +18 -4
- package/dist/testing.js +18 -7
- package/dist/ui.cjs +322 -281
- package/dist/ui.d.cts +0 -20
- package/dist/ui.d.ts +0 -20
- package/dist/ui.js +27 -21
- package/dist/widgets.cjs +75 -13
- package/dist/widgets.d.cts +6 -1
- package/dist/widgets.d.ts +6 -1
- package/dist/widgets.js +7 -6
- package/package.json +4 -1
package/dist/ssr.cjs
CHANGED
|
@@ -713,8 +713,69 @@ function escapeAttr(str) {
|
|
|
713
713
|
return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
714
714
|
}
|
|
715
715
|
|
|
716
|
-
// src/
|
|
716
|
+
// src/core/rendering/dispose.ts
|
|
717
|
+
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
717
718
|
var _isDev3 = isDev();
|
|
719
|
+
var activeBindingCount = 0;
|
|
720
|
+
function registerDisposer(node, teardown) {
|
|
721
|
+
let disposers = elementDisposers.get(node);
|
|
722
|
+
if (!disposers) {
|
|
723
|
+
disposers = [];
|
|
724
|
+
elementDisposers.set(node, disposers);
|
|
725
|
+
}
|
|
726
|
+
disposers.push(teardown);
|
|
727
|
+
if (_isDev3) activeBindingCount++;
|
|
728
|
+
}
|
|
729
|
+
function dispose(node) {
|
|
730
|
+
const stack = [node];
|
|
731
|
+
const order = [];
|
|
732
|
+
while (stack.length > 0) {
|
|
733
|
+
const current = stack.pop();
|
|
734
|
+
order.push(current);
|
|
735
|
+
const children = Array.from(current.childNodes);
|
|
736
|
+
for (let i2 = 0; i2 < children.length; i2++) {
|
|
737
|
+
stack.push(children[i2]);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
for (let i2 = order.length - 1; i2 >= 0; i2--) {
|
|
741
|
+
const current = order[i2];
|
|
742
|
+
const disposers = elementDisposers.get(current);
|
|
743
|
+
if (disposers) {
|
|
744
|
+
const snapshot = disposers.slice();
|
|
745
|
+
elementDisposers.delete(current);
|
|
746
|
+
if (_isDev3) activeBindingCount -= snapshot.length;
|
|
747
|
+
for (const d of snapshot) {
|
|
748
|
+
try {
|
|
749
|
+
d();
|
|
750
|
+
} catch (err) {
|
|
751
|
+
if (_isDev3 && typeof console !== "undefined") {
|
|
752
|
+
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
let extraPasses = 0;
|
|
757
|
+
while (extraPasses++ < 8) {
|
|
758
|
+
const added = elementDisposers.get(current);
|
|
759
|
+
if (!added || added.length === 0) break;
|
|
760
|
+
const moreSnapshot = added.slice();
|
|
761
|
+
elementDisposers.delete(current);
|
|
762
|
+
if (_isDev3) activeBindingCount -= moreSnapshot.length;
|
|
763
|
+
for (const d of moreSnapshot) {
|
|
764
|
+
try {
|
|
765
|
+
d();
|
|
766
|
+
} catch (err) {
|
|
767
|
+
if (_isDev3 && typeof console !== "undefined") {
|
|
768
|
+
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// src/reactivity/track-core.ts
|
|
778
|
+
var _isDev4 = isDev();
|
|
718
779
|
var POOL_MAX = 4096;
|
|
719
780
|
var nodePool = [];
|
|
720
781
|
function createNode() {
|
|
@@ -806,7 +867,7 @@ function safeInvoke(sub2) {
|
|
|
806
867
|
try {
|
|
807
868
|
sub2();
|
|
808
869
|
} catch (err) {
|
|
809
|
-
if (
|
|
870
|
+
if (_isDev4) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
810
871
|
}
|
|
811
872
|
}
|
|
812
873
|
var suspendDepth = 0;
|
|
@@ -1128,14 +1189,14 @@ function forEachSubscriber(signal2, visit) {
|
|
|
1128
1189
|
}
|
|
1129
1190
|
|
|
1130
1191
|
// src/reactivity/track.ts
|
|
1131
|
-
var
|
|
1132
|
-
var _runtimeVersion = true ? "3.
|
|
1192
|
+
var _isDev5 = isDev();
|
|
1193
|
+
var _runtimeVersion = true ? "3.4.0" : "dev";
|
|
1133
1194
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1134
1195
|
function resolveReactiveApi() {
|
|
1135
1196
|
const g2 = globalThis;
|
|
1136
1197
|
const existing = g2[REGISTRY_KEY];
|
|
1137
1198
|
if (existing) {
|
|
1138
|
-
if (
|
|
1199
|
+
if (_isDev5 && !existing.__dupWarned) {
|
|
1139
1200
|
existing.__dupWarned = true;
|
|
1140
1201
|
devWarn(
|
|
1141
1202
|
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity still works \u2014 all copies share the first one \u2014 but de-duplicate sibujs in your bundler (e.g. Vite optimizeDeps.exclude: ['sibujs'] or resolve.dedupe: ['sibujs']).`
|
|
@@ -1430,6 +1491,7 @@ function Head(props) {
|
|
|
1430
1491
|
}
|
|
1431
1492
|
};
|
|
1432
1493
|
apply();
|
|
1494
|
+
registerDisposer(anchor, cleanup3);
|
|
1433
1495
|
return anchor;
|
|
1434
1496
|
}
|
|
1435
1497
|
function setStructuredData(data2) {
|
|
@@ -1522,7 +1584,7 @@ var isBatching = API2.isBatching;
|
|
|
1522
1584
|
|
|
1523
1585
|
// src/core/signals/signal.ts
|
|
1524
1586
|
var _g2 = globalThis;
|
|
1525
|
-
var
|
|
1587
|
+
var _isDev6 = isDev();
|
|
1526
1588
|
function signal(initial, options) {
|
|
1527
1589
|
const state = {
|
|
1528
1590
|
value: initial,
|
|
@@ -1533,7 +1595,7 @@ function signal(initial, options) {
|
|
|
1533
1595
|
__activeNode: null,
|
|
1534
1596
|
__name: void 0
|
|
1535
1597
|
};
|
|
1536
|
-
const debugName =
|
|
1598
|
+
const debugName = _isDev6 ? options?.name : void 0;
|
|
1537
1599
|
const equalsFn = options?.equals;
|
|
1538
1600
|
if (debugName) state.__name = debugName;
|
|
1539
1601
|
function get() {
|
|
@@ -1550,7 +1612,7 @@ function signal(initial, options) {
|
|
|
1550
1612
|
if (equalsFn(prev, newValue)) return;
|
|
1551
1613
|
state.value = newValue;
|
|
1552
1614
|
state.__v++;
|
|
1553
|
-
if (
|
|
1615
|
+
if (_isDev6) {
|
|
1554
1616
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1555
1617
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
1556
1618
|
}
|
|
@@ -1558,7 +1620,7 @@ function signal(initial, options) {
|
|
|
1558
1620
|
notifySubscribers2(state);
|
|
1559
1621
|
}
|
|
1560
1622
|
};
|
|
1561
|
-
} else if (
|
|
1623
|
+
} else if (_isDev6) {
|
|
1562
1624
|
set = (next) => {
|
|
1563
1625
|
const prev = state.value;
|
|
1564
1626
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -1583,7 +1645,7 @@ function signal(initial, options) {
|
|
|
1583
1645
|
}
|
|
1584
1646
|
};
|
|
1585
1647
|
}
|
|
1586
|
-
if (
|
|
1648
|
+
if (_isDev6) {
|
|
1587
1649
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1588
1650
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
1589
1651
|
}
|
|
@@ -1640,24 +1702,30 @@ function createAction(actionFn) {
|
|
|
1640
1702
|
const [data2, setData] = signal(void 0);
|
|
1641
1703
|
const [error, setError] = signal(void 0);
|
|
1642
1704
|
const [loading, setLoading] = signal(false);
|
|
1705
|
+
let activeRun = 0;
|
|
1643
1706
|
const submit = async (input2) => {
|
|
1707
|
+
const runId = ++activeRun;
|
|
1644
1708
|
batch(() => {
|
|
1645
1709
|
setLoading(true);
|
|
1646
1710
|
setError(void 0);
|
|
1647
1711
|
});
|
|
1648
1712
|
try {
|
|
1649
1713
|
const result = await actionFn(input2);
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1714
|
+
if (runId === activeRun) {
|
|
1715
|
+
batch(() => {
|
|
1716
|
+
setData(result);
|
|
1717
|
+
setLoading(false);
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1654
1720
|
return result;
|
|
1655
1721
|
} catch (err) {
|
|
1656
1722
|
const actionError = err instanceof Error ? err : new Error(String(err));
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1723
|
+
if (runId === activeRun) {
|
|
1724
|
+
batch(() => {
|
|
1725
|
+
setError(actionError);
|
|
1726
|
+
setLoading(false);
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1661
1729
|
throw actionError;
|
|
1662
1730
|
}
|
|
1663
1731
|
};
|
|
@@ -1671,15 +1739,14 @@ function scrollRestoration(options) {
|
|
|
1671
1739
|
let popstateHandler = null;
|
|
1672
1740
|
let currentKey = null;
|
|
1673
1741
|
const save = (key) => {
|
|
1674
|
-
|
|
1675
|
-
x: window.scrollX,
|
|
1676
|
-
|
|
1677
|
-
});
|
|
1742
|
+
if (typeof window !== "undefined") {
|
|
1743
|
+
positions.set(key, { x: window.scrollX, y: window.scrollY });
|
|
1744
|
+
}
|
|
1678
1745
|
currentKey = key;
|
|
1679
1746
|
};
|
|
1680
1747
|
const restore = (key) => {
|
|
1681
1748
|
const pos = positions.get(key);
|
|
1682
|
-
if (pos) {
|
|
1749
|
+
if (pos && typeof window !== "undefined") {
|
|
1683
1750
|
window.scrollTo(pos.x, pos.y);
|
|
1684
1751
|
}
|
|
1685
1752
|
currentKey = key;
|
|
@@ -1687,7 +1754,7 @@ function scrollRestoration(options) {
|
|
|
1687
1754
|
const getPosition = (key) => {
|
|
1688
1755
|
return positions.get(key);
|
|
1689
1756
|
};
|
|
1690
|
-
if (mode === "auto") {
|
|
1757
|
+
if (mode === "auto" && typeof window !== "undefined") {
|
|
1691
1758
|
popstateHandler = () => {
|
|
1692
1759
|
if (currentKey) {
|
|
1693
1760
|
save(currentKey);
|
|
@@ -1737,13 +1804,13 @@ function createMiddlewareChain() {
|
|
|
1737
1804
|
}
|
|
1738
1805
|
|
|
1739
1806
|
// src/reactivity/bindAttribute.ts
|
|
1740
|
-
var
|
|
1807
|
+
var _isDev7 = isDev();
|
|
1741
1808
|
function setProp(el, key, val) {
|
|
1742
1809
|
el[key] = val;
|
|
1743
1810
|
}
|
|
1744
1811
|
function bindAttribute(el, attr, getter) {
|
|
1745
1812
|
if (isEventHandlerAttr(attr)) {
|
|
1746
|
-
if (
|
|
1813
|
+
if (_isDev7)
|
|
1747
1814
|
devWarn(
|
|
1748
1815
|
`bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
|
|
1749
1816
|
);
|
|
@@ -1755,7 +1822,7 @@ function bindAttribute(el, attr, getter) {
|
|
|
1755
1822
|
try {
|
|
1756
1823
|
value = getter();
|
|
1757
1824
|
} catch (err) {
|
|
1758
|
-
if (
|
|
1825
|
+
if (_isDev7)
|
|
1759
1826
|
devWarn(`bindAttribute: getter for "${attr}" threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
1760
1827
|
return;
|
|
1761
1828
|
}
|
|
@@ -1779,67 +1846,6 @@ function bindAttribute(el, attr, getter) {
|
|
|
1779
1846
|
return reactiveBinding2(commit);
|
|
1780
1847
|
}
|
|
1781
1848
|
|
|
1782
|
-
// src/core/rendering/dispose.ts
|
|
1783
|
-
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
1784
|
-
var _isDev7 = isDev();
|
|
1785
|
-
var activeBindingCount = 0;
|
|
1786
|
-
function registerDisposer(node, teardown) {
|
|
1787
|
-
let disposers = elementDisposers.get(node);
|
|
1788
|
-
if (!disposers) {
|
|
1789
|
-
disposers = [];
|
|
1790
|
-
elementDisposers.set(node, disposers);
|
|
1791
|
-
}
|
|
1792
|
-
disposers.push(teardown);
|
|
1793
|
-
if (_isDev7) activeBindingCount++;
|
|
1794
|
-
}
|
|
1795
|
-
function dispose(node) {
|
|
1796
|
-
const stack = [node];
|
|
1797
|
-
const order = [];
|
|
1798
|
-
while (stack.length > 0) {
|
|
1799
|
-
const current = stack.pop();
|
|
1800
|
-
order.push(current);
|
|
1801
|
-
const children = Array.from(current.childNodes);
|
|
1802
|
-
for (let i2 = 0; i2 < children.length; i2++) {
|
|
1803
|
-
stack.push(children[i2]);
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
for (let i2 = order.length - 1; i2 >= 0; i2--) {
|
|
1807
|
-
const current = order[i2];
|
|
1808
|
-
const disposers = elementDisposers.get(current);
|
|
1809
|
-
if (disposers) {
|
|
1810
|
-
const snapshot = disposers.slice();
|
|
1811
|
-
elementDisposers.delete(current);
|
|
1812
|
-
if (_isDev7) activeBindingCount -= snapshot.length;
|
|
1813
|
-
for (const d of snapshot) {
|
|
1814
|
-
try {
|
|
1815
|
-
d();
|
|
1816
|
-
} catch (err) {
|
|
1817
|
-
if (_isDev7 && typeof console !== "undefined") {
|
|
1818
|
-
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
let extraPasses = 0;
|
|
1823
|
-
while (extraPasses++ < 8) {
|
|
1824
|
-
const added = elementDisposers.get(current);
|
|
1825
|
-
if (!added || added.length === 0) break;
|
|
1826
|
-
const moreSnapshot = added.slice();
|
|
1827
|
-
elementDisposers.delete(current);
|
|
1828
|
-
if (_isDev7) activeBindingCount -= moreSnapshot.length;
|
|
1829
|
-
for (const d of moreSnapshot) {
|
|
1830
|
-
try {
|
|
1831
|
-
d();
|
|
1832
|
-
} catch (err) {
|
|
1833
|
-
if (_isDev7 && typeof console !== "undefined") {
|
|
1834
|
-
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
1849
|
// src/reactivity/bindChildNode.ts
|
|
1844
1850
|
var _isDev8 = isDev();
|
|
1845
1851
|
function bindChildNode(placeholder, getter) {
|
|
@@ -2309,8 +2315,17 @@ var center = tagFactory("center");
|
|
|
2309
2315
|
var font = tagFactory("font");
|
|
2310
2316
|
var marquee = tagFactory("marquee");
|
|
2311
2317
|
|
|
2318
|
+
// src/utils/globalSingleton.ts
|
|
2319
|
+
function globalSingleton(key, create) {
|
|
2320
|
+
const g2 = globalThis;
|
|
2321
|
+
return g2[key] ?? (g2[key] = create());
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2312
2324
|
// src/platform/microfrontend.ts
|
|
2313
|
-
var moduleCache =
|
|
2325
|
+
var moduleCache = globalSingleton(
|
|
2326
|
+
/* @__PURE__ */ Symbol.for("sibujs.microfrontend.moduleCache.v1"),
|
|
2327
|
+
() => /* @__PURE__ */ new Map()
|
|
2328
|
+
);
|
|
2314
2329
|
function createMicroApp(config) {
|
|
2315
2330
|
const host = config.container ?? document.createElement("div");
|
|
2316
2331
|
host.setAttribute("data-micro-app", config.name);
|
|
@@ -2727,8 +2742,14 @@ function createWorkerPool(workerFn2, poolSize) {
|
|
|
2727
2742
|
}
|
|
2728
2743
|
|
|
2729
2744
|
// src/platform/wasm.ts
|
|
2730
|
-
var moduleCache2 =
|
|
2731
|
-
|
|
2745
|
+
var moduleCache2 = globalSingleton(
|
|
2746
|
+
/* @__PURE__ */ Symbol.for("sibujs.wasm.moduleCache.v1"),
|
|
2747
|
+
() => /* @__PURE__ */ new Map()
|
|
2748
|
+
);
|
|
2749
|
+
var instanceCache = globalSingleton(
|
|
2750
|
+
/* @__PURE__ */ Symbol.for("sibujs.wasm.instanceCache.v1"),
|
|
2751
|
+
() => /* @__PURE__ */ new Map()
|
|
2752
|
+
);
|
|
2732
2753
|
function wasm(source2, config = {}) {
|
|
2733
2754
|
const [instance, setInstance] = signal(null);
|
|
2734
2755
|
const [loading, setLoading] = signal(true);
|
package/dist/ssr.d.cts
CHANGED
|
@@ -138,7 +138,14 @@ declare function wasm<T extends Record<string, unknown> = Record<string, unknown
|
|
|
138
138
|
/**
|
|
139
139
|
* Load and instantiate a WebAssembly module.
|
|
140
140
|
* Supports loading from URL, ArrayBuffer, or Uint8Array.
|
|
141
|
-
*
|
|
141
|
+
*
|
|
142
|
+
* Caching: keyed by `cacheKey` (or, for a URL source, the URL itself). A keyed
|
|
143
|
+
* load is memoized as a **singleton instance** — every caller with the same key
|
|
144
|
+
* receives the *same* `WebAssembly.Instance`, which shares one linear memory and
|
|
145
|
+
* mutable globals. This is intentional (load-once / reuse), but it means callers
|
|
146
|
+
* that need isolated state must use distinct cache keys, or pass a non-URL source
|
|
147
|
+
* with no `cacheKey` (which instantiates fresh every call). Compiled modules are
|
|
148
|
+
* immutable and always safe to share.
|
|
142
149
|
*/
|
|
143
150
|
interface LoadWasmOptions {
|
|
144
151
|
imports?: WebAssembly.Imports;
|
package/dist/ssr.d.ts
CHANGED
|
@@ -138,7 +138,14 @@ declare function wasm<T extends Record<string, unknown> = Record<string, unknown
|
|
|
138
138
|
/**
|
|
139
139
|
* Load and instantiate a WebAssembly module.
|
|
140
140
|
* Supports loading from URL, ArrayBuffer, or Uint8Array.
|
|
141
|
-
*
|
|
141
|
+
*
|
|
142
|
+
* Caching: keyed by `cacheKey` (or, for a URL source, the URL itself). A keyed
|
|
143
|
+
* load is memoized as a **singleton instance** — every caller with the same key
|
|
144
|
+
* receives the *same* `WebAssembly.Instance`, which shares one linear memory and
|
|
145
|
+
* mutable globals. This is intentional (load-once / reuse), but it means callers
|
|
146
|
+
* that need isolated state must use distinct cache keys, or pass a non-URL source
|
|
147
|
+
* with no `cacheKey` (which instantiates fresh every call). Compiled modules are
|
|
148
|
+
* immutable and always safe to share.
|
|
142
149
|
*/
|
|
143
150
|
interface LoadWasmOptions {
|
|
144
151
|
imports?: WebAssembly.Imports;
|
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-ODXVQ3CS.js";
|
|
26
|
+
import "./chunk-3Z2NGWQI.js";
|
|
27
27
|
import {
|
|
28
28
|
collectStream,
|
|
29
29
|
deserializeState,
|
|
@@ -44,14 +44,15 @@ import {
|
|
|
44
44
|
suspenseSwapScript,
|
|
45
45
|
trustHTML
|
|
46
46
|
} from "./chunk-EX77FXTT.js";
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-JNGGM2XE.js";
|
|
48
|
+
import "./chunk-K35BAR4P.js";
|
|
49
|
+
import "./chunk-7ZHH77QA.js";
|
|
50
50
|
import "./chunk-L3GAGWCC.js";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-BUKYCWHX.js";
|
|
52
52
|
import "./chunk-S3NFJO6L.js";
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-
|
|
53
|
+
import "./chunk-5VGSK6D2.js";
|
|
54
|
+
import "./chunk-KZBEVFXZ.js";
|
|
55
|
+
import "./chunk-OOUQUCNN.js";
|
|
55
56
|
import "./chunk-COY6PUD2.js";
|
|
56
57
|
export {
|
|
57
58
|
Head,
|
|
@@ -52,4 +52,4 @@ interface TagProps {
|
|
|
52
52
|
*/
|
|
53
53
|
declare const tagFactory: (tag: string, ns?: string) => (first?: TagProps | NodeChildren, second?: NodeChildren) => Element;
|
|
54
54
|
|
|
55
|
-
export { type Dispose as D, type
|
|
55
|
+
export { type Dispose as D, type NodeChild as N, SVG_NS as S, type TagProps as T, type NodeChildren as a, tagFactory as t };
|
|
@@ -52,4 +52,4 @@ interface TagProps {
|
|
|
52
52
|
*/
|
|
53
53
|
declare const tagFactory: (tag: string, ns?: string) => (first?: TagProps | NodeChildren, second?: NodeChildren) => Element;
|
|
54
54
|
|
|
55
|
-
export { type Dispose as D, type
|
|
55
|
+
export { type Dispose as D, type NodeChild as N, SVG_NS as S, type TagProps as T, type NodeChildren as a, tagFactory as t };
|
package/dist/testing.cjs
CHANGED
|
@@ -140,6 +140,12 @@ function dispose(node) {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
// src/utils/globalSingleton.ts
|
|
144
|
+
function globalSingleton(key, create) {
|
|
145
|
+
const g = globalThis;
|
|
146
|
+
return g[key] ?? (g[key] = create());
|
|
147
|
+
}
|
|
148
|
+
|
|
143
149
|
// src/testing/a11y.ts
|
|
144
150
|
function escSel(value) {
|
|
145
151
|
return value.replace(/["\\]/g, "\\$&");
|
|
@@ -641,7 +647,7 @@ function checkAriaAttributes(root) {
|
|
|
641
647
|
if (attr.name === "aria-checked" || attr.name === "aria-pressed") {
|
|
642
648
|
validValues.push("mixed");
|
|
643
649
|
}
|
|
644
|
-
if (!validValues.includes(attr.value)
|
|
650
|
+
if (!validValues.includes(attr.value)) {
|
|
645
651
|
violations.push({
|
|
646
652
|
rule: "aria-valid-attr-value",
|
|
647
653
|
level: "error",
|
|
@@ -1297,7 +1303,15 @@ function createHttpMock(routes = [], options = {}) {
|
|
|
1297
1303
|
const mockFetch = async (input, init) => {
|
|
1298
1304
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
1299
1305
|
const method = init?.method || "GET";
|
|
1300
|
-
|
|
1306
|
+
let body;
|
|
1307
|
+
if (init?.body != null) {
|
|
1308
|
+
const raw = String(init.body);
|
|
1309
|
+
try {
|
|
1310
|
+
body = JSON.parse(raw);
|
|
1311
|
+
} catch {
|
|
1312
|
+
body = raw;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1301
1315
|
requestLog.push({ url, method, body, timestamp: Date.now() });
|
|
1302
1316
|
const route = matchRoute(url, method);
|
|
1303
1317
|
if (!route) {
|
|
@@ -1980,7 +1994,7 @@ function forEachSubscriber(signal, visit) {
|
|
|
1980
1994
|
|
|
1981
1995
|
// src/reactivity/track.ts
|
|
1982
1996
|
var _isDev4 = isDev();
|
|
1983
|
-
var _runtimeVersion = true ? "3.
|
|
1997
|
+
var _runtimeVersion = true ? "3.4.0" : "dev";
|
|
1984
1998
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1985
1999
|
function resolveReactiveApi() {
|
|
1986
2000
|
const g = globalThis;
|
|
@@ -2654,7 +2668,7 @@ function escapeSelector(value) {
|
|
|
2654
2668
|
if (g.CSS && typeof g.CSS.escape === "function") return g.CSS.escape(value);
|
|
2655
2669
|
return value.replace(/[^\w-]/g, (m) => `\\${m.charCodeAt(0).toString(16)} `);
|
|
2656
2670
|
}
|
|
2657
|
-
var _renderedContainers = /* @__PURE__ */ new Set();
|
|
2671
|
+
var _renderedContainers = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.testing.containers.v1"), () => /* @__PURE__ */ new Set());
|
|
2658
2672
|
function unmountAll() {
|
|
2659
2673
|
for (const container of _renderedContainers) {
|
|
2660
2674
|
for (const child of Array.from(container.childNodes)) dispose(child);
|
package/dist/testing.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
globalSingleton
|
|
3
|
+
} from "./chunk-7ZHH77QA.js";
|
|
4
4
|
import {
|
|
5
5
|
effect
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BUKYCWHX.js";
|
|
7
7
|
import "./chunk-S3NFJO6L.js";
|
|
8
|
-
import
|
|
8
|
+
import {
|
|
9
|
+
dispose
|
|
10
|
+
} from "./chunk-5VGSK6D2.js";
|
|
11
|
+
import "./chunk-OOUQUCNN.js";
|
|
9
12
|
import "./chunk-COY6PUD2.js";
|
|
10
13
|
|
|
11
14
|
// src/testing/a11y.ts
|
|
@@ -509,7 +512,7 @@ function checkAriaAttributes(root) {
|
|
|
509
512
|
if (attr.name === "aria-checked" || attr.name === "aria-pressed") {
|
|
510
513
|
validValues.push("mixed");
|
|
511
514
|
}
|
|
512
|
-
if (!validValues.includes(attr.value)
|
|
515
|
+
if (!validValues.includes(attr.value)) {
|
|
513
516
|
violations.push({
|
|
514
517
|
rule: "aria-valid-attr-value",
|
|
515
518
|
level: "error",
|
|
@@ -1165,7 +1168,15 @@ function createHttpMock(routes = [], options = {}) {
|
|
|
1165
1168
|
const mockFetch = async (input, init) => {
|
|
1166
1169
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
1167
1170
|
const method = init?.method || "GET";
|
|
1168
|
-
|
|
1171
|
+
let body;
|
|
1172
|
+
if (init?.body != null) {
|
|
1173
|
+
const raw = String(init.body);
|
|
1174
|
+
try {
|
|
1175
|
+
body = JSON.parse(raw);
|
|
1176
|
+
} catch {
|
|
1177
|
+
body = raw;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1169
1180
|
requestLog.push({ url, method, body, timestamp: Date.now() });
|
|
1170
1181
|
const route = matchRoute(url, method);
|
|
1171
1182
|
if (!route) {
|
|
@@ -1894,7 +1905,7 @@ function escapeSelector(value) {
|
|
|
1894
1905
|
if (g.CSS && typeof g.CSS.escape === "function") return g.CSS.escape(value);
|
|
1895
1906
|
return value.replace(/[^\w-]/g, (m) => `\\${m.charCodeAt(0).toString(16)} `);
|
|
1896
1907
|
}
|
|
1897
|
-
var _renderedContainers = /* @__PURE__ */ new Set();
|
|
1908
|
+
var _renderedContainers = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.testing.containers.v1"), () => /* @__PURE__ */ new Set());
|
|
1898
1909
|
function unmountAll() {
|
|
1899
1910
|
for (const container of _renderedContainers) {
|
|
1900
1911
|
for (const child of Array.from(container.childNodes)) dispose(child);
|