@stacksjs/stx 0.2.572 → 0.2.574

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 (499) hide show
  1. package/dist/a11y.d.ts +51 -111
  2. package/dist/animation.d.ts +131 -74
  3. package/dist/api-client.d.ts +11 -21
  4. package/dist/api-handler.d.ts +4 -4
  5. package/dist/appearance-bootstrap.d.ts +16 -77
  6. package/dist/application-layers.d.ts +11 -20
  7. package/dist/asset-roots.d.ts +7 -27
  8. package/dist/assets.d.ts +7 -9
  9. package/dist/async-components.d.ts +56 -78
  10. package/dist/auth.d.ts +0 -3
  11. package/dist/browser-core-imports.d.ts +2 -2
  12. package/dist/build-externalize-repeated.d.ts +0 -25
  13. package/dist/build-externalize.d.ts +18 -53
  14. package/dist/build-id.d.ts +40 -28
  15. package/dist/build-message.d.ts +20 -44
  16. package/dist/builtins/attrs.d.ts +0 -14
  17. package/dist/builtins/drawer.d.ts +3 -22
  18. package/dist/builtins/icon.d.ts +17 -19
  19. package/dist/builtins/image-alpha.d.ts +8 -8
  20. package/dist/builtins/image-delivery.d.ts +38 -40
  21. package/dist/builtins/image-placeholder.d.ts +12 -50
  22. package/dist/builtins/image-warmup-worker.d.ts +1 -1
  23. package/dist/builtins/image-worker.d.ts +6 -32
  24. package/dist/builtins/index.d.ts +16 -6
  25. package/dist/builtins/modal.d.ts +13 -23
  26. package/dist/builtins/safe-image.d.ts +2 -42
  27. package/dist/builtins/stx-image.d.ts +44 -24
  28. package/dist/builtins/stx-link.d.ts +5 -8
  29. package/dist/builtins/stx-loading-indicator.d.ts +11 -10
  30. package/dist/builtins/suspense.d.ts +6 -27
  31. package/dist/builtins/toast.d.ts +15 -16
  32. package/dist/builtins/transition-group.d.ts +1 -25
  33. package/dist/caching.d.ts +24 -21
  34. package/dist/{chunk-a6jq7hex.js → chunk-06hx32h4.js} +3 -3
  35. package/dist/{chunk-cyg9w31a.js → chunk-0gt7e1ns.js} +1 -1
  36. package/dist/{chunk-15g5sc0p.js → chunk-0ppzstqj.js} +2 -2
  37. package/dist/{chunk-qcymqscj.js → chunk-0px2ab3m.js} +9 -9
  38. package/dist/chunk-0q5s55km.js +2 -0
  39. package/dist/{chunk-7t3ykgsm.js → chunk-1c8sdf9a.js} +3 -3
  40. package/dist/chunk-1m5pagp3.js +2 -0
  41. package/dist/{chunk-mzqyv7s5.js → chunk-1n9bxdnh.js} +3 -3
  42. package/dist/{chunk-58tz7tmf.js → chunk-1swmxkdt.js} +2 -2
  43. package/dist/{chunk-4easd8da.js → chunk-1x2x3xgc.js} +4 -4
  44. package/dist/chunk-27ja2rpd.js +2 -0
  45. package/dist/chunk-2b0p7am3.js +2 -0
  46. package/dist/{chunk-qj4j547f.js → chunk-30acme5g.js} +2 -2
  47. package/dist/{chunk-1n64749x.js → chunk-32pxa1r0.js} +1 -1
  48. package/dist/{chunk-g66m3g2r.js → chunk-37d52q0d.js} +1 -1
  49. package/dist/{chunk-sfwprq8q.js → chunk-3dr757vb.js} +9 -9
  50. package/dist/chunk-3k6q1481.js +2 -0
  51. package/dist/{chunk-2z0trbbm.js → chunk-3kc7af8c.js} +2 -2
  52. package/dist/chunk-3pr388w5.js +2 -0
  53. package/dist/chunk-42h0kvng.js +2 -0
  54. package/dist/chunk-4eff1v2p.js +2 -0
  55. package/dist/{chunk-gzgc8zk5.js → chunk-4k6cb5fg.js} +5 -5
  56. package/dist/{chunk-s12b57m9.js → chunk-4xvbc0mb.js} +2 -2
  57. package/dist/{chunk-83fdt4yj.js → chunk-501h1mer.js} +4 -4
  58. package/dist/{chunk-tv784gv0.js → chunk-550q827h.js} +2 -2
  59. package/dist/chunk-5n2v9g2c.js +2 -0
  60. package/dist/{chunk-q79kmad5.js → chunk-5xwmkxkk.js} +1 -1
  61. package/dist/chunk-68ygpbta.js +2 -0
  62. package/dist/{chunk-0bt0fbs1.js → chunk-69k5t6pj.js} +52 -52
  63. package/dist/{chunk-232jswfm.js → chunk-6c2y9h5h.js} +1 -1
  64. package/dist/chunk-6gjfres0.js +2 -0
  65. package/dist/chunk-6z57saf5.js +2 -0
  66. package/dist/chunk-71zwgxws.js +2 -0
  67. package/dist/{chunk-b9r88ysg.js → chunk-76437eb4.js} +2 -2
  68. package/dist/{chunk-beqkrwt1.js → chunk-7a0ewpz0.js} +2 -2
  69. package/dist/chunk-7debnvz9.js +2 -0
  70. package/dist/{chunk-jwvzvapp.js → chunk-7gxn7mvd.js} +2 -2
  71. package/dist/{chunk-vp31ff54.js → chunk-7hr63cp5.js} +2 -2
  72. package/dist/{chunk-5t1whxxt.js → chunk-825m59jr.js} +5 -5
  73. package/dist/{chunk-74xwzxwz.js → chunk-8efe5vpm.js} +2 -2
  74. package/dist/{chunk-jqefcghh.js → chunk-8hp6722y.js} +5 -5
  75. package/dist/{chunk-kgj852hx.js → chunk-9yht5n7g.js} +2 -2
  76. package/dist/{chunk-kzjrgh0b.js → chunk-a3w3jc0t.js} +6 -6
  77. package/dist/chunk-a77gbp9x.js +2 -0
  78. package/dist/chunk-ampr3fpv.js +2 -0
  79. package/dist/{chunk-2ads8rw5.js → chunk-b10n7cpe.js} +2 -2
  80. package/dist/{chunk-0q6n3by0.js → chunk-bb5a8adb.js} +3 -3
  81. package/dist/chunk-bgbz0wzq.js +2 -0
  82. package/dist/chunk-bgr7fqhs.js +2 -0
  83. package/dist/chunk-bjfrwcfh.js +2 -0
  84. package/dist/{chunk-9k7bq97t.js → chunk-byhsfnkc.js} +1 -1
  85. package/dist/{chunk-zyk12484.js → chunk-c0ewddb3.js} +2 -2
  86. package/dist/{chunk-b2q8bk8p.js → chunk-c6jyp7ss.js} +2 -2
  87. package/dist/chunk-cdt5pg28.js +2 -0
  88. package/dist/chunk-cfh798k7.js +2 -0
  89. package/dist/{chunk-pnag11c4.js → chunk-cp5903cg.js} +2 -2
  90. package/dist/{chunk-4bgfpkwx.js → chunk-crj0yqc6.js} +1 -1
  91. package/dist/chunk-dax3zkmm.js +2 -0
  92. package/dist/chunk-dn676tdp.js +2 -0
  93. package/dist/chunk-dtbj816p.js +2 -0
  94. package/dist/chunk-e23cg45k.js +2 -0
  95. package/dist/{chunk-qzbzn1yf.js → chunk-e27njk86.js} +12 -12
  96. package/dist/{chunk-vr36s2en.js → chunk-e40qpeg5.js} +2 -2
  97. package/dist/{chunk-q83w8edy.js → chunk-e7pjsrfc.js} +2 -2
  98. package/dist/chunk-ecwpsjpd.js +2 -0
  99. package/dist/{chunk-pqcvh9pp.js → chunk-f0mbj8w9.js} +1 -1
  100. package/dist/chunk-f1zyc84x.js +2 -0
  101. package/dist/{chunk-f4jh9vrj.js → chunk-g8dx2jew.js} +246 -243
  102. package/dist/{chunk-phzs239m.js → chunk-gdxhe7ae.js} +4 -4
  103. package/dist/{chunk-5dmkkvs7.js → chunk-gh0q6jrm.js} +2 -2
  104. package/dist/chunk-h8vk3q9n.js +2 -0
  105. package/dist/{chunk-k7ht6tqe.js → chunk-hq8vxds5.js} +2 -2
  106. package/dist/{chunk-zd01r00t.js → chunk-hqda3vcw.js} +1 -1
  107. package/dist/chunk-j8pamkbh.js +2 -0
  108. package/dist/{chunk-2jjff8kv.js → chunk-jwe7yq8m.js} +5 -5
  109. package/dist/chunk-k5rrp1bt.js +2 -0
  110. package/dist/{chunk-yk3wh2xv.js → chunk-kcq2ed1d.js} +2 -2
  111. package/dist/{chunk-9yar9rfq.js → chunk-ktc1ecsm.js} +1 -1
  112. package/dist/chunk-mfm7ezh6.js +2 -0
  113. package/dist/chunk-mp16jxcg.js +2 -0
  114. package/dist/chunk-myhh1zsm.js +2 -0
  115. package/dist/chunk-n1c9j5qv.js +2 -0
  116. package/dist/{chunk-dcpf6kas.js → chunk-n8hnrgen.js} +6 -6
  117. package/dist/{chunk-36agnyhe.js → chunk-nc0ba89b.js} +6 -6
  118. package/dist/chunk-nf63pk4s.js +2 -0
  119. package/dist/{chunk-1edvsndv.js → chunk-nxw03sy9.js} +2 -2
  120. package/dist/{chunk-jze68d0z.js → chunk-p3xkj7pm.js} +2 -2
  121. package/dist/chunk-p5cry5s7.js +2 -0
  122. package/dist/{chunk-0dz1b6a1.js → chunk-pxk0tpw2.js} +3 -3
  123. package/dist/chunk-qd4snptd.js +2 -0
  124. package/dist/{chunk-h4k3hyny.js → chunk-r5ce7mkg.js} +2 -2
  125. package/dist/chunk-r8qhex33.js +2 -0
  126. package/dist/chunk-rqvn1s52.js +2 -0
  127. package/dist/{chunk-79vdkvhf.js → chunk-sej3ng5k.js} +5 -5
  128. package/dist/chunk-sjsant53.js +2 -0
  129. package/dist/chunk-snzh9z3g.js +3 -0
  130. package/dist/{chunk-ymawe0y5.js → chunk-ss4h5ch3.js} +1 -1
  131. package/dist/{chunk-2crxkm7j.js → chunk-svvavwp2.js} +4 -4
  132. package/dist/{chunk-qt3x1sh3.js → chunk-t79xnvzr.js} +3 -3
  133. package/dist/{chunk-rrj5m9xv.js → chunk-ta50ym5j.js} +2 -2
  134. package/dist/chunk-ty8g61y9.js +2 -0
  135. package/dist/chunk-v1k6w4z5.js +2 -0
  136. package/dist/{chunk-rfnr4xz6.js → chunk-vde4mtfr.js} +2 -2
  137. package/dist/chunk-vm7zv0gc.js +2 -0
  138. package/dist/{chunk-xckzvbvn.js → chunk-vnh550b5.js} +1 -1
  139. package/dist/chunk-vnxc48en.js +2 -0
  140. package/dist/chunk-y7vbwhh7.js +2 -0
  141. package/dist/{chunk-ydx3mfpp.js → chunk-yf90vn5t.js} +6 -6
  142. package/dist/{chunk-6wc2t6cd.js → chunk-yhqhv8mp.js} +13 -13
  143. package/dist/{chunk-s34g3awk.js → chunk-ytf3qkaw.js} +3 -3
  144. package/dist/chunk-yvyypd92.js +2 -0
  145. package/dist/{chunk-c4zpzxex.js → chunk-z33z3rr4.js} +4 -4
  146. package/dist/chunk-zfw39q56.js +2 -0
  147. package/dist/chunk-zpm02e15.js +2 -0
  148. package/dist/chunk-zzr0p4bb.js +2 -0
  149. package/dist/cli.js +18 -18
  150. package/dist/client/directive.d.ts +0 -7
  151. package/dist/client/index.d.ts +1 -0
  152. package/dist/client/signals-appearance-runtime.d.ts +1 -1
  153. package/dist/client/signals-binding-utils-runtime.d.ts +1 -1
  154. package/dist/client/signals-bootstrap-runtime.d.ts +2 -2
  155. package/dist/client/signals-class-runtime.d.ts +1 -1
  156. package/dist/client/signals-component-api-runtime.d.ts +1 -1
  157. package/dist/client/signals-component-hydration-runtime.d.ts +1 -1
  158. package/dist/client/signals-component-props-runtime.d.ts +1 -1
  159. package/dist/client/signals-conditional-chain-runtime.d.ts +1 -1
  160. package/dist/client/signals-conditional-component-runtime.d.ts +1 -1
  161. package/dist/client/signals-container-cleanup-runtime.d.ts +1 -1
  162. package/dist/client/signals-context-runtime.d.ts +1 -1
  163. package/dist/client/signals-cookie-runtime.d.ts +1 -1
  164. package/dist/client/signals-devtools-runtime.d.ts +1 -1
  165. package/dist/client/signals-dialog-runtime.d.ts +1 -1
  166. package/dist/client/signals-dom-ready-runtime.d.ts +1 -1
  167. package/dist/client/signals-drawer-runtime.d.ts +1 -1
  168. package/dist/client/signals-effect-runtime.d.ts +1 -1
  169. package/dist/client/signals-event-shorthand-runtime.d.ts +1 -1
  170. package/dist/client/signals-expression-compiler-runtime.d.ts +1 -1
  171. package/dist/client/signals-expression-runtime.d.ts +1 -1
  172. package/dist/client/signals-fetch-transport-runtime.d.ts +1 -1
  173. package/dist/client/signals-for-runtime.d.ts +1 -1
  174. package/dist/client/signals-globals-runtime.d.ts +1 -1
  175. package/dist/client/signals-handler-runtime.d.ts +1 -1
  176. package/dist/client/signals-head-runtime.d.ts +1 -1
  177. package/dist/client/signals-helpers-runtime.d.ts +1 -1
  178. package/dist/client/signals-host-runtime.d.ts +1 -1
  179. package/dist/client/signals-hydration-audit-runtime.d.ts +1 -1
  180. package/dist/client/signals-hydration-runtime.d.ts +1 -1
  181. package/dist/client/signals-if-chain-runtime.d.ts +1 -1
  182. package/dist/client/signals-if-runtime.d.ts +1 -1
  183. package/dist/client/signals-lazy-hydration-runtime.d.ts +1 -1
  184. package/dist/client/signals-lifecycle-runtime.d.ts +1 -1
  185. package/dist/client/signals-loop-component-remap-runtime.d.ts +1 -1
  186. package/dist/client/signals-loop-conditional-runtime.d.ts +1 -1
  187. package/dist/client/signals-loop-row-runtime.d.ts +1 -1
  188. package/dist/client/signals-manifest-hydration-runtime.d.ts +1 -1
  189. package/dist/client/signals-model-runtime.d.ts +1 -1
  190. package/dist/client/signals-mount-runtime.d.ts +1 -1
  191. package/dist/client/signals-navigation-runtime.d.ts +1 -1
  192. package/dist/client/signals-notify-runtime.d.ts +1 -1
  193. package/dist/client/signals-optimistic-runtime.d.ts +1 -1
  194. package/dist/client/signals-overlay-runtime.d.ts +1 -1
  195. package/dist/client/signals-pipe-runtime.d.ts +1 -1
  196. package/dist/client/signals-proxy-runtime.d.ts +1 -1
  197. package/dist/client/signals-query-runtime.d.ts +1 -1
  198. package/dist/client/signals-reactive-runtime.d.ts +1 -1
  199. package/dist/client/signals-ref-runtime.d.ts +1 -1
  200. package/dist/client/signals-scope-disposal-runtime.d.ts +1 -1
  201. package/dist/client/signals-scope-traversal-runtime.d.ts +1 -1
  202. package/dist/client/signals-show-runtime.d.ts +1 -1
  203. package/dist/client/signals-spa-load-control-runtime.d.ts +1 -1
  204. package/dist/client/signals-spa-load-runtime.d.ts +1 -1
  205. package/dist/client/signals-state-runtime.d.ts +1 -1
  206. package/dist/client/signals-storage-runtime.d.ts +1 -1
  207. package/dist/client/signals-store-registry-runtime.d.ts +1 -1
  208. package/dist/client/signals-style-runtime.d.ts +1 -1
  209. package/dist/client/signals-suspense-runtime.d.ts +1 -1
  210. package/dist/client/signals-timer-runtime.d.ts +1 -1
  211. package/dist/client/signals-toast-runtime.d.ts +1 -1
  212. package/dist/client/signals-tooltip-runtime.d.ts +1 -1
  213. package/dist/client/signals-transition-group-runtime.d.ts +1 -1
  214. package/dist/client/signals-websocket-runtime.d.ts +1 -1
  215. package/dist/client-helpers.d.ts +1 -312
  216. package/dist/client-module-registry.d.ts +4 -27
  217. package/dist/client-parameter-bindings.d.ts +4 -9
  218. package/dist/client-parameter-bindings.js +30 -10
  219. package/dist/client-script-bundler.d.ts +55 -103
  220. package/dist/client-script.d.ts +69 -127
  221. package/dist/client-script.js +4 -7
  222. package/dist/color-mode-boot.d.ts +21 -58
  223. package/dist/component-client-factories.d.ts +8 -9
  224. package/dist/component-contract-checks.d.ts +15 -18
  225. package/dist/component-contract.d.ts +6 -6
  226. package/dist/component-hmr.d.ts +8 -7
  227. package/dist/component-model.d.ts +14 -20
  228. package/dist/component-processing.d.ts +51 -59
  229. package/dist/component-registry.d.ts +28 -99
  230. package/dist/component-renderer.d.ts +19 -16
  231. package/dist/component-resolution.d.ts +8 -8
  232. package/dist/component-tags.d.ts +1 -1
  233. package/dist/composable-loader.d.ts +6 -41
  234. package/dist/composables/use-fetch.d.ts +45 -114
  235. package/dist/composables/use-form.d.ts +2 -56
  236. package/dist/composables/use-intersection-observer.d.ts +1 -1
  237. package/dist/composables.d.ts +75 -74
  238. package/dist/composition-api.d.ts +19 -43
  239. package/dist/computed.d.ts +93 -86
  240. package/dist/conditionals.d.ts +0 -24
  241. package/dist/config.d.ts +30 -24
  242. package/dist/config.js +3 -0
  243. package/dist/craft-bridge.d.ts +1 -467
  244. package/dist/craft-components.d.ts +234 -680
  245. package/dist/craft-entry.js +2 -2
  246. package/dist/craft.js +2 -2
  247. package/dist/csp.d.ts +41 -107
  248. package/dist/database.d.ts +1 -1
  249. package/dist/defer.d.ts +0 -24
  250. package/dist/dev-server/terminal-colors.d.ts +32 -32
  251. package/dist/dev-server/ts-css.d.ts +26 -35
  252. package/dist/dev-server/types.d.ts +33 -29
  253. package/dist/directive-api.d.ts +42 -85
  254. package/dist/directive-arguments.d.ts +14 -39
  255. package/dist/document-shell.d.ts +49 -81
  256. package/dist/dynamic-components.d.ts +0 -9
  257. package/dist/engine-bindings.d.ts +1 -1
  258. package/dist/env.d.ts +26 -0
  259. package/dist/error-boundaries.d.ts +36 -43
  260. package/dist/error-handling.d.ts +1 -1
  261. package/dist/errors/codes.d.ts +43 -51
  262. package/dist/errors/formatter.d.ts +38 -58
  263. package/dist/errors/index.d.ts +61 -5
  264. package/dist/errors/logger.d.ts +40 -114
  265. package/dist/errors/sanitizer.d.ts +28 -53
  266. package/dist/errors/types.d.ts +31 -44
  267. package/dist/events.d.ts +32 -94
  268. package/dist/expressions.d.ts +57 -62
  269. package/dist/find-body-tag.d.ts +5 -34
  270. package/dist/first-script-tag.d.ts +0 -23
  271. package/dist/forms-validation.d.ts +117 -149
  272. package/dist/forms.d.ts +161 -120
  273. package/dist/framework-composables.d.ts +0 -32
  274. package/dist/head-injection.d.ts +30 -32
  275. package/dist/head-keys.d.ts +12 -15
  276. package/dist/head.d.ts +110 -139
  277. package/dist/heatmap.d.ts +76 -152
  278. package/dist/html-masking.d.ts +38 -62
  279. package/dist/hydration-runtime.d.ts +24 -20
  280. package/dist/hydration.d.ts +11 -10
  281. package/dist/i18n.d.ts +34 -95
  282. package/dist/image-optimization/auto-sibling.d.ts +4 -32
  283. package/dist/imported-signals.d.ts +0 -36
  284. package/dist/includes.d.ts +6 -69
  285. package/dist/index.d.ts +2 -1
  286. package/dist/init.d.ts +12 -20
  287. package/dist/internal-markdown.d.ts +8 -12
  288. package/dist/interpolation-context.d.ts +15 -15
  289. package/dist/island-chunking.d.ts +13 -30
  290. package/dist/keep-alive.d.ts +52 -72
  291. package/dist/layout-types.d.ts +2 -27
  292. package/dist/lazy-module.d.ts +0 -10
  293. package/dist/loading-indicator.d.ts +8 -5
  294. package/dist/loop-binding.d.ts +4 -7
  295. package/dist/loops.d.ts +25 -67
  296. package/dist/markdown.d.ts +1 -0
  297. package/dist/media/image/component.d.ts +9 -25
  298. package/dist/media/image/directive.d.ts +1 -15
  299. package/dist/media/image/placeholder.d.ts +9 -20
  300. package/dist/media/image/processor/cache.d.ts +18 -40
  301. package/dist/media/image/processor/index.d.ts +10 -1
  302. package/dist/media/image/processor/optimizer.d.ts +1 -12
  303. package/dist/media/image/processor/responsive.d.ts +6 -16
  304. package/dist/media/image/srcset.d.ts +49 -47
  305. package/dist/media/shared/cache.d.ts +31 -51
  306. package/dist/media/shared/hash.d.ts +0 -7
  307. package/dist/media/types.d.ts +754 -1235
  308. package/dist/media/video/directive.d.ts +1 -15
  309. package/dist/media/video/index.d.ts +17 -39
  310. package/dist/media/video/processor/cache.d.ts +19 -42
  311. package/dist/media/video/processor/index.d.ts +18 -1
  312. package/dist/media/video/processor/streaming.d.ts +10 -17
  313. package/dist/media/video/processor/thumbnail.d.ts +15 -21
  314. package/dist/media/video/processor/transcoder.d.ts +1 -11
  315. package/dist/meta-arguments.d.ts +14 -39
  316. package/dist/method-spoofing.d.ts +0 -7
  317. package/dist/middleware.d.ts +0 -60
  318. package/dist/native/bridge/protocol.d.ts +2 -1
  319. package/dist/native/compiler/headwind-to-style.d.ts +383 -359
  320. package/dist/native/compiler/icons.d.ts +249 -243
  321. package/dist/native/compiler/svg.d.ts +35 -24
  322. package/dist/native/runtime/jsc-globals.d.ts +1 -1
  323. package/dist/native/runtime/native-host.d.ts +1 -1
  324. package/dist/native/runtime/native-host.js +3 -0
  325. package/dist/offline/app-service-worker.d.ts +50 -114
  326. package/dist/offline/kept-store.d.ts +23 -37
  327. package/dist/offline/query-cache.d.ts +55 -126
  328. package/dist/owned-routes.d.ts +0 -31
  329. package/dist/page-response.d.ts +8 -39
  330. package/dist/parser/directive-parser.d.ts +45 -57
  331. package/dist/parser/expression-parser.d.ts +35 -33
  332. package/dist/parser/index.d.ts +39 -4
  333. package/dist/parser/tokenizer.d.ts +49 -61
  334. package/dist/partial-hydration.d.ts +51 -82
  335. package/dist/performance-utils.d.ts +115 -255
  336. package/dist/placeholder.d.ts +9 -18
  337. package/dist/plugin-system.d.ts +115 -264
  338. package/dist/process.d.ts +4 -9
  339. package/dist/process.js +6 -4
  340. package/dist/prop-sentinels.d.ts +11 -11
  341. package/dist/public-env.d.ts +0 -14
  342. package/dist/pwa/directives.d.ts +20 -12
  343. package/dist/pwa/inject.d.ts +0 -10
  344. package/dist/pwa/precache.d.ts +16 -22
  345. package/dist/pwa/service-worker.d.ts +0 -12
  346. package/dist/pwa.js +3 -3
  347. package/dist/reactive-bindings.d.ts +11 -34
  348. package/dist/reactive-tracking.d.ts +0 -36
  349. package/dist/reactive.d.ts +41 -58
  350. package/dist/render-memo.d.ts +5 -23
  351. package/dist/resolve-stx-targets.d.ts +6 -44
  352. package/dist/route-middleware.d.ts +35 -2
  353. package/dist/route-rules.d.ts +10 -13
  354. package/dist/router.d.ts +9 -8
  355. package/dist/routes.d.ts +3 -1
  356. package/dist/runtime-config-server.d.ts +14 -17
  357. package/dist/runtime-config.d.ts +2 -3
  358. package/dist/runtime-globals.d.ts +90 -122
  359. package/dist/runtime-injection.d.ts +0 -8
  360. package/dist/scaffolding.d.ts +30 -26
  361. package/dist/script-emit.d.ts +0 -30
  362. package/dist/script-validation.d.ts +6 -12
  363. package/dist/seo.d.ts +75 -153
  364. package/dist/server-api.d.ts +9 -12
  365. package/dist/server-bindings.d.ts +1 -26
  366. package/dist/server-data.d.ts +4 -5
  367. package/dist/sfc-template.d.ts +8 -8
  368. package/dist/signal-processing.d.ts +37 -53
  369. package/dist/signals-api.d.ts +58 -135
  370. package/dist/signals.d.ts +18 -24
  371. package/dist/site-url.d.ts +31 -28
  372. package/dist/slots.d.ts +20 -86
  373. package/dist/source-signature.d.ts +5 -28
  374. package/dist/ssg.d.ts +158 -337
  375. package/dist/ssg.js +4 -4
  376. package/dist/state-dir.d.ts +4 -4
  377. package/dist/store-loader.d.ts +0 -10
  378. package/dist/story/analytics.d.ts +60 -138
  379. package/dist/story/bookmarks.d.ts +34 -87
  380. package/dist/story/cli.d.ts +69 -123
  381. package/dist/story/collect/scanner.d.ts +0 -4
  382. package/dist/story/collect/tree.d.ts +1 -8
  383. package/dist/story/commands/build.d.ts +6 -11
  384. package/dist/story/commands/dev.d.ts +8 -15
  385. package/dist/story/commands/preview.d.ts +7 -13
  386. package/dist/story/config-watcher.d.ts +13 -20
  387. package/dist/story/config.d.ts +8 -11
  388. package/dist/story/context.d.ts +8 -14
  389. package/dist/story/hmr.d.ts +26 -24
  390. package/dist/story/hot-swap.d.ts +23 -34
  391. package/dist/story/keyboard-shortcuts.d.ts +18 -23
  392. package/dist/story/output.d.ts +44 -46
  393. package/dist/story/performance.d.ts +45 -107
  394. package/dist/story/presets.d.ts +41 -107
  395. package/dist/story/renderer.d.ts +27 -41
  396. package/dist/story/search.d.ts +12 -23
  397. package/dist/story/server.d.ts +11 -21
  398. package/dist/story/setup.d.ts +15 -23
  399. package/dist/story/testing.d.ts +40 -65
  400. package/dist/story/types.d.ts +160 -262
  401. package/dist/streaming.d.ts +57 -119
  402. package/dist/strip-literals.d.ts +1 -25
  403. package/dist/stx-module-imports.d.ts +7 -0
  404. package/dist/stx-virtual-ts.d.ts +102 -253
  405. package/dist/stx-virtual-ts.js +5 -4
  406. package/dist/style-scoping.d.ts +8 -21
  407. package/dist/suspense.d.ts +52 -67
  408. package/dist/teleport.d.ts +0 -22
  409. package/dist/template-syntax-escape.d.ts +8 -8
  410. package/dist/template-tag-balance.d.ts +6 -22
  411. package/dist/testing.d.ts +26 -11
  412. package/dist/theme-tokens.d.ts +388 -134
  413. package/dist/transitions.d.ts +55 -66
  414. package/dist/ts-css-config.d.ts +12 -70
  415. package/dist/types/component-types.d.ts +122 -187
  416. package/dist/types/config-types.d.ts +341 -956
  417. package/dist/types/context-types.d.ts +24 -46
  418. package/dist/types/csp-types.d.ts +66 -70
  419. package/dist/types/directive-types.d.ts +156 -223
  420. package/dist/types/index.d.ts +110 -6
  421. package/dist/types/pwa-types.d.ts +148 -273
  422. package/dist/types.d.ts +1 -0
  423. package/dist/unresolved-identifiers.d.ts +22 -24
  424. package/dist/url-safety.d.ts +32 -32
  425. package/dist/utils.d.ts +21 -36
  426. package/dist/utils.js +6 -2
  427. package/dist/validator.d.ts +26 -28
  428. package/dist/variable-extractor.d.ts +19 -49
  429. package/dist/view-composers.d.ts +81 -80
  430. package/dist/virtual-scrolling.d.ts +82 -101
  431. package/dist/visual-testing.d.ts +10 -9
  432. package/dist/vue-template.d.ts +0 -23
  433. package/dist/web-components/css-scoping.d.ts +11 -21
  434. package/dist/web-components.d.ts +58 -81
  435. package/dist/x-element.d.ts +1 -0
  436. package/package.json +6 -6
  437. package/stx.d.ts +2 -2
  438. package/dist/app-service-worker.d.ts +0 -165
  439. package/dist/chunk-01mxer9s.js +0 -2
  440. package/dist/chunk-09gtbb1w.js +0 -2
  441. package/dist/chunk-0g2ybnht.js +0 -3
  442. package/dist/chunk-15erabm6.js +0 -2
  443. package/dist/chunk-1z6c6dyk.js +0 -2
  444. package/dist/chunk-1zfg1kd5.js +0 -2
  445. package/dist/chunk-279jv0yf.js +0 -2
  446. package/dist/chunk-2a1q5y6r.js +0 -2
  447. package/dist/chunk-2cqbyb8w.js +0 -2
  448. package/dist/chunk-2jsnrfc8.js +0 -2
  449. package/dist/chunk-3gft8zng.js +0 -2
  450. package/dist/chunk-49gwmcrn.js +0 -2
  451. package/dist/chunk-4wfr074d.js +0 -2
  452. package/dist/chunk-5afw7z6v.js +0 -2
  453. package/dist/chunk-5fv4g4et.js +0 -2
  454. package/dist/chunk-604rs9sq.js +0 -2
  455. package/dist/chunk-636sfxyj.js +0 -2
  456. package/dist/chunk-6f4qrd0s.js +0 -2
  457. package/dist/chunk-6va5pe2m.js +0 -2
  458. package/dist/chunk-8k61b4ae.js +0 -2
  459. package/dist/chunk-asbq9cgs.js +0 -2
  460. package/dist/chunk-b7t8jejd.js +0 -2
  461. package/dist/chunk-b894fxfc.js +0 -2
  462. package/dist/chunk-bm2q1srp.js +0 -2
  463. package/dist/chunk-cgwyd9aq.js +0 -2
  464. package/dist/chunk-cvswrbzw.js +0 -2
  465. package/dist/chunk-d8206zbp.js +0 -2
  466. package/dist/chunk-f10299sf.js +0 -2
  467. package/dist/chunk-f1apaqfk.js +0 -2
  468. package/dist/chunk-g6zeqvvb.js +0 -2
  469. package/dist/chunk-ghy82tsc.js +0 -2
  470. package/dist/chunk-jw33eys8.js +0 -2
  471. package/dist/chunk-k6wgh598.js +0 -2
  472. package/dist/chunk-m2a1fxpb.js +0 -2
  473. package/dist/chunk-m6mxqepz.js +0 -2
  474. package/dist/chunk-n6qp05t9.js +0 -2
  475. package/dist/chunk-nn174xjh.js +0 -2
  476. package/dist/chunk-ntgy4e1q.js +0 -2
  477. package/dist/chunk-nw4axkpx.js +0 -2
  478. package/dist/chunk-p5chk3s9.js +0 -2
  479. package/dist/chunk-pw9verqx.js +0 -2
  480. package/dist/chunk-ta8bhz27.js +0 -2
  481. package/dist/chunk-tc5r2vmw.js +0 -2
  482. package/dist/chunk-ts80ktq7.js +0 -2
  483. package/dist/chunk-vyg8bvkt.js +0 -2
  484. package/dist/chunk-xq2ck69k.js +0 -2
  485. package/dist/chunk-y4ajd836.js +0 -2
  486. package/dist/chunk-zddzjd60.js +0 -2
  487. package/dist/chunk-zgxj1q7w.js +0 -2
  488. package/dist/chunk-zs7qhh40.js +0 -2
  489. package/dist/signals-context-runtime.d.ts +0 -2
  490. package/dist/signals-drawer-runtime.d.ts +0 -2
  491. package/dist/signals-host-runtime.d.ts +0 -9
  492. package/dist/signals-loop-conditional-runtime.d.ts +0 -2
  493. package/dist/signals-manifest-hydration-runtime.d.ts +0 -2
  494. package/dist/signals-notify-runtime.d.ts +0 -2
  495. package/dist/signals-optimistic-runtime.d.ts +0 -2
  496. package/dist/signals-overlay-runtime.d.ts +0 -2
  497. package/dist/signals-scope-disposal-runtime.d.ts +0 -2
  498. package/dist/signals-spa-load-control-runtime.d.ts +0 -2
  499. package/dist/signals-storage-runtime.d.ts +0 -2
