wevu 7.0.4 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/README.md +20 -4
  2. package/dist/alipay/jsx-runtime.d.mts +12 -0
  3. package/dist/alipay/jsx-runtime.mjs +1 -0
  4. package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/defineProperty.mjs +1 -1
  5. package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPrimitive.mjs +1 -1
  6. package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPropertyKey.mjs +1 -1
  7. package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/typeof.mjs +1 -1
  8. package/dist/dev/api/vitest/setup.d.mts +1 -0
  9. package/dist/dev/api/vitest.d.mts +1 -0
  10. package/dist/dev/api.d.mts +1 -0
  11. package/dist/dev/compiler.d.mts +1 -0
  12. package/dist/dev/fetch.d.mts +9 -0
  13. package/dist/dev/index.d.mts +72 -0
  14. package/dist/dev/index.mjs +12 -15
  15. package/dist/dev/internal-reactivity.d.mts +18 -0
  16. package/dist/dev/internal-reactivity.mjs +3 -2
  17. package/dist/dev/internal-runtime.d.mts +44 -0
  18. package/dist/dev/internal-runtime.mjs +19 -14
  19. package/dist/dev/internal-template.d.mts +2 -0
  20. package/dist/dev/jsxTypes.d.mts +9 -0
  21. package/dist/dev/macros/shared.d.mts +81 -0
  22. package/dist/dev/macros.d.mts +71 -0
  23. package/dist/dev/package.mjs +1 -1
  24. package/dist/dev/reactivity/asyncDerivation.d.mts +41 -0
  25. package/dist/dev/reactivity/asyncDerivation.mjs +130 -0
  26. package/dist/dev/reactivity/asyncDerivation.mjs.map +1 -0
  27. package/dist/dev/reactivity/computed.d.mts +21 -0
  28. package/dist/dev/reactivity/computed.mjs +2 -2
  29. package/dist/dev/reactivity/computed.mjs.map +1 -1
  30. package/dist/dev/reactivity/core.d.mts +35 -0
  31. package/dist/dev/reactivity/core.mjs +156 -32
  32. package/dist/dev/reactivity/core.mjs.map +1 -1
  33. package/dist/dev/reactivity/index.d.mts +16 -0
  34. package/dist/dev/reactivity/reactive/mutation.d.mts +21 -0
  35. package/dist/dev/reactivity/reactive/patch.d.mts +18 -0
  36. package/dist/dev/reactivity/reactive/shallow.d.mts +22 -0
  37. package/dist/dev/reactivity/reactive/shared.d.mts +4 -0
  38. package/dist/dev/reactivity/reactive.d.mts +42 -0
  39. package/dist/dev/reactivity/readonly.d.mts +27 -0
  40. package/dist/dev/reactivity/readonly.mjs.map +1 -1
  41. package/dist/dev/reactivity/ref.d.mts +27 -0
  42. package/dist/dev/reactivity/ref.mjs +1 -1
  43. package/dist/dev/reactivity/shallowRef.d.mts +19 -0
  44. package/dist/dev/reactivity/toRefs.d.mts +43 -0
  45. package/dist/dev/reactivity/traverse.d.mts +8 -0
  46. package/dist/dev/reactivity/watch/types.d.mts +43 -0
  47. package/dist/dev/reactivity/watch.d.mts +22 -0
  48. package/dist/dev/router/createRouter.d.mts +8 -0
  49. package/dist/dev/router/createRouter.mjs +16 -3
  50. package/dist/dev/router/createRouter.mjs.map +1 -1
  51. package/dist/dev/router/navigationCore.d.mts +6 -0
  52. package/dist/dev/router/resolve.d.mts +6 -0
  53. package/dist/dev/router/routeSync.d.mts +1 -0
  54. package/dist/dev/router/types.d.mts +172 -0
  55. package/dist/dev/router/useRoute.d.mts +19 -0
  56. package/dist/dev/router/useRoute.mjs +23 -5
  57. package/dist/dev/router/useRoute.mjs.map +1 -1
  58. package/dist/dev/router/useRouter.d.mts +8 -0
  59. package/dist/dev/router.d.mts +10 -0
  60. package/dist/dev/routerInternal/query.d.mts +7 -0
  61. package/dist/dev/routerInternal/types.d.mts +9 -0
  62. package/dist/dev/runtime/app/computed.mjs +2 -2
  63. package/dist/dev/runtime/app/computed.mjs.map +1 -1
  64. package/dist/dev/runtime/app/context.mjs +8 -2
  65. package/dist/dev/runtime/app/context.mjs.map +1 -1
  66. package/dist/dev/runtime/app/diagnostics.mjs +12 -0
  67. package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
  68. package/dist/dev/runtime/app/mount.mjs +31 -28
  69. package/dist/dev/runtime/app/mount.mjs.map +1 -1
  70. package/dist/dev/runtime/app/pending.d.mts +10 -0
  71. package/dist/dev/runtime/app/setData/commitTracker.d.mts +13 -0
  72. package/dist/dev/runtime/app/setData/commitTracker.mjs +265 -0
  73. package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -0
  74. package/dist/dev/runtime/app/setData/patchScheduler.mjs +47 -51
  75. package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -1
  76. package/dist/dev/runtime/app/setData/scheduler.d.mts +51 -0
  77. package/dist/dev/runtime/app/setData/scheduler.mjs +98 -111
  78. package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
  79. package/dist/dev/runtime/app/setData/snapshot.mjs +11 -1
  80. package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -1
  81. package/dist/dev/runtime/app.d.mts +8 -0
  82. package/dist/dev/runtime/app.mjs +18 -6
  83. package/dist/dev/runtime/app.mjs.map +1 -1
  84. package/dist/dev/runtime/bindingManifest.mjs +105 -0
  85. package/dist/dev/runtime/bindingManifest.mjs.map +1 -0
  86. package/dist/dev/runtime/capabilities.d.mts +75 -0
  87. package/dist/dev/runtime/capabilities.mjs +40 -0
  88. package/dist/dev/runtime/capabilities.mjs.map +1 -0
  89. package/dist/dev/runtime/css.d.mts +14 -0
  90. package/dist/dev/runtime/defaults.d.mts +12 -0
  91. package/dist/dev/runtime/define/componentDefinition.mjs +3 -0
  92. package/dist/dev/runtime/define/componentDefinition.mjs.map +1 -1
  93. package/dist/dev/runtime/define/optionsApi.mjs +1 -1
  94. package/dist/dev/runtime/define/props.mjs +30 -60
  95. package/dist/dev/runtime/define/props.mjs.map +1 -1
  96. package/dist/dev/runtime/define/scopedSlotOptions.mjs +37 -21
  97. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
  98. package/dist/dev/runtime/define.d.mts +118 -0
  99. package/dist/dev/runtime/define.mjs +32 -44
  100. package/dist/dev/runtime/define.mjs.map +1 -1
  101. package/dist/dev/runtime/diff.mjs +1 -1
  102. package/dist/dev/runtime/disposables.d.mts +31 -0
  103. package/dist/dev/runtime/elementIntersectionObserver.d.mts +26 -0
  104. package/dist/dev/runtime/features/inlineEvents.d.mts +7 -0
  105. package/dist/dev/runtime/features/inlineEvents.mjs +25 -0
  106. package/dist/dev/runtime/features/inlineEvents.mjs.map +1 -0
  107. package/dist/dev/runtime/features/layout.d.mts +7 -0
  108. package/dist/dev/runtime/features/layout.mjs +44 -0
  109. package/dist/dev/runtime/features/layout.mjs.map +1 -0
  110. package/dist/dev/runtime/features/patchStrategy.d.mts +7 -0
  111. package/dist/dev/runtime/features/patchStrategy.mjs +129 -0
  112. package/dist/dev/runtime/features/patchStrategy.mjs.map +1 -0
  113. package/dist/dev/runtime/features/publicLayout.d.mts +24 -0
  114. package/dist/dev/runtime/features/publicLayout.mjs +81 -0
  115. package/dist/dev/runtime/features/publicLayout.mjs.map +1 -0
  116. package/dist/dev/runtime/features/scopedSlots.d.mts +23 -0
  117. package/dist/dev/runtime/features/scopedSlots.mjs +88 -0
  118. package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -0
  119. package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +7 -0
  120. package/dist/dev/runtime/features/setDataHighFrequencyWarning.mjs +15 -0
  121. package/dist/dev/runtime/features/setDataHighFrequencyWarning.mjs.map +1 -0
  122. package/dist/dev/runtime/features/templateRefs.d.mts +7 -0
  123. package/dist/dev/runtime/features/templateRefs.mjs +39 -0
  124. package/dist/dev/runtime/features/templateRefs.mjs.map +1 -0
  125. package/dist/dev/runtime/hooks/base.d.mts +27 -0
  126. package/dist/dev/runtime/hooks/register.d.mts +30 -0
  127. package/dist/dev/runtime/hooks/vue.d.mts +52 -0
  128. package/dist/dev/runtime/hooks/vue.mjs +3 -5
  129. package/dist/dev/runtime/hooks/vue.mjs.map +1 -1
  130. package/dist/dev/runtime/hooks.d.mts +4 -0
  131. package/dist/dev/runtime/index.d.mts +46 -0
  132. package/dist/dev/runtime/inlineDataset.mjs +75 -0
  133. package/dist/dev/runtime/inlineDataset.mjs.map +1 -0
  134. package/dist/dev/runtime/intersectionObserver.d.mts +14 -0
  135. package/dist/dev/runtime/jsxIsland.d.mts +37 -0
  136. package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
  137. package/dist/dev/runtime/layoutBridge.d.mts +55 -0
  138. package/dist/dev/runtime/layoutBridge.mjs.map +1 -1
  139. package/dist/dev/runtime/noSetData.d.mts +5 -0
  140. package/dist/dev/runtime/pageEnvironment.d.mts +50 -0
  141. package/dist/dev/runtime/pageLayout.d.mts +25 -0
  142. package/dist/dev/runtime/pageLayout.mjs.map +1 -1
  143. package/dist/dev/runtime/pageScroll.d.mts +29 -0
  144. package/dist/dev/runtime/platform.mjs +18 -1
  145. package/dist/dev/runtime/platform.mjs.map +1 -1
  146. package/dist/dev/runtime/provide.d.mts +60 -0
  147. package/dist/dev/runtime/provideStore.d.mts +7 -0
  148. package/dist/dev/runtime/publicRuntime.d.mts +22 -0
  149. package/dist/dev/runtime/publicRuntime.mjs +91 -0
  150. package/dist/dev/runtime/publicRuntime.mjs.map +1 -0
  151. package/dist/dev/runtime/pullDownRefresh.d.mts +12 -0
  152. package/dist/dev/runtime/register/app.d.mts +14 -0
  153. package/dist/dev/runtime/register/app.mjs +7 -10
  154. package/dist/dev/runtime/register/app.mjs.map +1 -1
  155. package/dist/dev/runtime/register/component/lifecycle.mjs +22 -6
  156. package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
  157. package/dist/dev/runtime/register/component/methods.mjs +7 -10
  158. package/dist/dev/runtime/register/component/methods.mjs.map +1 -1
  159. package/dist/dev/runtime/register/component/options.mjs.map +1 -1
  160. package/dist/dev/runtime/register/component/registerDefinition.mjs +64 -69
  161. package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
  162. package/dist/dev/runtime/register/component.d.mts +17 -0
  163. package/dist/dev/runtime/register/inline.d.mts +15 -0
  164. package/dist/dev/runtime/register/inline.mjs +4 -64
  165. package/dist/dev/runtime/register/inline.mjs.map +1 -1
  166. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +1 -1
  167. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
  168. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +4 -6
  169. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
  170. package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +26 -0
  171. package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs.map +1 -0
  172. package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
  173. package/dist/dev/runtime/register/runtimeInstance.d.mts +26 -0
  174. package/dist/dev/runtime/register/runtimeInstance.mjs +402 -160
  175. package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
  176. package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -1
  177. package/dist/dev/runtime/register/setup.d.mts +11 -0
  178. package/dist/dev/runtime/register/snapshot.mjs +6 -10
  179. package/dist/dev/runtime/register/snapshot.mjs.map +1 -1
  180. package/dist/dev/runtime/register/watch.d.mts +12 -0
  181. package/dist/dev/runtime/register.d.mts +5 -0
  182. package/dist/dev/runtime/scopedSlots.mjs +1 -1
  183. package/dist/dev/runtime/scopedSlots.mjs.map +1 -1
  184. package/dist/dev/runtime/selectorQuery.d.mts +54 -0
  185. package/dist/dev/runtime/selectorQuery.mjs +5 -0
  186. package/dist/dev/runtime/selectorQuery.mjs.map +1 -1
  187. package/dist/dev/runtime/teardown.mjs +18 -0
  188. package/dist/dev/runtime/teardown.mjs.map +1 -0
  189. package/dist/dev/runtime/template.d.mts +6 -0
  190. package/dist/dev/runtime/templateRefTypes.d.mts +12 -0
  191. package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -1
  192. package/dist/dev/runtime/templateRefs.mjs +187 -118
  193. package/dist/dev/runtime/templateRefs.mjs.map +1 -1
  194. package/dist/dev/runtime/types/core.d.mts +35 -0
  195. package/dist/dev/runtime/types/miniprogram.d.mts +84 -0
  196. package/dist/dev/runtime/types/miniprogramHost.d.mts +45 -0
  197. package/dist/dev/runtime/types/miniprogramHostSources.d.mts +112 -0
  198. package/dist/dev/runtime/types/options.d.mts +136 -0
  199. package/dist/dev/runtime/types/props/propTypes.d.mts +79 -0
  200. package/dist/dev/runtime/types/props/router.d.mts +51 -0
  201. package/dist/dev/runtime/types/props/setup.d.mts +96 -0
  202. package/dist/dev/runtime/types/props.d.mts +4 -0
  203. package/dist/dev/runtime/types/runtime.d.mts +59 -0
  204. package/dist/dev/runtime/types/setData.d.mts +237 -0
  205. package/dist/dev/runtime/types.d.mts +29 -0
  206. package/dist/dev/runtime/uniAppHost.d.mts +8 -0
  207. package/dist/dev/runtime/updatePerformance.d.mts +13 -0
  208. package/dist/dev/runtime/use.d.mts +13 -0
  209. package/dist/dev/runtime/vueCompat/context.d.mts +8 -0
  210. package/dist/dev/runtime/vueCompat/model.d.mts +30 -0
  211. package/dist/dev/runtime/vueCompat/router.d.mts +29 -0
  212. package/dist/dev/runtime/vueCompat/router.mjs +18 -13
  213. package/dist/dev/runtime/vueCompat/router.mjs.map +1 -1
  214. package/dist/dev/runtime/vueCompat/templateRef.d.mts +9 -0
  215. package/dist/dev/runtime/vueCompat/templateRef.mjs +2 -0
  216. package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -1
  217. package/dist/dev/runtime/vueCompat.d.mts +5 -0
  218. package/dist/dev/scheduler.d.mts +4 -0
  219. package/dist/dev/store/base.mjs +12 -18
  220. package/dist/dev/store/base.mjs.map +1 -1
  221. package/dist/dev/store/define/optionsStyle.mjs +13 -23
  222. package/dist/dev/store/define/optionsStyle.mjs.map +1 -1
  223. package/dist/dev/store/define/setupStyle.mjs +14 -24
  224. package/dist/dev/store/define/setupStyle.mjs.map +1 -1
  225. package/dist/dev/store/define/shared.mjs +44 -1
  226. package/dist/dev/store/define/shared.mjs.map +1 -1
  227. package/dist/dev/store/define.d.mts +28 -0
  228. package/dist/dev/store/define.mjs.map +1 -1
  229. package/dist/dev/store/manager.d.mts +8 -0
  230. package/dist/dev/store/storeToRefs.d.mts +13 -0
  231. package/dist/dev/store/types.d.mts +70 -0
  232. package/dist/dev/store.d.mts +5 -0
  233. package/dist/dev/version.d.mts +4 -0
  234. package/dist/dev/vue-augment.d.mts +8 -0
  235. package/dist/dev/vue-demi.d.mts +87 -0
  236. package/dist/dev/vue-demi.mjs +12 -15
  237. package/dist/dev/vue-demi.mjs.map +1 -1
  238. package/dist/dev/vue-types.d.mts +19 -0
  239. package/dist/dev/web-apis.d.mts +3 -0
  240. package/dist/index.d.mts +13 -14
  241. package/dist/index.mjs +1 -1
  242. package/dist/internal-reactivity.d.mts +2 -1
  243. package/dist/internal-reactivity.mjs +1 -1
  244. package/dist/internal-runtime.d.mts +13 -6
  245. package/dist/internal-runtime.mjs +1 -1
  246. package/dist/jsx-runtime.d.mts +47 -9
  247. package/dist/jsxTypes.d.mts +8 -0
  248. package/dist/miniprogram/jsx-runtime.d.mts +12 -0
  249. package/dist/miniprogram/jsx-runtime.mjs +1 -0
  250. package/dist/package.mjs +1 -1
  251. package/dist/reactivity/asyncDerivation.d.mts +40 -0
  252. package/dist/reactivity/asyncDerivation.mjs +1 -0
  253. package/dist/reactivity/computed.mjs +1 -1
  254. package/dist/reactivity/core.d.mts +1 -0
  255. package/dist/reactivity/core.mjs +1 -1
  256. package/dist/reactivity/index.d.mts +2 -1
  257. package/dist/reactivity/readonly.d.mts +1 -1
  258. package/dist/reactivity/ref.mjs +1 -1
  259. package/dist/router/createRouter.mjs +1 -1
  260. package/dist/router/useRoute.mjs +1 -1
  261. package/dist/runtime/app/computed.mjs +1 -1
  262. package/dist/runtime/app/context.mjs +1 -1
  263. package/dist/runtime/app/diagnostics.mjs +1 -1
  264. package/dist/runtime/app/mount.mjs +1 -1
  265. package/dist/runtime/app/setData/commitTracker.d.mts +12 -0
  266. package/dist/runtime/app/setData/commitTracker.mjs +1 -0
  267. package/dist/runtime/app/setData/patchScheduler.mjs +1 -1
  268. package/dist/runtime/app/setData/scheduler.d.mts +50 -0
  269. package/dist/runtime/app/setData/scheduler.mjs +1 -1
  270. package/dist/runtime/app/setData/snapshot.mjs +1 -1
  271. package/dist/runtime/app.mjs +1 -1
  272. package/dist/runtime/bindingManifest.mjs +1 -0
  273. package/dist/runtime/capabilities.d.mts +74 -0
  274. package/dist/runtime/capabilities.mjs +1 -0
  275. package/dist/runtime/define/componentDefinition.mjs +1 -1
  276. package/dist/runtime/define/optionsApi.mjs +1 -1
  277. package/dist/runtime/define/props.mjs +1 -1
  278. package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
  279. package/dist/runtime/define.d.mts +5 -13
  280. package/dist/runtime/define.mjs +1 -1
  281. package/dist/runtime/diff.mjs +1 -1
  282. package/dist/runtime/features/inlineEvents.d.mts +6 -0
  283. package/dist/runtime/features/inlineEvents.mjs +1 -0
  284. package/dist/runtime/features/layout.d.mts +6 -0
  285. package/dist/runtime/features/layout.mjs +1 -0
  286. package/dist/runtime/features/patchStrategy.d.mts +6 -0
  287. package/dist/runtime/features/patchStrategy.mjs +1 -0
  288. package/dist/runtime/features/publicLayout.d.mts +23 -0
  289. package/dist/runtime/features/publicLayout.mjs +1 -0
  290. package/dist/runtime/features/scopedSlots.d.mts +22 -0
  291. package/dist/runtime/features/scopedSlots.mjs +1 -0
  292. package/dist/runtime/features/setDataHighFrequencyWarning.d.mts +6 -0
  293. package/dist/runtime/features/setDataHighFrequencyWarning.mjs +1 -0
  294. package/dist/runtime/features/templateRefs.d.mts +6 -0
  295. package/dist/runtime/features/templateRefs.mjs +1 -0
  296. package/dist/runtime/hooks/vue.d.mts +1 -2
  297. package/dist/runtime/hooks/vue.mjs +1 -1
  298. package/dist/runtime/index.d.mts +12 -14
  299. package/dist/runtime/inlineDataset.mjs +1 -0
  300. package/dist/runtime/jsxIsland.d.mts +2 -6
  301. package/dist/runtime/layoutBridge.d.mts +5 -9
  302. package/dist/runtime/pageLayout.d.mts +3 -4
  303. package/dist/runtime/platform.mjs +1 -1
  304. package/dist/runtime/publicRuntime.d.mts +21 -0
  305. package/dist/runtime/publicRuntime.mjs +1 -0
  306. package/dist/runtime/register/app.mjs +1 -1
  307. package/dist/runtime/register/component/lifecycle.mjs +1 -1
  308. package/dist/runtime/register/component/methods.mjs +1 -1
  309. package/dist/runtime/register/component/registerDefinition.mjs +1 -1
  310. package/dist/runtime/register/inline.mjs +1 -1
  311. package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -1
  312. package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
  313. package/dist/runtime/register/runtimeInstance/setupSnapshot.mjs +1 -0
  314. package/dist/runtime/register/runtimeInstance.mjs +1 -1
  315. package/dist/runtime/register/snapshot.mjs +1 -1
  316. package/dist/runtime/scopedSlots.mjs +1 -1
  317. package/dist/runtime/selectorQuery.mjs +1 -1
  318. package/dist/runtime/teardown.mjs +1 -0
  319. package/dist/runtime/templateRefTypes.d.mts +5 -2
  320. package/dist/runtime/templateRefs.mjs +1 -1
  321. package/dist/runtime/types/miniprogram.d.mts +3 -0
  322. package/dist/runtime/types/options.d.mts +2 -2
  323. package/dist/runtime/types/props.d.mts +1 -1
  324. package/dist/runtime/types/setData.d.mts +18 -1
  325. package/dist/runtime/types.d.mts +3 -3
  326. package/dist/runtime/vueCompat/router.d.mts +5 -4
  327. package/dist/runtime/vueCompat/router.mjs +1 -1
  328. package/dist/runtime/vueCompat/templateRef.mjs +1 -1
  329. package/dist/store/base.mjs +1 -1
  330. package/dist/store/define/optionsStyle.mjs +1 -1
  331. package/dist/store/define/setupStyle.mjs +1 -1
  332. package/dist/store/define/shared.mjs +1 -1
  333. package/dist/store/define.d.mts +10 -8
  334. package/dist/store/types.d.mts +4 -4
  335. package/dist/tt/jsx-runtime.d.mts +12 -0
  336. package/dist/tt/jsx-runtime.mjs +1 -0
  337. package/dist/vue-demi.d.mts +13 -14
  338. package/dist/vue-demi.mjs +1 -1
  339. package/dist/weapp/jsx-runtime.d.mts +12 -0
  340. package/dist/weapp/jsx-runtime.mjs +1 -0
  341. package/package.json +26 -22
  342. package/dist/dev/jsx-runtime.mjs +0 -1
  343. package/dist/runtime/templateRefs.d.mts +0 -10
  344. package/dist/weappIntrinsicElements/base.d.mts +0 -21
  345. package/dist/weappIntrinsicElements/elements/ad-custom.d.mts +0 -12
  346. package/dist/weappIntrinsicElements/elements/ad.d.mts +0 -15
  347. package/dist/weappIntrinsicElements/elements/audio.d.mts +0 -19
  348. package/dist/weappIntrinsicElements/elements/block.d.mts +0 -7
  349. package/dist/weappIntrinsicElements/elements/button.d.mts +0 -39
  350. package/dist/weappIntrinsicElements/elements/camera.d.mts +0 -17
  351. package/dist/weappIntrinsicElements/elements/canvas.d.mts +0 -17
  352. package/dist/weappIntrinsicElements/elements/checkbox-group.d.mts +0 -12
  353. package/dist/weappIntrinsicElements/elements/checkbox.d.mts +0 -12
  354. package/dist/weappIntrinsicElements/elements/cover-image.d.mts +0 -9
  355. package/dist/weappIntrinsicElements/elements/cover-view.d.mts +0 -9
  356. package/dist/weappIntrinsicElements/elements/editor.d.mts +0 -21
  357. package/dist/weappIntrinsicElements/elements/form.d.mts +0 -15
  358. package/dist/weappIntrinsicElements/elements/functional-page-navigator.d.mts +0 -14
  359. package/dist/weappIntrinsicElements/elements/icon.d.mts +0 -11
  360. package/dist/weappIntrinsicElements/elements/image.d.mts +0 -17
  361. package/dist/weappIntrinsicElements/elements/import.d.mts +0 -9
  362. package/dist/weappIntrinsicElements/elements/include.d.mts +0 -9
  363. package/dist/weappIntrinsicElements/elements/input.d.mts +0 -46
  364. package/dist/weappIntrinsicElements/elements/keyboard-accessory.d.mts +0 -7
  365. package/dist/weappIntrinsicElements/elements/label.d.mts +0 -9
  366. package/dist/weappIntrinsicElements/elements/live-player.d.mts +0 -34
  367. package/dist/weappIntrinsicElements/elements/live-pusher.d.mts +0 -56
  368. package/dist/weappIntrinsicElements/elements/map.d.mts +0 -104
  369. package/dist/weappIntrinsicElements/elements/match-media.d.mts +0 -15
  370. package/dist/weappIntrinsicElements/elements/movable-area.d.mts +0 -25
  371. package/dist/weappIntrinsicElements/elements/movable-view.d.mts +0 -25
  372. package/dist/weappIntrinsicElements/elements/navigation-bar.d.mts +0 -14
  373. package/dist/weappIntrinsicElements/elements/navigator.d.mts +0 -24
  374. package/dist/weappIntrinsicElements/elements/official-account.d.mts +0 -12
  375. package/dist/weappIntrinsicElements/elements/open-data.d.mts +0 -14
  376. package/dist/weappIntrinsicElements/elements/page-container.d.mts +0 -24
  377. package/dist/weappIntrinsicElements/elements/page-meta.d.mts +0 -22
  378. package/dist/weappIntrinsicElements/elements/picker-view-column.d.mts +0 -17
  379. package/dist/weappIntrinsicElements/elements/picker-view.d.mts +0 -17
  380. package/dist/weappIntrinsicElements/elements/picker.d.mts +0 -22
  381. package/dist/weappIntrinsicElements/elements/progress.d.mts +0 -20
  382. package/dist/weappIntrinsicElements/elements/radio-group.d.mts +0 -12
  383. package/dist/weappIntrinsicElements/elements/radio.d.mts +0 -12
  384. package/dist/weappIntrinsicElements/elements/rich-text.d.mts +0 -16
  385. package/dist/weappIntrinsicElements/elements/scroll-view.d.mts +0 -67
  386. package/dist/weappIntrinsicElements/elements/share-element.d.mts +0 -17
  387. package/dist/weappIntrinsicElements/elements/slider.d.mts +0 -22
  388. package/dist/weappIntrinsicElements/elements/slot.d.mts +0 -9
  389. package/dist/weappIntrinsicElements/elements/swiper-item.d.mts +0 -41
  390. package/dist/weappIntrinsicElements/elements/swiper.d.mts +0 -41
  391. package/dist/weappIntrinsicElements/elements/switch.d.mts +0 -13
  392. package/dist/weappIntrinsicElements/elements/template.d.mts +0 -11
  393. package/dist/weappIntrinsicElements/elements/text.d.mts +0 -14
  394. package/dist/weappIntrinsicElements/elements/textarea.d.mts +0 -39
  395. package/dist/weappIntrinsicElements/elements/video.d.mts +0 -70
  396. package/dist/weappIntrinsicElements/elements/view.d.mts +0 -12
  397. package/dist/weappIntrinsicElements/elements/voip-room.d.mts +0 -13
  398. package/dist/weappIntrinsicElements/elements/web-view.d.mts +0 -12
  399. package/dist/weappIntrinsicElements.d.mts +0 -153
  400. /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/defineProperty.mjs +0 -0
  401. /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPrimitive.mjs +0 -0
  402. /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPropertyKey.mjs +0 -0
  403. /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/typeof.mjs +0 -0
