wevu 7.2.2 → 7.4.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 (383) hide show
  1. package/README.md +6 -0
  2. package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.mjs +1 -1
  3. package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.mjs +1 -1
  4. package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.mjs +1 -1
  5. package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.mjs +1 -1
  6. package/dist/dev/internal-runtime.d.mts +2 -1
  7. package/dist/dev/internal-runtime.mjs +3 -2
  8. package/dist/dev/package.mjs +1 -1
  9. package/dist/dev/reactivity/asyncDerivation.mjs +8 -10
  10. package/dist/dev/reactivity/asyncDerivation.mjs.map +1 -1
  11. package/dist/dev/reactivity/core.mjs +5 -8
  12. package/dist/dev/reactivity/core.mjs.map +1 -1
  13. package/dist/dev/reactivity/reactive/patch.mjs +3 -3
  14. package/dist/dev/reactivity/reactive/patch.mjs.map +1 -1
  15. package/dist/dev/reactivity/reactive/patchState.mjs +4 -8
  16. package/dist/dev/reactivity/reactive/patchState.mjs.map +1 -1
  17. package/dist/dev/reactivity/reactive/shared.mjs +1 -2
  18. package/dist/dev/reactivity/reactive/shared.mjs.map +1 -1
  19. package/dist/dev/reactivity/reactive.mjs +5 -10
  20. package/dist/dev/reactivity/reactive.mjs.map +1 -1
  21. package/dist/dev/reactivity/ref.mjs +2 -2
  22. package/dist/dev/reactivity/ref.mjs.map +1 -1
  23. package/dist/dev/reactivity/shallowRef.mjs +1 -1
  24. package/dist/dev/reactivity/shallowRef.mjs.map +1 -1
  25. package/dist/dev/reactivity/watch/helpers.mjs +1 -1
  26. package/dist/dev/reactivity/watch/helpers.mjs.map +1 -1
  27. package/dist/dev/reactivity/watch.mjs +6 -8
  28. package/dist/dev/reactivity/watch.mjs.map +1 -1
  29. package/dist/dev/router/createRouter.mjs +17 -24
  30. package/dist/dev/router/createRouter.mjs.map +1 -1
  31. package/dist/dev/router/initialNavigation.mjs +22 -17
  32. package/dist/dev/router/initialNavigation.mjs.map +1 -1
  33. package/dist/dev/router/instance.mjs +1 -2
  34. package/dist/dev/router/instance.mjs.map +1 -1
  35. package/dist/dev/router/navigationCore.mjs +2 -2
  36. package/dist/dev/router/navigationCore.mjs.map +1 -1
  37. package/dist/dev/router/navigationResult.mjs +7 -10
  38. package/dist/dev/router/navigationResult.mjs.map +1 -1
  39. package/dist/dev/router/navigationTarget.mjs +1 -3
  40. package/dist/dev/router/navigationTarget.mjs.map +1 -1
  41. package/dist/dev/router/resolve.mjs +3 -4
  42. package/dist/dev/router/resolve.mjs.map +1 -1
  43. package/dist/dev/router/routeRegistry.mjs +1 -1
  44. package/dist/dev/router/routeRegistry.mjs.map +1 -1
  45. package/dist/dev/router/routeSync.mjs +1 -1
  46. package/dist/dev/router/routeSync.mjs.map +1 -1
  47. package/dist/dev/router/scrollRestoration/adapters.d.mts +8 -0
  48. package/dist/dev/router/scrollRestoration/adapters.mjs +86 -0
  49. package/dist/dev/router/scrollRestoration/adapters.mjs.map +1 -0
  50. package/dist/dev/router/scrollRestoration/controller.d.mts +8 -0
  51. package/dist/dev/router/scrollRestoration/controller.mjs +148 -0
  52. package/dist/dev/router/scrollRestoration/controller.mjs.map +1 -0
  53. package/dist/dev/router/scrollRestoration/host.d.mts +3 -0
  54. package/dist/dev/router/scrollRestoration/host.mjs +76 -0
  55. package/dist/dev/router/scrollRestoration/host.mjs.map +1 -0
  56. package/dist/dev/router/scrollRestoration/index.d.mts +9 -0
  57. package/dist/dev/router/scrollRestoration/index.mjs +156 -0
  58. package/dist/dev/router/scrollRestoration/index.mjs.map +1 -0
  59. package/dist/dev/router/scrollRestoration/types.d.mts +61 -0
  60. package/dist/dev/router/useRoute.mjs +12 -19
  61. package/dist/dev/router/useRoute.mjs.map +1 -1
  62. package/dist/dev/router.d.mts +5 -1
  63. package/dist/dev/router.mjs +4 -1
  64. package/dist/dev/routerInternal/location.mjs +2 -3
  65. package/dist/dev/routerInternal/location.mjs.map +1 -1
  66. package/dist/dev/routerInternal/params.mjs +2 -3
  67. package/dist/dev/routerInternal/params.mjs.map +1 -1
  68. package/dist/dev/routerInternal/records.mjs +1 -1
  69. package/dist/dev/routerInternal/records.mjs.map +1 -1
  70. package/dist/dev/routerInternal/recordsWarnings.mjs +1 -2
  71. package/dist/dev/routerInternal/recordsWarnings.mjs.map +1 -1
  72. package/dist/dev/runtime/app/context.mjs +13 -26
  73. package/dist/dev/runtime/app/context.mjs.map +1 -1
  74. package/dist/dev/runtime/app/diagnostics.mjs +2 -4
  75. package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
  76. package/dist/dev/runtime/app/mount.mjs +27 -33
  77. package/dist/dev/runtime/app/mount.mjs.map +1 -1
  78. package/dist/dev/runtime/app/setData/commitTracker.mjs +5 -9
  79. package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -1
  80. package/dist/dev/runtime/app/setData/patchScheduler.mjs +2 -4
  81. package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -1
  82. package/dist/dev/runtime/app/setData/payload.mjs +2 -3
  83. package/dist/dev/runtime/app/setData/payload.mjs.map +1 -1
  84. package/dist/dev/runtime/app/setData/scheduler.mjs +7 -9
  85. package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
  86. package/dist/dev/runtime/app/setData/snapshot.mjs +5 -6
  87. package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -1
  88. package/dist/dev/runtime/app/setDataOptions.mjs +26 -27
  89. package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -1
  90. package/dist/dev/runtime/app.mjs +9 -9
  91. package/dist/dev/runtime/app.mjs.map +1 -1
  92. package/dist/dev/runtime/bindingManifest.mjs +6 -14
  93. package/dist/dev/runtime/bindingManifest.mjs.map +1 -1
  94. package/dist/dev/runtime/capabilities.d.mts +4 -1
  95. package/dist/dev/runtime/capabilities.mjs.map +1 -1
  96. package/dist/dev/runtime/css.mjs +4 -8
  97. package/dist/dev/runtime/css.mjs.map +1 -1
  98. package/dist/dev/runtime/defaults.mjs +4 -4
  99. package/dist/dev/runtime/defaults.mjs.map +1 -1
  100. package/dist/dev/runtime/define/initialComputed.mjs +5 -5
  101. package/dist/dev/runtime/define/initialComputed.mjs.map +1 -1
  102. package/dist/dev/runtime/define/options.mjs +10 -12
  103. package/dist/dev/runtime/define/options.mjs.map +1 -1
  104. package/dist/dev/runtime/define/props.mjs +4 -5
  105. package/dist/dev/runtime/define/props.mjs.map +1 -1
  106. package/dist/dev/runtime/define/scopedSlotOptions.mjs +43 -61
  107. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
  108. package/dist/dev/runtime/define/setupResult.mjs +17 -28
  109. package/dist/dev/runtime/define/setupResult.mjs.map +1 -1
  110. package/dist/dev/runtime/define.mjs +9 -12
  111. package/dist/dev/runtime/define.mjs.map +1 -1
  112. package/dist/dev/runtime/diff.mjs +9 -11
  113. package/dist/dev/runtime/diff.mjs.map +1 -1
  114. package/dist/dev/runtime/disposables.mjs +2 -2
  115. package/dist/dev/runtime/disposables.mjs.map +1 -1
  116. package/dist/dev/runtime/elementIntersectionObserver.mjs +16 -24
  117. package/dist/dev/runtime/elementIntersectionObserver.mjs.map +1 -1
  118. package/dist/dev/runtime/features/inlineEvents.mjs +2 -3
  119. package/dist/dev/runtime/features/inlineEvents.mjs.map +1 -1
  120. package/dist/dev/runtime/features/jsxIslands.d.mts +7 -0
  121. package/dist/dev/runtime/features/jsxIslands.mjs +20 -0
  122. package/dist/dev/runtime/features/jsxIslands.mjs.map +1 -0
  123. package/dist/dev/runtime/features/layout.mjs +2 -3
  124. package/dist/dev/runtime/features/layout.mjs.map +1 -1
  125. package/dist/dev/runtime/features/publicLayout.mjs +2 -6
  126. package/dist/dev/runtime/features/publicLayout.mjs.map +1 -1
  127. package/dist/dev/runtime/features/scopedSlots.mjs +5 -9
  128. package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
  129. package/dist/dev/runtime/features/templateRefs.mjs +1 -1
  130. package/dist/dev/runtime/features/templateRefs.mjs.map +1 -1
  131. package/dist/dev/runtime/hooks/base.mjs +20 -43
  132. package/dist/dev/runtime/hooks/base.mjs.map +1 -1
  133. package/dist/dev/runtime/hooks/pageScroll.mjs +41 -0
  134. package/dist/dev/runtime/hooks/pageScroll.mjs.map +1 -0
  135. package/dist/dev/runtime/hooks/register.mjs +2 -1
  136. package/dist/dev/runtime/hooks/register.mjs.map +1 -1
  137. package/dist/dev/runtime/inlineDataset.mjs +1 -2
  138. package/dist/dev/runtime/inlineDataset.mjs.map +1 -1
  139. package/dist/dev/runtime/intersectionObserver.mjs +6 -6
  140. package/dist/dev/runtime/intersectionObserver.mjs.map +1 -1
  141. package/dist/dev/runtime/jsxIsland.mjs +16 -33
  142. package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
  143. package/dist/dev/runtime/layoutBridge.mjs +32 -62
  144. package/dist/dev/runtime/layoutBridge.mjs.map +1 -1
  145. package/dist/dev/runtime/nativeBridge.mjs +1 -1
  146. package/dist/dev/runtime/nativeBridge.mjs.map +1 -1
  147. package/dist/dev/runtime/navigationLifecycle.mjs +24 -0
  148. package/dist/dev/runtime/navigationLifecycle.mjs.map +1 -0
  149. package/dist/dev/runtime/pageEnvironment.mjs +15 -18
  150. package/dist/dev/runtime/pageEnvironment.mjs.map +1 -1
  151. package/dist/dev/runtime/pageLayout.mjs +7 -11
  152. package/dist/dev/runtime/pageLayout.mjs.map +1 -1
  153. package/dist/dev/runtime/pageScroll.mjs +2 -3
  154. package/dist/dev/runtime/pageScroll.mjs.map +1 -1
  155. package/dist/dev/runtime/platform/current.mjs +12 -0
  156. package/dist/dev/runtime/platform/current.mjs.map +1 -0
  157. package/dist/dev/runtime/platform/generic.mjs +36 -0
  158. package/dist/dev/runtime/platform/generic.mjs.map +1 -0
  159. package/dist/dev/runtime/platform/globals.mjs +29 -0
  160. package/dist/dev/runtime/platform/globals.mjs.map +1 -0
  161. package/dist/dev/runtime/platform.mjs +15 -60
  162. package/dist/dev/runtime/platform.mjs.map +1 -1
  163. package/dist/dev/runtime/provideContext.mjs +7 -9
  164. package/dist/dev/runtime/provideContext.mjs.map +1 -1
  165. package/dist/dev/runtime/publicRuntime.mjs +4 -0
  166. package/dist/dev/runtime/publicRuntime.mjs.map +1 -1
  167. package/dist/dev/runtime/pullDownRefresh.mjs +2 -4
  168. package/dist/dev/runtime/pullDownRefresh.mjs.map +1 -1
  169. package/dist/dev/runtime/register/app.mjs +18 -19
  170. package/dist/dev/runtime/register/app.mjs.map +1 -1
  171. package/dist/dev/runtime/register/component/alipay.mjs +9 -18
  172. package/dist/dev/runtime/register/component/alipay.mjs.map +1 -1
  173. package/dist/dev/runtime/register/component/alipayRegistration.mjs +60 -0
  174. package/dist/dev/runtime/register/component/alipayRegistration.mjs.map +1 -0
  175. package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs +2 -5
  176. package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs.map +1 -1
  177. package/dist/dev/runtime/register/component/lifecycle/platform.mjs +13 -26
  178. package/dist/dev/runtime/register/component/lifecycle/platform.mjs.map +1 -1
  179. package/dist/dev/runtime/register/component/lifecycle.mjs +7 -12
  180. package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
  181. package/dist/dev/runtime/register/component/methods.mjs +13 -18
  182. package/dist/dev/runtime/register/component/methods.mjs.map +1 -1
  183. package/dist/dev/runtime/register/component/options.mjs +3 -4
  184. package/dist/dev/runtime/register/component/options.mjs.map +1 -1
  185. package/dist/dev/runtime/register/component/props.mjs +25 -31
  186. package/dist/dev/runtime/register/component/props.mjs.map +1 -1
  187. package/dist/dev/runtime/register/component/registerDefinition.mjs +21 -40
  188. package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
  189. package/dist/dev/runtime/register/component/registerNativeDefinition.mjs +18 -60
  190. package/dist/dev/runtime/register/component/registerNativeDefinition.mjs.map +1 -1
  191. package/dist/dev/runtime/register/component.mjs +3 -5
  192. package/dist/dev/runtime/register/component.mjs.map +1 -1
  193. package/dist/dev/runtime/register/inline.mjs +8 -10
  194. package/dist/dev/runtime/register/inline.mjs.map +1 -1
  195. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +7 -8
  196. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -1
  197. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +1 -1
  198. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -1
  199. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +25 -34
  200. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
  201. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +13 -15
  202. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
  203. package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +2 -2
  204. package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs.map +1 -1
  205. package/dist/dev/runtime/register/runtimeInstance/utils.mjs +9 -9
  206. package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
  207. package/dist/dev/runtime/register/runtimeInstance.mjs +74 -100
  208. package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
  209. package/dist/dev/runtime/register/setDataFrequencyWarning.mjs +12 -15
  210. package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -1
  211. package/dist/dev/runtime/register/setup.mjs +2 -3
  212. package/dist/dev/runtime/register/setup.mjs.map +1 -1
  213. package/dist/dev/runtime/register/snapshot.mjs +1 -4
  214. package/dist/dev/runtime/register/snapshot.mjs.map +1 -1
  215. package/dist/dev/runtime/register/watch.mjs +3 -5
  216. package/dist/dev/runtime/register/watch.mjs.map +1 -1
  217. package/dist/dev/runtime/scopedSlots.mjs +14 -21
  218. package/dist/dev/runtime/scopedSlots.mjs.map +1 -1
  219. package/dist/dev/runtime/selectorQuery.mjs +5 -9
  220. package/dist/dev/runtime/selectorQuery.mjs.map +1 -1
  221. package/dist/dev/runtime/template.mjs +1 -1
  222. package/dist/dev/runtime/template.mjs.map +1 -1
  223. package/dist/dev/runtime/templateRefs/helpers.mjs +14 -24
  224. package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -1
  225. package/dist/dev/runtime/templateRefs.mjs +8 -15
  226. package/dist/dev/runtime/templateRefs.mjs.map +1 -1
  227. package/dist/dev/runtime/uniAppHost.mjs +6 -14
  228. package/dist/dev/runtime/uniAppHost.mjs.map +1 -1
  229. package/dist/dev/runtime/updatePerformance.mjs +1 -1
  230. package/dist/dev/runtime/updatePerformance.mjs.map +1 -1
  231. package/dist/dev/runtime/use.mjs +1 -1
  232. package/dist/dev/runtime/use.mjs.map +1 -1
  233. package/dist/dev/runtime/vueCompat/context.mjs +3 -5
  234. package/dist/dev/runtime/vueCompat/context.mjs.map +1 -1
  235. package/dist/dev/runtime/vueCompat/model.mjs +9 -13
  236. package/dist/dev/runtime/vueCompat/model.mjs.map +1 -1
  237. package/dist/dev/runtime/vueCompat/router.mjs +4 -4
  238. package/dist/dev/runtime/vueCompat/router.mjs.map +1 -1
  239. package/dist/dev/runtime/vueCompat/templateRef.mjs +1 -1
  240. package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -1
  241. package/dist/dev/scheduler.mjs +3 -4
  242. package/dist/dev/scheduler.mjs.map +1 -1
  243. package/dist/dev/store/base.mjs +1 -2
  244. package/dist/dev/store/base.mjs.map +1 -1
  245. package/dist/dev/store/define/create.mjs +11 -22
  246. package/dist/dev/store/define/create.mjs.map +1 -1
  247. package/dist/dev/store/define.mjs +1 -1
  248. package/dist/dev/store/define.mjs.map +1 -1
  249. package/dist/dev/store/view.mjs +1 -1
  250. package/dist/dev/store/view.mjs.map +1 -1
  251. package/dist/internal-runtime.d.mts +2 -1
  252. package/dist/internal-runtime.mjs +1 -1
  253. package/dist/package.mjs +1 -1
  254. package/dist/reactivity/asyncDerivation.mjs +1 -1
  255. package/dist/reactivity/core.mjs +1 -1
  256. package/dist/reactivity/reactive/patch.mjs +1 -1
  257. package/dist/reactivity/reactive/patchState.mjs +1 -1
  258. package/dist/reactivity/reactive/shared.mjs +1 -1
  259. package/dist/reactivity/reactive.mjs +1 -1
  260. package/dist/reactivity/ref.mjs +1 -1
  261. package/dist/reactivity/shallowRef.mjs +1 -1
  262. package/dist/reactivity/watch/helpers.mjs +1 -1
  263. package/dist/reactivity/watch.mjs +1 -1
  264. package/dist/router/createRouter.mjs +1 -1
  265. package/dist/router/initialNavigation.mjs +1 -1
  266. package/dist/router/instance.mjs +1 -1
  267. package/dist/router/navigationCore.mjs +1 -1
  268. package/dist/router/navigationResult.mjs +1 -1
  269. package/dist/router/navigationTarget.mjs +1 -1
  270. package/dist/router/resolve.mjs +1 -1
  271. package/dist/router/routeRegistry.mjs +1 -1
  272. package/dist/router/routeSync.mjs +1 -1
  273. package/dist/router/scrollRestoration/adapters.d.mts +7 -0
  274. package/dist/router/scrollRestoration/adapters.mjs +1 -0
  275. package/dist/router/scrollRestoration/controller.d.mts +7 -0
  276. package/dist/router/scrollRestoration/controller.mjs +1 -0
  277. package/dist/router/scrollRestoration/host.d.mts +3 -0
  278. package/dist/router/scrollRestoration/host.mjs +1 -0
  279. package/dist/router/scrollRestoration/index.d.mts +8 -0
  280. package/dist/router/scrollRestoration/index.mjs +1 -0
  281. package/dist/router/scrollRestoration/types.d.mts +60 -0
  282. package/dist/router/useRoute.mjs +1 -1
  283. package/dist/router.d.mts +5 -1
  284. package/dist/router.mjs +1 -1
  285. package/dist/routerInternal/location.mjs +1 -1
  286. package/dist/routerInternal/params.mjs +1 -1
  287. package/dist/routerInternal/records.mjs +1 -1
  288. package/dist/routerInternal/recordsWarnings.mjs +1 -1
  289. package/dist/runtime/app/context.mjs +1 -1
  290. package/dist/runtime/app/diagnostics.mjs +1 -1
  291. package/dist/runtime/app/mount.mjs +1 -1
  292. package/dist/runtime/app/setData/commitTracker.mjs +1 -1
  293. package/dist/runtime/app/setData/patchScheduler.mjs +1 -1
  294. package/dist/runtime/app/setData/payload.mjs +1 -1
  295. package/dist/runtime/app/setData/scheduler.mjs +1 -1
  296. package/dist/runtime/app/setData/snapshot.mjs +1 -1
  297. package/dist/runtime/app/setDataOptions.mjs +1 -1
  298. package/dist/runtime/app.mjs +1 -1
  299. package/dist/runtime/bindingManifest.mjs +1 -1
  300. package/dist/runtime/capabilities.d.mts +4 -1
  301. package/dist/runtime/css.mjs +1 -1
  302. package/dist/runtime/defaults.mjs +1 -1
  303. package/dist/runtime/define/initialComputed.mjs +1 -1
  304. package/dist/runtime/define/options.mjs +1 -1
  305. package/dist/runtime/define/props.mjs +1 -1
  306. package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
  307. package/dist/runtime/define/setupResult.mjs +1 -1
  308. package/dist/runtime/define.mjs +1 -1
  309. package/dist/runtime/diff.mjs +1 -1
  310. package/dist/runtime/disposables.mjs +1 -1
  311. package/dist/runtime/elementIntersectionObserver.mjs +1 -1
  312. package/dist/runtime/features/inlineEvents.mjs +1 -1
  313. package/dist/runtime/features/jsxIslands.d.mts +6 -0
  314. package/dist/runtime/features/jsxIslands.mjs +1 -0
  315. package/dist/runtime/features/layout.mjs +1 -1
  316. package/dist/runtime/features/publicLayout.mjs +1 -1
  317. package/dist/runtime/features/scopedSlots.mjs +1 -1
  318. package/dist/runtime/features/templateRefs.mjs +1 -1
  319. package/dist/runtime/hooks/base.mjs +1 -1
  320. package/dist/runtime/hooks/pageScroll.mjs +1 -0
  321. package/dist/runtime/hooks/register.mjs +1 -1
  322. package/dist/runtime/inlineDataset.mjs +1 -1
  323. package/dist/runtime/intersectionObserver.mjs +1 -1
  324. package/dist/runtime/jsxIsland.mjs +1 -1
  325. package/dist/runtime/layoutBridge.mjs +1 -1
  326. package/dist/runtime/nativeBridge.mjs +1 -1
  327. package/dist/runtime/navigationLifecycle.mjs +1 -0
  328. package/dist/runtime/pageEnvironment.mjs +1 -1
  329. package/dist/runtime/pageLayout.mjs +1 -1
  330. package/dist/runtime/pageScroll.mjs +1 -1
  331. package/dist/runtime/platform/current.mjs +1 -0
  332. package/dist/runtime/platform/generic.mjs +1 -0
  333. package/dist/runtime/platform/globals.mjs +1 -0
  334. package/dist/runtime/platform.mjs +1 -1
  335. package/dist/runtime/provideContext.mjs +1 -1
  336. package/dist/runtime/publicRuntime.mjs +1 -1
  337. package/dist/runtime/pullDownRefresh.mjs +1 -1
  338. package/dist/runtime/register/app.mjs +1 -1
  339. package/dist/runtime/register/component/alipay.mjs +1 -1
  340. package/dist/runtime/register/component/alipayRegistration.mjs +1 -0
  341. package/dist/runtime/register/component/lifecycle/optionalHooks.mjs +1 -1
  342. package/dist/runtime/register/component/lifecycle/platform.mjs +1 -1
  343. package/dist/runtime/register/component/lifecycle.mjs +1 -1
  344. package/dist/runtime/register/component/methods.mjs +1 -1
  345. package/dist/runtime/register/component/options.mjs +1 -1
  346. package/dist/runtime/register/component/props.mjs +1 -1
  347. package/dist/runtime/register/component/registerDefinition.mjs +1 -1
  348. package/dist/runtime/register/component/registerNativeDefinition.mjs +1 -1
  349. package/dist/runtime/register/component.mjs +1 -1
  350. package/dist/runtime/register/inline.mjs +1 -1
  351. package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -1
  352. package/dist/runtime/register/runtimeInstance/provideContext.mjs +1 -1
  353. package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -1
  354. package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
  355. package/dist/runtime/register/runtimeInstance/setupSnapshot.mjs +1 -1
  356. package/dist/runtime/register/runtimeInstance/utils.mjs +1 -1
  357. package/dist/runtime/register/runtimeInstance.mjs +1 -1
  358. package/dist/runtime/register/setDataFrequencyWarning.mjs +1 -1
  359. package/dist/runtime/register/setup.mjs +1 -1
  360. package/dist/runtime/register/snapshot.mjs +1 -1
  361. package/dist/runtime/register/watch.mjs +1 -1
  362. package/dist/runtime/scopedSlots.mjs +1 -1
  363. package/dist/runtime/selectorQuery.mjs +1 -1
  364. package/dist/runtime/template.mjs +1 -1
  365. package/dist/runtime/templateRefs/helpers.mjs +1 -1
  366. package/dist/runtime/templateRefs.mjs +1 -1
  367. package/dist/runtime/uniAppHost.mjs +1 -1
  368. package/dist/runtime/updatePerformance.mjs +1 -1
  369. package/dist/runtime/use.mjs +1 -1
  370. package/dist/runtime/vueCompat/context.mjs +1 -1
  371. package/dist/runtime/vueCompat/model.mjs +1 -1
  372. package/dist/runtime/vueCompat/router.mjs +1 -1
  373. package/dist/runtime/vueCompat/templateRef.mjs +1 -1
  374. package/dist/scheduler.mjs +1 -1
  375. package/dist/store/base.mjs +1 -1
  376. package/dist/store/define/create.mjs +1 -1
  377. package/dist/store/define.mjs +1 -1
  378. package/dist/store/view.mjs +1 -1
  379. package/package.json +7 -7
  380. /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.mjs +0 -0
  381. /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.mjs +0 -0
  382. /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.mjs +0 -0
  383. /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"define.mjs","names":[],"sources":["../../../src/runtime/define.ts"],"sourcesContent":["import type { WevuRuntimeBindingManifestV1 } from '@weapp-core/constants'\nimport type { RuntimeComponentDefinitionOptions } from './define/componentDefinition'\nimport type {\n ComponentPropsOptions,\n ComponentPublicInstance,\n ComputedDefinitions,\n DefineComponent,\n DefineComponentOptions,\n InferProps,\n MethodDefinitions,\n MiniProgramComponentPropertyOption,\n MiniProgramComponentRawOptions,\n SetDataSnapshotOptions,\n ShallowUnwrapRef,\n} from './types'\nimport {\n WEVU_BINDING_MANIFEST_KEY,\n WEVU_CSS_MODULES_KEY,\n WEVU_FUNCTION_PROP_PATHS_KEY,\n WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_PROP,\n WEVU_SLOT_SCOPE_KEY,\n} from '@weapp-core/constants'\nimport { hasOwn } from '../utils'\nimport { hasBindingOutputPath, resolveBindingManifest } from './bindingManifest'\nimport { requireRuntimeCapability } from './capabilities'\nimport { applyWevuComponentDefaults } from './defaults'\nimport {\n createRuntimeComponentDefinition,\n} from './define/componentDefinition'\nimport { resolveNativeInitialData } from './define/initialComputed'\nimport { resolveVueComponentOptions } from './define/options'\nimport { applyOptionsApiProvide, resolveOptionsApiInjections } from './define/optionsApi'\nimport { normalizeProps } from './define/props'\nimport { applySetupResult, mergeSetupResultDescriptors } from './define/setupResult'\nimport { runSetupFunction } from './register'\n\nconst componentLifecycleDefinitions = new WeakMap<object, Record<string, any>>()\n\nfunction resolveInitialDataContext(properties: unknown, methods: MethodDefinitions | undefined) {\n const context: Record<string, unknown> = { ...(methods ?? {}) }\n if (!properties || typeof properties !== 'object') {\n return context\n }\n for (const [name, definition] of Object.entries(properties)) {\n if (definition && typeof definition === 'object' && hasOwn(definition, 'value')) {\n context[name] = (definition as Record<string, unknown>).value\n }\n }\n return context\n}\n\nfunction shouldDeclareNativeSlotOwnerId(\n setData: SetDataSnapshotOptions | undefined,\n bindingManifest: WevuRuntimeBindingManifestV1 | undefined,\n) {\n return (\n Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n ) || (\n bindingManifest?.features?.scopedSlots === true\n && hasBindingOutputPath(bindingManifest, WEVU_SLOT_OWNER_ID_KEY)\n )\n}\n\nfunction shouldSeedNativeSlotOwnerId(mpOptions: Record<string, unknown>) {\n return Boolean(mpOptions.__wevu_isPage)\n}\n\nfunction hasScopedSlotHostProperties(mpOptions: Record<string, any>) {\n const properties = mpOptions.properties\n return Boolean(\n properties\n && typeof properties === 'object'\n && (\n WEVU_SLOT_OWNER_ID_PROP in properties\n || WEVU_SLOT_SCOPE_KEY in properties\n ),\n )\n}\n\nfunction resolveScopedSlotHostSetData(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n if (setData?.strategy !== 'patch' || !hasScopedSlotHostProperties(mpOptions)) {\n return setData\n }\n return {\n ...setData,\n strategy: 'diff' as const,\n }\n}\n\n/**\n * defineComponent 返回的组件定义描述,用于手动注册或高级用法。\n */\nexport interface ComponentDefinition<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n /**\n * 内部 runtime app(高级能力使用),不对外暴露正式 API。\n * @internal\n */\n __wevu_runtime: import('./types').RuntimeApp<D, C, M>\n\n /**\n * 内部选项快照(高级能力使用),包含 data/computed/methods 等。\n * @internal\n */\n __wevu_options: {\n scopedSlotOwnerRequired: boolean\n data: () => D\n computed: C\n methods: M\n setData: import('./types').SetDataSnapshotOptions | undefined\n bindingManifest?: WevuRuntimeBindingManifestV1\n watch: Record<string, any> | undefined\n setup: ((props: any, ctx: any) => any) | undefined\n mpOptions: MiniProgramComponentRawOptions\n }\n}\n\nfunction materializeComponentDefinition(\n componentOptions: RuntimeComponentDefinitionOptions,\n registerNative = false,\n) {\n const { lifecycleDefinition, runtimeApp } = createRuntimeComponentDefinition(componentOptions, registerNative)\n const definition: ComponentDefinition<any, any, any> = {\n __wevu_runtime: runtimeApp as any,\n __wevu_options: componentOptions as ComponentDefinition<any, any, any>['__wevu_options'],\n }\n componentLifecycleDefinitions.set(definition, lifecycleDefinition)\n return definition\n}\n\ntype SetupBindings<S> = Exclude<S, void> extends never ? Record<never, never> : Exclude<S, void>\ntype ResolveProps<P> = P extends ComponentPropsOptions ? InferProps<P> : P\n\nexport interface WevuComponentConstructor<\n Props,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n new (): ComponentPublicInstance<D, C, M, Props> & ShallowUnwrapRef<RawBindings>\n}\n\nexport type WevuDefinedComponent<\n PropsOrPropOptions,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M> & ComponentDefinition<D, C, M>\nexport interface SetupContextWithTypeProps<TypeProps> {\n props: TypeProps\n [key: string]: any\n}\nexport type SetupFunctionWithTypeProps<\n TypeProps,\n> = (\n props: TypeProps,\n ctx: SetupContextWithTypeProps<TypeProps>,\n) => Record<string, any> | void\nexport interface DefineComponentTypePropsOptions<TypeProps> {\n __typeProps: TypeProps\n setup?: SetupFunctionWithTypeProps<TypeProps>\n [key: string]: any\n}\nexport interface DefineComponentWithTypeProps<TypeProps> {\n new (): { $props: TypeProps } & Record<string, any>\n}\n\n/**\n * 按 Vue 3 风格定义一个小程序组件/页面。\n *\n * - 统一注册为 `Component()`\n *\n * @param options 组件定义项\n * @returns 可手动注册的组件定义\n *\n * @example\n * ```ts\n * defineComponent({\n * data: () => ({ count: 0 }),\n * setup() {\n * onMounted(() => console.log('已挂载'))\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * defineComponent({\n * setup() {\n * onPageScroll(() => {})\n * }\n * })\n * ```\n */\n// @ts-expect-error -- TS2589:__typeProps 签名的重载实例化深度过高。\nexport function defineComponent<\n TypeProps = any,\n>(\n options: DefineComponentTypePropsOptions<TypeProps>,\n): DefineComponentWithTypeProps<TypeProps>\nexport function defineComponent<\n P extends ComponentPropsOptions = Record<never, never>,\n D extends object = Record<never, never>,\n C extends ComputedDefinitions = Record<never, never>,\n M extends MethodDefinitions = Record<never, never>,\n S extends Record<string, any> | void = void,\n>(\n options: DefineComponentOptions<P, D, C, M, S>,\n): WevuComponentConstructor<ResolveProps<P>, SetupBindings<S>, D, C, M> & ComponentDefinition<D, C, M>\nexport function defineComponent(\n options: DefineComponentOptions<any, any, any, any, any>,\n): WevuComponentConstructor<Record<string, any>, Record<string, any>, Record<string, any>, ComputedDefinitions, MethodDefinitions>\n & ComponentDefinition<any, any, any> {\n // eslint-disable-next-line ts/no-use-before-define -- 重载实现需保持在内部共享工厂之前。\n return createComponentDefinition(options, true) as any\n}\n\nfunction createComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n registerNative: boolean,\n) {\n const resolvedOptions = resolveVueComponentOptions(applyWevuComponentDefaults(options))\n const {\n __typeProps: _typeProps,\n [WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY]: scopedSlotOwnerRequired,\n data,\n computed,\n methods,\n setData,\n watch,\n setup,\n props,\n inject: injectOptions,\n provide: provideOptions,\n allowFunctionProps,\n [WEVU_BINDING_MANIFEST_KEY]: rawBindingManifest,\n [WEVU_CSS_MODULES_KEY]: cssModules,\n ...mpOptions\n } = resolvedOptions as typeof resolvedOptions & { [WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY]?: boolean }\n const bindingManifest = resolveBindingManifest(rawBindingManifest)\n\n const rawFunctionPropPaths = (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n const functionPropPaths: string[] = Array.isArray(rawFunctionPropPaths)\n ? [...new Set(rawFunctionPropPaths.filter((path: unknown): path is string => typeof path === 'string' && path.length > 0))]\n : []\n delete (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n\n const rawResolvedSetData = allowFunctionProps === true\n ? {\n ...(setData ?? {}),\n includeFunctions: true,\n functionPaths: functionPropPaths,\n }\n : allowFunctionProps === false\n ? setData\n : functionPropPaths.length\n ? {\n ...(setData ?? {}),\n functionPaths: functionPropPaths,\n }\n : setData\n const resolvedSetData = resolveScopedSlotHostSetData(mpOptions, rawResolvedSetData)\n const setupFunctionPropKeys = new Set(\n functionPropPaths\n .filter(path => !path.includes('.')),\n )\n\n const normalizedMpOptions = normalizeProps(mpOptions, props, mpOptions.properties)\n const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods)\n const resolvedData = typeof data === 'function'\n ? () => data.call(initialDataContext)\n : data\n\n const hasOptionsApiContext = injectOptions != null || provideOptions != null\n const setupWrapper = typeof setup === 'function' || hasOptionsApiContext || cssModules\n ? ((props, ctx) => {\n if (cssModules && typeof cssModules === 'object') {\n ;((ctx as any).instance as Record<string, any>)[WEVU_CSS_MODULES_KEY] = cssModules\n }\n const publicInstance = (ctx as any)?.proxy ?? (ctx as any)?.instance ?? Object.create(null)\n const injected = resolveOptionsApiInjections(injectOptions, publicInstance)\n if (provideOptions != null) {\n applyOptionsApiProvide(provideOptions, publicInstance)\n }\n const setupResult = typeof setup === 'function'\n ? runSetupFunction(setup as any, props as Record<string, any>, ctx as any) as Record<string, any> | void\n : undefined\n const result = mergeSetupResultDescriptors({\n ...injected,\n ...(cssModules ?? {}),\n }, setupResult)\n if (ctx && Object.keys(result).length) {\n applySetupResult((ctx as any).runtime, (ctx as any).instance, result, {\n includeFunctionsInState: allowFunctionProps === true,\n functionPropPaths: allowFunctionProps === false ? undefined : setupFunctionPropKeys,\n })\n }\n return result\n }) satisfies DefineComponentOptions<ComponentPropsOptions, any, any, any, any>['setup']\n : undefined\n\n const nativeData = typeof resolvedData === 'function'\n ? resolvedData()\n : resolvedData\n const nativeOwnerId = nativeData && typeof nativeData === 'object'\n ? Reflect.get(nativeData, WEVU_SLOT_OWNER_ID_KEY)\n : undefined\n const shouldDeclareOwnerId = shouldDeclareNativeSlotOwnerId(resolvedSetData, bindingManifest)\n const scopedSlotHooks = shouldDeclareOwnerId\n ? requireRuntimeCapability('scopedSlots', 'defineComponent(scoped-slot owner metadata)')\n : undefined\n const seededNativeData = shouldDeclareOwnerId\n ? {\n ...(nativeData && typeof nativeData === 'object' ? nativeData : {}),\n [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions)\n ? nativeOwnerId || scopedSlotHooks?.allocateOwnerId()\n : nativeOwnerId || '',\n }\n : nativeData\n const nativeInitialData = resolveNativeInitialData(seededNativeData, computed as ComputedDefinitions, resolvedSetData, methods as Record<string, any> | undefined)\n const mpOptionsWithProps = nativeInitialData !== undefined\n ? {\n ...normalizedMpOptions,\n data: nativeInitialData,\n }\n : normalizedMpOptions\n\n const componentOptions: RuntimeComponentDefinitionOptions = {\n scopedSlotOwnerRequired: scopedSlotOwnerRequired === true,\n data: resolvedData as () => Record<string, any>,\n computed: computed as ComputedDefinitions,\n methods: methods as MethodDefinitions,\n setData: resolvedSetData,\n bindingManifest,\n watch,\n setup: setupWrapper,\n mpOptions: mpOptionsWithProps as MiniProgramComponentRawOptions,\n }\n\n const definition = materializeComponentDefinition(componentOptions, registerNative)\n\n return definition as unknown as WevuComponentConstructor<\n ResolveProps<ComponentPropsOptions>,\n Record<string, any>,\n Record<string, any>,\n ComputedDefinitions,\n MethodDefinitions\n > & ComponentDefinition<any, any, any>\n}\n\n/**\n * 创建不触发宿主全局注册的 Wevu 组件定义。\n *\n * @param options 组件选项\n * @internal\n */\nexport function createWevuComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n) {\n return createComponentDefinition(options, false)\n}\n\n/**\n * 从现有组件定义派生拥有独立应用上下文的组件定义。\n *\n * @param definition 已解析的 Wevu 组件定义\n * @internal\n */\nexport function createIsolatedWevuComponentDefinition(definition: object) {\n const componentOptions = (definition as ComponentDefinition<any, any, any>).__wevu_options\n if (!componentOptions) {\n throw new TypeError('无法从非 Wevu 组件定义创建独立运行时')\n }\n return materializeComponentDefinition(componentOptions)\n}\n\n/**\n * 获取组件定义对应的宿主生命周期定义。\n *\n * @param definition Wevu 组件定义\n * @internal\n */\nexport function getWevuComponentLifecycleDefinition(definition: object) {\n return componentLifecycleDefinitions.get(definition)\n}\n\n/**\n * 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。\n *\n * @param options 组件选项,可能包含小程序特有的 properties\n * @internal\n */\nexport function createWevuComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n>(\n options: DefineComponentOptions<P, D, C, M> & { properties?: MiniProgramComponentPropertyOption },\n): void {\n const allowNullPropInput = options.allowNullPropInput ?? true\n defineComponent({\n ...options,\n allowNullPropInput,\n __wevu_allowNullPropInput: allowNullPropInput,\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,gDAAgC,IAAI,QAAqC;AAE/E,SAAS,0BAA0B,YAAqB,SAAwC;CAC9F,MAAM,UAAmC,EAAE,GAAI,mDAAW,CAAC,EAAG;CAC9D,IAAI,CAAC,cAAc,OAAO,eAAe,UACvC,OAAO;CAET,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,UAAU,GACxD,IAAI,cAAc,OAAO,eAAe,YAAY,OAAO,YAAY,OAAO,GAC5E,QAAQ,QAAS,WAAuC;CAG5D,OAAO;AACT;AAEA,SAAS,+BACP,SACA,iBACA;;CACA,OACE,MAAM,0DAAQ,QAAS,IAAI,KACxB,QAAQ,KAAK,SAAS,sBAAsB,yFAE/C,gBAAiB,wFAAU,iBAAgB,QACxC,qBAAqB,iBAAiB,sBAAsB;AAEnE;AAEA,SAAS,4BAA4B,WAAoC;CACvE,OAAO,QAAQ,UAAU,aAAa;AACxC;AAEA,SAAS,4BAA4B,WAAgC;CACnE,MAAM,aAAa,UAAU;CAC7B,OAAO,QACL,cACG,OAAO,eAAe,aAEvB,2BAA2B,cACxB,uBAAuB,WAE9B;AACF;AAEA,SAAS,6BACP,WACA,SACA;CACA,uDAAI,QAAS,cAAa,WAAW,CAAC,4BAA4B,SAAS,GACzE,OAAO;CAET,OAAO;EACL,GAAG;EACH,UAAU;CACZ;AACF;AAiCA,SAAS,+BACP,kBACA,iBAAiB,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AgB,8BACd,SACA;CACA,OAAO,0BAA0B,SAAS,KAAK;AACjD;;;;;;;AAQA,SAAgB,sCAAsC,YAAoB;CACxE,MAAM,mBAAoB,WAAkD;CAC5E,IAAI,CAAC,kBACH,MAAM,IAAI,UAAU,uBAAuB;CAE7C,OAAO,+BAA+B,gBAAgB;AACxD;;;;;;;AAQA,SAAgB,oCAAoC,YAAoB;CACtE,OAAO,8BAA8B,IAAI,UAAU;AACrD;;;;;;;AAQA,SAAgB,oBAMd,SACM;;CACN,MAAM,8CAAqB,QAAQ,2FAAsB;CACzD,gBAAgB;EACd,GAAG;EACH;EACA,2BAA2B;CAC7B,CAAC;AACH"}
