@stacksjs/stx 0.2.917 → 0.2.921

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 (294) hide show
  1. package/dist/app-shell.js +3 -2
  2. package/dist/chunk-0678sab4.js +2 -0
  3. package/dist/chunk-0bnv0aaz.js +2 -0
  4. package/dist/chunk-0bvfm5h5.js +2 -0
  5. package/dist/chunk-0c3q5h03.js +2 -0
  6. package/dist/chunk-0fh84wr5.js +2 -0
  7. package/dist/chunk-0p9x0m5n.js +2 -0
  8. package/dist/{chunk-ngqb22wj.js → chunk-0rq1w0xr.js} +9 -9
  9. package/dist/{chunk-t65f98qv.js → chunk-1pc2p489.js} +2 -2
  10. package/dist/{chunk-1hx6dyy9.js → chunk-1ts1pg90.js} +2 -2
  11. package/dist/{chunk-h0aw9hmc.js → chunk-29cy41z3.js} +5 -5
  12. package/dist/{chunk-952dfmcb.js → chunk-2d0pemtc.js} +3 -3
  13. package/dist/{chunk-0vyytd9v.js → chunk-2qnpr0ty.js} +3 -3
  14. package/dist/chunk-2r2tayyd.js +3 -0
  15. package/dist/chunk-2sfxj244.js +2 -0
  16. package/dist/{chunk-nwef47nx.js → chunk-30d298vs.js} +1 -1
  17. package/dist/chunk-36j2drjv.js +42 -0
  18. package/dist/{chunk-pyyda92j.js → chunk-3d0bjcn7.js} +1 -1
  19. package/dist/chunk-3k9d0h11.js +2 -0
  20. package/dist/chunk-3mc9ew9r.js +25 -0
  21. package/dist/chunk-43r0h76m.js +2 -0
  22. package/dist/{chunk-95j8660f.js → chunk-4f8h38xr.js} +2 -2
  23. package/dist/{chunk-16sfjkc4.js → chunk-4jg8ddfy.js} +2 -2
  24. package/dist/chunk-4jh5t3rz.js +2 -0
  25. package/dist/{chunk-v78hjbz0.js → chunk-4nabpd82.js} +5 -5
  26. package/dist/{chunk-z110bf2c.js → chunk-4w203ddt.js} +9 -9
  27. package/dist/chunk-4y2k14ec.js +2 -0
  28. package/dist/chunk-57xcb1wn.js +2 -0
  29. package/dist/chunk-5ekbye3p.js +2 -0
  30. package/dist/chunk-5s1q4y2j.js +2 -0
  31. package/dist/chunk-6359fekc.js +2 -0
  32. package/dist/{chunk-sdmq09jw.js → chunk-66cz2ph7.js} +2 -2
  33. package/dist/chunk-6bm7t0hm.js +3 -0
  34. package/dist/{chunk-xc5esqcb.js → chunk-6ybq9pfh.js} +2 -2
  35. package/dist/{chunk-nhyv3w4r.js → chunk-7767n5k6.js} +1 -1
  36. package/dist/{chunk-0sj79ha5.js → chunk-78j6c3sf.js} +5 -5
  37. package/dist/{chunk-ftvpz1j4.js → chunk-7d0h2pa3.js} +5 -5
  38. package/dist/{chunk-1hbf5e1h.js → chunk-7g720sk3.js} +2 -2
  39. package/dist/chunk-7nshr15z.js +2 -0
  40. package/dist/{chunk-w98yt4d4.js → chunk-875wejw1.js} +2 -2
  41. package/dist/chunk-8g6cmgn8.js +2 -0
  42. package/dist/chunk-8gfdy17b.js +2 -0
  43. package/dist/{chunk-mgj074y2.js → chunk-8vjsmyrk.js} +5 -5
  44. package/dist/chunk-8yx65vb0.js +2 -0
  45. package/dist/{chunk-frpsrv1e.js → chunk-90ps064x.js} +2 -2
  46. package/dist/chunk-91nwc581.js +2 -0
  47. package/dist/{chunk-mt5ewkbg.js → chunk-94001bha.js} +6 -6
  48. package/dist/chunk-94skx5m6.js +2 -0
  49. package/dist/chunk-9aegppj7.js +2 -0
  50. package/dist/{chunk-11c7xg1z.js → chunk-9ch2qhbw.js} +1 -1
  51. package/dist/{chunk-da05660m.js → chunk-9sk596tw.js} +58 -58
  52. package/dist/{chunk-fn1reean.js → chunk-a3qb13vr.js} +20 -20
  53. package/dist/chunk-a5vzdhsk.js +2 -0
  54. package/dist/{chunk-0jdz31q1.js → chunk-a78k8fkg.js} +3 -3
  55. package/dist/{chunk-jr2r2nh5.js → chunk-ag07tdhn.js} +4 -4
  56. package/dist/chunk-amnfd29h.js +7 -0
  57. package/dist/chunk-aqh48tyw.js +2 -0
  58. package/dist/{chunk-fs43342z.js → chunk-avtq2p0c.js} +2 -2
  59. package/dist/{chunk-phzhmnnm.js → chunk-ayrd026n.js} +3 -3
  60. package/dist/{chunk-eptzpvn0.js → chunk-b0kq5mzq.js} +3 -3
  61. package/dist/chunk-b6am4h24.js +2 -0
  62. package/dist/{chunk-dwt2drzf.js → chunk-b9z4nb1v.js} +8 -8
  63. package/dist/{chunk-qsexsrw2.js → chunk-bwnx71s8.js} +5 -5
  64. package/dist/{chunk-2vx2ben8.js → chunk-c3nmjx26.js} +2 -2
  65. package/dist/chunk-cajg2sz0.js +2 -0
  66. package/dist/{chunk-2f5jjxcj.js → chunk-dhx4m7mf.js} +2 -2
  67. package/dist/chunk-dktqmf4t.js +2 -0
  68. package/dist/chunk-dqwxyk1m.js +2 -0
  69. package/dist/chunk-e2kk1d9z.js +2 -0
  70. package/dist/{chunk-ra2tzsvz.js → chunk-e8aqkt1b.js} +6 -6
  71. package/dist/{chunk-1jxkc6d0.js → chunk-e8hvbc53.js} +2 -2
  72. package/dist/{chunk-p3fepzt9.js → chunk-edjzm0vj.js} +3 -3
  73. package/dist/chunk-ee4ejnk2.js +2 -0
  74. package/dist/chunk-eezp4a40.js +2 -0
  75. package/dist/chunk-eh2ynja3.js +2 -0
  76. package/dist/chunk-emk29htn.js +2 -0
  77. package/dist/{chunk-va4xam1q.js → chunk-eqj8nj5c.js} +1 -1
  78. package/dist/{chunk-xnp031ba.js → chunk-f8sh6289.js} +7 -7
  79. package/dist/{chunk-wj9bqkc0.js → chunk-fb1hyhgf.js} +3 -3
  80. package/dist/chunk-fd0vnz09.js +2 -0
  81. package/dist/chunk-fyhtp2nt.js +2 -0
  82. package/dist/{chunk-ywrpmyzj.js → chunk-g2fxp9zp.js} +3 -3
  83. package/dist/chunk-gbct53j0.js +2 -0
  84. package/dist/{chunk-1jvt9t3r.js → chunk-gsm3rk4j.js} +2 -2
  85. package/dist/{chunk-gfp39bzr.js → chunk-gt9bt8xa.js} +2 -2
  86. package/dist/{chunk-ar6jeqmm.js → chunk-gxdy4qjj.js} +4 -4
  87. package/dist/chunk-gxtq25gr.js +2 -0
  88. package/dist/chunk-h1dnjn9g.js +2 -0
  89. package/dist/chunk-h4nqjks2.js +2 -0
  90. package/dist/{chunk-f0sxbgbm.js → chunk-h7z23fpq.js} +2 -2
  91. package/dist/{chunk-cq4cwfqf.js → chunk-hakevnm1.js} +2 -2
  92. package/dist/chunk-hn7fv830.js +2 -0
  93. package/dist/chunk-hx6tr46s.js +1459 -0
  94. package/dist/chunk-jenk04c8.js +2 -0
  95. package/dist/{chunk-ezqfrea9.js → chunk-jfy0r3hx.js} +28 -28
  96. package/dist/{chunk-3jc6yb02.js → chunk-jh007a8k.js} +9 -9
  97. package/dist/chunk-jh1hdq31.js +3 -0
  98. package/dist/{chunk-fzcqw147.js → chunk-jk1hzawb.js} +3 -3
  99. package/dist/{chunk-wm24jx3t.js → chunk-jya12bfn.js} +2 -2
  100. package/dist/chunk-k1qbgpfy.js +2 -0
  101. package/dist/chunk-kgmwja6f.js +2 -0
  102. package/dist/{chunk-91p8p2cc.js → chunk-khf62zkn.js} +6 -6
  103. package/dist/chunk-kppj8rqa.js +2 -0
  104. package/dist/{chunk-vayzmvf5.js → chunk-m3ra99h8.js} +6 -6
  105. package/dist/{chunk-fznjm7qt.js → chunk-m8rzaqm8.js} +2 -2
  106. package/dist/chunk-msvphygp.js +2 -0
  107. package/dist/chunk-mzbejejf.js +2 -0
  108. package/dist/{chunk-8b8az19t.js → chunk-nkgqhb7s.js} +8 -8
  109. package/dist/{chunk-npj20tj9.js → chunk-p17jeqz0.js} +2 -2
  110. package/dist/{chunk-bvqgq18r.js → chunk-p97h91zx.js} +2 -2
  111. package/dist/{chunk-cxsc37fg.js → chunk-pe5sstex.js} +2 -2
  112. package/dist/chunk-pjv4dskp.js +2 -0
  113. package/dist/chunk-pqr4gn9b.js +4 -0
  114. package/dist/{chunk-zv3rn0ch.js → chunk-prj38cyp.js} +6 -6
  115. package/dist/{chunk-5jc9hmwg.js → chunk-pwg544dw.js} +2 -2
  116. package/dist/chunk-pxvp0cc9.js +3 -0
  117. package/dist/{chunk-hhspwfva.js → chunk-q8snpht6.js} +3 -3
  118. package/dist/chunk-q99y5115.js +3 -0
  119. package/dist/chunk-qnytvyy0.js +2 -0
  120. package/dist/{chunk-23x3k751.js → chunk-qzspvwv6.js} +2 -2
  121. package/dist/chunk-r02asm46.js +2 -0
  122. package/dist/chunk-r7zvrh58.js +70 -0
  123. package/dist/chunk-ra35ptjg.js +3 -0
  124. package/dist/chunk-rc4712qh.js +2 -0
  125. package/dist/chunk-rq7sg012.js +33 -0
  126. package/dist/{chunk-302nw40c.js → chunk-rt4gzqs9.js} +1 -1
  127. package/dist/chunk-rx1xw7q2.js +2 -0
  128. package/dist/{chunk-36cz2v8k.js → chunk-rzmephr2.js} +31 -31
  129. package/dist/{chunk-cwcmmgvz.js → chunk-s1x2pc9b.js} +2 -2
  130. package/dist/{chunk-r7y1196g.js → chunk-s3rhbwgf.js} +4 -4
  131. package/dist/{chunk-0asdv3hk.js → chunk-s6w14v6h.js} +2 -2
  132. package/dist/chunk-sdvv8zge.js +3 -0
  133. package/dist/chunk-sgppgy5e.js +20 -0
  134. package/dist/chunk-sk7pptzf.js +38 -0
  135. package/dist/{chunk-w6ydg43d.js → chunk-sk8x8nw8.js} +3 -3
  136. package/dist/chunk-skjm3zdh.js +2 -0
  137. package/dist/{chunk-388xpdw5.js → chunk-t4exh7c9.js} +76 -36
  138. package/dist/{chunk-yq2krsc9.js → chunk-t64mp8x1.js} +6 -6
  139. package/dist/{chunk-8wqhzzkn.js → chunk-tfpd7aht.js} +3 -3
  140. package/dist/chunk-tsnzhke9.js +2 -0
  141. package/dist/{chunk-c13dv3wm.js → chunk-tt6n2mx6.js} +14 -14
  142. package/dist/chunk-txyze88n.js +2 -0
  143. package/dist/chunk-v1t7sees.js +2 -0
  144. package/dist/chunk-vhp5hqwp.js +54 -0
  145. package/dist/{chunk-88fx8xc1.js → chunk-vn3hsx7v.js} +2 -2
  146. package/dist/chunk-vt410s5m.js +2 -0
  147. package/dist/{chunk-mf5cqv1k.js → chunk-w27j0apm.js} +29 -29
  148. package/dist/{chunk-gg715pj6.js → chunk-w5vxzk5j.js} +6 -6
  149. package/dist/chunk-w81a1e14.js +9 -0
  150. package/dist/{chunk-m8n14s3z.js → chunk-wajvxzt0.js} +2 -2
  151. package/dist/chunk-wrva7jes.js +2 -0
  152. package/dist/chunk-ws25jw6x.js +6 -0
  153. package/dist/{chunk-789yp1tg.js → chunk-ww24mxmd.js} +3 -3
  154. package/dist/chunk-xdprx6tx.js +1331 -0
  155. package/dist/chunk-xgv3gy1b.js +2 -0
  156. package/dist/chunk-xjhv5e5f.js +2 -0
  157. package/dist/{chunk-zkwkhesc.js → chunk-xmy75h5v.js} +2 -2
  158. package/dist/chunk-xnvh4jk2.js +21 -0
  159. package/dist/chunk-xtakhmnb.js +2 -0
  160. package/dist/{chunk-2qk2ppgm.js → chunk-y97g0kwc.js} +1 -1
  161. package/dist/chunk-y9f9d4zv.js +2 -0
  162. package/dist/{chunk-p3x84jj0.js → chunk-yfe380a4.js} +2 -2
  163. package/dist/chunk-ygtz9kc7.js +3 -0
  164. package/dist/chunk-yyypc7s3.js +2 -0
  165. package/dist/chunk-z5j4prza.js +2 -0
  166. package/dist/{chunk-ma5ptt4m.js → chunk-z68teecy.js} +2 -2
  167. package/dist/cli.js +38 -38
  168. package/dist/color-mode-boot.d.ts +1 -8
  169. package/dist/color-mode-boot.js +46 -2
  170. package/dist/composables/use-media-query.js +23 -22
  171. package/dist/craft-entry.js +2 -2
  172. package/dist/craft.js +2 -2
  173. package/dist/document-shell.d.ts +2 -0
  174. package/dist/document-shell.js +15 -3
  175. package/dist/document-tags.d.ts +2 -0
  176. package/dist/document-tags.js +9 -0
  177. package/dist/head-injection.d.ts +2 -0
  178. package/dist/head-injection.js +1 -0
  179. package/dist/head.d.ts +2 -0
  180. package/dist/head.js +2 -2
  181. package/dist/native/accessibility.d.ts +1 -1
  182. package/dist/native/accessibility.js +5 -3
  183. package/dist/native/bridge/protocol.d.ts +1 -0
  184. package/dist/native/compiler/html-to-ir.js +15 -1
  185. package/dist/native/compiler/ir.d.ts +8 -0
  186. package/dist/native/components/primitives.d.ts +2 -0
  187. package/dist/native/event-names.js +6 -0
  188. package/dist/native/prop-names.js +3 -1
  189. package/dist/native/runtime/browser-renderer.d.ts +1 -0
  190. package/dist/native/runtime/browser-renderer.js +27 -6
  191. package/dist/native/runtime/craft-bridge.js +1 -0
  192. package/dist/native/runtime/craft.d.ts +3 -0
  193. package/dist/native/runtime/jsc-globals.js +1 -1
  194. package/dist/native/runtime/native-media.js +8 -3
  195. package/dist/native/runtime/shared-screen.js +8 -3
  196. package/dist/native/testing.d.ts +3 -1
  197. package/dist/native/testing.js +35 -1
  198. package/dist/page-head.js +1 -9
  199. package/dist/process.js +6 -3
  200. package/dist/pwa.js +3 -3
  201. package/dist/signal-processing.d.ts +2 -2
  202. package/dist/signal-processing.js +17 -11
  203. package/dist/ssg.js +13 -13
  204. package/dist/types/config-types.d.ts +1 -1
  205. package/dist/utils.js +2 -1
  206. package/dist/variable-extractor.js +6 -1
  207. package/dist/vue-template.d.ts +2 -0
  208. package/dist/vue-template.js +72 -2
  209. package/package.json +6 -6
  210. package/dist/chunk-0adc8x2h.js +0 -9
  211. package/dist/chunk-0atz8fjx.js +0 -20
  212. package/dist/chunk-0fm6avxt.js +0 -3
  213. package/dist/chunk-0v7555tr.js +0 -42
  214. package/dist/chunk-11rnqey0.js +0 -2
  215. package/dist/chunk-1mx3j280.js +0 -2
  216. package/dist/chunk-20hy5p3p.js +0 -2
  217. package/dist/chunk-29v3b5ks.js +0 -2
  218. package/dist/chunk-2cay3heb.js +0 -2
  219. package/dist/chunk-31yx4sjh.js +0 -2
  220. package/dist/chunk-33fnbw33.js +0 -2
  221. package/dist/chunk-357qjcj1.js +0 -3
  222. package/dist/chunk-38kerh2r.js +0 -2
  223. package/dist/chunk-38y11q8x.js +0 -2
  224. package/dist/chunk-3h4db9yb.js +0 -33
  225. package/dist/chunk-3q80f7mt.js +0 -2
  226. package/dist/chunk-43kz6rx9.js +0 -2
  227. package/dist/chunk-43sgpy4e.js +0 -54
  228. package/dist/chunk-4e18r89n.js +0 -3
  229. package/dist/chunk-4pve3r5a.js +0 -2
  230. package/dist/chunk-4vz17ytv.js +0 -68
  231. package/dist/chunk-5afnyvw5.js +0 -2
  232. package/dist/chunk-5d5dxts6.js +0 -2
  233. package/dist/chunk-5fdsyyfe.js +0 -2
  234. package/dist/chunk-67yr4m5h.js +0 -2
  235. package/dist/chunk-6aqr0e6s.js +0 -2
  236. package/dist/chunk-6bw02d1t.js +0 -2
  237. package/dist/chunk-76mn123c.js +0 -2
  238. package/dist/chunk-7ar11ccn.js +0 -2
  239. package/dist/chunk-7fc0vrs5.js +0 -2
  240. package/dist/chunk-82fg5gp6.js +0 -2
  241. package/dist/chunk-89r7bbsk.js +0 -2
  242. package/dist/chunk-8egbh6z1.js +0 -2
  243. package/dist/chunk-8n9jd8cz.js +0 -2
  244. package/dist/chunk-8tfpv6zf.js +0 -6
  245. package/dist/chunk-8x3yaahc.js +0 -2
  246. package/dist/chunk-94qc4zwb.js +0 -2
  247. package/dist/chunk-9928zdej.js +0 -3
  248. package/dist/chunk-9ay18k46.js +0 -2
  249. package/dist/chunk-9kn81bmp.js +0 -2
  250. package/dist/chunk-9tv0tw7f.js +0 -3
  251. package/dist/chunk-9w9y84t5.js +0 -21
  252. package/dist/chunk-a5h9bwrc.js +0 -2
  253. package/dist/chunk-b5qzed8y.js +0 -1323
  254. package/dist/chunk-bej9kz05.js +0 -2
  255. package/dist/chunk-bh2khcet.js +0 -2
  256. package/dist/chunk-bm6y085n.js +0 -25
  257. package/dist/chunk-c6096ssb.js +0 -2
  258. package/dist/chunk-ccgabq3a.js +0 -2
  259. package/dist/chunk-e0tvd7jj.js +0 -2
  260. package/dist/chunk-e5rag6rh.js +0 -3
  261. package/dist/chunk-fvr3h2fr.js +0 -7
  262. package/dist/chunk-gmmqz698.js +0 -2
  263. package/dist/chunk-hxftzw0x.js +0 -2
  264. package/dist/chunk-js1wayhb.js +0 -2
  265. package/dist/chunk-jz37h2z0.js +0 -4
  266. package/dist/chunk-k2t0w8z1.js +0 -2
  267. package/dist/chunk-k8s3hyh2.js +0 -2
  268. package/dist/chunk-kcpxqsdj.js +0 -2
  269. package/dist/chunk-mjr5fkc2.js +0 -2
  270. package/dist/chunk-n4m50dpk.js +0 -1467
  271. package/dist/chunk-na0e3s88.js +0 -2
  272. package/dist/chunk-new89wh2.js +0 -2
  273. package/dist/chunk-nrap20qt.js +0 -2
  274. package/dist/chunk-p9bghe13.js +0 -2
  275. package/dist/chunk-q2cwzgd0.js +0 -2
  276. package/dist/chunk-q60afqr7.js +0 -2
  277. package/dist/chunk-q9yahsww.js +0 -2
  278. package/dist/chunk-qdwtemy1.js +0 -2
  279. package/dist/chunk-qp0ndbk6.js +0 -2
  280. package/dist/chunk-rzsvxjse.js +0 -2
  281. package/dist/chunk-s2c0ynn9.js +0 -2
  282. package/dist/chunk-senrtnx2.js +0 -2
  283. package/dist/chunk-v1wr2vdx.js +0 -2
  284. package/dist/chunk-v6gkjg5f.js +0 -3
  285. package/dist/chunk-wc10m4tp.js +0 -38
  286. package/dist/chunk-wcxa8xy2.js +0 -2
  287. package/dist/chunk-wgrj0cvs.js +0 -2
  288. package/dist/chunk-wpkwx3wq.js +0 -2
  289. package/dist/chunk-wq17dce6.js +0 -2
  290. package/dist/chunk-wvc6eayq.js +0 -2
  291. package/dist/chunk-xa98a901.js +0 -2
  292. package/dist/chunk-xjt5129x.js +0 -2
  293. package/dist/chunk-yc3frw0z.js +0 -3
  294. package/dist/chunk-yn02d599.js +0 -2
