@stacksjs/stx 0.2.572 → 0.2.573

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 (381) 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-f4jh9vrj.js → chunk-0s647d0b.js} +53 -53
  35. package/dist/{chunk-09gtbb1w.js → chunk-1bsafdnt.js} +1 -1
  36. package/dist/{chunk-m6mxqepz.js → chunk-1btr5tme.js} +1 -1
  37. package/dist/{chunk-01mxer9s.js → chunk-2g6wcnna.js} +1 -1
  38. package/dist/{chunk-rrj5m9xv.js → chunk-2hg2bqtj.js} +1 -1
  39. package/dist/{chunk-xckzvbvn.js → chunk-4f0fh2a9.js} +1 -1
  40. package/dist/chunk-557wtdps.js +2 -0
  41. package/dist/{chunk-vr36s2en.js → chunk-58vrf6kh.js} +1 -1
  42. package/dist/{chunk-qzbzn1yf.js → chunk-6tsnz28m.js} +1 -1
  43. package/dist/{chunk-cvswrbzw.js → chunk-6x8cwscv.js} +1 -1
  44. package/dist/{chunk-1n64749x.js → chunk-74ew8ajw.js} +1 -1
  45. package/dist/{chunk-jqefcghh.js → chunk-78d6yyxz.js} +2 -2
  46. package/dist/{chunk-83fdt4yj.js → chunk-824cnbac.js} +1 -1
  47. package/dist/{chunk-ntgy4e1q.js → chunk-864xm0jy.js} +1 -1
  48. package/dist/{chunk-nn174xjh.js → chunk-9fbkdrm8.js} +1 -1
  49. package/dist/{chunk-kzjrgh0b.js → chunk-a3gvw1q2.js} +1 -1
  50. package/dist/{chunk-pqcvh9pp.js → chunk-amtrg7pn.js} +1 -1
  51. package/dist/{chunk-pw9verqx.js → chunk-b5fpsp5n.js} +1 -1
  52. package/dist/{chunk-5afw7z6v.js → chunk-bcjr3fw7.js} +1 -1
  53. package/dist/{chunk-n6qp05t9.js → chunk-bkj0j5se.js} +1 -1
  54. package/dist/{chunk-mzqyv7s5.js → chunk-cf97xdqa.js} +1 -1
  55. package/dist/{chunk-cgwyd9aq.js → chunk-cr67dpx4.js} +1 -1
  56. package/dist/{chunk-f1apaqfk.js → chunk-dpqvacd1.js} +1 -1
  57. package/dist/{chunk-ghy82tsc.js → chunk-et8726at.js} +1 -1
  58. package/dist/{chunk-4bgfpkwx.js → chunk-ev8t5cxk.js} +1 -1
  59. package/dist/{chunk-s34g3awk.js → chunk-fynh3bkq.js} +1 -1
  60. package/dist/{chunk-gzgc8zk5.js → chunk-g8757f97.js} +2 -2
  61. package/dist/{chunk-3gft8zng.js → chunk-hm4j4d8q.js} +1 -1
  62. package/dist/{chunk-0bt0fbs1.js → chunk-j9qy9t3t.js} +5 -5
  63. package/dist/{chunk-2a1q5y6r.js → chunk-jhc47xzj.js} +1 -1
  64. package/dist/{chunk-79vdkvhf.js → chunk-kns5m52j.js} +1 -1
  65. package/dist/{chunk-2cqbyb8w.js → chunk-mjpewk4r.js} +1 -1
  66. package/dist/{chunk-2jjff8kv.js → chunk-nj488tj2.js} +2 -2
  67. package/dist/{chunk-dcpf6kas.js → chunk-q9chv68c.js} +1 -1
  68. package/dist/{chunk-xq2ck69k.js → chunk-qm280dp3.js} +1 -1
  69. package/dist/{chunk-ymawe0y5.js → chunk-sjcstv33.js} +1 -1
  70. package/dist/{chunk-tc5r2vmw.js → chunk-t0zdz8kd.js} +1 -1
  71. package/dist/{chunk-jwvzvapp.js → chunk-t3dnak1j.js} +1 -1
  72. package/dist/{chunk-2jsnrfc8.js → chunk-t64nnmmj.js} +1 -1
  73. package/dist/{chunk-m2a1fxpb.js → chunk-tvb8p7c0.js} +1 -1
  74. package/dist/{chunk-6f4qrd0s.js → chunk-tyhgq6rw.js} +1 -1
  75. package/dist/{chunk-4wfr074d.js → chunk-vn7tc8hm.js} +1 -1
  76. package/dist/{chunk-y4ajd836.js → chunk-xy6g8zb9.js} +1 -1
  77. package/dist/{chunk-zddzjd60.js → chunk-ya7xks9t.js} +1 -1
  78. package/dist/chunk-zpz6q2fh.js +2 -0
  79. package/dist/chunk-zxt94g45.js +2 -0
  80. package/dist/{chunk-cyg9w31a.js → chunk-zz7tw07b.js} +1 -1
  81. package/dist/{chunk-ta8bhz27.js → chunk-zzcxacjf.js} +1 -1
  82. package/dist/cli.js +7 -7
  83. package/dist/client/directive.d.ts +0 -7
  84. package/dist/client/index.d.ts +1 -0
  85. package/dist/client/signals-appearance-runtime.d.ts +1 -1
  86. package/dist/client/signals-binding-utils-runtime.d.ts +1 -1
  87. package/dist/client/signals-bootstrap-runtime.d.ts +2 -2
  88. package/dist/client/signals-class-runtime.d.ts +1 -1
  89. package/dist/client/signals-component-api-runtime.d.ts +1 -1
  90. package/dist/client/signals-component-hydration-runtime.d.ts +1 -1
  91. package/dist/client/signals-component-props-runtime.d.ts +1 -1
  92. package/dist/client/signals-conditional-chain-runtime.d.ts +1 -1
  93. package/dist/client/signals-conditional-component-runtime.d.ts +1 -1
  94. package/dist/client/signals-container-cleanup-runtime.d.ts +1 -1
  95. package/dist/client/signals-context-runtime.d.ts +1 -1
  96. package/dist/client/signals-cookie-runtime.d.ts +1 -1
  97. package/dist/client/signals-devtools-runtime.d.ts +1 -1
  98. package/dist/client/signals-dialog-runtime.d.ts +1 -1
  99. package/dist/client/signals-dom-ready-runtime.d.ts +1 -1
  100. package/dist/client/signals-drawer-runtime.d.ts +1 -1
  101. package/dist/client/signals-effect-runtime.d.ts +1 -1
  102. package/dist/client/signals-event-shorthand-runtime.d.ts +1 -1
  103. package/dist/client/signals-expression-compiler-runtime.d.ts +1 -1
  104. package/dist/client/signals-expression-runtime.d.ts +1 -1
  105. package/dist/client/signals-fetch-transport-runtime.d.ts +1 -1
  106. package/dist/client/signals-for-runtime.d.ts +1 -1
  107. package/dist/client/signals-globals-runtime.d.ts +1 -1
  108. package/dist/client/signals-handler-runtime.d.ts +1 -1
  109. package/dist/client/signals-head-runtime.d.ts +1 -1
  110. package/dist/client/signals-helpers-runtime.d.ts +1 -1
  111. package/dist/client/signals-host-runtime.d.ts +1 -1
  112. package/dist/client/signals-hydration-audit-runtime.d.ts +1 -1
  113. package/dist/client/signals-hydration-runtime.d.ts +1 -1
  114. package/dist/client/signals-if-chain-runtime.d.ts +1 -1
  115. package/dist/client/signals-if-runtime.d.ts +1 -1
  116. package/dist/client/signals-lazy-hydration-runtime.d.ts +1 -1
  117. package/dist/client/signals-lifecycle-runtime.d.ts +1 -1
  118. package/dist/client/signals-loop-component-remap-runtime.d.ts +1 -1
  119. package/dist/client/signals-loop-conditional-runtime.d.ts +1 -1
  120. package/dist/client/signals-loop-row-runtime.d.ts +1 -1
  121. package/dist/client/signals-manifest-hydration-runtime.d.ts +1 -1
  122. package/dist/client/signals-model-runtime.d.ts +1 -1
  123. package/dist/client/signals-mount-runtime.d.ts +1 -1
  124. package/dist/client/signals-navigation-runtime.d.ts +1 -1
  125. package/dist/client/signals-notify-runtime.d.ts +1 -1
  126. package/dist/client/signals-optimistic-runtime.d.ts +1 -1
  127. package/dist/client/signals-overlay-runtime.d.ts +1 -1
  128. package/dist/client/signals-pipe-runtime.d.ts +1 -1
  129. package/dist/client/signals-proxy-runtime.d.ts +1 -1
  130. package/dist/client/signals-query-runtime.d.ts +1 -1
  131. package/dist/client/signals-reactive-runtime.d.ts +1 -1
  132. package/dist/client/signals-ref-runtime.d.ts +1 -1
  133. package/dist/client/signals-scope-disposal-runtime.d.ts +1 -1
  134. package/dist/client/signals-scope-traversal-runtime.d.ts +1 -1
  135. package/dist/client/signals-show-runtime.d.ts +1 -1
  136. package/dist/client/signals-spa-load-control-runtime.d.ts +1 -1
  137. package/dist/client/signals-spa-load-runtime.d.ts +1 -1
  138. package/dist/client/signals-state-runtime.d.ts +1 -1
  139. package/dist/client/signals-storage-runtime.d.ts +1 -1
  140. package/dist/client/signals-store-registry-runtime.d.ts +1 -1
  141. package/dist/client/signals-style-runtime.d.ts +1 -1
  142. package/dist/client/signals-suspense-runtime.d.ts +1 -1
  143. package/dist/client/signals-timer-runtime.d.ts +1 -1
  144. package/dist/client/signals-toast-runtime.d.ts +1 -1
  145. package/dist/client/signals-tooltip-runtime.d.ts +1 -1
  146. package/dist/client/signals-transition-group-runtime.d.ts +1 -1
  147. package/dist/client/signals-websocket-runtime.d.ts +1 -1
  148. package/dist/client-helpers.d.ts +1 -312
  149. package/dist/client-module-registry.d.ts +4 -27
  150. package/dist/client-parameter-bindings.d.ts +1 -4
  151. package/dist/client-script-bundler.d.ts +55 -103
  152. package/dist/client-script.d.ts +69 -127
  153. package/dist/color-mode-boot.d.ts +21 -58
  154. package/dist/component-client-factories.d.ts +8 -9
  155. package/dist/component-contract-checks.d.ts +15 -18
  156. package/dist/component-contract.d.ts +6 -6
  157. package/dist/component-hmr.d.ts +8 -7
  158. package/dist/component-model.d.ts +14 -20
  159. package/dist/component-processing.d.ts +51 -59
  160. package/dist/component-registry.d.ts +28 -99
  161. package/dist/component-renderer.d.ts +19 -16
  162. package/dist/component-resolution.d.ts +8 -8
  163. package/dist/component-tags.d.ts +1 -1
  164. package/dist/composable-loader.d.ts +6 -41
  165. package/dist/composables/use-fetch.d.ts +45 -114
  166. package/dist/composables/use-form.d.ts +2 -56
  167. package/dist/composables/use-intersection-observer.d.ts +1 -1
  168. package/dist/composables.d.ts +75 -74
  169. package/dist/composition-api.d.ts +19 -43
  170. package/dist/computed.d.ts +93 -86
  171. package/dist/conditionals.d.ts +0 -24
  172. package/dist/config.d.ts +30 -24
  173. package/dist/config.js +3 -0
  174. package/dist/craft-bridge.d.ts +1 -467
  175. package/dist/craft-components.d.ts +234 -680
  176. package/dist/craft-entry.js +1 -1
  177. package/dist/craft.js +1 -1
  178. package/dist/csp.d.ts +41 -107
  179. package/dist/database.d.ts +1 -1
  180. package/dist/defer.d.ts +0 -24
  181. package/dist/dev-server/terminal-colors.d.ts +32 -32
  182. package/dist/dev-server/ts-css.d.ts +26 -35
  183. package/dist/dev-server/types.d.ts +33 -29
  184. package/dist/directive-api.d.ts +42 -85
  185. package/dist/directive-arguments.d.ts +14 -39
  186. package/dist/document-shell.d.ts +49 -81
  187. package/dist/dynamic-components.d.ts +0 -9
  188. package/dist/engine-bindings.d.ts +1 -1
  189. package/dist/env.d.ts +26 -0
  190. package/dist/error-boundaries.d.ts +36 -43
  191. package/dist/error-handling.d.ts +1 -1
  192. package/dist/errors/codes.d.ts +43 -51
  193. package/dist/errors/formatter.d.ts +38 -58
  194. package/dist/errors/index.d.ts +61 -5
  195. package/dist/errors/logger.d.ts +40 -114
  196. package/dist/errors/sanitizer.d.ts +28 -53
  197. package/dist/errors/types.d.ts +31 -44
  198. package/dist/events.d.ts +32 -94
  199. package/dist/expressions.d.ts +57 -62
  200. package/dist/find-body-tag.d.ts +5 -34
  201. package/dist/first-script-tag.d.ts +0 -23
  202. package/dist/forms-validation.d.ts +117 -149
  203. package/dist/forms.d.ts +161 -120
  204. package/dist/framework-composables.d.ts +0 -32
  205. package/dist/head-injection.d.ts +30 -32
  206. package/dist/head-keys.d.ts +12 -15
  207. package/dist/head.d.ts +110 -139
  208. package/dist/heatmap.d.ts +76 -152
  209. package/dist/html-masking.d.ts +38 -62
  210. package/dist/hydration-runtime.d.ts +24 -20
  211. package/dist/hydration.d.ts +11 -10
  212. package/dist/i18n.d.ts +34 -95
  213. package/dist/image-optimization/auto-sibling.d.ts +4 -32
  214. package/dist/imported-signals.d.ts +0 -36
  215. package/dist/includes.d.ts +6 -69
  216. package/dist/index.d.ts +2 -1
  217. package/dist/init.d.ts +12 -20
  218. package/dist/internal-markdown.d.ts +8 -12
  219. package/dist/interpolation-context.d.ts +15 -15
  220. package/dist/island-chunking.d.ts +13 -30
  221. package/dist/keep-alive.d.ts +52 -72
  222. package/dist/layout-types.d.ts +2 -27
  223. package/dist/lazy-module.d.ts +0 -10
  224. package/dist/loading-indicator.d.ts +8 -5
  225. package/dist/loop-binding.d.ts +4 -7
  226. package/dist/loops.d.ts +25 -67
  227. package/dist/markdown.d.ts +1 -0
  228. package/dist/media/image/component.d.ts +9 -25
  229. package/dist/media/image/directive.d.ts +1 -15
  230. package/dist/media/image/placeholder.d.ts +9 -20
  231. package/dist/media/image/processor/cache.d.ts +18 -40
  232. package/dist/media/image/processor/index.d.ts +10 -1
  233. package/dist/media/image/processor/optimizer.d.ts +1 -12
  234. package/dist/media/image/processor/responsive.d.ts +6 -16
  235. package/dist/media/image/srcset.d.ts +49 -47
  236. package/dist/media/shared/cache.d.ts +31 -51
  237. package/dist/media/shared/hash.d.ts +0 -7
  238. package/dist/media/types.d.ts +754 -1235
  239. package/dist/media/video/directive.d.ts +1 -15
  240. package/dist/media/video/index.d.ts +17 -39
  241. package/dist/media/video/processor/cache.d.ts +19 -42
  242. package/dist/media/video/processor/index.d.ts +18 -1
  243. package/dist/media/video/processor/streaming.d.ts +10 -17
  244. package/dist/media/video/processor/thumbnail.d.ts +15 -21
  245. package/dist/media/video/processor/transcoder.d.ts +1 -11
  246. package/dist/meta-arguments.d.ts +14 -39
  247. package/dist/method-spoofing.d.ts +0 -7
  248. package/dist/middleware.d.ts +0 -60
  249. package/dist/native/bridge/protocol.d.ts +2 -1
  250. package/dist/native/compiler/headwind-to-style.d.ts +383 -359
  251. package/dist/native/compiler/icons.d.ts +249 -243
  252. package/dist/native/compiler/svg.d.ts +35 -24
  253. package/dist/native/runtime/jsc-globals.d.ts +1 -1
  254. package/dist/native/runtime/native-host.d.ts +1 -1
  255. package/dist/native/runtime/native-host.js +3 -0
  256. package/dist/offline/app-service-worker.d.ts +50 -114
  257. package/dist/offline/kept-store.d.ts +23 -37
  258. package/dist/offline/query-cache.d.ts +55 -126
  259. package/dist/owned-routes.d.ts +0 -31
  260. package/dist/page-response.d.ts +8 -39
  261. package/dist/parser/directive-parser.d.ts +45 -57
  262. package/dist/parser/expression-parser.d.ts +35 -33
  263. package/dist/parser/index.d.ts +39 -4
  264. package/dist/parser/tokenizer.d.ts +49 -61
  265. package/dist/partial-hydration.d.ts +51 -82
  266. package/dist/performance-utils.d.ts +115 -255
  267. package/dist/placeholder.d.ts +9 -18
  268. package/dist/plugin-system.d.ts +115 -264
  269. package/dist/process.d.ts +4 -9
  270. package/dist/process.js +6 -4
  271. package/dist/prop-sentinels.d.ts +11 -11
  272. package/dist/public-env.d.ts +0 -14
  273. package/dist/pwa/directives.d.ts +20 -12
  274. package/dist/pwa/inject.d.ts +0 -10
  275. package/dist/pwa/precache.d.ts +16 -22
  276. package/dist/pwa/service-worker.d.ts +0 -12
  277. package/dist/pwa.js +1 -1
  278. package/dist/reactive-bindings.d.ts +11 -34
  279. package/dist/reactive-tracking.d.ts +0 -36
  280. package/dist/reactive.d.ts +41 -58
  281. package/dist/render-memo.d.ts +5 -23
  282. package/dist/resolve-stx-targets.d.ts +6 -44
  283. package/dist/route-middleware.d.ts +35 -2
  284. package/dist/route-rules.d.ts +10 -13
  285. package/dist/router.d.ts +9 -8
  286. package/dist/routes.d.ts +3 -1
  287. package/dist/runtime-config-server.d.ts +14 -17
  288. package/dist/runtime-config.d.ts +2 -3
  289. package/dist/runtime-globals.d.ts +90 -122
  290. package/dist/runtime-injection.d.ts +0 -8
  291. package/dist/scaffolding.d.ts +30 -26
  292. package/dist/script-emit.d.ts +0 -30
  293. package/dist/script-validation.d.ts +6 -12
  294. package/dist/seo.d.ts +75 -153
  295. package/dist/server-api.d.ts +9 -12
  296. package/dist/server-bindings.d.ts +1 -26
  297. package/dist/server-data.d.ts +4 -5
  298. package/dist/sfc-template.d.ts +8 -8
  299. package/dist/signal-processing.d.ts +37 -53
  300. package/dist/signals-api.d.ts +58 -135
  301. package/dist/signals.d.ts +18 -24
  302. package/dist/site-url.d.ts +31 -28
  303. package/dist/slots.d.ts +20 -86
  304. package/dist/source-signature.d.ts +5 -28
  305. package/dist/ssg.d.ts +158 -337
  306. package/dist/ssg.js +2 -2
  307. package/dist/state-dir.d.ts +4 -4
  308. package/dist/store-loader.d.ts +0 -10
  309. package/dist/story/analytics.d.ts +60 -138
  310. package/dist/story/bookmarks.d.ts +34 -87
  311. package/dist/story/cli.d.ts +69 -123
  312. package/dist/story/collect/scanner.d.ts +0 -4
  313. package/dist/story/collect/tree.d.ts +1 -8
  314. package/dist/story/commands/build.d.ts +6 -11
  315. package/dist/story/commands/dev.d.ts +8 -15
  316. package/dist/story/commands/preview.d.ts +7 -13
  317. package/dist/story/config-watcher.d.ts +13 -20
  318. package/dist/story/config.d.ts +8 -11
  319. package/dist/story/context.d.ts +8 -14
  320. package/dist/story/hmr.d.ts +26 -24
  321. package/dist/story/hot-swap.d.ts +23 -34
  322. package/dist/story/keyboard-shortcuts.d.ts +18 -23
  323. package/dist/story/output.d.ts +44 -46
  324. package/dist/story/performance.d.ts +45 -107
  325. package/dist/story/presets.d.ts +41 -107
  326. package/dist/story/renderer.d.ts +27 -41
  327. package/dist/story/search.d.ts +12 -23
  328. package/dist/story/server.d.ts +11 -21
  329. package/dist/story/setup.d.ts +15 -23
  330. package/dist/story/testing.d.ts +40 -65
  331. package/dist/story/types.d.ts +160 -262
  332. package/dist/streaming.d.ts +57 -119
  333. package/dist/strip-literals.d.ts +1 -25
  334. package/dist/stx-module-imports.d.ts +7 -0
  335. package/dist/stx-virtual-ts.d.ts +102 -253
  336. package/dist/style-scoping.d.ts +8 -21
  337. package/dist/suspense.d.ts +52 -67
  338. package/dist/teleport.d.ts +0 -22
  339. package/dist/template-syntax-escape.d.ts +8 -8
  340. package/dist/template-tag-balance.d.ts +6 -22
  341. package/dist/testing.d.ts +26 -11
  342. package/dist/theme-tokens.d.ts +388 -134
  343. package/dist/transitions.d.ts +55 -66
  344. package/dist/ts-css-config.d.ts +12 -70
  345. package/dist/types/component-types.d.ts +122 -187
  346. package/dist/types/config-types.d.ts +341 -956
  347. package/dist/types/context-types.d.ts +24 -46
  348. package/dist/types/csp-types.d.ts +66 -70
  349. package/dist/types/directive-types.d.ts +156 -223
  350. package/dist/types/index.d.ts +110 -6
  351. package/dist/types/pwa-types.d.ts +148 -273
  352. package/dist/types.d.ts +1 -0
  353. package/dist/unresolved-identifiers.d.ts +22 -24
  354. package/dist/url-safety.d.ts +32 -32
  355. package/dist/utils.d.ts +21 -36
  356. package/dist/validator.d.ts +26 -28
  357. package/dist/variable-extractor.d.ts +19 -49
  358. package/dist/view-composers.d.ts +81 -80
  359. package/dist/virtual-scrolling.d.ts +82 -101
  360. package/dist/visual-testing.d.ts +10 -9
  361. package/dist/vue-template.d.ts +0 -23
  362. package/dist/web-components/css-scoping.d.ts +11 -21
  363. package/dist/web-components.d.ts +58 -81
  364. package/dist/x-element.d.ts +1 -0
  365. package/package.json +6 -6
  366. package/stx.d.ts +2 -2
  367. package/dist/app-service-worker.d.ts +0 -165
  368. package/dist/chunk-49gwmcrn.js +0 -2
  369. package/dist/chunk-6va5pe2m.js +0 -2
  370. package/dist/chunk-bm2q1srp.js +0 -2
  371. package/dist/signals-context-runtime.d.ts +0 -2
  372. package/dist/signals-drawer-runtime.d.ts +0 -2
  373. package/dist/signals-host-runtime.d.ts +0 -9
  374. package/dist/signals-loop-conditional-runtime.d.ts +0 -2
  375. package/dist/signals-manifest-hydration-runtime.d.ts +0 -2
  376. package/dist/signals-notify-runtime.d.ts +0 -2
  377. package/dist/signals-optimistic-runtime.d.ts +0 -2
  378. package/dist/signals-overlay-runtime.d.ts +0 -2
  379. package/dist/signals-scope-disposal-runtime.d.ts +0 -2
  380. package/dist/signals-spa-load-control-runtime.d.ts +0 -2
  381. package/dist/signals-storage-runtime.d.ts +0 -2
