@stacksjs/stx 0.2.572 → 0.2.574

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (499) hide show
  1. package/dist/a11y.d.ts +51 -111
  2. package/dist/animation.d.ts +131 -74
  3. package/dist/api-client.d.ts +11 -21
  4. package/dist/api-handler.d.ts +4 -4
  5. package/dist/appearance-bootstrap.d.ts +16 -77
  6. package/dist/application-layers.d.ts +11 -20
  7. package/dist/asset-roots.d.ts +7 -27
  8. package/dist/assets.d.ts +7 -9
  9. package/dist/async-components.d.ts +56 -78
  10. package/dist/auth.d.ts +0 -3
  11. package/dist/browser-core-imports.d.ts +2 -2
  12. package/dist/build-externalize-repeated.d.ts +0 -25
  13. package/dist/build-externalize.d.ts +18 -53
  14. package/dist/build-id.d.ts +40 -28
  15. package/dist/build-message.d.ts +20 -44
  16. package/dist/builtins/attrs.d.ts +0 -14
  17. package/dist/builtins/drawer.d.ts +3 -22
  18. package/dist/builtins/icon.d.ts +17 -19
  19. package/dist/builtins/image-alpha.d.ts +8 -8
  20. package/dist/builtins/image-delivery.d.ts +38 -40
  21. package/dist/builtins/image-placeholder.d.ts +12 -50
  22. package/dist/builtins/image-warmup-worker.d.ts +1 -1
  23. package/dist/builtins/image-worker.d.ts +6 -32
  24. package/dist/builtins/index.d.ts +16 -6
  25. package/dist/builtins/modal.d.ts +13 -23
  26. package/dist/builtins/safe-image.d.ts +2 -42
  27. package/dist/builtins/stx-image.d.ts +44 -24
  28. package/dist/builtins/stx-link.d.ts +5 -8
  29. package/dist/builtins/stx-loading-indicator.d.ts +11 -10
  30. package/dist/builtins/suspense.d.ts +6 -27
  31. package/dist/builtins/toast.d.ts +15 -16
  32. package/dist/builtins/transition-group.d.ts +1 -25
  33. package/dist/caching.d.ts +24 -21
  34. package/dist/{chunk-a6jq7hex.js → chunk-06hx32h4.js} +3 -3
  35. package/dist/{chunk-cyg9w31a.js → chunk-0gt7e1ns.js} +1 -1
  36. package/dist/{chunk-15g5sc0p.js → chunk-0ppzstqj.js} +2 -2
  37. package/dist/{chunk-qcymqscj.js → chunk-0px2ab3m.js} +9 -9
  38. package/dist/chunk-0q5s55km.js +2 -0
  39. package/dist/{chunk-7t3ykgsm.js → chunk-1c8sdf9a.js} +3 -3
  40. package/dist/chunk-1m5pagp3.js +2 -0
  41. package/dist/{chunk-mzqyv7s5.js → chunk-1n9bxdnh.js} +3 -3
  42. package/dist/{chunk-58tz7tmf.js → chunk-1swmxkdt.js} +2 -2
  43. package/dist/{chunk-4easd8da.js → chunk-1x2x3xgc.js} +4 -4
  44. package/dist/chunk-27ja2rpd.js +2 -0
  45. package/dist/chunk-2b0p7am3.js +2 -0
  46. package/dist/{chunk-qj4j547f.js → chunk-30acme5g.js} +2 -2
  47. package/dist/{chunk-1n64749x.js → chunk-32pxa1r0.js} +1 -1
  48. package/dist/{chunk-g66m3g2r.js → chunk-37d52q0d.js} +1 -1
  49. package/dist/{chunk-sfwprq8q.js → chunk-3dr757vb.js} +9 -9
  50. package/dist/chunk-3k6q1481.js +2 -0
  51. package/dist/{chunk-2z0trbbm.js → chunk-3kc7af8c.js} +2 -2
  52. package/dist/chunk-3pr388w5.js +2 -0
  53. package/dist/chunk-42h0kvng.js +2 -0
  54. package/dist/chunk-4eff1v2p.js +2 -0
  55. package/dist/{chunk-gzgc8zk5.js → chunk-4k6cb5fg.js} +5 -5
  56. package/dist/{chunk-s12b57m9.js → chunk-4xvbc0mb.js} +2 -2
  57. package/dist/{chunk-83fdt4yj.js → chunk-501h1mer.js} +4 -4
  58. package/dist/{chunk-tv784gv0.js → chunk-550q827h.js} +2 -2
  59. package/dist/chunk-5n2v9g2c.js +2 -0
  60. package/dist/{chunk-q79kmad5.js → chunk-5xwmkxkk.js} +1 -1
  61. package/dist/chunk-68ygpbta.js +2 -0
  62. package/dist/{chunk-0bt0fbs1.js → chunk-69k5t6pj.js} +52 -52
  63. package/dist/{chunk-232jswfm.js → chunk-6c2y9h5h.js} +1 -1
  64. package/dist/chunk-6gjfres0.js +2 -0
  65. package/dist/chunk-6z57saf5.js +2 -0
  66. package/dist/chunk-71zwgxws.js +2 -0
  67. package/dist/{chunk-b9r88ysg.js → chunk-76437eb4.js} +2 -2
  68. package/dist/{chunk-beqkrwt1.js → chunk-7a0ewpz0.js} +2 -2
  69. package/dist/chunk-7debnvz9.js +2 -0
  70. package/dist/{chunk-jwvzvapp.js → chunk-7gxn7mvd.js} +2 -2
  71. package/dist/{chunk-vp31ff54.js → chunk-7hr63cp5.js} +2 -2
  72. package/dist/{chunk-5t1whxxt.js → chunk-825m59jr.js} +5 -5
  73. package/dist/{chunk-74xwzxwz.js → chunk-8efe5vpm.js} +2 -2
  74. package/dist/{chunk-jqefcghh.js → chunk-8hp6722y.js} +5 -5
  75. package/dist/{chunk-kgj852hx.js → chunk-9yht5n7g.js} +2 -2
  76. package/dist/{chunk-kzjrgh0b.js → chunk-a3w3jc0t.js} +6 -6
  77. package/dist/chunk-a77gbp9x.js +2 -0
  78. package/dist/chunk-ampr3fpv.js +2 -0
  79. package/dist/{chunk-2ads8rw5.js → chunk-b10n7cpe.js} +2 -2
  80. package/dist/{chunk-0q6n3by0.js → chunk-bb5a8adb.js} +3 -3
  81. package/dist/chunk-bgbz0wzq.js +2 -0
  82. package/dist/chunk-bgr7fqhs.js +2 -0
  83. package/dist/chunk-bjfrwcfh.js +2 -0
  84. package/dist/{chunk-9k7bq97t.js → chunk-byhsfnkc.js} +1 -1
  85. package/dist/{chunk-zyk12484.js → chunk-c0ewddb3.js} +2 -2
  86. package/dist/{chunk-b2q8bk8p.js → chunk-c6jyp7ss.js} +2 -2
  87. package/dist/chunk-cdt5pg28.js +2 -0
  88. package/dist/chunk-cfh798k7.js +2 -0
  89. package/dist/{chunk-pnag11c4.js → chunk-cp5903cg.js} +2 -2
  90. package/dist/{chunk-4bgfpkwx.js → chunk-crj0yqc6.js} +1 -1
  91. package/dist/chunk-dax3zkmm.js +2 -0
  92. package/dist/chunk-dn676tdp.js +2 -0
  93. package/dist/chunk-dtbj816p.js +2 -0
  94. package/dist/chunk-e23cg45k.js +2 -0
  95. package/dist/{chunk-qzbzn1yf.js → chunk-e27njk86.js} +12 -12
  96. package/dist/{chunk-vr36s2en.js → chunk-e40qpeg5.js} +2 -2
  97. package/dist/{chunk-q83w8edy.js → chunk-e7pjsrfc.js} +2 -2
  98. package/dist/chunk-ecwpsjpd.js +2 -0
  99. package/dist/{chunk-pqcvh9pp.js → chunk-f0mbj8w9.js} +1 -1
  100. package/dist/chunk-f1zyc84x.js +2 -0
  101. package/dist/{chunk-f4jh9vrj.js → chunk-g8dx2jew.js} +246 -243
  102. package/dist/{chunk-phzs239m.js → chunk-gdxhe7ae.js} +4 -4
  103. package/dist/{chunk-5dmkkvs7.js → chunk-gh0q6jrm.js} +2 -2
  104. package/dist/chunk-h8vk3q9n.js +2 -0
  105. package/dist/{chunk-k7ht6tqe.js → chunk-hq8vxds5.js} +2 -2
  106. package/dist/{chunk-zd01r00t.js → chunk-hqda3vcw.js} +1 -1
  107. package/dist/chunk-j8pamkbh.js +2 -0
  108. package/dist/{chunk-2jjff8kv.js → chunk-jwe7yq8m.js} +5 -5
  109. package/dist/chunk-k5rrp1bt.js +2 -0
  110. package/dist/{chunk-yk3wh2xv.js → chunk-kcq2ed1d.js} +2 -2
  111. package/dist/{chunk-9yar9rfq.js → chunk-ktc1ecsm.js} +1 -1
  112. package/dist/chunk-mfm7ezh6.js +2 -0
  113. package/dist/chunk-mp16jxcg.js +2 -0
  114. package/dist/chunk-myhh1zsm.js +2 -0
  115. package/dist/chunk-n1c9j5qv.js +2 -0
  116. package/dist/{chunk-dcpf6kas.js → chunk-n8hnrgen.js} +6 -6
  117. package/dist/{chunk-36agnyhe.js → chunk-nc0ba89b.js} +6 -6
  118. package/dist/chunk-nf63pk4s.js +2 -0
  119. package/dist/{chunk-1edvsndv.js → chunk-nxw03sy9.js} +2 -2
  120. package/dist/{chunk-jze68d0z.js → chunk-p3xkj7pm.js} +2 -2
  121. package/dist/chunk-p5cry5s7.js +2 -0
  122. package/dist/{chunk-0dz1b6a1.js → chunk-pxk0tpw2.js} +3 -3
  123. package/dist/chunk-qd4snptd.js +2 -0
  124. package/dist/{chunk-h4k3hyny.js → chunk-r5ce7mkg.js} +2 -2
  125. package/dist/chunk-r8qhex33.js +2 -0
  126. package/dist/chunk-rqvn1s52.js +2 -0
  127. package/dist/{chunk-79vdkvhf.js → chunk-sej3ng5k.js} +5 -5
  128. package/dist/chunk-sjsant53.js +2 -0
  129. package/dist/chunk-snzh9z3g.js +3 -0
  130. package/dist/{chunk-ymawe0y5.js → chunk-ss4h5ch3.js} +1 -1
  131. package/dist/{chunk-2crxkm7j.js → chunk-svvavwp2.js} +4 -4
  132. package/dist/{chunk-qt3x1sh3.js → chunk-t79xnvzr.js} +3 -3
  133. package/dist/{chunk-rrj5m9xv.js → chunk-ta50ym5j.js} +2 -2
  134. package/dist/chunk-ty8g61y9.js +2 -0
  135. package/dist/chunk-v1k6w4z5.js +2 -0
  136. package/dist/{chunk-rfnr4xz6.js → chunk-vde4mtfr.js} +2 -2
  137. package/dist/chunk-vm7zv0gc.js +2 -0
  138. package/dist/{chunk-xckzvbvn.js → chunk-vnh550b5.js} +1 -1
  139. package/dist/chunk-vnxc48en.js +2 -0
  140. package/dist/chunk-y7vbwhh7.js +2 -0
  141. package/dist/{chunk-ydx3mfpp.js → chunk-yf90vn5t.js} +6 -6
  142. package/dist/{chunk-6wc2t6cd.js → chunk-yhqhv8mp.js} +13 -13
  143. package/dist/{chunk-s34g3awk.js → chunk-ytf3qkaw.js} +3 -3
  144. package/dist/chunk-yvyypd92.js +2 -0
  145. package/dist/{chunk-c4zpzxex.js → chunk-z33z3rr4.js} +4 -4
  146. package/dist/chunk-zfw39q56.js +2 -0
  147. package/dist/chunk-zpm02e15.js +2 -0
  148. package/dist/chunk-zzr0p4bb.js +2 -0
  149. package/dist/cli.js +18 -18
  150. package/dist/client/directive.d.ts +0 -7
  151. package/dist/client/index.d.ts +1 -0
  152. package/dist/client/signals-appearance-runtime.d.ts +1 -1
  153. package/dist/client/signals-binding-utils-runtime.d.ts +1 -1
  154. package/dist/client/signals-bootstrap-runtime.d.ts +2 -2
  155. package/dist/client/signals-class-runtime.d.ts +1 -1
  156. package/dist/client/signals-component-api-runtime.d.ts +1 -1
  157. package/dist/client/signals-component-hydration-runtime.d.ts +1 -1
  158. package/dist/client/signals-component-props-runtime.d.ts +1 -1
  159. package/dist/client/signals-conditional-chain-runtime.d.ts +1 -1
  160. package/dist/client/signals-conditional-component-runtime.d.ts +1 -1
  161. package/dist/client/signals-container-cleanup-runtime.d.ts +1 -1
  162. package/dist/client/signals-context-runtime.d.ts +1 -1
  163. package/dist/client/signals-cookie-runtime.d.ts +1 -1
  164. package/dist/client/signals-devtools-runtime.d.ts +1 -1
  165. package/dist/client/signals-dialog-runtime.d.ts +1 -1
  166. package/dist/client/signals-dom-ready-runtime.d.ts +1 -1
  167. package/dist/client/signals-drawer-runtime.d.ts +1 -1
  168. package/dist/client/signals-effect-runtime.d.ts +1 -1
  169. package/dist/client/signals-event-shorthand-runtime.d.ts +1 -1
  170. package/dist/client/signals-expression-compiler-runtime.d.ts +1 -1
  171. package/dist/client/signals-expression-runtime.d.ts +1 -1
  172. package/dist/client/signals-fetch-transport-runtime.d.ts +1 -1
  173. package/dist/client/signals-for-runtime.d.ts +1 -1
  174. package/dist/client/signals-globals-runtime.d.ts +1 -1
  175. package/dist/client/signals-handler-runtime.d.ts +1 -1
  176. package/dist/client/signals-head-runtime.d.ts +1 -1
  177. package/dist/client/signals-helpers-runtime.d.ts +1 -1
  178. package/dist/client/signals-host-runtime.d.ts +1 -1
  179. package/dist/client/signals-hydration-audit-runtime.d.ts +1 -1
  180. package/dist/client/signals-hydration-runtime.d.ts +1 -1
  181. package/dist/client/signals-if-chain-runtime.d.ts +1 -1
  182. package/dist/client/signals-if-runtime.d.ts +1 -1
  183. package/dist/client/signals-lazy-hydration-runtime.d.ts +1 -1
  184. package/dist/client/signals-lifecycle-runtime.d.ts +1 -1
  185. package/dist/client/signals-loop-component-remap-runtime.d.ts +1 -1
  186. package/dist/client/signals-loop-conditional-runtime.d.ts +1 -1
  187. package/dist/client/signals-loop-row-runtime.d.ts +1 -1
  188. package/dist/client/signals-manifest-hydration-runtime.d.ts +1 -1
  189. package/dist/client/signals-model-runtime.d.ts +1 -1
  190. package/dist/client/signals-mount-runtime.d.ts +1 -1
  191. package/dist/client/signals-navigation-runtime.d.ts +1 -1
  192. package/dist/client/signals-notify-runtime.d.ts +1 -1
  193. package/dist/client/signals-optimistic-runtime.d.ts +1 -1
  194. package/dist/client/signals-overlay-runtime.d.ts +1 -1
  195. package/dist/client/signals-pipe-runtime.d.ts +1 -1
  196. package/dist/client/signals-proxy-runtime.d.ts +1 -1
  197. package/dist/client/signals-query-runtime.d.ts +1 -1
  198. package/dist/client/signals-reactive-runtime.d.ts +1 -1
  199. package/dist/client/signals-ref-runtime.d.ts +1 -1
  200. package/dist/client/signals-scope-disposal-runtime.d.ts +1 -1
  201. package/dist/client/signals-scope-traversal-runtime.d.ts +1 -1
  202. package/dist/client/signals-show-runtime.d.ts +1 -1
  203. package/dist/client/signals-spa-load-control-runtime.d.ts +1 -1
  204. package/dist/client/signals-spa-load-runtime.d.ts +1 -1
  205. package/dist/client/signals-state-runtime.d.ts +1 -1
  206. package/dist/client/signals-storage-runtime.d.ts +1 -1
  207. package/dist/client/signals-store-registry-runtime.d.ts +1 -1
  208. package/dist/client/signals-style-runtime.d.ts +1 -1
  209. package/dist/client/signals-suspense-runtime.d.ts +1 -1
  210. package/dist/client/signals-timer-runtime.d.ts +1 -1
  211. package/dist/client/signals-toast-runtime.d.ts +1 -1
  212. package/dist/client/signals-tooltip-runtime.d.ts +1 -1
  213. package/dist/client/signals-transition-group-runtime.d.ts +1 -1
  214. package/dist/client/signals-websocket-runtime.d.ts +1 -1
  215. package/dist/client-helpers.d.ts +1 -312
  216. package/dist/client-module-registry.d.ts +4 -27
  217. package/dist/client-parameter-bindings.d.ts +4 -9
  218. package/dist/client-parameter-bindings.js +30 -10
  219. package/dist/client-script-bundler.d.ts +55 -103
  220. package/dist/client-script.d.ts +69 -127
  221. package/dist/client-script.js +4 -7
  222. package/dist/color-mode-boot.d.ts +21 -58
  223. package/dist/component-client-factories.d.ts +8 -9
  224. package/dist/component-contract-checks.d.ts +15 -18
  225. package/dist/component-contract.d.ts +6 -6
  226. package/dist/component-hmr.d.ts +8 -7
  227. package/dist/component-model.d.ts +14 -20
  228. package/dist/component-processing.d.ts +51 -59
  229. package/dist/component-registry.d.ts +28 -99
  230. package/dist/component-renderer.d.ts +19 -16
  231. package/dist/component-resolution.d.ts +8 -8
  232. package/dist/component-tags.d.ts +1 -1
  233. package/dist/composable-loader.d.ts +6 -41
  234. package/dist/composables/use-fetch.d.ts +45 -114
  235. package/dist/composables/use-form.d.ts +2 -56
  236. package/dist/composables/use-intersection-observer.d.ts +1 -1
  237. package/dist/composables.d.ts +75 -74
  238. package/dist/composition-api.d.ts +19 -43
  239. package/dist/computed.d.ts +93 -86
  240. package/dist/conditionals.d.ts +0 -24
  241. package/dist/config.d.ts +30 -24
  242. package/dist/config.js +3 -0
  243. package/dist/craft-bridge.d.ts +1 -467
  244. package/dist/craft-components.d.ts +234 -680
  245. package/dist/craft-entry.js +2 -2
  246. package/dist/craft.js +2 -2
  247. package/dist/csp.d.ts +41 -107
  248. package/dist/database.d.ts +1 -1
  249. package/dist/defer.d.ts +0 -24
  250. package/dist/dev-server/terminal-colors.d.ts +32 -32
  251. package/dist/dev-server/ts-css.d.ts +26 -35
  252. package/dist/dev-server/types.d.ts +33 -29
  253. package/dist/directive-api.d.ts +42 -85
  254. package/dist/directive-arguments.d.ts +14 -39
  255. package/dist/document-shell.d.ts +49 -81
  256. package/dist/dynamic-components.d.ts +0 -9
  257. package/dist/engine-bindings.d.ts +1 -1
  258. package/dist/env.d.ts +26 -0
  259. package/dist/error-boundaries.d.ts +36 -43
  260. package/dist/error-handling.d.ts +1 -1
  261. package/dist/errors/codes.d.ts +43 -51
  262. package/dist/errors/formatter.d.ts +38 -58
  263. package/dist/errors/index.d.ts +61 -5
  264. package/dist/errors/logger.d.ts +40 -114
  265. package/dist/errors/sanitizer.d.ts +28 -53
  266. package/dist/errors/types.d.ts +31 -44
  267. package/dist/events.d.ts +32 -94
  268. package/dist/expressions.d.ts +57 -62
  269. package/dist/find-body-tag.d.ts +5 -34
  270. package/dist/first-script-tag.d.ts +0 -23
  271. package/dist/forms-validation.d.ts +117 -149
  272. package/dist/forms.d.ts +161 -120
  273. package/dist/framework-composables.d.ts +0 -32
  274. package/dist/head-injection.d.ts +30 -32
  275. package/dist/head-keys.d.ts +12 -15
  276. package/dist/head.d.ts +110 -139
  277. package/dist/heatmap.d.ts +76 -152
  278. package/dist/html-masking.d.ts +38 -62
  279. package/dist/hydration-runtime.d.ts +24 -20
  280. package/dist/hydration.d.ts +11 -10
  281. package/dist/i18n.d.ts +34 -95
  282. package/dist/image-optimization/auto-sibling.d.ts +4 -32
  283. package/dist/imported-signals.d.ts +0 -36
  284. package/dist/includes.d.ts +6 -69
  285. package/dist/index.d.ts +2 -1
  286. package/dist/init.d.ts +12 -20
  287. package/dist/internal-markdown.d.ts +8 -12
  288. package/dist/interpolation-context.d.ts +15 -15
  289. package/dist/island-chunking.d.ts +13 -30
  290. package/dist/keep-alive.d.ts +52 -72
  291. package/dist/layout-types.d.ts +2 -27
  292. package/dist/lazy-module.d.ts +0 -10
  293. package/dist/loading-indicator.d.ts +8 -5
  294. package/dist/loop-binding.d.ts +4 -7
  295. package/dist/loops.d.ts +25 -67
  296. package/dist/markdown.d.ts +1 -0
  297. package/dist/media/image/component.d.ts +9 -25
  298. package/dist/media/image/directive.d.ts +1 -15
  299. package/dist/media/image/placeholder.d.ts +9 -20
  300. package/dist/media/image/processor/cache.d.ts +18 -40
  301. package/dist/media/image/processor/index.d.ts +10 -1
  302. package/dist/media/image/processor/optimizer.d.ts +1 -12
  303. package/dist/media/image/processor/responsive.d.ts +6 -16
  304. package/dist/media/image/srcset.d.ts +49 -47
  305. package/dist/media/shared/cache.d.ts +31 -51
  306. package/dist/media/shared/hash.d.ts +0 -7
  307. package/dist/media/types.d.ts +754 -1235
  308. package/dist/media/video/directive.d.ts +1 -15
  309. package/dist/media/video/index.d.ts +17 -39
  310. package/dist/media/video/processor/cache.d.ts +19 -42
  311. package/dist/media/video/processor/index.d.ts +18 -1
  312. package/dist/media/video/processor/streaming.d.ts +10 -17
  313. package/dist/media/video/processor/thumbnail.d.ts +15 -21
  314. package/dist/media/video/processor/transcoder.d.ts +1 -11
  315. package/dist/meta-arguments.d.ts +14 -39
  316. package/dist/method-spoofing.d.ts +0 -7
  317. package/dist/middleware.d.ts +0 -60
  318. package/dist/native/bridge/protocol.d.ts +2 -1
  319. package/dist/native/compiler/headwind-to-style.d.ts +383 -359
  320. package/dist/native/compiler/icons.d.ts +249 -243
  321. package/dist/native/compiler/svg.d.ts +35 -24
  322. package/dist/native/runtime/jsc-globals.d.ts +1 -1
  323. package/dist/native/runtime/native-host.d.ts +1 -1
  324. package/dist/native/runtime/native-host.js +3 -0
  325. package/dist/offline/app-service-worker.d.ts +50 -114
  326. package/dist/offline/kept-store.d.ts +23 -37
  327. package/dist/offline/query-cache.d.ts +55 -126
  328. package/dist/owned-routes.d.ts +0 -31
  329. package/dist/page-response.d.ts +8 -39
  330. package/dist/parser/directive-parser.d.ts +45 -57
  331. package/dist/parser/expression-parser.d.ts +35 -33
  332. package/dist/parser/index.d.ts +39 -4
  333. package/dist/parser/tokenizer.d.ts +49 -61
  334. package/dist/partial-hydration.d.ts +51 -82
  335. package/dist/performance-utils.d.ts +115 -255
  336. package/dist/placeholder.d.ts +9 -18
  337. package/dist/plugin-system.d.ts +115 -264
  338. package/dist/process.d.ts +4 -9
  339. package/dist/process.js +6 -4
  340. package/dist/prop-sentinels.d.ts +11 -11
  341. package/dist/public-env.d.ts +0 -14
  342. package/dist/pwa/directives.d.ts +20 -12
  343. package/dist/pwa/inject.d.ts +0 -10
  344. package/dist/pwa/precache.d.ts +16 -22
  345. package/dist/pwa/service-worker.d.ts +0 -12
  346. package/dist/pwa.js +3 -3
  347. package/dist/reactive-bindings.d.ts +11 -34
  348. package/dist/reactive-tracking.d.ts +0 -36
  349. package/dist/reactive.d.ts +41 -58
  350. package/dist/render-memo.d.ts +5 -23
  351. package/dist/resolve-stx-targets.d.ts +6 -44
  352. package/dist/route-middleware.d.ts +35 -2
  353. package/dist/route-rules.d.ts +10 -13
  354. package/dist/router.d.ts +9 -8
  355. package/dist/routes.d.ts +3 -1
  356. package/dist/runtime-config-server.d.ts +14 -17
  357. package/dist/runtime-config.d.ts +2 -3
  358. package/dist/runtime-globals.d.ts +90 -122
  359. package/dist/runtime-injection.d.ts +0 -8
  360. package/dist/scaffolding.d.ts +30 -26
  361. package/dist/script-emit.d.ts +0 -30
  362. package/dist/script-validation.d.ts +6 -12
  363. package/dist/seo.d.ts +75 -153
  364. package/dist/server-api.d.ts +9 -12
  365. package/dist/server-bindings.d.ts +1 -26
  366. package/dist/server-data.d.ts +4 -5
  367. package/dist/sfc-template.d.ts +8 -8
  368. package/dist/signal-processing.d.ts +37 -53
  369. package/dist/signals-api.d.ts +58 -135
  370. package/dist/signals.d.ts +18 -24
  371. package/dist/site-url.d.ts +31 -28
  372. package/dist/slots.d.ts +20 -86
  373. package/dist/source-signature.d.ts +5 -28
  374. package/dist/ssg.d.ts +158 -337
  375. package/dist/ssg.js +4 -4
  376. package/dist/state-dir.d.ts +4 -4
  377. package/dist/store-loader.d.ts +0 -10
  378. package/dist/story/analytics.d.ts +60 -138
  379. package/dist/story/bookmarks.d.ts +34 -87
  380. package/dist/story/cli.d.ts +69 -123
  381. package/dist/story/collect/scanner.d.ts +0 -4
  382. package/dist/story/collect/tree.d.ts +1 -8
  383. package/dist/story/commands/build.d.ts +6 -11
  384. package/dist/story/commands/dev.d.ts +8 -15
  385. package/dist/story/commands/preview.d.ts +7 -13
  386. package/dist/story/config-watcher.d.ts +13 -20
  387. package/dist/story/config.d.ts +8 -11
  388. package/dist/story/context.d.ts +8 -14
  389. package/dist/story/hmr.d.ts +26 -24
  390. package/dist/story/hot-swap.d.ts +23 -34
  391. package/dist/story/keyboard-shortcuts.d.ts +18 -23
  392. package/dist/story/output.d.ts +44 -46
  393. package/dist/story/performance.d.ts +45 -107
  394. package/dist/story/presets.d.ts +41 -107
  395. package/dist/story/renderer.d.ts +27 -41
  396. package/dist/story/search.d.ts +12 -23
  397. package/dist/story/server.d.ts +11 -21
  398. package/dist/story/setup.d.ts +15 -23
  399. package/dist/story/testing.d.ts +40 -65
  400. package/dist/story/types.d.ts +160 -262
  401. package/dist/streaming.d.ts +57 -119
  402. package/dist/strip-literals.d.ts +1 -25
  403. package/dist/stx-module-imports.d.ts +7 -0
  404. package/dist/stx-virtual-ts.d.ts +102 -253
  405. package/dist/stx-virtual-ts.js +5 -4
  406. package/dist/style-scoping.d.ts +8 -21
  407. package/dist/suspense.d.ts +52 -67
  408. package/dist/teleport.d.ts +0 -22
  409. package/dist/template-syntax-escape.d.ts +8 -8
  410. package/dist/template-tag-balance.d.ts +6 -22
  411. package/dist/testing.d.ts +26 -11
  412. package/dist/theme-tokens.d.ts +388 -134
  413. package/dist/transitions.d.ts +55 -66
  414. package/dist/ts-css-config.d.ts +12 -70
  415. package/dist/types/component-types.d.ts +122 -187
  416. package/dist/types/config-types.d.ts +341 -956
  417. package/dist/types/context-types.d.ts +24 -46
  418. package/dist/types/csp-types.d.ts +66 -70
  419. package/dist/types/directive-types.d.ts +156 -223
  420. package/dist/types/index.d.ts +110 -6
  421. package/dist/types/pwa-types.d.ts +148 -273
  422. package/dist/types.d.ts +1 -0
  423. package/dist/unresolved-identifiers.d.ts +22 -24
  424. package/dist/url-safety.d.ts +32 -32
  425. package/dist/utils.d.ts +21 -36
  426. package/dist/utils.js +6 -2
  427. package/dist/validator.d.ts +26 -28
  428. package/dist/variable-extractor.d.ts +19 -49
  429. package/dist/view-composers.d.ts +81 -80
  430. package/dist/virtual-scrolling.d.ts +82 -101
  431. package/dist/visual-testing.d.ts +10 -9
  432. package/dist/vue-template.d.ts +0 -23
  433. package/dist/web-components/css-scoping.d.ts +11 -21
  434. package/dist/web-components.d.ts +58 -81
  435. package/dist/x-element.d.ts +1 -0
  436. package/package.json +6 -6
  437. package/stx.d.ts +2 -2
  438. package/dist/app-service-worker.d.ts +0 -165
  439. package/dist/chunk-01mxer9s.js +0 -2
  440. package/dist/chunk-09gtbb1w.js +0 -2
  441. package/dist/chunk-0g2ybnht.js +0 -3
  442. package/dist/chunk-15erabm6.js +0 -2
  443. package/dist/chunk-1z6c6dyk.js +0 -2
  444. package/dist/chunk-1zfg1kd5.js +0 -2
  445. package/dist/chunk-279jv0yf.js +0 -2
  446. package/dist/chunk-2a1q5y6r.js +0 -2
  447. package/dist/chunk-2cqbyb8w.js +0 -2
  448. package/dist/chunk-2jsnrfc8.js +0 -2
  449. package/dist/chunk-3gft8zng.js +0 -2
  450. package/dist/chunk-49gwmcrn.js +0 -2
  451. package/dist/chunk-4wfr074d.js +0 -2
  452. package/dist/chunk-5afw7z6v.js +0 -2
  453. package/dist/chunk-5fv4g4et.js +0 -2
  454. package/dist/chunk-604rs9sq.js +0 -2
  455. package/dist/chunk-636sfxyj.js +0 -2
  456. package/dist/chunk-6f4qrd0s.js +0 -2
  457. package/dist/chunk-6va5pe2m.js +0 -2
  458. package/dist/chunk-8k61b4ae.js +0 -2
  459. package/dist/chunk-asbq9cgs.js +0 -2
  460. package/dist/chunk-b7t8jejd.js +0 -2
  461. package/dist/chunk-b894fxfc.js +0 -2
  462. package/dist/chunk-bm2q1srp.js +0 -2
  463. package/dist/chunk-cgwyd9aq.js +0 -2
  464. package/dist/chunk-cvswrbzw.js +0 -2
  465. package/dist/chunk-d8206zbp.js +0 -2
  466. package/dist/chunk-f10299sf.js +0 -2
  467. package/dist/chunk-f1apaqfk.js +0 -2
  468. package/dist/chunk-g6zeqvvb.js +0 -2
  469. package/dist/chunk-ghy82tsc.js +0 -2
  470. package/dist/chunk-jw33eys8.js +0 -2
  471. package/dist/chunk-k6wgh598.js +0 -2
  472. package/dist/chunk-m2a1fxpb.js +0 -2
  473. package/dist/chunk-m6mxqepz.js +0 -2
  474. package/dist/chunk-n6qp05t9.js +0 -2
  475. package/dist/chunk-nn174xjh.js +0 -2
  476. package/dist/chunk-ntgy4e1q.js +0 -2
  477. package/dist/chunk-nw4axkpx.js +0 -2
  478. package/dist/chunk-p5chk3s9.js +0 -2
  479. package/dist/chunk-pw9verqx.js +0 -2
  480. package/dist/chunk-ta8bhz27.js +0 -2
  481. package/dist/chunk-tc5r2vmw.js +0 -2
  482. package/dist/chunk-ts80ktq7.js +0 -2
  483. package/dist/chunk-vyg8bvkt.js +0 -2
  484. package/dist/chunk-xq2ck69k.js +0 -2
  485. package/dist/chunk-y4ajd836.js +0 -2
  486. package/dist/chunk-zddzjd60.js +0 -2
  487. package/dist/chunk-zgxj1q7w.js +0 -2
  488. package/dist/chunk-zs7qhh40.js +0 -2
  489. package/dist/signals-context-runtime.d.ts +0 -2
  490. package/dist/signals-drawer-runtime.d.ts +0 -2
  491. package/dist/signals-host-runtime.d.ts +0 -9
  492. package/dist/signals-loop-conditional-runtime.d.ts +0 -2
  493. package/dist/signals-manifest-hydration-runtime.d.ts +0 -2
  494. package/dist/signals-notify-runtime.d.ts +0 -2
  495. package/dist/signals-optimistic-runtime.d.ts +0 -2
  496. package/dist/signals-overlay-runtime.d.ts +0 -2
  497. package/dist/signals-scope-disposal-runtime.d.ts +0 -2
  498. package/dist/signals-spa-load-control-runtime.d.ts +0 -2
  499. package/dist/signals-storage-runtime.d.ts +0 -2
