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.
Files changed (302) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1630 -0
  3. package/dist/browser.cjs +815 -0
  4. package/dist/browser.d.cts +174 -0
  5. package/dist/browser.d.ts +174 -0
  6. package/dist/browser.js +458 -0
  7. package/dist/build.cjs +4970 -0
  8. package/dist/build.d.cts +630 -0
  9. package/dist/build.d.ts +630 -0
  10. package/dist/build.js +2478 -0
  11. package/dist/cdn.global.js +115 -0
  12. package/dist/chunk-27QC4FPL.js +67 -0
  13. package/dist/chunk-2ABBWCGC.js +65 -0
  14. package/dist/chunk-2MUNQYZ7.js +26 -0
  15. package/dist/chunk-2PSPKNUI.js +1711 -0
  16. package/dist/chunk-35CDLDX5.js +1758 -0
  17. package/dist/chunk-36MU4CFV.js +41 -0
  18. package/dist/chunk-3FIQOFI6.js +182 -0
  19. package/dist/chunk-3GHNC2BN.js +28 -0
  20. package/dist/chunk-3HLWWEPU.js +909 -0
  21. package/dist/chunk-3IVI3J54.js +252 -0
  22. package/dist/chunk-3KZ72WNW.js +944 -0
  23. package/dist/chunk-4AU64SQV.js +182 -0
  24. package/dist/chunk-4MOK7HAR.js +84 -0
  25. package/dist/chunk-4QK6FBDH.js +1429 -0
  26. package/dist/chunk-566Z7HXB.js +737 -0
  27. package/dist/chunk-5CRBB7XP.js +358 -0
  28. package/dist/chunk-5G67D3IZ.js +168 -0
  29. package/dist/chunk-5NCPAWBE.js +99 -0
  30. package/dist/chunk-5O2RKXR3.js +1444 -0
  31. package/dist/chunk-6BTBDO6A.js +633 -0
  32. package/dist/chunk-6IWEHW57.js +43 -0
  33. package/dist/chunk-6JGMNCD6.js +282 -0
  34. package/dist/chunk-6QRLJNXR.js +1425 -0
  35. package/dist/chunk-7HM5UE5T.js +270 -0
  36. package/dist/chunk-7JOLTGUH.js +58 -0
  37. package/dist/chunk-7MCWJCQK.js +909 -0
  38. package/dist/chunk-7RIIFP3E.js +1758 -0
  39. package/dist/chunk-7UASYN3G.js +254 -0
  40. package/dist/chunk-7W2WYHDI.js +741 -0
  41. package/dist/chunk-7Y35RDSJ.js +872 -0
  42. package/dist/chunk-A65GFJBL.js +65 -0
  43. package/dist/chunk-AD6ZIEDK.js +67 -0
  44. package/dist/chunk-AK5Y72F3.js +1426 -0
  45. package/dist/chunk-APOMMWH4.js +282 -0
  46. package/dist/chunk-ARZVTWIQ.js +1750 -0
  47. package/dist/chunk-AWWBM2BI.js +664 -0
  48. package/dist/chunk-AX5VEQTY.js +58 -0
  49. package/dist/chunk-AYTXVOW3.js +1708 -0
  50. package/dist/chunk-BG4A246G.js +1746 -0
  51. package/dist/chunk-BNFJJA2L.js +1425 -0
  52. package/dist/chunk-BPKPBVU5.js +59 -0
  53. package/dist/chunk-BPKPPSXC.js +282 -0
  54. package/dist/chunk-BPWKKK7F.js +1711 -0
  55. package/dist/chunk-CCKX6YTC.js +1735 -0
  56. package/dist/chunk-CIF5Z3MP.js +58 -0
  57. package/dist/chunk-CSXYU7IO.js +457 -0
  58. package/dist/chunk-D6JD4FDC.js +26 -0
  59. package/dist/chunk-E7NGA7X2.js +59 -0
  60. package/dist/chunk-EEPPJKAE.js +443 -0
  61. package/dist/chunk-EJMYGAGQ.js +717 -0
  62. package/dist/chunk-EL6Z5MDY.js +55 -0
  63. package/dist/chunk-EP7VRLEB.js +41 -0
  64. package/dist/chunk-ETMEC6FH.js +99 -0
  65. package/dist/chunk-EZ2WHYVL.js +65 -0
  66. package/dist/chunk-EZRVMSZK.js +67 -0
  67. package/dist/chunk-F2TRGINX.js +254 -0
  68. package/dist/chunk-F5JCIH3Q.js +642 -0
  69. package/dist/chunk-FGK3JKMN.js +909 -0
  70. package/dist/chunk-FQWPKSTD.js +1437 -0
  71. package/dist/chunk-FWHVLMCI.js +26 -0
  72. package/dist/chunk-GBEYQRO2.js +303 -0
  73. package/dist/chunk-GBLES3NK.js +248 -0
  74. package/dist/chunk-GQVGUQW6.js +1436 -0
  75. package/dist/chunk-HCV2T76T.js +457 -0
  76. package/dist/chunk-HS7ZKVPR.js +182 -0
  77. package/dist/chunk-HXDVV7HZ.js +909 -0
  78. package/dist/chunk-IB23VMO3.js +1746 -0
  79. package/dist/chunk-IEMZ7RTT.js +99 -0
  80. package/dist/chunk-IPGRSN42.js +1750 -0
  81. package/dist/chunk-IVMOK2QN.js +1750 -0
  82. package/dist/chunk-JCLGQO7T.js +443 -0
  83. package/dist/chunk-JDXL7KDB.js +1436 -0
  84. package/dist/chunk-JIIFW636.js +270 -0
  85. package/dist/chunk-JWGEEH7H.js +944 -0
  86. package/dist/chunk-K2BESAG7.js +1688 -0
  87. package/dist/chunk-K2U5YGF4.js +877 -0
  88. package/dist/chunk-K45FQ4Y4.js +175 -0
  89. package/dist/chunk-K7BPE427.js +1432 -0
  90. package/dist/chunk-KL3266RS.js +26 -0
  91. package/dist/chunk-KNN4P7DZ.js +84 -0
  92. package/dist/chunk-KP2DZH5Q.js +254 -0
  93. package/dist/chunk-KZHAJSQR.js +1636 -0
  94. package/dist/chunk-LBKGHMQV.js +1750 -0
  95. package/dist/chunk-LBTEPL7A.js +1731 -0
  96. package/dist/chunk-LEBBPTDB.js +1444 -0
  97. package/dist/chunk-LLH63WVQ.js +98 -0
  98. package/dist/chunk-LWVR2C4G.js +1711 -0
  99. package/dist/chunk-M3MDTVV2.js +896 -0
  100. package/dist/chunk-M5GNLDEO.js +303 -0
  101. package/dist/chunk-MFHVGKET.js +267 -0
  102. package/dist/chunk-MGWSG3PM.js +358 -0
  103. package/dist/chunk-MJNB47HB.js +19 -0
  104. package/dist/chunk-MLKGABMK.js +9 -0
  105. package/dist/chunk-MQWTY3JY.js +944 -0
  106. package/dist/chunk-MZZOQHNI.js +642 -0
  107. package/dist/chunk-NIHWGZS4.js +1426 -0
  108. package/dist/chunk-NSVVHQK5.js +41 -0
  109. package/dist/chunk-NVI2WE7D.js +443 -0
  110. package/dist/chunk-O7QBO3PH.js +58 -0
  111. package/dist/chunk-OAUPQBO2.js +270 -0
  112. package/dist/chunk-OB2LMD7C.js +297 -0
  113. package/dist/chunk-OHEYBWQU.js +58 -0
  114. package/dist/chunk-OI6OXUHJ.js +443 -0
  115. package/dist/chunk-OX2VMRMV.js +633 -0
  116. package/dist/chunk-P4FYE5TX.js +866 -0
  117. package/dist/chunk-P5KFWM4H.js +98 -0
  118. package/dist/chunk-PUMLE7RJ.js +1711 -0
  119. package/dist/chunk-Q4MFANBF.js +282 -0
  120. package/dist/chunk-QLEKZMMU.js +282 -0
  121. package/dist/chunk-RGGNGVO3.js +98 -0
  122. package/dist/chunk-RKJDRVV6.js +443 -0
  123. package/dist/chunk-S5BHU353.js +43 -0
  124. package/dist/chunk-SHQUSFH7.js +1426 -0
  125. package/dist/chunk-SMB4DBMD.js +182 -0
  126. package/dist/chunk-SNYHQP3D.js +743 -0
  127. package/dist/chunk-T24L3TBF.js +1717 -0
  128. package/dist/chunk-TAQNSOKT.js +692 -0
  129. package/dist/chunk-TDNY4SUA.js +41 -0
  130. package/dist/chunk-TNNF56IQ.js +1750 -0
  131. package/dist/chunk-TR7E6LYX.js +457 -0
  132. package/dist/chunk-URWUFH45.js +98 -0
  133. package/dist/chunk-UUSIH3XH.js +1429 -0
  134. package/dist/chunk-UYFNXLKR.js +1436 -0
  135. package/dist/chunk-V6F7KUWD.js +270 -0
  136. package/dist/chunk-VCZLXRMR.js +254 -0
  137. package/dist/chunk-VDHXSSBT.js +1426 -0
  138. package/dist/chunk-VM4QMKVK.js +254 -0
  139. package/dist/chunk-VWGYKYL2.js +737 -0
  140. package/dist/chunk-VX2OFBJN.js +1426 -0
  141. package/dist/chunk-VXVIE6DG.js +84 -0
  142. package/dist/chunk-W4OH7HG4.js +40 -0
  143. package/dist/chunk-WBVJX4GZ.js +98 -0
  144. package/dist/chunk-WDU2ZV4I.js +1426 -0
  145. package/dist/chunk-X6VUCICU.js +457 -0
  146. package/dist/chunk-XAY7FM7Y.js +618 -0
  147. package/dist/chunk-XJZ5Z2CM.js +642 -0
  148. package/dist/chunk-XKVFQTJJ.js +254 -0
  149. package/dist/chunk-XRLFASCY.js +22 -0
  150. package/dist/chunk-XYU6TZOW.js +182 -0
  151. package/dist/chunk-Y745CBVB.js +944 -0
  152. package/dist/chunk-YLBJSXYY.js +944 -0
  153. package/dist/chunk-YQJIKVPZ.js +1429 -0
  154. package/dist/chunk-YRM2VCZF.js +457 -0
  155. package/dist/chunk-YS33KBVJ.js +944 -0
  156. package/dist/chunk-Z27DZPDG.js +41 -0
  157. package/dist/chunk-ZXQ5NAEN.js +32 -0
  158. package/dist/contracts-B552GopR.d.cts +245 -0
  159. package/dist/contracts-B552GopR.d.ts +245 -0
  160. package/dist/contracts-Bg1ECISC.d.cts +245 -0
  161. package/dist/contracts-Bg1ECISC.d.ts +245 -0
  162. package/dist/contracts-CMriKJ6P.d.cts +245 -0
  163. package/dist/contracts-CMriKJ6P.d.ts +245 -0
  164. package/dist/contracts-DOrhwbke.d.cts +245 -0
  165. package/dist/contracts-DOrhwbke.d.ts +245 -0
  166. package/dist/data.cjs +1373 -0
  167. package/dist/data.d.cts +434 -0
  168. package/dist/data.d.ts +434 -0
  169. package/dist/data.js +945 -0
  170. package/dist/devtools.cjs +1357 -0
  171. package/dist/devtools.d.cts +473 -0
  172. package/dist/devtools.d.ts +473 -0
  173. package/dist/devtools.js +1084 -0
  174. package/dist/ecosystem.cjs +1046 -0
  175. package/dist/ecosystem.d.cts +247 -0
  176. package/dist/ecosystem.d.ts +247 -0
  177. package/dist/ecosystem.js +369 -0
  178. package/dist/extras.cjs +8457 -0
  179. package/dist/extras.d.cts +2356 -0
  180. package/dist/extras.d.ts +2356 -0
  181. package/dist/extras.js +5152 -0
  182. package/dist/index.cjs +2648 -0
  183. package/dist/index.d.cts +869 -0
  184. package/dist/index.d.ts +869 -0
  185. package/dist/index.js +386 -0
  186. package/dist/motion.cjs +604 -0
  187. package/dist/motion.d.cts +146 -0
  188. package/dist/motion.d.ts +146 -0
  189. package/dist/motion.js +346 -0
  190. package/dist/patterns.cjs +815 -0
  191. package/dist/patterns.d.cts +163 -0
  192. package/dist/patterns.d.ts +163 -0
  193. package/dist/patterns.js +296 -0
  194. package/dist/performance.cjs +927 -0
  195. package/dist/performance.d.cts +416 -0
  196. package/dist/performance.d.ts +416 -0
  197. package/dist/performance.js +654 -0
  198. package/dist/plugins.cjs +2487 -0
  199. package/dist/plugins.d.cts +393 -0
  200. package/dist/plugins.d.ts +393 -0
  201. package/dist/plugins.js +1504 -0
  202. package/dist/signal-BnWpq6WB.d.cts +5 -0
  203. package/dist/signal-BnWpq6WB.d.ts +5 -0
  204. package/dist/src/components/ErrorBoundary.d.ts +15 -0
  205. package/dist/src/components/ErrorBoundary.js +119 -0
  206. package/dist/src/core/catch.d.ts +11 -0
  207. package/dist/src/core/catch.js +28 -0
  208. package/dist/src/core/each.d.ts +13 -0
  209. package/dist/src/core/each.js +68 -0
  210. package/dist/src/core/for.d.ts +12 -0
  211. package/dist/src/core/for.js +67 -0
  212. package/dist/src/core/html.d.ts +137 -0
  213. package/dist/src/core/html.js +155 -0
  214. package/dist/src/core/htmlIf.d.ts +11 -0
  215. package/dist/src/core/htmlIf.js +18 -0
  216. package/dist/src/core/lazy.d.ts +7 -0
  217. package/dist/src/core/lazy.js +16 -0
  218. package/dist/src/core/mount.d.ts +7 -0
  219. package/dist/src/core/mount.js +12 -0
  220. package/dist/src/core/slots.d.ts +3 -0
  221. package/dist/src/core/slots.js +3 -0
  222. package/dist/src/core/suspense.d.ts +10 -0
  223. package/dist/src/core/suspense.js +33 -0
  224. package/dist/src/core/tagFactory.d.ts +13 -0
  225. package/dist/src/core/tagFactory.js +86 -0
  226. package/dist/src/core/test.d.ts +11 -0
  227. package/dist/src/core/test.js +28 -0
  228. package/dist/src/core/types.d.ts +2 -0
  229. package/dist/src/core/types.js +1 -0
  230. package/dist/src/core/useComputed.d.ts +6 -0
  231. package/dist/src/core/useComputed.js +30 -0
  232. package/dist/src/core/useEffect.d.ts +6 -0
  233. package/dist/src/core/useEffect.js +23 -0
  234. package/dist/src/core/useState.d.ts +10 -0
  235. package/dist/src/core/useState.js +34 -0
  236. package/dist/src/core/useStore.d.ts +19 -0
  237. package/dist/src/core/useStore.js +53 -0
  238. package/dist/src/core/useWatch.d.ts +8 -0
  239. package/dist/src/core/useWatch.js +23 -0
  240. package/dist/src/plugins/i18n.d.ts +6 -0
  241. package/dist/src/plugins/i18n.js +16 -0
  242. package/dist/src/plugins/router.d.ts +188 -0
  243. package/dist/src/plugins/router.js +1178 -0
  244. package/dist/src/reactivity/bindAttribute.d.ts +5 -0
  245. package/dist/src/reactivity/bindAttribute.js +31 -0
  246. package/dist/src/reactivity/bindChildNode.d.ts +10 -0
  247. package/dist/src/reactivity/bindChildNode.js +46 -0
  248. package/dist/src/reactivity/bindTextNode.d.ts +10 -0
  249. package/dist/src/reactivity/bindTextNode.js +27 -0
  250. package/dist/src/reactivity/signal.d.ts +3 -0
  251. package/dist/src/reactivity/signal.js +1 -0
  252. package/dist/src/reactivity/track.d.ts +18 -0
  253. package/dist/src/reactivity/track.js +73 -0
  254. package/dist/src/reactivity/useComputed.d.ts +6 -0
  255. package/dist/src/reactivity/useComputed.js +30 -0
  256. package/dist/src/reactivity/useEffect.d.ts +6 -0
  257. package/dist/src/reactivity/useEffect.js +23 -0
  258. package/dist/src/reactivity/useState.d.ts +10 -0
  259. package/dist/src/reactivity/useState.js +34 -0
  260. package/dist/src/reactivity/useStore.d.ts +19 -0
  261. package/dist/src/reactivity/useStore.js +53 -0
  262. package/dist/src/reactivity/useWatch.d.ts +8 -0
  263. package/dist/src/reactivity/useWatch.js +23 -0
  264. package/dist/src/utils/sanitize.d.ts +1 -0
  265. package/dist/src/utils/sanitize.js +8 -0
  266. package/dist/ssr-27FOM46T.js +35 -0
  267. package/dist/ssr-GFUTTSJD.js +22 -0
  268. package/dist/ssr-K7DCR6BZ.js +35 -0
  269. package/dist/ssr-O6LFMRFP.js +35 -0
  270. package/dist/ssr-QZEVGMMK.js +35 -0
  271. package/dist/ssr-SGVBCAGC.js +35 -0
  272. package/dist/ssr-UB2IXCYX.js +35 -0
  273. package/dist/ssr-XBZQNV4O.js +22 -0
  274. package/dist/ssr-Y76FSXDU.js +35 -0
  275. package/dist/ssr-YQJ4AYBD.js +35 -0
  276. package/dist/ssr.cjs +1757 -0
  277. package/dist/ssr.d.cts +478 -0
  278. package/dist/ssr.d.ts +478 -0
  279. package/dist/ssr.js +743 -0
  280. package/dist/tagFactory-CZPO4RXF.d.cts +34 -0
  281. package/dist/tagFactory-CZPO4RXF.d.ts +34 -0
  282. package/dist/tagFactory-CgImPVMY.d.cts +22 -0
  283. package/dist/tagFactory-CgImPVMY.d.ts +22 -0
  284. package/dist/tagFactory-Cw1iv5if.d.cts +22 -0
  285. package/dist/tagFactory-Cw1iv5if.d.ts +22 -0
  286. package/dist/tagFactory-DeAXq9ef.d.cts +30 -0
  287. package/dist/tagFactory-DeAXq9ef.d.ts +30 -0
  288. package/dist/tagFactory-SkY0a7L1.d.cts +22 -0
  289. package/dist/tagFactory-SkY0a7L1.d.ts +22 -0
  290. package/dist/testing.cjs +1919 -0
  291. package/dist/testing.d.cts +491 -0
  292. package/dist/testing.d.ts +491 -0
  293. package/dist/testing.js +1862 -0
  294. package/dist/ui.cjs +1497 -0
  295. package/dist/ui.d.cts +264 -0
  296. package/dist/ui.d.ts +264 -0
  297. package/dist/ui.js +900 -0
  298. package/dist/widgets.cjs +919 -0
  299. package/dist/widgets.d.cts +165 -0
  300. package/dist/widgets.d.ts +165 -0
  301. package/dist/widgets.js +545 -0
  302. package/package.json +134 -0