@@ -1,2 +1,2 @@
1
1
  /** DOM binding helpers shared by generated client directives. */
2
- export declare const SIGNALS_BINDING_UTILS_RUNTIME = " // Minimal attribute-only pass for the host element of a deferred subtree.\n // The full walk happens on children via processElement.\n function processAttributesOnly(el, scope) {\n // Just call processElement but mark it as already visited to prevent\n // infinite recursion via the stx-hydrate check below.\n el.__stx_hydrated = true;\n processElement(el, scope);\n }\n\n function isForDirectiveExpression(expr) {\n return typeof expr === 'string'\n && /^\\s*\\(?\\s*\\w+(?:\\s*,\\s*\\w+)?\\s*\\)?\\s+(?:in|of)\\s+.+\\s*$/.test(expr);\n }\n\n function getElementAttributes(el) {\n if (!el || !el.attributes) return [];\n return Array.from(el.attributes).map(function(attr) {\n // Browser DOM exposes Attr records through NamedNodeMap. HappyDOM and\n // other standards-oriented DOM implementations may expose Map entries\n // for cloned nodes instead. Normalize both shapes so reactive nodes\n // created by :for hydrate exactly like their browser counterparts.\n if (Array.isArray(attr)) return { name: attr[0], value: attr[1] };\n return attr;\n });\n }\n\n function getModelBinding(el) {\n if (!el || !el.attributes) return null;\n var prefixes = ['x-model', ':model', '@model'];\n var attrs = getElementAttributes(el);\n for (var i = 0; i < attrs.length; i++) {\n var name = attrs[i] && attrs[i].name;\n if (!name) continue;\n for (var j = 0; j < prefixes.length; j++) {\n if (name === prefixes[j] || name.indexOf(prefixes[j] + '.') === 0)\n return { name: name, expression: attrs[i].value };\n }\n }\n return null;\n }\n\n function readDeferredParentComponentProps(el) {\n var serialized = el.getAttribute('data-stx-deferred-parent-bindings');\n if (!serialized) return {};\n try {\n var parsed = JSON.parse(serialized);\n return parsed && typeof parsed === 'object' ? parsed : {};\n }\n catch (e) {\n return {};\n }\n }\n\n function preserveDeferredParentComponentProps(el) {\n var names = (el.getAttribute('data-stx-parent-bindings') || '').split(/\\s+/).filter(Boolean);\n if (!names.length) return;\n var deferred = readDeferredParentComponentProps(el);\n names.forEach(function(name) {\n var sourceName = ':' + name;\n if (el.hasAttribute(sourceName))\n deferred[name] = el.getAttribute(sourceName);\n });\n if (Object.keys(deferred).length)\n el.setAttribute('data-stx-deferred-parent-bindings', JSON.stringify(deferred));\n }\n\n function hasPendingLoopBoundary(el) {\n var loopBoundary = el;\n while (loopBoundary && loopBoundary !== document) {\n var loopExpression = loopBoundary.getAttribute && (\n loopBoundary.getAttribute('@for')\n || loopBoundary.getAttribute(':for')\n || loopBoundary.getAttribute('x-for')\n );\n if (loopExpression && isForDirectiveExpression(loopExpression))\n return true;\n loopBoundary = loopBoundary.parentElement || loopBoundary.parentNode;\n }\n return false;\n }\n\n function hasPendingAncestorLoopBoundary(el) {\n var loopBoundary = el && (el.parentElement || el.parentNode);\n while (loopBoundary && loopBoundary !== document) {\n var loopExpression = loopBoundary.getAttribute && (\n loopBoundary.getAttribute('@for')\n || loopBoundary.getAttribute(':for')\n || loopBoundary.getAttribute('x-for')\n );\n if (loopExpression && isForDirectiveExpression(loopExpression))\n return true;\n loopBoundary = loopBoundary.parentElement || loopBoundary.parentNode;\n }\n return false;\n }\n\n function syncComponentPropSignal(el, name, value) {\n if (!el || !el.getAttribute || value === undefined) return;\n var scopeId = el.getAttribute('data-stx-scope');\n var scopeVars = scopeId && window.stx._scopes && window.stx._scopes[scopeId];\n var camelName = name.replace(/-([a-z0-9])/g, function(_, character) {\n return character.toUpperCase();\n });\n // useReactiveProp signals are often intentionally aliased inside the\n // child, for example liveClosable = useReactiveProp('closable', true).\n // The public prop name therefore cannot be inferred from the variable\n // name exported by the component scope. Keep an element-owned registry as\n // the canonical bridge, with the scope lookup retained for older output.\n var propSignals = el.__stx_reactive_prop_signals;\n var propSignal = propSignals && (propSignals[name] || propSignals[camelName]);\n if (!propSignal && scopeVars)\n propSignal = scopeVars[name] || scopeVars[camelName];\n if (!propSignal || !propSignal._isSignal || typeof propSignal.set !== 'function') return;\n var directValues = el.__stx_direct_prop_values || (el.__stx_direct_prop_values = {});\n var directValue = {\n raw: el.hasAttribute(name) ? el.getAttribute(name) : null,\n value: value,\n };\n directValues[name] = directValue;\n directValues[camelName] = directValue;\n // This runs inside the parent binding effect. Reading the child prop\n // signal normally would subscribe that effect to its own output. Parent\n // expressions that return a fresh array or object would then recurse:\n // syncing the child retriggers the parent, which creates another value.\n // Compare without dependency tracking so the effect only follows the\n // caller-owned signals used by the binding expression.\n if (!Object.is(peek(function() { return propSignal(); }), value))\n propSignal.set(value);\n }\n";
2
+ export declare const SIGNALS_BINDING_UTILS_RUNTIME: string;
@@ -1,4 +1,4 @@
1
1
  /** Runtime preamble installed before any reactive APIs are created. */
