@askrjs/askr 0.0.48 → 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 +10 -3
  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 -51
  183. package/dist/router/navigate.d.ts.map +1 -1
  184. package/dist/router/navigate.js +16 -459
  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
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../src/renderer/utils.ts"],"sourcesContent":["/**\n * Shared utilities for the renderer module.\n * Consolidates common patterns to reduce code duplication.\n */\n\nimport { globalScheduler } from '../runtime/scheduler';\nimport { logger } from '../dev/logger';\nimport { getPublicAttributeName } from '../common/attr-names';\nimport { getRuntimeEnv } from './env';\nimport { setDevValue, incDevCounter } from '../runtime/dev-namespace';\n\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\n// Keep direct replaceChildren(...nodes) commits below a conservative argument\n// count until browser benchmarks prove larger spreads are safe.\nexport const DIRECT_REPLACE_CHILDREN_SPREAD_LIMIT = 4096;\n\nexport function canUseDirectReplaceChildrenSpread(count: number): boolean {\n return count <= DIRECT_REPLACE_CHILDREN_SPREAD_LIMIT;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface ListenerEntry {\n handler: EventListener;\n original: EventListener;\n eventName: string;\n options?: boolean | AddEventListenerOptions;\n updateHandler?: (nextHandler: EventListener) => void;\n}\n\nexport interface ParsedEventProp {\n eventName: string;\n capture: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Event Handler Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n// Handler pooling cache to avoid recreating wrapped handlers\n// Key: handler reference, Value: { wrapped: EventListener, flushAfter: boolean }\nconst handlerCache = new WeakMap<EventListener, Map<boolean, EventListener>>();\nlet cacheSize = 0;\nconst MAX_CACHE_SIZE = 1000;\n\n/**\n * Parse an event prop name (e.g., 'onClick') to its DOM event name (e.g., 'click')\n */\nexport function parseEventName(propName: string): string | null {\n return parseEventProp(propName)?.eventName ?? null;\n}\n\nexport function parseEventProp(propName: string): ParsedEventProp | null {\n if (!propName.startsWith('on') || propName.length <= 2) return null;\n const capture =\n propName.endsWith('Capture') && propName.length > 'onCapture'.length;\n const normalizedPropName = capture\n ? propName.slice(0, -'Capture'.length)\n : propName;\n\n return normalizedPropName.length <= 2\n ? null\n : {\n eventName:\n normalizedPropName.slice(2).charAt(0).toLowerCase() +\n normalizedPropName.slice(3).toLowerCase(),\n capture,\n };\n}\n\nexport function getEventListenerKey(\n eventName: string,\n capture = false\n): string {\n return capture ? `${eventName}:capture` : eventName;\n}\n\nexport function getEventListenerOptions(\n eventName: string,\n capture = false\n): AddEventListenerOptions | undefined {\n const passiveOptions = getPassiveOptions(eventName);\n if (!capture) {\n return passiveOptions;\n }\n\n return passiveOptions\n ? { ...passiveOptions, capture: true }\n : { capture: true };\n}\n\n/**\n * Get default event listener options for passive events\n */\nexport function getPassiveOptions(\n eventName: string\n): AddEventListenerOptions | undefined {\n if (\n eventName === 'wheel' ||\n eventName === 'scroll' ||\n eventName.startsWith('touch')\n ) {\n return { passive: true };\n }\n return undefined;\n}\n\n/**\n * Create a wrapped event handler that integrates with the scheduler\n * Uses caching to avoid recreating wrappers for the same handler\n */\nexport function createWrappedHandler(\n handler: EventListener,\n flushAfter = false\n): EventListener {\n // Check cache first\n const cachedByFlush = handlerCache.get(handler);\n if (cachedByFlush) {\n const cached = cachedByFlush.get(flushAfter);\n if (cached) return cached;\n }\n\n const wrapped: EventListener = (event: Event) => {\n try {\n globalScheduler.runInHandlerScope(\n () => {\n try {\n handler(event);\n } catch (error) {\n logger.error('[Askr] Event handler error:', error);\n }\n },\n flushAfter ? 'sync' : 'defer'\n );\n } catch (err) {\n if (flushAfter) {\n queueMicrotask(() => {\n throw err;\n });\n } else {\n logger.error('[Askr] Event handler error:', err);\n }\n }\n };\n\n // Cache the wrapped handler\n try {\n if (!handlerCache.has(handler)) {\n // Limit cache size to prevent memory leaks\n if (cacheSize >= MAX_CACHE_SIZE) {\n // Simple eviction - just don't cache new entries when full\n } else {\n cacheSize++;\n handlerCache.set(handler, new Map());\n }\n }\n handlerCache.get(handler)?.set(flushAfter, wrapped);\n } catch {\n // WeakMap can throw if handler is not a valid key\n }\n\n return wrapped;\n}\n\nexport function createMutableWrappedHandler(\n handler: EventListener,\n flushAfter = false\n): {\n handler: EventListener;\n updateHandler: (nextHandler: EventListener) => void;\n} {\n let currentHandler = handler;\n\n const wrapped: EventListener = (event: Event) => {\n try {\n globalScheduler.runInHandlerScope(\n () => {\n try {\n currentHandler(event);\n } catch (error) {\n logger.error('[Askr] Event handler error:', error);\n }\n },\n flushAfter ? 'sync' : 'defer'\n );\n } catch (err) {\n if (flushAfter) {\n queueMicrotask(() => {\n throw err;\n });\n } else {\n logger.error('[Askr] Event handler error:', err);\n }\n }\n };\n\n return {\n handler: wrapped,\n updateHandler(nextHandler: EventListener) {\n currentHandler = nextHandler;\n },\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Prop/Attribute Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Props that should be skipped during attribute processing */\nexport function isSkippedProp(key: string): boolean {\n return key === 'children' || key === 'key' || key === 'ref';\n}\n\n/** Check if prop should be ignored for prop-change detection */\nexport function isIgnoredForPropChanges(key: string): boolean {\n if (key === 'children' || key === 'key') return true;\n if (key.startsWith('on') && key.length > 2) return true;\n if (key.startsWith('data-')) return true;\n return false;\n}\n\n/**\n * Check if an element's current attribute value differs from vnode value\n */\nexport function hasPropChanged(\n el: Element,\n key: string,\n value: unknown\n): boolean {\n try {\n if (key === 'class' || key === 'className') {\n return readElementClassName(el) !== String(value);\n }\n if (key === 'value' || key === 'checked') {\n return (el as HTMLElement & Record<string, unknown>)[key] !== value;\n }\n const attr = el.getAttribute(getRenderedAttributeName(el, key));\n if (value === undefined || value === null || value === false) {\n return attr !== null;\n }\n return String(value) !== attr;\n } catch {\n return true;\n }\n}\n\nexport function isSVGDomElement(el: Element): el is SVGElement {\n return typeof SVGElement !== 'undefined' && el instanceof SVGElement;\n}\n\nexport function getRenderedAttributeName(\n el: Element,\n propName: string\n): string {\n const attributeName = getPublicAttributeName(propName);\n\n return el.namespaceURI === SVG_NAMESPACE\n ? attributeName\n : attributeName.toLowerCase();\n}\n\nexport function setRenderedAttribute(\n el: Element,\n propName: string,\n value: string\n): void {\n el.setAttribute(getRenderedAttributeName(el, propName), value);\n}\n\nexport function removeRenderedAttribute(el: Element, propName: string): void {\n el.removeAttribute(getRenderedAttributeName(el, propName));\n}\n\nexport function readElementClassName(el: Element): string {\n if (isSVGDomElement(el)) {\n return el.getAttribute('class') ?? '';\n }\n\n return (el as HTMLElement).className;\n}\n\nexport function writeElementClassName(el: Element, value: string): void {\n if (isSVGDomElement(el)) {\n if (value.length > 0) {\n el.setAttribute('class', value);\n } else {\n el.removeAttribute('class');\n }\n return;\n }\n\n (el as HTMLElement).className = value;\n}\n\nexport function tagNamesEqualIgnoreCase(a: string, b: string): boolean {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n\n for (let index = 0; index < a.length; index += 1) {\n const aCode = a.charCodeAt(index);\n const bCode = b.charCodeAt(index);\n if (aCode === bCode) continue;\n\n const normalizedA = aCode >= 65 && aCode <= 90 ? aCode + 32 : aCode;\n const normalizedB = bCode >= 65 && bCode <= 90 ? bCode + 32 : bCode;\n if (normalizedA !== normalizedB) return false;\n }\n\n return true;\n}\n\n/**\n * Check if a vnode has non-trivial props (excluding events and data-*)\n */\nexport function hasNonTrivialProps(props: Record<string, unknown>): boolean {\n for (const k of Object.keys(props)) {\n if (isIgnoredForPropChanges(k)) continue;\n return true;\n }\n return false;\n}\n\n/**\n * Check for prop changes between vnode and existing element\n */\nexport function checkPropChanges(\n el: Element,\n props: Record<string, unknown>\n): boolean {\n for (const k of Object.keys(props)) {\n if (isIgnoredForPropChanges(k)) continue;\n if (hasPropChanged(el, k, props[k])) {\n return true;\n }\n }\n return false;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Key Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Extract key from a vnode object\n */\nexport function extractKey(vnode: unknown): string | number | undefined {\n if (typeof vnode !== 'object' || vnode === null) return undefined;\n const obj = vnode as Record<string, unknown>;\n const rawKey =\n obj.key ?? (obj.props as Record<string, unknown> | undefined)?.key;\n if (rawKey === undefined || rawKey === null) return undefined;\n return typeof rawKey === 'symbol'\n ? String(rawKey)\n : (rawKey as string | number);\n}\n\n/**\n * Build a key map from element's children\n */\nexport function buildKeyMapFromChildren(\n parent: Element\n): Map<string | number, Element> {\n const map = new Map<string | number, Element>();\n for (let ch = parent.firstElementChild; ch; ch = ch.nextElementSibling) {\n const k = ch.getAttribute('data-key');\n if (k !== null) {\n map.set(k, ch);\n const n = Number(k);\n if (!Number.isNaN(n)) map.set(n, ch);\n }\n }\n return map;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Diagnostic Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Record DOM replace operation for diagnostics\n */\nexport function recordDOMReplace(source: string): void {\n try {\n incDevCounter('__DOM_REPLACE_COUNT');\n setDevValue(`__LAST_DOM_REPLACE_STACK_${source}`, new Error().stack);\n } catch {\n // ignore\n }\n}\n\n/**\n * Record fast-path stats for diagnostics\n */\nexport function recordFastPathStats(\n stats: Record<string, unknown>,\n counterName?: string\n): void {\n try {\n setDevValue('__LAST_FASTPATH_STATS', stats);\n setDevValue('__LAST_FASTPATH_COMMIT_COUNT', 1);\n if (counterName) {\n incDevCounter(counterName);\n }\n } catch {\n // ignore\n }\n}\n\n/**\n * Conditionally log debug info for fast-path operations\n */\nexport function logFastPathDebug(\n message: string,\n indexOrData?: number | unknown,\n data?: unknown\n): void {\n const env = getRuntimeEnv();\n if (env.ASKR_FASTPATH_DEBUG === '1' || env.ASKR_FASTPATH_DEBUG === 'true') {\n if (data !== undefined) {\n logger.warn(`[Askr][FASTPATH] ${message}`, indexOrData, data);\n } else if (indexOrData !== undefined) {\n logger.warn(`[Askr][FASTPATH] ${message}`, indexOrData);\n } else {\n logger.warn(`[Askr][FASTPATH] ${message}`);\n }\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Performance Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Get current high-resolution timestamp\n */\nexport function now(): number {\n return typeof performance !== 'undefined' && performance.now\n ? performance.now()\n : Date.now();\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,gBAAgB;AAItB,MAAa,uCAAuC;AAEpD,SAAgB,kCAAkC,OAAwB;CACxE,OAAO,SAAS;AAClB;AAyBA,MAAM,+BAAe,IAAI,QAAoD;AAC7E,IAAI,YAAY;AAChB,MAAM,iBAAiB;;;;AAKvB,SAAgB,eAAe,UAAiC;CAC9D,OAAO,eAAe,QAAQ,CAAC,EAAE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BAAoB,WAAW,aAAa,IAAI;MACvD,IAAI,gBAAgB,QACzB,OAAO,KAAK,oBAAoB,WAAW,WAAW;MAEtD,OAAO,KAAK,oBAAoB,SAAS;AAG/C;;;;AASA,SAAgB,MAAc;CAC5B,OAAO,OAAO,gBAAgB,eAAe,YAAY,MACrD,YAAY,IAAI,IAChB,KAAK,IAAI;AACf"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/renderer/utils.ts"],"sourcesContent":["/**\n * Shared utilities for the renderer module.\n * Consolidates common patterns to reduce code duplication.\n */\n\nimport { runRuntimeHandlerScope } from '../runtime/access';\nimport { logger } from '../dev/logger';\nimport { getPublicAttributeName } from '../common/attr-names';\nimport { getRuntimeEnv } from './env';\nimport { setDevValue, incDevCounter } from '../runtime/dev-namespace';\n\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\n// Keep direct replaceChildren(...nodes) commits below a conservative argument\n// count until browser benchmarks prove larger spreads are safe.\nexport const DIRECT_REPLACE_CHILDREN_SPREAD_LIMIT = 4096;\n\nexport function canUseDirectReplaceChildrenSpread(count: number): boolean {\n return count <= DIRECT_REPLACE_CHILDREN_SPREAD_LIMIT;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface ListenerEntry {\n handler: EventListener;\n original: EventListener;\n eventName: string;\n options?: boolean | AddEventListenerOptions;\n updateHandler?: (nextHandler: EventListener) => void;\n}\n\nexport interface ParsedEventProp {\n eventName: string;\n capture: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Event Handler Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n// Handler pooling cache to avoid recreating wrapped handlers\n// Key: handler reference, Value: { wrapped: EventListener, flushAfter: boolean }\nconst handlerCache = new WeakMap<EventListener, Map<boolean, EventListener>>();\nlet cacheSize = 0;\nconst MAX_CACHE_SIZE = 1000;\n\n/**\n * Parse an event prop name (e.g., 'onClick') to its DOM event name (e.g., 'click')\n */\nexport function parseEventName(propName: string): string | null {\n return parseEventProp(propName)?.eventName ?? null;\n}\n\nexport function parseEventProp(propName: string): ParsedEventProp | null {\n if (!propName.startsWith('on') || propName.length <= 2) return null;\n const capture =\n propName.endsWith('Capture') && propName.length > 'onCapture'.length;\n const normalizedPropName = capture\n ? propName.slice(0, -'Capture'.length)\n : propName;\n\n return normalizedPropName.length <= 2\n ? null\n : {\n eventName:\n normalizedPropName.slice(2).charAt(0).toLowerCase() +\n normalizedPropName.slice(3).toLowerCase(),\n capture,\n };\n}\n\nexport function getEventListenerKey(\n eventName: string,\n capture = false\n): string {\n return capture ? `${eventName}:capture` : eventName;\n}\n\nexport function getEventListenerOptions(\n eventName: string,\n capture = false\n): AddEventListenerOptions | undefined {\n const passiveOptions = getPassiveOptions(eventName);\n if (!capture) {\n return passiveOptions;\n }\n\n return passiveOptions\n ? { ...passiveOptions, capture: true }\n : { capture: true };\n}\n\n/**\n * Get default event listener options for passive events\n */\nexport function getPassiveOptions(\n eventName: string\n): AddEventListenerOptions | undefined {\n if (\n eventName === 'wheel' ||\n eventName === 'scroll' ||\n eventName.startsWith('touch')\n ) {\n return { passive: true };\n }\n return undefined;\n}\n\n/**\n * Create a wrapped event handler that integrates with the scheduler\n * Uses caching to avoid recreating wrappers for the same handler\n */\nexport function createWrappedHandler(\n handler: EventListener,\n flushAfter = false\n): EventListener {\n // Check cache first\n const cachedByFlush = handlerCache.get(handler);\n if (cachedByFlush) {\n const cached = cachedByFlush.get(flushAfter);\n if (cached) return cached;\n }\n\n const wrapped: EventListener = (event: Event) => {\n try {\n runRuntimeHandlerScope(\n () => {\n try {\n handler(event);\n } catch (error) {\n logger.error('[Askr] Event handler error:', error);\n }\n },\n flushAfter ? 'sync' : 'defer'\n );\n } catch (err) {\n if (flushAfter) {\n queueMicrotask(() => {\n throw err;\n });\n } else {\n logger.error('[Askr] Event handler error:', err);\n }\n }\n };\n\n // Cache the wrapped handler\n try {\n if (!handlerCache.has(handler)) {\n // Limit cache size to prevent memory leaks\n if (cacheSize >= MAX_CACHE_SIZE) {\n // Simple eviction - just don't cache new entries when full\n } else {\n cacheSize++;\n handlerCache.set(handler, new Map());\n }\n }\n handlerCache.get(handler)?.set(flushAfter, wrapped);\n } catch {\n // WeakMap can throw if handler is not a valid key\n }\n\n return wrapped;\n}\n\nexport function createMutableWrappedHandler(\n handler: EventListener,\n flushAfter = false\n): {\n handler: EventListener;\n updateHandler: (nextHandler: EventListener) => void;\n} {\n let currentHandler = handler;\n\n const wrapped: EventListener = (event: Event) => {\n try {\n runRuntimeHandlerScope(\n () => {\n try {\n currentHandler(event);\n } catch (error) {\n logger.error('[Askr] Event handler error:', error);\n }\n },\n flushAfter ? 'sync' : 'defer'\n );\n } catch (err) {\n if (flushAfter) {\n queueMicrotask(() => {\n throw err;\n });\n } else {\n logger.error('[Askr] Event handler error:', err);\n }\n }\n };\n\n return {\n handler: wrapped,\n updateHandler(nextHandler: EventListener) {\n currentHandler = nextHandler;\n },\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Prop/Attribute Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Props that should be skipped during attribute processing */\nexport function isSkippedProp(key: string): boolean {\n return key === 'children' || key === 'key' || key === 'ref';\n}\n\n/** Check if prop should be ignored for prop-change detection */\nexport function isIgnoredForPropChanges(key: string): boolean {\n if (key === 'children' || key === 'key') return true;\n if (key.startsWith('on') && key.length > 2) return true;\n if (key.startsWith('data-')) return true;\n return false;\n}\n\n/**\n * Check if an element's current attribute value differs from vnode value\n */\nexport function hasPropChanged(\n el: Element,\n key: string,\n value: unknown\n): boolean {\n try {\n if (key === 'class' || key === 'className') {\n return readElementClassName(el) !== String(value);\n }\n if (key === 'value' || key === 'checked') {\n return (el as HTMLElement & Record<string, unknown>)[key] !== value;\n }\n const attr = el.getAttribute(getRenderedAttributeName(el, key));\n if (value === undefined || value === null || value === false) {\n return attr !== null;\n }\n return String(value) !== attr;\n } catch {\n return true;\n }\n}\n\nexport function isSVGDomElement(el: Element): el is SVGElement {\n return typeof SVGElement !== 'undefined' && el instanceof SVGElement;\n}\n\nexport function getRenderedAttributeName(\n el: Element,\n propName: string\n): string {\n const attributeName = getPublicAttributeName(propName);\n\n return el.namespaceURI === SVG_NAMESPACE\n ? attributeName\n : attributeName.toLowerCase();\n}\n\nexport function setRenderedAttribute(\n el: Element,\n propName: string,\n value: string\n): void {\n el.setAttribute(getRenderedAttributeName(el, propName), value);\n}\n\nexport function removeRenderedAttribute(el: Element, propName: string): void {\n el.removeAttribute(getRenderedAttributeName(el, propName));\n}\n\nexport function readElementClassName(el: Element): string {\n if (isSVGDomElement(el)) {\n return el.getAttribute('class') ?? '';\n }\n\n return (el as HTMLElement).className;\n}\n\nexport function writeElementClassName(el: Element, value: string): void {\n if (isSVGDomElement(el)) {\n if (value.length > 0) {\n el.setAttribute('class', value);\n } else {\n el.removeAttribute('class');\n }\n return;\n }\n\n (el as HTMLElement).className = value;\n}\n\nexport function tagNamesEqualIgnoreCase(a: string, b: string): boolean {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n\n for (let index = 0; index < a.length; index += 1) {\n const aCode = a.charCodeAt(index);\n const bCode = b.charCodeAt(index);\n if (aCode === bCode) continue;\n\n const normalizedA = aCode >= 65 && aCode <= 90 ? aCode + 32 : aCode;\n const normalizedB = bCode >= 65 && bCode <= 90 ? bCode + 32 : bCode;\n if (normalizedA !== normalizedB) return false;\n }\n\n return true;\n}\n\n/**\n * Check if a vnode has non-trivial props (excluding events and data-*)\n */\nexport function hasNonTrivialProps(props: Record<string, unknown>): boolean {\n for (const k of Object.keys(props)) {\n if (isIgnoredForPropChanges(k)) continue;\n return true;\n }\n return false;\n}\n\n/**\n * Check for prop changes between vnode and existing element\n */\nexport function checkPropChanges(\n el: Element,\n props: Record<string, unknown>\n): boolean {\n for (const k of Object.keys(props)) {\n if (isIgnoredForPropChanges(k)) continue;\n if (hasPropChanged(el, k, props[k])) {\n return true;\n }\n }\n return false;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Key Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Extract key from a vnode object\n */\nexport function extractKey(vnode: unknown): string | number | undefined {\n if (typeof vnode !== 'object' || vnode === null) return undefined;\n const obj = vnode as Record<string, unknown>;\n const rawKey =\n obj.key ?? (obj.props as Record<string, unknown> | undefined)?.key;\n if (rawKey === undefined || rawKey === null) return undefined;\n return typeof rawKey === 'symbol'\n ? String(rawKey)\n : (rawKey as string | number);\n}\n\n/**\n * Build a key map from element's children\n */\nexport function buildKeyMapFromChildren(\n parent: Element\n): Map<string | number, Element> {\n const map = new Map<string | number, Element>();\n for (let ch = parent.firstElementChild; ch; ch = ch.nextElementSibling) {\n const k = ch.getAttribute('data-key');\n if (k !== null) {\n map.set(k, ch);\n const n = Number(k);\n if (!Number.isNaN(n)) map.set(n, ch);\n }\n }\n return map;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Diagnostic Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Record DOM replace operation for diagnostics\n */\nexport function recordDOMReplace(source: string): void {\n try {\n incDevCounter('__DOM_REPLACE_COUNT');\n setDevValue(`__LAST_DOM_REPLACE_STACK_${source}`, new Error().stack);\n } catch {\n // ignore\n }\n}\n\n/**\n * Record fast-path stats for diagnostics\n */\nexport function recordFastPathStats(\n stats: Record<string, unknown>,\n counterName?: string\n): void {\n try {\n setDevValue('__LAST_FASTPATH_STATS', stats);\n setDevValue('__LAST_FASTPATH_COMMIT_COUNT', 1);\n if (counterName) {\n incDevCounter(counterName);\n }\n } catch {\n // ignore\n }\n}\n\n/**\n * Conditionally log debug info for fast-path operations\n */\nexport function logFastPathDebug(\n message: string,\n indexOrData?: number | unknown,\n data?: unknown\n): void {\n const env = getRuntimeEnv();\n if (env.ASKR_FASTPATH_DEBUG === '1' || env.ASKR_FASTPATH_DEBUG === 'true') {\n if (data !== undefined) {\n logger.warn(`[Askr][FASTPATH] ${message}`, indexOrData, data);\n } else if (indexOrData !== undefined) {\n logger.warn(`[Askr][FASTPATH] ${message}`, indexOrData);\n } else {\n logger.warn(`[Askr][FASTPATH] ${message}`);\n }\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Performance Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Get current high-resolution timestamp\n */\nexport function now(): number {\n return typeof performance !== 'undefined' && performance.now\n ? performance.now()\n : Date.now();\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,gBAAgB;AAItB,MAAa,uCAAuC;AAEpD,SAAgB,kCAAkC,OAAwB;CACxE,OAAO,SAAS;AAClB;AAyBA,MAAM,+BAAe,IAAI,QAAoD;AAC7E,IAAI,YAAY;AAChB,MAAM,iBAAiB;;;;AAKvB,SAAgB,eAAe,UAAiC;CAC9D,OAAO,eAAe,QAAQ,CAAC,EAAE,aAAa;AAChD;AAEA,SAAgB,eAAe,UAA0C;CACvE,IAAI,CAAC,SAAS,WAAW,IAAI,KAAK,SAAS,UAAU,GAAG,OAAO;CAC/D,MAAM,UACJ,SAAS,SAAS,SAAS,KAAK,SAAS,SAAS;CACpD,MAAM,qBAAqB,UACvB,SAAS,MAAM,GAAG,EAAiB,IACnC;CAEJ,OAAO,mBAAmB,UAAU,IAChC,OACA;EACE,WACE,mBAAmB,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,IAClD,mBAAmB,MAAM,CAAC,CAAC,CAAC,YAAY;EAC1C;CACF;AACN;AAEA,SAAgB,oBACd,WACA,UAAU,OACF;CACR,OAAO,UAAU,GAAG,UAAU,YAAY;AAC5C;AAEA,SAAgB,wBACd,WACA,UAAU,OAC2B;CACrC,MAAM,iBAAiB,kBAAkB,SAAS;CAClD,IAAI,CAAC,SACH,OAAO;CAGT,OAAO,iBACH;EAAE,GAAG;EAAgB,SAAS;CAAK,IACnC,EAAE,SAAS,KAAK;AACtB;;;;AAKA,SAAgB,kBACd,WACqC;CACrC,IACE,c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ClB,IAAI,CAAC,OAAO,MAAM,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE;EACrC;CACF;CACA,OAAO;AACT;;;;AASA,SAAgB,iBAAiB,QAAsB;CACrD,IAAI;EACF,cAAc,qBAAqB;EACnC,YAAY,4BAA4B,2BAAU,IAAI,MAAM,EAAC,CAAC,KAAK;CACrE,QAAQ,CAER;AACF;;;;AAKA,SAAgB,oBACd,OACA,aACM;CACN,IAAI;EACF,YAAY,yBAAyB,KAAK;EAC1C,YAAY,gCAAgC,CAAC;EAC7C,IAAI,aACF,cAAc,WAAW;CAE7B,QAAQ,CAER;AACF;;;;AAKA,SAAgB,iBACd,SACA,aACA,MACM;CACN,MAAM,MAAM,cAAc;CAC1B,IAAI,IAAI,wBAAwB,OAAO,IAAI,wBAAwB,QACjE,IAAI,SAAS,QACX,OAAO,KAAK,oBAAoB,WAAW,aAAa,IAAI;MACvD,IAAI,gBAAgB,QACzB,OAAO,KAAK,oBAAoB,WAAW,WAAW;MAEtD,OAAO,KAAK,oBAAoB,SAAS;AAG/C;;;;AASA,SAAgB,MAAc;CAC5B,OAAO,OAAO,gBAAgB,eAAe,YAAY,MACrD,YAAY,IAAI,IAChB,KAAK,IAAI;AACf"}
@@ -1,3 +1,4 @@
1
- import { getSignal } from "../runtime/component.js";
2
- import { ActivityPredicate, ResourceResult, TimerOptions, capture, documentVisible, on, resource, routeActive, stream, task, timer, windowFocused } from "../runtime/operations.js";
1
+ import { getSignal } from "../runtime/component-scope.js";
2
+ import { ResourceResult, resource } from "../runtime/resource-operation.js";
3
+ import { ActivityPredicate, TimerOptions, capture, documentVisible, on, routeActive, stream, task, timer, windowFocused } from "../runtime/lifecycle-operations.js";
3
4
  export { type ActivityPredicate, type ResourceResult, type TimerOptions, capture, documentVisible, getSignal, on, resource, routeActive, stream, task, timer, windowFocused };