@@ -1,2 +1,2 @@
1
1
  /** Alert and confirm dialog helpers used by the generated client runtime. */
2
- export declare const SIGNALS_DIALOG_RUNTIME = " // \u2500\u2500 Alert & Confirm dialogs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Styled replacements for window.alert() and window.confirm().\n // Both return Promises and render into a temporary modal overlay.\n\n var _dialogId = 0;\n\n // Modality - the scroll lock, the inert page behind, the one Escape and the\n // one Tab trap - comes from the overlay stack above, which these dialogs\n // share with every other overlay on the page (#1998, stacksjs/stx#2057).\n\n /** Dialogs animate unless the reader asked them not to (#1998 item 5). */\n function _dialogReducedMotion() {\n try {\n return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);\n }\n catch (_e) {\n return false;\n }\n }\n var _dialogIcons = {\n info: '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#2563eb\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/></svg>',\n warning: '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#d97706\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/></svg>',\n error: '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#dc2626\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"/><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"/></svg>',\n success: '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#16a34a\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M9 12l2 2 4-4\"/></svg>',\n question: '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#6366f1\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/></svg>'\n };\n\n function _createDialog(message, options, isConfirm) {\n var opts = options || {};\n var type = opts.type || (isConfirm ? 'question' : 'info');\n var title = opts.title || '';\n var confirmText = opts.confirmText || 'OK';\n var cancelText = opts.cancelText || 'Cancel';\n var id = 'stx-dialog-' + (++_dialogId);\n // Resolve dark from what the APP decided, not only from the OS. stx's own\n // color-mode boot writes a class (default 'dark') and/or an attribute\n // (e.g. data-theme) onto <html>, so an app pinned to light on a dark OS used\n // to get a dark dialog over a light page. An explicit opts.dark wins over\n // both, and the media query stays as the last resort. See #1875.\n var isDark = _resolveDark(opts.dark);\n var bg = isDark ? '#1f2937' : '#ffffff';\n var textColor = isDark ? '#f3f4f6' : '#1f2937';\n var subColor = isDark ? '#9ca3af' : '#6b7280';\n var icon = _dialogIcons[type] || _dialogIcons.info;\n\n return new Promise(function(resolve) {\n // Inline transitions cannot be reached by a stylesheet media query, so the\n // preference is read here instead (#1998 item 5). One matchMedia probe\n // rather than usePreferredReducedMotion(): that returns a signal with a\n // change listener, and an imperative dialog that reads the value once at\n // open time would leak one listener per call.\n var still = _dialogReducedMotion();\n var fade = still ? '' : 'transition:opacity 0.2s ease;';\n var scale = still ? '' : 'transition:transform 0.2s ease;';\n\n var backdrop = document.createElement('div');\n backdrop.id = id;\n backdrop.style.cssText = 'position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:' + (still ? '1' : '0') + ';' + fade + 'font-family:system-ui,-apple-system,sans-serif';\n backdrop.setAttribute('role', 'alertdialog');\n backdrop.setAttribute('aria-modal', 'true');\n\n var panel = document.createElement('div');\n panel.style.cssText = 'max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:' + bg + ';color:' + textColor + ';box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(' + (still ? '1' : '0.95') + ');' + scale + 'text-align:center';\n\n var iconDiv = document.createElement('div');\n iconDiv.style.cssText = 'display:flex;justify-content:center;margin-bottom:1rem';\n iconDiv.innerHTML = icon;\n panel.appendChild(iconDiv);\n\n if (title) {\n var titleEl = document.createElement('h3');\n titleEl.id = id + '-title';\n titleEl.style.cssText = 'margin:0 0 0.5rem;font-size:1.125rem;font-weight:600';\n titleEl.textContent = title;\n panel.appendChild(titleEl);\n // role=alertdialog was announced with no accessible name at all.\n backdrop.setAttribute('aria-labelledby', titleEl.id);\n }\n\n var msgEl = document.createElement('p');\n msgEl.id = id + '-message';\n msgEl.style.cssText = 'margin:0 0 1.25rem;font-size:0.875rem;line-height:1.5;color:' + subColor;\n msgEl.textContent = message;\n panel.appendChild(msgEl);\n backdrop.setAttribute('aria-describedby', msgEl.id);\n if (!title)\n backdrop.setAttribute('aria-label', message);\n\n var btnRow = document.createElement('div');\n btnRow.style.cssText = 'display:flex;gap:0.75rem;justify-content:center';\n\n // Captured before the dialog steals focus, so it can be handed back on\n // close. Without this a keyboard or screen-reader user is dropped at the\n // top of the document every time a dialog closes.\n var previouslyFocused = document.activeElement;\n var closed = false;\n\n function cleanup(result) {\n // Guarded: the escape handler used to be able to fire after a button had\n // already closed the dialog, because the listener outlived it.\n if (closed) return;\n closed = true;\n\n // The fade is 200ms and resolve() is immediate, so for those 200ms a\n // full-viewport element at z-index 999999 was still hit-testing at the\n // centre of the screen - after the caller's await had already returned\n // (#1998 item 6). Fading out is right; swallowing clicks is not.\n backdrop.style.pointerEvents = 'none';\n backdrop.style.opacity = '0';\n if (!still) panel.style.transform = 'scale(0.95)';\n setTimeout(function() { backdrop.remove(); }, still ? 0 : 200);\n\n // Out of the stack BEFORE resolving, so a caller that opens another\n // dialog the moment this one answers does not land under a backdrop\n // that is still fading. That also unlocks the page and clears inert\n // when this was the last overlay, hands modality back to the one\n // underneath when it was not, and gives focus back to the opener.\n overlays.close(id);\n resolve(result);\n }\n\n // Declared out here rather than inside the branch: the focus decision\n // below needs to know whether a Cancel button exists at all.\n var cancelBtn = null;\n if (isConfirm) {\n cancelBtn = document.createElement('button');\n cancelBtn.textContent = cancelText;\n cancelBtn.style.cssText = 'padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:1px solid ' + (isDark ? '#374151' : '#d1d5db') + ';background:transparent;color:' + textColor + ';transition:background 0.15s';\n cancelBtn.onmouseover = function() { this.style.background = isDark ? '#374151' : '#f3f4f6'; };\n cancelBtn.onmouseout = function() { this.style.background = 'transparent'; };\n cancelBtn.onclick = function() { cleanup(false); };\n btnRow.appendChild(cancelBtn);\n }\n\n var okBtn = document.createElement('button');\n okBtn.textContent = confirmText;\n var btnColor = type === 'error' ? '#dc2626' : type === 'warning' ? '#d97706' : '#5672cd';\n okBtn.style.cssText = 'padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:none;background:' + btnColor + ';color:#fff;transition:opacity 0.15s';\n okBtn.onmouseover = function() { this.style.opacity = '0.9'; };\n okBtn.onmouseout = function() { this.style.opacity = '1'; };\n okBtn.onclick = function() { cleanup(isConfirm ? true : undefined); };\n btnRow.appendChild(okBtn);\n\n panel.appendChild(btnRow);\n backdrop.appendChild(panel);\n document.body.appendChild(backdrop);\n\n // Animate in\n if (!still) {\n void backdrop.offsetHeight;\n backdrop.style.opacity = '1';\n panel.style.transform = 'scale(1)';\n }\n\n\n /*\n * Initial focus, which was an unconditional okBtn.focus() (#1998 item 3).\n *\n * type: 'error' already paints that button red, so the API knows the\n * action is destructive - and still handed it the keyboard, where a stray\n * Enter or Space confirmed the delete. An error-type confirm now defaults\n * to Cancel, and defaultFocus overrides either way.\n *\n * An alert has only one button, so it keeps it: there is nothing\n * destructive to land on and focus has to go somewhere inside the trap.\n */\n var focusTarget = okBtn;\n if (isConfirm && cancelBtn) {\n var want = opts.defaultFocus;\n if (want === 'cancel' || (!want && type === 'error')) focusTarget = cancelBtn;\n else if (want === 'confirm') focusTarget = okBtn;\n }\n\n // Onto the overlay stack, which locks the page, makes it inert behind\n // this backdrop, traps Tab inside the panel and answers Escape for\n // whichever dialog is on top - so one Escape answers one dialog\n // (#1998 item 4) and a component Dialog underneath stays open.\n overlays.open(id, {\n panel: panel,\n root: backdrop,\n initialFocus: focusTarget,\n opener: previouslyFocused,\n onEscape: function() { cleanup(isConfirm ? false : undefined); }\n });\n });\n }\n\n function stxAlert(message, options) {\n return _createDialog(message, options, false);\n }\n\n function stxConfirm(message, options) {\n return _createDialog(message, options, true);\n }\n";
2
+ export declare const SIGNALS_DIALOG_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** DOM-ready initialization used by the generated client runtime. */
2
- export declare const SIGNALS_DOM_READY_RUNTIME = " // ==========================================================================\n // Auto-initialization\n // ==========================================================================\n\n // A dev runtime may be evaluated again by HMR, an embed, or a test harness.\n // Replace the previous listener so only the latest runtime closure can own\n // componentScope and reactive subscriptions.\n if (window.__stxDomReadyHandler) {\n document.removeEventListener('DOMContentLoaded', window.__stxDomReadyHandler);\n }\n const stxDomReadyHandler = () => {\n console.log('[stx] DOMContentLoaded fired \u2014 processing scopes');\n // Track which scoped elements have been processed\n const processedScopes = new Set();\n\n // Layout expansion can remove the data-stx marker from a page's first\n // element while leaving markers owned by the layout itself. The generated\n // page setup is still queued explicitly, so adopt it when its own marker\n // did not survive.\n const latestSetup = window.stx._latestSetup;\n const latestSetupName = typeof latestSetup === 'function' ? latestSetup.name : '';\n const hasLatestSetupMarker = latestSetupName && Array.from(document.querySelectorAll('[data-stx]'))\n .some(el => el.getAttribute('data-stx') === latestSetupName);\n if (latestSetup && !hasLatestSetupMarker) {\n try {\n const result = latestSetup();\n if (typeof result === 'object' && result !== null)\n Object.assign(componentScope, result);\n }\n catch (e) {\n console.error('[stx] initial setup error:', e);\n }\n }\n\n // Register page setup before mounting child components. Projected slot\n // content belongs to the caller, so child mounts need the caller's signals\n // available when they walk their own rendered roots.\n document.querySelectorAll('[data-stx]').forEach(el => {\n const setupName = el.getAttribute('data-stx');\n console.log('[DOMContentLoaded] data-stx:', setupName, 'el:', el.tagName, 'fn exists:', !!(setupName && window[setupName]));\n if (setupName && window[setupName]) {\n // Contained, like the two sibling setup call sites. An uncaught throw\n // here aborted the whole forEach and everything after it in this\n // handler, so ONE bad name in ONE page's setup left every root on the\n // page unhydrated \u2014 the user sees raw {{ }}, and the console names the\n // identifier without saying it cost them the document (#1805).\n try {\n const result = window[setupName]();\n console.log('[DOMContentLoaded] setup returned:', result ? Object.keys(result).slice(0, 10) : 'null');\n if (typeof result === 'object' && result !== null) {\n Object.assign(componentScope, result);\n }\n }\n catch (e) {\n console.error('[stx] page setup \"' + setupName + '\" threw; this root will not hydrate:', e);\n }\n }\n });\n var pageScopeSnapshot = { ...componentScope };\n\n /*\n * Any x-data scope the reactive bridge did not reach, initialized here.\n *\n * The bridge script addresses each scope by a selector it generated, and\n * that numbering restarts per render - so a page carrying three component\n * islands emits three scripts all looking for the same scope id, and two of\n * the three scopes are never initialized at all. The symptom is the\n * quietest one available: the markup is there, every binding shows its\n * initial value, and whatever x-init was meant to start never starts.\n *\n * Registered scopes are skipped, so the bridge stays authoritative where it\n * did run and this only picks up what it missed. The init expression is\n * read from data-stx-xinit, which the server preserves for exactly this.\n *\n * No backticks in this comment, deliberately: it lives inside the runtime\n * source that is embedded as a template literal, and one would end the\n * literal and take the whole file's syntax with it.\n */\n if (window.__stx_reactive && window.__stx_reactive.initScope) {\n document.querySelectorAll('[data-stx-xdata]').forEach(function(el) {\n var scopeId = el.getAttribute('data-stx-scope');\n if (scopeId && window.stx._scopes && window.stx._scopes[scopeId]) return;\n if (el.__stx_scope_initialized) return;\n\n var xdata = el.getAttribute('data-stx-xdata');\n if (!xdata) return;\n\n if (!scopeId) {\n scopeId = '__stx_scope_island_' + (++window.stx._scopeCounter);\n el.setAttribute('data-stx-scope', scopeId);\n }\n\n el.__stx_scope_initialized = true;\n\n try {\n window.__stx_reactive.initScope(el, xdata, [], {}, el.getAttribute('data-stx-xinit') || null);\n }\n catch (e) {\n console.error('[stx] island scope init error:', e);\n }\n });\n }\n\n // Process mount queue (from stx.mount() calls during loading) only after\n // caller setup is available for Vue-style projected slot ownership.\n mountQueue.forEach(function(fn) { fn(); });\n mountQueue = [];\n\n // A queued layout mount owns a separate $refs map and merges it into the\n // compatibility scope. Page useRef accessors already captured the page's\n // map during setup; bind its DOM back into that same map before onMount.\n // Keep the layout's other exposed names available for legacy bindings.\n componentScope.$refs = pageScopeSnapshot.$refs;\n\n // Bind page roots after child components have registered their local scope.\n document.querySelectorAll('[data-stx]').forEach(el => {\n console.log('[DOMContentLoaded] processElement on:', el.tagName, 'scope keys:', Object.keys(componentScope).slice(0, 10));\n var disposeEffects = trackEffects(function() {\n // The server's list when the page shipped one, the walk otherwise.\n if (!processFromManifest(el, componentScope, window.__stx_bindings)) processElement(el);\n });\n el.__stx_disposers = disposeEffects;\n\n // Remove x-cloak after bindings are applied (prevents FOUC)\n el.removeAttribute('x-cloak');\n el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });\n\n runMountCallbacks(mountCallbacks, destroyCallbacks);\n });\n\n // Multi-root fragment fix: a no-body> setup page tags only the FIRST\n // top-level element with data-stx (signal-processing.ts marks one element),\n // so sibling root elements were orphaned \u2014 their :if / :for / {{ }} / x-text\n // never hydrated, which read as \"{{ }} doesn't work under :if/:for\". The\n // setup(s) above already populated the shared global componentScope, so\n // process each un-hydrated sibling root under that same scope \u2014 same signals,\n // so cross-root state stays coupled.\n var stxRoots = document.querySelectorAll('[data-stx]');\n if (stxRoots.length && Object.keys(componentScope).length) {\n var rootParent = stxRoots[0].parentNode;\n if (rootParent && rootParent.children) {\n Array.prototype.slice.call(rootParent.children).forEach(function(sib) {\n if (sib.nodeType !== 1) return;\n if (sib.hasAttribute('data-stx') || sib.hasAttribute('data-stx-scope')) return;\n if (sib.tagName === 'SCRIPT' || sib.tagName === 'STYLE') return;\n if (sib.__stx_disposers) return; // already processed\n var disposeSib = trackEffects(function() { processElement(sib); });\n sib.__stx_disposers = disposeSib;\n sib.removeAttribute('x-cloak');\n sib.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });\n });\n }\n }\n\n // Process scoped components FIRST (their scripts have already registered scope variables)\n var allScopes = document.querySelectorAll('[data-stx-scope]');\n console.log('[stx] found', allScopes.length, 'data-stx-scope elements');\n allScopes.forEach(el => {\n const scopeId = el.getAttribute('data-stx-scope');\n console.log('[stx] scope:', scopeId, 'registered:', !!(window.stx._scopes && window.stx._scopes[scopeId]), 'el:', el.tagName);\n processedScopes.add(el);\n\n const scopeVars = window.stx._scopes && window.stx._scopes[scopeId];\n // Record the element this scope is bound to so cleanupContainer can tell a\n // dead registry entry (element replaced by an SPA swap) from a live one.\n // See sweepOrphanedScopes / #1775.\n if (scopeVars) scopeVars.__el = el;\n\n // Deferred island (#1746): its setup script (type=\"stx/island\") hasn't run\n // yet, so the scope isn't registered. Arm the hydration trigger anyway \u2014\n // processElement sees stx-hydrate and defers; deferHydration's run()\n // executes the script (registering the scope + running side-effectful\n // setup like fetches) and binds on the trigger. Reveal the HTML now.\n var isDeferredIsland = !scopeVars && el.hasAttribute && el.hasAttribute('stx-hydrate')\n && !!document.querySelector('script[data-stx-island=\"' + scopeId + '\"]');\n if (isDeferredIsland) {\n processElement(el);\n el.removeAttribute('x-cloak');\n el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });\n return;\n }\n\n if (!scopeVars) return;\n\n // Forwarded props and events belong to the caller. Capture its scope\n // before this component's locals are merged, so identical child names\n // cannot shadow expressions such as :total-items=\"totalItems\".\n el.__stx_parent_scope = el.__stx_parent_scope\n || resolveComponentCallerScope(el, pageScopeSnapshot);\n bindParentComponentProps(el, el.__stx_parent_scope);\n\n // Merge component scope vars into componentScope (don't restore - keep for head elements)\n // This ensures expressions can access component variables even for elements\n // where findElementScope might not work (e.g., cloned elements not yet in DOM)\n if (scopeVars) {\n componentScope = { ...componentScope, ...scopeVars };\n }\n\n console.log('[stx] calling processElement on scope:', scopeId, 'componentScope keys:', Object.keys(componentScope).length, 'scopeVars keys:', Object.keys(scopeVars).length);\n var disposeEffects = trackEffects(function() { processElement(el); });\n el.__stx_disposers = disposeEffects;\n console.log('[stx] scope processed OK:', scopeId);\n\n // Remove x-cloak after bindings are applied\n el.removeAttribute('x-cloak');\n el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });\n\n // Run scope-specific mount callbacks (mark mounted so _handleStxLoad\n // doesn't re-fire onMount on persistent layout scopes \u2014 see #1697).\n // EXCEPT when this scope's hydration is deferred (stx-hydrate, e.g. a\n // client=visible|idle island, #1746): processElement above only SCHEDULED\n // the work, so onMount must fire when the trigger actually hydrates the\n // scope, not now. deferHydration's run() flushes it then.\n var scopeDeferred = el.hasAttribute && el.hasAttribute('stx-hydrate') && !el.__stx_hydrated;\n // A component behind a false :if is in the document's MARKUP but not in\n // the document: bindIf detached the subtree before this walk reached it,\n // while the component's own setup script already ran and queued its\n // onMount. Mounting it from here anyway is what made being mounted\n // unusable as an open state (stacksjs/stx#2036) -- three gated modal\n // shells each locked body scroll and registered an Escape handler before\n // anything had been opened, so the page could not be scrolled and Escape\n // reached whichever instance registered last.\n //\n // Left unmounted rather than mounted-and-torn-down, so hydrateComponentScopes\n // flushes it when bindIf shows the subtree -- the same deferral\n // stx-hydrate uses above, and the same flush an island gets.\n var scopeDetached = el.isConnected === false;\n if (scopeVars && scopeVars.__mountCallbacks && !scopeVars.__mounted && !scopeDeferred && !scopeDetached) {\n scopeVars.__mounted = true;\n runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));\n }\n });\n\n // Run global mount callbacks (from partial <script client> blocks that call onMount)\n // These are pushed during script execution, before DOMContentLoaded\n console.log('[stx] running global mountCallbacks:', mountCallbacks.length);\n runMountCallbacks(mountCallbacks, destroyCallbacks);\n mountCallbacks.length = 0;\n\n // Auto-process elements with data-stx-auto (skip already processed scoped elements)\n document.querySelectorAll('[data-stx-auto]').forEach(el => {\n // Process element but skip children that are in scoped containers\n processElementSkipScopes(el, processedScopes);\n\n // Remove x-cloak after bindings are applied\n el.removeAttribute('x-cloak');\n el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });\n });\n\n // Process head> elements (title, meta) that may contain {{ }} expressions\n // Use componentScope which now contains variables from processed components\n const headElements = document.querySelectorAll('head title, head meta[content]');\n headElements.forEach(el => {\n if (el.tagName === 'TITLE') {\n const text = el.textContent;\n if (text && text.includes('{{')) {\n effect(() => {\n try {\n let result = text;\n const matches = text.match(/\\{\\{\\s*(.+?)\\s*\\}\\}/g);\n if (matches) {\n matches.forEach(match => {\n const expr = match.replace(/^\\{\\{\\s*|\\s*\\}\\}$/g, '');\n const fn = __stxCompileScoped(componentScope, [], 'return ' + expr);\n const value = fn(...__stxArgs(fn, componentScope));\n result = result.replace(match, value != null ? value : '');\n });\n }\n el.textContent = result;\n }\ncatch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Title expression error:', e);\n }\n });\n }\n }\nelse if (el.tagName === 'META') {\n const content = el.getAttribute('content');\n if (content && content.includes('{{')) {\n // Skip build-time placeholders like {{__TITLE__}}\n const hasOnlyPlaceholders = !content.replace(/\\{\\{\\s*__[A-Z_]+__\\s*\\}\\}/g, '').includes('{{');\n if (hasOnlyPlaceholders) return;\n effect(() => {\n try {\n let result = content;\n const matches = content.match(/\\{\\{\\s*(.+?)\\s*\\}\\}/g);\n if (matches) {\n matches.forEach(match => {\n const expr = match.replace(/^\\{\\{\\s*|\\s*\\}\\}$/g, '');\n if (/^__[A-Z_]+__$/.test(expr.trim())) return;\n const fn = __stxCompileScoped(componentScope, [], 'return ' + expr);\n const value = fn(...__stxArgs(fn, componentScope));\n result = result.replace(match, value != null ? value : '');\n });\n }\n el.setAttribute('content', result);\n }\ncatch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Meta expression error:', e);\n }\n });\n }\n }\n });\n\n // Everything that should have hydrated has now had its chance (#1773).\n auditHydration(document.body, 'DOMContentLoaded');\n };\n window.__stxDomReadyHandler = stxDomReadyHandler;\n console.log('[stx] registering DOMContentLoaded handler');\n document.addEventListener('DOMContentLoaded', stxDomReadyHandler);\n";
2
+ export declare const SIGNALS_DOM_READY_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Drawer controls used by the generated client runtime. */
2
- export declare const SIGNALS_DRAWER_RUNTIME = " // \u2500\u2500 Drawer system \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Same pattern as modal but slides from a side\n var drawer = {\n open: function(id) {\n var el = document.querySelector('[data-stx-drawer=\"' + id + '\"]');\n if (!el) { console.warn('[stx:drawer] Drawer \"' + id + '\" not found'); return; }\n el.style.display = 'flex';\n // Force reflow then animate\n void el.offsetHeight;\n el.setAttribute('data-stx-drawer-open', '');\n // The lock, Escape for the topmost and the Tab trap come from the\n // overlay stack, shared with every other overlay (stacksjs/stx#2057).\n // Each drawer used to bind its own Escape and set body overflow itself,\n // so two open closed together and the first to close unlocked the page.\n overlays.open('stx-drawer:' + id, {\n panel: el,\n onEscape: el.getAttribute('data-close-escape') !== 'false' ? function() { drawer.close(id); } : null\n });\n if (el.getAttribute('data-close-backdrop') !== 'false') {\n el.onclick = function(e) { if (e.target === el) drawer.close(id); };\n }\n },\n close: function(id) {\n var el = document.querySelector('[data-stx-drawer=\"' + id + '\"]');\n if (!el) return;\n el.removeAttribute('data-stx-drawer-open');\n el.onclick = null;\n overlays.close('stx-drawer:' + id);\n setTimeout(function() {\n if (!el.hasAttribute('data-stx-drawer-open')) el.style.display = 'none';\n }, 300);\n },\n toggle: function(id) {\n var el = document.querySelector('[data-stx-drawer=\"' + id + '\"]');\n if (el && el.hasAttribute('data-stx-drawer-open')) drawer.close(id);\n else drawer.open(id);\n }\n };\n";
2
+ export declare const SIGNALS_DRAWER_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Effects, batching, tracking, and signal utility helpers for the client runtime. */
2
- export declare const SIGNALS_EFFECT_RUNTIME = " // ==========================================================================\n // Effect\n // ==========================================================================\n\n function effect(fn, options = {}) {\n let cleanup;\n let isDisposed = false;\n\n const runEffect = () => {\n if (isDisposed) return;\n if (__stxDevtoolsTracking) { runEffect._runCount++; __stxDevtoolsStats.effectRuns++; }\n if (cleanup) {\n const pending = cleanup;\n cleanup = undefined;\n try { pending(); }\n catch (e) { console.error('[stx] effect cleanup error:', e); }\n }\n const prev = activeEffect;\n activeEffect = runEffect;\n effectStack.push(runEffect);\n try {\n // Only a FUNCTION is a cleanup. An effect body is an expression as\n // often as it is a block, and an expression has a value: an effect\n // written as an arrow assigning to textContent returns the assigned\n // string. Storing that and calling it on the next run threw\n // \"cleanup is not a function\" from the line above \u2014 outside this try,\n // so it escaped runEffect entirely and propagated out of whatever\n // .set() triggered the notification, taking unrelated subscribers with\n // it. Only ever on the second run, which is why it read as correct.\n var __result = fn();\n cleanup = typeof __result === 'function' ? __result : undefined;\n }\n catch (e) {\n // Auto-dispose effects that fail \u2014 prevents zombie subscriptions\n // from body-level processElement walking into mount-scoped content.\n isDisposed = true;\n // Only log if this is likely a real error, not a stale SPA effect.\n // Stale effects reference variables from a previous page's scope that no longer exist.\n //\n // Reported, never re-thrown. Re-thrown, it escaped the .set() that ran\n // this effect, and that set() stopped notifying everything after it:\n // a list half-rendered with raw {{ }} and no click handlers, a\n // selection that moved while the view it drives did not, and nothing\n // in the console, because the exception ended inside an event handler\n // or a native callback. One broken effect took the page with it.\n if (e instanceof ReferenceError) {\n // Silently dispose \u2014 this is expected during SPA navigation when\n // old effects fire against the new page's scope.\n } else {\n console.error('[stx] effect error (the effect is disposed):', e);\n }\n }\n finally {\n effectStack.pop();\n activeEffect = prev;\n }\n };\n\n runEffect._isStxEffect = true; // DevTools\n runEffect._stxId = ++__stxEffectId; // DevTools: stable effect id\n runEffect._runCount = 0; // DevTools: times this effect re-ran (when tracking)\n\n if (options.immediate !== false) runEffect();\n const dispose = () => {\n isDisposed = true;\n // Idempotent. A removed :for row is disposed on removal, and the page\n // tracker that collected its effects on first render still holds the\n // same disposer, which cleanupContainer calls on SPA navigation (#1954).\n // Clearing cleanup before calling it stops that second call running it\n // twice.\n if (cleanup) {\n const pending = cleanup;\n cleanup = undefined;\n pending();\n }\n };\n // Auto-register with active tracker\n if (activeDisposers) activeDisposers.push(dispose);\n return dispose;\n }\n\n // ==========================================================================\n // Effect Tracking\n // ==========================================================================\n\n function trackEffects(fn) {\n var parentDisposers = activeDisposers;\n var disposers = [];\n activeDisposers = disposers;\n try {\n fn();\n }\nfinally {\n activeDisposers = parentDisposers;\n if (parentDisposers) {\n disposers.forEach(function(d) { parentDisposers.push(d); });\n }\n }\n return function disposeAll() {\n disposers.forEach(function(d) { try { d(); }\ncatch (e) { console.warn('[stx] dispose error:', e); } });\n disposers.length = 0;\n };\n }\n\n // ==========================================================================\n // Batch\n // ==========================================================================\n\n function batch(fn) {\n if (isBatching) {\n fn();\n return;\n }\n isBatching = true;\n // finally: a throw inside fn left isBatching set for good, and every later\n // update was queued for a flush that never came - the page stopped.\n try {\n fn();\n }\n finally {\n isBatching = false;\n const queued = Array.from(pendingEffects);\n pendingEffects.clear();\n queued.forEach(e => e());\n }\n }\n\n // ==========================================================================\n // Utilities\n // ==========================================================================\n\n function isSignal(v) {\n return typeof v === 'function' && v._isSignal === true;\n }\n\n // The derived brand is set at creation; this predicate was declared and\n // auto-imported for years without ever existing here (#1804).\n function isDerived(v) {\n return typeof v === 'function' && v._isDerived === true;\n }\n\n function untrack(v) {\n return isSignal(v) || (typeof v === 'function' && v._isDerived) ? v() : v;\n }\n\n function peek(fn) {\n const prev = activeEffect;\n activeEffect = null;\n try {\n return fn();\n }\nfinally {\n activeEffect = prev;\n }\n }\n";
2
+ export declare const SIGNALS_EFFECT_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Event-expression shorthand parser used by the client runtime. */
2
- export declare const SIGNALS_EVENT_SHORTHAND_RUNTIME = " // ==========================================================================\n // Event Handler Shorthand (Feature #8)\n // ==========================================================================\n\n function parseEventShorthand(expr, scope) {\n const trimmed = expr.trim();\n\n // Handle !variable toggle: \"!visible\" -> toggle the signal\n if (/^!\\w+$/.test(trimmed)) {\n const varName = trimmed.slice(1);\n const signal = scope[varName];\n if (signal && signal._isSignal) {\n return () => signal.set(!signal());\n }\n return null;\n }\n\n // Handle variable++ increment: \"count++\" -> increment the signal\n if (/^\\w+\\+\\+$/.test(trimmed)) {\n const varName = trimmed.slice(0, -2);\n const signal = scope[varName];\n if (signal && signal._isSignal) {\n return () => signal.update(n => n + 1);\n }\n return null;\n }\n\n // Handle variable-- decrement: \"count--\" -> decrement the signal\n if (/^\\w+--$/.test(trimmed)) {\n const varName = trimmed.slice(0, -2);\n const signal = scope[varName];\n if (signal && signal._isSignal) {\n return () => signal.update(n => n - 1);\n }\n return null;\n }\n\n // Handle += and -= operators: \"count += 5\"\n const assignMatch = trimmed.match(/^(\\w+)\\s*([+\\-*\\/])=\\s*(.+)$/);\n if (assignMatch) {\n const [, varName, op, valueExpr] = assignMatch;\n const signal = scope[varName];\n if (signal && signal._isSignal) {\n return ($event) => {\n const addValue = toValue(valueExpr, null, true, { ...scope, $event: $event });\n signal.update(n => {\n switch (op) {\n case '+': return n + addValue;\n case '-': return n - addValue;\n case '*': return n * addValue;\n case '/': return n / addValue;\n default: return n;\n }\n });\n };\n }\n return null;\n }\n\n // Handle simple assignment: \"count = 5\" or \"visible = false\"\n const simpleAssignMatch = trimmed.match(/^(\\w+)\\s*=\\s*(.+)$/);\n if (simpleAssignMatch && !trimmed.includes('==') && !trimmed.includes('=>')) {\n const [, varName, valueExpr] = simpleAssignMatch;\n const signal = scope[varName];\n if (signal && signal._isSignal) {\n return ($event) => {\n const newValue = toValue(valueExpr, null, true, { ...scope, $event: $event });\n signal.set(newValue);\n };\n }\n return null;\n }\n\n // Bare function reference: \"@click=\\\"foo\\\"\" should invoke foo($event),\n // matching Alpine/Vue/Svelte. Without this the expression falls through\n // to the generic new Function() path and is evaluated as a discarded\n // identifier statement \u2014 silently a no-op. See stacksjs/stx#1695.\n const bareIdMatch = trimmed.match(/^([a-zA-Z_$][\\w$]*)$/);\n if (bareIdMatch) {\n const fn = scope[bareIdMatch[1]];\n if (typeof fn === 'function' && !fn._isSignal) {\n return ($event) => fn($event);\n }\n }\n\n return null;\n }\n";
2
+ export declare const SIGNALS_EVENT_SHORTHAND_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Cached expression compilation helpers for the generated client runtime. */
2
- export declare const SIGNALS_EXPRESSION_COMPILER_RUNTIME = " // Compiled expression functions, by parameter list and body. A binding was\n // compiled with new Function on every evaluation: a page with a few hundred\n // names in scope rebuilt a function of a few hundred parameters for every\n // binding of every row, every time a row re-rendered. Opening a 386-message\n // conversation took seven seconds in WebKit, the window frozen meanwhile.\n // A Function built this way closes over nothing, so one can be reused.\n const __stxCompiled = new Map();\n function __stxCompile(params, body) {\n const key = params.join(',') + '\\x01' + body;\n let fn = __stxCompiled.get(key);\n if (!fn) {\n fn = new Function(...params, body);\n // Bounded: expressions are finite per page, but SPA navigation adds more.\n if (__stxCompiled.size >= 5000) __stxCompiled.clear();\n __stxCompiled.set(key, fn);\n }\n return fn;\n }\n\n // The names an expression mentions, by its text.\n const __stxIdentifiers = new Map();\n function __stxNamesIn(body) {\n let names = __stxIdentifiers.get(body);\n if (!names) {\n names = Array.from(new Set(body.match(/[A-Za-z_$][\\w$]*/g) || []));\n if (__stxIdentifiers.size >= 5000) __stxIdentifiers.clear();\n __stxIdentifiers.set(body, names);\n }\n return names;\n }\n\n // Compile an expression over just the names in scope it mentions.\n //\n // It was compiled over every name in scope and called with every value,\n // read through the auto-unwrap proxy. Reading a signal subscribes the\n // running effect, so every binding depended on every signal on the page:\n // changing one unrelated value re-ran every binding of every row. The proxy\n // also tested each signal against the expression with fresh regexes. Now an\n // expression sees, reads and subscribes to what it names; a mention inside\n // a string only widens that, never narrows it.\n function __stxCompileScoped(scope, extraParams, body) {\n const keys = [];\n const names = __stxNamesIn(body);\n for (let i = 0; i < names.length; i++) {\n if (Object.prototype.propertyIsEnumerable.call(scope, names[i])) keys.push(names[i]);\n }\n const fn = __stxCompile(extraParams.length ? keys.concat(extraParams) : keys, body);\n // The cache keys on the parameter list, so a function always has these keys.\n fn.__stxKeys = keys;\n return fn;\n }\n\n function __stxArgs(fn, scope) {\n const keys = fn.__stxKeys;\n const args = new Array(keys.length);\n for (let i = 0; i < keys.length; i++) args[i] = scope[keys[i]];\n return args;\n }\n";
2
+ export declare const SIGNALS_EXPRESSION_COMPILER_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Scope lookup and expression evaluation for the generated client runtime. */
2
- export declare const SIGNALS_EXPRESSION_RUNTIME = " let componentScope = { $refs: {} };\n\n // Current element being processed (for scope lookup)\n let currentElement = null;\n\n function findElementScope(el) {\n let current = el;\n while (current && current !== document) {\n // Check element-local scope first (from stx.mount())\n if (current.__stx_scope) {\n return current.__stx_scope;\n }\n if (current.hasAttribute && current.hasAttribute('data-stx-scope')) {\n const scopeId = current.getAttribute('data-stx-scope');\n if (window.stx._scopes && window.stx._scopes[scopeId]) {\n return window.stx._scopes[scopeId];\n }\n }\n current = current.parentElement || current.parentNode;\n }\n return null;\n }\n\n function toValue(expr, el, enableAutoUnwrap = true, extraScope = {}) {\n try {\n // Skip placeholder expressions like __TITLE__ (build-time placeholders)\n if (/^__[A-Z_]+__$/.test(expr.trim())) {\n return expr;\n }\n // First try component-level scope\n const elementScope = findElementScope(el || currentElement);\n const baseScope = { ...globalHelpers, ...componentScope, ...(elementScope || {}), ...extraScope };\n\n // Check for pipe syntax (Feature #2)\n const pipeResult = parsePipeExpression(expr, baseScope);\n if (pipeResult) {\n // Use auto-unwrap proxy for pipe expressions\n const unwrapScope = enableAutoUnwrap\n ? createAutoUnwrapProxy(baseScope, function(prop) {\n if (typeof prop !== 'string') return false;\n return expressionCallsSignal(expr, prop)\n || expressionUsesSignalApi(expr, prop);\n })\n : baseScope;\n const piped = executePipeExpression(pipeResult.valueExpr, pipeResult.pipes, unwrapScope);\n return (piped && typeof piped === 'function' && (piped._isSignal || piped._isDerived)) ? piped() : piped;\n }\n\n // Use auto-unwrap proxy if enabled (Feature #1)\n const scope = enableAutoUnwrap\n ? createAutoUnwrapProxy(baseScope, function(prop) {\n if (typeof prop !== 'string') return false;\n return expressionCallsSignal(expr, prop)\n || expressionUsesSignalApi(expr, prop);\n })\n : baseScope;\n const fn = __stxCompileScoped(baseScope, [], 'return ' + expr);\n const result = fn(...__stxArgs(fn, scope));\n // Post-eval unwrap \u2014 see evalAttrExpr note for the reason.\n return (result && typeof result === 'function' && (result._isSignal || result._isDerived)) ? result() : result;\n }\ncatch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Expression error:', expr, e);\n return '';\n }\n }\n";
2
+ export declare const SIGNALS_EXPRESSION_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Shared HTTP transport, hooks, errors, and CSRF support for the generated client runtime. */
2
- export declare const SIGNALS_FETCH_TRANSPORT_RUNTIME = " // Short, ref-free repr of a value for the mutation log (so the buffer holds no\n // live references and big objects don't bloat it).\n function __stxShort(v) {\n try {\n if (typeof v === 'string') return v.length > 40 ? (v.slice(0, 40) + '\u2026') : v;\n if (v === null || typeof v !== 'object') return v;\n var s = JSON.stringify(v);\n return s.length > 60 ? (s.slice(0, 60) + '\u2026') : s;\n } catch (e) { return '[unserializable]'; }\n }\n // Wraps fetch with timing + a timeline record (the data layer's queries).\n // Turn a non-ok Response into an Error, reading the body FIRST.\n //\n // Every data primitive threw a synthesized 'HTTP nnn: statusText' before\n // touching the body, so whatever the server actually said \u2014 a validation\n // map, a rate-limit reason, an auth message \u2014 was unreachable from any stx\n // primitive, with no escape hatch (stacksjs/stx#1848). That is the single\n // most cited reason an app keeps writing raw fetch() calls.\n //\n // The body is attached rather than only interpolated: err.data is what a\n // caller needs to render field errors, and err.status is what it needs to\n // tell 401 from 500 without parsing the message.\n function __stxRawBody(body) {\n return (typeof FormData !== 'undefined' && body instanceof FormData)\n || (typeof Blob !== 'undefined' && body instanceof Blob)\n || (typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams)\n || (typeof ArrayBuffer !== 'undefined' && (body instanceof ArrayBuffer || ArrayBuffer.isView(body)));\n }\n\n async function __stxHttpError(response) {\n var body = null;\n var text = '';\n try { text = await response.text(); } catch (e) { text = ''; }\n if (text) {\n try { body = JSON.parse(text); } catch (e) { body = text; }\n }\n var detail = '';\n if (body && typeof body === 'object') detail = body.message || body.error || '';\n else if (typeof body === 'string') detail = body.slice(0, 200);\n var message = 'HTTP ' + response.status;\n if (response.statusText) message += ': ' + response.statusText;\n if (detail) message += ' - ' + detail;\n var err = new Error(message);\n err.status = response.status;\n err.statusText = response.statusText;\n err.data = body;\n err.response = response;\n return err;\n }\n\n // One place an app can reach the data layer. Every stx data primitive goes\n // through __stxFetch, the only fetch call in this runtime, so a single pair\n // of hooks covers useFetch, useQuery and useMutation (#1855).\n //\n // Without it there is no way to attach an Authorization header or notice a\n // 401 in one place, which is the reason an app keeps hand-written fetch\n // calls sitting next to the primitives that were meant to replace them.\n //\n // Hooks mutate the context they are handed and their return value is\n // ignored \u2014 the ofetch shape most people will already know. Throwing from a\n // hook fails the request, which is what a token-refresh flow wants.\n var __stxFetchHooks = { onRequest: null, onResponse: null, onResponseError: null };\n\n // Double-submit CSRF, echoed for every same-origin unsafe request. A server\n // using the pattern (Stacks does, by default, on every POST/PUT/PATCH/DELETE)\n // plants a readable cookie and rejects any unsafe request whose header does\n // not repeat it. Nothing here repeated it, so a form posting through\n // useMutation - or the framework's own CMS form block - got 403 \"CSRF token\n // mismatch\" on a stock install. The same thing axios does for XSRF-TOKEN.\n // Only same-origin: the token must never leave for another host.\n var __stxCsrf = { cookie: 'X-CSRF-Token', header: 'X-CSRF-Token' };\n\n function __stxCookie(name) {\n if (typeof document === 'undefined' || !document.cookie) return null;\n var parts = document.cookie.split(';');\n for (var i = 0; i < parts.length; i++) {\n var at = parts[i].indexOf('=');\n if (at === -1) continue;\n if (parts[i].slice(0, at).trim() !== name) continue;\n var value = parts[i].slice(at + 1).trim();\n try { return value ? decodeURIComponent(value) : null; } catch (e) { return value || null; }\n }\n return null;\n }\n\n // Whether this request should carry the token: unsafe, and same-origin.\n function __stxWantsCsrf(url, opts) {\n if (!__stxCsrf) return false;\n var method = String((opts && opts.method) || 'GET').toUpperCase();\n if (method === 'GET' || method === 'HEAD' || method === 'OPTIONS') return false;\n // A path is same-origin by definition; only an absolute URL needs its\n // origin compared, and one that cannot be parsed is not trusted.\n var target = String(url);\n if (/^[a-z][a-z0-9+.-]*:/i.test(target) || target.slice(0, 2) === '//') {\n if (typeof location === 'undefined') return false;\n try {\n if (new URL(target).origin !== location.origin) return false;\n } catch (e) { return false; }\n }\n return true;\n }\n\n // Fetch the cookie before the first unsafe request, when the page did not\n // bring one. A page served from a CDN cache cannot: the edge strips\n // Set-Cookie from a cached response, or it would hand one visitor's token to\n // everyone. So the only pages that could post a form were the ones nobody\n // cached. `csrf.prime` names a same-origin GET that sets the cookie (any\n // safe Stacks route does); one request, shared by concurrent callers, and\n // only when the cookie is missing.\n var __stxCsrfPriming = null;\n async function __stxPrimeCsrf(url, opts) {\n if (!__stxCsrf || !__stxCsrf.prime || !__stxWantsCsrf(url, opts)) return;\n if (__stxCookie(__stxCsrf.cookie)) return;\n if (!__stxCsrfPriming) {\n __stxCsrfPriming = fetch(__stxCsrf.prime, { credentials: 'same-origin', headers: { Accept: 'application/json' } })\n .then(function () {}, function () {})\n .then(function () { __stxCsrfPriming = null; });\n }\n await __stxCsrfPriming;\n }\n\n function __stxApplyCsrf(url, opts) {\n if (!__stxWantsCsrf(url, opts)) return;\n var token = __stxCookie(__stxCsrf.cookie);\n if (!token) return;\n var headers = __stxHeaders(opts.headers);\n var wanted = __stxCsrf.header.toLowerCase();\n for (var key in headers) {\n // A token the caller set on purpose wins.\n if (key.toLowerCase() === wanted) return;\n }\n headers[__stxCsrf.header] = token;\n opts.headers = headers;\n }\n\n function configureFetch(cfg) {\n cfg = cfg || {};\n // Unlike the hooks below, CSRF settings persist unless named: an app that\n // installs an Authorization hook has not asked to stop sending the token.\n // `csrf: false` turns it off; `{ cookie, header }` renames either side.\n if (Object.prototype.hasOwnProperty.call(cfg, 'csrf')) {\n __stxCsrf = cfg.csrf === false || cfg.csrf === null\n ? null\n : { cookie: (cfg.csrf && cfg.csrf.cookie) || 'X-CSRF-Token', header: (cfg.csrf && (cfg.csrf.header || cfg.csrf.cookie)) || 'X-CSRF-Token', prime: (cfg.csrf && typeof cfg.csrf.prime === 'string' && cfg.csrf.prime) || null };\n }\n // Replace rather than stack: a module re-evaluated by hot reload or by a\n // SPA script re-run must not end up with the same interceptor installed\n // twice, sending two Authorization headers or counting a 401 twice.\n __stxFetchHooks.onRequest = typeof cfg.onRequest === 'function' ? cfg.onRequest : null;\n __stxFetchHooks.onResponse = typeof cfg.onResponse === 'function' ? cfg.onResponse : null;\n // Fires for a non-ok response and for a thrown fetch (network error). If it\n // returns a Response, that Response replaces the original \u2014 this is how a\n // 401 -> refresh -> retry is expressed once instead of per call site. The\n // retry itself belongs to the hook: it should refresh the token and re-issue\n // the request with a plain fetch() (not this data layer) so it does not\n // re-enter the hook and loop. Returning nothing lets the error stand.\n __stxFetchHooks.onResponseError = typeof cfg.onResponseError === 'function' ? cfg.onResponseError : null;\n }\n\n // headers may be a function, so it can be evaluated per request rather than\n // captured once \u2014 a token that changes between calls. Object spread over a\n // function copies no own enumerable properties, so passing one used to\n // contribute nothing at all, in silence.\n function __stxHeaders(h) {\n return (typeof h === 'function' ? h() : h) || {};\n }\n\n async function __stxFetch(source, url, opts) {\n var t0 = __stxDevtoolsNow();\n opts = opts || {};\n // Before the hooks, so an onRequest hook sees (and may override) it.\n await __stxPrimeCsrf(url, opts);\n __stxApplyCsrf(url, opts);\n if (__stxFetchHooks.onRequest) {\n // Normalised first so a hook can write ctx.options.headers.Authorization\n // without having to create the bag itself.\n opts.headers = __stxHeaders(opts.headers);\n var reqCtx = { source: source, url: String(url), options: opts };\n await __stxFetchHooks.onRequest(reqCtx);\n // Reassignable, so a hook can prefix a baseURL or swap the options\n // wholesale instead of only mutating them.\n if (reqCtx.url) url = reqCtx.url;\n opts = reqCtx.options || opts;\n }\n var method = (opts && opts.method) || 'GET';\n // A hook may hand back a Response to use in place of the original. Anything\n // else (a truthy non-Response, undefined) leaves the outcome unchanged.\n function __stxIsResponse(v) { return !!v && typeof v.ok === 'boolean'; }\n try {\n var r = await fetch(url, opts);\n __stxDevtoolsRecordQuery({ source: source, url: String(url), method: method, status: r.status, ok: r.ok, ms: __stxDevtoolsNow() - t0 });\n if (__stxFetchHooks.onResponse) {\n await __stxFetchHooks.onResponse({ source: source, url: String(url), options: opts, response: r });\n }\n if (!r.ok && __stxFetchHooks.onResponseError) {\n var recovered = await __stxFetchHooks.onResponseError({ source: source, url: String(url), options: opts, response: r, error: null });\n if (__stxIsResponse(recovered)) {\n __stxDevtoolsRecordQuery({ source: source, url: String(url), method: method, status: recovered.status, ok: recovered.ok, retried: true, ms: __stxDevtoolsNow() - t0 });\n return recovered;\n }\n }\n return r;\n } catch (e) {\n __stxDevtoolsRecordQuery({ source: source, url: String(url), method: method, status: 0, ok: false, error: String((e && e.message) || e), ms: __stxDevtoolsNow() - t0 });\n // A network-level failure (no Response) also reaches the hook, so a retry\n // can cover a dropped connection, not only an auth status.\n if (__stxFetchHooks.onResponseError) {\n var recoveredErr = await __stxFetchHooks.onResponseError({ source: source, url: String(url), options: opts, response: null, error: e });\n if (__stxIsResponse(recoveredErr)) {\n __stxDevtoolsRecordQuery({ source: source, url: String(url), method: method, status: recoveredErr.status, ok: recoveredErr.ok, retried: true, ms: __stxDevtoolsNow() - t0 });\n return recoveredErr;\n }\n }\n throw e;\n }\n }";
2
+ export declare const SIGNALS_FETCH_TRANSPORT_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Reactive list binding for the generated client runtime. */
2
- export declare const SIGNALS_FOR_RUNTIME = " function bindFor(el, passedScope = componentScope, attrName = '@for') {\n if (el.__stx_for_bound) return;\n el.__stx_for_bound = true;\n const expr = el.getAttribute(attrName);\n // Support: \"item in list\", \"item, index in list\", \"(item, index) in list\"\n const match = expr.match(/^\\s*\\(?\\s*(\\w+)(?:\\s*,\\s*(\\w+))?\\s*\\)?\\s+(?:in|of)\\s+(.+)\\s*$/);\n\n if (!match) {\n console.warn('[STX] Invalid ' + attrName + ':', expr);\n return;\n }\n\n const [, itemName, indexName, listExpr] = match;\n let parent = el.parentNode;\n\n // Guard: if element has no parent, it's detached - skip processing\n if (!parent) {\n console.warn('[STX] bindFor: element has no parent, skipping');\n return;\n }\n\n const placeholder = stxHost.anchor('stx-for');\n const isTemplate = el.tagName === 'TEMPLATE';\n const componentSetupTemplates = [];\n if (!isTemplate && el.hasAttribute('data-stx-scope')) {\n const componentScopeId = el.getAttribute('data-stx-scope');\n const componentTemplateScopeId = el.getAttribute('data-stx-template-scope') || componentScopeId;\n let setupSibling = el.nextSibling;\n while (setupSibling) {\n const nextSetupSibling = setupSibling.nextSibling;\n if (setupSibling.nodeType === Node.TEXT_NODE && !(setupSibling.textContent || '').trim()) {\n setupSibling = nextSetupSibling;\n continue;\n }\n if (setupSibling.nodeType === Node.COMMENT_NODE) {\n setupSibling = nextSetupSibling;\n continue;\n }\n if (setupSibling.nodeType === Node.ELEMENT_NODE\n && setupSibling.tagName === 'SCRIPT'\n && setupSibling.hasAttribute('data-stx-scoped')\n && ((setupSibling.textContent || '').indexOf(componentScopeId) !== -1\n || (componentTemplateScopeId && (setupSibling.textContent || '').indexOf(componentTemplateScopeId) !== -1))) {\n componentSetupTemplates.push(stxHost.clone(setupSibling));\n stxHost.remove(setupSibling);\n setupSibling = nextSetupSibling;\n continue;\n }\n break;\n }\n }\n\n // Check if element also has @if / :if - need to handle together\n const ifExpr = el.getAttribute('@if') || el.getAttribute(':if');\n\n // Feature #3: Check for @loading and @empty siblings/content\n const loadingExpr = el.getAttribute('@loading');\n const emptyExpr = el.getAttribute('@empty');\n\n // Look for sibling elements with @for-loading or @for-empty\n let loadingTemplate = null;\n let emptyTemplate = null;\n\n // Check next siblings for @for-loading and @for-empty\n let sibling = el.nextElementSibling;\n while (sibling) {\n if (sibling.hasAttribute('@for-loading')) {\n loadingTemplate = stxHost.clone(sibling);\n loadingTemplate.removeAttribute('@for-loading');\n stxHost.remove(sibling);\n sibling = el.nextElementSibling;\n continue;\n }\n if (sibling.hasAttribute('@for-empty')) {\n emptyTemplate = stxHost.clone(sibling);\n emptyTemplate.removeAttribute('@for-empty');\n stxHost.remove(sibling);\n sibling = el.nextElementSibling;\n continue;\n }\n break;\n }\n\n // Capture the scope NOW before element is removed from DOM\n const capturedScope = findElementScope(el) || findElementScope(parent);\n\n stxHost.insert(parent, placeholder, el);\n // Component setup scripts execute while the server-rendered loop source is\n // still in the document. That source becomes a template, not a live\n // instance, so reclaim all registered scopes before removing it. Every\n // rendered iteration receives remapped setup scripts and fresh scopes.\n disposeSubtreeScopes(el);\n stxHost.remove(el);\n\n // Capture :key expression BEFORE removing the attribute\n const keyExpr = el.getAttribute(':key') || el.getAttribute('x-bind:key');\n\n // For <template> elements, use the content; otherwise clone the element\n let templateContent;\n if (isTemplate) {\n templateContent = el.content;\n deferRowConditionals(templateContent);\n }\nelse {\n // Before the source is cloned into the row template, so that clone does\n // not build the conditional elements either.\n deferRowConditionals(el);\n const wrapper = stxHost.clone(el);\n wrapper.removeAttribute('@for');\n wrapper.removeAttribute(':for');\n wrapper.removeAttribute('x-for');\n wrapper.removeAttribute('@loading');\n wrapper.removeAttribute('@empty');\n wrapper.removeAttribute(':key');\n wrapper.removeAttribute('x-bind:key');\n // Also remove @if / :if / x-if - we'll handle it inline\n if (ifExpr) { wrapper.removeAttribute('@if'); wrapper.removeAttribute(':if'); wrapper.removeAttribute('x-if'); }\n templateContent = wrapper;\n }\n\n let currentElements = [];\n // One entry per list item, each holding EVERY node that item rendered.\n // currentElements stays flat for transition snapshots, but the keyed\n // diff below must pair a key with all of its nodes: a template row\n // routinely yields several (an element plus its surrounding text nodes),\n // and indexing a flat list by key position then paired the wrong node\n // with each key, leaving the list rotated after an update.\n let currentGroups = [];\n let currentKeys = [];\n let loadingElement = null;\n let emptyElement = null;\n\n // A <template :for> can contain another structural directive. That\n // nested directive replaces its source node with a placeholder and owns\n // additional live siblings around that placeholder. Track an explicit\n // boundary for every template iteration so keyed reuse moves the complete\n // live range, including nodes created by nested :for / :if bindings.\n // Moving only the original cloned nodes pulled static siblings past the\n // nested range on the next outer update (header, then rows became rows,\n // then header).\n const liveGroupNodes = (group) => {\n if (!isTemplate || !group || group.length < 2) return group || [];\n const start = group[0];\n const end = group[group.length - 1];\n if (!start || !end || start.parentNode !== parent || end.parentNode !== parent)\n return group.filter(groupNode => groupNode && groupNode.parentNode === parent);\n\n const nodes = [];\n let currentNode = start;\n while (currentNode) {\n nodes.push(currentNode);\n if (currentNode === end) break;\n currentNode = currentNode.nextSibling;\n }\n return nodes;\n };\n\n const removeGroup = (group) => {\n const liveNodes = liveGroupNodes(group);\n const liveSet = new Set(liveNodes);\n liveNodes.forEach(e => { disposeSubtreeEffects(e); disposeSubtreeScopes(e); stxHost.remove(e); });\n group.forEach(groupNode => {\n if (liveSet.has(groupNode)) return;\n disposeSubtreeEffects(groupNode);\n disposeSubtreeScopes(groupNode);\n stxHost.remove(groupNode);\n });\n };\n\n const clearRenderedItems = () => {\n currentGroups.forEach(removeGroup);\n currentElements = [];\n currentGroups = [];\n currentKeys = [];\n };\n\n // Helper to evaluate with captured scope (auto-unwraps signals)\n // NOTE: This eagerly reads ALL signals in scope \u2014 use evalLazy inside effects\n // to avoid over-broad dependency tracking.\n const evalExpr = (expression, extraScope = {}) => {\n try {\n // Skip placeholder expressions like __TITLE__ (build-time placeholders)\n if (/^__[A-Z_]+__$/.test(expression.trim())) {\n return expression;\n }\n // Use passedScope instead of componentScope to preserve context through nested processing\n const scope = { ...globalHelpers, ...passedScope, ...(capturedScope || {}), ...extraScope };\n const unwrapScope = createAutoUnwrapProxy(scope, function(prop) {\n if (typeof prop !== 'string') return false;\n return expressionCallsSignal(expression, prop)\n || expressionUsesSignalApi(expression, prop);\n });\n const fn = __stxCompileScoped(scope, [], 'return ' + expression);\n return fn(...__stxArgs(fn, unwrapScope));\n }\ncatch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Expression error:', expression, e);\n return '';\n }\n };\n\n // Lazy eval: uses with() so only variables ACTUALLY ACCESSED by the expression\n // trigger signal reads. This prevents unrelated signals (like modalOpen) from\n // being tracked as dependencies when we only care about the list signal.\n const evalLazy = (expression, extraScope = {}) => {\n try {\n if (/^__[A-Z_]+__$/.test(expression.trim())) return expression;\n const scope = { ...globalHelpers, ...passedScope, ...(capturedScope || {}), ...extraScope };\n const unwrapScope = createAutoUnwrapProxy(scope, function(prop) {\n if (typeof prop !== 'string') return false;\n return expressionCallsSignal(expression, prop)\n || expressionUsesSignalApi(expression, prop);\n });\n // Compiled over the names the expression mentions (__stxCompileScoped),\n // so only those are read and register as dependencies. It used with()\n // over the proxy, which JavaScriptCore resolves through proxy traps on\n // every identifier - 36x slower than V8 for a list of message rows.\n const fn = __stxCompileScoped(unwrapScope, [], 'return ' + expression + '');\n return fn(...__stxArgs(fn, unwrapScope));\n } catch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Expression error:', expression, e);\n return '';\n }\n };\n\n // Helper to show loading state\n const showLoading = () => {\n hideLoading();\n hideEmpty();\n if (loadingTemplate) {\n loadingElement = stxHost.clone(loadingTemplate);\n stxHost.insert(parent, loadingElement, placeholder);\n }\n };\n\n // Helper to hide loading state\n const hideLoading = () => {\n if (loadingElement) {\n stxHost.remove(loadingElement);\n loadingElement = null;\n }\n };\n\n // Helper to show empty state\n const showEmpty = () => {\n hideLoading();\n hideEmpty();\n if (emptyTemplate) {\n emptyElement = stxHost.clone(emptyTemplate);\n stxHost.insert(parent, emptyElement, placeholder);\n const shownEmpty = emptyElement;\n shownEmpty.__stx_effect_disposers = trackEffects(function() { processElement(shownEmpty); });\n }\n };\n\n // Helper to hide empty state\n const hideEmpty = () => {\n if (emptyElement) {\n // A string @empty renders a text node, which has no subtree to dispose.\n if (emptyElement.nodeType === 1) disposeSubtreeEffects(emptyElement);\n stxHost.remove(emptyElement);\n emptyElement = null;\n }\n };\n\n // Helper: create DOM element(s) for a single list item.\n // The item is wrapped in a signal so bindings track it reactively. The pair\n // rides on the returned group, so reuse always reaches the signals the\n // bindings of THAT row actually read. A Map from key to signals could not:\n // two rows sharing a key overwrote each other in it, and the row that\n // reused the surviving entry was then bound to a signal nothing updated.\n const createItemElements = (item, index, key) => {\n const itemSignal = state(item);\n itemSignal._isStxLoopItem = true;\n const indexSignal = state(index);\n\n const itemScope = { ...globalHelpers, ...passedScope, ...(capturedScope || {}) };\n itemScope[itemName] = itemSignal;\n if (indexName) itemScope[indexName] = indexSignal;\n\n const elements = [];\n if (isTemplate) {\n elements.push(stxHost.anchor('stx-for-item-start'));\n Array.from(templateContent.childNodes).forEach(node => {\n const clone = stxHost.clone(node);\n if (clone.nodeType === 1) {\n // Structural directives need a live parent. Keep the iteration\n // scope on the clone until the keyed diff inserts it, then bind.\n clone.__stx_for_scope = itemScope;\n markLoopRow(clone, itemName, itemSignal);\n }\n elements.push(clone);\n });\n elements.push(stxHost.anchor('stx-for-item-end'));\n } else {\n const clone = stxHost.clone(templateContent);\n clone.__stx_for_scope = itemScope;\n markLoopRow(clone, itemName, itemSignal);\n elements.push(clone);\n componentSetupTemplates.forEach(function(setupTemplate) {\n elements.push(stxHost.clone(setupTemplate));\n });\n }\n remapForComponentScopes(elements);\n elements.__stx_signals = { item: itemSignal, index: indexSignal };\n return elements;\n };\n\n // Helper: compute key for an item\n const getItemKey = (item, index) => {\n if (!keyExpr) return String(index);\n try {\n const scope = { [itemName]: item };\n if (indexName) scope[indexName] = index;\n const fn = __stxCompile([itemName, indexName || '_idx'], 'return ' + keyExpr);\n return String(fn(item, index));\n } catch (e) {\n return String(index);\n }\n };\n\n effect(() => {\n parent = followPlaceholder(placeholder, parent);\n // Use evalLazy for the list expression \u2014 only tracks the list signal,\n // not every signal in the component scope. This prevents unrelated\n // signals (modalOpen, menuOpen, etc.) from triggering a full rebuild.\n // Check loading state if @loading attribute provided (Feature #3)\n if (loadingExpr) {\n const isLoading = evalLazy(loadingExpr);\n if (isLoading) {\n // Dispose scopes registered by items before they leave the DOM (#1727).\n clearRenderedItems();\n showLoading();\n return;\n }\n }\n\n hideLoading();\n\n // Evaluate list with LAZY tracking \u2014 only the list signal is tracked\n let list = evalLazy(listExpr);\n\n // Tolerate parens-on-signal in the list expression.\n // :for=\"x in store.signal\" --> works (bare-ref, auto-unwrapped)\n // :for=\"x in store.signal()\" --> silently iterated zero, because\n // the proxy unwraps the signal to\n // the array on access, then the\n // trailing call throws TypeError\n // which evalLazy's catch swallows.\n // Retry without the trailing parens so both forms succeed.\n //\n // This runtime is emitted as a TEMPLATE LITERAL, so every backslash here\n // must be DOUBLED to survive into the shipped string. A regex literal\n // crosses only that one layer (doubled escapes ship intact). A\n // new RegExp('...') string crosses a SECOND layer too \u2014 the browser's\n // string-literal parse strips the escapes again \u2014 collapsing the pattern\n // to a bare-letter match that never fires (stacksjs/stx#1748). So use a\n // regex literal, not new RegExp(string), for patterns with backslashes.\n var trailingParens = /\\(\\s*\\)\\s*$/;\n if (!Array.isArray(list) && trailingParens.test(listExpr)) {\n list = evalLazy(listExpr.replace(trailingParens, ''));\n }\n // Second-chance fallback: if the retry returned a signal /\n // derived function (the proxy failed to auto-unwrap, which\n // can happen when the resolved owning object lacks the\n // _isStxStore marker \u2014 e.g. ad-hoc objects, locally-imported\n // shapes), call it manually. Defensive: cheap when it would\n // already be an array, useful when the proxy missed.\n if (!Array.isArray(list) && typeof list === 'function' && (list._isSignal || list._isDerived)) {\n try { list = list(); } catch { /* swallow - the warning below surfaces it */ }\n }\n\n // If there's an @if condition, check it\n if (ifExpr) {\n const ifValue = evalLazy(ifExpr);\n if (!ifValue) {\n // Dispose scopes registered by items before they leave the DOM (#1727).\n clearRenderedItems();\n hideEmpty();\n return;\n }\n }\n\n if (!Array.isArray(list)) {\n // Silent return here used to mask a class of real misuse:\n // most often a signal call that threw mid-expression, or a\n // :for over undefined from a typo. One warn line saves a lot\n // of \"list rendered no rows despite the data being there\"\n // debugging cycles.\n //\n // Diagnostic: dump the scope identifiers so the caller can see\n // whether the expression's root identifier was in scope at all\n // (and if so, what type it was and whether it carried the\n // _isStxStore marker). Only fires on the warn path, which is\n // rare, so the extra Object.keys / spread cost is negligible.\n var diagScope;\n var rootName = '?';\n var rootInScope = true;\n var rootVal;\n try {\n var diagMerged = { ...globalHelpers, ...passedScope, ...(capturedScope || {}) };\n var firstIdent = listExpr.match(/^[A-Za-z_$][\\w$]*/);\n rootName = firstIdent ? firstIdent[0] : '?';\n rootInScope = Object.prototype.hasOwnProperty.call(diagMerged, rootName);\n rootVal = rootInScope ? diagMerged[rootName] : '<NOT-IN-SCOPE>';\n var rootKeys = (rootVal && typeof rootVal === 'object')\n ? Object.keys(rootVal).slice(0, 8).join(',')\n : '-';\n diagScope = '[root=' + rootName + ' inScope=' + rootInScope + ' type=' + (typeof rootVal) + ' isStxStore=' + !!(rootVal && rootVal._isStxStore) + ' keys=' + rootKeys + ']';\n }\n catch (_e) { diagScope = '[diag-error]'; rootInScope = true; }\n\n /*\n * Name the cause rather than guessing at it (stacksjs/stx#2051).\n *\n * This used to end with \"If this is a signal call, try the bare\n * reference\" every single time. In the most common failure the\n * identifier is not a signal at all -- it is a bare name the client\n * scope has never heard of, usually a declaration from a\n * script-server block, which :for cannot see because it is expanded\n * on the client. The hint sent people to the wrong layer: one app\n * read it, concluded the signals-and-:for pattern was unreliable, and\n * was rebuilt on hand-written getElementById wiring.\n *\n * The scope dump already answered the question -- inScope=false was\n * right there, ahead of the guess -- so lead with it, and keep the\n * signal advice for when the value really is a signal, which is the\n * one case where it applies.\n */\n var advice;\n if (!rootInScope) {\n advice = 'Nothing named ' + rootName + ' is in the client scope. A script-server declaration is not available here: :for is expanded on the client. '\n + 'Either wrap it in state() inside a script-client block, or iterate it with the server-side @foreach(' + rootName + ' as item).';\n }\n else if (typeof rootVal === 'function' && (rootVal._isSignal || rootVal._isDerived)) {\n advice = rootName + ' is a signal, so try the bare reference: ' + rootName + ' instead of ' + rootName + '().';\n }\n else {\n advice = rootName + ' resolved to a ' + (typeof rootVal) + ', not an array.';\n }\n console.warn('[STX] :for expected an array; got ' + (list === '' ? 'empty/error' : typeof list) + ' for expression \"' + listExpr + '\". ' + diagScope + ' ' + advice);\n return;\n }\n\n // Check empty state (Feature #3)\n if (list.length === 0) {\n // Dispose scopes registered by items before they leave the DOM (#1727).\n clearRenderedItems();\n if (emptyExpr) {\n const emptyContent = evalLazy(emptyExpr);\n // Held in the same slot the @for-empty template uses, so hideEmpty\n // takes it away when the list fills and a second empty render\n // replaces it instead of stacking another one. It used to go into\n // currentElements, which teardown does not walk -- it walks\n // currentGroups -- so the text stayed in the document forever: an\n // empty list that filled read \"Nothing herea\".\n hideEmpty();\n if (emptyContent && typeof emptyContent === 'string') {\n emptyElement = document.createTextNode(emptyContent);\n stxHost.insert(parent, emptyElement, placeholder);\n }\n } else if (emptyTemplate) {\n showEmpty();\n }\n return;\n }\n\n hideEmpty();\n\n // \u2500\u2500 <TransitionGroup> detection (#1742) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Active only when the list's parent is a [data-stx-transition-group]\n // AND it has already rendered once (no enter animation on first mount).\n // tgReady gates ALL animation work, so plain :for lists are untouched.\n var tgIsGroup = !!(parent && parent.hasAttribute && parent.hasAttribute('data-stx-transition-group'));\n var tgName = tgIsGroup ? (parent.getAttribute('data-stx-transition-group') || 'v') : null;\n var tgReady = tgIsGroup && !!parent.__stx_tg_init;\n var tgFirst = tgReady ? tgSnapshot(currentElements) : null;\n\n // \u2500\u2500 Key-based diffing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Build new key list\n const newKeys = list.map((item, i) => getItemKey(item, i));\n\n // Build old key \u2192 element(s) map\n const oldKeyMap = new Map();\n for (let i = 0; i < currentKeys.length; i++) {\n const k = currentKeys[i];\n if (!oldKeyMap.has(k)) oldKeyMap.set(k, []);\n oldKeyMap.get(k).push(currentGroups[i] || []);\n }\n\n // Build new element list, reusing existing DOM nodes by key\n const newElements = [];\n const newGroups = [];\n // Keys seen in THIS pass, for the duplicate warning only. Reuse is decided\n // by whether a group under the key is still unconsumed, not by whether the\n // key has been seen: gating it on the key made every duplicate occurrence\n // build a NEW group, while the removal pass below skipped the key as used\n // and left the old ones in the document. The list grew by one row on every\n // update, without bound, and the first duplicate stayed bound to a signal\n // the reconciliation never wrote to.\n const seenKeys = new Set();\n let warnedDuplicateKey = false;\n\n // Minimal-move reconciliation.\n //\n // Every reused row used to be round-tripped through a DocumentFragment,\n // and appendChild into a fragment DETACHES the node from the document\n // first. Removing a focused node blurs it and resets activeElement, so a\n // list could not contain a field the user was typing in: any write to the\n // backing array kicked them out of it, losing caret, selection and undo\n // history. It happened for every row unconditionally, including rows that\n // had not moved, and unkeyed loops took the same path because getItemKey\n // falls back to the index (#1882).\n //\n // The cursor walks the existing rendering in order. A node already at the\n // cursor is left ENTIRELY alone \u2014 an unchanged list now performs zero DOM\n // operations \u2014 and a node that genuinely has to move is moved with\n // insertBefore, which relocates it without a detach/reattach cycle.\n let cursor = null;\n for (let ci = 0; ci < currentGroups.length && !cursor; ci++) {\n const seed = liveGroupNodes(currentGroups[ci] || []);\n if (seed.length) cursor = seed[0];\n }\n\n for (let i = 0; i < list.length; i++) {\n const key = newKeys[i];\n const existing = oldKeyMap.get(key);\n\n if (seenKeys.has(key) && !warnedDuplicateKey) {\n warnedDuplicateKey = true;\n console.warn('[STX] :for has more than one item with the key ' + key + '. Rows are matched in order, so give each item a key of its own.');\n }\n seenKeys.add(key);\n\n if (existing && existing.length > 0) {\n // Reuse this item's nodes \u2014 move the whole group into position, in\n // order, so a multi-node row stays contiguous and correctly ordered.\n // A structural directive may intentionally have detached one of the\n // group's nodes. Its own placeholder owns reinsertion, so keyed reuse\n // must not resurrect that hidden node.\n const group = existing.shift();\n const liveNodes = liveGroupNodes(group);\n for (let li = 0; li < liveNodes.length; li++) {\n const groupNode = liveNodes[li];\n if (groupNode === cursor) {\n // Already exactly where it belongs. Touching it here is what\n // used to blur it, so the correct action is to do nothing.\n cursor = cursor.nextSibling;\n }\n else {\n // Moves without detaching. The cursor does not advance: this node\n // is now behind it, and the cursor still marks the next position\n // to fill.\n stxHost.insert(parent, groupNode, cursor || placeholder);\n }\n }\n newElements.push(...group);\n newGroups.push(group);\n // Update the item signal so bindings re-evaluate with new data.\n // This is the fix for #1669 \u2014 without this, reused elements show\n // stale data because the old bindings captured the old item via closure.\n const signals = group.__stx_signals;\n if (signals) {\n signals.item.set(list[i]);\n signals.index.set(i);\n }\n } else {\n // New item \u2014 create DOM elements with a fresh item signal\n const elements = createItemElements(list[i], i, key);\n elements.forEach(el => {\n // Before the cursor, not before the placeholder: a new row inserted\n // in the MIDDLE of the list must land at its own position, without\n // forcing every row after it to be moved to get back in order.\n stxHost.insert(parent, el, cursor || placeholder);\n if (tgReady && el.isConnected) tgEnter(el, tgName);\n });\n hydrateComponentScopes(elements, elements.find(function(node) {\n return node && node.__stx_for_scope;\n })?.__stx_for_scope || passedScope);\n elements.forEach(el => {\n if (el.nodeType === 1) {\n var itemScope = el.__stx_for_scope || passedScope;\n delete el.__stx_for_scope;\n // Tracked so removeGroup can dispose the row's effects (#1954). Kept\n // off __stx_disposers, which marks a hydrated component root here\n // and in the deferred :if pass.\n if (!el.__stx_disposers && el.tagName !== 'SCRIPT')\n el.__stx_effect_disposers = trackEffects(function() { processElement(el, itemScope); });\n el.removeAttribute('x-cloak');\n el.querySelectorAll('[x-cloak]').forEach(c => c.removeAttribute('x-cloak'));\n }\n });\n newElements.push(...elements);\n newGroups.push(elements);\n }\n }\n\n // Remove old elements whose keys are no longer in the list.\n // Dispose any scopes registered inside removed items before the\n // remove() call (#1727).\n // Whatever is still in here was not consumed above -- either the key left\n // the list, or the list now has fewer rows under that key than it did.\n // The test used to be \"this key was never used\", which could not see the\n // second case, so a duplicate key's leftover rows stayed on screen.\n for (const groups of oldKeyMap.values()) {\n if (groups.length > 0) {\n // In a transition group, run the leave animation and let it remove the\n // node; otherwise remove immediately. Scopes are disposed up-front\n // either way (their destroy hooks shouldn't wait on a CSS transition).\n groups.forEach((group) => {\n if (tgReady) {\n const liveNodes = liveGroupNodes(group);\n const transitioned = new Set();\n liveNodes.forEach((el) => {\n disposeSubtreeEffects(el);\n disposeSubtreeScopes(el);\n if (tgLeave(el, tgName)) transitioned.add(el);\n else stxHost.remove(el);\n });\n group.forEach((el) => {\n if (transitioned.has(el) || liveNodes.includes(el)) return;\n disposeSubtreeEffects(el);\n disposeSubtreeScopes(el);\n stxHost.remove(el);\n });\n }\n else {\n removeGroup(group);\n }\n });\n // The row's signals went with its group, so there is no key-indexed\n // map left to prune here.\n }\n }\n\n currentElements = newElements;\n currentGroups = newGroups;\n currentKeys = newKeys;\n\n // \u2500\u2500 <TransitionGroup> play (#1742) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // FLIP the surviving elements from their snapshotted positions, then mark\n // the group rendered so the next update animates.\n if (tgReady && tgFirst) tgFlip(newElements, tgFirst, tgName);\n if (tgIsGroup) parent.__stx_tg_init = true;\n });\n }\n";
2
+ export declare const SIGNALS_FOR_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Browser-global aliases used by the generated client runtime. */
2
- export declare const SIGNALS_GLOBALS_RUNTIME = " // Also expose globally for convenience\n window.state = state;\n window.derived = derived;\n window.effect = effect;\n window.batch = batch;\n window.onMount = onMount;\n window.onDestroy = onDestroy;\n window.useFetch = useFetch;\n window.clearServerData = clearServerData;\n window.useRef = useRef;\n window.navigate = navigate;\n window.goBack = goBack;\n window.goForward = goForward;\n window.useRoute = useRoute;\n window.useSearchParams = useSearchParams;\n window.useQuery = useQuery;\n window.useMutation = useMutation;\n window.provide = provide;\n window.$computed = $computed;\n window.$watch = $watch;\n window.useDebounce = useDebounce;\n window.useDebouncedValue = useDebouncedValue;\n window.useThrottle = useThrottle;\n window.useInterval = useInterval;\n window.useTimeout = useTimeout;\n window.useToggle = useToggle;\n window.useCounter = useCounter;\n window.useClickOutside = useClickOutside;\n window.useFocus = useFocus;\n window.nextTick = nextTick;\n window.useAsync = useAsync;\n window.useLocalStorage = useLocalStorage;\n // Paired with the line above. Both are in STX_RUNTIME_GLOBALS, so a\n // <script client> block gets either via the setup destructure \u2014 but code\n // that reads the bare window global directly (a plain <script>, or a\n // bundled module that wasn't rewritten) found useLocalStorage defined and\n // useSessionStorage undefined.\n window.useSessionStorage = useSessionStorage;\n window.keptState = keptState;\n window.forgetKeptState = forgetKeptState;\n window.setKeptScope = setKeptScope;\n window.flushKeptState = flushKeptState;\n window.cachedQuery = cachedQuery;\n window.useEventListener = useEventListener;\n window.useWebSocket = useWebSocket;\n window.useColorMode = useColorMode;\n window.useDark = useDark;\n window.useHead = useHead;\n window.useSeoMeta = useSeoMeta;\n window.toast = toast;\n window.modal = modal;\n window.drawer = drawer;\n window.stxAlert = stxAlert;\n window.stxConfirm = stxConfirm;\n window.defineStore = window.stx.defineStore;\n window.useStore = window.stx.useStore;\n window.ref = state;\n window.reactive = reactive;\n window.computed = derived;\n window.watch = $watch;\n window.watchEffect = function(fn) { return effect(fn); };\n\n // Note: SPA Router and View Transitions CSS are provided by the canonical\n // router script (packages/router/src/client.ts) which is injected alongside\n // the signals runtime or via the @stxRouter directive.\n";
2
+ export declare const SIGNALS_GLOBALS_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Signal-aware event expression handling for the generated client runtime. */
2
- export declare const SIGNALS_HANDLER_RUNTIME = " function expressionUsesSignalApi(expression, name) {\n var escapedName = name.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n return expressionUsesSignalMethod(expression, name)\n || expressionUsesSignalValue(expression, name);\n }\n\n function expressionUsesSignalMethod(expression, name) {\n var escapedName = name.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n return new RegExp('(?:^|[^\\\\w$])' + escapedName + '\\\\s*\\\\.\\\\s*(?:set|update|subscribe|toggle|input|change)\\\\s*\\\\(').test(expression);\n }\n\n function expressionUsesSignalValue(expression, name) {\n var escapedName = name.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n return new RegExp('(?:^|[^\\\\w$])' + escapedName + '\\\\s*\\\\.\\\\s*value\\\\b').test(expression);\n }\n\n function expressionCallsSignal(expression, name) {\n var escapedName = name.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n return new RegExp('(?:^|[^\\\\w$])' + escapedName + '\\\\s*\\\\(').test(expression);\n }\n\n function createExpressionAutoUnwrapProxy(scope, expression) {\n return createAutoUnwrapProxy(scope, function(prop, signal) {\n if (typeof prop !== 'string') return false;\n if (expressionCallsSignal(expression, prop) || expressionUsesSignalMethod(expression, prop))\n return true;\n if (!expressionUsesSignalValue(expression, prop))\n return false;\n\n // A :for item is itself represented by a signal. If that item's value\n // is an object with a real value field, item.value means the field,\n // not the signal wrapper API. Primitive signals still support\n // count.value, matching the explicit ref syntax.\n try {\n var currentValue = signal();\n return !(currentValue && typeof currentValue === 'object'\n && Object.prototype.hasOwnProperty.call(currentValue, 'value'));\n }\n catch (e) {\n return true;\n }\n });\n }\n\n function executeHandler(expr, event, el) {\n try {\n // Skip placeholder expressions like __TITLE__ (build-time placeholders)\n if (/^__[A-Z_]+__$/.test(expr.trim())) {\n return;\n }\n // First try component-level scope\n const elementScope = findElementScope(el || currentElement);\n const scope = { ...globalHelpers, ...componentScope, ...(elementScope || {}) };\n\n // Check for shorthand syntax (Feature #8)\n const shorthandFn = parseEventShorthand(expr, scope);\n if (shorthandFn) {\n shorthandFn(event);\n return;\n }\n\n // Loop items arrive as signals (see createItemElements). Unwrap them for\n // the same reason the inline @event path does: `item.value` in a handler\n // means the item's field, not the signal API.\n const handlerScope = {};\n Object.keys(scope).forEach(function(k) {\n const v = scope[k];\n handlerScope[k] = (v && typeof v === 'function' && v._isStxLoopItem) ? v() : v;\n });\n const fn = __stxCompileScoped(handlerScope, ['$event'], expr);\n fn(...__stxArgs(fn, handlerScope), event);\n }\ncatch (e) {\n // Event handlers fire on user interaction, not reactive re-runs \u2014 there's no\n // async-hydration race to silence. Surfacing TypeError/ReferenceError is what\n // turns \"@click does nothing, no warning\" into a 5-second debug. See #1694.\n console.warn('[STX] Handler error:', expr, e);\n }\n }\n";
2
+ export declare const SIGNALS_HANDLER_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Client-side document head and SEO helpers. */
2
- export declare const SIGNALS_HEAD_RUNTIME = " // ==========================================================================\n // Client-side useHead / useSeoMeta\n // ==========================================================================\n\n function useHead(config) {\n function apply() {\n if (config.title) document.title = config.title;\n // Process meta tags\n var metas = config.meta || [];\n for (var i = 0; i < metas.length; i++) {\n var m = metas[i];\n if (!m.name && !m.property) continue;\n var selector = m.name ? 'meta[name=\"' + m.name + '\"]' : 'meta[property=\"' + m.property + '\"]';\n var el = document.querySelector(selector);\n if (el) {\n el.setAttribute('content', m.content || '');\n } else {\n el = document.createElement('meta');\n if (m.name) el.setAttribute('name', m.name);\n if (m.property) el.setAttribute('property', m.property);\n el.setAttribute('content', m.content || '');\n document.head.appendChild(el);\n }\n }\n // Process link tags\n var links = config.link || config.links || [];\n for (var j = 0; j < links.length; j++) {\n var l = links[j];\n if (!l.rel || !l.href) continue;\n var linkSel = 'link[rel=\"' + l.rel + '\"][href=\"' + l.href + '\"]';\n if (!document.querySelector(linkSel)) {\n var le = document.createElement('link');\n for (var k in l) { if (l.hasOwnProperty(k)) le.setAttribute(k, l[k]); }\n document.head.appendChild(le);\n }\n }\n // Script tags\n var scripts = config.script || config.scripts || [];\n for (var si = 0; si < scripts.length; si++) {\n var s = scripts[si];\n var se = document.createElement('script');\n if (s.src) se.src = s.src;\n if (s.innerHTML) se.innerHTML = s.innerHTML;\n if (s.async) se.async = true;\n if (s.defer) se.defer = true;\n document.head.appendChild(se);\n }\n // Body class\n if (config.bodyAttrs && config.bodyAttrs.class) {\n config.bodyAttrs.class.split(' ').forEach(function(cls) { if (cls) document.body.classList.add(cls); });\n }\n // Html attributes. Every key, not just lang \u2014 the module impl\n // (head.ts updateHead) has always applied all of them, and a root-level\n // class is the main reason to reach for htmlAttrs at all (#1798).\n // class merges rather than replaces, matching bodyAttrs.class above:\n // the color-mode boot script owns a class on this same element.\n if (config.htmlAttrs) {\n for (var hk in config.htmlAttrs) {\n if (!config.htmlAttrs.hasOwnProperty(hk)) continue;\n var hv = config.htmlAttrs[hk];\n if (hv == null) continue;\n if (hk === 'class') {\n String(hv).split(' ').forEach(function(cls) { if (cls) document.documentElement.classList.add(cls); });\n } else {\n document.documentElement.setAttribute(hk, hv);\n }\n }\n }\n }\n // Apply immediately if DOM is ready, otherwise on mount\n if (document.readyState !== 'loading') { apply(); }\n else { onMount(apply); }\n }\n\n function useSeoMeta(config) {\n var meta = [];\n if (config.title) meta.push({ name: 'title', content: config.title });\n if (config.description) meta.push({ name: 'description', content: config.description });\n if (config.ogTitle) meta.push({ property: 'og:title', content: config.ogTitle });\n if (config.ogDescription) meta.push({ property: 'og:description', content: config.ogDescription });\n if (config.ogImage) meta.push({ property: 'og:image', content: config.ogImage });\n if (config.ogType) meta.push({ property: 'og:type', content: config.ogType });\n if (config.ogUrl) meta.push({ property: 'og:url', content: config.ogUrl });\n if (config.twitterCard) meta.push({ name: 'twitter:card', content: config.twitterCard });\n if (config.twitterTitle) meta.push({ name: 'twitter:title', content: config.twitterTitle });\n if (config.twitterDescription) meta.push({ name: 'twitter:description', content: config.twitterDescription });\n if (config.twitterImage) meta.push({ name: 'twitter:image', content: config.twitterImage });\n if (config.robots) meta.push({ name: 'robots', content: config.robots });\n if (config.canonical) meta.push({ property: 'og:url', content: config.canonical });\n useHead({ title: config.title || config.ogTitle, meta: meta });\n }\n";
2
+ export declare const SIGNALS_HEAD_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Formatting helpers and object dependency tracking used by client bindings. */
2
- export declare const SIGNALS_HELPERS_RUNTIME = " // ==========================================================================\n // Global Helpers (Feature #5)\n // ==========================================================================\n\n const globalHelpers = {\n // Number formatting\n fmt(n) {\n if (n == null) return '0';\n n = Number(n);\n if (n >= 1000000) return (n / 1000000).toFixed(1) + 'M';\n if (n >= 1000) return (n / 1000).toFixed(1) + 'K';\n return String(n);\n },\n\n // Date formatting\n formatDate(date, format = 'YYYY-MM-DD') {\n if (!date) return '';\n const d = date instanceof Date ? date : new Date(date);\n if (isNaN(d.getTime())) return '';\n const year = d.getFullYear();\n const month = String(d.getMonth() + 1).padStart(2, '0');\n const day = String(d.getDate()).padStart(2, '0');\n const hours = String(d.getHours()).padStart(2, '0');\n const minutes = String(d.getMinutes()).padStart(2, '0');\n const seconds = String(d.getSeconds()).padStart(2, '0');\n return format\n .replace('YYYY', year)\n .replace('MM', month)\n .replace('DD', day)\n .replace('HH', hours)\n .replace('mm', minutes)\n .replace('ss', seconds);\n },\n\n // Time ago formatting\n timeAgo(date) {\n if (!date) return '';\n const d = date instanceof Date ? date : new Date(date);\n const now = new Date();\n const seconds = Math.floor((now - d) / 1000);\n if (seconds < 60) return 'just now';\n if (seconds < 3600) return Math.floor(seconds / 60) + 'm ago';\n if (seconds < 86400) return Math.floor(seconds / 3600) + 'h ago';\n if (seconds < 604800) return Math.floor(seconds / 86400) + 'd ago';\n return d.toLocaleDateString();\n },\n\n // Debounce function\n debounce(fn, delay = 300) {\n let timeout;\n return function(...args) {\n clearTimeout(timeout);\n timeout = setTimeout(() => fn.apply(this, args), delay);\n };\n },\n\n // Throttle function\n throttle(fn, limit = 300) {\n let inThrottle;\n return function(...args) {\n if (!inThrottle) {\n fn.apply(this, args);\n inThrottle = true;\n setTimeout(() => inThrottle = false, limit);\n }\n };\n },\n\n // Capitalize first letter\n capitalize(str) {\n if (!str) return '';\n return str.charAt(0).toUpperCase() + str.slice(1);\n },\n\n // Truncate string\n truncate(str, length = 50, suffix = '...') {\n if (!str || str.length <= length) return str || '';\n return str.slice(0, length) + suffix;\n },\n\n // JSON stringify (safe)\n json(value, indent = 2) {\n try {\n return JSON.stringify(value, null, indent);\n }\ncatch (e) {\n return String(value);\n }\n },\n\n // Pluralize\n pluralize(count, singular, plural) {\n const p = plural || singular + 's';\n return count === 1 ? singular : p;\n },\n\n // Clamp number\n clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n },\n\n // Currency formatting\n currency(value, symbol = '$', decimals = 2) {\n if (value == null) return symbol + '0.00';\n return symbol + Number(value).toFixed(decimals).replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n },\n\n // Percentage formatting\n percent(value, decimals = 0) {\n if (value == null) return '0%';\n return (Number(value) * 100).toFixed(decimals) + '%';\n }\n };\n\n function track(target, key) {\n if (!activeEffect) return;\n let depsMap = targetMap.get(target);\n if (!depsMap) targetMap.set(target, (depsMap = new Map()));\n let deps = depsMap.get(key);\n if (!deps) depsMap.set(key, (deps = new Set()));\n deps.add(activeEffect);\n }\n\n function trigger(target, key) {\n const depsMap = targetMap.get(target);\n if (!depsMap) return;\n const deps = depsMap.get(key);\n if (deps) notifySubscribers(deps);\n }\n";
2
+ export declare const SIGNALS_HELPERS_RUNTIME: string;
@@ -6,4 +6,4 @@
6
6
  * DOM. The leading indentation and trailing blank line are intentional: this