package/dist/cli.js CHANGED
@@ -1,15 +1,15 @@
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.572";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
- 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(`
3
+ import"./chunk-yf90vn5t.js";import"./chunk-7hr63cp5.js";import"./chunk-gdxhe7ae.js";import"./chunk-hq8vxds5.js";import"./chunk-4xvbc0mb.js";import{G}from"./chunk-g8dx2jew.js";import"./chunk-3dr757vb.js";import"./chunk-nc0ba89b.js";import"./chunk-vde4mtfr.js";import"./chunk-ta50ym5j.js";import"./chunk-nxw03sy9.js";import"./chunk-550q827h.js";import"./chunk-kcq2ed1d.js";import"./chunk-0px2ab3m.js";import"./chunk-t79xnvzr.js";import"./chunk-c0ewddb3.js";import"./chunk-pveafhzg.js";import"./chunk-76437eb4.js";import"./chunk-1x2x3xgc.js";import"./chunk-8hp6722y.js";import"./chunk-wwhxgvr8.js";import"./chunk-0gt7e1ns.js";import"./chunk-yhqhv8mp.js";import"./chunk-bpdsdbvg.js";import"./chunk-mr9c2ej6.js";import"./chunk-e40qpeg5.js";import"./chunk-r4w1cye7.js";import"./chunk-32pxa1r0.js";import"./chunk-707n4pbz.js";import"./chunk-sej3ng5k.js";import"./chunk-crj0yqc6.js";import"./chunk-501h1mer.js";import"./chunk-1dg5qxg9.js";import"./chunk-5vw8493b.js";import"./chunk-anjm087t.js";import"./chunk-3kc7af8c.js";import{bt,wt}from"./chunk-n8hnrgen.js";import"./chunk-1n9bxdnh.js";import"./chunk-a3w3jc0t.js";import"./chunk-z33z3rr4.js";import"./chunk-7bwkeake.js";import"./chunk-hqda3vcw.js";import"./chunk-06hx32h4.js";import"./chunk-37d52q0d.js";import"./chunk-7gxn7mvd.js";import"./chunk-ss4h5ch3.js";import{eo,to,no,ro,kr,so,oo,io,Cr,_r,An,Pn,In}from"./chunk-69k5t6pj.js";import"./chunk-4k6cb5fg.js";import"./chunk-pxk0tpw2.js";import{_i}from"./chunk-cp5903cg.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.574";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
+ 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 Pn(t,p))n.exit(1)}catch(x){console.error("Failed to process files:",x),n.exit(1)}else An(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 ro(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-2b0p7am3.js"),{loadConfig:s}=await import("./chunk-sjsant53.js");console.log(`
11
11
  \uD83D\uDD0D Running PWA audit...
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(`
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 In(".",{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 In(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 Pn(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 An(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}
14
14
  `),n.exit(1);let c=Object.keys(i).length,r=Object.values(i).reduce((l,d)=>l+d.length,0);if(e.json){let l=JSON.stringify(i,null,2);if(e.output)await Bun.write(e.output,l),console.log(`A11y scan results written to ${e.output}`);else console.log(l)}else if(c===0)console.log(`\u2713 No accessibility issues found in ${s.length} file(s)!`);else{console.log(`Found ${r} accessibility issues in ${c} files:
15
15
  `);for(let[l,d]of Object.entries(i)){let a=f.relative(n.cwd(),l);console.log(`
@@ -61,7 +61,7 @@ Total: ${r} issues in ${c} files`),e.output){let l=`
61
61
  `).join("")}
62
62
  </body>
63
63
  </html>
64
- `.trim();await Bun.write(e.output,l),console.log(`A11y scan results written to ${e.output}`)}}n.exit(r>0?1:0)}catch(o){console.error("Error scanning for accessibility issues:",o),n.exit(1)}}),y.command("components:build [input]","Compile .stx files into a progressive web component library").option("--out <dir>","Output directory",{default:"dist/components"}).option("--prefix <name>","Prefix for inferred custom-element tags",{default:"stx"}).option("--shadow","Use open Shadow DOM by default").option("--no-progressive","Always render client templates on connection").option("--no-manifest","Skip custom-elements.json generation").option("--no-types","Skip TypeScript and JSX declarations").option("--no-css","Skip CSS output").option("--no-bundle","Skip bundle.js generation").option("--no-minify","Do not minify bundle.js and CSS").option("--sourcemap","Generate an external bundle source map").example("stx components:build components --out dist --prefix acme").example("stx components:build src/components --shadow --sourcemap").action(async(t,e)=>{try{let o=await to({inputDir:t||"components",outputDir:e.out,prefix:e.prefix,shadowDOM:e.shadow?"open":!1,progressive:e.progressive!==!1,manifest:e.manifest!==!1,declarations:e.types!==!1,css:e.css!==!1,bundle:e.bundle!==!1,minify:e.minify!==!1,sourcemap:e.sourcemap?"external":!1});console.log(`Built ${o.components.length} web component${o.components.length===1?"":"s"} to ${f.resolve(e.out)}`),console.log(`Generated ${o.files.length} files (${(o.totalBytes/1024).toFixed(1)} kB)`);for(let i of o.components)console.log(` ${i.tag} <- ${f.relative(n.cwd(),i.source)}`)}catch(o){console.error(`Component library build failed: ${o.message}`),n.exit(1)}}),y.command("build [input]","Generate static HTML files from STX templates (SSG)").option("--pages <dir>","Directory containing page templates",{default:"pages"}).option("--out <dir>","Output directory for generated files",{default:"dist"}).option("--domain <url>","Site domain for absolute URLs (e.g., https://example.com)").option("--base <path>","Base URL path for the site",{default:"/"}).option("--sitemap","Generate sitemap.xml",{default:!0}).option("--no-sitemap","Disable sitemap generation").option("--rss","Generate RSS feed").option("--minify","Minify HTML output",{default:!0}).option("--no-minify","Disable HTML minification").option("--no-cache","Disable build caching").option("--clean","Clean output directory before build",{default:!0}).option("--no-clean","Keep existing files in output directory").option("--concurrency <n>","Parallel page generation limit",{default:"10"}).option("--public <dir>","Directory with static assets to copy",{default:"public"}).option("--trailing-slash","Add trailing slashes to URLs").option("--verbose","Show detailed build output").option("--port <number>","Development server port for preview").option("--timeout <ms>","Build timeout in milliseconds").example("stx build").example("stx build --pages src/pages --out public").example("stx build --domain https://example.com --sitemap").example("stx build --no-minify --verbose").action(async(t,e)=>{try{let o=performance.now();if(e.port!==void 0){let d=Number.parseInt(e.port,10);if(d<1024||d>65535){if(d<1024)console.error(`
64
+ `.trim();await Bun.write(e.output,l),console.log(`A11y scan results written to ${e.output}`)}}n.exit(r>0?1:0)}catch(o){console.error("Error scanning for accessibility issues:",o),n.exit(1)}}),y.command("components:build [input]","Compile .stx files into a progressive web component library").option("--out <dir>","Output directory",{default:"dist/components"}).option("--prefix <name>","Prefix for inferred custom-element tags",{default:"stx"}).option("--shadow","Use open Shadow DOM by default").option("--no-progressive","Always render client templates on connection").option("--no-manifest","Skip custom-elements.json generation").option("--no-types","Skip TypeScript and JSX declarations").option("--no-css","Skip CSS output").option("--no-bundle","Skip bundle.js generation").option("--no-minify","Do not minify bundle.js and CSS").option("--sourcemap","Generate an external bundle source map").example("stx components:build components --out dist --prefix acme").example("stx components:build src/components --shadow --sourcemap").action(async(t,e)=>{try{let o=await no({inputDir:t||"components",outputDir:e.out,prefix:e.prefix,shadowDOM:e.shadow?"open":!1,progressive:e.progressive!==!1,manifest:e.manifest!==!1,declarations:e.types!==!1,css:e.css!==!1,bundle:e.bundle!==!1,minify:e.minify!==!1,sourcemap:e.sourcemap?"external":!1});console.log(`Built ${o.components.length} web component${o.components.length===1?"":"s"} to ${f.resolve(e.out)}`),console.log(`Generated ${o.files.length} files (${(o.totalBytes/1024).toFixed(1)} kB)`);for(let i of o.components)console.log(` ${i.tag} <- ${f.relative(n.cwd(),i.source)}`)}catch(o){console.error(`Component library build failed: ${o.message}`),n.exit(1)}}),y.command("build [input]","Generate static HTML files from STX templates (SSG)").option("--pages <dir>","Directory containing page templates",{default:"pages"}).option("--out <dir>","Output directory for generated files",{default:"dist"}).option("--domain <url>","Site domain for absolute URLs (e.g., https://example.com)").option("--base <path>","Base URL path for the site",{default:"/"}).option("--sitemap","Generate sitemap.xml",{default:!0}).option("--no-sitemap","Disable sitemap generation").option("--rss","Generate RSS feed").option("--minify","Minify HTML output",{default:!0}).option("--no-minify","Disable HTML minification").option("--no-cache","Disable build caching").option("--clean","Clean output directory before build",{default:!0}).option("--no-clean","Keep existing files in output directory").option("--concurrency <n>","Parallel page generation limit",{default:"10"}).option("--public <dir>","Directory with static assets to copy",{default:"public"}).option("--trailing-slash","Add trailing slashes to URLs").option("--verbose","Show detailed build output").option("--port <number>","Development server port for preview").option("--timeout <ms>","Build timeout in milliseconds").example("stx build").example("stx build --pages src/pages --out public").example("stx build --domain https://example.com --sitemap").example("stx build --no-minify --verbose").action(async(t,e)=>{try{let o=performance.now();if(e.port!==void 0){let d=Number.parseInt(e.port,10);if(d<1024||d>65535){if(d<1024)console.error(`
65
65
  Port must be between 1024 and 65535`),console.error(`
66
66
  suggestion: Try using a port between 1024 and 65535 (e.g., --port 3000)`);else console.error(`
67
67
  Port must be between 1024 and 65535`);n.exit(1)}}if(e.timeout!==void 0){let d=Number.parseInt(e.timeout,10);if(Number.isNaN(d))console.error(`
@@ -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-a77gbp9x.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,8 +84,8 @@ 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(`
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(`
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-bjfrwcfh.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
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-yvyypd92.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(`
91
91
  You can now deploy with: stx deploy`);return}if(e.build!==!1){if(console.log(`
@@ -97,7 +97,7 @@ You can now deploy with: stx deploy`);return}if(e.build!==!1){if(console.log(`
97
97
  `),console.log(` ${e.dryRun?"Would deploy":"Draft URL"}: ${c.url}`),c.siteUrl)console.log(` Site URL: ${c.siteUrl}`);if(!e.dryRun)console.log(`
98
98
  Deploy ID: ${c.deployId}`),console.log(` Duration: ${(c.duration/1000).toFixed(1)}s`),console.log(` Files: ${c.filesUploaded}`)}}catch(o){if(o instanceof Error&&o.name==="DeployError")console.error(`
99
99
  \u274C ${o.message}`),n.exit(1);console.error(`
100
- \u274C Deploy failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(t,e)=>{try{let{optimizeDirectory:o,isSharpAvailable:i,formatSize:s}=await import("./chunk-f10299sf.js"),c=await import("fs"),r=await import("path");if(console.log(`\x1B[1mstx images\x1B[0m \x1B[2mv${j}\x1B[0m`),!await i())console.error(`
100
+ \u274C Deploy failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(t,e)=>{try{let{optimizeDirectory:o,isSharpAvailable:i,formatSize:s}=await import("./chunk-k5rrp1bt.js"),c=await import("fs"),r=await import("path");if(console.log(`\x1B[1mstx images\x1B[0m \x1B[2mv${j}\x1B[0m`),!await i())console.error(`
101
101
  \u274C sharp is required for image optimization.`),console.log(`
102
102
  Install sharp with:`),console.log(" bun add sharp"),n.exit(1);let d=e.widths.split(",").map((v)=>Number.parseInt(v.trim(),10)).filter((v)=>!Number.isNaN(v)),a=e.formats.split(",").map((v)=>v.trim().toLowerCase()),m=Number.parseInt(e.quality,10)||80,g=e.placeholder,b=r.resolve(t);if(!c.existsSync(b))console.error(`
103
103
  \u274C Input directory not found: ${b}`),n.exit(1);if(!c.statSync(b).isDirectory())console.error(`
@@ -116,17 +116,17 @@ Would generate ~${P} image variants`);return}console.log(`
116
116
  \u2713 Report generated: ${m.outputPath}`),e.open!==!1)console.log(" Opening in browser...")}else console.log(m.report);if(m.exceedsThreshold){let g=e.threshold;console.error(`
117
117
  \u274C Bundle size (${i(m.stats.totalSize)}) exceeds threshold (${g})`),n.exit(1)}if(a==="html"){if(console.log(`
118
118
  \uD83D\uDCCA Summary:`),console.log(` Total Size: ${i(m.stats.totalSize)}`),console.log(` Gzip Size: ${i(m.stats.totalGzipSize)}`),console.log(` Modules: ${m.stats.moduleCount}`),console.log(` Chunks: ${m.stats.chunks.length}`),m.stats.duplicates.length>0)console.log(` Duplicates: ${m.stats.duplicates.length}`)}}catch(o){console.error(`
119
- \u274C Bundle analysis failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("test [patterns...]","Run tests with Bun test runner and browser environment").option("--watch","Watch for changes and rerun tests").option("--filter <pattern>","Only run tests matching the given pattern").option("--reporter <reporter>","Test reporter to use: default or junit (junit requires Bun v1.0+)",{default:"default"}).option("--timeout <ms>","Test timeout in milliseconds",{default:5000}).option("--coverage","Enable code coverage").option("--ui","Coming soon").option("--verbose","Show verbose output including test command").example("stx test").example("stx test packages/stx/test/").example("stx test **/*.test.ts --verbose").example('stx test --filter "should process"').example("stx test --watch --verbose").example("stx test --reporter junit").action(async(t,e)=>{try{if(console.log(`\x1B[1mstx test\x1B[0m \x1B[2mv${j} (${oo})\x1B[0m`),e.timeout){let s=z(e.timeout);if(!s.isValid)F(s)}let o=typeof t==="string"?[t]:t||[];if(o.length===0)o.push("**/*.test.ts","**/*.test.js","**/*.spec.ts","**/*.spec.js");if(e.verbose)console.log("Test patterns:",o),console.log("Options:",JSON.stringify({watch:e.watch||!1,filter:e.filter||"none",reporter:e.reporter||"default",timeout:e.timeout||5000,coverage:e.coverage||!1,ui:e.ui||!1},null,2));if(!await G.timeAsync("test-execution",()=>H(o,e))&&!e.watch)n.exit(1)}catch(o){console.error("Error running tests:",o),n.exit(1)}}),y.command("init [file]","Create a new STX file").alias("new").option("--force","Overwrite existing file").option("--template <file>","Path to a template file to use as a base").example("stx init").example("stx init page.stx").example("stx new contact.stx").example("stx new components/button.stx --template examples/components/button.stx").action(async(t="index.stx",e)=>{try{if(await so(t,{force:e.force,template:e.template}))console.log(`
119
+ \u274C Bundle analysis failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("test [patterns...]","Run tests with Bun test runner and browser environment").option("--watch","Watch for changes and rerun tests").option("--filter <pattern>","Only run tests matching the given pattern").option("--reporter <reporter>","Test reporter to use: default or junit (junit requires Bun v1.0+)",{default:"default"}).option("--timeout <ms>","Test timeout in milliseconds",{default:5000}).option("--coverage","Enable code coverage").option("--ui","Coming soon").option("--verbose","Show verbose output including test command").example("stx test").example("stx test packages/stx/test/").example("stx test **/*.test.ts --verbose").example('stx test --filter "should process"').example("stx test --watch --verbose").example("stx test --reporter junit").action(async(t,e)=>{try{if(console.log(`\x1B[1mstx test\x1B[0m \x1B[2mv${j} (${io})\x1B[0m`),e.timeout){let s=z(e.timeout);if(!s.isValid)F(s)}let o=typeof t==="string"?[t]:t||[];if(o.length===0)o.push("**/*.test.ts","**/*.test.js","**/*.spec.ts","**/*.spec.js");if(e.verbose)console.log("Test patterns:",o),console.log("Options:",JSON.stringify({watch:e.watch||!1,filter:e.filter||"none",reporter:e.reporter||"default",timeout:e.timeout||5000,coverage:e.coverage||!1,ui:e.ui||!1},null,2));if(!await G.timeAsync("test-execution",()=>H(o,e))&&!e.watch)n.exit(1)}catch(o){console.error("Error running tests:",o),n.exit(1)}}),y.command("init [file]","Create a new STX file").alias("new").option("--force","Overwrite existing file").option("--template <file>","Path to a template file to use as a base").example("stx init").example("stx init page.stx").example("stx new contact.stx").example("stx new components/button.stx --template examples/components/button.stx").action(async(t="index.stx",e)=>{try{if(await oo(t,{force:e.force,template:e.template}))console.log(`
120
120
  \u2728 Successfully created file: ${t}`),console.log(`
121
121
  To view it in the development server:`),console.log(` stx dev ${t}
122
122
  `);else console.error(`
123
- \u274C Failed to create file: ${t}`),n.exit(1)}catch(o){console.error("Error creating file:",o),n.exit(1)}}),y.command("format [patterns...]","Format STX and Markdown files automatically").option("--check","Check if files are formatted (exit with error if not)").option("--write","Write formatted files back to disk (default)").option("--diff","Show diff of changes that would be made").option("--ignore <patterns>","Comma-separated patterns to ignore").example("stx format").example("stx format **/*.stx").example("stx format **/*.md").example("stx format **/*.{stx,md}").example("stx format --check").example("stx format --diff --ignore node_modules/**").action(async(t,e)=>{try{if(e.check&&e.write)console.error("\u274C Options --check and --write are mutually exclusive"),console.error("\uD83D\uDCA1 Use --check to verify formatting or --write to apply changes, but not both"),n.exit(1);let o=t&&t.length>0?t:["**/*.stx","**/*.md"],i=e.ignore?e.ignore.split(",").map((a)=>a.trim()):["node_modules/**","dist/**",".git/**"],s=[];for(let a of o){let m=await Array.fromAsync(new Bun.Glob(a).scan({onlyFiles:!0,absolute:!0}));s.push(...m.filter((g)=>g.endsWith(".stx")||g.endsWith(".md")))}if(s=s.filter((a)=>!i.some((m)=>{let g=m.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(g).test(a)})),s.length===0){console.log("No STX or Markdown files found to format.");return}let c=s.filter((a)=>a.endsWith(".stx")),r=s.filter((a)=>a.endsWith(".md"));console.log(`Formatting ${s.length} files (${c.length} .stx, ${r.length} .md)...`);let l=0,d=0;for(let a of s)try{let m=await Bun.file(a).text(),b=a.endsWith(".md")?ro(m):xr(m);if(m!==b)if(e.check)console.log(`\u274C ${f.relative(n.cwd(),a)} needs formatting`),d++;else if(e.diff)console.log(`
123
+ \u274C Failed to create file: ${t}`),n.exit(1)}catch(o){console.error("Error creating file:",o),n.exit(1)}}),y.command("format [patterns...]","Format STX and Markdown files automatically").option("--check","Check if files are formatted (exit with error if not)").option("--write","Write formatted files back to disk (default)").option("--diff","Show diff of changes that would be made").option("--ignore <patterns>","Comma-separated patterns to ignore").example("stx format").example("stx format **/*.stx").example("stx format **/*.md").example("stx format **/*.{stx,md}").example("stx format --check").example("stx format --diff --ignore node_modules/**").action(async(t,e)=>{try{if(e.check&&e.write)console.error("\u274C Options --check and --write are mutually exclusive"),console.error("\uD83D\uDCA1 Use --check to verify formatting or --write to apply changes, but not both"),n.exit(1);let o=t&&t.length>0?t:["**/*.stx","**/*.md"],i=e.ignore?e.ignore.split(",").map((a)=>a.trim()):["node_modules/**","dist/**",".git/**"],s=[];for(let a of o){let m=await Array.fromAsync(new Bun.Glob(a).scan({onlyFiles:!0,absolute:!0}));s.push(...m.filter((g)=>g.endsWith(".stx")||g.endsWith(".md")))}if(s=s.filter((a)=>!i.some((m)=>{let g=m.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(g).test(a)})),s.length===0){console.log("No STX or Markdown files found to format.");return}let c=s.filter((a)=>a.endsWith(".stx")),r=s.filter((a)=>a.endsWith(".md"));console.log(`Formatting ${s.length} files (${c.length} .stx, ${r.length} .md)...`);let l=0,d=0;for(let a of s)try{let m=await Bun.file(a).text(),b=a.endsWith(".md")?so(m):kr(m);if(m!==b)if(e.check)console.log(`\u274C ${f.relative(n.cwd(),a)} needs formatting`),d++;else if(e.diff)console.log(`
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-j8pamkbh.js"),{resolveStxTargets:s}=await import("./chunk-zzr0p4bb.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
- `);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(`
129
+ `);return}let d=eo(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.
131
131
 
132
132
  ${m.failure.split(`
@@ -135,8 +135,8 @@ ${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.chec
135
135
  `),n.exit(2);let g=m.diagnostics.filter((b)=>b.category==="error");if(m.diagnostics.length>0)console.error(`
136
136
  ${o(m.diagnostics)}
137
137
  `);if(console.log(` Checked ${m.blockCount} script block(s) and ${m.expressionCount} template expression(s) in ${m.checkedFiles.length} file(s) \u2014 `+`${g.length} error(s), ${m.diagnostics.length-g.length} warning(s)
138
- `),g.length>0)n.exit(1)}),y.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(t,e)=>{let{codemodSource:o,formatCodemodFindings:i}=await import("./chunk-232jswfm.js"),s=globalThis.Bun.Glob,c=Array.isArray(t)?t:t?[t]:[],r=c.length?c:["**/*.stx","**/*.ts"],l=e.rule?[e.rule]:void 0;if(e.rule&&e.rule!=="confirm"&&e.rule!=="tooltip")console.error(`Unknown rule "${e.rule}". Expected: confirm | tooltip`),n.exit(1);let d=new Set,a=[],m=0,g=new Set;try{let b=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:n.cwd(),stdout:"pipe",stderr:"pipe"});for(let w of new TextDecoder().decode(b.stdout).split("\x00"))if(w)g.add(f.resolve(n.cwd(),w))}catch{}for(let b of r)for await(let w of new s(b).scan({cwd:n.cwd(),absolute:!0})){if(w.includes("/node_modules/")||w.includes("/dist/")||d.has(w)||g.has(w))continue;d.add(w);let k=await Bun.file(w).text(),v=o(k,{file:w,rules:l});if(a.push(...v.findings),e.fix&&v.code!==k)await Bun.write(w,v.code),m++}if(console.error(i(a,Boolean(e.fix))),e.fix)console.error(`
139
- ${m} file(s) written.`)}),y.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(t)=>{try{let e;try{let i=await import("./chunk-p5chk3s9.js");e=i.generateSignalsRuntime}catch{e=void 0}let o=await Sr({generateRuntime:e});if(t.json)console.log(JSON.stringify(o,null,2));else console.log(kr(o));if(!o.ok)n.exit(1)}catch(e){console.error("Error running doctor:",e),n.exit(1)}}),y.command("debug <file>","Debug STX template processing step by step").option("--step","Step through processing stages interactively").option("--verbose","Show detailed processing information").option("--context <data>","JSON string of context data to use").option("--save-report <file>","Save debug report to file").example("stx debug template.stx").example("stx debug template.stx --step").example(`stx debug template.stx --context '{"name": "John", "items": [1,2,3]}'`).action(async(t,e)=>{try{let o=A(t);if(!o.isValid)F(o);console.log(`\uD83D\uDD0D Debugging stx template: ${t}
138
+ `),g.length>0)n.exit(1)}),y.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(t,e)=>{let{codemodSource:o,formatCodemodFindings:i}=await import("./chunk-6c2y9h5h.js"),s=globalThis.Bun.Glob,c=Array.isArray(t)?t:t?[t]:[],r=c.length?c:["**/*.stx","**/*.ts"],l=e.rule?[e.rule]:void 0;if(e.rule&&e.rule!=="confirm"&&e.rule!=="tooltip")console.error(`Unknown rule "${e.rule}". Expected: confirm | tooltip`),n.exit(1);let d=new Set,a=[],m=0,g=new Set;try{let b=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:n.cwd(),stdout:"pipe",stderr:"pipe"});for(let w of new TextDecoder().decode(b.stdout).split("\x00"))if(w)g.add(f.resolve(n.cwd(),w))}catch{}for(let b of r)for await(let w of new s(b).scan({cwd:n.cwd(),absolute:!0})){if(w.includes("/node_modules/")||w.includes("/dist/")||d.has(w)||g.has(w))continue;d.add(w);let k=await Bun.file(w).text(),v=o(k,{file:w,rules:l});if(a.push(...v.findings),e.fix&&v.code!==k)await Bun.write(w,v.code),m++}if(console.error(i(a,Boolean(e.fix))),e.fix)console.error(`
139
+ ${m} file(s) written.`)}),y.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(t)=>{try{let e;try{let i=await import("./chunk-dn676tdp.js");e=i.generateSignalsRuntime}catch{e=void 0}let o=await Cr({generateRuntime:e});if(t.json)console.log(JSON.stringify(o,null,2));else console.log(_r(o));if(!o.ok)n.exit(1)}catch(e){console.error("Error running doctor:",e),n.exit(1)}}),y.command("debug <file>","Debug STX template processing step by step").option("--step","Step through processing stages interactively").option("--verbose","Show detailed processing information").option("--context <data>","JSON string of context data to use").option("--save-report <file>","Save debug report to file").example("stx debug template.stx").example("stx debug template.stx --step").example(`stx debug template.stx --context '{"name": "John", "items": [1,2,3]}'`).action(async(t,e)=>{try{let o=A(t);if(!o.isValid)F(o);console.log(`\uD83D\uDD0D Debugging stx template: ${t}
140
140
  `);let i={};if(e.context)try{i=JSON.parse(e.context)}catch(r){console.error("\u274C Invalid JSON in --context option"),n.exit(1)}let s=await Bun.file(t).text();console.log(`\uD83D\uDCC4 Template Content (${s.length} chars):`),console.log("\u2500".repeat(50)),console.log(s.substring(0,500)+(s.length>500?`
141
141
  ...
142
142
  `:"")),console.log("\u2500".repeat(50));let c=s.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(c)console.log(`
@@ -151,7 +151,7 @@ ${m} file(s) written.`)}),y.command("doctor","Diagnose the stx framework-runtime
151
151
  \uD83D\uDCDD Markdown Files:`),r.forEach((d)=>{console.log(` ${f.relative(o,d)}`)})}}catch(o){console.error("Error getting project status:",o),n.exit(1)}}),y.command("watch [patterns...]","Watch STX files for changes and run commands").option("--command <cmd>","Command to run on file changes",{default:"build"}).option("--ignore <patterns>","Comma-separated patterns to ignore").option("--debounce <ms>","Debounce delay before running command after change",{default:300}).option("--output <dir>","Output directory for command results").option("--verbose","Show detailed file change information").option("--clear","Clear console before running command").example("stx watch").example('stx watch **/*.stx --command "stx build"').example('stx watch --ignore "node_modules/**,dist/**"').action(async(t,e)=>{try{if(!t||t.length===0)console.error("\u274C Input file or pattern is required"),console.error("\uD83D\uDCA1 Specify a file pattern to watch (e.g., stx watch *.stx)"),n.exit(1);let o=Array.isArray(t)?t:[t],i=e.ignore?e.ignore.split(",").map((g)=>g.trim()):["node_modules/**","dist/**",".git/**"];if(e.debounce!==void 0){if(!z(e.debounce).isValid)console.error("\u274C Debounce must be a valid number"),console.error("\uD83D\uDCA1 Specify debounce in milliseconds (e.g., --debounce 300)"),n.exit(1)}if(e.output){if((e.output.match(/\.\.\//g)||[]).length>=3)console.error("\u274C Invalid output directory"),console.error("\uD83D\uDCA1 Specify a valid output directory path"),n.exit(1)}let s=e.debounce||300;console.log(`\uD83D\uDC40 Watching files: ${o.join(", ")}`),console.log(`\uD83D\uDEAB Ignoring: ${i.join(", ")}`),console.log(`\u23F1\uFE0F Debounce: ${s}ms`),console.log(`\uD83D\uDD27 Command: ${e.command}`),console.log(`
152
152
  Press Ctrl+C to stop watching...
153
153
  `);let c,r=!1,l=new Set;l.add(n.cwd());for(let g of o)(await Array.fromAsync(new Bun.Glob(g).scan({onlyFiles:!0,absolute:!0}))).forEach((w)=>{l.add(f.dirname(w))});let d=async()=>{if(r)return;if(r=!0,e.clear)console.clear();console.log(`\uD83D\uDD04 Running: ${e.command}`);let g=Date.now();try{let[b,...w]=e.command.split(" ");R(b,w,{stdio:"inherit",shell:!0}).on("close",(v)=>{let T=Date.now()-g;if(v===0)console.log(`\u2705 Command completed successfully in ${T}ms`);else console.log(`\u274C Command failed with exit code ${v} after ${T}ms`);r=!1})}catch(b){console.error("\u274C Error running command:",b),r=!1}},a=(g,b)=>{if(!b)return;if(i.some((v)=>{if(v.includes("*"))return b.match(v.replace(/\*/g,".*"));return b.includes(v)})){if(e.verbose)console.log(`\uD83D\uDEAB Ignoring: ${b}`);return}if(!o.some((v)=>{if(v.includes("*"))return b.match(v.replace(/\*/g,".*"));return b.endsWith(v)})){if(e.verbose)console.log(`\u23ED\uFE0F Skipping: ${b} (doesn't match patterns)`);return}if(e.verbose)console.log(`\uD83D\uDCDD ${g.toUpperCase()}: ${b}`);if(c)clearTimeout(c);c=setTimeout(d,s)},m=[];for(let g of l)try{let b=S.watch(g,{recursive:!0},a);if(m.push(b),e.verbose)console.log(`\uD83D\uDCC1 Watching directory: ${g}`)}catch(b){console.warn(`\u26A0\uFE0F Could not watch directory: ${g}`)}n.on("SIGINT",()=>{console.log(`
154
- \uD83D\uDED1 Stopping file watcher...`),m.forEach((g)=>g.close()),n.exit(0)})}catch(o){console.error("Error setting up file watcher:",o),n.exit(1)}}),y.command("analyze [patterns...]","Analyze STX templates for performance and best practices").option("--json","Output results as JSON").option("--detailed","Show detailed analysis for each file").option("--only-issues","Only show files with issues").option("--save-report <file>","Save analysis report to file").option("--threshold <level>","Only show issues at or above this level (info, warning, error)",{default:"info"}).example("stx analyze").example("stx analyze **/*.stx --detailed").example("stx analyze --only-issues --threshold warning").action(async(t,e)=>{try{let o=t&&t.length>0?t:["**/*.stx"],i=e.threshold||"info",s={info:0,warning:1,error:2},c=s[i];if(!e.json)console.log("\uD83D\uDD0D Analyzing stx templates...");let{results:r,summary:l}=await eo(o);if(r.length===0){console.log("No STX files found to analyze.");return}let d=e.onlyIssues?r.filter((a)=>a.issues.some((m)=>s[m.type]>=c)):r;if(e.json){let a={summary:l,results:d,generatedAt:new Date().toISOString()};if(e.saveReport)await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`\uD83D\uDCCB Analysis report saved to: ${e.saveReport}`);else console.log(JSON.stringify(a,null,2));return}if(console.log(`
154
+ \uD83D\uDED1 Stopping file watcher...`),m.forEach((g)=>g.close()),n.exit(0)})}catch(o){console.error("Error setting up file watcher:",o),n.exit(1)}}),y.command("analyze [patterns...]","Analyze STX templates for performance and best practices").option("--json","Output results as JSON").option("--detailed","Show detailed analysis for each file").option("--only-issues","Only show files with issues").option("--save-report <file>","Save analysis report to file").option("--threshold <level>","Only show issues at or above this level (info, warning, error)",{default:"info"}).example("stx analyze").example("stx analyze **/*.stx --detailed").example("stx analyze --only-issues --threshold warning").action(async(t,e)=>{try{let o=t&&t.length>0?t:["**/*.stx"],i=e.threshold||"info",s={info:0,warning:1,error:2},c=s[i];if(!e.json)console.log("\uD83D\uDD0D Analyzing stx templates...");let{results:r,summary:l}=await to(o);if(r.length===0){console.log("No STX files found to analyze.");return}let d=e.onlyIssues?r.filter((a)=>a.issues.some((m)=>s[m.type]>=c)):r;if(e.json){let a={summary:l,results:d,generatedAt:new Date().toISOString()};if(e.saveReport)await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`\uD83D\uDCCB Analysis report saved to: ${e.saveReport}`);else console.log(JSON.stringify(a,null,2));return}if(console.log(`
155
155
  \uD83D\uDCCA Analysis Summary`),console.log("\u2500".repeat(50)),console.log(`\uD83D\uDCC1 Files analyzed: ${l.totalFiles}`),console.log(`\uD83D\uDCCF Total lines: ${l.totalLines.toLocaleString()}`),console.log(`\uD83E\uDDEE Average complexity: ${l.avgComplexity}/10`),console.log(`\u26A0\uFE0F Total issues: ${l.totalIssues}`),console.log(`\uD83D\uDE80 Performance score: ${l.performanceScore}/10`),Object.keys(l.issuesByCategory).length>0){console.log(`
156
156
  \uD83D\uDCCB Issues by category:`);for(let[a,m]of Object.entries(l.issuesByCategory))console.log(` ${a}: ${m}`)}if(l.recommendations.length>0)console.log(`
157
157
  \uD83D\uDCA1 Project recommendations:`),l.recommendations.forEach((a)=>{console.log(` \u2022 ${a}`)});if(e.detailed){console.log(`
@@ -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-n1c9j5qv.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-6gjfres0.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-s34g3awk.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-jwe7yq8m.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-5xwmkxkk.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-qd4snptd.js"),{runVisualTests:o,updateSnapshots:i,formatTestResults:s}=await import("./chunk-byhsfnkc.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-ytf3qkaw.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-68ygpbta.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;