@@ -1,3 +1,6 @@
1
- import { getSignal } from "../runtime/component.js";
2
- import { capture, documentVisible, on, resource, routeActive, stream, task, timer, windowFocused } from "../runtime/operations.js";
1
+ import { getSignal } from "../runtime/component-scope.js";
2
+ import "../runtime/component.js";
3
+ import { resource } from "../runtime/resource-operation.js";
4
+ import { capture, documentVisible, on, routeActive, stream, task, timer, windowFocused } from "../runtime/lifecycle-operations.js";
5
+ import "../runtime/operations.js";
3
6
  export { capture, documentVisible, getSignal, on, resource, routeActive, stream, task, timer, windowFocused };
@@ -0,0 +1,36 @@
1
+ import { requireAuth, requireGuest, requirePermission, requireRole } from "./policy.js";
2
+ //#region src/router/access.ts
3
+ function hasBuiltInAuthMetadata(node) {
4
+ return node.auth !== void 0 || !!node.role || !!node.permission;
5
+ }
6
+ function validateSameNodeAccessMetadata(node) {
7
+ if (node.auth === "guest" && (!!node.role || !!node.permission)) throw new Error("Guest-only routes cannot be combined with role or permission requirements.");
8
+ }
9
+ function validateAccessMetadata(node, context) {
10
+ validateSameNodeAccessMetadata(node);
11
+ const requiresAuthenticated = node.auth === true || !!node.role || !!node.permission;
12
+ if (node.auth === "guest" && (context.state.authenticated || !!node.role || !!node.permission)) throw new Error("Guest-only routes cannot be combined with authenticated access requirements.");
13
+ if (context.state.guestOnly && requiresAuthenticated) throw new Error("Child routes cannot weaken a guest-only access scope with authenticated requirements.");
14
+ if (hasBuiltInAuthMetadata(node) && !context.authConfigured) throw new Error("Routes using `auth`, `role`, or `permission` require `auth.resolve` in registerRoutes(...).");
15
+ }
16
+ function nextAccessScopeState(node, state) {
17
+ const requiresAuthenticated = node.auth === true || !!node.role || !!node.permission;
18
+ return {
19
+ guestOnly: state.guestOnly || node.auth === "guest",
20
+ authenticated: state.authenticated || requiresAuthenticated
21
+ };
22
+ }
23
+ function compileNodePolicies(node) {
24
+ validateSameNodeAccessMetadata(node);
25
+ const compiled = [];
26
+ if (node.auth === true) compiled.push(requireAuth());
27
+ else if (node.auth === "guest") compiled.push(requireGuest());
28
+ if (node.role) compiled.push(requireRole(node.role));
29
+ if (node.permission) compiled.push(requirePermission(node.permission));
30
+ if (node.policies?.length) compiled.push(...node.policies);
31
+ return compiled;
32
+ }
33
+ //#endregion
34
+ export { compileNodePolicies, nextAccessScopeState, validateAccessMetadata };
35
+
36
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","names":[],"sources":["../../src/router/access.ts"],"sourcesContent":["import type {\n GroupHelperOptions,\n RouteOptions,\n RoutePolicy,\n} from '../common/router';\nimport {\n requireAuth,\n requireGuest,\n requirePermission,\n requireRole,\n} from './policy';\nimport type { AccessScopeState } from './internal-types';\n\nfunction hasBuiltInAuthMetadata(\n node: Pick<GroupHelperOptions | RouteOptions, 'auth' | 'role' | 'permission'>\n): boolean {\n return node.auth !== undefined || !!node.role || !!node.permission;\n}\n\nfunction validateSameNodeAccessMetadata(\n node: Pick<GroupHelperOptions | RouteOptions, 'auth' | 'role' | 'permission'>\n): void {\n if (node.auth === 'guest' && (!!node.role || !!node.permission)) {\n throw new Error(\n 'Guest-only routes cannot be combined with role or permission requirements.'\n );\n }\n}\n\nexport function validateAccessMetadata(\n node: Pick<GroupHelperOptions | RouteOptions, 'auth' | 'role' | 'permission'>,\n context: {\n authConfigured: boolean;\n state: AccessScopeState;\n }\n): void {\n validateSameNodeAccessMetadata(node);\n\n const requiresAuthenticated =\n node.auth === true || !!node.role || !!node.permission;\n\n if (\n node.auth === 'guest' &&\n (context.state.authenticated || !!node.role || !!node.permission)\n ) {\n throw new Error(\n 'Guest-only routes cannot be combined with authenticated access requirements.'\n );\n }\n\n if (context.state.guestOnly && requiresAuthenticated) {\n throw new Error(\n 'Child routes cannot weaken a guest-only access scope with authenticated requirements.'\n );\n }\n\n if (hasBuiltInAuthMetadata(node) && !context.authConfigured) {\n throw new Error(\n 'Routes using `auth`, `role`, or `permission` require `auth.resolve` in registerRoutes(...).'\n );\n }\n}\n\nexport function nextAccessScopeState(\n node: Pick<GroupHelperOptions | RouteOptions, 'auth' | 'role' | 'permission'>,\n state: AccessScopeState\n): AccessScopeState {\n const requiresAuthenticated =\n node.auth === true || !!node.role || !!node.permission;\n\n return {\n guestOnly: state.guestOnly || node.auth === 'guest',\n authenticated: state.authenticated || requiresAuthenticated,\n };\n}\n\nexport function compileNodePolicies(\n node: Pick<\n RouteOptions | GroupHelperOptions,\n 'auth' | 'role' | 'permission' | 'policies'\n >\n): RoutePolicy[] {\n validateSameNodeAccessMetadata(node);\n\n const compiled: RoutePolicy[] = [];\n\n if (node.auth === true) {\n compiled.push(requireAuth());\n } else if (node.auth === 'guest') {\n compiled.push(requireGuest());\n }\n\n if (node.role) {\n compiled.push(requireRole(node.role));\n }\n\n if (node.permission) {\n compiled.push(requirePermission(node.permission));\n }\n\n if (node.policies?.length) {\n compiled.push(...node.policies);\n }\n\n return compiled;\n}\n"],"mappings":";;AAaA,SAAS,uBACP,MACS;CACT,OAAO,KAAK,SAAS,UAAa,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK;AAC1D;AAEA,SAAS,+BACP,MACM;CACN,IAAI,KAAK,SAAS,YAAY,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK,aAClD,MAAM,IAAI,MACR,4EACF;AAEJ;AAEA,SAAgB,uBACd,MACA,SAIM;CACN,+BAA+B,IAAI;CAEnC,MAAM,wBACJ,KAAK,SAAS,QAAQ,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK;CAE9C,IACE,KAAK,SAAS,YACb,QAAQ,MAAM,iBAAiB,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK,aAEtD,MAAM,IAAI,MACR,8EACF;CAGF,IAAI,QAAQ,MAAM,aAAa,uBAC7B,MAAM,IAAI,MACR,uFACF;CAGF,IAAI,uBAAuB,IAAI,KAAK,CAAC,QAAQ,gBAC3C,MAAM,IAAI,MACR,6FACF;AAEJ;AAEA,SAAgB,qBACd,MACA,OACkB;CAClB,MAAM,wBACJ,KAAK,SAAS,QAAQ,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK;CAE9C,OAAO;EACL,WAAW,MAAM,aAAa,KAAK,SAAS;EAC5C,eAAe,MAAM,iBAAiB;CACxC;AACF;AAEA,SAAgB,oBACd,MAIe;CACf,+BAA+B,IAAI;CAEnC,MAAM,WAA0B,CAAC;CAEjC,IAAI,KAAK,SAAS,MAChB,SAAS,KAAK,YAAY,CAAC;MACtB,IAAI,KAAK,SAAS,SACvB,SAAS,KAAK,aAAa,CAAC;CAG9B,IAAI,KAAK,MACP,SAAS,KAAK,YAAY,KAAK,IAAI,CAAC;CAGtC,IAAI,KAAK,YACP,SAAS,KAAK,kBAAkB,KAAK,UAAU,CAAC;CAGlD,IAAI,KAAK,UAAU,QACjB,SAAS,KAAK,GAAG,KAAK,QAAQ;CAGhC,OAAO;AACT"}
@@ -0,0 +1,10 @@
1
+ import { RouteMatch, RouteParams, RouteSnapshot } from "../common/router.js";
2
+
3
+ //#region src/router/activity.d.ts
4
+ declare function setServerLocation(url: string | null): void;
5
+ declare function isRoutePathActive(pathOrPaths: string | readonly string[]): boolean;
6
+ declare function currentRoute<TParams extends RouteParams = RouteParams>(): RouteSnapshot<TParams>;
7
+ declare function syncCurrentRouteSnapshot(pathname: string, search: string, hash: string, activityMatches?: readonly RouteMatch[]): void;
8
+ //#endregion
9
+ export { currentRoute };
10
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.d.ts","names":[],"sources":["../../src/router/activity.ts"],"mappings":";;;iBAyBgB,iBAAA,CAAkB,GAAkB;AAAA,iBA6DpC,iBAAA,CACd,WAAuC;AAAA,iBA8EzB,YAAA,iBACE,WAAA,GAAc,WAAA,KAC3B,aAAA,CAAc,OAAA;AAAA,iBAiBH,wBAAA,CACd,QAAA,UACA,MAAA,UACA,IAAA,UACA,eAAA,YAA2B,UAAU"}
@@ -0,0 +1,89 @@
1
+ import { markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, notifyReadableReaders, recordReadableRead } from "../runtime/readable.js";
2
+ import { getCurrentComponentInstance } from "../runtime/component-scope.js";
3
+ import "../runtime/component.js";
4
+ import { getActiveRenderContext } from "../common/render-context.js";
5
+ import { getActiveRoutes } from "./store.js";
6
+ import { syncRouteActivitySnapshot } from "../common/route-activity.js";
7
+ import { deepFreeze, makeQuery, parseLocation } from "./route-context.js";
8
+ import { computeMatchesFromRoutes } from "./resolution.js";
9
+ //#region src/router/activity.ts
10
+ let currentRouteSnapshot = buildRouteSnapshot("/", "", "");
11
+ const currentRouteSource = (() => currentRouteSnapshot);
12
+ currentRouteSource._readers = /* @__PURE__ */ new Map();
13
+ let serverLocation = null;
14
+ function setServerLocation(url) {
15
+ serverLocation = url;
16
+ if (url) {
17
+ const parsed = parseLocation(url);
18
+ syncRouteActivitySnapshot(parsed.pathname, computeMatchesFromRoutes(parsed.pathname, getActiveRoutes()));
19
+ return;
20
+ }
21
+ syncRouteActivitySnapshot(currentRouteSnapshot.path, currentRouteSnapshot.matches);
22
+ }
23
+ function buildRouteSnapshot(pathname, search, hash) {
24
+ const query = makeQuery(search);
25
+ const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
26
+ return Object.freeze({
27
+ path: pathname,
28
+ params: deepFreeze({ ...matches[0]?.params }),
29
+ query,
30
+ hash: hash || null,
31
+ matches: Object.freeze(matches)
32
+ });
33
+ }
34
+ function setCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
35
+ currentRouteSnapshot = buildRouteSnapshot(pathname, search, hash);
36
+ syncRouteActivitySnapshot(pathname, activityMatches ?? currentRouteSnapshot.matches);
37
+ const instance = getCurrentComponentInstance();
38
+ markReadableDerivedSubscribersDirty(currentRouteSource);
39
+ markReactivePropsDirtySource(currentRouteSource);
40
+ notifyReadableReaders(currentRouteSource, instance);
41
+ }
42
+ function readCurrentRouteSnapshot() {
43
+ const instance = getCurrentComponentInstance();
44
+ if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
45
+ let pathname = "/";
46
+ let search = "";
47
+ let hash = "";
48
+ const renderContext = getActiveRenderContext();
49
+ if (instance.ssr && renderContext?.url) {
50
+ const parsed = parseLocation(renderContext.url);
51
+ pathname = parsed.pathname;
52
+ search = parsed.search;
53
+ hash = parsed.hash;
54
+ } else if (typeof window !== "undefined" && window.location) {
55
+ pathname = window.location.pathname || "/";
56
+ search = window.location.search || "";
57
+ hash = window.location.hash || "";
58
+ } else if (serverLocation) {
59
+ const parsed = parseLocation(serverLocation);
60
+ pathname = parsed.pathname;
61
+ search = parsed.search;
62
+ hash = parsed.hash;
63
+ }
64
+ const query = makeQuery(search);
65
+ const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
66
+ const instanceParams = instance.props;
67
+ const params = deepFreeze({ ...Object.keys(instanceParams).length > 0 ? instanceParams : matches[0]?.params ?? {} });
68
+ return Object.freeze({
69
+ path: pathname,
70
+ params,
71
+ query,
72
+ hash: hash || null,
73
+ matches: Object.freeze(matches)
74
+ });
75
+ }
76
+ function currentRoute() {
77
+ const instance = getCurrentComponentInstance();
78
+ if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
79
+ if (typeof window === "undefined" || instance.ssr) return readCurrentRouteSnapshot();
80
+ recordReadableRead(currentRouteSource);
81
+ return readCurrentRouteSnapshot();
82
+ }
83
+ function syncCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
84
+ setCurrentRouteSnapshot(pathname, search, hash, activityMatches);
85
+ }
86
+ //#endregion
87
+ export { currentRoute, setServerLocation, syncCurrentRouteSnapshot };
88
+
89
+ //# sourceMappingURL=activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.js","names":[],"sources":["../../src/router/activity.ts"],"sourcesContent":["import type { RouteMatch, RouteParams, RouteSnapshot } from '../common/router';\nimport { syncRouteActivitySnapshot } from '../common/route-activity';\nimport { getActiveRenderContext } from '../common/render-context';\nimport { getCurrentComponentInstance } from '../runtime/component';\nimport {\n markReadableDerivedSubscribersDirty,\n markReactivePropsDirtySource,\n notifyReadableReaders,\n recordReadableRead,\n type ReadableSource,\n} from '../runtime/readable';\nimport { deepFreeze, makeQuery, parseLocation } from './route-context';\nimport { computeMatchesFromRoutes } from './resolution';\nimport { getActiveRoutes } from './store';\n\nlet currentRouteSnapshot = buildRouteSnapshot('/', '', '');\n\nconst currentRouteSource = (() =>\n currentRouteSnapshot) as ReadableSource<RouteSnapshot> &\n (() => RouteSnapshot);\n\ncurrentRouteSource._readers = new Map();\n\nlet serverLocation: string | null = null;\n\nexport function setServerLocation(url: string | null): void {\n serverLocation = url;\n if (url) {\n const parsed = parseLocation(url);\n syncRouteActivitySnapshot(\n parsed.pathname,\n computeMatchesFromRoutes(parsed.pathname, getActiveRoutes())\n );\n return;\n }\n\n syncRouteActivitySnapshot(\n currentRouteSnapshot.path,\n currentRouteSnapshot.matches\n );\n}\n\nfunction buildRouteSnapshot(\n pathname: string,\n search: string,\n hash: string\n): RouteSnapshot {\n const query = makeQuery(search);\n const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());\n\n return Object.freeze({\n path: pathname,\n params: deepFreeze({ ...matches[0]?.params }),\n query,\n hash: hash || null,\n matches: Object.freeze(matches),\n });\n}\n\nfunction setCurrentRouteSnapshot(\n pathname: string,\n search: string,\n hash: string,\n activityMatches?: readonly RouteMatch[]\n): void {\n currentRouteSnapshot = buildRouteSnapshot(pathname, search, hash);\n syncRouteActivitySnapshot(\n pathname,\n activityMatches ?? currentRouteSnapshot.matches\n );\n\n const instance = getCurrentComponentInstance();\n markReadableDerivedSubscribersDirty(currentRouteSource);\n markReactivePropsDirtySource(currentRouteSource);\n notifyReadableReaders(currentRouteSource, instance);\n}\n\nfunction normalizeRouteActivityPath(path: string): string {\n const parsed = parseLocation(path);\n const pathname = parsed.pathname || '/';\n const absolutePathname = pathname.startsWith('/') ? pathname : `/${pathname}`;\n return absolutePathname.endsWith('/') && absolutePathname !== '/'\n ? absolutePathname.slice(0, -1)\n : absolutePathname;\n}\n\nexport function isRoutePathActive(\n pathOrPaths: string | readonly string[]\n): boolean {\n const candidates = new Set(\n (Array.isArray(pathOrPaths) ? pathOrPaths : [pathOrPaths]).map(\n normalizeRouteActivityPath\n )\n );\n\n let pathname = currentRouteSnapshot.path;\n if (typeof window !== 'undefined' && window.location) {\n pathname = window.location.pathname || '/';\n } else if (serverLocation) {\n pathname = parseLocation(serverLocation).pathname;\n }\n\n const activePath = normalizeRouteActivityPath(pathname);\n if (candidates.has(activePath)) {\n return true;\n }\n\n const matches = computeMatchesFromRoutes(activePath, getActiveRoutes());\n return matches.some((match) =>\n candidates.has(normalizeRouteActivityPath(match.path))\n );\n}\n\nfunction readCurrentRouteSnapshot<\n TParams extends RouteParams = RouteParams,\n>(): RouteSnapshot<TParams> {\n const instance = getCurrentComponentInstance();\n if (!instance) {\n throw new Error(\n 'currentRoute() can only be called during component render execution. ' +\n 'Call currentRoute() from inside your component function.'\n );\n }\n\n let pathname = '/';\n let search = '';\n let hash = '';\n const renderContext = getActiveRenderContext();\n\n if (instance.ssr && renderContext?.url) {\n const parsed = parseLocation(renderContext.url);\n pathname = parsed.pathname;\n search = parsed.search;\n hash = parsed.hash;\n } else if (typeof window !== 'undefined' && window.location) {\n pathname = window.location.pathname || '/';\n search = window.location.search || '';\n hash = window.location.hash || '';\n } else if (serverLocation) {\n const parsed = parseLocation(serverLocation);\n pathname = parsed.pathname;\n search = parsed.search;\n hash = parsed.hash;\n }\n\n const query = makeQuery(search);\n const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());\n const instanceParams = instance.props as Record<string, string>;\n const routeParams =\n Object.keys(instanceParams).length > 0\n ? instanceParams\n : (matches[0]?.params ?? {});\n const params = deepFreeze({\n ...routeParams,\n });\n\n return Object.freeze({\n path: pathname,\n params,\n query,\n hash: hash || null,\n matches: Object.freeze(matches),\n }) as RouteSnapshot<TParams>;\n}\n\nexport function currentRoute<\n TParams extends RouteParams = RouteParams,\n>(): RouteSnapshot<TParams> {\n const instance = getCurrentComponentInstance();\n if (!instance) {\n throw new Error(\n 'currentRoute() can only be called during component render execution. ' +\n 'Call currentRoute() from inside your component function.'\n );\n }\n\n if (typeof window === 'undefined' || instance.ssr) {\n return readCurrentRouteSnapshot<TParams>();\n }\n\n recordReadableRead(currentRouteSource);\n return readCurrentRouteSnapshot<TParams>();\n}\n\nexport function syncCurrentRouteSnapshot(\n pathname: string,\n search: string,\n hash: string,\n activityMatches?: readonly RouteMatch[]\n): void {\n setCurrentRouteSnapshot(pathname, search, hash, activityMatches);\n}\n"],"mappings":";;;;;;;;;AAeA,IAAI,uBAAuB,mBAAmB,KAAK,IAAI,EAAE;AAEzD,MAAM,4BACJ;AAGF,mBAAmB,2BAAW,IAAI,IAAI;AAEtC,IAAI,iBAAgC;AAEpC,SAAgB,kBAAkB,KAA0B;CAC1D,iBAAiB;CACjB,IAAI,KAAK;EACP,MAAM,SAAS,cAAc,GAAG;EAChC,0BACE,OAAO,UACP,yBAAyB,OAAO,UAAU,gBAAgB,CAAC,CAC7D;EACA;CACF;CAEA,0BACE,qBAAqB,MACrB,qBAAqB,OACvB;AACF;AAEA,SAAS,mBACP,UACA,QACA,MACe;CACf,MAAM,QAAQ,UAAU,MAAM;CAC9B,MAAM,UAAU,yBAAyB,UAAU,gBAAgB,CAAC;CAEpE,OAAO,OAAO,OAAO;EACnB,MAAM;EACN,QAAQ,WAAW,EAAE,GAAG,QAAQ,EAAE,EAAE,OAAO,CAAC;EAC5C;EACA,MAAM,QAAQ;EACd,SAAS,OAAO,OAAO,OAAO;CAChC,CAAC;AACH;AAEA,SAAS,wBACP,UACA,QACA,MACA,iBACM;CACN,uBAAuB,mBAAmB,UAAU,QAAQ,IAAI;CAChE,0BACE,UACA,mBAAmB,qBAAqB,OAC1C;CAEA,MAAM,WAAW,4BAA4B;CAC7C,oCAAoC,kBAAkB;CACtD,6BAA6B,kBAAkB;CAC/C,sBAAsB,oBAAoB,QAAQ;AACpD;AAsCA,SAAS,2BAEmB;CAC1B,MAAM,WAAW,4BAA4B;CAC7C,IAAI,CAAC,UACH,MAAM,IAAI,MACR,+HAEF;CAGF,IAAI,WAAW;CACf,IAAI,SAAS;CACb,IAAI,OAAO;CACX,MAAM,gBAAgB,uBAAuB;CAE7C,IAAI,SAAS,OAAO,eAAe,KAAK;EACtC,MAAM,SAAS,cAAc,cAAc,GAAG;EAC9C,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,OAAO,OAAO;CAChB,OAAO,IAAI,OAAO,WAAW,eAAe,OAAO,UAAU;EAC3D,WAAW,OAAO,SAAS,YAAY;EACvC,SAAS,OAAO,SAAS,UAAU;EACnC,OAAO,OAAO,SAAS,QAAQ;CACjC,OAAO,IAAI,gBAAgB;EACzB,MAAM,SAAS,cAAc,cAAc;EAC3C,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,OAAO,OAAO;CAChB;CAEA,MAAM,QAAQ,UAAU,MAAM;CAC9B,MAAM,UAAU,yBAAyB,UAAU,gBAAgB,CAAC;CACpE,MAAM,iBAAiB,SAAS;CAKhC,MAAM,SAAS,WAAW,EACxB,GAJA,OAAO,KAAK,cAAc,CAAC,CAAC,SAAS,IACjC,iBACC,QAAQ,EAAE,EAAE,UAAU,CAAC,EAG9B,CAAC;CAED,OAAO,OAAO,OAAO;EACnB,MAAM;EACN;EACA;EACA,MAAM,QAAQ;EACd,SAAS,OAAO,OAAO,OAAO;CAChC,CAAC;AACH;AAEA,SAAgB,eAEY;CAC1B,MAAM,WAAW,4BAA4B;CAC7C,IAAI,CAAC,UACH,MAAM,IAAI,MACR,+HAEF;CAGF,IAAI,OAAO,WAAW,eAAe,SAAS,KAC5C,OAAO,yBAAkC;CAG3C,mBAAmB,kBAAkB;CACrC,OAAO,yBAAkC;AAC3C;AAEA,SAAgB,yBACd,UACA,QACA,MACA,iBACM;CACN,wBAAwB,UAAU,QAAQ,MAAM,eAAe;AACjE"}
@@ -0,0 +1,22 @@
1
+ import { GroupHelperOptions, PageHelperOptions, RegisterRoutesOptions, RouteComponent, RouteDefinition, RouteOptions, RouteParams, RoutePathParams } from "../common/router.js";
2
+ import { AnyRouteComponent } from "./internal-types.js";
3
+
4
+ //#region src/router/authoring.d.ts
5
+ type RouteComponentParam<TComponent extends AnyRouteComponent> = Parameters<TComponent> extends [] ? unknown : Parameters<TComponent>[0];
6
+ type CompatibleAbsoluteRouteComponent<Path extends string, TComponent extends AnyRouteComponent> = Parameters<TComponent> extends [] ? TComponent : RoutePathParams<Path> extends RouteComponentParam<TComponent> ? TComponent : never;
7
+ type CompatibleRelativeRouteComponent<Path extends string, TComponent extends AnyRouteComponent> = Parameters<TComponent> extends [] ? TComponent : RouteComponentParam<TComponent> extends Record<keyof RoutePathParams<Path>, string> ? TComponent : never;
8
+ type CompatibleRouteComponent<Path extends string, TComponent extends AnyRouteComponent> = Path extends `/${string}` ? CompatibleAbsoluteRouteComponent<Path, TComponent> : CompatibleRelativeRouteComponent<Path, TComponent>;
9
+ type RouteOptionsForComponent<Path extends string, TComponent extends AnyRouteComponent> = Parameters<TComponent> extends [] ? RouteOptions<RoutePathParams<Path>> : RouteComponentParam<TComponent> extends RouteParams ? RouteOptions<RouteComponentParam<TComponent>> : RouteOptions<RoutePathParams<Path>>;
10
+ declare function group(options: GroupHelperOptions, fn: RouteDefinition): void;
11
+ declare function page<const TPath extends string>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, fn: RouteDefinition): void;
12
+ declare function page<const TPath extends string, TComponent extends AnyRouteComponent>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, fn: RouteDefinition): void;
13
+ declare function page<const TPath extends string>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, options: PageHelperOptions, fn: RouteDefinition): void;
14
+ declare function page<const TPath extends string, TComponent extends AnyRouteComponent>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, options: PageHelperOptions, fn: RouteDefinition): void;
15
+ declare function index(Component: RouteComponent, options?: RouteOptions): void;
16
+ declare function fallback(Component: RouteComponent): void;
17
+ declare function registerRoutes(definition: RouteDefinition, options?: RegisterRoutesOptions): void;
18
+ declare function route<const TPath extends string>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, options?: RouteOptions<RoutePathParams<TPath>>): void;
19
+ declare function route<const TPath extends string, TComponent extends AnyRouteComponent>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, options?: RouteOptionsForComponent<TPath, TComponent>): void;
20
+ //#endregion
21
+ export { fallback, group, index, page, registerRoutes, route };
22
+ //# sourceMappingURL=authoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring.d.ts","names":[],"sources":["../../src/router/authoring.ts"],"mappings":";;;;KAsCK,mBAAA,oBAAuC,iBAAA,IAC1C,UAAA,CAAW,UAAA,yBAAmC,UAAA,CAAW,UAAA;AAAA,KAEtD,gCAAA,yCAEgB,iBAAA,IAEnB,UAAA,CAAW,UAAA,eACP,UAAA,GACA,eAAA,CAAgB,IAAA,UAAc,mBAAA,CAAoB,UAAA,IAChD,UAAA;AAAA,KAGH,gCAAA,yCAEgB,iBAAA,IAEnB,UAAA,CAAW,UAAA,eACP,UAAA,GACA,mBAAA,CAAoB,UAAA,UAAoB,MAAA,OAC9B,eAAA,CAAgB,IAAA,aAGxB,UAAA;AAAA,KAGH,wBAAA,yCAEgB,iBAAA,IACjB,IAAA,wBACA,gCAAA,CAAiC,IAAA,EAAM,UAAA,IACvC,gCAAA,CAAiC,IAAA,EAAM,UAAA;AAAA,KAEtC,wBAAA,yCAEgB,iBAAA,IAEnB,UAAA,CAAW,UAAA,eACP,YAAA,CAAa,eAAA,CAAgB,IAAA,KAC7B,mBAAA,CAAoB,UAAA,UAAoB,WAAA,GACtC,YAAA,CAAa,mBAAA,CAAoB,UAAA,KACjC,YAAA,CAAa,eAAA,CAAgB,IAAA;AAAA,iBAmSrB,KAAA,CAAM,OAAA,EAAS,kBAAA,EAAoB,EAAA,EAAI,eAAe;AAAA,iBAKtD,IAAA,6BACd,IAAA,EAAM,KAAA,EACN,SAAA,EAAW,cAAA,CAAe,eAAA,CAAgB,KAAA,IAC1C,EAAA,EAAI,eAAA;AAAA,iBAEU,IAAA,gDAEK,iBAAA,EAEnB,IAAA,EAAM,KAAA,EACN,SAAA,EAAW,wBAAA,CAAyB,KAAA,EAAO,UAAA,GAC3C,EAAA,EAAI,eAAA;AAAA,iBAEU,IAAA,6BACd,IAAA,EAAM,KAAA,EACN,SAAA,EAAW,cAAA,CAAe,eAAA,CAAgB,KAAA,IAC1C,OAAA,EAAS,iBAAA,EACT,EAAA,EAAI,eAAA;AAAA,iBAEU,IAAA,gDAEK,iBAAA,EAEnB,IAAA,EAAM,KAAA,EACN,SAAA,EAAW,wBAAA,CAAyB,KAAA,EAAO,UAAA,GAC3C,OAAA,EAAS,iBAAA,EACT,EAAA,EAAI,eAAA;AAAA,iBA2BU,KAAA,CAAM,SAAA,EAAW,cAAA,EAAgB,OAAA,GAAU,YAAY;AAAA,iBAavD,QAAA,CAAS,SAAyB,EAAd,cAAc;AAAA,iBAmClC,cAAA,CACd,UAAA,EAAY,eAAA,EACZ,OAAA,GAAS,qBAA0B;AAAA,iBAWrB,KAAA,6BACd,IAAA,EAAM,KAAA,EACN,SAAA,EAAW,cAAA,CAAe,eAAA,CAAgB,KAAA,IAC1C,OAAA,GAAU,YAAA,CAAa,eAAA,CAAgB,KAAA;AAAA,iBAEzB,KAAA,gDAEK,iBAAA,EAEnB,IAAA,EAAM,KAAA,EACN,SAAA,EAAW,wBAAA,CAAyB,KAAA,EAAO,UAAA,GAC3C,OAAA,GAAU,wBAAA,CAAyB,KAAA,EAAO,UAAA"}
@@ -0,0 +1,198 @@
1
+ import { getCurrentComponentInstance } from "../runtime/component-scope.js";
2
+ import "../runtime/component.js";
3
+ import { getExecutionModel } from "../runtime/execution-model.js";
4
+ import { computeRank, normalizeRouteSegmentName, parseSegments } from "./match.js";
5
+ import { compileNodePolicies, nextAccessScopeState, validateAccessMetadata } from "./access.js";
6
+ import { createRouteHandler } from "./rendering.js";
7
+ import { addRouteToStores, assertRouteRegistrationUnlocked, getCurrentAccessScopeState, getCurrentInheritedPolicies, getCurrentLayoutChain, getCurrentPageChain, getCurrentPageScope, getCurrentPathPrefix, getCurrentRegistrationSession, getCurrentScopeKind, hasActivePageScope, insertRecordSorted, pushRegistrationScope, pushRegistrationSession, setDefaultRouteAuthOptions } from "./store.js";
8
+ //#region src/router/authoring.ts
9
+ function validateRoutePath(path) {
10
+ if (!path.startsWith("/")) throw new Error(`Route path must begin with "/". Got: "${path}"`);
11
+ if (/\/{2,}/.test(path)) throw new Error("Route path cannot contain consecutive slashes.");
12
+ if (/:([^/{}]+)/.test(path)) {
13
+ const suggested = path.replace(/:([^/{}]+)/g, "{$1}");
14
+ throw new Error(`Route parameter syntax uses {name} interpolation, not :name. Use "${suggested}" instead of "${path}".`);
15
+ }
16
+ const segments = path.split("/").filter(Boolean);
17
+ const seenParamNames = /* @__PURE__ */ new Set();
18
+ for (let index = 0; index < segments.length; index++) {
19
+ const segment = segments[index];
20
+ if (segment === "*") continue;
21
+ const hasOpenBrace = segment.includes("{");
22
+ const hasCloseBrace = segment.includes("}");
23
+ if (!hasOpenBrace && !hasCloseBrace) continue;
24
+ if (!(segment.startsWith("{") && segment.endsWith("}"))) throw new Error("Route parameter segments must use complete {name} interpolation.");
25
+ const rawParamName = normalizeRouteSegmentName(segment.slice(1, -1));
26
+ const isSplat = rawParamName.startsWith("*");
27
+ const paramName = isSplat ? normalizeRouteSegmentName(rawParamName.slice(1)) : rawParamName;
28
+ if (!paramName) throw new Error(isSplat ? "Route splat parameter name cannot be empty." : "Route parameter name cannot be empty.");
29
+ if (isSplat && paramName === "*") throw new Error("Route named splat parameter name cannot be \"*\".");
30
+ if (isSplat && index !== segments.length - 1) throw new Error("Route named splat parameters must be the final segment.");
31
+ if (seenParamNames.has(paramName)) throw new Error(`Route path cannot reuse duplicate parameter name "${paramName}".`);
32
+ seenParamNames.add(paramName);
33
+ }
34
+ }
35
+ function normalizeAbsoluteRoutePath(path) {
36
+ if (!path || path === "/") return "/";
37
+ return (path.endsWith("/") ? path.slice(0, -1) : path) || "/";
38
+ }
39
+ function joinRoutePaths(prefix, path) {
40
+ const normalizedPrefix = normalizeAbsoluteRoutePath(prefix || "/");
41
+ const normalizedPath = path.replace(/^\/+|\/+$/g, "");
42
+ if (!normalizedPath) return normalizedPrefix;
43
+ return normalizedPrefix === "/" ? `/${normalizedPath}` : `${normalizedPrefix}/${normalizedPath}`;
44
+ }
45
+ function resolvePageScopePath(path) {
46
+ if (!path) throw new Error("page(path, Component, fn) requires a non-empty path.");
47
+ if (path.startsWith("/")) {
48
+ validateRoutePath(path);
49
+ return normalizeAbsoluteRoutePath(path);
50
+ }
51
+ return joinRoutePaths(getCurrentPathPrefix(), path);
52
+ }
53
+ function resolveIndexPath() {
54
+ return normalizeAbsoluteRoutePath(getCurrentPathPrefix() || "/");
55
+ }
56
+ function resolveRouteRegistrationPath(path) {
57
+ if (path.startsWith("/")) {
58
+ if (hasActivePageScope()) throw new Error(`Child route paths inside page() must be relative. Use "${path.slice(1)}" instead of "${path}".`);
59
+ validateRoutePath(path);
60
+ return normalizeAbsoluteRoutePath(path);
61
+ }
62
+ const prefix = getCurrentPathPrefix();
63
+ if (!prefix) throw new Error(`Route path must begin with "/". Got: "${path}"`);
64
+ return joinRoutePaths(prefix, path);
65
+ }
66
+ function pushGroupScope(options, fn) {
67
+ validateAccessMetadata(options, {
68
+ authConfigured: getCurrentRegistrationSession().authConfigured,
69
+ state: getCurrentAccessScopeState()
70
+ });
71
+ const policies = compileNodePolicies(options);
72
+ pushRegistrationScope({
73
+ kind: "group",
74
+ pathPrefix: getCurrentPathPrefix(),
75
+ layout: options.layout,
76
+ policies,
77
+ state: nextAccessScopeState(options, getCurrentAccessScopeState())
78
+ }, fn);
79
+ }
80
+ function pushPageScope(path, Component, options, fn) {
81
+ if (hasActivePageScope()) throw new Error("page() cannot be nested inside another page(). Use route() for child leaves or group() for inherited behavior inside the existing page scope.");
82
+ validateAccessMetadata(options, {
83
+ authConfigured: getCurrentRegistrationSession().authConfigured,
84
+ state: getCurrentAccessScopeState()
85
+ });
86
+ const policies = compileNodePolicies(options);
87
+ pushRegistrationScope({
88
+ kind: "page",
89
+ pathPrefix: resolvePageScopePath(path),
90
+ page: Component,
91
+ hasIndex: false,
92
+ policies,
93
+ state: nextAccessScopeState(options, getCurrentAccessScopeState())
94
+ }, fn);
95
+ }
96
+ function normalizeRouteOptions(options) {
97
+ if (!options) return;
98
+ const loader = options.loader;
99
+ const policies = compileNodePolicies(options);
100
+ if (!loader && !options.entries && policies.length === 0 && !options.title && !options.namespace && options.auth === void 0 && !options.role && !options.permission) return;
101
+ return {
102
+ ...loader ? { loader } : {},
103
+ ...options.entries ? { entries: options.entries } : {},
104
+ ...options.auth !== void 0 ? { auth: options.auth } : {},
105
+ ...options.role ? { role: options.role } : {},
106
+ ...options.permission ? { permission: options.permission } : {},
107
+ ...policies.length > 0 ? { policies } : {},
108
+ ...options.title ? { title: options.title } : {},
109
+ ...options.namespace ? { namespace: options.namespace } : {}
110
+ };
111
+ }
112
+ function registerRouteAtResolvedPath(path, Component, options, metadata) {
113
+ validateRoutePath(path);
114
+ validateAccessMetadata(options ?? {}, {
115
+ authConfigured: getCurrentRegistrationSession().authConfigured,
116
+ state: getCurrentAccessScopeState()
117
+ });
118
+ const chain = getCurrentLayoutChain();
119
+ const pageChain = getCurrentPageChain();
120
+ const segments = parseSegments(path);
121
+ const rank = computeRank(segments);
122
+ const isFallback = metadata?.isFallback ?? path === "/*";
123
+ const comp = Component;
124
+ const normalizedOptions = normalizeRouteOptions(options);
125
+ const policies = [...getCurrentInheritedPolicies(), ...normalizedOptions?.policies ?? []];
126
+ const handler = createRouteHandler(comp, pageChain, chain);
127
+ const renderHandler = createRouteHandler(comp, pageChain, chain, true);
128
+ insertRecordSorted({
129
+ path,
130
+ component: comp,
131
+ segments,
132
+ rank,
133
+ layoutChain: chain,
134
+ pageChain,
135
+ options: normalizedOptions ? {
136
+ ...normalizedOptions,
137
+ ...policies.length > 0 ? { policies } : {}
138
+ } : policies.length > 0 ? { policies } : {},
139
+ isFallback,
140
+ handler,
141
+ renderHandler,
142
+ ...metadata?.fallbackPrefix ? { fallbackPrefix: metadata.fallbackPrefix } : {}
143
+ });
144
+ addRouteToStores({
145
+ path,
146
+ handler,
147
+ namespace: normalizedOptions?.namespace ?? options?.namespace,
148
+ ...metadata?.fallbackPrefix ? { fallbackPrefix: metadata.fallbackPrefix } : {}
149
+ });
150
+ }
151
+ function group(options, fn) {
152
+ pushGroupScope(options, fn);
153
+ }
154
+ function page(path, Component, optionsOrFn, maybeFn) {
155
+ const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
156
+ const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
157
+ if (typeof Component !== "function") throw new Error("page(path, Component, fn) requires a component function as the second argument.");
158
+ if (typeof fn !== "function") throw new Error("page(path, Component, fn) requires a route definition callback as the final argument.");
159
+ pushPageScope(path, Component, options, fn);
160
+ }
161
+ function index(Component, options) {
162
+ const pageScope = getCurrentPageScope();
163
+ if (pageScope?.hasIndex) throw new Error("page() cannot declare multiple index routes.");
164
+ if (pageScope) pageScope.hasIndex = true;
165
+ registerRouteAtResolvedPath(resolveIndexPath(), Component, options);
166
+ }
167
+ function fallback(Component) {
168
+ if (hasActivePageScope()) {
169
+ if (getCurrentScopeKind() !== "page") throw new Error("fallback() inside page() must be declared directly in the page scope, not inside nested group().");
170
+ registerRouteAtResolvedPath(`${getCurrentPathPrefix()}/*`, Component, void 0, {
171
+ isFallback: true,
172
+ fallbackPrefix: getCurrentPathPrefix()
173
+ });
174
+ return;
175
+ }
176
+ if (!(getCurrentInheritedPolicies().length === 0 && !getCurrentAccessScopeState().guestOnly && !getCurrentAccessScopeState().authenticated)) throw new Error("fallback() can only be registered at the root scope. Use route(\"/*\", Component) if you need compatibility behavior.");
177
+ registerRouteAtResolvedPath("/*", Component, void 0, {
178
+ isFallback: true,
179
+ fallbackPrefix: "/"
180
+ });
181
+ }
182
+ function registerRoutes(definition, options = {}) {
183
+ setDefaultRouteAuthOptions(options.auth);
184
+ pushRegistrationSession({ authConfigured: !!options.auth?.resolve }, definition);
185
+ }
186
+ function route(path, Component, options) {
187
+ if (typeof path === "undefined") throw new Error("route() is only for route registration. Use currentRoute() inside components.");
188
+ if (getExecutionModel() === "islands") throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.");
189
+ const currentInst = getCurrentComponentInstance();
190
+ if (currentInst && currentInst.ssr) throw new Error("route() cannot be called during SSR rendering. Register routes at module load time instead.");
191
+ assertRouteRegistrationUnlocked();
192
+ if (typeof Component !== "function") throw new Error("route(path, Component) requires a component function as the second argument. Passing JSX elements or VNodes directly is not supported.");
193
+ registerRouteAtResolvedPath(resolveRouteRegistrationPath(path), Component, options);
194
+ }
195
+ //#endregion
196
+ export { fallback, group, index, page, registerRoutes, route };
197
+
198
+ //# sourceMappingURL=authoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring.js","names":[],"sources":["../../src/router/authoring.ts"],"sourcesContent":["import type {\n GroupHelperOptions,\n PageHelperOptions,\n RegisterRoutesOptions,\n RouteComponent,\n RouteDefinition,\n RouteOptions,\n RouteParams,\n RoutePathParams,\n} from '../common/router';\nimport { getCurrentComponentInstance } from '../runtime/component';\nimport { getExecutionModel } from '../runtime/execution-model';\nimport { computeRank, normalizeRouteSegmentName, parseSegments } from './match';\nimport {\n compileNodePolicies,\n nextAccessScopeState,\n validateAccessMetadata,\n} from './access';\nimport type { AnyRouteComponent, InternalRouteRecord } from './internal-types';\nimport { createRouteHandler } from './rendering';\nimport {\n addRouteToStores,\n assertRouteRegistrationUnlocked,\n getCurrentAccessScopeState,\n getCurrentInheritedPolicies,\n getCurrentLayoutChain,\n getCurrentPageChain,\n getCurrentPageScope,\n getCurrentPathPrefix,\n getCurrentRegistrationSession,\n getCurrentScopeKind,\n hasActivePageScope,\n insertRecordSorted,\n pushRegistrationScope,\n pushRegistrationSession,\n setDefaultRouteAuthOptions,\n} from './store';\n\ntype RouteComponentParam<TComponent extends AnyRouteComponent> =\n Parameters<TComponent> extends [] ? unknown : Parameters<TComponent>[0];\n\ntype CompatibleAbsoluteRouteComponent<\n Path extends string,\n TComponent extends AnyRouteComponent,\n> =\n Parameters<TComponent> extends []\n ? TComponent\n : RoutePathParams<Path> extends RouteComponentParam<TComponent>\n ? TComponent\n : never;\n\ntype CompatibleRelativeRouteComponent<\n Path extends string,\n TComponent extends AnyRouteComponent,\n> =\n Parameters<TComponent> extends []\n ? TComponent\n : RouteComponentParam<TComponent> extends Record<\n keyof RoutePathParams<Path>,\n string\n >\n ? TComponent\n : never;\n\ntype CompatibleRouteComponent<\n Path extends string,\n TComponent extends AnyRouteComponent,\n> = Path extends `/${string}`\n ? CompatibleAbsoluteRouteComponent<Path, TComponent>\n : CompatibleRelativeRouteComponent<Path, TComponent>;\n\ntype RouteOptionsForComponent<\n Path extends string,\n TComponent extends AnyRouteComponent,\n> =\n Parameters<TComponent> extends []\n ? RouteOptions<RoutePathParams<Path>>\n : RouteComponentParam<TComponent> extends RouteParams\n ? RouteOptions<RouteComponentParam<TComponent>>\n : RouteOptions<RoutePathParams<Path>>;\n\nfunction validateRoutePath(path: string): void {\n if (!path.startsWith('/')) {\n throw new Error(`Route path must begin with \"/\". Got: \"${path}\"`);\n }\n if (/\\/{2,}/.test(path)) {\n throw new Error('Route path cannot contain consecutive slashes.');\n }\n if (/:([^/{}]+)/.test(path)) {\n const suggested = path.replace(/:([^/{}]+)/g, '{$1}');\n throw new Error(\n `Route parameter syntax uses {name} interpolation, not :name. ` +\n `Use \"${suggested}\" instead of \"${path}\".`\n );\n }\n\n const segments = path.split('/').filter(Boolean);\n const seenParamNames = new Set<string>();\n\n for (let index = 0; index < segments.length; index++) {\n const segment = segments[index];\n if (segment === '*') {\n continue;\n }\n\n const hasOpenBrace = segment.includes('{');\n const hasCloseBrace = segment.includes('}');\n\n if (!hasOpenBrace && !hasCloseBrace) {\n continue;\n }\n\n if (!(segment.startsWith('{') && segment.endsWith('}'))) {\n throw new Error(\n 'Route parameter segments must use complete {name} interpolation.'\n );\n }\n\n const rawParamName = normalizeRouteSegmentName(segment.slice(1, -1));\n const isSplat = rawParamName.startsWith('*');\n const paramName = isSplat\n ? normalizeRouteSegmentName(rawParamName.slice(1))\n : rawParamName;\n\n if (!paramName) {\n throw new Error(\n isSplat\n ? 'Route splat parameter name cannot be empty.'\n : 'Route parameter name cannot be empty.'\n );\n }\n\n if (isSplat && paramName === '*') {\n throw new Error('Route named splat parameter name cannot be \"*\".');\n }\n\n if (isSplat && index !== segments.length - 1) {\n throw new Error(\n 'Route named splat parameters must be the final segment.'\n );\n }\n\n if (seenParamNames.has(paramName)) {\n throw new Error(\n `Route path cannot reuse duplicate parameter name \"${paramName}\".`\n );\n }\n\n seenParamNames.add(paramName);\n }\n}\n\nfunction normalizeAbsoluteRoutePath(path: string): string {\n if (!path || path === '/') {\n return '/';\n }\n\n const normalized = path.endsWith('/') ? path.slice(0, -1) : path;\n return normalized || '/';\n}\n\nfunction joinRoutePaths(prefix: string, path: string): string {\n const normalizedPrefix = normalizeAbsoluteRoutePath(prefix || '/');\n const normalizedPath = path.replace(/^\\/+|\\/+$/g, '');\n\n if (!normalizedPath) {\n return normalizedPrefix;\n }\n\n return normalizedPrefix === '/'\n ? `/${normalizedPath}`\n : `${normalizedPrefix}/${normalizedPath}`;\n}\n\nfunction resolvePageScopePath(path: string): string {\n if (!path) {\n throw new Error('page(path, Component, fn) requires a non-empty path.');\n }\n\n if (path.startsWith('/')) {\n validateRoutePath(path);\n return normalizeAbsoluteRoutePath(path);\n }\n\n return joinRoutePaths(getCurrentPathPrefix(), path);\n}\n\nfunction resolveIndexPath(): string {\n return normalizeAbsoluteRoutePath(getCurrentPathPrefix() || '/');\n}\n\nfunction resolveRouteRegistrationPath(path: string): string {\n if (path.startsWith('/')) {\n if (hasActivePageScope()) {\n throw new Error(\n 'Child route paths inside page() must be relative. ' +\n `Use \"${path.slice(1)}\" instead of \"${path}\".`\n );\n }\n\n validateRoutePath(path);\n return normalizeAbsoluteRoutePath(path);\n }\n\n const prefix = getCurrentPathPrefix();\n\n if (!prefix) {\n throw new Error(`Route path must begin with \"/\". Got: \"${path}\"`);\n }\n\n return joinRoutePaths(prefix, path);\n}\n\nfunction pushGroupScope(\n options: GroupHelperOptions,\n fn: RouteDefinition\n): void {\n const session = getCurrentRegistrationSession();\n validateAccessMetadata(options, {\n authConfigured: session.authConfigured,\n state: getCurrentAccessScopeState(),\n });\n const policies = compileNodePolicies(options);\n\n pushRegistrationScope(\n {\n kind: 'group',\n pathPrefix: getCurrentPathPrefix(),\n layout: options.layout,\n policies,\n state: nextAccessScopeState(options, getCurrentAccessScopeState()),\n },\n fn\n );\n}\n\nfunction pushPageScope(\n path: string,\n Component: RouteComponent,\n options: PageHelperOptions,\n fn: RouteDefinition\n): void {\n if (hasActivePageScope()) {\n throw new Error(\n 'page() cannot be nested inside another page(). ' +\n 'Use route() for child leaves or group() for inherited behavior inside the existing page scope.'\n );\n }\n\n const session = getCurrentRegistrationSession();\n validateAccessMetadata(options, {\n authConfigured: session.authConfigured,\n state: getCurrentAccessScopeState(),\n });\n\n const policies = compileNodePolicies(options);\n\n pushRegistrationScope(\n {\n kind: 'page',\n pathPrefix: resolvePageScopePath(path),\n page: Component,\n hasIndex: false,\n policies,\n state: nextAccessScopeState(options, getCurrentAccessScopeState()),\n },\n fn\n );\n}\n\nfunction normalizeRouteOptions(\n options: RouteOptions | undefined\n): RouteOptions | undefined {\n if (!options) {\n return undefined;\n }\n\n const loader = options.loader;\n const policies = compileNodePolicies(options);\n\n if (\n !loader &&\n !options.entries &&\n policies.length === 0 &&\n !options.title &&\n !options.namespace &&\n options.auth === undefined &&\n !options.role &&\n !options.permission\n ) {\n return undefined;\n }\n\n return {\n ...(loader ? { loader } : {}),\n ...(options.entries ? { entries: options.entries } : {}),\n ...(options.auth !== undefined ? { auth: options.auth } : {}),\n ...(options.role ? { role: options.role } : {}),\n ...(options.permission ? { permission: options.permission } : {}),\n ...(policies.length > 0 ? { policies } : {}),\n ...(options.title ? { title: options.title } : {}),\n ...(options.namespace ? { namespace: options.namespace } : {}),\n };\n}\n\nfunction registerRouteAtResolvedPath(\n path: string,\n Component: RouteComponent,\n options?: RouteOptions,\n metadata?: {\n isFallback?: boolean;\n fallbackPrefix?: string;\n }\n): void {\n validateRoutePath(path);\n\n validateAccessMetadata(options ?? {}, {\n authConfigured: getCurrentRegistrationSession().authConfigured,\n state: getCurrentAccessScopeState(),\n });\n\n const chain = getCurrentLayoutChain();\n const pageChain = getCurrentPageChain();\n const segments = parseSegments(path);\n const rank = computeRank(segments);\n const isFallback = metadata?.isFallback ?? path === '/*';\n const comp = Component;\n const normalizedOptions = normalizeRouteOptions(options);\n const policies = [\n ...getCurrentInheritedPolicies(),\n ...(normalizedOptions?.policies ?? []),\n ];\n\n const handler = createRouteHandler(comp, pageChain, chain);\n const renderHandler = createRouteHandler(comp, pageChain, chain, true);\n\n const record: InternalRouteRecord = {\n path,\n component: comp,\n segments,\n rank,\n layoutChain: chain,\n pageChain,\n options: normalizedOptions\n ? {\n ...normalizedOptions,\n ...(policies.length > 0 ? { policies } : {}),\n }\n : policies.length > 0\n ? { policies }\n : {},\n isFallback,\n handler,\n renderHandler,\n ...(metadata?.fallbackPrefix\n ? { fallbackPrefix: metadata.fallbackPrefix }\n : {}),\n };\n\n insertRecordSorted(record);\n addRouteToStores({\n path,\n handler,\n namespace: normalizedOptions?.namespace ?? options?.namespace,\n ...(metadata?.fallbackPrefix\n ? { fallbackPrefix: metadata.fallbackPrefix }\n : {}),\n });\n}\n\nexport function group(options: GroupHelperOptions, fn: RouteDefinition): void;\nexport function group(options: GroupHelperOptions, fn: RouteDefinition): void {\n pushGroupScope(options, fn);\n}\n\nexport function page<const TPath extends string>(\n path: TPath,\n Component: RouteComponent<RoutePathParams<TPath>>,\n fn: RouteDefinition\n): void;\nexport function page<\n const TPath extends string,\n TComponent extends AnyRouteComponent,\n>(\n path: TPath,\n Component: CompatibleRouteComponent<TPath, TComponent>,\n fn: RouteDefinition\n): void;\nexport function page<const TPath extends string>(\n path: TPath,\n Component: RouteComponent<RoutePathParams<TPath>>,\n options: PageHelperOptions,\n fn: RouteDefinition\n): void;\nexport function page<\n const TPath extends string,\n TComponent extends AnyRouteComponent,\n>(\n path: TPath,\n Component: CompatibleRouteComponent<TPath, TComponent>,\n options: PageHelperOptions,\n fn: RouteDefinition\n): void;\nexport function page(\n path: string,\n Component: RouteComponent,\n optionsOrFn: PageHelperOptions | RouteDefinition,\n maybeFn?: RouteDefinition\n): void {\n const options =\n typeof optionsOrFn === 'function' ? ({} as PageHelperOptions) : optionsOrFn;\n const fn = typeof optionsOrFn === 'function' ? optionsOrFn : maybeFn;\n\n if (typeof Component !== 'function') {\n throw new Error(\n 'page(path, Component, fn) requires a component function as the second argument.'\n );\n }\n\n if (typeof fn !== 'function') {\n throw new Error(\n 'page(path, Component, fn) requires a route definition callback as the final argument.'\n );\n }\n\n pushPageScope(path, Component, options, fn);\n}\n\nexport function index(Component: RouteComponent, options?: RouteOptions): void {\n const pageScope = getCurrentPageScope();\n if (pageScope?.hasIndex) {\n throw new Error('page() cannot declare multiple index routes.');\n }\n\n if (pageScope) {\n pageScope.hasIndex = true;\n }\n\n registerRouteAtResolvedPath(resolveIndexPath(), Component, options);\n}\n\nexport function fallback(Component: RouteComponent): void {\n if (hasActivePageScope()) {\n if (getCurrentScopeKind() !== 'page') {\n throw new Error(\n 'fallback() inside page() must be declared directly in the page scope, not inside nested group().'\n );\n }\n\n registerRouteAtResolvedPath(\n `${getCurrentPathPrefix()}/*`,\n Component,\n undefined,\n { isFallback: true, fallbackPrefix: getCurrentPathPrefix() }\n );\n return;\n }\n\n const allowsRootFallback =\n getCurrentInheritedPolicies().length === 0 &&\n !getCurrentAccessScopeState().guestOnly &&\n !getCurrentAccessScopeState().authenticated;\n\n if (!allowsRootFallback) {\n throw new Error(\n 'fallback() can only be registered at the root scope. ' +\n 'Use route(\"/*\", Component) if you need compatibility behavior.'\n );\n }\n\n registerRouteAtResolvedPath('/*', Component, undefined, {\n isFallback: true,\n fallbackPrefix: '/',\n });\n}\n\nexport function registerRoutes(\n definition: RouteDefinition,\n options: RegisterRoutesOptions = {}\n): void {\n setDefaultRouteAuthOptions(options.auth);\n pushRegistrationSession(\n {\n authConfigured: !!options.auth?.resolve,\n },\n definition\n );\n}\n\nexport function route<const TPath extends string>(\n path: TPath,\n Component: RouteComponent<RoutePathParams<TPath>>,\n options?: RouteOptions<RoutePathParams<TPath>>\n): void;\nexport function route<\n const TPath extends string,\n TComponent extends AnyRouteComponent,\n>(\n path: TPath,\n Component: CompatibleRouteComponent<TPath, TComponent>,\n options?: RouteOptionsForComponent<TPath, TComponent>\n): void;\nexport function route(\n path: string,\n Component: RouteComponent,\n options?: RouteOptions\n): void {\n if (typeof path === 'undefined') {\n throw new Error(\n 'route() is only for route registration. Use currentRoute() inside components.'\n );\n }\n\n if (getExecutionModel() === 'islands') {\n throw new Error(\n 'Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.'\n );\n }\n\n const currentInst = getCurrentComponentInstance();\n if (currentInst && currentInst.ssr) {\n throw new Error(\n 'route() cannot be called during SSR rendering. Register routes at module load time instead.'\n );\n }\n\n assertRouteRegistrationUnlocked();\n\n if (typeof Component !== 'function') {\n throw new Error(\n 'route(path, Component) requires a component function as the second argument. ' +\n 'Passing JSX elements or VNodes directly is not supported.'\n );\n }\n\n registerRouteAtResolvedPath(\n resolveRouteRegistrationPath(path),\n Component,\n options\n );\n}\n"],"mappings":";;;;;;;;AAiFA,SAAS,kBAAkB,MAAoB;CAC7C,IAAI,CAAC,KAAK,WAAW,GAAG,GACtB,MAAM,IAAI,MAAM,yCAAyC,KAAK,EAAE;CAElE,IAAI,SAAS,KAAK,IAAI,GACpB,MAAM,IAAI,MAAM,gDAAgD;CAElE,IAAI,aAAa,KAAK,IAAI,GAAG;EAC3B,MAAM,YAAY,KAAK,QAAQ,eAAe,MAAM;EACpD,MAAM,IAAI,MACR,qEACU,UAAU,gBAAgB,KAAK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;EAAE,CAC7D;EACA;CACF;CAOA,IAAI,EAJF,4BAA4B,CAAC,CAAC,WAAW,KACzC,CAAC,2BAA2B,CAAC,CAAC,aAC9B,CAAC,2BAA2B,CAAC,CAAC,gBAG9B,MAAM,IAAI,MACR,uHAEF;CAGF,4BAA4B,MAAM,WAAW,QAAW;EACtD,YAAY;EACZ,gBAAgB;CAClB,CAAC;AACH;AAEA,SAAgB,eACd,YACA,UAAiC,CAAC,GAC5B;CACN,2BAA2B,QAAQ,IAAI;CACvC,wBACE,EACE,gBAAgB,CAAC,CAAC,QAAQ,MAAM,QAClC,GACA,UACF;AACF;AAeA,SAAgB,MACd,MACA,WACA,SACM;CACN,IAAI,OAAO,SAAS,aAClB,MAAM,IAAI,MACR,+EACF;CAGF,IAAI,kBAAkB,MAAM,WAC1B,MAAM,IAAI,MACR,8FACF;CAGF,MAAM,cAAc,4BAA4B;CAChD,IAAI,eAAe,YAAY,KAC7B,MAAM,IAAI,MACR,6FACF;CAGF,gCAAgC;CAEhC,IAAI,OAAO,cAAc,YACvB,MAAM,IAAI,MACR,wIAEF;CAGF,4BACE,6BAA6B,IAAI,GACjC,WACA,OACF;AACF"}
@@ -1,6 +1,14 @@
1
- import { AccessDecision, AccessDenyDecision, AccessRedirectDecision, GroupHelperOptions, LayoutScopeRecord, PageHelperOptions, PageScopeRecord, ParsedSegment, RegisterRoutesOptions, Route, RouteAuthMode, RouteAuthOptions, RouteAuthResolver, RouteAuthState, RouteComponent, RouteContext, RouteDefinition, RouteHandler, RouteManifest, RouteMatch, RouteMode, RouteOptions, RouteParams, RoutePathParams, RoutePolicy, RouteQuery, RouteRecord, RouteRenderResult, RouteRequestOptions, RouteRequestResult, RouteSnapshot } from "../common/router.js";
2
- import { HistoryScrollBehavior, NavigateOptions, NavigationScrollBehavior, RouteQueryParamInput, RouteQueryParamValue, RouteQueryUpdater, RouteQueryUpdates, ScrollRestorationOptions, UpdateRouteQueryOptions, navigate, updateRouteQuery } from "./navigate.js";
3
- import { Outlet, clearRoutes, currentRoute, fallback, getManifest, getRoutes, group, index, lazy, page, registerRoutes, route } from "./route.js";
1
+ import { AccessDecision, AccessDenyDecision, AccessRedirectDecision, GroupHelperOptions, LayoutScopeRecord, PageHelperOptions, PageScopeRecord, ParsedSegment, RegisterRoutesOptions, Route, RouteAuthMode, RouteAuthOptions, RouteAuthResolver, RouteAuthState, RouteComponent, RouteContext, RouteDefinition, RouteHandler, RouteManifest, RouteMatch, RouteMode, RouteOptions, RouteParams, RoutePathParams, RoutePolicy, RouteQuery, RouteRecord, RouteRegistry, RouteRenderResult, RouteRequestOptions, RouteRequestResult, RouteSnapshot } from "../common/router.js";
2
+ import { HistoryScrollBehavior, NavigationScrollBehavior, ScrollRestorationOptions } from "./navigation-scroll.js";
3
+ import { NavigateOptions } from "./navigation-targets.js";
4
+ import { RouteQueryParamInput, RouteQueryParamValue, RouteQueryUpdater, RouteQueryUpdates, UpdateRouteQueryOptions, updateRouteQuery } from "./route-query.js";
5
+ import { navigate } from "./navigate.js";
6
+ import { fallback, group, index, page, registerRoutes, route } from "./authoring.js";
7
+ import { currentRoute } from "./activity.js";
8
+ import { clearRoutes, createRouteRegistry, getManifest } from "./manifest.js";
9
+ import { getRoutes } from "./store.js";
10
+ import { lazy } from "./lazy.js";
11
+ import { Outlet } from "./rendering.js";
4
12
  import { allow, deny, forbidden, notFound, redirect, requireAuth, requirePermission, requireRole, unauthorized } from "./policy.js";