@@ -1,19 +1,23 @@
1
+ import { effectScope } from "../../reactivity/core.mjs";
2
+ import { isReactive } from "../../reactivity/reactive.mjs";
1
3
  import { isRef } from "../../reactivity/ref.mjs";
4
+ import { getMiniProgramRuntimeGlobalObject } from "../platform.mjs";
2
5
  import { callHookList } from "../hooks/base.mjs";
3
- import { isDeepEqualValue } from "../app/setData/snapshot.mjs";
4
- import { resolveRuntimePageLayoutName, syncRuntimePageLayoutState } from "../pageLayout.mjs";
5
- import { allocateOwnerId, attachOwnerSnapshot, mergeOwnerSnapshotProps, removeOwner, resolveOwnerSnapshot, updateOwnerSnapshot } from "../scopedSlots.mjs";
6
- import { clearTemplateRefs, scheduleTemplateRefUpdate } from "../templateRefs.mjs";
6
+ import { isSetDataHighFrequencyWarningRequested, requireRuntimeCapability, runtimeCapabilityRegistry } from "../capabilities.mjs";
7
+ import { runTeardownSteps } from "../teardown.mjs";
8
+ import { applySnapshotUpdate, isDeepEqualValue } from "../app/setData/snapshot.mjs";
9
+ import { observeSetDataCompletion } from "../app/setData/commitTracker.mjs";
7
10
  import { attachRuntimeSlots, createNoopWatchStopHandle, safeMarkNoSetData } from "./runtimeInstance/setupContext.mjs";
