@real-router/core 0.79.0 → 0.80.0

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 (338) hide show
  1. package/dist/cjs/Router-DGUed2F4.js +2 -0
  2. package/dist/cjs/{Router-BRuC-daj.js.map → Router-DGUed2F4.js.map} +1 -1
  3. package/dist/cjs/{Router-BG5yNYUG.d.ts → Router.d.ts} +5 -4
  4. package/dist/cjs/Router.d.ts.map +1 -0
  5. package/dist/cjs/Router.js +2 -0
  6. package/dist/cjs/Router.js.map +1 -0
  7. package/dist/cjs/RouterError.d.ts +182 -0
  8. package/dist/cjs/RouterError.d.ts.map +1 -0
  9. package/dist/cjs/RouterError.js +2 -0
  10. package/dist/cjs/RouterError.js.map +1 -0
  11. package/dist/cjs/api/cloneRouter.d.ts +86 -0
  12. package/dist/cjs/api/cloneRouter.d.ts.map +1 -0
  13. package/dist/cjs/api/cloneRouter.js +2 -0
  14. package/dist/cjs/api/cloneRouter.js.map +1 -0
  15. package/dist/cjs/api/getDependenciesApi.d.ts +7 -0
  16. package/dist/cjs/api/getDependenciesApi.d.ts.map +1 -0
  17. package/dist/cjs/api/getDependenciesApi.js +2 -0
  18. package/dist/cjs/api/getDependenciesApi.js.map +1 -0
  19. package/dist/cjs/api/getLifecycleApi.d.ts +7 -0
  20. package/dist/cjs/api/getLifecycleApi.d.ts.map +1 -0
  21. package/dist/cjs/api/getLifecycleApi.js +2 -0
  22. package/dist/cjs/api/getLifecycleApi.js.map +1 -0
  23. package/dist/cjs/api/getPluginApi.d.ts +7 -0
  24. package/dist/cjs/api/getPluginApi.d.ts.map +1 -0
  25. package/dist/cjs/api/getPluginApi.js +2 -0
  26. package/dist/cjs/api/getPluginApi.js.map +1 -0
  27. package/dist/cjs/api/getRoutesApi.d.ts +7 -0
  28. package/dist/cjs/api/getRoutesApi.d.ts.map +1 -0
  29. package/dist/cjs/api/getRoutesApi.js +2 -0
  30. package/dist/cjs/api/getRoutesApi.js.map +1 -0
  31. package/dist/cjs/api/helpers.js +2 -0
  32. package/dist/cjs/api/helpers.js.map +1 -0
  33. package/dist/cjs/api/types.d.ts +9 -0
  34. package/dist/cjs/api/types.d.ts.map +1 -0
  35. package/dist/cjs/api.d.ts +8 -105
  36. package/dist/cjs/api.js +1 -2
  37. package/dist/cjs/api.js.map +1 -1
  38. package/dist/cjs/buildParamMeta-DniluAIV.js.map +1 -1
  39. package/dist/cjs/constants.d.ts +25 -0
  40. package/dist/cjs/constants.d.ts.map +1 -0
  41. package/dist/cjs/constants.js +2 -0
  42. package/dist/cjs/constants.js.map +1 -0
  43. package/dist/cjs/createRouter.d.ts +23 -0
  44. package/dist/cjs/createRouter.d.ts.map +1 -0
  45. package/dist/cjs/createRouter.js +2 -0
  46. package/dist/cjs/createRouter.js.map +1 -0
  47. package/dist/cjs/engine/builder/buildTree.js +2 -0
  48. package/dist/cjs/engine/builder/buildTree.js.map +1 -0
  49. package/dist/cjs/engine/builder/computeCaches.js +2 -0
  50. package/dist/cjs/engine/builder/computeCaches.js.map +1 -0
  51. package/dist/cjs/engine/builder/createRouteTree.js +2 -0
  52. package/dist/cjs/engine/builder/createRouteTree.js.map +1 -0
  53. package/dist/cjs/engine/builder/types.d.ts +48 -0
  54. package/dist/cjs/engine/builder/types.d.ts.map +1 -0
  55. package/dist/cjs/engine/createMatcher.d.ts +29 -0
  56. package/dist/cjs/engine/createMatcher.d.ts.map +1 -0
  57. package/dist/cjs/engine/createMatcher.js +2 -0
  58. package/dist/cjs/engine/createMatcher.js.map +1 -0
  59. package/dist/cjs/engine/operations/routeTreeToDefinitions.js +2 -0
  60. package/dist/cjs/engine/operations/routeTreeToDefinitions.js.map +1 -0
  61. package/dist/cjs/engine/path-matcher/SegmentMatcher.d.ts +16 -0
  62. package/dist/cjs/engine/path-matcher/SegmentMatcher.d.ts.map +1 -0
  63. package/dist/cjs/engine/path-matcher/SegmentMatcher.js +2 -0
  64. package/dist/cjs/engine/path-matcher/SegmentMatcher.js.map +1 -0
  65. package/dist/cjs/engine/path-matcher/buildParamMeta.js +2 -0
  66. package/dist/cjs/engine/path-matcher/buildParamMeta.js.map +1 -0
  67. package/dist/cjs/engine/path-matcher/encoding.js +2 -0
  68. package/dist/cjs/engine/path-matcher/encoding.js.map +1 -0
  69. package/dist/cjs/engine/path-matcher/parseSegment.js +2 -0
  70. package/dist/cjs/engine/path-matcher/parseSegment.js.map +1 -0
  71. package/dist/cjs/engine/path-matcher/pathUtils.js +2 -0
  72. package/dist/cjs/engine/path-matcher/pathUtils.js.map +1 -0
  73. package/dist/cjs/engine/path-matcher/percentEncoding.js +2 -0
  74. package/dist/cjs/engine/path-matcher/percentEncoding.js.map +1 -0
  75. package/dist/cjs/engine/path-matcher/registration/buildParts.js +2 -0
  76. package/dist/cjs/engine/path-matcher/registration/buildParts.js.map +1 -0
  77. package/dist/cjs/engine/path-matcher/registration/context.js +2 -0
  78. package/dist/cjs/engine/path-matcher/registration/context.js.map +1 -0
  79. package/dist/cjs/engine/path-matcher/registration/errors.js +2 -0
  80. package/dist/cjs/engine/path-matcher/registration/errors.js.map +1 -0
  81. package/dist/cjs/engine/path-matcher/registration/index.js +2 -0
  82. package/dist/cjs/engine/path-matcher/registration/index.js.map +1 -0
  83. package/dist/cjs/engine/path-matcher/registration/trie.js +2 -0
  84. package/dist/cjs/engine/path-matcher/registration/trie.js.map +1 -0
  85. package/dist/cjs/engine/path-matcher/registration/trieNodes.js +2 -0
  86. package/dist/cjs/engine/path-matcher/registration/trieNodes.js.map +1 -0
  87. package/dist/cjs/{types-DaXCTxi1.d.ts → engine/path-matcher/types.d.ts} +2 -47
  88. package/dist/cjs/engine/path-matcher/types.d.ts.map +1 -0
  89. package/dist/cjs/engine/search-params/decode.js +2 -0
  90. package/dist/cjs/engine/search-params/decode.js.map +1 -0
  91. package/dist/cjs/engine/search-params/encode.js +2 -0
  92. package/dist/cjs/engine/search-params/encode.js.map +1 -0
  93. package/dist/cjs/engine/search-params/searchParams.js +2 -0
  94. package/dist/cjs/engine/search-params/searchParams.js.map +1 -0
  95. package/dist/cjs/engine/search-params/strategies/array.js +2 -0
  96. package/dist/cjs/engine/search-params/strategies/array.js.map +1 -0
  97. package/dist/cjs/engine/search-params/strategies/boolean.js +2 -0
  98. package/dist/cjs/engine/search-params/strategies/boolean.js.map +1 -0
  99. package/dist/cjs/engine/search-params/strategies/index.js +2 -0
  100. package/dist/cjs/engine/search-params/strategies/index.js.map +1 -0
  101. package/dist/cjs/engine/search-params/strategies/null.js +2 -0
  102. package/dist/cjs/engine/search-params/strategies/null.js.map +1 -0
  103. package/dist/cjs/engine/search-params/strategies/number.js +2 -0
  104. package/dist/cjs/engine/search-params/strategies/number.js.map +1 -0
  105. package/dist/cjs/engine/search-params/types.d.ts +72 -0
  106. package/dist/cjs/engine/search-params/types.d.ts.map +1 -0
  107. package/dist/cjs/engine/search-params/utils.js +2 -0
  108. package/dist/cjs/engine/search-params/utils.js.map +1 -0
  109. package/dist/cjs/engine/validation/route-batch.d.ts +38 -0
  110. package/dist/cjs/engine/validation/route-batch.d.ts.map +1 -0
  111. package/dist/cjs/engine/validation/route-batch.js +2 -0
  112. package/dist/cjs/engine/validation/route-batch.js.map +1 -0
  113. package/dist/cjs/engine/validation/routes.js +2 -0
  114. package/dist/cjs/engine/validation/routes.js.map +1 -0
  115. package/dist/cjs/foundation/event-emitter/EventEmitter.js +2 -0
  116. package/dist/cjs/foundation/event-emitter/EventEmitter.js.map +1 -0
  117. package/dist/cjs/foundation/fsm/fsm.js +2 -0
  118. package/dist/cjs/foundation/fsm/fsm.js.map +1 -0
  119. package/dist/cjs/foundation/logger/RouterLogger.js +2 -0
  120. package/dist/cjs/foundation/logger/RouterLogger.js.map +1 -0
  121. package/dist/cjs/foundation/logger/constants.js +2 -0
  122. package/dist/cjs/foundation/logger/constants.js.map +1 -0
  123. package/dist/cjs/getNavigator.d.ts +6 -0
  124. package/dist/cjs/getNavigator.d.ts.map +1 -0
  125. package/dist/cjs/getNavigator.js +2 -0
  126. package/dist/cjs/getNavigator.js.map +1 -0
  127. package/dist/cjs/guards.js +2 -0
  128. package/dist/cjs/guards.js.map +1 -0
  129. package/dist/cjs/helpers.js +2 -0
  130. package/dist/cjs/helpers.js.map +1 -0
  131. package/dist/cjs/index.d.ts +17 -239
  132. package/dist/cjs/index.js +1 -2
  133. package/dist/cjs/internals.d.ts +98 -0
  134. package/dist/cjs/internals.d.ts.map +1 -0
  135. package/dist/cjs/internals.js +2 -0
  136. package/dist/cjs/internals.js.map +1 -0
  137. package/dist/cjs/namespaces/DependenciesNamespace/dependenciesStore.d.ts +10 -0
  138. package/dist/cjs/namespaces/DependenciesNamespace/dependenciesStore.d.ts.map +1 -0
  139. package/dist/cjs/namespaces/DependenciesNamespace/dependenciesStore.js +2 -0
  140. package/dist/cjs/namespaces/DependenciesNamespace/dependenciesStore.js.map +1 -0
  141. package/dist/cjs/namespaces/EventBusNamespace/EventBusNamespace.js +2 -0
  142. package/dist/cjs/namespaces/EventBusNamespace/EventBusNamespace.js.map +1 -0
  143. package/dist/cjs/namespaces/NavigationNamespace/NavigationNamespace.js +2 -0
  144. package/dist/cjs/namespaces/NavigationNamespace/NavigationNamespace.js.map +1 -0
  145. package/dist/cjs/namespaces/NavigationNamespace/constants.js +2 -0
  146. package/dist/cjs/namespaces/NavigationNamespace/constants.js.map +1 -0
  147. package/dist/cjs/namespaces/NavigationNamespace/transition/completeTransition.js +2 -0
  148. package/dist/cjs/namespaces/NavigationNamespace/transition/completeTransition.js.map +1 -0
  149. package/dist/cjs/namespaces/NavigationNamespace/transition/errorHandling.js +2 -0
  150. package/dist/cjs/namespaces/NavigationNamespace/transition/errorHandling.js.map +1 -0
  151. package/dist/cjs/namespaces/NavigationNamespace/transition/guardPhase.js +2 -0
  152. package/dist/cjs/namespaces/NavigationNamespace/transition/guardPhase.js.map +1 -0
  153. package/dist/cjs/namespaces/OptionsNamespace/OptionsNamespace.js +2 -0
  154. package/dist/cjs/namespaces/OptionsNamespace/OptionsNamespace.js.map +1 -0
  155. package/dist/cjs/namespaces/OptionsNamespace/constants.js +2 -0
  156. package/dist/cjs/namespaces/OptionsNamespace/constants.js.map +1 -0
  157. package/dist/cjs/namespaces/OptionsNamespace/helpers.js +2 -0
  158. package/dist/cjs/namespaces/OptionsNamespace/helpers.js.map +1 -0
  159. package/dist/cjs/namespaces/OptionsNamespace/validators.js +2 -0
  160. package/dist/cjs/namespaces/OptionsNamespace/validators.js.map +1 -0
  161. package/dist/cjs/namespaces/PluginsNamespace/PluginsNamespace.js +2 -0
  162. package/dist/cjs/namespaces/PluginsNamespace/PluginsNamespace.js.map +1 -0
  163. package/dist/cjs/namespaces/PluginsNamespace/constants.js +2 -0
  164. package/dist/cjs/namespaces/PluginsNamespace/constants.js.map +1 -0
  165. package/dist/cjs/namespaces/PluginsNamespace/validators.js +2 -0
  166. package/dist/cjs/namespaces/PluginsNamespace/validators.js.map +1 -0
  167. package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts +174 -0
  168. package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts.map +1 -0
  169. package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.js +2 -0
  170. package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.js.map +1 -0
  171. package/dist/cjs/namespaces/RouteLifecycleNamespace/types.d.ts +17 -0
  172. package/dist/cjs/namespaces/RouteLifecycleNamespace/types.d.ts.map +1 -0
  173. package/dist/cjs/namespaces/RouterLifecycleNamespace/RouterLifecycleNamespace.js +2 -0
  174. package/dist/cjs/namespaces/RouterLifecycleNamespace/RouterLifecycleNamespace.js.map +1 -0
  175. package/dist/cjs/namespaces/RouterLifecycleNamespace/constants.js +2 -0
  176. package/dist/cjs/namespaces/RouterLifecycleNamespace/constants.js.map +1 -0
  177. package/dist/cjs/namespaces/RoutesNamespace/RoutesNamespace.js +2 -0
  178. package/dist/cjs/namespaces/RoutesNamespace/RoutesNamespace.js.map +1 -0
  179. package/dist/cjs/namespaces/RoutesNamespace/constants.js +2 -0
  180. package/dist/cjs/namespaces/RoutesNamespace/constants.js.map +1 -0
  181. package/dist/cjs/namespaces/RoutesNamespace/forwardChain.d.ts +5 -0
  182. package/dist/cjs/namespaces/RoutesNamespace/forwardChain.d.ts.map +1 -0
  183. package/dist/cjs/namespaces/RoutesNamespace/forwardChain.js +2 -0
  184. package/dist/cjs/namespaces/RoutesNamespace/forwardChain.js.map +1 -0
  185. package/dist/cjs/namespaces/RoutesNamespace/helpers.js +2 -0
  186. package/dist/cjs/namespaces/RoutesNamespace/helpers.js.map +1 -0
  187. package/dist/cjs/namespaces/RoutesNamespace/routeGuards.js +2 -0
  188. package/dist/cjs/namespaces/RoutesNamespace/routeGuards.js.map +1 -0
  189. package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts +42 -0
  190. package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts.map +1 -0
  191. package/dist/cjs/namespaces/RoutesNamespace/routesStore.js +2 -0
  192. package/dist/cjs/namespaces/RoutesNamespace/routesStore.js.map +1 -0
  193. package/dist/cjs/namespaces/RoutesNamespace/types.d.ts +57 -0
  194. package/dist/cjs/namespaces/RoutesNamespace/types.d.ts.map +1 -0
  195. package/dist/cjs/namespaces/StateNamespace/StateNamespace.js +2 -0
  196. package/dist/cjs/namespaces/StateNamespace/StateNamespace.js.map +1 -0
  197. package/dist/cjs/namespaces/StateNamespace/helpers.js +2 -0
  198. package/dist/cjs/namespaces/StateNamespace/helpers.js.map +1 -0
  199. package/dist/cjs/routerFSM.js +2 -0
  200. package/dist/cjs/routerFSM.js.map +1 -0
  201. package/dist/cjs/stateMetaStore.js +2 -0
  202. package/dist/cjs/stateMetaStore.js.map +1 -0
  203. package/dist/cjs/transitionPath.js +2 -0
  204. package/dist/cjs/transitionPath.js.map +1 -0
  205. package/dist/cjs/{RouterValidator-CZ8kPkrI.d.ts → types/RouterValidator.d.ts} +2 -2
  206. package/dist/cjs/types/RouterValidator.d.ts.map +1 -0
  207. package/dist/cjs/types/api.d.ts +184 -0
  208. package/dist/cjs/types/api.d.ts.map +1 -0
  209. package/dist/cjs/types/base.d.ts +95 -0
  210. package/dist/cjs/types/base.d.ts.map +1 -0
  211. package/dist/cjs/types/constants.d.ts +72 -0
  212. package/dist/cjs/types/constants.d.ts.map +1 -0
  213. package/dist/cjs/types/internal.d.ts +9 -0
  214. package/dist/cjs/types/internal.d.ts.map +1 -0
  215. package/dist/cjs/types/limits.d.ts +45 -0
  216. package/dist/cjs/types/limits.d.ts.map +1 -0
  217. package/dist/cjs/types/route-node-types.d.ts +46 -0
  218. package/dist/cjs/types/route-node-types.d.ts.map +1 -0
  219. package/dist/cjs/types/router.d.ts +313 -0
  220. package/dist/cjs/types/router.d.ts.map +1 -0
  221. package/dist/cjs/types/tree-changed.d.ts +55 -0
  222. package/dist/cjs/types/tree-changed.d.ts.map +1 -0
  223. package/dist/cjs/types.d.ts +208 -2
  224. package/dist/cjs/types.d.ts.map +1 -0
  225. package/dist/cjs/validation.d.ts +6 -518
  226. package/dist/cjs/validation.js +1 -2
  227. package/dist/cjs/wiring/wireNamespaces.js +2 -0
  228. package/dist/cjs/wiring/wireNamespaces.js.map +1 -0
  229. package/dist/esm/Router-Bk6PfSE8.mjs +2 -0
  230. package/dist/esm/{Router-DikzugaD.mjs.map → Router-Bk6PfSE8.mjs.map} +1 -1
  231. package/dist/esm/{Router-Cy75qbgU.d.mts → Router.d.mts} +5 -4
  232. package/dist/esm/Router.d.mts.map +1 -0
  233. package/dist/esm/RouterError.d.mts +182 -0
  234. package/dist/esm/RouterError.d.mts.map +1 -0
  235. package/dist/esm/api/cloneRouter.d.mts +86 -0
  236. package/dist/esm/api/cloneRouter.d.mts.map +1 -0
  237. package/dist/esm/api/getDependenciesApi.d.mts +7 -0
  238. package/dist/esm/api/getDependenciesApi.d.mts.map +1 -0
  239. package/dist/esm/api/getLifecycleApi.d.mts +7 -0
  240. package/dist/esm/api/getLifecycleApi.d.mts.map +1 -0
  241. package/dist/esm/api/getPluginApi.d.mts +7 -0
  242. package/dist/esm/api/getPluginApi.d.mts.map +1 -0
  243. package/dist/esm/api/getRoutesApi.d.mts +7 -0
  244. package/dist/esm/api/getRoutesApi.d.mts.map +1 -0
  245. package/dist/esm/api/types.d.mts +9 -0
  246. package/dist/esm/api/types.d.mts.map +1 -0
  247. package/dist/esm/api.d.mts +8 -105
  248. package/dist/esm/api.mjs +1 -1
  249. package/dist/esm/api.mjs.map +1 -1
  250. package/dist/esm/buildParamMeta-bOLhLF9h.mjs.map +1 -1
  251. package/dist/esm/constants.d.mts +25 -0
  252. package/dist/esm/constants.d.mts.map +1 -0
  253. package/dist/esm/createRouter.d.mts +23 -0
  254. package/dist/esm/createRouter.d.mts.map +1 -0
  255. package/dist/esm/engine/builder/types.d.mts +48 -0
  256. package/dist/esm/engine/builder/types.d.mts.map +1 -0
  257. package/dist/esm/engine/createMatcher.d.mts +29 -0
  258. package/dist/esm/engine/createMatcher.d.mts.map +1 -0
  259. package/dist/esm/engine/path-matcher/SegmentMatcher.d.mts +16 -0
  260. package/dist/esm/engine/path-matcher/SegmentMatcher.d.mts.map +1 -0
  261. package/dist/esm/{types-DaXCTxi1.d.mts → engine/path-matcher/types.d.mts} +2 -47
  262. package/dist/esm/engine/path-matcher/types.d.mts.map +1 -0
  263. package/dist/esm/engine/search-params/types.d.mts +72 -0
  264. package/dist/esm/engine/search-params/types.d.mts.map +1 -0
  265. package/dist/esm/engine/validation/route-batch.d.mts +38 -0
  266. package/dist/esm/engine/validation/route-batch.d.mts.map +1 -0
  267. package/dist/esm/getNavigator.d.mts +6 -0
  268. package/dist/esm/getNavigator.d.mts.map +1 -0
  269. package/dist/esm/index.d.mts +17 -239
  270. package/dist/esm/index.mjs +1 -1
  271. package/dist/esm/internals.d.mts +98 -0
  272. package/dist/esm/internals.d.mts.map +1 -0
  273. package/dist/esm/namespaces/DependenciesNamespace/dependenciesStore.d.mts +10 -0
  274. package/dist/esm/namespaces/DependenciesNamespace/dependenciesStore.d.mts.map +1 -0
  275. package/dist/esm/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.mts +174 -0
  276. package/dist/esm/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.mts.map +1 -0
  277. package/dist/esm/namespaces/RouteLifecycleNamespace/types.d.mts +17 -0
  278. package/dist/esm/namespaces/RouteLifecycleNamespace/types.d.mts.map +1 -0
  279. package/dist/esm/namespaces/RoutesNamespace/forwardChain.d.mts +5 -0
  280. package/dist/esm/namespaces/RoutesNamespace/forwardChain.d.mts.map +1 -0
  281. package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts +42 -0
  282. package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts.map +1 -0
  283. package/dist/esm/namespaces/RoutesNamespace/types.d.mts +57 -0
  284. package/dist/esm/namespaces/RoutesNamespace/types.d.mts.map +1 -0
  285. package/dist/esm/{RouterValidator-CZ8kPkrI.d.mts → types/RouterValidator.d.mts} +2 -2
  286. package/dist/esm/types/RouterValidator.d.mts.map +1 -0
  287. package/dist/esm/types/api.d.mts +184 -0
  288. package/dist/esm/types/api.d.mts.map +1 -0
  289. package/dist/esm/types/base.d.mts +95 -0
  290. package/dist/esm/types/base.d.mts.map +1 -0
  291. package/dist/esm/types/constants.d.mts +72 -0
  292. package/dist/esm/types/constants.d.mts.map +1 -0
  293. package/dist/esm/types/internal.d.mts +9 -0
  294. package/dist/esm/types/internal.d.mts.map +1 -0
  295. package/dist/esm/types/limits.d.mts +45 -0
  296. package/dist/esm/types/limits.d.mts.map +1 -0
  297. package/dist/esm/types/route-node-types.d.mts +46 -0
  298. package/dist/esm/types/route-node-types.d.mts.map +1 -0
  299. package/dist/esm/types/router.d.mts +313 -0
  300. package/dist/esm/types/router.d.mts.map +1 -0
  301. package/dist/esm/types/tree-changed.d.mts +55 -0
  302. package/dist/esm/types/tree-changed.d.mts.map +1 -0
  303. package/dist/esm/types.d.mts +208 -2
  304. package/dist/esm/types.d.mts.map +1 -0
  305. package/dist/esm/validation.d.mts +6 -518
  306. package/package.json +5 -14
  307. package/dist/cjs/Router-BG5yNYUG.d.ts.map +0 -1
  308. package/dist/cjs/Router-BRuC-daj.js +0 -2
  309. package/dist/cjs/RouterValidator-CZ8kPkrI.d.ts.map +0 -1
  310. package/dist/cjs/api.d.ts.map +0 -1
  311. package/dist/cjs/cloneRouter-3AOUeQ8M.js +0 -2
  312. package/dist/cjs/cloneRouter-3AOUeQ8M.js.map +0 -1
  313. package/dist/cjs/index-CAnGQpnz.d.ts +0 -974
  314. package/dist/cjs/index-CAnGQpnz.d.ts.map +0 -1
  315. package/dist/cjs/index-DDrryY2U.d.ts +0 -309
  316. package/dist/cjs/index-DDrryY2U.d.ts.map +0 -1
  317. package/dist/cjs/index.d.ts.map +0 -1
  318. package/dist/cjs/types-DaXCTxi1.d.ts.map +0 -1
  319. package/dist/cjs/utils.d.ts +0 -2
  320. package/dist/cjs/utils.js +0 -2
  321. package/dist/cjs/utils.js.map +0 -1
  322. package/dist/cjs/validation.d.ts.map +0 -1
  323. package/dist/esm/Router-Cy75qbgU.d.mts.map +0 -1
  324. package/dist/esm/Router-DikzugaD.mjs +0 -2
  325. package/dist/esm/RouterValidator-CZ8kPkrI.d.mts.map +0 -1
  326. package/dist/esm/api.d.mts.map +0 -1
  327. package/dist/esm/cloneRouter-CAh5vA3l.mjs +0 -2
  328. package/dist/esm/cloneRouter-CAh5vA3l.mjs.map +0 -1
  329. package/dist/esm/index-CAnGQpnz.d.mts +0 -974
  330. package/dist/esm/index-CAnGQpnz.d.mts.map +0 -1
  331. package/dist/esm/index-DnSU6huX.d.mts +0 -309
  332. package/dist/esm/index-DnSU6huX.d.mts.map +0 -1
  333. package/dist/esm/index.d.mts.map +0 -1
  334. package/dist/esm/types-DaXCTxi1.d.mts.map +0 -1
  335. package/dist/esm/utils.d.mts +0 -2
  336. package/dist/esm/utils.mjs +0 -2
  337. package/dist/esm/utils.mjs.map +0 -1
  338. package/dist/esm/validation.d.mts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StateNamespace.js","names":["#frozenState","#previousState","freezeStateInPlace","#deps","EMPTY_PARAMS","DEFAULT_TRANSITION","areParamValuesEqual"],"sources":["../../../../src/namespaces/StateNamespace/StateNamespace.ts"],"sourcesContent":["// packages/core/src/namespaces/StateNamespace/StateNamespace.ts\n\nimport { areParamValuesEqual } from \"./helpers\";\nimport { DEFAULT_TRANSITION, EMPTY_PARAMS } from \"../../constants\";\nimport { freezeStateInPlace } from \"../../helpers\";\nimport { setStateMetaParams } from \"../../stateMetaStore\";\n\nimport type { StateNamespaceDependencies } from \"./types\";\nimport type { RouteTreeStateMeta } from \"../../engine\";\nimport type { Params, State } from \"../../types\";\n\n/**\n * Independent namespace for managing router state storage and creation.\n *\n * Static methods handle validation (called by facade).\n * Instance methods handle state storage, freezing, and creation.\n */\nexport class StateNamespace {\n /**\n * Cached frozen state - avoids structuredClone on every getState() call.\n */\n #frozenState: State | undefined = undefined;\n\n /**\n * Previous state before the last setState call.\n */\n #previousState: State | undefined = undefined;\n\n /**\n * Dependencies injected from Router.\n */\n #deps!: StateNamespaceDependencies;\n\n // =========================================================================\n // Instance methods (trust input - already validated by facade)\n // =========================================================================\n\n /**\n * Returns the current router state.\n *\n * The returned state is deeply frozen (immutable) for safety.\n * Returns `undefined` if the router has not been started or has been stopped.\n */\n get<P extends Params = Params>(): State<P> | undefined {\n return this.#frozenState as State<P> | undefined; // NOSONAR -- generic narrowing needed for public API\n }\n\n /**\n * Sets the current router state.\n *\n * The state is deeply frozen before storage to ensure immutability.\n * The previous state is preserved and accessible via `getPrevious()`.\n *\n * @param state - Already validated by facade, or undefined to clear\n */\n set(state: State | undefined): void {\n // Preserve current state as previous before updating\n this.#previousState = this.#frozenState;\n\n // If state is already frozen (from makeState()), use it directly.\n // For external states, freeze in place without cloning.\n this.#frozenState = state ? freezeStateInPlace(state) : undefined;\n }\n\n /**\n * Returns the previous router state (before the last navigation).\n */\n getPrevious(): State | undefined {\n return this.#previousState;\n }\n\n reset(): void {\n this.#frozenState = undefined;\n this.#previousState = undefined;\n }\n\n // =========================================================================\n // Dependency Injection\n // =========================================================================\n\n /**\n * Sets dependencies for state creation methods.\n * Must be called before using makeState, areStatesEqual, etc.\n */\n setDependencies(deps: StateNamespaceDependencies): void {\n this.#deps = deps;\n }\n\n // =========================================================================\n // State Creation Methods\n // =========================================================================\n\n /**\n * Creates a state object for a route.\n *\n * `params` is frozen at creation so it is always immutable, even when\n * `skipFreeze=true` is passed to defer the outer `Object.freeze(state)` call.\n * This keeps params-freezing invariants independent of transition-pipeline\n * mutation (e.g. `completeTransition` attaching `state.transition`).\n *\n * `context` is initialized as a fresh empty object — intentionally NOT frozen\n * so plugins can publish data via `claim.write(state, value)` after creation.\n */\n makeState<P extends Params = Params>(\n name: string,\n params?: P,\n path?: string,\n meta?: RouteTreeStateMeta,\n skipFreeze?: boolean,\n ): State<P> {\n // Optimization: O(1) lookup instead of O(depth) ancestor iteration\n const defaultParamsConfig = this.#deps.getDefaultParams();\n const hasDefaultParams = Object.hasOwn(defaultParamsConfig, name);\n\n // Conditional allocation: avoid spreading when no defaultParams exist\n let mergedParams: P;\n\n if (hasDefaultParams) {\n mergedParams = Object.freeze({\n ...defaultParamsConfig[name],\n ...params,\n }) as P;\n } else if (!params || params === EMPTY_PARAMS) {\n mergedParams = EMPTY_PARAMS as P;\n } else {\n mergedParams = Object.freeze({ ...params });\n }\n\n const state = {\n name,\n params: mergedParams,\n path: path ?? this.#deps.buildPath(name, params),\n context: {},\n ...(!skipFreeze && { transition: DEFAULT_TRANSITION }),\n } as State<P>;\n\n if (meta) {\n setStateMetaParams(state, meta);\n }\n\n return skipFreeze ? state : freezeStateInPlace(state);\n }\n\n // =========================================================================\n // State Comparison Methods\n // =========================================================================\n\n /**\n * Compares two states for equality.\n * By default, ignores query params (only compares URL params).\n */\n areStatesEqual(\n state1: State | undefined,\n state2: State | undefined,\n ignoreQueryParams = true,\n ): boolean {\n if (!state1 || !state2) {\n return !!state1 === !!state2;\n }\n\n if (state1.name !== state2.name) {\n return false;\n }\n\n if (ignoreQueryParams) {\n // URL (path) param names are cached at the routes layer and invalidated\n // on every tree mutation, so this stays correct after replace() (#723).\n const urlParams = this.#deps.getUrlParams(state1.name);\n\n for (const urlParam of urlParams) {\n if (\n !areParamValuesEqual(state1.params[urlParam], state2.params[urlParam])\n ) {\n return false;\n }\n }\n\n return true;\n }\n\n const state1Keys = Object.keys(state1.params);\n const state2Keys = Object.keys(state2.params);\n\n if (state1Keys.length !== state2Keys.length) {\n return false;\n }\n\n for (const param of state1Keys) {\n if (\n !(param in state2.params) ||\n !areParamValuesEqual(state1.params[param], state2.params[param])\n ) {\n return false;\n }\n }\n\n return true;\n }\n}\n"],"mappings":"mIAiBA,IAAa,EAAb,KAA4B,CAI1B,GAAkC,IAAA,GAKlC,GAAoC,IAAA,GAKpC,GAYA,KAAuD,CACrD,OAAO,KAAKA,EACd,CAUA,IAAI,EAAgC,CAElC,KAAKC,GAAiB,KAAKD,GAI3B,KAAKA,GAAe,EAAQE,EAAAA,mBAAmB,CAAK,EAAI,IAAA,EAC1D,CAKA,aAAiC,CAC/B,OAAO,KAAKD,EACd,CAEA,OAAc,CACZ,KAAKD,GAAe,IAAA,GACpB,KAAKC,GAAiB,IAAA,EACxB,CAUA,gBAAgB,EAAwC,CACtD,KAAKE,GAAQ,CACf,CAiBA,UACE,EACA,EACA,EACA,EACA,EACU,CAEV,IAAM,EAAsB,KAAKA,GAAM,iBAAiB,EAClD,EAAmB,OAAO,OAAO,EAAqB,CAAI,EAG5D,EAEJ,AAQE,EARE,EACa,OAAO,OAAO,CAC3B,GAAG,EAAoB,GACvB,GAAG,CACL,CAAC,EACQ,CAAC,GAAU,IAAWC,EAAAA,aAChBA,EAAAA,aAEA,OAAO,OAAO,CAAE,GAAG,CAAO,CAAC,EAG5C,IAAM,EAAQ,CACZ,OACA,OAAQ,EACR,KAAM,GAAQ,KAAKD,GAAM,UAAU,EAAM,CAAM,EAC/C,QAAS,CAAC,EACV,GAAI,CAAC,GAAc,CAAE,WAAYE,EAAAA,kBAAmB,CACtD,EAMA,OAJI,GACF,EAAA,mBAAmB,EAAO,CAAI,EAGzB,EAAa,EAAQH,EAAAA,mBAAmB,CAAK,CACtD,CAUA,eACE,EACA,EACA,EAAoB,GACX,CACT,GAAI,CAAC,GAAU,CAAC,EACd,MAAO,CAAC,CAAC,GAAW,CAAC,CAAC,EAGxB,GAAI,EAAO,OAAS,EAAO,KACzB,MAAO,GAGT,GAAI,EAAmB,CAGrB,IAAM,EAAY,KAAKC,GAAM,aAAa,EAAO,IAAI,EAErD,IAAK,IAAM,KAAY,EACrB,GACE,CAACG,EAAAA,oBAAoB,EAAO,OAAO,GAAW,EAAO,OAAO,EAAS,EAErE,MAAO,GAIX,MAAO,EACT,CAEA,IAAM,EAAa,OAAO,KAAK,EAAO,MAAM,EACtC,EAAa,OAAO,KAAK,EAAO,MAAM,EAE5C,GAAI,EAAW,SAAW,EAAW,OACnC,MAAO,GAGT,IAAK,IAAM,KAAS,EAClB,GACE,EAAE,KAAS,EAAO,SAClB,CAACA,EAAAA,oBAAoB,EAAO,OAAO,GAAQ,EAAO,OAAO,EAAM,EAE/D,MAAO,GAIX,MAAO,EACT,CACF"}
