sibujs 3.3.1 → 3.3.3
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 +41 -18
- package/dist/browser.js +5 -5
- package/dist/build.cjs +57 -22
- package/dist/build.js +14 -14
- package/dist/cdn.global.js +7 -7
- package/dist/{chunk-MHBCEJQO.js → chunk-23VT3KZB.js} +2 -2
- package/dist/{chunk-WL7BIR6O.js → chunk-25LY5SRH.js} +31 -24
- package/dist/{chunk-37BUKSLH.js → chunk-5K6RVA2S.js} +1 -1
- package/dist/{chunk-AMIKDMLP.js → chunk-5Y34FWED.js} +17 -6
- package/dist/chunk-7ZHH77QA.js +9 -0
- package/dist/chunk-CCSJMTRN.js +15 -0
- package/dist/{chunk-R3QEDXFS.js → chunk-EX77FXTT.js} +1 -1
- package/dist/{chunk-WW6DAGGR.js → chunk-F3HO2MP7.js} +1 -1
- package/dist/{chunk-ZUVLC7TM.js → chunk-F7HW2NI5.js} +2 -4
- package/dist/{chunk-ULLTNDRA.js → chunk-IEYFHN5V.js} +72 -25
- package/dist/{chunk-Z37APKBV.js → chunk-IQN5W7GE.js} +73 -16
- package/dist/{chunk-WZG2SZOT.js → chunk-IWFE4AHO.js} +1 -1
- package/dist/{chunk-IKLYI3RF.js → chunk-MYXEBADX.js} +53 -23
- package/dist/{chunk-6LTFHJQG.js → chunk-QCQQ2N5H.js} +41 -20
- package/dist/{chunk-VOVVTOEA.js → chunk-QTOOBABV.js} +22 -5
- package/dist/{chunk-LU2MQXQQ.js → chunk-RZKGMHH4.js} +6 -6
- package/dist/{chunk-GOJMFRBL.js → chunk-S3NFJO6L.js} +20 -14
- package/dist/{chunk-NHKQKKZU.js → chunk-SBPUXWCE.js} +1 -1
- package/dist/{chunk-SLMFA3ZZ.js → chunk-TBDTU7UO.js} +2 -2
- package/dist/{chunk-4UUMSLSL.js → chunk-TVCCXPU2.js} +5 -5
- package/dist/{chunk-TEFZT5PJ.js → chunk-UOMYIAG6.js} +1 -1
- package/dist/{chunk-XH2RTYEQ.js → chunk-WFUUT6TG.js} +15 -8
- package/dist/{chunk-M5KBNOSJ.js → chunk-WTFMV2RU.js} +70 -59
- package/dist/{chunk-3JHCYHWN.js → chunk-WWV3SJ3L.js} +19 -13
- package/dist/{chunk-RYMOSG5B.js → chunk-Y35NQNLG.js} +90 -60
- package/dist/{chunk-F7FXQ3QS.js → chunk-ZXCZWMZT.js} +1 -1
- package/dist/data.cjs +36 -16
- package/dist/data.js +8 -7
- package/dist/devtools.cjs +91 -35
- package/dist/devtools.d.cts +12 -5
- package/dist/devtools.d.ts +12 -5
- package/dist/devtools.js +7 -6
- package/dist/ecosystem.cjs +31 -16
- package/dist/ecosystem.js +11 -10
- package/dist/extras.cjs +485 -280
- package/dist/extras.d.cts +1 -1
- package/dist/extras.d.ts +1 -1
- package/dist/extras.js +28 -24
- package/dist/index.cjs +59 -22
- package/dist/index.d.cts +24 -8
- package/dist/index.d.ts +24 -8
- package/dist/index.js +25 -21
- 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 +33 -20
- package/dist/patterns.d.cts +4 -1
- package/dist/patterns.d.ts +4 -1
- package/dist/patterns.js +6 -6
- package/dist/performance.cjs +90 -70
- package/dist/performance.js +8 -7
- package/dist/plugins.cjs +207 -144
- package/dist/plugins.d.cts +2 -1
- package/dist/plugins.d.ts +2 -1
- package/dist/plugins.js +178 -124
- package/dist/{ssr-6D67RAVB.js → ssr-2PPULEK2.js} +2 -2
- package/dist/ssr.cjs +132 -105
- package/dist/ssr.d.cts +8 -1
- package/dist/ssr.d.ts +8 -1
- package/dist/ssr.js +11 -10
- package/dist/testing.cjs +38 -18
- package/dist/testing.js +19 -8
- package/dist/ui.cjs +337 -294
- package/dist/ui.d.cts +0 -20
- package/dist/ui.d.ts +0 -20
- package/dist/ui.js +30 -24
- package/dist/widgets.cjs +95 -27
- package/dist/widgets.d.cts +6 -1
- package/dist/widgets.d.ts +6 -1
- package/dist/widgets.js +8 -7
- package/package.json +1 -1
- package/dist/chunk-YT6HQ6AM.js +0 -14
package/dist/ssr.cjs
CHANGED
|
@@ -87,23 +87,29 @@ function devWarn(message) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// src/core/ssr-context.ts
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
|
|
91
|
+
function detectSSRShared() {
|
|
92
|
+
let detected = null;
|
|
93
|
+
try {
|
|
94
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
95
|
+
let mod = null;
|
|
96
|
+
const getBuiltin = process.getBuiltinModule;
|
|
97
|
+
if (typeof getBuiltin === "function") {
|
|
98
|
+
mod = getBuiltin("node:async_hooks");
|
|
99
|
+
} else {
|
|
100
|
+
const req = Function("return typeof require==='function'?require:null")();
|
|
101
|
+
if (req) mod = req("node:async_hooks");
|
|
102
|
+
}
|
|
103
|
+
if (mod) detected = new mod.AsyncLocalStorage();
|
|
100
104
|
}
|
|
101
|
-
|
|
105
|
+
} catch {
|
|
106
|
+
detected = null;
|
|
102
107
|
}
|
|
103
|
-
|
|
104
|
-
als = null;
|
|
108
|
+
return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
|
|
105
109
|
}
|
|
106
|
-
var
|
|
110
|
+
var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
|
|
111
|
+
var als = _shared.als;
|
|
112
|
+
var fallbackStore = _shared.fallbackStore;
|
|
107
113
|
function getSSRStore() {
|
|
108
114
|
if (als) {
|
|
109
115
|
const s2 = als.getStore();
|
|
@@ -707,8 +713,69 @@ function escapeAttr(str) {
|
|
|
707
713
|
return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
708
714
|
}
|
|
709
715
|
|
|
710
|
-
// src/
|
|
716
|
+
// src/core/rendering/dispose.ts
|
|
717
|
+
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
711
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();
|
|
712
779
|
var POOL_MAX = 4096;
|
|
713
780
|
var nodePool = [];
|
|
714
781
|
function createNode() {
|
|
@@ -800,7 +867,7 @@ function safeInvoke(sub2) {
|
|
|
800
867
|
try {
|
|
801
868
|
sub2();
|
|
802
869
|
} catch (err) {
|
|
803
|
-
if (
|
|
870
|
+
if (_isDev4) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
804
871
|
}
|
|
805
872
|
}
|
|
806
873
|
var suspendDepth = 0;
|
|
@@ -1122,14 +1189,14 @@ function forEachSubscriber(signal2, visit) {
|
|
|
1122
1189
|
}
|
|
1123
1190
|
|
|
1124
1191
|
// src/reactivity/track.ts
|
|
1125
|
-
var
|
|
1126
|
-
var _runtimeVersion =
|
|
1192
|
+
var _isDev5 = isDev();
|
|
1193
|
+
var _runtimeVersion = true ? "3.3.3" : "dev";
|
|
1127
1194
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1128
1195
|
function resolveReactiveApi() {
|
|
1129
1196
|
const g2 = globalThis;
|
|
1130
1197
|
const existing = g2[REGISTRY_KEY];
|
|
1131
1198
|
if (existing) {
|
|
1132
|
-
if (
|
|
1199
|
+
if (_isDev5 && !existing.__dupWarned) {
|
|
1133
1200
|
existing.__dupWarned = true;
|
|
1134
1201
|
devWarn(
|
|
1135
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']).`
|
|
@@ -1424,6 +1491,7 @@ function Head(props) {
|
|
|
1424
1491
|
}
|
|
1425
1492
|
};
|
|
1426
1493
|
apply();
|
|
1494
|
+
registerDisposer(anchor, cleanup3);
|
|
1427
1495
|
return anchor;
|
|
1428
1496
|
}
|
|
1429
1497
|
function setStructuredData(data2) {
|
|
@@ -1516,7 +1584,7 @@ var isBatching = API2.isBatching;
|
|
|
1516
1584
|
|
|
1517
1585
|
// src/core/signals/signal.ts
|
|
1518
1586
|
var _g2 = globalThis;
|
|
1519
|
-
var
|
|
1587
|
+
var _isDev6 = isDev();
|
|
1520
1588
|
function signal(initial, options) {
|
|
1521
1589
|
const state = {
|
|
1522
1590
|
value: initial,
|
|
@@ -1527,7 +1595,7 @@ function signal(initial, options) {
|
|
|
1527
1595
|
__activeNode: null,
|
|
1528
1596
|
__name: void 0
|
|
1529
1597
|
};
|
|
1530
|
-
const debugName =
|
|
1598
|
+
const debugName = _isDev6 ? options?.name : void 0;
|
|
1531
1599
|
const equalsFn = options?.equals;
|
|
1532
1600
|
if (debugName) state.__name = debugName;
|
|
1533
1601
|
function get() {
|
|
@@ -1544,7 +1612,7 @@ function signal(initial, options) {
|
|
|
1544
1612
|
if (equalsFn(prev, newValue)) return;
|
|
1545
1613
|
state.value = newValue;
|
|
1546
1614
|
state.__v++;
|
|
1547
|
-
if (
|
|
1615
|
+
if (_isDev6) {
|
|
1548
1616
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1549
1617
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
1550
1618
|
}
|
|
@@ -1552,7 +1620,7 @@ function signal(initial, options) {
|
|
|
1552
1620
|
notifySubscribers2(state);
|
|
1553
1621
|
}
|
|
1554
1622
|
};
|
|
1555
|
-
} else if (
|
|
1623
|
+
} else if (_isDev6) {
|
|
1556
1624
|
set = (next) => {
|
|
1557
1625
|
const prev = state.value;
|
|
1558
1626
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -1577,7 +1645,7 @@ function signal(initial, options) {
|
|
|
1577
1645
|
}
|
|
1578
1646
|
};
|
|
1579
1647
|
}
|
|
1580
|
-
if (
|
|
1648
|
+
if (_isDev6) {
|
|
1581
1649
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1582
1650
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
1583
1651
|
}
|
|
@@ -1634,24 +1702,30 @@ function createAction(actionFn) {
|
|
|
1634
1702
|
const [data2, setData] = signal(void 0);
|
|
1635
1703
|
const [error, setError] = signal(void 0);
|
|
1636
1704
|
const [loading, setLoading] = signal(false);
|
|
1705
|
+
let activeRun = 0;
|
|
1637
1706
|
const submit = async (input2) => {
|
|
1707
|
+
const runId = ++activeRun;
|
|
1638
1708
|
batch(() => {
|
|
1639
1709
|
setLoading(true);
|
|
1640
1710
|
setError(void 0);
|
|
1641
1711
|
});
|
|
1642
1712
|
try {
|
|
1643
1713
|
const result = await actionFn(input2);
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1714
|
+
if (runId === activeRun) {
|
|
1715
|
+
batch(() => {
|
|
1716
|
+
setData(result);
|
|
1717
|
+
setLoading(false);
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1648
1720
|
return result;
|
|
1649
1721
|
} catch (err) {
|
|
1650
1722
|
const actionError = err instanceof Error ? err : new Error(String(err));
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1723
|
+
if (runId === activeRun) {
|
|
1724
|
+
batch(() => {
|
|
1725
|
+
setError(actionError);
|
|
1726
|
+
setLoading(false);
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1655
1729
|
throw actionError;
|
|
1656
1730
|
}
|
|
1657
1731
|
};
|
|
@@ -1665,15 +1739,14 @@ function scrollRestoration(options) {
|
|
|
1665
1739
|
let popstateHandler = null;
|
|
1666
1740
|
let currentKey = null;
|
|
1667
1741
|
const save = (key) => {
|
|
1668
|
-
|
|
1669
|
-
x: window.scrollX,
|
|
1670
|
-
|
|
1671
|
-
});
|
|
1742
|
+
if (typeof window !== "undefined") {
|
|
1743
|
+
positions.set(key, { x: window.scrollX, y: window.scrollY });
|
|
1744
|
+
}
|
|
1672
1745
|
currentKey = key;
|
|
1673
1746
|
};
|
|
1674
1747
|
const restore = (key) => {
|
|
1675
1748
|
const pos = positions.get(key);
|
|
1676
|
-
if (pos) {
|
|
1749
|
+
if (pos && typeof window !== "undefined") {
|
|
1677
1750
|
window.scrollTo(pos.x, pos.y);
|
|
1678
1751
|
}
|
|
1679
1752
|
currentKey = key;
|
|
@@ -1681,7 +1754,7 @@ function scrollRestoration(options) {
|
|
|
1681
1754
|
const getPosition = (key) => {
|
|
1682
1755
|
return positions.get(key);
|
|
1683
1756
|
};
|
|
1684
|
-
if (mode === "auto") {
|
|
1757
|
+
if (mode === "auto" && typeof window !== "undefined") {
|
|
1685
1758
|
popstateHandler = () => {
|
|
1686
1759
|
if (currentKey) {
|
|
1687
1760
|
save(currentKey);
|
|
@@ -1731,13 +1804,13 @@ function createMiddlewareChain() {
|
|
|
1731
1804
|
}
|
|
1732
1805
|
|
|
1733
1806
|
// src/reactivity/bindAttribute.ts
|
|
1734
|
-
var
|
|
1807
|
+
var _isDev7 = isDev();
|
|
1735
1808
|
function setProp(el, key, val) {
|
|
1736
1809
|
el[key] = val;
|
|
1737
1810
|
}
|
|
1738
1811
|
function bindAttribute(el, attr, getter) {
|
|
1739
1812
|
if (isEventHandlerAttr(attr)) {
|
|
1740
|
-
if (
|
|
1813
|
+
if (_isDev7)
|
|
1741
1814
|
devWarn(
|
|
1742
1815
|
`bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
|
|
1743
1816
|
);
|
|
@@ -1749,7 +1822,7 @@ function bindAttribute(el, attr, getter) {
|
|
|
1749
1822
|
try {
|
|
1750
1823
|
value = getter();
|
|
1751
1824
|
} catch (err) {
|
|
1752
|
-
if (
|
|
1825
|
+
if (_isDev7)
|
|
1753
1826
|
devWarn(`bindAttribute: getter for "${attr}" threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
1754
1827
|
return;
|
|
1755
1828
|
}
|
|
@@ -1773,67 +1846,6 @@ function bindAttribute(el, attr, getter) {
|
|
|
1773
1846
|
return reactiveBinding2(commit);
|
|
1774
1847
|
}
|
|
1775
1848
|
|
|
1776
|
-
// src/core/rendering/dispose.ts
|
|
1777
|
-
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
1778
|
-
var _isDev7 = isDev();
|
|
1779
|
-
var activeBindingCount = 0;
|
|
1780
|
-
function registerDisposer(node, teardown) {
|
|
1781
|
-
let disposers = elementDisposers.get(node);
|
|
1782
|
-
if (!disposers) {
|
|
1783
|
-
disposers = [];
|
|
1784
|
-
elementDisposers.set(node, disposers);
|
|
1785
|
-
}
|
|
1786
|
-
disposers.push(teardown);
|
|
1787
|
-
if (_isDev7) activeBindingCount++;
|
|
1788
|
-
}
|
|
1789
|
-
function dispose(node) {
|
|
1790
|
-
const stack = [node];
|
|
1791
|
-
const order = [];
|
|
1792
|
-
while (stack.length > 0) {
|
|
1793
|
-
const current = stack.pop();
|
|
1794
|
-
order.push(current);
|
|
1795
|
-
const children = Array.from(current.childNodes);
|
|
1796
|
-
for (let i2 = 0; i2 < children.length; i2++) {
|
|
1797
|
-
stack.push(children[i2]);
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
for (let i2 = order.length - 1; i2 >= 0; i2--) {
|
|
1801
|
-
const current = order[i2];
|
|
1802
|
-
const disposers = elementDisposers.get(current);
|
|
1803
|
-
if (disposers) {
|
|
1804
|
-
const snapshot = disposers.slice();
|
|
1805
|
-
elementDisposers.delete(current);
|
|
1806
|
-
if (_isDev7) activeBindingCount -= snapshot.length;
|
|
1807
|
-
for (const d of snapshot) {
|
|
1808
|
-
try {
|
|
1809
|
-
d();
|
|
1810
|
-
} catch (err) {
|
|
1811
|
-
if (_isDev7 && typeof console !== "undefined") {
|
|
1812
|
-
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
let extraPasses = 0;
|
|
1817
|
-
while (extraPasses++ < 8) {
|
|
1818
|
-
const added = elementDisposers.get(current);
|
|
1819
|
-
if (!added || added.length === 0) break;
|
|
1820
|
-
const moreSnapshot = added.slice();
|
|
1821
|
-
elementDisposers.delete(current);
|
|
1822
|
-
if (_isDev7) activeBindingCount -= moreSnapshot.length;
|
|
1823
|
-
for (const d of moreSnapshot) {
|
|
1824
|
-
try {
|
|
1825
|
-
d();
|
|
1826
|
-
} catch (err) {
|
|
1827
|
-
if (_isDev7 && typeof console !== "undefined") {
|
|
1828
|
-
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
1849
|
// src/reactivity/bindChildNode.ts
|
|
1838
1850
|
var _isDev8 = isDev();
|
|
1839
1851
|
function bindChildNode(placeholder, getter) {
|
|
@@ -2303,8 +2315,17 @@ var center = tagFactory("center");
|
|
|
2303
2315
|
var font = tagFactory("font");
|
|
2304
2316
|
var marquee = tagFactory("marquee");
|
|
2305
2317
|
|
|
2318
|
+
// src/utils/globalSingleton.ts
|
|
2319
|
+
function globalSingleton(key, create) {
|
|
2320
|
+
const g2 = globalThis;
|
|
2321
|
+
return g2[key] ?? (g2[key] = create());
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2306
2324
|
// src/platform/microfrontend.ts
|
|
2307
|
-
var moduleCache =
|
|
2325
|
+
var moduleCache = globalSingleton(
|
|
2326
|
+
/* @__PURE__ */ Symbol.for("sibujs.microfrontend.moduleCache.v1"),
|
|
2327
|
+
() => /* @__PURE__ */ new Map()
|
|
2328
|
+
);
|
|
2308
2329
|
function createMicroApp(config) {
|
|
2309
2330
|
const host = config.container ?? document.createElement("div");
|
|
2310
2331
|
host.setAttribute("data-micro-app", config.name);
|
|
@@ -2721,8 +2742,14 @@ function createWorkerPool(workerFn2, poolSize) {
|
|
|
2721
2742
|
}
|
|
2722
2743
|
|
|
2723
2744
|
// src/platform/wasm.ts
|
|
2724
|
-
var moduleCache2 =
|
|
2725
|
-
|
|
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
|
+
);
|
|
2726
2753
|
function wasm(source2, config = {}) {
|
|
2727
2754
|
const [instance, setInstance] = signal(null);
|
|
2728
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,9 @@ import {
|
|
|
22
22
|
wasm,
|
|
23
23
|
worker,
|
|
24
24
|
workerFn
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-QCQQ2N5H.js";
|
|
26
|
+
import "./chunk-7ZHH77QA.js";
|
|
27
|
+
import "./chunk-5K6RVA2S.js";
|
|
27
28
|
import {
|
|
28
29
|
collectStream,
|
|
29
30
|
deserializeState,
|
|
@@ -43,15 +44,15 @@ import {
|
|
|
43
44
|
ssrSuspense,
|
|
44
45
|
suspenseSwapScript,
|
|
45
46
|
trustHTML
|
|
46
|
-
} from "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-5VGSK6D2.js";
|
|
47
|
+
} from "./chunk-EX77FXTT.js";
|
|
48
|
+
import "./chunk-RZKGMHH4.js";
|
|
49
|
+
import "./chunk-SBPUXWCE.js";
|
|
50
50
|
import "./chunk-L3GAGWCC.js";
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-23VT3KZB.js";
|
|
52
|
+
import "./chunk-S3NFJO6L.js";
|
|
53
|
+
import "./chunk-5VGSK6D2.js";
|
|
54
|
+
import "./chunk-IWFE4AHO.js";
|
|
55
|
+
import "./chunk-UOMYIAG6.js";
|
|
55
56
|
import "./chunk-COY6PUD2.js";
|
|
56
57
|
export {
|
|
57
58
|
Head,
|
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 =
|
|
1997
|
+
var _runtimeVersion = true ? "3.3.3" : "dev";
|
|
1984
1998
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1985
1999
|
function resolveReactiveApi() {
|
|
1986
2000
|
const g = globalThis;
|
|
@@ -2037,23 +2051,29 @@ var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
|
2037
2051
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
2038
2052
|
|
|
2039
2053
|
// src/core/ssr-context.ts
|
|
2040
|
-
var
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2054
|
+
var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
|
|
2055
|
+
function detectSSRShared() {
|
|
2056
|
+
let detected = null;
|
|
2057
|
+
try {
|
|
2058
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
2059
|
+
let mod = null;
|
|
2060
|
+
const getBuiltin = process.getBuiltinModule;
|
|
2061
|
+
if (typeof getBuiltin === "function") {
|
|
2062
|
+
mod = getBuiltin("node:async_hooks");
|
|
2063
|
+
} else {
|
|
2064
|
+
const req = Function("return typeof require==='function'?require:null")();
|
|
2065
|
+
if (req) mod = req("node:async_hooks");
|
|
2066
|
+
}
|
|
2067
|
+
if (mod) detected = new mod.AsyncLocalStorage();
|
|
2050
2068
|
}
|
|
2051
|
-
|
|
2069
|
+
} catch {
|
|
2070
|
+
detected = null;
|
|
2052
2071
|
}
|
|
2053
|
-
|
|
2054
|
-
als = null;
|
|
2072
|
+
return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
|
|
2055
2073
|
}
|
|
2056
|
-
var
|
|
2074
|
+
var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
|
|
2075
|
+
var als = _shared.als;
|
|
2076
|
+
var fallbackStore = _shared.fallbackStore;
|
|
2057
2077
|
function getSSRStore() {
|
|
2058
2078
|
if (als) {
|
|
2059
2079
|
const s = als.getStore();
|
|
@@ -2648,7 +2668,7 @@ function escapeSelector(value) {
|
|
|
2648
2668
|
if (g.CSS && typeof g.CSS.escape === "function") return g.CSS.escape(value);
|
|
2649
2669
|
return value.replace(/[^\w-]/g, (m) => `\\${m.charCodeAt(0).toString(16)} `);
|
|
2650
2670
|
}
|
|
2651
|
-
var _renderedContainers = /* @__PURE__ */ new Set();
|
|
2671
|
+
var _renderedContainers = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.testing.containers.v1"), () => /* @__PURE__ */ new Set());
|
|
2652
2672
|
function unmountAll() {
|
|
2653
2673
|
for (const container of _renderedContainers) {
|
|
2654
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-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import
|
|
6
|
+
} from "./chunk-23VT3KZB.js";
|
|
7
|
+
import "./chunk-S3NFJO6L.js";
|
|
8
|
+
import {
|
|
9
|
+
dispose
|
|
10
|
+
} from "./chunk-5VGSK6D2.js";
|
|
11
|
+
import "./chunk-UOMYIAG6.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);
|