8
11
  import { bridgeRuntimeMethodsToTarget } from "./runtimeInstance/methodBridge.mjs";
9
12
  import { attachRuntimeProvideParentContext } from "./runtimeInstance/provideContext.mjs";
10
13
  import { attachNativeInstanceRef, attachRuntimeInstance, attachRuntimeRef, callNativeSetData, ensureRuntimeProps, resolveNativeSetData } from "./runtimeInstance/utils.mjs";
11
14
  import { runRuntimeSetupPhase } from "./runtimeInstance/setupPhase.mjs";
12
- import { createSetDataHighFrequencyWarningMonitor } from "./setDataFrequencyWarning.mjs";
15
+ import { restoreReactiveSetupSnapshot } from "./runtimeInstance/setupSnapshot.mjs";
13
16
  import { registerWatches } from "./watch.mjs";
14
- import { WEVU_EFFECT_SCOPE_KEY, WEVU_HOOKS_KEY, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY, WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY, WEVU_PROPS_DERIVED_KEYS_KEY, WEVU_PROPS_KEY, WEVU_PUBLIC_RUNTIME_KEY, WEVU_RUNTIME_OWNER_ID_KEY, WEVU_SLOT_OWNER_ID_KEY, WEVU_TEMPLATE_REFS_KEY, WEVU_WATCH_STOPS_KEY } from "@weapp-core/constants";
17
+ import { WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY, WEVU_EFFECT_SCOPE_KEY, WEVU_EXPOSED_KEY, WEVU_HOOKS_KEY, WEVU_HOST_COMMIT_PROMISE_KEY, WEVU_ON_BEFORE_UNMOUNT_HOOK, WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY, WEVU_PROPS_DERIVED_KEYS_KEY, WEVU_PUBLIC_RUNTIME_KEY, WEVU_SETUP_CONTEXT_INSTANCE_KEY, WEVU_SLOT_OWNER_ID_KEY, WEVU_WATCH_STOPS_KEY } from "@weapp-core/constants";
15
18
 
