@askrjs/askr 0.0.47 → 0.0.49

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 (394) hide show
  1. package/dist/benchmark.js +6 -6
  2. package/dist/benchmark.js.map +1 -1
  3. package/dist/boot/hydration.js +140 -0
  4. package/dist/boot/hydration.js.map +1 -0
  5. package/dist/boot/index.d.ts +3 -56
  6. package/dist/boot/index.d.ts.map +1 -1
  7. package/dist/boot/index.js +62 -410
  8. package/dist/boot/index.js.map +1 -1
  9. package/dist/boot/root-lifecycle.d.ts +15 -0
  10. package/dist/boot/root-lifecycle.d.ts.map +1 -0
  11. package/dist/boot/root-lifecycle.js +205 -0
  12. package/dist/boot/root-lifecycle.js.map +1 -0
  13. package/dist/boot/route-startup.js +45 -0
  14. package/dist/boot/route-startup.js.map +1 -0
  15. package/dist/boot/types.d.ts +62 -0
  16. package/dist/boot/types.d.ts.map +1 -0
  17. package/dist/common/component.d.ts +3 -1
  18. package/dist/common/component.d.ts.map +1 -1
  19. package/dist/common/jsx.d.ts +1 -1
  20. package/dist/common/jsx.d.ts.map +1 -1
  21. package/dist/common/jsx.js.map +1 -1
  22. package/dist/common/props.d.ts +1 -1
  23. package/dist/common/render-context.js +55 -0
  24. package/dist/common/render-context.js.map +1 -0
  25. package/dist/common/router.d.ts +5 -1
  26. package/dist/common/router.d.ts.map +1 -1
  27. package/dist/common/ssr.d.ts +1 -1
  28. package/dist/common/ssr.js.map +1 -1
  29. package/dist/common/vnode.d.ts +5 -4
  30. package/dist/common/vnode.d.ts.map +1 -1
  31. package/dist/common/vnode.js.map +1 -1
  32. package/dist/components/error-boundary.d.ts +1 -1
  33. package/dist/components/error-boundary.js +2 -1
  34. package/dist/components/error-boundary.js.map +1 -1
  35. package/dist/components/link.js.map +1 -1
  36. package/dist/control/for.js +2 -1
  37. package/dist/control/for.js.map +1 -1
  38. package/dist/data/data-runtime.d.ts +28 -0
  39. package/dist/data/data-runtime.d.ts.map +1 -0
  40. package/dist/data/data-runtime.js +114 -0
  41. package/dist/data/data-runtime.js.map +1 -0
  42. package/dist/data/index.d.ts +6 -142
  43. package/dist/data/index.js +5 -539
  44. package/dist/data/invalidation.d.ts +9 -0
  45. package/dist/data/invalidation.d.ts.map +1 -0
  46. package/dist/data/invalidation.js +27 -0
  47. package/dist/data/invalidation.js.map +1 -0
  48. package/dist/data/mutation-cell.d.ts +28 -0
  49. package/dist/data/mutation-cell.d.ts.map +1 -0
  50. package/dist/data/mutation-cell.js +132 -0
  51. package/dist/data/mutation-cell.js.map +1 -0
  52. package/dist/data/query-cell.d.ts +46 -0
  53. package/dist/data/query-cell.d.ts.map +1 -0
  54. package/dist/data/query-cell.js +290 -0
  55. package/dist/data/query-cell.js.map +1 -0
  56. package/dist/data/query-key.js +42 -0
  57. package/dist/data/query-key.js.map +1 -0
  58. package/dist/data/shared.js +20 -0
  59. package/dist/data/shared.js.map +1 -0
  60. package/dist/data/types.d.ts +161 -0
  61. package/dist/data/types.d.ts.map +1 -0
  62. package/dist/foundations/icon/icon.d.ts.map +1 -1
  63. package/dist/foundations/icon/icon.js.map +1 -1
  64. package/dist/foundations/structures/portal.d.ts +1 -1
  65. package/dist/foundations/structures/portal.d.ts.map +1 -1
  66. package/dist/foundations/structures/portal.js +2 -1
  67. package/dist/foundations/structures/portal.js.map +1 -1
  68. package/dist/fx/fx.d.ts +1 -1
  69. package/dist/fx/fx.js +5 -4
  70. package/dist/fx/fx.js.map +1 -1
  71. package/dist/fx/timing.d.ts.map +1 -1
  72. package/dist/fx/timing.js +10 -6
  73. package/dist/fx/timing.js.map +1 -1
  74. package/dist/index.d.ts +3 -2
  75. package/dist/index.js +4 -2
  76. package/dist/index.js.map +1 -1
  77. package/dist/jsx/index.d.ts +2 -1
  78. package/dist/jsx/index.js +3 -2
  79. package/dist/jsx/types.d.ts +2 -0
  80. package/dist/jsx/types.js +2 -1
  81. package/dist/jsx-runtime2.d.ts +2 -1
  82. package/dist/jsx-runtime2.js +3 -2
  83. package/dist/renderer/attributes.js +231 -0
  84. package/dist/renderer/attributes.js.map +1 -0
  85. package/dist/renderer/boundaries.js +266 -0
  86. package/dist/renderer/boundaries.js.map +1 -0
  87. package/dist/renderer/child-shape.js +85 -0
  88. package/dist/renderer/child-shape.js.map +1 -0
  89. package/dist/renderer/children.js +3 -2
  90. package/dist/renderer/children.js.map +1 -1
  91. package/dist/renderer/cleanup.js +2 -1
  92. package/dist/renderer/cleanup.js.map +1 -1
  93. package/dist/renderer/component-host-cleanup.js +68 -0
  94. package/dist/renderer/component-host-cleanup.js.map +1 -0
  95. package/dist/renderer/component-host-instances.js +65 -0
  96. package/dist/renderer/component-host-instances.js.map +1 -0
  97. package/dist/renderer/component-host.js +247 -0
  98. package/dist/renderer/component-host.js.map +1 -0
  99. package/dist/renderer/dom-host.js +13 -0
  100. package/dist/renderer/dom-host.js.map +1 -0
  101. package/dist/renderer/dom-internal.js +185 -0
  102. package/dist/renderer/dom-internal.js.map +1 -0
  103. package/dist/renderer/dom.js +9 -2356
  104. package/dist/renderer/element-children.js +279 -0
  105. package/dist/renderer/element-children.js.map +1 -0
  106. package/dist/renderer/env.js +2 -1
  107. package/dist/renderer/error-boundary-dom.js +29 -0
  108. package/dist/renderer/error-boundary-dom.js.map +1 -0
  109. package/dist/renderer/evaluate-dom-range.js +85 -0
  110. package/dist/renderer/evaluate-dom-range.js.map +1 -0
  111. package/dist/renderer/evaluate-reconcile.js +281 -0
  112. package/dist/renderer/evaluate-reconcile.js.map +1 -0
  113. package/dist/renderer/evaluate.js +13 -399
  114. package/dist/renderer/evaluate.js.map +1 -1
  115. package/dist/renderer/fastpath.js +6 -5
  116. package/dist/renderer/fastpath.js.map +1 -1
  117. package/dist/renderer/for-commit-dom-map.js +83 -0
  118. package/dist/renderer/for-commit-dom-map.js.map +1 -0
  119. package/dist/renderer/for-commit-removal.js +36 -0
  120. package/dist/renderer/for-commit-removal.js.map +1 -0
  121. package/dist/renderer/for-commit-reorder.js +89 -0
  122. package/dist/renderer/for-commit-reorder.js.map +1 -0
  123. package/dist/renderer/for-commit.js +6 -188
  124. package/dist/renderer/for-commit.js.map +1 -1
  125. package/dist/renderer/index.js +28 -16
  126. package/dist/renderer/index.js.map +1 -1
  127. package/dist/renderer/keyed-children.js +32 -0
  128. package/dist/renderer/keyed-children.js.map +1 -0
  129. package/dist/renderer/keyed.js +2 -15
  130. package/dist/renderer/keyed.js.map +1 -1
  131. package/dist/renderer/namespaces.js +23 -0
  132. package/dist/renderer/namespaces.js.map +1 -0
  133. package/dist/renderer/prop-bindings.js +280 -0
  134. package/dist/renderer/prop-bindings.js.map +1 -0
  135. package/dist/renderer/reactive-child-dom.js +133 -0
  136. package/dist/renderer/reactive-child-dom.js.map +1 -0
  137. package/dist/renderer/reactive-child-sources.js +184 -0
  138. package/dist/renderer/reactive-child-sources.js.map +1 -0
  139. package/dist/renderer/reactive-children.js +294 -0
  140. package/dist/renderer/reactive-children.js.map +1 -0
  141. package/dist/renderer/reconcile-commit.js +38 -0
  142. package/dist/renderer/reconcile-commit.js.map +1 -0
  143. package/dist/renderer/reconcile-fastpaths.js +106 -0
  144. package/dist/renderer/reconcile-fastpaths.js.map +1 -0
  145. package/dist/renderer/reconcile-resolution.js +187 -0
  146. package/dist/renderer/reconcile-resolution.js.map +1 -0
  147. package/dist/renderer/reconcile.js +9 -371
  148. package/dist/renderer/reconcile.js.map +1 -1
  149. package/dist/renderer/retained-element-rollback.js +276 -0
  150. package/dist/renderer/retained-element-rollback.js.map +1 -0
  151. package/dist/renderer/stable-patch.js +82 -0
  152. package/dist/renderer/stable-patch.js.map +1 -0
  153. package/dist/renderer/static-reuse.js +96 -0
  154. package/dist/renderer/static-reuse.js.map +1 -0
  155. package/dist/renderer/types.js +2 -1
  156. package/dist/renderer/utils.js +4 -4
  157. package/dist/renderer/utils.js.map +1 -1
  158. package/dist/resources/index.d.ts +3 -2
  159. package/dist/resources/index.js +5 -2
  160. package/dist/router/access.js +36 -0
  161. package/dist/router/access.js.map +1 -0
  162. package/dist/router/activity.d.ts +10 -0
  163. package/dist/router/activity.d.ts.map +1 -0
  164. package/dist/router/activity.js +89 -0
  165. package/dist/router/activity.js.map +1 -0
  166. package/dist/router/authoring.d.ts +22 -0
  167. package/dist/router/authoring.d.ts.map +1 -0
  168. package/dist/router/authoring.js +198 -0
  169. package/dist/router/authoring.js.map +1 -0
  170. package/dist/router/index.d.ts +12 -4
  171. package/dist/router/index.js +9 -2
  172. package/dist/router/internal-types.d.ts +31 -0
  173. package/dist/router/internal-types.d.ts.map +1 -0
  174. package/dist/router/lazy.d.ts +19 -0
  175. package/dist/router/lazy.d.ts.map +1 -0
  176. package/dist/router/lazy.js +52 -0
  177. package/dist/router/lazy.js.map +1 -0
  178. package/dist/router/manifest.d.ts +10 -0
  179. package/dist/router/manifest.d.ts.map +1 -0
  180. package/dist/router/manifest.js +49 -0
  181. package/dist/router/manifest.js.map +1 -0
  182. package/dist/router/navigate.d.ts +4 -33
  183. package/dist/router/navigate.d.ts.map +1 -1
  184. package/dist/router/navigate.js +17 -414
  185. package/dist/router/navigate.js.map +1 -1
  186. package/dist/router/navigation-registry.d.ts +32 -0
  187. package/dist/router/navigation-registry.d.ts.map +1 -0
  188. package/dist/router/navigation-registry.js +105 -0
  189. package/dist/router/navigation-registry.js.map +1 -0
  190. package/dist/router/navigation-scroll.d.ts +14 -0
  191. package/dist/router/navigation-scroll.d.ts.map +1 -0
  192. package/dist/router/navigation-scroll.js +93 -0
  193. package/dist/router/navigation-scroll.js.map +1 -0
  194. package/dist/router/navigation-targets.d.ts +31 -0
  195. package/dist/router/navigation-targets.d.ts.map +1 -0
  196. package/dist/router/navigation-targets.js +253 -0
  197. package/dist/router/navigation-targets.js.map +1 -0
  198. package/dist/router/policy.d.ts +7 -1
  199. package/dist/router/policy.d.ts.map +1 -1
  200. package/dist/router/policy.js +27 -9
  201. package/dist/router/policy.js.map +1 -1
  202. package/dist/router/rendering.d.ts +10 -0
  203. package/dist/router/rendering.d.ts.map +1 -0
  204. package/dist/router/rendering.js +45 -0
  205. package/dist/router/rendering.js.map +1 -0
  206. package/dist/router/resolution.d.ts +17 -0
  207. package/dist/router/resolution.d.ts.map +1 -0
  208. package/dist/router/resolution.js +253 -0
  209. package/dist/router/resolution.js.map +1 -0
  210. package/dist/router/route-query.d.ts +17 -0
  211. package/dist/router/route-query.d.ts.map +1 -0
  212. package/dist/router/route-query.js +47 -0
  213. package/dist/router/route-query.js.map +1 -0
  214. package/dist/router/route.d.ts +8 -149
  215. package/dist/router/route.js +8 -854
  216. package/dist/router/store.d.ts +50 -0
  217. package/dist/router/store.d.ts.map +1 -0
  218. package/dist/router/store.js +171 -0
  219. package/dist/router/store.js.map +1 -0
  220. package/dist/runtime/access.js +45 -0
  221. package/dist/runtime/access.js.map +1 -0
  222. package/dist/runtime/child-scope.d.ts +1 -1
  223. package/dist/runtime/child-scope.js +4 -1
  224. package/dist/runtime/child-scope.js.map +1 -1
  225. package/dist/runtime/component-cleanup.d.ts +16 -0
  226. package/dist/runtime/component-cleanup.d.ts.map +1 -0
  227. package/dist/runtime/component-cleanup.js +70 -0
  228. package/dist/runtime/component-cleanup.js.map +1 -0
  229. package/dist/runtime/component-commit.js +165 -0
  230. package/dist/runtime/component-commit.js.map +1 -0
  231. package/dist/runtime/component-contracts.js +5 -0
  232. package/dist/runtime/component-facade.d.ts +5 -0
  233. package/dist/runtime/component-facade.js +4 -0
  234. package/dist/runtime/component-internal.d.ts +100 -0
  235. package/dist/runtime/component-internal.d.ts.map +1 -0
  236. package/dist/runtime/component-internal.js +219 -0
  237. package/dist/runtime/component-internal.js.map +1 -0
  238. package/dist/runtime/component-lifecycle.d.ts +49 -0
  239. package/dist/runtime/component-lifecycle.d.ts.map +1 -0
  240. package/dist/runtime/component-lifecycle.js +176 -0
  241. package/dist/runtime/component-lifecycle.js.map +1 -0
  242. package/dist/runtime/component-scope.d.ts +55 -0
  243. package/dist/runtime/component-scope.d.ts.map +1 -0
  244. package/dist/runtime/component-scope.js +154 -0
  245. package/dist/runtime/component-scope.js.map +1 -0
  246. package/dist/runtime/component.d.ts +4 -152
  247. package/dist/runtime/component.js +4 -692
  248. package/dist/runtime/context.d.ts +1 -1
  249. package/dist/runtime/context.js +6 -4
  250. package/dist/runtime/context.js.map +1 -1
  251. package/dist/runtime/control.d.ts +3 -3
  252. package/dist/runtime/control.js +2 -1
  253. package/dist/runtime/control.js.map +1 -1
  254. package/dist/runtime/derive.d.ts.map +1 -1
  255. package/dist/runtime/derive.js +6 -5
  256. package/dist/runtime/derive.js.map +1 -1
  257. package/dist/runtime/effect.d.ts +1 -1
  258. package/dist/runtime/effect.d.ts.map +1 -1
  259. package/dist/runtime/effect.js +2 -2
  260. package/dist/runtime/effect.js.map +1 -1
  261. package/dist/runtime/events.js +3 -3
  262. package/dist/runtime/events.js.map +1 -1
  263. package/dist/runtime/fastlane.js +13 -27
  264. package/dist/runtime/fastlane.js.map +1 -1
  265. package/dist/runtime/for-bench.d.ts +1 -1
  266. package/dist/runtime/for-bench.js +1 -4
  267. package/dist/runtime/for-bench.js.map +1 -1
  268. package/dist/runtime/for-internal.d.ts +43 -0
  269. package/dist/runtime/for-internal.d.ts.map +1 -0
  270. package/dist/runtime/for-internal.js +98 -0
  271. package/dist/runtime/for-internal.js.map +1 -0
  272. package/dist/runtime/for-reconcile.d.ts +8 -0
  273. package/dist/runtime/for-reconcile.d.ts.map +1 -0
  274. package/dist/runtime/for-reconcile.js +389 -0
  275. package/dist/runtime/for-reconcile.js.map +1 -0
  276. package/dist/runtime/for-scopes.d.ts +26 -0
  277. package/dist/runtime/for-scopes.d.ts.map +1 -0
  278. package/dist/runtime/for-scopes.js +160 -0
  279. package/dist/runtime/for-scopes.js.map +1 -0
  280. package/dist/runtime/for-signals.d.ts +30 -0
  281. package/dist/runtime/for-signals.d.ts.map +1 -0
  282. package/dist/runtime/for-signals.js +139 -0
  283. package/dist/runtime/for-signals.js.map +1 -0
  284. package/dist/runtime/for.d.ts +4 -66
  285. package/dist/runtime/for.js +5 -773
  286. package/dist/runtime/lifecycle-operations.d.ts +31 -0
  287. package/dist/runtime/lifecycle-operations.d.ts.map +1 -0
  288. package/dist/runtime/lifecycle-operations.js +195 -0
  289. package/dist/runtime/lifecycle-operations.js.map +1 -0
  290. package/dist/runtime/operations.d.ts +3 -40
  291. package/dist/runtime/operations.js +2 -357
  292. package/dist/runtime/readable.d.ts +2 -3
  293. package/dist/runtime/readable.d.ts.map +1 -1
  294. package/dist/runtime/readable.js +6 -5
  295. package/dist/runtime/readable.js.map +1 -1
  296. package/dist/runtime/resource-cell.js +2 -2
  297. package/dist/runtime/resource-cell.js.map +1 -1
  298. package/dist/runtime/resource-operation.d.ts +13 -0
  299. package/dist/runtime/resource-operation.d.ts.map +1 -0
  300. package/dist/runtime/resource-operation.js +170 -0
  301. package/dist/runtime/resource-operation.js.map +1 -0
  302. package/dist/runtime/runtime.d.ts +42 -0
  303. package/dist/runtime/runtime.d.ts.map +1 -0
  304. package/dist/runtime/runtime.js +59 -0
  305. package/dist/runtime/runtime.js.map +1 -0
  306. package/dist/runtime/scheduler.d.ts +5 -1
  307. package/dist/runtime/scheduler.d.ts.map +1 -1
  308. package/dist/runtime/scheduler.js +17 -17
  309. package/dist/runtime/scheduler.js.map +1 -1
  310. package/dist/runtime/selector.js +4 -3
  311. package/dist/runtime/selector.js.map +1 -1
  312. package/dist/runtime/snapshot-source.d.ts +1 -1
  313. package/dist/runtime/snapshot-source.js +1 -1
  314. package/dist/runtime/state.js +2 -1
  315. package/dist/runtime/state.js.map +1 -1
  316. package/dist/ssg/batch-render.js +2 -1
  317. package/dist/ssg/batch-render.js.map +1 -1
  318. package/dist/ssg/create-static-gen.d.ts +9 -3
  319. package/dist/ssg/create-static-gen.d.ts.map +1 -1
  320. package/dist/ssg/create-static-gen.js +12 -99
  321. package/dist/ssg/create-static-gen.js.map +1 -1
  322. package/dist/ssg/generation-plan.js +70 -0
  323. package/dist/ssg/generation-plan.js.map +1 -0
  324. package/dist/ssg/incremental-manifest.js +1 -1
  325. package/dist/ssg/static-routes.js +101 -0
  326. package/dist/ssg/static-routes.js.map +1 -0
  327. package/dist/ssg/types.d.ts +15 -7
  328. package/dist/ssg/types.d.ts.map +1 -1
  329. package/dist/ssr/boundaries.js +113 -0
  330. package/dist/ssr/boundaries.js.map +1 -0
  331. package/dist/ssr/component-runtime.js +111 -0
  332. package/dist/ssr/component-runtime.js.map +1 -0
  333. package/dist/ssr/context.d.ts +3 -1
  334. package/dist/ssr/context.d.ts.map +1 -1
  335. package/dist/ssr/context.js +9 -2
  336. package/dist/ssr/context.js.map +1 -1
  337. package/dist/ssr/errors.d.ts +2 -0
  338. package/dist/ssr/errors.js +11 -1
  339. package/dist/ssr/errors.js.map +1 -1
  340. package/dist/ssr/escape.js +3 -3
  341. package/dist/ssr/escape.js.map +1 -1
  342. package/dist/ssr/hydration-data.js +10 -0
  343. package/dist/ssr/hydration-data.js.map +1 -0
  344. package/dist/ssr/hydration-verify.d.ts +12 -0
  345. package/dist/ssr/hydration-verify.d.ts.map +1 -0
  346. package/dist/ssr/hydration-verify.js +144 -0
  347. package/dist/ssr/hydration-verify.js.map +1 -0
  348. package/dist/ssr/index-internal.d.ts +15 -0
  349. package/dist/ssr/index-internal.d.ts.map +1 -0
  350. package/dist/ssr/index-internal.js +19 -0
  351. package/dist/ssr/index-internal.js.map +1 -0
  352. package/dist/ssr/index.d.ts +5 -57
  353. package/dist/ssr/index.js +3 -738
  354. package/dist/ssr/render-keys.js +9 -32
  355. package/dist/ssr/render-keys.js.map +1 -1
  356. package/dist/ssr/render-resolved.d.ts +1 -1
  357. package/dist/ssr/render-resolved.d.ts.map +1 -1
  358. package/dist/ssr/render-resolved.js +4 -2
  359. package/dist/ssr/render-resolved.js.map +1 -1
  360. package/dist/ssr/render-sync.d.ts +21 -0
  361. package/dist/ssr/render-sync.d.ts.map +1 -0
  362. package/dist/ssr/render-sync.js +275 -0
  363. package/dist/ssr/render-sync.js.map +1 -0
  364. package/dist/ssr/route-policy-resolution.js +77 -0
  365. package/dist/ssr/route-policy-resolution.js.map +1 -0
  366. package/dist/ssr/route-render.d.ts +77 -0
  367. package/dist/ssr/route-render.d.ts.map +1 -0
  368. package/dist/ssr/route-render.js +119 -0
  369. package/dist/ssr/route-render.js.map +1 -0
  370. package/dist/ssr/sink.d.ts +26 -0
  371. package/dist/ssr/sink.d.ts.map +1 -0
  372. package/dist/ssr/types.d.ts +1 -0
  373. package/dist/ssr/types.d.ts.map +1 -1
  374. package/dist/ssr/verify-hydration.js.map +1 -1
  375. package/dist/testing/index.d.ts +1 -2
  376. package/dist/testing/index.d.ts.map +1 -1
  377. package/dist/testing/index.js +2 -1
  378. package/dist/testing/index.js.map +1 -1
  379. package/package.json +4 -3
  380. package/dist/data/index.d.ts.map +0 -1
  381. package/dist/data/index.js.map +0 -1
  382. package/dist/renderer/dom.js.map +0 -1
  383. package/dist/router/route.d.ts.map +0 -1
  384. package/dist/router/route.js.map +0 -1
  385. package/dist/runtime/component.d.ts.map +0 -1
  386. package/dist/runtime/component.js.map +0 -1
  387. package/dist/runtime/for.d.ts.map +0 -1
  388. package/dist/runtime/for.js.map +0 -1
  389. package/dist/runtime/operations.d.ts.map +0 -1
  390. package/dist/runtime/operations.js.map +0 -1
  391. package/dist/runtime/ssr-bridge.js +0 -24
  392. package/dist/runtime/ssr-bridge.js.map +0 -1
  393. package/dist/ssr/index.d.ts.map +0 -1
  394. package/dist/ssr/index.js.map +0 -1