@@ -1,9 +1,9 @@
1
1
  // @bun
2
- import"./chunk-b5qzed8y.js";import{qo,Xa,Ga}from"./chunk-fzcqw147.js";import"./chunk-36cz2v8k.js";import"./chunk-0jdz31q1.js";import"./chunk-4vz17ytv.js";import"./chunk-16sfjkc4.js";import"./chunk-phzhmnnm.js";import"./chunk-9928zdej.js";import"./chunk-w98yt4d4.js";import"./chunk-p3x84jj0.js";import"./chunk-2vx2ben8.js";import"./chunk-388xpdw5.js";import"./chunk-mf5cqv1k.js";import"./chunk-xnp031ba.js";import"./chunk-jr2r2nh5.js";import"./chunk-0adc8x2h.js";import"./chunk-t65f98qv.js";import"./chunk-ngqb22wj.js";import"./chunk-n4m50dpk.js";import"./chunk-0v7555tr.js";import"./chunk-43sgpy4e.js";import"./chunk-9w9y84t5.js";import"./chunk-bm6y085n.js";import"./chunk-fs43342z.js";import"./chunk-0vyytd9v.js";import{Xu,Ja,ty,ny,Ya,Ko,ws,Za,Qa,ry,sy,ec,tc,nc,rc}from"./chunk-ezqfrea9.js";import"./chunk-h0aw9hmc.js";import"./chunk-0fm6avxt.js";import"./chunk-9tv0tw7f.js";import"./chunk-8b8az19t.js";import"./chunk-nhyv3w4r.js";import"./chunk-w6ydg43d.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
2
+ import"./chunk-r7zvrh58.js";import{Jo,Za,Qa}from"./chunk-jk1hzawb.js";import"./chunk-rzmephr2.js";import"./chunk-a78k8fkg.js";import"./chunk-4jg8ddfy.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-xdprx6tx.js";import"./chunk-875wejw1.js";import"./chunk-yfe380a4.js";import"./chunk-c3nmjx26.js";import"./chunk-t4exh7c9.js";import"./chunk-w27j0apm.js";import"./chunk-f8sh6289.js";import"./chunk-ag07tdhn.js";import"./chunk-w81a1e14.js";import"./chunk-1pc2p489.js";import"./chunk-0rq1w0xr.js";import"./chunk-hx6tr46s.js";import"./chunk-36j2drjv.js";import"./chunk-vhp5hqwp.js";import"./chunk-xnvh4jk2.js";import"./chunk-3mc9ew9r.js";import"./chunk-avtq2p0c.js";import"./chunk-2qnpr0ty.js";import{Qu,ec,iy,ay,tc,Yo,xs,nc,rc,cy,ly,sc,oc,ic,ac}from"./chunk-jfy0r3hx.js";import"./chunk-29cy41z3.js";import"./chunk-jh1hdq31.js";import"./chunk-2r2tayyd.js";import"./chunk-nkgqhb7s.js";import"./chunk-7767n5k6.js";import"./chunk-sk8x8nw8.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
3
3
  `),scripts:t.scripts.join(`
