wevu 6.18.7 → 6.19.1

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 (585) hide show
  1. package/dist/_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/defineProperty.mjs +1 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/toPrimitive.mjs +1 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/toPropertyKey.mjs +1 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/typeof.mjs +1 -0
  5. package/dist/dev/_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/defineProperty.mjs +14 -0
  6. package/dist/dev/_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/toPrimitive.mjs +16 -0
  7. package/dist/dev/_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/toPropertyKey.mjs +11 -0
  8. package/dist/dev/_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/typeof.mjs +12 -0
  9. package/dist/dev/index.mjs +48 -10
  10. package/dist/dev/internal-reactivity.mjs +15 -5
  11. package/dist/dev/internal-runtime.mjs +32 -4
  12. package/dist/dev/internal-template.mjs +1 -1
  13. package/dist/dev/package.mjs +6 -0
  14. package/dist/dev/package.mjs.map +1 -0
  15. package/dist/dev/reactivity/computed.mjs +49 -0
  16. package/dist/dev/reactivity/computed.mjs.map +1 -0
  17. package/dist/dev/reactivity/core.mjs +184 -0
  18. package/dist/dev/reactivity/core.mjs.map +1 -0
  19. package/dist/dev/reactivity/reactive/mutation.mjs +12 -0
  20. package/dist/dev/reactivity/reactive/mutation.mjs.map +1 -0
  21. package/dist/dev/{computed-BxRsUJgi.mjs → reactivity/reactive/patch.mjs} +8 -49
  22. package/dist/dev/reactivity/reactive/patch.mjs.map +1 -0
  23. package/dist/dev/reactivity/reactive/patchState.mjs +138 -0
  24. package/dist/dev/reactivity/reactive/patchState.mjs.map +1 -0
  25. package/dist/dev/reactivity/reactive/shallow.mjs +77 -0
  26. package/dist/dev/reactivity/reactive/shallow.mjs.map +1 -0
  27. package/dist/dev/reactivity/reactive/shared.mjs +40 -0
  28. package/dist/dev/reactivity/reactive/shared.mjs.map +1 -0
  29. package/dist/dev/reactivity/reactive/state.mjs +8 -0
  30. package/dist/dev/reactivity/reactive/state.mjs.map +1 -0
  31. package/dist/dev/reactivity/reactive.mjs +213 -0
  32. package/dist/dev/reactivity/reactive.mjs.map +1 -0
  33. package/dist/dev/reactivity/readonly.mjs +69 -0
  34. package/dist/dev/reactivity/readonly.mjs.map +1 -0
  35. package/dist/dev/reactivity/ref.mjs +97 -0
  36. package/dist/dev/reactivity/ref.mjs.map +1 -0
  37. package/dist/dev/reactivity/shallowRef.mjs +71 -0
  38. package/dist/dev/reactivity/shallowRef.mjs.map +1 -0
  39. package/dist/dev/{toRefs-D06VmFK2.mjs → reactivity/toRefs.mjs} +4 -3
  40. package/dist/dev/reactivity/toRefs.mjs.map +1 -0
  41. package/dist/dev/reactivity/traverse.mjs +40 -0
  42. package/dist/dev/reactivity/traverse.mjs.map +1 -0
  43. package/dist/dev/reactivity/watch/helpers.mjs +78 -0
  44. package/dist/dev/reactivity/watch/helpers.mjs.map +1 -0
  45. package/dist/dev/reactivity/watch/types.mjs +20 -0
  46. package/dist/dev/reactivity/watch/types.mjs.map +1 -0
  47. package/dist/dev/reactivity/watch.mjs +167 -0
  48. package/dist/dev/reactivity/watch.mjs.map +1 -0
  49. package/dist/dev/router/backNavigation.mjs +32 -0
  50. package/dist/dev/router/backNavigation.mjs.map +1 -0
  51. package/dist/dev/router/createRouter.mjs +179 -0
  52. package/dist/dev/router/createRouter.mjs.map +1 -0
  53. package/dist/dev/router/instance.mjs +17 -0
  54. package/dist/dev/router/instance.mjs.map +1 -0
  55. package/dist/dev/router/navigationApi.mjs +94 -0
  56. package/dist/dev/router/navigationApi.mjs.map +1 -0
  57. package/dist/dev/router/navigationCore.mjs +139 -0
  58. package/dist/dev/router/navigationCore.mjs.map +1 -0
  59. package/dist/dev/router/navigationResult.mjs +54 -0
  60. package/dist/dev/router/navigationResult.mjs.map +1 -0
  61. package/dist/dev/router/navigationTarget.mjs +122 -0
  62. package/dist/dev/router/navigationTarget.mjs.map +1 -0
  63. package/dist/dev/router/navigationTargetHelpers.mjs +38 -0
  64. package/dist/dev/router/navigationTargetHelpers.mjs.map +1 -0
  65. package/dist/dev/router/resolve.mjs +29 -0
  66. package/dist/dev/router/resolve.mjs.map +1 -0
  67. package/dist/dev/router/routeRegistry.mjs +78 -0
  68. package/dist/dev/router/routeRegistry.mjs.map +1 -0
  69. package/dist/dev/router/routeSync.mjs +72 -0
  70. package/dist/dev/router/routeSync.mjs.map +1 -0
  71. package/dist/dev/router/types.mjs +11 -0
  72. package/dist/dev/router/types.mjs.map +1 -0
  73. package/dist/dev/router/useRoute.mjs +106 -0
  74. package/dist/dev/router/useRoute.mjs.map +1 -0
  75. package/dist/dev/router/useRouter.mjs +15 -0
  76. package/dist/dev/router/useRouter.mjs.map +1 -0
  77. package/dist/dev/router.mjs +9 -1378
  78. package/dist/dev/routerInternal/location.mjs +68 -0
  79. package/dist/dev/routerInternal/location.mjs.map +1 -0
  80. package/dist/dev/routerInternal/matching.mjs +149 -0
  81. package/dist/dev/routerInternal/matching.mjs.map +1 -0
  82. package/dist/dev/routerInternal/params.mjs +95 -0
  83. package/dist/dev/routerInternal/params.mjs.map +1 -0
  84. package/dist/dev/routerInternal/path.mjs +42 -0
  85. package/dist/dev/routerInternal/path.mjs.map +1 -0
  86. package/dist/dev/routerInternal/query.mjs +113 -0
  87. package/dist/dev/routerInternal/query.mjs.map +1 -0
  88. package/dist/dev/routerInternal/records.mjs +173 -0
  89. package/dist/dev/routerInternal/records.mjs.map +1 -0
  90. package/dist/dev/routerInternal/recordsWarnings.mjs +49 -0
  91. package/dist/dev/routerInternal/recordsWarnings.mjs.map +1 -0
  92. package/dist/dev/routerInternal/snapshots.mjs +126 -0
  93. package/dist/dev/routerInternal/snapshots.mjs.map +1 -0
  94. package/dist/dev/runtime/app/computed.mjs +68 -0
  95. package/dist/dev/runtime/app/computed.mjs.map +1 -0
  96. package/dist/dev/runtime/app/context.mjs +275 -0
  97. package/dist/dev/runtime/app/context.mjs.map +1 -0
  98. package/dist/dev/runtime/app/diagnostics.mjs +34 -0
  99. package/dist/dev/runtime/app/diagnostics.mjs.map +1 -0
  100. package/dist/dev/runtime/app/mount.mjs +270 -0
  101. package/dist/dev/runtime/app/mount.mjs.map +1 -0
  102. package/dist/dev/runtime/app/pending.mjs +14 -0
  103. package/dist/dev/runtime/app/pending.mjs.map +1 -0
  104. package/dist/dev/runtime/app/setData/patchScheduler.mjs +158 -0
  105. package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -0
  106. package/dist/dev/runtime/app/setData/payload.mjs +161 -0
  107. package/dist/dev/runtime/app/setData/payload.mjs.map +1 -0
  108. package/dist/dev/runtime/app/setData/scheduler.mjs +313 -0
  109. package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -0
  110. package/dist/dev/runtime/app/setData/snapshot.mjs +129 -0
  111. package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -0
  112. package/dist/dev/runtime/app/setDataOptions.mjs +73 -0
  113. package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -0
  114. package/dist/dev/runtime/app.mjs +93 -0
  115. package/dist/dev/runtime/app.mjs.map +1 -0
  116. package/dist/dev/runtime/bindModel.mjs +92 -0
  117. package/dist/dev/runtime/bindModel.mjs.map +1 -0
  118. package/dist/dev/runtime/defaults.mjs +61 -0
  119. package/dist/dev/runtime/defaults.mjs.map +1 -0
  120. package/dist/dev/runtime/define/initialComputed.mjs +125 -0
  121. package/dist/dev/runtime/define/initialComputed.mjs.map +1 -0
  122. package/dist/dev/runtime/define/options.mjs +169 -0
  123. package/dist/dev/runtime/define/options.mjs.map +1 -0
  124. package/dist/dev/runtime/define/optionsApi.mjs +48 -0
  125. package/dist/dev/runtime/define/optionsApi.mjs.map +1 -0
  126. package/dist/dev/runtime/define/props.mjs +194 -0
  127. package/dist/dev/runtime/define/props.mjs.map +1 -0
  128. package/dist/dev/runtime/define/scopedSlotOptions.mjs +316 -0
  129. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -0
  130. package/dist/dev/runtime/define/setupResult.mjs +78 -0
  131. package/dist/dev/runtime/define/setupResult.mjs.map +1 -0
  132. package/dist/dev/runtime/define.mjs +142 -0
  133. package/dist/dev/runtime/define.mjs.map +1 -0
  134. package/dist/dev/runtime/diff.mjs +193 -0
  135. package/dist/dev/runtime/diff.mjs.map +1 -0
  136. package/dist/dev/runtime/disposables.mjs +81 -0
  137. package/dist/dev/runtime/disposables.mjs.map +1 -0
  138. package/dist/dev/runtime/elementIntersectionObserver.mjs +80 -0
  139. package/dist/dev/runtime/elementIntersectionObserver.mjs.map +1 -0
  140. package/dist/dev/runtime/emit.mjs +36 -0
  141. package/dist/dev/runtime/emit.mjs.map +1 -0
  142. package/dist/dev/{base-CYkvI7w8.mjs → runtime/hooks/base.mjs} +3 -140
  143. package/dist/dev/runtime/hooks/base.mjs.map +1 -0
  144. package/dist/dev/runtime/hooks/register.mjs +92 -0
  145. package/dist/dev/runtime/hooks/register.mjs.map +1 -0
  146. package/dist/dev/runtime/hooks/vue.mjs +81 -0
  147. package/dist/dev/runtime/hooks/vue.mjs.map +1 -0
  148. package/dist/dev/runtime/internal.mjs +18 -0
  149. package/dist/dev/runtime/internal.mjs.map +1 -0
  150. package/dist/dev/runtime/intersectionObserver.mjs +46 -0
  151. package/dist/dev/runtime/intersectionObserver.mjs.map +1 -0
  152. package/dist/dev/runtime/layoutBridge.mjs +303 -0
  153. package/dist/dev/runtime/layoutBridge.mjs.map +1 -0
  154. package/dist/dev/runtime/layoutComponentMatcher.mjs +11 -0
  155. package/dist/dev/runtime/layoutComponentMatcher.mjs.map +1 -0
  156. package/dist/dev/runtime/nativeBridge.mjs +21 -0
  157. package/dist/dev/runtime/nativeBridge.mjs.map +1 -0
  158. package/dist/dev/runtime/noSetData.mjs +18 -0
  159. package/dist/dev/runtime/noSetData.mjs.map +1 -0
  160. package/dist/dev/runtime/pageEnvironment.mjs +100 -0
  161. package/dist/dev/runtime/pageEnvironment.mjs.map +1 -0
  162. package/dist/dev/runtime/pageLayout.mjs +71 -0
  163. package/dist/dev/runtime/pageLayout.mjs.map +1 -0
  164. package/dist/dev/runtime/pageScroll.mjs +110 -0
  165. package/dist/dev/runtime/pageScroll.mjs.map +1 -0
  166. package/dist/dev/runtime/platform.mjs +79 -0
  167. package/dist/dev/runtime/platform.mjs.map +1 -0
  168. package/dist/dev/runtime/provide.mjs +71 -0
  169. package/dist/dev/runtime/provide.mjs.map +1 -0
  170. package/dist/dev/runtime/provideContext.mjs +101 -0
  171. package/dist/dev/runtime/provideContext.mjs.map +1 -0
  172. package/dist/dev/runtime/provideStore.mjs +18 -0
  173. package/dist/dev/runtime/provideStore.mjs.map +1 -0
  174. package/dist/dev/runtime/pullDownRefresh.mjs +24 -0
  175. package/dist/dev/runtime/pullDownRefresh.mjs.map +1 -0
  176. package/dist/dev/runtime/register/app.mjs +161 -0
  177. package/dist/dev/runtime/register/app.mjs.map +1 -0
  178. package/dist/dev/runtime/register/component/features.mjs +43 -0
  179. package/dist/dev/runtime/register/component/features.mjs.map +1 -0
  180. package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs +64 -0
  181. package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs.map +1 -0
  182. package/dist/dev/runtime/register/component/lifecycle/platform.mjs +96 -0
  183. package/dist/dev/runtime/register/component/lifecycle/platform.mjs.map +1 -0
  184. package/dist/dev/runtime/register/component/lifecycle.mjs +122 -0
  185. package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -0
  186. package/dist/dev/runtime/register/component/methods.mjs +82 -0
  187. package/dist/dev/runtime/register/component/methods.mjs.map +1 -0
  188. package/dist/dev/runtime/register/component/options.mjs +204 -0
  189. package/dist/dev/runtime/register/component/options.mjs.map +1 -0
  190. package/dist/dev/runtime/register/component/props.mjs +218 -0
  191. package/dist/dev/runtime/register/component/props.mjs.map +1 -0
  192. package/dist/dev/runtime/register/component/registerDefinition.mjs +290 -0
  193. package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -0
  194. package/dist/dev/runtime/register/component.mjs +129 -0
  195. package/dist/dev/runtime/register/component.mjs.map +1 -0
  196. package/dist/dev/runtime/register/inline.mjs +145 -0
  197. package/dist/dev/runtime/register/inline.mjs.map +1 -0
  198. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +53 -0
  199. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -0
  200. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +34 -0
  201. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -0
  202. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +230 -0
  203. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -0
  204. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +166 -0
  205. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -0
  206. package/dist/dev/runtime/register/runtimeInstance/utils.mjs +122 -0
  207. package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -0
  208. package/dist/dev/runtime/register/runtimeInstance.mjs +441 -0
  209. package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -0
  210. package/dist/dev/runtime/register/setDataFrequencyWarning.mjs +95 -0
  211. package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -0
  212. package/dist/dev/runtime/register/setup.mjs +22 -0
  213. package/dist/dev/runtime/register/setup.mjs.map +1 -0
  214. package/dist/dev/runtime/register/snapshot.mjs +18 -0
  215. package/dist/dev/runtime/register/snapshot.mjs.map +1 -0
  216. package/dist/dev/runtime/register/watch.mjs +57 -0
  217. package/dist/dev/runtime/register/watch.mjs.map +1 -0
  218. package/dist/dev/runtime/scopedSlots.mjs +115 -0
  219. package/dist/dev/runtime/scopedSlots.mjs.map +1 -0
  220. package/dist/dev/runtime/selectorQuery.mjs +49 -0
  221. package/dist/dev/runtime/selectorQuery.mjs.map +1 -0
  222. package/dist/dev/runtime/setupTracking.mjs +59 -0
  223. package/dist/dev/runtime/setupTracking.mjs.map +1 -0
  224. package/dist/dev/{template-n_iVr0ey.mjs → runtime/template.mjs} +7 -4
  225. package/dist/dev/runtime/template.mjs.map +1 -0
  226. package/dist/dev/runtime/templateRefs/helpers.mjs +259 -0
  227. package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -0
  228. package/dist/dev/runtime/templateRefs.mjs +162 -0
  229. package/dist/dev/runtime/templateRefs.mjs.map +1 -0
  230. package/dist/dev/runtime/uniAppHost.mjs +119 -0
  231. package/dist/dev/runtime/uniAppHost.mjs.map +1 -0
  232. package/dist/dev/runtime/updatePerformance.mjs +41 -0
  233. package/dist/dev/runtime/updatePerformance.mjs.map +1 -0
  234. package/dist/dev/runtime/use.mjs +25 -0
  235. package/dist/dev/runtime/use.mjs.map +1 -0
  236. package/dist/dev/runtime/vueCompat/context.mjs +25 -0
  237. package/dist/dev/runtime/vueCompat/context.mjs.map +1 -0
  238. package/dist/dev/runtime/vueCompat/model.mjs +119 -0
  239. package/dist/dev/runtime/vueCompat/model.mjs.map +1 -0
  240. package/dist/dev/runtime/vueCompat/router.mjs +124 -0
  241. package/dist/dev/runtime/vueCompat/router.mjs.map +1 -0
  242. package/dist/dev/runtime/vueCompat/templateRef.mjs +37 -0
  243. package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -0
  244. package/dist/dev/scheduler.mjs +75 -0
  245. package/dist/dev/scheduler.mjs.map +1 -0
  246. package/dist/dev/store/actions.mjs +40 -0
  247. package/dist/dev/store/actions.mjs.map +1 -0
  248. package/dist/dev/store/base.mjs +56 -0
  249. package/dist/dev/store/base.mjs.map +1 -0
  250. package/dist/dev/store/define/optionsStyle.mjs +125 -0
  251. package/dist/dev/store/define/optionsStyle.mjs.map +1 -0
  252. package/dist/dev/store/define/setupStyle.mjs +145 -0
  253. package/dist/dev/store/define/setupStyle.mjs.map +1 -0
  254. package/dist/dev/store/define/shared.mjs +38 -0
  255. package/dist/dev/store/define/shared.mjs.map +1 -0
  256. package/dist/dev/store/define.mjs +23 -0
  257. package/dist/dev/store/define.mjs.map +1 -0
  258. package/dist/dev/store/manager.mjs +21 -0
  259. package/dist/dev/store/manager.mjs.map +1 -0
  260. package/dist/dev/store/storeToRefs.mjs +29 -0
  261. package/dist/dev/store/storeToRefs.mjs.map +1 -0
  262. package/dist/dev/store/utils.mjs +49 -0
  263. package/dist/dev/store/utils.mjs.map +1 -0
  264. package/dist/dev/store.mjs +3 -1
  265. package/dist/dev/utils.mjs +16 -0
  266. package/dist/dev/utils.mjs.map +1 -0
  267. package/dist/dev/version.mjs +8 -0
  268. package/dist/dev/version.mjs.map +1 -0
  269. package/dist/dev/vue-demi.mjs +48 -168
  270. package/dist/dev/vue-demi.mjs.map +1 -1
  271. package/dist/index.d.mts +71 -7
  272. package/dist/index.mjs +1 -1
  273. package/dist/internal-reactivity.d.mts +16 -2
  274. package/dist/internal-reactivity.mjs +1 -1
  275. package/dist/internal-runtime.d.mts +35 -2
  276. package/dist/internal-runtime.mjs +1 -1
  277. package/dist/internal-template.d.mts +1 -1
  278. package/dist/internal-template.mjs +1 -1
  279. package/dist/jsx-runtime.d.mts +1 -1
  280. package/dist/macros/shared.d.mts +81 -0
  281. package/dist/macros.d.mts +70 -0
  282. package/dist/package.mjs +1 -0
  283. package/dist/reactivity/computed.d.mts +21 -0
  284. package/dist/reactivity/computed.mjs +1 -0
  285. package/dist/reactivity/core.d.mts +34 -0
  286. package/dist/reactivity/core.mjs +1 -0
  287. package/dist/reactivity/index.d.mts +15 -0
  288. package/dist/reactivity/reactive/mutation.d.mts +21 -0
  289. package/dist/reactivity/reactive/mutation.mjs +1 -0
  290. package/dist/reactivity/reactive/patch.d.mts +18 -0
  291. package/dist/reactivity/reactive/patch.mjs +1 -0
  292. package/dist/reactivity/reactive/patchState.mjs +1 -0
  293. package/dist/reactivity/reactive/shallow.d.mts +22 -0
  294. package/dist/reactivity/reactive/shallow.mjs +1 -0
  295. package/dist/reactivity/reactive/shared.d.mts +4 -0
  296. package/dist/reactivity/reactive/shared.mjs +1 -0
  297. package/dist/reactivity/reactive/state.mjs +1 -0
  298. package/dist/reactivity/reactive.d.mts +41 -0
  299. package/dist/reactivity/reactive.mjs +1 -0
  300. package/dist/reactivity/readonly.d.mts +27 -0
  301. package/dist/reactivity/readonly.mjs +1 -0
  302. package/dist/reactivity/ref.d.mts +27 -0
  303. package/dist/reactivity/ref.mjs +1 -0
  304. package/dist/reactivity/shallowRef.d.mts +19 -0
  305. package/dist/reactivity/shallowRef.mjs +1 -0
  306. package/dist/reactivity/toRefs.d.mts +43 -0
  307. package/dist/reactivity/toRefs.mjs +1 -0
  308. package/dist/reactivity/traverse.d.mts +8 -0
  309. package/dist/reactivity/traverse.mjs +1 -0
  310. package/dist/reactivity/watch/helpers.mjs +1 -0
  311. package/dist/reactivity/watch/types.d.mts +43 -0
  312. package/dist/reactivity/watch/types.mjs +1 -0
  313. package/dist/reactivity/watch.d.mts +21 -0
  314. package/dist/reactivity/watch.mjs +1 -0
  315. package/dist/router/backNavigation.mjs +1 -0
  316. package/dist/router/createRouter.d.mts +8 -0
  317. package/dist/router/createRouter.mjs +1 -0
  318. package/dist/router/instance.mjs +1 -0
  319. package/dist/router/navigationApi.mjs +1 -0
  320. package/dist/router/navigationCore.d.mts +6 -0
  321. package/dist/router/navigationCore.mjs +1 -0
  322. package/dist/router/navigationResult.mjs +1 -0
  323. package/dist/router/navigationTarget.mjs +1 -0
  324. package/dist/router/navigationTargetHelpers.mjs +1 -0
  325. package/dist/router/resolve.d.mts +6 -0
  326. package/dist/router/resolve.mjs +1 -0
  327. package/dist/router/routeRegistry.mjs +1 -0
  328. package/dist/router/routeSync.d.mts +1 -0
  329. package/dist/router/routeSync.mjs +1 -0
  330. package/dist/router/types.d.mts +163 -0
  331. package/dist/router/types.mjs +1 -0
  332. package/dist/router/useRoute.d.mts +19 -0
  333. package/dist/router/useRoute.mjs +1 -0
  334. package/dist/router/useRouter.d.mts +8 -0
  335. package/dist/router/useRouter.mjs +1 -0
  336. package/dist/router.d.mts +9 -204
  337. package/dist/router.mjs +1 -1
  338. package/dist/routerInternal/location.mjs +1 -0
  339. package/dist/routerInternal/matching.mjs +1 -0
  340. package/dist/routerInternal/params.mjs +1 -0
  341. package/dist/routerInternal/path.mjs +1 -0
  342. package/dist/routerInternal/query.d.mts +7 -0
  343. package/dist/routerInternal/query.mjs +1 -0
  344. package/dist/routerInternal/records.mjs +1 -0
  345. package/dist/routerInternal/recordsWarnings.mjs +1 -0
  346. package/dist/routerInternal/snapshots.mjs +1 -0
  347. package/dist/routerInternal/types.d.mts +9 -0
  348. package/dist/runtime/app/computed.mjs +1 -0
  349. package/dist/runtime/app/context.mjs +1 -0
  350. package/dist/runtime/app/diagnostics.mjs +1 -0
  351. package/dist/runtime/app/mount.mjs +1 -0
  352. package/dist/runtime/app/pending.d.mts +10 -0
  353. package/dist/runtime/app/pending.mjs +1 -0
  354. package/dist/runtime/app/setData/patchScheduler.mjs +1 -0
  355. package/dist/runtime/app/setData/payload.mjs +1 -0
  356. package/dist/runtime/app/setData/scheduler.mjs +1 -0
  357. package/dist/runtime/app/setData/snapshot.mjs +1 -0
  358. package/dist/runtime/app/setDataOptions.mjs +1 -0
  359. package/dist/runtime/app.d.mts +8 -0
  360. package/dist/runtime/app.mjs +1 -0
  361. package/dist/runtime/bindModel.mjs +1 -0
  362. package/dist/runtime/defaults.d.mts +11 -0
  363. package/dist/runtime/defaults.mjs +1 -0
  364. package/dist/runtime/define/initialComputed.mjs +1 -0
  365. package/dist/runtime/define/options.mjs +1 -0
  366. package/dist/runtime/define/optionsApi.mjs +1 -0
  367. package/dist/runtime/define/props.mjs +1 -0
  368. package/dist/runtime/define/scopedSlotOptions.mjs +1 -0
  369. package/dist/runtime/define/setupResult.mjs +1 -0
  370. package/dist/runtime/define.d.mts +105 -0
  371. package/dist/runtime/define.mjs +1 -0
  372. package/dist/runtime/diff.mjs +1 -0
  373. package/dist/runtime/disposables.d.mts +31 -0
  374. package/dist/runtime/disposables.mjs +1 -0
  375. package/dist/runtime/elementIntersectionObserver.d.mts +26 -0
  376. package/dist/runtime/elementIntersectionObserver.mjs +1 -0
  377. package/dist/runtime/emit.mjs +1 -0
  378. package/dist/runtime/hooks/base.d.mts +27 -0
  379. package/dist/runtime/hooks/base.mjs +1 -0
  380. package/dist/runtime/hooks/register.d.mts +30 -0
  381. package/dist/runtime/hooks/register.mjs +1 -0
  382. package/dist/runtime/hooks/vue.d.mts +53 -0
  383. package/dist/runtime/hooks/vue.mjs +1 -0
  384. package/dist/runtime/hooks.d.mts +4 -0
  385. package/dist/runtime/index.d.mts +47 -0
  386. package/dist/runtime/internal.mjs +1 -0
  387. package/dist/runtime/intersectionObserver.d.mts +14 -0
  388. package/dist/runtime/intersectionObserver.mjs +1 -0
  389. package/dist/runtime/layoutBridge.d.mts +59 -0
  390. package/dist/runtime/layoutBridge.mjs +1 -0
  391. package/dist/runtime/layoutComponentMatcher.mjs +1 -0
  392. package/dist/runtime/nativeBridge.mjs +1 -0
  393. package/dist/runtime/noSetData.d.mts +5 -0
  394. package/dist/runtime/noSetData.mjs +1 -0
  395. package/dist/runtime/pageEnvironment.d.mts +50 -0
  396. package/dist/runtime/pageEnvironment.mjs +1 -0
  397. package/dist/runtime/pageLayout.d.mts +26 -0
  398. package/dist/runtime/pageLayout.mjs +1 -0
  399. package/dist/runtime/pageScroll.d.mts +29 -0
  400. package/dist/runtime/pageScroll.mjs +1 -0
  401. package/dist/runtime/platform.mjs +1 -0
  402. package/dist/runtime/provide.d.mts +59 -0
  403. package/dist/runtime/provide.mjs +1 -0
  404. package/dist/runtime/provideContext.mjs +1 -0
  405. package/dist/runtime/provideStore.d.mts +7 -0
  406. package/dist/runtime/provideStore.mjs +1 -0
  407. package/dist/runtime/pullDownRefresh.d.mts +12 -0
  408. package/dist/runtime/pullDownRefresh.mjs +1 -0
  409. package/dist/runtime/register/app.d.mts +14 -0
  410. package/dist/runtime/register/app.mjs +1 -0
  411. package/dist/runtime/register/component/features.mjs +1 -0
  412. package/dist/runtime/register/component/lifecycle/optionalHooks.mjs +1 -0
  413. package/dist/runtime/register/component/lifecycle/platform.mjs +1 -0
  414. package/dist/runtime/register/component/lifecycle.mjs +1 -0
  415. package/dist/runtime/register/component/methods.mjs +1 -0
  416. package/dist/runtime/register/component/options.mjs +1 -0
  417. package/dist/runtime/register/component/props.mjs +1 -0
  418. package/dist/runtime/register/component/registerDefinition.mjs +1 -0
  419. package/dist/runtime/register/component.d.mts +15 -0
  420. package/dist/runtime/register/component.mjs +1 -0
  421. package/dist/runtime/register/inline.d.mts +15 -0
  422. package/dist/runtime/register/inline.mjs +1 -0
  423. package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -0
  424. package/dist/runtime/register/runtimeInstance/provideContext.mjs +1 -0
  425. package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -0
  426. package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -0
  427. package/dist/runtime/register/runtimeInstance/utils.mjs +1 -0
  428. package/dist/runtime/register/runtimeInstance.d.mts +26 -0
  429. package/dist/runtime/register/runtimeInstance.mjs +1 -0
  430. package/dist/runtime/register/setDataFrequencyWarning.mjs +1 -0
  431. package/dist/runtime/register/setup.d.mts +11 -0
  432. package/dist/runtime/register/setup.mjs +1 -0
  433. package/dist/runtime/register/snapshot.mjs +1 -0
  434. package/dist/runtime/register/watch.d.mts +12 -0
  435. package/dist/runtime/register/watch.mjs +1 -0
  436. package/dist/runtime/register.d.mts +5 -0
  437. package/dist/runtime/scopedSlots.mjs +1 -0
  438. package/dist/runtime/selectorQuery.d.mts +54 -0
  439. package/dist/runtime/selectorQuery.mjs +1 -0
  440. package/dist/runtime/setupTracking.mjs +1 -0
  441. package/dist/{template-DE8e5dj_.d.mts → runtime/template.d.mts} +1 -1
  442. package/dist/runtime/template.mjs +1 -0
  443. package/dist/runtime/templateRefTypes.d.mts +7 -0
  444. package/dist/runtime/templateRefs/helpers.mjs +1 -0
  445. package/dist/runtime/templateRefs.d.mts +11 -0
  446. package/dist/runtime/templateRefs.mjs +1 -0
  447. package/dist/runtime/types/core.d.mts +35 -0
  448. package/dist/runtime/types/miniprogram.d.mts +80 -0
  449. package/dist/runtime/types/miniprogramHost.d.mts +44 -0
  450. package/dist/runtime/types/miniprogramHostSources.d.mts +112 -0
  451. package/dist/runtime/types/options.d.mts +136 -0
  452. package/dist/runtime/types/props/propTypes.d.mts +79 -0
  453. package/dist/runtime/types/props/router.d.mts +51 -0
  454. package/dist/runtime/types/props/setup.d.mts +96 -0
  455. package/dist/runtime/types/props.d.mts +4 -0
  456. package/dist/runtime/types/runtime.d.mts +59 -0
  457. package/dist/runtime/types/setData.d.mts +220 -0
  458. package/dist/runtime/types.d.mts +28 -0
  459. package/dist/runtime/uniAppHost.d.mts +8 -0
  460. package/dist/runtime/uniAppHost.mjs +1 -0
  461. package/dist/runtime/updatePerformance.d.mts +13 -0
  462. package/dist/runtime/updatePerformance.mjs +1 -0
  463. package/dist/runtime/use.d.mts +13 -0
  464. package/dist/runtime/use.mjs +1 -0
  465. package/dist/runtime/vueCompat/context.d.mts +8 -0
  466. package/dist/runtime/vueCompat/context.mjs +1 -0
  467. package/dist/runtime/vueCompat/model.d.mts +30 -0
  468. package/dist/runtime/vueCompat/model.mjs +1 -0
  469. package/dist/runtime/vueCompat/router.d.mts +28 -0
  470. package/dist/runtime/vueCompat/router.mjs +1 -0
  471. package/dist/runtime/vueCompat/templateRef.d.mts +9 -0
  472. package/dist/runtime/vueCompat/templateRef.mjs +1 -0
  473. package/dist/runtime/vueCompat.d.mts +5 -0
  474. package/dist/scheduler.d.mts +4 -0
  475. package/dist/scheduler.mjs +1 -0
  476. package/dist/store/actions.mjs +1 -0
  477. package/dist/store/base.mjs +1 -0
  478. package/dist/store/define/optionsStyle.mjs +1 -0
  479. package/dist/store/define/setupStyle.mjs +1 -0
  480. package/dist/store/define/shared.mjs +1 -0
  481. package/dist/store/define.d.mts +26 -0
  482. package/dist/store/define.mjs +1 -0
  483. package/dist/store/manager.d.mts +8 -0
  484. package/dist/store/manager.mjs +1 -0
  485. package/dist/store/storeToRefs.d.mts +13 -0
  486. package/dist/store/storeToRefs.mjs +1 -0
  487. package/dist/store/types.d.mts +70 -0
  488. package/dist/store/utils.mjs +1 -0
  489. package/dist/store.d.mts +4 -1
  490. package/dist/store.mjs +1 -1
  491. package/dist/utils.mjs +1 -0
  492. package/dist/version.d.mts +4 -0
  493. package/dist/version.mjs +1 -0
  494. package/dist/vue-augment.d.mts +6 -0
  495. package/dist/vue-demi.d.mts +68 -10
  496. package/dist/vue-demi.mjs +1 -1
  497. package/dist/vue-types.d.mts +18 -0
  498. package/dist/weappIntrinsicElements/base.d.mts +22 -0
  499. package/dist/weappIntrinsicElements/elements/ad-custom.d.mts +13 -0
  500. package/dist/weappIntrinsicElements/elements/ad.d.mts +16 -0
  501. package/dist/weappIntrinsicElements/elements/audio.d.mts +20 -0
  502. package/dist/weappIntrinsicElements/elements/block.d.mts +8 -0
  503. package/dist/weappIntrinsicElements/elements/button.d.mts +40 -0
  504. package/dist/weappIntrinsicElements/elements/camera.d.mts +18 -0
  505. package/dist/weappIntrinsicElements/elements/canvas.d.mts +18 -0
  506. package/dist/weappIntrinsicElements/elements/checkbox-group.d.mts +13 -0
  507. package/dist/weappIntrinsicElements/elements/checkbox.d.mts +13 -0
  508. package/dist/weappIntrinsicElements/elements/cover-image.d.mts +10 -0
  509. package/dist/weappIntrinsicElements/elements/cover-view.d.mts +10 -0
  510. package/dist/weappIntrinsicElements/elements/editor.d.mts +22 -0
  511. package/dist/weappIntrinsicElements/elements/form.d.mts +16 -0
  512. package/dist/weappIntrinsicElements/elements/functional-page-navigator.d.mts +15 -0
  513. package/dist/weappIntrinsicElements/elements/icon.d.mts +12 -0
  514. package/dist/weappIntrinsicElements/elements/image.d.mts +18 -0
  515. package/dist/weappIntrinsicElements/elements/import.d.mts +10 -0
  516. package/dist/weappIntrinsicElements/elements/include.d.mts +10 -0
  517. package/dist/weappIntrinsicElements/elements/input.d.mts +47 -0
  518. package/dist/weappIntrinsicElements/elements/keyboard-accessory.d.mts +8 -0
  519. package/dist/weappIntrinsicElements/elements/label.d.mts +10 -0
  520. package/dist/weappIntrinsicElements/elements/live-player.d.mts +35 -0
  521. package/dist/weappIntrinsicElements/elements/live-pusher.d.mts +57 -0
  522. package/dist/weappIntrinsicElements/elements/map.d.mts +105 -0
  523. package/dist/weappIntrinsicElements/elements/match-media.d.mts +16 -0
  524. package/dist/weappIntrinsicElements/elements/movable-area.d.mts +26 -0
  525. package/dist/weappIntrinsicElements/elements/movable-view.d.mts +26 -0
  526. package/dist/weappIntrinsicElements/elements/navigation-bar.d.mts +15 -0
  527. package/dist/weappIntrinsicElements/elements/navigator.d.mts +25 -0
  528. package/dist/weappIntrinsicElements/elements/official-account.d.mts +13 -0
  529. package/dist/weappIntrinsicElements/elements/open-data.d.mts +15 -0
  530. package/dist/weappIntrinsicElements/elements/page-container.d.mts +25 -0
  531. package/dist/weappIntrinsicElements/elements/page-meta.d.mts +23 -0
  532. package/dist/weappIntrinsicElements/elements/picker-view-column.d.mts +18 -0
  533. package/dist/weappIntrinsicElements/elements/picker-view.d.mts +18 -0
  534. package/dist/weappIntrinsicElements/elements/picker.d.mts +23 -0
  535. package/dist/weappIntrinsicElements/elements/progress.d.mts +21 -0
  536. package/dist/weappIntrinsicElements/elements/radio-group.d.mts +13 -0
  537. package/dist/weappIntrinsicElements/elements/radio.d.mts +13 -0
  538. package/dist/weappIntrinsicElements/elements/rich-text.d.mts +17 -0
  539. package/dist/weappIntrinsicElements/elements/scroll-view.d.mts +68 -0
  540. package/dist/weappIntrinsicElements/elements/share-element.d.mts +18 -0
  541. package/dist/weappIntrinsicElements/elements/slider.d.mts +23 -0
  542. package/dist/weappIntrinsicElements/elements/slot.d.mts +10 -0
  543. package/dist/weappIntrinsicElements/elements/swiper-item.d.mts +42 -0
  544. package/dist/weappIntrinsicElements/elements/swiper.d.mts +42 -0
  545. package/dist/weappIntrinsicElements/elements/switch.d.mts +14 -0
  546. package/dist/weappIntrinsicElements/elements/template.d.mts +12 -0
  547. package/dist/weappIntrinsicElements/elements/text.d.mts +15 -0
  548. package/dist/weappIntrinsicElements/elements/textarea.d.mts +40 -0
  549. package/dist/weappIntrinsicElements/elements/video.d.mts +71 -0
  550. package/dist/weappIntrinsicElements/elements/view.d.mts +13 -0
  551. package/dist/weappIntrinsicElements/elements/voip-room.d.mts +14 -0
  552. package/dist/weappIntrinsicElements/elements/web-view.d.mts +13 -0
  553. package/dist/weappIntrinsicElements.d.mts +153 -0
  554. package/package.json +6 -6
  555. package/dist/base-BxKbbKVO.mjs +0 -1
  556. package/dist/computed-Xoi9XEUx.mjs +0 -1
  557. package/dist/dev/base-CYkvI7w8.mjs.map +0 -1
  558. package/dist/dev/computed-BxRsUJgi.mjs.map +0 -1
  559. package/dist/dev/ref-DRZC3Kc5.mjs +0 -695
  560. package/dist/dev/ref-DRZC3Kc5.mjs.map +0 -1
  561. package/dist/dev/rolldown-runtime-BUUfjzRC.mjs +0 -36
  562. package/dist/dev/router-D0JQfgyN.mjs +0 -754
  563. package/dist/dev/router-D0JQfgyN.mjs.map +0 -1
  564. package/dist/dev/router.mjs.map +0 -1
  565. package/dist/dev/store-HNsiQJ4d.mjs +0 -479
  566. package/dist/dev/store-HNsiQJ4d.mjs.map +0 -1
  567. package/dist/dev/template-n_iVr0ey.mjs.map +0 -1
  568. package/dist/dev/templateRef-BLnYcEH0.mjs +0 -6439
  569. package/dist/dev/templateRef-BLnYcEH0.mjs.map +0 -1
  570. package/dist/dev/toRefs-D06VmFK2.mjs.map +0 -1
  571. package/dist/dev/watch-jrgL5ald.mjs +0 -445
  572. package/dist/dev/watch-jrgL5ald.mjs.map +0 -1
  573. package/dist/index-BiHILcmb.d.mts +0 -1215
  574. package/dist/index-CCET_bCY.d.mts +0 -111
  575. package/dist/ref-D37CknuD.mjs +0 -1
  576. package/dist/rolldown-runtime-CenpyGzJ.mjs +0 -1
  577. package/dist/router-D4W4lEXM.mjs +0 -1
  578. package/dist/store-eHrHBQiv.mjs +0 -1
  579. package/dist/template-CNzlwH-E.mjs +0 -1
  580. package/dist/templateRef-DOTHWzZ5.mjs +0 -1
  581. package/dist/toRefs-CoytPyo0.mjs +0 -1
  582. package/dist/traverse-B4Ez44Gd.d.mts +0 -108
  583. package/dist/vue-types-B3N60cGV.d.mts +0 -757
  584. package/dist/watch-Bbd-gmEg.mjs +0 -1
  585. package/dist/weappIntrinsicElements-BgDtC53_.d.mts +0 -1257