2
- export declare const SIGNALS_PREAMBLE_RUNTIME = "\n// STX Signals Runtime (Development Build)\nconsole.log('[stx] signals runtime loading');\n// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs\n// (e.g. from partial scripts that execute before the full runtime is ready)\nif(!window.__stx_early_mounts)window.__stx_early_mounts=[];\nif(!window.__stx_early_destroys)window.__stx_early_destroys=[];\nif(!window.onMount)window.onMount=function(fn){window.__stx_early_mounts.push(fn)};\nif(!window.onDestroy)window.onDestroy=function(fn){window.__stx_early_destroys.push(fn)};\nconsole.log('[stx] entering IIFE');\n(function() {\n 'use strict';\n\n";
2
+ export declare const SIGNALS_PREAMBLE_RUNTIME: string;
3
3
  /** Browser-only setup that must run after the host adapter is selected. */
4
- export declare const SIGNALS_CLOAK_RUNTIME = " // Inject x-cloak CSS to prevent FOUC (Flash of Unstyled Content)\n // Elements with x-cloak are hidden until the runtime removes the attribute after mount\n var cloakStyle = document.getElementById ? document.getElementById('stx-cloak-style') : null;\n if (!cloakStyle) {\n cloakStyle = document.createElement('style');\n cloakStyle.id = 'stx-cloak-style';\n cloakStyle.textContent = '[x-cloak] { display: none !important; }';\n document.head.appendChild(cloakStyle);\n }\n\n";
4
+ export declare const SIGNALS_CLOAK_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Reactive class binding for the generated client runtime. */
2
- export declare const SIGNALS_CLASS_RUNTIME = " function bindClass(el, expr, passedScope = componentScope, isVisible) {\n const originalClasses = el.className;\n const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };\n const keys = Object.keys(capturedScope);\n\n // Pre-compile \u2014 only the names the expression mentions (see\n // __stxCompileScoped: reading every signal subscribed the class binding to\n // every signal on the page), and only valid JS identifiers.\n const mentioned = new Set(__stxNamesIn(expr));\n const safeKeys = keys.filter(k => mentioned.has(k) && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k));\n let fn;\n try {\n fn = __stxCompile(safeKeys, 'return ' + expr);\n } catch (e) {\n console.warn('[STX] bindClass compile error:', expr, e);\n return;\n }\n\n effect(() => {\n if (isVisible && !isVisible()) return;\n // Subscribe to signals by reading them, establishing reactive deps.\n // But pass RAW scope values to the fn so call-expressions like\n // activeTab() === 'overview' work \u2014 if we passed unwrapped values,\n // the fn would try to invoke a primitive and throw.\n for (let i = 0; i < safeKeys.length; i++) {\n const v = capturedScope[safeKeys[i]];\n if (v && typeof v === 'function' && (v._isSignal || v._isDerived)) {\n v();\n }\n }\n\n let value;\n try {\n // First pass: auto-unwrap proxy \u2014 handles expressions that read\n // signals as primitives (e.g. { 'active': count > 5 } where count\n // is a signal).\n const unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);\n value = fn.apply(null, safeKeys.map(k => unwrapScope[k]));\n } catch (e1) {\n // Retry with raw scope \u2014 handles call-expressions like activeTab()\n // that need the signal function to remain callable.\n try {\n value = fn.apply(null, safeKeys.map(k => capturedScope[k]));\n } catch (e2) {\n if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Class expression error:', expr, e2);\n value = '';\n }\n }\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n // Object form { \"cls-a cls-b\": cond } \u2014 keys may contain multiple\n // whitespace-separated classes; classList.add/remove can't accept\n // those as a single token (throws DOMException), so split each key.\n Object.keys(value).forEach(cls => {\n const tokens = cls.split(/\\s+/).filter(Boolean);\n if (value[cls]) tokens.forEach(t => el.classList.add(t));\n else tokens.forEach(t => el.classList.remove(t));\n });\n }\nelse if (Array.isArray(value)) {\n var _clsArr = [originalClasses, value.filter(Boolean).join(' ')].filter(Boolean).join(' ');\n if (typeof el.className === 'string') el.className = _clsArr; else el.setAttribute('class', _clsArr);\n }\nelse {\n var _clsStr = [originalClasses, value || ''].filter(Boolean).join(' ');\n if (typeof el.className === 'string') el.className = _clsStr; else el.setAttribute('class', _clsStr);\n }\n });\n }\n";
2
+ export declare const SIGNALS_CLASS_RUNTIME: string;
@@ -1 +1 @@
1
- export declare const SIGNALS_COMPONENT_API_RUNTIME = " // Component composition API (Phase 4)\n defineProps: function(definitions) {\n var props = window.__STX_CURRENT_PROPS__ || {};\n if (!definitions) return props;\n var result = Object.assign({}, props);\n for (var key in definitions) {\n if (!definitions.hasOwnProperty(key)) continue;\n var def = definitions[key];\n var opts = (typeof def === 'function' || Array.isArray(def)) ? { type: def } : (def || {});\n if (result[key] === undefined && opts['default'] !== undefined) {\n result[key] = typeof opts['default'] === 'function' ? opts['default']() : opts['default'];\n }\n }\n return result;\n },\n withDefaults: function(props, defaults) {\n var result = Object.assign({}, props);\n for (var key in defaults) {\n if (!defaults.hasOwnProperty(key)) continue;\n if (result[key] === undefined) {\n result[key] = typeof defaults[key] === 'function' ? defaults[key]() : defaults[key];\n }\n }\n return result;\n },\n defineEmits: function(events) {\n var el = window.__STX_CURRENT_ELEMENT__ || null;\n var declaredEvents = Array.isArray(events)\n ? events\n : (events && typeof events === 'object' ? Object.keys(events) : []);\n if (el && declaredEvents.length) {\n el.__stx_component_emits = el.__stx_component_emits || Object.create(null);\n declaredEvents.forEach(function(event) {\n el.__stx_component_emits[event] = true;\n });\n }\n return function(event, payload) {\n var target = el || document.body;\n if (el) {\n el.__stx_component_emits = el.__stx_component_emits || Object.create(null);\n el.__stx_component_emits[event] = true;\n }\n target.dispatchEvent(new CustomEvent(event, { detail: payload, bubbles: true, cancelable: true }));\n };\n },\n defineExpose: function(exposed) {\n var el = window.__STX_CURRENT_ELEMENT__;\n if (el) el.__stx_exposed = exposed;\n },\n defineSlots: function() {\n return window.__STX_CURRENT_SLOTS__ || {};\n },\n // Vue spells the same lookup useSlots(); it was auto-imported with no\n // implementation behind it (#1804).\n useSlots: function() {\n return window.__STX_CURRENT_SLOTS__ || {};\n },";
1
+ export declare const SIGNALS_COMPONENT_API_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Component-scope hydration helpers for the generated client runtime. */
2
- export declare const SIGNALS_COMPONENT_HYDRATION_RUNTIME = " function hydrateComponentScopes(nodes, callerScope) {\n var roots = [];\n var scripts = [];\n forEachGroupElement(nodes, function(node, insideTemplateContent) {\n // A template's content is inert source material. Remapping must traverse\n // it, but setup and event hydration belong to the live clones inserted by\n // bindIf/bindFor, where the correct iteration scope is available.\n if (insideTemplateContent) return;\n if (node.hasAttribute && node.hasAttribute('data-stx-scope')) roots.push(node);\n if (node.tagName === 'SCRIPT' && node.hasAttribute('data-stx-scoped')) scripts.push(node);\n });\n if (!roots.length) return;\n\n function hasPendingStructuralAncestor(root) {\n var cursor = root && root.parentElement;\n while (cursor && cursor.nodeType === Node.ELEMENT_NODE) {\n if (cursor.hasAttribute('@for')\n || cursor.hasAttribute(':for')\n || cursor.hasAttribute('x-for')\n || cursor.hasAttribute('@if')\n || cursor.hasAttribute(':if')\n || cursor.hasAttribute('x-if')\n || cursor.hasAttribute('@else-if')\n || cursor.hasAttribute(':else-if')\n || cursor.hasAttribute('x-else-if')\n || cursor.hasAttribute('@else')\n || cursor.hasAttribute(':else')\n || cursor.hasAttribute('x-else'))\n return true;\n cursor = cursor.parentElement;\n }\n return false;\n }\n\n // Scripts cloned from template.content are inert in browsers. Compile each\n // distinct component setup body once, then run that cached function for\n // every loop instance. Temporarily restoring the template's original scope\n // id lets existing compiled setup code locate the correct root without\n // rewriting and reparsing the full script for every row.\n scripts.forEach(function(old) {\n var text = old.textContent || '';\n var pendingRoots = roots.filter(function(root) {\n var scopeId = root.getAttribute('data-stx-scope');\n var originalScopeId = root.getAttribute('data-stx-template-scope') || scopeId;\n return scopeId\n && originalScopeId\n && text.indexOf(originalScopeId) !== -1\n && !hasPendingStructuralAncestor(root)\n && !(window.stx._scopes && window.stx._scopes[scopeId]);\n });\n if (!pendingRoots.length) return;\n\n var setup = __forComponentSetupFactories.get(text);\n if (!setup) {\n try {\n setup = new Function(text);\n __forComponentSetupFactories.set(text, setup);\n }\n catch (e) {\n console.error('[stx] cloned component setup compile error:', e);\n return;\n }\n }\n\n pendingRoots.forEach(function(root) {\n var scopeId = root.getAttribute('data-stx-scope');\n var originalScopeId = root.getAttribute('data-stx-template-scope') || scopeId;\n if (!scopeId || !originalScopeId) return;\n\n root.setAttribute('data-stx-scope', originalScopeId);\n // The setup finds its root by id, which a detached clone cannot answer\n // to: rows a :for builds inside a component's closed :if are set up\n // before the :if puts them in the document, and found nothing, so they\n // never read a prop. Hand the root over (utils.ts reads it).\n var previousSetupRoot = window.__STX_SETUP_ROOT__;\n window.__STX_SETUP_ROOT__ = root;\n try {\n setup();\n var registeredScope = window.stx._scopes && (window.stx._scopes[originalScopeId] || window.stx._scopes[scopeId]);\n if (registeredScope && originalScopeId !== scopeId) {\n delete window.stx._scopes[originalScopeId];\n window.stx._scopes[scopeId] = registeredScope;\n }\n }\n catch (e) {\n console.error('[stx] cloned component setup error:', e);\n }\n finally {\n window.__STX_SETUP_ROOT__ = previousSetupRoot;\n root.setAttribute('data-stx-scope', scopeId);\n }\n });\n\n // A component that is itself a structural source still needs its setup\n // sibling when bindFor/bindIf turns that source into a clone template.\n // Final row instances have no structural attribute and can discard it.\n var isStructuralSource = pendingRoots.some(function(root) {\n return root.hasAttribute('@for')\n || root.hasAttribute(':for')\n || root.hasAttribute('x-for')\n || root.hasAttribute('@if')\n || root.hasAttribute(':if')\n || root.hasAttribute('x-if');\n });\n if (!isStructuralSource && old.parentNode) old.parentNode.removeChild(old);\n });\n\n roots.forEach(function(root) {\n // Still inside a conditional or loop this walk has not bound: the\n // directive decides whether the component is on the page at all, and\n // hydrates it through this same function when it is. Mounting it from\n // here is what ran a hidden pane's onMount when an enclosing :if opened\n // (stacksjs/stx#2071): the walk reached the pane's root while the pane's\n // own :if was still an attribute, so its condition was never asked. The\n // setup half above already leaves these roots alone.\n if (hasPendingStructuralAncestor(root)) return;\n var scopeId = root.getAttribute('data-stx-scope');\n var scopeVars = scopeId && window.stx._scopes && window.stx._scopes[scopeId];\n var resolvedCallerScope = resolveComponentCallerScope(root, callerScope);\n root.__stx_parent_scope = resolvedCallerScope;\n bindParentComponentProps(root, resolvedCallerScope);\n if (!scopeVars) return;\n if (root.__stx_disposers) {\n // Bound already, by the page's scope walk: a component behind a false\n // :if in a PARTIAL is in the list that walk collects, and is detached\n // by the time it is reached, so it was bound and its mount deferred\n // (stacksjs/stx#2036). Showing the branch is that mount. Without this\n // the component rendered and its onMount never ran at all.\n if (scopeVars.__mountCallbacks && !scopeVars.__mounted && !scopeVars.__suspended && root.isConnected) {\n scopeVars.__el = root;\n scopeVars.__mounted = true;\n runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));\n }\n return;\n }\n scopeVars.__el = root;\n var childScope = { ...resolvedCallerScope, ...scopeVars };\n root.__stx_disposers = trackEffects(function() {\n processElement(root, childScope);\n });\n if (scopeVars.__mountCallbacks && !scopeVars.__mounted) {\n scopeVars.__mounted = true;\n runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));\n }\n });\n }\n";
2
+ export declare const SIGNALS_COMPONENT_HYDRATION_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Parent-to-component reactive prop bindings for the generated client runtime. */
2
- export declare const SIGNALS_COMPONENT_PROPS_RUNTIME = " function bindParentComponentProps(el, callerScope) {\n if (!el || !el.getAttribute || el.__stx_parent_props_bound) return;\n var names = (el.getAttribute('data-stx-parent-bindings') || '').split(/\\s+/).filter(Boolean);\n if (!names.length) return;\n if (hasPendingLoopBoundary(el)) {\n preserveDeferredParentComponentProps(el);\n return;\n }\n var deferred = readDeferredParentComponentProps(el);\n var bindings = names.map(function(name) {\n var sourceName = ':' + name;\n var expression = el.hasAttribute(sourceName) ? el.getAttribute(sourceName) : deferred[name];\n return typeof expression === 'string'\n ? { name: name, sourceName: sourceName, expression: expression }\n : null;\n }).filter(Boolean);\n if (!bindings.length) return;\n el.__stx_parent_props_bound = true;\n var scope = { ...globalHelpers, ...callerScope };\n\n bindings.forEach(function(binding) {\n var name = binding.name;\n var sourceName = binding.sourceName;\n var expression = binding.expression;\n effect(function() {\n var value;\n try {\n // Support both signal styles in forwarded props:\n // :open=\"open\" and :open=\"open()\".\n // Auto-unwrap bare signals, but preserve a signal function when this\n // expression explicitly calls it or accesses its object API.\n var unwrapScope = createAutoUnwrapProxy(scope, function(prop) {\n if (typeof prop !== 'string') return false;\n return expressionCallsSignal(expression, prop)\n || expressionUsesSignalApi(expression, prop);\n });\n var fn = __stxCompileScoped(unwrapScope, [], 'return (' + expression + ')');\n value = fn(...__stxArgs(fn, unwrapScope));\n if (value && typeof value === 'function' && (value._isSignal || value._isDerived)) value = value();\n }\n catch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError))\n console.warn('[STX] Parent component prop error:', expression, e);\n value = undefined;\n }\n\n // Preserve native prop types; the DOM host reflects boolean presence\n // and serializes structured values at its own boundary.\n if (name.startsWith('aria-') && typeof value === 'boolean') {\n stxHost.setAttribute(el, name, String(value));\n }\n else if (value === null || value === undefined) {\n stxHost.removeAttribute(el, name);\n }\n else {\n stxHost.setAttribute(el, name, value);\n }\n // The component setup scope is already registered for normal and\n // cloned signal components. Update its prop signal directly so object\n // identity and synchronous Vue-like prop delivery do not depend on a\n // MutationObserver round trip through a serialized DOM attribute.\n // The attribute remains the public DOM reflection and observer fallback\n // for scopes that register after this binding pass.\n syncComponentPropSignal(el, name, value);\n });\n el.removeAttribute(sourceName);\n delete deferred[name];\n });\n if (Object.keys(deferred).length)\n el.setAttribute('data-stx-deferred-parent-bindings', JSON.stringify(deferred));\n else\n el.removeAttribute('data-stx-deferred-parent-bindings');\n }\n\n function resolveComponentCallerScope(el, pageScope) {\n var resolved = { ...pageScope };\n var ancestors = [];\n var current = el && (el.parentElement || el.parentNode);\n while (current && current !== document) {\n if (current.getAttribute && current.hasAttribute('data-stx-scope'))\n ancestors.push(current.getAttribute('data-stx-scope'));\n current = current.parentElement || current.parentNode;\n }\n ancestors.reverse().forEach(function(scopeId) {\n var ancestorScope = window.stx._scopes && window.stx._scopes[scopeId];\n if (ancestorScope) Object.assign(resolved, ancestorScope);\n });\n return resolved;\n }\n";
2
+ export declare const SIGNALS_COMPONENT_PROPS_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Conditional-chain discovery helpers for the generated client runtime. */
2
- export declare const SIGNALS_CONDITIONAL_CHAIN_RUNTIME = " var __bindIfCounter = 0;\n // \u2500\u2500 x-else / x-else-if chain support (stacksjs/stx#1734) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Returns { name, terminal } for an else/else-if attribute present on el,\n // or null. terminal=true for the catch-all x-else (no further siblings\n // join the chain). Checks all three prefixes (:, x-, @).\n function getElseAttrInfo(el) {\n if (!el || !el.hasAttribute) return null;\n if (el.hasAttribute(':else-if')) return { name: ':else-if', terminal: false };\n if (el.hasAttribute('x-else-if')) return { name: 'x-else-if', terminal: false };\n if (el.hasAttribute('@else-if')) return { name: '@else-if', terminal: false };\n if (el.hasAttribute(':else')) return { name: ':else', terminal: true };\n if (el.hasAttribute('x-else')) return { name: 'x-else', terminal: true };\n if (el.hasAttribute('@else')) return { name: '@else', terminal: true };\n return null;\n }\n\n // Walk forward from an x-if/:if/@if head element collecting consecutive\n // else-if/else siblings (nextElementSibling skips text/comment nodes, so\n // whitespace between branches is tolerated \u2014 matches Vue). Returns a chain\n // array whose first entry is the if head; trailing x-else (if any) has\n // expr=null and terminal=true.\n function findIfChain(el, ifAttr) {\n var chain = [{ el: el, attr: ifAttr, expr: el.getAttribute(ifAttr), terminal: false }];\n var sib = el.nextElementSibling;\n while (sib) {\n var info = getElseAttrInfo(sib);\n if (!info) break;\n chain.push({\n el: sib,\n attr: info.name,\n expr: info.terminal ? null : sib.getAttribute(info.name),\n terminal: info.terminal,\n });\n if (info.terminal) break; // x-else is the chain terminator\n sib = sib.nextElementSibling;\n }\n return chain;\n }\n";
2
+ export declare const SIGNALS_CONDITIONAL_CHAIN_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Conditional component scope preservation for the generated client runtime. */
2
- export declare const SIGNALS_CONDITIONAL_COMPONENT_RUNTIME = " // A false :if detaches its subtree before the DOMContentLoaded scope walk\n // reaches nested components. Capture and bind their caller-owned props while\n // the ancestor chain is still connected, otherwise resolveComponentCallerScope\n // can no longer see the component that declared expressions such as\n // :options=\"environmentOptions\".\n function preserveConditionalComponentScopes(root, callerScope) {\n if (!root || !root.querySelectorAll) return;\n // A <template :if> branch is inert source: what shows is a clone of its\n // content, hydrated and bound by processTemplateNodes when it is inserted.\n // A DOM whose querySelectorAll reaches into template content (the test\n // DOM, a native host) would otherwise bind the SOURCE component's caller\n // props here, consuming :value on the source, so every clone carried the\n // value of the moment it was cloned and stopped following the page.\n if (root.tagName === 'TEMPLATE') return;\n var scopeEls = [];\n if (root.matches && root.matches('[data-stx-scope]')) scopeEls.push(root);\n root.querySelectorAll('[data-stx-scope]').forEach(function(scopeEl) { scopeEls.push(scopeEl); });\n scopeEls.forEach(function(scopeEl) {\n if (scopeEl.__stx_parent_props_bound) return;\n // A component inside a descendant loop cannot resolve its caller props\n // until bindFor creates the iteration scope. Binding it while the outer\n // conditional is being detached would consume expressions such as\n // :status=\"deployment.status\" before the deployment item exists, leaving every\n // later clone with the child's default prop. bindFor hydrates these\n // component scopes after insertion with the correct per-item scope.\n var current = scopeEl;\n while (current && current !== root) {\n if (current.hasAttribute\n && (current.hasAttribute('@for') || current.hasAttribute(':for') || current.hasAttribute('x-for'))) {\n preserveDeferredParentComponentProps(scopeEl);\n return;\n }\n current = current.parentElement || current.parentNode;\n }\n scopeEl.__stx_parent_scope = resolveComponentCallerScope(scopeEl, callerScope);\n bindParentComponentProps(scopeEl, scopeEl.__stx_parent_scope);\n });\n }\n\n // Component setup scripts are emitted immediately after their scoped root.\n // When that root itself carries :if, detaching only the element leaves the\n // sibling setup script outside the conditional node group. Scripts inserted\n // through innerHTML are inert, so the later hydration pass has no script to\n // execute and the component keeps raw directives and interpolations.\n function findConditionalComponentSetupSiblings(root) {\n if (!root || !root.hasAttribute || !root.hasAttribute('data-stx-scope')) return [];\n var scopeId = root.getAttribute('data-stx-scope');\n var templateScopeId = root.getAttribute('data-stx-template-scope') || scopeId;\n if (!scopeId) return [];\n\n var scripts = [];\n var sibling = root.nextSibling;\n while (sibling) {\n var next = sibling.nextSibling;\n if (sibling.nodeType === Node.TEXT_NODE && !(sibling.textContent || '').trim()) {\n sibling = next;\n continue;\n }\n if (sibling.nodeType === Node.COMMENT_NODE) {\n sibling = next;\n continue;\n }\n if (sibling.nodeType === Node.ELEMENT_NODE\n && sibling.tagName === 'STYLE'\n && sibling.hasAttribute('data-stx-vendor')) {\n sibling = next;\n continue;\n }\n if (sibling.nodeType === Node.ELEMENT_NODE\n && sibling.tagName === 'SCRIPT'\n && sibling.hasAttribute('data-stx-scoped')\n && ((sibling.textContent || '').indexOf(scopeId) !== -1\n || (templateScopeId && (sibling.textContent || '').indexOf(templateScopeId) !== -1))) {\n scripts.push(sibling);\n sibling = next;\n continue;\n }\n break;\n }\n return scripts;\n }\n";
2
+ export declare const SIGNALS_CONDITIONAL_COMPONENT_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** SPA container cleanup used by the generated client runtime. */
2
- export declare const SIGNALS_CONTAINER_CLEANUP_RUNTIME = " // ==========================================================================\n // Container Cleanup (for SPA navigation)\n // ==========================================================================\n\n function cleanupContainer(container) {\n if (!container) return;\n\n // Clear pending mount callbacks from the departing page\n mountCallbacks.length = 0;\n\n // Reset componentScope \u2014 clear old page variables to prevent scope leaking\n // between SPA navigations. Preserve $refs and re-apply shell-level scope\n // from persistent elements (sidebar, nav) that live outside the container.\n var preservedRefs = componentScope.$refs || {};\n componentScope = { $refs: preservedRefs };\n // Re-apply scope from shell elements (outside the swap container)\n var shellElements = document.querySelectorAll('[data-stx-content] ~ *');\n document.querySelectorAll('body > *').forEach(function(el) {\n if (el === container) return;\n if (el.tagName === 'SCRIPT' || el.tagName === 'STYLE') return;\n if (el.__stx_scope) Object.assign(componentScope, el.__stx_scope);\n });\n\n // 1-2. Every descendant, then the container: cancel pending island\n // hydration (#1746), fire destroy hooks, dispose effects. Shared with\n // :for row removal and template :if hide so all three release the same\n // trackers, including the row and branch ones added for #1954.\n disposeSubtreeEffects(container);\n // Clear __stx_scope so _handleStxLoad's processElement guard doesn't skip it\n container.__stx_scope = null;\n\n // 3. Clean up scopes registered on departing components. Routed\n // through disposeSubtreeScopes so the same walk runs for SPA\n // navigation and for :if/:for-driven unmount (see #1727).\n disposeSubtreeScopes(container);\n\n // 4. Reclaim entries the container walk can't see \u2014 components rendered\n // outside the swap container, or already detached before step 3 ran its\n // querySelectorAll. Without this the registry grew every navigation (#1775).\n sweepOrphanedScopes();\n }\n";
2
+ export declare const SIGNALS_CONTAINER_CLEANUP_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Computed helpers and component value sharing for the client runtime. */
2
- export declare const SIGNALS_CONTEXT_RUNTIME = " // ==========================================================================\n // Public API\n // ==========================================================================\n\n // ==========================================================================\n // $: Computed Shorthand Support (Feature #7)\n // ==========================================================================\n\n // Helper function for $: reactive declarations (transformed by compiler)\n // Usage: $computed(() => count * 2) is shorthand for derived()\n function $computed(fn) {\n return derived(fn);\n }\n\n // Helper for watching a value with auto-unwrap\n function $watch(deps, fn) {\n effect(() => {\n // Access all dependencies to track them\n const values = Array.isArray(deps) ? deps.map(d => {\n if (typeof d === 'function' && (d._isSignal || d._isDerived)) return d();\n return d;\n }) : (typeof deps === 'function' && (deps._isSignal || deps._isDerived)) ? [deps()] : [deps];\n\n fn(...values);\n });\n }\n\n // provide() \u2014 share values across components (like Vue's provide/inject)\n // Usage: provide('Modal', Modal) \u2014 makes Modal accessible in all components\n //\n // inject() was auto-imported but implemented nowhere, so half of the pair\n // worked: provide() succeeded and the failure surfaced only in the consumer\n // (#1804). Values are recorded in a private registry as well as on window,\n // because the global write collides with native properties \u2014 provide('name',\n // x) lands on window.name, which the browser coerces to a string.\n var __stxProvided = Object.create(null);\n\n function provide(name, value) {\n __stxProvided[name] = value;\n window[name] = value;\n }\n\n function inject(name, defaultValue) {\n if (name in __stxProvided) return __stxProvided[name];\n if (name in window) return window[name];\n return defaultValue;\n }\n";
2
+ export declare const SIGNALS_CONTEXT_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** Cookie signal composable used by the generated client runtime. */
2
- export declare const SIGNALS_COOKIE_RUNTIME = " // Reactive cookie binding. Mirrors useLocalStorage's shape: returns a string-\n // valued signal, writes on .set(), and respects cookie attributes via opts.\n // Setting the signal to '' deletes the cookie (max-age=0). Cookies don't fire\n // a 'storage' event, so cross-tab updates aren't auto-reflected; consumers\n // that need that can poll on 'visibilitychange' themselves. See issue #1701.\n function useCookie(name, opts) {\n opts = opts || {};\n var encode = opts.encode || encodeURIComponent;\n var decode = opts.decode || decodeURIComponent;\n // Escape cookie name so dots/brackets/etc. read safely through the matcher.\n var escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n var nameRe = new RegExp('(?:^|; )' + escapedName + '=([^;]*)');\n function read() {\n if (typeof document === 'undefined') return opts.defaultValue || '';\n var m = document.cookie.match(nameRe);\n return m ? decode(m[1]) : (opts.defaultValue || '');\n }\n var s = state(read());\n function serialise(value) {\n var parts = [name + '=' + (value ? encode(value) : '')];\n parts.push('path=' + (opts.path || '/'));\n if (opts.domain) parts.push('domain=' + opts.domain);\n if (value === '') parts.push('max-age=0');\n else if (typeof opts.maxAge === 'number') parts.push('max-age=' + opts.maxAge);\n else if (opts.expires !== undefined) {\n // Date, seconds-from-now, or anything Date can parse \u2014 matching the\n // composable. Accepting only a Date here meant the same option silently\n // produced a session cookie on the runtime path.\n var expiresDate = opts.expires instanceof Date\n ? opts.expires\n : (typeof opts.expires === 'number' ? new Date(Date.now() + opts.expires * 1000) : new Date(opts.expires));\n parts.push('expires=' + expiresDate.toUTCString());\n }\n parts.push('SameSite=' + (opts.sameSite || 'Lax'));\n var secure = opts.secure;\n if (secure === undefined) secure = typeof location !== 'undefined' && location.protocol === 'https:';\n if (secure) parts.push('Secure');\n return parts.join('; ');\n }\n // subscribe, not effect: an effect runs once at creation, so merely\n // DECLARING a cookie rewrote it from these options. A second declaration\n // that only wanted to read - no options, because it is not the owner of the\n // policy - therefore reserialised it with no max-age, which is the\n // definition of a session cookie. A 30-day login died at browser close\n // because the user opened a settings page (#1933).\n //\n // subscribe fires on set() only, so construction is a pure read: read()\n // above already seeds the signal. This matches the composable, which has\n // always used subscribe.\n s.subscribe(function(value) {\n if (typeof document === 'undefined') return;\n document.cookie = serialise(value);\n });\n return s;\n }\n";
2
+ export declare const SIGNALS_COOKIE_RUNTIME: string;
@@ -1,2 +1,2 @@
1
1
  /** DevTools introspection used by the generated client runtime. */