@@ -0,0 +1,1750 @@
1
+ import {
2
+ a,
3
+ abbr,
4
+ address,
5
+ area,
6
+ article,
7
+ aside,
8
+ audio,
9
+ b,
10
+ base,
11
+ bdi,
12
+ bdo,
13
+ blockquote,
14
+ body,
15
+ br,
16
+ button,
17
+ canvas,
18
+ caption,
19
+ center,
20
+ circle,
21
+ cite,
22
+ clipPath,
23
+ code,
24
+ col,
25
+ colgroup,
26
+ customElement,
27
+ data,
28
+ datalist,
29
+ dd,
30
+ defs,
31
+ del,
32
+ details,
33
+ dfn,
34
+ dialog,
35
+ div,
36
+ dl,
37
+ dt,
38
+ ellipse,
39
+ em,
40
+ embed,
41
+ fieldset,
42
+ figcaption,
43
+ figure,
44
+ font,
45
+ footer,
46
+ form,
47
+ g,
48
+ h1,
49
+ h2,
50
+ h3,
51
+ h4,
52
+ h5,
53
+ h6,
54
+ head,
55
+ header,
56
+ hr,
57
+ i,
58
+ iframe,
59
+ img,
60
+ input,
61
+ ins,
62
+ kbd,
63
+ label,
64
+ legend,
65
+ li,
66
+ line,
67
+ linearGradient,
68
+ link,
69
+ main,
70
+ map,
71
+ mark,
72
+ marker,
73
+ marquee,
74
+ mask,
75
+ math,
76
+ menu,
77
+ meta,
78
+ meter,
79
+ nav,
80
+ noscript,
81
+ object,
82
+ ol,
83
+ optgroup,
84
+ option,
85
+ output,
86
+ p,
87
+ param,
88
+ path,
89
+ pattern,
90
+ picture,
91
+ polygon,
92
+ polyline,
93
+ portal,
94
+ pre,
95
+ progress,
96
+ q,
97
+ radialGradient,
98
+ rect,
99
+ rp,
100
+ rt,
101
+ ruby,
102
+ s,
103
+ samp,
104
+ script,
105
+ section,
106
+ select,
107
+ slot,
108
+ small,
109
+ source,
110
+ span,
111
+ stop,
112
+ strong,
113
+ style,
114
+ sub,
115
+ summary,
116
+ sup,
117
+ svg,
118
+ symbol,
119
+ table,
120
+ tbody,
121
+ td,
122
+ template,
123
+ text,
124
+ textarea,
125
+ tfoot,
126
+ th,
127
+ thead,
128
+ time,
129
+ title,
130
+ tr,
131
+ track as track2,
132
+ tspan,
133
+ u,
134
+ ul,
135
+ use,
136
+ var_,
137
+ video
138
+ } from "./chunk-BPKPPSXC.js";
139
+ import {
140
+ sbContext
141
+ } from "./chunk-KL3266RS.js";
142
+ import {
143
+ SVG_NS,
144
+ bindChildNode,
145
+ checkLeaks,
146
+ sbDispose,
147
+ sbRegisterDisposer,
148
+ tagFactory
149
+ } from "./chunk-V6F7KUWD.js";
150
+ import {
151
+ sbBindDynamic
152
+ } from "./chunk-5NCPAWBE.js";
153
+ import {
154
+ sbDerived
155
+ } from "./chunk-A65GFJBL.js";
156
+ import {
157
+ sbDisableSSR,
158
+ sbEffect,
159
+ sbEnableSSR,
160
+ sbIsSSR,
161
+ sbWithSSR
162
+ } from "./chunk-CIF5Z3MP.js";
163
+ import {
164
+ devAssert
165
+ } from "./chunk-MJNB47HB.js";
166
+ import {
167
+ enqueueBatchedSignal,
168
+ isBatching,
169
+ notifySubscribers,
170
+ recordDependency,
171
+ sbBatch,
172
+ sbSignal,
173
+ track
174
+ } from "./chunk-GBEYQRO2.js";
175
+ import {
176
+ __export
177
+ } from "./chunk-MLKGABMK.js";
178
+
179
+ // index.ts
180
+ var index_exports = {};
181
+ __export(index_exports, {
182
+ SVG_NS: () => SVG_NS,
183
+ a: () => a,
184
+ abbr: () => abbr,
185
+ address: () => address,
186
+ area: () => area,
187
+ article: () => article,
188
+ aside: () => aside,
189
+ audio: () => audio,
190
+ b: () => b,
191
+ base: () => base,
192
+ bdi: () => bdi,
193
+ bdo: () => bdo,
194
+ blockquote: () => blockquote,
195
+ body: () => body,
196
+ br: () => br,
197
+ button: () => button,
198
+ canvas: () => canvas,
199
+ caption: () => caption,
200
+ center: () => center,
201
+ checkLeaks: () => checkLeaks,
202
+ circle: () => circle,
203
+ cite: () => cite,
204
+ clipPath: () => clipPath,
205
+ code: () => code,
206
+ col: () => col,
207
+ colgroup: () => colgroup,
208
+ customElement: () => customElement,
209
+ data: () => data,
210
+ datalist: () => datalist,
211
+ dd: () => dd,
212
+ defs: () => defs,
213
+ del: () => del,
214
+ details: () => details,
215
+ dfn: () => dfn,
216
+ dialog: () => dialog,
217
+ div: () => div,
218
+ dl: () => dl,
219
+ dt: () => dt,
220
+ ellipse: () => ellipse,
221
+ em: () => em,
222
+ embed: () => embed,
223
+ enqueueBatchedSignal: () => enqueueBatchedSignal,
224
+ fieldset: () => fieldset,
225
+ figcaption: () => figcaption,
226
+ figure: () => figure,
227
+ font: () => font,
228
+ footer: () => footer,
229
+ form: () => form,
230
+ g: () => g,
231
+ h1: () => h1,
232
+ h2: () => h2,
233
+ h3: () => h3,
234
+ h4: () => h4,
235
+ h5: () => h5,
236
+ h6: () => h6,
237
+ head: () => head,
238
+ header: () => header,
239
+ hr: () => hr,
240
+ html: () => html,
241
+ i: () => i,
242
+ iframe: () => iframe,
243
+ img: () => img,
244
+ input: () => input,
245
+ ins: () => ins,
246
+ isBatching: () => isBatching,
247
+ kbd: () => kbd,
248
+ label: () => label,
249
+ legend: () => legend,
250
+ li: () => li,
251
+ line: () => line,
252
+ linearGradient: () => linearGradient,
253
+ link: () => link,
254
+ main: () => main,
255
+ map: () => map,
256
+ mark: () => mark,
257
+ marker: () => marker,
258
+ marquee: () => marquee,
259
+ mask: () => mask,
260
+ math: () => math,
261
+ menu: () => menu,
262
+ meta: () => meta,
263
+ meter: () => meter,
264
+ nav: () => nav,
265
+ noscript: () => noscript,
266
+ object: () => object,
267
+ ol: () => ol,
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
+ rp: () => rp,
285
+ rt: () => rt,
286
+ ruby: () => ruby,
287
+ s: () => s,
288
+ samp: () => samp,
289
+ sbArray: () => sbArray,
290
+ sbBatch: () => sbBatch,
291
+ sbBindDynamic: () => sbBindDynamic,
292
+ sbCatchError: () => sbCatchError,
293
+ sbCatchErrorAsync: () => sbCatchErrorAsync,
294
+ sbContext: () => sbContext,
295
+ sbDeepSignal: () => sbDeepSignal,
296
+ sbDerived: () => sbDerived,
297
+ sbDisableSSR: () => sbDisableSSR,
298
+ sbDispose: () => sbDispose,
299
+ sbDynamicComponent: () => sbDynamicComponent,
300
+ sbEach: () => sbEach,
301
+ sbEffect: () => sbEffect,
302
+ sbEnableSSR: () => sbEnableSSR,
303
+ sbErrorBoundary: () => sbErrorBoundary,
304
+ sbFragment: () => sbFragment,
305
+ sbGetSlot: () => sbGetSlot,
306
+ sbIsSSR: () => sbIsSSR,
307
+ sbLazy: () => sbLazy,
308
+ sbLoading: () => sbLoading,
309
+ sbMatch: () => sbMatch,
310
+ sbMemo: () => sbMemo,
311
+ sbMemoFn: () => sbMemoFn,
312
+ sbMount: () => sbMount,
313
+ sbOnMount: () => sbOnMount,
314
+ sbOnUnmount: () => sbOnUnmount,
315
+ sbPortal: () => sbPortal,
316
+ sbReactiveArray: () => sbReactiveArray,
317
+ sbRef: () => sbRef,
318
+ sbRegisterComponent: () => sbRegisterComponent,
319
+ sbRegisterDisposer: () => sbRegisterDisposer,
320
+ sbResolveComponent: () => sbResolveComponent,
321
+ sbSetGlobalErrorHandler: () => sbSetGlobalErrorHandler,
322
+ sbShow: () => sbShow,
323
+ sbSignal: () => sbSignal,
324
+ sbStore: () => sbStore,
325
+ sbSuspense: () => sbSuspense,
326
+ sbUnregisterComponent: () => sbUnregisterComponent,
327
+ sbWatch: () => sbWatch,
328
+ sbWhen: () => sbWhen,
329
+ sbWithSSR: () => sbWithSSR,
330
+ script: () => script,
331
+ section: () => section,
332
+ select: () => select,
333
+ slot: () => slot,
334
+ small: () => small,
335
+ source: () => source,
336
+ span: () => span,
337
+ stop: () => stop,
338
+ strong: () => strong,
339
+ style: () => style,
340
+ sub: () => sub,
341
+ summary: () => summary,
342
+ sup: () => sup,
343
+ svg: () => svg,
344
+ symbol: () => symbol,
345
+ table: () => table,
346
+ tagFactory: () => tagFactory,
347
+ tbody: () => tbody,
348
+ td: () => td,
349
+ template: () => template,
350
+ text: () => text,
351
+ textarea: () => textarea,
352
+ tfoot: () => tfoot,
353
+ th: () => th,
354
+ thead: () => thead,
355
+ time: () => time,
356
+ title: () => title,
357
+ tr: () => tr,
358
+ track: () => track2,
359
+ tspan: () => tspan,
360
+ u: () => u,
361
+ ul: () => ul,
362
+ use: () => use,
363
+ var_: () => var_,
364
+ video: () => video
365
+ });
366
+
367
+ // src/core/rendering/htm.ts
368
+ var VOID_ELEMENTS = /* @__PURE__ */ new Set([
369
+ "area",
370
+ "base",
371
+ "br",
372
+ "col",
373
+ "embed",
374
+ "hr",
375
+ "img",
376
+ "input",
377
+ "link",
378
+ "meta",
379
+ "param",
380
+ "source",
381
+ "track",
382
+ "wbr"
383
+ ]);
384
+ var SVG_TAGS = /* @__PURE__ */ new Set([
385
+ "svg",
386
+ "circle",
387
+ "ellipse",
388
+ "g",
389
+ "line",
390
+ "path",
391
+ "polygon",
392
+ "polyline",
393
+ "rect",
394
+ "text",
395
+ "tspan",
396
+ "defs",
397
+ "clipPath",
398
+ "mask",
399
+ "pattern",
400
+ "linearGradient",
401
+ "radialGradient",
402
+ "stop",
403
+ "use",
404
+ "symbol",
405
+ "marker"
406
+ ]);
407
+ var cache = /* @__PURE__ */ new WeakMap();
408
+ function parseTemplate(strings) {
409
+ const exprCount = strings.length - 1;
410
+ let template2 = strings[0];
411
+ for (let i2 = 0; i2 < exprCount; i2++) {
412
+ template2 += `\0${i2}\0${strings[i2 + 1]}`;
413
+ }
414
+ let pos = 0;
415
+ const len = template2.length;
416
+ function skipWs() {
417
+ while (pos < len && (template2[pos] === " " || template2[pos] === " " || template2[pos] === "\n" || template2[pos] === "\r")) pos++;
418
+ }
419
+ function tryExprIdx() {
420
+ if (template2[pos] !== "\0") return -1;
421
+ const start = pos;
422
+ pos++;
423
+ let idxStr = "";
424
+ while (pos < len && template2[pos] !== "\0") idxStr += template2[pos++];
425
+ if (pos < len) pos++;
426
+ const idx = Number.parseInt(idxStr, 10);
427
+ if (Number.isNaN(idx) || idx < 0 || idx >= exprCount) {
428
+ pos = start;
429
+ return -1;
430
+ }
431
+ return idx;
432
+ }
433
+ function readTagName() {
434
+ let name = "";
435
+ while (pos < len && /[a-zA-Z0-9\-]/.test(template2[pos])) name += template2[pos++];
436
+ return name;
437
+ }
438
+ function parseAttrValue() {
439
+ skipWs();
440
+ if (template2[pos] !== "=") return { kind: "bool" };
441
+ pos++;
442
+ skipWs();
443
+ const exprIdx = tryExprIdx();
444
+ if (exprIdx >= 0) return { kind: "expr", idx: exprIdx };
445
+ const quote = template2[pos];
446
+ if (quote === '"' || quote === "'") {
447
+ pos++;
448
+ const statics = [];
449
+ const exprs = [];
450
+ let current = "";
451
+ while (pos < len && template2[pos] !== quote) {
452
+ const innerIdx = tryExprIdx();
453
+ if (innerIdx >= 0) {
454
+ statics.push(current);
455
+ current = "";
456
+ exprs.push(innerIdx);
457
+ } else {
458
+ current += template2[pos++];
459
+ }
460
+ }
461
+ if (pos < len) pos++;
462
+ statics.push(current);
463
+ if (exprs.length === 0) {
464
+ return { kind: "static", value: statics[0] };
465
+ }
466
+ return { kind: "mixed", statics, exprs };
467
+ }
468
+ let val = "";
469
+ while (pos < len && !/[\s>\/]/.test(template2[pos])) val += template2[pos++];
470
+ return { kind: "static", value: val };
471
+ }
472
+ function parseAttrs() {
473
+ const attrs = [];
474
+ while (pos < len) {
475
+ skipWs();
476
+ if (template2[pos] === ">" || template2[pos] === "/") break;
477
+ let attrName = "";
478
+ while (pos < len && /[a-zA-Z0-9\-:_.]/.test(template2[pos])) attrName += template2[pos++];
479
+ if (!attrName) break;
480
+ const val = parseAttrValue();
481
+ if (attrName.startsWith("on:")) {
482
+ if (val.kind === "expr") {
483
+ attrs.push({ t: 3, name: attrName.slice(3), idx: val.idx });
484
+ }
485
+ } else if (val.kind === "bool") {
486
+ attrs.push({ t: 4, name: attrName });
487
+ } else if (val.kind === "static") {
488
+ attrs.push({ t: 0, name: attrName, value: val.value });
489
+ } else if (val.kind === "expr") {
490
+ attrs.push({ t: 1, name: attrName, idx: val.idx });
491
+ } else if (val.kind === "mixed") {
492
+ attrs.push({ t: 2, name: attrName, statics: val.statics, exprs: val.exprs });
493
+ }
494
+ }
495
+ return attrs;
496
+ }
497
+ function collapseWs(s2) {
498
+ return s2.replace(/\s+/g, " ");
499
+ }
500
+ function parseTextChildren(children) {
501
+ let text2 = "";
502
+ while (pos < len && template2[pos] !== "<") {
503
+ const idx = tryExprIdx();
504
+ if (idx >= 0) {
505
+ const collapsed2 = collapseWs(text2);
506
+ if (collapsed2) children.push({ t: 1, value: collapsed2 });
507
+ text2 = "";
508
+ children.push({ t: 2, idx });
509
+ } else {
510
+ text2 += template2[pos++];
511
+ }
512
+ }
513
+ const collapsed = collapseWs(text2);
514
+ if (collapsed) children.push({ t: 1, value: collapsed });
515
+ }
516
+ function parseChildren() {
517
+ const children = [];
518
+ while (pos < len) {
519
+ if (template2[pos] === "<" && pos + 1 < len && template2[pos + 1] === "/") break;
520
+ if (template2[pos] === "<") {
521
+ pos++;
522
+ const tag = readTagName();
523
+ const attrs = parseAttrs();
524
+ skipWs();
525
+ const isVoid = VOID_ELEMENTS.has(tag);
526
+ const isSelfClosing = template2[pos] === "/";
527
+ if (isSelfClosing) pos++;
528
+ if (pos < len) pos++;
529
+ if (isVoid || isSelfClosing) {
530
+ children.push({ t: 0, el: { tag, svg: SVG_TAGS.has(tag), attrs, children: [] } });
531
+ } else {
532
+ const inner = parseChildren();
533
+ if (template2[pos] === "<" && pos + 1 < len && template2[pos + 1] === "/") {
534
+ pos += 2;
535
+ readTagName();
536
+ skipWs();
537
+ if (pos < len && template2[pos] === ">") pos++;
538
+ }
539
+ children.push({ t: 0, el: { tag, svg: SVG_TAGS.has(tag), attrs, children: inner } });
540
+ }
541
+ } else {
542
+ parseTextChildren(children);
543
+ }
544
+ }
545
+ return children;
546
+ }
547
+ return parseChildren();
548
+ }
549
+ var factoryCache = /* @__PURE__ */ new Map();
550
+ function getFactory(tag, svg2) {
551
+ const key = svg2 ? `svg:${tag}` : tag;
552
+ let f = factoryCache.get(key);
553
+ if (!f) {
554
+ f = tagFactory(tag, svg2 ? SVG_NS : void 0);
555
+ factoryCache.set(key, f);
556
+ }
557
+ return f;
558
+ }
559
+ function executeElement(tmpl, values) {
560
+ const props = {};
561
+ const events = {};
562
+ let hasEvents = false;
563
+ for (let i2 = 0; i2 < tmpl.attrs.length; i2++) {
564
+ const attr = tmpl.attrs[i2];
565
+ switch (attr.t) {
566
+ case 0:
567
+ props[attr.name] = attr.value;
568
+ break;
569
+ case 1:
570
+ props[attr.name] = values[attr.idx];
571
+ break;
572
+ case 2: {
573
+ let val = attr.statics[0];
574
+ for (let j = 0; j < attr.exprs.length; j++) {
575
+ val += String(values[attr.exprs[j]]) + attr.statics[j + 1];
576
+ }
577
+ props[attr.name] = val;
578
+ break;
579
+ }
580
+ case 3:
581
+ events[attr.name] = values[attr.idx];
582
+ hasEvents = true;
583
+ break;
584
+ case 4:
585
+ props[attr.name] = true;
586
+ break;
587
+ }
588
+ }
589
+ if (hasEvents) props.on = events;
590
+ if (tmpl.children.length > 0) {
591
+ const nodes = executeChildList(tmpl.children, values);
592
+ props.nodes = nodes.length === 1 ? nodes[0] : nodes;
593
+ }
594
+ return getFactory(tmpl.tag, tmpl.svg)(props);
595
+ }
596
+ function executeChildList(children, values) {
597
+ const nodes = [];
598
+ for (let i2 = 0; i2 < children.length; i2++) {
599
+ const child = children[i2];
600
+ switch (child.t) {
601
+ case 0:
602
+ nodes.push(executeElement(child.el, values));
603
+ break;
604
+ case 1:
605
+ nodes.push(child.value);
606
+ break;
607
+ case 2:
608
+ nodes.push(values[child.idx]);
609
+ break;
610
+ }
611
+ }
612
+ return nodes;
613
+ }
614
+ function html(strings, ...values) {
615
+ let tmpl = cache.get(strings);
616
+ if (!tmpl) {
617
+ tmpl = parseTemplate(strings);
618
+ cache.set(strings, tmpl);
619
+ }
620
+ const result = executeChildList(tmpl, values);
621
+ if (result.length === 1 && result[0] instanceof Node) {
622
+ return result[0];
623
+ }
624
+ const wrapper = document.createElement("div");
625
+ for (const node of result) {
626
+ if (node instanceof Node) {
627
+ wrapper.appendChild(node);
628
+ } else if (typeof node === "function") {
629
+ const placeholder = document.createComment("bind:htm");
630
+ wrapper.appendChild(placeholder);
631
+ const teardown = bindChildNode(placeholder, node);
632
+ sbRegisterDisposer(wrapper, teardown);
633
+ } else if (node != null) {
634
+ wrapper.appendChild(document.createTextNode(String(node)));
635
+ }
636
+ }
637
+ return wrapper;
638
+ }
639
+
640
+ // src/core/rendering/mount.ts
641
+ function sbMount(component, container) {
642
+ if (!container) {
643
+ throw new Error("[Sibu] sbMount: container element not found. Make sure the DOM element exists before calling sbMount().");
644
+ }
645
+ devAssert(
646
+ typeof component === "function" || component instanceof Node,
647
+ "sbMount: first argument must be a component function or a DOM Node."
648
+ );
649
+ const startTime = typeof performance !== "undefined" ? performance.now() : 0;
650
+ const node = typeof component === "function" ? component() : component;
651
+ const duration = typeof performance !== "undefined" ? performance.now() - startTime : 0;
652
+ container.appendChild(node);
653
+ const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
654
+ if (hook) {
655
+ hook.emit("app:init", { rootElement: node, container, duration });
656
+ }
657
+ return {
658
+ node,
659
+ unmount() {
660
+ if (hook) hook.emit("app:unmount", { rootElement: node });
661
+ sbDispose(node);
662
+ if (node.parentNode) {
663
+ node.parentNode.removeChild(node);
664
+ }
665
+ }
666
+ };
667
+ }
668
+
669
+ // src/core/rendering/each.ts
670
+ function resolveNodeChild(child) {
671
+ if (typeof child === "function") {
672
+ return resolveNodeChild(child());
673
+ }
674
+ if (child instanceof Node) {
675
+ return child;
676
+ }
677
+ return document.createTextNode(String(child));
678
+ }
679
+ function longestIncreasingSubsequence(arr, len) {
680
+ if (len === 0) return [];
681
+ const tails = [];
682
+ const predecessor = new Array(len);
683
+ for (let i2 = 0; i2 < len; i2++) {
684
+ const val = arr[i2];
685
+ let lo = 0;
686
+ let hi = tails.length;
687
+ while (lo < hi) {
688
+ const mid = lo + hi >> 1;
689
+ if (arr[tails[mid]] < val) {
690
+ lo = mid + 1;
691
+ } else {
692
+ hi = mid;
693
+ }
694
+ }
695
+ tails[lo] = i2;
696
+ predecessor[i2] = lo > 0 ? tails[lo - 1] : -1;
697
+ }
698
+ const lisLength = tails.length;
699
+ const result = new Array(lisLength);
700
+ let k = tails[lisLength - 1];
701
+ for (let i2 = lisLength - 1; i2 >= 0; i2--) {
702
+ result[i2] = k;
703
+ k = predecessor[k];
704
+ }
705
+ return result;
706
+ }
707
+ function sbEach(getArray, render, options) {
708
+ devAssert(typeof getArray === "function", "sbEach: first argument must be a function that returns an array.");
709
+ devAssert(typeof render === "function", "sbEach: second argument must be a render function.");
710
+ devAssert(options && typeof options.key === "function", "sbEach: options.key must be a function that returns a unique key per item.");
711
+ const anchor = document.createComment("each:anchor");
712
+ const end = document.createComment("each:end");
713
+ let oldKeys = [];
714
+ let nodeMap = /* @__PURE__ */ new Map();
715
+ let workMap = /* @__PURE__ */ new Map();
716
+ let newNodes = [];
717
+ const oldKeyIndex = /* @__PURE__ */ new Map();
718
+ let reusedNewBuf = [];
719
+ let reusedOldBuf = [];
720
+ let initialized = false;
721
+ let sentinelInserted = false;
722
+ const keyFn = options.key;
723
+ const update = () => {
724
+ const arr = getArray();
725
+ const newLen = arr.length;
726
+ const parent = anchor.parentNode;
727
+ if (!parent) return;
728
+ if (!sentinelInserted) {
729
+ parent.insertBefore(end, anchor.nextSibling);
730
+ sentinelInserted = true;
731
+ }
732
+ const newKeys = new Array(newLen);
733
+ for (let i2 = 0; i2 < newLen; i2++) {
734
+ newKeys[i2] = keyFn(arr[i2]);
735
+ }
736
+ if (newNodes.length < newLen) {
737
+ newNodes = new Array(newLen);
738
+ }
739
+ workMap.clear();
740
+ for (let i2 = 0; i2 < newLen; i2++) {
741
+ const key = newKeys[i2];
742
+ const existing = nodeMap.get(key);
743
+ let node;
744
+ if (existing !== void 0) {
745
+ node = existing;
746
+ } else {
747
+ node = resolveNodeChild(render(arr[i2], i2));
748
+ }
749
+ workMap.set(key, node);
750
+ newNodes[i2] = node;
751
+ }
752
+ for (const [key, node] of nodeMap) {
753
+ if (!workMap.has(key) && node.parentNode) {
754
+ parent.removeChild(node);
755
+ }
756
+ }
757
+ if (newLen === 0) {
758
+ oldKeys = newKeys;
759
+ const tmp2 = nodeMap;
760
+ nodeMap = workMap;
761
+ workMap = tmp2;
762
+ return;
763
+ }
764
+ const oldLen = oldKeys.length;
765
+ oldKeyIndex.clear();
766
+ for (let i2 = 0; i2 < oldLen; i2++) {
767
+ oldKeyIndex.set(oldKeys[i2], i2);
768
+ }
769
+ if (reusedNewBuf.length < newLen) {
770
+ reusedNewBuf = new Array(newLen);
771
+ reusedOldBuf = new Array(newLen);
772
+ }
773
+ let reusedCount = 0;
774
+ for (let i2 = 0; i2 < newLen; i2++) {
775
+ const oldIdx = oldKeyIndex.get(newKeys[i2]);
776
+ if (oldIdx !== void 0) {
777
+ reusedNewBuf[reusedCount] = i2;
778
+ reusedOldBuf[reusedCount] = oldIdx;
779
+ reusedCount++;
780
+ }
781
+ }
782
+ const lisIndices = longestIncreasingSubsequence(reusedOldBuf, reusedCount);
783
+ const isStable = new Uint8Array(newLen);
784
+ for (let i2 = 0; i2 < lisIndices.length; i2++) {
785
+ isStable[reusedNewBuf[lisIndices[i2]]] = 1;
786
+ }
787
+ let nextRef = end;
788
+ for (let i2 = newLen - 1; i2 >= 0; i2--) {
789
+ const node = newNodes[i2];
790
+ if (isStable[i2]) {
791
+ nextRef = node;
792
+ } else {
793
+ if (node.nextSibling !== nextRef) {
794
+ parent.insertBefore(node, nextRef);
795
+ }
796
+ nextRef = node;
797
+ }
798
+ }
799
+ oldKeys = newKeys;
800
+ const tmp = nodeMap;
801
+ nodeMap = workMap;
802
+ workMap = tmp;
803
+ initialized = true;
804
+ };
805
+ track(update);
806
+ if (!initialized) {
807
+ queueMicrotask(() => {
808
+ if (!initialized && anchor.parentNode) {
809
+ update();
810
+ }
811
+ });
812
+ }
813
+ return anchor;
814
+ }
815
+
816
+ // src/core/rendering/fragment.ts
817
+ function sbFragment(nodes) {
818
+ const frag = document.createDocumentFragment();
819
+ for (const child of nodes) {
820
+ if (child == null) continue;
821
+ if (Array.isArray(child)) {
822
+ for (const nested of child) {
823
+ frag.appendChild(resolveChild(nested));
824
+ }
825
+ } else {
826
+ frag.appendChild(resolveChild(child));
827
+ }
828
+ }
829
+ return frag;
830
+ }
831
+ function resolveChild(child) {
832
+ if (child == null) {
833
+ return document.createTextNode("");
834
+ }
835
+ if (child instanceof Node) {
836
+ return child;
837
+ }
838
+ if (typeof child === "function") {
839
+ const result = child();
840
+ if (result instanceof Node) return result;
841
+ return document.createTextNode(String(result ?? ""));
842
+ }
843
+ return document.createTextNode(String(child));
844
+ }
845
+
846
+ // src/core/rendering/portal.ts
847
+ function sbPortal(nodes, target) {
848
+ const anchor = document.createComment("portal");
849
+ const container = target || document.body;
850
+ let portalContent = null;
851
+ queueMicrotask(() => {
852
+ try {
853
+ portalContent = nodes();
854
+ container.appendChild(portalContent);
855
+ } catch (err) {
856
+ console.error("[Portal] Render error:", err);
857
+ }
858
+ });
859
+ const observer = new MutationObserver(() => {
860
+ if (!anchor.isConnected && portalContent) {
861
+ portalContent.remove();
862
+ portalContent = null;
863
+ observer.disconnect();
864
+ }
865
+ });
866
+ queueMicrotask(() => {
867
+ if (anchor.parentNode) {
868
+ observer.observe(anchor.parentNode, { childList: true });
869
+ }
870
+ });
871
+ return anchor;
872
+ }
873
+
874
+ // src/core/rendering/dynamic.ts
875
+ var componentRegistry = /* @__PURE__ */ new Map();
876
+ function sbRegisterComponent(name, component) {
877
+ componentRegistry.set(name, component);
878
+ }
879
+ function sbUnregisterComponent(name) {
880
+ componentRegistry.delete(name);
881
+ }
882
+ function sbResolveComponent(name) {
883
+ const component = componentRegistry.get(name);
884
+ if (component) {
885
+ return component();
886
+ }
887
+ return div({ nodes: `[Component "${name}" not found]` });
888
+ }
889
+ function sbDynamicComponent(is) {
890
+ const container = div({ class: "sibu-dynamic" });
891
+ function render() {
892
+ const target = is();
893
+ let el;
894
+ if (typeof target === "function") {
895
+ el = target();
896
+ } else {
897
+ el = sbResolveComponent(target);
898
+ }
899
+ container.replaceChildren(el);
900
+ }
901
+ track(render);
902
+ return container;
903
+ }
904
+
905
+ // src/core/rendering/slots.ts
906
+ function sbGetSlot(slots, name = "default") {
907
+ return slots?.[name];
908
+ }
909
+
910
+ // src/core/rendering/directives.ts
911
+ function sbShow(condition, element) {
912
+ const update = () => {
913
+ element.style.display = condition() ? "" : "none";
914
+ };
915
+ track(update);
916
+ return element;
917
+ }
918
+ function sbWhen(condition, thenBranch, elseBranch) {
919
+ const anchor = document.createComment("when");
920
+ let currentNode = null;
921
+ let initialized = false;
922
+ const update = () => {
923
+ const show = condition();
924
+ const parent = anchor.parentNode;
925
+ if (!parent) return;
926
+ if (currentNode?.parentNode) {
927
+ currentNode.parentNode.removeChild(currentNode);
928
+ currentNode = null;
929
+ }
930
+ const result = show ? thenBranch() : elseBranch ? elseBranch() : null;
931
+ if (result != null) {
932
+ const node = result instanceof Node ? result : document.createTextNode(String(result));
933
+ parent.insertBefore(node, anchor.nextSibling);
934
+ currentNode = node;
935
+ }
936
+ initialized = true;
937
+ };
938
+ track(update);
939
+ if (!initialized) {
940
+ queueMicrotask(() => {
941
+ if (!initialized && anchor.parentNode) update();
942
+ });
943
+ }
944
+ return anchor;
945
+ }
946
+ function sbMatch(value, cases, fallback) {
947
+ const anchor = document.createComment("match");
948
+ let currentNode = null;
949
+ let initialized = false;
950
+ const update = () => {
951
+ const key = String(value());
952
+ const parent = anchor.parentNode;
953
+ if (!parent) return;
954
+ if (currentNode?.parentNode) {
955
+ currentNode.parentNode.removeChild(currentNode);
956
+ currentNode = null;
957
+ }
958
+ const renderFn = cases[key] || fallback;
959
+ if (renderFn) {
960
+ const result = renderFn();
961
+ if (result != null) {
962
+ const node = result instanceof Node ? result : document.createTextNode(String(result));
963
+ parent.insertBefore(node, anchor.nextSibling);
964
+ currentNode = node;
965
+ }
966
+ }
967
+ initialized = true;
968
+ };
969
+ track(update);
970
+ if (!initialized) {
971
+ queueMicrotask(() => {
972
+ if (!initialized && anchor.parentNode) update();
973
+ });
974
+ }
975
+ return anchor;
976
+ }
977
+
978
+ // src/core/rendering/catch.ts
979
+ var globalErrorHandler = null;
980
+ function sbCatchError(fn, onError) {
981
+ try {
982
+ const result = fn();
983
+ if (result && typeof result.then === "function") {
984
+ result.catch((err) => {
985
+ if (onError) {
986
+ onError(err, "async");
987
+ } else if (globalErrorHandler) {
988
+ globalErrorHandler(err, "async");
989
+ } else {
990
+ console.error("Unhandled async error in Sibu.sbCatchError:", err);
991
+ }
992
+ });
993
+ }
994
+ return result;
995
+ } catch (err) {
996
+ if (onError) {
997
+ onError(err, "sync");
998
+ } else if (globalErrorHandler) {
999
+ globalErrorHandler(err, "sync");
1000
+ } else {
1001
+ console.error("Unhandled error in Sibu.sbCatchError:", err);
1002
+ }
1003
+ return null;
1004
+ }
1005
+ }
1006
+ async function sbCatchErrorAsync(fn, onError) {
1007
+ try {
1008
+ return await fn();
1009
+ } catch (err) {
1010
+ if (onError) {
1011
+ onError(err, "async");
1012
+ } else if (globalErrorHandler) {
1013
+ globalErrorHandler(err, "async");
1014
+ } else {
1015
+ console.error("Unhandled async error in Sibu.sbCatchErrorAsync:", err);
1016
+ }
1017
+ return null;
1018
+ }
1019
+ }
1020
+ function sbSetGlobalErrorHandler(handler) {
1021
+ globalErrorHandler = handler;
1022
+ }
1023
+
1024
+ // src/core/signals/sbWatch.ts
1025
+ function sbWatch(getter, callback) {
1026
+ devAssert(typeof getter === "function", "sbWatch: first argument must be a getter function.");
1027
+ devAssert(typeof callback === "function", "sbWatch: second argument must be a callback function.");
1028
+ if (sbIsSSR()) return () => {
1029
+ };
1030
+ let oldValue = getter();
1031
+ const subscriber = () => {
1032
+ const newValue = getter();
1033
+ if (!Object.is(newValue, oldValue)) {
1034
+ callback(newValue, oldValue);
1035
+ oldValue = newValue;
1036
+ }
1037
+ };
1038
+ const teardown = track(subscriber);
1039
+ return teardown;
1040
+ }
1041
+
1042
+ // src/core/signals/sbStore.ts
1043
+ function sbStore(initialState) {
1044
+ devAssert(
1045
+ initialState !== null && typeof initialState === "object" && !Array.isArray(initialState),
1046
+ "sbStore: argument must be a plain object. For arrays, use sbArray() instead."
1047
+ );
1048
+ const signals = {};
1049
+ Object.keys(initialState).forEach((key) => {
1050
+ const [getter, setter] = sbSignal(initialState[key]);
1051
+ signals[key] = [getter, setter];
1052
+ });
1053
+ const store = new Proxy({}, {
1054
+ get(_, prop) {
1055
+ if (prop in signals) {
1056
+ const getter = signals[prop][0];
1057
+ return getter();
1058
+ }
1059
+ return void 0;
1060
+ },
1061
+ set() {
1062
+ throw new Error("[Sibu] sbStore: Direct mutation is not allowed. Use actions.setState() to update store properties.");
1063
+ }
1064
+ });
1065
+ const getSnapshot = () => {
1066
+ const snapshot = {};
1067
+ Object.keys(signals).forEach((key) => {
1068
+ snapshot[key] = signals[key][0]();
1069
+ });
1070
+ return snapshot;
1071
+ };
1072
+ const setState = (patch) => {
1073
+ const current = getSnapshot();
1074
+ const nextState = typeof patch === "function" ? patch(current) : patch;
1075
+ Object.entries(nextState).forEach(([key, value]) => {
1076
+ if (key in signals) {
1077
+ signals[key][1](value);
1078
+ }
1079
+ });
1080
+ };
1081
+ const reset = () => {
1082
+ Object.keys(initialState).forEach((key) => {
1083
+ const setter = signals[key][1];
1084
+ setter(initialState[key]);
1085
+ });
1086
+ };
1087
+ const subscribe = (callback) => {
1088
+ return sbEffect(() => {
1089
+ const snapshot = getSnapshot();
1090
+ callback(snapshot);
1091
+ });
1092
+ };
1093
+ const subscribeKey = (key, callback) => {
1094
+ let prev = signals[key][0]();
1095
+ return sbEffect(() => {
1096
+ const current = signals[key][0]();
1097
+ if (!Object.is(current, prev)) {
1098
+ const oldPrev = prev;
1099
+ prev = current;
1100
+ callback(current, oldPrev);
1101
+ }
1102
+ });
1103
+ };
1104
+ return [store, { setState, reset, subscribe, subscribeKey, getSnapshot }];
1105
+ }
1106
+
1107
+ // src/core/signals/sbRef.ts
1108
+ function sbRef(initial) {
1109
+ return { current: initial };
1110
+ }
1111
+
1112
+ // src/core/signals/sbMemo.ts
1113
+ function sbMemo(factory) {
1114
+ return sbDerived(factory);
1115
+ }
1116
+
1117
+ // src/core/signals/sbMemoFn.ts
1118
+ function sbMemoFn(callback) {
1119
+ return sbDerived(callback);
1120
+ }
1121
+
1122
+ // src/core/signals/sbArray.ts
1123
+ function sbArray(initial = []) {
1124
+ const [arr, setArr] = sbSignal([...initial]);
1125
+ const actions = {
1126
+ sbPush(...items) {
1127
+ setArr((prev) => [...prev, ...items]);
1128
+ },
1129
+ pop() {
1130
+ let removed;
1131
+ setArr((prev) => {
1132
+ const copy = [...prev];
1133
+ removed = copy.pop();
1134
+ return copy;
1135
+ });
1136
+ return removed;
1137
+ },
1138
+ shift() {
1139
+ let removed;
1140
+ setArr((prev) => {
1141
+ const copy = [...prev];
1142
+ removed = copy.shift();
1143
+ return copy;
1144
+ });
1145
+ return removed;
1146
+ },
1147
+ unshift(...items) {
1148
+ setArr((prev) => [...items, ...prev]);
1149
+ },
1150
+ splice(start, deleteCount = 0, ...items) {
1151
+ let removed = [];
1152
+ setArr((prev) => {
1153
+ const copy = [...prev];
1154
+ removed = copy.splice(start, deleteCount, ...items);
1155
+ return copy;
1156
+ });
1157
+ return removed;
1158
+ },
1159
+ remove(index) {
1160
+ setArr((prev) => prev.filter((_, i2) => i2 !== index));
1161
+ },
1162
+ removeWhere(predicate) {
1163
+ setArr((prev) => {
1164
+ const idx = prev.findIndex(predicate);
1165
+ if (idx === -1) return prev;
1166
+ return prev.filter((_, i2) => i2 !== idx);
1167
+ });
1168
+ },
1169
+ set(items) {
1170
+ setArr([...items]);
1171
+ },
1172
+ update(index, value) {
1173
+ setArr((prev) => prev.map((item, i2) => i2 === index ? value : item));
1174
+ },
1175
+ updateWhere(predicate, updater) {
1176
+ setArr((prev) => prev.map((item) => predicate(item) ? updater(item) : item));
1177
+ },
1178
+ sort(compareFn) {
1179
+ setArr((prev) => [...prev].sort(compareFn));
1180
+ },
1181
+ reverse() {
1182
+ setArr((prev) => [...prev].reverse());
1183
+ },
1184
+ filter(predicate) {
1185
+ setArr((prev) => prev.filter(predicate));
1186
+ },
1187
+ map(transform) {
1188
+ setArr((prev) => prev.map(transform));
1189
+ },
1190
+ clear() {
1191
+ setArr([]);
1192
+ }
1193
+ };
1194
+ return [arr, actions];
1195
+ }
1196
+ function sbReactiveArray(initial = []) {
1197
+ let data2 = [...initial];
1198
+ let snapshot = null;
1199
+ const signal = {};
1200
+ function notify() {
1201
+ snapshot = null;
1202
+ if (!enqueueBatchedSignal(signal)) {
1203
+ notifySubscribers(signal);
1204
+ }
1205
+ }
1206
+ function get() {
1207
+ recordDependency(signal);
1208
+ if (snapshot === null) {
1209
+ snapshot = Object.freeze([...data2]);
1210
+ }
1211
+ return snapshot;
1212
+ }
1213
+ const actions = {
1214
+ sbPush(...items) {
1215
+ if (items.length === 0) return;
1216
+ data2.push(...items);
1217
+ notify();
1218
+ },
1219
+ pop() {
1220
+ if (data2.length === 0) return void 0;
1221
+ const removed = data2.pop();
1222
+ notify();
1223
+ return removed;
1224
+ },
1225
+ shift() {
1226
+ if (data2.length === 0) return void 0;
1227
+ const removed = data2.shift();
1228
+ notify();
1229
+ return removed;
1230
+ },
1231
+ unshift(...items) {
1232
+ if (items.length === 0) return;
1233
+ data2.unshift(...items);
1234
+ notify();
1235
+ },
1236
+ splice(start, deleteCount = 0, ...items) {
1237
+ const removed = data2.splice(start, deleteCount, ...items);
1238
+ if (removed.length > 0 || items.length > 0) {
1239
+ notify();
1240
+ }
1241
+ return removed;
1242
+ },
1243
+ remove(index) {
1244
+ if (index < 0 || index >= data2.length) return;
1245
+ data2.splice(index, 1);
1246
+ notify();
1247
+ },
1248
+ removeWhere(predicate) {
1249
+ const idx = data2.findIndex(predicate);
1250
+ if (idx === -1) return;
1251
+ data2.splice(idx, 1);
1252
+ notify();
1253
+ },
1254
+ set(items) {
1255
+ data2 = [...items];
1256
+ notify();
1257
+ },
1258
+ update(index, value) {
1259
+ if (index < 0 || index >= data2.length) return;
1260
+ if (Object.is(data2[index], value)) return;
1261
+ data2[index] = value;
1262
+ notify();
1263
+ },
1264
+ updateWhere(predicate, updater) {
1265
+ let changed = false;
1266
+ for (let i2 = 0; i2 < data2.length; i2++) {
1267
+ if (predicate(data2[i2])) {
1268
+ const updated = updater(data2[i2]);
1269
+ if (!Object.is(data2[i2], updated)) {
1270
+ data2[i2] = updated;
1271
+ changed = true;
1272
+ }
1273
+ }
1274
+ }
1275
+ if (changed) notify();
1276
+ },
1277
+ sort(compareFn) {
1278
+ if (data2.length <= 1) return;
1279
+ data2.sort(compareFn);
1280
+ notify();
1281
+ },
1282
+ reverse() {
1283
+ if (data2.length <= 1) return;
1284
+ data2.reverse();
1285
+ notify();
1286
+ },
1287
+ filter(predicate) {
1288
+ const filtered = data2.filter(predicate);
1289
+ if (filtered.length === data2.length) return;
1290
+ data2 = filtered;
1291
+ notify();
1292
+ },
1293
+ map(transform) {
1294
+ let changed = false;
1295
+ for (let i2 = 0; i2 < data2.length; i2++) {
1296
+ const transformed = transform(data2[i2], i2);
1297
+ if (!Object.is(data2[i2], transformed)) {
1298
+ data2[i2] = transformed;
1299
+ changed = true;
1300
+ }
1301
+ }
1302
+ if (changed) notify();
1303
+ },
1304
+ clear() {
1305
+ if (data2.length === 0) return;
1306
+ data2 = [];
1307
+ notify();
1308
+ }
1309
+ };
1310
+ return [get, actions];
1311
+ }
1312
+
1313
+ // src/core/signals/sbDeepSignal.ts
1314
+ function deepEqual(a2, b2) {
1315
+ if (Object.is(a2, b2)) return true;
1316
+ if (a2 == null || b2 == null) return false;
1317
+ if (typeof a2 !== typeof b2) return false;
1318
+ if (typeof a2 !== "object") return false;
1319
+ if (Array.isArray(a2)) {
1320
+ if (!Array.isArray(b2)) return false;
1321
+ if (a2.length !== b2.length) return false;
1322
+ return a2.every((val, i2) => deepEqual(val, b2[i2]));
1323
+ }
1324
+ const keysA = Object.keys(a2);
1325
+ const keysB = Object.keys(b2);
1326
+ if (keysA.length !== keysB.length) return false;
1327
+ return keysA.every((key) => deepEqual(a2[key], b2[key]));
1328
+ }
1329
+ function sbDeepSignal(initial) {
1330
+ const state = { value: initial };
1331
+ function get() {
1332
+ recordDependency(state);
1333
+ return state.value;
1334
+ }
1335
+ function set(next) {
1336
+ const newValue = typeof next === "function" ? next(state.value) : next;
1337
+ if (deepEqual(newValue, state.value)) return;
1338
+ state.value = newValue;
1339
+ if (!enqueueBatchedSignal(state)) {
1340
+ notifySubscribers(state);
1341
+ }
1342
+ }
1343
+ return [get, set];
1344
+ }
1345
+
1346
+ // src/core/rendering/lifecycle.ts
1347
+ function sbOnMount(callback, element) {
1348
+ if (typeof document === "undefined") return;
1349
+ if (element) {
1350
+ if (element.isConnected) {
1351
+ queueMicrotask(() => {
1352
+ callback();
1353
+ });
1354
+ return;
1355
+ }
1356
+ const observer = new MutationObserver(() => {
1357
+ if (element.isConnected) {
1358
+ observer.disconnect();
1359
+ callback();
1360
+ }
1361
+ });
1362
+ queueMicrotask(() => {
1363
+ if (element.isConnected) {
1364
+ callback();
1365
+ } else {
1366
+ observer.observe(document.body, { childList: true, subtree: true });
1367
+ }
1368
+ });
1369
+ } else {
1370
+ queueMicrotask(() => {
1371
+ callback();
1372
+ });
1373
+ }
1374
+ }
1375
+ function sbOnUnmount(callback, element) {
1376
+ const startObserving = () => {
1377
+ const observer = new MutationObserver(() => {
1378
+ if (!element.isConnected) {
1379
+ observer.disconnect();
1380
+ callback();
1381
+ }
1382
+ });
1383
+ observer.observe(document.body, { childList: true, subtree: true });
1384
+ };
1385
+ if (element.isConnected) {
1386
+ startObserving();
1387
+ } else {
1388
+ sbOnMount(() => {
1389
+ startObserving();
1390
+ return void 0;
1391
+ }, element);
1392
+ }
1393
+ }
1394
+
1395
+ // src/core/rendering/lazy.ts
1396
+ function sbLazy(importFn) {
1397
+ let cached = null;
1398
+ return function LazyComponent() {
1399
+ if (cached) {
1400
+ return cached();
1401
+ }
1402
+ const [_status, setStatus] = sbSignal("loading");
1403
+ const [_error, setError] = sbSignal(null);
1404
+ const container = div({ class: "sibu-lazy" });
1405
+ importFn().then((mod) => {
1406
+ cached = mod.default;
1407
+ const rendered = cached();
1408
+ container.replaceChildren(rendered);
1409
+ setStatus("loaded");
1410
+ }).catch((err) => {
1411
+ const errorObj = err instanceof Error ? err : new Error(String(err));
1412
+ setError(errorObj);
1413
+ setStatus("error");
1414
+ container.replaceChildren(
1415
+ div({
1416
+ class: "sibu-lazy-error",
1417
+ nodes: `Failed to load component: ${errorObj.message}`
1418
+ })
1419
+ );
1420
+ });
1421
+ container.appendChild(span({ class: "sibu-lazy-loading", nodes: "Loading..." }));
1422
+ return container;
1423
+ };
1424
+ }
1425
+ function sbSuspense({ nodes, fallback }) {
1426
+ const container = div({ class: "sibu-suspense" });
1427
+ const fallbackEl = fallback();
1428
+ container.appendChild(fallbackEl);
1429
+ queueMicrotask(() => {
1430
+ try {
1431
+ const childEl = nodes();
1432
+ if (childEl.classList.contains("sibu-lazy")) {
1433
+ const observer = new MutationObserver(() => {
1434
+ const loading = childEl.querySelector(".sibu-lazy-loading");
1435
+ if (!loading) {
1436
+ observer.disconnect();
1437
+ container.replaceChildren(childEl);
1438
+ }
1439
+ });
1440
+ observer.observe(childEl, { childList: true, subtree: true });
1441
+ if (!childEl.querySelector(".sibu-lazy-loading")) {
1442
+ container.replaceChildren(childEl);
1443
+ }
1444
+ } else {
1445
+ container.replaceChildren(childEl);
1446
+ }
1447
+ } catch {
1448
+ }
1449
+ });
1450
+ return container;
1451
+ }
1452
+
1453
+ // src/components/ErrorBoundary.ts
1454
+ var errorBoundaryStyles = `
1455
+ .sibu-error-boundary {
1456
+ position: relative;
1457
+ }
1458
+
1459
+ .sibu-error-fallback {
1460
+ border: 2px solid #dc3545;
1461
+ border-radius: 8px;
1462
+ padding: 20px;
1463
+ margin: 10px 0;
1464
+ background: linear-gradient(135deg, #fff5f5 0%, #ffebee 100%);
1465
+ box-shadow: 0 2px 12px rgba(220, 53, 69, 0.15);
1466
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
1467
+ }
1468
+
1469
+ .sibu-error-fallback .sibu-error-title {
1470
+ margin: 0 0 12px 0;
1471
+ color: #dc3545;
1472
+ font-size: 1.1em;
1473
+ font-weight: 600;
1474
+ }
1475
+
1476
+ .sibu-error-fallback .sibu-error-message {
1477
+ font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
1478
+ background-color: rgba(0, 0, 0, 0.04);
1479
+ padding: 10px 14px;
1480
+ border-radius: 6px;
1481
+ border: 1px solid rgba(0, 0, 0, 0.08);
1482
+ margin: 10px 0;
1483
+ color: #495057;
1484
+ word-break: break-word;
1485
+ font-size: 0.9em;
1486
+ line-height: 1.5;
1487
+ }
1488
+
1489
+ .sibu-error-fallback .sibu-error-btn {
1490
+ display: inline-flex;
1491
+ align-items: center;
1492
+ gap: 6px;
1493
+ padding: 8px 18px;
1494
+ border: none;
1495
+ border-radius: 6px;
1496
+ cursor: pointer;
1497
+ font-size: 14px;
1498
+ font-weight: 500;
1499
+ transition: all 0.2s ease;
1500
+ margin-top: 8px;
1501
+ background-color: #dc3545;
1502
+ color: white;
1503
+ }
1504
+
1505
+ .sibu-error-fallback .sibu-error-btn:hover {
1506
+ background-color: #c82333;
1507
+ transform: translateY(-1px);
1508
+ box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
1509
+ }
1510
+
1511
+ .sibu-error-fallback .sibu-error-btn:active {
1512
+ transform: translateY(0);
1513
+ }
1514
+ `;
1515
+ var stylesInjected = false;
1516
+ function injectStyles() {
1517
+ if (!stylesInjected && typeof document !== "undefined") {
1518
+ const styleElement = style({ nodes: errorBoundaryStyles });
1519
+ document.head.appendChild(styleElement);
1520
+ stylesInjected = true;
1521
+ }
1522
+ }
1523
+ var fallbackCache = /* @__PURE__ */ new WeakMap();
1524
+ function getMemoizedFallback(fallbackFn, error, retry) {
1525
+ let cache2 = fallbackCache.get(fallbackFn);
1526
+ if (!cache2) {
1527
+ cache2 = /* @__PURE__ */ new Map();
1528
+ fallbackCache.set(fallbackFn, cache2);
1529
+ }
1530
+ const key = error.message;
1531
+ if (!cache2.has(key)) {
1532
+ cache2.set(key, fallbackFn(error, retry));
1533
+ }
1534
+ return cache2.get(key);
1535
+ }
1536
+ function sbErrorBoundary({ nodes, fallback, onError }) {
1537
+ injectStyles();
1538
+ const [error, setError] = sbSignal(null);
1539
+ const retry = () => {
1540
+ if (fallback) {
1541
+ fallbackCache.delete(fallback);
1542
+ }
1543
+ setError(null);
1544
+ };
1545
+ const handleError = (e) => {
1546
+ const errorObj = e instanceof Error ? e : new Error(String(e));
1547
+ setError(errorObj);
1548
+ onError?.(errorObj);
1549
+ return errorObj;
1550
+ };
1551
+ const defaultFallback = (err, retryFn) => div({
1552
+ class: "sibu-error-fallback",
1553
+ nodes: [
1554
+ h3({
1555
+ nodes: "Something went wrong",
1556
+ class: "sibu-error-title"
1557
+ }),
1558
+ p({
1559
+ nodes: err.message,
1560
+ class: "sibu-error-message"
1561
+ }),
1562
+ button({
1563
+ nodes: "Retry",
1564
+ class: "sibu-error-btn",
1565
+ on: { click: retryFn }
1566
+ })
1567
+ ]
1568
+ });
1569
+ const tryRenderFallback = (err) => {
1570
+ const fn = fallback || defaultFallback;
1571
+ try {
1572
+ return getMemoizedFallback(fn, err, retry);
1573
+ } catch (fallbackError) {
1574
+ const propagateError = fallbackError instanceof Error ? fallbackError : new Error(String(fallbackError));
1575
+ queueMicrotask(() => {
1576
+ if (container.parentNode) {
1577
+ container.dispatchEvent(
1578
+ new CustomEvent("sibu:error-propagate", {
1579
+ bubbles: true,
1580
+ detail: { error: propagateError }
1581
+ })
1582
+ );
1583
+ }
1584
+ });
1585
+ return document.createComment("error-boundary-failed");
1586
+ }
1587
+ };
1588
+ const container = div({
1589
+ class: "sibu-error-boundary",
1590
+ nodes: () => {
1591
+ const currentError = error();
1592
+ if (currentError) {
1593
+ return tryRenderFallback(currentError);
1594
+ }
1595
+ try {
1596
+ const result = nodes();
1597
+ if (result && typeof result.then === "function") {
1598
+ const asyncContainer = div({ class: "sibu-error-async" });
1599
+ asyncContainer.appendChild(span({ class: "sibu-lazy-loading", nodes: "Loading..." }));
1600
+ result.then((el) => {
1601
+ asyncContainer.replaceChildren(el);
1602
+ }).catch((e) => {
1603
+ const err = handleError(e);
1604
+ asyncContainer.replaceChildren(tryRenderFallback(err));
1605
+ });
1606
+ return asyncContainer;
1607
+ }
1608
+ return result;
1609
+ } catch (e) {
1610
+ const errorObj = handleError(e);
1611
+ return tryRenderFallback(errorObj);
1612
+ }
1613
+ }
1614
+ });
1615
+ container.addEventListener("sibu:error-propagate", (e) => {
1616
+ if (error()) return;
1617
+ e.stopPropagation();
1618
+ const customEvent = e;
1619
+ const propagatedError = customEvent.detail?.error;
1620
+ if (propagatedError) {
1621
+ handleError(propagatedError);
1622
+ }
1623
+ });
1624
+ return container;
1625
+ }
1626
+
1627
+ // src/components/Loading.ts
1628
+ var loadingStyles = `
1629
+ @keyframes sibu-spin {
1630
+ to { transform: rotate(360deg); }
1631
+ }
1632
+
1633
+ @keyframes sibu-pulse {
1634
+ 0%, 100% { opacity: 1; }
1635
+ 50% { opacity: 0.4; }
1636
+ }
1637
+
1638
+ .sibu-loading {
1639
+ display: flex;
1640
+ align-items: center;
1641
+ justify-content: center;
1642
+ padding: 20px;
1643
+ gap: 10px;
1644
+ }
1645
+
1646
+ .sibu-loading-spinner {
1647
+ width: 24px;
1648
+ height: 24px;
1649
+ border: 3px solid #e0e0e0;
1650
+ border-top-color: #3b82f6;
1651
+ border-radius: 50%;
1652
+ animation: sibu-spin 0.8s linear infinite;
1653
+ }
1654
+
1655
+ .sibu-loading-dots {
1656
+ display: flex;
1657
+ gap: 4px;
1658
+ }
1659
+
1660
+ .sibu-loading-dot {
1661
+ width: 8px;
1662
+ height: 8px;
1663
+ border-radius: 50%;
1664
+ background-color: #3b82f6;
1665
+ animation: sibu-pulse 1.2s ease-in-out infinite;
1666
+ }
1667
+
1668
+ .sibu-loading-dot:nth-child(2) { animation-delay: 0.2s; }
1669
+ .sibu-loading-dot:nth-child(3) { animation-delay: 0.4s; }
1670
+
1671
+ .sibu-loading-text {
1672
+ color: #6b7280;
1673
+ font-size: 14px;
1674
+ }
1675
+
1676
+ .sibu-loading-sm .sibu-loading-spinner { width: 16px; height: 16px; border-width: 2px; }
1677
+ .sibu-loading-sm .sibu-loading-dot { width: 6px; height: 6px; }
1678
+ .sibu-loading-lg .sibu-loading-spinner { width: 40px; height: 40px; border-width: 4px; }
1679
+ .sibu-loading-lg .sibu-loading-dot { width: 12px; height: 12px; }
1680
+ .sibu-loading-lg .sibu-loading-dots { gap: 6px; }
1681
+ `;
1682
+ var loadingStylesInjected = false;
1683
+ function injectLoadingStyles() {
1684
+ if (!loadingStylesInjected && typeof document !== "undefined") {
1685
+ document.head.appendChild(style({ nodes: loadingStyles }));
1686
+ loadingStylesInjected = true;
1687
+ }
1688
+ }
1689
+ function sbLoading(props = {}) {
1690
+ injectLoadingStyles();
1691
+ const { text: text2, variant = "spinner", size = "md" } = props;
1692
+ const sizeClass = size !== "md" ? ` sibu-loading-${size}` : "";
1693
+ if (variant === "dots") {
1694
+ return div({
1695
+ class: `sibu-loading${sizeClass}`,
1696
+ nodes: [
1697
+ div({
1698
+ class: "sibu-loading-dots",
1699
+ nodes: [
1700
+ span({ class: "sibu-loading-dot" }),
1701
+ span({ class: "sibu-loading-dot" }),
1702
+ span({ class: "sibu-loading-dot" })
1703
+ ]
1704
+ }),
1705
+ text2 ? span({ class: "sibu-loading-text", nodes: text2 }) : null
1706
+ ].filter(Boolean)
1707
+ });
1708
+ }
1709
+ return div({
1710
+ class: `sibu-loading${sizeClass}`,
1711
+ nodes: [
1712
+ div({ class: "sibu-loading-spinner" }),
1713
+ text2 ? span({ class: "sibu-loading-text", nodes: text2 }) : null
1714
+ ].filter(Boolean)
1715
+ });
1716
+ }
1717
+
1718
+ export {
1719
+ html,
1720
+ sbMount,
1721
+ sbEach,
1722
+ sbFragment,
1723
+ sbPortal,
1724
+ sbRegisterComponent,
1725
+ sbUnregisterComponent,
1726
+ sbResolveComponent,
1727
+ sbDynamicComponent,
1728
+ sbGetSlot,
1729
+ sbShow,
1730
+ sbWhen,
1731
+ sbMatch,
1732
+ sbCatchError,
1733
+ sbCatchErrorAsync,
1734
+ sbSetGlobalErrorHandler,
1735
+ sbWatch,
1736
+ sbStore,
1737
+ sbRef,
1738
+ sbMemo,
1739
+ sbMemoFn,
1740
+ sbArray,
1741
+ sbReactiveArray,
1742
+ sbDeepSignal,
1743
+ sbOnMount,
1744
+ sbOnUnmount,
1745
+ sbLazy,
1746
+ sbSuspense,
1747
+ sbErrorBoundary,
1748
+ sbLoading,
1749
+ index_exports
1750
+ };