@stacksjs/stx 0.2.532 → 0.2.534

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 (298) hide show
  1. package/dist/{chunk-y4qks0bd.js → chunk-01343ehq.js} +2 -2
  2. package/dist/chunk-0e5nasyf.js +2 -0
  3. package/dist/chunk-13zbt9py.js +2 -0
  4. package/dist/{chunk-9w2vmfha.js → chunk-1c4t7ncb.js} +2 -2
  5. package/dist/{chunk-gxfnmjzp.js → chunk-1xgs9gd5.js} +2 -2
  6. package/dist/{chunk-4gt0r98p.js → chunk-2bvk0qyd.js} +2 -2
  7. package/dist/{chunk-y7ds4qyb.js → chunk-2h4f37kx.js} +2 -2
  8. package/dist/{chunk-q6e45gnw.js → chunk-2kvbg3t5.js} +3 -3
  9. package/dist/{chunk-xdtz2v5r.js → chunk-2n4je46m.js} +2 -2
  10. package/dist/{chunk-xcfhy5bj.js → chunk-33bzhsyw.js} +2 -2
  11. package/dist/{chunk-7ybgfk0m.js → chunk-3nk8cnrm.js} +2 -2
  12. package/dist/{chunk-gsxb0ry9.js → chunk-3r1m3tyr.js} +1 -1
  13. package/dist/chunk-3zs8yxy0.js +2 -0
  14. package/dist/{chunk-khwj964t.js → chunk-40hbpz2b.js} +3 -3
  15. package/dist/chunk-4a7v51vh.js +2 -0
  16. package/dist/{chunk-xtknewf7.js → chunk-4hyhr5r7.js} +1 -1
  17. package/dist/{chunk-hp1tnxzb.js → chunk-4pxc3r1p.js} +4 -4
  18. package/dist/chunk-4qts8zk7.js +2 -0
  19. package/dist/{chunk-587ehsxn.js → chunk-4r7s3862.js} +2 -2
  20. package/dist/chunk-4y2av4ev.js +2 -0
  21. package/dist/chunk-5g498pdp.js +2 -0
  22. package/dist/chunk-5gq8m2m7.js +2 -0
  23. package/dist/chunk-5wx323bm.js +2 -0
  24. package/dist/{chunk-d2r8t40y.js → chunk-66s4nhp7.js} +2 -2
  25. package/dist/{chunk-d7x6n702.js → chunk-6dtmants.js} +3 -3
  26. package/dist/chunk-6rcxtdh3.js +2 -0
  27. package/dist/{chunk-st79dqpz.js → chunk-6sd4zdtg.js} +1 -1
  28. package/dist/{chunk-zpdq0kx1.js → chunk-6tnh3cyq.js} +1 -1
  29. package/dist/chunk-6va8wt88.js +2 -0
  30. package/dist/chunk-7v2j9bmc.js +2 -0
  31. package/dist/chunk-7zgtdap7.js +2 -0
  32. package/dist/{chunk-0pebjkzx.js → chunk-843y0pfg.js} +4 -4
  33. package/dist/{chunk-4xxhprts.js → chunk-8chxczpj.js} +3 -3
  34. package/dist/{chunk-b7xdk1g4.js → chunk-8m1y1kyr.js} +5 -5
  35. package/dist/chunk-90kzf313.js +2 -0
  36. package/dist/{chunk-t6769zcy.js → chunk-93n6yv5x.js} +12 -12
  37. package/dist/chunk-94rg5s6c.js +2 -0
  38. package/dist/chunk-9674w2gm.js +2 -0
  39. package/dist/{chunk-gvw8wh29.js → chunk-9p6bt089.js} +3 -3
  40. package/dist/{chunk-kg77xs08.js → chunk-bczcm7jk.js} +2 -2
  41. package/dist/{chunk-rs46hksk.js → chunk-bxsehntq.js} +1 -1
  42. package/dist/{chunk-vg8thz41.js → chunk-c56qtne1.js} +1 -1
  43. package/dist/chunk-d1jxmhph.js +2 -0
  44. package/dist/{chunk-5tj6expd.js → chunk-d7zterbp.js} +2 -2
  45. package/dist/{chunk-664503e6.js → chunk-d871008z.js} +4 -4
  46. package/dist/chunk-dekpf1ry.js +2 -0
  47. package/dist/chunk-epa1c4q4.js +2 -0
  48. package/dist/{chunk-xb0785wp.js → chunk-f3q84h7b.js} +2 -2
  49. package/dist/{chunk-g060jncp.js → chunk-fqfqyn48.js} +4 -4
  50. package/dist/{chunk-g5t10z04.js → chunk-gnx0fzne.js} +60 -60
  51. package/dist/chunk-gsc5t942.js +2 -0
  52. package/dist/chunk-gsm1y1kb.js +2 -0
  53. package/dist/chunk-gxedmh17.js +2 -0
  54. package/dist/{chunk-9xq5yer8.js → chunk-h4crv0by.js} +1 -1
  55. package/dist/{chunk-pr5q4wev.js → chunk-hp8g2q2n.js} +1 -1
  56. package/dist/{chunk-38w14qs7.js → chunk-hvpzy98g.js} +1 -1
  57. package/dist/chunk-j9c0yam7.js +2 -0
  58. package/dist/{chunk-12e4a0ab.js → chunk-jbfad9cc.js} +2 -2
  59. package/dist/chunk-jv3jj612.js +2 -0
  60. package/dist/chunk-jvqas8y2.js +2 -0
  61. package/dist/{chunk-rwn3b21z.js → chunk-k3v13vfr.js} +2 -2
  62. package/dist/chunk-kcs7hyep.js +2 -0
  63. package/dist/chunk-kvp0at16.js +2 -0
  64. package/dist/{chunk-31c1g3rt.js → chunk-m011s2ha.js} +3 -3
  65. package/dist/{chunk-2jk0vceh.js → chunk-m56m95gk.js} +2 -2
  66. package/dist/{chunk-7s14bthq.js → chunk-m5fw8jq1.js} +2 -2
  67. package/dist/chunk-m7jmpech.js +2 -0
  68. package/dist/chunk-m8n9wxba.js +2 -0
  69. package/dist/{chunk-fyxydww2.js → chunk-mjdyyekx.js} +2 -2
  70. package/dist/{chunk-ennxrn5g.js → chunk-nd8v4xgb.js} +5 -5
  71. package/dist/chunk-ngma9vzc.js +2 -0
  72. package/dist/{chunk-rtk6n3vh.js → chunk-ngxqydsg.js} +3 -3
  73. package/dist/{chunk-ee4wwr89.js → chunk-nmy4x6dx.js} +4 -4
  74. package/dist/chunk-pz1mjgsp.js +2 -0
  75. package/dist/{chunk-er031j13.js → chunk-qfc912e5.js} +2 -2
  76. package/dist/chunk-qk3ptn6h.js +2 -0
  77. package/dist/{chunk-03wggzg8.js → chunk-qmza4327.js} +2 -2
  78. package/dist/{chunk-j8pacd7m.js → chunk-qqr4rn9p.js} +4 -4
  79. package/dist/chunk-rx4hz615.js +2 -0
  80. package/dist/chunk-shf0hd05.js +2 -0
  81. package/dist/{chunk-3vvppnws.js → chunk-sqb6gkzf.js} +8374 -8374
  82. package/dist/chunk-t1g1sp2z.js +2 -0
  83. package/dist/{chunk-m2v04c6v.js → chunk-tgc645pa.js} +45 -45
  84. package/dist/{chunk-2dzd2h15.js → chunk-tkvp3rz0.js} +1 -1
  85. package/dist/{chunk-458etq5a.js → chunk-tqnh98j7.js} +3 -3
  86. package/dist/chunk-tr9bjtqx.js +2 -0
  87. package/dist/{chunk-2y6tzn6d.js → chunk-ty1v368m.js} +2 -2
  88. package/dist/{chunk-grb3kfya.js → chunk-v4r8nzf3.js} +1 -1
  89. package/dist/{chunk-p8yh7mgr.js → chunk-v9vvzdag.js} +2 -2
  90. package/dist/{chunk-0wvsfs4s.js → chunk-vb4xxpa6.js} +2 -2
  91. package/dist/chunk-vfnerp7h.js +2 -0
  92. package/dist/{chunk-tkeabv04.js → chunk-vhfwnvmc.js} +5 -5
  93. package/dist/{chunk-15r72kw7.js → chunk-vjdj0ex3.js} +1 -1
  94. package/dist/{chunk-9pztpvvk.js → chunk-wh7xn313.js} +1 -1
  95. package/dist/chunk-wjt46tdp.js +2 -0
  96. package/dist/chunk-wxy9re1a.js +2 -0
  97. package/dist/{chunk-kwvexxey.js → chunk-x607yxrc.js} +3 -3
  98. package/dist/{chunk-3zyvhf4p.js → chunk-xey01yna.js} +1 -1
  99. package/dist/{chunk-stbsqy7e.js → chunk-xwrbrg1q.js} +1 -1
  100. package/dist/{chunk-9sqjmd9a.js → chunk-y18yvcjb.js} +5 -5
  101. package/dist/chunk-ydtnskdv.js +2 -0
  102. package/dist/{chunk-ky25egh1.js → chunk-yw3cqy43.js} +1 -1
  103. package/dist/{chunk-1945hk44.js → chunk-z9r3tqyr.js} +1 -1
  104. package/dist/chunk-zeve89kw.js +2 -0
  105. package/dist/cli.js +12 -12
  106. package/dist/client/signals-appearance-runtime.d.ts +2 -0
  107. package/dist/client/signals-appearance-runtime.js +283 -0
  108. package/dist/client/signals-authoring-runtime.d.ts +2 -0
  109. package/dist/client/signals-authoring-runtime.js +187 -0
  110. package/dist/client/signals-binding-utils-runtime.d.ts +2 -0
  111. package/dist/client/signals-binding-utils-runtime.js +130 -0
  112. package/dist/client/signals-bootstrap-runtime.d.ts +4 -0
  113. package/dist/client/signals-bootstrap-runtime.js +24 -0
  114. package/dist/client/signals-class-runtime.d.ts +2 -0
  115. package/dist/client/signals-class-runtime.js +69 -0
  116. package/dist/client/signals-component-api-runtime.d.ts +1 -0
  117. package/dist/client/signals-component-api-runtime.js +57 -0
  118. package/dist/client/signals-component-hydration-runtime.d.ts +2 -0
  119. package/dist/client/signals-component-hydration-runtime.js +147 -0
  120. package/dist/client/signals-component-props-runtime.d.ts +2 -0
  121. package/dist/client/signals-component-props-runtime.js +90 -0
  122. package/dist/client/signals-conditional-chain-runtime.d.ts +2 -0
  123. package/dist/client/signals-conditional-chain-runtime.js +39 -0
  124. package/dist/client/signals-conditional-component-runtime.d.ts +2 -0
  125. package/dist/client/signals-conditional-component-runtime.js +82 -0
  126. package/dist/client/signals-container-cleanup-runtime.d.ts +2 -0
  127. package/dist/client/signals-container-cleanup-runtime.js +42 -0
  128. package/dist/client/signals-context-runtime.d.ts +2 -0
  129. package/dist/client/signals-context-runtime.js +48 -0
  130. package/dist/client/signals-cookie-runtime.d.ts +2 -0
  131. package/dist/client/signals-cookie-runtime.js +56 -0
  132. package/dist/client/signals-devtools-runtime.d.ts +2 -0
  133. package/dist/client/signals-devtools-runtime.js +136 -0
  134. package/dist/client/signals-dialog-runtime.d.ts +2 -0
  135. package/dist/client/signals-dialog-runtime.js +195 -0
  136. package/dist/client/signals-dom-ready-runtime.d.ts +2 -0
  137. package/dist/client/signals-dom-ready-runtime.js +306 -0
  138. package/dist/client/signals-drawer-runtime.d.ts +2 -0
  139. package/dist/client/signals-drawer-runtime.js +39 -0
  140. package/dist/client/signals-effect-runtime.d.ts +2 -0
  141. package/dist/client/signals-effect-runtime.js +157 -0
  142. package/dist/client/signals-event-shorthand-runtime.d.ts +2 -0
  143. package/dist/client/signals-event-shorthand-runtime.js +88 -0
  144. package/dist/client/signals-expression-compiler-runtime.d.ts +2 -0
  145. package/dist/client/signals-expression-compiler-runtime.js +59 -0
  146. package/dist/client/signals-expression-runtime.d.ts +2 -0
  147. package/dist/client/signals-expression-runtime.js +67 -0
  148. package/dist/client/signals-fetch-runtime.d.ts +2 -0
  149. package/dist/client/signals-fetch-runtime.js +144 -0
  150. package/dist/client/signals-fetch-transport-runtime.d.ts +2 -0
  151. package/dist/client/signals-fetch-transport-runtime.js +216 -0
  152. package/dist/client/signals-for-runtime.d.ts +2 -0
  153. package/dist/client/signals-for-runtime.js +647 -0
  154. package/dist/client/signals-globals-runtime.d.ts +2 -0
  155. package/dist/client/signals-globals-runtime.js +66 -0
  156. package/dist/client/signals-handler-runtime.d.ts +2 -0
  157. package/dist/client/signals-handler-runtime.js +80 -0
  158. package/dist/client/signals-head-runtime.d.ts +2 -0
  159. package/dist/client/signals-head-runtime.js +92 -0
  160. package/dist/client/signals-helpers-runtime.d.ts +2 -0
  161. package/dist/client/signals-helpers-runtime.js +137 -0
  162. package/dist/client/signals-host-runtime.d.ts +9 -0
  163. package/dist/client/signals-host-runtime.js +132 -0
  164. package/dist/client/signals-hydration-audit-runtime.d.ts +2 -0
  165. package/dist/client/signals-hydration-audit-runtime.js +209 -0
  166. package/dist/client/signals-hydration-runtime.d.ts +2 -0
  167. package/dist/client/signals-hydration-runtime.js +52 -0
  168. package/dist/client/signals-if-chain-runtime.d.ts +2 -0
  169. package/dist/client/signals-if-chain-runtime.js +283 -0
  170. package/dist/client/signals-if-runtime.d.ts +2 -0
  171. package/dist/client/signals-if-runtime.js +346 -0
  172. package/dist/client/signals-kept-runtime.d.ts +2 -0
  173. package/dist/client/signals-kept-runtime.js +62 -0
  174. package/dist/client/signals-lazy-hydration-runtime.d.ts +2 -0
  175. package/dist/client/signals-lazy-hydration-runtime.js +133 -0
  176. package/dist/client/signals-lifecycle-runtime.d.ts +2 -0
  177. package/dist/client/signals-lifecycle-runtime.js +114 -0
  178. package/dist/client/signals-loop-component-remap-runtime.d.ts +2 -0
  179. package/dist/client/signals-loop-component-remap-runtime.js +66 -0
  180. package/dist/client/signals-loop-conditional-runtime.d.ts +2 -0
  181. package/dist/client/signals-loop-conditional-runtime.js +48 -0
  182. package/dist/client/signals-loop-row-runtime.d.ts +2 -0
  183. package/dist/client/signals-loop-row-runtime.js +41 -0
  184. package/dist/client/signals-manifest-hydration-runtime.d.ts +2 -0
  185. package/dist/client/signals-manifest-hydration-runtime.js +82 -0
  186. package/dist/client/signals-model-runtime.d.ts +2 -0
  187. package/dist/client/signals-model-runtime.js +156 -0
  188. package/dist/client/signals-mount-runtime.d.ts +1 -0
  189. package/dist/client/signals-mount-runtime.js +231 -0
  190. package/dist/client/signals-navigation-runtime.d.ts +2 -0
  191. package/dist/client/signals-navigation-runtime.js +198 -0
  192. package/dist/client/signals-optimistic-runtime.d.ts +2 -0
  193. package/dist/client/signals-optimistic-runtime.js +34 -0
  194. package/dist/client/signals-overlay-runtime.d.ts +2 -0
  195. package/dist/client/signals-overlay-runtime.js +352 -0
  196. package/dist/client/signals-pipe-runtime.d.ts +2 -0
  197. package/dist/client/signals-pipe-runtime.js +177 -0
  198. package/dist/client/signals-process-element-runtime.d.ts +1 -0
  199. package/dist/client/signals-process-element-runtime.js +696 -0
  200. package/dist/client/signals-proxy-runtime.d.ts +2 -0
  201. package/dist/client/signals-proxy-runtime.js +78 -0
  202. package/dist/client/signals-public-api-runtime.d.ts +1 -0
  203. package/dist/client/signals-public-api-runtime.js +120 -0
  204. package/dist/client/signals-query-runtime.d.ts +2 -0
  205. package/dist/client/signals-query-runtime.js +351 -0
  206. package/dist/client/signals-reactive-core-bootstrap-runtime.d.ts +1 -0
  207. package/dist/client/signals-reactive-core-bootstrap-runtime.js +30 -0
  208. package/dist/client/signals-reactive-runtime.d.ts +2 -0
  209. package/dist/client/signals-reactive-runtime.js +67 -0
  210. package/dist/client/signals-ref-runtime.d.ts +2 -0
  211. package/dist/client/signals-ref-runtime.js +33 -0
  212. package/dist/client/signals-scope-disposal-runtime.d.ts +2 -0
  213. package/dist/client/signals-scope-disposal-runtime.js +195 -0
  214. package/dist/client/signals-scope-traversal-runtime.d.ts +2 -0
  215. package/dist/client/signals-scope-traversal-runtime.js +42 -0
  216. package/dist/client/signals-show-runtime.d.ts +2 -0
  217. package/dist/client/signals-show-runtime.js +54 -0
  218. package/dist/client/signals-spa-load-control-runtime.d.ts +2 -0
  219. package/dist/client/signals-spa-load-control-runtime.js +42 -0
  220. package/dist/client/signals-spa-load-runtime.d.ts +2 -0
  221. package/dist/client/signals-spa-load-runtime.js +187 -0
  222. package/dist/client/signals-state-runtime.d.ts +2 -0
  223. package/dist/client/signals-state-runtime.js +125 -0
  224. package/dist/client/signals-storage-runtime.d.ts +2 -0
  225. package/dist/client/signals-storage-runtime.js +79 -0
  226. package/dist/client/signals-store-registry-runtime.d.ts +1 -0
  227. package/dist/client/signals-store-registry-runtime.js +461 -0
  228. package/dist/client/signals-style-runtime.d.ts +2 -0
  229. package/dist/client/signals-style-runtime.js +35 -0
  230. package/dist/client/signals-suspense-runtime.d.ts +2 -0
  231. package/dist/client/signals-suspense-runtime.js +59 -0
  232. package/dist/client/signals-timer-runtime.d.ts +2 -0
  233. package/dist/client/signals-timer-runtime.js +378 -0
  234. package/dist/client/signals-toast-runtime.d.ts +2 -0
  235. package/dist/client/signals-toast-runtime.js +206 -0
  236. package/dist/client/signals-tooltip-runtime.d.ts +2 -0
  237. package/dist/client/signals-tooltip-runtime.js +40 -0
  238. package/dist/client/signals-transition-group-runtime.d.ts +2 -0
  239. package/dist/client/signals-transition-group-runtime.js +92 -0
  240. package/dist/client/signals-websocket-runtime.d.ts +2 -0
  241. package/dist/client/signals-websocket-runtime.js +138 -0
  242. package/dist/craft-entry.js +2 -2
  243. package/dist/craft.js +2 -2
  244. package/dist/pwa.js +3 -3
  245. package/dist/signals-context-runtime.d.ts +2 -0
  246. package/dist/signals-drawer-runtime.d.ts +2 -0
  247. package/dist/signals-host-runtime.d.ts +9 -0
  248. package/dist/signals-loop-conditional-runtime.d.ts +2 -0
  249. package/dist/signals-manifest-hydration-runtime.d.ts +2 -0
  250. package/dist/signals-optimistic-runtime.d.ts +2 -0
  251. package/dist/signals-overlay-runtime.d.ts +2 -0
  252. package/dist/signals-scope-disposal-runtime.d.ts +2 -0
  253. package/dist/signals-spa-load-control-runtime.d.ts +2 -0
  254. package/dist/signals-storage-runtime.d.ts +2 -0
  255. package/dist/signals.js +141 -9900
  256. package/dist/ssg.js +3 -3
  257. package/package.json +5 -5
  258. package/dist/chunk-0p9pwd61.js +0 -2
  259. package/dist/chunk-0zmv31nc.js +0 -2
  260. package/dist/chunk-28xtazwz.js +0 -2
  261. package/dist/chunk-2936t942.js +0 -2
  262. package/dist/chunk-29qwmthc.js +0 -2
  263. package/dist/chunk-323cxa69.js +0 -2
  264. package/dist/chunk-375zp0vr.js +0 -2
  265. package/dist/chunk-3w49r16x.js +0 -2
  266. package/dist/chunk-8bcvb86w.js +0 -2
  267. package/dist/chunk-8gmb3k1p.js +0 -2
  268. package/dist/chunk-a15yzfc6.js +0 -2
  269. package/dist/chunk-d4155ec5.js +0 -2
  270. package/dist/chunk-dd31q423.js +0 -2
  271. package/dist/chunk-f2q5bckn.js +0 -2
  272. package/dist/chunk-fhx35529.js +0 -2
  273. package/dist/chunk-h1y5q942.js +0 -2
  274. package/dist/chunk-h791c7sb.js +0 -2
  275. package/dist/chunk-h88jcr3k.js +0 -2
  276. package/dist/chunk-heq5c0gd.js +0 -2
  277. package/dist/chunk-j3b24e77.js +0 -2
  278. package/dist/chunk-jpck8nm5.js +0 -2
  279. package/dist/chunk-m4d99a9r.js +0 -2
  280. package/dist/chunk-ng2sdph7.js +0 -2
  281. package/dist/chunk-qs3p7sc6.js +0 -2
  282. package/dist/chunk-rchwwcxy.js +0 -2
  283. package/dist/chunk-rk4mttds.js +0 -2
  284. package/dist/chunk-rma3bv36.js +0 -2
  285. package/dist/chunk-rp5a91ak.js +0 -2
  286. package/dist/chunk-sp5x96rn.js +0 -2
  287. package/dist/chunk-t2mjeezd.js +0 -2
  288. package/dist/chunk-t61j834x.js +0 -2
  289. package/dist/chunk-v2vg5jqq.js +0 -2
  290. package/dist/chunk-vmfw4svt.js +0 -2
  291. package/dist/chunk-w6ecbk3y.js +0 -2
  292. package/dist/chunk-wbv6vjhm.js +0 -2
  293. package/dist/chunk-wfbr3txe.js +0 -2
  294. package/dist/chunk-wpnv0naj.js +0 -2
  295. package/dist/chunk-wwny5dk9.js +0 -2
  296. package/dist/chunk-x55avrcf.js +0 -2
  297. package/dist/chunk-yts2745t.js +0 -2
  298. package/dist/chunk-zah67v44.js +0 -2