2
- export declare const SIGNALS_DEVTOOLS_RUNTIME = " // ==========================================================================\n // DevTools introspection (stacksjs/stx#1747, Phase 1)\n // ==========================================================================\n // A read-only, console-usable inspector wired to the live runtime \u2014 no manual\n // registration. Reads signal values via peek() so inspecting never subscribes\n // the active effect (i.e. it can't pollute the reactive graph).\n function __stxDevtoolsClassify(sv) {\n var out = { signals: {}, derived: {}, stores: {}, values: {}, methods: [] };\n if (!sv || typeof sv !== 'object') return out;\n Object.keys(sv).forEach(function(k) {\n if (k.indexOf('__') === 0 || k === '$el' || k === '$refs' || k === '$props') return;\n var v = sv[k];\n try {\n if (typeof v === 'function' && v._isSignal) out.signals[k] = peek(function() { return v(); });\n else if (typeof v === 'function' && v._isDerived) out.derived[k] = peek(function() { return v(); });\n else if (v && v._isStxStore) out.stores[k] = '[store]';\n else if (typeof v === 'function') out.methods.push(k);\n else out.values[k] = v;\n }\n catch (e) { out.values[k] = '[unreadable]'; }\n });\n return out;\n }\n window.__stxDevtools = {\n version: 4,\n // \u2500\u2500 Phase 2: reactivity instrumentation (dev-mode, opt-in) \u2500\u2500\n // Turn counting on/off. OFF by default so the runtime stays zero-overhead\n // until a devtools session asks for it.\n enable: function() { __stxDevtoolsTracking = true; },\n disable: function() { __stxDevtoolsTracking = false; },\n tracking: function() { return __stxDevtoolsTracking; },\n // Global tallies since the last reset: total signal changes + effect re-runs.\n stats: function() {\n return { signalSets: __stxDevtoolsStats.signalSets, effectRuns: __stxDevtoolsStats.effectRuns, tracking: __stxDevtoolsTracking };\n },\n resetStats: function() { __stxDevtoolsStats.signalSets = 0; __stxDevtoolsStats.effectRuns = 0; __stxDevtoolsIfTrace.length = 0; __stxDevtoolsQueries.length = 0; __stxDevtoolsMutations.length = 0; },\n // Phase 3: structured :if decision trace \u2014 which branch each reactive\n // @if/v-if/:if chain picked, newest last. Recorded only while tracking.\n ifTrace: function() { return __stxDevtoolsIfTrace.slice(); },\n // Phase 3: data-layer query timeline \u2014 { source, url, method, status, ok, ms }\n // for each useFetch/useQuery/useMutation request, newest last.\n queries: function() { return __stxDevtoolsQueries.slice(); },\n // Phase 4: state-change log \u2014 each recorded signal mutation { name, scope,\n // prev, next }, newest last. Resolves each signal id to its name + owning\n // scope/store at query time, so the buffer itself holds no live references.\n mutations: function() {\n var nameById = {};\n function index(container, label) {\n if (!container || typeof container !== 'object') return;\n Object.keys(container).forEach(function(k) {\n if (k.indexOf('__') === 0) return;\n var v = container[k];\n if (typeof v === 'function' && v._stxSignalId) nameById[v._stxSignalId] = { name: k, scope: label };\n });\n }\n var scopes = (window.stx && window.stx._scopes) || {};\n Object.keys(scopes).forEach(function(id) { index(scopes[id], id); });\n if (window.stx && window.stx._stores && typeof window.stx._stores.forEach === 'function')\n window.stx._stores.forEach(function(s, id) { index(s, 'store:' + id); });\n return __stxDevtoolsMutations.map(function(m) {\n var info = nameById[m.sid];\n return { name: info ? info.name : '(anonymous)', scope: info ? info.scope : null, prev: m.prev, next: m.next };\n });\n },\n // Reactive graph: per scope, each signal/derived with its current value, how\n // many times it was set (when tracking), and how many effects subscribe to\n // it (the dependency edges \u2014 \"which effects read this signal\", as a count).\n graph: function() {\n var out = [];\n var scopes = (window.stx && window.stx._scopes) || {};\n Object.keys(scopes).forEach(function(scopeId) {\n var sv = scopes[scopeId];\n if (!sv || typeof sv !== 'object') return;\n var nodes = [];\n Object.keys(sv).forEach(function(k) {\n if (k.indexOf('__') === 0 || k === '$el' || k === '$refs' || k === '$props') return;\n var v = sv[k];\n if (typeof v === 'function' && (v._isSignal || v._isDerived)) {\n nodes.push({\n name: k,\n type: v._isDerived ? 'derived' : 'signal',\n value: peek(function() { return v(); }),\n setCount: v._setCount || 0,\n subscribers: (v._effects && typeof v._effects.size === 'number') ? v._effects.size : 0\n });\n }\n });\n if (nodes.length) out.push({ scopeId: scopeId, nodes: nodes });\n });\n return out;\n },\n // Component tree from [data-stx-scope] elements, nested by DOM ancestry.\n tree: function() {\n var byEl = new Map();\n var roots = [];\n var nodes = document.querySelectorAll('[data-stx-scope]');\n Array.prototype.forEach.call(nodes, function(el) {\n byEl.set(el, { scopeId: el.getAttribute('data-stx-scope'), tag: (el.tagName || '').toLowerCase(), children: [], el: el });\n });\n Array.prototype.forEach.call(nodes, function(el) {\n var node = byEl.get(el);\n var p = el.parentElement;\n while (p && !byEl.has(p)) p = p.parentElement;\n if (p) byEl.get(p).children.push(node); else roots.push(node);\n });\n function clean(n) { return { scopeId: n.scopeId, tag: n.tag, children: n.children.map(clean) }; }\n return roots.map(clean);\n },\n // Signals / derived / stores / methods / plain values for a scope id.\n scope: function(scopeId) {\n var sv = (window.stx && window.stx._scopes) ? window.stx._scopes[scopeId] : null;\n return sv ? __stxDevtoolsClassify(sv) : null;\n },\n // The nearest enclosing scope's inspection for a DOM element.\n inspect: function(el) {\n var s = el;\n while (s && !(s.getAttribute && s.getAttribute('data-stx-scope'))) s = s.parentElement;\n return s ? this.scope(s.getAttribute('data-stx-scope')) : null;\n },\n // All registered stores by id.\n stores: function() {\n var out = {};\n var reg = window.stx && window.stx._stores;\n if (reg && typeof reg.forEach === 'function') reg.forEach(function(v, k) { out[k] = true; });\n return out;\n },\n // One store's state \u2014 its state signals / getters (derived) / plain values /\n // actions (methods). A store is just an object of those, so the same\n // classifier as scope() works (values read via peek \u2014 no graph pollution).\n store: function(id) {\n var reg = window.stx && window.stx._stores;\n var s = reg && typeof reg.get === 'function' ? reg.get(id) : null;\n return s ? __stxDevtoolsClassify(s) : null;\n },\n };\n";
2
+ export declare const SIGNALS_DEVTOOLS_RUNTIME: string;
@@ -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;