16
19
  //#region src/runtime/register/runtimeInstance.ts
20
+ const initialReactiveSetupSnapshots = /* @__PURE__ */ new WeakMap();
17
21
  function cloneInitialSnapshotValue(value, cache = /* @__PURE__ */ new WeakMap()) {
18
22
  if (!value || typeof value !== "object") return value;
19
23
  if (cache.has(value)) return cache.get(value);
@@ -28,6 +32,29 @@ function cloneInitialSnapshotValue(value, cache = /* @__PURE__ */ new WeakMap())
28
32
  for (const [key, child] of Object.entries(value)) next[key] = cloneInitialSnapshotValue(child, cache);
29
33
  return next;
30
34
  }
35
+ function mergeBufferedSetDataPayload(buffered, incoming) {
36
+ const merged = buffered !== null && buffered !== void 0 ? buffered : {};
37
+ for (const [path, value] of Object.entries(incoming)) {
38
+ let ancestorPath;
39
+ for (const candidate of Object.keys(merged)) if (path.startsWith(`${candidate}.`)) {
40
+ ancestorPath = candidate;
41
+ break;
42
+ }
43
+ if (ancestorPath) {
44
+ const holder = { value: merged[ancestorPath] };
45
+ applySnapshotUpdate(holder, `value.${path.slice(ancestorPath.length + 1)}`, value, "set", {
46
+ cloneValue: false,
47
+ clonedParents: /* @__PURE__ */ new WeakSet()
48
+ });
49
+ merged[ancestorPath] = holder.value;
50
+ continue;
51
+ }
52
+ const descendantPrefix = `${path}.`;
53
+ for (const candidate of Object.keys(merged)) if (candidate.startsWith(descendantPrefix)) delete merged[candidate];
54
+ merged[path] = value;
55
+ }
56
+ return merged;
57
+ }
31
58
  function resolveInitialSnapshotFromNativeData(target, omitKeys, extraEntries) {
32
59
  const data = target.data;
33
60
  if ((!data || typeof data !== "object") && (!extraEntries || !Object.keys(extraEntries).length)) return;
@@ -46,146 +73,308 @@ function resolveInitialSnapshotFromNativeData(target, omitKeys, extraEntries) {
46
73
  function hasTemplateRuntimeBindings(runtimeApp) {
47
74
  return Boolean(runtimeApp === null || runtimeApp === void 0 ? void 0 : runtimeApp.__wevuHasTemplateRuntimeBindings);
48
75
  }
49
- function attachPageLayoutSetter(target) {
50
- if (typeof target.route !== "string" || !target.route) return;
51
- target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
52
- var _target$__wevu;
53
- const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
54
- if (!runtimeState || typeof runtimeState !== "object") return;
55
- runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout);
56
- const nextProps = layout === false ? {} : props !== null && props !== void 0 ? props : {};
57
- runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps;
58
- syncRuntimePageLayoutState(target, layout, nextProps);
59
- };
60
- }
61
76
  /**
62
77
  * 挂载运行时实例(框架内部注册流程使用)。
63
78
  * @internal
64
79
  */
65
80
  function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
66
- var _data, _wevuSetDataOptions, _wevuSetDataOptions2, _runtime$proxy, _runtime$state, _runtime$setupState, _computed, _runtime$methods, _watch, _bindModel, _snapshot, _unmount;
81
+ var _runtime$proxy, _runtime$state, _runtime$setupState, _computed, _runtime$methods, _watch, _bindModel, _snapshot, _unmount;
67
82
  if (target.__wevu) return target.__wevu;
83
+ const runtimeSetDataOptions = runtimeApp.__wevuSetDataOptions;
84
+ const scopedSlotHooks = hasTemplateRuntimeBindings(runtimeApp) ? requireRuntimeCapability("scopedSlots", "mountRuntimeInstance(scoped-slot bindings)") : void 0;
85
+ const scopedSlotState = scopedSlotHooks === null || scopedSlotHooks === void 0 ? void 0 : scopedSlotHooks.prepareMount(target);
86
+ const templateRefBindings = target.__wevuTemplateRefs;
87
+ if (Array.isArray(templateRefBindings) && templateRefBindings.length) requireRuntimeCapability("templateRefs", "mountRuntimeInstance(template refs)");
88
+ const highFrequencyWarningHooks = isSetDataHighFrequencyWarningRequested(runtimeSetDataOptions === null || runtimeSetDataOptions === void 0 ? void 0 : runtimeSetDataOptions.highFrequencyWarning) ? requireRuntimeCapability("setDataHighFrequencyWarning", "mountRuntimeInstance(setData.highFrequencyWarning)") : void 0;
68
89
  attachRuntimeProvideParentContext(target, runtimeApp);
69
90
  safeMarkNoSetData(target);
70
- const initialNativeOwnerId = (_data = target.data) === null || _data === void 0 ? void 0 : _data[WEVU_SLOT_OWNER_ID_KEY];
71
- const ownerId = typeof initialNativeOwnerId === "string" && initialNativeOwnerId ? initialNativeOwnerId : allocateOwnerId();
72
- const shouldFlushNativeOwnerId = typeof initialNativeOwnerId === "string" && initialNativeOwnerId !== ownerId;
73
- const suspendWhenHidden = Boolean(runtimeApp === null || runtimeApp === void 0 || (_wevuSetDataOptions = runtimeApp.__wevuSetDataOptions) === null || _wevuSetDataOptions === void 0 ? void 0 : _wevuSetDataOptions.suspendWhenHidden);
91
+ const suspendWhenHidden = Boolean(runtimeSetDataOptions === null || runtimeSetDataOptions === void 0 ? void 0 : runtimeSetDataOptions.suspendWhenHidden);
74
92
  const targetLabel = typeof target.route === "string" && target.route ? `page:${target.route}` : typeof target.is === "string" && target.is ? `component:${target.is}` : "unknown-target";