1
+ {"version":3,"file":"define.mjs","names":[],"sources":["../../../src/runtime/define.ts"],"sourcesContent":["import type { WevuRuntimeBindingManifestV1 } from '@weapp-core/constants'\nimport type { RuntimeComponentDefinitionOptions } from './define/componentDefinition'\nimport type {\n ComponentPropsOptions,\n ComponentPublicInstance,\n ComputedDefinitions,\n DefineComponent,\n DefineComponentOptions,\n InferProps,\n MethodDefinitions,\n MiniProgramComponentPropertyOption,\n MiniProgramComponentRawOptions,\n SetDataSnapshotOptions,\n ShallowUnwrapRef,\n} from './types'\nimport {\n WEVU_BINDING_MANIFEST_KEY,\n WEVU_CSS_MODULES_KEY,\n WEVU_FUNCTION_PROP_PATHS_KEY,\n WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_PROP,\n WEVU_SLOT_SCOPE_KEY,\n} from '@weapp-core/constants'\nimport { hasOwn } from '../utils'\nimport { hasBindingOutputPath, resolveBindingManifest } from './bindingManifest'\nimport { requireRuntimeCapability } from './capabilities'\nimport { applyWevuComponentDefaults } from './defaults'\nimport {\n createRuntimeComponentDefinition,\n} from './define/componentDefinition'\nimport { resolveNativeInitialData } from './define/initialComputed'\nimport { resolveVueComponentOptions } from './define/options'\nimport { applyOptionsApiProvide, resolveOptionsApiInjections } from './define/optionsApi'\nimport { normalizeProps } from './define/props'\nimport { applySetupResult, mergeSetupResultDescriptors } from './define/setupResult'\nimport { runSetupFunction } from './register'\n\nconst componentLifecycleDefinitions = new WeakMap<object, Record<string, any>>()\n\nfunction resolveInitialDataContext(properties: unknown, methods: MethodDefinitions | undefined) {\n const context: Record<string, unknown> = { ...(methods ?? {}) }\n if (!properties || typeof properties !== 'object') {\n return context\n }\n for (const [name, definition] of Object.entries(properties)) {\n if (definition && typeof definition === 'object' && hasOwn(definition, 'value')) {\n context[name] = (definition as Record<string, unknown>).value\n }\n }\n return context\n}\n\nfunction shouldDeclareNativeSlotOwnerId(\n setData: SetDataSnapshotOptions | undefined,\n bindingManifest: WevuRuntimeBindingManifestV1 | undefined,\n) {\n return (\n Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n ) || (\n bindingManifest?.features?.scopedSlots === true\n && hasBindingOutputPath(bindingManifest, WEVU_SLOT_OWNER_ID_KEY)\n )\n}\n\nfunction shouldSeedNativeSlotOwnerId(mpOptions: Record<string, unknown>) {\n return Boolean(mpOptions.__wevu_isPage)\n}\n\nfunction hasScopedSlotHostProperties(mpOptions: Record<string, any>) {\n const properties = mpOptions.properties\n return Boolean(\n properties\n && typeof properties === 'object'\n && (\n WEVU_SLOT_OWNER_ID_PROP in properties\n || WEVU_SLOT_SCOPE_KEY in properties\n ),\n )\n}\n\nfunction resolveScopedSlotHostSetData(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n if (setData?.strategy !== 'patch' || !hasScopedSlotHostProperties(mpOptions)) {\n return setData\n }\n return {\n ...setData,\n strategy: 'diff' as const,\n }\n}\n\n/**\n * defineComponent 返回的组件定义描述,用于手动注册或高级用法。\n */\nexport interface ComponentDefinition<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n /**\n * 内部 runtime app(高级能力使用),不对外暴露正式 API。\n * @internal\n */\n __wevu_runtime: import('./types').RuntimeApp<D, C, M>\n\n /**\n * 内部选项快照(高级能力使用),包含 data/computed/methods 等。\n * @internal\n */\n __wevu_options: {\n scopedSlotOwnerRequired: boolean\n data: () => D\n computed: C\n methods: M\n setData: import('./types').SetDataSnapshotOptions | undefined\n bindingManifest?: WevuRuntimeBindingManifestV1\n watch: Record<string, any> | undefined\n setup: ((props: any, ctx: any) => any) | undefined\n mpOptions: MiniProgramComponentRawOptions\n }\n}\n\nfunction materializeComponentDefinition(\n componentOptions: RuntimeComponentDefinitionOptions,\n registerNative = false,\n) {\n const { lifecycleDefinition, runtimeApp } = createRuntimeComponentDefinition(componentOptions, registerNative)\n const definition: ComponentDefinition<any, any, any> = {\n __wevu_runtime: runtimeApp as any,\n __wevu_options: componentOptions as ComponentDefinition<any, any, any>['__wevu_options'],\n }\n componentLifecycleDefinitions.set(definition, lifecycleDefinition)\n return definition\n}\n\ntype SetupBindings<S> = Exclude<S, void> extends never ? Record<never, never> : Exclude<S, void>\ntype ResolveProps<P> = P extends ComponentPropsOptions ? InferProps<P> : P\n\nexport interface WevuComponentConstructor<\n Props,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n new (): ComponentPublicInstance<D, C, M, Props> & ShallowUnwrapRef<RawBindings>\n}\n\nexport type WevuDefinedComponent<\n PropsOrPropOptions,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M> & ComponentDefinition<D, C, M>\nexport interface SetupContextWithTypeProps<TypeProps> {\n props: TypeProps\n [key: string]: any\n}\nexport type SetupFunctionWithTypeProps<\n TypeProps,\n> = (\n props: TypeProps,\n ctx: SetupContextWithTypeProps<TypeProps>,\n) => Record<string, any> | void\nexport interface DefineComponentTypePropsOptions<TypeProps> {\n __typeProps: TypeProps\n setup?: SetupFunctionWithTypeProps<TypeProps>\n [key: string]: any\n}\nexport interface DefineComponentWithTypeProps<TypeProps> {\n new (): { $props: TypeProps } & Record<string, any>\n}\n\n/**\n * 按 Vue 3 风格定义一个小程序组件/页面。\n *\n * - 统一注册为 `Component()`\n *\n * @param options 组件定义项\n * @returns 可手动注册的组件定义\n *\n * @example\n * ```ts\n * defineComponent({\n * data: () => ({ count: 0 }),\n * setup() {\n * onMounted(() => console.log('已挂载'))\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * defineComponent({\n * setup() {\n * onPageScroll(() => {})\n * }\n * })\n * ```\n */\n// @ts-expect-error -- TS2589:__typeProps 签名的重载实例化深度过高。\nexport function defineComponent<\n TypeProps = any,\n>(\n options: DefineComponentTypePropsOptions<TypeProps>,\n): DefineComponentWithTypeProps<TypeProps>\nexport function defineComponent<\n P extends ComponentPropsOptions = Record<never, never>,\n D extends object = Record<never, never>,\n C extends ComputedDefinitions = Record<never, never>,\n M extends MethodDefinitions = Record<never, never>,\n S extends Record<string, any> | void = void,\n>(\n options: DefineComponentOptions<P, D, C, M, S>,\n): WevuComponentConstructor<ResolveProps<P>, SetupBindings<S>, D, C, M> & ComponentDefinition<D, C, M>\nexport function defineComponent(\n options: DefineComponentOptions<any, any, any, any, any>,\n): WevuComponentConstructor<Record<string, any>, Record<string, any>, Record<string, any>, ComputedDefinitions, MethodDefinitions>\n & ComponentDefinition<any, any, any> {\n // eslint-disable-next-line ts/no-use-before-define -- 重载实现需保持在内部共享工厂之前。\n return createComponentDefinition(options, true) as any\n}\n\nfunction createComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n registerNative: boolean,\n) {\n const resolvedOptions = resolveVueComponentOptions(applyWevuComponentDefaults(options))\n const {\n __typeProps: _typeProps,\n [WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY]: scopedSlotOwnerRequired,\n data,\n computed,\n methods,\n setData,\n watch,\n setup,\n props,\n inject: injectOptions,\n provide: provideOptions,\n allowFunctionProps,\n [WEVU_BINDING_MANIFEST_KEY]: rawBindingManifest,\n [WEVU_CSS_MODULES_KEY]: cssModules,\n ...mpOptions\n } = resolvedOptions as typeof resolvedOptions & { [WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY]?: boolean }\n const bindingManifest = resolveBindingManifest(rawBindingManifest)\n\n const rawFunctionPropPaths = (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n const functionPropPaths: string[] = Array.isArray(rawFunctionPropPaths)\n ? [...new Set(rawFunctionPropPaths.filter((path: unknown): path is string => typeof path === 'string' && path.length > 0))]\n : []\n delete (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n\n const rawResolvedSetData = allowFunctionProps === true\n ? {\n ...(setData ?? {}),\n includeFunctions: true,\n functionPaths: functionPropPaths,\n }\n : allowFunctionProps === false\n ? setData\n : functionPropPaths.length\n ? {\n ...(setData ?? {}),\n functionPaths: functionPropPaths,\n }\n : setData\n const resolvedSetData = resolveScopedSlotHostSetData(mpOptions, rawResolvedSetData)\n const setupFunctionPropKeys = new Set(\n functionPropPaths\n .filter(path => !path.includes('.')),\n )\n\n const normalizedMpOptions = normalizeProps(mpOptions, props, mpOptions.properties)\n const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods)\n const resolvedData = typeof data === 'function'\n ? () => data.call(initialDataContext)\n : data\n\n const hasOptionsApiContext = injectOptions != null || provideOptions != null\n const setupWrapper = typeof setup === 'function' || hasOptionsApiContext || cssModules\n ? ((props, ctx) => {\n if (cssModules && typeof cssModules === 'object') {\n ;((ctx as any).instance as Record<string, any>)[WEVU_CSS_MODULES_KEY] = cssModules\n }\n const publicInstance = (ctx as any)?.proxy ?? (ctx as any)?.instance ?? Object.create(null)\n const injected = resolveOptionsApiInjections(injectOptions, publicInstance)\n if (provideOptions != null) {\n applyOptionsApiProvide(provideOptions, publicInstance)\n }\n const setupResult = typeof setup === 'function'\n ? runSetupFunction(setup as any, props as Record<string, any>, ctx as any) as Record<string, any> | void\n : undefined\n const result = mergeSetupResultDescriptors({\n ...injected,\n ...(cssModules ?? {}),\n }, setupResult)\n if (ctx && Object.keys(result).length) {\n applySetupResult((ctx as any).runtime, (ctx as any).instance, result, {\n includeFunctionsInState: allowFunctionProps === true,\n functionPropPaths: allowFunctionProps === false ? undefined : setupFunctionPropKeys,\n })\n }\n return result\n }) satisfies DefineComponentOptions<ComponentPropsOptions, any, any, any, any>['setup']\n : undefined\n\n const nativeData = typeof resolvedData === 'function'\n ? resolvedData()\n : resolvedData\n const nativeOwnerId = nativeData && typeof nativeData === 'object'\n ? Reflect.get(nativeData, WEVU_SLOT_OWNER_ID_KEY)\n : undefined\n const shouldDeclareOwnerId = shouldDeclareNativeSlotOwnerId(resolvedSetData, bindingManifest)\n const scopedSlotHooks = shouldDeclareOwnerId\n ? requireRuntimeCapability('scopedSlots', 'defineComponent(scoped-slot owner metadata)')\n : undefined\n const seededNativeData = shouldDeclareOwnerId\n ? {\n ...(nativeData && typeof nativeData === 'object' ? nativeData : {}),\n [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions)\n ? nativeOwnerId || scopedSlotHooks?.allocateOwnerId()\n : nativeOwnerId || '',\n }\n : nativeData\n const nativeInitialData = resolveNativeInitialData(seededNativeData, computed as ComputedDefinitions, resolvedSetData, methods as Record<string, any> | undefined)\n const mpOptionsWithProps = nativeInitialData !== undefined\n ? {\n ...normalizedMpOptions,\n data: nativeInitialData,\n }\n : normalizedMpOptions\n\n const componentOptions: RuntimeComponentDefinitionOptions = {\n scopedSlotOwnerRequired: scopedSlotOwnerRequired === true,\n data: resolvedData as () => Record<string, any>,\n computed: computed as ComputedDefinitions,\n methods: methods as MethodDefinitions,\n setData: resolvedSetData,\n bindingManifest,\n watch,\n setup: setupWrapper,\n mpOptions: mpOptionsWithProps as MiniProgramComponentRawOptions,\n }\n\n const definition = materializeComponentDefinition(componentOptions, registerNative)\n\n return definition as unknown as WevuComponentConstructor<\n ResolveProps<ComponentPropsOptions>,\n Record<string, any>,\n Record<string, any>,\n ComputedDefinitions,\n MethodDefinitions\n > & ComponentDefinition<any, any, any>\n}\n\n/**\n * 创建不触发宿主全局注册的 Wevu 组件定义。\n *\n * @param options 组件选项\n * @internal\n */\nexport function createWevuComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n) {\n return createComponentDefinition(options, false)\n}\n\n/**\n * 从现有组件定义派生拥有独立应用上下文的组件定义。\n *\n * @param definition 已解析的 Wevu 组件定义\n * @internal\n */\nexport function createIsolatedWevuComponentDefinition(definition: object) {\n const componentOptions = (definition as ComponentDefinition<any, any, any>).__wevu_options\n if (!componentOptions) {\n throw new TypeError('无法从非 Wevu 组件定义创建独立运行时')\n }\n return materializeComponentDefinition(componentOptions)\n}\n\n/**\n * 获取组件定义对应的宿主生命周期定义。\n *\n * @param definition Wevu 组件定义\n * @internal\n */\nexport function getWevuComponentLifecycleDefinition(definition: object) {\n return componentLifecycleDefinitions.get(definition)\n}\n\n/**\n * 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。\n *\n * @param options 组件选项,可能包含小程序特有的 properties\n * @internal\n */\nexport function createWevuComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n>(\n options: DefineComponentOptions<P, D, C, M> & { properties?: MiniProgramComponentPropertyOption },\n): void {\n const allowNullPropInput = options.allowNullPropInput ?? true\n defineComponent({\n ...options,\n allowNullPropInput,\n __wevu_allowNullPropInput: allowNullPropInput,\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,gDAAgC,IAAI,QAAqC;AAE/E,SAAS,0BAA0B,YAAqB,SAAwC;CAC9F,MAAM,UAAmC,EAAE,GAAI,WAAW,CAAC,EAAG;CAC9D,IAAI,CAAC,cAAc,OAAO,eAAe,UACvC,OAAO;CAET,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,UAAU,GACxD,IAAI,cAAc,OAAO,eAAe,YAAY,OAA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AAQ,IAAI,YAAY,sBAAsB,IAC9C;CACJ,MAAM,uBAAuB,+BAA+B,iBAAiB,eAAe;CAC5F,MAAM,kBAAkB,uBACpB,yBAAyB,eAAe,6CAA6C,IACrF;CACJ,MAAM,mBAAmB,uBACrB;EACE,GAAI,cAAc,OAAO,eAAe,WAAW,aAAa,CAAC;GAChE,yBAAyB,4BAA4B,SAAS,IAC3D,iBAAiB,iBAAiB,gBAAgB,IAClD,iBAAiB;CACvB,IACA;CACJ,MAAM,oBAAoB,yBAAyB,kBAAkB,UAAiC,iBAAiB,OAA0C;CACjK,MAAM,qBAAqB,sBAAsB,SAC7C;EACE,GAAG;EACH,MAAM;CACR,IACA;CAgBJ,OAFmB,+BAA+B;EAXhD,yBAAyB,4BAA4B;EACrD,MAAM;EACI;EACD;EACT,SAAS;EACT;EACA;EACA,OAAO;EACP,WAAW;CAGoD,GAAG,cAEpD;AAOlB;;;;;;;AAQA,SAAgB,8BACd,SACA;CACA,OAAO,0BAA0B,SAAS,KAAK;AACjD;;;;;;;AAQA,SAAgB,sCAAsC,YAAoB;CACxE,MAAM,mBAAoB,WAAkD;CAC5E,IAAI,CAAC,kBACH,MAAM,IAAI,UAAU,uBAAuB;CAE7C,OAAO,+BAA+B,gBAAgB;AACxD;;;;;;;AAQA,SAAgB,oCAAoC,YAAoB;CACtE,OAAO,8BAA8B,IAAI,UAAU;AACrD;;;;;;;AAQA,SAAgB,oBAMd,SACM;CACN,MAAM,qBAAqB,QAAQ,sBAAsB;CACzD,gBAAgB;EACd,GAAG;EACH;EACA,2BAA2B;CAC7B,CAAC;AACH"}
@@ -36,9 +36,8 @@ function toPlainInternal(value, seen, visiting, cache, cacheEligibility, depth,
36
36
  const raw = reactiveValue ? toRaw(unwrapped) : unwrapped;
37
37
  let canUseCache = Boolean(cache) && reactiveValue;
38
38
  if (cache && !canUseCache) {
39
- const cachedEligibility = cacheEligibility === null || cacheEligibility === void 0 ? void 0 : cacheEligibility.get(raw);
40
- canUseCache = cachedEligibility !== null && cachedEligibility !== void 0 ? cachedEligibility : !hasTrackableSetupBinding(raw);
41
- cacheEligibility === null || cacheEligibility === void 0 || cacheEligibility.set(raw, canUseCache);
39
+ canUseCache = cacheEligibility?.get(raw) ?? !hasTrackableSetupBinding(raw);
40
+ cacheEligibility?.set(raw, canUseCache);
42
41
  }
43
42
  const cacheRef = canUseCache ? cache : void 0;
44
43
  if (depth <= 0 || budget.keys <= 0) return raw;
@@ -125,11 +124,10 @@ function toPlainInternal(value, seen, visiting, cache, cacheEligibility, depth,
125
124
  return output;
126
125
  }
127
126
  function toPlain(value, seen = /* @__PURE__ */ new WeakMap(), options) {
128
- var _options$_depth, _options$_budget, _options$_path;
129
- const depth = (_options$_depth = options === null || options === void 0 ? void 0 : options._depth) !== null && _options$_depth !== void 0 ? _options$_depth : typeof (options === null || options === void 0 ? void 0 : options.maxDepth) === "number" ? Math.max(0, Math.floor(options.maxDepth)) : Number.POSITIVE_INFINITY;
130
- const budget = (_options$_budget = options === null || options === void 0 ? void 0 : options._budget) !== null && _options$_budget !== void 0 ? _options$_budget : typeof (options === null || options === void 0 ? void 0 : options.maxKeys) === "number" ? { keys: Math.max(0, Math.floor(options.maxKeys)) } : { keys: Number.POSITIVE_INFINITY };
131
- const functionPathSet = Array.isArray(options === null || options === void 0 ? void 0 : options.functionPaths) && options.functionPaths.length ? new Set(options.functionPaths) : void 0;
132
- return toPlainInternal(value, seen, /* @__PURE__ */ new WeakSet(), options === null || options === void 0 ? void 0 : options.cache, options === null || options === void 0 ? void 0 : options.cacheEligibility, depth, budget, Boolean(options === null || options === void 0 ? void 0 : options.includeFunctions), functionPathSet, (_options$_path = options === null || options === void 0 ? void 0 : options._path) !== null && _options$_path !== void 0 ? _options$_path : "");
127
+ const depth = options?._depth ?? (typeof options?.maxDepth === "number" ? Math.max(0, Math.floor(options.maxDepth)) : Number.POSITIVE_INFINITY);
128
+ const budget = options?._budget ?? (typeof options?.maxKeys === "number" ? { keys: Math.max(0, Math.floor(options.maxKeys)) } : { keys: Number.POSITIVE_INFINITY });
129
+ const functionPathSet = Array.isArray(options?.functionPaths) && options.functionPaths.length ? new Set(options.functionPaths) : void 0;
130
+ return toPlainInternal(value, seen, /* @__PURE__ */ new WeakSet(), options?.cache, options?.cacheEligibility, depth, budget, Boolean(options?.includeFunctions), functionPathSet, options?._path ?? "");
133
131
  }
134
132
  function isArrayEqual(a, b, compare) {
135
133
  if (a.length !== b.length) return false;
@@ -176,13 +174,13 @@ function assignNestedDiff(prev, next, path, output) {
176
174
  }
177
175
  function diffSnapshots(prev, next, options) {
178
176
  const diff = {};
179
- const skipKeys = options === null || options === void 0 ? void 0 : options.skipKeys;
177
+ const skipKeys = options?.skipKeys;
180
178
  for (const key of Object.keys(next)) {
181
- if (skipKeys === null || skipKeys === void 0 ? void 0 : skipKeys.has(key)) continue;
179
+ if (skipKeys?.has(key)) continue;
182
180
  assignNestedDiff(prev[key], next[key], key, diff);
183
181
  }
184
182
  for (const key of Object.keys(prev)) {
185
- if (skipKeys === null || skipKeys === void 0 ? void 0 : skipKeys.has(key)) continue;
183
+ if (skipKeys?.has(key)) continue;
186
184
  if (!hasOwn(next, key)) diff[key] = null;
187
185
  }
188
186
  return diff;
@@ -1 +1 @@
1
- {"version":3,"file":"diff.mjs","names":[],"sources":["../../../src/runtime/diff.ts"],"sourcesContent":["import { getReactiveVersion, isReactive, toRaw, unref } from '../reactivity'\nimport { hasOwn } from '../utils'\nimport { isNoSetData } from './noSetData'\nimport { hasTrackableSetupBinding } from './setupTracking'\n\nfunction isPlainObject(value: unknown): value is Record<string, any> {\n if (Object.prototype.toString.call(value) !== '[object Object]') {\n return false\n }\n const proto = Object.getPrototypeOf(value)\n return proto === null || proto === Object.prototype\n}\n\nexport interface ToPlainOptions {\n cache?: WeakMap<object, { version: number, value: any }>\n cacheEligibility?: WeakMap<object, boolean>\n maxDepth?: number\n maxKeys?: number\n includeFunctions?: boolean\n functionPaths?: string[]\n _depth?: number\n _budget?: { keys: number }\n _path?: string\n}\n\nfunction isAllowedFunctionPath(functionPathSet: Set<string> | undefined, currentPath: string) {\n if (!functionPathSet || !currentPath) {\n return false\n }\n let candidate = currentPath\n while (candidate) {\n if (functionPathSet.has(candidate)) {\n return true\n }\n const separatorIndex = candidate.lastIndexOf('.')\n if (separatorIndex < 0) {\n return false\n }\n candidate = candidate.slice(0, separatorIndex)\n }\n return false\n}\n\nfunction toPlainInternal(\n value: any,\n seen: WeakMap<object, any>,\n visiting: WeakSet<object>,\n cache: WeakMap<object, { version: number, value: any }> | undefined,\n cacheEligibility: WeakMap<object, boolean> | undefined,\n depth: number,\n budget: { keys: number },\n includeFunctions: boolean,\n functionPathSet: Set<string> | undefined,\n currentPath: string,\n): any {\n const unwrapped = unref(value)\n if (typeof unwrapped === 'bigint') {\n const asNumber = Number(unwrapped)\n return Number.isSafeInteger(asNumber) ? asNumber : unwrapped.toString()\n }\n if (typeof unwrapped === 'symbol') {\n return unwrapped.toString()\n }\n if (typeof unwrapped === 'function') {\n return includeFunctions || isAllowedFunctionPath(functionPathSet, currentPath) ? unwrapped : undefined\n }\n if (typeof unwrapped !== 'object' || unwrapped === null) {\n return unwrapped\n }\n if (isNoSetData(unwrapped)) {\n return undefined\n }\n const reactiveValue = isReactive(unwrapped)\n const raw = reactiveValue ? toRaw(unwrapped) : unwrapped\n let canUseCache = Boolean(cache) && reactiveValue\n if (cache && !canUseCache) {\n const cachedEligibility = cacheEligibility?.get(raw)\n canUseCache = cachedEligibility ?? !hasTrackableSetupBinding(raw)\n cacheEligibility?.set(raw, canUseCache)\n }\n const cacheRef = canUseCache ? cache : undefined\n\n if (depth <= 0 || budget.keys <= 0) {\n return raw\n }\n\n if (cacheRef) {\n const version = getReactiveVersion(raw as any)\n const cached = cacheRef.get(raw)\n if (cached && cached.version === version) {\n return cached.value\n }\n }\n\n if (visiting.has(raw)) {\n return undefined\n }\n if (seen.has(raw)) {\n return seen.get(raw)\n }\n if (raw instanceof Date) {\n return raw.getTime()\n }\n if (raw instanceof RegExp) {\n return raw.toString()\n }\n if (raw instanceof Map) {\n const entries: any[] = []\n seen.set(raw, entries)\n visiting.add(raw)\n raw.forEach((mapValue, mapKey) => {\n entries.push([\n toPlainInternal(mapKey, seen, visiting, undefined, undefined, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, undefined, ''),\n toPlainInternal(mapValue, seen, visiting, undefined, undefined, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, undefined, ''),\n ])\n })\n visiting.delete(raw)\n return entries\n }\n if (raw instanceof Set) {\n const values: any[] = []\n seen.set(raw, values)\n visiting.add(raw)\n raw.forEach((setValue) => {\n values.push(toPlainInternal(setValue, seen, visiting, undefined, undefined, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, undefined, ''))\n })\n visiting.delete(raw)\n return values\n }\n if (typeof ArrayBuffer !== 'undefined') {\n if (raw instanceof ArrayBuffer) {\n return raw.byteLength\n }\n if (ArrayBuffer.isView(raw)) {\n const view: any = raw as any\n const iter = view[Symbol.iterator]\n if (typeof iter === 'function') {\n const values = [...view]\n seen.set(raw, values)\n return values.map(item => toPlainInternal(item, seen, visiting, undefined, undefined, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, undefined, ''))\n }\n const bytes = [...new Uint8Array(view.buffer, view.byteOffset, view.byteLength)]\n seen.set(raw, bytes)\n return bytes\n }\n }\n if (raw instanceof Error) {\n return {\n name: raw.name,\n message: raw.message,\n }\n }\n if (Array.isArray(raw)) {\n const arr: any[] = []\n seen.set(raw, arr)\n visiting.add(raw)\n const nextDepth = depth - 1\n for (let index = 0; index < raw.length; index += 1) {\n const childPath = currentPath ? `${currentPath}.${index}` : String(index)\n const next = toPlainInternal(raw[index], seen, visiting, cache, cacheEligibility, nextDepth, budget, includeFunctions, functionPathSet, childPath)\n arr[index] = next === undefined ? null : next\n }\n visiting.delete(raw)\n if (cacheRef) {\n cacheRef.set(raw, { version: getReactiveVersion(raw as any), value: arr })\n }\n return arr\n }\n const output: Record<string, any> = {}\n seen.set(raw, output)\n visiting.add(raw)\n const nextDepth = depth - 1\n for (const key of Object.keys(raw)) {\n budget.keys -= 1\n if (budget.keys <= 0) {\n break\n }\n const childPath = currentPath ? `${currentPath}.${key}` : key\n const next = toPlainInternal((raw as any)[key], seen, visiting, cache, cacheEligibility, nextDepth, budget, includeFunctions, functionPathSet, childPath)\n if (next !== undefined) {\n output[key] = next\n }\n }\n visiting.delete(raw)\n if (cacheRef) {\n cacheRef.set(raw, { version: getReactiveVersion(raw as any), value: output })\n }\n return output\n}\n\nexport function toPlain(value: any, seen = new WeakMap<object, any>(), options?: ToPlainOptions): any {\n const depth = options?._depth ?? (typeof options?.maxDepth === 'number' ? Math.max(0, Math.floor(options.maxDepth)) : Number.POSITIVE_INFINITY)\n const budget = options?._budget ?? (typeof options?.maxKeys === 'number' ? { keys: Math.max(0, Math.floor(options.maxKeys)) } : { keys: Number.POSITIVE_INFINITY })\n const functionPathSet = Array.isArray(options?.functionPaths) && options.functionPaths.length\n ? new Set(options.functionPaths)\n : undefined\n return toPlainInternal(value, seen, new WeakSet(), options?.cache, options?.cacheEligibility, depth, budget, Boolean(options?.includeFunctions), functionPathSet, options?._path ?? '')\n}\n\ntype DeepEqualCompare = (a: any, b: any) => boolean\n\nfunction isArrayEqual(a: any[], b: any[], compare: DeepEqualCompare): boolean {\n if (a.length !== b.length) {\n return false\n }\n for (let i = 0; i < a.length; i++) {\n if (!compare(a[i], b[i])) {\n return false\n }\n }\n return true\n}\n\nfunction isPlainObjectEqual(a: Record<string, any>, b: Record<string, any>, compare: DeepEqualCompare): boolean {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length) {\n return false\n }\n for (const key of aKeys) {\n if (!hasOwn(b, key)) {\n return false\n }\n if (!compare(a[key], b[key])) {\n return false\n }\n }\n return true\n}\n\nfunction isDeepEqual(a: any, b: any): boolean {\n if (Object.is(a, b)) {\n return true\n }\n if (Array.isArray(a) && Array.isArray(b)) {\n return isArrayEqual(a, b, isDeepEqual)\n }\n if (isPlainObject(a) && isPlainObject(b)) {\n return isPlainObjectEqual(a, b, isDeepEqual)\n }\n return false\n}\n\nfunction normalizeSetDataValue<T>(value: T): T | null {\n return value === undefined ? null : value\n}\n\nfunction assignNestedDiff(\n prev: any,\n next: any,\n path: string,\n output: Record<string, any>,\n) {\n if (isDeepEqual(prev, next)) {\n return\n }\n\n if (isPlainObject(prev) && isPlainObject(next)) {\n for (const key of Object.keys(next)) {\n if (!hasOwn(prev, key)) {\n output[`${path}.${key}`] = normalizeSetDataValue(next[key])\n continue\n }\n assignNestedDiff(prev[key], next[key], `${path}.${key}`, output)\n }\n for (const key of Object.keys(prev)) {\n if (!hasOwn(next, key)) {\n output[`${path}.${key}`] = null\n }\n }\n return\n }\n\n if (Array.isArray(prev) && Array.isArray(next)) {\n if (!isArrayEqual(prev, next, isDeepEqual)) {\n output[path] = normalizeSetDataValue(next)\n }\n return\n }\n\n output[path] = normalizeSetDataValue(next)\n}\n\nexport function diffSnapshots(\n prev: Record<string, any>,\n next: Record<string, any>,\n options?: { skipKeys?: Set<string> },\n): Record<string, any> {\n const diff: Record<string, any> = {}\n const skipKeys = options?.skipKeys\n for (const key of Object.keys(next)) {\n if (skipKeys?.has(key)) {\n continue\n }\n assignNestedDiff(prev[key], next[key], key, diff)\n }\n for (const key of Object.keys(prev)) {\n if (skipKeys?.has(key)) {\n continue\n }\n if (!hasOwn(next, key)) {\n diff[key] = null\n }\n }\n return diff\n}\n"],"mappings":";;;;;;;;AAKA,SAAS,cAAc,OAA8C;CACnE,IAAI,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,mBAC5C,OAAO;CAET,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,OAAO,UAAU,QAAQ,UAAU,OAAO;AAC5C;AAcA,SAAS,sBAAsB,iBAA0C,aAAqB;CAC5F,IAAI,CAAC,mBAAmB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,IAAI,GAAG,GACnB;EAEF,IAAI,CAAC,OAAO,MAAM,GAAG,GACnB,KAAK,OAAO;CAEhB;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"diff.mjs","names":[],"sources":["../../../src/runtime/diff.ts"],"sourcesContent":["import { getReactiveVersion, isReactive, toRaw, unref } from '../reactivity'\nimport { hasOwn } from '../utils'\nimport { isNoSetData } from './noSetData'\nimport { hasTrackableSetupBinding } from './setupTracking'\n\nfunction isPlainObject(value: unknown): value is Record<string, any> {\n if (Object.prototype.toString.call(value) !== '[object Object]') {\n return false\n }\n const proto = Object.getPrototypeOf(value)\n return proto === null || proto === Object.prototype\n}\n\nexport interface ToPlainOptions {\n cache?: WeakMap<object, { version: number, value: any }>\n cacheEligibility?: WeakMap<object, boolean>\n maxDepth?: number\n maxKeys?: number\n includeFunctions?: boolean\n functionPaths?: string[]\n _depth?: number\n _budget?: { keys: number }\n _path?: string\n}\n\nfunction isAllowedFunctionPath(functionPathSet: Set<string> | undefined, currentPath: string) {\n if (!functionPathSet || !currentPath) {\n return false\n }\n let candidate = currentPath\n while (candidate) {\n if (functionPathSet.has(candidate)) {\n return true\n }\n const separatorIndex = candidate.lastIndexOf('.')\n if (separatorIndex < 0) {\n return false\n }\n candidate = candidate.slice(0, separatorIndex)\n }\n return false\n}\n\nfunction toPlainInternal(\n value: any,\n seen: WeakMap<object, any>,\n visiting: WeakSet<object>,\n cache: WeakMap<object, { version: number, value: any }> | undefined,\n cacheEligibility: WeakMap<object, boolean> | undefined,\n depth: number,\n budget: { keys: number },\n includeFunctions: boolean,\n functionPathSet: Set<string> | undefined,\n currentPath: string,\n): any {\n const unwrapped = unref(value)\n if (typeof unwrapped === 'bigint') {\n const asNumber = Number(unwrapped)\n return Number.isSafeInteger(asNumber) ? asNumber : unwrapped.toString()\n }\n if (typeof unwrapped === 'symbol') {\n return unwrapped.toString()\n }\n if (typeof unwrapped === 'function') {\n return includeFunctions || isAllowedFunctionPath(functionPathSet, currentPath) ? unwrapped : undefined\n }\n if (typeof unwrapped !== 'object' || unwrapped === null) {\n return unwrapped\n }\n if (isNoSetData(unwrapped)) {\n return undefined\n }\n const reactiveValue = isReactive(unwrapped)\n const raw = reactiveValue ? toRaw(unwrapped) : unwrapped\n let canUseCache = Boolean(cache) && reactiveValue\n if (cache && !canUseCache) {\n const cachedEligibility = cacheEligibility?.get(raw)\n canUseCache = cachedEligibility ?? !hasTrackableSetupBinding(raw)\n cacheEligibility?.set(raw, canUseCache)\n }\n const cacheRef = canUseCache ? cache : undefined\n\n if (depth <= 0 || budget.keys <= 0) {\n return raw\n }\n\n if (cacheRef) {\n const version = getReactiveVersion(raw as any)\n const cached = cacheRef.get(raw)\n if (cached && cached.version === version) {\n return cached.value\n }\n }\n\n if (visiting.has(raw)) {\n return undefined\n }\n if (seen.has(raw)) {\n return seen.get(raw)\n }\n if (raw instanceof Date) {\n return raw.getTime()\n }\n if (raw instanceof RegExp) {\n return raw.toString()\n }\n if (raw instanceof Map) {\n const entries: any[] = []\n seen.set(raw, entries)\n visiting.add(raw)\n raw.forEach((mapValue, mapKey) => {\n entries.push([\n toPlainInternal(mapKey, seen, visiting, undefined, undefined, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, undefined, ''),\n toPlainInternal(mapValue, seen, visiting, undefined, undefined, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, undefined, ''),\n ])\n })\n visiting.delete(raw)\n return entries\n }\n if (raw instanceof Set) {\n const values: any[] = []\n seen.set(raw, values)\n visiting.add(raw)\n raw.forEach((setValue) => {\n values.push(toPlainInternal(setValue, seen, visiting, undefined, undefined, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, undefined, ''))\n })\n visiting.delete(raw)\n return values\n }\n if (typeof ArrayBuffer !== 'undefined') {\n if (raw instanceof ArrayBuffer) {\n return raw.byteLength\n }\n if (ArrayBuffer.isView(raw)) {\n const view: any = raw as any\n const iter = view[Symbol.iterator]\n if (typeof iter === 'function') {\n const values = [...view]\n seen.set(raw, values)\n return values.map(item => toPlainInternal(item, seen, visiting, undefined, undefined, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, undefined, ''))\n }\n const bytes = [...new Uint8Array(view.buffer, view.byteOffset, view.byteLength)]\n seen.set(raw, bytes)\n return bytes\n }\n }\n if (raw instanceof Error) {\n return {\n name: raw.name,\n message: raw.message,\n }\n }\n if (Array.isArray(raw)) {\n const arr: any[] = []\n seen.set(raw, arr)\n visiting.add(raw)\n const nextDepth = depth - 1\n for (let index = 0; index < raw.length; index += 1) {\n const childPath = currentPath ? `${currentPath}.${index}` : String(index)\n const next = toPlainInternal(raw[index], seen, visiting, cache, cacheEligibility, nextDepth, budget, includeFunctions, functionPathSet, childPath)\n arr[index] = next === undefined ? null : next\n }\n visiting.delete(raw)\n if (cacheRef) {\n cacheRef.set(raw, { version: getReactiveVersion(raw as any), value: arr })\n }\n return arr\n }\n const output: Record<string, any> = {}\n seen.set(raw, output)\n visiting.add(raw)\n const nextDepth = depth - 1\n for (const key of Object.keys(raw)) {\n budget.keys -= 1\n if (budget.keys <= 0) {\n break\n }\n const childPath = currentPath ? `${currentPath}.${key}` : key\n const next = toPlainInternal((raw as any)[key], seen, visiting, cache, cacheEligibility, nextDepth, budget, includeFunctions, functionPathSet, childPath)\n if (next !== undefined) {\n output[key] = next\n }\n }\n visiting.delete(raw)\n if (cacheRef) {\n cacheRef.set(raw, { version: getReactiveVersion(raw as any), value: output })\n }\n return output\n}\n\nexport function toPlain(value: any, seen = new WeakMap<object, any>(), options?: ToPlainOptions): any {\n const depth = options?._depth ?? (typeof options?.maxDepth === 'number' ? Math.max(0, Math.floor(options.maxDepth)) : Number.POSITIVE_INFINITY)\n const budget = options?._budget ?? (typeof options?.maxKeys === 'number' ? { keys: Math.max(0, Math.floor(options.maxKeys)) } : { keys: Number.POSITIVE_INFINITY })\n const functionPathSet = Array.isArray(options?.functionPaths) && options.functionPaths.length\n ? new Set(options.functionPaths)\n : undefined\n return toPlainInternal(value, seen, new WeakSet(), options?.cache, options?.cacheEligibility, depth, budget, Boolean(options?.includeFunctions), functionPathSet, options?._path ?? '')\n}\n\ntype DeepEqualCompare = (a: any, b: any) => boolean\n\nfunction isArrayEqual(a: any[], b: any[], compare: DeepEqualCompare): boolean {\n if (a.length !== b.length) {\n return false\n }\n for (let i = 0; i < a.length; i++) {\n if (!compare(a[i], b[i])) {\n return false\n }\n }\n return true\n}\n\nfunction isPlainObjectEqual(a: Record<string, any>, b: Record<string, any>, compare: DeepEqualCompare): boolean {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length) {\n return false\n }\n for (const key of aKeys) {\n if (!hasOwn(b, key)) {\n return false\n }\n if (!compare(a[key], b[key])) {\n return false\n }\n }\n return true\n}\n\nfunction isDeepEqual(a: any, b: any): boolean {\n if (Object.is(a, b)) {\n return true\n }\n if (Array.isArray(a) && Array.isArray(b)) {\n return isArrayEqual(a, b, isDeepEqual)\n }\n if (isPlainObject(a) && isPlainObject(b)) {\n return isPlainObjectEqual(a, b, isDeepEqual)\n }\n return false\n}\n\nfunction normalizeSetDataValue<T>(value: T): T | null {\n return value === undefined ? null : value\n}\n\nfunction assignNestedDiff(\n prev: any,\n next: any,\n path: string,\n output: Record<string, any>,\n) {\n if (isDeepEqual(prev, next)) {\n return\n }\n\n if (isPlainObject(prev) && isPlainObject(next)) {\n for (const key of Object.keys(next)) {\n if (!hasOwn(prev, key)) {\n output[`${path}.${key}`] = normalizeSetDataValue(next[key])\n continue\n }\n assignNestedDiff(prev[key], next[key], `${path}.${key}`, output)\n }\n for (const key of Object.keys(prev)) {\n if (!hasOwn(next, key)) {\n output[`${path}.${key}`] = null\n }\n }\n return\n }\n\n if (Array.isArray(prev) && Array.isArray(next)) {\n if (!isArrayEqual(prev, next, isDeepEqual)) {\n output[path] = normalizeSetDataValue(next)\n }\n return\n }\n\n output[path] = normalizeSetDataValue(next)\n}\n\nexport function diffSnapshots(\n prev: Record<string, any>,\n next: Record<string, any>,\n options?: { skipKeys?: Set<string> },\n): Record<string, any> {\n const diff: Record<string, any> = {}\n const skipKeys = options?.skipKeys\n for (const key of Object.keys(next)) {\n if (skipKeys?.has(key)) {\n continue\n }\n assignNestedDiff(prev[key], next[key], key, diff)\n }\n for (const key of Object.keys(prev)) {\n if (skipKeys?.has(key)) {\n continue\n }\n if (!hasOwn(next, key)) {\n diff[key] = null\n }\n }\n return diff\n}\n"],"mappings":";;;;;;;;AAKA,SAAS,cAAc,OAA8C;CACnE,IAAI,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,mBAC5C,OAAO;CAET,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,OAAO,UAAU,QAAQ,UAAU,OAAO;AAC5C;AAcA,SAAS,sBAAsB,iBAA0C,aAAqB;CAC5F,IAAI,CAAC,mBAAmB,CAAC,aACvB,OAAO;CAET,IAAI,YAAY;CAChB,OAAO,WAAW;EAChB,IAAI,gBAAgB,IAAI,SAAS,GAC/B,OAAO;EAET,MAAM,iBAAiB,UAAU,YAAY,GAAG;EAChD,IAAI,iBAAiB,GACnB,OAAO;EAET,YAAY,UAAU,MAAM,GAAG,cAAc;CAC/C;CACA,OAAO;AACT;AAEA,SAAS,gBACP,OACA,MACA,UACA,OACA,kBACA,OACA,QACA,kBACA,iBACA,aACK;CACL,MAAM,YAAY,MAAM,KAAK;CAC7B,IAAI,OAAO,cAAc,UAAU;EACjC,MAAM,WAAW,OAAO,SAAS;EACjC,OAAO,OAAO,cAAc,QAAQ,IAAI,WAAW,UAAU,SAAS;CACxE;CACA,IAAI,OAAO,cAAc,UACvB,OAAO,UAAU,SAAS;CAE5B,IAAI,OAAO,cAAc,YACvB,OAAO,oBAAoB,sBAAsB,iBAAiB,WAAW,IAAI,YAAY;CAE/F,IAAI,OAAO,cAAc,YAAY,cAAc,MACjD,OAAO;CAET,IAAI,YAAY,SAAS,GACvB;CAEF,MA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,GACnB,OAAO,GAAG,KAAK,GAAG,SAAS;EAG/B;CACF;CAEA,IAAI,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,IAAI,GAAG;EAC9C,IAAI,CAAC,aAAa,MAAM,MAAM,WAAW,GACvC,OAAO,QAAQ,sBAAsB,IAAI;EAE3C;CACF;CAEA,OAAO,QAAQ,sBAAsB,IAAI;AAC3C;AAEA,SAAgB,cACd,MACA,MACA,SACqB;CACrB,MAAM,OAA4B,CAAC;CACnC,MAAM,WAAW,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG;EACnC,IAAI,UAAU,IAAI,GAAG,GACnB;EAEF,iBAAiB,KAAK,MAAM,KAAK,MAAM,KAAK,IAAI;CAClD;CACA,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG;EACnC,IAAI,UAAU,IAAI,GAAG,GACnB;EAEF,IAAI,CAAC,OAAO,MAAM,GAAG,GACnB,KAAK,OAAO;CAEhB;CACA,OAAO;AACT"}
@@ -35,7 +35,7 @@ function useDisposables() {
35
35
  if (disposed) {
36
36
  try {
37
37
  cleanup();
38
- } catch (_unused) {}
38
+ } catch {}
39
39
  return () => {};
40
40
  }
41
41
  cleanupSet.add(cleanup);
@@ -50,7 +50,7 @@ function useDisposables() {
50
50
  cleanupSet.clear();
51
51
  for (const cleanup of queue) try {
52
52
  cleanup();
53
- } catch (_unused2) {}
53
+ } catch {}
54
54
  };
55
55
  const bagSetTimeout = (handler, timeout, ...args) => {
56
56
  const timer = setTimeout(handler, timeout, ...args);
@@ -1 +1 @@
1
- {"version":3,"file":"disposables.mjs","names":[],"sources":["../../../src/runtime/disposables.ts"],"sourcesContent":["import { getCurrentInstance, onDetached, onUnload } from './hooks'\n\nexport type DisposableMethodName\n = | 'dispose'\n | 'abort'\n | 'cancel'\n | 'stop'\n | 'disconnect'\n | 'destroy'\n | 'close'\n\nexport type DisposableObject = Partial<Record<DisposableMethodName, () => void>>\nexport type DisposableLike = (() => void) | DisposableObject\n\nexport interface DisposableBag {\n /**\n * 注册一个清理项,返回“取消注册”函数(不会立即执行清理)。\n */\n add: (target: DisposableLike | null | undefined) => () => void\n /**\n * 立即执行并清空当前 bag 中的全部清理项(幂等)。\n */\n dispose: () => void\n /**\n * 注册 timeout,并在 bag dispose 时自动 clearTimeout。\n */\n setTimeout: (\n handler: (...args: any[]) => void,\n timeout?: number,\n ...args: any[]\n ) => ReturnType<typeof setTimeout>\n /**\n * 注册 interval,并在 bag dispose 时自动 clearInterval。\n */\n setInterval: (\n handler: (...args: any[]) => void,\n timeout?: number,\n ...args: any[]\n ) => ReturnType<typeof setInterval>\n}\n\nconst DISPOSABLE_METHODS: DisposableMethodName[] = [\n 'dispose',\n 'abort',\n 'cancel',\n 'stop',\n 'disconnect',\n 'destroy',\n 'close',\n]\n\nfunction resolveCleanup(target: DisposableLike | null | undefined): (() => void) | undefined {\n if (!target) {\n return undefined\n }\n if (typeof target === 'function') {\n return target\n }\n for (const methodName of DISPOSABLE_METHODS) {\n const candidate = target[methodName]\n if (typeof candidate === 'function') {\n return () => candidate.call(target)\n }\n }\n return undefined\n}\n\n/**\n * 在 setup() 中创建一个“清理袋”,统一管理副作用释放。\n *\n * 典型用法:注册定时器、请求任务、事件监听退订函数,\n * 在页面/组件卸载时自动批量清理,减少内存泄漏风险。\n */\nexport function useDisposables(): DisposableBag {\n if (!getCurrentInstance()) {\n throw new Error('useDisposables() 必须在 setup() 的同步阶段调用')\n }\n\n const cleanupSet = new Set<() => void>()\n let disposed = false\n\n const add: DisposableBag['add'] = (target) => {\n const cleanup = resolveCleanup(target)\n if (!cleanup) {\n return () => {}\n }\n\n if (disposed) {\n try {\n cleanup()\n }\n catch {\n // 忽略清理项自身异常,避免影响后续流程\n }\n return () => {}\n }\n\n cleanupSet.add(cleanup)\n return () => {\n cleanupSet.delete(cleanup)\n }\n }\n\n const dispose = () => {\n if (disposed) {\n return\n }\n disposed = true\n const queue = [...cleanupSet]\n cleanupSet.clear()\n for (const cleanup of queue) {\n try {\n cleanup()\n }\n catch {\n // 忽略单个清理项失败,保证其余清理继续执行\n }\n }\n }\n\n const bagSetTimeout: DisposableBag['setTimeout'] = (handler, timeout, ...args) => {\n const timer = setTimeout(handler, timeout, ...args)\n add(() => {\n clearTimeout(timer)\n })\n return timer\n }\n\n const bagSetInterval: DisposableBag['setInterval'] = (handler, timeout, ...args) => {\n const timer = setInterval(handler, timeout, ...args)\n add(() => {\n clearInterval(timer)\n })\n return timer\n }\n\n onUnload(dispose)\n onDetached(dispose)\n\n return {\n add,\n dispose,\n setTimeout: bagSetTimeout,\n setInterval: bagSetInterval,\n }\n}\n"],"mappings":";;;;AAyCA,MAAM,qBAA6C;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,eAAe,QAAqE;CAC3F,IAAI,CAAC,QACH;CAEF,IAAI,OAAO,WAAW,YACpB,OAAO;CAET,KAAK,MAAM,cAAc,oBAAoB;EAC3C,MAAM,YAAY,OAAO;EACzB,IAAI,OAAO,cAAc,YACvB,aAAa,UAAU,KAAK,MAAM;CAEtC;AAEF;;;;;;;AAQA,SAAgB,iBAAgC;CAC9C,IAAI,CAAC,mBAAmB,GACtB,MAAM,IAAI,MAAM,sCAAsC;CAGxD,MAAM,6BAAa,IAAI,IAAgB;CACvC,IAAI,WAAW;CAEf,MAAM,OAA6B,WAAW;EAC5C,MAAM,UAAU,eAAe,MAAM;EACrC,IAAI,CAAC,SACH,aAAa,CAAC;EAGhB,IAAI,UAAU;GACZ,IAAI;IACF,QAAQ;GACV,kBACM,CAEN;GACA,aAAa,CAAC;EAChB;EAEA,WAAW,IAAI,OAAO;EACtB,aAAa;GACX,WAAW,OAAO,OAAO;EAC3B;CACF;CAEA,MAAM,gBAAgB;EACpB,IAAI,UACF;EAEF,WAAW;EACX,MAAM,QAAQ,CAAC,GAAG,UAAU;EAC5B,WAAW,MAAM;EACjB,KAAK,MAAM,WAAW,OACpB,IAAI;GACF,QAAQ;EACV,mBACM,CAEN;CAEJ;CAEA,MAAM,iBAA8C,SAAS,SAAS,GAAG,SAAS;EAChF,MAAM,QAAQ,WAAW,SAAS,SAAS,GAAG,IAAI;EAClD,UAAU;GACR,aAAa,KAAK;EACpB,CAAC;EACD,OAAO;CACT;CAEA,MAAM,kBAAgD,SAAS,SAAS,GAAG,SAAS;EAClF,MAAM,QAAQ,YAAY,SAAS,SAAS,GAAG,IAAI;EACnD,UAAU;GACR,cAAc,KAAK;EACrB,CAAC;EACD,OAAO;CACT;CAEA,SAAS,OAAO;CAChB,WAAW,OAAO;CAElB,OAAO;EACL;EACA;EACA,YAAY;EACZ,aAAa;CACf;AACF"}
1
+ {"version":3,"file":"disposables.mjs","names":[],"sources":["../../../src/runtime/disposables.ts"],"sourcesContent":["import { getCurrentInstance, onDetached, onUnload } from './hooks'\n\nexport type DisposableMethodName\n = | 'dispose'\n | 'abort'\n | 'cancel'\n | 'stop'\n | 'disconnect'\n | 'destroy'\n | 'close'\n\nexport type DisposableObject = Partial<Record<DisposableMethodName, () => void>>\nexport type DisposableLike = (() => void) | DisposableObject\n\nexport interface DisposableBag {\n /**\n * 注册一个清理项,返回“取消注册”函数(不会立即执行清理)。\n */\n add: (target: DisposableLike | null | undefined) => () => void\n /**\n * 立即执行并清空当前 bag 中的全部清理项(幂等)。\n */\n dispose: () => void\n /**\n * 注册 timeout,并在 bag dispose 时自动 clearTimeout。\n */\n setTimeout: (\n handler: (...args: any[]) => void,\n timeout?: number,\n ...args: any[]\n ) => ReturnType<typeof setTimeout>\n /**\n * 注册 interval,并在 bag dispose 时自动 clearInterval。\n */\n setInterval: (\n handler: (...args: any[]) => void,\n timeout?: number,\n ...args: any[]\n ) => ReturnType<typeof setInterval>\n}\n\nconst DISPOSABLE_METHODS: DisposableMethodName[] = [\n 'dispose',\n 'abort',\n 'cancel',\n 'stop',\n 'disconnect',\n 'destroy',\n 'close',\n]\n\nfunction resolveCleanup(target: DisposableLike | null | undefined): (() => void) | undefined {\n if (!target) {\n return undefined\n }\n if (typeof target === 'function') {\n return target\n }\n for (const methodName of DISPOSABLE_METHODS) {\n const candidate = target[methodName]\n if (typeof candidate === 'function') {\n return () => candidate.call(target)\n }\n }\n return undefined\n}\n\n/**\n * 在 setup() 中创建一个“清理袋”,统一管理副作用释放。\n *\n * 典型用法:注册定时器、请求任务、事件监听退订函数,\n * 在页面/组件卸载时自动批量清理,减少内存泄漏风险。\n */\nexport function useDisposables(): DisposableBag {\n if (!getCurrentInstance()) {\n throw new Error('useDisposables() 必须在 setup() 的同步阶段调用')\n }\n\n const cleanupSet = new Set<() => void>()\n let disposed = false\n\n const add: DisposableBag['add'] = (target) => {\n const cleanup = resolveCleanup(target)\n if (!cleanup) {\n return () => {}\n }\n\n if (disposed) {\n try {\n cleanup()\n }\n catch {\n // 忽略清理项自身异常,避免影响后续流程\n }\n return () => {}\n }\n\n cleanupSet.add(cleanup)\n return () => {\n cleanupSet.delete(cleanup)\n }\n }\n\n const dispose = () => {\n if (disposed) {\n return\n }\n disposed = true\n const queue = [...cleanupSet]\n cleanupSet.clear()\n for (const cleanup of queue) {\n try {\n cleanup()\n }\n catch {\n // 忽略单个清理项失败,保证其余清理继续执行\n }\n }\n }\n\n const bagSetTimeout: DisposableBag['setTimeout'] = (handler, timeout, ...args) => {\n const timer = setTimeout(handler, timeout, ...args)\n add(() => {\n clearTimeout(timer)\n })\n return timer\n }\n\n const bagSetInterval: DisposableBag['setInterval'] = (handler, timeout, ...args) => {\n const timer = setInterval(handler, timeout, ...args)\n add(() => {\n clearInterval(timer)\n })\n return timer\n }\n\n onUnload(dispose)\n onDetached(dispose)\n\n return {\n add,\n dispose,\n setTimeout: bagSetTimeout,\n setInterval: bagSetInterval,\n }\n}\n"],"mappings":";;;;AAyCA,MAAM,qBAA6C;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,eAAe,QAAqE;CAC3F,IAAI,CAAC,QACH;CAEF,IAAI,OAAO,WAAW,YACpB,OAAO;CAET,KAAK,MAAM,cAAc,oBAAoB;EAC3C,MAAM,YAAY,OAAO;EACzB,IAAI,OAAO,cAAc,YACvB,aAAa,UAAU,KAAK,MAAM;CAEtC;AAEF;;;;;;;AAQA,SAAgB,iBAAgC;CAC9C,IAAI,CAAC,mBAAmB,GACtB,MAAM,IAAI,MAAM,sCAAsC;CAGxD,MAAM,6BAAa,IAAI,IAAgB;CACvC,IAAI,WAAW;CAEf,MAAM,OAA6B,WAAW;EAC5C,MAAM,UAAU,eAAe,MAAM;EACrC,IAAI,CAAC,SACH,aAAa,CAAC;EAGhB,IAAI,UAAU;GACZ,IAAI;IACF,QAAQ;GACV,QACM,CAEN;GACA,aAAa,CAAC;EAChB;EAEA,WAAW,IAAI,OAAO;EACtB,aAAa;GACX,WAAW,OAAO,OAAO;EAC3B;CACF;CAEA,MAAM,gBAAgB;EACpB,IAAI,UACF;EAEF,WAAW;EACX,MAAM,QAAQ,CAAC,GAAG,UAAU;EAC5B,WAAW,MAAM;EACjB,KAAK,MAAM,WAAW,OACpB,IAAI;GACF,QAAQ;EACV,QACM,CAEN;CAEJ;CAEA,MAAM,iBAA8C,SAAS,SAAS,GAAG,SAAS;EAChF,MAAM,QAAQ,WAAW,SAAS,SAAS,GAAG,IAAI;EAClD,UAAU;GACR,aAAa,KAAK;EACpB,CAAC;EACD,OAAO;CACT;CAEA,MAAM,kBAAgD,SAAS,SAAS,GAAG,SAAS;EAClF,MAAM,QAAQ,YAAY,SAAS,SAAS,GAAG,IAAI;EACnD,UAAU;GACR,cAAc,KAAK;EACrB,CAAC;EACD,OAAO;CACT;CAEA,SAAS,OAAO;CAChB,WAAW,OAAO;CAElB,OAAO;EACL;EACA;EACA,YAAY;EACZ,aAAa;CACf;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { toValue } from "../reactivity/ref.mjs";
2
- import { getCurrentMiniProgramRuntimeCapabilities, getMiniProgramGlobalObject, supportsCurrentMiniProgramRuntimeCapability } from "./platform.mjs";
2
+ import { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabilities } from "./platform/current.mjs";
3
+ import { supportsCurrentMiniProgramRuntimeCapability } from "./platform.mjs";
3
4
  import { getCurrentInstance, getCurrentSetupContext } from "./hooks/base.mjs";
4
5
  import { onDetached, onUnload } from "./hooks/register.mjs";
5
6
  import { onMounted, onUnmounted } from "./hooks/vue.mjs";
@@ -11,55 +12,46 @@ function createObserverFromContext(context, options) {
11
12
  const creator = nativeContext.createIntersectionObserver;
12
13
  if (typeof creator === "function") return creator.call(nativeContext, options);
13
14
  if (!supportsCurrentMiniProgramRuntimeCapability("globalCreateIntersectionObserver")) return;
14
- const miniProgramGlobal = getMiniProgramGlobalObject();
15
- const globalCreator = miniProgramGlobal === null || miniProgramGlobal === void 0 ? void 0 : miniProgramGlobal.createIntersectionObserver;
15
+ const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
16
+ const globalCreator = miniProgramGlobal?.createIntersectionObserver;
16
17
  if (typeof globalCreator !== "function") return;
17
18
  return getCurrentMiniProgramRuntimeCapabilities().intersectionObserverScopeByParameter ? globalCreator.call(miniProgramGlobal, context, options) : globalCreator.call(miniProgramGlobal, options);
18
19
  }
19
20
  function applyRelativeToViewport(observer, relativeToViewport) {
20
- var _observer$relativeToV;
21
21
  if (relativeToViewport === false || typeof observer.relativeToViewport !== "function") return observer;
22
22
  const margins = relativeToViewport && typeof relativeToViewport === "object" ? relativeToViewport : void 0;
23
- return (_observer$relativeToV = observer.relativeToViewport(margins)) !== null && _observer$relativeToV !== void 0 ? _observer$relativeToV : observer;
23
+ return observer.relativeToViewport(margins) ?? observer;
24
24
  }
25
25
  /**
26
26
  * 观察当前组件或页面内的节点可见性,并在卸载时自动断开。
27
27
  */
28
28
  function useElementIntersectionObserver(options) {
29
- var _options$context;
30
- const context = (_options$context = options.context) !== null && _options$context !== void 0 ? _options$context : getCurrentInstance();
29
+ const context = options.context ?? getCurrentInstance();
31
30
  if (!context || !getCurrentSetupContext()) throw new Error("useElementIntersectionObserver() 必须在 setup() 的同步阶段调用");
32
31
  let observer = null;
33
32
  const disconnect = () => {
34
33
  if (!observer) return;
35
34
  try {
36
35
  observer.disconnect();
37
- } catch (_unused) {}
36
+ } catch {}
38
37
  observer = null;
39
38
  };
40
39
  const observe = () => {
41
- var _options$observerOpti, _options$relativeToVi;
42
40
  disconnect();
43
41
  const selector = toValue(options.selector);
44
42
  if (!(options.enabled == null ? true : toValue(options.enabled)) || !selector) return null;
45
- const nextObserver = createObserverFromContext(context, toValue((_options$observerOpti = options.observerOptions) !== null && _options$observerOpti !== void 0 ? _options$observerOpti : {}));
43
+ const nextObserver = createObserverFromContext(context, toValue(options.observerOptions ?? {}));
46
44
  if (!nextObserver || typeof nextObserver.observe !== "function") return null;
47
- observer = applyRelativeToViewport(nextObserver, (_options$relativeToVi = options.relativeToViewport) !== null && _options$relativeToVi !== void 0 ? _options$relativeToVi : true);
48
- observer.observe(selector, (result) => {
49
- var _options$onObserve;
50
- return (_options$onObserve = options.onObserve) === null || _options$onObserve === void 0 ? void 0 : _options$onObserve.call(options, result);
51
- });
45
+ observer = applyRelativeToViewport(nextObserver, options.relativeToViewport ?? true);
46
+ observer.observe(selector, (result) => options.onObserve?.(result));
52
47
  return observer;
53
48
  };
54
- watch(() => {
55
- var _options$observerOpti2;
56
- return [
57
- toValue(options.selector),
58
- options.enabled == null ? true : toValue(options.enabled),
59
- toValue((_options$observerOpti2 = options.observerOptions) !== null && _options$observerOpti2 !== void 0 ? _options$observerOpti2 : {}),
60
- options.relativeToViewport
61
- ];
62
- }, () => {
49
+ watch(() => [
50
+ toValue(options.selector),
51
+ options.enabled == null ? true : toValue(options.enabled),
52
+ toValue(options.observerOptions ?? {}),
53
+ options.relativeToViewport
54
+ ], () => {
63
55
  observe();
64
56
  }, { deep: true });
65
57
  onMounted(observe);
@@ -1 +1 @@
1
- {"version":3,"file":"elementIntersectionObserver.mjs","names":[],"sources":["../../../src/runtime/elementIntersectionObserver.ts"],"sourcesContent":["import type { MaybeRefOrGetter } from '../reactivity'\nimport type {\n InternalRuntimeState,\n MiniProgramIntersectionObserver,\n MiniProgramIntersectionObserverOptions,\n} from './types'\nimport { toValue, watch } from '../reactivity'\nimport { getCurrentInstance, getCurrentSetupContext, onDetached, onMounted, onUnload, onUnmounted } from './hooks'\nimport { getCurrentMiniProgramRuntimeCapabilities, getMiniProgramGlobalObject, supportsCurrentMiniProgramRuntimeCapability } from './platform'\n\nexport type ElementIntersectionObserverCallback<T = unknown> = (result: T) => void\n\nexport interface UseElementIntersectionObserverOptions<T = unknown> {\n context?: InternalRuntimeState | null\n enabled?: MaybeRefOrGetter<boolean>\n observerOptions?: MaybeRefOrGetter<MiniProgramIntersectionObserverOptions>\n onObserve?: ElementIntersectionObserverCallback<T>\n relativeToViewport?: boolean | Record<string, number>\n selector: MaybeRefOrGetter<string | null | undefined>\n}\n\nexport interface UseElementIntersectionObserverReturn {\n disconnect: () => void\n observe: () => MiniProgramIntersectionObserver | null\n readonly observer: MiniProgramIntersectionObserver | null\n}\n\nfunction createObserverFromContext(\n context: InternalRuntimeState,\n options: MiniProgramIntersectionObserverOptions,\n) {\n const nativeContext = context as Record<string, any>\n const creator = nativeContext.createIntersectionObserver\n if (typeof creator === 'function') {\n return creator.call(nativeContext, options) as MiniProgramIntersectionObserver | undefined\n }\n\n if (!supportsCurrentMiniProgramRuntimeCapability('globalCreateIntersectionObserver')) {\n return undefined\n }\n\n const miniProgramGlobal = getMiniProgramGlobalObject()\n const globalCreator = miniProgramGlobal?.createIntersectionObserver\n if (typeof globalCreator !== 'function') {\n return undefined\n }\n\n return getCurrentMiniProgramRuntimeCapabilities().intersectionObserverScopeByParameter\n ? globalCreator.call(miniProgramGlobal, context, options)\n : globalCreator.call(miniProgramGlobal, options)\n}\n\nfunction applyRelativeToViewport(\n observer: MiniProgramIntersectionObserver,\n relativeToViewport: UseElementIntersectionObserverOptions['relativeToViewport'],\n) {\n if (relativeToViewport === false || typeof observer.relativeToViewport !== 'function') {\n return observer\n }\n const margins = relativeToViewport && typeof relativeToViewport === 'object'\n ? relativeToViewport\n : undefined\n return observer.relativeToViewport(margins as any) ?? observer\n}\n\n/**\n * 观察当前组件或页面内的节点可见性,并在卸载时自动断开。\n */\nexport function useElementIntersectionObserver<T = unknown>(\n options: UseElementIntersectionObserverOptions<T>,\n): UseElementIntersectionObserverReturn {\n const context = options.context ?? getCurrentInstance<InternalRuntimeState>()\n if (!context || !getCurrentSetupContext()) {\n throw new Error('useElementIntersectionObserver() 必须在 setup() 的同步阶段调用')\n }\n\n let observer: MiniProgramIntersectionObserver | null = null\n\n const disconnect = () => {\n if (!observer) {\n return\n }\n try {\n observer.disconnect()\n }\n catch {\n // 忽略平台差异导致的断开异常,避免影响页面卸载流程\n }\n observer = null\n }\n\n const observe = () => {\n disconnect()\n\n const selector = toValue(options.selector)\n const enabled = options.enabled == null ? true : toValue(options.enabled)\n if (!enabled || !selector) {\n return null\n }\n\n const nextObserver = createObserverFromContext(\n context,\n toValue(options.observerOptions ?? {}),\n )\n if (!nextObserver || typeof nextObserver.observe !== 'function') {\n return null\n }\n\n observer = applyRelativeToViewport(\n nextObserver,\n options.relativeToViewport ?? true,\n )\n observer.observe(selector, result => options.onObserve?.(result as T))\n return observer\n }\n\n watch(\n () => [\n toValue(options.selector),\n options.enabled == null ? true : toValue(options.enabled),\n toValue(options.observerOptions ?? {}),\n options.relativeToViewport,\n ],\n () => {\n observe()\n },\n {\n deep: true,\n },\n )\n\n onMounted(observe)\n onUnmounted(disconnect)\n onUnload(disconnect)\n onDetached(disconnect)\n\n return {\n disconnect,\n observe,\n get observer() {\n return observer\n },\n }\n}\n"],"mappings":";;;;;;;;AA2BA,SAAS,0BACP,SACA,SACA;CACA,MAAM,gBAAgB;CACtB,MAAM,UAAU,cAAc;CAC9B,IAAI,OAAO,YAAY,YACrB,OAAO,QAAQ,KAAK,eAAe,OAAO;CAG5C,IAAI,CAAC,4CAA4C,kCAAkC,GACjF;CAGF,MAAM,oBAAoB,2BAA2B;CACrD,MAAM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;CAEA,UAAU,OAAO;CACjB,YAAY,UAAU;CACtB,SAAS,UAAU;CACnB,WAAW,UAAU;CAErB,OAAO;EACL;EACA;EACA,IAAI,WAAW;GACb,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"elementIntersectionObserver.mjs","names":[],"sources":["../../../src/runtime/elementIntersectionObserver.ts"],"sourcesContent":["import type { MaybeRefOrGetter } from '../reactivity'\nimport type {\n InternalRuntimeState,\n MiniProgramIntersectionObserver,\n MiniProgramIntersectionObserverOptions,\n} from './types'\nimport { toValue, watch } from '../reactivity'\nimport { getCurrentInstance, getCurrentSetupContext, onDetached, onMounted, onUnload, onUnmounted } from './hooks'\nimport { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabilities, supportsCurrentMiniProgramRuntimeCapability } from './platform'\n\nexport type ElementIntersectionObserverCallback<T = unknown> = (result: T) => void\n\nexport interface UseElementIntersectionObserverOptions<T = unknown> {\n context?: InternalRuntimeState | null\n enabled?: MaybeRefOrGetter<boolean>\n observerOptions?: MaybeRefOrGetter<MiniProgramIntersectionObserverOptions>\n onObserve?: ElementIntersectionObserverCallback<T>\n relativeToViewport?: boolean | Record<string, number>\n selector: MaybeRefOrGetter<string | null | undefined>\n}\n\nexport interface UseElementIntersectionObserverReturn {\n disconnect: () => void\n observe: () => MiniProgramIntersectionObserver | null\n readonly observer: MiniProgramIntersectionObserver | null\n}\n\nfunction createObserverFromContext(\n context: InternalRuntimeState,\n options: MiniProgramIntersectionObserverOptions,\n) {\n const nativeContext = context as Record<string, any>\n const creator = nativeContext.createIntersectionObserver\n if (typeof creator === 'function') {\n return creator.call(nativeContext, options) as MiniProgramIntersectionObserver | undefined\n }\n\n if (!supportsCurrentMiniProgramRuntimeCapability('globalCreateIntersectionObserver')) {\n return undefined\n }\n\n const miniProgramGlobal = getCurrentMiniProgramGlobalObject()\n const globalCreator = miniProgramGlobal?.createIntersectionObserver\n if (typeof globalCreator !== 'function') {\n return undefined\n }\n\n return getCurrentMiniProgramRuntimeCapabilities().intersectionObserverScopeByParameter\n ? globalCreator.call(miniProgramGlobal, context, options)\n : globalCreator.call(miniProgramGlobal, options)\n}\n\nfunction applyRelativeToViewport(\n observer: MiniProgramIntersectionObserver,\n relativeToViewport: UseElementIntersectionObserverOptions['relativeToViewport'],\n) {\n if (relativeToViewport === false || typeof observer.relativeToViewport !== 'function') {\n return observer\n }\n const margins = relativeToViewport && typeof relativeToViewport === 'object'\n ? relativeToViewport\n : undefined\n return observer.relativeToViewport(margins as any) ?? observer\n}\n\n/**\n * 观察当前组件或页面内的节点可见性,并在卸载时自动断开。\n */\nexport function useElementIntersectionObserver<T = unknown>(\n options: UseElementIntersectionObserverOptions<T>,\n): UseElementIntersectionObserverReturn {\n const context = options.context ?? getCurrentInstance<InternalRuntimeState>()\n if (!context || !getCurrentSetupContext()) {\n throw new Error('useElementIntersectionObserver() 必须在 setup() 的同步阶段调用')\n }\n\n let observer: MiniProgramIntersectionObserver | null = null\n\n const disconnect = () => {\n if (!observer) {\n return\n }\n try {\n observer.disconnect()\n }\n catch {\n // 忽略平台差异导致的断开异常,避免影响页面卸载流程\n }\n observer = null\n }\n\n const observe = () => {\n disconnect()\n\n const selector = toValue(options.selector)\n const enabled = options.enabled == null ? true : toValue(options.enabled)\n if (!enabled || !selector) {\n return null\n }\n\n const nextObserver = createObserverFromContext(\n context,\n toValue(options.observerOptions ?? {}),\n )\n if (!nextObserver || typeof nextObserver.observe !== 'function') {\n return null\n }\n\n observer = applyRelativeToViewport(\n nextObserver,\n options.relativeToViewport ?? true,\n )\n observer.observe(selector, result => options.onObserve?.(result as T))\n return observer\n }\n\n watch(\n () => [\n toValue(options.selector),\n options.enabled == null ? true : toValue(options.enabled),\n toValue(options.observerOptions ?? {}),\n options.relativeToViewport,\n ],\n () => {\n observe()\n },\n {\n deep: true,\n },\n )\n\n onMounted(observe)\n onUnmounted(disconnect)\n onUnload(disconnect)\n onDetached(disconnect)\n\n return {\n disconnect,\n observe,\n get observer() {\n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,YAAY,MAAW,CAAC;EACrE,OAAO;CACT;CAEA,YACQ;EACJ,QAAQ,QAAQ,QAAQ;EACxB,QAAQ,WAAW,OAAO,OAAO,QAAQ,QAAQ,OAAO;EACxD,QAAQ,QAAQ,mBAAmB,CAAC,CAAC;EACrC,QAAQ;CACV,SACM;EACJ,QAAQ;CACV,GACA,EACE,MAAM,KACR,CACF;CAEA,UAAU,OAAO;CACjB,YAAY,UAAU;CACtB,SAAS,UAAU;CACnB,WAAW,UAAU;CAErB,OAAO;EACL;EACA;EACA,IAAI,WAAW;GACb,OAAO;EACT;CACF;AACF"}
@@ -5,10 +5,9 @@ import { WEVU_INLINE_MAP_KEY } from "@weapp-core/constants";
5
5
  //#region src/runtime/features/inlineEvents.ts
6
6
  const inlineEventHooks = {
7
7
  handler(event) {
8
- var _runtime$proxy, _runtime$methods;
9
8
  const runtime = this.__wevu;
10
- const context = (_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : this;
11
- const inlineMap = runtime === null || runtime === void 0 || (_runtime$methods = runtime.methods) === null || _runtime$methods === void 0 ? void 0 : _runtime$methods[WEVU_INLINE_MAP_KEY];
9
+ const context = runtime?.proxy ?? this;
10
+ const inlineMap = runtime?.methods?.[WEVU_INLINE_MAP_KEY];
12
11
  return runInlineExpression(context, void 0, event, inlineMap && typeof inlineMap === "object" && !Array.isArray(inlineMap) ? inlineMap : void 0);
13
12
  },
14
13
  run: runInlineExpression
@@ -1 +1 @@
1
- {"version":3,"file":"inlineEvents.mjs","names":[],"sources":["../../../../src/runtime/features/inlineEvents.ts"],"sourcesContent":["import type { RuntimeCapabilityRegistry } from '../capabilities'\nimport type { InlineExpressionMap } from '../register/inline'\nimport type { InternalRuntimeState } from '../types'\nimport { WEVU_INLINE_MAP_KEY } from '@weapp-core/constants'\nimport { registerRuntimeCapability } from '../capabilities'\nimport { runInlineExpression } from '../register/inline'\n\nconst inlineEventHooks: NonNullable<RuntimeCapabilityRegistry['inlineEvents']> = {\n handler(this: InternalRuntimeState, event: unknown) {\n const runtime = this.__wevu\n const context = runtime?.proxy ?? this\n const inlineMap = runtime?.methods?.[WEVU_INLINE_MAP_KEY] as unknown\n return runInlineExpression(\n context,\n undefined,\n event,\n inlineMap && typeof inlineMap === 'object' && !Array.isArray(inlineMap)\n ? inlineMap as InlineExpressionMap\n : undefined,\n )\n },\n run: runInlineExpression,\n}\n\n/**\n * 安装模板内联事件能力。\n */\nexport function installInlineEvents(): void {\n registerRuntimeCapability('inlineEvents', inlineEventHooks)\n}\n"],"mappings":";;;;;AAOA,MAAM,mBAA2E;CAC/E,QAAoC,OAAgB;;EAClD,MAAM,UAAU,KAAK;EACrB,MAAM,8EAAU,QAAS,gEAAS;EAClC,MAAM,0EAAY,QAAS,6EAAU;EACrC,OAAO,oBACL,SACA,QACA,OACA,aAAa,OAAO,cAAc,YAAY,CAAC,MAAM,QAAQ,SAAS,IAClE,YACA,MACN;CACF;CACA,KAAK;AACP;;;;AAKA,SAAgB,sBAA4B;CAC1C,0BAA0B,gBAAgB,gBAAgB;AAC5D"}
1
+ {"version":3,"file":"inlineEvents.mjs","names":[],"sources":["../../../../src/runtime/features/inlineEvents.ts"],"sourcesContent":["import type { RuntimeCapabilityRegistry } from '../capabilities'\nimport type { InlineExpressionMap } from '../register/inline'\nimport type { InternalRuntimeState } from '../types'\nimport { WEVU_INLINE_MAP_KEY } from '@weapp-core/constants'\nimport { registerRuntimeCapability } from '../capabilities'\nimport { runInlineExpression } from '../register/inline'\n\nconst inlineEventHooks: NonNullable<RuntimeCapabilityRegistry['inlineEvents']> = {\n handler(this: InternalRuntimeState, event: unknown) {\n const runtime = this.__wevu\n const context = runtime?.proxy ?? this\n const inlineMap = runtime?.methods?.[WEVU_INLINE_MAP_KEY] as unknown\n return runInlineExpression(\n context,\n undefined,\n event,\n inlineMap && typeof inlineMap === 'object' && !Array.isArray(inlineMap)\n ? inlineMap as InlineExpressionMap\n : undefined,\n )\n },\n run: runInlineExpression,\n}\n\n/**\n * 安装模板内联事件能力。\n */\nexport function installInlineEvents(): void {\n registerRuntimeCapability('inlineEvents', inlineEventHooks)\n}\n"],"mappings":";;;;;AAOA,MAAM,mBAA2E;CAC/E,QAAoC,OAAgB;EAClD,MAAM,UAAU,KAAK;EACrB,MAAM,UAAU,SAAS,SAAS;EAClC,MAAM,YAAY,SAAS,UAAU;EACrC,OAAO,oBACL,SACA,QACA,OACA,aAAa,OAAO,cAAc,YAAY,CAAC,MAAM,QAAQ,SAAS,IAClE,YACA,MACN;CACF;CACA,KAAK;AACP;;;;AAKA,SAAgB,sBAA4B;CAC1C,0BAA0B,gBAAgB,gBAAgB;AAC5D"}
@@ -0,0 +1,7 @@
1
+ //#region src/runtime/features/jsxIslands.d.ts
2
+ /**
3
+ * 安装 JSX 动态岛的宿主事件入口,纯模板组件无需携带分发实现。
4
+ */
5
+ export declare function installJsxIslands(): void;
6
+ //#endregion
7
+ //# sourceMappingURL=jsxIslands.d.mts.map
@@ -0,0 +1,20 @@
1
+ import { registerRuntimeCapability } from "../capabilities.mjs";
2
+ import { runJsxIslandHandler } from "../jsxIsland.mjs";
3
+ import { WEVU_JSX_ISLAND_HANDLER } from "@weapp-core/constants";
4
+
5
+ //#region src/runtime/features/jsxIslands.ts
6
+ const jsxIslandHooks = { attachMethods(methods) {
7
+ if (!methods[WEVU_JSX_ISLAND_HANDLER]) methods[WEVU_JSX_ISLAND_HANDLER] = function(event) {
8
+ return runJsxIslandHandler(this, event);
9
+ };
10
+ } };
11
+ /**
12
+ * 安装 JSX 动态岛的宿主事件入口,纯模板组件无需携带分发实现。
13
+ */
14
+ function installJsxIslands() {
15
+ registerRuntimeCapability("jsxIslands", jsxIslandHooks);
16
+ }
17
+
18
+ //#endregion
19
+ export { installJsxIslands };
20
+ //# sourceMappingURL=jsxIslands.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsxIslands.mjs","names":[],"sources":["../../../../src/runtime/features/jsxIslands.ts"],"sourcesContent":["import type { RuntimeCapabilityRegistry } from '../capabilities'\nimport type { InternalRuntimeState } from '../types'\nimport { WEVU_JSX_ISLAND_HANDLER } from '@weapp-core/constants'\nimport { registerRuntimeCapability } from '../capabilities'\nimport { runJsxIslandHandler } from '../jsxIsland'\n\nconst jsxIslandHooks: NonNullable<RuntimeCapabilityRegistry['jsxIslands']> = {\n attachMethods(methods) {\n if (!methods[WEVU_JSX_ISLAND_HANDLER]) {\n methods[WEVU_JSX_ISLAND_HANDLER] = function (this: InternalRuntimeState, event: unknown) {\n return runJsxIslandHandler(this, event)\n }\n }\n },\n}\n\n/**\n * 安装 JSX 动态岛的宿主事件入口,纯模板组件无需携带分发实现。\n */\nexport function installJsxIslands(): void {\n registerRuntimeCapability('jsxIslands', jsxIslandHooks)\n}\n"],"mappings":";;;;;AAMA,MAAM,iBAAuE,EAC3E,cAAc,SAAS;CACrB,IAAI,CAAC,QAAQ,0BACX,QAAQ,2BAA2B,SAAsC,OAAgB;EACvF,OAAO,oBAAoB,MAAM,KAAK;CACxC;AAEJ,EACF;;;;AAKA,SAAgB,oBAA0B;CACxC,0BAA0B,cAAc,cAAc;AACxD"}
@@ -9,11 +9,10 @@ import { WEVU_LAYOUT_HOST_BRIDGE_KEY, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOU
9
9
  const layoutHooks = {
10
10
  attachPageSetter(target) {
11
11
  target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
12
- var _target$__wevu;
13
- const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
12
+ const runtimeState = target.__wevu?.state;
14
13
  if (!runtimeState || typeof runtimeState !== "object") return;
15
14
  runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout);
16
- const nextProps = layout === false ? {} : props !== null && props !== void 0 ? props : {};
15
+ const nextProps = layout === false ? {} : props ?? {};
17
16
  runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps;
18
17
  syncRuntimePageLayoutState(target, layout, nextProps);
19
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"layout.mjs","names":[],"sources":["../../../../src/runtime/features/layout.ts"],"sourcesContent":["import type { RuntimeCapabilityRegistry } from '../capabilities'\nimport type { InternalRuntimeState } from '../types'\nimport {\n WEVU_LAYOUT_HOST_BRIDGE_KEY,\n WEVU_PAGE_LAYOUT_NAME_KEY,\n WEVU_PAGE_LAYOUT_PROPS_KEY,\n WEVU_PAGE_LAYOUT_SETTER_KEY,\n} from '@weapp-core/constants'\nimport { registerRuntimeCapability } from '../capabilities'\nimport { registerRuntimeLayoutHosts, unregisterRuntimeLayoutHosts } from '../layoutBridge'\nimport { resolveRuntimePageLayoutName, syncRuntimePageLayoutState } from '../pageLayout'\nimport { runTeardownSteps } from '../teardown'\nimport { installTemplateRefs } from './templateRefs'\n\nconst layoutHooks: NonNullable<RuntimeCapabilityRegistry['layout']> = {\n attachPageSetter(target) {\n target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout: string | false, props?: object) => {\n const runtimeState = target.__wevu?.state as Record<string, unknown> | undefined\n if (!runtimeState || typeof runtimeState !== 'object') {\n return\n }\n runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout)\n const nextProps = layout === false ? {} : (props ?? {})\n runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps\n syncRuntimePageLayoutState(target as InternalRuntimeState & Record<string, unknown>, layout, nextProps)\n }\n },\n attachHosts(bindings, target) {\n if (!bindings.length || target[WEVU_LAYOUT_HOST_BRIDGE_KEY]) {\n return\n }\n const bridge = registerRuntimeLayoutHosts(bindings, target)\n if (bridge) {\n target[WEVU_LAYOUT_HOST_BRIDGE_KEY] = bridge\n }\n },\n detachHosts(bindings, target) {\n const bridge = target[WEVU_LAYOUT_HOST_BRIDGE_KEY]\n if (!bindings.length || !bridge) {\n return\n }\n runTeardownSteps([\n () => unregisterRuntimeLayoutHosts(bindings, bridge),\n () => {\n delete target[WEVU_LAYOUT_HOST_BRIDGE_KEY]\n },\n ])\n },\n}\n\n/**\n * 安装 layout 能力,并直接安装其模板 ref 依赖。\n */\nexport function installLayout(): void {\n installTemplateRefs()\n registerRuntimeCapability('layout', layoutHooks)\n}\n"],"mappings":";;;;;;;;AAcA,MAAM,cAAgE;CACpE,iBAAiB,QAAQ;EACvB,OAAO,gCAAgC,QAAwB,UAAmB;;GAChF,MAAM,iCAAe,OAAO,wEAAQ;GACpC,IAAI,CAAC,gBAAgB,OAAO,iBAAiB,UAC3C;GAEF,aAAa,6BAA6B,6BAA6B,MAAM;GAC7E,MAAM,YAAY,WAAW,QAAQ,CAAC,IAAK,6CAAS,CAAC;GACrD,aAAa,8BAA8B;GAC3C,2BAA2B,QAA0D,QAAQ,SAAS;EACxG;CACF;CACA,YAAY,UAAU,QAAQ;EAC5B,IAAI,CAAC,SAAS,UAAU,OAAO,8BAC7B;EAEF,MAAM,SAAS,2BAA2B,UAAU,MAAM;EAC1D,IAAI,QACF,OAAO,+BAA+B;CAE1C;CACA,YAAY,UAAU,QAAQ;EAC5B,MAAM,SAAS,OAAO;EACtB,IAAI,CAAC,SAAS,UAAU,CAAC,QACvB;EAEF,iBAAiB,OACT,6BAA6B,UAAU,MAAM,SAC7C;GACJ,OAAO,OAAO;EAChB,CACF,CAAC;CACH;AACF;;;;AAKA,SAAgB,gBAAsB;CACpC,oBAAoB;CACpB,0BAA0B,UAAU,WAAW;AACjD"}
1
+ {"version":3,"file":"layout.mjs","names":[],"sources":["../../../../src/runtime/features/layout.ts"],"sourcesContent":["import type { RuntimeCapabilityRegistry } from '../capabilities'\nimport type { InternalRuntimeState } from '../types'\nimport {\n WEVU_LAYOUT_HOST_BRIDGE_KEY,\n WEVU_PAGE_LAYOUT_NAME_KEY,\n WEVU_PAGE_LAYOUT_PROPS_KEY,\n WEVU_PAGE_LAYOUT_SETTER_KEY,\n} from '@weapp-core/constants'\nimport { registerRuntimeCapability } from '../capabilities'\nimport { registerRuntimeLayoutHosts, unregisterRuntimeLayoutHosts } from '../layoutBridge'\nimport { resolveRuntimePageLayoutName, syncRuntimePageLayoutState } from '../pageLayout'\nimport { runTeardownSteps } from '../teardown'\nimport { installTemplateRefs } from './templateRefs'\n\nconst layoutHooks: NonNullable<RuntimeCapabilityRegistry['layout']> = {\n attachPageSetter(target) {\n target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout: string | false, props?: object) => {\n const runtimeState = target.__wevu?.state as Record<string, unknown> | undefined\n if (!runtimeState || typeof runtimeState !== 'object') {\n return\n }\n runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout)\n const nextProps = layout === false ? {} : (props ?? {})\n runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps\n syncRuntimePageLayoutState(target as InternalRuntimeState & Record<string, unknown>, layout, nextProps)\n }\n },\n attachHosts(bindings, target) {\n if (!bindings.length || target[WEVU_LAYOUT_HOST_BRIDGE_KEY]) {\n return\n }\n const bridge = registerRuntimeLayoutHosts(bindings, target)\n if (bridge) {\n target[WEVU_LAYOUT_HOST_BRIDGE_KEY] = bridge\n }\n },\n detachHosts(bindings, target) {\n const bridge = target[WEVU_LAYOUT_HOST_BRIDGE_KEY]\n if (!bindings.length || !bridge) {\n return\n }\n runTeardownSteps([\n () => unregisterRuntimeLayoutHosts(bindings, bridge),\n () => {\n delete target[WEVU_LAYOUT_HOST_BRIDGE_KEY]\n },\n ])\n },\n}\n\n/**\n * 安装 layout 能力,并直接安装其模板 ref 依赖。\n */\nexport function installLayout(): void {\n installTemplateRefs()\n registerRuntimeCapability('layout', layoutHooks)\n}\n"],"mappings":";;;;;;;;AAcA,MAAM,cAAgE;CACpE,iBAAiB,QAAQ;EACvB,OAAO,gCAAgC,QAAwB,UAAmB;GAChF,MAAM,eAAe,OAAO,QAAQ;GACpC,IAAI,CAAC,gBAAgB,OAAO,iBAAiB,UAC3C;GAEF,aAAa,6BAA6B,6BAA6B,MAAM;GAC7E,MAAM,YAAY,WAAW,QAAQ,CAAC,IAAK,SAAS,CAAC;GACrD,aAAa,8BAA8B;GAC3C,2BAA2B,QAA0D,QAAQ,SAAS;EACxG;CACF;CACA,YAAY,UAAU,QAAQ;EAC5B,IAAI,CAAC,SAAS,UAAU,OAAO,8BAC7B;EAEF,MAAM,SAAS,2BAA2B,UAAU,MAAM;EAC1D,IAAI,QACF,OAAO,+BAA+B;CAE1C;CACA,YAAY,UAAU,QAAQ;EAC5B,MAAM,SAAS,OAAO;EACtB,IAAI,CAAC,SAAS,UAAU,CAAC,QACvB;EAEF,iBAAiB,OACT,6BAA6B,UAAU,MAAM,SAC7C;GACJ,OAAO,OAAO;EAChB,CACF,CAAC;CACH;AACF;;;;AAKA,SAAgB,gBAAsB;CACpC,oBAAoB;CACpB,0BAA0B,UAAU,WAAW;AACjD"}
@@ -48,15 +48,11 @@ const usePageLayout = (...args) => {
48
48
  return usePageLayout$1(...args);
49
49
  };
50
50
  function setPageLayout(layout, props) {
51
- var _getCurrentPageInstan;
52
51
  installLayout();
53
52
  const pages = getCurrentMiniProgramPages();
54
53
  const currentInstance = getCurrentInstance();
55
- const currentTarget = currentInstance && typeof currentInstance.route === "string" && currentInstance.route ? currentInstance : (_getCurrentPageInstan = getCurrentPageInstance()) !== null && _getCurrentPageInstan !== void 0 ? _getCurrentPageInstan : pages[pages.length - 1];
56
- if (currentTarget) {
57
- var _runtimeCapabilityReg;
58
- (_runtimeCapabilityReg = runtimeCapabilityRegistry.layout) === null || _runtimeCapabilityReg === void 0 || _runtimeCapabilityReg.attachPageSetter(currentTarget);
59
- }
54
+ const currentTarget = currentInstance && typeof currentInstance.route === "string" && currentInstance.route ? currentInstance : getCurrentPageInstance() ?? pages[pages.length - 1];
55
+ if (currentTarget) runtimeCapabilityRegistry.layout?.attachPageSetter(currentTarget);
60
56
  if (layout === false) {
61
57
  setPageLayout$1(false);
62
58
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"publicLayout.mjs","names":["registerPageLayoutBridgeImplementation","unregisterPageLayoutBridgeImplementation","resolveLayoutBridgeImplementation","resolveLayoutHostImplementation","waitForLayoutHostImplementation","useLayoutBridgeImplementation","registerRuntimeLayoutHostsImplementation","unregisterRuntimeLayoutHostsImplementation","useLayoutHostsImplementation","usePageLayoutImplementation","syncRuntimePageLayoutStateImplementation","syncRuntimePageLayoutStateFromRuntimeImplementation","resolveRuntimePageLayoutNameImplementation"],"sources":["../../../../src/runtime/features/publicLayout.ts"],"sourcesContent":["import type { WevuPageLayoutMap } from '../pageLayout'\nimport type { InternalRuntimeState } from '../types'\nimport { runtimeCapabilityRegistry } from '../capabilities'\nimport { getCurrentInstance } from '../hooks'\nimport {\n registerPageLayoutBridge as registerPageLayoutBridgeImplementation,\n registerRuntimeLayoutHosts as registerRuntimeLayoutHostsImplementation,\n resolveLayoutBridge as resolveLayoutBridgeImplementation,\n resolveLayoutHost as resolveLayoutHostImplementation,\n unregisterPageLayoutBridge as unregisterPageLayoutBridgeImplementation,\n unregisterRuntimeLayoutHosts as unregisterRuntimeLayoutHostsImplementation,\n useLayoutBridge as useLayoutBridgeImplementation,\n useLayoutHosts as useLayoutHostsImplementation,\n waitForLayoutHost as waitForLayoutHostImplementation,\n} from '../layoutBridge'\nimport {\n resolveRuntimePageLayoutName as resolveRuntimePageLayoutNameImplementation,\n setPageLayout as setPageLayoutImplementation,\n syncRuntimePageLayoutStateFromRuntime as syncRuntimePageLayoutStateFromRuntimeImplementation,\n syncRuntimePageLayoutState as syncRuntimePageLayoutStateImplementation,\n usePageLayout as usePageLayoutImplementation,\n} from '../pageLayout'\nimport { getCurrentMiniProgramPages } from '../platform'\nimport { getCurrentPageInstance } from '../register/component/lifecycle/platform'\nimport { installLayout } from './layout'\n\nexport type { LayoutBridgeInstance, LayoutHostBinding } from '../layoutBridge'\nexport type { PageLayoutState, WevuPageLayoutMap } from '../pageLayout'\n\nexport const registerPageLayoutBridge: typeof registerPageLayoutBridgeImplementation = (...args) => {\n installLayout()\n return registerPageLayoutBridgeImplementation(...args)\n}\n\nexport const unregisterPageLayoutBridge: typeof unregisterPageLayoutBridgeImplementation = (...args) => {\n installLayout()\n return unregisterPageLayoutBridgeImplementation(...args)\n}\n\nexport const resolveLayoutBridge: typeof resolveLayoutBridgeImplementation = (...args) => {\n installLayout()\n return resolveLayoutBridgeImplementation(...args)\n}\n\nexport const resolveLayoutHost: typeof resolveLayoutHostImplementation = (...args) => {\n installLayout()\n return resolveLayoutHostImplementation(...args)\n}\n\nexport const waitForLayoutHost: typeof waitForLayoutHostImplementation = (...args) => {\n installLayout()\n return waitForLayoutHostImplementation(...args)\n}\n\nexport const useLayoutBridge: typeof useLayoutBridgeImplementation = (...args) => {\n installLayout()\n return useLayoutBridgeImplementation(...args)\n}\n\nexport const registerRuntimeLayoutHosts: typeof registerRuntimeLayoutHostsImplementation = (...args) => {\n installLayout()\n return registerRuntimeLayoutHostsImplementation(...args)\n}\n\nexport const unregisterRuntimeLayoutHosts: typeof unregisterRuntimeLayoutHostsImplementation = (...args) => {\n installLayout()\n return unregisterRuntimeLayoutHostsImplementation(...args)\n}\n\nexport const useLayoutHosts: typeof useLayoutHostsImplementation = (...args) => {\n installLayout()\n return useLayoutHostsImplementation(...args)\n}\n\nexport const usePageLayout: typeof usePageLayoutImplementation = (...args) => {\n installLayout()\n return usePageLayoutImplementation(...args)\n}\n\ntype PublicPageLayoutName = keyof WevuPageLayoutMap extends never\n ? string\n : Extract<keyof WevuPageLayoutMap, string>\ntype PublicPageLayoutProps<Name extends string> = Name extends keyof WevuPageLayoutMap\n ? WevuPageLayoutMap[Name]\n : object\n\nexport function setPageLayout(layout: false): void\nexport function setPageLayout<Name extends PublicPageLayoutName>(\n layout: Name,\n props?: PublicPageLayoutProps<Name>,\n): void\nexport function setPageLayout(layout: string | false, props?: object): void {\n installLayout()\n const pages = getCurrentMiniProgramPages()\n const currentInstance = getCurrentInstance()\n const currentTarget = currentInstance && typeof currentInstance.route === 'string' && currentInstance.route\n ? currentInstance\n : getCurrentPageInstance() ?? pages[pages.length - 1]\n if (currentTarget) {\n runtimeCapabilityRegistry.layout?.attachPageSetter(currentTarget as InternalRuntimeState)\n }\n if (layout === false) {\n setPageLayoutImplementation(false)\n return\n }\n setPageLayoutImplementation(layout, props)\n}\n\nexport const syncRuntimePageLayoutState: typeof syncRuntimePageLayoutStateImplementation = (...args) => {\n installLayout()\n return syncRuntimePageLayoutStateImplementation(...args)\n}\n\nexport const syncRuntimePageLayoutStateFromRuntime: typeof syncRuntimePageLayoutStateFromRuntimeImplementation = (...args) => {\n installLayout()\n return syncRuntimePageLayoutStateFromRuntimeImplementation(...args)\n}\n\nexport const resolveRuntimePageLayoutName: typeof resolveRuntimePageLayoutNameImplementation = (...args) => {\n installLayout()\n return resolveRuntimePageLayoutNameImplementation(...args)\n}\n"],"mappings":";;;;;;;;;AA6BA,MAAa,4BAA2E,GAAG,SAAS;CAClG,cAAc;CACd,OAAOA,2BAAuC,GAAG,IAAI;AACvD;AAEA,MAAa,8BAA+E,GAAG,SAAS;CACtG,cAAc;CACd,OAAOC,6BAAyC,GAAG,IAAI;AACzD;AAEA,MAAa,uBAAiE,GAAG,SAAS;CACxF,cAAc;CACd,OAAOC,sBAAkC,GAAG,IAAI;AAClD;AAEA,MAAa,qBAA6D,GAAG,SAAS;CACpF,cAAc;CACd,OAAOC,oBAAgC,GAAG,IAAI;AAChD;AAEA,MAAa,qBAA6D,GAAG,SAAS;CACpF,cAAc;CACd,OAAOC,oBAAgC,GAAG,IAAI;AAChD;AAEA,MAAa,mBAAyD,GAAG,SAAS;CAChF,cAAc;CACd,OAAOC,kBAA8B,GAAG,IAAI;AAC9C;AAEA,MAAa,8BAA+E,GAAG,SAAS;CACtG,cAAc;CACd,OAAOC,6BAAyC,GAAG,IAAI;AACzD;AAEA,MAAa,gCAAmF,GAAG,SAAS;CAC1G,cAAc;CACd,OAAOC,+BAA2C,GAAG,IAAI;AAC3D;AAEA,MAAa,kBAAuD,GAAG,SAAS;CAC9E,cAAc;CACd,OAAOC,iBAA6B,GAAG,IAAI;AAC7C;AAEA,MAAa,iBAAqD,GAAG,SAAS;CAC5E,cAAc;CACd,OAAOC,gBAA4B,GAAG,IAAI;AAC5C;AAcA,SAAgB,cAAc,QAAwB,OAAsB;;CAC1E,cAAc;CACd,MAAM,QAAQ,2BAA2B;CACzC,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,gBAAgB,mBAAmB,OAAO,gBAAgB,UAAU,YAAY,gBAAgB,QAClG,2CACA,uBAAuB,0EAAK,MAAM,MAAM,SAAS;CACrD,IAAI,eAAe;;EACjB,mDAA0B,8EAAQ,iBAAiB,aAAqC;CAC1F;CACA,IAAI,WAAW,OAAO;EACpB,gBAA4B,KAAK;EACjC;CACF;CACA,gBAA4B,QAAQ,KAAK;AAC3C;AAEA,MAAa,8BAA+E,GAAG,SAAS;CACtG,cAAc;CACd,OAAOC,6BAAyC,GAAG,IAAI;AACzD;AAEA,MAAa,yCAAqG,GAAG,SAAS;CAC5H,cAAc;CACd,OAAOC,wCAAoD,GAAG,IAAI;AACpE;AAEA,MAAa,gCAAmF,GAAG,SAAS;CAC1G,cAAc;CACd,OAAOC,+BAA2C,GAAG,IAAI;AAC3D"}
1
+ {"version":3,"file":"publicLayout.mjs","names":["registerPageLayoutBridgeImplementation","unregisterPageLayoutBridgeImplementation","resolveLayoutBridgeImplementation","resolveLayoutHostImplementation","waitForLayoutHostImplementation","useLayoutBridgeImplementation","registerRuntimeLayoutHostsImplementation","unregisterRuntimeLayoutHostsImplementation","useLayoutHostsImplementation","usePageLayoutImplementation","syncRuntimePageLayoutStateImplementation","syncRuntimePageLayoutStateFromRuntimeImplementation","resolveRuntimePageLayoutNameImplementation"],"sources":["../../../../src/runtime/features/publicLayout.ts"],"sourcesContent":["import type { WevuPageLayoutMap } from '../pageLayout'\nimport type { InternalRuntimeState } from '../types'\nimport { runtimeCapabilityRegistry } from '../capabilities'\nimport { getCurrentInstance } from '../hooks'\nimport {\n registerPageLayoutBridge as registerPageLayoutBridgeImplementation,\n registerRuntimeLayoutHosts as registerRuntimeLayoutHostsImplementation,\n resolveLayoutBridge as resolveLayoutBridgeImplementation,\n resolveLayoutHost as resolveLayoutHostImplementation,\n unregisterPageLayoutBridge as unregisterPageLayoutBridgeImplementation,\n unregisterRuntimeLayoutHosts as unregisterRuntimeLayoutHostsImplementation,\n useLayoutBridge as useLayoutBridgeImplementation,\n useLayoutHosts as useLayoutHostsImplementation,\n waitForLayoutHost as waitForLayoutHostImplementation,\n} from '../layoutBridge'\nimport {\n resolveRuntimePageLayoutName as resolveRuntimePageLayoutNameImplementation,\n setPageLayout as setPageLayoutImplementation,\n syncRuntimePageLayoutStateFromRuntime as syncRuntimePageLayoutStateFromRuntimeImplementation,\n syncRuntimePageLayoutState as syncRuntimePageLayoutStateImplementation,\n usePageLayout as usePageLayoutImplementation,\n} from '../pageLayout'\nimport { getCurrentMiniProgramPages } from '../platform'\nimport { getCurrentPageInstance } from '../register/component/lifecycle/platform'\nimport { installLayout } from './layout'\n\nexport type { LayoutBridgeInstance, LayoutHostBinding } from '../layoutBridge'\nexport type { PageLayoutState, WevuPageLayoutMap } from '../pageLayout'\n\nexport const registerPageLayoutBridge: typeof registerPageLayoutBridgeImplementation = (...args) => {\n installLayout()\n return registerPageLayoutBridgeImplementation(...args)\n}\n\nexport const unregisterPageLayoutBridge: typeof unregisterPageLayoutBridgeImplementation = (...args) => {\n installLayout()\n return unregisterPageLayoutBridgeImplementation(...args)\n}\n\nexport const resolveLayoutBridge: typeof resolveLayoutBridgeImplementation = (...args) => {\n installLayout()\n return resolveLayoutBridgeImplementation(...args)\n}\n\nexport const resolveLayoutHost: typeof resolveLayoutHostImplementation = (...args) => {\n installLayout()\n return resolveLayoutHostImplementation(...args)\n}\n\nexport const waitForLayoutHost: typeof waitForLayoutHostImplementation = (...args) => {\n installLayout()\n return waitForLayoutHostImplementation(...args)\n}\n\nexport const useLayoutBridge: typeof useLayoutBridgeImplementation = (...args) => {\n installLayout()\n return useLayoutBridgeImplementation(...args)\n}\n\nexport const registerRuntimeLayoutHosts: typeof registerRuntimeLayoutHostsImplementation = (...args) => {\n installLayout()\n return registerRuntimeLayoutHostsImplementation(...args)\n}\n\nexport const unregisterRuntimeLayoutHosts: typeof unregisterRuntimeLayoutHostsImplementation = (...args) => {\n installLayout()\n return unregisterRuntimeLayoutHostsImplementation(...args)\n}\n\nexport const useLayoutHosts: typeof useLayoutHostsImplementation = (...args) => {\n installLayout()\n return useLayoutHostsImplementation(...args)\n}\n\nexport const usePageLayout: typeof usePageLayoutImplementation = (...args) => {\n installLayout()\n return usePageLayoutImplementation(...args)\n}\n\ntype PublicPageLayoutName = keyof WevuPageLayoutMap extends never\n ? string\n : Extract<keyof WevuPageLayoutMap, string>\ntype PublicPageLayoutProps<Name extends string> = Name extends keyof WevuPageLayoutMap\n ? WevuPageLayoutMap[Name]\n : object\n\nexport function setPageLayout(layout: false): void\nexport function setPageLayout<Name extends PublicPageLayoutName>(\n layout: Name,\n props?: PublicPageLayoutProps<Name>,\n): void\nexport function setPageLayout(layout: string | false, props?: object): void {\n installLayout()\n const pages = getCurrentMiniProgramPages()\n const currentInstance = getCurrentInstance()\n const currentTarget = currentInstance && typeof currentInstance.route === 'string' && currentInstance.route\n ? currentInstance\n : getCurrentPageInstance() ?? pages[pages.length - 1]\n if (currentTarget) {\n runtimeCapabilityRegistry.layout?.attachPageSetter(currentTarget as InternalRuntimeState)\n }\n if (layout === false) {\n setPageLayoutImplementation(false)\n return\n }\n setPageLayoutImplementation(layout, props)\n}\n\nexport const syncRuntimePageLayoutState: typeof syncRuntimePageLayoutStateImplementation = (...args) => {\n installLayout()\n return syncRuntimePageLayoutStateImplementation(...args)\n}\n\nexport const syncRuntimePageLayoutStateFromRuntime: typeof syncRuntimePageLayoutStateFromRuntimeImplementation = (...args) => {\n installLayout()\n return syncRuntimePageLayoutStateFromRuntimeImplementation(...args)\n}\n\nexport const resolveRuntimePageLayoutName: typeof resolveRuntimePageLayoutNameImplementation = (...args) => {\n installLayout()\n return resolveRuntimePageLayoutNameImplementation(...args)\n}\n"],"mappings":";;;;;;;;;AA6BA,MAAa,4BAA2E,GAAG,SAAS;CAClG,cAAc;CACd,OAAOA,2BAAuC,GAAG,IAAI;AACvD;AAEA,MAAa,8BAA+E,GAAG,SAAS;CACtG,cAAc;CACd,OAAOC,6BAAyC,GAAG,IAAI;AACzD;AAEA,MAAa,uBAAiE,GAAG,SAAS;CACxF,cAAc;CACd,OAAOC,sBAAkC,GAAG,IAAI;AAClD;AAEA,MAAa,qBAA6D,GAAG,SAAS;CACpF,cAAc;CACd,OAAOC,oBAAgC,GAAG,IAAI;AAChD;AAEA,MAAa,qBAA6D,GAAG,SAAS;CACpF,cAAc;CACd,OAAOC,oBAAgC,GAAG,IAAI;AAChD;AAEA,MAAa,mBAAyD,GAAG,SAAS;CAChF,cAAc;CACd,OAAOC,kBAA8B,GAAG,IAAI;AAC9C;AAEA,MAAa,8BAA+E,GAAG,SAAS;CACtG,cAAc;CACd,OAAOC,6BAAyC,GAAG,IAAI;AACzD;AAEA,MAAa,gCAAmF,GAAG,SAAS;CAC1G,cAAc;CACd,OAAOC,+BAA2C,GAAG,IAAI;AAC3D;AAEA,MAAa,kBAAuD,GAAG,SAAS;CAC9E,cAAc;CACd,OAAOC,iBAA6B,GAAG,IAAI;AAC7C;AAEA,MAAa,iBAAqD,GAAG,SAAS;CAC5E,cAAc;CACd,OAAOC,gBAA4B,GAAG,IAAI;AAC5C;AAcA,SAAgB,cAAc,QAAwB,OAAsB;CAC1E,cAAc;CACd,MAAM,QAAQ,2BAA2B;CACzC,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,gBAAgB,mBAAmB,OAAO,gBAAgB,UAAU,YAAY,gBAAgB,QAClG,kBACA,uBAAuB,KAAK,MAAM,MAAM,SAAS;CACrD,IAAI,eACF,0BAA0B,QAAQ,iBAAiB,aAAqC;CAE1F,IAAI,WAAW,OAAO;EACpB,gBAA4B,KAAK;EACjC;CACF;CACA,gBAA4B,QAAQ,KAAK;AAC3C;AAEA,MAAa,8BAA+E,GAAG,SAAS;CACtG,cAAc;CACd,OAAOC,6BAAyC,GAAG,IAAI;AACzD;AAEA,MAAa,yCAAqG,GAAG,SAAS;CAC5H,cAAc;CACd,OAAOC,wCAAoD,GAAG,IAAI;AACpE;AAEA,MAAa,gCAAmF,GAAG,SAAS;CAC1G,cAAc;CACd,OAAOC,+BAA2C,GAAG,IAAI;AAC3D"}
@@ -10,10 +10,9 @@ import { WEVU_PROPS_KEY, WEVU_RUNTIME_OWNER_ID_KEY, WEVU_SCOPED_SLOT_CREATOR_KEY
10
10
  //#region src/runtime/features/scopedSlots.ts
11
11
  const scopedSlotHooks = {
12
12
  prepareMount(target) {
13
- var _target$data;
14
13
  const existing = getScopedSlotMountState(target);
15
14
  if (existing) return existing;
16
- const initialNativeOwnerId = (_target$data = target.data) === null || _target$data === void 0 ? void 0 : _target$data[WEVU_SLOT_OWNER_ID_KEY];
15
+ const initialNativeOwnerId = target.data?.[WEVU_SLOT_OWNER_ID_KEY];
17
16
  const ownerId = typeof initialNativeOwnerId === "string" && initialNativeOwnerId ? initialNativeOwnerId : allocateOwnerId();
18
17
  const state = {
19
18
  ownerId,
@@ -31,11 +30,10 @@ const scopedSlotHooks = {
31
30
  attachOwnerSnapshot(target, runtime, state.ownerId, { deferSnapshot });
32
31
  },
33
32
  refresh(target, state) {
34
- var _WEVU_PROPS_KEY;
35
33
  const runtime = target.__wevu;
36
34
  if (!runtime) return;
37
35
  const snapshot = resolveOwnerSnapshot(runtime);
38
- const propsSource = (_WEVU_PROPS_KEY = target[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : target.properties;
36
+ const propsSource = target[WEVU_PROPS_KEY] ?? target.properties;
39
37
  mergeOwnerSnapshotProps(snapshot, propsSource);
40
38
  updateOwnerSnapshot(state.ownerId, snapshot, runtime.proxy, target);
41
39
  },
@@ -43,15 +41,14 @@ const scopedSlotHooks = {
43
41
  if (!state.shouldFlushNativeOwnerId) return;
44
42
  try {
45
43
  if (target.data && typeof target.data === "object") target.data[WEVU_SLOT_OWNER_ID_KEY] = state.ownerId;
46
- } catch (_unused) {}
44
+ } catch {}
47
45
  const setData = resolveNativeSetData(target);
48
46
  if (setData) callNativeSetData(target, setData, { [WEVU_SLOT_OWNER_ID_KEY]: state.ownerId });
49
47
  },
50
48
  teardown(target) {
51
- var _ref, _state$ownerId;
52
49
  const state = getScopedSlotMountState(target);
53
50
  const scopedTarget = target;
54
- const ownerId = (_ref = (_state$ownerId = state === null || state === void 0 ? void 0 : state.ownerId) !== null && _state$ownerId !== void 0 ? _state$ownerId : scopedTarget[WEVU_RUNTIME_OWNER_ID_KEY]) !== null && _ref !== void 0 ? _ref : scopedTarget[WEVU_SLOT_OWNER_ID_KEY];
51
+ const ownerId = state?.ownerId ?? scopedTarget[WEVU_RUNTIME_OWNER_ID_KEY] ?? scopedTarget[WEVU_SLOT_OWNER_ID_KEY];
55
52
  runTeardownSteps([() => {
56
53
  if (typeof ownerId === "string" && ownerId) removeOwner(ownerId);
57
54
  }, () => {
@@ -59,9 +56,8 @@ const scopedSlotHooks = {
59
56
  }]);
60
57
  },
61
58
  resolveLifecycleProxy(target) {
62
- var _ref2, _ref3, _scopedTarget$WEVU_RU, _target$data2, _target$properties;
63
59
  const scopedTarget = target;
64
- const ownerId = (_ref2 = (_ref3 = (_scopedTarget$WEVU_RU = scopedTarget[WEVU_RUNTIME_OWNER_ID_KEY]) !== null && _scopedTarget$WEVU_RU !== void 0 ? _scopedTarget$WEVU_RU : scopedTarget[WEVU_SLOT_OWNER_ID_KEY]) !== null && _ref3 !== void 0 ? _ref3 : (_target$data2 = target.data) === null || _target$data2 === void 0 ? void 0 : _target$data2[WEVU_SLOT_OWNER_ID_KEY]) !== null && _ref2 !== void 0 ? _ref2 : (_target$properties = target.properties) === null || _target$properties === void 0 ? void 0 : _target$properties[WEVU_SLOT_OWNER_ID_KEY];
60
+ const ownerId = scopedTarget[WEVU_RUNTIME_OWNER_ID_KEY] ?? scopedTarget[WEVU_SLOT_OWNER_ID_KEY] ?? target.data?.[WEVU_SLOT_OWNER_ID_KEY] ?? target.properties?.[WEVU_SLOT_OWNER_ID_KEY];
65
61
  return typeof ownerId === "string" && ownerId ? getOwnerProxy(ownerId) : void 0;
66
62
  },
67
63
  allocateOwnerId