7
7
  * fragment is interpolated directly into the generated runtime.
8
8
  */
9
- export declare const SIGNALS_HOST_RUNTIME = " // \u2500\u2500 Host \u2500\u2500\n //\n // The tree this runtime mutates. Every write the binding layer makes to a\n // node goes through here, so the same runtime can drive something that is not\n // the document -- native views over a bridge (stacksjs/stx#1984).\n //\n // Signals never touch a node, so nothing above this line needs to change; the\n // coupling is entirely in the bind layer. A host is swapped in by assigning\n // window.__stx_host before the runtime executes. The name is stxHost, not\n // host, because the runtime already calls two local DOM nodes host -- a\n // shadowed adapter fails as node.anchor is not a function, deep inside a\n // branch swap, and nowhere near the line that caused it, which keeps the web path\n // exactly as it was: same calls, one property lookup earlier.\n var stxHost = window.__stx_host || {\n setText: function(node, value) { node.textContent = value; },\n setMarkup: function(node, value) { node.innerHTML = value == null ? '' : value; },\n setAttribute: function(node, name, value) {\n if (value === false) { node.removeAttribute(name); return; }\n if (value === true) { node.setAttribute(name, ''); return; }\n var next = value;\n if (typeof value === 'object' && value !== null) {\n try { next = JSON.stringify(value); }\n catch (e) { next = String(value); }\n }\n node.setAttribute(name, next);\n },\n removeAttribute: function(node, name) { node.removeAttribute(name); },\n setStyle: function(node, value) {\n if (typeof value === 'object' && value !== null) {\n Object.assign(node.style, value);\n if (Object.prototype.hasOwnProperty.call(value, 'display')) node.__stx_display = value.display || '';\n }\n else if (typeof value === 'string') {\n node.style.cssText = value;\n node.__stx_display = node.style.display || '';\n }\n // Reactive style updates must not clear the display:none owned by :show.\n // This also keeps the latest explicit display for when the gate opens.\n if (node.__stx_visible === false) node.style.display = 'none';\n },\n\n // Structural operations, for the bindings that build rows rather than\n // update one node (#1984).\n //\n // anchor() is a position in the child list that survives the nodes around\n // it moving -- a comment node here, since the document has one; a native\n // host keeps an index or a zero-size sentinel.\n //\n // clone() is the one that does not carry over as-is: a DOM subtree can be\n // deep-copied, a native view hierarchy cannot. A native host materialises a\n // fresh subtree from the template it was given instead of copying views,\n // which is why the row template is passed rather than a node to duplicate.\n // A native host registers the handler against the view and has the platform\n // call it; nothing about the binding layer changes, which is the point.\n // The options argument carries passive/capture/once. A native host has no use for\n // passive -- there is no scroll thread to block -- but dropping the\n // parameter silently makes every touch listener blocking again, so it stays\n // in the signature and each host decides what to do with it.\n listen: function(node, event, handler, options) { node.addEventListener(event, handler, options); },\n\n // Returns the PREVIOUS visibility. bindShow needs to know whether it just\n // revealed something, and asking the node afterwards is the one read-back\n // in the binding layer -- a native host cannot answer what a UIView's\n // display value was, because it has none. A write that reports what it\n // replaced removes the question: the DOM host reads its own style, a native\n // host reads isHidden, and the binder reads neither.\n //\n // Restoring an explicit display (a flex row, an inline-block) is the host's\n // business too; it records it the first time it hides the node.\n // The scope root a node belongs to: nearest ancestor-or-self that owns a\n // scope, or null. Three binding paths need it -- ref ownership, and an\n // if-chain finding the scope its branch belongs to.\n //\n // Not a query method. A host is never handed a selector, because a native\n // view tree has nothing to match one against: the DOM host walks with\n // closest(), a native host reads the node-to-scope map it maintains as it\n // creates views. The from flag skips the node itself, which the ref path needs\n // when it walks outward past a receiver it has already rejected.\n scopeOf: function(node, from) {\n var start = from ? (node && node.parentElement) : node;\n return (start && start.closest) ? start.closest('[data-stx-scope]') : null;\n },\n\n setVisible: function(node, visible) {\n if (node.__stx_display === undefined) {\n var d = node.style.display;\n node.__stx_display = (d && d !== 'none') ? d : '';\n }\n var was = node.style.display !== 'none';\n node.__stx_visible = visible;\n node.style.display = visible ? node.__stx_display : 'none';\n return was;\n },\n\n anchor: function(label) { return document.createComment(label); },\n clone: function(node) { return node.cloneNode(true); },\n insert: function(parent, node, before) { parent.insertBefore(node, before); },\n remove: function(node) { if (node.parentNode) node.parentNode.removeChild(node); },\n\n // Teardown needs to reach a subtree, and both ways of reaching one were\n // selector queries -- the last DOM assumption left in the binding layer\n // (#1984). A view hierarchy has no selectors, and a native host already\n // knows what it built, so being asked is cheaper for it than searching is\n // for the document.\n //\n // descendants() is every node under this one, for the per-node teardown\n // state the runtime hangs off elements. scopesIn() is the scope IDS in the\n // subtree, this node included -- ids and not nodes, because the only thing\n // done with them is a lookup in window.stx._scopes.\n descendants: function(node) {\n var out = [];\n if (!node || !node.querySelectorAll) return out;\n var all = node.querySelectorAll('*');\n for (var i = 0; i < all.length; i++) out.push(all[i]);\n return out;\n },\n scopesIn: function(node) {\n var ids = [];\n if (!node) return ids;\n var own = node.getAttribute && node.getAttribute('data-stx-scope');\n if (own) ids.push(own);\n if (node.querySelectorAll) {\n var matches = node.querySelectorAll('[data-stx-scope]');\n for (var i = 0; i < matches.length; i++) {\n var id = matches[i].getAttribute('data-stx-scope');\n if (id) ids.push(id);\n }\n }\n return ids;\n }\n };\n";
9
+ export declare const SIGNALS_HOST_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Post-hydration diagnostics used by the generated client runtime. */
2
- export declare const SIGNALS_HYDRATION_AUDIT_RUNTIME = " // ==========================================================================\n // Post-hydration invariant sweep (stacksjs/stx#1773)\n // ==========================================================================\n //\n // Preserved moustaches are the framework's de-facto error UI: ANY failure in\n // the detect \u2192 extract \u2192 bundle \u2192 ship \u2192 rebind relay collapses into the same\n // visible symptom, literal {{ }} on screen. Eight separate fixes each patched\n // one site's heuristic, and no invariant anywhere asserted the actual\n // requirement \u2014 zero unhydrated scopes after hydration. So every new upstream\n // miss reached users silently and had to be diagnosed from a screenshot.\n //\n // This is that invariant. It runs at the end of both hydration entry points\n // and turns a silent miss into one loud, self-healing event:\n //\n // - an element carrying data-stx-scope whose id isn't in the registry, or\n // that hydration reached but never processed, is reported AND processed\n // with the ambient scope, which is what the walk would have done had the\n // script arrived. That recovers the D2/D3 shapes (a silent early return\n // in the walk, a stale __stx_scope guard) rather than merely naming them.\n // - leftover {{ }} text is reported. Diagnostic only, never auto-fixed:\n // without a scope there is nothing to interpolate against, and a page may\n // legitimately print moustaches.\n //\n // Deliberately quiet in the normal case: nothing is logged when the page has\n // no signals at all, and containers that legitimately show template syntax\n // (<pre>, <code>, <template>, <script>, <style>, <textarea>, and anything\n // under [data-stx-ignore]) are skipped.\n\n var AUDIT_SKIP_TAGS = { PRE: 1, CODE: 1, SCRIPT: 1, STYLE: 1, TEXTAREA: 1, TEMPLATE: 1 };\n\n // Expressions whose evaluation threw a ReferenceError/TypeError and have not\n // since succeeded. evalAttrExpr swallows those two on purpose \u2014 a signal may\n // not exist yet on an effect's first pass \u2014 which is why a genuinely broken\n // binding produces no diagnostic at all today. The classic case is\n // :if=\"flag()\" where flag is a signal: the auto-unwrap proxy returns the\n // VALUE, calling it throws TypeError, the directive suppresses it, and the\n // element silently stays hidden with no warning anywhere (see CLAUDE.md,\n // \"Signals: scripts call, templates don't\").\n //\n // Recording rather than warning immediately is what keeps this quiet on\n // working pages: a first-pass failure that later succeeds clears itself, so\n // only expressions still broken when hydration finishes are reported.\n var _exprFailures = {};\n var _exprFailureCount = 0;\n\n function noteExprFailure(expr, err) {\n if (_exprFailures[expr] !== undefined) return;\n // Bounded: one runaway loop must not grow this without limit.\n if (_exprFailureCount >= 50) return;\n _exprFailureCount++;\n _exprFailures[expr] = (err && err.message) ? err.message : String(err);\n }\n\n function noteExprSuccess(expr) {\n if (_exprFailures[expr] === undefined) return;\n delete _exprFailures[expr];\n _exprFailureCount--;\n }\n\n function auditSkipped(node) {\n // Not rendered, not audited. Covers <template> content (a detached\n // DocumentFragment \u2014 which some DOM implementations still walk into) and\n // :if branches parked off-document, neither of which the user can see.\n if (node.isConnected === false) return true;\n for (var p = node.parentNode; p; p = p.parentNode) {\n if (p.nodeType === Node.DOCUMENT_FRAGMENT_NODE) return true;\n if (p.nodeType !== Node.ELEMENT_NODE) continue;\n if (AUDIT_SKIP_TAGS[p.tagName]) return true;\n if (p.hasAttribute && p.hasAttribute('data-stx-ignore')) return true;\n // A :if whose deferred child-binding pass hasn't run yet legitimately holds\n // literal {{ }} that binds a macrotask later \u2014 not a hydration miss (#1773).\n if (p.__stx_if_pending) return true;\n // A deferred island (client=visible|idle|\u2026) is unhydrated ON PURPOSE until\n // its trigger fires, so its {{ }} legitimately stay literal in the meantime\n // \u2014 not a miss (#1746). The stranded-scope pass already skips stx-hydrate;\n // the literal sweep must too.\n if (p.hasAttribute && p.hasAttribute('stx-hydrate') && !p.__stx_hydrated) return true;\n }\n return false;\n }\n\n // Whether the element is, or sits inside, a structural directive's source that has\n // not bound yet. Binding replaces the source with a marker and a template,\n // so a :for / :if still on an element in the document has yet to run.\n var UNBOUND_STRUCTURE = [':for', '@for', 'x-for', ':if', '@if', 'x-if', ':else-if', '@else-if', 'x-else-if', ':else', '@else', 'x-else'];\n function inUnboundStructure(el) {\n for (var p = el; p && p.nodeType === Node.ELEMENT_NODE; p = p.parentElement) {\n for (var i = 0; i < UNBOUND_STRUCTURE.length; i++) {\n if (p.hasAttribute(UNBOUND_STRUCTURE[i])) return true;\n }\n }\n return false;\n }\n\n function findLiteralMoustaches(root) {\n var found = [];\n if (!root || typeof document.createTreeWalker !== 'function') return found;\n // Read NodeFilter off window, not the bare global: in a real browser they\n // are the same object, but some DOM implementations used for testing expose\n // it only on window, and a bare reference then throws inside the audit.\n var showText = (window.NodeFilter && window.NodeFilter.SHOW_TEXT) || 4;\n var walker = document.createTreeWalker(root, showText, null);\n var node;\n while ((node = walker.nextNode())) {\n // Browsers expose Text.nodeValue as a string, while lightweight DOM and\n // native embedding shims can preserve an assigned number. Diagnostics\n // must normalize the boundary instead of aborting the entire audit on a\n // missing String#indexOf method.\n var text = node.nodeValue == null ? '' : String(node.nodeValue);\n if (text.indexOf('{{') === -1 || text.indexOf('}}') === -1) continue;\n if (auditSkipped(node)) continue;\n found.push(text.trim().slice(0, 80));\n if (found.length >= 5) break;\n }\n return found;\n }\n\n // A diagnostic that can break hydration is worse than no diagnostic, so the\n // whole sweep is wrapped and every DOM capability it uses is feature-checked.\n // Minimal document stubs (tests, non-browser embeddings) simply skip it.\n function auditHydration(container, phase) {\n try { auditHydrationUnsafe(container, phase); }\n catch (e) { console.warn('[stx] hydration audit skipped:', e && e.message ? e.message : e); }\n }\n\n function auditHydrationUnsafe(container, phase) {\n if (!window.stx || !window.stx._scopes) return;\n var root = container && typeof container.querySelectorAll === 'function' ? container : document.body;\n if (!root || typeof root.querySelectorAll !== 'function') return;\n\n // Unregistered / unprocessed scopes \u2014 the unambiguous failure, and the one\n // worth repairing.\n var stranded = [];\n root.querySelectorAll('[data-stx-scope]').forEach(function(el) {\n if (el.__stx_audit_recovered) return;\n // Deferred islands are unhydrated ON PURPOSE until their trigger fires.\n if (el.hasAttribute('stx-hydrate') || el.__stx_hydration_scheduled) return;\n // Inert markup is not a miss: a component inside a :if branch whose\n // deferred pass has not run, or inside a :for / :if source that has not\n // bound, is set up when it does, under its own clone's id. The literal\n // sweep already allowed for the first; recovering the second ran a\n // loop's source against the page's scope.\n if (auditSkipped(el) || inUnboundStructure(el)) return;\n var scopeId = el.getAttribute('data-stx-scope');\n var registered = window.stx._scopes[scopeId];\n if (registered && el.__stx_disposers) return;\n stranded.push({ el: el, id: scopeId, registered: !!registered });\n });\n\n if (stranded.length) {\n console.error(\n '[stx] hydration invariant failed after ' + phase + ': '\n + stranded.length + ' scope(s) left unhydrated \u2014 '\n + stranded.map(function(s) {\n return s.id + (s.registered ? ' (registered, never processed)' : ' (not registered)');\n }).join(', ')\n + '. Recovering with the ambient scope; please report with the page that produced it (stacksjs/stx#1773).',\n );\n stranded.forEach(function(s) {\n // Once per element: a repair that itself fails must not loop on the\n // next navigation.\n s.el.__stx_audit_recovered = true;\n try {\n var vars = s.registered ? window.stx._scopes[s.id] : null;\n if (vars) Object.assign(componentScope, vars);\n s.el.__stx_disposers = trackEffects(function() { processElement(s.el, componentScope); });\n s.el.removeAttribute('x-cloak');\n s.el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });\n }\n catch (e) {\n console.error('[stx] hydration recovery failed for scope ' + s.id + ':', e);\n }\n });\n }\n\n var literals = findLiteralMoustaches(root);\n if (literals.length) {\n console.error(\n '[stx] hydration invariant failed after ' + phase + ': literal {{ }} left in the DOM \u2014 '\n + literals.join(' | ')\n + '. An expression did not bind; see stacksjs/stx#1773. Wrap intentional '\n + 'template syntax in <pre>/<code> or [data-stx-ignore] to exclude it.',\n );\n }\n\n // Expressions that threw and never recovered. Reported here rather than at\n // throw time so a first-pass miss that later resolves stays silent.\n var brokenExprs = [];\n for (var expr in _exprFailures) {\n if (Object.prototype.hasOwnProperty.call(_exprFailures, expr))\n brokenExprs.push(expr + ' \u2192 ' + _exprFailures[expr]);\n }\n if (brokenExprs.length) {\n var hint = brokenExprs.some(function(m) { return m.indexOf('is not a function') !== -1; })\n ? ' If one of these calls a signal, drop the parentheses: templates read '\n + 'a signal by bare name (:if=\"flag\"), scripts call it (flag()). Calling '\n + 'the unwrapped value is a TypeError, which directives suppress \u2014 the '\n + 'element just stays hidden.'\n : '';\n console.error(\n '[stx] hydration invariant failed after ' + phase + ': '\n + brokenExprs.length + ' expression(s) never evaluated \u2014 '\n + brokenExprs.slice(0, 5).join(' | ') + '.' + hint,\n );\n _exprFailures = {};\n _exprFailureCount = 0;\n }\n }\n";
2
+ export declare const SIGNALS_HYDRATION_AUDIT_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Dynamic subtree hydration used by the generated client runtime. */
2
- export declare const SIGNALS_HYDRATION_RUNTIME = " // Hydrate a subtree inserted AFTER initial load \u2014 e.g. a streamed suspense\n // boundary (#1746 Phase 3). Mirrors the SPA re-init pass, scoped to the\n // container: (1) executes the subtree's scoped setup scripts (inert when\n // inserted via innerHTML, so they're cloned into fresh script elements to\n // run), (2) processes any data-stx-scope islands the scripts registered,\n // (3) binds directives across the subtree (content using already-live page\n // signals works too), (4) flushes onMount. Idempotent via the usual guards.\n function hydrateSubtree(container) {\n if (!container || !container.querySelectorAll) return;\n // 1. Run scoped setup scripts so their scopes register.\n var scoped = container.querySelectorAll('script[data-stx-scoped]');\n for (var i = 0; i < scoped.length; i++) {\n var old = scoped[i];\n if (old.__stx_ran) continue;\n var fresh = document.createElement('script');\n for (var a = 0; a < old.attributes.length; a++) fresh.setAttribute(old.attributes[a].name, old.attributes[a].value);\n fresh.textContent = old.textContent;\n fresh.__stx_ran = true;\n if (old.parentNode) old.parentNode.replaceChild(fresh, old);\n }\n // 2. Process scopes registered in this subtree (incl. the container itself).\n var scopeEls = [];\n if (container.matches && container.matches('[data-stx-scope]')) scopeEls.push(container);\n container.querySelectorAll('[data-stx-scope]').forEach(function(el) { scopeEls.push(el); });\n scopeEls.forEach(function(el) {\n if (el.__stx_disposers) return;\n var scopeId = el.getAttribute('data-stx-scope');\n var scopeVars = window.stx._scopes && window.stx._scopes[scopeId];\n if (!scopeVars) return;\n el.__stx_parent_scope = el.__stx_parent_scope\n || resolveComponentCallerScope(el, componentScope);\n bindParentComponentProps(el, el.__stx_parent_scope);\n Object.assign(componentScope, scopeVars);\n el.__stx_disposers = trackEffects(function() { processElement(el, componentScope); });\n if (scopeVars.__mountCallbacks && !scopeVars.__mounted) {\n scopeVars.__mounted = true;\n runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));\n }\n });\n // 3. Bind directives across the subtree.\n processElement(container);\n if (container.removeAttribute) container.removeAttribute('x-cloak');\n container.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });\n // 4. Flush any global mount callbacks the scripts queued.\n if (mountCallbacks.length) {\n var cbs = mountCallbacks.slice();\n mountCallbacks.length = 0;\n runMountCallbacks(cbs, destroyCallbacks);\n }\n window.dispatchEvent(new CustomEvent('stx:hydrated', { detail: { el: container, trigger: 'stream' } }));\n }\n";
2
+ export declare const SIGNALS_HYDRATION_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Reactive if/else-if/else chain binding for the generated client runtime. */
2
- export declare const SIGNALS_IF_CHAIN_RUNTIME = " // Reactive if/else-if/else chain. A single effect drives mutual exclusion:\n // on each run it picks the first branch whose condition is truthy (the\n // trailing x-else always matches), inserts that branch, and removes\n // whichever branch was previously shown. One effect for the whole chain\n // means branches can't transiently both render or both vanish in a tick,\n // and a single source signal isn't subscribed N times. See #1734.\n function bindIfChain(chain, passedScope = componentScope) {\n var head = chain[0].el;\n if (head.__stx_if_bound) { console.log('[stx] bindIfChain SKIPPED (head already bound):', head.tagName, chain.map(function(c) { return c.attr; }).join(',')); return; }\n console.log('[stx] bindIfChain entry:', head.tagName, 'branches:', chain.map(function(c) { return c.attr; }).join(','));\n\n var parent = head.parentNode;\n if (!parent) { console.warn('[STX] bindIfChain: head element has no parent, skipping'); return; }\n\n var capturedComponentScope = { ...passedScope };\n\n // Detach every branch up-front, leaving a positional placeholder comment\n // so reinsertion preserves source order. Mark each as a chain member so\n // the parent's snapshot child-iteration skips the detached (non-active)\n // branches instead of bringing their content to life. The active branch\n // is re-inserted below and IS connected, so it processes normally.\n chain.forEach(function(b) {\n preserveConditionalComponentScopes(b.el, capturedComponentScope);\n b.el.__stx_if_bound = true;\n b.el.__stx_chain_member = true;\n b.el.__stx_chain_active = false;\n b.el.__stx_if_visible = state(false);\n b.capturedElementScope = findElementScope(b.el);\n b.placeholder = stxHost.anchor('stx-if-chain');\n stxHost.insert(parent, b.placeholder, b.el);\n b.el.removeAttribute(b.attr);\n // A <template> branch (the wrapper convertSignalDirectivesToAttributes\n // emits for a multi-child / text branch) is INERT \u2014 inserting the element\n // renders nothing, its content lives in a document fragment. Clone that\n // content ONCE into a stable node set we toggle in and out, exactly as\n // bindIf/bindFor already do for template elements. An element branch is\n // its own single node. Without this, a multi-element @else / @else-if\n // branch rendered blank the moment the markup was well-formed enough to\n // survive as a real <template> (the #1784 markup fix). See #1784.\n b.isTemplate = b.el.tagName === 'TEMPLATE';\n // A template branch renders CLONES, re-cloned on every show, and marks\n // where they end -- the same contract the single-template :if got in\n // #1955. Its content was cloned once here and that one node set was\n // toggled in and out, which broke two ways as soon as the branch held a\n // structural directive: a :for inside it replaces its own source element\n // with a placeholder comment and renders rows as SIBLINGS, so hiding\n // removed neither (the rows were never in this list, and the source node\n // it did hold was already detached, so the parentNode guard skipped it)\n // and both branches stayed on screen at once. Re-showing then re-inserted\n // that source element, painting the literal text of its interpolations.\n // An element branch still owns exactly the node it was bound to: whatever\n // a directive inside it renders is inside that element.\n // Snapshot the content BEFORE anything processes it, and clone each show\n // from the snapshot rather than from the live template. A nested :for\n // does not leave content pristine -- processing moves its row source out\n // and the attributes it consumed (x-model, :id) do not come back -- so a\n // second clone taken from the element would arrive already stripped, with\n // no binding and no way to acquire one.\n b.pristine = b.isTemplate ? stxHost.clone(b.el.content) : null;\n b.nodes = b.isTemplate ? [] : [b.el];\n b.endMarker = null;\n stxHost.remove(b.el);\n b.childrenProcessed = false;\n });\n\n // Per-branch evaluator. Evaluated inside the chain effect via with()\n // (like evalLazy) so ONLY the signals the expression actually references\n // register as dependencies \u2014 not every signal in scope. The old form\n // (new Function(...Object.keys(scope)) called with ...Object.values of\n // the unwrap proxy) read every scope value through the proxy to build the\n // positional args, subscribing the effect to ALL scope signals, so it\n // re-ran on every unrelated mutation (#1738). with() only triggers the\n // proxy's get-trap for identifiers the expression names.\n //\n // Two passes, same as bindIf (#1733): proxy pass first (so bare-ref\n // comparisons like count === 0 read the signal as a value), raw-scope\n // retry second (so call-syntax like count() === 0 works \u2014 the proxy\n // would have unwrapped count to a value, making count() throw).\n function evalBranch(b) {\n var expression = b.expr;\n if (/^__[A-Z_]+__$/.test(expression.trim())) return expression;\n var scope = { ...globalHelpers, ...capturedComponentScope, ...(b.capturedElementScope || {}) };\n try {\n var unwrapScope = createExpressionAutoUnwrapProxy(scope, expression);\n // Compiled over the names the expression mentions (see __stxCompileScoped).\n var fn = __stxCompileScoped(unwrapScope, [], 'return ' + expression + '');\n return fn(...__stxArgs(fn, unwrapScope));\n }\ncatch (e1) {\n try {\n var fn2 = __stxCompileScoped(scope, [], 'return ' + expression + '');\n return fn2(...__stxArgs(fn2, scope));\n }\ncatch (e2) {\n if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expression, e2);\n return '';\n }\n }\n }\n\n var currentIdx = -1;\n\n effect(function() {\n // Evaluate EVERY branch's condition each run (not for-break) so the\n // reactive tracker registers dependencies on exactly the signals the\n // branch expressions reference \u2014 and on ALL of them, so a transition\n // from a later branch back to an earlier one still re-fires. Then pick\n // the first truthy branch (terminal x-else always matches).\n //\n // Pre-fix (#1738) this used a for-break picker, which only subscribed\n // to signals up to the first truthy branch; to stay correct it then\n // eagerly read EVERY signal in scope \u2014 a sledgehammer that re-ran this\n // effect on every unrelated signal mutation in the scope (50+ no-op\n // runs per page load on real apps). Evaluating all branches subscribes\n // narrowly to just the branch signals instead.\n var pickedIdx = -1;\n for (var i = 0; i < chain.length; i++) {\n var b = chain[i];\n var matched = b.terminal ? true : !!evalBranch(b);\n if (matched && pickedIdx === -1) pickedIdx = i;\n }\n\n console.log('[stx] bindIfChain pick:', pickedIdx, 'of', chain.length, '(', pickedIdx >= 0 ? chain[pickedIdx].attr : 'none', ') prev:', currentIdx);\n if (__stxDevtoolsTracking) {\n var __ifScope = null;\n try { __ifScope = stxHost.scopeOf(head); } catch (e) { __ifScope = null; }\n __stxDevtoolsRecordIf({\n scopeId: __ifScope ? __ifScope.getAttribute('data-stx-scope') : null,\n branches: chain.map(function(c) { return c.attr; }),\n picked: pickedIdx,\n pickedAttr: pickedIdx >= 0 ? chain[pickedIdx].attr : null,\n prev: currentIdx\n });\n }\n if (pickedIdx === currentIdx) return;\n\n // Remove the previously-shown branch. Do NOT disposeSubtreeScopes here:\n // a chain branch is a TOGGLE (re-shown when its condition matches again),\n // not a permanent unmount, and a nested data-stx-scope inside it can't be\n // recreated once deleted from window.stx._scopes (its setup IIFE ran\n // once at page load). Deleting it broke re-show of nested scoped\n // components under reactive conditionals (#1737). Permanent disposal is\n // still handled by bindFor (item removal) and cleanupContainer (SPA nav).\n if (currentIdx !== -1) {\n var gone = chain[currentIdx];\n gone.el.__stx_chain_active = false;\n gone.el.__stx_if_visible.set(false);\n // Unmount what the branch held, as a single :if does, before any of\n // it leaves the page.\n var leavingNodes = gone.nodes.filter(function (n) { return n.parentNode; });\n if (gone.isTemplate && gone.endMarker && gone.endMarker.parentNode) {\n leavingNodes = [];\n for (var walk = gone.placeholder.nextSibling; walk && walk !== gone.endMarker; walk = walk.nextSibling) leavingNodes.push(walk);\n }\n suspendSubtreeScopes(leavingNodes);\n\n if (gone.isTemplate) {\n // Everything this branch rendered goes, not just the clones it owns:\n // a nested :for or :if renders siblings of its own that no clone list\n // contains. The marker bounds the range, so a sibling that belongs to\n // a later branch or to ordinary markup is never touched.\n if (gone.endMarker && gone.endMarker.parentNode) {\n var doomed = gone.placeholder.nextSibling;\n while (doomed && doomed !== gone.endMarker) {\n var nextDoomed = doomed.nextSibling;\n disposeSubtreeEffects(doomed);\n stxHost.remove(doomed);\n doomed = nextDoomed;\n }\n stxHost.remove(gone.endMarker);\n gone.endMarker = null;\n }\n gone.nodes.forEach(function (n) {\n if (!n.parentNode) return;\n disposeSubtreeEffects(n);\n stxHost.remove(n);\n });\n // The next show clones afresh and processes again, so these effects\n // are finished with; leaving them bound only accumulates work (#1954).\n if (typeof gone.el.__stx_chain_disposers === 'function') {\n try { gone.el.__stx_chain_disposers(); }\ncatch (e) { /* a disposer of its own is not this branch's problem */ }\n gone.el.__stx_chain_disposers = null;\n }\n gone.nodes = [];\n gone.childrenProcessed = false;\n }\n else {\n gone.nodes.forEach(function (n) {\n if (!n.parentNode) return;\n // Detached nodes are out of reach of a DOM walk, so a row removed\n // while this branch is hidden could not dispose the effects it was\n // processed with (#1954). Same registry the single-element :if uses.\n var parentEl = n.parentNode;\n if (!parentEl.__stx_detached_if) parentEl.__stx_detached_if = new Set();\n parentEl.__stx_detached_if.add(n);\n stxHost.remove(n);\n });\n }\n }\n\n // Insert + process the newly-picked branch.\n if (pickedIdx !== -1) {\n var pick = chain[pickedIdx];\n pick.el.__stx_chain_active = true;\n // Insert this branch's node(s) before the placeholder's next sibling.\n // The anchor is captured once so the nodes stack in source order.\n var anchor = pick.placeholder.nextSibling;\n var pickHost = pick.placeholder.parentNode;\n if (pick.isTemplate && pick.nodes.length === 0)\n pick.nodes = Array.prototype.slice.call(stxHost.clone(pick.pristine).childNodes);\n pick.nodes.forEach(function (n) {\n if (pickHost.__stx_detached_if) pickHost.__stx_detached_if.delete(n);\n stxHost.insert(pickHost, n, anchor);\n });\n pick.el.__stx_if_visible.set(true);\n // Bound AFTER the clones, so hiding can remove whatever a structural\n // directive inside the branch renders as their sibling.\n if (pick.isTemplate) {\n if (!pick.endMarker) pick.endMarker = stxHost.anchor('stx-if-chain-end');\n stxHost.insert(pickHost, pick.endMarker, anchor);\n }\n pick.el.__stx_shown_at = performance.now();\n // An element branch shown before keeps its bindings and its scopes;\n // the components in it mount again (a template branch is cloned afresh\n // and mounts through hydrateComponentScopes below).\n if (pick.childrenProcessed) {\n var shownNodes = pick.nodes;\n queueMicrotask(function () {\n if (pick.el.__stx_chain_active) peek(function () { resumeSubtreeScopes(shownNodes); });\n });\n }\n if (!pick.childrenProcessed) {\n pick.childrenProcessed = true;\n // Hydrate before the outer scope walk can see the inserted branch.\n // Chromium executes scripts cloned from template.content as soon as\n // they are connected, so deferring this pass allowed the global walk\n // to process projected slot expressions without the loop caller\n // scope. peek() keeps this synchronous pass from subscribing child\n // reads to the current chain effect.\n // Tracked on the branch element: this runs inside the chain effect,\n // where no tracker is active, so without a handle the effects of a\n // branch picked after render survive their row's removal (#1954).\n pick.el.__stx_chain_disposers = trackEffects(function () {\n peek(function () {\n var childScope = { ...globalHelpers, ...capturedComponentScope, ...(pick.capturedElementScope || {}) };\n // Components compiled inside any branch of an if/else-if/else\n // chain carry scoped setup scripts with them. Branch nodes are\n // detached before those scripts can execute, so simply\n // re-inserting the selected branch leaves component props,\n // events, directives, and projected slot expressions inert.\n // Hydrate those scopes before the normal subtree walk, matching\n // the single-template :if and :for insertion paths.\n var previouslyTrackedNodes = new Set();\n pick.nodes.forEach(function (n) {\n if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);\n });\n hydrateComponentScopes(pick.nodes, childScope);\n pick.nodes.forEach(function (n) {\n if (n.nodeType !== 1) return; // whitespace/text between template children\n // A scoped component receives its disposer in the outer scope\n // walk immediately after processElement returns from binding\n // this conditional. That first pass intentionally stops at\n // :if, so a disposer does not mean its children were hydrated.\n if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)\n processElement(n, childScope);\n n.removeAttribute('x-cloak');\n n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });\n });\n resumeDetachedBranches();\n });\n });\n }\n }\n\n currentIdx = pickedIdx;\n });\n }\n\n // Shown branches whose deferred bind found them off the page: an enclosing\n // :if, bound later in the same pass, hid them between the queue and the run.\n // Their own condition has not changed, so their effect never runs again to\n // retry; each resumes here when an enclosing branch puts it back.";
2
+ export declare const SIGNALS_IF_CHAIN_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Single-branch conditional binding for the generated client runtime. */
2
- export declare const SIGNALS_IF_RUNTIME = " const detachedBranches = new Set();\n function resumeDetachedBranches() {\n if (!detachedBranches.size) return;\n Array.from(detachedBranches).forEach(function(resume) {\n if (!resume.el.isConnected) return;\n detachedBranches.delete(resume);\n resume();\n });\n }\n\n function bindIf(el, passedScope = componentScope, attrName = '@if') {\n // Guard: prevent double-binding on the same element\n if (el.__stx_if_bound) { console.log('[stx] bindIf SKIPPED (already bound):', el.getAttribute(attrName) || '(attr removed)', 'on', el.tagName); return; }\n el.__stx_if_bound = true;\n\n const expr = el.getAttribute(attrName);\n let parent = el.parentNode;\n\n // Guard: if element has no parent, it's detached - skip processing\n if (!parent) {\n console.warn('[STX] bindIf: element has no parent, skipping');\n return;\n }\n\n const placeholder = stxHost.anchor('stx-if');\n // Marks where this branch's rendered content ENDS (stacksjs/stx#1955).\n // Hiding used to remove only the cloned nodes, but a structural directive\n // directly inside the template renders its own output as siblings that are\n // not among those clones -- a <template :for> at the top level of a\n // <template :if> left every row on screen after the branch went false.\n // Only the template branch needs it; the single-element branch owns exactly\n // the node it was bound to.\n let endMarker = null;\n let isInserted = true;\n\n // Handle <template> elements specially - clone their content\n const isTemplate = el.tagName === 'TEMPLATE';\n if (!isTemplate) el.__stx_if_visible = state(true);\n const componentSetupSiblings = isTemplate ? [] : findConditionalComponentSetupSiblings(el);\n let currentNodes = isTemplate ? [] : [el, ...componentSetupSiblings];\n\n // Capture BOTH element scope AND passedScope NOW before anything changes\n // passedScope may contain @for iteration variables or parent component signals\n const capturedElementScope = findElementScope(el);\n const capturedComponentScope = { ...passedScope };\n\n preserveConditionalComponentScopes(el, capturedComponentScope);\n stxHost.insert(parent, placeholder, el);\n el.removeAttribute(attrName);\n\n if (isTemplate) {\n // Nothing is cloned until the condition holds: the effect below clones\n // template.content on the first true and binds it then. Every branch\n // used to be cloned and inserted up front and the false ones removed, so\n // a false branch still built its elements - in WebKit a <video> or\n // <audio> sets up a media player as it is created.\n isInserted = false;\n stxHost.remove(el); // Remove the template element itself\n }\n\n // Helper to evaluate with captured scope (auto-unwraps signals).\n // A with-scope resolves only identifiers the expression actually references,\n // so the conditional subscribes narrowly instead of reading every signal\n // in a component scope. That broad subscription made an unrelated ref\n // update re-enter structural removal while the real condition was already\n // removing the same subtree. First try the auto-unwrap proxy (so a bare\n // comparison like count > 5 reads the signal value), then retry with the\n // raw scope so call syntax like count() === 0 still works (#1733).\n const evalExpr = (expression) => {\n // Skip placeholder expressions like __TITLE__ (build-time placeholders)\n if (/^__[A-Z_]+__$/.test(expression.trim())) {\n return expression;\n }\n try {\n const scope = { ...globalHelpers, ...capturedComponentScope, ...(capturedElementScope || {}) };\n const unwrapScope = createExpressionAutoUnwrapProxy(scope, expression);\n const fn = __stxCompileScoped(unwrapScope, [], 'return ' + expression + '');\n return fn(...__stxArgs(fn, unwrapScope));\n }\ncatch (e1) {\n try {\n // Retry without the unwrap proxy so call-syntax (signal()) works.\n const scope2 = { ...globalHelpers, ...capturedComponentScope, ...(capturedElementScope || {}) };\n const fn2 = __stxCompileScoped(scope2, [], 'return ' + expression + '');\n return fn2(...__stxArgs(fn2, scope2));\n }\ncatch (e2) {\n if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expression, e2);\n return '';\n }\n }\n };\n\n // Track if children have been processed\n let childrenProcessed = false;\n\n // Helper to process children with captured scope\n const processChildrenWithScope = () => {\n // Build the combined scope for children - no need to modify global componentScope\n // Just pass the scope explicitly to processElement\n const childScope = { ...globalHelpers, ...capturedComponentScope, ...(capturedElementScope || {}) };\n\n\n Array.from(el.childNodes).forEach(child => processElement(child, childScope));\n\n childrenProcessed = true;\n };\n\n // A <template :if> inserts clones of template.content rather than the\n // template element itself. Those clones still need the normal directive\n // and interpolation pass. Previously the initially-visible branch was\n // inserted and left inert, so bindings such as :text and {{ expression }}\n // leaked into the rendered UI until the condition toggled.\n const processTemplateNodes = (nodes) => {\n const childScope = { ...globalHelpers, ...capturedComponentScope, ...(capturedElementScope || {}) };\n // Components compiled inside a <template :if> carry setup scripts in the\n // template content. Browser-cloned scripts are inert, so register their\n // scopes and forwarded props before walking the inserted branch. This is\n // the same component hydration path used by <template :for>.\n hydrateComponentScopes(nodes, childScope);\n nodes.forEach(node => {\n if (!node.__stx_disposers && node.tagName !== 'SCRIPT')\n node.__stx_effect_disposers = trackEffects(function() { processElement(node, childScope); });\n if (node.nodeType === 1) {\n node.removeAttribute('x-cloak');\n node.querySelectorAll('[x-cloak]').forEach(c => c.removeAttribute('x-cloak'));\n }\n });\n resumeDetachedBranches();\n };\n\n // Evaluate the :if expression \u2014 use direct signal read for simple refs,\n // falling back to evalExpr for complex expressions\n const fullScope = { ...globalHelpers, ...capturedComponentScope, ...(capturedElementScope || {}) };\n const directSignal = fullScope[expr];\n\n effect(() => {\n parent = followPlaceholder(placeholder, parent, currentNodes);\n var value;\n if (directSignal && (directSignal._isSignal || directSignal._isDerived)) {\n value = directSignal();\n console.log('[stx] bindIf effect (direct):', expr, '\u2192', value, 'isInserted:', isInserted);\n } else {\n value = evalExpr(expr);\n }\n\n if (isTemplate) {\n if (value && !isInserted) {\n // Re-insert cloned content\n currentNodes = Array.from(el.content.childNodes).map(n => stxHost.clone(n));\n const insertionAnchor = placeholder.nextSibling;\n currentNodes.forEach(node => stxHost.insert(parent, node, insertionAnchor));\n // Bound AFTER the clones, so hiding can remove whatever a nested\n // structural directive rendered as their sibling (#1955).\n if (!endMarker) endMarker = stxHost.anchor('stx-if-end');\n stxHost.insert(parent, endMarker, insertionAnchor);\n processTemplateNodes(currentNodes);\n childrenProcessed = true;\n // Stamp insertion time for click propagation guard\n currentNodes.forEach(function(n) { if (n.nodeType === 1) n.__stx_shown_at = performance.now(); });\n isInserted = true;\n }\nelse if (!value && isInserted) {\n // Remove all current nodes. Do NOT disposeSubtreeScopes \u2014 :if is a\n // toggle, not a permanent unmount; see the single-element branch\n // below and #1737. Effects are disposed, though: these clones are never\n // reused, and a re-show clones afresh, so leaving them bound only\n // accumulates work (#1954).\n //\n // Everything between the placeholder and the end marker goes, not\n // just the clones: a nested :for or :if renders siblings of its own\n // that no clone list contains (#1955).\n // Only walk the range when THIS binding inserted the content and\n // left its marker. Without that guard the walk ran to the end of the\n // parent and took a sibling <template :if> with it -- the initial\n // server-rendered state has no marker to stop at.\n if (endMarker && endMarker.parentNode === parent) {\n var leaving = [];\n for (var cursor = placeholder.nextSibling; cursor && cursor !== endMarker; cursor = cursor.nextSibling) leaving.push(cursor);\n suspendSubtreeScopes(leaving);\n var doomed = placeholder.nextSibling;\n while (doomed && doomed !== endMarker) {\n var nextDoomed = doomed.nextSibling;\n disposeSubtreeEffects(doomed);\n stxHost.remove(doomed);\n doomed = nextDoomed;\n }\n stxHost.remove(endMarker);\n }\n suspendSubtreeScopes(currentNodes.filter(node => node.parentNode));\n currentNodes.forEach(node => { disposeSubtreeEffects(node); stxHost.remove(node); });\n currentNodes = [];\n isInserted = false;\n childrenProcessed = false;\n }\n else if (value && isInserted && !childrenProcessed) {\n // Initial template content is cloned before the effect runs. Process\n // it after the condition is confirmed so hidden branches stay inert.\n // Keep hydration synchronous so the outer scope walk cannot bind\n // caller-owned slot expressions first, while peek() prevents child\n // reads from subscribing to this conditional effect.\n childrenProcessed = true;\n peek(function() {\n if (isInserted) processTemplateNodes(currentNodes);\n });\n }\n }\nelse {\n // Native hosts keep a view hierarchy rather than a DOM subtree. Route\n // the conditional through the same visibility contract as :show so a\n // false branch is hidden in the first render and in every loop row;\n // the structural remove/insert below still preserves browser and\n // native lifecycle behaviour when the branch changes.\n if (stxHost.isNative) stxHost.setVisible(el, !!value);\n if (value && !isInserted) {\n console.log('[stx] bindIf INSERTING element for :if=' + expr);\n const insertionAnchor = placeholder.nextSibling;\n currentNodes.forEach(node => stxHost.insert(parent, node, insertionAnchor));\n if (parent && parent.__stx_detached_if) currentNodes.forEach(node => parent.__stx_detached_if.delete(node));\n el.__stx_if_visible.set(true);\n el.__stx_shown_at = performance.now();\n isInserted = true;\n // A previously hydrated parent skips hydrateShownBranch on re-show.\n // Its children may have become visible while it was detached, so\n // resume their pending bindings now that the subtree is connected.\n peek(resumeDetachedBranches);\n // Shown before, so the components in it mounted and were suspended\n // when it hid. They mount again now -- in a microtask, the same\n // moment their first mount ran, and only if still shown by then.\n if (childrenProcessed) {\n queueMicrotask(function() {\n if (isInserted) peek(function() { resumeSubtreeScopes(currentNodes); });\n });\n }\n }\nelse if (!value && isInserted) {\n console.log('[stx] bindIf REMOVING element for :if=' + expr, 'el.isConnected:', el.isConnected, 'parent:', parent.tagName);\n el.__stx_if_visible.set(false);\n // Unmounted, not disposed: the components in it release what they\n // hold while their markup is still on the page, and keep their scopes.\n suspendSubtreeScopes(currentNodes);\n // Do NOT disposeSubtreeScopes here. :if is a TOGGLE \u2014 the element is\n // re-shown when the condition flips back \u2014 not a permanent unmount.\n // A nested data-stx-scope inside this subtree is created once by its\n // setup IIFE at page load and stored in window.stx._scopes; deleting\n // it on hide left re-show unable to recreate it, so nested scoped\n // components under reactive conditionals rendered all branches at\n // once (#1737). Permanent disposal stays in bindFor (item removal)\n // and cleanupContainer (SPA navigation). The double-bind guards make\n // re-show idempotent, so toggling doesn't leak.\n currentNodes.forEach(node => stxHost.remove(node));\n // Detached nodes are out of reach of a DOM walk, so an ancestor row or\n // branch removed while this is hidden could not dispose their effects\n // (#1954). Record them on the parent that keeps the placeholder.\n if (parent) {\n if (!parent.__stx_detached_if) parent.__stx_detached_if = new Set();\n currentNodes.forEach(node => parent.__stx_detached_if.add(node));\n }\n isInserted = false;\n console.log('[stx] bindIf REMOVED, el.isConnected:', el.isConnected);\n }\n // Process the entire subtree when element is visible and not yet processed.\n // peek() keeps child effects from subscribing to this bindIf's tracked\n // signals. Use capturedComponentScope (not global componentScope) so\n // iteration variables from an enclosing for-loop remain in scope.\n // Process the element itself, not just children, so sibling directives\n // on the same element (e.g. text binding alongside if) fire too. The if\n // attribute was already removed, so no recursion.\n //\n // Synchronously when the branch is on the page, as the template and\n // if/else-chain branches already are. This pass used to wait for a\n // timer, so every :if (and each :for inside one) filled in a frame\n // after the rest of the page was bound: a screen opened from a tab bar\n // showed its sections arriving one after another.\n if (value && isInserted && !childrenProcessed) {\n childrenProcessed = true;\n // Until this pass runs, the shown subtree still holds literal {{ }}.\n // Flag it so the hydration audit doesn't report those as a binding\n // miss when the pass is deferred (#1773).\n el.__stx_if_pending = true;\n var hydrateShownBranch = function() {\n // Removed with its row, or hidden again, before this ran. Hydrating\n // a detached element now creates effects nothing will dispose\n // (#1954). Leave it unprocessed so the next show schedules the pass.\n if (!el.isConnected) {\n childrenProcessed = false;\n el.__stx_if_pending = false;\n // Hidden by an ancestor rather than by this condition (a page :if\n // around a component whose own :if queued this pass), the branch\n // comes back without this effect running, and a component shown\n // again kept its :for rows as raw markup.\n var resume = function() {\n if (!isInserted || childrenProcessed) return;\n childrenProcessed = true;\n el.__stx_if_pending = true;\n peek(hydrateShownBranch);\n };\n resume.el = el;\n detachedBranches.add(resume);\n return;\n }\n var childScope = { ...globalHelpers, ...capturedComponentScope, ...(capturedElementScope || {}) };\n // A false single-element conditional is detached before the\n // DOMContentLoaded component-scope pass. When it becomes visible,\n // hydrate any component roots in the restored subtree first so\n // projected slot bindings and component-local directives receive\n // the same lifecycle as components inserted by template :if.\n var wasTrackedBeforeConditionalHydration = !!el.__stx_disposers;\n hydrateComponentScopes(currentNodes, childScope);\n // Tracked on its own property so an ancestor row or branch removal\n // reaches these effects too (#1954). This runs after the enclosing\n // tracker has closed, so nothing else would collect them.\n if (wasTrackedBeforeConditionalHydration || !el.__stx_disposers)\n el.__stx_if_disposers = trackEffects(function() { processElement(el, childScope); });\n // Remove x-cloak from the inserted subtree \u2014 the initial\n // cloak removal (after processElement on the root) already\n // ran before this deferred processing, so newly-inserted\n // :if children still have x-cloak and stay hidden.\n el.removeAttribute('x-cloak');\n el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });\n // Deferred bind complete \u2014 the audit may inspect this subtree now.\n el.__stx_if_pending = false;\n // Branches inside this one that were hidden with it can bind now.\n resumeDetachedBranches();\n };\n // In a microtask, not inside this effect's own run: child effects\n // created while it is running saw the data mid-change (a screen\n // swapping workouts) and recorded expressions that had never\n // evaluated. A microtask still runs before the browser paints, so\n // the branch is bound in the first frame all the same. A branch\n // shown while detached (inside content not on the page yet) waits a\n // macrotask, when it has been placed.\n if (el.isConnected) {\n // A native host sends the insertion as soon as its current\n // mutation turn ends. Hydrating in a later microtask would put the\n // handler registration in a second batch, leaving a same-turn tap\n // with the source expression instead of a native handler id.\n if (stxHost.isNative) peek(hydrateShownBranch);\n else queueMicrotask(function() { peek(hydrateShownBranch); });\n }\n else setTimeout(hydrateShownBranch, 0);\n }\n }\n });\n }\n";
2
+ export declare const SIGNALS_IF_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Deferred island hydration scheduling for the generated client runtime. */
2
- export declare const SIGNALS_LAZY_HYDRATION_RUNTIME = " // Lazy hydration: defer processElement for subtrees marked with stx-hydrate.\n // Triggers: \"visible\" (IntersectionObserver), \"idle\" (requestIdleCallback),\n // \"interaction\" (mouseenter/click/focus), \"media:<query>\" (matchMedia).\n function deferHydration(el, trigger, scope) {\n if (el.__stx_hydration_scheduled) return;\n el.__stx_hydration_scheduled = true;\n\n var run = function() {\n if (el.__stx_hydrated) return;\n el.__stx_hydrated = true;\n el.__stx_hydration_cancel = null; // trigger consumed \u2014 nothing left to cancel\n el.removeAttribute('stx-hydrate');\n var sid = el.getAttribute && el.getAttribute('data-stx-scope');\n\n // Everything downstream of the island setup running: merge the now-\n // registered scope, bind the subtree, flush onMount, announce hydration.\n // Factored out so the async chunked path can run it from a <script> load\n // event while the inline path runs it synchronously (#1746).\n var finishHydrate = function() {\n var effectiveScope = scope;\n if (sid) {\n var reg = window.stx._scopes ? window.stx._scopes[sid] : null;\n if (reg) effectiveScope = Object.assign({}, scope || {}, reg);\n }\n // Walk children and process them with the (now scope-merged) context\n Array.from(el.children).forEach(function(child) { processElement(child, effectiveScope); });\n // Also process the element itself (attributes/bindings on the host)\n processAttributesOnly(el, effectiveScope);\n // Fire this scope's onMount now that it has actually hydrated \u2014 the\n // initial mount pass deferred it for stx-hydrate scopes so onMount lands\n // on hydration, not at page load (#1746). Guarded by __mounted so it\n // never double-fires with the eager path.\n var sv = sid && window.stx._scopes ? window.stx._scopes[sid] : null;\n if (sv && sv.__mountCallbacks && !sv.__mounted) {\n sv.__mounted = true;\n runMountCallbacks(sv.__mountCallbacks, scopeDestroySink(sv));\n }\n window.dispatchEvent(new CustomEvent('stx:hydrated', { detail: { el: el, trigger: trigger } }));\n };\n\n // Island (#1746): the component's setup script was emitted inert\n // (type=\"stx/island\") so the browser skipped it at parse. Run it now \u2014 it\n // registers the scope (signals + methods) AND runs any side-effectful\n // setup (e.g. a fetch in the <script client> body) at hydration time.\n var islandScript = sid ? document.querySelector('script[data-stx-island=\"' + sid + '\"]') : null;\n if (islandScript && !islandScript.__stx_ran) {\n islandScript.__stx_ran = true;\n var chunkSrc = islandScript.getAttribute && islandScript.getAttribute('data-stx-src');\n if (chunkSrc) {\n // Chunked island (production build): the IIFE lives in a separate\n // file fetched only now. Load it via a real <script src> (CSP-clean \u2014\n // no eval/new Function) and defer ALL downstream work to its load\n // event, since the scope isn't registered until the chunk executes.\n var s = document.createElement('script');\n s.src = chunkSrc;\n // Subresource Integrity (opt-in at build): pin the chunk's bytes.\n var integ = islandScript.getAttribute('data-stx-integrity');\n if (integ) s.integrity = integ;\n s.onload = finishHydrate;\n s.onerror = function() {\n // Network error / 404: the island can't become interactive. Log,\n // emit an observable event (analytics/monitoring can react), then\n // best-effort finish. The server-rendered HTML stays visible\n // (x-cloak was already removed on arming) \u2014 it just won't wire up.\n console.error('[stx] island chunk load failed:', sid, chunkSrc);\n window.dispatchEvent(new CustomEvent('stx:island-error', { detail: { el: el, scopeId: sid, src: chunkSrc } }));\n finishHydrate();\n };\n document.head.appendChild(s);\n return; // finishHydrate runs from the chunk's load event\n }\n // Inline island (dev / SSR / chunking off): execute synchronously.\n // eslint-disable-next-line no-new-func\n try { (new Function(islandScript.textContent))(); }\n catch (e) { console.error('[stx] island setup error:', sid, e); }\n }\n finishHydrate();\n };\n\n // Record how to cancel a still-pending trigger so SPA navigation can tear it\n // down \u2014 otherwise an unhydrated island's observer/timer/listener leaks and\n // may fire run() on a detached element after the page swapped (#1746).\n // Cleared once run() fires (it guards on __stx_hydrated anyway).\n if (trigger === 'idle') {\n if (typeof requestIdleCallback === 'function') {\n var idleId = requestIdleCallback(run, { timeout: 2000 });\n el.__stx_hydration_cancel = function() { if (typeof cancelIdleCallback === 'function') cancelIdleCallback(idleId); };\n }\n else {\n var idleTimer = setTimeout(run, 200);\n el.__stx_hydration_cancel = function() { clearTimeout(idleTimer); };\n }\n }\n else if (trigger === 'visible') {\n if (typeof IntersectionObserver === 'function') {\n var io = new IntersectionObserver(function(entries) {\n entries.forEach(function(e) {\n if (e.isIntersecting) { io.disconnect(); run(); }\n });\n }, { rootMargin: '50px' });\n io.observe(el);\n el.__stx_hydration_cancel = function() { io.disconnect(); };\n } else {\n run(); // fallback: no IO support, hydrate immediately\n }\n }\n else if (trigger === 'interaction') {\n var events = ['mouseenter', 'click', 'focusin', 'touchstart'];\n var handler = function() {\n events.forEach(function(ev) { el.removeEventListener(ev, handler); });\n run();\n };\n events.forEach(function(ev) { el.addEventListener(ev, handler, { once: true, passive: true }); });\n el.__stx_hydration_cancel = function() { events.forEach(function(ev) { el.removeEventListener(ev, handler); }); };\n }\n else if (trigger && trigger.indexOf('media:') === 0) {\n var query = trigger.slice(6);\n var mql = window.matchMedia(query);\n if (mql.matches) run();\n else {\n var mqHandler = function(e) {\n if (e.matches) { mql.removeEventListener('change', mqHandler); run(); }\n };\n mql.addEventListener('change', mqHandler);\n el.__stx_hydration_cancel = function() { mql.removeEventListener('change', mqHandler); };\n }\n }\n else {\n // Unknown trigger \u2014 hydrate immediately\n run();\n }\n }\n";
2
+ export declare const SIGNALS_LAZY_HYDRATION_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Lifecycle queues and scope-aware hook ownership for the client runtime. */
2
- export declare const SIGNALS_LIFECYCLE_RUNTIME = " // ==========================================================================\n // Lifecycle\n // ==========================================================================\n\n const mountCallbacks = [];\n const destroyCallbacks = [];\n\n function currentLifecycleScope() {\n var el = window.__STX_CURRENT_ELEMENT__;\n if (!el || !el.getAttribute || !window.stx || !window.stx._scopes) return null;\n var scopeId = el.getAttribute('data-stx-scope');\n return scopeId ? window.stx._scopes[scopeId] || null : null;\n }\n\n function onMount(fn) {\n var scope = currentLifecycleScope();\n if (scope) {\n scope.__mountCallbacks = scope.__mountCallbacks || [];\n scope.__mountCallbacks.push(fn);\n // Kept apart from the queue, which a flush drains: a component behind an\n // :if mounts again every time it is shown (see suspendSubtreeScopes).\n scope.__mountHooks = scope.__mountHooks || [];\n scope.__mountHooks.push(fn);\n return;\n }\n mountCallbacks.push(fn);\n }\n\n // Where an onDestroy called from inside a running mount callback belongs:\n // the queue runMountCallbacks is parking cleanups on, which is the mounting\n // component's own. Null outside a flush.\n //\n // Without it such a call, typically a composable like useEventListener\n // invoked in onMount, found no current element and went to the global\n // queue, and every stx:load drains that queue. A component that stays on\n // the page across navigations (one the layout renders) lost the listener at\n // the first navigation while its markup stayed bound (#1958).\n var activeDestroySink = null;\n\n function onDestroy(fn) {\n var scope = currentLifecycleScope();\n if (scope) {\n scope.__destroyCallbacks = scope.__destroyCallbacks || [];\n scope.__destroyCallbacks.push(fn);\n // Registered once, at setup, and owed at every unmount -- including each\n // time an :if hides the component (see suspendSubtreeScopes).\n scope.__destroyHooks = scope.__destroyHooks || [];\n scope.__destroyHooks.push(fn);\n return;\n }\n if (activeDestroySink) {\n activeDestroySink.push(fn);\n return;\n }\n destroyCallbacks.push(fn);\n }\n\n // Run mount callbacks and keep whatever teardown they hand back.\n //\n // A mount callback may return its own cleanup \u2014 the shape LifecycleCallback\n // has always declared, and the shape every peer framework uses. Only the two\n // component-factory paths honoured it; the other flush sites called fn() and\n // dropped the result on the floor, so the teardown never ran and nothing said\n // so. A listener or timer registered that way outlived its element and leaked\n // once per re-render (#1857).\n //\n // The sink argument is where a returned cleanup is parked: a scoped flush\n // passes that scope's __destroyCallbacks, a global flush passes the module\n // queue. (No backticks in this comment \u2014 it lives inside a template literal.)\n function runMountCallbacks(list, sink) {\n if (!list || !list.length) return;\n var target = sink || destroyCallbacks;\n // Drain before running. A mount callback fires once, and leaving the queue\n // in place made that untrue: the DOM-ready handler reaches this with the\n // same shared mountCallbacks array twice \u2014 once inside the per-root\n // hydration loop, then again for the global pass \u2014 and only emptied it\n // after the second call. So every onMount on a page with a data-stx root\n // ran twice, and a page with N roots ran them N+1 times. Every request the\n // hook made was duplicated with it.\n // Taking the batch out first also keeps a callback that registers another\n // onMount honest: the new one queues for the next flush instead of being\n // swallowed by the clear or replayed by the next caller.\n var batch = list.splice(0, list.length);\n // An onDestroy registered while the batch runs joins the same queue as a\n // returned cleanup. Saved and restored, so a mount that mounts something\n // else (stx.mount inside onMount) hands the outer sink back afterwards.\n var previousSink = activeDestroySink;\n activeDestroySink = target;\n try {\n for (var i = 0; i < batch.length; i++) {\n try {\n var cleanup = batch[i]();\n if (typeof cleanup === 'function') target.push(cleanup);\n }\n catch (e) { console.error('[stx] onMount error:', e); }\n }\n }\n finally {\n activeDestroySink = previousSink;\n }\n }\n\n // The scope's own teardown queue, created on demand so a scope that never\n // returns a cleanup does not carry an empty array around.\n function scopeDestroySink(scopeVars) {\n if (!scopeVars) return destroyCallbacks;\n scopeVars.__destroyCallbacks = scopeVars.__destroyCallbacks || [];\n return scopeVars.__destroyCallbacks;\n }\n\n // Drain any early mount/destroy calls captured by the pre-initialization shim\n if (window.__stx_early_mounts) { window.__stx_early_mounts.forEach(function(fn) { mountCallbacks.push(fn); }); window.__stx_early_mounts = null; }\n if (window.__stx_early_destroys) { window.__stx_early_destroys.forEach(function(fn) { destroyCallbacks.push(fn); }); window.__stx_early_destroys = null; }\n";
2
+ export declare const SIGNALS_LIFECYCLE_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Loop component scope remapping helpers for the generated client runtime. */
2
- export declare const SIGNALS_LOOP_COMPONENT_REMAP_RUNTIME = " var __forComponentScopeCounter = 0;\n var __forComponentSetupFactories = new Map();\n\n function forEachGroupElement(nodes, callback) {\n function visit(node, insideTemplateContent) {\n if (!node || node.nodeType !== Node.ELEMENT_NODE) return;\n callback(node, insideTemplateContent);\n\n // HTMLTemplateElement children live in template.content, outside the\n // element's ordinary descendant tree. Component roots and setup scripts\n // wrapped by caller-owned :if/:for directives must still be discoverable\n // for scope remapping before those templates are cloned.\n var entersTemplateContent = node.tagName === 'TEMPLATE' && node.content;\n var childRoot = entersTemplateContent\n ? node.content\n : node;\n Array.from(childRoot.childNodes || []).forEach(function(child) {\n visit(child, insideTemplateContent || entersTemplateContent);\n });\n }\n\n nodes.forEach(function(node) { visit(node, false); });\n }\n\n // A signal component expanded inside <template :for> carries a compiled\n // data-stx-scope id and setup script. cloneNode() used to duplicate that id\n // for every row, so all instances shared the first child's props and state.\n // Give each cloned component tree its own ids before insertion, and rewrite\n // the setup scripts that target those ids.\n function remapForComponentScopes(nodes) {\n var scopeMap = {};\n forEachGroupElement(nodes, function(node) {\n if (!node.hasAttribute || !node.hasAttribute('data-stx-scope')) return;\n var oldId = node.getAttribute('data-stx-scope');\n if (!oldId) return;\n if (!scopeMap[oldId])\n scopeMap[oldId] = oldId + '_for_' + (++__forComponentScopeCounter);\n // Keep the compiler's original id through any additional structural\n // clones. DOM cloneNode() preserves attributes but not expando fields.\n if (!node.hasAttribute('data-stx-template-scope'))\n node.setAttribute('data-stx-template-scope', oldId);\n node.setAttribute('data-stx-scope', scopeMap[oldId]);\n });\n\n var oldIds = Object.keys(scopeMap);\n if (!oldIds.length) return;\n\n forEachGroupElement(nodes, function(node) {\n if (node.attributes) {\n Array.from(node.attributes).forEach(function(rawAttribute) {\n var attribute = Array.isArray(rawAttribute)\n ? { name: rawAttribute[0], value: rawAttribute[1] }\n : rawAttribute;\n if (!attribute || attribute.name === 'data-stx-scope' || attribute.name === 'data-stx-template-scope') return;\n var value = attribute.value;\n if (typeof value !== 'string') return;\n oldIds.forEach(function(oldId) {\n if (value.indexOf(oldId) !== -1)\n value = value.split(oldId).join(scopeMap[oldId]);\n });\n if (value !== attribute.value) node.setAttribute(attribute.name, value);\n });\n }\n });\n }\n";
2
+ export declare const SIGNALS_LOOP_COMPONENT_REMAP_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Loop-row conditional deferral for the generated client runtime. */
2
- export declare const SIGNALS_LOOP_CONDITIONAL_RUNTIME = " // A :for row is a clone of its template, so a conditional element in the row\n // is built for every row whether or not its condition ever holds; :if then\n // parks the false ones. In WebKit a <video> or <audio> sets up a media player\n // as it is created: a message list with one media slot per attachment took\n // 1.8s to render instead of 18ms, and every row paid for elements it never\n // showed. Before any row is cloned, each eligible conditional element in the\n // row template is moved into a <template> carrying its condition. Template\n // content is inert, so a cloned row builds the element only when the\n // condition holds (bindIf clones template content on the first true).\n //\n // Left alone: an if/else chain (its branches must stay siblings), an element\n // that is also a loop, a component (its setup script is a sibling), and\n // anything holding a script.\n var IF_ATTRS = [':if', 'x-if', '@if'];\n var FOR_ATTRS = [':for', 'x-for', '@for'];\n function deferRowConditionals(root) {\n if (stxHost.isNative || !root || !root.querySelectorAll || typeof document === 'undefined' || !document.createElement) return;\n // Inert HTML template content is a DOM allocation optimisation. Native\n // hosts already clone recorded descriptors and bind conditions through\n // their host operations; their document facade has no template content.\n if (!document.createElement('template').content) return;\n // A walk, not a selector: escaping ':' and '@' in an attribute selector\n // through this generated source is easy to get wrong, and wrong throws.\n var candidates = Array.prototype.slice.call(root.querySelectorAll('*'));\n for (var i = 0; i < candidates.length; i++) {\n var el = candidates[i];\n if (el.tagName === 'TEMPLATE' || !el.parentNode) continue;\n var attr = null;\n for (var a = 0; a < IF_ATTRS.length; a++) {\n if (el.hasAttribute(IF_ATTRS[a])) { attr = IF_ATTRS[a]; break; }\n }\n if (!attr) continue;\n var skip = false;\n for (var f = 0; f < FOR_ATTRS.length; f++) {\n if (el.hasAttribute(FOR_ATTRS[f])) skip = true;\n }\n if (skip || getElseAttrInfo(el)) continue;\n var next = el.nextElementSibling;\n if (next && (getElseAttrInfo(next) || next.tagName === 'SCRIPT')) continue;\n if (el.hasAttribute('data-stx-scope') || el.hasAttribute('x-data') || el.querySelector('script')) continue;\n var holder = document.createElement('template');\n holder.setAttribute(attr, el.getAttribute(attr));\n el.removeAttribute(attr);\n el.parentNode.insertBefore(holder, el);\n holder.content.appendChild(el);\n }\n }\n";
2
+ export declare const SIGNALS_LOOP_CONDITIONAL_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Loop-row ownership and placeholder helpers for the generated client runtime. */
2
- export declare const SIGNALS_LOOP_ROW_RUNTIME = " // A loop row binds in its own iteration scope, and only its loop puts it\n // there. A walk from further out (an enclosing :if hydrating the branch it\n // shows) carries no item, so it used to bind whatever in the row was still\n // unbound -- a conditional's children, waiting for their own deferred pass\n // -- against a scope without the row: on a native screen every card's\n // compliance chip came out empty. Such a walk now leaves the row alone.\n function markLoopRow(row, itemName, itemSignal) {\n row.__stx_loop_row = { name: itemName, signal: itemSignal };\n }\n function isForeignToLoopRow(el, scope) {\n var row = el.__stx_loop_row;\n return !!row && (!scope || scope[row.name] !== row.signal);\n }\n\n // Where a structural directive's output goes is wherever its placeholder\n // is NOW, not the parent it was bound under. Something may move the\n // placeholder after binding: the router adopts the first page into a\n // retained screen (<div data-stx-screen>) by moving the container's\n // children, and an app may move a node itself. A :for or :if at the top\n // level of a page kept inserting into the container while its placeholder\n // sat in the screen, and the browser threw \"insertBefore: the node before\n // which the new node is to be inserted is not a child of this node\" -- the\n // page went blank the first time a top-level condition changed. The\n // if/else chain has always inserted at its placeholder's parent; :if and\n // :for now do the same. Hidden nodes registered on the old parent (#1954)\n // follow, so a later disposal walk of the new one still finds them.\n function followPlaceholder(placeholder, parent, nodes) {\n var now = placeholder.parentNode;\n if (!now || now === parent) return parent;\n var held = parent && parent.__stx_detached_if;\n if (held && nodes) {\n nodes.forEach(function(node) {\n if (!held.has(node)) return;\n held.delete(node);\n if (!now.__stx_detached_if) now.__stx_detached_if = new Set();\n now.__stx_detached_if.add(node);\n });\n }\n return now;\n }\n";
2
+ export declare const SIGNALS_LOOP_ROW_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Manifest-driven browser and native hydration for the generated client runtime. */
2
- export declare const SIGNALS_MANIFEST_HYDRATION_RUNTIME = " /**\n * Bind what the server said carries a binding, instead of looking for it.\n *\n * The walk exists because the runtime does not know where the bindings are.\n * The server does -- it rendered them -- so when it ships that list the\n * runtime stops searching: resolve each id, bind that element, never touch\n * its children. An element with no bindings is never visited at all.\n *\n * This is the piece a native host needs. A view hierarchy has no attributes\n * to read and no selector to match, so discovery cannot happen there; handed\n * the list, it does not have to. On the DOM the ids resolve by attribute,\n * which is one query per entry rather than a full traversal.\n *\n * Absent a manifest nothing changes: the walk is still the default, and a\n * page that ships no list hydrates exactly as it did.\n */\n function processFromManifest(root, scope, manifest, resolvedNodes) {\n // Arrays have an entries() method too. Prefer the array itself before\n // accepting the compiled document shape { entries: [...] }.\n var entries = Array.isArray(manifest)\n ? manifest\n : (manifest && Array.isArray(manifest.entries) ? manifest.entries : null);\n if (!entries || !entries.length || (!root && !resolvedNodes)) return false;\n for (var i = 0; i < entries.length; i++) {\n var entry = entries[i];\n var id = entry && entry.id;\n if (id === undefined || id === null) continue;\n // Native compilation already has stable handles for every manifest id.\n // Accept those handles directly so a non-DOM host never needs selectors\n // or an attribute walk. The browser keeps its existing lookup fallback.\n var node = resolvedNodes\n ? (typeof resolvedNodes.get === 'function' ? resolvedNodes.get(id) : resolvedNodes[id])\n : null;\n if (!node && root) {\n node = root.getAttribute && root.getAttribute('data-stx-b') === String(id)\n ? root\n : (root.querySelector ? root.querySelector('[data-stx-b=\"' + id + '\"]') : null);\n }\n if (!node) continue;\n // A structural binding can detach its source before a later manifest\n // entry reaches one of that source's children. Native handles expose\n // this state directly; do not register effects or handlers for a view\n // that no longer exists in the host tree. Browser hydration keeps its\n // existing behaviour because it does not pass resolvedNodes here.\n if (resolvedNodes && node.__stxId !== undefined && node.isConnected === false) continue;\n processElement(node, scope, true);\n }\n return true;\n }\n\n // Bind a precompiled host tree without waiting for DOMContentLoaded. Native\n // passes its manifest id to node-handle table; browser hydration continues\n // through the document-ready path below. The same state, effect, expression,\n // event and host implementations are used by both.\n function hydrateHost(root, setup, manifest, resolvedNodes) {\n var mountStart = mountCallbacks.length;\n var destroyStart = destroyCallbacks.length;\n var outerSink = activeDestroySink;\n activeDestroySink = null;\n var values;\n try { values = typeof setup === 'function' ? setup() : setup; }\n finally { activeDestroySink = outerSink; }\n var localMountHooks = mountCallbacks.splice(mountStart);\n var localDestroyHooks = destroyCallbacks.splice(destroyStart);\n var scope = Object.assign({ $refs: {} }, values || {});\n var disposeEffects = trackEffects(function() {\n processFromManifest(root, scope, manifest, resolvedNodes);\n });\n runMountCallbacks(localMountHooks, localDestroyHooks);\n var mounted = true;\n return function disposeHost() {\n if (!mounted) return;\n mounted = false;\n disposeEffects();\n var hooks = localDestroyHooks.splice(0, localDestroyHooks.length);\n for (var i = 0; i < hooks.length; i++) {\n try { hooks[i](); }\n catch (e) { console.warn('[stx] native destroy error:', e); }\n }\n };\n }\n";
2
+ export declare const SIGNALS_MANIFEST_HYDRATION_RUNTIME: string;