@@ -0,0 +1,2 @@
1
+ function e(t,n){if(t===n)return!0;if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}return!1}exports.areParamValuesEqual=e;
2
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","names":[],"sources":["../../../../src/namespaces/StateNamespace/helpers.ts"],"sourcesContent":["// packages/core/src/namespaces/StateNamespace/helpers.ts\n\nexport function areParamValuesEqual(val1: unknown, val2: unknown): boolean {\n if (val1 === val2) {\n return true;\n }\n\n if (Array.isArray(val1) && Array.isArray(val2)) {\n if (val1.length !== val2.length) {\n return false;\n }\n\n // eslint-disable-next-line unicorn/no-for-loop -- hot path: for-of entries() allocates iterator per recursive call\n for (let i = 0; i < val1.length; i++) {\n if (!areParamValuesEqual(val1[i], val2[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n"],"mappings":"AAEA,SAAgB,EAAoB,EAAe,EAAwB,CACzE,GAAI,IAAS,EACX,MAAO,GAGT,GAAI,MAAM,QAAQ,CAAI,GAAK,MAAM,QAAQ,CAAI,EAAG,CAC9C,GAAI,EAAK,SAAW,EAAK,OACvB,MAAO,GAIT,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,OAAQ,IAC/B,GAAI,CAAC,EAAoB,EAAK,GAAI,EAAK,EAAE,EACvC,MAAO,GAIX,MAAO,EACT,CAEA,MAAO,EACT"}
@@ -0,0 +1,2 @@
1
+ const e=require("./foundation/fsm/fsm.js"),t={IDLE:`IDLE`,STARTING:`STARTING`,READY:`READY`,TRANSITION_STARTED:`TRANSITION_STARTED`,LEAVE_APPROVED:`LEAVE_APPROVED`,DISPOSED:`DISPOSED`},n={START:`START`,STARTED:`STARTED`,NAVIGATE:`NAVIGATE`,LEAVE_APPROVE:`LEAVE_APPROVE`,COMPLETE:`COMPLETE`,FAIL:`FAIL`,CANCEL:`CANCEL`,STOP:`STOP`,DISPOSE:`DISPOSE`},r={initial:t.IDLE,context:null,transitions:{[t.IDLE]:{[n.START]:t.STARTING,[n.DISPOSE]:t.DISPOSED},[t.STARTING]:{[n.STARTED]:t.READY,[n.FAIL]:t.IDLE,[n.STOP]:t.IDLE,[n.DISPOSE]:t.DISPOSED},[t.READY]:{[n.NAVIGATE]:t.TRANSITION_STARTED,[n.FAIL]:t.READY,[n.STOP]:t.IDLE,[n.DISPOSE]:t.DISPOSED},[t.TRANSITION_STARTED]:{[n.NAVIGATE]:t.TRANSITION_STARTED,[n.LEAVE_APPROVE]:t.LEAVE_APPROVED,[n.CANCEL]:t.READY,[n.FAIL]:t.READY,[n.DISPOSE]:t.DISPOSED},[t.LEAVE_APPROVED]:{[n.NAVIGATE]:t.TRANSITION_STARTED,[n.COMPLETE]:t.READY,[n.CANCEL]:t.READY,[n.FAIL]:t.READY,[n.DISPOSE]:t.DISPOSED},[t.DISPOSED]:{}}};function i(){return new e.FSM(r)}exports.createRouterFSM=i,exports.routerEvents=n,exports.routerStates=t;
2
+ //# sourceMappingURL=routerFSM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routerFSM.js","names":["FSM"],"sources":["../../src/routerFSM.ts"],"sourcesContent":["// packages/core/src/routerFSM.ts\n\nimport { FSM } from \"./foundation/fsm\";\n\nimport type { FSMConfig } from \"./foundation/fsm\";\nimport type { NavigationOptions, State } from \"./types\";\n\n/**\n * Router FSM states.\n *\n * - IDLE: Router not started or stopped\n * - STARTING: Router is initializing\n * - READY: Router is ready for navigation\n * - TRANSITION_STARTED: Navigation in progress (before deactivation guards)\n * - LEAVE_APPROVED: Deactivation guards passed, activation guards pending\n * - DISPOSED: Router has been disposed (R2+)\n */\nexport const routerStates = {\n IDLE: \"IDLE\",\n STARTING: \"STARTING\",\n READY: \"READY\",\n TRANSITION_STARTED: \"TRANSITION_STARTED\",\n LEAVE_APPROVED: \"LEAVE_APPROVED\",\n DISPOSED: \"DISPOSED\",\n} as const;\n\nexport type RouterState = (typeof routerStates)[keyof typeof routerStates];\n\n/**\n * Router FSM events.\n *\n * - START: Begin router initialization\n * - STARTED: Router initialization complete\n * - NAVIGATE: Begin navigation\n * - COMPLETE: Navigation completed successfully\n * - FAIL: Navigation or initialization failed\n * - CANCEL: Navigation cancelled\n * - STOP: Stop router\n * - DISPOSE: Dispose router (R2+)\n */\nexport const routerEvents = {\n START: \"START\",\n STARTED: \"STARTED\",\n NAVIGATE: \"NAVIGATE\",\n LEAVE_APPROVE: \"LEAVE_APPROVE\",\n COMPLETE: \"COMPLETE\",\n FAIL: \"FAIL\",\n CANCEL: \"CANCEL\",\n STOP: \"STOP\",\n DISPOSE: \"DISPOSE\",\n} as const;\n\nexport type RouterEvent = (typeof routerEvents)[keyof typeof routerEvents];\n\n/**\n * Per-event payloads for the router FSM (#1169 commit-gate). The three hot\n * navigation transitions carry their transition states so the FSM action\n * dispatched by `send()` emits the matching transition event — i.e. events are\n * literal consequences of FSM transitions (no `forceState` + manual emit). See\n * `EventBusNamespace.#setupFSMActions`.\n */\nexport interface RouterPayloads {\n NAVIGATE: { toState: State; fromState?: State | undefined };\n LEAVE_APPROVE: { toState: State; fromState?: State | undefined };\n COMPLETE: {\n toState: State;\n fromState?: State | undefined;\n opts?: NavigationOptions | undefined;\n };\n}\n\n/**\n * Router FSM configuration.\n *\n * Transitions:\n * - IDLE → STARTING (START), DISPOSED (DISPOSE)\n * - STARTING → READY (STARTED), IDLE (FAIL, STOP), DISPOSED (DISPOSE)\n * - READY → TRANSITION_STARTED (NAVIGATE), READY (FAIL, self-loop for early validation errors), IDLE (STOP), DISPOSED (DISPOSE)\n * - TRANSITION_STARTED → LEAVE_APPROVED (LEAVE_APPROVE), TRANSITION_STARTED (NAVIGATE, self-loop), READY (CANCEL, FAIL), DISPOSED (DISPOSE)\n * - LEAVE_APPROVED → READY (COMPLETE, CANCEL, FAIL), TRANSITION_STARTED (NAVIGATE), DISPOSED (DISPOSE)\n * - DISPOSED → (no transitions)\n *\n * DISPOSE is wired from every non-DISPOSED state so `router.dispose()` always\n * settles the FSM at DISPOSED. The facade orchestrates cleanup through IDLE\n * for healthy flows; the direct transitions guarantee the FSM is not left\n * stuck if cleanup is skipped (e.g. dispose mid-STARTING when the start\n * pipeline threw before STARTED/FAIL).\n */\nconst routerFSMConfig: FSMConfig<RouterState, RouterEvent, null> = {\n initial: routerStates.IDLE,\n context: null,\n transitions: {\n [routerStates.IDLE]: {\n [routerEvents.START]: routerStates.STARTING,\n [routerEvents.DISPOSE]: routerStates.DISPOSED,\n },\n [routerStates.STARTING]: {\n [routerEvents.STARTED]: routerStates.READY,\n [routerEvents.FAIL]: routerStates.IDLE,\n [routerEvents.STOP]: routerStates.IDLE,\n [routerEvents.DISPOSE]: routerStates.DISPOSED,\n },\n [routerStates.READY]: {\n [routerEvents.NAVIGATE]: routerStates.TRANSITION_STARTED,\n [routerEvents.FAIL]: routerStates.READY,\n [routerEvents.STOP]: routerStates.IDLE,\n [routerEvents.DISPOSE]: routerStates.DISPOSED,\n },\n [routerStates.TRANSITION_STARTED]: {\n [routerEvents.NAVIGATE]: routerStates.TRANSITION_STARTED,\n [routerEvents.LEAVE_APPROVE]: routerStates.LEAVE_APPROVED,\n [routerEvents.CANCEL]: routerStates.READY,\n [routerEvents.FAIL]: routerStates.READY,\n [routerEvents.DISPOSE]: routerStates.DISPOSED,\n },\n [routerStates.LEAVE_APPROVED]: {\n [routerEvents.NAVIGATE]: routerStates.TRANSITION_STARTED,\n [routerEvents.COMPLETE]: routerStates.READY,\n [routerEvents.CANCEL]: routerStates.READY,\n [routerEvents.FAIL]: routerStates.READY,\n [routerEvents.DISPOSE]: routerStates.DISPOSED,\n },\n [routerStates.DISPOSED]: {},\n },\n};\n\n/**\n * Factory function to create a router FSM instance.\n *\n * @returns FSM instance with initial state \"IDLE\"\n */\nexport function createRouterFSM(): FSM<\n RouterState,\n RouterEvent,\n null,\n RouterPayloads\n> {\n return new FSM<RouterState, RouterEvent, null, RouterPayloads>(\n routerFSMConfig,\n );\n}\n"],"mappings":"2CAiBa,EAAe,CAC1B,KAAM,OACN,SAAU,WACV,MAAO,QACP,mBAAoB,qBACpB,eAAgB,iBAChB,SAAU,UACZ,EAgBa,EAAe,CAC1B,MAAO,QACP,QAAS,UACT,SAAU,WACV,cAAe,gBACf,SAAU,WACV,KAAM,OACN,OAAQ,SACR,KAAM,OACN,QAAS,SACX,EAsCM,EAA6D,CACjE,QAAS,EAAa,KACtB,QAAS,KACT,YAAa,EACV,EAAa,MAAO,EAClB,EAAa,OAAQ,EAAa,UAClC,EAAa,SAAU,EAAa,QACvC,GACC,EAAa,UAAW,EACtB,EAAa,SAAU,EAAa,OACpC,EAAa,MAAO,EAAa,MACjC,EAAa,MAAO,EAAa,MACjC,EAAa,SAAU,EAAa,QACvC,GACC,EAAa,OAAQ,EACnB,EAAa,UAAW,EAAa,oBACrC,EAAa,MAAO,EAAa,OACjC,EAAa,MAAO,EAAa,MACjC,EAAa,SAAU,EAAa,QACvC,GACC,EAAa,oBAAqB,EAChC,EAAa,UAAW,EAAa,oBACrC,EAAa,eAAgB,EAAa,gBAC1C,EAAa,QAAS,EAAa,OACnC,EAAa,MAAO,EAAa,OACjC,EAAa,SAAU,EAAa,QACvC,GACC,EAAa,gBAAiB,EAC5B,EAAa,UAAW,EAAa,oBACrC,EAAa,UAAW,EAAa,OACrC,EAAa,QAAS,EAAa,OACnC,EAAa,MAAO,EAAa,OACjC,EAAa,SAAU,EAAa,QACvC,GACC,EAAa,UAAW,CAAC,CAC5B,CACF,EAOA,SAAgB,GAKd,CACA,OAAO,IAAIA,EAAAA,IACT,CACF,CACF"}
@@ -0,0 +1,2 @@
1
+ const e=new WeakMap;function t(t){return e.get(t)}function n(t,n){e.set(t,n)}exports.getStateMetaParams=t,exports.setStateMetaParams=n;
2
+ //# sourceMappingURL=stateMetaStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateMetaStore.js","names":[],"sources":["../../src/stateMetaStore.ts"],"sourcesContent":["// packages/core/src/stateMetaStore.ts\n\nimport type { Params, State } from \"./types\";\n\nconst store = new WeakMap<State, Params>();\n\n/** @internal */\nexport function getStateMetaParams(state: State): Params | undefined {\n return store.get(state);\n}\n\n/** @internal */\nexport function setStateMetaParams(state: State, params: Params): void {\n store.set(state, params);\n}\n"],"mappings":"AAIA,MAAM,EAAQ,IAAI,QAGlB,SAAgB,EAAmB,EAAkC,CACnE,OAAO,EAAM,IAAI,CAAK,CACxB,CAGA,SAAgB,EAAmB,EAAc,EAAsB,CACrE,EAAM,IAAI,EAAO,CAAM,CACzB"}
@@ -0,0 +1,2 @@
1
+ const e=require("./stateMetaStore.js"),t=[];Object.freeze(t);function n(e){let t=e.split(`.`),n=t.length,r=[t[0]],i=t[0].length;for(let a=1;a<n-1;a++)i+=1+t[a].length,r.push(e.slice(0,i));return r.push(e),r}const r=new Set([`string`,`number`,`boolean`]);function i(e){return r.has(typeof e)}function a(e,t,n,r){let a=t[e];if(!a||typeof a!=`object`)return!0;for(let e of Object.keys(a)){let t=n.params[e],a=r.params[e];if(i(t)&&i(a)&&String(t)!==String(a))return!1}return!0}function o(e,t,n,r,i,o){for(let s=0;s<o;s++){let o=r[s];if(o!==i[s]||!a(o,e,t,n))return s}return o}const s=new Map;function c(e){let t=s.get(e);if(t)return t;let n=l(e);return Object.freeze(n),s.set(e,n),n}function l(e){if(!e)return[``];let t=e.indexOf(`.`);if(t===-1)return[e];let r=e.indexOf(`.`,t+1);if(r===-1)return[e.slice(0,t),e];let i=e.indexOf(`.`,r+1);return i===-1?[e.slice(0,t),e.slice(0,r),e]:e.indexOf(`.`,i+1)===-1?[e.slice(0,t),e.slice(0,r),e.slice(0,i),e]:n(e)}let u,d,f=null,p,m,h=null;function g(n,r){if(!r)return{intersection:``,toActivate:c(n.name),toDeactivate:t};let i=e.getStateMetaParams(n),a=e.getStateMetaParams(r);if(!i&&!a)return{intersection:``,toActivate:c(n.name),toDeactivate:c(r.name)};let s=c(n.name),l=c(r.name),u=Math.min(l.length,s.length),d=o(i??a,n,r,s,l,u),f;if(d>=l.length)f=t;else if(d===0&&l.length===1)f=l;else{f=[];for(let e=l.length-1;e>=d;e--)f.push(l[e])}let p=d===0?s:s.slice(d);return{intersection:d>0?l[d-1]:``,toDeactivate:f,toActivate:p}}function _(e,t){if(f!==null&&e===u&&t===d)return f;if(h!==null&&e===p&&t===m)return h;let n=g(e,t);return p=u,m=d,h=f,u=e,d=t,f=n,n}exports.getTransitionPath=_,exports.nameToIDs=c;
2
+ //# sourceMappingURL=transitionPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transitionPath.js","names":["getStateMetaParams"],"sources":["../../src/transitionPath.ts"],"sourcesContent":["// packages/core/src/transitionPath.ts\n\nimport { getStateMetaParams } from \"./stateMetaStore\";\n\nimport type { State } from \"./types\";\n\n/**\n * Parameters extracted from a route segment.\n * Maps parameter names to their string values.\n */\ntype PrimitiveParam = string | number | boolean;\n\n/**\n * Represents a transition path between two router states.\n * Contains information about which route segments need to be activated/deactivated.\n */\nexport interface TransitionPath {\n /** The common ancestor route segment where paths diverge */\n intersection: string;\n /** Route segments that need to be deactivated (in reverse order) */\n toDeactivate: string[];\n /** Route segments that need to be activated (in order) */\n toActivate: string[];\n}\n\n// Constants for better maintainability\nconst ROUTE_SEGMENT_SEPARATOR = \".\";\nconst EMPTY_INTERSECTION = \"\";\nconst DEFAULT_ROUTE_NAME = \"\";\nconst FROZEN_EMPTY_ARRAY: string[] = [];\n\nObject.freeze(FROZEN_EMPTY_ARRAY);\n\n/**\n * Handles conversion of route names with many segments (5+).\n * Internal helper for nameToIDs function.\n *\n * Uses optimized hybrid approach: split to get segments, then slice original\n * string to build cumulative paths. This approach is 65-81% faster than\n * string concatenation for typical cases (5-10 segments).\n *\n * @param name - Route name with 5 or more segments\n * @returns Array of cumulative segment IDs\n * @throws {Error} If route depth exceeds maximum allowed\n * @internal\n */\nfunction nameToIDsGeneral(name: string): string[] {\n // We know there are at least 5 segments at this point (after fast paths)\n const segments = name.split(ROUTE_SEGMENT_SEPARATOR);\n const segmentCount = segments.length;\n\n // First segment is always just itself\n const ids: string[] = [segments[0]];\n\n // Calculate cumulative lengths and slice from original string\n // This avoids repeated string concatenation (O(k²) → O(k))\n let cumulativeLength = segments[0].length;\n\n for (let i = 1; i < segmentCount - 1; i++) {\n cumulativeLength += 1 + segments[i].length; // +1 for dot separator\n ids.push(name.slice(0, cumulativeLength));\n }\n\n // Last segment is always the full route name\n ids.push(name);\n\n return ids;\n}\n\nconst PRIMITIVE_TYPES: ReadonlySet<string> = new Set([\n \"string\",\n \"number\",\n \"boolean\",\n]);\n\nfunction isPrimitive(value: unknown): value is PrimitiveParam {\n return PRIMITIVE_TYPES.has(typeof value);\n}\n\n/**\n * Compares segment parameters between two states without creating intermediate objects.\n * Returns true if all primitive params for the given segment are equal in both states.\n */\nfunction segmentParamsEqual(\n name: string,\n toMetaParams: Record<string, unknown>,\n toState: State,\n fromState: State,\n): boolean {\n const keys = toMetaParams[name];\n\n if (!keys || typeof keys !== \"object\") {\n return true;\n }\n\n for (const key of Object.keys(keys)) {\n const toVal = toState.params[key];\n const fromVal = fromState.params[key];\n\n if (\n isPrimitive(toVal) &&\n isPrimitive(fromVal) &&\n String(toVal) !== String(fromVal)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Finds the point where two state paths diverge based on segments and parameters.\n * Compares both segment names and their parameters to find the first difference.\n *\n * @param toMetaParams - Cached meta.params from toState (avoids per-segment WeakMap lookup)\n * @param toState - Target state\n * @param fromState - Source state\n * @param toStateIds - Segment IDs for target state\n * @param fromStateIds - Segment IDs for source state\n * @param maxI - Maximum index to check (minimum of both arrays)\n * @returns Index of first difference, or maxI if all checked segments match\n */\nfunction pointOfDifference(\n toMetaParams: Record<string, unknown>,\n toState: State,\n fromState: State,\n toStateIds: string[],\n fromStateIds: string[],\n maxI: number,\n): number {\n for (let i = 0; i < maxI; i++) {\n const toSegment = toStateIds[i];\n const fromSegment = fromStateIds[i];\n\n // Different segment names - immediate difference\n if (toSegment !== fromSegment) {\n return i;\n }\n\n if (!segmentParamsEqual(toSegment, toMetaParams, toState, fromState)) {\n return i;\n }\n }\n\n return maxI;\n}\n\n/**\n * Converts a route name to an array of hierarchical segment identifiers.\n * Each segment ID includes all parent segments in the path.\n *\n * @param name - Route name in dot notation (e.g., 'users.profile.edit')\n * @returns Array of cumulative segment IDs\n * @throws {Error} If route depth exceeds maximum allowed depth\n *\n * @example\n * // Simple route\n * nameToIDs('users');\n * // Returns: ['users']\n *\n * @example\n * // Nested route\n * nameToIDs('users.profile.edit');\n * // Returns: ['users', 'users.profile', 'users.profile.edit']\n *\n * @example\n * // Empty string (root route)\n * nameToIDs('');\n * // Returns: ['']\n *\n * @remarks\n * Input parameter is NOT validated in this function for performance reasons.\n * Validation significantly slows down nameToIDs execution.\n * The input should be validated by the function/method that calls nameToIDs.\n */\n// Module-global cache (shared across all router instances): bounded in practice by\n// the app's route-name vocabulary, which is stable across cloneRouter() requests, so\n// it does not grow per request. Intentionally NOT cleared on dispose() — it is not\n// per-router, so one router's teardown must not evict entries other routers rely on.\nconst nameToIDsCache = new Map<string, string[]>();\n\nexport function nameToIDs(name: string): string[] {\n const cached = nameToIDsCache.get(name);\n\n // Stryker disable next-line BlockStatement: equivalent — dropping the cache-hit early return recomputes the identical frozen id chain (the cache is a perf optimization, not a correctness gate).\n if (cached) {\n return cached;\n }\n\n const result = computeNameToIDs(name);\n\n Object.freeze(result);\n nameToIDsCache.set(name, result);\n\n return result;\n}\n\nfunction computeNameToIDs(name: string): string[] {\n if (!name) {\n return [DEFAULT_ROUTE_NAME];\n }\n\n const firstDot = name.indexOf(ROUTE_SEGMENT_SEPARATOR);\n\n if (firstDot === -1) {\n return [name];\n }\n\n const secondDot = name.indexOf(ROUTE_SEGMENT_SEPARATOR, firstDot + 1);\n\n if (secondDot === -1) {\n return [name.slice(0, firstDot), name];\n }\n\n const thirdDot = name.indexOf(ROUTE_SEGMENT_SEPARATOR, secondDot + 1);\n\n // Stryker disable next-line UnaryOperator,BlockStatement: equivalent — inverting/emptying the 3-segment fast path routes the name through nameToIDsGeneral (below), which yields the identical id chain (same rationale as the L242 ArithmeticOperator disable). The ConditionalExpression/EqualityOperator siblings stay live (→true and !== are killed).\n if (thirdDot === -1) {\n return [name.slice(0, firstDot), name.slice(0, secondDot), name];\n }\n\n // Stryker disable next-line ArithmeticOperator: equivalent — `thirdDot - 1` makes fourthDot non-(-1), routing 5+ segment names through nameToIDsGeneral, which yields the identical id chain.\n const fourthDot = name.indexOf(ROUTE_SEGMENT_SEPARATOR, thirdDot + 1);\n\n // Stryker disable next-line UnaryOperator,BlockStatement: equivalent — inverting/emptying the 4-segment fast path routes the name through nameToIDsGeneral (below), which yields the identical id chain (same rationale as the L242 ArithmeticOperator disable). The ConditionalExpression/EqualityOperator siblings stay live (→true and !== are killed).\n if (fourthDot === -1) {\n return [\n name.slice(0, firstDot),\n name.slice(0, secondDot),\n name.slice(0, thirdDot),\n name,\n ];\n }\n\n return nameToIDsGeneral(name);\n}\n\n/**\n * Calculates the transition path between two router states.\n * Determines which route segments need to be deactivated and activated\n * to transition from one state to another.\n *\n * @param toState - Target state to transition to\n * @param fromState - Current state to transition from (optional)\n * @returns Transition path with intersection and segments to activate/deactivate\n *\n * @throws {TypeError} When toState is null or undefined\n * @throws {TypeError} When toState is not an object\n * @throws {TypeError} When toState.name is missing or not a string\n * @throws {TypeError} When toState.params is missing or not an object\n * @throws {TypeError} When toState.path is missing or not a string\n * @throws {TypeError} When toState.name contains invalid route format:\n * - Contains only whitespace (e.g., \" \")\n * - Has consecutive dots (e.g., \"users..profile\")\n * - Has leading/trailing dots (e.g., \".users\" or \"users.\")\n * - Segments don't match pattern [a-zA-Z_][a-zA-Z0-9_-]* (e.g., \"users.123\")\n * - Contains spaces or special characters (e.g., \"users profile\")\n * - Exceeds maximum length (8192 characters)\n * @throws {TypeError} When fromState is provided and has any of the validation errors listed above for toState\n *\n * @example\n * // ✅ Valid calls\n * getTransitionPath({ name: 'users.profile', params: {}, path: '/users/profile' });\n * getTransitionPath(toState, fromState);\n * getTransitionPath({ name: '', params: {}, path: '/' }); // root route\n *\n * @example\n * // ❌ Invalid calls that throw TypeError\n * getTransitionPath(null); // toState is null\n * getTransitionPath(undefined); // toState is undefined\n * getTransitionPath({}); // missing required fields\n * getTransitionPath({ name: 123, params: {}, path: '/' }); // name not a string\n * getTransitionPath({ name: 'home', path: '/' }); // missing params\n * getTransitionPath({ name: 'users..profile', params: {}, path: '/' }); // consecutive dots\n * getTransitionPath({ name: '.users', params: {}, path: '/' }); // leading dot\n * getTransitionPath({ name: 'users.', params: {}, path: '/' }); // trailing dot\n * getTransitionPath({ name: 'users profile', params: {}, path: '/' }); // contains space\n * getTransitionPath({ name: 'users.123', params: {}, path: '/' }); // segment starts with number\n * getTransitionPath(validToState, { name: 'invalid..route', params: {}, path: '/' }); // fromState invalid\n *\n * @example\n * // Full activation (no fromState)\n * getTransitionPath(makeState('users.profile'));\n * // Returns: {\n * // intersection: '',\n * // toActivate: ['users', 'users.profile'],\n * // toDeactivate: []\n * // }\n *\n * @example\n * // Partial transition with common ancestor\n * getTransitionPath(\n * makeState('users.profile'),\n * makeState('users.list')\n * );\n * // Returns: {\n * // intersection: 'users',\n * // toActivate: ['users.profile'],\n * // toDeactivate: ['users.list']\n * // }\n *\n * @example\n * // Complete route change\n * getTransitionPath(\n * makeState('admin.dashboard'),\n * makeState('users.profile')\n * );\n * // Returns: {\n * // intersection: '',\n * // toActivate: ['admin', 'admin.dashboard'],\n * // toDeactivate: ['users.profile', 'users']\n * // }\n */\n// Single-entry cache: shouldUpdateNode calls getTransitionPath N times per\n// navigation with the same state objects (once per subscribed node).\n// Cache by reference eliminates N-1 redundant computations.\n// Module-global (≤2 State refs); not cleared on dispose — negligible, not per-router.\nlet cached1To: State | undefined;\nlet cached1From: State | undefined;\nlet cached1Result: TransitionPath | null = null;\n\nlet cached2To: State | undefined;\nlet cached2From: State | undefined;\nlet cached2Result: TransitionPath | null = null;\n\nfunction computeTransitionPath(\n toState: State,\n fromState?: State,\n): TransitionPath {\n // ===== FAST PATH 1: Initial navigation (no fromState) =====\n // This is the best performing case in benchmarks (5M ops/sec)\n if (!fromState) {\n return {\n intersection: EMPTY_INTERSECTION,\n toActivate: nameToIDs(toState.name),\n toDeactivate: FROZEN_EMPTY_ARRAY,\n };\n }\n\n // ===== FAST PATH 3: Missing meta requires full reload =====\n // Single WeakMap lookup per state, reused in pointOfDifference/segmentParamsEqual\n const toMetaParams = getStateMetaParams(toState);\n const fromMetaParams = getStateMetaParams(fromState);\n\n if (!toMetaParams && !fromMetaParams) {\n // FAST PATH 3 (both states meta-less). Consumers that land here read the\n // result order-INSENSITIVELY, so the from-chain is returned as-is\n // (root→leaf, no reverse needed):\n // • `shouldUpdateNode` reads `toDeactivate` by MEMBERSHIP (`.includes`).\n // • Externally-supplied meta-less states (e.g. a plugin passing a raw\n // `{name, params, path}` to `navigateToState`) land here. Since #1170,\n // `navigateToState` carries the source's WeakMap meta across its writable\n // shell, so start()/popstate states are NOT meta-less. A `replace()`\n // survivor stays meta-less but is benign: the next transition's `toState`\n // always carries meta (buildNavigateState), so this both-meta-less path\n // is not reached from it.\n // (`canNavigateTo` no longer reaches this path — since #970 it builds its\n // toState WITH meta, mirroring buildNavigateState.)\n // The navigate pipeline always carries meta (buildNavigateState) → STANDARD\n // PATH below, which trims the shared ancestor and reverses correctly.\n return {\n intersection: EMPTY_INTERSECTION,\n toActivate: nameToIDs(toState.name),\n toDeactivate: nameToIDs(fromState.name),\n };\n }\n\n // ===== STANDARD PATH: Routes with parameters =====\n const toStateIds = nameToIDs(toState.name);\n const fromStateIds = nameToIDs(fromState.name);\n // Stryker disable next-line MethodExpression: equivalent — Math.max reads one index past the shorter id array; that slot is undefined, so the `toSegment !== fromSegment` check in pointOfDifference returns the same divergence index Math.min would stop at.\n const maxI = Math.min(fromStateIds.length, toStateIds.length);\n\n const i = pointOfDifference(\n (toMetaParams ?? fromMetaParams) as Record<string, unknown>,\n toState,\n fromState,\n toStateIds,\n fromStateIds,\n maxI,\n );\n\n // Optimization: Build deactivation list in reverse order directly\n // instead of slice(i).toReversed() which creates 2 arrays\n let toDeactivate: string[];\n\n if (i >= fromStateIds.length) {\n toDeactivate = FROZEN_EMPTY_ARRAY;\n } else if (i === 0 && fromStateIds.length === 1) {\n // Single-segment route: reversed = original, reuse cached frozen array\n toDeactivate = fromStateIds;\n } else {\n toDeactivate = [];\n\n for (let j = fromStateIds.length - 1; j >= i; j--) {\n toDeactivate.push(fromStateIds[j]);\n }\n }\n\n // Build activation list — reuse cached frozen array when using full list\n const toActivate = i === 0 ? toStateIds : toStateIds.slice(i);\n\n // Determine intersection point (common ancestor)\n const intersection = i > 0 ? fromStateIds[i - 1] : EMPTY_INTERSECTION;\n\n return {\n intersection,\n toDeactivate,\n toActivate,\n };\n}\n\nexport function getTransitionPath(\n toState: State,\n fromState?: State,\n): TransitionPath {\n // Stryker disable BlockStatement: equivalent — both cache short-circuits below; emptying either early-return recomputes the identical TransitionPath (computeTransitionPath is deterministic for the same to/from states) and re-caches it. Restored right after.\n if (\n cached1Result !== null &&\n toState === cached1To &&\n fromState === cached1From\n ) {\n return cached1Result;\n }\n\n if (\n cached2Result !== null &&\n toState === cached2To &&\n fromState === cached2From\n ) {\n return cached2Result;\n }\n // Stryker restore BlockStatement\n\n const result = computeTransitionPath(toState, fromState);\n\n cached2To = cached1To;\n cached2From = cached1From;\n cached2Result = cached1Result;\n\n cached1To = toState;\n cached1From = fromState;\n cached1Result = result;\n\n return result;\n}\n"],"mappings":"uCA6BM,EAA+B,CAAC,EAEtC,OAAO,OAAO,CAAkB,EAehC,SAAS,EAAiB,EAAwB,CAEhD,IAAM,EAAW,EAAK,MAAM,GAAuB,EAC7C,EAAe,EAAS,OAGxB,EAAgB,CAAC,EAAS,EAAE,EAI9B,EAAmB,EAAS,EAAE,CAAC,OAEnC,IAAK,IAAI,EAAI,EAAG,EAAI,EAAe,EAAG,IACpC,GAAoB,EAAI,EAAS,EAAE,CAAC,OACpC,EAAI,KAAK,EAAK,MAAM,EAAG,CAAgB,CAAC,EAM1C,OAFA,EAAI,KAAK,CAAI,EAEN,CACT,CAEA,MAAM,EAAuC,IAAI,IAAI,CACnD,SACA,SACA,SACF,CAAC,EAED,SAAS,EAAY,EAAyC,CAC5D,OAAO,EAAgB,IAAI,OAAO,CAAK,CACzC,CAMA,SAAS,EACP,EACA,EACA,EACA,EACS,CACT,IAAM,EAAO,EAAa,GAE1B,GAAI,CAAC,GAAQ,OAAO,GAAS,SAC3B,MAAO,GAGT,IAAK,IAAM,KAAO,OAAO,KAAK,CAAI,EAAG,CACnC,IAAM,EAAQ,EAAQ,OAAO,GACvB,EAAU,EAAU,OAAO,GAEjC,GACE,EAAY,CAAK,GACjB,EAAY,CAAO,GACnB,OAAO,CAAK,IAAM,OAAO,CAAO,EAEhC,MAAO,EAEX,CAEA,MAAO,EACT,CAcA,SAAS,EACP,EACA,EACA,EACA,EACA,EACA,EACQ,CACR,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,IAAK,CAC7B,IAAM,EAAY,EAAW,GAQ7B,GAJI,IAHgB,EAAa,IAO7B,CAAC,EAAmB,EAAW,EAAc,EAAS,CAAS,EACjE,OAAO,CAEX,CAEA,OAAO,CACT,CAkCA,MAAM,EAAiB,IAAI,IAE3B,SAAgB,EAAU,EAAwB,CAChD,IAAM,EAAS,EAAe,IAAI,CAAI,EAGtC,GAAI,EACF,OAAO,EAGT,IAAM,EAAS,EAAiB,CAAI,EAKpC,OAHA,OAAO,OAAO,CAAM,EACpB,EAAe,IAAI,EAAM,CAAM,EAExB,CACT,CAEA,SAAS,EAAiB,EAAwB,CAChD,GAAI,CAAC,EACH,MAAO,CAAC,EAAkB,EAG5B,IAAM,EAAW,EAAK,QAAQ,GAAuB,EAErD,GAAI,IAAa,GACf,MAAO,CAAC,CAAI,EAGd,IAAM,EAAY,EAAK,QAAQ,IAAyB,EAAW,CAAC,EAEpE,GAAI,IAAc,GAChB,MAAO,CAAC,EAAK,MAAM,EAAG,CAAQ,EAAG,CAAI,EAGvC,IAAM,EAAW,EAAK,QAAQ,IAAyB,EAAY,CAAC,EAoBpE,OAjBI,IAAa,GACR,CAAC,EAAK,MAAM,EAAG,CAAQ,EAAG,EAAK,MAAM,EAAG,CAAS,EAAG,CAAI,EAI/C,EAAK,QAAQ,IAAyB,EAAW,CAGvD,IAAM,GACT,CACL,EAAK,MAAM,EAAG,CAAQ,EACtB,EAAK,MAAM,EAAG,CAAS,EACvB,EAAK,MAAM,EAAG,CAAQ,EACtB,CACF,EAGK,EAAiB,CAAI,CAC9B,CAkFA,IAAI,EACA,EACA,EAAuC,KAEvC,EACA,EACA,EAAuC,KAE3C,SAAS,EACP,EACA,EACgB,CAGhB,GAAI,CAAC,EACH,MAAO,CACL,aAAc,GACd,WAAY,EAAU,EAAQ,IAAI,EAClC,aAAc,CAChB,EAKF,IAAM,EAAeA,EAAAA,mBAAmB,CAAO,EACzC,EAAiBA,EAAAA,mBAAmB,CAAS,EAEnD,GAAI,CAAC,GAAgB,CAAC,EAgBpB,MAAO,CACL,aAAc,GACd,WAAY,EAAU,EAAQ,IAAI,EAClC,aAAc,EAAU,EAAU,IAAI,CACxC,EAIF,IAAM,EAAa,EAAU,EAAQ,IAAI,EACnC,EAAe,EAAU,EAAU,IAAI,EAEvC,EAAO,KAAK,IAAI,EAAa,OAAQ,EAAW,MAAM,EAEtD,EAAI,EACP,GAAgB,EACjB,EACA,EACA,EACA,EACA,CACF,EAII,EAEJ,GAAI,GAAK,EAAa,OACpB,EAAe,OACV,GAAI,IAAM,GAAK,EAAa,SAAW,EAE5C,EAAe,MACV,CACL,EAAe,CAAC,EAEhB,IAAK,IAAI,EAAI,EAAa,OAAS,EAAG,GAAK,EAAG,IAC5C,EAAa,KAAK,EAAa,EAAE,CAErC,CAGA,IAAM,EAAa,IAAM,EAAI,EAAa,EAAW,MAAM,CAAC,EAK5D,MAAO,CACL,aAHmB,EAAI,EAAI,EAAa,EAAI,GAAK,GAIjD,eACA,YACF,CACF,CAEA,SAAgB,EACd,EACA,EACgB,CAEhB,GACE,IAAkB,MAClB,IAAY,GACZ,IAAc,EAEd,OAAO,EAGT,GACE,IAAkB,MAClB,IAAY,GACZ,IAAc,EAEd,OAAO,EAIT,IAAM,EAAS,EAAsB,EAAS,CAAS,EAUvD,MARA,GAAY,EACZ,EAAc,EACd,EAAgB,EAEhB,EAAY,EACZ,EAAc,EACd,EAAgB,EAET,CACT"}
@@ -103,5 +103,5 @@ interface RouterValidator {
103
103
  };