4
4
  `),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
5
5
  `),scripts:t.scripts.join(`
6
6
  `),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
7
7
  <script data-craft-hydration>
8
8
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
9
- </script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{Xu as CRAFT_BRIDGE_SCRIPT,Ko as CRAFT_COMPONENTS,Za as CRAFT_COMPONENT_RUNTIME,ws as CRAFT_COMPONENT_STYLES,qo as NATIVE_COMPONENTS,ec as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Xa as compileToNative,Ga as createHotReloadServer,tc as findCraftBinary,Ja as generateCraftBridgeScript,V as generateCraftOptimizations,rc as getAvailableFormats,nc as getAvailableTargets,sy as getCraftComponents,G as getSSRCacheStats,Ya as injectCraftBridge,ty as isCraftEnvironment,Y as prerenderForCraft,Qa as processCraftComponents,ny as processCraftDirective,ry as registerCraftComponent,Q as renderSSR};
9
+ </script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{Qu as CRAFT_BRIDGE_SCRIPT,Yo as CRAFT_COMPONENTS,nc as CRAFT_COMPONENT_RUNTIME,xs as CRAFT_COMPONENT_STYLES,Jo as NATIVE_COMPONENTS,sc as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Za as compileToNative,Qa as createHotReloadServer,oc as findCraftBinary,ec as generateCraftBridgeScript,V as generateCraftOptimizations,ac as getAvailableFormats,ic as getAvailableTargets,ly as getCraftComponents,G as getSSRCacheStats,tc as injectCraftBridge,iy as isCraftEnvironment,Y as prerenderForCraft,rc as processCraftComponents,ay as processCraftDirective,cy as registerCraftComponent,Q as renderSSR};
package/dist/craft.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // @bun
2
- import"./chunk-b5qzed8y.js";import{qo,Xa,Ga}from"./chunk-fzcqw147.js";import"./chunk-36cz2v8k.js";import"./chunk-0jdz31q1.js";import"./chunk-4vz17ytv.js";import"./chunk-16sfjkc4.js";import"./chunk-phzhmnnm.js";import"./chunk-9928zdej.js";import"./chunk-w98yt4d4.js";import"./chunk-p3x84jj0.js";import"./chunk-2vx2ben8.js";import"./chunk-388xpdw5.js";import"./chunk-mf5cqv1k.js";import"./chunk-xnp031ba.js";import"./chunk-jr2r2nh5.js";import"./chunk-0adc8x2h.js";import"./chunk-t65f98qv.js";import"./chunk-ngqb22wj.js";import"./chunk-n4m50dpk.js";import"./chunk-0v7555tr.js";import"./chunk-43sgpy4e.js";import"./chunk-9w9y84t5.js";import"./chunk-bm6y085n.js";import"./chunk-fs43342z.js";import"./chunk-0vyytd9v.js";import{Xu,Ja,ty,ny,Ya,Ko,ws,Za,Qa,ry,sy,ec,tc,nc,rc}from"./chunk-ezqfrea9.js";import"./chunk-h0aw9hmc.js";import"./chunk-0fm6avxt.js";import"./chunk-9tv0tw7f.js";import"./chunk-8b8az19t.js";import"./chunk-nhyv3w4r.js";import"./chunk-w6ydg43d.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
2
+ import"./chunk-r7zvrh58.js";import{Jo,Za,Qa}from"./chunk-jk1hzawb.js";import"./chunk-rzmephr2.js";import"./chunk-a78k8fkg.js";import"./chunk-4jg8ddfy.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-xdprx6tx.js";import"./chunk-875wejw1.js";import"./chunk-yfe380a4.js";import"./chunk-c3nmjx26.js";import"./chunk-t4exh7c9.js";import"./chunk-w27j0apm.js";import"./chunk-f8sh6289.js";import"./chunk-ag07tdhn.js";import"./chunk-w81a1e14.js";import"./chunk-1pc2p489.js";import"./chunk-0rq1w0xr.js";import"./chunk-hx6tr46s.js";import"./chunk-36j2drjv.js";import"./chunk-vhp5hqwp.js";import"./chunk-xnvh4jk2.js";import"./chunk-3mc9ew9r.js";import"./chunk-avtq2p0c.js";import"./chunk-2qnpr0ty.js";import{Qu,ec,iy,ay,tc,Yo,xs,nc,rc,cy,ly,sc,oc,ic,ac}from"./chunk-jfy0r3hx.js";import"./chunk-29cy41z3.js";import"./chunk-jh1hdq31.js";import"./chunk-2r2tayyd.js";import"./chunk-nkgqhb7s.js";import"./chunk-7767n5k6.js";import"./chunk-sk8x8nw8.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
3
3
  `),scripts:t.scripts.join(`
