sibujs 1.0.0-beta.1
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/LICENSE +21 -0
- package/README.md +1630 -0
- package/dist/browser.cjs +815 -0
- package/dist/browser.d.cts +174 -0
- package/dist/browser.d.ts +174 -0
- package/dist/browser.js +458 -0
- package/dist/build.cjs +4970 -0
- package/dist/build.d.cts +630 -0
- package/dist/build.d.ts +630 -0
- package/dist/build.js +2478 -0
- package/dist/cdn.global.js +115 -0
- package/dist/chunk-27QC4FPL.js +67 -0
- package/dist/chunk-2ABBWCGC.js +65 -0
- package/dist/chunk-2MUNQYZ7.js +26 -0
- package/dist/chunk-2PSPKNUI.js +1711 -0
- package/dist/chunk-35CDLDX5.js +1758 -0
- package/dist/chunk-36MU4CFV.js +41 -0
- package/dist/chunk-3FIQOFI6.js +182 -0
- package/dist/chunk-3GHNC2BN.js +28 -0
- package/dist/chunk-3HLWWEPU.js +909 -0
- package/dist/chunk-3IVI3J54.js +252 -0
- package/dist/chunk-3KZ72WNW.js +944 -0
- package/dist/chunk-4AU64SQV.js +182 -0
- package/dist/chunk-4MOK7HAR.js +84 -0
- package/dist/chunk-4QK6FBDH.js +1429 -0
- package/dist/chunk-566Z7HXB.js +737 -0
- package/dist/chunk-5CRBB7XP.js +358 -0
- package/dist/chunk-5G67D3IZ.js +168 -0
- package/dist/chunk-5NCPAWBE.js +99 -0
- package/dist/chunk-5O2RKXR3.js +1444 -0
- package/dist/chunk-6BTBDO6A.js +633 -0
- package/dist/chunk-6IWEHW57.js +43 -0
- package/dist/chunk-6JGMNCD6.js +282 -0
- package/dist/chunk-6QRLJNXR.js +1425 -0
- package/dist/chunk-7HM5UE5T.js +270 -0
- package/dist/chunk-7JOLTGUH.js +58 -0
- package/dist/chunk-7MCWJCQK.js +909 -0
- package/dist/chunk-7RIIFP3E.js +1758 -0
- package/dist/chunk-7UASYN3G.js +254 -0
- package/dist/chunk-7W2WYHDI.js +741 -0
- package/dist/chunk-7Y35RDSJ.js +872 -0
- package/dist/chunk-A65GFJBL.js +65 -0
- package/dist/chunk-AD6ZIEDK.js +67 -0
- package/dist/chunk-AK5Y72F3.js +1426 -0
- package/dist/chunk-APOMMWH4.js +282 -0
- package/dist/chunk-ARZVTWIQ.js +1750 -0
- package/dist/chunk-AWWBM2BI.js +664 -0
- package/dist/chunk-AX5VEQTY.js +58 -0
- package/dist/chunk-AYTXVOW3.js +1708 -0
- package/dist/chunk-BG4A246G.js +1746 -0
- package/dist/chunk-BNFJJA2L.js +1425 -0
- package/dist/chunk-BPKPBVU5.js +59 -0
- package/dist/chunk-BPKPPSXC.js +282 -0
- package/dist/chunk-BPWKKK7F.js +1711 -0
- package/dist/chunk-CCKX6YTC.js +1735 -0
- package/dist/chunk-CIF5Z3MP.js +58 -0
- package/dist/chunk-CSXYU7IO.js +457 -0
- package/dist/chunk-D6JD4FDC.js +26 -0
- package/dist/chunk-E7NGA7X2.js +59 -0
- package/dist/chunk-EEPPJKAE.js +443 -0
- package/dist/chunk-EJMYGAGQ.js +717 -0
- package/dist/chunk-EL6Z5MDY.js +55 -0
- package/dist/chunk-EP7VRLEB.js +41 -0
- package/dist/chunk-ETMEC6FH.js +99 -0
- package/dist/chunk-EZ2WHYVL.js +65 -0
- package/dist/chunk-EZRVMSZK.js +67 -0
- package/dist/chunk-F2TRGINX.js +254 -0
- package/dist/chunk-F5JCIH3Q.js +642 -0
- package/dist/chunk-FGK3JKMN.js +909 -0
- package/dist/chunk-FQWPKSTD.js +1437 -0
- package/dist/chunk-FWHVLMCI.js +26 -0
- package/dist/chunk-GBEYQRO2.js +303 -0
- package/dist/chunk-GBLES3NK.js +248 -0
- package/dist/chunk-GQVGUQW6.js +1436 -0
- package/dist/chunk-HCV2T76T.js +457 -0
- package/dist/chunk-HS7ZKVPR.js +182 -0
- package/dist/chunk-HXDVV7HZ.js +909 -0
- package/dist/chunk-IB23VMO3.js +1746 -0
- package/dist/chunk-IEMZ7RTT.js +99 -0
- package/dist/chunk-IPGRSN42.js +1750 -0
- package/dist/chunk-IVMOK2QN.js +1750 -0
- package/dist/chunk-JCLGQO7T.js +443 -0
- package/dist/chunk-JDXL7KDB.js +1436 -0
- package/dist/chunk-JIIFW636.js +270 -0
- package/dist/chunk-JWGEEH7H.js +944 -0
- package/dist/chunk-K2BESAG7.js +1688 -0
- package/dist/chunk-K2U5YGF4.js +877 -0
- package/dist/chunk-K45FQ4Y4.js +175 -0
- package/dist/chunk-K7BPE427.js +1432 -0
- package/dist/chunk-KL3266RS.js +26 -0
- package/dist/chunk-KNN4P7DZ.js +84 -0
- package/dist/chunk-KP2DZH5Q.js +254 -0
- package/dist/chunk-KZHAJSQR.js +1636 -0
- package/dist/chunk-LBKGHMQV.js +1750 -0
- package/dist/chunk-LBTEPL7A.js +1731 -0
- package/dist/chunk-LEBBPTDB.js +1444 -0
- package/dist/chunk-LLH63WVQ.js +98 -0
- package/dist/chunk-LWVR2C4G.js +1711 -0
- package/dist/chunk-M3MDTVV2.js +896 -0
- package/dist/chunk-M5GNLDEO.js +303 -0
- package/dist/chunk-MFHVGKET.js +267 -0
- package/dist/chunk-MGWSG3PM.js +358 -0
- package/dist/chunk-MJNB47HB.js +19 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-MQWTY3JY.js +944 -0
- package/dist/chunk-MZZOQHNI.js +642 -0
- package/dist/chunk-NIHWGZS4.js +1426 -0
- package/dist/chunk-NSVVHQK5.js +41 -0
- package/dist/chunk-NVI2WE7D.js +443 -0
- package/dist/chunk-O7QBO3PH.js +58 -0
- package/dist/chunk-OAUPQBO2.js +270 -0
- package/dist/chunk-OB2LMD7C.js +297 -0
- package/dist/chunk-OHEYBWQU.js +58 -0
- package/dist/chunk-OI6OXUHJ.js +443 -0
- package/dist/chunk-OX2VMRMV.js +633 -0
- package/dist/chunk-P4FYE5TX.js +866 -0
- package/dist/chunk-P5KFWM4H.js +98 -0
- package/dist/chunk-PUMLE7RJ.js +1711 -0
- package/dist/chunk-Q4MFANBF.js +282 -0
- package/dist/chunk-QLEKZMMU.js +282 -0
- package/dist/chunk-RGGNGVO3.js +98 -0
- package/dist/chunk-RKJDRVV6.js +443 -0
- package/dist/chunk-S5BHU353.js +43 -0
- package/dist/chunk-SHQUSFH7.js +1426 -0
- package/dist/chunk-SMB4DBMD.js +182 -0
- package/dist/chunk-SNYHQP3D.js +743 -0
- package/dist/chunk-T24L3TBF.js +1717 -0
- package/dist/chunk-TAQNSOKT.js +692 -0
- package/dist/chunk-TDNY4SUA.js +41 -0
- package/dist/chunk-TNNF56IQ.js +1750 -0
- package/dist/chunk-TR7E6LYX.js +457 -0
- package/dist/chunk-URWUFH45.js +98 -0
- package/dist/chunk-UUSIH3XH.js +1429 -0
- package/dist/chunk-UYFNXLKR.js +1436 -0
- package/dist/chunk-V6F7KUWD.js +270 -0
- package/dist/chunk-VCZLXRMR.js +254 -0
- package/dist/chunk-VDHXSSBT.js +1426 -0
- package/dist/chunk-VM4QMKVK.js +254 -0
- package/dist/chunk-VWGYKYL2.js +737 -0
- package/dist/chunk-VX2OFBJN.js +1426 -0
- package/dist/chunk-VXVIE6DG.js +84 -0
- package/dist/chunk-W4OH7HG4.js +40 -0
- package/dist/chunk-WBVJX4GZ.js +98 -0
- package/dist/chunk-WDU2ZV4I.js +1426 -0
- package/dist/chunk-X6VUCICU.js +457 -0
- package/dist/chunk-XAY7FM7Y.js +618 -0
- package/dist/chunk-XJZ5Z2CM.js +642 -0
- package/dist/chunk-XKVFQTJJ.js +254 -0
- package/dist/chunk-XRLFASCY.js +22 -0
- package/dist/chunk-XYU6TZOW.js +182 -0
- package/dist/chunk-Y745CBVB.js +944 -0
- package/dist/chunk-YLBJSXYY.js +944 -0
- package/dist/chunk-YQJIKVPZ.js +1429 -0
- package/dist/chunk-YRM2VCZF.js +457 -0
- package/dist/chunk-YS33KBVJ.js +944 -0
- package/dist/chunk-Z27DZPDG.js +41 -0
- package/dist/chunk-ZXQ5NAEN.js +32 -0
- package/dist/contracts-B552GopR.d.cts +245 -0
- package/dist/contracts-B552GopR.d.ts +245 -0
- package/dist/contracts-Bg1ECISC.d.cts +245 -0
- package/dist/contracts-Bg1ECISC.d.ts +245 -0
- package/dist/contracts-CMriKJ6P.d.cts +245 -0
- package/dist/contracts-CMriKJ6P.d.ts +245 -0
- package/dist/contracts-DOrhwbke.d.cts +245 -0
- package/dist/contracts-DOrhwbke.d.ts +245 -0
- package/dist/data.cjs +1373 -0
- package/dist/data.d.cts +434 -0
- package/dist/data.d.ts +434 -0
- package/dist/data.js +945 -0
- package/dist/devtools.cjs +1357 -0
- package/dist/devtools.d.cts +473 -0
- package/dist/devtools.d.ts +473 -0
- package/dist/devtools.js +1084 -0
- package/dist/ecosystem.cjs +1046 -0
- package/dist/ecosystem.d.cts +247 -0
- package/dist/ecosystem.d.ts +247 -0
- package/dist/ecosystem.js +369 -0
- package/dist/extras.cjs +8457 -0
- package/dist/extras.d.cts +2356 -0
- package/dist/extras.d.ts +2356 -0
- package/dist/extras.js +5152 -0
- package/dist/index.cjs +2648 -0
- package/dist/index.d.cts +869 -0
- package/dist/index.d.ts +869 -0
- package/dist/index.js +386 -0
- package/dist/motion.cjs +604 -0
- package/dist/motion.d.cts +146 -0
- package/dist/motion.d.ts +146 -0
- package/dist/motion.js +346 -0
- package/dist/patterns.cjs +815 -0
- package/dist/patterns.d.cts +163 -0
- package/dist/patterns.d.ts +163 -0
- package/dist/patterns.js +296 -0
- package/dist/performance.cjs +927 -0
- package/dist/performance.d.cts +416 -0
- package/dist/performance.d.ts +416 -0
- package/dist/performance.js +654 -0
- package/dist/plugins.cjs +2487 -0
- package/dist/plugins.d.cts +393 -0
- package/dist/plugins.d.ts +393 -0
- package/dist/plugins.js +1504 -0
- package/dist/signal-BnWpq6WB.d.cts +5 -0
- package/dist/signal-BnWpq6WB.d.ts +5 -0
- package/dist/src/components/ErrorBoundary.d.ts +15 -0
- package/dist/src/components/ErrorBoundary.js +119 -0
- package/dist/src/core/catch.d.ts +11 -0
- package/dist/src/core/catch.js +28 -0
- package/dist/src/core/each.d.ts +13 -0
- package/dist/src/core/each.js +68 -0
- package/dist/src/core/for.d.ts +12 -0
- package/dist/src/core/for.js +67 -0
- package/dist/src/core/html.d.ts +137 -0
- package/dist/src/core/html.js +155 -0
- package/dist/src/core/htmlIf.d.ts +11 -0
- package/dist/src/core/htmlIf.js +18 -0
- package/dist/src/core/lazy.d.ts +7 -0
- package/dist/src/core/lazy.js +16 -0
- package/dist/src/core/mount.d.ts +7 -0
- package/dist/src/core/mount.js +12 -0
- package/dist/src/core/slots.d.ts +3 -0
- package/dist/src/core/slots.js +3 -0
- package/dist/src/core/suspense.d.ts +10 -0
- package/dist/src/core/suspense.js +33 -0
- package/dist/src/core/tagFactory.d.ts +13 -0
- package/dist/src/core/tagFactory.js +86 -0
- package/dist/src/core/test.d.ts +11 -0
- package/dist/src/core/test.js +28 -0
- package/dist/src/core/types.d.ts +2 -0
- package/dist/src/core/types.js +1 -0
- package/dist/src/core/useComputed.d.ts +6 -0
- package/dist/src/core/useComputed.js +30 -0
- package/dist/src/core/useEffect.d.ts +6 -0
- package/dist/src/core/useEffect.js +23 -0
- package/dist/src/core/useState.d.ts +10 -0
- package/dist/src/core/useState.js +34 -0
- package/dist/src/core/useStore.d.ts +19 -0
- package/dist/src/core/useStore.js +53 -0
- package/dist/src/core/useWatch.d.ts +8 -0
- package/dist/src/core/useWatch.js +23 -0
- package/dist/src/plugins/i18n.d.ts +6 -0
- package/dist/src/plugins/i18n.js +16 -0
- package/dist/src/plugins/router.d.ts +188 -0
- package/dist/src/plugins/router.js +1178 -0
- package/dist/src/reactivity/bindAttribute.d.ts +5 -0
- package/dist/src/reactivity/bindAttribute.js +31 -0
- package/dist/src/reactivity/bindChildNode.d.ts +10 -0
- package/dist/src/reactivity/bindChildNode.js +46 -0
- package/dist/src/reactivity/bindTextNode.d.ts +10 -0
- package/dist/src/reactivity/bindTextNode.js +27 -0
- package/dist/src/reactivity/signal.d.ts +3 -0
- package/dist/src/reactivity/signal.js +1 -0
- package/dist/src/reactivity/track.d.ts +18 -0
- package/dist/src/reactivity/track.js +73 -0
- package/dist/src/reactivity/useComputed.d.ts +6 -0
- package/dist/src/reactivity/useComputed.js +30 -0
- package/dist/src/reactivity/useEffect.d.ts +6 -0
- package/dist/src/reactivity/useEffect.js +23 -0
- package/dist/src/reactivity/useState.d.ts +10 -0
- package/dist/src/reactivity/useState.js +34 -0
- package/dist/src/reactivity/useStore.d.ts +19 -0
- package/dist/src/reactivity/useStore.js +53 -0
- package/dist/src/reactivity/useWatch.d.ts +8 -0
- package/dist/src/reactivity/useWatch.js +23 -0
- package/dist/src/utils/sanitize.d.ts +1 -0
- package/dist/src/utils/sanitize.js +8 -0
- package/dist/ssr-27FOM46T.js +35 -0
- package/dist/ssr-GFUTTSJD.js +22 -0
- package/dist/ssr-K7DCR6BZ.js +35 -0
- package/dist/ssr-O6LFMRFP.js +35 -0
- package/dist/ssr-QZEVGMMK.js +35 -0
- package/dist/ssr-SGVBCAGC.js +35 -0
- package/dist/ssr-UB2IXCYX.js +35 -0
- package/dist/ssr-XBZQNV4O.js +22 -0
- package/dist/ssr-Y76FSXDU.js +35 -0
- package/dist/ssr-YQJ4AYBD.js +35 -0
- package/dist/ssr.cjs +1757 -0
- package/dist/ssr.d.cts +478 -0
- package/dist/ssr.d.ts +478 -0
- package/dist/ssr.js +743 -0
- package/dist/tagFactory-CZPO4RXF.d.cts +34 -0
- package/dist/tagFactory-CZPO4RXF.d.ts +34 -0
- package/dist/tagFactory-CgImPVMY.d.cts +22 -0
- package/dist/tagFactory-CgImPVMY.d.ts +22 -0
- package/dist/tagFactory-Cw1iv5if.d.cts +22 -0
- package/dist/tagFactory-Cw1iv5if.d.ts +22 -0
- package/dist/tagFactory-DeAXq9ef.d.cts +30 -0
- package/dist/tagFactory-DeAXq9ef.d.ts +30 -0
- package/dist/tagFactory-SkY0a7L1.d.cts +22 -0
- package/dist/tagFactory-SkY0a7L1.d.ts +22 -0
- package/dist/testing.cjs +1919 -0
- package/dist/testing.d.cts +491 -0
- package/dist/testing.d.ts +491 -0
- package/dist/testing.js +1862 -0
- package/dist/ui.cjs +1497 -0
- package/dist/ui.d.cts +264 -0
- package/dist/ui.d.ts +264 -0
- package/dist/ui.js +900 -0
- package/dist/widgets.cjs +919 -0
- package/dist/widgets.d.cts +165 -0
- package/dist/widgets.d.ts +165 -0
- package/dist/widgets.js +545 -0
- package/package.json +134 -0
|
@@ -0,0 +1,1046 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// ecosystem.ts
|
|
21
|
+
var ecosystem_exports = {};
|
|
22
|
+
__export(ecosystem_exports, {
|
|
23
|
+
antdAdapter: () => antdAdapter,
|
|
24
|
+
chakraAdapter: () => chakraAdapter,
|
|
25
|
+
componentAdapter: () => componentAdapter,
|
|
26
|
+
createTheme: () => createTheme,
|
|
27
|
+
materialAdapter: () => materialAdapter,
|
|
28
|
+
mobXAdapter: () => mobXAdapter,
|
|
29
|
+
reduxAdapter: () => reduxAdapter,
|
|
30
|
+
zustandAdapter: () => zustandAdapter
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(ecosystem_exports);
|
|
33
|
+
|
|
34
|
+
// src/reactivity/track.ts
|
|
35
|
+
var subscriberStack = [];
|
|
36
|
+
var currentSubscriber = null;
|
|
37
|
+
var signalSubscribers = /* @__PURE__ */ new WeakMap();
|
|
38
|
+
var SUBS = "__s";
|
|
39
|
+
var notifyDepth = 0;
|
|
40
|
+
var pendingQueue = [];
|
|
41
|
+
var pendingSet = /* @__PURE__ */ new Set();
|
|
42
|
+
var suspendDepth = 0;
|
|
43
|
+
var trackingSuspended = false;
|
|
44
|
+
function track(effectFn, subscriber) {
|
|
45
|
+
if (!subscriber) subscriber = effectFn;
|
|
46
|
+
cleanup(subscriber);
|
|
47
|
+
subscriberStack.push(subscriber);
|
|
48
|
+
currentSubscriber = subscriber;
|
|
49
|
+
effectFn();
|
|
50
|
+
subscriberStack.pop();
|
|
51
|
+
currentSubscriber = subscriberStack[subscriberStack.length - 1] || null;
|
|
52
|
+
return () => cleanup(subscriber);
|
|
53
|
+
}
|
|
54
|
+
function suspendTracking() {
|
|
55
|
+
if (suspendDepth === 0) {
|
|
56
|
+
subscriberStack.push(null);
|
|
57
|
+
currentSubscriber = null;
|
|
58
|
+
trackingSuspended = true;
|
|
59
|
+
}
|
|
60
|
+
suspendDepth++;
|
|
61
|
+
}
|
|
62
|
+
function resumeTracking() {
|
|
63
|
+
suspendDepth--;
|
|
64
|
+
if (suspendDepth === 0) {
|
|
65
|
+
subscriberStack.pop();
|
|
66
|
+
currentSubscriber = subscriberStack[subscriberStack.length - 1] || null;
|
|
67
|
+
trackingSuspended = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function recordDependency(signal2) {
|
|
71
|
+
if (!currentSubscriber) return;
|
|
72
|
+
let deps = currentSubscriber._deps;
|
|
73
|
+
if (!deps) {
|
|
74
|
+
deps = /* @__PURE__ */ new Set();
|
|
75
|
+
currentSubscriber._deps = deps;
|
|
76
|
+
}
|
|
77
|
+
if (!deps.has(signal2)) {
|
|
78
|
+
deps.add(signal2);
|
|
79
|
+
let subs = signal2[SUBS];
|
|
80
|
+
if (!subs) {
|
|
81
|
+
subs = /* @__PURE__ */ new Set();
|
|
82
|
+
signalSubscribers.set(signal2, subs);
|
|
83
|
+
signal2[SUBS] = subs;
|
|
84
|
+
}
|
|
85
|
+
subs.add(currentSubscriber);
|
|
86
|
+
if (subs.size === 1) {
|
|
87
|
+
signal2.__f = currentSubscriber;
|
|
88
|
+
} else if (signal2.__f !== void 0) {
|
|
89
|
+
signal2.__f = void 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function queueSignalNotification(signal2) {
|
|
94
|
+
const subs = signal2[SUBS];
|
|
95
|
+
if (!subs) return;
|
|
96
|
+
for (const sub of subs) {
|
|
97
|
+
if (sub._c) {
|
|
98
|
+
propagateDirty(sub);
|
|
99
|
+
} else if (!pendingSet.has(sub)) {
|
|
100
|
+
pendingSet.add(sub);
|
|
101
|
+
pendingQueue.push(sub);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function drainNotificationQueue() {
|
|
106
|
+
if (notifyDepth > 0) return;
|
|
107
|
+
notifyDepth++;
|
|
108
|
+
try {
|
|
109
|
+
let i = 0;
|
|
110
|
+
while (i < pendingQueue.length) {
|
|
111
|
+
pendingQueue[i]();
|
|
112
|
+
i++;
|
|
113
|
+
}
|
|
114
|
+
} finally {
|
|
115
|
+
pendingQueue.length = 0;
|
|
116
|
+
pendingSet.clear();
|
|
117
|
+
notifyDepth--;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function propagateDirty(sub) {
|
|
121
|
+
sub();
|
|
122
|
+
let sig = sub._sig;
|
|
123
|
+
let suspended = false;
|
|
124
|
+
if (sig && sig._g) {
|
|
125
|
+
const sDeps = sub._deps;
|
|
126
|
+
if (sDeps && sDeps.size === 1) {
|
|
127
|
+
suspendTracking();
|
|
128
|
+
suspended = true;
|
|
129
|
+
const s = sig;
|
|
130
|
+
s._d = false;
|
|
131
|
+
s._v = s._g();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
while (sig) {
|
|
135
|
+
const first = sig.__f;
|
|
136
|
+
if (first) {
|
|
137
|
+
if (first._c) {
|
|
138
|
+
const nSig = first._sig;
|
|
139
|
+
nSig._d = true;
|
|
140
|
+
if (suspended && nSig._g) {
|
|
141
|
+
const fDeps = first._deps;
|
|
142
|
+
if (fDeps && fDeps.size === 1) {
|
|
143
|
+
nSig._d = false;
|
|
144
|
+
nSig._v = nSig._g();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
sig = nSig;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (!pendingSet.has(first)) {
|
|
151
|
+
pendingSet.add(first);
|
|
152
|
+
pendingQueue.push(first);
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
const subs = sig[SUBS];
|
|
157
|
+
if (!subs) break;
|
|
158
|
+
let nextSig;
|
|
159
|
+
for (const s of subs) {
|
|
160
|
+
if (s._c) {
|
|
161
|
+
s();
|
|
162
|
+
const nSig = s._sig;
|
|
163
|
+
if (nSig && !nextSig) {
|
|
164
|
+
nextSig = nSig;
|
|
165
|
+
} else if (nSig) {
|
|
166
|
+
propagateDirty(s);
|
|
167
|
+
}
|
|
168
|
+
} else if (!pendingSet.has(s)) {
|
|
169
|
+
pendingSet.add(s);
|
|
170
|
+
pendingQueue.push(s);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
sig = nextSig;
|
|
174
|
+
}
|
|
175
|
+
if (suspended) resumeTracking();
|
|
176
|
+
}
|
|
177
|
+
function notifySubscribers(signal2) {
|
|
178
|
+
const first = signal2.__f;
|
|
179
|
+
if (first) {
|
|
180
|
+
if (notifyDepth > 0) {
|
|
181
|
+
if (first._c) {
|
|
182
|
+
propagateDirty(first);
|
|
183
|
+
} else if (!pendingSet.has(first)) {
|
|
184
|
+
pendingSet.add(first);
|
|
185
|
+
pendingQueue.push(first);
|
|
186
|
+
}
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
notifyDepth++;
|
|
190
|
+
try {
|
|
191
|
+
if (first._c) {
|
|
192
|
+
propagateDirty(first);
|
|
193
|
+
} else {
|
|
194
|
+
first();
|
|
195
|
+
}
|
|
196
|
+
let i = 0;
|
|
197
|
+
while (i < pendingQueue.length) {
|
|
198
|
+
pendingQueue[i]();
|
|
199
|
+
i++;
|
|
200
|
+
}
|
|
201
|
+
} finally {
|
|
202
|
+
pendingQueue.length = 0;
|
|
203
|
+
pendingSet.clear();
|
|
204
|
+
notifyDepth--;
|
|
205
|
+
}
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const subs = signal2[SUBS];
|
|
209
|
+
if (!subs || subs.size === 0) return;
|
|
210
|
+
if (notifyDepth > 0) {
|
|
211
|
+
for (const sub of subs) {
|
|
212
|
+
if (sub._c) {
|
|
213
|
+
propagateDirty(sub);
|
|
214
|
+
} else if (!pendingSet.has(sub)) {
|
|
215
|
+
pendingSet.add(sub);
|
|
216
|
+
pendingQueue.push(sub);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
notifyDepth++;
|
|
222
|
+
try {
|
|
223
|
+
let directCount = 0;
|
|
224
|
+
for (const sub of subs) {
|
|
225
|
+
pendingQueue[directCount++] = sub;
|
|
226
|
+
}
|
|
227
|
+
for (let i2 = 0; i2 < directCount; i2++) {
|
|
228
|
+
if (pendingQueue[i2]._c) {
|
|
229
|
+
propagateDirty(pendingQueue[i2]);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
for (let i2 = 0; i2 < directCount; i2++) {
|
|
233
|
+
if (!pendingQueue[i2]._c) {
|
|
234
|
+
if (!pendingSet.has(pendingQueue[i2])) {
|
|
235
|
+
pendingQueue[i2]();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
let i = directCount;
|
|
240
|
+
while (i < pendingQueue.length) {
|
|
241
|
+
pendingQueue[i]();
|
|
242
|
+
i++;
|
|
243
|
+
}
|
|
244
|
+
} finally {
|
|
245
|
+
pendingQueue.length = 0;
|
|
246
|
+
pendingSet.clear();
|
|
247
|
+
notifyDepth--;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function cleanup(subscriber) {
|
|
251
|
+
const deps = subscriber._deps;
|
|
252
|
+
if (!deps || deps.size === 0) return;
|
|
253
|
+
for (const signal2 of deps) {
|
|
254
|
+
const subs = signal2[SUBS];
|
|
255
|
+
if (subs) {
|
|
256
|
+
subs.delete(subscriber);
|
|
257
|
+
if (signal2.__f === subscriber) {
|
|
258
|
+
signal2.__f = void 0;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
deps.clear();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// src/core/dev.ts
|
|
266
|
+
function isDev() {
|
|
267
|
+
return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : true;
|
|
268
|
+
}
|
|
269
|
+
function devAssert(condition, message) {
|
|
270
|
+
if (isDev() && !condition) {
|
|
271
|
+
throw new Error(`[Sibu] ${message}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// src/core/ssr-context.ts
|
|
276
|
+
var ssrMode = false;
|
|
277
|
+
function isSSR() {
|
|
278
|
+
return ssrMode;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/core/signals/effect.ts
|
|
282
|
+
function effect(effectFn) {
|
|
283
|
+
devAssert(typeof effectFn === "function", "effect: argument must be a function.");
|
|
284
|
+
if (isSSR()) return () => {
|
|
285
|
+
};
|
|
286
|
+
let runCount = 0;
|
|
287
|
+
let cleanupHandle = () => {
|
|
288
|
+
};
|
|
289
|
+
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
290
|
+
const subscriber = () => {
|
|
291
|
+
cleanupHandle();
|
|
292
|
+
runCount++;
|
|
293
|
+
if (hook) hook.emit("effect:run", { effectFn, runCount });
|
|
294
|
+
cleanupHandle = track(effectFn, subscriber);
|
|
295
|
+
};
|
|
296
|
+
cleanupHandle = track(effectFn, subscriber);
|
|
297
|
+
runCount = 1;
|
|
298
|
+
if (hook) hook.emit("effect:create", { effectFn });
|
|
299
|
+
return () => {
|
|
300
|
+
if (hook) hook.emit("effect:destroy", { effectFn });
|
|
301
|
+
cleanupHandle();
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// src/reactivity/batch.ts
|
|
306
|
+
var batchDepth = 0;
|
|
307
|
+
var pendingSignals = /* @__PURE__ */ new Set();
|
|
308
|
+
function batch(fn) {
|
|
309
|
+
batchDepth++;
|
|
310
|
+
try {
|
|
311
|
+
fn();
|
|
312
|
+
} finally {
|
|
313
|
+
batchDepth--;
|
|
314
|
+
if (batchDepth === 0) {
|
|
315
|
+
flushBatch();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
function enqueueBatchedSignal(signal2) {
|
|
320
|
+
if (batchDepth === 0) return false;
|
|
321
|
+
pendingSignals.add(signal2);
|
|
322
|
+
return true;
|
|
323
|
+
}
|
|
324
|
+
function flushBatch() {
|
|
325
|
+
const signals = Array.from(pendingSignals);
|
|
326
|
+
pendingSignals.clear();
|
|
327
|
+
for (const signal2 of signals) {
|
|
328
|
+
queueSignalNotification(signal2);
|
|
329
|
+
}
|
|
330
|
+
drainNotificationQueue();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// src/core/signals/signal.ts
|
|
334
|
+
function signal(initial, options) {
|
|
335
|
+
const state = { value: initial };
|
|
336
|
+
const debugName = options?.name;
|
|
337
|
+
if (debugName) {
|
|
338
|
+
state.__name = debugName;
|
|
339
|
+
}
|
|
340
|
+
function get() {
|
|
341
|
+
recordDependency(state);
|
|
342
|
+
return state.value;
|
|
343
|
+
}
|
|
344
|
+
get.__signal = state;
|
|
345
|
+
if (debugName) get.__name = debugName;
|
|
346
|
+
function set(next) {
|
|
347
|
+
const newValue = typeof next === "function" ? next(state.value) : next;
|
|
348
|
+
if (Object.is(newValue, state.value)) return;
|
|
349
|
+
const oldValue = state.value;
|
|
350
|
+
state.value = newValue;
|
|
351
|
+
const hook2 = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
352
|
+
if (hook2) hook2.emit("signal:update", { signal: state, name: debugName, oldValue, newValue });
|
|
353
|
+
if (!enqueueBatchedSignal(state)) {
|
|
354
|
+
notifySubscribers(state);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
358
|
+
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
359
|
+
return [get, set];
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// src/plugins/plugin.ts
|
|
363
|
+
function createPlugin(name, install) {
|
|
364
|
+
return { name, install };
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// src/ecosystem/adapters/mobx.ts
|
|
368
|
+
function mobXAdapter(options) {
|
|
369
|
+
return createPlugin("sibu-mobx", (ctx) => {
|
|
370
|
+
const { autorun } = options;
|
|
371
|
+
const disposers = [];
|
|
372
|
+
function fromMobX(expression) {
|
|
373
|
+
const [getValue, setValue] = signal(expression());
|
|
374
|
+
const disposer = autorun(() => {
|
|
375
|
+
const newValue = expression();
|
|
376
|
+
batch(() => {
|
|
377
|
+
setValue(newValue);
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
disposers.push(disposer);
|
|
381
|
+
return getValue;
|
|
382
|
+
}
|
|
383
|
+
function toMobX(sibuGetter, callback) {
|
|
384
|
+
return effect(() => {
|
|
385
|
+
callback(sibuGetter());
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
function destroy() {
|
|
389
|
+
for (const disposer of disposers) {
|
|
390
|
+
disposer();
|
|
391
|
+
}
|
|
392
|
+
disposers.length = 0;
|
|
393
|
+
}
|
|
394
|
+
const api = { fromMobX, toMobX, destroy };
|
|
395
|
+
ctx.provide("mobx", api);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// src/core/signals/derived.ts
|
|
400
|
+
function derived(getter, options) {
|
|
401
|
+
devAssert(typeof getter === "function", "derived: argument must be a getter function.");
|
|
402
|
+
const debugName = options?.name;
|
|
403
|
+
const cs = {};
|
|
404
|
+
cs._d = false;
|
|
405
|
+
cs._g = getter;
|
|
406
|
+
const markDirty = () => {
|
|
407
|
+
if (cs._d) return;
|
|
408
|
+
cs._d = true;
|
|
409
|
+
};
|
|
410
|
+
markDirty._c = 1;
|
|
411
|
+
markDirty._sig = cs;
|
|
412
|
+
track(() => {
|
|
413
|
+
cs._d = false;
|
|
414
|
+
cs._v = getter();
|
|
415
|
+
}, markDirty);
|
|
416
|
+
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
417
|
+
function computedGetter() {
|
|
418
|
+
if (trackingSuspended) {
|
|
419
|
+
if (cs._d) {
|
|
420
|
+
cs._d = false;
|
|
421
|
+
cs._v = getter();
|
|
422
|
+
}
|
|
423
|
+
return cs._v;
|
|
424
|
+
}
|
|
425
|
+
recordDependency(cs);
|
|
426
|
+
if (cs._d) {
|
|
427
|
+
const oldValue = cs._v;
|
|
428
|
+
cs._d = false;
|
|
429
|
+
suspendTracking();
|
|
430
|
+
try {
|
|
431
|
+
cs._v = getter();
|
|
432
|
+
} finally {
|
|
433
|
+
resumeTracking();
|
|
434
|
+
}
|
|
435
|
+
if (hook && oldValue !== cs._v) {
|
|
436
|
+
hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return cs._v;
|
|
440
|
+
}
|
|
441
|
+
if (debugName) {
|
|
442
|
+
computedGetter.__name = debugName;
|
|
443
|
+
cs.__name = debugName;
|
|
444
|
+
}
|
|
445
|
+
computedGetter.__signal = cs;
|
|
446
|
+
if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
|
|
447
|
+
return computedGetter;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// src/ecosystem/adapters/redux.ts
|
|
451
|
+
function reduxAdapter(options) {
|
|
452
|
+
return createPlugin("sibu-redux", (ctx) => {
|
|
453
|
+
const { store } = options;
|
|
454
|
+
const [getState, setState] = signal(store.getState());
|
|
455
|
+
const unsubscribe = store.subscribe(() => {
|
|
456
|
+
batch(() => {
|
|
457
|
+
setState(store.getState());
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
function useSelector(selector) {
|
|
461
|
+
return derived(() => selector(getState()));
|
|
462
|
+
}
|
|
463
|
+
const api = {
|
|
464
|
+
getState,
|
|
465
|
+
useSelector,
|
|
466
|
+
dispatch: store.dispatch.bind(store),
|
|
467
|
+
destroy: unsubscribe
|
|
468
|
+
};
|
|
469
|
+
ctx.provide("redux", api);
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// src/ecosystem/adapters/zustand.ts
|
|
474
|
+
function zustandAdapter(options) {
|
|
475
|
+
return createPlugin("sibu-zustand", (ctx) => {
|
|
476
|
+
const { store } = options;
|
|
477
|
+
const [getState, setSibuState] = signal(store.getState());
|
|
478
|
+
const unsubscribe = store.subscribe((state) => {
|
|
479
|
+
batch(() => {
|
|
480
|
+
setSibuState(state);
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
function useSelector(selector) {
|
|
484
|
+
return derived(() => selector(getState()));
|
|
485
|
+
}
|
|
486
|
+
const api = {
|
|
487
|
+
getState,
|
|
488
|
+
useSelector,
|
|
489
|
+
setState: store.setState.bind(store),
|
|
490
|
+
destroy() {
|
|
491
|
+
unsubscribe();
|
|
492
|
+
store.destroy();
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
ctx.provide("zustand", api);
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// src/utils/sanitize.ts
|
|
500
|
+
function sanitize(value) {
|
|
501
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
502
|
+
}
|
|
503
|
+
function sanitizeUrl(url) {
|
|
504
|
+
const trimmed = url.replace(/[\x00-\x20\x7f-\x9f]+/g, "").trim();
|
|
505
|
+
if (!trimmed) return "";
|
|
506
|
+
const lower = trimmed.toLowerCase();
|
|
507
|
+
if (lower.startsWith("javascript:") || lower.startsWith("data:") || lower.startsWith("vbscript:") || lower.startsWith("blob:")) {
|
|
508
|
+
return "";
|
|
509
|
+
}
|
|
510
|
+
return trimmed;
|
|
511
|
+
}
|
|
512
|
+
var URL_ATTRIBUTES = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "cite", "poster", "background", "srcset"]);
|
|
513
|
+
function isUrlAttribute(attr) {
|
|
514
|
+
return URL_ATTRIBUTES.has(attr);
|
|
515
|
+
}
|
|
516
|
+
function sanitizeAttribute(attr, value) {
|
|
517
|
+
if (isUrlAttribute(attr)) {
|
|
518
|
+
return sanitizeUrl(value);
|
|
519
|
+
}
|
|
520
|
+
return sanitize(value);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// src/reactivity/bindAttribute.ts
|
|
524
|
+
function bindAttribute(el, attr, getter) {
|
|
525
|
+
function commit() {
|
|
526
|
+
let value;
|
|
527
|
+
try {
|
|
528
|
+
value = getter();
|
|
529
|
+
} catch {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (typeof value === "boolean") {
|
|
533
|
+
if (attr in el && (attr === "checked" || attr === "disabled" || attr === "selected")) {
|
|
534
|
+
el[attr] = value;
|
|
535
|
+
} else if (value) {
|
|
536
|
+
el.setAttribute(attr, "");
|
|
537
|
+
} else {
|
|
538
|
+
el.removeAttribute(attr);
|
|
539
|
+
}
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
const str = sanitizeAttribute(attr, String(value));
|
|
543
|
+
if ((attr === "value" || attr === "checked") && attr in el) {
|
|
544
|
+
el[attr] = attr === "checked" ? Boolean(value) : str;
|
|
545
|
+
} else {
|
|
546
|
+
el.setAttribute(attr, str);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const teardown = track(commit);
|
|
550
|
+
return teardown;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// src/reactivity/bindChildNode.ts
|
|
554
|
+
function bindChildNode(placeholder, getter) {
|
|
555
|
+
let lastNodes = [];
|
|
556
|
+
function commit() {
|
|
557
|
+
let result;
|
|
558
|
+
try {
|
|
559
|
+
result = getter();
|
|
560
|
+
} catch {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
for (const node of lastNodes) {
|
|
564
|
+
node.parentNode?.removeChild(node);
|
|
565
|
+
}
|
|
566
|
+
lastNodes = [];
|
|
567
|
+
if (result == null) return;
|
|
568
|
+
const parent = placeholder.parentNode;
|
|
569
|
+
if (!parent) return;
|
|
570
|
+
const anchor = placeholder.nextSibling;
|
|
571
|
+
const newNodes = [];
|
|
572
|
+
const insertItem = (item) => {
|
|
573
|
+
const node = item instanceof Node ? item : document.createTextNode(String(item));
|
|
574
|
+
parent.insertBefore(node, anchor);
|
|
575
|
+
newNodes.push(node);
|
|
576
|
+
};
|
|
577
|
+
if (Array.isArray(result)) {
|
|
578
|
+
for (const item of result) insertItem(item);
|
|
579
|
+
} else {
|
|
580
|
+
insertItem(result);
|
|
581
|
+
}
|
|
582
|
+
lastNodes = newNodes;
|
|
583
|
+
}
|
|
584
|
+
return track(commit);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// src/core/rendering/dispose.ts
|
|
588
|
+
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
589
|
+
var activeBindingCount = 0;
|
|
590
|
+
function registerDisposer(node, teardown) {
|
|
591
|
+
let disposers = elementDisposers.get(node);
|
|
592
|
+
if (!disposers) {
|
|
593
|
+
disposers = [];
|
|
594
|
+
elementDisposers.set(node, disposers);
|
|
595
|
+
}
|
|
596
|
+
disposers.push(teardown);
|
|
597
|
+
activeBindingCount++;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// src/core/rendering/tagFactory.ts
|
|
601
|
+
var kebabCache = /* @__PURE__ */ new Map();
|
|
602
|
+
function toKebab(prop) {
|
|
603
|
+
let cached = kebabCache.get(prop);
|
|
604
|
+
if (cached !== void 0) return cached;
|
|
605
|
+
cached = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
606
|
+
kebabCache.set(prop, cached);
|
|
607
|
+
return cached;
|
|
608
|
+
}
|
|
609
|
+
function applyStyle(el, style) {
|
|
610
|
+
if (!style) return;
|
|
611
|
+
if (typeof style === "function") {
|
|
612
|
+
const teardown = track(() => {
|
|
613
|
+
el.setAttribute("style", style());
|
|
614
|
+
});
|
|
615
|
+
registerDisposer(el, teardown);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
if (typeof style === "string") {
|
|
619
|
+
el.setAttribute("style", style);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
const htmlEl = el;
|
|
623
|
+
for (const prop in style) {
|
|
624
|
+
const val = style[prop];
|
|
625
|
+
const name = toKebab(prop);
|
|
626
|
+
if (typeof val === "function") {
|
|
627
|
+
const getter = val;
|
|
628
|
+
const teardown = track(() => {
|
|
629
|
+
htmlEl.style.setProperty(name, String(getter()));
|
|
630
|
+
});
|
|
631
|
+
registerDisposer(el, teardown);
|
|
632
|
+
} else {
|
|
633
|
+
htmlEl.style.setProperty(name, String(val));
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
function applyClass(el, cls) {
|
|
638
|
+
if (cls == null) return;
|
|
639
|
+
if (typeof cls === "string") {
|
|
640
|
+
el.setAttribute("class", cls);
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (typeof cls === "function") {
|
|
644
|
+
const getter = cls;
|
|
645
|
+
const teardown = track(() => {
|
|
646
|
+
el.setAttribute("class", getter());
|
|
647
|
+
});
|
|
648
|
+
registerDisposer(el, teardown);
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
if (typeof cls === "object") {
|
|
652
|
+
const obj = cls;
|
|
653
|
+
let hasReactive = false;
|
|
654
|
+
for (const name in obj) {
|
|
655
|
+
if (typeof obj[name] === "function") {
|
|
656
|
+
hasReactive = true;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (hasReactive) {
|
|
661
|
+
const update = () => {
|
|
662
|
+
let result = "";
|
|
663
|
+
for (const name in obj) {
|
|
664
|
+
const val = obj[name];
|
|
665
|
+
const active = typeof val === "function" ? val() : val;
|
|
666
|
+
if (active) result = result ? `${result} ${name}` : name;
|
|
667
|
+
}
|
|
668
|
+
el.setAttribute("class", result);
|
|
669
|
+
};
|
|
670
|
+
const teardown = track(update);
|
|
671
|
+
registerDisposer(el, teardown);
|
|
672
|
+
} else {
|
|
673
|
+
let result = "";
|
|
674
|
+
for (const name in obj) {
|
|
675
|
+
if (obj[name]) result = result ? `${result} ${name}` : name;
|
|
676
|
+
}
|
|
677
|
+
el.setAttribute("class", result);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
function renderChild(child) {
|
|
682
|
+
if (child == null) {
|
|
683
|
+
return document.createTextNode("");
|
|
684
|
+
}
|
|
685
|
+
if (child instanceof Node) {
|
|
686
|
+
return child;
|
|
687
|
+
}
|
|
688
|
+
return document.createTextNode(String(child));
|
|
689
|
+
}
|
|
690
|
+
function appendOneChild(el, child) {
|
|
691
|
+
if (typeof child === "function") {
|
|
692
|
+
const placeholder = document.createComment("bind:child");
|
|
693
|
+
el.appendChild(placeholder);
|
|
694
|
+
const teardown = bindChildNode(placeholder, child);
|
|
695
|
+
registerDisposer(el, teardown);
|
|
696
|
+
} else {
|
|
697
|
+
el.appendChild(renderChild(child));
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function appendChildren(el, nodes) {
|
|
701
|
+
if (Array.isArray(nodes)) {
|
|
702
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
703
|
+
const c = nodes[i];
|
|
704
|
+
if (Array.isArray(c)) {
|
|
705
|
+
for (let j = 0; j < c.length; j++) {
|
|
706
|
+
appendOneChild(el, c[j]);
|
|
707
|
+
}
|
|
708
|
+
} else {
|
|
709
|
+
appendOneChild(el, c);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
} else {
|
|
713
|
+
appendOneChild(el, nodes);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
function isTagProps(value) {
|
|
717
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Node);
|
|
718
|
+
}
|
|
719
|
+
var tagFactory = (tag, ns) => (first, second) => {
|
|
720
|
+
let props;
|
|
721
|
+
if (first === void 0) {
|
|
722
|
+
props = {};
|
|
723
|
+
} else if (isTagProps(first)) {
|
|
724
|
+
props = first;
|
|
725
|
+
} else if (second !== void 0) {
|
|
726
|
+
props = { class: first, nodes: second };
|
|
727
|
+
} else {
|
|
728
|
+
props = { nodes: first };
|
|
729
|
+
}
|
|
730
|
+
const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag);
|
|
731
|
+
for (const key in props) {
|
|
732
|
+
const value = props[key];
|
|
733
|
+
if (value == null) continue;
|
|
734
|
+
switch (key) {
|
|
735
|
+
case "id":
|
|
736
|
+
el.id = value;
|
|
737
|
+
break;
|
|
738
|
+
case "class":
|
|
739
|
+
applyClass(el, value);
|
|
740
|
+
break;
|
|
741
|
+
case "style":
|
|
742
|
+
applyStyle(el, value);
|
|
743
|
+
break;
|
|
744
|
+
case "ref":
|
|
745
|
+
if (value && typeof value === "object" && "current" in value) {
|
|
746
|
+
value.current = el;
|
|
747
|
+
}
|
|
748
|
+
break;
|
|
749
|
+
case "on": {
|
|
750
|
+
const handlers = value;
|
|
751
|
+
const eventNames = [];
|
|
752
|
+
for (const ev in handlers) {
|
|
753
|
+
el.addEventListener(ev, handlers[ev]);
|
|
754
|
+
eventNames.push(ev);
|
|
755
|
+
}
|
|
756
|
+
if (eventNames.length) {
|
|
757
|
+
el.__sibu_events__ = eventNames;
|
|
758
|
+
}
|
|
759
|
+
break;
|
|
760
|
+
}
|
|
761
|
+
case "nodes":
|
|
762
|
+
appendChildren(el, value);
|
|
763
|
+
break;
|
|
764
|
+
default:
|
|
765
|
+
if (key.toLowerCase().startsWith("on")) break;
|
|
766
|
+
if (typeof value === "function") {
|
|
767
|
+
const teardown = bindAttribute(el, key, value);
|
|
768
|
+
registerDisposer(el, teardown);
|
|
769
|
+
} else if (typeof value === "boolean") {
|
|
770
|
+
if (value) el.setAttribute(key, "");
|
|
771
|
+
else el.removeAttribute(key);
|
|
772
|
+
} else {
|
|
773
|
+
el.setAttribute(key, sanitizeAttribute(key, String(value)));
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return el;
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
// src/ecosystem/ui/componentAdapter.ts
|
|
781
|
+
function createTheme(initial) {
|
|
782
|
+
const [getConfig, setConfig] = signal(initial);
|
|
783
|
+
function resolveClass(component, variant) {
|
|
784
|
+
const config = getConfig();
|
|
785
|
+
const overrideKey = variant ? `${component}-${variant}` : component;
|
|
786
|
+
if (config.classOverrides?.[overrideKey]) {
|
|
787
|
+
return config.classOverrides[overrideKey];
|
|
788
|
+
}
|
|
789
|
+
const base = `${config.prefix}-${component}`;
|
|
790
|
+
return variant ? `${base} ${config.prefix}-${component}--${variant}` : base;
|
|
791
|
+
}
|
|
792
|
+
function setTheme(partial) {
|
|
793
|
+
setConfig((prev) => ({ ...prev, ...partial }));
|
|
794
|
+
}
|
|
795
|
+
return { config: getConfig, setTheme, resolveClass };
|
|
796
|
+
}
|
|
797
|
+
function componentAdapter(config) {
|
|
798
|
+
const theme = createTheme({ prefix: config.prefix });
|
|
799
|
+
const components = {};
|
|
800
|
+
for (const [name, mapping] of Object.entries(config.components)) {
|
|
801
|
+
const factory = tagFactory(mapping.tag || "div");
|
|
802
|
+
components[name] = (props = {}) => {
|
|
803
|
+
const { variant, size, class: userClass, ...rest } = props;
|
|
804
|
+
const classes = [mapping.baseClass];
|
|
805
|
+
if (variant && mapping.variants?.[variant]) {
|
|
806
|
+
classes.push(mapping.variants[variant]);
|
|
807
|
+
}
|
|
808
|
+
if (size && mapping.sizes?.[size]) {
|
|
809
|
+
classes.push(mapping.sizes[size]);
|
|
810
|
+
}
|
|
811
|
+
let finalClass;
|
|
812
|
+
if (typeof userClass === "function") {
|
|
813
|
+
finalClass = () => {
|
|
814
|
+
const extra = userClass();
|
|
815
|
+
return extra ? `${classes.join(" ")} ${extra}` : classes.join(" ");
|
|
816
|
+
};
|
|
817
|
+
} else if (typeof userClass === "string" && userClass) {
|
|
818
|
+
finalClass = `${classes.join(" ")} ${userClass}`;
|
|
819
|
+
} else {
|
|
820
|
+
finalClass = classes.join(" ");
|
|
821
|
+
}
|
|
822
|
+
const mergedProps = {
|
|
823
|
+
...mapping.defaultProps,
|
|
824
|
+
...rest,
|
|
825
|
+
class: finalClass
|
|
826
|
+
};
|
|
827
|
+
return factory(mergedProps);
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
return { name: config.name, components, theme };
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
// src/ecosystem/ui/antd.ts
|
|
834
|
+
var antdConfig = {
|
|
835
|
+
name: "antd",
|
|
836
|
+
prefix: "ant",
|
|
837
|
+
components: {
|
|
838
|
+
Button: {
|
|
839
|
+
tag: "button",
|
|
840
|
+
baseClass: "ant-btn",
|
|
841
|
+
variants: {
|
|
842
|
+
primary: "ant-btn-primary",
|
|
843
|
+
dashed: "ant-btn-dashed",
|
|
844
|
+
text: "ant-btn-text",
|
|
845
|
+
link: "ant-btn-link",
|
|
846
|
+
default: "ant-btn-default",
|
|
847
|
+
danger: "ant-btn-dangerous"
|
|
848
|
+
},
|
|
849
|
+
sizes: {
|
|
850
|
+
sm: "ant-btn-sm",
|
|
851
|
+
lg: "ant-btn-lg"
|
|
852
|
+
},
|
|
853
|
+
defaultProps: { type: "button" }
|
|
854
|
+
},
|
|
855
|
+
Input: {
|
|
856
|
+
tag: "input",
|
|
857
|
+
baseClass: "ant-input",
|
|
858
|
+
sizes: {
|
|
859
|
+
sm: "ant-input-sm",
|
|
860
|
+
lg: "ant-input-lg"
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
Card: {
|
|
864
|
+
tag: "div",
|
|
865
|
+
baseClass: "ant-card",
|
|
866
|
+
variants: {
|
|
867
|
+
bordered: "ant-card-bordered"
|
|
868
|
+
}
|
|
869
|
+
},
|
|
870
|
+
Modal: {
|
|
871
|
+
tag: "div",
|
|
872
|
+
baseClass: "ant-modal"
|
|
873
|
+
},
|
|
874
|
+
Tag: {
|
|
875
|
+
tag: "span",
|
|
876
|
+
baseClass: "ant-tag",
|
|
877
|
+
variants: {
|
|
878
|
+
success: "ant-tag-success",
|
|
879
|
+
error: "ant-tag-error",
|
|
880
|
+
warning: "ant-tag-warning",
|
|
881
|
+
processing: "ant-tag-processing"
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
Badge: {
|
|
885
|
+
tag: "span",
|
|
886
|
+
baseClass: "ant-badge"
|
|
887
|
+
},
|
|
888
|
+
Avatar: {
|
|
889
|
+
tag: "span",
|
|
890
|
+
baseClass: "ant-avatar",
|
|
891
|
+
sizes: {
|
|
892
|
+
sm: "ant-avatar-sm",
|
|
893
|
+
lg: "ant-avatar-lg"
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
var antdAdapter = componentAdapter(antdConfig);
|
|
899
|
+
|
|
900
|
+
// src/ecosystem/ui/chakra.ts
|
|
901
|
+
var chakraConfig = {
|
|
902
|
+
name: "chakra",
|
|
903
|
+
prefix: "chakra",
|
|
904
|
+
components: {
|
|
905
|
+
Button: {
|
|
906
|
+
tag: "button",
|
|
907
|
+
baseClass: "chakra-button",
|
|
908
|
+
variants: {
|
|
909
|
+
solid: "chakra-button--solid",
|
|
910
|
+
outline: "chakra-button--outline",
|
|
911
|
+
ghost: "chakra-button--ghost",
|
|
912
|
+
link: "chakra-button--link"
|
|
913
|
+
},
|
|
914
|
+
sizes: {
|
|
915
|
+
xs: "chakra-button--xs",
|
|
916
|
+
sm: "chakra-button--sm",
|
|
917
|
+
md: "chakra-button--md",
|
|
918
|
+
lg: "chakra-button--lg"
|
|
919
|
+
},
|
|
920
|
+
defaultProps: { type: "button" }
|
|
921
|
+
},
|
|
922
|
+
Input: {
|
|
923
|
+
tag: "input",
|
|
924
|
+
baseClass: "chakra-input",
|
|
925
|
+
variants: {
|
|
926
|
+
outline: "chakra-input--outline",
|
|
927
|
+
filled: "chakra-input--filled",
|
|
928
|
+
flushed: "chakra-input--flushed",
|
|
929
|
+
unstyled: "chakra-input--unstyled"
|
|
930
|
+
},
|
|
931
|
+
sizes: {
|
|
932
|
+
xs: "chakra-input--xs",
|
|
933
|
+
sm: "chakra-input--sm",
|
|
934
|
+
md: "chakra-input--md",
|
|
935
|
+
lg: "chakra-input--lg"
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
Card: {
|
|
939
|
+
tag: "div",
|
|
940
|
+
baseClass: "chakra-card",
|
|
941
|
+
variants: {
|
|
942
|
+
elevated: "chakra-card--elevated",
|
|
943
|
+
outline: "chakra-card--outline",
|
|
944
|
+
filled: "chakra-card--filled",
|
|
945
|
+
unstyled: "chakra-card--unstyled"
|
|
946
|
+
}
|
|
947
|
+
},
|
|
948
|
+
Modal: {
|
|
949
|
+
tag: "div",
|
|
950
|
+
baseClass: "chakra-modal__content"
|
|
951
|
+
},
|
|
952
|
+
Badge: {
|
|
953
|
+
tag: "span",
|
|
954
|
+
baseClass: "chakra-badge",
|
|
955
|
+
variants: {
|
|
956
|
+
solid: "chakra-badge--solid",
|
|
957
|
+
subtle: "chakra-badge--subtle",
|
|
958
|
+
outline: "chakra-badge--outline"
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
Stack: {
|
|
962
|
+
tag: "div",
|
|
963
|
+
baseClass: "chakra-stack",
|
|
964
|
+
variants: {
|
|
965
|
+
horizontal: "chakra-stack--horizontal",
|
|
966
|
+
vertical: "chakra-stack--vertical"
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
var chakraAdapter = componentAdapter(chakraConfig);
|
|
972
|
+
|
|
973
|
+
// src/ecosystem/ui/material.ts
|
|
974
|
+
var materialConfig = {
|
|
975
|
+
name: "material",
|
|
976
|
+
prefix: "mdc",
|
|
977
|
+
components: {
|
|
978
|
+
Button: {
|
|
979
|
+
tag: "button",
|
|
980
|
+
baseClass: "mdc-button",
|
|
981
|
+
variants: {
|
|
982
|
+
raised: "mdc-button--raised",
|
|
983
|
+
outlined: "mdc-button--outlined",
|
|
984
|
+
text: "mdc-button--text",
|
|
985
|
+
unelevated: "mdc-button--unelevated"
|
|
986
|
+
},
|
|
987
|
+
sizes: {
|
|
988
|
+
sm: "mdc-button--dense"
|
|
989
|
+
},
|
|
990
|
+
defaultProps: { type: "button" }
|
|
991
|
+
},
|
|
992
|
+
Input: {
|
|
993
|
+
tag: "div",
|
|
994
|
+
baseClass: "mdc-text-field",
|
|
995
|
+
variants: {
|
|
996
|
+
outlined: "mdc-text-field--outlined",
|
|
997
|
+
filled: "mdc-text-field--filled"
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
Card: {
|
|
1001
|
+
tag: "div",
|
|
1002
|
+
baseClass: "mdc-card",
|
|
1003
|
+
variants: {
|
|
1004
|
+
outlined: "mdc-card--outlined",
|
|
1005
|
+
elevated: "mdc-card--elevated"
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
Modal: {
|
|
1009
|
+
tag: "div",
|
|
1010
|
+
baseClass: "mdc-dialog",
|
|
1011
|
+
variants: {
|
|
1012
|
+
fullscreen: "mdc-dialog--fullscreen"
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
Chip: {
|
|
1016
|
+
tag: "span",
|
|
1017
|
+
baseClass: "mdc-chip",
|
|
1018
|
+
variants: {
|
|
1019
|
+
outlined: "mdc-chip--outlined"
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
List: {
|
|
1023
|
+
tag: "ul",
|
|
1024
|
+
baseClass: "mdc-list",
|
|
1025
|
+
variants: {
|
|
1026
|
+
dense: "mdc-list--dense"
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
ListItem: {
|
|
1030
|
+
tag: "li",
|
|
1031
|
+
baseClass: "mdc-list-item"
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
var materialAdapter = componentAdapter(materialConfig);
|
|
1036
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1037
|
+
0 && (module.exports = {
|
|
1038
|
+
antdAdapter,
|
|
1039
|
+
chakraAdapter,
|
|
1040
|
+
componentAdapter,
|
|
1041
|
+
createTheme,
|
|
1042
|
+
materialAdapter,
|
|
1043
|
+
mobXAdapter,
|
|
1044
|
+
reduxAdapter,
|
|
1045
|
+
zustandAdapter
|
|
1046
|
+
});
|