75
- const highFrequencyWarning = createSetDataHighFrequencyWarningMonitor({
76
- option: runtimeApp === null || runtimeApp === void 0 || (_wevuSetDataOptions2 = runtimeApp.__wevuSetDataOptions) === null || _wevuSetDataOptions2 === void 0 ? void 0 : _wevuSetDataOptions2.highFrequencyWarning,
93
+ const highFrequencyWarning = highFrequencyWarningHooks === null || highFrequencyWarningHooks === void 0 ? void 0 : highFrequencyWarningHooks.createMonitor({
94
+ option: runtimeSetDataOptions === null || runtimeSetDataOptions === void 0 ? void 0 : runtimeSetDataOptions.highFrequencyWarning,
77
95
  targetLabel,
78
96
  isInPageScrollHook: () => {
79
97
  var _WEVU_PAGE_SCROLL_HOO;
80
98
  return Number((_WEVU_PAGE_SCROLL_HOO = target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _WEVU_PAGE_SCROLL_HOO !== void 0 ? _WEVU_PAGE_SCROLL_HOO : 0) > 0;
81
99
  }
82
100
  });
83
- const createDeferredAdapter = (instance) => {
84
- let pending;
85
- let pendingCallbacks = [];
86
- let enabled = false;
87
- const adapter = { setData(payload, callback) {
88
- if (!enabled) {
89
- var _pending;
90
- pending = {
91
- ...(_pending = pending) !== null && _pending !== void 0 ? _pending : {},
92
- ...payload
93
- };
94
- if (callback) pendingCallbacks.push(callback);
95
- return;
96
- }
97
- const setData = resolveNativeSetData(instance);
98
- if (setData) return callNativeSetData(instance, setData, payload, callback);
99
- } };
100
- adapter.__wevu_enableSetData = (discardPending = false) => {
101
- enabled = true;
102
- if (discardPending) {
103
- pending = void 0;
104
- pendingCallbacks = [];
105
- }
106
- const setData = resolveNativeSetData(instance);
107
- if (pending && Object.keys(pending).length && setData) {
108
- const payload = pending;
109
- const callbacks = pendingCallbacks;
110
- pending = void 0;
111
- pendingCallbacks = [];
112
- const callback = callbacks.length ? () => callbacks.forEach((callback) => callback()) : void 0;
113
- callNativeSetData(instance, setData, payload, callback);
114
- }
115
- };
116
- return adapter;
117
- };
118
- const baseAdapter = (options === null || options === void 0 ? void 0 : options.deferSetData) ? createDeferredAdapter(target) : { setData(payload, callback) {
119
- const setData = resolveNativeSetData(target);
120
- if (setData) return callNativeSetData(target, setData, payload, callback);
121
- } };
122
- let runtimeRef;
123
101
  let visible = true;
124
- let hiddenPendingPayload;
125
- const mergePendingPayload = (pending, payload) => ({
126
- ...pending !== null && pending !== void 0 ? pending : {},
127
- ...payload
102
+ let enabled = !(options === null || options === void 0 ? void 0 : options.deferSetData);
103
+ let disposed = false;
104
+ let dispatchGeneration = 0;
105
+ let pendingPayload;
106
+ let pendingSettlementHead;
107
+ let pendingSettlementTail;
108
+ let pendingRawCallbacks = [];
109
+ const ownsHostCommit = !(WEVU_HOST_COMMIT_PROMISE_KEY in target);
110
+ let pendingHostCommits = 0;
111
+ let hostCommitFailed = false;
112
+ let hostCommitCause;
113
+ let hostCommitPromise;
114
+ let resolveHostCommit;
115
+ let rejectHostCommit;
116
+ const resetHostCommitFailure = () => {
117
+ if (!pendingHostCommits && !pendingPayload && !hostCommitPromise) {
118
+ hostCommitFailed = false;
119
+ hostCommitCause = void 0;
120
+ }
121
+ };
122
+ const flushHostCommitWaiter = () => {
123
+ if (pendingHostCommits || pendingPayload) return;
124
+ if (hostCommitFailed) rejectHostCommit === null || rejectHostCommit === void 0 || rejectHostCommit(hostCommitCause);
125
+ else resolveHostCommit === null || resolveHostCommit === void 0 || resolveHostCommit();
126
+ hostCommitPromise = void 0;
127
+ resolveHostCommit = void 0;
128
+ rejectHostCommit = void 0;
129
+ };
130
+ const beginHostCommit = () => {
131
+ if (ownsHostCommit) pendingHostCommits += 1;
132
+ };
133
+ const finishHostCommit = (settlement = "committed", cause) => {
134
+ if (!ownsHostCommit || disposed) return;
135
+ if (settlement === "failed" && !hostCommitFailed) {
136
+ hostCommitFailed = true;
137
+ hostCommitCause = cause;
138
+ }
139
+ pendingHostCommits -= 1;
140
+ flushHostCommitWaiter();
141
+ };
142
+ const failHostCommit = (cause) => finishHostCommit("failed", cause);
143
+ if (ownsHostCommit) Object.defineProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY, {
144
+ configurable: true,
145
+ enumerable: false,
146
+ get: () => {
147
+ var _hostCommitPromise;
148
+ if (!pendingHostCommits && !pendingPayload) return hostCommitFailed ? Promise.reject(hostCommitCause) : void 0;
149
+ (_hostCommitPromise = hostCommitPromise) !== null && _hostCommitPromise !== void 0 || (hostCommitPromise = new Promise((resolve, reject) => {
150
+ resolveHostCommit = resolve;
151
+ rejectHostCommit = reject;
152
+ }));
153
+ return hostCommitPromise;
154
+ }
128
155
  });
129
156
  const refreshOwnerSnapshot = () => {
130
- var _WEVU_PROPS_KEY;
131
- if (!runtimeRef) return;
132
- const snapshot = resolveOwnerSnapshot(runtimeRef);
133
- const propsSource = (_WEVU_PROPS_KEY = target[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : target.properties;
134
- mergeOwnerSnapshotProps(snapshot, propsSource);
135
- updateOwnerSnapshot(ownerId, snapshot, runtimeRef.proxy, target);
157
+ if (scopedSlotState) {
158
+ var _runtimeCapabilityReg;
159
+ (_runtimeCapabilityReg = runtimeCapabilityRegistry.scopedSlots) === null || _runtimeCapabilityReg === void 0 || _runtimeCapabilityReg.refresh(target, scopedSlotState);
160
+ }
161
+ };
162
+ const completeSuccessfulSetData = () => {
163
+ if (disposed) return;
164
+ const bindings = target.__wevuTemplateRefs;
165
+ if (!runtimeCapabilityRegistry.templateRefs && (!Array.isArray(bindings) || !bindings.length)) {
166
+ if (ownsHostCommit) finishHostCommit();
167
+ return;
168
+ }
169
+ requireRuntimeCapability("templateRefs", "mountRuntimeInstance(template ref completion)").schedule(target, ownsHostCommit ? finishHostCommit : void 0, target, ownsHostCommit ? failHostCommit : void 0);
136
170
  };
137
171
  const syncNativeOwnerId = () => {
138
- if (!shouldFlushNativeOwnerId) return;
139
- const nativeData = target.data;
140
- try {
141
- if (nativeData && typeof nativeData === "object") nativeData[WEVU_SLOT_OWNER_ID_KEY] = ownerId;
142
- } catch (_unused) {}
143
- const setData = resolveNativeSetData(target);
144
- if (!setData) return;
145
- callNativeSetData(target, setData, { [WEVU_SLOT_OWNER_ID_KEY]: ownerId });
172
+ if (scopedSlotState) scopedSlotHooks === null || scopedSlotHooks === void 0 || scopedSlotHooks.syncNativeOwnerId(target, scopedSlotState);
173
+ };
174
+ const appendPendingSettlement = (settle) => {
175
+ const record = {
176
+ settle,
177
+ next: void 0
178
+ };
179
+ if (pendingSettlementTail) pendingSettlementTail.next = record;
180
+ else pendingSettlementHead = record;
181
+ pendingSettlementTail = record;
182
+ };
183
+ const settlePendingRecords = (first, settlement, cause) => {
184
+ let current = first;
185
+ let isFirst = true;
186
+ while (current) {
187
+ const next = current.next;
188
+ current.next = void 0;
189
+ if (settlement === "failed" && !isFirst) current.settle("abandoned");
190
+ else current.settle(settlement, cause);
191
+ current = next;
192
+ isFirst = false;
193
+ }
194
+ };
195
+ const dispatchPhysicalSetData = (payload, settle) => {
196
+ const generation = dispatchGeneration;
197
+ beginHostCommit();
198
+ refreshOwnerSnapshot();
199
+ observeSetDataCompletion({
200
+ invoke: (callback) => {
201
+ const setData = resolveNativeSetData(target);
202
+ if (!setData) {
203
+ callback();
204
+ return;
205
+ }
206
+ return callNativeSetData(target, setData, payload, callback);
207
+ },
208
+ completion: "callback",
209
+ settle: (settlement, cause) => {
210
+ if (disposed || generation !== dispatchGeneration) return;
211
+ if (settlement !== "committed") {
212
+ finishHostCommit(settlement, cause);
213
+ settle(settlement, cause);
214
+ return;
215
+ }
216
+ try {
217
+ settle(settlement, cause);
218
+ } catch (error) {
219
+ finishHostCommit("failed", error);
220
+ throw error;
221
+ }
222
+ completeSuccessfulSetData();
223
+ }
224
+ });
225
+ };
226
+ const flushPendingSetData = () => {
227
+ if (!pendingPayload) return;
228
+ const payload = pendingPayload;
229
+ const settlements = pendingSettlementHead;
230
+ const rawCallbacks = pendingRawCallbacks;
231
+ pendingPayload = void 0;
232
+ pendingSettlementHead = void 0;
233
+ pendingSettlementTail = void 0;
234
+ pendingRawCallbacks = [];
235
+ dispatchPhysicalSetData(payload, (settlement, cause) => {
236
+ if (settlement === "committed") {
237
+ try {
238
+ for (const callback of rawCallbacks) callback();
239
+ } finally {
240
+ settlePendingRecords(settlements, settlement, cause);
241
+ }
242
+ return;
243
+ }
244
+ settlePendingRecords(settlements, settlement, cause);
245
+ });
246
+ };
247
+ const abandonPendingSetData = () => {
248
+ const settlements = pendingSettlementHead;
249
+ pendingPayload = void 0;
250
+ pendingSettlementHead = void 0;
251
+ pendingSettlementTail = void 0;
252
+ pendingRawCallbacks = [];
253
+ settlePendingRecords(settlements, "abandoned");
254
+ flushHostCommitWaiter();
255
+ };
256
+ const bufferPayload = (payload) => {
257
+ resetHostCommitFailure();
258
+ pendingPayload = mergeBufferedSetDataPayload(pendingPayload, payload);
146
259
  };
147
260
  const baseMountAdapter = {
148
- ...baseAdapter,
149
- setData(payload) {
261
+ setData(payload, callback) {
150
262
  highFrequencyWarning === null || highFrequencyWarning === void 0 || highFrequencyWarning();
151
- if (suspendWhenHidden && !visible) {
152
- hiddenPendingPayload = mergePendingPayload(hiddenPendingPayload, payload);
263
+ if (!enabled || suspendWhenHidden && !visible) {
264
+ bufferPayload(payload);
265
+ if (callback) pendingRawCallbacks.push(callback);
153
266
  refreshOwnerSnapshot();
154
- scheduleTemplateRefUpdate(target);
155
267
  return;
156
268
  }
157
- const hasTemplateRefs = Array.isArray(target[WEVU_TEMPLATE_REFS_KEY]) && target[WEVU_TEMPLATE_REFS_KEY].length > 0;
158
269
  refreshOwnerSnapshot();
159
- if (hasTemplateRefs && resolveNativeSetData(target)) return new Promise((resolve) => {
160
- baseAdapter.setData(payload, () => {
161
- refreshOwnerSnapshot();
162
- scheduleTemplateRefUpdate(target);
163
- resolve();
164
- });
270
+ resetHostCommitFailure();
271
+ beginHostCommit();
272
+ const setData = resolveNativeSetData(target);
273
+ if (!setData) {
274
+ try {
275
+ callback === null || callback === void 0 || callback();
276
+ } catch (cause) {
277
+ finishHostCommit("failed", cause);
278
+ throw cause;
279
+ }
280
+ completeSuccessfulSetData();
281
+ return;
282
+ }
283
+ let invoking = true;
284
+ let callbackCalled = false;
285
+ let returnIsAuthoritative = false;
286
+ let successHandled = false;
287
+ const handleFailure = (cause) => {
288
+ if (successHandled) return;
289
+ successHandled = true;
290
+ finishHostCommit("failed", cause);
291
+ };
292
+ const handleSuccess = () => {
293
+ if (successHandled) return;
294
+ successHandled = true;
295
+ completeSuccessfulSetData();
296
+ };
297
+ const nativeCallback = () => {
298
+ try {
299
+ callback === null || callback === void 0 || callback();
300
+ } catch (cause) {
301
+ handleFailure(cause);
302
+ throw cause;
303
+ }
304
+ if (invoking) {
305
+ callbackCalled = true;
306
+ return;
307
+ }
308
+ if (!returnIsAuthoritative) handleSuccess();
309
+ };
310
+ let result;
311
+ try {
312
+ result = callNativeSetData(target, setData, payload, nativeCallback);
313
+ } catch (cause) {
314
+ handleFailure(cause);
315
+ throw cause;
316
+ }
317
+ invoking = false;
318
+ returnIsAuthoritative = Boolean(result && typeof result.then === "function");
319
+ if (result && typeof result.then === "function") return result.then(() => {
320
+ handleSuccess();
321
+ }, (cause) => {
322
+ handleFailure(cause);
323
+ throw cause;
165
324
  });
166
- const result = baseAdapter.setData(payload);
167
- scheduleTemplateRefUpdate(target);
325
+ if (callbackCalled) handleSuccess();
168
326
  return result;
169
327
  },
328
+ __wevu_dispatchSetData(payload, settle) {
329
+ highFrequencyWarning === null || highFrequencyWarning === void 0 || highFrequencyWarning();
330
+ if (disposed) {
331
+ settle("abandoned");
332
+ return;
333
+ }
334
+ if (!enabled || suspendWhenHidden && !visible) {
335
+ bufferPayload(payload);
336
+ appendPendingSettlement(settle);
337
+ refreshOwnerSnapshot();
338
+ return;
339
+ }
340
+ resetHostCommitFailure();
341
+ dispatchPhysicalSetData(payload, settle);
342
+ },
343
+ __wevu_enableSetData(discardPending = false) {
344
+ enabled = true;
345
+ if (discardPending) {
346
+ abandonPendingSetData();
347
+ return;
348
+ }
349
+ flushPendingSetData();
350
+ },
170
351
  __wevu_setVisibility(nextVisible) {
171
352
  visible = nextVisible;
172
- if (!visible || !hiddenPendingPayload) return;
173
- const payload = hiddenPendingPayload;
174
- hiddenPendingPayload = void 0;
175
- const hasTemplateRefs = Array.isArray(target[WEVU_TEMPLATE_REFS_KEY]) && target[WEVU_TEMPLATE_REFS_KEY].length > 0;
176
- refreshOwnerSnapshot();
177
- if (hasTemplateRefs && resolveNativeSetData(target)) return new Promise((resolve) => {
178
- baseAdapter.setData(payload, () => {
179
- refreshOwnerSnapshot();
180
- scheduleTemplateRefUpdate(target);
181
- resolve();
182
- });
183
- });
184
- const result = baseAdapter.setData(payload);
185
- scheduleTemplateRefUpdate(target);
186
- return result;
353
+ if (visible && enabled) flushPendingSetData();
354
+ },
355
+ __wevu_disposeSetData() {
356
+ if (disposed) return;
357
+ disposed = true;
358
+ dispatchGeneration += 1;
359
+ pendingPayload = void 0;
360
+ pendingSettlementHead = void 0;
361
+ pendingSettlementTail = void 0;
362
+ pendingRawCallbacks = [];
363
+ pendingHostCommits = 0;
364
+ hostCommitFailed = false;
365
+ hostCommitCause = void 0;
366
+ flushHostCommitWaiter();
367
+ if (ownsHostCommit) Reflect.deleteProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY);
187
368
  }
188
369
  };
370
+ Object.defineProperty(baseMountAdapter, "__wevu_reportSetDataError", {
371
+ configurable: true,
372
+ enumerable: false,
373
+ value: (error) => {
374
+ callHookList(target, "onError", [error]);
375
+ },
376
+ writable: false
377
+ });
189
378
  Object.defineProperty(baseMountAdapter, "__wevu_targetLabel", {
190
379
  configurable: true,
191
380
  enumerable: false,
@@ -205,17 +394,17 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
205
394
  value: options.snapshotOmitKeys,
206
395
  writable: false
207
396
  });
208
- const initialSnapshot = resolveInitialSnapshotFromNativeData(target, options === null || options === void 0 ? void 0 : options.snapshotOmitKeys, hasTemplateRuntimeBindings(runtimeApp) ? void 0 : { [WEVU_SLOT_OWNER_ID_KEY]: ownerId });
397
+ const initialSnapshot = resolveInitialSnapshotFromNativeData(target, options === null || options === void 0 ? void 0 : options.snapshotOmitKeys);
209
398
  if (initialSnapshot && Object.keys(initialSnapshot).length) Object.defineProperty(baseMountAdapter, "__wevu_initialSnapshot", {
210
399
  configurable: true,
211
400
  enumerable: false,
212
401
  value: initialSnapshot,
213
402
  writable: false
214
403
  });
215
- Object.defineProperty(baseMountAdapter, "__wevu_initialState", {
404
+ if (scopedSlotState) Object.defineProperty(baseMountAdapter, "__wevu_initialState", {
216
405
  configurable: true,
217
406
  enumerable: false,
218
- value: { [WEVU_SLOT_OWNER_ID_KEY]: ownerId },
407
+ value: { [WEVU_SLOT_OWNER_ID_KEY]: scopedSlotState.ownerId },
219
408
  writable: false
220
409
  });
221
410
  if (Boolean(options === null || options === void 0 ? void 0 : options.deferSetData) || Boolean(setup) || Boolean(targetProperties && typeof targetProperties === "object" && Object.keys(targetProperties).length > 0)) Object.defineProperty(baseMountAdapter, "__wevu_deferInitialSnapshot", {
@@ -225,7 +414,6 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
225
414
  writable: false
226
415
  });
227
416
  const runtime = runtimeApp.mount(baseMountAdapter);
228
- runtimeRef = runtime;
229
417
  attachRuntimeInstance(runtime, target);
230
418
  const runtimeProxy = (_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : {};
231
419
  const runtimeState = (_runtime$state = runtime === null || runtime === void 0 ? void 0 : runtime.state) !== null && _runtime$state !== void 0 ? _runtime$state : {};
@@ -237,7 +425,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
237
425
  const runtimeComputed = (_computed = runtime === null || runtime === void 0 ? void 0 : runtime.computed) !== null && _computed !== void 0 ? _computed : Object.create(null);
238
426
  if (!(runtime === null || runtime === void 0 ? void 0 : runtime.methods)) try {
239
427
  runtime.methods = Object.create(null);
240
- } catch (_unused2) {}
428
+ } catch (_unused) {}
241
429
  const runtimeMethods = (_runtime$methods = runtime === null || runtime === void 0 ? void 0 : runtime.methods) !== null && _runtime$methods !== void 0 ? _runtime$methods : Object.create(null);
242
430
  const runtimeWatch = (_watch = runtime === null || runtime === void 0 ? void 0 : runtime.watch) !== null && _watch !== void 0 ? _watch : (() => createNoopWatchStopHandle());
243
431
  const runtimeBindModel = (_bindModel = runtime === null || runtime === void 0 ? void 0 : runtime.bindModel) !== null && _bindModel !== void 0 ? _bindModel : (() => {});
@@ -264,6 +452,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
264
452
  __wevu_flushSetupSnapshotSync: runtime.__wevu_flushSetupSnapshotSync,
265
453
  __wevu_touchSetupMethodsVersion: runtime.__wevu_touchSetupMethodsVersion,
266
454
  __wevu_trackSetupReactiveKey: runtime.__wevu_trackSetupReactiveKey,
455
+ __wevu_cloneDispatchedSnapshot: runtime.__wevu_cloneDispatchedSnapshot,
267
456
  [WEVU_PROPS_DERIVED_KEYS_KEY]: runtime[WEVU_PROPS_DERIVED_KEYS_KEY]
268
457
  };
269
458
  for (const [key, value] of Object.entries(internalRuntimeFields)) {
@@ -282,14 +471,14 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
282
471
  writable: false
283
472
  });
284
473
  target.__wevu = runtimeWithDefaults;
285
- attachPageLayoutSetter(target);
286
474
  const runtimeProps = ensureRuntimeProps(target, runtimeState);
287
475
  attachRuntimeSlots(runtimeState, runtimeProps);
288
- attachOwnerSnapshot(target, runtimeWithDefaults, ownerId, { deferSnapshot: options === null || options === void 0 ? void 0 : options.deferSetData });
476
+ if (scopedSlotState) scopedSlotHooks === null || scopedSlotHooks === void 0 || scopedSlotHooks.attachMount(target, runtimeWithDefaults, scopedSlotState, Boolean(options === null || options === void 0 ? void 0 : options.deferSetData));
289
477
  syncNativeOwnerId();
290
478
  const watchStops = watchMap ? registerWatches(runtimeWithDefaults, watchMap, target, { deferMissingSourceBaseline: Boolean(setup) }) : [];
291
479
  if (watchStops.length) target[WEVU_WATCH_STOPS_KEY] = watchStops;
292
- if (setup) {
480
+ if (setup) try {
481
+ var _getMiniProgramRuntim;
293
482
  runRuntimeSetupPhase({
294
483
  target,
295
484
  runtime,
@@ -298,13 +487,25 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
298
487
  runtimeProxy,
299
488
  setup
300
489
  });
490
+ if (typeof ((_getMiniProgramRuntim = getMiniProgramRuntimeGlobalObject()) === null || _getMiniProgramRuntim === void 0 || (_getMiniProgramRuntim = _getMiniProgramRuntim[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]) === null || _getMiniProgramRuntim === void 0 ? void 0 : _getMiniProgramRuntim.trackWevuComponent) === "function") {
491
+ var _runtimeWithDefaults$;
492
+ const initialReactiveSetupSnapshot = {};
493
+ for (const [key, value] of Object.entries((_runtimeWithDefaults$ = runtimeWithDefaults.setupState) !== null && _runtimeWithDefaults$ !== void 0 ? _runtimeWithDefaults$ : {})) if (isReactive(value)) initialReactiveSetupSnapshot[key] = cloneInitialSnapshotValue(value);
494
+ initialReactiveSetupSnapshots.set(runtimeWithDefaults, initialReactiveSetupSnapshot);
495
+ }
301
496
  if (!(options === null || options === void 0 ? void 0 : options.deferSetData)) {
302
497
  var _runtimeWithSyncFlush;
303
498
  (_runtimeWithSyncFlush = runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync) === null || _runtimeWithSyncFlush === void 0 || _runtimeWithSyncFlush.call(runtimeWithSyncFlush);
304
499
  }
305
500
  if (!(options === null || options === void 0 ? void 0 : options.deferSetData)) refreshOwnerSnapshot();
306
501
  for (const stop of watchStops) stop.resume();
307
- } else if (!(options === null || options === void 0 ? void 0 : options.deferSetData) && target.properties && typeof target.properties === "object" && Object.keys(target.properties).length > 0) {
502
+ } catch (error) {
503
+ try {
504
+ teardownRuntimeInstance(target, { skipHooks: true });
505
+ } catch (_unused2) {}
506
+ throw error;
507
+ }
508
+ else if (!(options === null || options === void 0 ? void 0 : options.deferSetData) && target.properties && typeof target.properties === "object" && Object.keys(target.properties).length > 0) {
308
509
  var _runtimeWithSyncFlush2;
309
510
  (_runtimeWithSyncFlush2 = runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync) === null || _runtimeWithSyncFlush2 === void 0 || _runtimeWithSyncFlush2.call(runtimeWithSyncFlush);
310
511
  refreshOwnerSnapshot();
@@ -329,6 +530,8 @@ function preserveRuntimeFacadeIdentity(target, previousRuntime, nextRuntime) {
329
530
  }
330
531
  }
331
532
  attachRuntimeRef(previousRuntime.state, previousRuntime);
533
+ const nextInitialSetupSnapshot = initialReactiveSetupSnapshots.get(nextRuntime);
534
+ if (nextInitialSetupSnapshot) initialReactiveSetupSnapshots.set(previousRuntime, nextInitialSetupSnapshot);
332
535
  target.__wevu = previousRuntime;
333
536
  Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {
334
537
  value: previousRuntime,
@@ -345,7 +548,7 @@ function createRuntimeStateSnapshot(runtime, nativeData, preferredState) {
345
548
  for (const key of Object.keys(nativeData !== null && nativeData !== void 0 ? nativeData : {})) {
346
549
  if (!Object.prototype.hasOwnProperty.call(runtimeState, key)) continue;
347
550
  const setupBinding = setupState === null || setupState === void 0 ? void 0 : setupState[key];
348
- if (setupState && Object.prototype.hasOwnProperty.call(setupState, key) && !isRef(setupBinding)) continue;
551
+ if (setupState && Object.prototype.hasOwnProperty.call(setupState, key) && !isRef(setupBinding) && !isReactive(setupBinding)) continue;
349
552
  if (preferredState && Object.prototype.hasOwnProperty.call(preferredState, key)) {
350
553
  snapshot[key] = cloneInitialSnapshotValue(preferredState[key]);
351
554
  continue;
@@ -354,14 +557,6 @@ function createRuntimeStateSnapshot(runtime, nativeData, preferredState) {
354
557
  }
355
558
  return snapshot;
356
559
  }
357
- function collectPlainSetupSnapshotKeys(runtime, nativeData) {
358
- const setupState = runtime.setupState;
359
- if (!setupState || !nativeData || typeof nativeData !== "object") return [];
360
- return Object.keys(nativeData).filter((key) => {
361
- const setupBinding = setupState[key];
362
- return Object.prototype.hasOwnProperty.call(setupState, key) && !isRef(setupBinding);
363
- });
364
- }
365
560
  function syncRuntimeStateFromNativeData(target, options) {
366
561
  var _options$nativeData;
367
562
  const runtime = target.__wevu;
@@ -375,51 +570,99 @@ function syncRuntimeStateFromNativeData(target, options) {
375
570
  if (Object.prototype.hasOwnProperty.call(runtimeState, key)) try {
376
571
  const setupBinding = setupState === null || setupState === void 0 ? void 0 : setupState[key];
377
572
  const runtimeValue = cloneInitialSnapshotValue(value);
378
- if (!(options === null || options === void 0 ? void 0 : options.includeSetupState) && setupState && Object.prototype.hasOwnProperty.call(setupState, key)) continue;
573
+ if (setupState && Object.prototype.hasOwnProperty.call(setupState, key)) {
574
+ if (!(options === null || options === void 0 ? void 0 : options.includeSetupState) || !isRef(setupBinding) && !isReactive(setupBinding)) continue;
575
+ }
379
576
  if (!(options === null || options === void 0 ? void 0 : options.includeSetupState) && initialRuntimeSnapshot && Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key) && !isDeepEqualValue(runtimeState[key], initialRuntimeSnapshot[key], 20, { keys: 1e4 })) continue;
380
577
  if (!(options === null || options === void 0 ? void 0 : options.includeSetupState) && initialRuntimeSnapshot && !Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)) continue;
381
578
  if (isRef(setupBinding)) {
382
579
  setupBinding.value = runtimeValue;
383
580
  continue;
384
581
  }
582
+ if (isReactive(setupBinding) && runtimeValue && typeof runtimeValue === "object") {
583
+ var _options$initialSetup;
584
+ restoreReactiveSetupSnapshot(setupBinding, runtimeValue, options === null || options === void 0 || (_options$initialSetup = options.initialSetupState) === null || _options$initialSetup === void 0 ? void 0 : _options$initialSetup[key]);
585
+ continue;
586
+ }
385
587
  runtimeState[key] = runtimeValue;
386
588
  } catch (_unused5) {}
387
589
  }
388
590
  }
389
591
  function enableDeferredSetData(target, options) {
390
- var _wevu, _wevu2, _wevu2$__wevu_flushSe;
391
- const adapter = (_wevu = target.__wevu) === null || _wevu === void 0 ? void 0 : _wevu.adapter;
592
+ var _target$__wevu, _adapter$__wevu_enabl, _wevu, _wevu$__wevu_flushSet;
593
+ const adapter = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.adapter;
392
594
  syncRuntimeStateFromNativeData(target, { includeSetupState: options === null || options === void 0 ? void 0 : options.rehydrateSetupState });
393
- if (adapter && typeof adapter.__wevu_enableSetData === "function") adapter.__wevu_enableSetData(true);
394
- (_wevu2 = target.__wevu) === null || _wevu2 === void 0 || (_wevu2$__wevu_flushSe = _wevu2.__wevu_flushSetupSnapshotSync) === null || _wevu2$__wevu_flushSe === void 0 || _wevu2$__wevu_flushSe.call(_wevu2);
595
+ adapter === null || adapter === void 0 || (_adapter$__wevu_enabl = adapter.__wevu_enableSetData) === null || _adapter$__wevu_enabl === void 0 || _adapter$__wevu_enabl.call(adapter, true);
596
+ (_wevu = target.__wevu) === null || _wevu === void 0 || (_wevu$__wevu_flushSet = _wevu.__wevu_flushSetupSnapshotSync) === null || _wevu$__wevu_flushSet === void 0 || _wevu$__wevu_flushSet.call(_wevu);
395
597
  }
396
598
  function setRuntimeSetDataVisibility(target, visible) {
397
- var _wevu3;
398
- const adapter = (_wevu3 = target.__wevu) === null || _wevu3 === void 0 ? void 0 : _wevu3.adapter;
399
- if (adapter && typeof adapter.__wevu_setVisibility === "function") adapter.__wevu_setVisibility(visible);
599
+ var _target$__wevu2, _adapter$__wevu_setVi;
600
+ const adapter = (_target$__wevu2 = target.__wevu) === null || _target$__wevu2 === void 0 ? void 0 : _target$__wevu2.adapter;
601
+ adapter === null || adapter === void 0 || (_adapter$__wevu_setVi = adapter.__wevu_setVisibility) === null || _adapter$__wevu_setVi === void 0 || _adapter$__wevu_setVi.call(adapter, visible);
400
602
  }
401
603
  /**
402
604
  * 卸载运行时实例(框架内部注册流程使用)。
403
605
  * @internal
404
606
  */
405
607
  function teardownRuntimeInstance(target, options) {
406
- var _WEVU_RUNTIME_OWNER_I, _target$WEVU_EFFECT_S;
407
608
  const runtime = target.__wevu;
408
- const ownerId = (_WEVU_RUNTIME_OWNER_I = target[WEVU_RUNTIME_OWNER_ID_KEY]) !== null && _WEVU_RUNTIME_OWNER_I !== void 0 ? _WEVU_RUNTIME_OWNER_I : target[WEVU_SLOT_OWNER_ID_KEY];
409
- if (ownerId) removeOwner(ownerId);
410
- clearTemplateRefs(target);
411
- if (!(options === null || options === void 0 ? void 0 : options.skipHooks) && runtime && target[WEVU_HOOKS_KEY]) callHookList(target, "onUnload", []);
412
- if (target[WEVU_HOOKS_KEY]) target[WEVU_HOOKS_KEY] = void 0;
413
609
  const stops = target[WEVU_WATCH_STOPS_KEY];
414
- if (Array.isArray(stops)) for (const stop of stops) try {
415
- stop();
416
- } catch (_unused6) {}
417
- target[WEVU_WATCH_STOPS_KEY] = void 0;
418
- (_target$WEVU_EFFECT_S = target[WEVU_EFFECT_SCOPE_KEY]) === null || _target$WEVU_EFFECT_S === void 0 || _target$WEVU_EFFECT_S.stop();
419
- target[WEVU_EFFECT_SCOPE_KEY] = void 0;
420
- if (runtime) runtime.unmount();
421
- delete target.__wevu;
422
- if (WEVU_PUBLIC_RUNTIME_KEY in target) delete target[WEVU_PUBLIC_RUNTIME_KEY];
610
+ const effectScope$1 = target[WEVU_EFFECT_SCOPE_KEY];
611
+ runTeardownSteps([
612
+ () => {
613
+ var _target$WEVU_HOOKS_KE;
614
+ if (!(options === null || options === void 0 ? void 0 : options.skipHooks) && runtime && ((_target$WEVU_HOOKS_KE = target[WEVU_HOOKS_KEY]) === null || _target$WEVU_HOOKS_KE === void 0 ? void 0 : _target$WEVU_HOOKS_KE[WEVU_ON_BEFORE_UNMOUNT_HOOK])) {
615
+ if (effectScope$1 === null || effectScope$1 === void 0 ? void 0 : effectScope$1.active) effectScope$1.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK));
616
+ else {
617
+ const teardownScope = effectScope(true);
618
+ runTeardownSteps([() => teardownScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK)), () => teardownScope.stop()]);
619
+ }
620
+ }
621
+ },
622
+ () => {
623
+ var _runtimeCapabilityReg2;
624
+ return (_runtimeCapabilityReg2 = runtimeCapabilityRegistry.scopedSlots) === null || _runtimeCapabilityReg2 === void 0 ? void 0 : _runtimeCapabilityReg2.teardown(target);
625
+ },
626
+ () => {
627
+ if (Array.isArray(target.__wevuTemplateRefs) && target.__wevuTemplateRefs.length > 0) requireRuntimeCapability("templateRefs", "teardownRuntimeInstance(template refs)").clear(target);
628
+ },
629
+ () => {
630
+ if (!(options === null || options === void 0 ? void 0 : options.skipHooks) && runtime && target[WEVU_HOOKS_KEY]) callHookList(target, "onUnload", []);
631
+ },
632
+ () => {
633
+ if (target[WEVU_HOOKS_KEY]) target[WEVU_HOOKS_KEY] = void 0;
634
+ },
635
+ () => {
636
+ if (Array.isArray(stops)) for (const stop of stops) try {
637
+ stop();
638
+ } catch (_unused6) {}
639
+ },
640
+ () => {
641
+ target[WEVU_WATCH_STOPS_KEY] = void 0;
642
+ },
643
+ () => {
644
+ effectScope$1 === null || effectScope$1 === void 0 || effectScope$1.stop();
645
+ },
646
+ () => {
647
+ target[WEVU_EFFECT_SCOPE_KEY] = void 0;
648
+ },
649
+ () => runtime === null || runtime === void 0 ? void 0 : runtime.unmount(),
650
+ () => {
651
+ var _adapter$__wevu_dispo;
652
+ const adapter = runtime === null || runtime === void 0 ? void 0 : runtime.adapter;
653
+ adapter === null || adapter === void 0 || (_adapter$__wevu_dispo = adapter.__wevu_disposeSetData) === null || _adapter$__wevu_dispo === void 0 || _adapter$__wevu_dispo.call(adapter);
654
+ },
655
+ () => {
656
+ delete target[WEVU_SETUP_CONTEXT_INSTANCE_KEY];
657
+ delete target[WEVU_EXPOSED_KEY];
658
+ },
659
+ () => {
660
+ delete target.__wevu;
661
+ },
662
+ () => {
663
+ if (WEVU_PUBLIC_RUNTIME_KEY in target) delete target[WEVU_PUBLIC_RUNTIME_KEY];
664
+ }
665
+ ]);
423
666
  }
424
667
  /**
425
668
  * 重建运行时实例,同时保持宿主包装对象持有的 runtime facade 身份稳定。
@@ -427,22 +670,21 @@ function teardownRuntimeInstance(target, options) {
427
670
  */
428
671
  function refreshRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
429
672
  const previousRuntime = target.__wevu;
673
+ const initialSetupState = previousRuntime ? initialReactiveSetupSnapshots.get(previousRuntime) : void 0;
430
674
  const previousRuntimeState = previousRuntime ? createRuntimeStateSnapshot(previousRuntime, target.data, options === null || options === void 0 ? void 0 : options.stateSnapshot) : void 0;
431
- const plainSetupSnapshotKeys = previousRuntime ? collectPlainSetupSnapshotKeys(previousRuntime, target.data) : [];
432
675
  teardownRuntimeInstance(target, { skipHooks: true });
433
676
  const nextRuntime = mountRuntimeInstance(target, runtimeApp, watchMap, setup, {
434
677
  deferSetData: true,
435
678
  snapshotOmitKeys: options === null || options === void 0 ? void 0 : options.snapshotOmitKeys
436
679
  });
437
- if (previousRuntimeState) {
680
+ const stateSnapshot = previousRuntimeState !== null && previousRuntimeState !== void 0 ? previousRuntimeState : (options === null || options === void 0 ? void 0 : options.stateSnapshot) ? createRuntimeStateSnapshot(nextRuntime, options.stateSnapshot, options.stateSnapshot) : void 0;
681
+ if (stateSnapshot) {
438
682
  const nativeData = target.data;
439
- if (nativeData && typeof nativeData === "object") {
440
- for (const key of plainSetupSnapshotKeys) delete nativeData[key];
441
- Object.assign(nativeData, cloneInitialSnapshotValue(previousRuntimeState));
442
- }
683
+ if (nativeData && typeof nativeData === "object") Object.assign(nativeData, cloneInitialSnapshotValue(stateSnapshot));
443
684
  syncRuntimeStateFromNativeData(target, {
444
685
  includeSetupState: true,
445
- nativeData: previousRuntimeState
686
+ nativeData: stateSnapshot,
687
+ initialSetupState
446
688
  });
447
689
  }
448
690
  if (!previousRuntime || previousRuntime === nextRuntime) return nextRuntime;