@@ -0,0 +1,378 @@
1
+ export const SIGNALS_TIMER_RUNTIME = ` // ==========================================================================
2
+ // Timer & Utility Composables
3
+ // ==========================================================================
4
+
5
+ function useDebounce(fn, delay) {
6
+ delay = delay || 250;
7
+ var timer = null;
8
+ var lastArgs = null;
9
+ var debounced = function() {
10
+ lastArgs = Array.prototype.slice.call(arguments);
11
+ if (timer !== null) clearTimeout(timer);
12
+ var args = lastArgs;
13
+ timer = setTimeout(function() {
14
+ timer = null;
15
+ lastArgs = null;
16
+ fn.apply(null, args);
17
+ }, delay);
18
+ };
19
+ debounced.cancel = function() {
20
+ if (timer !== null) { clearTimeout(timer); timer = null; lastArgs = null; }
21
+ };
22
+ debounced.flush = function() {
23
+ if (timer !== null && lastArgs !== null) {
24
+ clearTimeout(timer); timer = null;
25
+ var args = lastArgs; lastArgs = null;
26
+ fn.apply(null, args);
27
+ }
28
+ };
29
+ debounced.pending = function() { return timer !== null; };
30
+ onDestroy(debounced.cancel);
31
+ return debounced;
32
+ }
33
+
34
+ // VueUse-compatible alias; both names use the same callback contract.
35
+ var useDebounceFn = useDebounce;
36
+
37
+ function useDebouncedValue(getter, delay) {
38
+ delay = delay || 250;
39
+ var current = getter();
40
+ var listeners = [];
41
+ var timer = null;
42
+ function schedule() {
43
+ if (timer !== null) clearTimeout(timer);
44
+ timer = setTimeout(function() {
45
+ timer = null;
46
+ var next = getter();
47
+ if (next !== current) {
48
+ current = next;
49
+ listeners.forEach(function(fn) { fn(current); });
50
+ }
51
+ }, delay);
52
+ }
53
+ schedule();
54
+ onDestroy(function() { if (timer !== null) clearTimeout(timer); listeners = []; });
55
+ return {
56
+ get value() { return current; },
57
+ subscribe: function(fn) {
58
+ listeners.push(fn);
59
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
60
+ }
61
+ };
62
+ }
63
+
64
+ // VueUse-compatible alias; keep the existing value-ref shape.
65
+ var refDebounced = useDebouncedValue;
66
+
67
+ function useThrottle(fn, limit) {
68
+ limit = limit || 250;
69
+ var timer = null;
70
+ var lastRan = 0;
71
+ var throttled = function() {
72
+ var args = Array.prototype.slice.call(arguments);
73
+ var now = Date.now();
74
+ var remaining = limit - (now - lastRan);
75
+ if (remaining <= 0) {
76
+ if (timer !== null) { clearTimeout(timer); timer = null; }
77
+ lastRan = now;
78
+ fn.apply(null, args);
79
+ }
80
+ else if (timer === null) {
81
+ timer = setTimeout(function() {
82
+ lastRan = Date.now();
83
+ timer = null;
84
+ fn.apply(null, args);
85
+ }, remaining);
86
+ }
87
+ };
88
+ throttled.cancel = function() {
89
+ if (timer !== null) { clearTimeout(timer); timer = null; }
90
+ };
91
+ onDestroy(throttled.cancel);
92
+ return throttled;
93
+ }
94
+
95
+ var useThrottleFn = useThrottle;
96
+
97
+ function useInterval(interval, options, thirdOptions) {
98
+ // Accept the callback-first form too \u2014 useInterval(fn, 1000) is what most
99
+ // callers reach for, and silently ignoring the callback (the previous
100
+ // behaviour) produced a timer that ticked into the void. An options object
101
+ // may follow the interval \u2014 useInterval(fn, 1000, { enabled, whileVisible })
102
+ // \u2014 or replace it \u2014 useInterval(fn, { enabled }) (#1870).
103
+ var callback = null;
104
+ if (typeof interval === 'function') {
105
+ callback = interval;
106
+ if (typeof options === 'number') {
107
+ interval = options;
108
+ options = thirdOptions || {};
109
+ }
110
+ else {
111
+ interval = 1000;
112
+ options = (options && typeof options === 'object') ? options : {};
113
+ }
114
+ }
115
+ interval = interval || 1000;
116
+ options = options || {};
117
+ var count = 0;
118
+ var id = null;
119
+ var running = false;
120
+ var listeners = [];
121
+ // A tick is skipped (not counted, listeners not called) while the timer is
122
+ // gated off: enabled is false / returns false, or whileVisible is set
123
+ // and the document is hidden. This makes "run only while authorized and
124
+ // visible" expressible without the caller hand-pausing the timer (#1870).
125
+ function shouldTick() {
126
+ if (options.whileVisible && typeof document !== 'undefined' && document.hidden) return false;
127
+ var en = options.enabled;
128
+ if (typeof en === 'function') return !!en();
129
+ return en !== false;
130
+ }
131
+ function tick() {
132
+ if (!shouldTick()) return;
133
+ count++;
134
+ listeners.forEach(function(fn) { fn(count); });
135
+ }
136
+ function resume() {
137
+ if (running) return;
138
+ running = true;
139
+ id = setInterval(tick, interval);
140
+ if (options.immediate) tick();
141
+ }
142
+ function pause() {
143
+ if (!running) return;
144
+ running = false;
145
+ if (id !== null) { clearInterval(id); id = null; }
146
+ }
147
+ function reset() {
148
+ pause();
149
+ count = 0;
150
+ listeners.forEach(function(fn) { fn(count); });
151
+ resume();
152
+ }
153
+ if (callback) listeners.push(callback);
154
+ resume();
155
+ onDestroy(function() { pause(); listeners = []; });
156
+ return {
157
+ get counter() { return count; },
158
+ pause: pause,
159
+ resume: resume,
160
+ reset: reset,
161
+ subscribe: function(fn) {
162
+ listeners.push(fn);
163
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
164
+ }
165
+ };
166
+ }
167
+
168
+ function useTimeout(callback, delay) {
169
+ delay = delay || 1000;
170
+ var timer = null;
171
+ var pending = false;
172
+ var listeners = [];
173
+ function setPending(v) {
174
+ if (v !== pending) {
175
+ pending = v;
176
+ listeners.forEach(function(fn) { fn(pending); });
177
+ }
178
+ }
179
+ function start() {
180
+ stop();
181
+ setPending(true);
182
+ timer = setTimeout(function() {
183
+ timer = null;
184
+ setPending(false);
185
+ callback();
186
+ }, delay);
187
+ }
188
+ function stop() {
189
+ if (timer !== null) { clearTimeout(timer); timer = null; }
190
+ setPending(false);
191
+ }
192
+ start();
193
+ onDestroy(stop);
194
+ return {
195
+ get isPending() { return pending; },
196
+ start: start,
197
+ stop: stop,
198
+ subscribe: function(fn) {
199
+ listeners.push(fn);
200
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
201
+ }
202
+ };
203
+ }
204
+
205
+ var useTimeoutFn = useTimeout;
206
+
207
+ function useToggle(initial) {
208
+ var current = !!initial;
209
+ var listeners = [];
210
+ function notify() { listeners.forEach(function(fn) { fn(current); }); }
211
+ function toggle() { current = !current; notify(); }
212
+ function set(v) { v = !!v; if (v !== current) { current = v; notify(); } }
213
+ var ref = {
214
+ get value() { return current; },
215
+ subscribe: function(fn) {
216
+ listeners.push(fn);
217
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
218
+ }
219
+ };
220
+ return [ref, toggle, set];
221
+ }
222
+
223
+ function useCounter(initial, options) {
224
+ initial = initial || 0;
225
+ options = options || {};
226
+ var min = options.min != null ? options.min : -Infinity;
227
+ var max = options.max != null ? options.max : Infinity;
228
+ function clamp(v) { return Math.min(max, Math.max(min, v)); }
229
+ var current = clamp(initial);
230
+ var listeners = [];
231
+ function notify() { listeners.forEach(function(fn) { fn(current); }); }
232
+ return {
233
+ get count() { return current; },
234
+ inc: function(step) { current = clamp(current + (step || 1)); notify(); },
235
+ dec: function(step) { current = clamp(current - (step || 1)); notify(); },
236
+ set: function(v) { current = clamp(v); notify(); },
237
+ reset: function() { current = clamp(initial); notify(); },
238
+ subscribe: function(fn) {
239
+ listeners.push(fn);
240
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
241
+ }
242
+ };
243
+ }
244
+
245
+ function useClickOutside(target, handler) {
246
+ function resolveTarget() {
247
+ if (typeof target === 'string') return document.querySelector(target);
248
+ if (target && typeof target === 'object') {
249
+ if ('current' in target) return target.current;
250
+ if ('value' in target) return target.value;
251
+ }
252
+ return target;
253
+ }
254
+ function listener(event) {
255
+ var el = resolveTarget();
256
+ if (!el) return;
257
+ if (el === event.target || el.contains(event.target)) return;
258
+ handler(event);
259
+ }
260
+ document.addEventListener('pointerdown', listener, true);
261
+ function remove() { document.removeEventListener('pointerdown', listener, true); }
262
+ onDestroy(remove);
263
+ return { remove: remove };
264
+ }
265
+
266
+ function useFocus(target) {
267
+ var focused = false;
268
+ var listeners = [];
269
+ function resolve() {
270
+ return typeof target === 'string' ? document.querySelector(target) : target;
271
+ }
272
+ function setFocused(v) {
273
+ if (v !== focused) {
274
+ focused = v;
275
+ listeners.forEach(function(fn) { fn(focused); });
276
+ }
277
+ }
278
+ var onFocusIn = function() { setFocused(true); };
279
+ var onBlurOut = function() { setFocused(false); };
280
+ var el = resolve();
281
+ if (el) {
282
+ el.addEventListener('focus', onFocusIn);
283
+ el.addEventListener('blur', onBlurOut);
284
+ focused = document.activeElement === el;
285
+ }
286
+ onDestroy(function() {
287
+ var el = resolve();
288
+ if (el) { el.removeEventListener('focus', onFocusIn); el.removeEventListener('blur', onBlurOut); }
289
+ listeners = [];
290
+ });
291
+ return {
292
+ get isFocused() { return focused; },
293
+ focus: function() { var el = resolve(); if (el && el.focus) el.focus(); },
294
+ blur: function() { var el = resolve(); if (el && el.blur) el.blur(); },
295
+ subscribe: function(fn) {
296
+ listeners.push(fn);
297
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
298
+ }
299
+ };
300
+ }
301
+
302
+ // Queue work after the current synchronous signal/effect flush and after
303
+ // structural directives finish their deferred subtree hydration. The
304
+ // microtask schedules this timer only after every subscriber has run, so a
305
+ // :if/:for timer created later in the same signal flush runs first and its
306
+ // template refs are available to the callback.
307
+ function nextTick(fn) {
308
+ return Promise.resolve().then(function() {
309
+ return new Promise(function(resolve) {
310
+ setTimeout(function() {
311
+ if (fn) fn();
312
+ resolve();
313
+ }, 0);
314
+ });
315
+ });
316
+ }
317
+
318
+ // Watch several sources at once, calling back with (newValues, oldValues).
319
+ // Declared and auto-imported but never implemented here (#1804). NOT an alias
320
+ // of $watch, which spreads the values and passes no oldValues \u2014 callers
321
+ // written against the declared contract would silently receive the wrong
322
+ // arguments. Sources may be signals, Vue-style refs, or plain values.
323
+ function watchMultiple(sources, callback, options) {
324
+ options = options || {};
325
+ var read = function() {
326
+ return sources.map(function(s) {
327
+ if (typeof s === 'function') return s();
328
+ if (s && typeof s === 'object' && 'value' in s) return s.value;
329
+ return s;
330
+ });
331
+ };
332
+ var oldValues = read();
333
+ var first = true;
334
+ return effect(function() {
335
+ var newValues = read();
336
+ if (first) {
337
+ first = false;
338
+ if (!options.immediate) return;
339
+ }
340
+ callback(newValues, oldValues);
341
+ oldValues = newValues;
342
+ });
343
+ }
344
+
345
+ function useAsync(fn, options) {
346
+ options = options || {};
347
+ var asyncState = 'idle';
348
+ var data = null;
349
+ var error = null;
350
+ var listeners = [];
351
+ function notify() {
352
+ var snap = { state: asyncState, data: data, error: error };
353
+ listeners.forEach(function(fn) { fn(snap); });
354
+ }
355
+ function execute() {
356
+ var args = Array.prototype.slice.call(arguments);
357
+ asyncState = 'loading'; error = null; notify();
358
+ return fn.apply(null, args).then(function(result) {
359
+ data = result; asyncState = 'success'; notify(); return data;
360
+ }).catch(function(e) {
361
+ error = e instanceof Error ? e : new Error(String(e));
362
+ asyncState = 'error'; notify(); return null;
363
+ });
364
+ }
365
+ if (options.immediate) execute();
366
+ return {
367
+ get state() { return asyncState; },
368
+ get isLoading() { return asyncState === 'loading'; },
369
+ get error() { return error; },
370
+ get data() { return data; },
371
+ execute: execute,
372
+ subscribe: function(fn) {
373
+ listeners.push(fn);
374
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
375
+ }
376
+ };
377
+ }
378
+ `;
@@ -0,0 +1,2 @@
1
+ /** Toast notification helpers used by the generated client runtime. */
2
+ export declare const SIGNALS_TOAST_RUNTIME = " // ==========================================================================\n // Toast notification system\n // ==========================================================================\n\n var _toastId = 0;\n var _toastIcons = {\n success: '<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#16a34a\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M9 12l2 2 4-4\"/></svg>',\n error: '<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#dc2626\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"/><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"/></svg>',\n info: '<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#2563eb\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/></svg>',\n warning: '<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#d97706\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/></svg>'\n };\n var _toastColors = {\n success: '#16a34a',\n error: '#dc2626',\n info: '#2563eb',\n warning: '#d97706'\n };\n\n function _getToastContainer() {\n return document.getElementById('stx-toast-container');\n }\n\n function _getToastAnimClass(container) {\n if (!container) return { inAnim: 'stx-toast-in', outAnim: 'stx-toast-out' };\n var pos = container.getAttribute('data-stx-toast-position') || 'top-right';\n if (pos.indexOf('left') !== -1) return { inAnim: 'stx-toast-in-left', outAnim: 'stx-toast-out-left' };\n if (pos.indexOf('center') !== -1) return { inAnim: 'stx-toast-in-center', outAnim: 'stx-toast-out-center' };\n return { inAnim: 'stx-toast-in', outAnim: 'stx-toast-out' };\n }\n\n function removeToast(id) {\n var el = document.getElementById('stx-toast-' + id);\n if (!el) return;\n var container = _getToastContainer();\n var anims = _getToastAnimClass(container);\n el.style.animation = anims.outAnim + ' 0.3s ease forwards';\n setTimeout(function() {\n if (el.parentNode) el.parentNode.removeChild(el);\n }, 300);\n }\n\n /*\n * Is the APP in dark mode, not just the OS?\n *\n * stx's own color-mode boot writes a class (default 'dark') and/or an\n * attribute (data-theme / data-color-mode) onto <html>, so an app pinned to\n * light on a dark OS must not get a dark overlay over a light page. An\n * explicit override wins over both, and the media query is the last resort.\n *\n * One function rather than the resolution inlined per surface. #1875 fixed\n * this at the two dialog call sites, and toast kept the OS-only version and\n * shipped the exact bug #1875 describes; that is what a per-call-site fix\n * costs. See #1912.\n */\n function _resolveDark(override) {\n if (override != null)\n return !!override;\n\n var root = document.documentElement;\n if (root.classList.contains('dark'))\n return true;\n\n var attr = root.getAttribute('data-theme') || root.getAttribute('data-color-mode');\n if (attr === 'dark')\n return true;\n if (attr === 'light')\n return false;\n\n return !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);\n }\n\n function addToast(type, message, options) {\n var container = _getToastContainer();\n if (!container) {\n console.warn('[stx:toast] No <StxToast /> container found. Add <StxToast /> to your layout.');\n return -1;\n }\n var opts = options || {};\n var duration = opts.duration !== undefined ? opts.duration : 3000;\n var id = ++_toastId;\n var maxToasts = parseInt(container.getAttribute('data-stx-toast-max') || '5', 10);\n\n /*\n * A semantic id replaces its own toast in place (stacksjs/stx#1913).\n *\n * Without it, a persistent 'Publishing...' toast and the call that clears\n * it on completion have to thread the numeric return value between two\n * different functions by hand, which is the state management the primitive\n * exists to remove. With an id of 'publish' the second call simply replaces\n * the first, and toast.dismiss('publish') ends it.\n */\n var key = opts.id != null ? String(opts.id) : '';\n if (key) {\n var prior = container.querySelector('[data-stx-toast-key=\"' + key.replace(/\"/g, '') + '\"]');\n // Removed outright rather than through removeToast, which animates for\n // 300ms first. This is a REPLACEMENT, not a dismissal: animating the old\n // one out while the new one animates in shows both at once, in the same\n // slot, which is exactly the flicker a keyed toast exists to avoid.\n if (prior && prior.parentNode)\n prior.parentNode.removeChild(prior);\n }\n\n // Enforce max toasts \u2014 remove oldest\n var existing = container.querySelectorAll('[data-stx-toast]');\n while (existing.length >= maxToasts && existing.length > 0) {\n var oldId = existing[0].getAttribute('data-stx-toast');\n removeToast(oldId);\n existing = container.querySelectorAll('[data-stx-toast]');\n }\n\n var anims = _getToastAnimClass(container);\n var borderColor = _toastColors[type] || _toastColors.info;\n var icon = _toastIcons[type] || _toastIcons.info;\n var isDark = _resolveDark(opts.dark);\n var bg = isDark ? '#1f2937' : '#ffffff';\n var textColor = isDark ? '#f3f4f6' : '#1f2937';\n var shadow = isDark ? '0 4px 12px rgba(0,0,0,0.4)' : '0 4px 12px rgba(0,0,0,0.15)';\n\n var el = document.createElement('div');\n el.id = 'stx-toast-' + id;\n el.setAttribute('data-stx-toast', String(id));\n if (key)\n el.setAttribute('data-stx-toast-key', key);\n el.setAttribute('role', 'alert');\n el.setAttribute('aria-live', 'assertive');\n el.style.cssText = 'pointer-events:auto;display:flex;align-items:flex-start;gap:0.75rem;padding:0.875rem 1rem;border-radius:0.5rem;border-left:4px solid ' + borderColor + ';background:' + bg + ';color:' + textColor + ';box-shadow:' + shadow + ';animation:' + anims.inAnim + ' 0.3s ease;font-family:system-ui,-apple-system,sans-serif;font-size:0.875rem;line-height:1.4;max-width:100%';\n\n var iconSpan = document.createElement('span');\n iconSpan.style.cssText = 'flex-shrink:0;display:flex;align-items:center;margin-top:1px';\n iconSpan.innerHTML = icon;\n\n /*\n * Title above message, when one is given (#1913).\n *\n * Collapsing the two into one string loses the hierarchy that makes a toast\n * scannable, and every one of the 16 call sites in the reporting app passed\n * a title. A wrapper is used only when there IS a title, so the untitled\n * shape renders exactly as it did.\n */\n var msgSpan = document.createElement(opts.title ? 'div' : 'span');\n msgSpan.style.cssText = 'flex:1;word-wrap:break-word';\n\n if (opts.title) {\n var titleEl = document.createElement('div');\n titleEl.setAttribute('data-stx-toast-title', '');\n titleEl.style.cssText = 'font-weight:600;margin-bottom:0.125rem';\n titleEl.textContent = opts.title;\n msgSpan.appendChild(titleEl);\n\n var bodyEl = document.createElement('div');\n bodyEl.style.cssText = 'opacity:0.9';\n bodyEl.textContent = message;\n msgSpan.appendChild(bodyEl);\n }\n else {\n msgSpan.textContent = message;\n }\n\n var closeBtn = document.createElement('button');\n closeBtn.type = 'button';\n closeBtn.setAttribute('aria-label', 'Dismiss notification');\n closeBtn.style.cssText = 'flex-shrink:0;background:none;border:none;cursor:pointer;padding:0;color:' + (isDark ? '#9ca3af' : '#6b7280') + ';font-size:1.125rem;line-height:1;display:flex;align-items:center';\n closeBtn.innerHTML = '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\"><path d=\"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z\"/></svg>';\n closeBtn.onclick = function() { removeToast(id); };\n\n el.appendChild(iconSpan);\n el.appendChild(msgSpan);\n el.appendChild(closeBtn);\n container.appendChild(el);\n\n if (duration > 0) {\n setTimeout(function() { removeToast(id); }, duration);\n }\n\n return id;\n }\n\n var toast = {\n success: function(message, options) { return addToast('success', message, options); },\n error: function(message, options) { return addToast('error', message, options); },\n info: function(message, options) { return addToast('info', message, options); },\n warning: function(message, options) { return addToast('warning', message, options); },\n dismiss: function(id) {\n if (id !== undefined) {\n // A string id is the semantic key the caller passed; a number is the\n // handle addToast returned. Both dismiss, so a caller does not have to\n // know which kind it is holding (#1913).\n if (typeof id === 'string') {\n var c = _getToastContainer();\n var match = c && c.querySelector('[data-stx-toast-key=\"' + id.replace(/\"/g, '') + '\"]');\n if (match)\n removeToast(match.getAttribute('data-stx-toast'));\n return;\n }\n removeToast(id);\n return;\n }\n var container = _getToastContainer();\n if (!container) return;\n var all = container.querySelectorAll('[data-stx-toast]');\n for (var i = 0; i < all.length; i++) {\n var tid = all[i].getAttribute('data-stx-toast');\n removeToast(tid);\n }\n }\n };";
@@ -0,0 +1,206 @@
1
+ export const SIGNALS_TOAST_RUNTIME = ` // ==========================================================================
2
+ // Toast notification system
3
+ // ==========================================================================
4
+
5
+ var _toastId = 0;
6
+ var _toastIcons = {
7
+ success: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',
8
+ error: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',
9
+ info: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
10
+ warning: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'
11
+ };
12
+ var _toastColors = {
13
+ success: '#16a34a',
14
+ error: '#dc2626',
15
+ info: '#2563eb',
16
+ warning: '#d97706'
17
+ };
18
+
19
+ function _getToastContainer() {
20
+ return document.getElementById('stx-toast-container');
21
+ }
22
+
23
+ function _getToastAnimClass(container) {
24
+ if (!container) return { inAnim: 'stx-toast-in', outAnim: 'stx-toast-out' };
25
+ var pos = container.getAttribute('data-stx-toast-position') || 'top-right';
26
+ if (pos.indexOf('left') !== -1) return { inAnim: 'stx-toast-in-left', outAnim: 'stx-toast-out-left' };
27
+ if (pos.indexOf('center') !== -1) return { inAnim: 'stx-toast-in-center', outAnim: 'stx-toast-out-center' };
28
+ return { inAnim: 'stx-toast-in', outAnim: 'stx-toast-out' };
29
+ }
30
+
31
+ function removeToast(id) {
32
+ var el = document.getElementById('stx-toast-' + id);
33
+ if (!el) return;
34
+ var container = _getToastContainer();
35
+ var anims = _getToastAnimClass(container);
36
+ el.style.animation = anims.outAnim + ' 0.3s ease forwards';
37
+ setTimeout(function() {
38
+ if (el.parentNode) el.parentNode.removeChild(el);
39
+ }, 300);
40
+ }
41
+
42
+ /*
43
+ * Is the APP in dark mode, not just the OS?
44
+ *
45
+ * stx's own color-mode boot writes a class (default 'dark') and/or an
46
+ * attribute (data-theme / data-color-mode) onto <html>, so an app pinned to
47
+ * light on a dark OS must not get a dark overlay over a light page. An
48
+ * explicit override wins over both, and the media query is the last resort.
49
+ *
50
+ * One function rather than the resolution inlined per surface. #1875 fixed
51
+ * this at the two dialog call sites, and toast kept the OS-only version and
52
+ * shipped the exact bug #1875 describes; that is what a per-call-site fix
53
+ * costs. See #1912.
54
+ */
55
+ function _resolveDark(override) {
56
+ if (override != null)
57
+ return !!override;
58
+
59
+ var root = document.documentElement;
60
+ if (root.classList.contains('dark'))
61
+ return true;
62
+
63
+ var attr = root.getAttribute('data-theme') || root.getAttribute('data-color-mode');
64
+ if (attr === 'dark')
65
+ return true;
66
+ if (attr === 'light')
67
+ return false;
68
+
69
+ return !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
70
+ }
71
+
72
+ function addToast(type, message, options) {
73
+ var container = _getToastContainer();
74
+ if (!container) {
75
+ console.warn('[stx:toast] No <StxToast /> container found. Add <StxToast /> to your layout.');
76
+ return -1;
77
+ }
78
+ var opts = options || {};
79
+ var duration = opts.duration !== undefined ? opts.duration : 3000;
80
+ var id = ++_toastId;
81
+ var maxToasts = parseInt(container.getAttribute('data-stx-toast-max') || '5', 10);
82
+
83
+ /*
84
+ * A semantic id replaces its own toast in place (stacksjs/stx#1913).
85
+ *
86
+ * Without it, a persistent 'Publishing...' toast and the call that clears
87
+ * it on completion have to thread the numeric return value between two
88
+ * different functions by hand, which is the state management the primitive
89
+ * exists to remove. With an id of 'publish' the second call simply replaces
90
+ * the first, and toast.dismiss('publish') ends it.
91
+ */
92
+ var key = opts.id != null ? String(opts.id) : '';
93
+ if (key) {
94
+ var prior = container.querySelector('[data-stx-toast-key="' + key.replace(/"/g, '') + '"]');
95
+ // Removed outright rather than through removeToast, which animates for
96
+ // 300ms first. This is a REPLACEMENT, not a dismissal: animating the old
97
+ // one out while the new one animates in shows both at once, in the same
98
+ // slot, which is exactly the flicker a keyed toast exists to avoid.
99
+ if (prior && prior.parentNode)
100
+ prior.parentNode.removeChild(prior);
101
+ }
102
+
103
+ // Enforce max toasts \u2014 remove oldest
104
+ var existing = container.querySelectorAll('[data-stx-toast]');
105
+ while (existing.length >= maxToasts && existing.length > 0) {
106
+ var oldId = existing[0].getAttribute('data-stx-toast');
107
+ removeToast(oldId);
108
+ existing = container.querySelectorAll('[data-stx-toast]');
109
+ }
110
+
111
+ var anims = _getToastAnimClass(container);
112
+ var borderColor = _toastColors[type] || _toastColors.info;
113
+ var icon = _toastIcons[type] || _toastIcons.info;
114
+ var isDark = _resolveDark(opts.dark);
115
+ var bg = isDark ? '#1f2937' : '#ffffff';
116
+ var textColor = isDark ? '#f3f4f6' : '#1f2937';
117
+ var shadow = isDark ? '0 4px 12px rgba(0,0,0,0.4)' : '0 4px 12px rgba(0,0,0,0.15)';
118
+
119
+ var el = document.createElement('div');
120
+ el.id = 'stx-toast-' + id;
121
+ el.setAttribute('data-stx-toast', String(id));
122
+ if (key)
123
+ el.setAttribute('data-stx-toast-key', key);
124
+ el.setAttribute('role', 'alert');
125
+ el.setAttribute('aria-live', 'assertive');
126
+ el.style.cssText = 'pointer-events:auto;display:flex;align-items:flex-start;gap:0.75rem;padding:0.875rem 1rem;border-radius:0.5rem;border-left:4px solid ' + borderColor + ';background:' + bg + ';color:' + textColor + ';box-shadow:' + shadow + ';animation:' + anims.inAnim + ' 0.3s ease;font-family:system-ui,-apple-system,sans-serif;font-size:0.875rem;line-height:1.4;max-width:100%';
127
+
128
+ var iconSpan = document.createElement('span');
129
+ iconSpan.style.cssText = 'flex-shrink:0;display:flex;align-items:center;margin-top:1px';
130
+ iconSpan.innerHTML = icon;
131
+
132
+ /*
133
+ * Title above message, when one is given (#1913).
134
+ *
135
+ * Collapsing the two into one string loses the hierarchy that makes a toast
136
+ * scannable, and every one of the 16 call sites in the reporting app passed
137
+ * a title. A wrapper is used only when there IS a title, so the untitled
138
+ * shape renders exactly as it did.
139
+ */
140
+ var msgSpan = document.createElement(opts.title ? 'div' : 'span');
141
+ msgSpan.style.cssText = 'flex:1;word-wrap:break-word';
142
+
143
+ if (opts.title) {
144
+ var titleEl = document.createElement('div');
145
+ titleEl.setAttribute('data-stx-toast-title', '');
146
+ titleEl.style.cssText = 'font-weight:600;margin-bottom:0.125rem';
147
+ titleEl.textContent = opts.title;
148
+ msgSpan.appendChild(titleEl);
149
+
150
+ var bodyEl = document.createElement('div');
151
+ bodyEl.style.cssText = 'opacity:0.9';
152
+ bodyEl.textContent = message;
153
+ msgSpan.appendChild(bodyEl);
154
+ }
155
+ else {
156
+ msgSpan.textContent = message;
157
+ }
158
+
159
+ var closeBtn = document.createElement('button');
160
+ closeBtn.type = 'button';
161
+ closeBtn.setAttribute('aria-label', 'Dismiss notification');
162
+ closeBtn.style.cssText = 'flex-shrink:0;background:none;border:none;cursor:pointer;padding:0;color:' + (isDark ? '#9ca3af' : '#6b7280') + ';font-size:1.125rem;line-height:1;display:flex;align-items:center';
163
+ closeBtn.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"/></svg>';
164
+ closeBtn.onclick = function() { removeToast(id); };
165
+
166
+ el.appendChild(iconSpan);
167
+ el.appendChild(msgSpan);
168
+ el.appendChild(closeBtn);
169
+ container.appendChild(el);
170
+
171
+ if (duration > 0) {
172
+ setTimeout(function() { removeToast(id); }, duration);
173
+ }
174
+
175
+ return id;
176
+ }
177
+
178
+ var toast = {
179
+ success: function(message, options) { return addToast('success', message, options); },
180
+ error: function(message, options) { return addToast('error', message, options); },
181
+ info: function(message, options) { return addToast('info', message, options); },
182
+ warning: function(message, options) { return addToast('warning', message, options); },
183
+ dismiss: function(id) {
184
+ if (id !== undefined) {
185
+ // A string id is the semantic key the caller passed; a number is the
186
+ // handle addToast returned. Both dismiss, so a caller does not have to
187
+ // know which kind it is holding (#1913).
188
+ if (typeof id === 'string') {
189
+ var c = _getToastContainer();
190
+ var match = c && c.querySelector('[data-stx-toast-key="' + id.replace(/"/g, '') + '"]');
191
+ if (match)
192
+ removeToast(match.getAttribute('data-stx-toast'));
193
+ return;
194
+ }
195
+ removeToast(id);
196
+ return;
197
+ }
198
+ var container = _getToastContainer();
199
+ if (!container) return;
200
+ var all = container.querySelectorAll('[data-stx-toast]');
201
+ for (var i = 0; i < all.length; i++) {
202
+ var tid = all[i].getAttribute('data-stx-toast');
203
+ removeToast(tid);
204
+ }
205
+ }
206
+ };`;
@@ -0,0 +1,2 @@
1
+ /** Tooltip delegation used by the generated client runtime. */
2
+ export declare const SIGNALS_TOOLTIP_RUNTIME = " // \u2500\u2500 Tooltip runtime \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n (function() {\n var tip = null;\n function createTip() {\n tip = document.createElement('div');\n tip.id = 'stx-tooltip';\n tip.style.cssText = 'position:absolute;z-index:999999;pointer-events:none;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;word-wrap:break-word;opacity:0;transition:opacity 0.15s ease;white-space:pre-wrap;box-shadow:0 2px 8px rgba(0,0,0,0.2)';\n document.body.appendChild(tip);\n }\n function show(el) {\n if (!tip) createTip();\n var text = el.getAttribute('x-tooltip');\n if (!text) return;\n tip.textContent = text;\n tip.style.display = 'block';\n tip.style.opacity = '0';\n var pos = el.getAttribute('x-tooltip-position') || 'top';\n var rect = el.getBoundingClientRect();\n var tw = tip.offsetWidth;\n var th = tip.offsetHeight;\n var sx = window.scrollX;\n var sy = window.scrollY;\n var left, top;\n if (pos === 'bottom') { left = rect.left + rect.width / 2 - tw / 2; top = rect.bottom + 8; }\n else if (pos === 'left') { left = rect.left - tw - 8; top = rect.top + rect.height / 2 - th / 2; }\n else if (pos === 'right') { left = rect.right + 8; top = rect.top + rect.height / 2 - th / 2; }\n else { left = rect.left + rect.width / 2 - tw / 2; top = rect.top - th - 8; if (top < 0) { top = rect.bottom + 8; } }\n if (left < 4) left = 4;\n if (left + tw > window.innerWidth - 4) left = window.innerWidth - tw - 4;\n tip.style.left = (left + sx) + 'px';\n tip.style.top = (top + sy) + 'px';\n tip.style.opacity = '1';\n }\n function hide() { if (tip) { tip.style.opacity = '0'; setTimeout(function() { if (tip) tip.style.display = 'none'; }, 150); } }\n document.addEventListener('mouseover', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) show(el); });\n document.addEventListener('mouseout', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) hide(); });\n document.addEventListener('focusin', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) show(el); });\n document.addEventListener('focusout', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) hide(); });\n })();\n";
@@ -0,0 +1,40 @@
1
+ export const SIGNALS_TOOLTIP_RUNTIME = ` // \u2500\u2500 Tooltip runtime \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
2
+ (function() {
3
+ var tip = null;
4
+ function createTip() {
5
+ tip = document.createElement('div');
6
+ tip.id = 'stx-tooltip';
7
+ tip.style.cssText = 'position:absolute;z-index:999999;pointer-events:none;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;word-wrap:break-word;opacity:0;transition:opacity 0.15s ease;white-space:pre-wrap;box-shadow:0 2px 8px rgba(0,0,0,0.2)';
8
+ document.body.appendChild(tip);
9
+ }
10
+ function show(el) {
11
+ if (!tip) createTip();
12
+ var text = el.getAttribute('x-tooltip');
13
+ if (!text) return;
14
+ tip.textContent = text;
15
+ tip.style.display = 'block';
16
+ tip.style.opacity = '0';
17
+ var pos = el.getAttribute('x-tooltip-position') || 'top';
18
+ var rect = el.getBoundingClientRect();
19
+ var tw = tip.offsetWidth;
20
+ var th = tip.offsetHeight;
21
+ var sx = window.scrollX;
22
+ var sy = window.scrollY;
23
+ var left, top;
24
+ if (pos === 'bottom') { left = rect.left + rect.width / 2 - tw / 2; top = rect.bottom + 8; }
25
+ else if (pos === 'left') { left = rect.left - tw - 8; top = rect.top + rect.height / 2 - th / 2; }
26
+ else if (pos === 'right') { left = rect.right + 8; top = rect.top + rect.height / 2 - th / 2; }
27
+ else { left = rect.left + rect.width / 2 - tw / 2; top = rect.top - th - 8; if (top < 0) { top = rect.bottom + 8; } }
28
+ if (left < 4) left = 4;
29
+ if (left + tw > window.innerWidth - 4) left = window.innerWidth - tw - 4;
30
+ tip.style.left = (left + sx) + 'px';
31
+ tip.style.top = (top + sy) + 'px';
32
+ tip.style.opacity = '1';
33
+ }
34
+ function hide() { if (tip) { tip.style.opacity = '0'; setTimeout(function() { if (tip) tip.style.display = 'none'; }, 150); } }
35
+ document.addEventListener('mouseover', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) show(el); });
36
+ document.addEventListener('mouseout', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) hide(); });
37
+ document.addEventListener('focusin', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) show(el); });
38
+ document.addEventListener('focusout', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) hide(); });
39
+ })();
40
+ `;
@@ -0,0 +1,2 @@
1
+ /** TransitionGroup animation helpers for the generated client runtime. */
2
+ export declare const SIGNALS_TRANSITION_GROUP_RUNTIME = " // \u2500\u2500 <TransitionGroup> support (#1742) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Class-driven enter/leave + FLIP move animations for keyed :for lists whose\n // parent is a [data-stx-transition-group]. All helpers are self-contained and\n // guarded (no-ops off the happy path), and every transition has a timeout\n // fallback so a missed transitionend (or a layout-less environment) can't hang\n // a leaving node in the DOM. bindFor calls these only when the parent is a\n // group AND the group has already done its initial render (no enter on mount).\n function tgDurationMs(el) {\n try {\n var cs = (typeof getComputedStyle === 'function') ? getComputedStyle(el) : null;\n if (cs) {\n var raw = (cs.transitionDuration || '').split(',')[0].trim();\n var ms = raw.indexOf('ms') >= 0 ? parseFloat(raw) : parseFloat(raw) * 1000;\n if (ms > 0) return ms;\n }\n } catch (e) {}\n return 300;\n }\n function tgOnEnd(el, cb) {\n var done = false;\n function finish() {\n if (done) return;\n done = true;\n try { el.removeEventListener('transitionend', finish); } catch (e) {}\n cb();\n }\n try { el.addEventListener('transitionend', finish); } catch (e) {}\n // Fallback: transitionend may never fire (no real layout, display:none,\n // a dropped event). Always converge.\n setTimeout(finish, tgDurationMs(el) + 60);\n }\n function tgRaf2(fn) {\n var raf = (typeof requestAnimationFrame === 'function') ? requestAnimationFrame : function(f) { return setTimeout(f, 16); };\n raf(function() { raf(fn); });\n }\n function tgEnter(el, name) {\n if (!el || el.nodeType !== 1 || !el.classList) return;\n el.classList.add(name + '-enter-from', name + '-enter-active');\n tgRaf2(function() {\n el.classList.remove(name + '-enter-from');\n el.classList.add(name + '-enter-to');\n tgOnEnd(el, function() { el.classList.remove(name + '-enter-active', name + '-enter-to'); });\n });\n }\n function tgLeave(el, name) {\n if (!el || el.nodeType !== 1 || !el.classList) return false;\n el.classList.add(name + '-leave-from', name + '-leave-active');\n tgRaf2(function() {\n el.classList.remove(name + '-leave-from');\n el.classList.add(name + '-leave-to');\n tgOnEnd(el, function() { if (el.parentNode) el.parentNode.removeChild(el); });\n });\n return true; // took over the DOM removal\n }\n function tgSnapshot(els) {\n var m = new Map();\n for (var i = 0; i < els.length; i++) {\n var el = els[i];\n if (el && el.nodeType === 1 && el.getBoundingClientRect) {\n try { m.set(el, el.getBoundingClientRect()); } catch (e) {}\n }\n }\n return m;\n }\n function tgFlip(els, first, name) {\n var moved = [];\n for (var i = 0; i < els.length; i++) {\n var el = els[i];\n if (!el || el.nodeType !== 1 || !first.has(el) || !el.getBoundingClientRect) continue;\n var last, f = first.get(el);\n try { last = el.getBoundingClientRect(); } catch (e) { continue; }\n var dx = f.left - last.left, dy = f.top - last.top;\n if (dx || dy) {\n el.style.transform = 'translate(' + dx + 'px,' + dy + 'px)';\n el.style.transitionDuration = '0s';\n moved.push(el);\n }\n }\n if (!moved.length) return;\n // Force reflow so the inverted transform is committed before we play it.\n if (els[0] && typeof els[0].offsetHeight === 'number') void els[0].offsetHeight;\n var raf = (typeof requestAnimationFrame === 'function') ? requestAnimationFrame : function(f) { return setTimeout(f, 16); };\n raf(function() {\n moved.forEach(function(el) {\n el.classList.add(name + '-move');\n el.style.transform = '';\n el.style.transitionDuration = '';\n tgOnEnd(el, function() { el.classList.remove(name + '-move'); el.style.transform = ''; el.style.transitionDuration = ''; });\n });\n });\n }\n";