4
4
  `),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
5
5
  `),scripts:t.scripts.join(`
6
6
  `),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
7
7
  <script data-craft-hydration>
8
8
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
9
- </script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{Xu as CRAFT_BRIDGE_SCRIPT,Ko as CRAFT_COMPONENTS,Za as CRAFT_COMPONENT_RUNTIME,ws as CRAFT_COMPONENT_STYLES,qo as NATIVE_COMPONENTS,ec as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Xa as compileToNative,Ga as createHotReloadServer,tc as findCraftBinary,Ja as generateCraftBridgeScript,V as generateCraftOptimizations,rc as getAvailableFormats,nc as getAvailableTargets,sy as getCraftComponents,G as getSSRCacheStats,Ya as injectCraftBridge,ty as isCraftEnvironment,Y as prerenderForCraft,Qa as processCraftComponents,ny as processCraftDirective,ry as registerCraftComponent,Q as renderSSR};
9
+ </script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{Qu as CRAFT_BRIDGE_SCRIPT,Yo as CRAFT_COMPONENTS,nc as CRAFT_COMPONENT_RUNTIME,xs as CRAFT_COMPONENT_STYLES,Jo as NATIVE_COMPONENTS,sc as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Za as compileToNative,Qa as createHotReloadServer,oc as findCraftBinary,ec as generateCraftBridgeScript,V as generateCraftOptimizations,ac as getAvailableFormats,ic as getAvailableTargets,ly as getCraftComponents,G as getSSRCacheStats,tc as injectCraftBridge,iy as isCraftEnvironment,Y as prerenderForCraft,rc as processCraftComponents,ay as processCraftDirective,cy as registerCraftComponent,Q as renderSSR};
@@ -22,6 +22,8 @@ export declare function metaDedupKey(m: Record<string, string>): string;
22
22
  * equivalent inside a string literal.