104
104
  }
105
105
  //#endregion
106
- export { RouterValidator as t };
107
- //# sourceMappingURL=RouterValidator-CZ8kPkrI.d.ts.map
106
+ export { RouterValidator };
107
+ //# sourceMappingURL=RouterValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouterValidator.d.ts","names":[],"sources":["../../../src/types/RouterValidator.ts"],"mappings":";;;;;;;;;;UAUiB;;;;EAIf;IACE,wBAAwB;IACxB,wBAAwB;IACxB,4BACE,eACA,iBACA,iBACA;IAEF,+BAA+B;IAC/B,2BACE,eACA,iBACA;IAEF,uBAAuB;IACvB,iBACE,mBACA,eACA;IAEF,0BAA0B;IAC1B,+BAA+B,eAAe;IAC9C,mCAAmC,cAAc;IACjD,sBACE,cACA,kBACA;IAEF,uBAAuB,iBAAiB;IACxC,oBAAoB,eAAe;IACnC,uBAAuB,eAAe;IACtC,8BAA8B,mBAAmB;IACjD,0BAA0B;IAC1B,sBAAsB;IACtB,wBAAwB;;;;;EAM1B;IACE,kBAAkB,kBAAkB;IACpC,+BAA+B,oBAAoB;;;;;EAMrD;IACE,yBAAyB,eAAe;IACxC,4BACE,eACA,gBACA;IAEF,6BAA6B,eAAe;IAC5C,2BAA2B,cAAc;IACzC,0BAA0B,gBAAgB;IAC1C,oBAAoB;IACpB,gBAAgB,cAAc;IAC9B,qBAAqB,gBAAgB;IACrC,wBAAwB;;;;;EAM1B;IACE,sBAAsB,eAAe;IACrC,6BACE,kBACA;IAEF,qBAAqB;IACrB,0BAA0B;IAC1B,sBAAsB;IACtB,uBAAuB;IACvB,uBAAuB;IACvB,6BAA6B,iBAAiB;;;;;EAMhD;IACE,kBAAkB,kBAAkB;IACpC,uBAAuB,eAAe;IACtC,0BAA0B,eAAe;IACzC,gBAAgB,cAAc,cAAc;IAC5C,qBAAqB,cAAc;;;;;EAMrC;IACE,uBAAuB;IACvB,gCAAgC;IAChC,8BAA8B;IAC9B,4BAA4B,kBAAkB;IAC9C,iBAAiB,iBAAiB;IAClC,oBAAoB;;;;;EAMtB;IACE,wBACE,eACA,iBACA;IAEF,6BACE,aACA,aACA;;;;;EAOJ;IACE,uBAAuB,eAAe;IACtC,0BACE,eACA,mBACA"}
@@ -0,0 +1,184 @@
1
+ import { RouteTreeState } from "./route-node-types.js";
2
+ import { Params, SimpleState, State, StateMetaInput, Unsubscribe } from "./base.js";
3
+ import { DefaultDependencies, GuardFnFactory, Options, Plugin, Route, RouteConfigUpdate } from "./router.js";
4
+ import { EventMethodMap, EventName } from "./constants.js";
5
+ import { TreeChangedEvent } from "./tree-changed.js";
6
+ import { NavigationOptions, StateContext } from "../types.js";
7
+ //#region src/types/api.d.ts
8
+ /**
9
+ * Maps interceptable method names to their signatures.
10
+ * Used by {@link PluginApi.addInterceptor} to provide type-safe interceptor registration.
11
+ *
12
+ * To add a new interceptable method:
13
+ * 1. Add its signature here
14
+ * 2. Wrap it with `createInterceptable()` / `createBinaryInterceptable()` in
15
+ * the `registerInternals` block of the Router constructor
16
+ * (`packages/core/src/Router.ts`)
17
+ */
18
+ interface InterceptableMethodMap {
19
+ start: (path?: string) => Promise<State>;
20
+ buildPath: (route: string, params?: Params) => string;
21
+ forwardState: (routeName: string, routeParams: Params) => SimpleState;
22
+ }
23
+ /**
24
+ * Type-safe interceptor callback.
25
+ * Receives `next` (the next function in the chain) followed by the method's original parameters.
26
+ */
27
+ type InterceptorFn<M extends keyof InterceptableMethodMap> = (next: InterceptableMethodMap[M], ...args: Parameters<InterceptableMethodMap[M]>) => ReturnType<InterceptableMethodMap[M]>;
28
+ /**
29
+ * Writer object returned by {@link PluginApi.claimContextNamespace}. Holds
30
+ * exclusive ownership of a single `state.context.<namespace>` key for the
31
+ * lifetime of the owning plugin.
32
+ *
33
+ * @description
34
+ * A plugin obtains a claim by calling `api.claimContextNamespace("ns")` at
35
+ * registration, then publishes per-navigation data via {@link write} from a
36
+ * lifecycle hook (typically `onTransitionSuccess`) or from an interceptor.
37
+ * The plugin must call {@link release} in its `teardown()` so another plugin
38
+ * can reclaim the same namespace.
39
+ *
40
+ * The core runtime enforces one invariant: a namespace can be held by at most
41
+ * one claim at a time. Double-claiming throws `CONTEXT_NAMESPACE_ALREADY_CLAIMED`.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const navigationPlugin: PluginFactory = (router) => {
46
+ * const api = getPluginApi(router);
47
+ * const claim = api.claimContextNamespace("navigation");
48
+ *
49
+ * return {
50
+ * onTransitionSuccess(toState, fromState) {
51
+ * claim.write(toState, { direction: detectDirection(fromState, toState) });
52
+ * },
53
+ * teardown() {
54
+ * claim.release();
55
+ * },
56
+ * };
57
+ * };
58
+ * ```
59
+ *
60
+ * @see {@link PluginApi.claimContextNamespace}
61
+ * @see {@link State.context}
62
+ */
63
+ interface ContextNamespaceClaim<T = unknown> {
64
+ write: (state: State, value: T) => void;
65
+ release: () => void;
66
+ }
67
+ /**
68
+ * Plugin API — for plugins and infrastructure packages.
69
+ * Hides plugin-internal methods from public autocomplete.
70
+ */
71
+ interface PluginApi {
72
+ makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: StateMetaInput) => State<P>;
73
+ buildState: (routeName: string, routeParams: Params) => RouteTreeState | undefined;
74
+ forwardState: <P extends Params = Params>(routeName: string, routeParams: P) => SimpleState<P>;
75
+ matchPath: <P extends Params = Params>(path: string) => State<P> | undefined;
76
+ /**
77
+ * Navigate to a fully-built `State`, skipping the redundant
78
+ * `forwardState`/`buildPath` round-trip in `buildNavigateState`.
79
+ *
80
+ * Plugin-only entry point for browser-initiated navigation: a plugin
81
+ * receives a URL event, resolves it via `api.matchPath(url)`, then commits
82
+ * the resulting `State` directly via `api.navigateToState(state, opts)`.
83
+ *
84
+ * Semantics vs `router.navigate(name, params, opts)`:
85
+ * - `forwardState` is NOT re-applied (matchPath already ran it).
86
+ * - `buildPath` is NOT re-run; `state.path` is used verbatim, preserving
87
+ * `trailingSlash:"preserve"` source-URL output.
88
+ * - `forwardState`/`buildPath` interceptors do NOT run on this path; the
89
+ * URL the user navigated to is the source of truth.
90
+ * - Pipeline: SAME_STATES check, FSM transition, guards, `subscribeLeave`,
91
+ * `completeTransition`, plugin lifecycle hooks — all unchanged.
92
+ *
93
+ * Programmatic / userland navigation should keep using
94
+ * `router.navigate(name, params, opts)` so interceptors apply.
95
+ */
96
+ navigateToState: (state: State, options?: NavigationOptions) => Promise<State>;
97
+ setRootPath: (rootPath: string) => void;
98
+ getRootPath: () => string;
99
+ addEventListener: <E extends EventName>(eventName: E, cb: Plugin[EventMethodMap[E]]) => Unsubscribe;
100
+ buildNavigationState: (name: string, params?: Params) => State | undefined;
101
+ getOptions: () => Options;
102
+ getTree: () => unknown;
103
+ addInterceptor: <M extends keyof InterceptableMethodMap>(method: M, fn: InterceptorFn<M>) => Unsubscribe;
104
+ extendRouter: (extensions: Record<string, unknown>) => Unsubscribe;
105
+ /**
106
+ * Emits a `$$error` event without going through the navigation pipeline.
107
+ *
108
+ * Used by plugins that detect an error outside a running transition (e.g.,
109
+ * an unmatched URL on popstate in strict mode). The event reaches any
110
+ * `onTransitionError` plugin hook and any `$$error` listener so developers
111
+ * can observe errors raised by the plugin layer.
112
+ *
113
+ * The current router state is used as `fromState`; `toState` is `undefined`
114
+ * because no transition was attempted. Safe to call at any FSM state —
115
+ * delegates to `sendFailSafe` internally (direct emit when not READY).
116
+ */
117
+ emitTransitionError: (error: Error) => void;
118
+ claimContextNamespace: {
119
+ <K extends keyof StateContext & string>(namespace: K): ContextNamespaceClaim<StateContext[K]>;
120
+ (namespace: string): ContextNamespaceClaim;
121
+ };
122
+ getRouteConfig: (name: string) => Record<string, unknown> | undefined;
123
+ }
124
+ /**
125
+ * Routes API — for dynamic route mutation.
126
+ */
127
+ interface RoutesApi<Dependencies extends DefaultDependencies = DefaultDependencies> {
128
+ add: (routes: Route<Dependencies>[] | Route<Dependencies>, options?: {
129
+ parent?: string;
130
+ }) => void;
131
+ remove: (name: string) => void;
132
+ /**
133
+ * Patch an existing route's configuration in place (no tree rebuild).
134
+ *
135
+ * Applies the structural/guard fields and any plugin-defined custom fields
136
+ * (lifecycle hooks, `preload`, `searchSchema`, …) from the patch. Fields are
137
+ * shallow-merged by key; `null` removes a field, `undefined` is a no-op.
138
+ * `name`/`path`/`children` are immutable — use `remove` + `add` to
139
+ * restructure. See {@link RouteConfigUpdate} for the full semantics and the
140
+ * plugin augmentation pattern.
141
+ */
142
+ update: (name: string, updates: RouteConfigUpdate<Dependencies>) => void;
143
+ clear: () => void;
144
+ replace: (routes: Route<Dependencies>[] | Route<Dependencies>) => void;
145
+ has: (name: string) => boolean;
146
+ get: (name: string) => Route<Dependencies> | undefined;
147
+ /**
148
+ * Subscribe to structural route-tree mutations (`add` / `remove` / `update`
149
+ * with structural fields / `replace` / `clear`). Fire-and-forget: the handler
150
+ * cannot cancel the mutation, runs after the atomic commit, and sees the
151
+ * post-mutation tree via `get()` / `has()`.
152
+ *
153
+ * Duplicate-registration semantics are **lenient** (mirrors
154
+ * `router.subscribe`): each call registers an independent listener and
155
+ * returns its own unsubscribe.
156
+ *
157
+ * @returns Unsubscribe function for this specific registration.
158
+ */
159
+ subscribeChanges: (handler: (event: TreeChangedEvent<Dependencies>) => void) => Unsubscribe;
160
+ }
161
+ /**
162
+ * Dependencies API — CRUD for dependency injection.
163
+ */
164
+ interface DependenciesApi<Dependencies extends DefaultDependencies = DefaultDependencies> {
165
+ get: <K extends keyof Dependencies>(key: K) => Dependencies[K];
166
+ getAll: () => Partial<Dependencies>;
167
+ set: <K extends keyof Dependencies & string>(name: K, value: Dependencies[K]) => void;
168
+ setAll: (deps: Dependencies) => void;
169
+ remove: (name: keyof Dependencies) => void;
170
+ reset: () => void;
171
+ has: (name: keyof Dependencies) => boolean;
172
+ }
173
+ /**
174
+ * Lifecycle API — guard registration (addActivateGuard, addDeactivateGuard, etc.)
175
+ */
176
+ interface LifecycleApi<Dependencies extends DefaultDependencies = DefaultDependencies> {
177
+ addActivateGuard: (name: string, canActivateHandler: GuardFnFactory<Dependencies> | boolean) => void;
178
+ addDeactivateGuard: (name: string, canDeactivateHandler: GuardFnFactory<Dependencies> | boolean) => void;
179
+ removeActivateGuard: (name: string) => void;
180
+ removeDeactivateGuard: (name: string) => void;
181
+ }
182
+ //#endregion
183
+ export { ContextNamespaceClaim, DependenciesApi, InterceptableMethodMap, InterceptorFn, LifecycleApi, PluginApi, RoutesApi };
184
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","names":[],"sources":["../../../src/types/api.ts"],"mappings":";;;;;;;;;;;;;;;;;UAqCiB;EACf,QAAQ,kBAAkB,QAAQ;EAClC,YAAY,eAAe,SAAS;EACpC,eAAe,mBAAmB,aAAa,WAAW;;;;;;KAOhD,cAAc,gBAAgB,2BACxC,MAAM,uBAAuB,OAC1B,MAAM,WAAW,uBAAuB,QACxC,WAAW,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAqCtB,sBAAsB;EACrC,QAAQ,OAAO,OAAO,OAAO;EAC7B;;;;;;UAOe;EACf,YAAY,UAAU,SAAS,QAC7B,cACA,SAAS,GACT,eACA,OAAO,mBACJ,MAAM;EAEX,aACE,mBACA,aAAa,WACV;EAEL,eAAe,UAAU,SAAS,QAChC,mBACA,aAAa,MACV,YAAY;EAEjB,YAAY,UAAU,SAAS,QAAQ,iBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;;EAsB9D,kBACE,OAAO,OACP,UAAU,sBACP,QAAQ;EAEb,cAAc;EACd;EAEA,mBAAmB,UAAU,WAC3B,WAAW,GACX,IAAI,OAAO,eAAe,QACvB;EAEL,uBAAuB,cAAc,SAAS,WAAW;EAEzD,kBAAkB;EAElB;EAEA,iBAAiB,gBAAgB,wBAC/B,QAAQ,GACR,IAAI,cAAc,OACf;EAEL,eAAe,YAAY,4BAA4B;;;;;;;;;;;;;EAcvD,sBAAsB,OAAO;EAE7B;KAEG,gBAAgB,uBACf,WAAW,IACV,sBAAsB,aAAa;KACrC,oBAAoB;;EAGvB,iBAAiB,iBAAiB;;;;;UAMnB,UACf,qBAAqB,sBAAsB;EAE3C,MACE,QAAQ,MAAM,kBAAkB,MAAM,eACtC;IAAY;;EAGd,SAAS;;;;;;;;;;;EAYT,SAAS,cAAc,SAAS,kBAAkB;EAElD;EAEA,UAAU,QAAQ,MAAM,kBAAkB,MAAM;EAEhD,MAAM;EAEN,MAAM,iBAAiB,MAAM;;;;;;;;;;;;;EAc7B,mBACE,UAAU,OAAO,iBAAiB,2BAC/B;;;;;UAMU,gBACf,qBAAqB,sBAAsB;EAE3C,MAAM,gBAAgB,cAAc,KAAK,MAAM,aAAa;EAC5D,cAAc,QAAQ;EACtB,MAAM,gBAAgB,uBACpB,MAAM,GACN,OAAO,aAAa;EAEtB,SAAS,MAAM;EACf,SAAS,YAAY;EACrB;EACA,MAAM,YAAY;;;;;UAMH,aACf,qBAAqB,sBAAsB;EAE3C,mBACE,cACA,oBAAoB,eAAe;EAErC,qBACE,cACA,sBAAsB,eAAe;EAEvC,sBAAsB;EACtB,wBAAwB"}
@@ -0,0 +1,95 @@
1
+ import { StateContext } from "../types.js";
2
+ //#region src/types/base.d.ts
3
+ /**
4
+ * Detach function returned by subscription APIs.
5
+ *
6
+ * @description
7
+ * Calling this function removes the associated listener. Returned by
8
+ * `router.subscribe()`, `router.addEventListener()`, `router.subscribeLeave()`,
9
+ * and plugin interceptors. Idempotent — calling more than once is safe and
10
+ * has no additional effect after the first call.
11
+ */
12
+ type Unsubscribe = () => void;
13
+ interface SimpleState<P extends Params = Params> {
14
+ name: string;
15
+ params: P;
16
+ }
17
+ type TransitionPhase = "deactivating" | "activating";
18
+ type TransitionReason = "success" | "blocked" | "cancelled" | "error";
19
+ interface TransitionMeta {
20
+ phase: TransitionPhase;
21
+ reason: TransitionReason;
22
+ reload?: boolean;
23
+ replace?: boolean;
24
+ redirected?: boolean;
25
+ from?: string;
26
+ blocker?: string;
27
+ segments: {
28
+ deactivated: string[];
29
+ activated: string[];
30
+ intersection: string;
31
+ };
32
+ }
33
+ interface State<P extends Params = Params> {
34
+ name: string;
35
+ params: P;
36
+ path: string;
37
+ transition: TransitionMeta;
38
+ /**
39
+ * Plugin-extensible per-route data, attached by plugins via
40
+ * `PluginApi.claimContextNamespace()` + `claim.write(state, value)`.
41
+ *
42
+ * @description
43
+ * Required field — always present as at least `{}` on every State created by
44
+ * the router (via `makeState`, `navigateToNotFound`, or `cloneRouter`).
45
+ *
46
+ * Typed extensions come from plugins augmenting {@link StateContext} through
47
+ * module augmentation. The intersection with `Record<string, unknown>` allows
48
+ * untyped namespaces (inline plugins, tests, or plugins that skip augmentation)
49
+ * to write without compile errors.
50
+ *
51
+ * The `context` object itself is **not frozen** — this is intentional, so
52
+ * plugins can attach data without cloning state. Core structural fields
53
+ * (`name`, `params`, `path`, `transition`) remain immutable via shallow
54
+ * `Object.freeze(state)`.
55
+ *
56
+ * @see {@link StateContext}
57
+ */
58
+ context: StateContext & Record<string, unknown>;
59
+ }
60
+ interface StateMetaInput<P extends Params = Params> {
61
+ params: P;
62
+ }
63
+ /**
64
+ * Parsed shape produced by `serializeRouterState()` (`@real-router/ssr-utils`,
65
+ * after `JSON.parse`). Identical to {@link State} minus `transition`
66
+ * (per-navigation `TransitionMeta` is meaningless after hydration; the client
67
+ * builds its own on commit). Defined here (not in `ssr-utils`) because core's
68
+ * own hydration scratchpad (`RouterInternals.hydrationState`) is typed against
69
+ * it — see `internals.ts`.
70
+ */
71
+ type SerializedRouterState<P extends Params = Params> = Omit<State<P>, "transition">;
72
+ /**
73
+ * RouterError interface describing the public API of the RouterError class.
74
+ * The actual class implementation is in the real-router package.
75
+ * This interface enables structural typing compatibility between
76
+ * core-types and real-router packages.
77
+ */
78
+ interface RouterError extends Error {
79
+ [key: string]: unknown;
80
+ readonly code: string;
81
+ readonly segment: string | undefined;
82
+ readonly path: string | undefined;
83
+ setCode: (code: string) => void;
84
+ setErrorInstance: (err: Error) => void;
85
+ setAdditionalFields: (fields: Record<string, unknown>) => void;
86
+ hasField: (key: string) => boolean;
87
+ getField: (key: string) => unknown;
88
+ toJSON: () => Record<string, unknown>;
89
+ }
90
+ interface Params {
91
+ [key: string]: string | string[] | number | number[] | boolean | boolean[] | Params | Params[] | Record<string, string | number | boolean> | null | undefined;
92
+ }
93
+ //#endregion
94
+ export { Params, RouterError, SerializedRouterState, SimpleState, State, StateMetaInput, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
95
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","names":[],"sources":["../../../src/types/base.ts"],"mappings":";;;;;;;;;;;KAmBY;UAEK,YAAY,UAAU,SAAS;EAC9C;EACA,QAAQ;;KAGE;KAEA;UAEK;EACf,OAAO;EACP,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;IACE;IACA;IACA;;;UAIa,MAAM,UAAU,SAAS;EACxC;EACA,QAAQ;EACR;EACA,YAAY;;;;;;;;;;;;;;;;;;;;;EAqBZ,SAAS,eAAe;;UAGT,eAAe,UAAU,SAAS;EACjD,QAAQ;;;;;;;;;;KAWE,sBAAsB,UAAU,SAAS,UAAU,KAC7D,MAAM;;;;;;;UAUS,oBAAoB;GAClC;WACQ;WACA;WACA;EACT,UAAU;EACV,mBAAmB,KAAK;EACxB,sBAAsB,QAAQ;EAC9B,WAAW;EACX,WAAW;EACX,cAAc;;UAGC;GACd,4EAOG,SACA,WACA"}
@@ -0,0 +1,72 @@
1
+ //#region src/types/constants.d.ts
2
+ /**
3
+ * Plugin lifecycle method names
4
+ */
5
+ type PluginMethod = "onStart" | "onStop" | "onTransitionStart" | "onTransitionLeaveApprove" | "onTransitionCancel" | "onTransitionSuccess" | "onTransitionError";
6
+ /**
7
+ * Router event names
8
+ */
9
+ type EventName = "$start" | "$stop" | "$$start" | "$$leaveApprove" | "$$cancel" | "$$success" | "$$error";
10
+ /**
11
+ * Event type keys
12
+ */
13
+ type EventsKeys = "ROUTER_START" | "ROUTER_STOP" | "TRANSITION_START" | "TRANSITION_LEAVE_APPROVE" | "TRANSITION_CANCEL" | "TRANSITION_SUCCESS" | "TRANSITION_ERROR";
14
+ /**
15
+ * Error code values
16
+ */
17
+ type ErrorCodeValues = "NOT_STARTED" | "NO_START_PATH_OR_STATE" | "ALREADY_STARTED" | "ROUTE_NOT_FOUND" | "SAME_STATES" | "CANNOT_DEACTIVATE" | "CANNOT_ACTIVATE" | "TRANSITION_ERR" | "CANCELLED" | "DISPOSED" | "PLUGIN_CONFLICT" | "CONTEXT_NAMESPACE_ALREADY_CLAIMED";
18
+ /**
19
+ * Error code keys
20
+ */
21
+ type ErrorCodeKeys = "ROUTER_NOT_STARTED" | "NO_START_PATH_OR_STATE" | "ROUTER_ALREADY_STARTED" | "ROUTE_NOT_FOUND" | "SAME_STATES" | "CANNOT_DEACTIVATE" | "CANNOT_ACTIVATE" | "TRANSITION_ERR" | "TRANSITION_CANCELLED" | "ROUTER_DISPOSED" | "PLUGIN_CONFLICT" | "CONTEXT_NAMESPACE_ALREADY_CLAIMED" | "REENTRANT_NAVIGATION" | "REENTRANT_TREE_MUTATION";
22
+ /**
23
+ * Mapping of event keys to plugin methods
24
+ */
25
+ interface EventToPluginMap {
26
+ readonly ROUTER_START: "onStart";
27
+ readonly ROUTER_STOP: "onStop";
28
+ readonly TRANSITION_START: "onTransitionStart";
29
+ readonly TRANSITION_LEAVE_APPROVE: "onTransitionLeaveApprove";
30
+ readonly TRANSITION_CANCEL: "onTransitionCancel";
31
+ readonly TRANSITION_SUCCESS: "onTransitionSuccess";
32
+ readonly TRANSITION_ERROR: "onTransitionError";
33
+ }
34
+ /**
35
+ * Mapping of event keys to event names
36
+ */
37
+ interface EventToNameMap {
38
+ ROUTER_START: "$start";
39
+ ROUTER_STOP: "$stop";
40
+ TRANSITION_START: "$$start";
41
+ TRANSITION_LEAVE_APPROVE: "$$leaveApprove";
42
+ TRANSITION_CANCEL: "$$cancel";
43
+ TRANSITION_SUCCESS: "$$success";
44
+ TRANSITION_ERROR: "$$error";
45
+ }
46
+ /**
47
+ * Mapping of event names to plugin method names.
48
+ * Type-level computation from EventToNameMap + EventToPluginMap.
49
+ */
50
+ type EventMethodMap = { [K in EventsKeys as EventToNameMap[K]]: EventToPluginMap[K]; };
51
+ /**
52
+ * Mapping of error code keys to their values
53
+ */
54
+ interface ErrorCodeToValueMap {
55
+ ROUTER_NOT_STARTED: "NOT_STARTED";
56
+ NO_START_PATH_OR_STATE: "NO_START_PATH_OR_STATE";
57
+ ROUTER_ALREADY_STARTED: "ALREADY_STARTED";
58
+ ROUTE_NOT_FOUND: "ROUTE_NOT_FOUND";
59
+ SAME_STATES: "SAME_STATES";
60
+ CANNOT_DEACTIVATE: "CANNOT_DEACTIVATE";
61
+ CANNOT_ACTIVATE: "CANNOT_ACTIVATE";
62
+ TRANSITION_ERR: "TRANSITION_ERR";
63
+ TRANSITION_CANCELLED: "CANCELLED";
64
+ ROUTER_DISPOSED: "DISPOSED";
65
+ PLUGIN_CONFLICT: "PLUGIN_CONFLICT";
66
+ CONTEXT_NAMESPACE_ALREADY_CLAIMED: "CONTEXT_NAMESPACE_ALREADY_CLAIMED";
67
+ REENTRANT_NAVIGATION: "REENTRANT_NAVIGATION";
68
+ REENTRANT_TREE_MUTATION: "REENTRANT_TREE_MUTATION";
69
+ }
70
+ //#endregion
71
+ export { ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, PluginMethod };
72
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/types/constants.ts"],"mappings":";;;;KAGY;;;;KAYA;;;;KAYA;;;;KAYA;;;;KAiBA;;;;UAmBK;WACN;WACA;WACA;WACA;WACA;WACA;WACA;;;;;UAMM;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;KAOU,oBACT,KAAK,cAAc,eAAe,KAAK,iBAAiB;;;;UAM1C;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
@@ -0,0 +1,9 @@
1
+ import { LimitsConfig } from "./limits.js";
2
+ //#region src/types/internal.d.ts
3
+ /**
4
+ * Immutable limits configuration type.
5
+ */
6
+ type Limits = Readonly<LimitsConfig>;
7
+ //#endregion
8
+ export { Limits };
9
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","names":[],"sources":["../../../src/types/internal.ts"],"mappings":";;;;;KAwDY,SAAS,SAAS"}
@@ -0,0 +1,45 @@
1
+ //#region src/types/limits.d.ts
2
+ /**
3
+ * Configuration for router resource limits.
4
+ * Controls maximum allowed values for various router operations to prevent resource exhaustion.
5
+ */
6
+ interface LimitsConfig {
7
+ /**
8
+ * Maximum number of route dependencies allowed.
9
+ * Prevents circular dependency chains and excessive dependency graphs.
10
+ *
11
+ * @default 100
12
+ */
13
+ maxDependencies: number;
14
+ /**
15
+ * Maximum number of plugins that can be registered.
16
+ * Limits plugin stack depth to prevent performance degradation.
17
+ *
18
+ * @default 50
19
+ */
20
+ maxPlugins: number;
21
+ /**
22
+ * Maximum number of event listeners per event type.
23
+ * Prevents memory leaks from excessive listener registration.
24
+ *
25
+ * @default 10000
26
+ */
27
+ maxListeners: number;
28
+ /**
29
+ * Listener count at which a memory leak warning is logged per event type.
30
+ * Set to 0 to disable the warning.
31
+ *
32
+ * @default 1000
33
+ */
34
+ warnListeners: number;
35
+ /**
36
+ * Maximum number of lifecycle handlers (canActivate/canDeactivate) per route.
37
+ * Controls guard function stack to prevent excessive validation overhead.
38
+ *
39
+ * @default 200
40
+ */
41
+ maxLifecycleHandlers: number;
42
+ }
43
+ //#endregion
44
+ export { LimitsConfig };
45
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","names":[],"sources":["../../../src/types/limits.ts"],"mappings":";;;;;UAIiB;;;;;;;EAOf;;;;;;;EAQA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;EAQA"}
@@ -0,0 +1,46 @@
1
+ //#region src/types/route-node-types.d.ts
2
+ /**
3
+ * Route Node Type Definitions — Minimal Public API.
4
+ *
5
+ * This module exports ONLY the essential types used by real-router:
6
+ * - QueryParamsMode, QueryParamsOptions
7
+ * - RouteParams, RouteTreeState
8
+ *
9
+ * These types are copied from route-node to avoid circular dependencies.
10
+ *
11
+ * @module route-node-types
12
+ */
13
+ type ArrayFormat = "none" | "brackets" | "index" | "comma";
14
+ type BooleanFormat = "none" | "auto" | "empty-true";
15
+ type NullFormat = "default" | "hidden";
16
+ type NumberFormat = "none" | "auto";
17
+ /**
18
+ * Options for query parameter parsing and building.
19
+ */
20
+ interface QueryParamsOptions {
21
+ arrayFormat?: ArrayFormat;
22
+ booleanFormat?: BooleanFormat;
23
+ nullFormat?: NullFormat;
24
+ numberFormat?: NumberFormat;
25
+ }
26
+ /**
27
+ * Controls how query parameters are handled during matching.
28
+ */
29
+ type QueryParamsMode = "default" | "strict" | "loose";
30
+ type ParamSource = "url" | "query";
31
+ type ParamTypeMap = Record<string, ParamSource>;
32
+ type RouteTreeStateMeta = Record<string, ParamTypeMap>;
33
+ interface RouteParams {
34
+ [key: string]: string | string[] | number | number[] | boolean | boolean[] | RouteParams | RouteParams[] | Record<string, string | number | boolean> | null | undefined;
35
+ }
36
+ /**
37
+ * Complete state representation of a matched route.
38
+ */
39
+ interface RouteTreeState<P extends Record<string, unknown> = RouteParams> {
40
+ name: string;
41
+ params: P;
42
+ meta: RouteTreeStateMeta;
43
+ }
44
+ //#endregion
45
+ export { QueryParamsMode, QueryParamsOptions, RouteParams, RouteTreeState };
46
+ //# sourceMappingURL=route-node-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-node-types.d.ts","names":[],"sources":["../../../src/types/route-node-types.ts"],"mappings":";;;;;;;;;;;;KAgBK;KACA;KACA;KACA;;;;UAKY;EACf,cAAc;EACd,gBAAgB;EAChB,aAAa;EACb,eAAe;;;;;KAUL;KAMP;KACA,eAAe,eAAe;KAC9B,qBAAqB,eAAe;UAExB;GACd,4EAOG,cACA,gBACA;;;;;UAQW,eACf,UAAU,0BAA0B;EAEpC;EACA,QAAQ;EACR,MAAM"}