5
13
  import { Link, LinkProps } from "../components/link.js";
6
- export { type AccessDecision, type AccessDenyDecision, type AccessRedirectDecision, type GroupHelperOptions, type HistoryScrollBehavior, type LayoutScopeRecord, Link, type LinkProps, type NavigateOptions, type NavigationScrollBehavior, Outlet, type PageHelperOptions, type PageScopeRecord, type ParsedSegment, type RegisterRoutesOptions, type Route, type RouteAuthMode, type RouteAuthOptions, type RouteAuthResolver, type RouteAuthState, type RouteComponent, type RouteContext, type RouteDefinition, type RouteHandler, type RouteManifest, type RouteMatch, type RouteMode, type RouteOptions, type RouteParams, type RoutePathParams, type RoutePolicy, type RouteQuery, type RouteQueryParamInput, type RouteQueryParamValue, type RouteQueryUpdater, type RouteQueryUpdates, type RouteRecord, type RouteRenderResult, type RouteRequestOptions, type RouteRequestResult, type RouteSnapshot, type ScrollRestorationOptions, type UpdateRouteQueryOptions, allow, clearRoutes, currentRoute, deny, fallback, forbidden, getManifest, getRoutes, group, index, lazy, navigate, notFound, page, redirect, registerRoutes, requireAuth, requirePermission, requireRole, route, unauthorized, updateRouteQuery };
14
+ export { type AccessDecision, type AccessDenyDecision, type AccessRedirectDecision, type GroupHelperOptions, type HistoryScrollBehavior, type LayoutScopeRecord, Link, type LinkProps, type NavigateOptions, type NavigationScrollBehavior, Outlet, type PageHelperOptions, type PageScopeRecord, type ParsedSegment, type RegisterRoutesOptions, type Route, type RouteAuthMode, type RouteAuthOptions, type RouteAuthResolver, type RouteAuthState, type RouteComponent, type RouteContext, type RouteDefinition, type RouteHandler, type RouteManifest, type RouteMatch, type RouteMode, type RouteOptions, type RouteParams, type RoutePathParams, type RoutePolicy, type RouteQuery, type RouteQueryParamInput, type RouteQueryParamValue, type RouteQueryUpdater, type RouteQueryUpdates, type RouteRecord, type RouteRegistry, type RouteRenderResult, type RouteRequestOptions, type RouteRequestResult, type RouteSnapshot, type ScrollRestorationOptions, type UpdateRouteQueryOptions, allow, clearRoutes, createRouteRegistry, currentRoute, deny, fallback, forbidden, getManifest, getRoutes, group, index, lazy, navigate, notFound, page, redirect, registerRoutes, requireAuth, requirePermission, requireRole, route, unauthorized, updateRouteQuery };
@@ -1,5 +1,12 @@
1
1
  import { allow, deny, forbidden, notFound, redirect, requireAuth, requirePermission, requireRole, unauthorized } from "./policy.js";