23
23
  */
24
24
  export declare function inlineScriptContent(s: { content?: unknown, type?: unknown }): string;
25
+ /** Serialize the opt-in separately from ordinary HTML attributes. */
26
+ export declare function headScriptAttributes(script: Record<string, unknown>): Record<string, unknown>;
25
27
  /**
26
28
  * Build the attribute string for the shell's `<html>` open tag.
27
29
  *
@@ -1,4 +1,5 @@
1
1
  import { headCloseIndex } from "./document-tags.js";
2
+ import { BEFORE_RUNTIME_SCRIPT_MARKER } from "./head-injection.js";
2
3
  import { generateColorModeBootScript } from "./color-mode-boot.js";
3
4
  export const COMPONENT_WRAPPER_RULE = "[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}", CLOAK_STYLE = `<style data-stx-cloak>[x-cloak]{display:none !important}${COMPONENT_WRAPPER_RULE}</style>`, HTML_ATTRS_MARKER = "data-stx-html-attrs", HTML_CLASS_MARKER = "data-stx-html-class";
4
5
  const SAFE_ATTR_NAME = /^[A-Za-z_:][\w:.-]*$/;
@@ -35,8 +36,19 @@ export function inlineScriptContent(s) {
35
36
  const content = String(s.content), type = typeof s.type === "string" ? s.type.trim().toLowerCase() : "";
36
37
  return /json$|^importmap$/.test(type) ? content.replace(/<\//g, "<\\/") : content;
37
38
  }
39
+ export function headScriptAttributes(script) {
40
+ const { content, beforeRuntime, ...attributes } = script;
41
+ if (beforeRuntime !== !0)
42
+ return attributes;
43
+ const type = String(attributes.type ?? "").trim().toLowerCase();
44
+ if (typeof content !== "string" || !content.trim() || attributes.src || attributes.async || attributes.defer || type && type !== "text/javascript" && type !== "application/javascript")
45
+ throw Error("A beforeRuntime head script must be synchronous inline JavaScript.");
46
+ delete attributes.async;
47
+ delete attributes.defer;
48
+ return { ...attributes, [BEFORE_RUNTIME_SCRIPT_MARKER]: "" };
49
+ }
38
50
  function inlineScriptTag(s) {
39
- const attrs = attrPairs(s, (k) => k === "content");
51
+ const attrs = attrPairs(headScriptAttributes(s));
40
52
  return `<script${attrs ? ` ${attrs}` : ""}>${inlineScriptContent(s)}</script>`;
41
53
  }
42
54
  export function buildHtmlAttrs(htmlAttrs = {}, lang = "en") {
@@ -246,7 +258,7 @@ export function generateDocumentShell(content, headConfig = {}, options = {}) {
246
258
  }).join(`
247
259
  `), configHeadScripts = headScriptTags.map((s) => {
248
260
  if (s.src)
249
- return ` <script ${attrPairs(s, (k) => k === "content")}></script>`;
261
+ return ` <script ${attrPairs(headScriptAttributes(s))}></script>`;
250
262
  if (s.content)
251
263
  return ` ${inlineScriptTag(s)}`;
252
264
  return "";
@@ -338,7 +350,7 @@ export function injectConfigHeadTags(html, headConfig = {}) {
338
350
  if (s.src) {
339
351
  if (head.includes(`src="${s.src}"`))
340
352
  continue;
341
- parts.push(` <script ${attrPairs(s, (k) => k === "content")}></script>`);
353
+ parts.push(` <script ${attrPairs(headScriptAttributes(s))}></script>`);
342
354
  } else if (s.content) {
343
355
  if (head.includes(inlineScriptContent(s)))
344
356
  continue;
@@ -1,3 +1,5 @@
1
+ /** Read an opening tag's attributes with lowercased names and first duplicate wins. */
2
+ export declare function tagAttributes(token: string): Record<string, string>;
1
3
  /** The index of the document's `</head>`, or -1. */
2
4
  export declare function headCloseIndex(html: string): number;
3
5
  /** The index of the document's `</body>`, or -1. */
@@ -1,4 +1,13 @@
1
1
  const RAW_TEXT_OR_TAG = /<!--[\s\S]*?-->|<(script|style|textarea|title)\b[^>]*>[\s\S]*?<\/\1\s*>|<\/(head|body)\s*>/gi;