@@ -0,0 +1,161 @@
1
+ //#region src/data/types.d.ts
2
+ type QueryConsistency = 'fresh' | 'stale' | 'refreshing' | 'pending-write';
3
+ type QueryStaleReason = 'aborted' | 'error' | 'inconsistent';
4
+ interface DataRuntime {
5
+ readonly queryCache: Map<string, unknown>;
6
+ }
7
+ interface DataRuntimeOptions {
8
+ queryCache?: Map<string, unknown>;
9
+ }
10
+ interface InvalidateOptions {
11
+ markPendingWrite?: boolean;
12
+ runtime?: DataRuntime;
13
+ }
14
+ interface InvalidateOnIntervalOptions extends InvalidateOptions {
15
+ intervalMs: number;
16
+ activeOn?: string | readonly string[];
17
+ visibleOnly?: boolean;
18
+ focusedOnly?: boolean;
19
+ }
20
+ type QueryKeyPart = string | number | boolean | null | undefined | readonly QueryKeyPart[] | {
21
+ readonly [key: string]: QueryKeyPart;
22
+ };
23
+ interface QueryScope {
24
+ key(...parts: QueryKeyPart[]): string;
25
+ prefix(...parts: QueryKeyPart[]): string;
26
+ invalidate(parts: readonly QueryKeyPart[], options?: InvalidateOptions): void;
27
+ }
28
+ type QueryControls = {
29
+ refresh(): Promise<void>;
30
+ };
31
+ type QueryLoading = {
32
+ data: null;
33
+ error: null;
34
+ loading: true;
35
+ refreshing: false;
36
+ stale: false;
37
+ consistency: 'fresh';
38
+ staleReason: null;
39
+ };
40
+ type QueryFresh<T> = {
41
+ data: T;
42
+ error: null;
43
+ loading: false;
44
+ refreshing: false;
45
+ stale: false;
46
+ consistency: 'fresh';
47
+ staleReason: null;
48
+ };
49
+ type QueryRefreshing<T> = {
50
+ data: T;
51
+ error: null;
52
+ loading: false;
53
+ refreshing: true;
54
+ stale: true;
55
+ consistency: 'refreshing';
56
+ staleReason: null;
57
+ };
58
+ type QueryPendingWrite<T> = {
59
+ data: T;
60
+ error: null;
61
+ loading: false;
62
+ refreshing: true;
63
+ stale: true;
64
+ consistency: 'pending-write';
65
+ staleReason: null;
66
+ };
67
+ type QueryStaleValue<T> = {
68
+ data: T;
69
+ error: null;
70
+ loading: false;
71
+ refreshing: false;
72
+ stale: true;
73
+ consistency: 'stale';
74
+ staleReason: 'aborted' | 'inconsistent';
75
+ };
76
+ type QueryStaleErrorWithValue<T> = {
77
+ data: T;
78
+ error: {};
79
+ loading: false;
80
+ refreshing: false;
81
+ stale: true;
82
+ consistency: 'stale';
83
+ staleReason: 'error';
84
+ };
85
+ type QueryStaleError = {
86
+ data: null;
87
+ error: {};
88
+ loading: false;
89
+ refreshing: false;
90
+ stale: true;
91
+ consistency: 'stale';
92
+ staleReason: 'error';
93
+ };
94
+ type Query<T extends {}> = QueryControls & (QueryLoading | QueryFresh<T> | QueryRefreshing<T> | QueryPendingWrite<T> | QueryStaleValue<T> | QueryStaleErrorWithValue<T> | QueryStaleError);
95
+ type MutationControls<TInput, TResult> = {
96
+ execute(input: TInput): Promise<TResult>;
97
+ abort(): void;
98
+ reset(): void;
99
+ };
100
+ type MutationIdle = {
101
+ status: 'idle';
102
+ pending: false;
103
+ error: null;
104
+ result: null;
105
+ };
106
+ type MutationPending = {
107
+ status: 'pending';
108
+ pending: true;
109
+ error: null;
110
+ result: null;
111
+ };
112
+ type MutationSuccess<TResult> = {
113
+ status: 'success';
114
+ pending: false;
115
+ error: null;
116
+ result: TResult;
117
+ };
118
+ type MutationError = {
119
+ status: 'error';
120
+ pending: false;
121
+ error: {};
122
+ result: null;
123
+ };
124
+ type Mutation<TInput, TResult> = MutationControls<TInput, TResult> & (MutationIdle | MutationPending | MutationSuccess<TResult> | MutationError);
125
+ type MutationRecord<TResult> = {
126
+ status: 'idle' | 'pending' | 'success' | 'error';
127
+ error: {} | null;
128
+ result: TResult | null;
129
+ };
130
+ type QueryOptions<T> = {
131
+ key: string;
132
+ fetch: (ctx: {
133
+ signal: AbortSignal;
134
+ }) => Promise<T>;
135
+ isConsistent?: (data: T) => boolean;
136
+ reconcile?: (data: T, ctx: {
137
+ key: string;
138
+ }) => Promise<boolean> | boolean;
139
+ runtime?: DataRuntime;
140
+ };
141
+ type MutationOptions<TInput, TResult> = {
142
+ action: (input: TInput, ctx: {
143
+ signal: AbortSignal;
144
+ }) => Promise<TResult>;
145
+ affects?: (input: TInput, result: TResult) => string[];
146
+ afterSuccess?: 'invalidate';
147
+ runtime?: DataRuntime;
148
+ };
149
+ type QueryState<T> = {
150
+ data: T | null;
151
+ error: {} | null;
152
+ loading: boolean;
153
+ refreshing: boolean;
154
+ stale: boolean;
155
+ consistency: QueryConsistency;
156
+ staleReason: QueryStaleReason | null;
157
+ };
158
+ type QueryDefinitionField = 'fetch' | 'isConsistent' | 'reconcile';
159
+ //#endregion
160
+ export { DataRuntime, DataRuntimeOptions, InvalidateOnIntervalOptions, InvalidateOptions, Mutation, MutationOptions, Query, QueryConsistency, QueryKeyPart, QueryOptions, QueryScope, QueryStaleReason, QueryState };
161
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/data/types.ts"],"mappings":";KAAY,gBAAA;AAAA,KAMA,gBAAA;AAAA,UAEK,WAAA;EAAA,SACN,UAAA,EAAY,GAAG;AAAA;AAAA,UAGT,kBAAA;EACf,UAAA,GAAa,GAAG;AAAA;AAAA,UAGD,iBAAA;EACf,gBAAA;EACA,OAAA,GAAU,WAAW;AAAA;AAAA,UAGN,2BAAA,SAAoC,iBAAiB;EACpE,UAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;AAAA;AAAA,KAGU,YAAA,2DAMC,YAAA;EAAA,UACG,GAAA,WAAc,YAAY;AAAA;AAAA,UAEzB,UAAA;EACf,GAAA,IAAO,KAAA,EAAO,YAAA;EACd,MAAA,IAAU,KAAA,EAAO,YAAA;EACjB,UAAA,CAAW,KAAA,WAAgB,YAAA,IAAgB,OAAA,GAAU,iBAAA;AAAA;AAAA,KAGlD,aAAA;EACH,OAAA,IAAW,OAAO;AAAA;AAAA,KAGf,YAAA;EACH,IAAA;EACA,KAAA;EACA,OAAA;EACA,UAAA;EACA,KAAA;EACA,WAAA;EACA,WAAA;AAAA;AAAA,KAGG,UAAA;EACH,IAAA,EAAM,CAAC;EACP,KAAA;EACA,OAAA;EACA,UAAA;EACA,KAAA;EACA,WAAA;EACA,WAAA;AAAA;AAAA,KAGG,eAAA;EACH,IAAA,EAAM,CAAC;EACP,KAAA;EACA,OAAA;EACA,UAAA;EACA,KAAA;EACA,WAAA;EACA,WAAA;AAAA;AAAA,KAGG,iBAAA;EACH,IAAA,EAAM,CAAC;EACP,KAAA;EACA,OAAA;EACA,UAAA;EACA,KAAA;EACA,WAAA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AAA,IAAgB,IAAA,EAAM,CAAA;EACtB,SAAA,IAAa,IAAA,EAAM,CAAA,EAAG,GAAA;IAAO,GAAA;EAAA,MAAkB,OAAA;EAC/C,OAAA,GAAU,WAAA;AAAA;AAAA,KAGA,eAAA;EACV,MAAA,GAAS,KAAA,EAAO,MAAA,EAAQ,GAAA;IAAO,MAAA,EAAQ,WAAA;EAAA,MAAkB,OAAA,CAAQ,OAAA;EACjE,OAAA,IAAW,KAAA,EAAO,MAAA,EAAQ,MAAA,EAAQ,OAAA;EAClC,YAAA;EACA,OAAA,GAAU,WAAA;AAAA;AAAA,KAGA,UAAA;EACV,IAAA,EAAM,CAAA;EACN,KAAA;EACA,OAAA;EACA,UAAA;EACA,KAAA;EACA,WAAA,EAAa,gBAAA;EACb,WAAA,EAAa,gBAAA;AAAA;AAAA,KAGH,oBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","names":[],"sources":["../../../src/foundations/icon/icon.tsx"],"mappings":";;;;iBAOgB,eAAA,CAAgB,KAAA,YAAiB,KAAA,IAAS,aAAa;AAAA,iBAOvD,sBAAA,CAAuB,IAAqB;AAAA,iBAK5C,uBAAA,CAAwB,IAAqB;AAAA,iBAO7C,8BAAA,CACd,WAAA,UACA,SAAA,EAAW,aAAa;AAAA,iBAYV,kBAAA,CACd,KAA2C,WAA3B,eAAe;AAAA,iBAUjB,aAAA,IACX,MAAA,EAAQ,KAAK;AAAA,iBAMF,oBAAA;EACd,IAAA;EACA,WAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA;AAAA,GACC,IAAA,CACD,SAAA;;;;;;;;;;;;;;;;;;;;;iBA4Cc,QAAA;EACd,IAAA;EACA,WAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA,EAAO,SAAA;EACP,KAAA;EACA,QAAA;EACA,QAAA;EACA,GAAA;EAAA,GACG;AAAA,GACF,SAAA,GAAY,UAAA"}
1
+ {"version":3,"file":"icon.d.ts","names":[],"sources":["../../../src/foundations/icon/icon.tsx"],"mappings":";;;;iBAQgB,eAAA,CAAgB,KAAA,YAAiB,KAAA,IAAS,aAAa;AAAA,iBAOvD,sBAAA,CAAuB,IAAqB;AAAA,iBAK5C,uBAAA,CAAwB,IAAqB;AAAA,iBAO7C,8BAAA,CACd,WAAA,UACA,SAAA,EAAW,aAAa;AAAA,iBAYV,kBAAA,CACd,KAA2C,WAA3B,eAAe;AAAA,iBAUjB,aAAA,IACX,MAAA,EAAQ,KAAK;AAAA,iBAMF,oBAAA;EACd,IAAA;EACA,WAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA;AAAA,GACC,IAAA,CACD,SAAA;;;;;;;;;;;;;;;;;;;;;iBA4Cc,QAAA;EACd,IAAA;EACA,WAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA,EAAO,SAAA;EACP,KAAA;EACA,QAAA;EACA,QAAA;EACA,GAAA;EAAA,GACG;AAAA,GACF,SAAA,GAAY,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon.js","names":[],"sources":["../../../src/foundations/icon/icon.tsx"],"sourcesContent":["/* eslint-disable askr/no-hardcoded-theme-tokens -- Icon exposes a stable CSS variable contract consumed by themes. */\nimport { jsx, jsxs } from '../../jsx/jsx-runtime';\nimport type { JSXElement } from '../../common/jsx';\nimport type { IconProps, IconSizeToken, IconStyleObject } from './icon.types';\n\nconst ICON_SIZE_TOKENS: readonly IconSizeToken[] = ['sm', 'md', 'lg', 'xl'];\n\nexport function isIconSizeToken(value: unknown): value is IconSizeToken {\n return (\n typeof value === 'string' &&\n ICON_SIZE_TOKENS.includes(value as IconSizeToken)\n );\n}\n\nexport function normalizeIconSizeValue(size: number | string): string {\n if (typeof size === 'number') return `${size}px`;\n return size;\n}\n\nexport function resolveIconSizeVariable(size: number | string): string {\n if (isIconSizeToken(size)) {\n return `var(--ak-icon-size-${size}, var(--ak-icon-size-md, 1.25rem))`;\n }\n return normalizeIconSizeValue(size);\n}\n\nexport function resolveIconStrokeWidthVariable(\n strokeWidth: number,\n sizeToken: IconSizeToken | undefined\n): string {\n if (sizeToken) {\n return `var(--ak-icon-stroke-width-${sizeToken}, var(--ak-icon-stroke-width-md, ${strokeWidth}))`;\n }\n return `var(--ak-icon-stroke-width-md, ${strokeWidth})`;\n}\n\nfunction camelToKebab(key: string): string {\n return key.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);\n}\n\nexport function serializeIconStyle(\n style: string | IconStyleObject | undefined\n): string {\n if (!style) return '';\n if (typeof style === 'string') return style.trim();\n return Object.entries(style)\n .filter(([, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${camelToKebab(key)}:${String(value)}`)\n .join(';');\n}\n\nexport function joinIconStyle(\n ...styles: Array<string | undefined>\n): string | undefined {\n const merged = styles.map((style) => style?.trim()).filter(Boolean);\n return merged.length > 0 ? merged.join(';') : undefined;\n}\n\nexport function getIconContractProps({\n size = 20,\n strokeWidth = 2,\n color = 'currentColor',\n title,\n style,\n iconName,\n}: Pick<\n IconProps,\n 'color' | 'iconName' | 'size' | 'strokeWidth' | 'style' | 'title'\n>) {\n const sizeToken = isIconSizeToken(size) ? size : undefined;\n const decorative = title ? undefined : 'true';\n const resolvedSize = resolveIconSizeVariable(size);\n const resolvedStrokeWidth = resolveIconStrokeWidthVariable(\n strokeWidth,\n sizeToken\n );\n const iconStyle = joinIconStyle(\n `--ak-icon-size:${resolvedSize}`,\n `--ak-icon-stroke-width:${resolvedStrokeWidth}`,\n 'display:inline-block',\n 'flex-shrink:0',\n 'width:var(--ak-icon-size)',\n 'height:var(--ak-icon-size)',\n 'stroke-width:var(--ak-icon-stroke-width)',\n serializeIconStyle(style)\n );\n\n return {\n sizeToken,\n decorative,\n iconStyle,\n attrs: {\n xmlns: 'http://www.w3.org/2000/svg',\n width: '24',\n height: '24',\n fill: 'none',\n stroke: color,\n 'stroke-width': 'var(--ak-icon-stroke-width)',\n role: 'img',\n 'aria-hidden': title ? undefined : 'true',\n style: iconStyle,\n 'data-slot': 'icon',\n 'data-icon': iconName,\n 'data-size': sizeToken,\n 'data-decorative': decorative,\n 'data-color': color === 'currentColor' ? 'current' : undefined,\n },\n };\n}\n\nexport function IconBase({\n size = 20,\n strokeWidth = 2,\n color = 'currentColor',\n title,\n class: className,\n style,\n iconName,\n children,\n ref,\n ...rest\n}: IconProps): JSXElement {\n const { attrs } = getIconContractProps({\n size,\n strokeWidth,\n color,\n title,\n style,\n iconName,\n });\n\n const finalChildren = title\n ? [jsx('title', { children: title }), children]\n : children;\n\n return jsxs('svg', {\n ...rest,\n ...attrs,\n viewBox: rest.viewBox ?? '0 0 24 24',\n 'stroke-linecap': rest['stroke-linecap'] ?? 'round',\n 'stroke-linejoin': rest['stroke-linejoin'] ?? 'round',\n class: className,\n ref,\n children: finalChildren,\n });\n}\n"],"mappings":";;AAKA,MAAM,mBAA6C;CAAC;CAAM;CAAM;CAAM;AAAI;AAE1E,SAAgB,gBAAgB,OAAwC;CACtE,OACE,OAAO,UAAU,YACjB,iBAAiB,SAAS,KAAsB;AAEpD;AAEA,SAAgB,uBAAuB,MAA+B;CACpE,IAAI,OAAO,SAAS,UAAU,OAAO,GAAG,KAAK;CAC7C,OAAO;AACT;AAEA,SAAgB,wBAAwB,MAA+B;CACrE,IAAI,gBAAgB,IAAI,GACtB,OAAO,sBAAsB,KAAK;CAEpC,OAAO,uBAAuB,IAAI;AACpC;AAEA,SAAgB,+BACd,aACA,WACQ;CACR,IAAI,WACF,OAAO,8BAA8B,UAAU,mCAAmC,YAAY;CAEhG,OAAO,kCAAkC,YAAY;AACvD;AAEA,SAAS,aAAa,KAAqB;CACzC,OAAO,IAAI,QAAQ,aAAa,UAAU,IAAI,MAAM,YAAY,GAAG;AACrE;AAEA,SAAgB,mBACd,OACQ;CACR,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,OAAO,UAAU,UAAU,OAAO,MAAM,KAAK;CACjD,OAAO,OAAO,QAAQ,KAAK,CAAC,CACzB,QAAQ,GAAG,WAAW,UAAU,UAAa,UAA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qBAAqB;EAC5C,mBAAmB,KAAK,sBAAsB;EAC9C,OAAO;EACP;EACA,UAAU;CACZ,CAAC;AACH"}
1
+ {"version":3,"file":"icon.js","names":[],"sources":["../../../src/foundations/icon/icon.tsx"],"sourcesContent":["/* eslint-disable askr/no-hardcoded-theme-tokens -- Icon exposes a stable CSS variable contract consumed by themes. */\nimport { jsx, jsxs } from '../../jsx/jsx-runtime';\nimport type { JSXElement } from '../../common/jsx';\nimport type { KnownIntrinsicElementProps } from '../../common/props';\nimport type { IconProps, IconSizeToken, IconStyleObject } from './icon.types';\n\nconst ICON_SIZE_TOKENS: readonly IconSizeToken[] = ['sm', 'md', 'lg', 'xl'];\n\nexport function isIconSizeToken(value: unknown): value is IconSizeToken {\n return (\n typeof value === 'string' &&\n ICON_SIZE_TOKENS.includes(value as IconSizeToken)\n );\n}\n\nexport function normalizeIconSizeValue(size: number | string): string {\n if (typeof size === 'number') return `${size}px`;\n return size;\n}\n\nexport function resolveIconSizeVariable(size: number | string): string {\n if (isIconSizeToken(size)) {\n return `var(--ak-icon-size-${size}, var(--ak-icon-size-md, 1.25rem))`;\n }\n return normalizeIconSizeValue(size);\n}\n\nexport function resolveIconStrokeWidthVariable(\n strokeWidth: number,\n sizeToken: IconSizeToken | undefined\n): string {\n if (sizeToken) {\n return `var(--ak-icon-stroke-width-${sizeToken}, var(--ak-icon-stroke-width-md, ${strokeWidth}))`;\n }\n return `var(--ak-icon-stroke-width-md, ${strokeWidth})`;\n}\n\nfunction camelToKebab(key: string): string {\n return key.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);\n}\n\nexport function serializeIconStyle(\n style: string | IconStyleObject | undefined\n): string {\n if (!style) return '';\n if (typeof style === 'string') return style.trim();\n return Object.entries(style)\n .filter(([, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${camelToKebab(key)}:${String(value)}`)\n .join(';');\n}\n\nexport function joinIconStyle(\n ...styles: Array<string | undefined>\n): string | undefined {\n const merged = styles.map((style) => style?.trim()).filter(Boolean);\n return merged.length > 0 ? merged.join(';') : undefined;\n}\n\nexport function getIconContractProps({\n size = 20,\n strokeWidth = 2,\n color = 'currentColor',\n title,\n style,\n iconName,\n}: Pick<\n IconProps,\n 'color' | 'iconName' | 'size' | 'strokeWidth' | 'style' | 'title'\n>) {\n const sizeToken = isIconSizeToken(size) ? size : undefined;\n const decorative = title ? undefined : 'true';\n const resolvedSize = resolveIconSizeVariable(size);\n const resolvedStrokeWidth = resolveIconStrokeWidthVariable(\n strokeWidth,\n sizeToken\n );\n const iconStyle = joinIconStyle(\n `--ak-icon-size:${resolvedSize}`,\n `--ak-icon-stroke-width:${resolvedStrokeWidth}`,\n 'display:inline-block',\n 'flex-shrink:0',\n 'width:var(--ak-icon-size)',\n 'height:var(--ak-icon-size)',\n 'stroke-width:var(--ak-icon-stroke-width)',\n serializeIconStyle(style)\n );\n\n return {\n sizeToken,\n decorative,\n iconStyle,\n attrs: {\n xmlns: 'http://www.w3.org/2000/svg',\n width: '24',\n height: '24',\n fill: 'none',\n stroke: color,\n 'stroke-width': 'var(--ak-icon-stroke-width)',\n role: 'img',\n 'aria-hidden': title ? undefined : 'true',\n style: iconStyle,\n 'data-slot': 'icon',\n 'data-icon': iconName,\n 'data-size': sizeToken,\n 'data-decorative': decorative,\n 'data-color': color === 'currentColor' ? 'current' : undefined,\n },\n };\n}\n\nexport function IconBase({\n size = 20,\n strokeWidth = 2,\n color = 'currentColor',\n title,\n class: className,\n style,\n iconName,\n children,\n ref,\n ...rest\n}: IconProps): JSXElement {\n const { attrs } = getIconContractProps({\n size,\n strokeWidth,\n color,\n title,\n style,\n iconName,\n });\n\n const finalChildren = title\n ? [jsx('title', { children: title }), children]\n : children;\n\n const svgProps = {\n ...rest,\n ...attrs,\n viewBox: rest.viewBox ?? '0 0 24 24',\n 'stroke-linecap': rest['stroke-linecap'] ?? 'round',\n 'stroke-linejoin': rest['stroke-linejoin'] ?? 'round',\n class: className,\n ref,\n children: finalChildren,\n } as unknown as Known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SAAY;CACvC,MAAM,eAAe,wBAAwB,IAAI;CACjD,MAAM,sBAAsB,+BAC1B,aACA,SACF;CACA,MAAM,YAAY,cAChB,kBAAkB,gBAClB,0BAA0B,uBAC1B,wBACA,iBACA,6BACA,8BACA,4CACA,mBAAmB,KAAK,CAC1B;CAEA,OAAO;EACL;EACA;EACA;EACA,OAAO;GACL,OAAO;GACP,OAAO;GACP,QAAQ;GACR,MAAM;GACN,QAAQ;GACR,gBAAgB;GAChB,MAAM;GACN,eAAe,QAAQ,SAAY;GACnC,OAAO;GACP,aAAa;GACb,aAAa;GACb,aAAa;GACb,mBAAmB;GACnB,cAAc,UAAU,iBAAiB,YAAY;EACvD;CACF;AACF;AAEA,SAAgB,SAAS,EACvB,OAAO,IACP,cAAc,GACd,QAAQ,gBACR,OACA,OAAO,WACP,OACA,UACA,UACA,KACA,GAAG,QACqB;CACxB,MAAM,EAAE,UAAU,qBAAqB;EACrC;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,gBAAgB,QAClB,CAAC,IAAI,SAAS,EAAE,UAAU,MAAM,CAAC,GAAG,QAAQ,IAC5C;CAaJ,OAAO,KAAK,OAAO;EAVjB,GAAG;EACH,GAAG;EACH,SAAS,KAAK,WAAW;EACzB,kBAAkB,KAAK,qBAAqB;EAC5C,mBAAmB,KAAK,sBAAsB;EAC9C,OAAO;EACP;EACA,UAAU;CAGO,CAAQ;AAC7B"}
@@ -1,4 +1,4 @@
1
- import { ComponentInstance } from "../../runtime/component.js";
1
+ import { ComponentInstance } from "../../runtime/component-internal.js";
2
2
  import { RenderableChild } from "../../common/vnode.js";
3
3
 
4
4
  //#region src/foundations/structures/portal.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"portal.d.ts","names":[],"sources":["../../../src/foundations/structures/portal.tsx"],"mappings":";;;;UAoCiB,MAAA,WAAiB,eAAA,GAAkB,eAAA;EASlD;EAAA;EA+Bc;EAnCd,MAAA,CAAO,KAAA;IAAS,QAAA,GAAW,CAAA;EAAA;AAAA;AAAA,UAGZ,WAAA;EACf,QAAA,GAAW,eAAe;AAAA;AAAA,iBA+BZ,YAAA,WACJ,eAAA,GAAkB,eAAA,KACzB,MAAA,CAAO,CAAA;AAAA,iBAyDI,mBAAA;AAAA,iBAMA,yBAAA,CAA0B,KAAoB;AAAA,iBAsI9C,6BAAA,CACd,QAA2B,EAAjB,iBAAiB;AAAA,cAkBhB,aAAA,EAAe,MAAM,CAAC,eAAA;AAAA,iBAkBnB,MAAA,CAAO,KAAkB,EAAX,WAAW"}
1
+ {"version":3,"file":"portal.d.ts","names":[],"sources":["../../../src/foundations/structures/portal.tsx"],"mappings":";;;;UAoCiB,MAAA,WAAiB,eAAA,GAAkB,eAAA;;;EASxB;EAJ1B,MAAA,CAAO,KAAA;IAAS,QAAA,GAAW,CAAA;EAAA;AAAA;AAAA,UAGZ,WAAA;EACf,QAAA,GAAW,eAAe;AAAA;AAAA,iBA+BZ,YAAA,WACJ,eAAA,GAAkB,eAAA,KACzB,MAAA,CAAO,CAAA;AAAA,iBAyDI,mBAAA;AAAA,iBAMA,yBAAA,CAA0B,KAAoB;AAAA,iBAsI9C,6BAAA,CACd,QAA2B,EAAjB,iBAAiB;AAAA,cAkBhB,aAAA,EAAe,MAAM,CAAC,eAAA;AAAA,iBAkBnB,MAAA,CAAO,KAAkB,EAAX,WAAW"}
@@ -1,5 +1,6 @@
1
1
  import { markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, notifyReadableReaders, recordReadableRead } from "../../runtime/readable.js";
2
- import { getCurrentComponentInstance, getCurrentPortalScope } from "../../runtime/component.js";
2
+ import { getCurrentComponentInstance, getCurrentPortalScope } from "../../runtime/component-scope.js";
3
+ import "../../runtime/component.js";
3
4
  //#region src/foundations/structures/portal.tsx
4
5
  /**
5
6
  * Portal / Host primitive.
@@ -1 +1 @@
1
- {"version":3,"file":"portal.js","names":[],"sources":["../../../src/foundations/structures/portal.tsx"],"sourcesContent":["/**\n * Portal / Host primitive.\n *\n * Foundations remain runtime-agnostic: a portal is an explicit read/write slot.\n * Scheduling and attachment are owned by the runtime when `createPortalSlot`\n * exists; otherwise this falls back to a local slot (deterministic, but does\n * not schedule updates).\n *\n * POLICY DECISIONS (LOCKED):\n *\n * 1. Local Mutable State\n * Foundations may use local mutable state ONLY to model deterministic slots,\n * never to coordinate timing, effects, or ordering. The fallback mode uses\n * closure-local `mounted` and `value` variables which are non-escaping and\n * deterministic.\n *\n * 2. Return Type Philosophy\n * Portal call signatures return `unknown` (intentionally opaque). The runtime\n * owns the concrete type. This prevents foundations from assuming JSX.Element\n * or DOM node types, maintaining runtime-agnostic portability.\n */\n\nimport {\n markReactivePropsDirtySource,\n markReadableDerivedSubscribersDirty,\n notifyReadableReaders,\n recordReadableRead,\n type ReadableSource,\n} from '../../runtime/readable';\nimport {\n getCurrentComponentInstance,\n getCurrentPortalScope,\n type ComponentInstance,\n} from '../../runtime/component';\nimport type { RenderableChild } from '../../common/vnode';\n\nexport interface Portal<T extends RenderableChild = RenderableChild> {\n /** Mount point — rendered exactly once */\n (): unknown;\n\n /** Render content into the portal */\n render(props: { children?: T }): unknown;\n}\n\nexport interface PortalProps {\n children?: RenderableChild;\n}\n\nfunction createPortalSlot<T>(): {\n read(): unknown;\n write(value: T | undefined): void;\n} {\n let currentValue: T | undefined;\n\n const source = (() => {\n recordReadableRead(source);\n return currentValue;\n }) as ReadableSource<T | undefined>;\n\n return {\n read() {\n return source();\n },\n write(value: T | undefined) {\n if (Object.is(currentValue, value)) {\n return;\n }\n\n currentValue = value;\n markReadableDerivedSubscribersDirty(source);\n markReactivePropsDirtySource(source);\n notifyReadableReaders(source);\n },\n };\n}\n\nexport function definePortal<\n T extends RenderableChild = RenderableChild,\n>(): Portal<T> {\n // Using `typeof createPortalSlot` is safe even if the identifier is not\n // defined at runtime (it returns 'undefined' rather than throwing).\n if (typeof createPortalSlot === 'function') {\n const slot = createPortalSlot<T>();\n\n function PortalHost() {\n return slot.read();\n }\n\n PortalHost.render = function PortalRender(props: { children?: T }) {\n slot.write(props.children);\n return null;\n };\n\n return PortalHost as Portal<T>;\n }\n\n // Deterministic local fallback (SSR/tests). No runtime scheduling.\n // Writes are accepted only after the host has rendered at least once.\n //\n // CRITICAL BEHAVIOR:\n // - Writes update local state but do NOT trigger re-renders\n // - The portal host will reflect changes only when the component tree\n // re-renders for other reasons (e.g., parent state change)\n // - This is safe for SSR and tests where rendering is synchronous\n // and externally controlled\n // - In runtime mode, createPortalSlot handles scheduling automatically\n let mounted = false;\n let value: T | undefined;\n\n function PortalHostFallback() {\n mounted = true;\n return value as unknown;\n }\n\n PortalHostFallback.render = function PortalRenderFallback(props: {\n children?: T;\n }) {\n if (!mounted) return null;\n value = props.children;\n return null;\n };\n\n return PortalHostFallback as Portal<T>;\n}\n\ntype DefaultPortalState = {\n portal: Portal<RenderableChild>;\n owner: ComponentInstance | null;\n cleanupOwners: WeakSet<ComponentInstance>;\n};\n\nlet _defaultPortalStates = new Map<object, DefaultPortalState>();\nlet _hasPendingDefaultPortalValue = false;\nlet _pendingDefaultPortalValue: RenderableChild | undefined = undefined;\n\nexport function _resetDefaultPortal(): void {\n _defaultPortalStates = new Map<object, DefaultPortalState>();\n _hasPendingDefaultPortalValue = false;\n _pendingDefaultPortalValue = undefined;\n}\n\nexport function disposeDefaultPortalScope(scope: object | null): void {\n if (!scope) {\n return;\n }\n\n const state = _defaultPortalStates.get(scope);\n if (state) {\n state.portal.render({ children: undefined });\n }\n\n _defaultPortalStates.delete(scope);\n}\n\nfunction isComponentPortalScope(scope: object): scope is ComponentInstance {\n return Array.isArray((scope as ComponentInstance).cleanupFns);\n}\n\nfunction isStaleDefaultPortalScope(scope: object): boolean {\n if (!isComponentPortalScope(scope)) {\n return false;\n }\n\n if (scope.target && scope.target.isConnected === false) {\n return true;\n }\n\n return scope.mounted === false;\n}\n\nfunction pruneStaleDefaultPortalScopes(): void {\n if (_defaultPortalStates.size === 0) {\n return;\n }\n\n for (const scope of Array.from(_defaultPortalStates.keys())) {\n if (isStaleDefaultPortalScope(scope)) {\n disposeDefaultPortalScope(scope);\n }\n }\n}\n\nfunction getSingleDefaultPortalScope(): object | null {\n pruneStaleDefaultPortalScopes();\n\n if (_defaultPortalStates.size !== 1) {\n return null;\n }\n\n return _defaultPortalStates.keys().next().value ?? null;\n}\n\nfunction getDefaultPortalState(scope: object): DefaultPortalState {\n let state = _defaultPortalStates.get(scope);\n if (!state) {\n state = {\n portal: definePortal<RenderableChild>(),\n owner: null,\n cleanupOwners: new WeakSet<ComponentInstance>(),\n };\n _defaultPortalStates.set(scope, state);\n }\n return state;\n}\n\nfunction resolveDefaultPortalScope(\n owner: ComponentInstance | null\n): object | null {\n return (\n owner?.portalScope ??\n getCurrentPortalScope() ??\n getSingleDefaultPortalScope()\n );\n}\n\nfunction writeDefaultPortal(\n props: PortalProps,\n owner: ComponentInstance | null\n): void {\n const scope = resolveDefaultPortalScope(owner);\n if (!scope) {\n if (_defaultPortalStates.size !== 0) {\n return;\n }\n\n _hasPendingDefaultPortalValue = true;\n _pendingDefaultPortalValue = props.children;\n return;\n }\n\n const state = getDefaultPortalState(scope);\n _hasPendingDefaultPortalValue = false;\n _pendingDefaultPortalValue = undefined;\n state.portal.render(props);\n state.owner = owner;\n}\n\nfunction applyPendingDefaultPortalValue(scope: object): void {\n if (!_hasPendingDefaultPortalValue) {\n return;\n }\n\n const state = getDefaultPortalState(scope);\n state.portal.render({ children: _pendingDefaultPortalValue });\n state.owner = null;\n _hasPendingDefaultPortalValue = false;\n _pendingDefaultPortalValue = undefined;\n}\n\nfunction registerDefaultPortalOwner(owner: ComponentInstance): void {\n const scope = resolveDefaultPortalScope(owner);\n if (!scope) {\n return;\n }\n\n const state = getDefaultPortalState(scope);\n if (state.cleanupOwners.has(owner)) {\n return;\n }\n\n state.cleanupOwners.add(owner);\n owner.cleanupFns.push(() => {\n const currentState = _defaultPortalStates.get(scope);\n if (!currentState) {\n return;\n }\n\n if (currentState.owner === owner) {\n currentState.portal.render({ children: undefined });\n currentState.owner = null;\n }\n currentState.cleanupOwners.delete(owner);\n });\n}\n\nexport function clearDefaultPortalForInstance(\n instance: ComponentInstance\n): void {\n const scope = instance.portalScope;\n if (!scope) {\n return;\n }\n\n const state = _defaultPortalStates.get(scope);\n if (!state) {\n return;\n }\n\n _hasPendingDefaultPortalValue = false;\n _pendingDefaultPortalValue = undefined;\n state.portal.render({ children: undefined });\n state.owner = null;\n}\n\nexport const DefaultPortal: Portal<RenderableChild> = (() => {\n function Host() {\n const scope = resolveDefaultPortalScope(getCurrentComponentInstance());\n if (!scope) {\n return null;\n }\n\n applyPendingDefaultPortalValue(scope);\n const v = getDefaultPortalState(scope).portal();\n return v === undefined ? null : v;\n }\n Host.render = function Render(props: { children?: RenderableChild }) {\n writeDefaultPortal(props, getCurrentComponentInstance());\n return null;\n };\n return Host as Portal<RenderableChild>;\n})();\n\nexport function Portal(props: PortalProps): null {\n const owner = getCurrentComponentInstance();\n if (owner) {\n registerDefaultPortalOwner(owner);\n }\n writeDefaultPortal(props, owner);\n return null;\n}\n\n/**\n * NOTE:\n * createPortalSlot is a runtime primitive.\n * It owns scheduling, consistency, and SSR behavior.\n */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAS,mBAGP;CACA,IAAI;CAEJ,MAAM,gBAAgB;EACpB,mBAAmB,MAAM;EACzB,OAAO;CACT;CAEA,OAAO;EACL,OAAO;GACL,OAAO,OAAO;EAChB;EACA,MAAM,OAAsB;GAC1B,IAAI,OAAO,GAAG,cAAc,KAAK,GAC/B;GAGF,eAAe;GACf,oCAAoC,MAAM;GAC1C,6BAA6B,MAAM;GACnC,sBAAsB,MAAM;EAC9B;CACF;AACF;AAEA,SAAgB,eAED;CAGb,IAAI,OAAO,qBAAqB,YAAY;EAC1C,MAAM,OAAO,iBAAoB;EAEjC,SAAS,aAAa;GACpB,OAAO,KAAK,KAAK;EACnB;EAEA,WAAW,SAAS,SAAS,aAAa,OAAyB;GACjE,KAAK,MAAM,MAAM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3C,MAAM,QAAQ;AAChB;AAEA,MAAa,uBAAgD;CAC3D,SAAS,OAAO;EACd,MAAM,QAAQ,0BAA0B,4BAA4B,CAAC;EACrE,IAAI,CAAC,OACH,OAAO;EAGT,+BAA+B,KAAK;EACpC,MAAM,IAAI,sBAAsB,KAAK,CAAC,CAAC,OAAO;EAC9C,OAAO,MAAM,SAAY,OAAO;CAClC;CACA,KAAK,SAAS,SAAS,OAAO,OAAuC;EACnE,mBAAmB,OAAO,4BAA4B,CAAC;EACvD,OAAO;CACT;CACA,OAAO;AACT,EAAA,CAAG;AAEH,SAAgB,OAAO,OAA0B;CAC/C,MAAM,QAAQ,4BAA4B;CAC1C,IAAI,OACF,2BAA2B,KAAK;CAElC,mBAAmB,OAAO,KAAK;CAC/B,OAAO;AACT"}
1
+ {"version":3,"file":"portal.js","names":[],"sources":["../../../src/foundations/structures/portal.tsx"],"sourcesContent":["/**\n * Portal / Host primitive.\n *\n * Foundations remain runtime-agnostic: a portal is an explicit read/write slot.\n * Scheduling and attachment are owned by the runtime when `createPortalSlot`\n * exists; otherwise this falls back to a local slot (deterministic, but does\n * not schedule updates).\n *\n * POLICY DECISIONS (LOCKED):\n *\n * 1. Local Mutable State\n * Foundations may use local mutable state ONLY to model deterministic slots,\n * never to coordinate timing, effects, or ordering. The fallback mode uses\n * closure-local `mounted` and `value` variables which are non-escaping and\n * deterministic.\n *\n * 2. Return Type Philosophy\n * Portal call signatures return `unknown` (intentionally opaque). The runtime\n * owns the concrete type. This prevents foundations from assuming JSX.Element\n * or DOM node types, maintaining runtime-agnostic portability.\n */\n\nimport {\n markReactivePropsDirtySource,\n markReadableDerivedSubscribersDirty,\n notifyReadableReaders,\n recordReadableRead,\n type ReadableSource,\n} from '../../runtime/readable';\nimport {\n getCurrentComponentInstance,\n getCurrentPortalScope,\n type ComponentInstance,\n} from '../../runtime/component';\nimport type { RenderableChild } from '../../common/vnode';\n\nexport interface Portal<T extends RenderableChild = RenderableChild> {\n /** Mount point — rendered exactly once */\n (): unknown;\n\n /** Render content into the portal */\n render(props: { children?: T }): unknown;\n}\n\nexport interface PortalProps {\n children?: RenderableChild;\n}\n\nfunction createPortalSlot<T>(): {\n read(): unknown;\n write(value: T | undefined): void;\n} {\n let currentValue: T | undefined;\n\n const source = (() => {\n recordReadableRead(source);\n return currentValue;\n }) as ReadableSource<T | undefined>;\n\n return {\n read() {\n return source();\n },\n write(value: T | undefined) {\n if (Object.is(currentValue, value)) {\n return;\n }\n\n currentValue = value;\n markReadableDerivedSubscribersDirty(source);\n markReactivePropsDirtySource(source);\n notifyReadableReaders(source);\n },\n };\n}\n\nexport function definePortal<\n T extends RenderableChild = RenderableChild,\n>(): Portal<T> {\n // Using `typeof createPortalSlot` is safe even if the identifier is not\n // defined at runtime (it returns 'undefined' rather than throwing).\n if (typeof createPortalSlot === 'function') {\n const slot = createPortalSlot<T>();\n\n function PortalHost() {\n return slot.read();\n }\n\n PortalHost.render = function PortalRender(props: { children?: T }) {\n slot.write(props.children);\n return null;\n };\n\n return PortalHost as Portal<T>;\n }\n\n // Deterministic local fallback (SSR/tests). No runtime scheduling.\n // Writes are accepted only after the host has rendered at least once.\n //\n // CRITICAL BEHAVIOR:\n // - Writes update local state but do NOT trigger re-renders\n // - The portal host will reflect changes only when the component tree\n // re-renders for other reasons (e.g., parent state change)\n // - This is safe for SSR and tests where rendering is synchronous\n // and externally controlled\n // - In runtime mode, createPortalSlot handles scheduling automatically\n let mounted = false;\n let value: T | undefined;\n\n function PortalHostFallback() {\n mounted = true;\n return value as unknown;\n }\n\n PortalHostFallback.render = function PortalRenderFallback(props: {\n children?: T;\n }) {\n if (!mounted) return null;\n value = props.children;\n return null;\n };\n\n return PortalHostFallback as Portal<T>;\n}\n\ntype DefaultPortalState = {\n portal: Portal<RenderableChild>;\n owner: ComponentInstance | null;\n cleanupOwners: WeakSet<ComponentInstance>;\n};\n\nlet _defaultPortalStates = new Map<object, DefaultPortalState>();\nlet _hasPendingDefaultPortalValue = false;\nlet _pendingDefaultPortalValue: RenderableChild | undefined = undefined;\n\nexport function _resetDefaultPortal(): void {\n _defaultPortalStates = new Map<object, DefaultPortalState>();\n _hasPendingDefaultPortalValue = false;\n _pendingDefaultPortalValue = undefined;\n}\n\nexport function disposeDefaultPortalScope(scope: object | null): void {\n if (!scope) {\n return;\n }\n\n const state = _defaultPortalStates.get(scope);\n if (state) {\n state.portal.render({ children: undefined });\n }\n\n _defaultPortalStates.delete(scope);\n}\n\nfunction isComponentPortalScope(scope: object): scope is ComponentInstance {\n return Array.isArray((scope as ComponentInstance).cleanupFns);\n}\n\nfunction isStaleDefaultPortalScope(scope: object): boolean {\n if (!isComponentPortalScope(scope)) {\n return false;\n }\n\n if (scope.target && scope.target.isConnected === false) {\n return true;\n }\n\n return scope.mounted === false;\n}\n\nfunction pruneStaleDefaultPortalScopes(): void {\n if (_defaultPortalStates.size === 0) {\n return;\n }\n\n for (const scope of Array.from(_defaultPortalStates.keys())) {\n if (isStaleDefaultPortalScope(scope)) {\n disposeDefaultPortalScope(scope);\n }\n }\n}\n\nfunction getSingleDefaultPortalScope(): object | null {\n pruneStaleDefaultPortalScopes();\n\n if (_defaultPortalStates.size !== 1) {\n return null;\n }\n\n return _defaultPortalStates.keys().next().value ?? null;\n}\n\nfunction getDefaultPortalState(scope: object): DefaultPortalState {\n let state = _defaultPortalStates.get(scope);\n if (!state) {\n state = {\n portal: definePortal<RenderableChild>(),\n owner: null,\n cleanupOwners: new WeakSet<ComponentInstance>(),\n };\n _defaultPortalStates.set(scope, state);\n }\n return state;\n}\n\nfunction resolveDefaultPortalScope(\n owner: ComponentInstance | null\n): object | null {\n return (\n owner?.portalScope ??\n getCurrentPortalScope() ??\n getSingleDefaultPortalScope()\n );\n}\n\nfunction writeDefaultPortal(\n props: PortalProps,\n owner: ComponentInstance | null\n): void {\n const scope = resolveDefaultPortalScope(owner);\n if (!scope) {\n if (_defaultPortalStates.size !== 0) {\n return;\n }\n\n _hasPendingDefaultPortalValue = true;\n _pendingDefaultPortalValue = props.children;\n return;\n }\n\n const state = getDefaultPortalState(scope);\n _hasPendingDefaultPortalValue = false;\n _pendingDefaultPortalValue = undefined;\n state.portal.render(props);\n state.owner = owner;\n}\n\nfunction applyPendingDefaultPortalValue(scope: object): void {\n if (!_hasPendingDefaultPortalValue) {\n return;\n }\n\n const state = getDefaultPortalState(scope);\n state.portal.render({ children: _pendingDefaultPortalValue });\n state.owner = null;\n _hasPendingDefaultPortalValue = false;\n _pendingDefaultPortalValue = undefined;\n}\n\nfunction registerDefaultPortalOwner(owner: ComponentInstance): void {\n const scope = resolveDefaultPortalScope(owner);\n if (!scope) {\n return;\n }\n\n const state = getDefaultPortalState(scope);\n if (state.cleanupOwners.has(owner)) {\n return;\n }\n\n state.cleanupOwners.add(owner);\n owner.cleanupFns.push(() => {\n const currentState = _defaultPortalStates.get(scope);\n if (!currentState) {\n return;\n }\n\n if (currentState.owner === owner) {\n currentState.portal.render({ children: undefined });\n currentState.owner = null;\n }\n currentState.cleanupOwners.delete(owner);\n });\n}\n\nexport function clearDefaultPortalForInstance(\n instance: ComponentInstance\n): void {\n const scope = instance.portalScope;\n if (!scope) {\n return;\n }\n\n const state = _defaultPortalStates.get(scope);\n if (!state) {\n return;\n }\n\n _hasPendingDefaultPortalValue = false;\n _pendingDefaultPortalValue = undefined;\n state.portal.render({ children: undefined });\n state.owner = null;\n}\n\nexport const DefaultPortal: Portal<RenderableChild> = (() => {\n function Host() {\n const scope = resolveDefaultPortalScope(getCurrentComponentInstance());\n if (!scope) {\n return null;\n }\n\n applyPendingDefaultPortalValue(scope);\n const v = getDefaultPortalState(scope).portal();\n return v === undefined ? null : v;\n }\n Host.render = function Render(props: { children?: RenderableChild }) {\n writeDefaultPortal(props, getCurrentComponentInstance());\n return null;\n };\n return Host as Portal<RenderableChild>;\n})();\n\nexport function Portal(props: PortalProps): null {\n const owner = getCurrentComponentInstance();\n if (owner) {\n registerDefaultPortalOwner(owner);\n }\n writeDefaultPortal(props, owner);\n return null;\n}\n\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CAC7C,IAAI,CAAC,OACH;CAGF,MAAM,QAAQ,sBAAsB,KAAK;CACzC,IAAI,MAAM,cAAc,IAAI,KAAK,GAC/B;CAGF,MAAM,cAAc,IAAI,KAAK;CAC7B,MAAM,WAAW,WAAW;EAC1B,MAAM,eAAe,qBAAqB,IAAI,KAAK;EACnD,IAAI,CAAC,cACH;EAGF,IAAI,aAAa,UAAU,OAAO;GAChC,aAAa,OAAO,OAAO,EAAE,UAAU,OAAU,CAAC;GAClD,aAAa,QAAQ;EACvB;EACA,aAAa,cAAc,OAAO,KAAK;CACzC,CAAC;AACH;AAEA,SAAgB,8BACd,UACM;CACN,MAAM,QAAQ,SAAS;CACvB,IAAI,CAAC,OACH;CAGF,MAAM,QAAQ,qBAAqB,IAAI,KAAK;CAC5C,IAAI,CAAC,OACH;CAGF,gCAAgC;CAChC,6BAA6B;CAC7B,MAAM,OAAO,OAAO,EAAE,UAAU,OAAU,CAAC;CAC3C,MAAM,QAAQ;AAChB;AAEA,MAAa,uBAAgD;CAC3D,SAAS,OAAO;EACd,MAAM,QAAQ,0BAA0B,4BAA4B,CAAC;EACrE,IAAI,CAAC,OACH,OAAO;EAGT,+BAA+B,KAAK;EACpC,MAAM,IAAI,sBAAsB,KAAK,CAAC,CAAC,OAAO;EAC9C,OAAO,MAAM,SAAY,OAAO;CAClC;CACA,KAAK,SAAS,SAAS,OAAO,OAAuC;EACnE,mBAAmB,OAAO,4BAA4B,CAAC;EACvD,OAAO;CACT;CACA,OAAO;AACT,EAAA,CAAG;AAEH,SAAgB,OAAO,OAA0B;CAC/C,MAAM,QAAQ,4BAA4B;CAC1C,IAAI,OACF,2BAA2B,KAAK;CAElC,mBAAmB,OAAO,KAAK;CAC/B,OAAO;AACT"}
package/dist/fx/fx.d.ts CHANGED
@@ -29,5 +29,5 @@ declare function scheduleRetry<T>(fn: () => Promise<T>, options?: RetryOptions):
29
29
  cancel(): void;
30
30
  };
31
31
  //#endregion
32
- export { debounceEvent, rafEvent, scheduleIdle, scheduleRetry, scheduleTimeout, throttleEvent };
32
+ export { CancelFn, RetryOptions, debounceEvent, rafEvent, scheduleIdle, scheduleRetry, scheduleTimeout, throttleEvent };
33
33
  //# sourceMappingURL=fx.d.ts.map
package/dist/fx/fx.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { logger } from "../dev/logger.js";
2
- import { globalScheduler } from "../runtime/scheduler.js";
3
- import { getCurrentComponentInstance } from "../runtime/component.js";
2
+ import { enqueueRuntimeTask } from "../runtime/access.js";
3
+ import { getCurrentComponentInstance } from "../runtime/component-scope.js";
4
+ import "../runtime/component.js";
4
5
  import { noopEventListener, noopEventListenerWithFlush } from "./noop.js";
5
6
  //#region src/fx/fx.ts
6
7
  function throwIfDuringRender() {
@@ -10,7 +11,7 @@ function throwIfDuringRender() {
10
11
  * Helper: schedule a user callback through the global scheduler
11
12
  */
12
13
  function enqueueUserCallback(fn) {
13
- globalScheduler.enqueue(() => {
14
+ enqueueRuntimeTask(() => {
14
15
  try {
15
16
  fn();
16
17
  } catch (err) {
@@ -184,7 +185,7 @@ function scheduleRetry(fn, options) {
184
185
  let cancelled = false;
185
186
  const attempt = (index) => {
186
187
  if (cancelled) return;
187
- globalScheduler.enqueue(() => {
188
+ enqueueRuntimeTask(() => {
188
189
  if (cancelled) return;
189
190
  fn().then(() => {}, () => {
190
191
  if (cancelled) return;
package/dist/fx/fx.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fx.js","names":[],"sources":["../../src/fx/fx.ts"],"sourcesContent":["import { globalScheduler } from '../runtime/scheduler';\nimport { getCurrentComponentInstance } from '../runtime/component';\nimport { logger } from '../dev/logger';\nimport { noopEventListener, noopEventListenerWithFlush } from './noop';\n\nexport type CancelFn = () => void;\n\n// Platform-specific timer handle types\ntype TimeoutHandle = ReturnType<typeof setTimeout> | null;\n// rAF may fall back to setTimeout in some environments/tests, include both\ntype RafHandle =\n | ReturnType<typeof requestAnimationFrame>\n | ReturnType<typeof setTimeout>\n | null;\n// requestIdleCallback may be unavailable; allow setTimeout fallback handle\ntype IdleHandle =\n | ReturnType<typeof requestIdleCallback>\n | ReturnType<typeof setTimeout>\n | null;\n\nfunction throwIfDuringRender(): void {\n const inst = getCurrentComponentInstance();\n if (inst !== null) {\n throw new Error(\n '[Askr] calling FX handler during render is not allowed. Move calls to event handlers or effects.'\n );\n }\n}\n\n/**\n * Helper: schedule a user callback through the global scheduler\n */\nfunction enqueueUserCallback(fn: () => void) {\n globalScheduler.enqueue(() => {\n try {\n fn();\n } catch (err) {\n // Keep behavior consistent with other scheduler-queued work\n logger.error('[Askr] FX handler error:', err);\n }\n });\n}\n\n// ---------- Event handlers ----------\n\nexport function debounceEvent(\n ms: number,\n handler: EventListener,\n options?: { leading?: boolean; trailing?: boolean }\n): EventListener & { cancel(): void; flush(): void } {\n const { leading = false, trailing = true } = options || {};\n\n const inst = getCurrentComponentInstance();\n // On SSR, event handlers are inert\n if (inst && inst.ssr) {\n return noopEventListenerWithFlush;\n }\n\n let timeoutId: TimeoutHandle = null;\n let lastEvent: Event | null = null;\n let lastCallTime = 0;\n\n const debounced = function (this: unknown, ev: Event) {\n // Disallow using returned handler during render\n throwIfDuringRender();\n\n const now = Date.now();\n lastEvent = ev;\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n if (leading && now - lastCallTime >= ms) {\n enqueueUserCallback(() => handler.call(null, ev));\n lastCallTime = now;\n }\n\n if (trailing) {\n timeoutId = setTimeout(() => {\n // Schedule through scheduler\n if (lastEvent) {\n enqueueUserCallback(() => handler.call(null, lastEvent!));\n }\n timeoutId = null;\n lastCallTime = Date.now();\n }, ms);\n }\n } as EventListener & { cancel(): void; flush(): void };\n\n debounced.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastEvent = null;\n };\n\n debounced.flush = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n const ev = lastEvent;\n lastEvent = null;\n timeoutId = null;\n if (ev) enqueueUserCallback(() => handler.call(null, ev));\n }\n };\n\n // Auto-cleanup on component unmount\n if (inst) {\n (inst.cleanupFns ??= []).push(() => {\n debounced.cancel();\n });\n }\n\n return debounced;\n}\n\nexport function throttleEvent(\n ms: number,\n handler: EventListener,\n options?: { leading?: boolean; trailing?: boolean }\n): EventListener & { cancel(): void } {\n const { leading = true, trailing = true } = options || {};\n\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return noopEventListener;\n }\n\n let lastCallTime = 0;\n let timeoutId: TimeoutHandle = null;\n let lastEvent: Event | null = null;\n\n const throttled = function (this: unknown, ev: Event) {\n throwIfDuringRender();\n\n const now = Date.now();\n lastEvent = ev;\n\n if (leading && now - lastCallTime >= ms) {\n enqueueUserCallback(() => handler.call(null, ev));\n lastCallTime = now;\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n } else if (!leading && lastCallTime === 0) {\n lastCallTime = now;\n }\n\n if (trailing && timeoutId === null) {\n const wait = ms - (now - lastCallTime);\n timeoutId = setTimeout(\n () => {\n if (lastEvent)\n enqueueUserCallback(() => handler.call(null, lastEvent!));\n lastCallTime = Date.now();\n timeoutId = null;\n },\n Math.max(0, wait)\n );\n }\n } as EventListener & { cancel(): void };\n\n throttled.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastEvent = null;\n };\n\n if (inst) {\n (inst.cleanupFns ??= []).push(() => throttled.cancel());\n }\n\n return throttled;\n}\n\nexport function rafEvent(\n handler: EventListener\n): EventListener & { cancel(): void } {\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return noopEventListener;\n }\n\n let frameId: RafHandle = null;\n let lastEvent: Event | null = null;\n\n const scheduleFrame = () => {\n const rAF =\n typeof requestAnimationFrame !== 'undefined'\n ? requestAnimationFrame\n : (cb: FrameRequestCallback) => setTimeout(() => cb(Date.now()), 16);\n\n frameId = rAF(() => {\n frameId = null;\n if (lastEvent) {\n const ev = lastEvent;\n lastEvent = null;\n enqueueUserCallback(() => handler.call(null, ev));\n }\n });\n };\n\n const fn = function (this: unknown, ev: Event) {\n throwIfDuringRender();\n lastEvent = ev;\n if (frameId === null) scheduleFrame();\n } as EventListener & { cancel(): void };\n\n fn.cancel = () => {\n if (frameId !== null) {\n // If frameId is numeric and cancelAnimationFrame is available, use it;\n // otherwise fall back to clearTimeout for the setTimeout fallback.\n if (\n typeof cancelAnimationFrame !== 'undefined' &&\n typeof frameId === 'number'\n ) {\n cancelAnimationFrame(frameId);\n } else {\n clearTimeout(frameId as ReturnType<typeof setTimeout>);\n }\n frameId = null;\n }\n lastEvent = null;\n };\n\n if (inst) (inst.cleanupFns ??= []).push(() => fn.cancel());\n\n return fn;\n}\n\n// ---------- Scheduled work ----------\n\nexport function scheduleTimeout(ms: number, fn: () => void): CancelFn {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return () => {};\n }\n\n let id: TimeoutHandle = setTimeout(() => {\n id = null;\n enqueueUserCallback(fn);\n }, ms);\n\n const cancel = () => {\n if (id !== null) {\n clearTimeout(id);\n id = null;\n }\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return cancel;\n}\n\nexport function scheduleIdle(\n fn: () => void,\n options?: { timeout?: number }\n): CancelFn {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) return () => {};\n\n let id: IdleHandle = null;\n let usingRIC = false;\n\n if (typeof requestIdleCallback !== 'undefined') {\n usingRIC = true;\n id = requestIdleCallback(() => {\n id = null;\n enqueueUserCallback(fn);\n }, options);\n } else {\n // Fallback: schedule on next macrotask\n id = setTimeout(() => {\n id = null;\n enqueueUserCallback(fn);\n }, 0);\n }\n\n const cancel = () => {\n if (id !== null) {\n // If using requestIdleCallback and available, call cancelIdleCallback for numeric ids.\n if (\n usingRIC &&\n typeof cancelIdleCallback !== 'undefined' &&\n typeof id === 'number'\n ) {\n cancelIdleCallback(id);\n } else {\n clearTimeout(id as ReturnType<typeof setTimeout>);\n }\n id = null;\n }\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return cancel;\n}\n\nexport interface RetryOptions {\n maxAttempts?: number;\n delayMs?: number;\n backoff?: (attemptIndex: number) => number;\n}\n\nexport function scheduleRetry<T>(\n fn: () => Promise<T>,\n options?: RetryOptions\n): { cancel(): void } {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) return { cancel: () => {} };\n\n const {\n maxAttempts = 3,\n delayMs = 100,\n backoff = (i: number) => delayMs * Math.pow(2, i),\n } = options || {};\n\n let cancelled = false;\n\n const attempt = (index: number) => {\n if (cancelled) return;\n // Run user fn inside scheduler\n globalScheduler.enqueue(() => {\n if (cancelled) return;\n // Call fn (it may be async)\n const p = fn();\n p.then(\n () => {\n // Completed successfully\n },\n () => {\n if (cancelled) return;\n if (index + 1 < maxAttempts) {\n const delay = backoff(index);\n // Schedule next attempt via setTimeout so it gets enqueued through scheduleTimeout\n setTimeout(() => {\n attempt(index + 1);\n }, delay);\n }\n }\n ).catch((e) => {\n logger.error('[Askr] scheduleRetry error:', e);\n });\n });\n };\n\n // Start first attempt\n attempt(0);\n\n const cancel = () => {\n cancelled = true;\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return { cancel };\n}\n"],"mappings":";;;;;AAoBA,SAAS,sBAA4B;CAEnC,IADa,4BACT,MAAS,MACX,MAAM,IAAI,MACR,kGACF;AAEJ;;;;AAKA,SAAS,oBAAoB,IAAgB;CAC3C,gBAAgB,cAAc;EAC5B,IAAI;GACF,GAAG;EACL,SAAS,KAAK;GAEZ,OAAO,MAAM,4BAA4B,GAAG;EAC9C;CACF,CAAC;AACH;AAIA,SAAgB,cACd,IACA,SACA,SACmD;CACnD,MAAM,EAAE,UAAU,OAAO,WAAW,SAAS,WAAW,CAAC;CAEzD,MAAM,OAAO,4BAA4B;CAEzC,IAAI,QAAQ,KAAK,KACf,OAAO;CAGT,IAAI,Y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AW;EAEf,gBAAgB,cAAc;GAC5B,IAAI,WAAW;GAGf,AADU,GACV,CAAA,CAAE,WACM,CAEN,SACM;IACJ,IAAI,WAAW;IACf,IAAI,QAAQ,IAAI,aAAa;KAC3B,MAAM,QAAQ,QAAQ,KAAK;KAE3B,iBAAiB;MACf,QAAQ,QAAQ,CAAC;KACnB,GAAG,KAAK;IACV;GACF,CACF,CAAC,CAAC,OAAO,MAAM;IACb,OAAO,MAAM,+BAA+B,CAAC;GAC/C,CAAC;EACH,CAAC;CACH;CAGA,QAAQ,CAAC;CAET,MAAM,eAAe;EACnB,YAAY;CACd;CAEA,IAAI,MAAM,CAAC,KAAK,eAAe,CAAC,EAAA,CAAG,KAAK,MAAM;CAC9C,OAAO,EAAE,OAAO;AAClB"}
1
+ {"version":3,"file":"fx.js","names":[],"sources":["../../src/fx/fx.ts"],"sourcesContent":["import { enqueueRuntimeTask } from '../runtime/access';\nimport { getCurrentComponentInstance } from '../runtime/component';\nimport { logger } from '../dev/logger';\nimport { noopEventListener, noopEventListenerWithFlush } from './noop';\n\nexport type CancelFn = () => void;\n\n// Platform-specific timer handle types\ntype TimeoutHandle = ReturnType<typeof setTimeout> | null;\n// rAF may fall back to setTimeout in some environments/tests, include both\ntype RafHandle =\n | ReturnType<typeof requestAnimationFrame>\n | ReturnType<typeof setTimeout>\n | null;\n// requestIdleCallback may be unavailable; allow setTimeout fallback handle\ntype IdleHandle =\n | ReturnType<typeof requestIdleCallback>\n | ReturnType<typeof setTimeout>\n | null;\n\nfunction throwIfDuringRender(): void {\n const inst = getCurrentComponentInstance();\n if (inst !== null) {\n throw new Error(\n '[Askr] calling FX handler during render is not allowed. Move calls to event handlers or effects.'\n );\n }\n}\n\n/**\n * Helper: schedule a user callback through the global scheduler\n */\nfunction enqueueUserCallback(fn: () => void) {\n enqueueRuntimeTask(() => {\n try {\n fn();\n } catch (err) {\n // Keep behavior consistent with other scheduler-queued work\n logger.error('[Askr] FX handler error:', err);\n }\n });\n}\n\n// ---------- Event handlers ----------\n\nexport function debounceEvent(\n ms: number,\n handler: EventListener,\n options?: { leading?: boolean; trailing?: boolean }\n): EventListener & { cancel(): void; flush(): void } {\n const { leading = false, trailing = true } = options || {};\n\n const inst = getCurrentComponentInstance();\n // On SSR, event handlers are inert\n if (inst && inst.ssr) {\n return noopEventListenerWithFlush;\n }\n\n let timeoutId: TimeoutHandle = null;\n let lastEvent: Event | null = null;\n let lastCallTime = 0;\n\n const debounced = function (this: unknown, ev: Event) {\n // Disallow using returned handler during render\n throwIfDuringRender();\n\n const now = Date.now();\n lastEvent = ev;\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n if (leading && now - lastCallTime >= ms) {\n enqueueUserCallback(() => handler.call(null, ev));\n lastCallTime = now;\n }\n\n if (trailing) {\n timeoutId = setTimeout(() => {\n // Schedule through scheduler\n if (lastEvent) {\n enqueueUserCallback(() => handler.call(null, lastEvent!));\n }\n timeoutId = null;\n lastCallTime = Date.now();\n }, ms);\n }\n } as EventListener & { cancel(): void; flush(): void };\n\n debounced.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastEvent = null;\n };\n\n debounced.flush = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n const ev = lastEvent;\n lastEvent = null;\n timeoutId = null;\n if (ev) enqueueUserCallback(() => handler.call(null, ev));\n }\n };\n\n // Auto-cleanup on component unmount\n if (inst) {\n (inst.cleanupFns ??= []).push(() => {\n debounced.cancel();\n });\n }\n\n return debounced;\n}\n\nexport function throttleEvent(\n ms: number,\n handler: EventListener,\n options?: { leading?: boolean; trailing?: boolean }\n): EventListener & { cancel(): void } {\n const { leading = true, trailing = true } = options || {};\n\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return noopEventListener;\n }\n\n let lastCallTime = 0;\n let timeoutId: TimeoutHandle = null;\n let lastEvent: Event | null = null;\n\n const throttled = function (this: unknown, ev: Event) {\n throwIfDuringRender();\n\n const now = Date.now();\n lastEvent = ev;\n\n if (leading && now - lastCallTime >= ms) {\n enqueueUserCallback(() => handler.call(null, ev));\n lastCallTime = now;\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n } else if (!leading && lastCallTime === 0) {\n lastCallTime = now;\n }\n\n if (trailing && timeoutId === null) {\n const wait = ms - (now - lastCallTime);\n timeoutId = setTimeout(\n () => {\n if (lastEvent)\n enqueueUserCallback(() => handler.call(null, lastEvent!));\n lastCallTime = Date.now();\n timeoutId = null;\n },\n Math.max(0, wait)\n );\n }\n } as EventListener & { cancel(): void };\n\n throttled.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastEvent = null;\n };\n\n if (inst) {\n (inst.cleanupFns ??= []).push(() => throttled.cancel());\n }\n\n return throttled;\n}\n\nexport function rafEvent(\n handler: EventListener\n): EventListener & { cancel(): void } {\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return noopEventListener;\n }\n\n let frameId: RafHandle = null;\n let lastEvent: Event | null = null;\n\n const scheduleFrame = () => {\n const rAF =\n typeof requestAnimationFrame !== 'undefined'\n ? requestAnimationFrame\n : (cb: FrameRequestCallback) => setTimeout(() => cb(Date.now()), 16);\n\n frameId = rAF(() => {\n frameId = null;\n if (lastEvent) {\n const ev = lastEvent;\n lastEvent = null;\n enqueueUserCallback(() => handler.call(null, ev));\n }\n });\n };\n\n const fn = function (this: unknown, ev: Event) {\n throwIfDuringRender();\n lastEvent = ev;\n if (frameId === null) scheduleFrame();\n } as EventListener & { cancel(): void };\n\n fn.cancel = () => {\n if (frameId !== null) {\n // If frameId is numeric and cancelAnimationFrame is available, use it;\n // otherwise fall back to clearTimeout for the setTimeout fallback.\n if (\n typeof cancelAnimationFrame !== 'undefined' &&\n typeof frameId === 'number'\n ) {\n cancelAnimationFrame(frameId);\n } else {\n clearTimeout(frameId as ReturnType<typeof setTimeout>);\n }\n frameId = null;\n }\n lastEvent = null;\n };\n\n if (inst) (inst.cleanupFns ??= []).push(() => fn.cancel());\n\n return fn;\n}\n\n// ---------- Scheduled work ----------\n\nexport function scheduleTimeout(ms: number, fn: () => void): CancelFn {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return () => {};\n }\n\n let id: TimeoutHandle = setTimeout(() => {\n id = null;\n enqueueUserCallback(fn);\n }, ms);\n\n const cancel = () => {\n if (id !== null) {\n clearTimeout(id);\n id = null;\n }\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return cancel;\n}\n\nexport function scheduleIdle(\n fn: () => void,\n options?: { timeout?: number }\n): CancelFn {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) return () => {};\n\n let id: IdleHandle = null;\n let usingRIC = false;\n\n if (typeof requestIdleCallback !== 'undefined') {\n usingRIC = true;\n id = requestIdleCallback(() => {\n id = null;\n enqueueUserCallback(fn);\n }, options);\n } else {\n // Fallback: schedule on next macrotask\n id = setTimeout(() => {\n id = null;\n enqueueUserCallback(fn);\n }, 0);\n }\n\n const cancel = () => {\n if (id !== null) {\n // If using requestIdleCallback and available, call cancelIdleCallback for numeric ids.\n if (\n usingRIC &&\n typeof cancelIdleCallback !== 'undefined' &&\n typeof id === 'number'\n ) {\n cancelIdleCallback(id);\n } else {\n clearTimeout(id as ReturnType<typeof setTimeout>);\n }\n id = null;\n }\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return cancel;\n}\n\nexport interface RetryOptions {\n maxAttempts?: number;\n delayMs?: number;\n backoff?: (attemptIndex: number) => number;\n}\n\nexport function scheduleRetry<T>(\n fn: () => Promise<T>,\n options?: RetryOptions\n): { cancel(): void } {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) return { cancel: () => {} };\n\n const {\n maxAttempts = 3,\n delayMs = 100,\n backoff = (i: number) => delayMs * Math.pow(2, i),\n } = options || {};\n\n let cancelled = false;\n\n const attempt = (index: number) => {\n if (cancelled) return;\n // Run user fn inside scheduler\n enqueueRuntimeTask(() => {\n if (cancelled) return;\n // Call fn (it may be async)\n const p = fn();\n p.then(\n () => {\n // Completed successfully\n },\n () => {\n if (cancelled) return;\n if (index + 1 < maxAttempts) {\n const delay = backoff(index);\n // Schedule next attempt via setTimeout so it gets enqueued through scheduleTimeout\n setTimeout(() => {\n attempt(index + 1);\n }, delay);\n }\n }\n ).catch((e) => {\n logger.error('[Askr] scheduleRetry error:', e);\n });\n });\n };\n\n // Start first attempt\n attempt(0);\n\n const cancel = () => {\n cancelled = true;\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return { cancel };\n}\n"],"mappings":";;;;;;AAoBA,SAAS,sBAA4B;CAEnC,IADa,4BACT,MAAS,MACX,MAAM,IAAI,MACR,kGACF;AAEJ;;;;AAKA,SAAS,oBAAoB,IAAgB;CAC3C,yBAAyB;EACvB,IAAI;GACF,GAAG;EACL,SAAS,KAAK;GAEZ,OAAO,MAAM,4BAA4B,GAAG;EAC9C;CACF,CAAC;AACH;AAIA,SAAgB,cACd,IACA,SACA,SACmD;CACnD,MAAM,EAAE,UAAU,OAAO,WAAW,SAAS,WAAW,CAAC;CAEzD,MAAM,OAAO,4BAA4B;CAEzC,IAAI,QAAQ,KAAK,KACf,OAAO;CAGT,IAAI,YAA2B;CAC/B,IAAI,YAA0B;CAC9B,IAAI,eAAe;CAEnB,MAAM,YAAY,SAAyB,IAAW;EAEpD,oBAAoB;EAEpB,MAAM,MAAM,KAAK,IAAI;EACrB,YAAY;EAEZ,IAAI,cAAc,MAAM;GACtB,aAAa,SAAS;GACtB,YAAY;EACd;EAEA,IAAI,WAAW,MAAM,gBAAgB,IAAI;GACvC,0BAA0B,QAAQ,KAAK,MAAM,EAAE,CAAC;GAChD,eAAe;EACjB;EAEA,IAAI,UACF,YAAY,iBAAiB;GAE3B,IAAI,WACF,0BAA0B,QAAQ,KAAK,MAAM,SAAU,CAAC;GAE1D,YAAY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["../../src/fx/timing.ts"],"mappings":";;AAKA;;;UAAiB,eAAA;EACf,OAAA;EACA,QAAQ;AAAA;AAAA,UAGO,eAAA;EACf,OAAA;EACA,QAAQ;AAAA;AAAA,UAGO,YAAA;EACf,WAAA;EACA,OAAA;EACA,OAAA,IAAW,YAAA;AAAA;AAAA,KAGR,KAAA,OAAY,IAAI;;;AAHY;AAChC;;;;AAEoB;AAoBrB;;;;;;;;;iBAAgB,QAAA,WAAmB,KAAA,EACjC,EAAA,EAAI,CAAA,EACJ,EAAA,UACA,OAAA,GAAU,eAAA,GACT,CAAA;EAAM,MAAA;AAAA;;;;;;;;AAAM;AA2Df;;;;;;;;;iBAAgB,QAAA,WAAmB,KAAA,EACjC,EAAA,EAAI,CAAA,EACJ,EAAA,UACA,OAAA,GAAU,eAAA,GACT,CAAA;EAAM,MAAA;AAAA;;;;;;;;AAAM;AAsEf;;;;;;;;iBAAgB,IAAA,WAAe,KAAA,EAAO,EAAA,EAAI,CAAA,GAAI,CAAA;;;;;;AAAC;AA2B/C;;;;AAAoC;AAmBpC;;iBAnBgB,KAAA,CAAM,EAAc;;;;;;;;;;;;AAmBU;AAkC9C;;;iBAlCgB,GAAA,WAAc,KAAA,EAAO,EAAA,EAAI,CAAA,GAAI,CAAA;;;;;AAkCsB;AAyBnE;;;;AAA4C;AAqB5C;;;;iBA9CgB,IAAA,CAAK,EAAA,cAAgB,OAAA;EAAY,OAAA;AAAA;;;;;;;;;;;;;AAiDrC;;iBAxBI,OAAA,CAAQ,EAAA,WAAa,OAAO;;;;;;;;;;;;;;;;;;iBAqBtB,KAAA,IACpB,EAAA,QAAU,OAAA,CAAQ,CAAA,GAClB,OAAA,GAAU,YAAA,GACT,OAAA,CAAQ,CAAA"}
package/dist/fx/timing.js CHANGED
@@ -17,6 +17,7 @@
17
17
  * ```
18
18
  */
19
19
  function debounce(fn, ms, options) {
20
+ const callable = fn;
20
21
  let timeoutId = null;
21
22
  const { leading = false, trailing = true } = options || {};
22
23
  let lastArgs = null;
@@ -28,11 +29,11 @@ function debounce(fn, ms, options) {
28
29
  lastThis = this;
29
30
  if (timeoutId !== null) clearTimeout(timeoutId);
30
31
  if (leading && callTime - lastCallTime >= ms) {
31
- fn.apply(this, args);
32
+ callable.apply(this, args);
32
33
  lastCallTime = callTime;
33
34
  }
34
35
  if (trailing) timeoutId = setTimeout(() => {
35
- fn.apply(lastThis, lastArgs);
36
+ callable.apply(lastThis, lastArgs);
36
37
  timeoutId = null;
37
38
  lastCallTime = Date.now();
38
39
  }, ms);
@@ -63,6 +64,7 @@ function debounce(fn, ms, options) {
63
64
  * ```
64
65
  */
65
66
  function throttle(fn, ms, options) {
67
+ const callable = fn;
66
68
  let lastCallTime = null;
67
69
  let timeoutId = null;
68
70
  const { leading = true, trailing = true } = options || {};
@@ -74,7 +76,7 @@ function throttle(fn, ms, options) {
74
76
  lastArgs = args;
75
77
  lastThis = this;
76
78
  if (leading && timeSinceLastCall >= ms) {
77
- fn.apply(this, args);
79
+ callable.apply(this, args);
78
80
  lastCallTime = callTime;
79
81
  if (timeoutId !== null) {
80
82
  clearTimeout(timeoutId);
@@ -84,7 +86,7 @@ function throttle(fn, ms, options) {
84
86
  }
85
87
  if (!leading && lastCallTime === null) lastCallTime = callTime;
86
88
  if (trailing && timeoutId === null) timeoutId = setTimeout(() => {
87
- fn.apply(lastThis, lastArgs);
89
+ callable.apply(lastThis, lastArgs);
88
90
  lastCallTime = Date.now();
89
91
  timeoutId = null;
90
92
  }, lastCallTime === null ? ms : Math.max(0, ms - (callTime - lastCallTime)));
@@ -114,12 +116,13 @@ function throttle(fn, ms, options) {
114
116
  * ```
115
117
  */
116
118
  function once(fn) {
119
+ const callable = fn;
117
120
  let called = false;
118
121
  let result;
119
122
  return ((...args) => {
120
123
  if (!called) {
121
124
  called = true;
122
- result = fn(...args);
125
+ result = callable(...args);
123
126
  }
124
127
  return result;
125
128
  });
@@ -156,6 +159,7 @@ function defer(fn) {
156
159
  * ```
157
160
  */
158
161
  function raf(fn) {
162
+ const callable = fn;
159
163
  let frameId = null;
160
164
  let lastArgs = null;
161
165
  let lastThis = null;
@@ -163,7 +167,7 @@ function raf(fn) {
163
167
  lastArgs = args;
164
168
  lastThis = this;
165
169
  if (frameId === null) frameId = requestAnimationFrame(() => {
166
- fn.apply(lastThis, lastArgs);
170
+ callable.apply(lastThis, lastArgs);
167
171
  frameId = null;
168
172
  });
169
173
  };
@@ -1 +1 @@
1
- {"version":3,"file":"timing.js","names":[],"sources":["../../src/fx/timing.ts"],"sourcesContent":["/**\n * Timing utilities — pure helpers for common async patterns\n * No framework coupling. No lifecycle awareness.\n */\n\nexport interface DebounceOptions {\n leading?: boolean;\n trailing?: boolean;\n}\n\nexport interface ThrottleOptions {\n leading?: boolean;\n trailing?: boolean;\n}\n\nexport interface RetryOptions {\n maxAttempts?: number;\n delayMs?: number;\n backoff?: (attemptIndex: number) => number;\n}\n\ntype AnyFn = (...args: never[]) => unknown;\n\n/**\n * Debounce — delay execution, coalesce rapid calls\n *\n * Useful for: text input, resize, autosave\n *\n * @param fn Function to debounce\n * @param ms Delay in milliseconds\n * @param options trailing (default true), leading\n * @returns Debounced function with cancel() method\n *\n * @example\n * ```ts\n * const save = debounce((text) => api.save(text), 500);\n * input.addEventListener('input', (e) => save(e.target.value));\n * save.cancel(); // stop any pending execution\n * ```\n */\nexport function debounce<T extends AnyFn>(\n fn: T,\n ms: number,\n options?: DebounceOptions\n): T & { cancel(): void } {\n let timeoutId: NodeJS.Timeout | null = null;\n const { leading = false, trailing = true } = options || {};\n let lastArgs: unknown[] | null = null;\n let lastThis: unknown = null;\n let lastCallTime = 0;\n\n const debounced = function (this: unknown, ...args: unknown[]) {\n const callTime = Date.now();\n lastArgs = args;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n lastThis = this;\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (leading && callTime - lastCallTime >= ms) {\n fn.apply(this, args);\n lastCallTime = callTime;\n }\n\n if (trailing) {\n timeoutId = setTimeout(() => {\n fn.apply(lastThis, lastArgs!);\n timeoutId = null;\n lastCallTime = Date.now();\n }, ms);\n }\n };\n\n debounced.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n return debounced as T & { cancel(): void };\n}\n\n/**\n * Throttle — rate-limit execution, keep first/last\n *\n * Useful for: scroll, mouse move, high-frequency events\n *\n * @param fn Function to throttle\n * @param ms Minimum interval between calls in milliseconds\n * @param options leading (default true), trailing (default true)\n * @returns Throttled function with cancel() method\n *\n * @example\n * ```ts\n * const handleScroll = throttle(updateUI, 100);\n * window.addEventListener('scroll', handleScroll);\n * handleScroll.cancel();\n * ```\n */\nexport function throttle<T extends AnyFn>(\n fn: T,\n ms: number,\n options?: ThrottleOptions\n): T & { cancel(): void } {\n let lastCallTime: number | null = null;\n let timeoutId: NodeJS.Timeout | null = null;\n const { leading = true, trailing = true } = options || {};\n let lastArgs: unknown[] | null = null;\n let lastThis: unknown = null;\n\n const throttled = function (this: unknown, ...args: unknown[]) {\n const callTime = Date.now();\n const timeSinceLastCall =\n lastCallTime === null\n ? Number.POSITIVE_INFINITY\n : callTime - lastCallTime;\n lastArgs = args;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n lastThis = this;\n\n if (leading && timeSinceLastCall >= ms) {\n fn.apply(this, args);\n lastCallTime = callTime;\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n return;\n }\n\n if (!leading && lastCallTime === null) {\n lastCallTime = callTime;\n }\n\n if (trailing && timeoutId === null) {\n timeoutId = setTimeout(\n () => {\n fn.apply(lastThis, lastArgs!);\n lastCallTime = Date.now();\n timeoutId = null;\n },\n lastCallTime === null ? ms : Math.max(0, ms - (callTime - lastCallTime))\n );\n }\n };\n\n throttled.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n return throttled as T & { cancel(): void };\n}\n\n/**\n * Once — guard against double execution\n *\n * Useful for: init logic, event safety\n *\n * @param fn Function to call at most once\n * @returns Function that executes fn only on first call\n *\n * @example\n * ```ts\n * const init = once(setup);\n * init(); // runs\n * init(); // does nothing\n * init(); // does nothing\n * ```\n */\nexport function once<T extends AnyFn>(fn: T): T {\n let called = false;\n let result: unknown;\n\n return ((...args: unknown[]) => {\n if (!called) {\n called = true;\n result = fn(...args);\n }\n return result;\n }) as T;\n}\n\n/**\n * Defer — schedule on microtask queue\n *\n * Useful for: run-after-current-stack logic\n * More reliable than setTimeout(..., 0)\n *\n * @param fn Function to defer\n *\n * @example\n * ```ts\n * defer(() => update()); // runs after current stack, before next macrotask\n * ```\n */\nexport function defer(fn: () => void): void {\n Promise.resolve().then(fn);\n}\n\n/**\n * RAF — coalesce multiple updates into single frame\n *\n * Useful for: animation, layout work, render updates\n *\n * @param fn Function to schedule on next animation frame\n * @returns Function that schedules fn on requestAnimationFrame\n *\n * @example\n * ```ts\n * const update = raf(render);\n * update(); // schedules on next frame\n * update(); // same frame, no duplicate\n * ```\n */\nexport function raf<T extends AnyFn>(fn: T): T {\n let frameId: number | null = null;\n let lastArgs: unknown[] | null = null;\n let lastThis: unknown = null;\n\n return function (this: unknown, ...args: unknown[]) {\n lastArgs = args;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n lastThis = this;\n\n if (frameId === null) {\n frameId = requestAnimationFrame(() => {\n fn.apply(lastThis, lastArgs!);\n frameId = null;\n });\n }\n } as T;\n}\n\n/**\n * Idle — schedule low-priority work\n *\n * Useful for: background prep, non-urgent updates\n * Falls back to setTimeout if requestIdleCallback unavailable\n *\n * @param fn Function to call when idle\n * @param options timeout for fallback\n *\n * @example\n * ```ts\n * idle(() => prefetchData());\n * ```\n */\nexport function idle(fn: () => void, options?: { timeout?: number }): void {\n if (typeof requestIdleCallback !== 'undefined') {\n requestIdleCallback(fn, options ? { timeout: options.timeout } : undefined);\n } else {\n // Fallback: defer to microtask, then use setTimeout\n Promise.resolve().then(() => {\n setTimeout(fn, 0);\n });\n }\n}\n\n/**\n * Timeout — Promise-based delay\n *\n * Useful for: readable async code, waiting between retries\n *\n * @param ms Milliseconds to wait\n * @returns Promise that resolves after delay\n *\n * @example\n * ```ts\n * await timeout(300);\n * console.log('300ms later');\n * ```\n */\nexport function timeout(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Retry — attempt function with backoff\n *\n * Useful for: network calls, transient failures\n *\n * @param fn Async function to retry\n * @param options maxAttempts, delayMs, backoff function\n * @returns Promise with final result or error\n *\n * @example\n * ```ts\n * const data = await retry(() => fetch(url), {\n * maxAttempts: 3,\n * delayMs: 100,\n * });\n * ```\n */\nexport async function retry<T>(\n fn: () => Promise<T>,\n options?: RetryOptions\n): Promise<T> {\n const {\n maxAttempts = 3,\n delayMs = 100,\n backoff = (i: number) => delayMs * Math.pow(2, i),\n } = options || {};\n\n let lastError: Error | null = null;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n try {\n return await fn();\n } catch (error) {\n lastError = error as Error;\n if (attempt < maxAttempts - 1) {\n const delay = backoff(attempt);\n await timeout(delay);\n }\n }\n }\n\n throw lastError || new Error('Retry failed');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,SAAgB,SACd,IACA,IACA,SACwB;CACxB,IAAI,YAAmC;CACvC,MAAM,EAAE,UAAU,OAAO,WAAW,SAAS,WAAW,CAAC;CACzD,IAAI,WAA6B;CACjC,IAAI,WAAoB;CACxB,IAAI,eAAe;CAEnB,MAAM,YAAY,SAAyB,GAAG,MAAiB;EAC7D,MAAM,WAAW,KAAK,IAAI;EAC1B,WAAW;EAEX,WAAW;EAEX,IAAI,cAAc,MAChB,aAAa,SAAS;EAGxB,IAAI,WAAW,WAAW,gBAAgB,IAAI;GAC5C,GAAG,MAAM,MAAM,IAAI;GACnB,eAAe;EACjB;EAEA,IAAI,UACF,YAAY,iBAAiB;GAC3B,GAAG,MAAM,UAAU,QAAS;GAC5B,YAAY;GACZ,eAAe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AC3B;;;;;;;;;;;;;;;;AAiBA,SAAgB,IAAqB,IAAU;CAC7C,IAAI,UAAyB;CAC7B,IAAI,WAA6B;CACjC,IAAI,WAAoB;CAExB,OAAO,SAAyB,GAAG,MAAiB;EAClD,WAAW;EAEX,WAAW;EAEX,IAAI,YAAY,MACd,UAAU,4BAA4B;GACpC,GAAG,MAAM,UAAU,QAAS;GAC5B,UAAU;EACZ,CAAC;CAEL;AACF;;;;;;;;;;;;;;;AAgBA,SAAgB,KAAK,IAAgB,SAAsC;CACzE,IAAI,OAAO,wBAAwB,aACjC,oBAAoB,IAAI,UAAU,EAAE,SAAS,QAAQ,QAAQ,IAAI,MAAS;MAG1E,QAAQ,QAAQ,CAAC,CAAC,WAAW;EAC3B,WAAW,IAAI,CAAC;CAClB,CAAC;AAEL;;;;;;;;;;;;;;;AAgBA,SAAgB,QAAQ,IAA2B;CACjD,OAAO,IAAI,SAAS,YAAY,WAAW,SAAS,EAAE,CAAC;AACzD;;;;;;;;;;;;;;;;;;AAmBA,eAAsB,MACpB,IACA,SACY;CACZ,MAAM,EACJ,cAAc,GACd,UAAU,KACV,WAAW,MAAc,UAAU,KAAK,IAAI,GAAG,CAAC,MAC9C,WAAW,CAAC;CAEhB,IAAI,YAA0B;CAE9B,KAAK,IAAI,UAAU,GAAG,UAAU,aAAa,WAC3C,IAAI;EACF,OAAO,MAAM,GAAG;CAClB,SAAS,OAAO;EACd,YAAY;EACZ,IAAI,UAAU,cAAc,GAE1B,MAAM,QADQ,QAAQ,OACR,CAAK;CAEvB;CAGF,MAAM,6BAAa,IAAI,MAAM,cAAc;AAC7C"}
1
+ {"version":3,"file":"timing.js","names":[],"sources":["../../src/fx/timing.ts"],"sourcesContent":["/**\n * Timing utilities — pure helpers for common async patterns\n * No framework coupling. No lifecycle awareness.\n */\n\nexport interface DebounceOptions {\n leading?: boolean;\n trailing?: boolean;\n}\n\nexport interface ThrottleOptions {\n leading?: boolean;\n trailing?: boolean;\n}\n\nexport interface RetryOptions {\n maxAttempts?: number;\n delayMs?: number;\n backoff?: (attemptIndex: number) => number;\n}\n\ntype AnyFn = (...args: never[]) => unknown;\ntype CallableFn = (this: unknown, ...args: unknown[]) => unknown;\n\n/**\n * Debounce — delay execution, coalesce rapid calls\n *\n * Useful for: text input, resize, autosave\n *\n * @param fn Function to debounce\n * @param ms Delay in milliseconds\n * @param options trailing (default true), leading\n * @returns Debounced function with cancel() method\n *\n * @example\n * ```ts\n * const save = debounce((text) => api.save(text), 500);\n * input.addEventListener('input', (e) => save(e.target.value));\n * save.cancel(); // stop any pending execution\n * ```\n */\nexport function debounce<T extends AnyFn>(\n fn: T,\n ms: number,\n options?: DebounceOptions\n): T & { cancel(): void } {\n const callable = fn as unknown as CallableFn;\n let timeoutId: NodeJS.Timeout | null = null;\n const { leading = false, trailing = true } = options || {};\n let lastArgs: unknown[] | null = null;\n let lastThis: unknown = null;\n let lastCallTime = 0;\n\n const debounced = function (this: unknown, ...args: unknown[]) {\n const callTime = Date.now();\n lastArgs = args;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n lastThis = this;\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (leading && callTime - lastCallTime >= ms) {\n callable.apply(this, args);\n lastCallTime = callTime;\n }\n\n if (trailing) {\n timeoutId = setTimeout(() => {\n callable.apply(lastThis, lastArgs!);\n timeoutId = null;\n lastCallTime = Date.now();\n }, ms);\n }\n };\n\n debounced.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n return debounced as unknown as T & { cancel(): void };\n}\n\n/**\n * Throttle — rate-limit execution, keep first/last\n *\n * Useful for: scroll, mouse move, high-frequency events\n *\n * @param fn Function to throttle\n * @param ms Minimum interval between calls in milliseconds\n * @param options leading (default true), trailing (default true)\n * @returns Throttled function with cancel() method\n *\n * @example\n * ```ts\n * const handleScroll = throttle(updateUI, 100);\n * window.addEventListener('scroll', handleScroll);\n * handleScroll.cancel();\n * ```\n */\nexport function throttle<T extends AnyFn>(\n fn: T,\n ms: number,\n options?: ThrottleOptions\n): T & { cancel(): void } {\n const callable = fn as unknown as CallableFn;\n let lastCallTime: number | null = null;\n let timeoutId: NodeJS.Timeout | null = null;\n const { leading = true, trailing = true } = options || {};\n let lastArgs: unknown[] | null = null;\n let lastThis: unknown = null;\n\n const throttled = function (this: unknown, ...args: unknown[]) {\n const callTime = Date.now();\n const timeSinceLastCall =\n lastCallTime === null\n ? Number.POSITIVE_INFINITY\n : callTime - lastCallTime;\n lastArgs = args;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n lastThis = this;\n\n if (leading && timeSinceLastCall >= ms) {\n callable.apply(this, args);\n lastCallTime = callTime;\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n return;\n }\n\n if (!leading && lastCallTime === null) {\n lastCallTime = callTime;\n }\n\n if (trailing && timeoutId === null) {\n timeoutId = setTimeout(\n () => {\n callable.apply(lastThis, lastArgs!);\n lastCallTime = Date.now();\n timeoutId = null;\n },\n lastCallTime === null ? ms : Math.max(0, ms - (callTime - lastCallTime))\n );\n }\n };\n\n throttled.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n return throttled as unknown as T & { cancel(): void };\n}\n\n/**\n * Once — guard against double execution\n *\n * Useful for: init logic, event safety\n *\n * @param fn Function to call at most once\n * @returns Function that executes fn only on first call\n *\n * @example\n * ```ts\n * const init = once(setup);\n * init(); // runs\n * init(); // does nothing\n * init(); // does nothing\n * ```\n */\nexport function once<T extends AnyFn>(fn: T): T {\n const callable = fn as unknown as CallableFn;\n let called = false;\n let result: unknown;\n\n return ((...args: unknown[]) => {\n if (!called) {\n called = true;\n result = callable(...args);\n }\n return result;\n }) as unknown as T;\n}\n\n/**\n * Defer — schedule on microtask queue\n *\n * Useful for: run-after-current-stack logic\n * More reliable than setTimeout(..., 0)\n *\n * @param fn Function to defer\n *\n * @example\n * ```ts\n * defer(() => update()); // runs after current stack, before next macrotask\n * ```\n */\nexport function defer(fn: () => void): void {\n Promise.resolve().then(fn);\n}\n\n/**\n * RAF — coalesce multiple updates into single frame\n *\n * Useful for: animation, layout work, render updates\n *\n * @param fn Function to schedule on next animation frame\n * @returns Function that schedules fn on requestAnimationFrame\n *\n * @example\n * ```ts\n * const update = raf(render);\n * update(); // schedules on next frame\n * update(); // same frame, no duplicate\n * ```\n */\nexport function raf<T extends AnyFn>(fn: T): T {\n const callable = fn as unknown as CallableFn;\n let frameId: number | null = null;\n let lastArgs: unknown[] | null = null;\n let lastThis: unknown = null;\n\n return function (this: unknown, ...args: unknown[]) {\n lastArgs = args;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n lastThis = this;\n\n if (frameId === null) {\n frameId = requestAnimationFrame(() => {\n callable.apply(lastThis, lastArgs!);\n frameId = null;\n });\n }\n } as unknown as T;\n}\n\n/**\n * Idle — schedule low-priority work\n *\n * Useful for: background prep, non-urgent updates\n * Falls back to setTimeout if requestIdleCallback unavailable\n *\n * @param fn Function to call when idle\n * @param options timeout for fallback\n *\n * @example\n * ```ts\n * idle(() => prefetchData());\n * ```\n */\nexport function idle(fn: () => void, options?: { timeout?: number }): void {\n if (typeof requestIdleCallback !== 'undefined') {\n requestIdleCallback(fn, options ? { timeout: options.timeout } : undefined);\n } else {\n // Fallback: defer to microtask, then use setTimeout\n Promise.resolve().then(() => {\n setTimeout(fn, 0);\n });\n }\n}\n\n/**\n * Timeout — Promise-based delay\n *\n * Useful for: readable async code, waiting between retries\n *\n * @param ms Milliseconds to wait\n * @returns Promise that resolves after delay\n *\n * @example\n * ```ts\n * await timeout(300);\n * console.log('300ms later');\n * ```\n */\nexport function timeout(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Retry — attempt function with backoff\n *\n * Useful for: network calls, transient failures\n *\n * @param fn Async function to retry\n * @param options maxAttempts, delayMs, backoff function\n * @returns Promise with final result or error\n *\n * @example\n * ```ts\n * const data = await retry(() => fetch(url), {\n * maxAttempts: 3,\n * delayMs: 100,\n * });\n * ```\n */\nexport async function retry<T>(\n fn: () => Promise<T>,\n options?: RetryOptions\n): Promise<T> {\n const {\n maxAttempts = 3,\n delayMs = 100,\n backoff = (i: number) => delayMs * Math.pow(2, i),\n } = options || {};\n\n let lastError: Error | null = null;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n try {\n return await fn();\n } catch (error) {\n lastError = error as Error;\n if (attempt < maxAttempts - 1) {\n const delay = backoff(attempt);\n await timeout(delay);\n }\n }\n }\n\n throw lastError || new Error('Retry failed');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,SAAgB,SACd,IACA,IACA,SACwB;CACxB,MAAM,WAAW;CACjB,IAAI,YAAmC;CACvC,MAAM,EAAE,UAAU,OAAO,WAAW,SAAS,WAAW,CAAC;CACzD,IAAI,WAA6B;CACjC,IAAI,WAAoB;CACxB,IAAI,eAAe;CAEnB,MAAM,YAAY,SAAyB,GAAG,MAAiB;EAC7D,MAAM,WAAW,KAAK,IAAI;EAC1B,WAAW;EAEX,WAAW;EAEX,IAAI,cAAc,MAChB,aAAa,SAAS;EAGxB,IAAI,WAAW,WAAW,gBAAgB,IAAI;GAC5C,SAAS,MAAM,MAAM,IAAI;GACzB,eAAe;EACjB;EAEA,IAAI,UACF,YAAY,iBAAiB;GAC3B,SAAS,MAAM,UAAU,QAAS;GAClC,YAAY;GACZ,eAAe,KAAK,IAAI;EAC1B,GAAG,EAAE;CAET;CAEA,UAAU,eAAe;EACvB,IAAI,cAAc,MAAM;GACtB,aAAa,SAAS;GACtB,YAAY;EACd;CACF;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,SACd,IACA,IACA,SACwB;CACxB,MAAM,WAAW;CACjB,IAAI,eAA8B;CAClC,IAAI,YAAmC;CACvC,MAAM,EAAE,UAAU,MAAM,WAAW,SAAS,WAAW,CAAC;CACxD,IAAI,WAA6B;CACjC,IAAI,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;;;;;;;AAgBA,SAAgB,KAAK,IAAgB,SAAsC;CACzE,IAAI,OAAO,wBAAwB,aACjC,oBAAoB,IAAI,UAAU,EAAE,SAAS,QAAQ,QAAQ,IAAI,MAAS;MAG1E,QAAQ,QAAQ,CAAC,CAAC,WAAW;EAC3B,WAAW,IAAI,CAAC;CAClB,CAAC;AAEL;;;;;;;;;;;;;;;AAgBA,SAAgB,QAAQ,IAA2B;CACjD,OAAO,IAAI,SAAS,YAAY,WAAW,SAAS,EAAE,CAAC;AACzD;;;;;;;;;;;;;;;;;;AAmBA,eAAsB,MACpB,IACA,SACY;CACZ,MAAM,EACJ,cAAc,GACd,UAAU,KACV,WAAW,MAAc,UAAU,KAAK,IAAI,GAAG,CAAC,MAC9C,WAAW,CAAC;CAEhB,IAAI,YAA0B;CAE9B,KAAK,IAAI,UAAU,GAAG,UAAU,aAAa,WAC3C,IAAI;EACF,OAAO,MAAM,GAAG;CAClB,SAAS,OAAO;EACd,YAAY;EACZ,IAAI,UAAU,cAAc,GAE1B,MAAM,QADQ,QAAQ,OACR,CAAK;CAEvB;CAGF,MAAM,6BAAa,IAAI,MAAM,cAAc;AAC7C"}
package/dist/index.d.ts CHANGED
@@ -2,11 +2,12 @@ import { Props } from "./common/props.js";
2
2
  import { Fragment } from "./common/jsx.js";
3
3
  import { State, StateSetter, StateTuple, state } from "./runtime/state.js";
4
4
  import { Context, defineContext, readContext } from "./runtime/context.js";
5
- import { getSignal } from "./runtime/component.js";
5
+ import { getSignal } from "./runtime/component-scope.js";
6
6
  import { For, ForProps } from "./control/for.js";
7
7
  import { Show, ShowProps } from "./control/show.js";
8
8
  import { Case, CaseProps, Match, MatchProps } from "./control/case.js";
9
+ import { AskrRuntime, AskrRuntimeOptions, RuntimeKeyedReorderDecision, RuntimeRendererHost, createRuntime, getDefaultRuntime } from "./runtime/runtime.js";
9
10
  import { Derived, derive } from "./runtime/derive.js";
10
11
  import { Selector, selector } from "./runtime/selector.js";
11
12
  import { jsx, jsxs } from "./jsx-runtime.js";
12
- export { Case, type CaseProps, type Context, type Derived, For, type ForProps, Fragment, Match, type MatchProps, type Props, type Selector, Show, type ShowProps, type State, type StateSetter, type StateTuple, defineContext, derive, getSignal, jsx, jsxs, readContext, selector, state };
13
+ export { AskrRuntime, type AskrRuntimeOptions, Case, type CaseProps, type Context, type Derived, For, type ForProps, Fragment, Match, type MatchProps, type Props, type RuntimeKeyedReorderDecision, type RuntimeRendererHost, type Selector, Show, type ShowProps, type State, type StateSetter, type StateTuple, createRuntime, defineContext, derive, getDefaultRuntime, getSignal, jsx, jsxs, readContext, selector, state };
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ import { AskrRuntime, createRuntime, getDefaultRuntime } from "./runtime/runtime.js";
1
2
  import { Fragment } from "./common/jsx.js";
2
3
  import { defineContext, readContext } from "./runtime/context.js";
3
- import { getSignal } from "./runtime/component.js";
4
+ import { getSignal } from "./runtime/component-scope.js";
5
+ import "./runtime/component.js";
4
6
  import { jsx, jsxs } from "./jsx-runtime.js";
5
7
  import { installRendererBridge } from "./renderer/index.js";
6
8
  import { state } from "./runtime/state.js";
@@ -19,6 +21,6 @@ import "./jsx-runtime2.js";
19
21
  */
20
22
  installRendererBridge();
21
23
  //#endregion
22
- export { Case, For, Fragment, Match, Show, defineContext, derive, getSignal, jsx, jsxs, readContext, selector, state };
24
+ export { AskrRuntime, Case, For, Fragment, Match, Show, createRuntime, defineContext, derive, getDefaultRuntime, getSignal, jsx, jsxs, readContext, selector, state };
23
25
 
24
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Askr: Actor-backed deterministic UI framework\n *\n * Public API surface — only users should import from here\n */\n\nimport { installRendererBridge } from './renderer';\n\ninstallRendererBridge();\n\n// Runtime primitives\nexport { state } from './runtime/state';\nexport type { State, StateSetter, StateTuple } from './runtime/state';\nexport { derive } from './runtime/derive';\nexport type { Derived } from './runtime/derive';\nexport { getSignal } from './runtime/component';\nexport { selector } from './runtime/selector';\nexport type { Selector } from './runtime/selector';\n\n// Control flow\nexport { Case, For, Match, Show } from './control';\nexport type { CaseProps, ForProps, MatchProps, ShowProps } from './control';\n\n// Context\nexport { defineContext, readContext } from './runtime/context';\nexport type { Context } from './runtime/context';\n\n// Re-export JSX runtime for tsconfig jsxImportSource\nexport { jsx, jsxs, Fragment } from './jsx-runtime';\n\n// Public types\nexport type { Props } from './common/props';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,sBAAsB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Askr: Actor-backed deterministic UI framework\n *\n * Public API surface — only users should import from here\n */\n\nimport { installRendererBridge } from './renderer';\n\ninstallRendererBridge();\n\nexport { createRuntime, getDefaultRuntime } from './runtime/runtime';\nexport type {\n AskrRuntimeOptions,\n RuntimeRendererHost,\n RuntimeKeyedReorderDecision,\n} from './runtime/runtime';\nexport { AskrRuntime } from './runtime/runtime';\n\n// Runtime primitives\nexport { state } from './runtime/state';\nexport type { State, StateSetter, StateTuple } from './runtime/state';\nexport { derive } from './runtime/derive';\nexport type { Derived } from './runtime/derive';\nexport { getSignal } from './runtime/component';\nexport { selector } from './runtime/selector';\nexport type { Selector } from './runtime/selector';\n\n// Control flow\nexport { Case, For, Match, Show } from './control';\nexport type { CaseProps, ForProps, MatchProps, ShowProps } from './control';\n\n// Context\nexport { defineContext, readContext } from './runtime/context';\nexport type { Context } from './runtime/context';\n\n// Re-export JSX runtime for tsconfig jsxImportSource\nexport { jsx, jsxs, Fragment } from './jsx-runtime';\n\n// Public types\nexport type { Props } from './common/props';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,sBAAsB"}
@@ -1 +1,2 @@
1
- import { Fragment, JSXElement } from "../common/jsx.js";
1
+ import { Fragment, JSXElement } from "../common/jsx.js";
2
+ export type { JSXElement };
package/dist/jsx/index.js CHANGED
@@ -1,3 +1,4 @@
1
- import "../common/jsx.js";
1
+ import { ELEMENT_TYPE, Fragment } from "../common/jsx.js";
2
2
  import "./types.js";
3
- import "./utils.js";
3
+ import { cloneElement, isElement } from "./utils.js";
4
+ export { ELEMENT_TYPE, Fragment, cloneElement, isElement };
@@ -18,4 +18,6 @@ declare global {
18
18
  }
19
19
  }
20
20
  } //# sourceMappingURL=types.d.ts.map
21
+ //#endregion
22
+ export { Fragment, type JSXElement };
21
23
  //# sourceMappingURL=types.d.ts.map
package/dist/jsx/types.js CHANGED
@@ -1 +1,2 @@
1
- import "../common/jsx.js";
1
+ import { ELEMENT_TYPE, Fragment, STATIC_CHILDREN } from "../common/jsx.js";
2
+ export { ELEMENT_TYPE, Fragment, STATIC_CHILDREN };
@@ -1,2 +1,3 @@
1
1
  import { Fragment, JSXElement } from "./common/jsx.js";
2
- import { jsx, jsxDEV, jsxs } from "./jsx-runtime.js";
2
+ import { jsx, jsxDEV, jsxs } from "./jsx-runtime.js";
3
+ export { Fragment, jsx, jsxs };
@@ -1,3 +1,4 @@
1
- import "./common/jsx.js";
1
+ import { Fragment } from "./common/jsx.js";
2
2
  import "./jsx/types.js";
3
- import "./jsx-runtime.js";
3
+ import { jsx, jsxs } from "./jsx-runtime.js";
4
+ export { Fragment, jsx, jsxs };