@stacksjs/stx 0.2.571 → 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 (382) 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-4ssg5xpq.js → chunk-fynh3bkq.js} +12 -2
  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/bundle.js +11 -1
  251. package/dist/native/compiler/headwind-to-style.d.ts +383 -359
  252. package/dist/native/compiler/icons.d.ts +249 -243
  253. package/dist/native/compiler/svg.d.ts +35 -24
  254. package/dist/native/runtime/jsc-globals.d.ts +1 -1
  255. package/dist/native/runtime/native-host.d.ts +1 -1
  256. package/dist/native/runtime/native-host.js +3 -0
  257. package/dist/offline/app-service-worker.d.ts +50 -114
  258. package/dist/offline/kept-store.d.ts +23 -37
  259. package/dist/offline/query-cache.d.ts +55 -126
  260. package/dist/owned-routes.d.ts +0 -31
  261. package/dist/page-response.d.ts +8 -39
  262. package/dist/parser/directive-parser.d.ts +45 -57
  263. package/dist/parser/expression-parser.d.ts +35 -33
  264. package/dist/parser/index.d.ts +39 -4
  265. package/dist/parser/tokenizer.d.ts +49 -61
  266. package/dist/partial-hydration.d.ts +51 -82
  267. package/dist/performance-utils.d.ts +115 -255
  268. package/dist/placeholder.d.ts +9 -18
  269. package/dist/plugin-system.d.ts +115 -264
  270. package/dist/process.d.ts +4 -9
  271. package/dist/process.js +6 -4
  272. package/dist/prop-sentinels.d.ts +11 -11
  273. package/dist/public-env.d.ts +0 -14
  274. package/dist/pwa/directives.d.ts +20 -12
  275. package/dist/pwa/inject.d.ts +0 -10
  276. package/dist/pwa/precache.d.ts +16 -22
  277. package/dist/pwa/service-worker.d.ts +0 -12
  278. package/dist/pwa.js +1 -1
  279. package/dist/reactive-bindings.d.ts +11 -34
  280. package/dist/reactive-tracking.d.ts +0 -36
  281. package/dist/reactive.d.ts +41 -58
  282. package/dist/render-memo.d.ts +5 -23
  283. package/dist/resolve-stx-targets.d.ts +6 -44
  284. package/dist/route-middleware.d.ts +35 -2
  285. package/dist/route-rules.d.ts +10 -13
  286. package/dist/router.d.ts +9 -8
  287. package/dist/routes.d.ts +3 -1
  288. package/dist/runtime-config-server.d.ts +14 -17
  289. package/dist/runtime-config.d.ts +2 -3
  290. package/dist/runtime-globals.d.ts +90 -122
  291. package/dist/runtime-injection.d.ts +0 -8
  292. package/dist/scaffolding.d.ts +30 -26
  293. package/dist/script-emit.d.ts +0 -30
  294. package/dist/script-validation.d.ts +6 -12
  295. package/dist/seo.d.ts +75 -153
  296. package/dist/server-api.d.ts +9 -12
  297. package/dist/server-bindings.d.ts +1 -26
  298. package/dist/server-data.d.ts +4 -5
  299. package/dist/sfc-template.d.ts +8 -8
  300. package/dist/signal-processing.d.ts +37 -53
  301. package/dist/signals-api.d.ts +58 -135
  302. package/dist/signals.d.ts +18 -24
  303. package/dist/site-url.d.ts +31 -28
  304. package/dist/slots.d.ts +20 -86
  305. package/dist/source-signature.d.ts +5 -28
  306. package/dist/ssg.d.ts +158 -337
  307. package/dist/ssg.js +2 -2
  308. package/dist/state-dir.d.ts +4 -4
  309. package/dist/store-loader.d.ts +0 -10
  310. package/dist/story/analytics.d.ts +60 -138
  311. package/dist/story/bookmarks.d.ts +34 -87
  312. package/dist/story/cli.d.ts +69 -123
  313. package/dist/story/collect/scanner.d.ts +0 -4
  314. package/dist/story/collect/tree.d.ts +1 -8
  315. package/dist/story/commands/build.d.ts +6 -11
  316. package/dist/story/commands/dev.d.ts +8 -15
  317. package/dist/story/commands/preview.d.ts +7 -13
  318. package/dist/story/config-watcher.d.ts +13 -20
  319. package/dist/story/config.d.ts +8 -11
  320. package/dist/story/context.d.ts +8 -14
  321. package/dist/story/hmr.d.ts +26 -24
  322. package/dist/story/hot-swap.d.ts +23 -34
  323. package/dist/story/keyboard-shortcuts.d.ts +18 -23
  324. package/dist/story/output.d.ts +44 -46
  325. package/dist/story/performance.d.ts +45 -107
  326. package/dist/story/presets.d.ts +41 -107
  327. package/dist/story/renderer.d.ts +27 -41
  328. package/dist/story/search.d.ts +12 -23
  329. package/dist/story/server.d.ts +11 -21
  330. package/dist/story/setup.d.ts +15 -23
  331. package/dist/story/testing.d.ts +40 -65
  332. package/dist/story/types.d.ts +160 -262
  333. package/dist/streaming.d.ts +57 -119
  334. package/dist/strip-literals.d.ts +1 -25
  335. package/dist/stx-module-imports.d.ts +7 -0
  336. package/dist/stx-virtual-ts.d.ts +102 -253
  337. package/dist/style-scoping.d.ts +8 -21
  338. package/dist/suspense.d.ts +52 -67
  339. package/dist/teleport.d.ts +0 -22
  340. package/dist/template-syntax-escape.d.ts +8 -8
  341. package/dist/template-tag-balance.d.ts +6 -22
  342. package/dist/testing.d.ts +26 -11
  343. package/dist/theme-tokens.d.ts +388 -134
  344. package/dist/transitions.d.ts +55 -66
  345. package/dist/ts-css-config.d.ts +12 -70
  346. package/dist/types/component-types.d.ts +122 -187
  347. package/dist/types/config-types.d.ts +341 -956
  348. package/dist/types/context-types.d.ts +24 -46
  349. package/dist/types/csp-types.d.ts +66 -70
  350. package/dist/types/directive-types.d.ts +156 -223
  351. package/dist/types/index.d.ts +110 -6
  352. package/dist/types/pwa-types.d.ts +148 -273
  353. package/dist/types.d.ts +1 -0
  354. package/dist/unresolved-identifiers.d.ts +22 -24
  355. package/dist/url-safety.d.ts +32 -32
  356. package/dist/utils.d.ts +21 -36
  357. package/dist/validator.d.ts +26 -28
  358. package/dist/variable-extractor.d.ts +19 -49
  359. package/dist/view-composers.d.ts +81 -80
  360. package/dist/virtual-scrolling.d.ts +82 -101
  361. package/dist/visual-testing.d.ts +10 -9
  362. package/dist/vue-template.d.ts +0 -23
  363. package/dist/web-components/css-scoping.d.ts +11 -21
  364. package/dist/web-components.d.ts +58 -81
  365. package/dist/x-element.d.ts +1 -0
  366. package/package.json +6 -6
  367. package/stx.d.ts +2 -2
  368. package/dist/app-service-worker.d.ts +0 -165
  369. package/dist/chunk-49gwmcrn.js +0 -2
  370. package/dist/chunk-6va5pe2m.js +0 -2
  371. package/dist/chunk-bm2q1srp.js +0 -2
  372. package/dist/signals-context-runtime.d.ts +0 -2
  373. package/dist/signals-drawer-runtime.d.ts +0 -2
  374. package/dist/signals-host-runtime.d.ts +0 -9
  375. package/dist/signals-loop-conditional-runtime.d.ts +0 -2
  376. package/dist/signals-manifest-hydration-runtime.d.ts +0 -2
  377. package/dist/signals-notify-runtime.d.ts +0 -2
  378. package/dist/signals-optimistic-runtime.d.ts +0 -2
  379. package/dist/signals-overlay-runtime.d.ts +0 -2
  380. package/dist/signals-scope-disposal-runtime.d.ts +0 -2
  381. package/dist/signals-spa-load-control-runtime.d.ts +0 -2
  382. package/dist/signals-storage-runtime.d.ts +0 -2
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import"./chunk-ydx3mfpp.js";import"./chunk-vp31ff54.js";import"./chunk-phzs239m.js";import"./chunk-k7ht6tqe.js";import"./chunk-s12b57m9.js";import{G}from"./chunk-f4jh9vrj.js";import"./chunk-sfwprq8q.js";import"./chunk-36agnyhe.js";import"./chunk-rfnr4xz6.js";import"./chunk-rrj5m9xv.js";import"./chunk-1edvsndv.js";import"./chunk-tv784gv0.js";import"./chunk-yk3wh2xv.js";import"./chunk-qcymqscj.js";import"./chunk-qt3x1sh3.js";import"./chunk-zyk12484.js";import"./chunk-pveafhzg.js";import"./chunk-b9r88ysg.js";import"./chunk-4easd8da.js";import"./chunk-jqefcghh.js";import"./chunk-wwhxgvr8.js";import"./chunk-cyg9w31a.js";import"./chunk-6wc2t6cd.js";import"./chunk-bpdsdbvg.js";import"./chunk-mr9c2ej6.js";import"./chunk-vr36s2en.js";import"./chunk-r4w1cye7.js";import"./chunk-1n64749x.js";import"./chunk-707n4pbz.js";import"./chunk-79vdkvhf.js";import"./chunk-4bgfpkwx.js";import"./chunk-83fdt4yj.js";import"./chunk-1dg5qxg9.js";import"./chunk-5vw8493b.js";import"./chunk-anjm087t.js";import"./chunk-2z0trbbm.js";import{bt,wt}from"./chunk-dcpf6kas.js";import"./chunk-mzqyv7s5.js";import"./chunk-kzjrgh0b.js";import"./chunk-c4zpzxex.js";import"./chunk-7bwkeake.js";import"./chunk-zd01r00t.js";import"./chunk-a6jq7hex.js";import"./chunk-g66m3g2r.js";import"./chunk-jwvzvapp.js";import"./chunk-ymawe0y5.js";import{Qs,eo,to,no,xr,ro,so,oo,Sr,kr,$n,Rn,An}from"./chunk-0bt0fbs1.js";import"./chunk-gzgc8zk5.js";import"./chunk-0dz1b6a1.js";import{_i}from"./chunk-pnag11c4.js";import{u}from"./chunk-cg8hg6cs.js";import{spawn as R}from"child_process";import S from"fs";import f from"path";import n from"process";import{CLI as W}from"@stacksjs/clapp";var j="0.2.571";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new W("stx");function B(h){let p=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(p))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(p<1024||p>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=f.dirname(h),t=f.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),i=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:i}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(p){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function z(h){let p=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(p))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(p<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(p>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),V=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,p=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(p)}function U(h){if(!h)return;let p;try{p=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof p!=="object"||p===null||Array.isArray(p))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(p))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return p}async function H(h,p){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let r=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(r.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...r),p.verbose)console.log(`Found ${r.length} file(s) matching pattern: ${c}`)}catch(r){return console.error(`Error expanding glob pattern ${c}:`,r),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),p.filter)x.push("--pattern",p.filter);if(p.timeout)x.push("--timeout",p.timeout.toString());if(p.reporter&&p.reporter!=="default")if(p.reporter==="junit"){let c=f.resolve("stx-test-report.xml");x.push("--reporter",p.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${p.reporter}' is not supported. Using default reporter.`);if(p.coverage)x.push("--coverage");if(p.watch)x.push("--watch");x.push("--preload",f.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:p.ui?"true":"false",STX_TEST_VERBOSE:p.verbose?"true":"false"},o="bun";if(p.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let i=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(r)=>{let d=((performance.now()-i)/1000).toFixed(2);if(r===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
3
+ import"./chunk-ydx3mfpp.js";import"./chunk-vp31ff54.js";import"./chunk-phzs239m.js";import"./chunk-k7ht6tqe.js";import"./chunk-s12b57m9.js";import{G}from"./chunk-0s647d0b.js";import"./chunk-sfwprq8q.js";import"./chunk-36agnyhe.js";import"./chunk-rfnr4xz6.js";import"./chunk-2hg2bqtj.js";import"./chunk-1edvsndv.js";import"./chunk-tv784gv0.js";import"./chunk-yk3wh2xv.js";import"./chunk-qcymqscj.js";import"./chunk-qt3x1sh3.js";import"./chunk-zyk12484.js";import"./chunk-pveafhzg.js";import"./chunk-b9r88ysg.js";import"./chunk-4easd8da.js";import"./chunk-78d6yyxz.js";import"./chunk-wwhxgvr8.js";import"./chunk-zz7tw07b.js";import"./chunk-6wc2t6cd.js";import"./chunk-bpdsdbvg.js";import"./chunk-mr9c2ej6.js";import"./chunk-58vrf6kh.js";import"./chunk-r4w1cye7.js";import"./chunk-74ew8ajw.js";import"./chunk-707n4pbz.js";import"./chunk-kns5m52j.js";import"./chunk-ev8t5cxk.js";import"./chunk-824cnbac.js";import"./chunk-1dg5qxg9.js";import"./chunk-5vw8493b.js";import"./chunk-anjm087t.js";import"./chunk-2z0trbbm.js";import{bt,wt}from"./chunk-q9chv68c.js";import"./chunk-cf97xdqa.js";import"./chunk-a3gvw1q2.js";import"./chunk-c4zpzxex.js";import"./chunk-7bwkeake.js";import"./chunk-zd01r00t.js";import"./chunk-a6jq7hex.js";import"./chunk-g66m3g2r.js";import"./chunk-t3dnak1j.js";import"./chunk-sjcstv33.js";import{Qs,eo,to,no,xr,ro,so,oo,Sr,kr,$n,Rn,An}from"./chunk-j9qy9t3t.js";import"./chunk-g8757f97.js";import"./chunk-0dz1b6a1.js";import{_i}from"./chunk-pnag11c4.js";import{u}from"./chunk-cg8hg6cs.js";import{spawn as R}from"child_process";import S from"fs";import f from"path";import n from"process";import{CLI as W}from"@stacksjs/clapp";var j="0.2.573";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new W("stx");function B(h){let p=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(p))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(p<1024||p>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=f.dirname(h),t=f.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),i=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:i}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(p){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function z(h){let p=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(p))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(p<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(p>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),V=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,p=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(p)}function U(h){if(!h)return;let p;try{p=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof p!=="object"||p===null||Array.isArray(p))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(p))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return p}async function H(h,p){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let r=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(r.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...r),p.verbose)console.log(`Found ${r.length} file(s) matching pattern: ${c}`)}catch(r){return console.error(`Error expanding glob pattern ${c}:`,r),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),p.filter)x.push("--pattern",p.filter);if(p.timeout)x.push("--timeout",p.timeout.toString());if(p.reporter&&p.reporter!=="default")if(p.reporter==="junit"){let c=f.resolve("stx-test-report.xml");x.push("--reporter",p.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${p.reporter}' is not supported. Using default reporter.`);if(p.coverage)x.push("--coverage");if(p.watch)x.push("--watch");x.push("--preload",f.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:p.ui?"true":"false",STX_TEST_VERBOSE:p.verbose?"true":"false"},o="bun";if(p.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let i=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(r)=>{let d=((performance.now()-i)/1000).toFixed(2);if(r===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
4
4
  Test run interrupted`),s.kill("SIGINT"),n.exit(1)})})}catch(x){return console.error("Error running tests:",x instanceof Error?x.message:String(x)),!1}}var L=n.argv.length>=3&&(V(n.argv[2])&&S.existsSync(n.argv[2])||O(n.argv[2]));if(L){let h=n.argv[2],p={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let x=3;x<n.argv.length;x++){let t=n.argv[x];if(t==="--port"&&x+1<n.argv.length){let e=B(n.argv[++x]);if(!e.isValid)F(e);p.port=Number.parseInt(n.argv[x],10)}else if(t==="--no-watch")p.watch=!1;else if(t==="--highlight-theme"&&x+1<n.argv.length){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.defaultTheme=n.argv[++x]}else if(t==="--no-highlight"){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.enabled=!1}else if(t==="--no-highlight-unknown"){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(t==="--no-cache")p.cache=!1;else if(t==="--native")p.native=!0}if(O(h))try{let x=await Array.fromAsync(new Bun.Glob(h).scan({onlyFiles:!0,absolute:!0})),t=h.endsWith(".stx")?x.filter((s)=>s.endsWith(".stx")):h.endsWith(".md")?x.filter((s)=>s.endsWith(".md")):x.filter((s)=>s.endsWith(".stx")||s.endsWith(".md")),e=h.split("*")[0].replace(/\/$/,"")||".",o=f.resolve(e);try{let s=new Bun.Glob("**/*.stx"),r=(await Array.fromAsync(s.scan({cwd:o,onlyFiles:!0,absolute:!0}))).filter((l)=>/\[.+\]/.test(f.basename(l)));for(let l of r)if(!t.includes(l))t.push(l)}catch{}if(t.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${h}`),n.exit(1);if(!await Rn(t,p))n.exit(1)}catch(x){console.error("Failed to process files:",x),n.exit(1)}else $n(h,p).catch((x)=>{console.error("Failed to start dev server:",x),n.exit(1)})}else{let h=function(t,e){let o=[];for(let i=0;i<=e.length;i++)o[i]=[i];for(let i=0;i<=t.length;i++)o[0][i]=i;for(let i=1;i<=e.length;i++)for(let s=1;s<=t.length;s++)if(e.charAt(i-1)===t.charAt(s-1))o[i][s]=o[i-1][s-1];else o[i][s]=Math.min(o[i-1][s-1]+1,o[i][s-1]+1,o[i-1][s]+1);return o[e.length][t.length]};y.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(t)=>{try{if(await no(t))console.log("Documentation generated successfully."),n.exit(0);else console.error("Documentation generation failed."),n.exit(1)}catch(e){console.error("Error generating documentation:",e),n.exit(1)}}),y.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(t,e)=>{try{let{fetchCollections:o,generatePackage:i}=await import("./chunk-t61vdbje.js");if(t==="list"){console.log(`
5
5
  \uD83D\uDCDA Fetching available icon collections...
6
6
  `);let s=await o(),c=Object.entries(s).sort((r,l)=>l[1].total-r[1].total);console.log(`Available collections:
7
7
  `);for(let[r,l]of c){let d=l;console.log(` ${r.padEnd(30)} ${d.name} (${d.total} icons)`)}console.log(`
8
8
  Total: ${c.length} collections`)}else if(t.startsWith("generate")){let s=t==="generate"?"":t.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!s)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),n.exit(1);let c=e.output||f.join(n.cwd(),"packages/collections"),r=e.icons?e.icons.split(",").map((l)=>l.trim()):void 0;await i(s,c,r),console.log(`
9
9
  \u2713 Package generated successfully!`),console.log(`
10
- To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:i}=await import("./chunk-d8206zbp.js"),{loadConfig:s}=await import("./chunk-zddzjd60.js");console.log(`
10
+ To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:i}=await import("./chunk-d8206zbp.js"),{loadConfig:s}=await import("./chunk-ya7xks9t.js");console.log(`
11
11
  \uD83D\uDD0D Running PWA audit...
12
12
  `);let c=await s(),r=e.output||"dist",l=o(c,r);if(console.log(i(l)),l.failed>0)n.exit(1)}else console.error(`Unknown pwa command: ${t}`),console.error("Available commands: audit"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(t,e)=>{try{if(e.port!==void 0){let i=B(e.port);if(!i.isValid)F(i);e.port=Number.parseInt(String(e.port),10)}if(e.timeout!==void 0){let i=z(e.timeout);if(!i.isValid)F(i)}let o={syntaxHighlighting:{enabled:e.highlight!==!1,serverSide:!0,defaultTheme:e.highlightTheme||"github-dark",highlightUnknownLanguages:e.highlightUnknown!==!1}};if(!t){if(!await An(".",{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}if(!O(t))try{let i=await import("fs");if(i.existsSync(t)&&i.statSync(t).isDirectory()){if(!await An(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}}catch{}if(O(t)){console.log(`Expanding glob pattern: ${t}`);let i=await G.timeAsync("glob-expansion",async()=>Array.fromAsync(new Bun.Glob(t).scan({onlyFiles:!0,absolute:!0}))),s=t.endsWith(".stx")?i.filter((d)=>d.endsWith(".stx")):t.endsWith(".md")?i.filter((d)=>d.endsWith(".md")):i.filter((d)=>d.endsWith(".stx")||d.endsWith(".md"));if(s.length===0)console.error(`No STX or Markdown files found matching pattern: ${t}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),n.exit(1);let c=t.split("*")[0].replace(/\/$/,"")||".",r=f.resolve(c);try{let d=new Bun.Glob("**/*.stx"),m=(await Array.fromAsync(d.scan({cwd:r,onlyFiles:!0,absolute:!0}))).filter((g)=>/\[.+\]/.test(f.basename(g)));for(let g of m)if(!s.includes(g))s.push(g)}catch{}if(console.log(`Found ${s.length} ${s.length===1?"file":"files"} matching ${t}`),!await Rn(s,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}else{if(!O(t)){let s=A(t);if(!s.isValid)F(s)}if(!await $n(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}}catch(o){console.error("Error starting dev server:",o),n.exit(1)}}),y.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(t=".",e)=>{try{console.log(`Scanning ${t} for accessibility issues...`);let o=e.ignore?e.ignore.split(",").map((l)=>l.trim()):[],{results:i,scannedFiles:s}=await _i(t,{recursive:e.recursive!==!1,ignorePaths:o});if(s.length===0)console.log(`
13
13
  No .stx files matched ${t}
@@ -69,7 +69,7 @@ Total: ${r} issues in ${c} files`),e.output){let l=`
69
69
  File not found: ${t}`),n.exit(1);if(!t.endsWith(".stx"))console.error(`
70
70
  File must have .stx extension: ${t}`),n.exit(1)}let i=f.resolve(e.pages),s=f.resolve(e.out);if(!t&&!S.existsSync(i))console.error(`
71
71
  Pages directory not found: ${i}`),console.log(`
72
- Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-f1apaqfk.js");wt();let r=await c({root:t?f.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(r.mode==="ssr"&&r.ssr)console.log(`
72
+ Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-dpqvacd1.js");wt();let r=await c({root:t?f.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(r.mode==="ssr"&&r.ssr)console.log(`
73
73
  Build complete! (SSR)
74
74
  `),console.log(` Pages compiled: ${r.ssr.pageCount}`),console.log(` Output: ${r.ssr.outputDir}`),console.log(` Duration: ${l}s
75
75
  `);else if(r.ssg){if(console.log(`
@@ -84,7 +84,7 @@ Total: ${r} issues in ${c} files`),e.output){let l=`
84
84
  Build completed with ${r.ssg.failedCount} error(s). Fix the issues above and try again.
85
85
  `),n.exit(1);console.log(" To preview locally:"),console.log(` cd ${e.out||"dist"} && npx serve
86
86
  `)}}catch(o){console.error(`
87
- Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-09gtbb1w.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
87
+ Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-1bsafdnt.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
88
88
  Failed to start production server:`,e instanceof Error?e.message:String(e)),n.exit(1)}}),y.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(t,e)=>{try{let{deploy:o,initNetlify:i,DeployError:s}=await import("./chunk-5fv4g4et.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${j}\x1B[0m`),e.init){console.log(`
89
89
  \uD83D\uDCDD Initializing Netlify configuration...
90
90
  `);let r=await i({directory:t||n.cwd(),siteId:e.siteId});if(console.log(`\u2713 Created ${r.configPath}`),r.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${t}
124
124
  \uD83D\uDCDD ${f.relative(n.cwd(),a)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${f.basename(a)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(a,b),console.log(`\u2705 Formatted ${f.relative(n.cwd(),a)}`),l++}catch(m){console.error(`\u274C Error formatting ${f.relative(n.cwd(),a)}:`,m),d++}if(e.check&&d>0)console.log(`
125
125
  ${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.check&&!e.diff)console.log(`\u2728 Formatted ${l} files successfully`)}catch(o){console.error("Error formatting files:",o),n.exit(1)}}),y.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(t,e)=>{try{if(e.clear){G.clear(),console.log("\u2705 Performance statistics cleared");return}let o=G.getStats();if(Object.keys(o).length===0){if(e.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(e.json)console.log(JSON.stringify(o,null,2));else{console.log(`
126
126
  \uD83D\uDCCA STX Performance Statistics
127
- `);for(let[i,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${i}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:i}=await import("./chunk-ntgy4e1q.js"),{resolveStxTargets:s}=await import("./chunk-b7t8jejd.js"),c=Array.isArray(t)?t:t?[t]:[],r=c.length?c:["**/*.stx"],l=await s(r);if(l.length===0){console.log(`
127
+ `);for(let[i,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${i}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:i}=await import("./chunk-864xm0jy.js"),{resolveStxTargets:s}=await import("./chunk-b7t8jejd.js"),c=Array.isArray(t)?t:t?[t]:[],r=c.length?c:["**/*.stx"],l=await s(r);if(l.length===0){console.log(`
128
128
  No .stx files matched ${r.join(", ")}
129
129
  `);return}let d=Qs(n.argv,"--lib"),a=d.length>0?d:e.lib?Array.isArray(e.lib)?e.lib:[e.lib]:[],m=await i(l,{client:e.client!==!1,server:e.server!==!1,templates:e.templates!==!1,extraLibs:a});if(m.failure)console.error(`
130
130
  Type-check did not run.
@@ -160,11 +160,11 @@ Press Ctrl+C to stop watching...
160
160
  \uD83D\uDCC4 Files with issues:`),d.forEach((a)=>{let m=a.issues.filter((g)=>s[g.type]>=c).length;if(m>0)console.log(` ${f.relative(n.cwd(),a.file)} (${m} issues)`)});if(e.saveReport){let a={summary:l,results:d,generatedAt:new Date().toISOString(),commandOptions:e};await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`
161
161
  \uD83D\uDCCB Analysis report saved to: ${e.saveReport}`)}console.log(`
162
162
  \u2728 Analysis complete! Use --detailed for more information.`)}catch(o){console.error("Error analyzing templates:",o),n.exit(1)}}),y.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(t,e)=>{let{captureScreenshots:o}=await import("./chunk-7xrrzqh7.js"),i=t||"dist";try{let s=await o(i,e.out,{width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),waitMs:Number.parseInt(e.wait,10),timeoutMs:Number.parseInt(e.timeout,10),fullPage:Boolean(e.fullPage),waitSelector:e.waitSelector,format:e.format,backend:e.backend});for(let c of s)console.log(`\uD83D\uDCF8 ${c.output} (${(c.bytes/1024).toFixed(0)} KB)`);console.log(`
163
- \u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(j)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-nn174xjh.js"),o={};if(t.context){let i=f.resolve(t.context);if(S.existsSync(i))try{let s=S.readFileSync(i,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${i}`),n.exit(1)}await e({context:o,cwd:t.cwd?f.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:i,getAvailableFormats:s}=await import("./chunk-ghy82tsc.js"),c=f.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let r=i();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${r.join(", ")}`),n.exit(1);let l=e.target||r[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
163
+ \u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(j)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-9fbkdrm8.js"),o={};if(t.context){let i=f.resolve(t.context);if(S.existsSync(i))try{let s=S.readFileSync(i,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${i}`),n.exit(1)}await e({context:o,cwd:t.cwd?f.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:i,getAvailableFormats:s}=await import("./chunk-et8726at.js"),c=f.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let r=i();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${r.join(", ")}`),n.exit(1);let l=e.target||r[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
164
164
  \uD83D\uDD28 Building native app...`),console.log(` Input: ${t}`),console.log(` Target: ${l}`),console.log(` Format: ${e.format||"default"}`),console.log(` Output: ${e.output}
165
165
  `);let a=await o({input:c,output:f.resolve(e.output),target:l,format:e.format,name:e.name,version:e.version,description:e.description,author:e.author,bundleId:e.bundleId,icon:e.icon?f.resolve(e.icon):void 0,window:{title:e.title,width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),frameless:e.frameless,alwaysOnTop:e.alwaysOnTop},systemTray:e.systemTray,menubarOnly:e.menubarOnly,category:e.category,copyright:e.copyright,minimumSystemVersion:e.minSystemVersion,infoPlist:U(e.infoPlist),devTools:e.devTools,craftPath:e.craftPath,verbose:e.verbose});if(a.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${a.outputPath}`),a.duration)console.log(` Duration: ${(a.duration/1000).toFixed(2)}s`);if(l==="macos"&&a.format==="app")console.log(`
166
166
  \uD83D\uDCA1 To run: open "${a.outputPath}"`);else if(l==="linux"&&a.format==="appimage")console.log(`
167
- \uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-2jjff8kv.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-q79kmad5.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-1zfg1kd5.js"),{runVisualTests:o,updateSnapshots:i,formatTestResults:s}=await import("./chunk-9k7bq97t.js"),c=await e({mode:"build"});if(t.update){let r=await i(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${r} snapshots`)}else{let r=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(r)),r.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:i}=await import("./chunk-4ssg5xpq.js"),s=await i(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${f.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(i){console.error(i instanceof Error?i.message:String(i)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-15erabm6.js"),i=f.resolve(t);if(!S.existsSync(i))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
167
+ \uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-nj488tj2.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-q79kmad5.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-1zfg1kd5.js"),{runVisualTests:o,updateSnapshots:i,formatTestResults:s}=await import("./chunk-9k7bq97t.js"),c=await e({mode:"build"});if(t.update){let r=await i(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${r} snapshots`)}else{let r=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(r)),r.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:i}=await import("./chunk-fynh3bkq.js"),s=await i(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${f.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(i){console.error(i instanceof Error?i.message:String(i)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-15erabm6.js"),i=f.resolve(t);if(!S.existsSync(i))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
168
168
  \uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${t}`),console.log(` Target: ${e.target}`),console.log(` Format: ${e.format}`),console.log(` Output: ${e.output}
169
169
  `);let r=S.readFileSync(i,"utf-8"),l=await o(r,{target:e.target,format:e.format,optimize:e.optimize,treeShake:e.treeShake,hotReload:e.hotReload,debug:e.verbose,sourceMaps:e.sourcemaps,bundle:e.bundle,minify:e.minify}),d=f.resolve(e.output);if(!S.existsSync(d))S.mkdirSync(d,{recursive:!0});let a=f.basename(t,f.extname(t)),m=e.format==="typescript"?"ts":e.format==="json"?"json":"zig",g=f.join(d,`${a}.${m}`);S.writeFileSync(g,l.code);let b=f.join(d,`${a}.manifest.json`);if(S.writeFileSync(b,JSON.stringify(l.manifest,null,2)),e.sourcemaps&&l.sourceMaps){let w=f.join(d,`${a}.${m}.map`);S.writeFileSync(w,l.sourceMaps)}if(e.target==="universal"&&l.platformCode.size>0)for(let[w,k]of l.platformCode){let v=f.join(d,`${a}.${w}.${m}`);S.writeFileSync(v,k)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${g}`),console.log(` Manifest: ${b}`),console.log(`
170
170
  \uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${l.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${l.stats.totalComponents}`),console.log(` Native components: ${l.stats.nativeComponents}`),console.log(` Web fallback components: ${l.stats.webComponents}`),console.log(` Bundle size: ${(l.stats.bundleSize/1024).toFixed(2)}KB`),l.stats.warnings.length>0){console.log(`
@@ -1,10 +1,3 @@
1
- /**
2
- * STX Router Directive
3
- *
4
- * Usage in templates:
5
- * @stxRouter - Inject the SPA router script
6
- * @stxRouter('main') - Specify custom container selector
7
- */
8
1
  import type { CustomDirective } from '../types';
9
2
  /**
10
3
  * Handler for @stxRouter directive
@@ -4,4 +4,5 @@
4
4
  * Browser-side functionality for STX applications.
5
5
  */
6
6
  export * from './directive';
7
+ // Re-export getRouterScript from the canonical router (packages/router)
7
8
  export { getRouterScript } from 'stx-router';
@@ -1,2 +1,2 @@
1
1
  /** Color mode, media, visibility, and scroll-lock helpers for the client runtime. */
2
- export declare const SIGNALS_APPEARANCE_RUNTIME = " function useColorMode(options) {\n options = options || {};\n // The pre-paint boot script (stacksjs/stx#1794) publishes the app's\n // configured options here. Reading them makes a bare useColorMode() agree\n // with whatever already landed on <html> before first paint \u2014 without this\n // the composable would fall back to its own defaults, read a different\n // storage key, and undo the theme on hydration, reintroducing the very\n // flash the boot script exists to prevent.\n var boot = null;\n try { boot = window.__STX_COLOR_MODE__ || null; } catch (e) {}\n // Explicit-undefined checks rather than ||, so an explicit darkClass:null\n // or attribute:null opts out instead of falling through to the default.\n // An explicit null means \"do not manage this\", from the call site OR from\n // app.colorMode. The boot payload is generated by stx and always carries\n // every key, so absent and explicitly-null ARE distinguishable there, and\n // rejecting null made the boot global the one path that could not say it\n // (#1813). The asymmetry hid because it only bites where the fallback is\n // non-null: attribute:null looked fine, darkClass:null silently became\n // 'dark' \u2014 so opting out of the class required repeating the option at\n // every call site, defeating the single-source arrangement the global\n // exists for.\n function pick(a, b, fallback) {\n if (a !== undefined) return a;\n if (b !== undefined) return b;\n return fallback;\n }\n // Read through a helper rather than a short-circuit on boot itself: that\n // expression yields undefined for an undefined boot but NULL for a null\n // one, which pick would now honour as an explicit opt-out.\n function fromBoot(key) {\n return (boot && typeof boot === 'object') ? boot[key] : undefined;\n }\n var storageKey = pick(options.storageKey, fromBoot('storageKey'), 'stx-color-mode');\n var initialMode = pick(options.initialMode, fromBoot('initialMode'), 'auto');\n var darkClass = pick(options.darkClass, fromBoot('darkClass'), 'dark');\n var attribute = pick(options.attribute, fromBoot('attribute'), null);\n var autoValueOption = pick(options.autoValue, fromBoot('autoValue'), undefined);\n var disableTransitions = options.disableTransitions !== false;\n // A mode the page was served already stamped with, which outranks this\n // composable's own resolution: for a page whose theme is not the visitor's\n // to choose (stacksjs/stx#2050). Taken from the boot global's forced key\n // rather than by reading the attribute, because the boot script has\n // stamped it by now either way and the DOM can no longer say which it was.\n //\n // No backticks in this comment, or any other in this file: the runtime is\n // generated from a template literal, so one would end the literal and\n // break the whole emitted script.\n var respectExisting = options.respectExisting === true || fromBoot('respectExisting') === true;\n var bootForced = fromBoot('forced');\n var forcedMode = (respectExisting && (bootForced === 'light' || bootForced === 'dark')) ? bootForced : null;\n var resolved = 'light';\n var listeners = [];\n var cleanups = [];\n\n // Storage tokens meaning \"follow the system\". 'system' is a common spelling\n // for the same concept; rejecting it used to send the app down a silent\n // data-loss path \u2014 read 'system', fail to recognise it, fall back to\n // 'auto', then OVERWRITE the stored value with 'auto' (#1788).\n function normalizeMode(v) {\n if (v === 'light' || v === 'dark') return v;\n if (v === 'auto' || v === 'system') return 'auto';\n return null;\n }\n var preference = normalizeMode(initialMode) || 'auto';\n\n function getSystem() {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n function resolve(pref) { return pref === 'auto' ? getSystem() : pref; }\n // Used wherever the resolved mode is assigned, so a forced page survives\n // a system-theme change and another tab's write, not just the first mount.\n function effective(pref) { return forcedMode || resolve(pref); }\n function applyDOM(mode) {\n var el = document.documentElement;\n if (disableTransitions) el.style.setProperty('transition', 'none', 'important');\n // Both, when both are configured. The class drives the utility\n // framework's dark: variants, the attribute drives everything else \u2014\n // complements, not alternatives.\n if (attribute) el.setAttribute(attribute, mode);\n // Explicit add/remove, not toggle(cls, force) \u2014 very-happy-dom ignores\n // the force argument and plain-toggles, inverting every light-mode test.\n if (darkClass) { if (mode === 'dark') el.classList.add(darkClass); else el.classList.remove(darkClass); }\n if (disableTransitions) { el.offsetHeight; el.style.removeProperty('transition'); }\n }\n function readRaw() {\n try { return localStorage.getItem(storageKey); }\ncatch (e) { return null; }\n }\n // The spelling written back for 'auto': an explicit option wins, else\n // whatever the app already stored, so its own pre-paint script keeps\n // reading a value it recognises.\n var storedRaw = readRaw();\n var autoValue = autoValueOption !== undefined\n ? autoValueOption\n : ((storedRaw === 'auto' || storedRaw === 'system') ? storedRaw : 'auto');\n\n function persist(pref) {\n try { localStorage.setItem(storageKey, pref === 'auto' ? autoValue : pref); }\ncatch (e) {} }\n // persistChoice: only an explicit user choice is written back. Persisting\n // on init would stamp the resolved default over a stored value this\n // composable didn't recognise, destroying it.\n // The boot script keeps the document in step for its whole life when it\n // was configured with what this instance manages (see color-mode-boot.ts):\n // then the system, the foreground and other tabs are its to follow, and\n // this instance only mirrors what it announces. Following them here as\n // well was what made the mode a component's: the listener left with the\n // component, and with it the page's following of the system.\n var bootSync = fromBoot('sync');\n var bootWatches = typeof bootSync === 'function' && fromBoot('watching') === true\n && fromBoot('storageKey') === storageKey && fromBoot('darkClass') === darkClass && fromBoot('attribute') === attribute;\n\n function update(pref, persistChoice) {\n preference = normalizeMode(pref) || 'auto';\n resolved = effective(preference);\n applyDOM(resolved);\n if (persistChoice !== false) persist(preference);\n listeners.forEach(function(fn) { fn(resolved, preference); });\n // A choice made here is announced to every other instance by the boot.\n if (persistChoice !== false && bootWatches) bootSync();\n }\n\n update(normalizeMode(storedRaw) || initialMode, false);\n\n if (bootWatches) {\n var onAnnounced = function(e) {\n var detail = (e && e.detail) || {};\n var pref = normalizeMode(detail.preference) || preference;\n var mode = forcedMode || (detail.mode === 'dark' ? 'dark' : 'light');\n if (pref === preference && mode === resolved) return;\n preference = pref;\n resolved = mode;\n listeners.forEach(function(fn) { fn(resolved, preference); });\n };\n window.addEventListener('stx:color-mode', onAnnounced);\n cleanups.push(function() { window.removeEventListener('stx:color-mode', onAnnounced); });\n onDestroy(function() { cleanups.forEach(function(fn) { fn(); }); listeners = []; });\n return colorModeHandle();\n }\n\n var mql = window.matchMedia('(prefers-color-scheme: dark)');\n var onSystemChange = function() {\n if (preference === 'auto') {\n resolved = forcedMode || getSystem();\n applyDOM(resolved);\n listeners.forEach(function(fn) { fn(resolved, preference); });\n }\n };\n mql.addEventListener('change', onSystemChange);\n cleanups.push(function() { mql.removeEventListener('change', onSystemChange); });\n\n var onStorage = function(e) {\n if (e.key !== storageKey) return;\n var v = normalizeMode(e.newValue);\n if (v) {\n // Track the other tab's spelling too, so a write from here doesn't\n // convert the key out from under it.\n if (v === 'auto' && (e.newValue === 'auto' || e.newValue === 'system')) autoValue = e.newValue;\n preference = v; resolved = effective(v); applyDOM(resolved);\n listeners.forEach(function(fn) { fn(resolved, preference); });\n }\n };\n window.addEventListener('storage', onStorage);\n cleanups.push(function() { window.removeEventListener('storage', onStorage); });\n\n onDestroy(function() { cleanups.forEach(function(fn) { fn(); }); listeners = []; });\n\n return colorModeHandle();\n\n function colorModeHandle() {\n return {\n get mode() { return resolved; },\n get preference() { return preference; },\n get isDark() { return resolved === 'dark'; },\n set: function(mode) { update(mode); },\n toggle: function() { update(resolved === 'dark' ? 'light' : 'dark'); },\n subscribe: function(fn) {\n listeners.push(fn);\n return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };\n }\n };\n }\n }\n\n function useDark(options) {\n var cm = useColorMode(options);\n var dark = state(cm.isDark);\n var setSignal = dark.set;\n cm.subscribe(function(mode) { setSignal(mode === 'dark'); });\n dark.toggle = function() { cm.toggle(); };\n dark.set = function(value) { cm.set(value ? 'dark' : 'light'); };\n Object.defineProperty(dark, 'isDark', { get: function() { return dark(); } });\n return dark;\n }\n\n function useMediaQuery(query) {\n var mql = window.matchMedia(query);\n var matches = state(mql.matches);\n var onChange = function(event) { matches.set(event.matches); };\n if (mql.addEventListener) mql.addEventListener('change', onChange);\n else if (mql.addListener) mql.addListener(onChange);\n onDestroy(function() {\n if (mql.removeEventListener) mql.removeEventListener('change', onChange);\n else if (mql.removeListener) mql.removeListener(onChange);\n });\n Object.defineProperty(matches, 'matches', { get: function() { return matches(); } });\n Object.defineProperty(matches, 'value', { get: function() { return matches(); } });\n return matches;\n }\n\n // 'visible' or 'hidden', kept current: whether the page is on screen (the\n // app in the foreground, the tab in front). Built in rather than taken from\n // @stacksjs/browser, whose bundle a page then carried in full (~180KB) for\n // this one listener.\n function useDocumentVisibility() {\n var visibility = state(typeof document !== 'undefined' ? document.visibilityState : 'visible');\n if (typeof document === 'undefined') return visibility;\n var onChange = function() { visibility.set(document.visibilityState); };\n document.addEventListener('visibilitychange', onChange);\n onDestroy(function() { document.removeEventListener('visibilitychange', onChange); });\n return visibility;\n }\n\n var scrollLockStates = new WeakMap();\n\n function resolveScrollLockTarget(target) {\n var value = target;\n if (typeof value === 'function') value = value();\n if (value && typeof value === 'object' && 'current' in value) value = value.current;\n if (value && typeof value === 'object' && !value.nodeType && 'value' in value) value = value.value;\n return value || document.body || document.documentElement;\n }\n\n function acquireScrollLock(element) {\n if (!element) return;\n var existing = scrollLockStates.get(element);\n if (existing) {\n existing.count += 1;\n return;\n }\n scrollLockStates.set(element, { count: 1, overflow: element.style.overflow });\n element.style.overflow = 'hidden';\n }\n\n function releaseScrollLock(element) {\n if (!element) return;\n var existing = scrollLockStates.get(element);\n if (!existing) return;\n existing.count -= 1;\n if (existing.count > 0) return;\n element.style.overflow = existing.overflow;\n scrollLockStates.delete(element);\n }\n\n function useScrollLock(target) {\n var locked = state(false);\n var lockedElement = null;\n var unsubscribe = locked.subscribe(function(value) {\n if (value) {\n if (lockedElement) return;\n lockedElement = resolveScrollLockTarget(target);\n acquireScrollLock(lockedElement);\n }\n else if (lockedElement) {\n releaseScrollLock(lockedElement);\n lockedElement = null;\n }\n });\n onDestroy(function() {\n unsubscribe();\n if (lockedElement) {\n releaseScrollLock(lockedElement);\n lockedElement = null;\n }\n });\n return locked;\n }\n\n function usePreferredDark() { return useMediaQuery('(prefers-color-scheme: dark)'); }\n function usePreferredLight() { return useMediaQuery('(prefers-color-scheme: light)'); }\n function usePreferredReducedMotion() { return useMediaQuery('(prefers-reduced-motion: reduce)'); }\n function usePreferredContrast() { return useMediaQuery('(prefers-contrast: more)'); }\n";
2
+ export declare const SIGNALS_APPEARANCE_RUNTIME: string;
@@ -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;