2
- import { Outlet, clearRoutes, currentRoute, fallback, getManifest, getRoutes, group, index, lazy, page, registerRoutes, route } from "./route.js";
3
- import { navigate, updateRouteQuery } from "./navigate.js";
2
+ import { Outlet } from "./rendering.js";
3
+ import { getRoutes } from "./store.js";
4
+ import { fallback, group, index, page, registerRoutes, route } from "./authoring.js";
5
+ import { currentRoute } from "./activity.js";
6
+ import { lazy } from "./lazy.js";
7
+ import { clearRoutes, createRouteRegistry, getManifest } from "./manifest.js";
8
+ import "./route.js";
9
+ import { updateRouteQuery } from "./route-query.js";
10
+ import { navigate } from "./navigate.js";
4
11
  import { Link } from "../components/link.js";
5
- export { Link, Outlet, allow, clearRoutes, currentRoute, deny, fallback, forbidden, getManifest, getRoutes, group, index, lazy, navigate, notFound, page, redirect, registerRoutes, requireAuth, requirePermission, requireRole, route, unauthorized, updateRouteQuery };
12
+ export { Link, Outlet, allow, clearRoutes, createRouteRegistry, currentRoute, deny, fallback, forbidden, getManifest, getRoutes, group, index, lazy, navigate, notFound, page, redirect, registerRoutes, requireAuth, requirePermission, requireRole, route, unauthorized, updateRouteQuery };