@@ -0,0 +1,173 @@
1
+ import { createAbsoluteRoutePath, isDynamicRoutePath, resolvePath } from "./path.mjs";
2
+ import { warnRouteConfig } from "./recordsWarnings.mjs";
3
+
4
+ //#region src/routerInternal/records.ts
5
+ function normalizeBeforeEnterGuards(beforeEnter) {
6
+ if (!beforeEnter) return [];
7
+ if (Array.isArray(beforeEnter)) return beforeEnter;
8
+ return [beforeEnter];
9
+ }
10
+ function resolveRouteRecordName(route, normalizedPath, source = "namedRoutes") {
11
+ if (typeof route.name === "string" && route.name.trim()) return route.name.trim();
12
+ if (source === "routes") return normalizedPath || "/";
13
+ return "";
14
+ }
15
+ function normalizeRouteRecordAliasPaths(alias, normalizedPath) {
16
+ if (!alias) return [];
17
+ const aliasList = Array.isArray(alias) ? alias : [alias];
18
+ const normalizedAliasPaths = [];
19
+ for (const aliasPath of aliasList) {
20
+ if (typeof aliasPath !== "string") continue;
21
+ const normalizedAliasPath = resolvePath(aliasPath, "");
22
+ if (!normalizedAliasPath || normalizedAliasPath === normalizedPath) continue;
23
+ if (!normalizedAliasPaths.includes(normalizedAliasPath)) normalizedAliasPaths.push(normalizedAliasPath);
24
+ }
25
+ return normalizedAliasPaths;
26
+ }
27
+ function normalizeRouteRecordRaw(route, parentName, source = "namedRoutes") {
28
+ const normalizedPath = resolvePath(route.path, "");
29
+ if (!normalizedPath && route.path !== "/") return;
30
+ const routeName = resolveRouteRecordName(route, normalizedPath, source);
31
+ if (!routeName) return;
32
+ return {
33
+ name: routeName,
34
+ path: normalizedPath,
35
+ aliasPaths: normalizeRouteRecordAliasPaths(route.alias, normalizedPath),
36
+ parentName,
37
+ meta: route.meta,
38
+ beforeEnterGuards: normalizeBeforeEnterGuards(route.beforeEnter),
39
+ redirect: route.redirect
40
+ };
41
+ }
42
+ function normalizeNestedRoutePath(path, parentPath) {
43
+ if (!parentPath || path.startsWith("/")) return resolvePath(path, "");
44
+ return resolvePath(`${createAbsoluteRoutePath(parentPath)}/${path}`, "");
45
+ }
46
+ function normalizeAliasInputList(alias) {
47
+ if (!alias) return [];
48
+ if (Array.isArray(alias)) return alias.filter((item) => typeof item === "string" && item.length > 0);
49
+ return typeof alias === "string" && alias.length > 0 ? [alias] : [];
50
+ }
51
+ function mergeAliasPaths(aliasPaths) {
52
+ const mergedAliasPaths = [];
53
+ for (const aliasPath of aliasPaths) {
54
+ if (!aliasPath || mergedAliasPaths.includes(aliasPath)) continue;
55
+ mergedAliasPaths.push(aliasPath);
56
+ }
57
+ return mergedAliasPaths;
58
+ }
59
+ function createRouteRecordAliasValue(aliasPaths) {
60
+ if (aliasPaths.length === 0) return;
61
+ if (aliasPaths.length === 1) return createAbsoluteRoutePath(aliasPaths[0]);
62
+ return aliasPaths.map((aliasPath) => createAbsoluteRoutePath(aliasPath));
63
+ }
64
+ function flattenNamedRouteRecords(records, parentPath, parentName, parentAliasPaths = [], source, pathPrefix = "namedRoutes", ancestorRecords = /* @__PURE__ */ new Set()) {
65
+ const flattenedRecords = [];
66
+ for (const [index, record] of records.entries()) {
67
+ const routeConfigPath = `${pathPrefix}[${index}]`;
68
+ if (ancestorRecords.has(record)) {
69
+ warnRouteConfig(`ignored route record at ${routeConfigPath}: detected circular children reference`);
70
+ continue;
71
+ }
72
+ if (typeof record.path !== "string" || !record.path) {
73
+ const routeName = typeof (record === null || record === void 0 ? void 0 : record.name) === "string" ? record.name.trim() : "";
74
+ warnRouteConfig(`ignored route record "${routeName}" at ${routeConfigPath}: route path is required`);
75
+ continue;
76
+ }
77
+ const normalizedPath = normalizeNestedRoutePath(record.path, parentPath);
78
+ const routeName = resolveRouteRecordName(record, normalizedPath, source);
79
+ if (!routeName) {
80
+ warnRouteConfig(`ignored route record at ${routeConfigPath}: route name is required`);
81
+ continue;
82
+ }
83
+ const normalizedDirectAliasPaths = [];
84
+ const directAliasByNormalizedPath = /* @__PURE__ */ new Map();
85
+ for (const rawAliasPath of normalizeAliasInputList(record.alias)) {
86
+ const normalizedAliasPath = normalizeNestedRoutePath(rawAliasPath, parentPath);
87
+ if (!normalizedAliasPath) continue;
88
+ if (normalizedAliasPath === normalizedPath) {
89
+ warnRouteConfig(`ignored alias "${createAbsoluteRoutePath(normalizedAliasPath)}" for route "${routeName}" at ${routeConfigPath}: alias is same as route path`);
90
+ continue;
91
+ }
92
+ const duplicateAliasPath = directAliasByNormalizedPath.get(normalizedAliasPath);
93
+ if (duplicateAliasPath) {
94
+ warnRouteConfig(`ignored duplicate alias "${createAbsoluteRoutePath(normalizedAliasPath)}" for route "${routeName}" at ${routeConfigPath}: already declared by "${duplicateAliasPath}"`);
95
+ continue;
96
+ }
97
+ directAliasByNormalizedPath.set(normalizedAliasPath, rawAliasPath);
98
+ normalizedDirectAliasPaths.push(normalizedAliasPath);
99
+ }
100
+ const normalizedInheritedAliasPaths = record.path.startsWith("/") ? [] : parentAliasPaths.map((parentAliasPath) => normalizeNestedRoutePath(record.path, parentAliasPath)).filter(Boolean).filter((aliasPath) => aliasPath !== normalizedPath);
101
+ const normalizedAliasPaths = mergeAliasPaths([...normalizedDirectAliasPaths, ...normalizedInheritedAliasPaths]);
102
+ const normalizedRecord = {
103
+ name: routeName,
104
+ path: normalizedPath ? createAbsoluteRoutePath(normalizedPath) : "/",
105
+ alias: createRouteRecordAliasValue(normalizedAliasPaths),
106
+ meta: record.meta,
107
+ beforeEnter: record.beforeEnter,
108
+ redirect: record.redirect
109
+ };
110
+ flattenedRecords.push({
111
+ route: normalizedRecord,
112
+ parentName,
113
+ source
114
+ });
115
+ if (Array.isArray(record.children) && record.children.length > 0) {
116
+ const nextAncestorRecords = new Set(ancestorRecords);
117
+ nextAncestorRecords.add(record);
118
+ flattenedRecords.push(...flattenNamedRouteRecords(record.children, normalizedPath, routeName, normalizedAliasPaths, source, `${routeConfigPath}.children`, nextAncestorRecords));
119
+ }
120
+ }
121
+ return flattenedRecords;
122
+ }
123
+ function normalizeNamedRouteEntries(namedRoutes, source = "namedRoutes") {
124
+ if (!namedRoutes) return [];
125
+ if (Array.isArray(namedRoutes)) return flattenNamedRouteRecords(namedRoutes, void 0, void 0, [], source, source);
126
+ const normalizedEntries = [];
127
+ for (const [rawName, rawPath] of Object.entries(namedRoutes)) {
128
+ const routeName = typeof rawName === "string" ? rawName.trim() : "";
129
+ if (!routeName) {
130
+ warnRouteConfig(`ignored route record at ${source}: route name is required`);
131
+ continue;
132
+ }
133
+ if (typeof rawPath !== "string" || !rawPath) {
134
+ warnRouteConfig(`ignored route record "${routeName}" at ${source}: route path is required`);
135
+ continue;
136
+ }
137
+ normalizedEntries.push({
138
+ route: {
139
+ name: routeName,
140
+ path: rawPath
141
+ },
142
+ source
143
+ });
144
+ }
145
+ return normalizedEntries;
146
+ }
147
+ function resolveRouteOptionEntries(options) {
148
+ return [...normalizeNamedRouteEntries(options.routes, "routes"), ...normalizeNamedRouteEntries(options.namedRoutes, "namedRoutes")];
149
+ }
150
+ function createNamedRouteNameByStaticPath(recordByName) {
151
+ const nameByStaticPath = /* @__PURE__ */ new Map();
152
+ for (const [name, record] of recordByName.entries()) {
153
+ if (!isDynamicRoutePath(record.path) && !nameByStaticPath.has(record.path)) nameByStaticPath.set(record.path, name);
154
+ for (const aliasPath of record.aliasPaths) if (!isDynamicRoutePath(aliasPath) && !nameByStaticPath.has(aliasPath)) nameByStaticPath.set(aliasPath, name);
155
+ }
156
+ return nameByStaticPath;
157
+ }
158
+ function createNamedRouteLookup(routeEntries) {
159
+ const recordByName = /* @__PURE__ */ new Map();
160
+ for (const routeRecord of routeEntries) {
161
+ const normalizedRecord = normalizeRouteRecordRaw(routeRecord.route, routeRecord.parentName, routeRecord.source);
162
+ if (!normalizedRecord) continue;
163
+ recordByName.set(normalizedRecord.name, normalizedRecord);
164
+ }
165
+ return {
166
+ recordByName,
167
+ nameByStaticPath: createNamedRouteNameByStaticPath(recordByName)
168
+ };
169
+ }
170
+
171
+ //#endregion
172
+ export { createNamedRouteLookup, createNamedRouteNameByStaticPath, createRouteRecordAliasValue, flattenNamedRouteRecords, normalizeRouteRecordRaw, resolveRouteOptionEntries };
173
+ //# sourceMappingURL=records.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"records.mjs","names":[],"sources":["../../../src/routerInternal/records.ts"],"sourcesContent":["import type {\n NamedRoutes,\n NavigationGuard,\n RouteRecordInput,\n RouteRecordRaw,\n UseRouterOptions,\n} from '../router'\nimport type {\n FlattenedRouteRecordSeed,\n NamedRouteLookup,\n RouteOptionSource,\n RouteRecordNormalized,\n} from './types'\nimport { createAbsoluteRoutePath, isDynamicRoutePath, resolvePath } from './path'\nimport { warnRouteConfig } from './recordsWarnings'\n\nfunction normalizeBeforeEnterGuards(beforeEnter?: RouteRecordRaw['beforeEnter']): readonly NavigationGuard[] {\n if (!beforeEnter) {\n return []\n }\n if (Array.isArray(beforeEnter)) {\n return beforeEnter as readonly NavigationGuard[]\n }\n return [beforeEnter as NavigationGuard]\n}\n\nfunction resolveRouteRecordName(\n route: RouteRecordInput,\n normalizedPath: string,\n source: RouteOptionSource = 'namedRoutes',\n): string {\n if (typeof route.name === 'string' && route.name.trim()) {\n return route.name.trim()\n }\n\n if (source === 'routes') {\n return normalizedPath || '/'\n }\n\n return ''\n}\n\nfunction normalizeRouteRecordAliasPaths(\n alias: RouteRecordRaw['alias'],\n normalizedPath: string,\n): readonly string[] {\n if (!alias) {\n return []\n }\n const aliasList = Array.isArray(alias)\n ? alias\n : [alias]\n\n const normalizedAliasPaths: string[] = []\n for (const aliasPath of aliasList) {\n if (typeof aliasPath !== 'string') {\n continue\n }\n const normalizedAliasPath = resolvePath(aliasPath, '')\n if (!normalizedAliasPath || normalizedAliasPath === normalizedPath) {\n continue\n }\n if (!normalizedAliasPaths.includes(normalizedAliasPath)) {\n normalizedAliasPaths.push(normalizedAliasPath)\n }\n }\n\n return normalizedAliasPaths\n}\n\nexport function normalizeRouteRecordRaw(\n route: RouteRecordInput,\n parentName?: string,\n source: RouteOptionSource = 'namedRoutes',\n): RouteRecordNormalized | undefined {\n const normalizedPath = resolvePath(route.path, '')\n if (!normalizedPath && route.path !== '/') {\n return undefined\n }\n\n const routeName = resolveRouteRecordName(route, normalizedPath, source)\n if (!routeName) {\n return undefined\n }\n const aliasPaths = normalizeRouteRecordAliasPaths(route.alias, normalizedPath)\n\n return {\n name: routeName,\n path: normalizedPath,\n aliasPaths,\n parentName,\n meta: route.meta,\n beforeEnterGuards: normalizeBeforeEnterGuards(route.beforeEnter),\n redirect: route.redirect,\n }\n}\n\nfunction normalizeNestedRoutePath(path: string, parentPath?: string): string {\n if (!parentPath || path.startsWith('/')) {\n return resolvePath(path, '')\n }\n return resolvePath(`${createAbsoluteRoutePath(parentPath)}/${path}`, '')\n}\n\nfunction normalizeAliasInputList(alias: RouteRecordRaw['alias']): string[] {\n if (!alias) {\n return []\n }\n if (Array.isArray(alias)) {\n return alias.filter((item): item is string => typeof item === 'string' && item.length > 0)\n }\n return typeof alias === 'string' && alias.length > 0\n ? [alias]\n : []\n}\n\nfunction mergeAliasPaths(aliasPaths: readonly string[]): string[] {\n const mergedAliasPaths: string[] = []\n for (const aliasPath of aliasPaths) {\n if (!aliasPath || mergedAliasPaths.includes(aliasPath)) {\n continue\n }\n mergedAliasPaths.push(aliasPath)\n }\n return mergedAliasPaths\n}\n\nexport function createRouteRecordAliasValue(aliasPaths: readonly string[]): RouteRecordRaw['alias'] {\n if (aliasPaths.length === 0) {\n return undefined\n }\n if (aliasPaths.length === 1) {\n return createAbsoluteRoutePath(aliasPaths[0])\n }\n return aliasPaths.map(aliasPath => createAbsoluteRoutePath(aliasPath))\n}\n\nexport function flattenNamedRouteRecords(\n records: readonly RouteRecordInput[],\n parentPath?: string,\n parentName?: string,\n parentAliasPaths: readonly string[] = [],\n source?: RouteOptionSource,\n pathPrefix = 'namedRoutes',\n ancestorRecords: ReadonlySet<RouteRecordInput> = new Set<RouteRecordInput>(),\n): FlattenedRouteRecordSeed[] {\n const flattenedRecords: FlattenedRouteRecordSeed[] = []\n\n for (const [index, record] of records.entries()) {\n const routeConfigPath = `${pathPrefix}[${index}]`\n if (ancestorRecords.has(record)) {\n warnRouteConfig(`ignored route record at ${routeConfigPath}: detected circular children reference`)\n continue\n }\n\n if (typeof record.path !== 'string' || !record.path) {\n const routeName = typeof record?.name === 'string'\n ? record.name.trim()\n : ''\n warnRouteConfig(`ignored route record \"${routeName}\" at ${routeConfigPath}: route path is required`)\n continue\n }\n\n const normalizedPath = normalizeNestedRoutePath(record.path, parentPath)\n const routeName = resolveRouteRecordName(record, normalizedPath, source)\n if (!routeName) {\n warnRouteConfig(`ignored route record at ${routeConfigPath}: route name is required`)\n continue\n }\n const normalizedDirectAliasPaths: string[] = []\n const directAliasByNormalizedPath = new Map<string, string>()\n for (const rawAliasPath of normalizeAliasInputList(record.alias)) {\n const normalizedAliasPath = normalizeNestedRoutePath(rawAliasPath, parentPath)\n if (!normalizedAliasPath) {\n continue\n }\n if (normalizedAliasPath === normalizedPath) {\n warnRouteConfig(`ignored alias \"${createAbsoluteRoutePath(normalizedAliasPath)}\" for route \"${routeName}\" at ${routeConfigPath}: alias is same as route path`)\n continue\n }\n\n const duplicateAliasPath = directAliasByNormalizedPath.get(normalizedAliasPath)\n if (duplicateAliasPath) {\n warnRouteConfig(\n `ignored duplicate alias \"${createAbsoluteRoutePath(normalizedAliasPath)}\" for route \"${routeName}\" at ${routeConfigPath}: already declared by \"${duplicateAliasPath}\"`,\n )\n continue\n }\n\n directAliasByNormalizedPath.set(normalizedAliasPath, rawAliasPath)\n normalizedDirectAliasPaths.push(normalizedAliasPath)\n }\n const normalizedInheritedAliasPaths = record.path.startsWith('/')\n ? []\n : parentAliasPaths\n .map(parentAliasPath => normalizeNestedRoutePath(record.path, parentAliasPath))\n .filter(Boolean)\n .filter(aliasPath => aliasPath !== normalizedPath)\n const normalizedAliasPaths = mergeAliasPaths([\n ...normalizedDirectAliasPaths,\n ...normalizedInheritedAliasPaths,\n ])\n const normalizedRecord: RouteRecordRaw = {\n name: routeName,\n path: normalizedPath ? createAbsoluteRoutePath(normalizedPath) : '/',\n alias: createRouteRecordAliasValue(normalizedAliasPaths),\n meta: record.meta,\n beforeEnter: record.beforeEnter,\n redirect: record.redirect,\n }\n flattenedRecords.push({\n route: normalizedRecord,\n parentName,\n source,\n })\n\n if (Array.isArray(record.children) && record.children.length > 0) {\n const nextAncestorRecords = new Set(ancestorRecords)\n nextAncestorRecords.add(record)\n flattenedRecords.push(\n ...flattenNamedRouteRecords(\n record.children,\n normalizedPath,\n routeName,\n normalizedAliasPaths,\n source,\n `${routeConfigPath}.children`,\n nextAncestorRecords,\n ),\n )\n }\n }\n\n return flattenedRecords\n}\n\nfunction normalizeNamedRouteEntries(\n namedRoutes?: NamedRoutes | readonly RouteRecordInput[],\n source: RouteOptionSource = 'namedRoutes',\n): FlattenedRouteRecordSeed[] {\n if (!namedRoutes) {\n return []\n }\n\n if (Array.isArray(namedRoutes)) {\n return flattenNamedRouteRecords(namedRoutes, undefined, undefined, [], source, source)\n }\n\n const normalizedEntries: FlattenedRouteRecordSeed[] = []\n for (const [rawName, rawPath] of Object.entries(namedRoutes)) {\n const routeName = typeof rawName === 'string'\n ? rawName.trim()\n : ''\n if (!routeName) {\n warnRouteConfig(`ignored route record at ${source}: route name is required`)\n continue\n }\n if (typeof rawPath !== 'string' || !rawPath) {\n warnRouteConfig(`ignored route record \"${routeName}\" at ${source}: route path is required`)\n continue\n }\n normalizedEntries.push({\n route: {\n name: routeName,\n path: rawPath,\n },\n source,\n })\n }\n\n return normalizedEntries\n}\n\nexport function resolveRouteOptionEntries(options: UseRouterOptions): FlattenedRouteRecordSeed[] {\n return [\n ...normalizeNamedRouteEntries(options.routes, 'routes'),\n ...normalizeNamedRouteEntries(options.namedRoutes, 'namedRoutes'),\n ]\n}\n\nexport function createNamedRouteNameByStaticPath(recordByName: ReadonlyMap<string, RouteRecordNormalized>): Map<string, string> {\n const nameByStaticPath = new Map<string, string>()\n for (const [name, record] of recordByName.entries()) {\n if (!isDynamicRoutePath(record.path) && !nameByStaticPath.has(record.path)) {\n nameByStaticPath.set(record.path, name)\n }\n for (const aliasPath of record.aliasPaths) {\n if (!isDynamicRoutePath(aliasPath) && !nameByStaticPath.has(aliasPath)) {\n nameByStaticPath.set(aliasPath, name)\n }\n }\n }\n return nameByStaticPath\n}\n\nexport function createNamedRouteLookup(routeEntries: readonly FlattenedRouteRecordSeed[]): NamedRouteLookup {\n const recordByName = new Map<string, RouteRecordNormalized>()\n\n for (const routeRecord of routeEntries) {\n const normalizedRecord = normalizeRouteRecordRaw(\n routeRecord.route,\n routeRecord.parentName,\n routeRecord.source,\n )\n if (!normalizedRecord) {\n continue\n }\n recordByName.set(normalizedRecord.name, normalizedRecord)\n }\n\n return {\n recordByName,\n nameByStaticPath: createNamedRouteNameByStaticPath(recordByName),\n }\n}\n"],"mappings":";;;;AAgBA,SAAS,2BAA2B,aAAyE;CAC3G,IAAI,CAAC,aACH,OAAO,CAAC;CAEV,IAAI,MAAM,QAAQ,WAAW,GAC3B,OAAO;CAET,OAAO,CAAC,WAA8B;AACxC;AAEA,SAAS,uBACP,OACA,gBACA,SAA4B,eACpB;CACR,IAAI,OAAO,MAAM,SAAS,YAAY,MAAM,KAAK,KAAK,GACpD,OAAO,MAAM,KAAK,KAAK;CAGzB,IAAI,WAAW,UACb,OAAO,kBAAkB;CAG3B,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arnings.ts
4
+ function warnRouteConfig(message) {
5
+ if (typeof console === "undefined" || typeof console.warn !== "function") return;
6
+ console.warn(`[wevu/router] ${message}`);
7
+ }
8
+ function formatRoutePathForWarning(path) {
9
+ const normalizedPath = resolvePath(path, "");
10
+ if (!normalizedPath) return "/";
11
+ return createAbsoluteRoutePath(normalizedPath);
12
+ }
13
+ function hasCircularChildrenReference(routeRecord, ancestorRecords = /* @__PURE__ */ new Set()) {
14
+ if (ancestorRecords.has(routeRecord)) return true;
15
+ if (!Array.isArray(routeRecord.children) || routeRecord.children.length === 0) return false;
16
+ const nextAncestorRecords = new Set(ancestorRecords);
17
+ nextAncestorRecords.add(routeRecord);
18
+ for (const childRecord of routeRecord.children) if (hasCircularChildrenReference(childRecord, nextAncestorRecords)) return true;
19
+ return false;
20
+ }
21
+ function assertValidAddRouteInput(routeRecord) {
22
+ const routeName = typeof routeRecord.name === "string" ? routeRecord.name.trim() : "";
23
+ if (!routeName) throw new Error("Route name is required when adding a named route");
24
+ if (typeof routeRecord.path !== "string" || !routeRecord.path) throw new Error(`Route path is required when adding named route "${routeName}"`);
25
+ if (hasCircularChildrenReference(routeRecord)) throw new Error(`Circular children reference detected when adding named route "${routeName}"`);
26
+ }
27
+ function warnDuplicateRouteEntries(routeEntries) {
28
+ const latestRouteInfoByName = /* @__PURE__ */ new Map();
29
+ const duplicateMessages = [];
30
+ for (const routeEntry of routeEntries) {
31
+ var _routeEntry$source;
32
+ const routeName = typeof routeEntry.route.name === "string" ? routeEntry.route.name.trim() : "";
33
+ if (!routeName) continue;
34
+ const currentSource = (_routeEntry$source = routeEntry.source) !== null && _routeEntry$source !== void 0 ? _routeEntry$source : "namedRoutes";
35
+ const currentPath = formatRoutePathForWarning(routeEntry.route.path);
36
+ const previousInfo = latestRouteInfoByName.get(routeName);
37
+ if (previousInfo) duplicateMessages.push(`"${routeName}" (${previousInfo.source}:${previousInfo.path} -> ${currentSource}:${currentPath})`);
38
+ latestRouteInfoByName.set(routeName, {
39
+ source: currentSource,
40
+ path: currentPath
41
+ });
42
+ }
43
+ if (duplicateMessages.length === 0) return;
44
+ warnRouteConfig(`duplicate route names detected, later entries override earlier ones: ${duplicateMessages.join(", ")}`);
45
+ }
46
+
47
+ //#endregion
48
+ export { assertValidAddRouteInput, warnDuplicateRouteEntries, warnRouteConfig };
49
+ //# sourceMappingURL=recordsWarnings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordsWarnings.mjs","names":[],"sources":["../../../src/routerInternal/recordsWarnings.ts"],"sourcesContent":["import type { RouteRecordRaw } from '../router'\nimport type { FlattenedRouteRecordSeed, RouteOptionSource } from './types'\nimport { createAbsoluteRoutePath, resolvePath } from './path'\n\nexport function warnRouteConfig(message: string): void {\n // eslint-disable-next-line no-console\n if (typeof console === 'undefined' || typeof console.warn !== 'function') {\n return\n }\n // eslint-disable-next-line no-console\n console.warn(`[wevu/router] ${message}`)\n}\n\nfunction formatRoutePathForWarning(path: string): string {\n const normalizedPath = resolvePath(path, '')\n if (!normalizedPath) {\n return '/'\n }\n return createAbsoluteRoutePath(normalizedPath)\n}\n\nfunction hasCircularChildrenReference(\n routeRecord: RouteRecordRaw,\n ancestorRecords: ReadonlySet<RouteRecordRaw> = new Set<RouteRecordRaw>(),\n): boolean {\n if (ancestorRecords.has(routeRecord)) {\n return true\n }\n\n if (!Array.isArray(routeRecord.children) || routeRecord.children.length === 0) {\n return false\n }\n\n const nextAncestorRecords = new Set(ancestorRecords)\n nextAncestorRecords.add(routeRecord)\n for (const childRecord of routeRecord.children) {\n if (hasCircularChildrenReference(childRecord, nextAncestorRecords)) {\n return true\n }\n }\n\n return false\n}\n\nexport function assertValidAddRouteInput(routeRecord: RouteRecordRaw): void {\n const routeName = typeof routeRecord.name === 'string'\n ? routeRecord.name.trim()\n : ''\n if (!routeName) {\n throw new Error('Route name is required when adding a named route')\n }\n if (typeof routeRecord.path !== 'string' || !routeRecord.path) {\n throw new Error(`Route path is required when adding named route \"${routeName}\"`)\n }\n if (hasCircularChildrenReference(routeRecord)) {\n throw new Error(`Circular children reference detected when adding named route \"${routeName}\"`)\n }\n}\n\nexport function warnDuplicateRouteEntries(routeEntries: readonly FlattenedRouteRecordSeed[]): void {\n const latestRouteInfoByName = new Map<string, { source: RouteOptionSource, path: string }>()\n const duplicateMessages: string[] = []\n\n for (const routeEntry of routeEntries) {\n const routeName = typeof routeEntry.route.name === 'string'\n ? routeEntry.route.name.trim()\n : ''\n if (!routeName) {\n continue\n }\n\n const currentSource = routeEntry.source ?? 'namedRoutes'\n const currentPath = formatRoutePathForWarning(routeEntry.route.path)\n const previousInfo = latestRouteInfoByName.get(routeName)\n if (previousInfo) {\n duplicateMessages.push(`\"${routeName}\" (${previousInfo.source}:${previousInfo.path} -> ${currentSource}:${currentPath})`)\n }\n latestRouteInfoByName.set(routeName, {\n source: currentSource,\n path: currentPath,\n })\n }\n\n if (duplicateMessages.length === 0) {\n return\n }\n\n warnRouteConfig(`duplicate route names detected, later entries override earlier ones: ${duplicateMessages.join(', ')}`)\n}\n"],"mappings":";;;AAIA,SAAgB,gBAAgB,SAAuB;CAErD,IAAI,OAAO,YAAY,eAAe,OAAO,QAAQ,SAAS,YAC5D;CAGF,QAAQ,KAAK,iBAAiB,SAAS;AACzC;AAEA,SAAS,0BAA0B,MAAsB;CACvD,MAAM,iBAAiB,YAAY,MAAM,EAAE;CAC3C,IAAI,CAAC,gBACH,OAAO;CAET,OAAO,wBAAwB,cAAc;AAC/C;AAEA,SAAS,6BACP,aACA,kCAA+C,IAAI,IAAoB,GAC9D;CACT,IAAI,gBAAgB,IAAI,WAAW,GACjC,OAAO;CAGT,IAAI,CAAC,MAAM,QAAQ,YAAY,QAAQ,KAAK,YAAY,SAAS,WAAW,GAC1E,OAAO;CAGT,MAAM,sBAAsB,IAAI,IAAI,eAAe;CACnD,oBAAoB,IAAI,WAAW;CACnC,KAAK,MAAM,eAAe,YAAY,UACpC,IAAI,6BAA6B,aAAa,mBAAmB,GAC/D,OAAO;CAIX,OAAO;AACT;AAEA,SAAgB,yBAAyB,aAAmC;CAC1E,MAAM,YAAY,OAAO,YAAY,SAAS,WAC1C,YAAY,KAAK,KAAK,IACtB;CACJ,IAAI,CAAC,WACH,MAAM,IAAI,MAAM,kDAAkD;CAEpE,IAAI,OAAO,YAAY,SAAS,YAAY,CAAC,YAAY,MACvD,MAAM,IAAI,MAAM,mDAAmD,UAAU,EAAE;CAEjF,IAAI,6BAA6B,WAAW,GAC1C,MAAM,IAAI,MAAM,iEAAiE,UAAU,EAAE;AAEjG;AAEA,SAAgB,0BAA0B,cAAyD;CACjG,MAAM,wCAAwB,IAAI,IAAyD;CAC3F,MAAM,oBAA8B,CAAC;CAErC,KAAK,MAAM,cAAc,cAAc;;EACrC,MAAM,YAAY,OAAO,WAAW,MAAM,SAAS,WAC/C,WAAW,MAAM,KAAK,KAAK,IAC3B;EACJ,IAAI,CAAC,WACH;EAGF,MAAM,sCAAgB,WAAW,yEAAU;EAC3C,MAAM,cAAc,0BAA0B,WAAW,MAAM,IAAI;EACnE,MAAM,eAAe,sBAAsB,IAAI,SAAS;EACxD,IAAI,cACF,kBAAkB,KAAK,IAAI,UAAU,KAAK,aAAa,OAAO,GAAG,aAAa,KAAK,MAAM,cAAc,GAAG,YAAY,EAAE;EAE1H,sBAAsB,IAAI,WAAW;GACnC,QAAQ;GACR,MAAM;EACR,CAAC;CACH;CAEA,IAAI,kBAAkB,WAAW,GAC/B;CAGF,gBAAgB,wEAAwE,kBAAkB,KAAK,IAAI,GAAG;AACxH"}
@@ -0,0 +1,126 @@
1
+ import { createAbsoluteRoutePath, resolvePath } from "./path.mjs";
2
+ import { stringifyQuery } from "./query.mjs";
3
+
4
+ //#region src/routerInternal/snapshots.ts
5
+ function cloneRouteMeta(meta) {
6
+ if (!meta) return;
7
+ return { ...meta };
8
+ }
9
+ function freezeRouteRecordRawSnapshot(routeRecord) {
10
+ const snapshot = {
11
+ name: routeRecord.name,
12
+ path: routeRecord.path
13
+ };
14
+ if (routeRecord.meta !== void 0) snapshot.meta = cloneRouteMeta(routeRecord.meta);
15
+ if (Array.isArray(routeRecord.alias)) snapshot.alias = Object.freeze(routeRecord.alias.slice());
16
+ else if (routeRecord.alias !== void 0) snapshot.alias = routeRecord.alias;
17
+ if (Array.isArray(routeRecord.beforeEnter)) snapshot.beforeEnter = Object.freeze(routeRecord.beforeEnter.slice());
18
+ else if (routeRecord.beforeEnter !== void 0) snapshot.beforeEnter = routeRecord.beforeEnter;
19
+ if (routeRecord.redirect !== void 0) snapshot.redirect = routeRecord.redirect;
20
+ return Object.freeze(snapshot);
21
+ }
22
+ function createRouterOptionsSnapshot(normalizedTabBarEntries, normalizedNamedRoutes, paramsMode, maxRedirects, routeResolveCodec, rejectOnError) {
23
+ const tabBarEntriesSnapshot = Object.freeze(normalizedTabBarEntries.map((path) => createAbsoluteRoutePath(path)));
24
+ const routesSnapshot = Object.freeze(normalizedNamedRoutes.map(freezeRouteRecordRawSnapshot));
25
+ return Object.freeze({
26
+ tabBarEntries: tabBarEntriesSnapshot,
27
+ routes: routesSnapshot,
28
+ namedRoutes: routesSnapshot,
29
+ paramsMode,
30
+ maxRedirects,
31
+ parseQuery: routeResolveCodec.parseQuery,
32
+ stringifyQuery: routeResolveCodec.stringifyQuery,
33
+ rejectOnError
34
+ });
35
+ }
36
+ function normalizeRouteRecordMatched(record, matchedPath) {
37
+ const matchedRecord = {
38
+ name: record.name,
39
+ path: createAbsoluteRoutePath(record.path)
40
+ };
41
+ const normalizedMatchedPath = typeof matchedPath === "string" && matchedPath ? createAbsoluteRoutePath(resolvePath(matchedPath, "")) : void 0;
42
+ if (normalizedMatchedPath && normalizedMatchedPath !== matchedRecord.path) matchedRecord.aliasPath = normalizedMatchedPath;
43
+ if (record.meta !== void 0) matchedRecord.meta = cloneRouteMeta(record.meta);
44
+ return matchedRecord;
45
+ }
46
+ function cloneRouteRecordMatchedList(matched) {
47
+ if (!matched) return;
48
+ return matched.map((record) => ({
49
+ name: record.name,
50
+ path: record.path,
51
+ aliasPath: record.aliasPath,
52
+ meta: cloneRouteMeta(record.meta)
53
+ }));
54
+ }
55
+ function cloneLocationQuery(query) {
56
+ const cloned = {};
57
+ for (const key of Object.keys(query)) {
58
+ const value = query[key];
59
+ cloned[key] = Array.isArray(value) ? value.slice() : value;
60
+ }
61
+ return cloned;
62
+ }
63
+ function cloneRouteParams(params) {
64
+ const cloned = {};
65
+ for (const key of Object.keys(params)) {
66
+ const value = params[key];
67
+ cloned[key] = Array.isArray(value) ? value.slice() : value;
68
+ }
69
+ return cloned;
70
+ }
71
+ function cloneRouteLocationRedirectedFrom(redirectedFrom) {
72
+ if (!redirectedFrom) return;
73
+ const cloned = {
74
+ path: redirectedFrom.path,
75
+ fullPath: redirectedFrom.fullPath,
76
+ query: cloneLocationQuery(redirectedFrom.query),
77
+ hash: redirectedFrom.hash,
78
+ params: cloneRouteParams(redirectedFrom.params)
79
+ };
80
+ if (redirectedFrom.name !== void 0) cloned.name = redirectedFrom.name;
81
+ if (redirectedFrom.meta !== void 0) cloned.meta = cloneRouteMeta(redirectedFrom.meta);
82
+ if (redirectedFrom.href !== void 0) cloned.href = redirectedFrom.href;
83
+ if (redirectedFrom.matched !== void 0) cloned.matched = cloneRouteRecordMatchedList(redirectedFrom.matched);
84
+ return cloned;
85
+ }
86
+ function createRedirectedFromSnapshot(route) {
87
+ const snapshot = {
88
+ path: route.path,
89
+ fullPath: route.fullPath,
90
+ query: cloneLocationQuery(route.query),
91
+ hash: route.hash,
92
+ params: cloneRouteParams(route.params)
93
+ };
94
+ if (route.name !== void 0) snapshot.name = route.name;
95
+ if (route.meta !== void 0) snapshot.meta = cloneRouteMeta(route.meta);
96
+ if (route.href !== void 0) snapshot.href = route.href;
97
+ if (route.matched !== void 0) snapshot.matched = cloneRouteRecordMatchedList(route.matched);
98
+ return snapshot;
99
+ }
100
+ function snapshotRouteLocation(route) {
101
+ const snapshot = {
102
+ path: route.path,
103
+ fullPath: route.fullPath,
104
+ query: cloneLocationQuery(route.query),
105
+ hash: route.hash,
106
+ params: cloneRouteParams(route.params)
107
+ };
108
+ if (route.meta !== void 0) snapshot.meta = cloneRouteMeta(route.meta);
109
+ if (route.href !== void 0) snapshot.href = route.href;
110
+ if (route.matched !== void 0) snapshot.matched = cloneRouteRecordMatchedList(route.matched);
111
+ if (route.redirectedFrom !== void 0) snapshot.redirectedFrom = cloneRouteLocationRedirectedFrom(route.redirectedFrom);
112
+ if (route.name !== void 0) snapshot.name = route.name;
113
+ return snapshot;
114
+ }
115
+ function createNativeRouteUrl(target, queryStringifier = stringifyQuery) {
116
+ const basePath = createAbsoluteRoutePath(target.path);
117
+ const queryString = queryStringifier(target.query);
118
+ return queryString ? `${basePath}?${queryString}` : basePath;
119
+ }
120
+ function hasLocationQuery(query) {
121
+ return Object.keys(query).length > 0;
122
+ }
123
+
124
+ //#endregion
125
+ export { cloneLocationQuery, cloneRouteLocationRedirectedFrom, cloneRouteMeta, cloneRouteParams, cloneRouteRecordMatchedList, createNativeRouteUrl, createRedirectedFromSnapshot, createRouterOptionsSnapshot, hasLocationQuery, normalizeRouteRecordMatched, snapshotRouteLocation };
126
+ //# sourceMappingURL=snapshots.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshots.mjs","names":[],"sources":["../../../src/routerInternal/snapshots.ts"],"sourcesContent":["import type {\n LocationQuery,\n RouteLocationNormalizedLoaded,\n RouteLocationRedirectedFrom,\n RouteMeta,\n RouteParams,\n RouteParamsMode,\n RouteQueryStringifier,\n RouteRecordMatched,\n RouteRecordRaw,\n UseRouterOptions,\n} from '../router'\nimport type { RouteRecordNormalized, RouteResolveCodec } from './types'\nimport { createAbsoluteRoutePath, resolvePath } from './path'\nimport { stringifyQuery } from './query'\n\nexport function cloneRouteMeta(meta?: RouteMeta): RouteMeta | undefined {\n if (!meta) {\n return undefined\n }\n return {\n ...meta,\n }\n}\n\nfunction freezeRouteRecordRawSnapshot(routeRecord: RouteRecordRaw): Readonly<RouteRecordRaw> {\n const snapshot: RouteRecordRaw = {\n name: routeRecord.name,\n path: routeRecord.path,\n }\n\n if (routeRecord.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(routeRecord.meta)\n }\n if (Array.isArray(routeRecord.alias)) {\n snapshot.alias = Object.freeze(routeRecord.alias.slice())\n }\n else if (routeRecord.alias !== undefined) {\n snapshot.alias = routeRecord.alias\n }\n if (Array.isArray(routeRecord.beforeEnter)) {\n snapshot.beforeEnter = Object.freeze(routeRecord.beforeEnter.slice())\n }\n else if (routeRecord.beforeEnter !== undefined) {\n snapshot.beforeEnter = routeRecord.beforeEnter\n }\n if (routeRecord.redirect !== undefined) {\n snapshot.redirect = routeRecord.redirect\n }\n\n return Object.freeze(snapshot)\n}\n\nexport function createRouterOptionsSnapshot(\n normalizedTabBarEntries: readonly string[],\n normalizedNamedRoutes: readonly RouteRecordRaw[],\n paramsMode: RouteParamsMode,\n maxRedirects: number,\n routeResolveCodec: RouteResolveCodec,\n rejectOnError: boolean,\n): Readonly<UseRouterOptions> {\n const tabBarEntriesSnapshot = Object.freeze(\n normalizedTabBarEntries.map(path => createAbsoluteRoutePath(path)),\n )\n const routesSnapshot = Object.freeze(\n normalizedNamedRoutes.map(freezeRouteRecordRawSnapshot),\n ) as readonly RouteRecordRaw[]\n\n return Object.freeze({\n tabBarEntries: tabBarEntriesSnapshot,\n routes: routesSnapshot,\n namedRoutes: routesSnapshot,\n paramsMode,\n maxRedirects,\n parseQuery: routeResolveCodec.parseQuery,\n stringifyQuery: routeResolveCodec.stringifyQuery,\n rejectOnError,\n })\n}\n\nexport function normalizeRouteRecordMatched(\n record: RouteRecordNormalized,\n matchedPath?: string,\n): RouteRecordMatched {\n const matchedRecord: RouteRecordMatched = {\n name: record.name,\n path: createAbsoluteRoutePath(record.path),\n }\n const normalizedMatchedPath = typeof matchedPath === 'string' && matchedPath\n ? createAbsoluteRoutePath(resolvePath(matchedPath, ''))\n : undefined\n if (normalizedMatchedPath && normalizedMatchedPath !== matchedRecord.path) {\n matchedRecord.aliasPath = normalizedMatchedPath\n }\n if (record.meta !== undefined) {\n matchedRecord.meta = cloneRouteMeta(record.meta)\n }\n return matchedRecord\n}\n\nexport function cloneRouteRecordMatchedList(matched?: readonly RouteRecordMatched[]): RouteRecordMatched[] | undefined {\n if (!matched) {\n return undefined\n }\n return matched.map(record => ({\n name: record.name,\n path: record.path,\n aliasPath: record.aliasPath,\n meta: cloneRouteMeta(record.meta),\n }))\n}\n\nexport function cloneLocationQuery(query: LocationQuery): LocationQuery {\n const cloned: LocationQuery = {}\n for (const key of Object.keys(query)) {\n const value = query[key]\n cloned[key] = Array.isArray(value) ? value.slice() : value\n }\n return cloned\n}\n\nexport function cloneRouteParams(params: RouteParams): RouteParams {\n const cloned: RouteParams = {}\n for (const key of Object.keys(params)) {\n const value = params[key]\n cloned[key] = Array.isArray(value) ? value.slice() : value\n }\n return cloned\n}\n\nexport function cloneRouteLocationRedirectedFrom(\n redirectedFrom?: RouteLocationRedirectedFrom,\n): RouteLocationRedirectedFrom | undefined {\n if (!redirectedFrom) {\n return undefined\n }\n\n const cloned: RouteLocationRedirectedFrom = {\n path: redirectedFrom.path,\n fullPath: redirectedFrom.fullPath,\n query: cloneLocationQuery(redirectedFrom.query),\n hash: redirectedFrom.hash,\n params: cloneRouteParams(redirectedFrom.params),\n }\n if (redirectedFrom.name !== undefined) {\n cloned.name = redirectedFrom.name\n }\n if (redirectedFrom.meta !== undefined) {\n cloned.meta = cloneRouteMeta(redirectedFrom.meta)\n }\n if (redirectedFrom.href !== undefined) {\n cloned.href = redirectedFrom.href\n }\n if (redirectedFrom.matched !== undefined) {\n cloned.matched = cloneRouteRecordMatchedList(redirectedFrom.matched)\n }\n return cloned\n}\n\nexport function createRedirectedFromSnapshot(route: RouteLocationNormalizedLoaded): RouteLocationRedirectedFrom {\n const snapshot: RouteLocationRedirectedFrom = {\n path: route.path,\n fullPath: route.fullPath,\n query: cloneLocationQuery(route.query),\n hash: route.hash,\n params: cloneRouteParams(route.params),\n }\n if (route.name !== undefined) {\n snapshot.name = route.name\n }\n if (route.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(route.meta)\n }\n if (route.href !== undefined) {\n snapshot.href = route.href\n }\n if (route.matched !== undefined) {\n snapshot.matched = cloneRouteRecordMatchedList(route.matched)\n }\n return snapshot\n}\n\nexport function snapshotRouteLocation(route: RouteLocationNormalizedLoaded): RouteLocationNormalizedLoaded {\n const snapshot: RouteLocationNormalizedLoaded = {\n path: route.path,\n fullPath: route.fullPath,\n query: cloneLocationQuery(route.query),\n hash: route.hash,\n params: cloneRouteParams(route.params),\n }\n if (route.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(route.meta)\n }\n if (route.href !== undefined) {\n snapshot.href = route.href\n }\n if (route.matched !== undefined) {\n snapshot.matched = cloneRouteRecordMatchedList(route.matched)\n }\n if (route.redirectedFrom !== undefined) {\n snapshot.redirectedFrom = cloneRouteLocationRedirectedFrom(route.redirectedFrom)\n }\n if (route.name !== undefined) {\n snapshot.name = route.name\n }\n return snapshot\n}\n\nexport function createNativeRouteUrl(\n target: RouteLocationNormalizedLoaded,\n queryStringifier: RouteQueryStringifier = stringifyQuery,\n): string {\n const basePath = createAbsoluteRoutePath(target.path)\n const queryString = queryStringifier(target.query)\n return queryString ? `${basePath}?${queryString}` : basePath\n}\n\nexport function hasLocationQuery(query: LocationQuery): boolean {\n return Object.keys(query).length > 0\n}\n"],"mappings":";;;;AAgBA,SAAgB,eAAe,MAAyC;CACtE,IAAI,CAAC,MACH;CAEF,OAAO,EACL,GAAG,KACL;AACF;AAEA,SAAS,6BAA6B,aAAuD;CAC3F,MAAM,WAA2B;EAC/B,MAAM,YAAY;EAClB,MAAM,YAAY;CACpB;CAEA,IAAI,YAAY,SAAS,QACvB,SAAS,OAAO,eAAe,YAAY,IAAI;CAEjD,IAAI,MAAM,QAAQ,YAAY,KAAK,GACjC,SAAS,QAAQ,OAAO,OAAO,YAAY,MAAM,MAAM,CAAC;MAErD,IAAI,YAAY,UAAU,QAC7B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AAO,mBAAmB,MAAM,KAAK;EACrC,MAAM,MAAM;EACZ,QAAQ,iBAAiB,MAAM,MAAM;CACvC;CACA,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,eAAe,MAAM,IAAI;CAE3C,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,IAAI,MAAM,YAAY,QACpB,SAAS,UAAU,4BAA4B,MAAM,OAAO;CAE9D,IAAI,MAAM,mBAAmB,QAC3B,SAAS,iBAAiB,iCAAiC,MAAM,cAAc;CAEjF,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,OAAO;AACT;AAEA,SAAgB,qBACd,QACA,mBAA0C,gBAClC;CACR,MAAM,WAAW,wBAAwB,OAAO,IAAI;CACpD,MAAM,cAAc,iBAAiB,OAAO,KAAK;CACjD,OAAO,cAAc,GAAG,SAAS,GAAG,gBAAgB;AACtD;AAEA,SAAgB,iBAAiB,OAA+B;CAC9D,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS;AACrC"}
@@ -0,0 +1,68 @@
1
+ import { effect, track, trigger } from "../../reactivity/core.mjs";
2
+ import { markAsRef } from "../../reactivity/ref.mjs";
3
+
4
+ //#region src/runtime/app/computed.ts
5
+ function createComputedAccessors(options) {
6
+ const computedRefs = Object.create(null);
7
+ const computedSetters = Object.create(null);
8
+ const dirtyComputedKeys = /* @__PURE__ */ new Set();
9
+ const createTrackedComputed = (key, getter, setter) => {
10
+ let value;
11
+ let dirty = true;
12
+ let runner;
13
+ const obj = {
14
+ get value() {
15
+ if (dirty) {
16
+ value = runner();
17
+ dirty = false;
18
+ }
19
+ track(obj, "value");
20
+ return value;
21
+ },
22
+ set value(nextValue) {
23
+ if (!setter) throw new Error("计算属性是只读的");
24
+ setter(nextValue);
25
+ }
26
+ };
27
+ markAsRef(obj);
28
+ runner = effect(getter, {
29
+ lazy: true,
30
+ scheduler: () => {
31
+ if (!dirty) {
32
+ dirty = true;
33
+ if (options.setDataStrategy === "patch" && options.includeComputed) dirtyComputedKeys.add(key);
34
+ trigger(obj, "value");
35
+ }
36
+ }
37
+ });
38
+ return obj;
39
+ };
40
+ return {
41
+ computedRefs,
42
+ computedSetters,
43
+ dirtyComputedKeys,
44
+ createTrackedComputed,
45
+ computedProxy: new Proxy({}, {
46
+ get(_target, key) {
47
+ if (typeof key === "string" && computedRefs[key]) return computedRefs[key].value;
48
+ },
49
+ has(_target, key) {
50
+ return typeof key === "string" && Boolean(computedRefs[key]);
51
+ },
52
+ ownKeys() {
53
+ return Object.keys(computedRefs);
54
+ },
55
+ getOwnPropertyDescriptor(_target, key) {
56
+ if (typeof key === "string" && computedRefs[key]) return {
57
+ configurable: true,
58
+ enumerable: true,
59
+ value: computedRefs[key].value
60
+ };
61
+ }
62
+ })
63
+ };
64
+ }
65
+
66
+ //#endregion
67
+ export { createComputedAccessors };
68
+ //# sourceMappingURL=computed.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computed.mjs","names":[],"sources":["../../../../src/runtime/app/computed.ts"],"sourcesContent":["import type { ComputedRef } from '../../reactivity'\nimport { effect } from '../../reactivity'\nimport { track, trigger } from '../../reactivity/core'\nimport { markAsRef } from '../../reactivity/ref'\n\ninterface ComputedOptions {\n includeComputed: boolean\n setDataStrategy: 'diff' | 'patch'\n}\n\nexport function createComputedAccessors(options: ComputedOptions) {\n const computedRefs: Record<string, ComputedRef<any>> = Object.create(null)\n const computedSetters: Record<string, (value: any) => void> = Object.create(null)\n const dirtyComputedKeys = new Set<string>()\n\n const createTrackedComputed = <T>(\n key: string,\n getter: () => T,\n setter?: (value: T) => void,\n ): ComputedRef<T> => {\n let value: T\n let dirty = true\n let runner!: () => T\n const obj: any = {\n get value() {\n if (dirty) {\n value = runner()\n dirty = false\n }\n track(obj, 'value')\n return value\n },\n set value(nextValue: T) {\n if (!setter) {\n throw new Error('计算属性是只读的')\n }\n setter(nextValue)\n },\n }\n markAsRef(obj)\n runner = effect(getter, {\n lazy: true,\n scheduler: () => {\n if (!dirty) {\n dirty = true\n if (options.setDataStrategy === 'patch' && options.includeComputed) {\n dirtyComputedKeys.add(key)\n }\n trigger(obj, 'value')\n }\n },\n })\n return obj as ComputedRef<T>\n }\n\n const computedProxy = new Proxy(\n {},\n {\n get(_target, key: string | symbol) {\n if (typeof key === 'string' && computedRefs[key]) {\n return computedRefs[key].value\n }\n return undefined\n },\n has(_target, key: string | symbol) {\n return typeof key === 'string' && Boolean(computedRefs[key])\n },\n ownKeys() {\n return Object.keys(computedRefs)\n },\n getOwnPropertyDescriptor(_target, key: string | symbol) {\n if (typeof key === 'string' && computedRefs[key]) {\n return {\n configurable: true,\n enumerable: true,\n value: computedRefs[key].value,\n }\n }\n return undefined\n },\n },\n )\n\n return {\n computedRefs,\n computedSetters,\n dirtyComputedKeys,\n createTrackedComputed,\n computedProxy,\n }\n}\n"],"mappings":";;;;AAUA,SAAgB,wBAAwB,SAA0B;CAChE,MAAM,eAAiD,OAAO,OAAO,IAAI;CACzE,MAAM,kBAAwD,OAAO,OAAO,IAAI;CAChF,MAAM,oCAAoB,IAAI,IAAY;CAE1C,MAAM,yBACJ,KACA,QACA,WACmB;EACnB,IAAI;EACJ,IAAI,QAAQ;EACZ,IAAI;EACJ,MAAM,MAAW;GACf,IAAI,QAAQ;IACV,IAAI,OAAO;KACT,QAAQ,OAAO;KACf,QAAQ;IACV;IACA,MAAM,KAAK,OAAO;IAClB,OAAO;GACT;GACA,IAAI,MAAM,WAAc;IACtB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,UAAU;IAE5B,OAAO,SAAS;GAClB;EACF;EACA,UAAU,GAAG;EACb,SAAS,OAAO,QAAQ;GACtB,MAAM;GACN,iBAAiB;IACf,IAAI,CAAC,OAAO;KACV,QAAQ;KACR,IAAI,QAAQ,oBAAoB,WAAW,QAAQ,iBACjD,kBAAkB,IAAI,GAAG;KAE3B,QAAQ,KAAK,OAAO;IACtB;GACF;EACF,CAAC;EACD,OAAO;CACT;CA8BA,OAAO;EACL;EACA;EACA;EACA;EACA,mBAjCwB,MACxB,CAAC,GACD;GACE,IAAI,SAAS,KAAsB;IACjC,IAAI,OAAO,QAAQ,YAAY,aAAa,MAC1C,OAAO,aAAa,IAAI,CAAC;GAG7B;GACA,IAAI,SAAS,KAAsB;IACjC,OAAO,OAAO,QAAQ,YAAY,QAAQ,aAAa,IAAI;GAC7D;GACA,UAAU;IACR,OAAO,OAAO,KAAK,YAAY;GACjC;GACA,yBAAyB,SAAS,KAAsB;IACtD,IAAI,OAAO,QAAQ,YAAY,aAAa,MAC1C,OAAO;KACL,cAAc;KACd,YAAY;KACZ,OAAO,aAAa,IAAI,CAAC;IAC3B;GAGJ;EACF,CAQY;CACd;AACF"}