2
+ export function tagAttributes(token) {
3
+ const attrs = Object.create(null), attributes = token.replace(/^<\w+\b|>$/g, "");
4
+ for (const match of attributes.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)) {
5
+ const name = match[1].toLowerCase();
6
+ if (!(name in attrs))
7
+ attrs[name] = match[2] ?? match[3] ?? match[4] ?? "";
8
+ }
9
+ return attrs;
10
+ }
2
11
  function closeTagIndex(html, tag, which) {
3
12
  if (!html.includes(`</${tag}`) && !html.includes(`</${tag.toUpperCase()}`))
4
13
  return -1;
@@ -52,6 +52,8 @@ export declare function headInsertionPoint(html: string): number | null;
52
52
  *
53
53
  * @module head-injection
54
54
  */
55
+ /** A document-only classic script that runs ahead of the client runtime. */
56
+ export declare const BEFORE_RUNTIME_SCRIPT_MARKER: 'data-stx-before-runtime';
55
57
  /** Fragments waiting to be spliced into one document. */
56
58
  export declare interface HeadInjections {
57
59
  afterOpen: string[]
@@ -1,4 +1,5 @@
1
1
  import { headCloseIndex } from "./document-tags.js";
2
+ export const BEFORE_RUNTIME_SCRIPT_MARKER = "data-stx-before-runtime";
2
3
  export function createHeadInjections() {
3
4
  return { afterOpen: [], beforeClose: [] };
4
5
  }
package/dist/head.d.ts CHANGED
@@ -152,6 +152,7 @@ export declare interface ScriptTag {
152
152
  type?: string
153
153
  async?: boolean
154
154
  defer?: boolean
155
+ beforeRuntime?: boolean
155
156
  content?: string
156
157
  id?: string
157
158
  }
@@ -215,6 +216,7 @@ export declare interface PageMeta {
215
216
  title?: string
216
217
  description?: string
217
218
  status?: number
219
+ cache?: boolean
218
220
  layout?: LayoutName | false
219
221
  middleware?: string | string[]
220
222
  transition?: string | { name: string; mode?: string }
package/dist/head.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { replaceDirectiveCalls, reportDirectiveFailure, splitTopLevelArgs } from "./directive-arguments.js";
2
- import { inlineScriptContent } from "./document-shell.js";
2
+ import { headScriptAttributes, inlineScriptContent } from "./document-shell.js";
3
3
  import { ErrorCodes } from "./error-handling.js";
4
4
  import { resolveMetaArguments } from "./meta-arguments.js";
5
5
  import { normalizeHeadKeys, USE_HEAD_KEYS } from "./head-keys.js";
@@ -162,7 +162,7 @@ export function renderHead(config = currentHead) {
162
162
  parts.push(`<link ${attrs}>`);
163
163
  }
164
164
  for (const script of config.script || []) {
165
- const { content, ...attrs } = script, attrStr = Object.entries(attrs).filter(([_, v]) => v !== void 0).map(([k, v]) => {
165
+ const { content } = script, attrs = headScriptAttributes({ ...script }), attrStr = Object.entries(attrs).filter(([_, v]) => v !== void 0).map(([k, v]) => {
166
166
  if (typeof v === "boolean")
167
167
  return v ? k : "";
168
168
  return `${k}="${escapeHtml(String(v))}"`;
@@ -27,4 +27,4 @@ export declare function accessibilityChanges(props: Record<string, unknown>, bef
27
27
  /** Recover authored native fields from compiler IR before reactive updates. */
28
28
  export declare function authoredAccessibilityProps(props: Record<string, unknown>, source?: Record<string, unknown>): Record<string, unknown>;
29
29
  /** Fields derived from web semantics at the native transport boundary. */
30
- export declare const ACCESSIBILITY_FIELDS: readonly ['accessibilityLabel', 'accessibilityRole', 'accessibilityState', 'accessibilityValue'];
30
+ export declare const ACCESSIBILITY_FIELDS: readonly ['accessibilityLabel', 'accessibilityRole', 'accessibilityState', 'accessibilityValue', 'accessibilityHidden'];
@@ -84,16 +84,18 @@ export function applyStaticAccessibility(props) {
84
84
  if (patch)
85
85
  Object.assign(derived, patch);
86
86
  }
87
- if (stateValue("aria-hidden", props["aria-hidden"]) === !0)
87
+ if (stateValue("aria-hidden", props["aria-hidden"]) === !0 && props.accessibilityHidden !== !1) {
88
88
  derived.accessibilityRole = "none";
89
- for (const key of ["accessibilityLabel", "accessibilityRole", "accessibilityValue"])
89
+ derived.accessibilityHidden = !0;
90
+ }
91
+ for (const key of ["accessibilityLabel", "accessibilityRole", "accessibilityValue", "accessibilityHidden"])
90
92
  if (props[key] === void 0 && derived[key] !== void 0 && derived[key] !== null)
91
93
  props[key] = derived[key];
92
94
  const state = derived.accessibilityState;
93
95
  if (state)
94
96
  props.accessibilityState = { ...state, ...authoredState };
95
97
  }
96
- export const ACCESSIBILITY_FIELDS = ["accessibilityLabel", "accessibilityRole", "accessibilityState", "accessibilityValue"];
98
+ export const ACCESSIBILITY_FIELDS = ["accessibilityLabel", "accessibilityRole", "accessibilityState", "accessibilityValue", "accessibilityHidden"];
97
99
  export function projectAccessibility(props, type) {
98
100
  let relevant = type === "Image";
99
101
  if (!relevant) {
@@ -244,6 +244,7 @@ export declare interface NativeBridgeInterface {
244
244
  viewportWidth?: number
245
245
  viewportHeight?: number
246
246
  reducedMotion?: boolean
247
+ appearance?: { reduceMotion?: boolean }
247
248
  sessionTokenKey?: string
248
249
  shareStorage?: Record<string, string>
249
250
  appURL?: string
@@ -11,18 +11,23 @@ import { extractStylesheetTheme } from "./stylesheet-theme.js";
11
11
  import { applySvgAnimation, parseViewBox, SVG_DROPPED, SVG_NODE_TYPES, SVG_TYPES, svgGeometry } from "./svg.js";
12
12
  import { compileClassStyles } from "./headwind-to-style.js";
13
13
  import { createDocument, createNode } from "./ir.js";
14
- const BROWSER_ONLY_EVENTS = /^(?:key(?:down|up|press)|mouse[a-z]+|pointer[a-z]+|dbl(?:click)?|contextmenu|wheel|drag[a-z]*|drop|copy|cut|paste|beforeinput|compositionstart|compositionupdate|compositionend|animation[a-z]+|transition[a-z]+|resize|hashchange|popstate|beforeunload|unload|visibilitychange|selectionchange|selectstart|auxclick)$/, DROP_SUBTREE = new Set(["script", "style", "head", "meta", "link", "title", "base", "noscript"]), UNWRAP = new Set(["template", "body", "html", "main", "fragment"]), BOX_ONLY = new Set;
14
+ const BROWSER_ONLY_EVENTS = /^(?:key(?:down|up|press)|mouse[a-z]+|pointer[a-z]+|dbl(?:click)?|contextmenu|wheel|drag[a-z]*|drop|copy|cut|paste|beforeinput|compositionstart|compositionupdate|compositionend|animation[a-z]+|transition[a-z]+|resize|hashchange|popstate|beforeunload|unload|visibilitychange|selectionchange|selectstart|auxclick)$/, DROP_SUBTREE = new Set(["script", "style", "head", "meta", "link", "title", "base", "noscript"]), UNWRAP = new Set(["template", "body", "html", "main", "fragment"]), BOX_ONLY = new Set, SURFACE_EVENTS = ["onReady", "onResize", "onLost", "onRestored"];
15
15
  export const NATIVE_EVENTS = new Set([
16
16
  "onBlur",
17
17
  "onChange",
18
18
  "onChangeText",
19
19
  "onDismiss",
20
+ "onDismissComplete",
20
21
  "onEnd",
21
22
  "onEndEditing",
22
23
  "onEndReached",
23
24
  "onError",
24
25
  "onFocus",
25
26
  "onPageSelected",
27
+ "onReady",
28
+ "onResize",
29
+ "onLost",
30
+ "onRestored",
26
31
  "onLayout",
27
32
  "onLoad",
28
33
  "onLoadEnd",
@@ -91,6 +96,7 @@ const NATIVE_TYPES = new Set([
91
96
  "ActivityIndicator",
92
97
  "StatusBar",
93
98
  "RefreshControl",
99
+ "RenderSurface",
94
100
  ...SVG_NODE_TYPES
95
101
  ]), SHARED_RUNTIME_UNSUPPORTED_LIST_PROPS = new Map([
96
102
  ["data", "data"],
@@ -389,6 +395,14 @@ export async function translateHtmlToIR(html, options = {}) {
389
395
  if (names.has(lowerName))
390
396
  diagnostics.push({ kind: "unsupported-list-prop", tag: type, name: publicName });
391
397
  }
398
+ if (type !== "RenderSurface")
399
+ for (const name of SURFACE_EVENTS) {
400
+ if (events[name] === void 0)
401
+ continue;
402
+ delete events[name];
403
+ if (name === "onResize")
404
+ diagnostics.push({ kind: "unread-event", tag, name: "@resize" });
405
+ }
392
406
  const node = createNode(type, props, style, events);
393
407
  node._inlineStyle = inline;
394
408
  node._styleSource = decodeEntities(attributes.find(([name]) => name === "style")?.[1] ?? "");
@@ -246,6 +246,8 @@ export type STXComponentType = | 'Sidebar'
246
246
  | 'MapPolyline'
247
247
  | 'MapPolygon'
248
248
  | 'MapMarker'
249
+ /** A box shared TypeScript draws into, frame by frame (`craft.renderSurface`, craft-native/craft#578). */
250
+ | 'RenderSurface'
249
251
  // Lists
250
252
  | 'FlatList'
251
253
  | 'SectionList'
@@ -283,6 +285,12 @@ export type STXEventType = | 'onPress'
283
285
  | 'onLongPress'
284
286
  | 'onShow'
285
287
  | 'onDismiss'
288
+ | 'onDismissComplete'
289
+ // A RenderSurface's life
290
+ | 'onReady'
291
+ | 'onResize'
292
+ | 'onLost'
293
+ | 'onRestored'
286
294
  | 'onRequestClose'
287
295
  // Gesture events
288
296
  | 'onSwipe'
@@ -43,6 +43,7 @@ export declare interface BaseProps {
43
43
  testID?: string
44
44
  accessibilityLabel?: string
45
45
  accessibilityHint?: string
46
+ accessibilityHidden?: boolean
46
47
  accessibilityValue?: string | number
47
48
  accessibilityState?: AccessibilityState
48
49
  accessibilityRole?: AccessibilityRole
@@ -402,6 +403,7 @@ export declare interface ModalProps extends BaseProps {
402
403
  onRequestClose?: () => void
403
404
  onShow?: () => void
404
405
  onDismiss?: () => void
406
+ onDismissComplete?: () => void
405
407
  }
406
408
  export declare interface ActivityIndicatorProps extends BaseProps {
407
409
  animating?: boolean
@@ -48,6 +48,8 @@ export const NATIVE_EVENT_NAMES = {
48
48
  requestclose: "onRequestClose",
49
49
  show: "onShow",
50
50
  dismiss: "onDismiss",
51
+ "dismiss-complete": "onDismissComplete",
52
+ dismisscomplete: "onDismissComplete",
51
53
  "sliding-complete": "onSlidingComplete",
52
54
  slidingcomplete: "onSlidingComplete",
53
55
  "load-start": "onLoadStart",
@@ -56,6 +58,10 @@ export const NATIVE_EVENT_NAMES = {
56
58
  "load-end": "onLoadEnd",
57
59
  loadend: "onLoadEnd",
58
60
  error: "onError",
61
+ ready: "onReady",
62
+ resize: "onResize",
63
+ lost: "onLost",
64
+ restored: "onRestored",
59
65
  play: "onPlay",
60
66
  playing: "onPlay",
61
67
  pause: "onPause",
@@ -1,6 +1,7 @@
1
1
  import { SVG_PROP_NAMES } from "./compiler/svg.js";
2
2
  const NATIVE_PROP_NAMES = [
3
3
  ...SVG_PROP_NAMES,
4
+ "accessibilityHidden",
4
5
  "accessibilityHint",
5
6
  "accessibilityLabel",
6
7
  "accessibilityRole",
@@ -154,7 +155,8 @@ export const NATIVE_BOOLEAN_PROPS = new Set([
154
155
  "showsScale",
155
156
  "pictureInPicture",
156
157
  "grabberVisible",
157
- "iconOnly"
158
+ "iconOnly",
159
+ "opaque"
158
160
  ]);
159
161
  const nativePropNames = new Map(NATIVE_PROP_NAMES.map((name) => [normaliseKey(name), name]));
160
162
  function normaliseKey(name) {
@@ -11,6 +11,7 @@ declare interface RecordNode {
11
11
  dispose: Array<() => void>
12
12
  layoutObserver?: ResizeObserver
13
13
  layoutObservedParent?: Element
14
+ modalPresentation?: object
14
15
  text?: string
15
16
  }
16
17
  export declare interface BrowserRendererOptions {
@@ -232,7 +232,20 @@ export class BrowserScreenRenderer {
232
232
  this.fire(record, "onRequestClose");
233
233
  }
234
234
  });
235
- listen("close", () => this.fire(record, "onDismiss"));
235
+ if (record.type === "Modal")
236
+ listen("close", () => {
237
+ const presentation = record.modalPresentation;
238
+ this.fire(record, "onDismiss");
239
+ if (!presentation)
240
+ return;
241
+ const dialog = element;
242
+ queueMicrotask(() => {
243
+ if (!dialog.isConnected || dialog.open || record.modalPresentation !== presentation)
244
+ return;
245
+ record.modalPresentation = void 0;
246
+ this.fire(record, "onDismissComplete");
247
+ });
248
+ });
236
249
  listen("scroll", () => this.fire(record, "onScroll", { contentOffset: { x: element.scrollLeft, y: element.scrollTop }, layoutMeasurement: { width: element.clientWidth, height: element.clientHeight }, contentSize: { width: element.scrollWidth, height: element.scrollHeight } }));
237
250
  const videoEvents = { play: "onPlay", pause: "onPause", ended: "onEnd", timeupdate: "onProgress", loadedmetadata: "onLoad", loadstart: "onLoadStart", loadeddata: "onLoadEnd", error: "onError", enterpictureinpicture: "onPictureInPictureStart", leavepictureinpicture: "onPictureInPictureStop" };
238
251
  if (record.type === "Video")
@@ -349,6 +362,10 @@ export class BrowserScreenRenderer {
349
362
  element.setAttribute("aria-description", String(props.accessibilityHint));
350
363
  else
351
364
  element.removeAttribute("aria-description");
365
+ if (props.accessibilityHidden === !0)
366
+ element.setAttribute("aria-hidden", "true");
367
+ else
368
+ element.removeAttribute("aria-hidden");
352
369
  if (type === "Link") {
353
370
  const destination = ["href", "to"].map((name) => props[name]).find((value) => typeof value === "string" && value.trim() !== "");
354
371
  if (destination)
@@ -516,17 +533,21 @@ export class BrowserScreenRenderer {
516
533
  if (dialog.open)
517
534
  dialog.close();
518
535
  css.display = "none";
519
- } else
536
+ } else {
537
+ if (!dialog.open)
538
+ record.modalPresentation = void 0;
520
539
  queueMicrotask(() => {
521
540
  if (!dialog.isConnected || !record.props.visible)
522
541
  return;
523
542
  css.display = "flex";
524
543
  css.flexDirection = "column";
525
- if (!dialog.open) {
526
- dialog.showModal();
527
- this.fire(record, "onShow");
528
- }
544
+ if (dialog.open)
545
+ return;
546
+ record.modalPresentation = {};
547
+ dialog.showModal();
548
+ this.fire(record, "onShow");
529
549
  });
550
+ }
530
551
  }
531
552
  if (type === "ActivityIndicator" || type === "RefreshControl") {
532
553
  element.setAttribute("aria-label", String(props.accessibilityLabel ?? "Loading"));
@@ -21,6 +21,7 @@ function capabilityFlags(capabilities) {
21
21
  files: capabilities.has("files"),
22
22
  media: capabilities.has("media"),
23
23
  biometric: capabilities.has("biometric"),
24
+ renderSurface: capabilities.has("renderSurface"),
24
25
  pushNotifications: capabilities.has("push"),
25
26
  secureStorage: capabilities.has("secureStorage"),
26
27
  storage: capabilities.has("storage"),
@@ -285,6 +285,9 @@ export declare interface NativeCraft {
285
285
  haptic: (style?: string) => Promise<void>
286
286
  clipboard: { write: (text: string) => Promise<unknown>, read: () => Promise<string> }
287
287
  device: { getInfo: () => Promise<Record<string, unknown>> }
288
+ renderSurface?: {
289
+ present: (surface: string, pixels: Uint32Array, width: number, height: number) => boolean
290
+ }
288
291
  biometrics: {
289
292
  isAvailable: () => Promise<boolean>
290
293
  getBiometricType: () => Promise<string | null>
@@ -755,7 +755,7 @@ export function installJSCGlobals(target = globalThis) {
755
755
  width: Number(bridge.viewportWidth) || 0,
756
756
  height: Number(bridge.viewportHeight) || 0,
757
757
  colorScheme: bridge.colorScheme === "dark" ? "dark" : "light",
758
- reducedMotion: bridge.reducedMotion === !0,
758
+ reducedMotion: (bridge.appearance?.reduceMotion ?? bridge.reducedMotion) === !0,
759
759
  pointer: bridge.platform === "macos"
760
760
  });
761
761
  target.__stxNativeMedia = media;
@@ -79,11 +79,16 @@ export function createNativeMedia(initial = {}) {
79
79
  pointer: initial.pointer === !0
80
80
  }, watched = new Set;
81
81
  function matchMedia(query) {
82
- const media = String(query), entry = { list: null, matches: evaluateMediaQuery(media, state), listeners: new Set }, listen = (listener) => {
82
+ const media = String(query), entry = { list: null, matches: evaluateMediaQuery(media, state), listeners: new Set }, watch = () => {
83
+ if (watched.has(entry))
84
+ return;
85
+ entry.matches = evaluateMediaQuery(media, state);
86
+ watched.add(entry);
87
+ }, listen = (listener) => {
83
88
  if (typeof listener !== "function")
84
89
  return;
85
90
  entry.listeners.add(listener);
86
- watched.add(entry);
91
+ watch();
87
92
  }, forget = (listener) => {
88
93
  entry.listeners.delete(listener);
89
94
  if (!entry.listeners.size && !entry.list.onchange)
@@ -101,7 +106,7 @@ export function createNativeMedia(initial = {}) {
101
106
  set onchange(value) {
102
107
  onchange = typeof value === "function" ? value : null;
103
108
  if (onchange)
104
- watched.add(entry);
109
+ watch();
105
110
  else if (!entry.listeners.size)
106
111
  watched.delete(entry);
107
112
  },
@@ -42,12 +42,17 @@ export function prepareSharedNativeScreen(document, manifest, bridge, options =
42
42
  });
43
43
  Object.assign(host, { reportBindingError: createBindingDiagnostics(document.meta.source ?? "native screen") });
44
44
  protocol.on("APPEARANCE", (message) => {
45
- const scheme = message.payload?.colorScheme;
46
- if (scheme === "light" || scheme === "dark") {
45
+ const { colorScheme: scheme, reduceMotion } = message.payload ?? {}, media = globalThis.__stxNativeMedia, hasColorScheme = scheme === "light" || scheme === "dark";
46
+ if (hasColorScheme) {
47
47
  bridge.colorScheme = scheme;
48
48
  host.setColorScheme(scheme);
49
- globalThis.__stxNativeMedia?.update({ colorScheme: scheme });
50
49
  }
50
+ if (typeof reduceMotion === "boolean")
51
+ bridge.reducedMotion = reduceMotion;
52
+ media?.update({
53
+ ...hasColorScheme ? { colorScheme: scheme } : {},
54
+ ...typeof reduceMotion === "boolean" ? { reducedMotion: reduceMotion } : {}
55
+ });
51
56
  });
52
57
  protocol.on("VIEWPORT", (message) => {
53
58
  const width = Number(message.payload?.width);
@@ -44,7 +44,9 @@ export declare interface NativeScreenOptions {
44
44
  snapshots?: Record<string, unknown>
45
45
  snapshotWrite?: (name: string, value: unknown) => Promise<unknown>
46
46
  dialog?: { actionSheet?: (options: any) => Promise<string>, confirm?: (options: any) => Promise<boolean> }
47
+ modalDismissDelayMs?: number
47
48
  colorScheme?: 'light' | 'dark'
49
+ reducedMotion?: boolean
48
50
  viewportWidth?: number
49
51
  params?: Record<string, unknown>
50
52
  routeURL?: string
@@ -102,7 +104,7 @@ export declare interface NativeScreen {
102
104
  appState: (state: 'active' | 'background' | 'inactive') => void
103
105
  background: () => void
104
106
  resume: () => void
105
- appearance: (scheme: 'light' | 'dark') => void
107
+ appearance: (scheme: 'light' | 'dark', reduceMotion?: boolean) => void
106
108
  viewport: (width: number, height?: number) => void
107
109
  appear: () => void
108
110
  disappear: () => void