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,1437 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useComputed,
|
|
4
|
+
useEffect
|
|
5
|
+
} from "./chunk-P5KFWM4H.js";
|
|
6
|
+
import {
|
|
7
|
+
SVG_NS,
|
|
8
|
+
a,
|
|
9
|
+
abbr,
|
|
10
|
+
address,
|
|
11
|
+
area,
|
|
12
|
+
article,
|
|
13
|
+
aside,
|
|
14
|
+
audio,
|
|
15
|
+
b,
|
|
16
|
+
base,
|
|
17
|
+
batch,
|
|
18
|
+
bdi,
|
|
19
|
+
bdo,
|
|
20
|
+
bindDynamic,
|
|
21
|
+
blockquote,
|
|
22
|
+
body,
|
|
23
|
+
br,
|
|
24
|
+
button,
|
|
25
|
+
canvas,
|
|
26
|
+
caption,
|
|
27
|
+
center,
|
|
28
|
+
circle,
|
|
29
|
+
cite,
|
|
30
|
+
clipPath,
|
|
31
|
+
code,
|
|
32
|
+
col,
|
|
33
|
+
colgroup,
|
|
34
|
+
customElement,
|
|
35
|
+
data,
|
|
36
|
+
datalist,
|
|
37
|
+
dd,
|
|
38
|
+
defs,
|
|
39
|
+
del,
|
|
40
|
+
details,
|
|
41
|
+
dfn,
|
|
42
|
+
dialog,
|
|
43
|
+
dispose,
|
|
44
|
+
div,
|
|
45
|
+
dl,
|
|
46
|
+
dt,
|
|
47
|
+
ellipse,
|
|
48
|
+
em,
|
|
49
|
+
embed,
|
|
50
|
+
enqueueBatchedSignal,
|
|
51
|
+
fieldset,
|
|
52
|
+
figcaption,
|
|
53
|
+
figure,
|
|
54
|
+
font,
|
|
55
|
+
footer,
|
|
56
|
+
form,
|
|
57
|
+
g,
|
|
58
|
+
h1,
|
|
59
|
+
h2,
|
|
60
|
+
h3,
|
|
61
|
+
h4,
|
|
62
|
+
h5,
|
|
63
|
+
h6,
|
|
64
|
+
head,
|
|
65
|
+
header,
|
|
66
|
+
hr,
|
|
67
|
+
html,
|
|
68
|
+
i,
|
|
69
|
+
iframe,
|
|
70
|
+
img,
|
|
71
|
+
input,
|
|
72
|
+
ins,
|
|
73
|
+
isBatching,
|
|
74
|
+
kbd,
|
|
75
|
+
label,
|
|
76
|
+
legend,
|
|
77
|
+
li,
|
|
78
|
+
line,
|
|
79
|
+
linearGradient,
|
|
80
|
+
link,
|
|
81
|
+
main,
|
|
82
|
+
map,
|
|
83
|
+
mark,
|
|
84
|
+
marker,
|
|
85
|
+
marquee,
|
|
86
|
+
mask,
|
|
87
|
+
math,
|
|
88
|
+
menu,
|
|
89
|
+
meta,
|
|
90
|
+
meter,
|
|
91
|
+
nav,
|
|
92
|
+
noscript,
|
|
93
|
+
notifySubscribers,
|
|
94
|
+
object,
|
|
95
|
+
ol,
|
|
96
|
+
optgroup,
|
|
97
|
+
option,
|
|
98
|
+
output,
|
|
99
|
+
p,
|
|
100
|
+
param,
|
|
101
|
+
path,
|
|
102
|
+
pattern,
|
|
103
|
+
picture,
|
|
104
|
+
polygon,
|
|
105
|
+
polyline,
|
|
106
|
+
portal,
|
|
107
|
+
pre,
|
|
108
|
+
progress,
|
|
109
|
+
q,
|
|
110
|
+
radialGradient,
|
|
111
|
+
recordDependency,
|
|
112
|
+
rect,
|
|
113
|
+
registerDisposer,
|
|
114
|
+
rp,
|
|
115
|
+
rt,
|
|
116
|
+
ruby,
|
|
117
|
+
s,
|
|
118
|
+
samp,
|
|
119
|
+
script,
|
|
120
|
+
section,
|
|
121
|
+
select,
|
|
122
|
+
slot,
|
|
123
|
+
small,
|
|
124
|
+
source,
|
|
125
|
+
span,
|
|
126
|
+
stop,
|
|
127
|
+
strong,
|
|
128
|
+
style,
|
|
129
|
+
sub,
|
|
130
|
+
summary,
|
|
131
|
+
sup,
|
|
132
|
+
svg,
|
|
133
|
+
symbol,
|
|
134
|
+
table,
|
|
135
|
+
tagFactory,
|
|
136
|
+
tbody,
|
|
137
|
+
td,
|
|
138
|
+
template,
|
|
139
|
+
text,
|
|
140
|
+
textarea,
|
|
141
|
+
tfoot,
|
|
142
|
+
th,
|
|
143
|
+
thead,
|
|
144
|
+
time,
|
|
145
|
+
title,
|
|
146
|
+
tr,
|
|
147
|
+
track,
|
|
148
|
+
track2,
|
|
149
|
+
tspan,
|
|
150
|
+
u,
|
|
151
|
+
ul,
|
|
152
|
+
use,
|
|
153
|
+
useState,
|
|
154
|
+
var_,
|
|
155
|
+
video
|
|
156
|
+
} from "./chunk-M3MDTVV2.js";
|
|
157
|
+
import {
|
|
158
|
+
__export
|
|
159
|
+
} from "./chunk-MLKGABMK.js";
|
|
160
|
+
|
|
161
|
+
// index.ts
|
|
162
|
+
var index_exports = {};
|
|
163
|
+
__export(index_exports, {
|
|
164
|
+
DynamicComponent: () => DynamicComponent,
|
|
165
|
+
ErrorBoundary: () => ErrorBoundary,
|
|
166
|
+
Fragment: () => Fragment,
|
|
167
|
+
Loading: () => Loading,
|
|
168
|
+
Portal: () => Portal,
|
|
169
|
+
SVG_NS: () => SVG_NS,
|
|
170
|
+
Suspense: () => Suspense,
|
|
171
|
+
a: () => a,
|
|
172
|
+
abbr: () => abbr,
|
|
173
|
+
address: () => address,
|
|
174
|
+
area: () => area,
|
|
175
|
+
article: () => article,
|
|
176
|
+
aside: () => aside,
|
|
177
|
+
audio: () => audio,
|
|
178
|
+
b: () => b,
|
|
179
|
+
base: () => base,
|
|
180
|
+
batch: () => batch,
|
|
181
|
+
bdi: () => bdi,
|
|
182
|
+
bdo: () => bdo,
|
|
183
|
+
bindDynamic: () => bindDynamic,
|
|
184
|
+
blockquote: () => blockquote,
|
|
185
|
+
body: () => body,
|
|
186
|
+
br: () => br,
|
|
187
|
+
button: () => button,
|
|
188
|
+
canvas: () => canvas,
|
|
189
|
+
caption: () => caption,
|
|
190
|
+
catchError: () => catchError,
|
|
191
|
+
catchErrorAsync: () => catchErrorAsync,
|
|
192
|
+
center: () => center,
|
|
193
|
+
circle: () => circle,
|
|
194
|
+
cite: () => cite,
|
|
195
|
+
clipPath: () => clipPath,
|
|
196
|
+
code: () => code,
|
|
197
|
+
col: () => col,
|
|
198
|
+
colgroup: () => colgroup,
|
|
199
|
+
createContext: () => createContext,
|
|
200
|
+
customElement: () => customElement,
|
|
201
|
+
data: () => data,
|
|
202
|
+
datalist: () => datalist,
|
|
203
|
+
dd: () => dd,
|
|
204
|
+
defs: () => defs,
|
|
205
|
+
del: () => del,
|
|
206
|
+
details: () => details,
|
|
207
|
+
dfn: () => dfn,
|
|
208
|
+
dialog: () => dialog,
|
|
209
|
+
dispose: () => dispose,
|
|
210
|
+
div: () => div,
|
|
211
|
+
dl: () => dl,
|
|
212
|
+
dt: () => dt,
|
|
213
|
+
each: () => each,
|
|
214
|
+
ellipse: () => ellipse,
|
|
215
|
+
em: () => em,
|
|
216
|
+
embed: () => embed,
|
|
217
|
+
enqueueBatchedSignal: () => enqueueBatchedSignal,
|
|
218
|
+
fieldset: () => fieldset,
|
|
219
|
+
figcaption: () => figcaption,
|
|
220
|
+
figure: () => figure,
|
|
221
|
+
font: () => font,
|
|
222
|
+
footer: () => footer,
|
|
223
|
+
form: () => form,
|
|
224
|
+
g: () => g,
|
|
225
|
+
getSlot: () => getSlot,
|
|
226
|
+
h1: () => h1,
|
|
227
|
+
h2: () => h2,
|
|
228
|
+
h3: () => h3,
|
|
229
|
+
h4: () => h4,
|
|
230
|
+
h5: () => h5,
|
|
231
|
+
h6: () => h6,
|
|
232
|
+
head: () => head,
|
|
233
|
+
header: () => header,
|
|
234
|
+
hr: () => hr,
|
|
235
|
+
html: () => html,
|
|
236
|
+
i: () => i,
|
|
237
|
+
iframe: () => iframe,
|
|
238
|
+
img: () => img,
|
|
239
|
+
input: () => input,
|
|
240
|
+
ins: () => ins,
|
|
241
|
+
isBatching: () => isBatching,
|
|
242
|
+
kbd: () => kbd,
|
|
243
|
+
label: () => label,
|
|
244
|
+
lazy: () => lazy,
|
|
245
|
+
legend: () => legend,
|
|
246
|
+
li: () => li,
|
|
247
|
+
line: () => line,
|
|
248
|
+
linearGradient: () => linearGradient,
|
|
249
|
+
link: () => link,
|
|
250
|
+
main: () => main,
|
|
251
|
+
map: () => map,
|
|
252
|
+
mark: () => mark,
|
|
253
|
+
marker: () => marker,
|
|
254
|
+
marquee: () => marquee,
|
|
255
|
+
mask: () => mask,
|
|
256
|
+
match: () => match,
|
|
257
|
+
math: () => math,
|
|
258
|
+
menu: () => menu,
|
|
259
|
+
meta: () => meta,
|
|
260
|
+
meter: () => meter,
|
|
261
|
+
mount: () => mount,
|
|
262
|
+
nav: () => nav,
|
|
263
|
+
noscript: () => noscript,
|
|
264
|
+
object: () => object,
|
|
265
|
+
ol: () => ol,
|
|
266
|
+
onMount: () => onMount,
|
|
267
|
+
onUnmount: () => onUnmount,
|
|
268
|
+
optgroup: () => optgroup,
|
|
269
|
+
option: () => option,
|
|
270
|
+
output: () => output,
|
|
271
|
+
p: () => p,
|
|
272
|
+
param: () => param,
|
|
273
|
+
path: () => path,
|
|
274
|
+
pattern: () => pattern,
|
|
275
|
+
picture: () => picture,
|
|
276
|
+
polygon: () => polygon,
|
|
277
|
+
polyline: () => polyline,
|
|
278
|
+
portal: () => portal,
|
|
279
|
+
pre: () => pre,
|
|
280
|
+
progress: () => progress,
|
|
281
|
+
q: () => q,
|
|
282
|
+
radialGradient: () => radialGradient,
|
|
283
|
+
rect: () => rect,
|
|
284
|
+
registerComponent: () => registerComponent,
|
|
285
|
+
registerDisposer: () => registerDisposer,
|
|
286
|
+
resolveComponent: () => resolveComponent,
|
|
287
|
+
rp: () => rp,
|
|
288
|
+
rt: () => rt,
|
|
289
|
+
ruby: () => ruby,
|
|
290
|
+
s: () => s,
|
|
291
|
+
samp: () => samp,
|
|
292
|
+
script: () => script,
|
|
293
|
+
section: () => section,
|
|
294
|
+
select: () => select,
|
|
295
|
+
setGlobalErrorHandler: () => setGlobalErrorHandler,
|
|
296
|
+
show: () => show,
|
|
297
|
+
slot: () => slot,
|
|
298
|
+
small: () => small,
|
|
299
|
+
source: () => source,
|
|
300
|
+
span: () => span,
|
|
301
|
+
stop: () => stop,
|
|
302
|
+
strong: () => strong,
|
|
303
|
+
style: () => style,
|
|
304
|
+
sub: () => sub,
|
|
305
|
+
summary: () => summary,
|
|
306
|
+
sup: () => sup,
|
|
307
|
+
svg: () => svg,
|
|
308
|
+
symbol: () => symbol,
|
|
309
|
+
table: () => table,
|
|
310
|
+
tagFactory: () => tagFactory,
|
|
311
|
+
tbody: () => tbody,
|
|
312
|
+
td: () => td,
|
|
313
|
+
template: () => template,
|
|
314
|
+
text: () => text,
|
|
315
|
+
textarea: () => textarea,
|
|
316
|
+
tfoot: () => tfoot,
|
|
317
|
+
th: () => th,
|
|
318
|
+
thead: () => thead,
|
|
319
|
+
time: () => time,
|
|
320
|
+
title: () => title,
|
|
321
|
+
tr: () => tr,
|
|
322
|
+
track: () => track2,
|
|
323
|
+
tspan: () => tspan,
|
|
324
|
+
u: () => u,
|
|
325
|
+
ul: () => ul,
|
|
326
|
+
unregisterComponent: () => unregisterComponent,
|
|
327
|
+
use: () => use,
|
|
328
|
+
useArray: () => useArray,
|
|
329
|
+
useCallback: () => useCallback,
|
|
330
|
+
useComputed: () => useComputed,
|
|
331
|
+
useDeepState: () => useDeepState,
|
|
332
|
+
useEffect: () => useEffect,
|
|
333
|
+
useMemo: () => useMemo,
|
|
334
|
+
useReactiveArray: () => useReactiveArray,
|
|
335
|
+
useRef: () => useRef,
|
|
336
|
+
useState: () => useState,
|
|
337
|
+
useStore: () => useStore,
|
|
338
|
+
useWatch: () => useWatch,
|
|
339
|
+
var_: () => var_,
|
|
340
|
+
video: () => video,
|
|
341
|
+
when: () => when
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
// src/core/rendering/mount.ts
|
|
345
|
+
function mount(component, container) {
|
|
346
|
+
if (!container) {
|
|
347
|
+
throw new Error("Mount target element not found.");
|
|
348
|
+
}
|
|
349
|
+
const startTime = typeof performance !== "undefined" ? performance.now() : 0;
|
|
350
|
+
const node = typeof component === "function" ? component() : component;
|
|
351
|
+
const duration = typeof performance !== "undefined" ? performance.now() - startTime : 0;
|
|
352
|
+
container.appendChild(node);
|
|
353
|
+
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
354
|
+
if (hook) {
|
|
355
|
+
hook.emit("app:init", { rootElement: node, container, duration });
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
node,
|
|
359
|
+
unmount() {
|
|
360
|
+
if (hook) hook.emit("app:unmount", { rootElement: node });
|
|
361
|
+
dispose(node);
|
|
362
|
+
if (node.parentNode) {
|
|
363
|
+
node.parentNode.removeChild(node);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/core/rendering/each.ts
|
|
370
|
+
function resolveNodeChild(child) {
|
|
371
|
+
if (typeof child === "function") {
|
|
372
|
+
return resolveNodeChild(child());
|
|
373
|
+
}
|
|
374
|
+
if (child instanceof Node) {
|
|
375
|
+
return child;
|
|
376
|
+
}
|
|
377
|
+
return document.createTextNode(String(child));
|
|
378
|
+
}
|
|
379
|
+
function longestIncreasingSubsequence(arr, len) {
|
|
380
|
+
if (len === 0) return [];
|
|
381
|
+
const tails = [];
|
|
382
|
+
const predecessor = new Array(len);
|
|
383
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
384
|
+
const val = arr[i2];
|
|
385
|
+
let lo = 0;
|
|
386
|
+
let hi = tails.length;
|
|
387
|
+
while (lo < hi) {
|
|
388
|
+
const mid = lo + hi >> 1;
|
|
389
|
+
if (arr[tails[mid]] < val) {
|
|
390
|
+
lo = mid + 1;
|
|
391
|
+
} else {
|
|
392
|
+
hi = mid;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
tails[lo] = i2;
|
|
396
|
+
predecessor[i2] = lo > 0 ? tails[lo - 1] : -1;
|
|
397
|
+
}
|
|
398
|
+
const lisLength = tails.length;
|
|
399
|
+
const result = new Array(lisLength);
|
|
400
|
+
let k = tails[lisLength - 1];
|
|
401
|
+
for (let i2 = lisLength - 1; i2 >= 0; i2--) {
|
|
402
|
+
result[i2] = k;
|
|
403
|
+
k = predecessor[k];
|
|
404
|
+
}
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
407
|
+
function each(getArray, render, options) {
|
|
408
|
+
const anchor = document.createComment("each:anchor");
|
|
409
|
+
const end = document.createComment("each:end");
|
|
410
|
+
let oldKeys = [];
|
|
411
|
+
let nodeMap = /* @__PURE__ */ new Map();
|
|
412
|
+
let workMap = /* @__PURE__ */ new Map();
|
|
413
|
+
let newNodes = [];
|
|
414
|
+
const oldKeyIndex = /* @__PURE__ */ new Map();
|
|
415
|
+
let reusedNewBuf = [];
|
|
416
|
+
let reusedOldBuf = [];
|
|
417
|
+
let initialized = false;
|
|
418
|
+
let sentinelInserted = false;
|
|
419
|
+
const keyFn = options.key;
|
|
420
|
+
const update = () => {
|
|
421
|
+
const arr = getArray();
|
|
422
|
+
const newLen = arr.length;
|
|
423
|
+
const parent = anchor.parentNode;
|
|
424
|
+
if (!parent) return;
|
|
425
|
+
if (!sentinelInserted) {
|
|
426
|
+
parent.insertBefore(end, anchor.nextSibling);
|
|
427
|
+
sentinelInserted = true;
|
|
428
|
+
}
|
|
429
|
+
const newKeys = new Array(newLen);
|
|
430
|
+
for (let i2 = 0; i2 < newLen; i2++) {
|
|
431
|
+
newKeys[i2] = keyFn(arr[i2]);
|
|
432
|
+
}
|
|
433
|
+
if (newNodes.length < newLen) {
|
|
434
|
+
newNodes = new Array(newLen);
|
|
435
|
+
}
|
|
436
|
+
workMap.clear();
|
|
437
|
+
for (let i2 = 0; i2 < newLen; i2++) {
|
|
438
|
+
const key = newKeys[i2];
|
|
439
|
+
const existing = nodeMap.get(key);
|
|
440
|
+
let node;
|
|
441
|
+
if (existing !== void 0) {
|
|
442
|
+
node = existing;
|
|
443
|
+
} else {
|
|
444
|
+
node = resolveNodeChild(render(arr[i2], i2));
|
|
445
|
+
}
|
|
446
|
+
workMap.set(key, node);
|
|
447
|
+
newNodes[i2] = node;
|
|
448
|
+
}
|
|
449
|
+
for (const [key, node] of nodeMap) {
|
|
450
|
+
if (!workMap.has(key) && node.parentNode) {
|
|
451
|
+
parent.removeChild(node);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if (newLen === 0) {
|
|
455
|
+
oldKeys = newKeys;
|
|
456
|
+
const tmp2 = nodeMap;
|
|
457
|
+
nodeMap = workMap;
|
|
458
|
+
workMap = tmp2;
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const oldLen = oldKeys.length;
|
|
462
|
+
oldKeyIndex.clear();
|
|
463
|
+
for (let i2 = 0; i2 < oldLen; i2++) {
|
|
464
|
+
oldKeyIndex.set(oldKeys[i2], i2);
|
|
465
|
+
}
|
|
466
|
+
if (reusedNewBuf.length < newLen) {
|
|
467
|
+
reusedNewBuf = new Array(newLen);
|
|
468
|
+
reusedOldBuf = new Array(newLen);
|
|
469
|
+
}
|
|
470
|
+
let reusedCount = 0;
|
|
471
|
+
for (let i2 = 0; i2 < newLen; i2++) {
|
|
472
|
+
const oldIdx = oldKeyIndex.get(newKeys[i2]);
|
|
473
|
+
if (oldIdx !== void 0) {
|
|
474
|
+
reusedNewBuf[reusedCount] = i2;
|
|
475
|
+
reusedOldBuf[reusedCount] = oldIdx;
|
|
476
|
+
reusedCount++;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
const lisIndices = longestIncreasingSubsequence(reusedOldBuf, reusedCount);
|
|
480
|
+
const isStable = new Uint8Array(newLen);
|
|
481
|
+
for (let i2 = 0; i2 < lisIndices.length; i2++) {
|
|
482
|
+
isStable[reusedNewBuf[lisIndices[i2]]] = 1;
|
|
483
|
+
}
|
|
484
|
+
let nextRef = end;
|
|
485
|
+
for (let i2 = newLen - 1; i2 >= 0; i2--) {
|
|
486
|
+
const node = newNodes[i2];
|
|
487
|
+
if (isStable[i2]) {
|
|
488
|
+
nextRef = node;
|
|
489
|
+
} else {
|
|
490
|
+
if (node.nextSibling !== nextRef) {
|
|
491
|
+
parent.insertBefore(node, nextRef);
|
|
492
|
+
}
|
|
493
|
+
nextRef = node;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
oldKeys = newKeys;
|
|
497
|
+
const tmp = nodeMap;
|
|
498
|
+
nodeMap = workMap;
|
|
499
|
+
workMap = tmp;
|
|
500
|
+
initialized = true;
|
|
501
|
+
};
|
|
502
|
+
track(update);
|
|
503
|
+
if (!initialized) {
|
|
504
|
+
queueMicrotask(() => {
|
|
505
|
+
if (!initialized && anchor.parentNode) {
|
|
506
|
+
update();
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
return anchor;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// src/core/rendering/fragment.ts
|
|
514
|
+
function Fragment(nodes) {
|
|
515
|
+
const frag = document.createDocumentFragment();
|
|
516
|
+
for (const child of nodes) {
|
|
517
|
+
if (child == null) continue;
|
|
518
|
+
if (Array.isArray(child)) {
|
|
519
|
+
for (const nested of child) {
|
|
520
|
+
frag.appendChild(resolveChild(nested));
|
|
521
|
+
}
|
|
522
|
+
} else {
|
|
523
|
+
frag.appendChild(resolveChild(child));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return frag;
|
|
527
|
+
}
|
|
528
|
+
function resolveChild(child) {
|
|
529
|
+
if (child == null) {
|
|
530
|
+
return document.createTextNode("");
|
|
531
|
+
}
|
|
532
|
+
if (child instanceof Node) {
|
|
533
|
+
return child;
|
|
534
|
+
}
|
|
535
|
+
if (typeof child === "function") {
|
|
536
|
+
const result = child();
|
|
537
|
+
if (result instanceof Node) return result;
|
|
538
|
+
return document.createTextNode(String(result ?? ""));
|
|
539
|
+
}
|
|
540
|
+
return document.createTextNode(String(child));
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// src/core/rendering/portal.ts
|
|
544
|
+
function Portal(nodes, target) {
|
|
545
|
+
const anchor = document.createComment("portal");
|
|
546
|
+
const container = target || document.body;
|
|
547
|
+
let portalContent = null;
|
|
548
|
+
queueMicrotask(() => {
|
|
549
|
+
try {
|
|
550
|
+
portalContent = nodes();
|
|
551
|
+
container.appendChild(portalContent);
|
|
552
|
+
} catch (err) {
|
|
553
|
+
console.error("[Portal] Render error:", err);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
const observer = new MutationObserver(() => {
|
|
557
|
+
if (!anchor.isConnected && portalContent) {
|
|
558
|
+
portalContent.remove();
|
|
559
|
+
portalContent = null;
|
|
560
|
+
observer.disconnect();
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
queueMicrotask(() => {
|
|
564
|
+
if (anchor.parentNode) {
|
|
565
|
+
observer.observe(anchor.parentNode, { childList: true });
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
return anchor;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// src/core/rendering/dynamic.ts
|
|
572
|
+
var componentRegistry = /* @__PURE__ */ new Map();
|
|
573
|
+
function registerComponent(name, component) {
|
|
574
|
+
componentRegistry.set(name, component);
|
|
575
|
+
}
|
|
576
|
+
function unregisterComponent(name) {
|
|
577
|
+
componentRegistry.delete(name);
|
|
578
|
+
}
|
|
579
|
+
function resolveComponent(name) {
|
|
580
|
+
const component = componentRegistry.get(name);
|
|
581
|
+
if (component) {
|
|
582
|
+
return component();
|
|
583
|
+
}
|
|
584
|
+
return div({ nodes: `[Component "${name}" not found]` });
|
|
585
|
+
}
|
|
586
|
+
function DynamicComponent(is) {
|
|
587
|
+
const container = div({ class: "sibu-dynamic" });
|
|
588
|
+
function render() {
|
|
589
|
+
const target = is();
|
|
590
|
+
let el;
|
|
591
|
+
if (typeof target === "function") {
|
|
592
|
+
el = target();
|
|
593
|
+
} else {
|
|
594
|
+
el = resolveComponent(target);
|
|
595
|
+
}
|
|
596
|
+
container.replaceChildren(el);
|
|
597
|
+
}
|
|
598
|
+
track(render);
|
|
599
|
+
return container;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// src/core/rendering/slots.ts
|
|
603
|
+
function getSlot(slots, name = "default") {
|
|
604
|
+
return slots?.[name];
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// src/core/rendering/directives.ts
|
|
608
|
+
function show(condition, element) {
|
|
609
|
+
const update = () => {
|
|
610
|
+
element.style.display = condition() ? "" : "none";
|
|
611
|
+
};
|
|
612
|
+
track(update);
|
|
613
|
+
return element;
|
|
614
|
+
}
|
|
615
|
+
function when(condition, thenBranch, elseBranch) {
|
|
616
|
+
const anchor = document.createComment("when");
|
|
617
|
+
let currentNode = null;
|
|
618
|
+
let initialized = false;
|
|
619
|
+
const update = () => {
|
|
620
|
+
const show2 = condition();
|
|
621
|
+
const parent = anchor.parentNode;
|
|
622
|
+
if (!parent) return;
|
|
623
|
+
if (currentNode?.parentNode) {
|
|
624
|
+
currentNode.parentNode.removeChild(currentNode);
|
|
625
|
+
currentNode = null;
|
|
626
|
+
}
|
|
627
|
+
const result = show2 ? thenBranch() : elseBranch ? elseBranch() : null;
|
|
628
|
+
if (result != null) {
|
|
629
|
+
const node = result instanceof Node ? result : document.createTextNode(String(result));
|
|
630
|
+
parent.insertBefore(node, anchor.nextSibling);
|
|
631
|
+
currentNode = node;
|
|
632
|
+
}
|
|
633
|
+
initialized = true;
|
|
634
|
+
};
|
|
635
|
+
track(update);
|
|
636
|
+
if (!initialized) {
|
|
637
|
+
queueMicrotask(() => {
|
|
638
|
+
if (!initialized && anchor.parentNode) update();
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
return anchor;
|
|
642
|
+
}
|
|
643
|
+
function match(value, cases, fallback) {
|
|
644
|
+
const anchor = document.createComment("match");
|
|
645
|
+
let currentNode = null;
|
|
646
|
+
let initialized = false;
|
|
647
|
+
const update = () => {
|
|
648
|
+
const key = String(value());
|
|
649
|
+
const parent = anchor.parentNode;
|
|
650
|
+
if (!parent) return;
|
|
651
|
+
if (currentNode?.parentNode) {
|
|
652
|
+
currentNode.parentNode.removeChild(currentNode);
|
|
653
|
+
currentNode = null;
|
|
654
|
+
}
|
|
655
|
+
const renderFn = cases[key] || fallback;
|
|
656
|
+
if (renderFn) {
|
|
657
|
+
const result = renderFn();
|
|
658
|
+
if (result != null) {
|
|
659
|
+
const node = result instanceof Node ? result : document.createTextNode(String(result));
|
|
660
|
+
parent.insertBefore(node, anchor.nextSibling);
|
|
661
|
+
currentNode = node;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
initialized = true;
|
|
665
|
+
};
|
|
666
|
+
track(update);
|
|
667
|
+
if (!initialized) {
|
|
668
|
+
queueMicrotask(() => {
|
|
669
|
+
if (!initialized && anchor.parentNode) update();
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
return anchor;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// src/core/rendering/catch.ts
|
|
676
|
+
var globalErrorHandler = null;
|
|
677
|
+
function catchError(fn, onError) {
|
|
678
|
+
try {
|
|
679
|
+
const result = fn();
|
|
680
|
+
if (result && typeof result.then === "function") {
|
|
681
|
+
result.catch((err) => {
|
|
682
|
+
if (onError) {
|
|
683
|
+
onError(err, "async");
|
|
684
|
+
} else if (globalErrorHandler) {
|
|
685
|
+
globalErrorHandler(err, "async");
|
|
686
|
+
} else {
|
|
687
|
+
console.error("Unhandled async error in Sibu.catchError:", err);
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
return result;
|
|
692
|
+
} catch (err) {
|
|
693
|
+
if (onError) {
|
|
694
|
+
onError(err, "sync");
|
|
695
|
+
} else if (globalErrorHandler) {
|
|
696
|
+
globalErrorHandler(err, "sync");
|
|
697
|
+
} else {
|
|
698
|
+
console.error("Unhandled error in Sibu.catchError:", err);
|
|
699
|
+
}
|
|
700
|
+
return null;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
async function catchErrorAsync(fn, onError) {
|
|
704
|
+
try {
|
|
705
|
+
return await fn();
|
|
706
|
+
} catch (err) {
|
|
707
|
+
if (onError) {
|
|
708
|
+
onError(err, "async");
|
|
709
|
+
} else if (globalErrorHandler) {
|
|
710
|
+
globalErrorHandler(err, "async");
|
|
711
|
+
} else {
|
|
712
|
+
console.error("Unhandled async error in Sibu.catchErrorAsync:", err);
|
|
713
|
+
}
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
function setGlobalErrorHandler(handler) {
|
|
718
|
+
globalErrorHandler = handler;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// src/core/hooks/useWatch.ts
|
|
722
|
+
function useWatch(getter, callback) {
|
|
723
|
+
let oldValue = getter();
|
|
724
|
+
const subscriber = () => {
|
|
725
|
+
const newValue = getter();
|
|
726
|
+
if (!Object.is(newValue, oldValue)) {
|
|
727
|
+
callback(newValue, oldValue);
|
|
728
|
+
oldValue = newValue;
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
const teardown = track(subscriber);
|
|
732
|
+
return teardown;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// src/core/hooks/useStore.ts
|
|
736
|
+
function useStore(initialState) {
|
|
737
|
+
const signals = {};
|
|
738
|
+
Object.keys(initialState).forEach((key) => {
|
|
739
|
+
const [getter, setter] = useState(initialState[key]);
|
|
740
|
+
signals[key] = [getter, setter];
|
|
741
|
+
});
|
|
742
|
+
const store = new Proxy({}, {
|
|
743
|
+
get(_, prop) {
|
|
744
|
+
if (prop in signals) {
|
|
745
|
+
const getter = signals[prop][0];
|
|
746
|
+
return getter();
|
|
747
|
+
}
|
|
748
|
+
return void 0;
|
|
749
|
+
},
|
|
750
|
+
set() {
|
|
751
|
+
throw new Error("Direct mutation of store is not allowed. Use actions.setState.");
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
const getSnapshot = () => {
|
|
755
|
+
const snapshot = {};
|
|
756
|
+
Object.keys(signals).forEach((key) => {
|
|
757
|
+
snapshot[key] = signals[key][0]();
|
|
758
|
+
});
|
|
759
|
+
return snapshot;
|
|
760
|
+
};
|
|
761
|
+
const setState = (patch) => {
|
|
762
|
+
const current = getSnapshot();
|
|
763
|
+
const nextState = typeof patch === "function" ? patch(current) : patch;
|
|
764
|
+
Object.entries(nextState).forEach(([key, value]) => {
|
|
765
|
+
if (key in signals) {
|
|
766
|
+
signals[key][1](value);
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
};
|
|
770
|
+
const reset = () => {
|
|
771
|
+
Object.keys(initialState).forEach((key) => {
|
|
772
|
+
const setter = signals[key][1];
|
|
773
|
+
setter(initialState[key]);
|
|
774
|
+
});
|
|
775
|
+
};
|
|
776
|
+
const subscribe = (callback) => {
|
|
777
|
+
return useEffect(() => {
|
|
778
|
+
const snapshot = getSnapshot();
|
|
779
|
+
callback(snapshot);
|
|
780
|
+
});
|
|
781
|
+
};
|
|
782
|
+
const subscribeKey = (key, callback) => {
|
|
783
|
+
let prev = signals[key][0]();
|
|
784
|
+
return useEffect(() => {
|
|
785
|
+
const current = signals[key][0]();
|
|
786
|
+
if (!Object.is(current, prev)) {
|
|
787
|
+
const oldPrev = prev;
|
|
788
|
+
prev = current;
|
|
789
|
+
callback(current, oldPrev);
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
};
|
|
793
|
+
return [store, { setState, reset, subscribe, subscribeKey, getSnapshot }];
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// src/core/hooks/useRef.ts
|
|
797
|
+
function useRef(initial) {
|
|
798
|
+
return { current: initial };
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// src/core/hooks/useMemo.ts
|
|
802
|
+
function useMemo(factory) {
|
|
803
|
+
return useComputed(factory);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// src/core/hooks/useCallback.ts
|
|
807
|
+
function useCallback(callback) {
|
|
808
|
+
return useComputed(callback);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// src/core/hooks/useArray.ts
|
|
812
|
+
function useArray(initial = []) {
|
|
813
|
+
const [arr, setArr] = useState([...initial]);
|
|
814
|
+
const actions = {
|
|
815
|
+
push(...items) {
|
|
816
|
+
setArr((prev) => [...prev, ...items]);
|
|
817
|
+
},
|
|
818
|
+
pop() {
|
|
819
|
+
let removed;
|
|
820
|
+
setArr((prev) => {
|
|
821
|
+
const copy = [...prev];
|
|
822
|
+
removed = copy.pop();
|
|
823
|
+
return copy;
|
|
824
|
+
});
|
|
825
|
+
return removed;
|
|
826
|
+
},
|
|
827
|
+
shift() {
|
|
828
|
+
let removed;
|
|
829
|
+
setArr((prev) => {
|
|
830
|
+
const copy = [...prev];
|
|
831
|
+
removed = copy.shift();
|
|
832
|
+
return copy;
|
|
833
|
+
});
|
|
834
|
+
return removed;
|
|
835
|
+
},
|
|
836
|
+
unshift(...items) {
|
|
837
|
+
setArr((prev) => [...items, ...prev]);
|
|
838
|
+
},
|
|
839
|
+
splice(start, deleteCount = 0, ...items) {
|
|
840
|
+
let removed = [];
|
|
841
|
+
setArr((prev) => {
|
|
842
|
+
const copy = [...prev];
|
|
843
|
+
removed = copy.splice(start, deleteCount, ...items);
|
|
844
|
+
return copy;
|
|
845
|
+
});
|
|
846
|
+
return removed;
|
|
847
|
+
},
|
|
848
|
+
remove(index) {
|
|
849
|
+
setArr((prev) => prev.filter((_, i2) => i2 !== index));
|
|
850
|
+
},
|
|
851
|
+
removeWhere(predicate) {
|
|
852
|
+
setArr((prev) => {
|
|
853
|
+
const idx = prev.findIndex(predicate);
|
|
854
|
+
if (idx === -1) return prev;
|
|
855
|
+
return prev.filter((_, i2) => i2 !== idx);
|
|
856
|
+
});
|
|
857
|
+
},
|
|
858
|
+
set(items) {
|
|
859
|
+
setArr([...items]);
|
|
860
|
+
},
|
|
861
|
+
update(index, value) {
|
|
862
|
+
setArr((prev) => prev.map((item, i2) => i2 === index ? value : item));
|
|
863
|
+
},
|
|
864
|
+
updateWhere(predicate, updater) {
|
|
865
|
+
setArr((prev) => prev.map((item) => predicate(item) ? updater(item) : item));
|
|
866
|
+
},
|
|
867
|
+
sort(compareFn) {
|
|
868
|
+
setArr((prev) => [...prev].sort(compareFn));
|
|
869
|
+
},
|
|
870
|
+
reverse() {
|
|
871
|
+
setArr((prev) => [...prev].reverse());
|
|
872
|
+
},
|
|
873
|
+
filter(predicate) {
|
|
874
|
+
setArr((prev) => prev.filter(predicate));
|
|
875
|
+
},
|
|
876
|
+
map(transform) {
|
|
877
|
+
setArr((prev) => prev.map(transform));
|
|
878
|
+
},
|
|
879
|
+
clear() {
|
|
880
|
+
setArr([]);
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
return [arr, actions];
|
|
884
|
+
}
|
|
885
|
+
function useReactiveArray(initial = []) {
|
|
886
|
+
let data2 = [...initial];
|
|
887
|
+
let snapshot = null;
|
|
888
|
+
const signal = {};
|
|
889
|
+
function notify() {
|
|
890
|
+
snapshot = null;
|
|
891
|
+
if (!enqueueBatchedSignal(signal)) {
|
|
892
|
+
notifySubscribers(signal);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
function get() {
|
|
896
|
+
recordDependency(signal);
|
|
897
|
+
if (snapshot === null) {
|
|
898
|
+
snapshot = Object.freeze([...data2]);
|
|
899
|
+
}
|
|
900
|
+
return snapshot;
|
|
901
|
+
}
|
|
902
|
+
const actions = {
|
|
903
|
+
push(...items) {
|
|
904
|
+
if (items.length === 0) return;
|
|
905
|
+
data2.push(...items);
|
|
906
|
+
notify();
|
|
907
|
+
},
|
|
908
|
+
pop() {
|
|
909
|
+
if (data2.length === 0) return void 0;
|
|
910
|
+
const removed = data2.pop();
|
|
911
|
+
notify();
|
|
912
|
+
return removed;
|
|
913
|
+
},
|
|
914
|
+
shift() {
|
|
915
|
+
if (data2.length === 0) return void 0;
|
|
916
|
+
const removed = data2.shift();
|
|
917
|
+
notify();
|
|
918
|
+
return removed;
|
|
919
|
+
},
|
|
920
|
+
unshift(...items) {
|
|
921
|
+
if (items.length === 0) return;
|
|
922
|
+
data2.unshift(...items);
|
|
923
|
+
notify();
|
|
924
|
+
},
|
|
925
|
+
splice(start, deleteCount = 0, ...items) {
|
|
926
|
+
const removed = data2.splice(start, deleteCount, ...items);
|
|
927
|
+
if (removed.length > 0 || items.length > 0) {
|
|
928
|
+
notify();
|
|
929
|
+
}
|
|
930
|
+
return removed;
|
|
931
|
+
},
|
|
932
|
+
remove(index) {
|
|
933
|
+
if (index < 0 || index >= data2.length) return;
|
|
934
|
+
data2.splice(index, 1);
|
|
935
|
+
notify();
|
|
936
|
+
},
|
|
937
|
+
removeWhere(predicate) {
|
|
938
|
+
const idx = data2.findIndex(predicate);
|
|
939
|
+
if (idx === -1) return;
|
|
940
|
+
data2.splice(idx, 1);
|
|
941
|
+
notify();
|
|
942
|
+
},
|
|
943
|
+
set(items) {
|
|
944
|
+
data2 = [...items];
|
|
945
|
+
notify();
|
|
946
|
+
},
|
|
947
|
+
update(index, value) {
|
|
948
|
+
if (index < 0 || index >= data2.length) return;
|
|
949
|
+
if (Object.is(data2[index], value)) return;
|
|
950
|
+
data2[index] = value;
|
|
951
|
+
notify();
|
|
952
|
+
},
|
|
953
|
+
updateWhere(predicate, updater) {
|
|
954
|
+
let changed = false;
|
|
955
|
+
for (let i2 = 0; i2 < data2.length; i2++) {
|
|
956
|
+
if (predicate(data2[i2])) {
|
|
957
|
+
const updated = updater(data2[i2]);
|
|
958
|
+
if (!Object.is(data2[i2], updated)) {
|
|
959
|
+
data2[i2] = updated;
|
|
960
|
+
changed = true;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
if (changed) notify();
|
|
965
|
+
},
|
|
966
|
+
sort(compareFn) {
|
|
967
|
+
if (data2.length <= 1) return;
|
|
968
|
+
data2.sort(compareFn);
|
|
969
|
+
notify();
|
|
970
|
+
},
|
|
971
|
+
reverse() {
|
|
972
|
+
if (data2.length <= 1) return;
|
|
973
|
+
data2.reverse();
|
|
974
|
+
notify();
|
|
975
|
+
},
|
|
976
|
+
filter(predicate) {
|
|
977
|
+
const filtered = data2.filter(predicate);
|
|
978
|
+
if (filtered.length === data2.length) return;
|
|
979
|
+
data2 = filtered;
|
|
980
|
+
notify();
|
|
981
|
+
},
|
|
982
|
+
map(transform) {
|
|
983
|
+
let changed = false;
|
|
984
|
+
for (let i2 = 0; i2 < data2.length; i2++) {
|
|
985
|
+
const transformed = transform(data2[i2], i2);
|
|
986
|
+
if (!Object.is(data2[i2], transformed)) {
|
|
987
|
+
data2[i2] = transformed;
|
|
988
|
+
changed = true;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
if (changed) notify();
|
|
992
|
+
},
|
|
993
|
+
clear() {
|
|
994
|
+
if (data2.length === 0) return;
|
|
995
|
+
data2 = [];
|
|
996
|
+
notify();
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
return [get, actions];
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// src/core/hooks/useDeepState.ts
|
|
1003
|
+
function deepEqual(a2, b2) {
|
|
1004
|
+
if (Object.is(a2, b2)) return true;
|
|
1005
|
+
if (a2 == null || b2 == null) return false;
|
|
1006
|
+
if (typeof a2 !== typeof b2) return false;
|
|
1007
|
+
if (typeof a2 !== "object") return false;
|
|
1008
|
+
if (Array.isArray(a2)) {
|
|
1009
|
+
if (!Array.isArray(b2)) return false;
|
|
1010
|
+
if (a2.length !== b2.length) return false;
|
|
1011
|
+
return a2.every((val, i2) => deepEqual(val, b2[i2]));
|
|
1012
|
+
}
|
|
1013
|
+
const keysA = Object.keys(a2);
|
|
1014
|
+
const keysB = Object.keys(b2);
|
|
1015
|
+
if (keysA.length !== keysB.length) return false;
|
|
1016
|
+
return keysA.every((key) => deepEqual(a2[key], b2[key]));
|
|
1017
|
+
}
|
|
1018
|
+
function useDeepState(initial) {
|
|
1019
|
+
const state = { value: initial };
|
|
1020
|
+
function get() {
|
|
1021
|
+
recordDependency(state);
|
|
1022
|
+
return state.value;
|
|
1023
|
+
}
|
|
1024
|
+
function set(next) {
|
|
1025
|
+
const newValue = typeof next === "function" ? next(state.value) : next;
|
|
1026
|
+
if (deepEqual(newValue, state.value)) return;
|
|
1027
|
+
state.value = newValue;
|
|
1028
|
+
if (!enqueueBatchedSignal(state)) {
|
|
1029
|
+
notifySubscribers(state);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
return [get, set];
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// src/core/rendering/lifecycle.ts
|
|
1036
|
+
function onMount(callback, element) {
|
|
1037
|
+
if (element) {
|
|
1038
|
+
if (element.isConnected) {
|
|
1039
|
+
queueMicrotask(() => {
|
|
1040
|
+
callback();
|
|
1041
|
+
});
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
const observer = new MutationObserver(() => {
|
|
1045
|
+
if (element.isConnected) {
|
|
1046
|
+
observer.disconnect();
|
|
1047
|
+
callback();
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
queueMicrotask(() => {
|
|
1051
|
+
if (element.isConnected) {
|
|
1052
|
+
callback();
|
|
1053
|
+
} else {
|
|
1054
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
} else {
|
|
1058
|
+
queueMicrotask(() => {
|
|
1059
|
+
callback();
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
function onUnmount(callback, element) {
|
|
1064
|
+
const startObserving = () => {
|
|
1065
|
+
const observer = new MutationObserver(() => {
|
|
1066
|
+
if (!element.isConnected) {
|
|
1067
|
+
observer.disconnect();
|
|
1068
|
+
callback();
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1072
|
+
};
|
|
1073
|
+
if (element.isConnected) {
|
|
1074
|
+
startObserving();
|
|
1075
|
+
} else {
|
|
1076
|
+
onMount(() => {
|
|
1077
|
+
startObserving();
|
|
1078
|
+
return void 0;
|
|
1079
|
+
}, element);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
// src/core/rendering/lazy.ts
|
|
1084
|
+
function lazy(importFn) {
|
|
1085
|
+
let cached = null;
|
|
1086
|
+
return function LazyComponent() {
|
|
1087
|
+
if (cached) {
|
|
1088
|
+
return cached();
|
|
1089
|
+
}
|
|
1090
|
+
const [_status, setStatus] = useState("loading");
|
|
1091
|
+
const [_error, setError] = useState(null);
|
|
1092
|
+
const container = div({ class: "sibu-lazy" });
|
|
1093
|
+
importFn().then((mod) => {
|
|
1094
|
+
cached = mod.default;
|
|
1095
|
+
const rendered = cached();
|
|
1096
|
+
container.replaceChildren(rendered);
|
|
1097
|
+
setStatus("loaded");
|
|
1098
|
+
}).catch((err) => {
|
|
1099
|
+
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
1100
|
+
setError(errorObj);
|
|
1101
|
+
setStatus("error");
|
|
1102
|
+
container.replaceChildren(
|
|
1103
|
+
div({
|
|
1104
|
+
class: "sibu-lazy-error",
|
|
1105
|
+
nodes: `Failed to load component: ${errorObj.message}`
|
|
1106
|
+
})
|
|
1107
|
+
);
|
|
1108
|
+
});
|
|
1109
|
+
container.appendChild(span({ class: "sibu-lazy-loading", nodes: "Loading..." }));
|
|
1110
|
+
return container;
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
function Suspense({ nodes, fallback }) {
|
|
1114
|
+
const container = div({ class: "sibu-suspense" });
|
|
1115
|
+
const fallbackEl = fallback();
|
|
1116
|
+
container.appendChild(fallbackEl);
|
|
1117
|
+
queueMicrotask(() => {
|
|
1118
|
+
try {
|
|
1119
|
+
const childEl = nodes();
|
|
1120
|
+
if (childEl.classList.contains("sibu-lazy")) {
|
|
1121
|
+
const observer = new MutationObserver(() => {
|
|
1122
|
+
const loading = childEl.querySelector(".sibu-lazy-loading");
|
|
1123
|
+
if (!loading) {
|
|
1124
|
+
observer.disconnect();
|
|
1125
|
+
container.replaceChildren(childEl);
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
observer.observe(childEl, { childList: true, subtree: true });
|
|
1129
|
+
if (!childEl.querySelector(".sibu-lazy-loading")) {
|
|
1130
|
+
container.replaceChildren(childEl);
|
|
1131
|
+
}
|
|
1132
|
+
} else {
|
|
1133
|
+
container.replaceChildren(childEl);
|
|
1134
|
+
}
|
|
1135
|
+
} catch {
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
return container;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
// src/components/ErrorBoundary.ts
|
|
1142
|
+
var errorBoundaryStyles = `
|
|
1143
|
+
.sibu-error-boundary {
|
|
1144
|
+
position: relative;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
.sibu-error-fallback {
|
|
1148
|
+
border: 2px solid #dc3545;
|
|
1149
|
+
border-radius: 8px;
|
|
1150
|
+
padding: 20px;
|
|
1151
|
+
margin: 10px 0;
|
|
1152
|
+
background: linear-gradient(135deg, #fff5f5 0%, #ffebee 100%);
|
|
1153
|
+
box-shadow: 0 2px 12px rgba(220, 53, 69, 0.15);
|
|
1154
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
.sibu-error-fallback .sibu-error-title {
|
|
1158
|
+
margin: 0 0 12px 0;
|
|
1159
|
+
color: #dc3545;
|
|
1160
|
+
font-size: 1.1em;
|
|
1161
|
+
font-weight: 600;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
.sibu-error-fallback .sibu-error-message {
|
|
1165
|
+
font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
|
|
1166
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
1167
|
+
padding: 10px 14px;
|
|
1168
|
+
border-radius: 6px;
|
|
1169
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
1170
|
+
margin: 10px 0;
|
|
1171
|
+
color: #495057;
|
|
1172
|
+
word-break: break-word;
|
|
1173
|
+
font-size: 0.9em;
|
|
1174
|
+
line-height: 1.5;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
.sibu-error-fallback .sibu-error-btn {
|
|
1178
|
+
display: inline-flex;
|
|
1179
|
+
align-items: center;
|
|
1180
|
+
gap: 6px;
|
|
1181
|
+
padding: 8px 18px;
|
|
1182
|
+
border: none;
|
|
1183
|
+
border-radius: 6px;
|
|
1184
|
+
cursor: pointer;
|
|
1185
|
+
font-size: 14px;
|
|
1186
|
+
font-weight: 500;
|
|
1187
|
+
transition: all 0.2s ease;
|
|
1188
|
+
margin-top: 8px;
|
|
1189
|
+
background-color: #dc3545;
|
|
1190
|
+
color: white;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
.sibu-error-fallback .sibu-error-btn:hover {
|
|
1194
|
+
background-color: #c82333;
|
|
1195
|
+
transform: translateY(-1px);
|
|
1196
|
+
box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
.sibu-error-fallback .sibu-error-btn:active {
|
|
1200
|
+
transform: translateY(0);
|
|
1201
|
+
}
|
|
1202
|
+
`;
|
|
1203
|
+
var stylesInjected = false;
|
|
1204
|
+
function injectStyles() {
|
|
1205
|
+
if (!stylesInjected && typeof document !== "undefined") {
|
|
1206
|
+
const styleElement = style({ nodes: errorBoundaryStyles });
|
|
1207
|
+
document.head.appendChild(styleElement);
|
|
1208
|
+
stylesInjected = true;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
var fallbackCache = /* @__PURE__ */ new WeakMap();
|
|
1212
|
+
function getMemoizedFallback(fallbackFn, error, retry) {
|
|
1213
|
+
let cache = fallbackCache.get(fallbackFn);
|
|
1214
|
+
if (!cache) {
|
|
1215
|
+
cache = /* @__PURE__ */ new Map();
|
|
1216
|
+
fallbackCache.set(fallbackFn, cache);
|
|
1217
|
+
}
|
|
1218
|
+
const key = error.message;
|
|
1219
|
+
if (!cache.has(key)) {
|
|
1220
|
+
cache.set(key, fallbackFn(error, retry));
|
|
1221
|
+
}
|
|
1222
|
+
return cache.get(key);
|
|
1223
|
+
}
|
|
1224
|
+
function ErrorBoundary({ nodes, fallback, onError }) {
|
|
1225
|
+
injectStyles();
|
|
1226
|
+
const [error, setError] = useState(null);
|
|
1227
|
+
const retry = () => {
|
|
1228
|
+
if (fallback) {
|
|
1229
|
+
fallbackCache.delete(fallback);
|
|
1230
|
+
}
|
|
1231
|
+
setError(null);
|
|
1232
|
+
};
|
|
1233
|
+
const handleError = (e) => {
|
|
1234
|
+
const errorObj = e instanceof Error ? e : new Error(String(e));
|
|
1235
|
+
setError(errorObj);
|
|
1236
|
+
onError?.(errorObj);
|
|
1237
|
+
return errorObj;
|
|
1238
|
+
};
|
|
1239
|
+
const defaultFallback = (err, retryFn) => div({
|
|
1240
|
+
class: "sibu-error-fallback",
|
|
1241
|
+
nodes: [
|
|
1242
|
+
h3({
|
|
1243
|
+
nodes: "Something went wrong",
|
|
1244
|
+
class: "sibu-error-title"
|
|
1245
|
+
}),
|
|
1246
|
+
p({
|
|
1247
|
+
nodes: err.message,
|
|
1248
|
+
class: "sibu-error-message"
|
|
1249
|
+
}),
|
|
1250
|
+
button({
|
|
1251
|
+
nodes: "Retry",
|
|
1252
|
+
class: "sibu-error-btn",
|
|
1253
|
+
on: { click: retryFn }
|
|
1254
|
+
})
|
|
1255
|
+
]
|
|
1256
|
+
});
|
|
1257
|
+
const tryRenderFallback = (err) => {
|
|
1258
|
+
const fn = fallback || defaultFallback;
|
|
1259
|
+
try {
|
|
1260
|
+
return getMemoizedFallback(fn, err, retry);
|
|
1261
|
+
} catch (fallbackError) {
|
|
1262
|
+
const propagateError = fallbackError instanceof Error ? fallbackError : new Error(String(fallbackError));
|
|
1263
|
+
queueMicrotask(() => {
|
|
1264
|
+
if (container.parentNode) {
|
|
1265
|
+
container.dispatchEvent(
|
|
1266
|
+
new CustomEvent("sibu:error-propagate", {
|
|
1267
|
+
bubbles: true,
|
|
1268
|
+
detail: { error: propagateError }
|
|
1269
|
+
})
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
return document.createComment("error-boundary-failed");
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
const container = div({
|
|
1277
|
+
class: "sibu-error-boundary",
|
|
1278
|
+
nodes: () => {
|
|
1279
|
+
const currentError = error();
|
|
1280
|
+
if (currentError) {
|
|
1281
|
+
return tryRenderFallback(currentError);
|
|
1282
|
+
}
|
|
1283
|
+
try {
|
|
1284
|
+
const result = nodes();
|
|
1285
|
+
if (result && typeof result.then === "function") {
|
|
1286
|
+
const asyncContainer = div({ class: "sibu-error-async" });
|
|
1287
|
+
asyncContainer.appendChild(span({ class: "sibu-lazy-loading", nodes: "Loading..." }));
|
|
1288
|
+
result.then((el) => {
|
|
1289
|
+
asyncContainer.replaceChildren(el);
|
|
1290
|
+
}).catch((e) => {
|
|
1291
|
+
const err = handleError(e);
|
|
1292
|
+
asyncContainer.replaceChildren(tryRenderFallback(err));
|
|
1293
|
+
});
|
|
1294
|
+
return asyncContainer;
|
|
1295
|
+
}
|
|
1296
|
+
return result;
|
|
1297
|
+
} catch (e) {
|
|
1298
|
+
const errorObj = handleError(e);
|
|
1299
|
+
return tryRenderFallback(errorObj);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
container.addEventListener("sibu:error-propagate", (e) => {
|
|
1304
|
+
if (error()) return;
|
|
1305
|
+
e.stopPropagation();
|
|
1306
|
+
const customEvent = e;
|
|
1307
|
+
const propagatedError = customEvent.detail?.error;
|
|
1308
|
+
if (propagatedError) {
|
|
1309
|
+
handleError(propagatedError);
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
return container;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
// src/components/Loading.ts
|
|
1316
|
+
var loadingStyles = `
|
|
1317
|
+
@keyframes sibu-spin {
|
|
1318
|
+
to { transform: rotate(360deg); }
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
@keyframes sibu-pulse {
|
|
1322
|
+
0%, 100% { opacity: 1; }
|
|
1323
|
+
50% { opacity: 0.4; }
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
.sibu-loading {
|
|
1327
|
+
display: flex;
|
|
1328
|
+
align-items: center;
|
|
1329
|
+
justify-content: center;
|
|
1330
|
+
padding: 20px;
|
|
1331
|
+
gap: 10px;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
.sibu-loading-spinner {
|
|
1335
|
+
width: 24px;
|
|
1336
|
+
height: 24px;
|
|
1337
|
+
border: 3px solid #e0e0e0;
|
|
1338
|
+
border-top-color: #3b82f6;
|
|
1339
|
+
border-radius: 50%;
|
|
1340
|
+
animation: sibu-spin 0.8s linear infinite;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
.sibu-loading-dots {
|
|
1344
|
+
display: flex;
|
|
1345
|
+
gap: 4px;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
.sibu-loading-dot {
|
|
1349
|
+
width: 8px;
|
|
1350
|
+
height: 8px;
|
|
1351
|
+
border-radius: 50%;
|
|
1352
|
+
background-color: #3b82f6;
|
|
1353
|
+
animation: sibu-pulse 1.2s ease-in-out infinite;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
.sibu-loading-dot:nth-child(2) { animation-delay: 0.2s; }
|
|
1357
|
+
.sibu-loading-dot:nth-child(3) { animation-delay: 0.4s; }
|
|
1358
|
+
|
|
1359
|
+
.sibu-loading-text {
|
|
1360
|
+
color: #6b7280;
|
|
1361
|
+
font-size: 14px;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
.sibu-loading-sm .sibu-loading-spinner { width: 16px; height: 16px; border-width: 2px; }
|
|
1365
|
+
.sibu-loading-sm .sibu-loading-dot { width: 6px; height: 6px; }
|
|
1366
|
+
.sibu-loading-lg .sibu-loading-spinner { width: 40px; height: 40px; border-width: 4px; }
|
|
1367
|
+
.sibu-loading-lg .sibu-loading-dot { width: 12px; height: 12px; }
|
|
1368
|
+
.sibu-loading-lg .sibu-loading-dots { gap: 6px; }
|
|
1369
|
+
`;
|
|
1370
|
+
var loadingStylesInjected = false;
|
|
1371
|
+
function injectLoadingStyles() {
|
|
1372
|
+
if (!loadingStylesInjected && typeof document !== "undefined") {
|
|
1373
|
+
document.head.appendChild(style({ nodes: loadingStyles }));
|
|
1374
|
+
loadingStylesInjected = true;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
function Loading(props = {}) {
|
|
1378
|
+
injectLoadingStyles();
|
|
1379
|
+
const { text: text2, variant = "spinner", size = "md" } = props;
|
|
1380
|
+
const sizeClass = size !== "md" ? ` sibu-loading-${size}` : "";
|
|
1381
|
+
if (variant === "dots") {
|
|
1382
|
+
return div({
|
|
1383
|
+
class: `sibu-loading${sizeClass}`,
|
|
1384
|
+
nodes: [
|
|
1385
|
+
div({
|
|
1386
|
+
class: "sibu-loading-dots",
|
|
1387
|
+
nodes: [
|
|
1388
|
+
span({ class: "sibu-loading-dot" }),
|
|
1389
|
+
span({ class: "sibu-loading-dot" }),
|
|
1390
|
+
span({ class: "sibu-loading-dot" })
|
|
1391
|
+
]
|
|
1392
|
+
}),
|
|
1393
|
+
text2 ? span({ class: "sibu-loading-text", nodes: text2 }) : null
|
|
1394
|
+
].filter(Boolean)
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
return div({
|
|
1398
|
+
class: `sibu-loading${sizeClass}`,
|
|
1399
|
+
nodes: [
|
|
1400
|
+
div({ class: "sibu-loading-spinner" }),
|
|
1401
|
+
text2 ? span({ class: "sibu-loading-text", nodes: text2 }) : null
|
|
1402
|
+
].filter(Boolean)
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
export {
|
|
1407
|
+
mount,
|
|
1408
|
+
each,
|
|
1409
|
+
Fragment,
|
|
1410
|
+
Portal,
|
|
1411
|
+
registerComponent,
|
|
1412
|
+
unregisterComponent,
|
|
1413
|
+
resolveComponent,
|
|
1414
|
+
DynamicComponent,
|
|
1415
|
+
getSlot,
|
|
1416
|
+
show,
|
|
1417
|
+
when,
|
|
1418
|
+
match,
|
|
1419
|
+
catchError,
|
|
1420
|
+
catchErrorAsync,
|
|
1421
|
+
setGlobalErrorHandler,
|
|
1422
|
+
useWatch,
|
|
1423
|
+
useStore,
|
|
1424
|
+
useRef,
|
|
1425
|
+
useMemo,
|
|
1426
|
+
useCallback,
|
|
1427
|
+
useArray,
|
|
1428
|
+
useReactiveArray,
|
|
1429
|
+
useDeepState,
|
|
1430
|
+
onMount,
|
|
1431
|
+
onUnmount,
|
|
1432
|
+
lazy,
|
|
1433
|
+
Suspense,
|
|
1434
|
+
ErrorBoundary,
|
|
1435
|
+
Loading,
|
|
1436
|
+
index_exports
|
|
1437
|
+
};
|