wevu 7.4.0 → 7.6.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 (291) hide show
  1. package/README.md +2 -0
  2. package/dist/config/defaults.d.mts +44 -0
  3. package/dist/config/pageFeatures.d.mts +51 -0
  4. package/dist/config.d.mts +4 -0
  5. package/dist/config.mjs +1 -0
  6. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/defineProperty.mjs +1 -1
  7. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPrimitive.mjs +1 -1
  8. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPropertyKey.mjs +1 -1
  9. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/typeof.mjs +1 -1
  10. package/dist/dev/package.mjs +1 -1
  11. package/dist/dev/reactivity/computed.mjs.map +1 -1
  12. package/dist/dev/reactivity/core.mjs +1 -1
  13. package/dist/dev/reactivity/ref.mjs +1 -1
  14. package/dist/dev/reactivity/ref.mjs.map +1 -1
  15. package/dist/dev/runtime/app/diagnostics.mjs +5 -1
  16. package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
  17. package/dist/dev/runtime/app/mount.mjs +8 -3
  18. package/dist/dev/runtime/app/mount.mjs.map +1 -1
  19. package/dist/dev/runtime/app/setData/commitTracker.mjs +39 -4
  20. package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -1
  21. package/dist/dev/runtime/app/setData/observation.mjs +109 -0
  22. package/dist/dev/runtime/app/setData/observation.mjs.map +1 -0
  23. package/dist/dev/runtime/app/setData/scheduler.mjs +12 -1
  24. package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
  25. package/dist/dev/runtime/app/setDataOptions.mjs +1 -0
  26. package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -1
  27. package/dist/dev/runtime/define/initialComputed.mjs +13 -12
  28. package/dist/dev/runtime/define/initialComputed.mjs.map +1 -1
  29. package/dist/dev/runtime/define/props.mjs +5 -1
  30. package/dist/dev/runtime/define/props.mjs.map +1 -1
  31. package/dist/dev/runtime/define/scopedSlotOptions.mjs +2 -1
  32. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
  33. package/dist/dev/runtime/define/setupResult.mjs +3 -5
  34. package/dist/dev/runtime/define/setupResult.mjs.map +1 -1
  35. package/dist/dev/runtime/define.mjs +3 -8
  36. package/dist/dev/runtime/define.mjs.map +1 -1
  37. package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
  38. package/dist/dev/runtime/pageLayout.mjs.map +1 -1
  39. package/dist/dev/runtime/register/component/hmrRegistration.mjs +15 -0
  40. package/dist/dev/runtime/register/component/hmrRegistration.mjs.map +1 -0
  41. package/dist/dev/runtime/register/component/props.mjs +15 -5
  42. package/dist/dev/runtime/register/component/props.mjs.map +1 -1
  43. package/dist/dev/runtime/register/component/registerDefinition.mjs +30 -18
  44. package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
  45. package/dist/dev/runtime/register/component.mjs +23 -12
  46. package/dist/dev/runtime/register/component.mjs.map +1 -1
  47. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +14 -7
  48. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -1
  49. package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs +78 -0
  50. package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs.map +1 -0
  51. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +52 -8
  52. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -1
  53. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +2 -25
  54. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
  55. package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
  56. package/dist/dev/runtime/register/runtimeInstance.mjs +69 -29
  57. package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
  58. package/dist/dev/runtime/register/watch.mjs +1 -3
  59. package/dist/dev/runtime/register/watch.mjs.map +1 -1
  60. package/dist/fetch.mjs +1 -1
  61. package/dist/index.d.mts +13 -8
  62. package/dist/internal-reactivity.d.mts +2 -1
  63. package/dist/internal-template.mjs +1 -1
  64. package/dist/jsx-runtime.d.mts +2 -1
  65. package/dist/macros/shared.d.mts +3 -2
  66. package/dist/macros.d.mts +3 -10
  67. package/dist/package.mjs +1 -1
  68. package/dist/reactivity/asyncDerivation.d.mts +2 -1
  69. package/dist/reactivity/computed.d.mts +3 -7
  70. package/dist/reactivity/core.mjs +1 -1
  71. package/dist/reactivity/index.d.mts +2 -1
  72. package/dist/reactivity/reactive/mutation.d.mts +2 -1
  73. package/dist/reactivity/reactive/patch.mjs +1 -1
  74. package/dist/reactivity/reactive/patchState.mjs +1 -1
  75. package/dist/reactivity/ref.d.mts +1 -1
  76. package/dist/reactivity/ref.mjs +1 -1
  77. package/dist/reactivity/toRefs.d.mts +2 -1
  78. package/dist/reactivity/watch/helpers.mjs +1 -1
  79. package/dist/reactivity/watch/types.d.mts +2 -1
  80. package/dist/router/initialNavigation.mjs +1 -1
  81. package/dist/router/types.d.mts +2 -1
  82. package/dist/router/useRoute.mjs +1 -1
  83. package/dist/routerInternal/matching.mjs +1 -1
  84. package/dist/routerInternal/params.mjs +1 -1
  85. package/dist/routerInternal/path.mjs +1 -1
  86. package/dist/routerInternal/query.mjs +1 -1
  87. package/dist/routerInternal/records.mjs +1 -1
  88. package/dist/runtime/app/context.mjs +1 -1
  89. package/dist/runtime/app/diagnostics.mjs +1 -1
  90. package/dist/runtime/app/mount.mjs +1 -1
  91. package/dist/runtime/app/setData/commitTracker.d.mts +2 -1
  92. package/dist/runtime/app/setData/commitTracker.mjs +1 -1
  93. package/dist/runtime/app/setData/observation.d.mts +13 -0
  94. package/dist/runtime/app/setData/observation.mjs +1 -0
  95. package/dist/runtime/app/setData/scheduler.d.mts +1 -0
  96. package/dist/runtime/app/setData/scheduler.mjs +1 -1
  97. package/dist/runtime/app/setDataOptions.mjs +1 -1
  98. package/dist/runtime/app.d.mts +1 -1
  99. package/dist/runtime/capabilities.d.mts +2 -2
  100. package/dist/runtime/define/initialComputed.mjs +1 -1
  101. package/dist/runtime/define/props.mjs +1 -1
  102. package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
  103. package/dist/runtime/define/setupResult.mjs +1 -1
  104. package/dist/runtime/define.d.mts +5 -3
  105. package/dist/runtime/define.mjs +1 -1
  106. package/dist/runtime/diff.mjs +1 -1
  107. package/dist/runtime/features/publicLayout.d.mts +2 -1
  108. package/dist/runtime/features/publicLayout.mjs +1 -1
  109. package/dist/runtime/features/scopedSlots.d.mts +3 -2
  110. package/dist/runtime/index.d.mts +7 -4
  111. package/dist/runtime/jsxIsland.mjs +1 -1
  112. package/dist/runtime/pageLayout.d.mts +3 -2
  113. package/dist/runtime/pageLayout.mjs +1 -1
  114. package/dist/runtime/pageScroll.mjs +1 -1
  115. package/dist/runtime/register/app.d.mts +1 -1
  116. package/dist/runtime/register/component/alipayRegistration.mjs +1 -1
  117. package/dist/runtime/register/component/hmrRegistration.mjs +1 -0
  118. package/dist/runtime/register/component/lifecycle.mjs +1 -1
  119. package/dist/runtime/register/component/props.mjs +1 -1
  120. package/dist/runtime/register/component/registerDefinition.mjs +1 -1
  121. package/dist/runtime/register/component/registerNativeDefinition.mjs +1 -1
  122. package/dist/runtime/register/component.d.mts +1 -1
  123. package/dist/runtime/register/component.mjs +1 -1
  124. package/dist/runtime/register/inline.d.mts +2 -1
  125. package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -1
  126. package/dist/runtime/register/runtimeInstance/nativeDeclaration.mjs +1 -0
  127. package/dist/runtime/register/runtimeInstance/provideContext.mjs +1 -1
  128. package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
  129. package/dist/runtime/register/runtimeInstance.d.mts +11 -6
  130. package/dist/runtime/register/runtimeInstance.mjs +1 -1
  131. package/dist/runtime/register/setup.d.mts +2 -1
  132. package/dist/runtime/register/watch.d.mts +2 -1
  133. package/dist/runtime/register/watch.mjs +1 -1
  134. package/dist/runtime/setupTracking.mjs +1 -1
  135. package/dist/runtime/templateRefTypes.d.mts +3 -5
  136. package/dist/runtime/templateRefs.mjs +1 -1
  137. package/dist/runtime/types/core.d.mts +3 -7
  138. package/dist/runtime/types/miniprogramHostSources.d.mts +1 -0
  139. package/dist/runtime/types/options.d.mts +6 -52
  140. package/dist/runtime/types/props/propTypes.d.mts +2 -1
  141. package/dist/runtime/types/props/router.d.mts +2 -1
  142. package/dist/runtime/types/props/setup.d.mts +2 -1
  143. package/dist/runtime/types/runtime.d.mts +3 -1
  144. package/dist/runtime/types/setData.d.mts +30 -0
  145. package/dist/runtime/types.d.mts +5 -3
  146. package/dist/runtime/uniAppHost.d.mts +2 -1
  147. package/dist/runtime/vueCompat/model.d.mts +3 -2
  148. package/dist/runtime/vueCompat/router.d.mts +2 -1
  149. package/dist/scheduler.mjs +1 -1
  150. package/dist/store/storeToRefs.d.mts +2 -1
  151. package/dist/store/types.d.mts +4 -3
  152. package/dist/types/definitions.d.mts +7 -0
  153. package/dist/types/pageLayout.d.mts +4 -0
  154. package/dist/types/pageMeta.d.mts +10 -0
  155. package/dist/types/reactivity.d.mts +13 -0
  156. package/dist/types.d.mts +5 -0
  157. package/dist/types.mjs +1 -0
  158. package/dist/vue-demi.d.mts +13 -7
  159. package/dist/vue-types.d.mts +3 -4
  160. package/dist/web-apis.mjs +1 -1
  161. package/package.json +23 -13
  162. package/dist/dev/api/vitest/setup.d.mts +0 -1
  163. package/dist/dev/api/vitest.d.mts +0 -1
  164. package/dist/dev/api.d.mts +0 -1
  165. package/dist/dev/compiler.d.mts +0 -1
  166. package/dist/dev/fetch.d.mts +0 -9
  167. package/dist/dev/index.d.mts +0 -72
  168. package/dist/dev/internal-reactivity.d.mts +0 -18
  169. package/dist/dev/internal-runtime.d.mts +0 -45
  170. package/dist/dev/internal-template.d.mts +0 -2
  171. package/dist/dev/jsxTypes.d.mts +0 -9
  172. package/dist/dev/macros/shared.d.mts +0 -83
  173. package/dist/dev/macros.d.mts +0 -71
  174. package/dist/dev/reactivity/asyncDerivation.d.mts +0 -41
  175. package/dist/dev/reactivity/computed.d.mts +0 -25
  176. package/dist/dev/reactivity/core.d.mts +0 -35
  177. package/dist/dev/reactivity/index.d.mts +0 -16
  178. package/dist/dev/reactivity/reactive/mutation.d.mts +0 -21
  179. package/dist/dev/reactivity/reactive/patch.d.mts +0 -18
  180. package/dist/dev/reactivity/reactive/shallow.d.mts +0 -22
  181. package/dist/dev/reactivity/reactive/shared.d.mts +0 -4
  182. package/dist/dev/reactivity/reactive.d.mts +0 -42
  183. package/dist/dev/reactivity/readonly.d.mts +0 -27
  184. package/dist/dev/reactivity/ref.d.mts +0 -27
  185. package/dist/dev/reactivity/shallowRef.d.mts +0 -19
  186. package/dist/dev/reactivity/toRefs.d.mts +0 -43
  187. package/dist/dev/reactivity/traverse.d.mts +0 -8
  188. package/dist/dev/reactivity/watch/types.d.mts +0 -43
  189. package/dist/dev/reactivity/watch.d.mts +0 -22
  190. package/dist/dev/router/auto-routes.d.mts +0 -8
  191. package/dist/dev/router/createRouter.d.mts +0 -9
  192. package/dist/dev/router/navigationCore.d.mts +0 -7
  193. package/dist/dev/router/resolve.d.mts +0 -7
  194. package/dist/dev/router/routeSync.d.mts +0 -2
  195. package/dist/dev/router/scrollRestoration/adapters.d.mts +0 -8
  196. package/dist/dev/router/scrollRestoration/controller.d.mts +0 -8
  197. package/dist/dev/router/scrollRestoration/host.d.mts +0 -3
  198. package/dist/dev/router/scrollRestoration/index.d.mts +0 -9
  199. package/dist/dev/router/scrollRestoration/types.d.mts +0 -61
  200. package/dist/dev/router/types.d.mts +0 -267
  201. package/dist/dev/router/useRoute.d.mts +0 -20
  202. package/dist/dev/router/useRouter.d.mts +0 -9
  203. package/dist/dev/router.d.mts +0 -30
  204. package/dist/dev/routerInternal/location.d.mts +0 -2
  205. package/dist/dev/routerInternal/matching.d.mts +0 -2
  206. package/dist/dev/routerInternal/params.d.mts +0 -2
  207. package/dist/dev/routerInternal/query.d.mts +0 -7
  208. package/dist/dev/routerInternal/records.d.mts +0 -2
  209. package/dist/dev/routerInternal/recordsWarnings.d.mts +0 -2
  210. package/dist/dev/routerInternal/shared.d.mts +0 -9
  211. package/dist/dev/routerInternal/snapshots.d.mts +0 -2
  212. package/dist/dev/routerInternal/types.d.mts +0 -9
  213. package/dist/dev/runtime/app/pending.d.mts +0 -10
  214. package/dist/dev/runtime/app/setData/commitTracker.d.mts +0 -13
  215. package/dist/dev/runtime/app/setData/scheduler.d.mts +0 -51
  216. package/dist/dev/runtime/app.d.mts +0 -8
  217. package/dist/dev/runtime/capabilities.d.mts +0 -78
  218. package/dist/dev/runtime/css.d.mts +0 -14
  219. package/dist/dev/runtime/defaults.d.mts +0 -12
  220. package/dist/dev/runtime/define.d.mts +0 -118
  221. package/dist/dev/runtime/disposables.d.mts +0 -31
  222. package/dist/dev/runtime/elementIntersectionObserver.d.mts +0 -26
  223. package/dist/dev/runtime/features/inlineEvents.d.mts +0 -7
  224. package/dist/dev/runtime/features/jsxIslands.d.mts +0 -7
  225. package/dist/dev/runtime/features/layout.d.mts +0 -7
  226. package/dist/dev/runtime/features/patchStrategy.d.mts +0 -7
  227. package/dist/dev/runtime/features/publicLayout.d.mts +0 -24
  228. package/dist/dev/runtime/features/scopedSlots.d.mts +0 -23
  229. package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +0 -7
  230. package/dist/dev/runtime/features/templateRefs.d.mts +0 -7
  231. package/dist/dev/runtime/hooks/base.d.mts +0 -27
  232. package/dist/dev/runtime/hooks/register.d.mts +0 -30
  233. package/dist/dev/runtime/hooks/vue.d.mts +0 -52
  234. package/dist/dev/runtime/hooks.d.mts +0 -4
  235. package/dist/dev/runtime/index.d.mts +0 -46
  236. package/dist/dev/runtime/intersectionObserver.d.mts +0 -14
  237. package/dist/dev/runtime/jsxIsland.d.mts +0 -37
  238. package/dist/dev/runtime/layoutBridge.d.mts +0 -55
  239. package/dist/dev/runtime/noSetData.d.mts +0 -5
  240. package/dist/dev/runtime/pageEnvironment.d.mts +0 -50
  241. package/dist/dev/runtime/pageLayout.d.mts +0 -25
  242. package/dist/dev/runtime/pageScroll.d.mts +0 -29
  243. package/dist/dev/runtime/provide.d.mts +0 -60
  244. package/dist/dev/runtime/provideStore.d.mts +0 -7
  245. package/dist/dev/runtime/publicRuntime.d.mts +0 -22
  246. package/dist/dev/runtime/pullDownRefresh.d.mts +0 -12
  247. package/dist/dev/runtime/register/app.d.mts +0 -14
  248. package/dist/dev/runtime/register/component.d.mts +0 -17
  249. package/dist/dev/runtime/register/inline.d.mts +0 -15
  250. package/dist/dev/runtime/register/runtimeInstance.d.mts +0 -26
  251. package/dist/dev/runtime/register/setup.d.mts +0 -11
  252. package/dist/dev/runtime/register/watch.d.mts +0 -12
  253. package/dist/dev/runtime/register.d.mts +0 -5
  254. package/dist/dev/runtime/selectorQuery.d.mts +0 -54
  255. package/dist/dev/runtime/template.d.mts +0 -6
  256. package/dist/dev/runtime/templateRefTypes.d.mts +0 -12
  257. package/dist/dev/runtime/types/core.d.mts +0 -35
  258. package/dist/dev/runtime/types/miniprogram.d.mts +0 -84
  259. package/dist/dev/runtime/types/miniprogramHost.d.mts +0 -45
  260. package/dist/dev/runtime/types/miniprogramHostSources.d.mts +0 -112
  261. package/dist/dev/runtime/types/options.d.mts +0 -138
  262. package/dist/dev/runtime/types/props/propTypes.d.mts +0 -79
  263. package/dist/dev/runtime/types/props/router.d.mts +0 -51
  264. package/dist/dev/runtime/types/props/setup.d.mts +0 -96
  265. package/dist/dev/runtime/types/props.d.mts +0 -4
  266. package/dist/dev/runtime/types/runtime.d.mts +0 -59
  267. package/dist/dev/runtime/types/setData.d.mts +0 -237
  268. package/dist/dev/runtime/types.d.mts +0 -29
  269. package/dist/dev/runtime/uniAppHost.d.mts +0 -8
  270. package/dist/dev/runtime/updatePerformance.d.mts +0 -13
  271. package/dist/dev/runtime/use.d.mts +0 -13
  272. package/dist/dev/runtime/vueCompat/context.d.mts +0 -8
  273. package/dist/dev/runtime/vueCompat/model.d.mts +0 -30
  274. package/dist/dev/runtime/vueCompat/router.d.mts +0 -29
  275. package/dist/dev/runtime/vueCompat/templateRef.d.mts +0 -9
  276. package/dist/dev/runtime/vueCompat.d.mts +0 -5
  277. package/dist/dev/scheduler.d.mts +0 -4
  278. package/dist/dev/store/define.d.mts +0 -8
  279. package/dist/dev/store/manager.d.mts +0 -16
  280. package/dist/dev/store/storeToRefs.d.mts +0 -11
  281. package/dist/dev/store/types.d.mts +0 -106
  282. package/dist/dev/store.d.mts +0 -5
  283. package/dist/dev/version.d.mts +0 -4
  284. package/dist/dev/vue-augment.d.mts +0 -8
  285. package/dist/dev/vue-demi.d.mts +0 -87
  286. package/dist/dev/vue-types.d.mts +0 -19
  287. package/dist/dev/web-apis.d.mts +0 -3
  288. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/defineProperty.mjs +0 -0
  289. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPrimitive.mjs +0 -0
  290. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPropertyKey.mjs +0 -0
  291. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/typeof.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeInstance.mjs","names":["effectScope","createEffectScope"],"sources":["../../../../src/runtime/register/runtimeInstance.ts"],"sourcesContent":["import type { SetDataAdapterSettlement, SetDataAdapterSettler, SetDataPayload } from '../app/setData/commitTracker'\nimport type {\n ComponentPropsOptions,\n ComputedDefinitions,\n DefineAppOptions,\n DefineComponentOptions,\n InternalRuntimeState,\n MethodDefinitions,\n RuntimeApp,\n RuntimeInstance,\n SetDataSnapshotOptions,\n} from '../types'\nimport type { AdapterWithSetData } from './runtimeInstance/utils'\nimport type { WatchMap } from './watch'\nimport {\n WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY,\n WEVU_EFFECT_SCOPE_KEY,\n WEVU_EXPOSED_KEY,\n WEVU_HOOKS_KEY,\n WEVU_HOST_COMMIT_PROMISE_KEY,\n WEVU_ON_BEFORE_UNMOUNT_HOOK,\n WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY,\n WEVU_PROPS_DERIVED_KEYS_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n WEVU_SETUP_CONTEXT_INSTANCE_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_WATCH_STOPS_KEY,\n} from '@weapp-core/constants'\nimport { effectScope as createEffectScope, isReactive, isRef } from '../../reactivity'\nimport { observeSetDataCompletion } from '../app/setData/commitTracker'\nimport { applySnapshotUpdate, isDeepEqualValue } from '../app/setData/snapshot'\nimport {\n isSetDataHighFrequencyWarningRequested,\n requireRuntimeCapability,\n runtimeCapabilityRegistry,\n} from '../capabilities'\nimport { callHookList } from '../hooks'\nimport { getMiniProgramRuntimeGlobalObject } from '../platform'\nimport { runTeardownSteps } from '../teardown'\nimport { bridgeRuntimeMethodsToTarget } from './runtimeInstance/methodBridge'\nimport { attachRuntimeProvideParentContext } from './runtimeInstance/provideContext'\nimport {\n attachRuntimeSlots,\n createNoopWatchStopHandle,\n safeMarkNoSetData,\n} from './runtimeInstance/setupContext'\nimport { runRuntimeSetupPhase } from './runtimeInstance/setupPhase'\nimport { restoreReactiveSetupSnapshot } from './runtimeInstance/setupSnapshot'\nimport {\n attachNativeInstanceRef,\n attachRuntimeInstance,\n attachRuntimeRef,\n callNativeSetData,\n ensureRuntimeProps,\n resolveNativeSetData,\n} from './runtimeInstance/utils'\nimport { registerWatches } from './watch'\n\nconst initialReactiveSetupSnapshots = new WeakMap<object, Record<string, unknown>>()\n\nfunction cloneInitialSnapshotValue(value: unknown, cache = new WeakMap<object, unknown>()): unknown {\n if (!value || typeof value !== 'object') {\n return value\n }\n if (cache.has(value as object)) {\n return cache.get(value as object)\n }\n if (Array.isArray(value)) {\n const next: unknown[] = []\n cache.set(value, next)\n for (const item of value) {\n next.push(cloneInitialSnapshotValue(item, cache))\n }\n return next\n }\n const next: Record<string, unknown> = {}\n cache.set(value as object, next)\n for (const [key, child] of Object.entries(value as Record<string, unknown>)) {\n next[key] = cloneInitialSnapshotValue(child, cache)\n }\n return next\n}\nfunction mergeBufferedSetDataPayload(\n buffered: SetDataPayload | undefined,\n incoming: SetDataPayload,\n): SetDataPayload {\n const merged = buffered ?? {}\n for (const [path, value] of Object.entries(incoming)) {\n let ancestorPath: string | undefined\n for (const candidate of Object.keys(merged)) {\n if (path.startsWith(`${candidate}.`)) {\n ancestorPath = candidate\n break\n }\n }\n if (ancestorPath) {\n const holder: Record<string, unknown> = { value: merged[ancestorPath] }\n applySnapshotUpdate(\n holder,\n `value.${path.slice(ancestorPath.length + 1)}`,\n value,\n 'set',\n { cloneValue: false, clonedParents: new WeakSet<object>() },\n )\n merged[ancestorPath] = holder.value\n continue\n }\n const descendantPrefix = `${path}.`\n for (const candidate of Object.keys(merged)) {\n if (candidate.startsWith(descendantPrefix)) {\n delete merged[candidate]\n }\n }\n merged[path] = value\n }\n return merged\n}\n\nfunction resolveInitialSnapshotFromNativeData(\n target: InternalRuntimeState,\n omitKeys?: string[],\n extraEntries?: Record<string, unknown>,\n) {\n const data = (target as any).data\n if ((!data || typeof data !== 'object') && (!extraEntries || !Object.keys(extraEntries).length)) {\n return undefined\n }\n const omitSet = Array.isArray(omitKeys) && omitKeys.length\n ? new Set(omitKeys)\n : undefined\n const snapshot: Record<string, any> = {}\n if (data && typeof data === 'object') {\n for (const [key, value] of Object.entries(data as Record<string, unknown>)) {\n if (omitSet?.has(key)) {\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n if (extraEntries) {\n for (const [key, value] of Object.entries(extraEntries)) {\n if (omitSet?.has(key)) {\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n return snapshot\n}\n\nfunction hasTemplateRuntimeBindings(runtimeApp: RuntimeApp<any, any, any>) {\n return Boolean((runtimeApp as any)?.__wevuHasTemplateRuntimeBindings)\n}\n\ntype RuntimeSetupFunction<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']\n | DefineAppOptions<D, C, M>['setup']\n\ntype RuntimeInstanceWithSyncFlush<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = RuntimeInstance<D, C, M> & {\n __wevu_flushSetupSnapshotSync?: () => void\n __wevu_touchSetupMethodsVersion?: () => void\n __wevu_trackSetupReactiveKey?: (key: string) => void\n __wevu_cloneDispatchedSnapshot?: () => Record<string, any>\n}\n\ninterface BufferedSetDataSettlement {\n settle: SetDataAdapterSettler\n next: BufferedSetDataSettlement | undefined\n}\n\n/**\n * 挂载运行时实例(框架内部注册流程使用)。\n * @internal\n */\nexport function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: { deferSetData?: boolean, snapshotOmitKeys?: string[] },\n) {\n if (target.__wevu) {\n return target.__wevu as RuntimeInstance<D, C, M>\n }\n const runtimeSetDataOptions = (\n runtimeApp as typeof runtimeApp & { __wevuSetDataOptions?: SetDataSnapshotOptions }\n ).__wevuSetDataOptions\n const hasScopedSlotBindings = hasTemplateRuntimeBindings(runtimeApp)\n const scopedSlotHooks = hasScopedSlotBindings\n ? requireRuntimeCapability('scopedSlots', 'mountRuntimeInstance(scoped-slot bindings)')\n : undefined\n const scopedSlotState = scopedSlotHooks?.prepareMount(target)\n const templateRefBindings = target.__wevuTemplateRefs\n if (Array.isArray(templateRefBindings) && templateRefBindings.length) {\n requireRuntimeCapability('templateRefs', 'mountRuntimeInstance(template refs)')\n }\n const highFrequencyWarningRequested = isSetDataHighFrequencyWarningRequested(\n runtimeSetDataOptions?.highFrequencyWarning,\n )\n const highFrequencyWarningHooks = highFrequencyWarningRequested\n ? requireRuntimeCapability('setDataHighFrequencyWarning', 'mountRuntimeInstance(setData.highFrequencyWarning)')\n : undefined\n attachRuntimeProvideParentContext(target, runtimeApp as RuntimeApp<any, any, any>)\n safeMarkNoSetData(target)\n const suspendWhenHidden = Boolean(runtimeSetDataOptions?.suspendWhenHidden)\n const targetLabel = typeof (target as any).route === 'string' && (target as any).route\n ? `page:${(target as any).route}`\n : typeof (target as any).is === 'string' && (target as any).is\n ? `component:${(target as any).is}`\n : 'unknown-target'\n const highFrequencyWarning = highFrequencyWarningHooks?.createMonitor({\n option: runtimeSetDataOptions?.highFrequencyWarning,\n targetLabel,\n isInPageScrollHook: () => Number((target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 0) > 0,\n })\n let visible = true\n let enabled = !options?.deferSetData\n let disposed = false\n let dispatchGeneration = 0\n let pendingPayload: SetDataPayload | undefined\n let pendingSettlementHead: BufferedSetDataSettlement | undefined\n let pendingSettlementTail: BufferedSetDataSettlement | undefined\n let pendingRawCallbacks: Array<() => void> = []\n const ownsHostCommit = !(WEVU_HOST_COMMIT_PROMISE_KEY in target)\n let pendingHostCommits = 0\n let hostCommitFailed = false\n let hostCommitCause: unknown\n let hostCommitPromise: Promise<void> | undefined\n let resolveHostCommit: (() => void) | undefined\n let rejectHostCommit: ((cause: unknown) => void) | undefined\n\n const resetHostCommitFailure = () => {\n if (!pendingHostCommits && !pendingPayload && !hostCommitPromise) {\n hostCommitFailed = false\n hostCommitCause = undefined\n }\n }\n const flushHostCommitWaiter = () => {\n if (pendingHostCommits || pendingPayload) {\n return\n }\n if (hostCommitFailed) {\n rejectHostCommit?.(hostCommitCause)\n }\n else {\n resolveHostCommit?.()\n }\n hostCommitPromise = undefined\n resolveHostCommit = undefined\n rejectHostCommit = undefined\n }\n const beginHostCommit = () => {\n if (ownsHostCommit) {\n pendingHostCommits += 1\n }\n }\n const finishHostCommit = (settlement: SetDataAdapterSettlement = 'committed', cause?: unknown) => {\n if (!ownsHostCommit || disposed) {\n return\n }\n if (settlement === 'failed' && !hostCommitFailed) {\n hostCommitFailed = true\n hostCommitCause = cause\n }\n pendingHostCommits -= 1\n flushHostCommitWaiter()\n }\n const failHostCommit = (cause: unknown) => finishHostCommit('failed', cause)\n if (ownsHostCommit) {\n Object.defineProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY, {\n configurable: true,\n enumerable: false,\n get: () => {\n if (!pendingHostCommits && !pendingPayload) {\n return hostCommitFailed ? Promise.reject(hostCommitCause) : undefined\n }\n // 只有实例 $nextTick 消费宿主屏障时才创建 Promise。\n hostCommitPromise ??= new Promise<void>((resolve, reject) => {\n resolveHostCommit = resolve\n rejectHostCommit = reject\n })\n return hostCommitPromise\n },\n })\n }\n\n const refreshOwnerSnapshot = () => {\n if (scopedSlotState) {\n runtimeCapabilityRegistry.scopedSlots?.refresh(target, scopedSlotState)\n }\n }\n const completeSuccessfulSetData = () => {\n if (disposed) {\n return\n }\n const bindings = target.__wevuTemplateRefs\n if (!runtimeCapabilityRegistry.templateRefs && (!Array.isArray(bindings) || !bindings.length)) {\n if (ownsHostCommit) {\n finishHostCommit()\n }\n return\n }\n requireRuntimeCapability(\n 'templateRefs',\n 'mountRuntimeInstance(template ref completion)',\n ).schedule(\n target,\n ownsHostCommit ? finishHostCommit : undefined,\n target,\n ownsHostCommit ? failHostCommit : undefined,\n )\n }\n const syncNativeOwnerId = () => {\n if (scopedSlotState) {\n scopedSlotHooks?.syncNativeOwnerId(target, scopedSlotState)\n }\n }\n const appendPendingSettlement = (settle: SetDataAdapterSettler) => {\n const record: BufferedSetDataSettlement = {\n settle,\n next: undefined,\n }\n if (pendingSettlementTail) {\n pendingSettlementTail.next = record\n }\n else {\n pendingSettlementHead = record\n }\n pendingSettlementTail = record\n }\n const settlePendingRecords = (\n first: BufferedSetDataSettlement | undefined,\n settlement: SetDataAdapterSettlement,\n cause?: unknown,\n ) => {\n let current = first\n let isFirst = true\n while (current) {\n const next = current.next\n current.next = undefined\n if (settlement === 'failed' && !isFirst) {\n current.settle('abandoned')\n }\n else {\n current.settle(settlement, cause)\n }\n current = next\n isFirst = false\n }\n }\n const dispatchPhysicalSetData = (\n payload: SetDataPayload,\n settle: SetDataAdapterSettler,\n ) => {\n const generation = dispatchGeneration\n beginHostCommit()\n refreshOwnerSnapshot()\n observeSetDataCompletion({\n invoke: (callback) => {\n const setData = resolveNativeSetData(target)\n if (!setData) {\n callback()\n return undefined\n }\n return callNativeSetData(target, setData, payload, callback)\n },\n completion: 'callback',\n settle: (settlement, cause) => {\n if (disposed || generation !== dispatchGeneration) {\n return\n }\n if (settlement !== 'committed') {\n finishHostCommit(settlement, cause)\n settle(settlement, cause)\n return\n }\n // 物理提交已成功,但实例屏障仍需等待原始回调;回调失败不能回滚快照账本。\n try {\n settle(settlement, cause)\n }\n catch (error) {\n finishHostCommit('failed', error)\n throw error\n }\n completeSuccessfulSetData()\n },\n })\n }\n const flushPendingSetData = () => {\n if (!pendingPayload) {\n return\n }\n const payload = pendingPayload\n const settlements = pendingSettlementHead\n const rawCallbacks = pendingRawCallbacks\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n dispatchPhysicalSetData(payload, (settlement, cause) => {\n if (settlement === 'committed') {\n try {\n for (const callback of rawCallbacks) {\n callback()\n }\n }\n finally {\n settlePendingRecords(settlements, settlement, cause)\n }\n return\n }\n settlePendingRecords(settlements, settlement, cause)\n })\n }\n const abandonPendingSetData = () => {\n const settlements = pendingSettlementHead\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n settlePendingRecords(settlements, 'abandoned')\n flushHostCommitWaiter()\n }\n const bufferPayload = (payload: SetDataPayload) => {\n resetHostCommitFailure()\n pendingPayload = mergeBufferedSetDataPayload(pendingPayload, payload)\n }\n\n const adapter: AdapterWithSetData = {\n setData(payload: Record<string, any>, callback?: () => void) {\n highFrequencyWarning?.()\n if (!enabled || (suspendWhenHidden && !visible)) {\n bufferPayload(payload)\n if (callback) {\n pendingRawCallbacks.push(callback)\n }\n refreshOwnerSnapshot()\n return undefined\n }\n\n refreshOwnerSnapshot()\n resetHostCommitFailure()\n beginHostCommit()\n const setData = resolveNativeSetData(target)\n if (!setData) {\n try {\n callback?.()\n }\n catch (cause) {\n finishHostCommit('failed', cause)\n throw cause\n }\n completeSuccessfulSetData()\n return undefined\n }\n\n let invoking = true\n let callbackCalled = false\n let returnIsAuthoritative = false\n let successHandled = false\n const handleFailure = (cause: unknown) => {\n if (successHandled) {\n return\n }\n successHandled = true\n finishHostCommit('failed', cause)\n }\n const handleSuccess = () => {\n if (successHandled) {\n return\n }\n successHandled = true\n completeSuccessfulSetData()\n }\n const nativeCallback = () => {\n try {\n callback?.()\n }\n catch (cause) {\n handleFailure(cause)\n throw cause\n }\n if (invoking) {\n callbackCalled = true\n return\n }\n if (!returnIsAuthoritative) {\n handleSuccess()\n }\n }\n let result: void | Promise<void>\n try {\n result = callNativeSetData(target, setData, payload, nativeCallback)\n }\n catch (cause) {\n handleFailure(cause)\n throw cause\n }\n invoking = false\n returnIsAuthoritative = Boolean(result && typeof result.then === 'function')\n if (result && typeof result.then === 'function') {\n return result.then(\n () => {\n handleSuccess()\n },\n (cause) => {\n handleFailure(cause)\n throw cause\n },\n )\n }\n if (callbackCalled) {\n handleSuccess()\n }\n return result\n },\n __wevu_dispatchSetData(payload, settle) {\n highFrequencyWarning?.()\n if (disposed) {\n settle('abandoned')\n return\n }\n if (!enabled || (suspendWhenHidden && !visible)) {\n bufferPayload(payload)\n appendPendingSettlement(settle)\n refreshOwnerSnapshot()\n return\n }\n resetHostCommitFailure()\n dispatchPhysicalSetData(payload, settle)\n },\n __wevu_enableSetData(discardPending = false) {\n enabled = true\n if (discardPending) {\n abandonPendingSetData()\n return\n }\n flushPendingSetData()\n },\n __wevu_setVisibility(nextVisible: boolean) {\n visible = nextVisible\n if (visible && enabled) {\n flushPendingSetData()\n }\n },\n __wevu_disposeSetData() {\n if (disposed) {\n return\n }\n disposed = true\n dispatchGeneration += 1\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n pendingHostCommits = 0\n hostCommitFailed = false\n hostCommitCause = undefined\n flushHostCommitWaiter()\n if (ownsHostCommit) {\n Reflect.deleteProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY)\n }\n },\n }\n\n const baseMountAdapter = {\n ...adapter,\n }\n Object.defineProperty(baseMountAdapter, '__wevu_reportSetDataError', {\n configurable: true,\n enumerable: false,\n value: (error: Error) => {\n callHookList(target, 'onError', [error])\n },\n writable: false,\n })\n Object.defineProperty(baseMountAdapter, '__wevu_targetLabel', {\n configurable: true,\n enumerable: false,\n value: targetLabel,\n writable: false,\n })\n const targetProperties = (target as any).properties\n if (targetProperties && typeof targetProperties === 'object') {\n Object.defineProperty(baseMountAdapter, '__wevu_initialProps', {\n configurable: true,\n enumerable: false,\n value: targetProperties,\n writable: false,\n })\n }\n if (Array.isArray(options?.snapshotOmitKeys) && options.snapshotOmitKeys.length) {\n Object.defineProperty(baseMountAdapter, '__wevu_snapshotOmitKeys', {\n configurable: true,\n enumerable: false,\n value: options.snapshotOmitKeys,\n writable: false,\n })\n }\n const initialSnapshot = resolveInitialSnapshotFromNativeData(\n target,\n options?.snapshotOmitKeys,\n )\n if (initialSnapshot && Object.keys(initialSnapshot).length) {\n Object.defineProperty(baseMountAdapter, '__wevu_initialSnapshot', {\n configurable: true,\n enumerable: false,\n value: initialSnapshot,\n writable: false,\n })\n }\n if (scopedSlotState) {\n Object.defineProperty(baseMountAdapter, '__wevu_initialState', {\n configurable: true,\n enumerable: false,\n value: { [WEVU_SLOT_OWNER_ID_KEY]: scopedSlotState.ownerId },\n writable: false,\n })\n }\n const shouldDeferInitialSnapshot = Boolean(options?.deferSetData)\n || Boolean(setup)\n || Boolean(targetProperties && typeof targetProperties === 'object' && Object.keys(targetProperties).length > 0)\n if (shouldDeferInitialSnapshot) {\n Object.defineProperty(baseMountAdapter, '__wevu_deferInitialSnapshot', {\n configurable: true,\n enumerable: false,\n value: true,\n writable: false,\n })\n }\n const runtime = runtimeApp.mount(baseMountAdapter)\n attachRuntimeInstance(runtime as RuntimeInstance<any, any, any>, target)\n const runtimeProxy = runtime?.proxy ?? {}\n const runtimeState = runtime?.state ?? {}\n const runtimeSetupState = runtime?.setupState ?? Object.create(null)\n if (runtimeState && typeof runtimeState === 'object') {\n attachRuntimeRef(runtimeState as Record<string, any>, runtime)\n attachNativeInstanceRef(runtimeState as Record<string, any>, target)\n }\n const runtimeComputed = (runtime as any)?.computed ?? Object.create(null)\n // 防护:适配器可能返回不完整的 runtime(或被插件篡改),此处兜底补齐\n if (!runtime?.methods) {\n try {\n ;(runtime as any).methods = Object.create(null)\n }\n catch {\n // 若对象只读则忽略,后续将使用兜底 runtimeMethods\n }\n }\n const runtimeMethods = runtime?.methods ?? Object.create(null)\n const runtimeWatch = (runtime as any)?.watch ?? (() => createNoopWatchStopHandle())\n const runtimeBindModel = (runtime as any)?.bindModel ?? (() => {})\n const runtimeWithDefaults = {\n ...(runtime ?? {}),\n state: runtimeState,\n setupState: runtimeSetupState,\n proxy: runtimeProxy,\n methods: runtimeMethods,\n computed: runtimeComputed,\n watch: runtimeWatch,\n bindModel: runtimeBindModel,\n snapshot: (runtime as any)?.snapshot ?? (() => Object.create(null)),\n unmount: (runtime as any)?.unmount ?? (() => {}),\n } satisfies RuntimeInstance<any, any, any>\n Object.defineProperty(runtimeWithDefaults, '__wevu_initialRuntimeSnapshot', {\n configurable: true,\n enumerable: false,\n value: cloneInitialSnapshotValue(runtimeState),\n writable: false,\n })\n const runtimeWithSyncFlush = runtimeWithDefaults as RuntimeInstanceWithSyncFlush<D, C, M>\n const internalRuntimeFields = {\n __wevu_flushSetupSnapshotSync: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_flushSetupSnapshotSync,\n __wevu_touchSetupMethodsVersion: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_touchSetupMethodsVersion,\n __wevu_trackSetupReactiveKey: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_trackSetupReactiveKey,\n __wevu_cloneDispatchedSnapshot: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_cloneDispatchedSnapshot,\n [WEVU_PROPS_DERIVED_KEYS_KEY]: (runtime as any)[WEVU_PROPS_DERIVED_KEYS_KEY],\n }\n for (const [key, value] of Object.entries(internalRuntimeFields)) {\n if (!value) {\n continue\n }\n Object.defineProperty(runtimeWithDefaults, key, {\n configurable: true,\n enumerable: false,\n value,\n writable: true,\n })\n }\n\n Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {\n value: runtimeWithDefaults,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n target.__wevu = runtimeWithDefaults\n const runtimeProps = ensureRuntimeProps(target, runtimeState as Record<string, any>)\n attachRuntimeSlots(runtimeState as Record<string, any>, runtimeProps)\n\n if (scopedSlotState) {\n scopedSlotHooks?.attachMount(target, runtimeWithDefaults, scopedSlotState, Boolean(options?.deferSetData))\n }\n syncNativeOwnerId()\n\n const watchStops = watchMap\n ? registerWatches(runtimeWithDefaults, watchMap, target, {\n deferMissingSourceBaseline: Boolean(setup),\n })\n : []\n if (watchStops.length) {\n target[WEVU_WATCH_STOPS_KEY] = watchStops\n }\n\n if (setup) {\n try {\n runRuntimeSetupPhase({\n target,\n runtime,\n runtimeWithDefaults,\n runtimeState: runtimeState as Record<string, any>,\n runtimeProxy: runtimeProxy as Record<string, any>,\n setup,\n })\n if (typeof getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]?.trackWevuComponent === 'function') {\n const initialReactiveSetupSnapshot: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(runtimeWithDefaults.setupState ?? {})) {\n if (isReactive(value)) {\n initialReactiveSetupSnapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n initialReactiveSetupSnapshots.set(runtimeWithDefaults, initialReactiveSetupSnapshot)\n }\n if (!options?.deferSetData) {\n runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync?.()\n }\n if (!options?.deferSetData) {\n refreshOwnerSnapshot()\n }\n for (const stop of watchStops) {\n stop.resume()\n }\n }\n catch (error) {\n try {\n // eslint-disable-next-line ts/no-use-before-define -- setup 失败后复用统一 teardown 回滚已安装运行时\n teardownRuntimeInstance(target, { skipHooks: true })\n }\n catch {\n // setup 异常优先,回滚异常不能覆盖原始失败。\n }\n throw error\n }\n }\n else if (\n !options?.deferSetData\n && (target as any).properties\n && typeof (target as any).properties === 'object'\n && Object.keys((target as any).properties).length > 0\n ) {\n runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync?.()\n refreshOwnerSnapshot()\n }\n\n // 将 runtime.methods 透传到原生实例,供小程序事件处理直接调用\n bridgeRuntimeMethodsToTarget(target, runtime)\n\n return runtime\n}\n\nfunction preserveRuntimeFacadeIdentity<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n previousRuntime: RuntimeInstance<D, C, M>,\n nextRuntime: RuntimeInstance<D, C, M>,\n) {\n for (const key of Reflect.ownKeys(previousRuntime)) {\n if (!Reflect.has(nextRuntime, key)) {\n const descriptor = Reflect.getOwnPropertyDescriptor(previousRuntime, key)\n if (descriptor?.configurable) {\n Reflect.deleteProperty(previousRuntime, key)\n }\n }\n }\n for (const key of Reflect.ownKeys(nextRuntime)) {\n const descriptor = Reflect.getOwnPropertyDescriptor(nextRuntime, key)\n if (!descriptor) {\n continue\n }\n try {\n Reflect.defineProperty(previousRuntime, key, descriptor)\n }\n catch {\n try {\n ;(previousRuntime as any)[key] = (nextRuntime as any)[key]\n }\n catch {\n // 宿主包装对象仍持有旧 runtime 时,保留无法覆盖的只读字段。\n }\n }\n }\n attachRuntimeRef(previousRuntime.state as Record<string, any>, previousRuntime)\n const nextInitialSetupSnapshot = initialReactiveSetupSnapshots.get(nextRuntime)\n if (nextInitialSetupSnapshot) {\n initialReactiveSetupSnapshots.set(previousRuntime, nextInitialSetupSnapshot)\n }\n target.__wevu = previousRuntime\n Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {\n value: previousRuntime,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n return previousRuntime\n}\n\nfunction createRuntimeStateSnapshot(\n runtime: RuntimeInstance<any, any, any>,\n nativeData: Record<string, any> | undefined,\n preferredState?: Record<string, any>,\n) {\n const runtimeState = runtime.state as Record<string, any>\n const setupState = runtime.setupState as Record<string, any> | undefined\n const snapshot: Record<string, any> = {}\n for (const key of Object.keys(nativeData ?? {})) {\n if (!Object.prototype.hasOwnProperty.call(runtimeState, key)) {\n continue\n }\n const setupBinding = setupState?.[key]\n if (setupState && Object.prototype.hasOwnProperty.call(setupState, key) && !isRef(setupBinding) && !isReactive(setupBinding)) {\n continue\n }\n if (preferredState && Object.prototype.hasOwnProperty.call(preferredState, key)) {\n snapshot[key] = cloneInitialSnapshotValue(preferredState[key])\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(isRef(setupBinding) ? setupBinding.value : runtimeState[key])\n }\n return snapshot\n}\n\nfunction syncRuntimeStateFromNativeData(\n target: InternalRuntimeState,\n options?: { includeSetupState?: boolean, nativeData?: Record<string, any>, initialSetupState?: Record<string, unknown> },\n) {\n const runtime = target.__wevu\n const runtimeState = runtime?.state as Record<string, any> | undefined\n const setupState = runtime?.setupState as Record<string, any> | undefined\n const nativeData = options?.nativeData ?? (target as any).data as Record<string, any> | undefined\n if (!runtimeState || typeof runtimeState !== 'object' || !nativeData || typeof nativeData !== 'object') {\n return\n }\n const initialRuntimeSnapshot = (runtime as any)?.__wevu_initialRuntimeSnapshot as Record<string, any> | undefined\n for (const [key, value] of Object.entries(nativeData)) {\n if (!key || key === 'undefined') {\n continue\n }\n if (Object.prototype.hasOwnProperty.call(runtimeState, key)) {\n try {\n const setupBinding = setupState?.[key]\n const runtimeValue = cloneInitialSnapshotValue(value)\n if (setupState && Object.prototype.hasOwnProperty.call(setupState, key)) {\n // 普通 setup 值来自当前代码;仅 ref/reactive 绑定承接宿主状态。\n if (!options?.includeSetupState || (!isRef(setupBinding) && !isReactive(setupBinding))) {\n continue\n }\n }\n if (\n !options?.includeSetupState\n && initialRuntimeSnapshot\n && Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)\n && !isDeepEqualValue(runtimeState[key], initialRuntimeSnapshot[key], 20, { keys: 10_000 })\n ) {\n continue\n }\n if (\n !options?.includeSetupState\n && initialRuntimeSnapshot\n && !Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)\n ) {\n continue\n }\n if (isRef(setupBinding)) {\n setupBinding.value = runtimeValue\n continue\n }\n if (isReactive(setupBinding) && runtimeValue && typeof runtimeValue === 'object') {\n restoreReactiveSetupSnapshot(setupBinding, runtimeValue, options?.initialSetupState?.[key])\n continue\n }\n runtimeState[key] = runtimeValue\n }\n catch {\n // DevTools 热更新期间可能带入响应式 state 拒绝写入的临时 data key,跳过即可。\n }\n }\n }\n}\n\nexport function enableDeferredSetData(\n target: InternalRuntimeState,\n options?: { rehydrateSetupState?: boolean },\n) {\n const adapter = target.__wevu?.adapter as AdapterWithSetData | undefined\n syncRuntimeStateFromNativeData(target, {\n includeSetupState: options?.rehydrateSetupState,\n })\n adapter?.__wevu_enableSetData?.(true)\n ;(target as any).__wevu?.__wevu_flushSetupSnapshotSync?.()\n}\n\nexport function setRuntimeSetDataVisibility(target: InternalRuntimeState, visible: boolean) {\n const adapter = target.__wevu?.adapter as AdapterWithSetData | undefined\n adapter?.__wevu_setVisibility?.(visible)\n}\n\n/**\n * 卸载运行时实例(框架内部注册流程使用)。\n * @internal\n */\nexport function teardownRuntimeInstance(target: InternalRuntimeState, options?: { skipHooks?: boolean }) {\n const runtime = target.__wevu\n\n const stops = target[WEVU_WATCH_STOPS_KEY]\n const effectScope = target[WEVU_EFFECT_SCOPE_KEY]\n\n runTeardownSteps([\n () => {\n if (!options?.skipHooks && runtime && target[WEVU_HOOKS_KEY]?.[WEVU_ON_BEFORE_UNMOUNT_HOOK]) {\n if (effectScope?.active) {\n effectScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK))\n }\n else {\n const teardownScope = createEffectScope(true)\n runTeardownSteps([\n () => teardownScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK)),\n () => teardownScope.stop(),\n ])\n }\n }\n },\n () => runtimeCapabilityRegistry.scopedSlots?.teardown(target),\n () => {\n if (Array.isArray(target.__wevuTemplateRefs) && target.__wevuTemplateRefs.length > 0) {\n requireRuntimeCapability('templateRefs', 'teardownRuntimeInstance(template refs)').clear(target)\n }\n },\n () => {\n // 触发卸载钩子(仅在 teardown 首次执行时触发)\n if (!options?.skipHooks && runtime && target[WEVU_HOOKS_KEY]) {\n callHookList(target, 'onUnload', [])\n }\n },\n () => {\n // 清理注册的生命周期钩子\n if (target[WEVU_HOOKS_KEY]) {\n target[WEVU_HOOKS_KEY] = undefined\n }\n },\n () => {\n if (Array.isArray(stops)) {\n for (const stop of stops) {\n try {\n stop()\n }\n catch {\n // 避免 teardown 中断:单个 stop 失败不阻塞其他清理\n }\n }\n }\n },\n () => {\n target[WEVU_WATCH_STOPS_KEY] = undefined\n },\n () => {\n effectScope?.stop()\n },\n () => {\n target[WEVU_EFFECT_SCOPE_KEY] = undefined\n },\n () => runtime?.unmount(),\n () => {\n const adapter = runtime?.adapter as AdapterWithSetData | undefined\n adapter?.__wevu_disposeSetData?.()\n },\n () => {\n delete (target as any)[WEVU_SETUP_CONTEXT_INSTANCE_KEY]\n delete (target as any)[WEVU_EXPOSED_KEY]\n },\n () => {\n delete target.__wevu\n },\n () => {\n if (WEVU_PUBLIC_RUNTIME_KEY in target) {\n delete (target as any)[WEVU_PUBLIC_RUNTIME_KEY]\n }\n },\n ])\n}\n\n/**\n * 重建运行时实例,同时保持宿主包装对象持有的 runtime facade 身份稳定。\n * @internal\n */\nexport function refreshRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: { snapshotOmitKeys?: string[], stateSnapshot?: Record<string, any> },\n) {\n const previousRuntime = target.__wevu as RuntimeInstance<D, C, M> | undefined\n const initialSetupState = previousRuntime ? initialReactiveSetupSnapshots.get(previousRuntime) : undefined\n const previousRuntimeState = previousRuntime\n ? createRuntimeStateSnapshot(previousRuntime, (target as any).data, options?.stateSnapshot)\n : undefined\n teardownRuntimeInstance(target, { skipHooks: true })\n const nextRuntime = mountRuntimeInstance(target, runtimeApp, watchMap, setup, {\n deferSetData: true,\n snapshotOmitKeys: options?.snapshotOmitKeys,\n })\n const stateSnapshot = previousRuntimeState ?? (options?.stateSnapshot\n ? createRuntimeStateSnapshot(nextRuntime, options.stateSnapshot, options.stateSnapshot)\n : undefined)\n if (stateSnapshot) {\n const nativeData = (target as any).data\n if (nativeData && typeof nativeData === 'object') {\n Object.assign(nativeData, cloneInitialSnapshotValue(stateSnapshot))\n }\n syncRuntimeStateFromNativeData(target, {\n includeSetupState: true,\n nativeData: stateSnapshot,\n initialSetupState,\n })\n }\n if (!previousRuntime || previousRuntime === nextRuntime) {\n return nextRuntime\n }\n return preserveRuntimeFacadeIdentity(target, previousRuntime, nextRuntime)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0DA,MAAM,gDAAgC,IAAI,QAAyC;AAEnF,SAAS,0BAA0B,OAAgB,wBAA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ACA,MAAM,kBAAkB,OAAO;CAC/B,MAAM,oBAAoB,kBAAkB,8BAA8B,IAAI,eAAe,IAAI;CACjG,MAAM,uBAAuB,kBACzB,2BAA2B,iBAAkB,OAAe,MAAM,SAAS,aAAa,IACxF;CACJ,wBAAwB,QAAQ,EAAE,WAAW,KAAK,CAAC;CACnD,MAAM,cAAc,qBAAqB,QAAQ,YAAY,UAAU,OAAO;EAC5E,cAAc;EACd,kBAAkB,SAAS;CAC7B,CAAC;CACD,MAAM,gBAAgB,yBAAyB,SAAS,gBACpD,2BAA2B,aAAa,QAAQ,eAAe,QAAQ,aAAa,IACpF;CACJ,IAAI,eAAe;EACjB,MAAM,aAAc,OAAe;EACnC,IAAI,cAAc,OAAO,eAAe,UACtC,OAAO,OAAO,YAAY,0BAA0B,aAAa,CAAC;EAEpE,+BAA+B,QAAQ;GACrC,mBAAmB;GACnB,YAAY;GACZ;EACF,CAAC;CACH;CACA,IAAI,CAAC,mBAAmB,oBAAoB,aAC1C,OAAO;CAET,OAAO,8BAA8B,QAAQ,iBAAiB,WAAW;AAC3E"}
1
+ {"version":3,"file":"runtimeInstance.mjs","names":["effectScope","createEffectScope"],"sources":["../../../../src/runtime/register/runtimeInstance.ts"],"sourcesContent":["import type { SetDataAdapterSettlement, SetDataAdapterSettler, SetDataPayload } from '../app/setData/commitTracker'\nimport type { PhysicalSetDataObserver } from '../app/setData/observation'\nimport type {\n ComponentPropsOptions,\n ComputedDefinitions,\n DefineAppOptions,\n DefineComponentOptions,\n InternalRuntimeState,\n MethodDefinitions,\n RuntimeApp,\n RuntimeInstance,\n SetDataSnapshotOptions,\n} from '../types'\nimport type { AdapterWithSetData } from './runtimeInstance/utils'\nimport type { WatchMap } from './watch'\nimport {\n WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY,\n WEVU_EFFECT_SCOPE_KEY,\n WEVU_EXPOSED_KEY,\n WEVU_HOOKS_KEY,\n WEVU_HOST_COMMIT_PROMISE_KEY,\n WEVU_NATIVE_SLOT_CONTEXT_KEY,\n WEVU_ON_BEFORE_UNMOUNT_HOOK,\n WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY,\n WEVU_PARENT_INSTANCE_KEY,\n WEVU_PROPS_DERIVED_KEYS_KEY,\n WEVU_PROVIDES_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n WEVU_RUNTIME_APP_KEY,\n WEVU_SETUP_CONTEXT_INSTANCE_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_WATCH_STOPS_KEY,\n} from '@weapp-core/constants'\nimport { effectScope as createEffectScope, isReactive, isRef } from '../../reactivity'\nimport { observeSetDataCompletion } from '../app/setData/commitTracker'\nimport { observePhysicalDispatch } from '../app/setData/observation'\nimport { applySnapshotUpdate, isDeepEqualValue } from '../app/setData/snapshot'\nimport {\n isSetDataHighFrequencyWarningRequested,\n requireRuntimeCapability,\n runtimeCapabilityRegistry,\n} from '../capabilities'\nimport { callHookList } from '../hooks'\nimport { isRuntimeLayoutComponentTarget } from '../layoutComponentMatcher'\nimport { getMiniProgramRuntimeGlobalObject } from '../platform'\nimport { runTeardownSteps } from '../teardown'\nimport { bridgeRuntimeMethodsToTarget } from './runtimeInstance/methodBridge'\nimport { releaseNativeDeclaration } from './runtimeInstance/nativeDeclaration'\nimport { attachRuntimeProvideParentContext } from './runtimeInstance/provideContext'\nimport {\n attachRuntimeSlots,\n createNoopWatchStopHandle,\n safeMarkNoSetData,\n} from './runtimeInstance/setupContext'\nimport { runRuntimeSetupPhase } from './runtimeInstance/setupPhase'\nimport { restoreReactiveSetupSnapshot } from './runtimeInstance/setupSnapshot'\nimport {\n attachNativeInstanceRef,\n attachRuntimeInstance,\n attachRuntimeRef,\n callNativeSetData,\n ensureRuntimeProps,\n resolveNativeSetData,\n} from './runtimeInstance/utils'\nimport { registerWatches } from './watch'\n\ntype ImportMetaWithEnv = ImportMeta & { env?: { PLATFORM?: string, PROD?: boolean } }\n\nconst initialReactiveSetupSnapshots = new WeakMap<object, Record<string, unknown>>()\n\nfunction cloneInitialSnapshotValue(value: unknown, cache = new WeakMap<object, unknown>()): unknown {\n if (!value || typeof value !== 'object') {\n return value\n }\n if (cache.has(value as object)) {\n return cache.get(value as object)\n }\n if (Array.isArray(value)) {\n const next: unknown[] = []\n cache.set(value, next)\n for (const item of value) {\n next.push(cloneInitialSnapshotValue(item, cache))\n }\n return next\n }\n const next: Record<string, unknown> = {}\n cache.set(value as object, next)\n for (const [key, child] of Object.entries(value as Record<string, unknown>)) {\n next[key] = cloneInitialSnapshotValue(child, cache)\n }\n return next\n}\nfunction mergeBufferedSetDataPayload(\n buffered: SetDataPayload | undefined,\n incoming: SetDataPayload,\n): SetDataPayload {\n const merged = buffered ?? {}\n for (const [path, value] of Object.entries(incoming)) {\n let ancestorPath: string | undefined\n for (const candidate of Object.keys(merged)) {\n if (path.startsWith(`${candidate}.`)) {\n ancestorPath = candidate\n break\n }\n }\n if (ancestorPath) {\n const holder: Record<string, unknown> = { value: merged[ancestorPath] }\n applySnapshotUpdate(\n holder,\n `value.${path.slice(ancestorPath.length + 1)}`,\n value,\n 'set',\n { cloneValue: false, clonedParents: new WeakSet<object>() },\n )\n merged[ancestorPath] = holder.value\n continue\n }\n const descendantPrefix = `${path}.`\n for (const candidate of Object.keys(merged)) {\n if (candidate.startsWith(descendantPrefix)) {\n delete merged[candidate]\n }\n }\n merged[path] = value\n }\n return merged\n}\n\nfunction resolveInitialSnapshotFromNativeData(\n target: InternalRuntimeState,\n omitKeys?: string[],\n extraEntries?: Record<string, unknown>,\n) {\n const data = (target as any).data\n if ((!data || typeof data !== 'object') && (!extraEntries || !Object.keys(extraEntries).length)) {\n return undefined\n }\n const omitSet = Array.isArray(omitKeys) && omitKeys.length\n ? new Set(omitKeys)\n : undefined\n const snapshot: Record<string, any> = {}\n if (data && typeof data === 'object') {\n for (const [key, value] of Object.entries(data as Record<string, unknown>)) {\n if (omitSet?.has(key)) {\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n if (extraEntries) {\n for (const [key, value] of Object.entries(extraEntries)) {\n if (omitSet?.has(key)) {\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n return snapshot\n}\n\nfunction hasTemplateRuntimeBindings(runtimeApp: RuntimeApp<any, any, any>) {\n return Boolean((runtimeApp as any)?.__wevuHasTemplateRuntimeBindings)\n}\n\ntype RuntimeSetupFunction<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']\n | DefineAppOptions<D, C, M>['setup']\n\ntype RuntimeInstanceWithSyncFlush<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = RuntimeInstance<D, C, M> & {\n __wevu_flushSetupSnapshotSync?: () => void\n __wevu_touchSetupMethodsVersion?: () => void\n __wevu_trackSetupReactiveKey?: (key: string) => void\n __wevu_cloneDispatchedSnapshot?: () => Record<string, any>\n}\n\ninterface BufferedSetDataSettlement {\n settle: SetDataAdapterSettler\n next: BufferedSetDataSettlement | undefined\n}\n\ninterface RuntimeMountOptions {\n deferSetData?: boolean\n snapshotOmitKeys?: string[]\n attached?: boolean\n layoutParent?: InternalRuntimeState\n}\n\n/**\n * 挂载运行时实例(框架内部注册流程使用)。\n * @internal\n */\nexport function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: RuntimeMountOptions,\n): RuntimeInstance<D, C, M> {\n if (target.__wevu) {\n // 经典 HMR 可能复用宿主页面实例并重新执行页面脚本。此时旧 runtime\n // 仍然存在,但它绑定的是上一轮模块创建的 runtimeApp;继续直接返回会\n // 让新脚本闭包更新一份未被旧 tracker 订阅的 setup 状态。通过统一刷新\n // 路径重建响应式绑定,同时保留宿主实例和已提交的数据快照。\n // 只在应用明确为生产构建时裁剪;未提供 Vite env 的消费者保留刷新兼容。\n if ((import.meta as ImportMetaWithEnv).env?.PROD !== true && target[WEVU_RUNTIME_APP_KEY] && target[WEVU_RUNTIME_APP_KEY] !== runtimeApp) {\n // eslint-disable-next-line ts/no-use-before-define -- refreshRuntimeInstance 统一处理旧实例快照与 facade 复用。\n return refreshRuntimeInstance(target, runtimeApp, watchMap, setup, {\n snapshotOmitKeys: options?.snapshotOmitKeys,\n attached: options?.attached,\n })\n }\n return target.__wevu as RuntimeInstance<D, C, M>\n }\n try {\n // eslint-disable-next-line ts/no-use-before-define -- 统一事务边界覆盖声明注册后、setup 前的挂载失败。\n return mountRuntimeInstanceWithContext(target, runtimeApp, watchMap, setup, options)\n }\n catch (error) {\n try {\n // eslint-disable-next-line ts/no-use-before-define -- 所有挂载失败共用 teardown,不能留下原生声明地址。\n teardownRuntimeInstance(target, { skipHooks: true })\n }\n catch {\n // 保留原始挂载异常,清理异常不能覆盖它。\n }\n throw error\n }\n}\n\nfunction mountRuntimeInstanceWithContext<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: RuntimeMountOptions,\n) {\n const runtimeSetDataOptions = (\n runtimeApp as typeof runtimeApp & { __wevuSetDataOptions?: SetDataSnapshotOptions }\n ).__wevuSetDataOptions\n const hasScopedSlotBindings = hasTemplateRuntimeBindings(runtimeApp)\n const scopedSlotHooks = hasScopedSlotBindings\n ? requireRuntimeCapability('scopedSlots', 'mountRuntimeInstance(scoped-slot bindings)')\n : undefined\n const scopedSlotState = scopedSlotHooks?.prepareMount(target)\n const templateRefBindings = target.__wevuTemplateRefs\n if (Array.isArray(templateRefBindings) && templateRefBindings.length) {\n requireRuntimeCapability('templateRefs', 'mountRuntimeInstance(template refs)')\n }\n const highFrequencyWarningRequested = isSetDataHighFrequencyWarningRequested(\n runtimeSetDataOptions?.highFrequencyWarning,\n )\n const highFrequencyWarningHooks = highFrequencyWarningRequested\n ? requireRuntimeCapability('setDataHighFrequencyWarning', 'mountRuntimeInstance(setData.highFrequencyWarning)')\n : undefined\n attachRuntimeProvideParentContext(target, runtimeApp, options?.attached, options?.layoutParent)\n safeMarkNoSetData(target)\n const suspendWhenHidden = Boolean(runtimeSetDataOptions?.suspendWhenHidden)\n const targetLabel = typeof (target as any).route === 'string' && (target as any).route\n ? `page:${(target as any).route}`\n : typeof (target as any).is === 'string' && (target as any).is\n ? `component:${(target as any).is}`\n : 'unknown-target'\n const highFrequencyWarning = highFrequencyWarningHooks?.createMonitor({\n option: runtimeSetDataOptions?.highFrequencyWarning,\n targetLabel,\n isInPageScrollHook: () => Number((target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 0) > 0,\n })\n let visible = true\n let enabled = !options?.deferSetData\n let disposed = false\n let dispatchGeneration = 0\n let pendingPayload: SetDataPayload | undefined\n let pendingSettlementHead: BufferedSetDataSettlement | undefined\n let pendingSettlementTail: BufferedSetDataSettlement | undefined\n let pendingObservers: PhysicalSetDataObserver[] | undefined\n let pendingRawCallbacks: Array<() => void> = []\n const ownsHostCommit = !(WEVU_HOST_COMMIT_PROMISE_KEY in target)\n let pendingHostCommits = 0\n let hostCommitFailed = false\n let hostCommitCause: unknown\n let hostCommitPromise: Promise<void> | undefined\n let resolveHostCommit: (() => void) | undefined\n let rejectHostCommit: ((cause: unknown) => void) | undefined\n\n const resetHostCommitFailure = () => {\n if (!pendingHostCommits && !pendingPayload && !hostCommitPromise) {\n hostCommitFailed = false\n hostCommitCause = undefined\n }\n }\n const flushHostCommitWaiter = () => {\n if (pendingHostCommits || pendingPayload) {\n return\n }\n if (hostCommitFailed) {\n rejectHostCommit?.(hostCommitCause)\n }\n else {\n resolveHostCommit?.()\n }\n hostCommitPromise = undefined\n resolveHostCommit = undefined\n rejectHostCommit = undefined\n }\n const beginHostCommit = () => {\n if (ownsHostCommit) {\n pendingHostCommits += 1\n }\n }\n const finishHostCommit = (settlement: SetDataAdapterSettlement = 'committed', cause?: unknown) => {\n if (!ownsHostCommit || disposed) {\n return\n }\n if (settlement === 'failed' && !hostCommitFailed) {\n hostCommitFailed = true\n hostCommitCause = cause\n }\n pendingHostCommits -= 1\n flushHostCommitWaiter()\n }\n const failHostCommit = (cause: unknown) => finishHostCommit('failed', cause)\n if (ownsHostCommit) {\n Object.defineProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY, {\n configurable: true,\n enumerable: false,\n get: () => {\n if (!pendingHostCommits && !pendingPayload) {\n return hostCommitFailed ? Promise.reject(hostCommitCause) : undefined\n }\n // 只有实例 $nextTick 消费宿主屏障时才创建 Promise。\n hostCommitPromise ??= new Promise<void>((resolve, reject) => {\n resolveHostCommit = resolve\n rejectHostCommit = reject\n })\n return hostCommitPromise\n },\n })\n }\n\n const refreshOwnerSnapshot = () => {\n if (scopedSlotState) {\n runtimeCapabilityRegistry.scopedSlots?.refresh(target, scopedSlotState)\n }\n }\n const completeSuccessfulSetData = () => {\n if (disposed) {\n return\n }\n const bindings = target.__wevuTemplateRefs\n if (!runtimeCapabilityRegistry.templateRefs && (!Array.isArray(bindings) || !bindings.length)) {\n if (ownsHostCommit) {\n finishHostCommit()\n }\n return\n }\n requireRuntimeCapability(\n 'templateRefs',\n 'mountRuntimeInstance(template ref completion)',\n ).schedule(\n target,\n ownsHostCommit ? finishHostCommit : undefined,\n target,\n ownsHostCommit ? failHostCommit : undefined,\n )\n }\n const syncNativeOwnerId = () => {\n if (scopedSlotState) {\n scopedSlotHooks?.syncNativeOwnerId(target, scopedSlotState)\n }\n }\n const appendPendingSettlement = (settle: SetDataAdapterSettler, observer?: PhysicalSetDataObserver) => {\n const record: BufferedSetDataSettlement = {\n settle,\n next: undefined,\n }\n if (pendingSettlementTail) {\n pendingSettlementTail.next = record\n }\n else {\n pendingSettlementHead = record\n }\n pendingSettlementTail = record\n if (observer) {\n (pendingObservers ??= []).push(observer)\n }\n }\n const settlePendingRecords = (\n first: BufferedSetDataSettlement | undefined,\n settlement: SetDataAdapterSettlement,\n cause?: unknown,\n ) => {\n let current = first\n let isFirst = true\n while (current) {\n const next = current.next\n current.next = undefined\n if (settlement === 'failed' && !isFirst) {\n current.settle('abandoned')\n }\n else {\n current.settle(settlement, cause)\n }\n current = next\n isFirst = false\n }\n }\n const dispatchPhysicalSetData = (\n payload: SetDataPayload,\n settle: SetDataAdapterSettler,\n observer?: PhysicalSetDataObserver,\n ) => {\n const generation = dispatchGeneration\n beginHostCommit()\n refreshOwnerSnapshot()\n observeSetDataCompletion({\n observer,\n invoke: (callback) => {\n const setData = resolveNativeSetData(target)\n if (!setData) {\n callback()\n return undefined\n }\n if (observer) {\n observePhysicalDispatch(observer, payload)\n }\n return callNativeSetData(target, setData, payload, callback)\n },\n completion: 'callback',\n settle: (settlement, cause) => {\n if (disposed || generation !== dispatchGeneration) {\n return\n }\n if (settlement !== 'committed') {\n finishHostCommit(settlement, cause)\n settle(settlement, cause)\n return\n }\n // 物理提交已成功,但实例屏障仍需等待原始回调;回调失败不能回滚快照账本。\n try {\n settle(settlement, cause)\n }\n catch (error) {\n finishHostCommit('failed', error)\n throw error\n }\n completeSuccessfulSetData()\n },\n })\n }\n const flushPendingSetData = () => {\n if (!pendingPayload) {\n return\n }\n const payload = pendingPayload\n const settlements = pendingSettlementHead\n const rawCallbacks = pendingRawCallbacks\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n const observers = pendingObservers\n pendingObservers = undefined\n const observer: PhysicalSetDataObserver | undefined = observers && {\n dispatch: info => observers.forEach(item => item.dispatch(info)),\n returned: returnedAt => observers.forEach(item => item.returned(returnedAt)),\n complete: boundary => observers.forEach(item => item.complete(boundary)),\n }\n dispatchPhysicalSetData(payload, (settlement, cause) => {\n if (settlement === 'committed') {\n try {\n for (const callback of rawCallbacks) {\n callback()\n }\n }\n finally {\n settlePendingRecords(settlements, settlement, cause)\n }\n return\n }\n settlePendingRecords(settlements, settlement, cause)\n }, observer)\n }\n const abandonPendingSetData = () => {\n pendingObservers = undefined\n const settlements = pendingSettlementHead\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n settlePendingRecords(settlements, 'abandoned')\n flushHostCommitWaiter()\n }\n const bufferPayload = (payload: SetDataPayload) => {\n resetHostCommitFailure()\n pendingPayload = mergeBufferedSetDataPayload(pendingPayload, payload)\n }\n\n const adapter: AdapterWithSetData = {\n setData(payload: Record<string, any>, callback?: () => void) {\n highFrequencyWarning?.()\n if (!enabled || (suspendWhenHidden && !visible)) {\n bufferPayload(payload)\n if (callback) {\n pendingRawCallbacks.push(callback)\n }\n refreshOwnerSnapshot()\n return undefined\n }\n\n refreshOwnerSnapshot()\n resetHostCommitFailure()\n beginHostCommit()\n const setData = resolveNativeSetData(target)\n if (!setData) {\n try {\n callback?.()\n }\n catch (cause) {\n finishHostCommit('failed', cause)\n throw cause\n }\n completeSuccessfulSetData()\n return undefined\n }\n\n let invoking = true\n let callbackCalled = false\n let returnIsAuthoritative = false\n let successHandled = false\n const handleFailure = (cause: unknown) => {\n if (successHandled) {\n return\n }\n successHandled = true\n finishHostCommit('failed', cause)\n }\n const handleSuccess = () => {\n if (successHandled) {\n return\n }\n successHandled = true\n completeSuccessfulSetData()\n }\n const nativeCallback = () => {\n try {\n callback?.()\n }\n catch (cause) {\n handleFailure(cause)\n throw cause\n }\n if (invoking) {\n callbackCalled = true\n return\n }\n if (!returnIsAuthoritative) {\n handleSuccess()\n }\n }\n let result: void | Promise<void>\n try {\n result = callNativeSetData(target, setData, payload, nativeCallback)\n }\n catch (cause) {\n handleFailure(cause)\n throw cause\n }\n invoking = false\n returnIsAuthoritative = Boolean(result && typeof result.then === 'function')\n if (result && typeof result.then === 'function') {\n return result.then(\n () => {\n handleSuccess()\n },\n (cause) => {\n handleFailure(cause)\n throw cause\n },\n )\n }\n if (callbackCalled) {\n handleSuccess()\n }\n return result\n },\n __wevu_dispatchSetData(payload, settle, observer) {\n highFrequencyWarning?.()\n if (disposed) {\n settle('abandoned')\n return\n }\n if (!enabled || (suspendWhenHidden && !visible)) {\n bufferPayload(payload)\n appendPendingSettlement(settle, observer)\n refreshOwnerSnapshot()\n return\n }\n resetHostCommitFailure()\n dispatchPhysicalSetData(payload, settle, observer)\n },\n __wevu_enableSetData(discardPending = false) {\n enabled = true\n if (discardPending) {\n abandonPendingSetData()\n return\n }\n flushPendingSetData()\n },\n __wevu_setVisibility(nextVisible: boolean) {\n visible = nextVisible\n if (visible && enabled) {\n flushPendingSetData()\n }\n },\n __wevu_disposeSetData() {\n if (disposed) {\n return\n }\n disposed = true\n dispatchGeneration += 1\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n pendingHostCommits = 0\n hostCommitFailed = false\n hostCommitCause = undefined\n flushHostCommitWaiter()\n if (ownsHostCommit) {\n Reflect.deleteProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY)\n }\n },\n }\n\n const baseMountAdapter = {\n ...adapter,\n }\n Object.defineProperty(baseMountAdapter, '__wevu_reportSetDataError', {\n configurable: true,\n enumerable: false,\n value: (error: Error) => {\n callHookList(target, 'onError', [error])\n },\n writable: false,\n })\n Object.defineProperty(baseMountAdapter, '__wevu_targetLabel', {\n configurable: true,\n enumerable: false,\n value: targetLabel,\n writable: false,\n })\n const targetProperties = (target as any).properties\n if (targetProperties && typeof targetProperties === 'object') {\n Object.defineProperty(baseMountAdapter, '__wevu_initialProps', {\n configurable: true,\n enumerable: false,\n value: targetProperties,\n writable: false,\n })\n }\n if (Array.isArray(options?.snapshotOmitKeys) && options.snapshotOmitKeys.length) {\n Object.defineProperty(baseMountAdapter, '__wevu_snapshotOmitKeys', {\n configurable: true,\n enumerable: false,\n value: options.snapshotOmitKeys,\n writable: false,\n })\n }\n const initialSnapshot = resolveInitialSnapshotFromNativeData(\n target,\n options?.snapshotOmitKeys,\n )\n if (initialSnapshot && Object.keys(initialSnapshot).length) {\n Object.defineProperty(baseMountAdapter, '__wevu_initialSnapshot', {\n configurable: true,\n enumerable: false,\n value: initialSnapshot,\n writable: false,\n })\n }\n if (scopedSlotState) {\n Object.defineProperty(baseMountAdapter, '__wevu_initialState', {\n configurable: true,\n enumerable: false,\n value: { [WEVU_SLOT_OWNER_ID_KEY]: scopedSlotState.ownerId },\n writable: false,\n })\n }\n const shouldDeferInitialSnapshot = Boolean(options?.deferSetData)\n || Boolean(setup)\n || Boolean(targetProperties && typeof targetProperties === 'object' && Object.keys(targetProperties).length > 0)\n if (shouldDeferInitialSnapshot) {\n Object.defineProperty(baseMountAdapter, '__wevu_deferInitialSnapshot', {\n configurable: true,\n enumerable: false,\n value: true,\n writable: false,\n })\n }\n const runtime = runtimeApp.mount(baseMountAdapter)\n attachRuntimeInstance(runtime as RuntimeInstance<any, any, any>, target)\n const runtimeProxy = runtime?.proxy ?? {}\n const runtimeState = runtime?.state ?? {}\n const runtimeSetupState = runtime?.setupState ?? Object.create(null)\n if (runtimeState && typeof runtimeState === 'object') {\n attachRuntimeRef(runtimeState as Record<string, any>, runtime)\n attachNativeInstanceRef(runtimeState as Record<string, any>, target)\n }\n const runtimeComputed = (runtime as any)?.computed ?? Object.create(null)\n // 防护:适配器可能返回不完整的 runtime(或被插件篡改),此处兜底补齐\n if (!runtime?.methods) {\n try {\n ;(runtime as any).methods = Object.create(null)\n }\n catch {\n // 若对象只读则忽略,后续将使用兜底 runtimeMethods\n }\n }\n const runtimeMethods = runtime?.methods ?? Object.create(null)\n const runtimeWatch = (runtime as any)?.watch ?? (() => createNoopWatchStopHandle())\n const runtimeBindModel = (runtime as any)?.bindModel ?? (() => {})\n const runtimeWithDefaults = {\n ...(runtime ?? {}),\n state: runtimeState,\n setupState: runtimeSetupState,\n proxy: runtimeProxy,\n methods: runtimeMethods,\n computed: runtimeComputed,\n watch: runtimeWatch,\n bindModel: runtimeBindModel,\n snapshot: (runtime as any)?.snapshot ?? (() => Object.create(null)),\n unmount: (runtime as any)?.unmount ?? (() => {}),\n } satisfies RuntimeInstance<any, any, any>\n Object.defineProperty(runtimeWithDefaults, '__wevu_initialRuntimeSnapshot', {\n configurable: true,\n enumerable: false,\n value: cloneInitialSnapshotValue(runtimeState),\n writable: false,\n })\n const runtimeWithSyncFlush = runtimeWithDefaults as RuntimeInstanceWithSyncFlush<D, C, M>\n const internalRuntimeFields = {\n __wevu_flushSetupSnapshotSync: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_flushSetupSnapshotSync,\n __wevu_touchSetupMethodsVersion: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_touchSetupMethodsVersion,\n __wevu_trackSetupReactiveKey: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_trackSetupReactiveKey,\n __wevu_cloneDispatchedSnapshot: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_cloneDispatchedSnapshot,\n [WEVU_PROPS_DERIVED_KEYS_KEY]: (runtime as any)[WEVU_PROPS_DERIVED_KEYS_KEY],\n }\n for (const [key, value] of Object.entries(internalRuntimeFields)) {\n if (!value) {\n continue\n }\n Object.defineProperty(runtimeWithDefaults, key, {\n configurable: true,\n enumerable: false,\n value,\n writable: true,\n })\n }\n\n Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {\n value: runtimeWithDefaults,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n target.__wevu = runtimeWithDefaults\n const runtimeProps = ensureRuntimeProps(target, runtimeState as Record<string, any>)\n attachRuntimeSlots(runtimeState as Record<string, any>, runtimeProps)\n\n if (scopedSlotState) {\n scopedSlotHooks?.attachMount(target, runtimeWithDefaults, scopedSlotState, Boolean(options?.deferSetData))\n }\n syncNativeOwnerId()\n\n if (setup) {\n runRuntimeSetupPhase({\n target,\n runtime,\n runtimeWithDefaults,\n runtimeState: runtimeState as Record<string, any>,\n runtimeProxy: runtimeProxy as Record<string, any>,\n setup,\n })\n }\n\n const watchStops = watchMap\n ? registerWatches(runtimeWithDefaults, watchMap, target)\n : []\n if (watchStops.length) {\n target[WEVU_WATCH_STOPS_KEY] = watchStops\n }\n\n if (setup) {\n if ((import.meta as ImportMetaWithEnv).env?.PROD !== true && typeof getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]?.trackWevuComponent === 'function') {\n const initialReactiveSetupSnapshot: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(runtimeWithDefaults.setupState ?? {})) {\n if (isReactive(value)) {\n initialReactiveSetupSnapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n initialReactiveSetupSnapshots.set(runtimeWithDefaults, initialReactiveSetupSnapshot)\n }\n if (!options?.deferSetData) {\n runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync?.()\n }\n if (!options?.deferSetData) {\n refreshOwnerSnapshot()\n }\n }\n else if (\n !options?.deferSetData\n && (target as any).properties\n && typeof (target as any).properties === 'object'\n && Object.keys((target as any).properties).length > 0\n ) {\n runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync?.()\n refreshOwnerSnapshot()\n }\n\n // 将 runtime.methods 透传到原生实例,供小程序事件处理直接调用\n bridgeRuntimeMethodsToTarget(target, runtime)\n\n return runtime\n}\n\nfunction preserveRuntimeFacadeIdentity<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n previousRuntime: RuntimeInstance<D, C, M>,\n nextRuntime: RuntimeInstance<D, C, M>,\n) {\n for (const key of Reflect.ownKeys(previousRuntime)) {\n if (!Reflect.has(nextRuntime, key)) {\n const descriptor = Reflect.getOwnPropertyDescriptor(previousRuntime, key)\n if (descriptor?.configurable) {\n Reflect.deleteProperty(previousRuntime, key)\n }\n }\n }\n for (const key of Reflect.ownKeys(nextRuntime)) {\n const descriptor = Reflect.getOwnPropertyDescriptor(nextRuntime, key)\n if (!descriptor) {\n continue\n }\n try {\n Reflect.defineProperty(previousRuntime, key, descriptor)\n }\n catch {\n try {\n ;(previousRuntime as any)[key] = (nextRuntime as any)[key]\n }\n catch {\n // 宿主包装对象仍持有旧 runtime 时,保留无法覆盖的只读字段。\n }\n }\n }\n attachRuntimeRef(previousRuntime.state as Record<string, any>, previousRuntime)\n const nextInitialSetupSnapshot = initialReactiveSetupSnapshots.get(nextRuntime)\n if (nextInitialSetupSnapshot) {\n initialReactiveSetupSnapshots.set(previousRuntime, nextInitialSetupSnapshot)\n }\n target.__wevu = previousRuntime\n Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {\n value: previousRuntime,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n return previousRuntime\n}\n\nfunction createRuntimeStateSnapshot(\n runtime: RuntimeInstance<any, any, any>,\n nativeData: Record<string, any> | undefined,\n preferredState?: Record<string, any>,\n) {\n const runtimeState = runtime.state as Record<string, any>\n const setupState = runtime.setupState as Record<string, any> | undefined\n const snapshot: Record<string, any> = {}\n for (const key of Object.keys(nativeData ?? {})) {\n if (!Object.prototype.hasOwnProperty.call(runtimeState, key)) {\n continue\n }\n const setupBinding = setupState?.[key]\n if (setupState && Object.prototype.hasOwnProperty.call(setupState, key) && !isRef(setupBinding) && !isReactive(setupBinding)) {\n continue\n }\n if (preferredState && Object.prototype.hasOwnProperty.call(preferredState, key)) {\n snapshot[key] = cloneInitialSnapshotValue(preferredState[key])\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(isRef(setupBinding) ? setupBinding.value : runtimeState[key])\n }\n return snapshot\n}\n\nfunction syncRuntimeStateFromNativeData(\n target: InternalRuntimeState,\n options?: { includeSetupState?: boolean, nativeData?: Record<string, any>, initialSetupState?: Record<string, unknown> },\n) {\n const runtime = target.__wevu\n const runtimeState = runtime?.state as Record<string, any> | undefined\n const setupState = runtime?.setupState as Record<string, any> | undefined\n const nativeData = options?.nativeData ?? (target as any).data as Record<string, any> | undefined\n if (!runtimeState || typeof runtimeState !== 'object' || !nativeData || typeof nativeData !== 'object') {\n return\n }\n const initialRuntimeSnapshot = (runtime as any)?.__wevu_initialRuntimeSnapshot as Record<string, any> | undefined\n for (const [key, value] of Object.entries(nativeData)) {\n if (!key || key === 'undefined') {\n continue\n }\n if (Object.prototype.hasOwnProperty.call(runtimeState, key)) {\n try {\n const setupBinding = setupState?.[key]\n const runtimeValue = cloneInitialSnapshotValue(value)\n if (setupState && Object.prototype.hasOwnProperty.call(setupState, key)) {\n // 普通 setup 值来自当前代码;仅 ref/reactive 绑定承接宿主状态。\n if (!options?.includeSetupState || (!isRef(setupBinding) && !isReactive(setupBinding))) {\n continue\n }\n }\n if (\n !options?.includeSetupState\n && initialRuntimeSnapshot\n && Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)\n && !isDeepEqualValue(runtimeState[key], initialRuntimeSnapshot[key], 20, { keys: 10_000 })\n ) {\n continue\n }\n if (\n !options?.includeSetupState\n && initialRuntimeSnapshot\n && !Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)\n ) {\n continue\n }\n if (isRef(setupBinding)) {\n setupBinding.value = runtimeValue\n continue\n }\n if (isReactive(setupBinding) && runtimeValue && typeof runtimeValue === 'object') {\n restoreReactiveSetupSnapshot(setupBinding, runtimeValue, options?.initialSetupState?.[key])\n continue\n }\n runtimeState[key] = runtimeValue\n }\n catch {\n // DevTools 热更新期间可能带入响应式 state 拒绝写入的临时 data key,跳过即可。\n }\n }\n }\n}\n\nexport function enableDeferredSetData(\n target: InternalRuntimeState,\n options?: { rehydrateSetupState?: boolean },\n) {\n const adapter = target.__wevu?.adapter as AdapterWithSetData | undefined\n syncRuntimeStateFromNativeData(target, {\n includeSetupState: options?.rehydrateSetupState,\n })\n adapter?.__wevu_enableSetData?.(true)\n ;(target as any).__wevu?.__wevu_flushSetupSnapshotSync?.()\n}\n\nexport function setRuntimeSetDataVisibility(target: InternalRuntimeState, visible: boolean) {\n const adapter = target.__wevu?.adapter as AdapterWithSetData | undefined\n adapter?.__wevu_setVisibility?.(visible)\n}\n\n/**\n * 卸载运行时实例(框架内部注册流程使用)。\n * @internal\n */\nexport function teardownRuntimeInstance(target: InternalRuntimeState, options?: {\n skipHooks?: boolean\n preserveNativeDeclarationChildren?: boolean\n}) {\n const runtime = target.__wevu\n\n const stops = target[WEVU_WATCH_STOPS_KEY]\n const effectScope = target[WEVU_EFFECT_SCOPE_KEY]\n\n runTeardownSteps([\n () => {\n if (!options?.skipHooks && runtime && target[WEVU_HOOKS_KEY]?.[WEVU_ON_BEFORE_UNMOUNT_HOOK]) {\n if (effectScope?.active) {\n effectScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK))\n }\n else {\n const teardownScope = createEffectScope(true)\n runTeardownSteps([\n () => teardownScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK)),\n () => teardownScope.stop(),\n ])\n }\n }\n },\n ...((!(import.meta as ImportMetaWithEnv).env?.PLATFORM || (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'weapp')\n && target[WEVU_NATIVE_SLOT_CONTEXT_KEY] === true\n ? [() => releaseNativeDeclaration(target, options?.preserveNativeDeclarationChildren)]\n : []),\n () => runtimeCapabilityRegistry.scopedSlots?.teardown(target),\n () => {\n if (Array.isArray(target.__wevuTemplateRefs) && target.__wevuTemplateRefs.length > 0) {\n requireRuntimeCapability('templateRefs', 'teardownRuntimeInstance(template refs)').clear(target)\n }\n },\n () => {\n // 触发卸载钩子(仅在 teardown 首次执行时触发)\n if (!options?.skipHooks && runtime && target[WEVU_HOOKS_KEY]) {\n callHookList(target, 'onUnload', [])\n }\n },\n () => {\n // 清理注册的生命周期钩子\n if (target[WEVU_HOOKS_KEY]) {\n target[WEVU_HOOKS_KEY] = undefined\n }\n },\n () => {\n if (Array.isArray(stops)) {\n for (const stop of stops) {\n try {\n stop()\n }\n catch {\n // 避免 teardown 中断:单个 stop 失败不阻塞其他清理\n }\n }\n }\n },\n () => {\n target[WEVU_WATCH_STOPS_KEY] = undefined\n },\n () => {\n effectScope?.stop()\n },\n () => {\n target[WEVU_EFFECT_SCOPE_KEY] = undefined\n },\n () => runtime?.unmount(),\n () => {\n const adapter = runtime?.adapter as AdapterWithSetData | undefined\n adapter?.__wevu_disposeSetData?.()\n },\n () => {\n delete (target as any)[WEVU_SETUP_CONTEXT_INSTANCE_KEY]\n delete (target as any)[WEVU_EXPOSED_KEY]\n },\n () => {\n delete target.__wevu\n },\n () => {\n if (WEVU_PUBLIC_RUNTIME_KEY in target) {\n delete (target as any)[WEVU_PUBLIC_RUNTIME_KEY]\n }\n },\n () => {\n // 只解除宿主引用,不清空 provides 或撤销用户已持有的注入对象。\n delete target[WEVU_PARENT_INSTANCE_KEY]\n },\n () => {\n delete target[WEVU_PROVIDES_KEY]\n },\n () => {\n delete target[WEVU_RUNTIME_APP_KEY]\n },\n ])\n}\n\n/**\n * 重建运行时实例,同时保持宿主包装对象持有的 runtime facade 身份稳定。\n * @internal\n */\nexport function refreshRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: { snapshotOmitKeys?: string[], stateSnapshot?: Record<string, any>, attached?: boolean },\n): RuntimeInstance<D, C, M> {\n const previousRuntime = target.__wevu as RuntimeInstance<D, C, M> | undefined\n const initialSetupState = previousRuntime ? initialReactiveSetupSnapshots.get(previousRuntime) : undefined\n const previousRuntimeState = previousRuntime\n ? createRuntimeStateSnapshot(previousRuntime, (target as any).data, options?.stateSnapshot)\n : undefined\n // 页面上方的 layout 由独立挂载插入;HMR 仅在本次重建期间保留仍存活的 layout。\n const parent = target[WEVU_PARENT_INSTANCE_KEY]\n const layoutParent = parent && isRuntimeLayoutComponentTarget(parent) ? parent : undefined\n teardownRuntimeInstance(target, { skipHooks: true, preserveNativeDeclarationChildren: true })\n const nextRuntime = mountRuntimeInstance(target, runtimeApp, watchMap, setup, {\n deferSetData: true,\n snapshotOmitKeys: options?.snapshotOmitKeys,\n attached: options?.attached,\n layoutParent,\n })\n const stateSnapshot = previousRuntimeState ?? (options?.stateSnapshot\n ? createRuntimeStateSnapshot(nextRuntime, options.stateSnapshot, options.stateSnapshot)\n : undefined)\n if (stateSnapshot) {\n const nativeData = (target as any).data\n if (nativeData && typeof nativeData === 'object') {\n Object.assign(nativeData, cloneInitialSnapshotValue(stateSnapshot))\n }\n syncRuntimeStateFromNativeData(target, {\n includeSetupState: true,\n nativeData: stateSnapshot,\n initialSetupState,\n })\n }\n if (!previousRuntime || previousRuntime === nextRuntime) {\n return nextRuntime\n }\n return preserveRuntimeFacadeIdentity(target, previousRuntime, nextRuntime)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoEA,MAAM,gDAAgC,IAAI,QAAyC;AAEnF,SAAS,0BAA0B,OAAgB,wBAAQ,IAAI,QAAyB,GAAY;CAClG,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAET,IAAI,MAAM,IAAI,KAAe,GAC3B,OAAO,MAAM,IAAI,KAAe;CAElC,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,OAAkB,CAAC;EACzB,MAAM,IAAI,OAAO,IAAI;EACrB,KAAK,MAAM,QAAQ,OACjB,KAAK,KAAK,0BAA0B,MAAM,KAAK,CAAC;EAElD,OAAO;CACT;CACA,MAAM,OAAgC,CAAC;CACvC,MAAM,IAAI,OAAiB,IAAI;CAC/B,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAgC,GACxE,KAAK,OAAO,0BAA0B,OAAO,KAAK;CAEpD,OAAO;AACT;AACA,SAAS,4BACP,UACA,UACgB;CAChB,MAAM,SAAS,YAAY,CAAC;CAC5B,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,GAAG;EACpD,IAAI;EACJ,KAAK,MAAM,aAAa,OAAO,KAAK,MAAM,GACxC,IAAI,KAAK,WAAW,GAAG,UAAU,EAAE,GAAG;GACpC,eAAe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AI,2BAA2B,QAC7B,OAAQ,OAAe;EAE3B;QACM;GAEJ,OAAO,OAAO;EAChB;QACM;GACJ,OAAO,OAAO;EAChB;QACM;GACJ,OAAO,OAAO;EAChB;CACF,CAAC;AACH;;;;;AAMA,SAAgB,uBACd,QACA,YACA,UACA,OACA,SAC0B;CAC1B,MAAM,kBAAkB,OAAO;CAC/B,MAAM,oBAAoB,kBAAkB,8BAA8B,IAAI,eAAe,IAAI;CACjG,MAAM,uBAAuB,kBACzB,2BAA2B,iBAAkB,OAAe,MAAM,SAAS,aAAa,IACxF;CAEJ,MAAM,SAAS,OAAO;CACtB,MAAM,eAAe,UAAU,+BAA+B,MAAM,IAAI,SAAS;CACjF,wBAAwB,QAAQ;EAAE,WAAW;EAAM,mCAAmC;CAAK,CAAC;CAC5F,MAAM,cAAc,qBAAqB,QAAQ,YAAY,UAAU,OAAO;EAC5E,cAAc;EACd,kBAAkB,SAAS;EAC3B,UAAU,SAAS;EACnB;CACF,CAAC;CACD,MAAM,gBAAgB,yBAAyB,SAAS,gBACpD,2BAA2B,aAAa,QAAQ,eAAe,QAAQ,aAAa,IACpF;CACJ,IAAI,eAAe;EACjB,MAAM,aAAc,OAAe;EACnC,IAAI,cAAc,OAAO,eAAe,UACtC,OAAO,OAAO,YAAY,0BAA0B,aAAa,CAAC;EAEpE,+BAA+B,QAAQ;GACrC,mBAAmB;GACnB,YAAY;GACZ;EACF,CAAC;CACH;CACA,IAAI,CAAC,mBAAmB,oBAAoB,aAC1C,OAAO;CAET,OAAO,8BAA8B,QAAQ,iBAAiB,WAAW;AAC3E"}
@@ -35,7 +35,7 @@ function createPathGetter(target, path) {
35
35
  return current;
36
36
  };
37
37
  }
38
- function registerWatches(runtime, watchMap, instance, options) {
38
+ function registerWatches(runtime, watchMap, instance) {
39
39
  const stops = [];
40
40
  const proxy = runtime.proxy;
41
41
  for (const [expression, descriptor] of Object.entries(watchMap)) {
@@ -43,8 +43,6 @@ function registerWatches(runtime, watchMap, instance, options) {
43
43
  if (!normalized) continue;
44
44
  const getter = createPathGetter(proxy, expression);
45
45
  const stopHandle = runtime.watch(getter, normalized.handler, normalized.options);
46
- const sourceRoot = expression.split(".")[0]?.trim();
47
- if (options?.deferMissingSourceBaseline && !normalized.options.immediate && sourceRoot && !(sourceRoot in proxy)) stopHandle.pause();
48
46
  stops.push(stopHandle);
49
47
  }
50
48
  return stops;
@@ -1 +1 @@
1
- {"version":3,"file":"watch.mjs","names":[],"sources":["../../../../src/runtime/register/watch.ts"],"sourcesContent":["import type { WatchStopHandle } from '../../reactivity'\nimport type {\n ComponentPublicInstance,\n InternalRuntimeState,\n RuntimeInstance,\n} from '../types'\n\ntype WatchHandler = (this: any, value: any, oldValue: any) => void\nexport type WatchDescriptor = WatchHandler | string | {\n handler: WatchHandler | string\n immediate?: boolean\n deep?: boolean\n}\nexport type WatchMap = Record<string, WatchDescriptor>\n\ninterface RegisterWatchesOptions {\n deferMissingSourceBaseline?: boolean\n}\n\nexport function normalizeWatchDescriptor(\n descriptor: WatchDescriptor,\n runtime: RuntimeInstance<any, any, any>,\n instance: InternalRuntimeState,\n): { handler: WatchHandler, options: any } | undefined {\n if (typeof descriptor === 'function') {\n return {\n handler: descriptor.bind(runtime.proxy),\n options: {},\n }\n }\n\n if (typeof descriptor === 'string') {\n const method = (runtime.methods as any)?.[descriptor] ?? (instance as any)[descriptor]\n if (typeof method === 'function') {\n return {\n handler: method.bind(runtime.proxy),\n options: {},\n }\n }\n return undefined\n }\n\n if (!descriptor || typeof descriptor !== 'object') {\n return undefined\n }\n\n const base = normalizeWatchDescriptor((descriptor as any).handler, runtime, instance)\n if (!base) {\n return undefined\n }\n\n const options: any = {\n ...base.options,\n }\n\n if ((descriptor as any).immediate !== undefined) {\n options.immediate = (descriptor as any).immediate\n }\n if ((descriptor as any).deep !== undefined) {\n options.deep = (descriptor as any).deep\n }\n\n return {\n handler: base.handler,\n options,\n }\n}\n\nexport function createPathGetter(target: ComponentPublicInstance<any, any, any>, path: string) {\n const segments = path.split('.').map(segment => segment.trim()).filter(Boolean)\n if (!segments.length) {\n return () => target\n }\n\n return () => {\n let current: any = target\n for (const segment of segments) {\n if (current == null) {\n return current\n }\n current = current[segment]\n }\n return current\n }\n}\n\nexport function registerWatches(\n runtime: RuntimeInstance<any, any, any>,\n watchMap: WatchMap,\n instance: InternalRuntimeState,\n options?: RegisterWatchesOptions,\n) {\n const stops: WatchStopHandle[] = []\n const proxy = runtime.proxy\n\n for (const [expression, descriptor] of Object.entries(watchMap)) {\n const normalized = normalizeWatchDescriptor(descriptor as any, runtime, instance)\n if (!normalized) {\n continue\n }\n const getter = createPathGetter(proxy, expression)\n const stopHandle = runtime.watch(getter, normalized.handler, normalized.options)\n const sourceRoot = expression.split('.')[0]?.trim()\n if (\n options?.deferMissingSourceBaseline\n && !normalized.options.immediate\n && sourceRoot\n && !(sourceRoot in proxy)\n ) {\n stopHandle.pause()\n }\n stops.push(stopHandle)\n }\n\n return stops\n}\n"],"mappings":";AAmBA,SAAgB,yBACd,YACA,SACA,UACqD;CACrD,IAAI,OAAO,eAAe,YACxB,OAAO;EACL,SAAS,WAAW,KAAK,QAAQ,KAAK;EACtC,SAAS,CAAC;CACZ;CAGF,IAAI,OAAO,eAAe,UAAU;EAClC,MAAM,SAAU,QAAQ,UAAkB,eAAgB,SAAiB;EAC3E,IAAI,OAAO,WAAW,YACpB,OAAO;GACL,SAAS,OAAO,KAAK,QAAQ,KAAK;GAClC,SAAS,CAAC;EACZ;EAEF;CACF;CAEA,IAAI,CAAC,cAAc,OAAO,eAAe,UACvC;CAGF,MAAM,OAAO,yBAA0B,WAAmB,SAAS,SAAS,QAAQ;CACpF,IAAI,CAAC,MACH;CAGF,MAAM,UAAe,EACnB,GAAG,KAAK,QACV;CAEA,IAAK,WAAmB,cAAc,QACpC,QAAQ,YAAa,WAAmB;CAE1C,IAAK,WAAmB,SAAS,QAC/B,QAAQ,OAAQ,WAAmB;CAGrC,OAAO;EACL,SAAS,KAAK;EACd;CACF;AACF;AAEA,SAAgB,iBAAiB,QAAgD,MAAc;CAC7F,MAAM,WAAW,KAAK,MAAM,GAAG,CAAC,CAAC,KAAI,YAAW,QAAQ,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO;CAC9E,IAAI,CAAC,SAAS,QACZ,aAAa;CAGf,aAAa;EACX,IAAI,UAAe;EACnB,KAAK,MAAM,WAAW,UAAU;GAC9B,IAAI,WAAW,MACb,OAAO;GAET,UAAU,QAAQ;EACpB;EACA,OAAO;CACT;AACF;AAEA,SAAgB,gBACd,SACA,UACA,UACA,SACA;CACA,MAAM,QAA2B,CAAC;CAClC,MAAM,QAAQ,QAAQ;CAEtB,KAAK,MAAM,CAAC,YAAY,eAAe,OAAO,QAAQ,QAAQ,GAAG;EAC/D,MAAM,aAAa,yBAAyB,YAAmB,SAAS,QAAQ;EAChF,IAAI,CAAC,YACH;EAEF,MAAM,SAAS,iBAAiB,OAAO,UAAU;EACjD,MAAM,aAAa,QAAQ,MAAM,QAAQ,WAAW,SAAS,WAAW,OAAO;EAC/E,MAAM,aAAa,WAAW,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK;EAClD,IACE,SAAS,8BACN,CAAC,WAAW,QAAQ,aACpB,cACA,EAAE,cAAc,QAEnB,WAAW,MAAM;EAEnB,MAAM,KAAK,UAAU;CACvB;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"watch.mjs","names":[],"sources":["../../../../src/runtime/register/watch.ts"],"sourcesContent":["import type { WatchStopHandle } from '../../reactivity'\nimport type {\n ComponentPublicInstance,\n InternalRuntimeState,\n RuntimeInstance,\n} from '../types'\n\ntype WatchHandler = (this: any, value: any, oldValue: any) => void\nexport type WatchDescriptor = WatchHandler | string | {\n handler: WatchHandler | string\n immediate?: boolean\n deep?: boolean\n}\nexport type WatchMap = Record<string, WatchDescriptor>\n\nexport function normalizeWatchDescriptor(\n descriptor: WatchDescriptor,\n runtime: RuntimeInstance<any, any, any>,\n instance: InternalRuntimeState,\n): { handler: WatchHandler, options: any } | undefined {\n if (typeof descriptor === 'function') {\n return {\n handler: descriptor.bind(runtime.proxy),\n options: {},\n }\n }\n\n if (typeof descriptor === 'string') {\n const method = (runtime.methods as any)?.[descriptor] ?? (instance as any)[descriptor]\n if (typeof method === 'function') {\n return {\n handler: method.bind(runtime.proxy),\n options: {},\n }\n }\n return undefined\n }\n\n if (!descriptor || typeof descriptor !== 'object') {\n return undefined\n }\n\n const base = normalizeWatchDescriptor((descriptor as any).handler, runtime, instance)\n if (!base) {\n return undefined\n }\n\n const options: any = {\n ...base.options,\n }\n\n if ((descriptor as any).immediate !== undefined) {\n options.immediate = (descriptor as any).immediate\n }\n if ((descriptor as any).deep !== undefined) {\n options.deep = (descriptor as any).deep\n }\n\n return {\n handler: base.handler,\n options,\n }\n}\n\nexport function createPathGetter(target: ComponentPublicInstance<any, any, any>, path: string) {\n const segments = path.split('.').map(segment => segment.trim()).filter(Boolean)\n if (!segments.length) {\n return () => target\n }\n\n return () => {\n let current: any = target\n for (const segment of segments) {\n if (current == null) {\n return current\n }\n current = current[segment]\n }\n return current\n }\n}\n\nexport function registerWatches(\n runtime: RuntimeInstance<any, any, any>,\n watchMap: WatchMap,\n instance: InternalRuntimeState,\n) {\n const stops: WatchStopHandle[] = []\n const proxy = runtime.proxy\n\n for (const [expression, descriptor] of Object.entries(watchMap)) {\n const normalized = normalizeWatchDescriptor(descriptor as any, runtime, instance)\n if (!normalized) {\n continue\n }\n const getter = createPathGetter(proxy, expression)\n const stopHandle = runtime.watch(getter, normalized.handler, normalized.options)\n stops.push(stopHandle)\n }\n\n return stops\n}\n"],"mappings":";AAeA,SAAgB,yBACd,YACA,SACA,UACqD;CACrD,IAAI,OAAO,eAAe,YACxB,OAAO;EACL,SAAS,WAAW,KAAK,QAAQ,KAAK;EACtC,SAAS,CAAC;CACZ;CAGF,IAAI,OAAO,eAAe,UAAU;EAClC,MAAM,SAAU,QAAQ,UAAkB,eAAgB,SAAiB;EAC3E,IAAI,OAAO,WAAW,YACpB,OAAO;GACL,SAAS,OAAO,KAAK,QAAQ,KAAK;GAClC,SAAS,CAAC;EACZ;EAEF;CACF;CAEA,IAAI,CAAC,cAAc,OAAO,eAAe,UACvC;CAGF,MAAM,OAAO,yBAA0B,WAAmB,SAAS,SAAS,QAAQ;CACpF,IAAI,CAAC,MACH;CAGF,MAAM,UAAe,EACnB,GAAG,KAAK,QACV;CAEA,IAAK,WAAmB,cAAc,QACpC,QAAQ,YAAa,WAAmB;CAE1C,IAAK,WAAmB,SAAS,QAC/B,QAAQ,OAAQ,WAAmB;CAGrC,OAAO;EACL,SAAS,KAAK;EACd;CACF;AACF;AAEA,SAAgB,iBAAiB,QAAgD,MAAc;CAC7F,MAAM,WAAW,KAAK,MAAM,GAAG,CAAC,CAAC,KAAI,YAAW,QAAQ,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO;CAC9E,IAAI,CAAC,SAAS,QACZ,aAAa;CAGf,aAAa;EACX,IAAI,UAAe;EACnB,KAAK,MAAM,WAAW,UAAU;GAC9B,IAAI,WAAW,MACb,OAAO;GAET,UAAU,QAAQ;EACpB;EACA,OAAO;CACT;AACF;AAEA,SAAgB,gBACd,SACA,UACA,UACA;CACA,MAAM,QAA2B,CAAC;CAClC,MAAM,QAAQ,QAAQ;CAEtB,KAAK,MAAM,CAAC,YAAY,eAAe,OAAO,QAAQ,QAAQ,GAAG;EAC/D,MAAM,aAAa,yBAAyB,YAAmB,SAAS,QAAQ;EAChF,IAAI,CAAC,YACH;EAEF,MAAM,SAAS,iBAAiB,OAAO,UAAU;EACjD,MAAM,aAAa,QAAQ,MAAM,QAAQ,WAAW,SAAS,WAAW,OAAO;EAC/E,MAAM,KAAK,UAAU;CACvB;CAEA,OAAO;AACT"}
package/dist/fetch.mjs CHANGED
@@ -1 +1 @@
1
- import{fetch as e}from"@wevu/web-apis/fetch";export{e as fetch};
1
+ export{fetch}from"@wevu/web-apis/fetch";
package/dist/index.d.mts CHANGED
@@ -1,11 +1,17 @@
1
+ import { PageLayoutMeta, PageMeta } from "./types/pageMeta.mjs";
2
+ import { SetDataBindingDiagnostic, SetDataDebugInfo, SetDataSnapshotOptions } from "./runtime/types/setData.mjs";
3
+ import { PageFeatures } from "./config/pageFeatures.mjs";
1
4
  import { AlipayMiniProgramHostNamespace, AlipayMiniProgramHostSourceContract, DefaultMiniProgramHostNamespace, DefaultMiniProgramHostSourceContract, DouyinMiniProgramHostNamespace, DouyinMiniProgramHostSourceContract, MiniProgramHostNamespace, MiniProgramHostNamespaceBySource, MiniProgramHostSourceName, MiniProgramHostSourceRegistry, MiniProgramPlatformHostNamespaceBySource, MiniProgramPlatformHostSourceName, MiniProgramPlatformHostSourceRegistry, MiniProgramRuntimeHostNamespaceBySource, MiniProgramRuntimeHostSourceName, MiniProgramRuntimeHostSourceRegistry, TtMiniProgramHostNamespace, TtMiniProgramHostSourceContract, WechatMiniProgramHostNamespace, WechatMiniProgramHostSourceContract } from "./runtime/types/miniprogramHostSources.mjs";
2
5
  import { HostMiniProgramAddToFavoritesOption, HostMiniProgramAppOptions, HostMiniProgramAppTrivialInstance, HostMiniProgramBehaviorIdentifier, HostMiniProgramBoundingClientRectResult, HostMiniProgramComponentAllFullProperty, HostMiniProgramComponentAllProperty, HostMiniProgramComponentBehaviorOptions, HostMiniProgramComponentEmptyArray, HostMiniProgramComponentInstance, HostMiniProgramComponentMethodOption, HostMiniProgramComponentPropertyOption, HostMiniProgramComponentPropertyValue, HostMiniProgramComponentShortProperty, HostMiniProgramComponentTrivialInstance, HostMiniProgramComponentTrivialOption, HostMiniProgramIntersectionObserver, HostMiniProgramIntersectionObserverOptions, HostMiniProgramLaunchOptions, HostMiniProgramMemoryWarningResult, HostMiniProgramNavigateToOption, HostMiniProgramNodesRef, HostMiniProgramNodesRefFields, HostMiniProgramPageLifetime, HostMiniProgramPageNotFoundOptions, HostMiniProgramPageResizeOption, HostMiniProgramPageScrollOption, HostMiniProgramPageTrivialInstance, HostMiniProgramReLaunchOption, HostMiniProgramRedirectToOption, HostMiniProgramRouter, HostMiniProgramSaveExitState, HostMiniProgramScrollOffsetResult, HostMiniProgramSelectorQuery, HostMiniProgramShareAppMessageOption, HostMiniProgramSwitchTabOption, HostMiniProgramTabItemTapOption, HostMiniProgramThemeChangeResult, HostMiniProgramTriggerEventOptions, HostMiniProgramUnhandledRejectionResult } from "./runtime/types/miniprogramHost.mjs";
3
6
  import { MiniProgramAdapter, MiniProgramAppOptions, MiniProgramBehaviorIdentifier, MiniProgramComponentInstance, MiniProgramComponentOptions, MiniProgramComponentPropertyValue, MiniProgramComponentRawOptions, MiniProgramInstance, MiniProgramPageLifetimes } from "./runtime/types/miniprogram.mjs";
4
7
  import { ComponentPropsOptions, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InferNativePropType, InferNativeProps, InferPropType, InferProps, NativePropType, NativePropsOptions, NativeTypeHint, NativeTypedProperty, PropConstructor, PropOptions, PropType } from "./runtime/types/props/propTypes.mjs";
5
8
  import { MiniProgramRouterNavigateToOption, MiniProgramRouterReLaunchOption, MiniProgramRouterRedirectToOption, MiniProgramRouterSwitchTabOption, SetupContextRouter, WevuTypedRouterRouteMap } from "./runtime/types/props/router.mjs";
9
+ import { ComputedGetter, ComputedSetter, WritableComputedOptions } from "./types/reactivity.mjs";
10
+ import { ComputedDefinitions, ExtractComputed, ExtractMethods, MethodDefinitions } from "./types/definitions.mjs";
11
+ import { ComponentPublicInstance, ModelBinding, ModelBindingOptions, ModelBindingPayload } from "./runtime/types/core.mjs";
6
12
  import { AsyncDerivation, AsyncDerivationContext, AsyncDerivationState, AsyncDerivationStatus, UseAsyncDerivationOptions, useAsyncDerivation } from "./reactivity/asyncDerivation.mjs";
7
13
  import { CustomRefFactory, CustomRefOptions, CustomRefSource, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, customRef, isRef, ref, toValue, unref } from "./reactivity/ref.mjs";
8
- import { ComputedGetter, ComputedRef, ComputedSetter, WritableComputedOptions, WritableComputedRef, computed } from "./reactivity/computed.mjs";
14
+ import { ComputedRef, WritableComputedRef, computed } from "./reactivity/computed.mjs";
9
15
  import { nextTick } from "./scheduler.mjs";
10
16
  import { EffectScope, batch, effect, effectScope, endBatch, getCurrentScope, onScopeDispose, startBatch, stop } from "./reactivity/core.mjs";
11
17
  import { MutationKind, MutationOp, MutationRecord, addMutationRecorder, removeMutationRecorder } from "./reactivity/reactive/mutation.mjs";
@@ -20,21 +26,19 @@ import { traverse } from "./reactivity/traverse.mjs";
20
26
  import { MapSources, MaybeUndefined, MultiWatchSources, OnCleanup, WatchCallback, WatchEffect, WatchEffectOptions, WatchMultiSources, WatchOptions, WatchScheduler, WatchSource, WatchSourceValue, WatchSources, WatchStopHandle, getDeepWatchStrategy, setDeepWatchStrategy } from "./reactivity/watch/types.mjs";
21
27
  import { watch, watchEffect, watchPostEffect, watchSyncEffect } from "./reactivity/watch.mjs";
22
28
  import "./reactivity/index.mjs";
23
- import { ComponentPublicInstance, ComputedDefinitions, ExtractComputed, ExtractMethods, MethodDefinitions, ModelBinding, ModelBindingOptions, ModelBindingPayload } from "./runtime/types/core.mjs";
24
29
  import { AppConfig, InternalRuntimeState, InternalRuntimeStateFields, RuntimeApp, RuntimeInstance, WevuPlugin } from "./runtime/types/runtime.mjs";
25
30
  import { SetupContext, SetupContextIntersectionObserver, SetupContextIntersectionObserverOptions, SetupContextNativeInstance, SetupContextSelectorQuery, SetupFunction } from "./runtime/types/props/setup.mjs";
26
31
  import { AllowedComponentProps, ComponentCustomProps, ComponentOptionsMixin, DefineComponent, NativeComponent, ObjectDirective, PublicProps, ShallowUnwrapRef, VNode, VNodeProps } from "./vue-types.mjs";
27
- import { SetDataBindingDiagnostic, SetDataDebugInfo, SetDataSnapshotOptions } from "./runtime/types/setData.mjs";
28
- import { CreateAppOptions, DataOption, DefineAppOptions, DefineComponentOptions, PageFeatures } from "./runtime/types/options.mjs";
32
+ import { CreateAppOptions, DataOption, DefineAppOptions, DefineComponentOptions } from "./runtime/types/options.mjs";
29
33
  import { GlobalComponents, GlobalDirectives, MiniProgramTemplateRefValue, TemplateRefValue, TemplateRefs, WevuGlobalComponents, WevuGlobalDirectives } from "./runtime/types.mjs";
30
- import "./runtime/templateRefTypes.mjs";
31
34
  import "./vue-augment.mjs";
32
35
  import { useCssModule } from "./runtime/css.mjs";
33
36
  import { WevuDefaults, resetWevuDefaults } from "./runtime/defaults.mjs";
34
37
  import { ComponentDefinition, DefineComponentTypePropsOptions, DefineComponentWithTypeProps, SetupContextWithTypeProps, SetupFunctionWithTypeProps, WevuComponentConstructor, WevuDefinedComponent } from "./runtime/define.mjs";
35
38
  import { DisposableBag, DisposableLike, DisposableMethodName, DisposableObject, useDisposables } from "./runtime/disposables.mjs";
36
39
  import { ElementIntersectionObserverCallback, UseElementIntersectionObserverOptions, UseElementIntersectionObserverReturn, useElementIntersectionObserver } from "./runtime/elementIntersectionObserver.mjs";
37
- import { PageLayoutState, WevuPageLayoutMap } from "./runtime/pageLayout.mjs";
40
+ import { WevuPageLayoutMap } from "./types/pageLayout.mjs";
41
+ import { PageLayoutState } from "./runtime/pageLayout.mjs";
38
42
  import { LayoutHostBinding } from "./runtime/capabilities.mjs";
39
43
  import { LayoutBridgeInstance } from "./runtime/layoutBridge.mjs";
40
44
  import { registerPageLayoutBridge, registerRuntimeLayoutHosts, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, setPageLayout, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, useLayoutBridge, useLayoutHosts, usePageLayout, waitForLayoutHost } from "./runtime/features/publicLayout.mjs";
@@ -61,7 +65,8 @@ import { useNativePageRouter, useNativeRouter } from "./runtime/vueCompat/router
61
65
  import { TemplateRef, useTemplateRef } from "./runtime/vueCompat/templateRef.mjs";
62
66
  import "./runtime/index.mjs";
63
67
  import { ComponentTypeEmits, EmitFn, EmitsOptions } from "./macros/shared.mjs";
64
- import { DefineModelModifiers, DefineModelTransformOptions, ModelRef, PageLayoutMeta, PageMeta, defineEmits, defineExpose, defineModel, defineOptions, definePageMeta, defineProps, defineSlots, withDefaults } from "./macros.mjs";
68
+ import { DefineModelModifiers, DefineModelTransformOptions, ModelRef, defineEmits, defineExpose, defineModel, defineOptions, definePageMeta, defineProps, defineSlots, withDefaults } from "./macros.mjs";
69
+ import { MiniProgramTemplateRefElements } from "./runtime/templateRefTypes.mjs";
65
70
  import { ActionContext, ActionSubscriber, DefineStoreOptions, MutationType, Pinia, PiniaCustomProperties, PiniaCustomStateProperties, PiniaPlugin, PiniaPluginContext, StateTree, StoreActions, StoreDefinition, StoreGeneric, StoreManager, StoreState, StoreSubscribeOptions, SubscriptionCallback, SubscriptionCallbackMutation } from "./store/types.mjs";
66
71
  import { defineStore } from "./store/define.mjs";
67
72
  import { createPinia, createStore, disposePinia, getActivePinia, setActivePinia } from "./store/manager.mjs";
@@ -69,4 +74,4 @@ import { StoreToRefsResult, storeToRefs } from "./store/storeToRefs.mjs";
69
74
  import "./store.mjs";
70
75
  import { version } from "./version.mjs";
71
76
  export * from "@wevu/web-apis";
72
- export { type ActionContext, type ActionSubscriber, type AlipayMiniProgramHostNamespace, type AlipayMiniProgramHostSourceContract, type AllowedComponentProps, type AppConfig, type AsyncDerivation, type AsyncDerivationContext, type AsyncDerivationState, type AsyncDerivationStatus, type ComponentCustomProps, type ComponentDefinition, type ComponentOptionsMixin, type ComponentPropsOptions, type ComponentPublicInstance, type ComponentTypeEmits, type ComputedDefinitions, type ComputedGetter, type ComputedRef, type ComputedSetter, type CreateAppOptions, type CustomRefFactory, type CustomRefOptions, type CustomRefSource, type DataOption, type DefaultMiniProgramHostNamespace, type DefaultMiniProgramHostSourceContract, type DefineAppOptions, type DefineComponent, type DefineComponentOptions, type DefineComponentTypePropsOptions, type DefineComponentWithTypeProps, DefineModelModifiers, DefineModelTransformOptions, type DefineStoreOptions, DisposableBag, DisposableLike, DisposableMethodName, DisposableObject, type DouyinMiniProgramHostNamespace, type DouyinMiniProgramHostSourceContract, type EffectScope, ElementIntersectionObserverCallback, type EmitFn, type EmitsOptions, type ExtractComputed, type ExtractDefaultPropTypes, type ExtractMethods, type ExtractPropTypes, type ExtractPublicPropTypes, GlobalComponents, GlobalDirectives, type HostMiniProgramAddToFavoritesOption, type HostMiniProgramAppOptions, type HostMiniProgramAppTrivialInstance, type HostMiniProgramBehaviorIdentifier, type HostMiniProgramBoundingClientRectResult, type HostMiniProgramComponentAllFullProperty, type HostMiniProgramComponentAllProperty, type HostMiniProgramComponentBehaviorOptions, type HostMiniProgramComponentEmptyArray, type HostMiniProgramComponentInstance, type HostMiniProgramComponentMethodOption, type HostMiniProgramComponentPropertyOption, type HostMiniProgramComponentPropertyValue, type HostMiniProgramComponentShortProperty, type HostMiniProgramComponentTrivialInstance, type HostMiniProgramComponentTrivialOption, type HostMiniProgramIntersectionObserver, type HostMiniProgramIntersectionObserverOptions, type HostMiniProgramLaunchOptions, type HostMiniProgramMemoryWarningResult, type HostMiniProgramNavigateToOption, type HostMiniProgramNodesRef, type HostMiniProgramNodesRefFields, type HostMiniProgramPageLifetime, type HostMiniProgramPageNotFoundOptions, type HostMiniProgramPageResizeOption, type HostMiniProgramPageScrollOption, type HostMiniProgramPageTrivialInstance, type HostMiniProgramReLaunchOption, type HostMiniProgramRedirectToOption, type HostMiniProgramRouter, type HostMiniProgramSaveExitState, type HostMiniProgramScrollOffsetResult, type HostMiniProgramSelectorQuery, type HostMiniProgramShareAppMessageOption, type HostMiniProgramSwitchTabOption, type HostMiniProgramTabItemTapOption, type HostMiniProgramThemeChangeResult, type HostMiniProgramTriggerEventOptions, type HostMiniProgramUnhandledRejectionResult, type InferNativePropType, type InferNativeProps, type InferPropType, type InferProps, type InternalRuntimeState, type InternalRuntimeStateFields, type LayoutBridgeInstance, type LayoutHostBinding, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MaybeUndefined, type MethodDefinitions, type MiniProgramAdapter, type HostMiniProgramAddToFavoritesOption as MiniProgramAddToFavoritesOption, type MiniProgramAppOptions, type MiniProgramBehaviorIdentifier, type HostMiniProgramBoundingClientRectResult as MiniProgramBoundingClientRectResult, type HostMiniProgramComponentAllFullProperty as MiniProgramComponentAllFullProperty, type HostMiniProgramComponentAllProperty as MiniProgramComponentAllProperty, type HostMiniProgramComponentBehaviorOptions as MiniProgramComponentBehaviorOptions, type HostMiniProgramComponentEmptyArray as MiniProgramComponentEmptyArray, type MiniProgramComponentInstance, type HostMiniProgramComponentMethodOption as MiniProgramComponentMethodOption, type MiniProgramComponentOptions, type HostMiniProgramComponentPropertyOption as MiniProgramComponentPropertyOption, type MiniProgramComponentPropertyValue, type MiniProgramComponentRawOptions, type HostMiniProgramComponentShortProperty as MiniProgramComponentShortProperty, type MiniProgramHostNamespace, type MiniProgramHostNamespaceBySource, type MiniProgramHostSourceName, type MiniProgramHostSourceRegistry, type MiniProgramInstance, type HostMiniProgramIntersectionObserver as MiniProgramIntersectionObserver, type HostMiniProgramIntersectionObserverOptions as MiniProgramIntersectionObserverOptions, type HostMiniProgramLaunchOptions as MiniProgramLaunchOptions, type HostMiniProgramMemoryWarningResult as MiniProgramMemoryWarningResult, type HostMiniProgramNavigateToOption as MiniProgramNavigateToOption, type HostMiniProgramNodesRef as MiniProgramNodesRef, type HostMiniProgramNodesRefFields as MiniProgramNodesRefFields, type HostMiniProgramPageLifetime as MiniProgramPageLifetime, type MiniProgramPageLifetimes, type HostMiniProgramPageNotFoundOptions as MiniProgramPageNotFoundOptions, type HostMiniProgramPageResizeOption as MiniProgramPageResizeOption, type HostMiniProgramPageScrollOption as MiniProgramPageScrollOption, type MiniProgramPlatformHostNamespaceBySource, type MiniProgramPlatformHostSourceName, type MiniProgramPlatformHostSourceRegistry, type HostMiniProgramReLaunchOption as MiniProgramReLaunchOption, type HostMiniProgramRedirectToOption as MiniProgramRedirectToOption, type HostMiniProgramRouter as MiniProgramRouter, type MiniProgramRouterNavigateToOption, type MiniProgramRouterReLaunchOption, type MiniProgramRouterRedirectToOption, type MiniProgramRouterSwitchTabOption, type MiniProgramRuntimeHostNamespaceBySource, type MiniProgramRuntimeHostSourceName, type MiniProgramRuntimeHostSourceRegistry, type HostMiniProgramSaveExitState as MiniProgramSaveExitState, type HostMiniProgramScrollOffsetResult as MiniProgramScrollOffsetResult, type HostMiniProgramSelectorQuery as MiniProgramSelectorQuery, type HostMiniProgramShareAppMessageOption as MiniProgramShareAppMessageOption, type HostMiniProgramSwitchTabOption as MiniProgramSwitchTabOption, type HostMiniProgramTabItemTapOption as MiniProgramTabItemTapOption, MiniProgramTemplateRefValue, type HostMiniProgramThemeChangeResult as MiniProgramThemeChangeResult, type HostMiniProgramUnhandledRejectionResult as MiniProgramUnhandledRejectionResult, type ModelBinding, type ModelBindingOptions, type ModelBindingPayload, type ModelModifiers, ModelRef, type MultiWatchSources, type MutationKind, type MutationOp, type MutationRecord, MutationType, type NativeComponent, type NativePropType, type NativePropsOptions, type NativeTypeHint, type NativeTypedProperty, NavigationBarMetrics, type ObjectDirective, type OnCleanup, type PageFeatures, PageLayoutMeta, type PageLayoutState, PageMeta, PageStackSnapshot, type Pinia, type PiniaCustomProperties, type PiniaCustomStateProperties, type PiniaPlugin, type PiniaPluginContext, type PrelinkReactiveTreeOptions, type PropConstructor, type PropOptions, type PropType, type PublicProps, PullDownRefreshHandler, type Ref, type RuntimeApp, type RuntimeInstance, type SetDataBindingDiagnostic, type SetDataDebugInfo, type SetDataSnapshotOptions, type SetupContext, type SetupContextIntersectionObserver, type SetupContextIntersectionObserverOptions, type SetupContextNativeInstance, type SetupContextRouter, type SetupContextSelectorQuery, type SetupContextWithTypeProps, type SetupFunction, type SetupFunctionWithTypeProps, type ShallowRef, type ShallowUnwrapRef, type StateTree, type StoreActions, type StoreDefinition, type StoreGeneric, type StoreManager, type StoreState, type StoreSubscribeOptions, type StoreToRefsResult, type SubscriptionCallback, type SubscriptionCallbackMutation, type TemplateRef, TemplateRefValue, TemplateRefs, type ToRefs, type HostMiniProgramTriggerEventOptions as TriggerEventOptions, type TtMiniProgramHostNamespace, type TtMiniProgramHostSourceContract, UpdatePerformanceListener, UpdatePerformanceListenerResult, UseAllBoundingClientRectOptions, UseAllScrollOffsetOptions, UseAllSelectorFieldsOptions, type UseAsyncDerivationOptions, UseAsyncPullDownRefreshOptions, UseBoundingClientRectOptions, UseElementIntersectionObserverOptions, UseElementIntersectionObserverReturn, UseIntersectionObserverOptions, UseIntersectionObserverResult, type UseModelOptions, UseNavigationBarMetricsOptions, UsePageScrollThrottleOptions, UsePageScrollThrottleStopHandle, UsePageStackOptions, UseScrollOffsetOptions, UseSelectorFieldsOptions, UseSelectorQueryOptions, UseUpdatePerformanceListenerStopHandle, type VNode, type VNodeProps, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, type WechatMiniProgramHostNamespace, type WechatMiniProgramHostSourceContract, type WevuComponentConstructor, type WevuDefaults, type WevuDefinedComponent, WevuGlobalComponents, WevuGlobalDirectives, type WevuPageLayoutMap, type WevuPlugin, type WevuTypedRouterRouteMap, type WritableComputedOptions, type WritableComputedRef, addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createPinia, createStore, createWevuComponent, createWevuScopedSlotComponent, customRef, defineAppSetup, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, definePageMeta, defineProps, defineSlots, defineStore, disposePinia, effect, effectScope, endBatch, getActivePinia, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getNavigationBarMetrics, getReactiveVersion, hasInjectionContext, inject, injectGlobal, isNoSetData, isProxy, isRaw, isReactive, isReadonly, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, registerPageLayoutBridge, registerRuntimeLayoutHosts, removeMutationRecorder, resetWevuDefaults, resolveLayoutBridge, resolveLayoutHost, resolvePropValue, resolveRuntimePageLayoutName, runSetupFunction, setActivePinia, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, storeToRefs, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, teardownRuntimeInstance, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, use, useAsyncDerivation, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useCssModule, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, version, waitForLayoutHost, watch, watchEffect, watchPostEffect, watchSyncEffect, withDefaults };
77
+ export { type ActionContext, type ActionSubscriber, type AlipayMiniProgramHostNamespace, type AlipayMiniProgramHostSourceContract, type AllowedComponentProps, type AppConfig, type AsyncDerivation, type AsyncDerivationContext, type AsyncDerivationState, type AsyncDerivationStatus, type ComponentCustomProps, type ComponentDefinition, type ComponentOptionsMixin, type ComponentPropsOptions, type ComponentPublicInstance, type ComponentTypeEmits, type ComputedDefinitions, type ComputedGetter, type ComputedRef, type ComputedSetter, type CreateAppOptions, type CustomRefFactory, type CustomRefOptions, type CustomRefSource, type DataOption, type DefaultMiniProgramHostNamespace, type DefaultMiniProgramHostSourceContract, type DefineAppOptions, type DefineComponent, type DefineComponentOptions, type DefineComponentTypePropsOptions, type DefineComponentWithTypeProps, DefineModelModifiers, DefineModelTransformOptions, type DefineStoreOptions, DisposableBag, DisposableLike, DisposableMethodName, DisposableObject, type DouyinMiniProgramHostNamespace, type DouyinMiniProgramHostSourceContract, type EffectScope, ElementIntersectionObserverCallback, type EmitFn, type EmitsOptions, type ExtractComputed, type ExtractDefaultPropTypes, type ExtractMethods, type ExtractPropTypes, type ExtractPublicPropTypes, GlobalComponents, GlobalDirectives, type HostMiniProgramAddToFavoritesOption, type HostMiniProgramAppOptions, type HostMiniProgramAppTrivialInstance, type HostMiniProgramBehaviorIdentifier, type HostMiniProgramBoundingClientRectResult, type HostMiniProgramComponentAllFullProperty, type HostMiniProgramComponentAllProperty, type HostMiniProgramComponentBehaviorOptions, type HostMiniProgramComponentEmptyArray, type HostMiniProgramComponentInstance, type HostMiniProgramComponentMethodOption, type HostMiniProgramComponentPropertyOption, type HostMiniProgramComponentPropertyValue, type HostMiniProgramComponentShortProperty, type HostMiniProgramComponentTrivialInstance, type HostMiniProgramComponentTrivialOption, type HostMiniProgramIntersectionObserver, type HostMiniProgramIntersectionObserverOptions, type HostMiniProgramLaunchOptions, type HostMiniProgramMemoryWarningResult, type HostMiniProgramNavigateToOption, type HostMiniProgramNodesRef, type HostMiniProgramNodesRefFields, type HostMiniProgramPageLifetime, type HostMiniProgramPageNotFoundOptions, type HostMiniProgramPageResizeOption, type HostMiniProgramPageScrollOption, type HostMiniProgramPageTrivialInstance, type HostMiniProgramReLaunchOption, type HostMiniProgramRedirectToOption, type HostMiniProgramRouter, type HostMiniProgramSaveExitState, type HostMiniProgramScrollOffsetResult, type HostMiniProgramSelectorQuery, type HostMiniProgramShareAppMessageOption, type HostMiniProgramSwitchTabOption, type HostMiniProgramTabItemTapOption, type HostMiniProgramThemeChangeResult, type HostMiniProgramTriggerEventOptions, type HostMiniProgramUnhandledRejectionResult, type InferNativePropType, type InferNativeProps, type InferPropType, type InferProps, type InternalRuntimeState, type InternalRuntimeStateFields, type LayoutBridgeInstance, type LayoutHostBinding, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MaybeUndefined, type MethodDefinitions, type MiniProgramAdapter, type HostMiniProgramAddToFavoritesOption as MiniProgramAddToFavoritesOption, type MiniProgramAppOptions, type MiniProgramBehaviorIdentifier, type HostMiniProgramBoundingClientRectResult as MiniProgramBoundingClientRectResult, type HostMiniProgramComponentAllFullProperty as MiniProgramComponentAllFullProperty, type HostMiniProgramComponentAllProperty as MiniProgramComponentAllProperty, type HostMiniProgramComponentBehaviorOptions as MiniProgramComponentBehaviorOptions, type HostMiniProgramComponentEmptyArray as MiniProgramComponentEmptyArray, type MiniProgramComponentInstance, type HostMiniProgramComponentMethodOption as MiniProgramComponentMethodOption, type MiniProgramComponentOptions, type HostMiniProgramComponentPropertyOption as MiniProgramComponentPropertyOption, type MiniProgramComponentPropertyValue, type MiniProgramComponentRawOptions, type HostMiniProgramComponentShortProperty as MiniProgramComponentShortProperty, type MiniProgramHostNamespace, type MiniProgramHostNamespaceBySource, type MiniProgramHostSourceName, type MiniProgramHostSourceRegistry, type MiniProgramInstance, type HostMiniProgramIntersectionObserver as MiniProgramIntersectionObserver, type HostMiniProgramIntersectionObserverOptions as MiniProgramIntersectionObserverOptions, type HostMiniProgramLaunchOptions as MiniProgramLaunchOptions, type HostMiniProgramMemoryWarningResult as MiniProgramMemoryWarningResult, type HostMiniProgramNavigateToOption as MiniProgramNavigateToOption, type HostMiniProgramNodesRef as MiniProgramNodesRef, type HostMiniProgramNodesRefFields as MiniProgramNodesRefFields, type HostMiniProgramPageLifetime as MiniProgramPageLifetime, type MiniProgramPageLifetimes, type HostMiniProgramPageNotFoundOptions as MiniProgramPageNotFoundOptions, type HostMiniProgramPageResizeOption as MiniProgramPageResizeOption, type HostMiniProgramPageScrollOption as MiniProgramPageScrollOption, type MiniProgramPlatformHostNamespaceBySource, type MiniProgramPlatformHostSourceName, type MiniProgramPlatformHostSourceRegistry, type HostMiniProgramReLaunchOption as MiniProgramReLaunchOption, type HostMiniProgramRedirectToOption as MiniProgramRedirectToOption, type HostMiniProgramRouter as MiniProgramRouter, type MiniProgramRouterNavigateToOption, type MiniProgramRouterReLaunchOption, type MiniProgramRouterRedirectToOption, type MiniProgramRouterSwitchTabOption, type MiniProgramRuntimeHostNamespaceBySource, type MiniProgramRuntimeHostSourceName, type MiniProgramRuntimeHostSourceRegistry, type HostMiniProgramSaveExitState as MiniProgramSaveExitState, type HostMiniProgramScrollOffsetResult as MiniProgramScrollOffsetResult, type HostMiniProgramSelectorQuery as MiniProgramSelectorQuery, type HostMiniProgramShareAppMessageOption as MiniProgramShareAppMessageOption, type HostMiniProgramSwitchTabOption as MiniProgramSwitchTabOption, type HostMiniProgramTabItemTapOption as MiniProgramTabItemTapOption, type MiniProgramTemplateRefElements, MiniProgramTemplateRefValue, type HostMiniProgramThemeChangeResult as MiniProgramThemeChangeResult, type HostMiniProgramUnhandledRejectionResult as MiniProgramUnhandledRejectionResult, type ModelBinding, type ModelBindingOptions, type ModelBindingPayload, type ModelModifiers, ModelRef, type MultiWatchSources, type MutationKind, type MutationOp, type MutationRecord, MutationType, type NativeComponent, type NativePropType, type NativePropsOptions, type NativeTypeHint, type NativeTypedProperty, NavigationBarMetrics, type ObjectDirective, type OnCleanup, type PageFeatures, type PageLayoutMeta, type PageLayoutState, type PageMeta, PageStackSnapshot, type Pinia, type PiniaCustomProperties, type PiniaCustomStateProperties, type PiniaPlugin, type PiniaPluginContext, type PrelinkReactiveTreeOptions, type PropConstructor, type PropOptions, type PropType, type PublicProps, PullDownRefreshHandler, type Ref, type RuntimeApp, type RuntimeInstance, type SetDataBindingDiagnostic, type SetDataDebugInfo, type SetDataSnapshotOptions, type SetupContext, type SetupContextIntersectionObserver, type SetupContextIntersectionObserverOptions, type SetupContextNativeInstance, type SetupContextRouter, type SetupContextSelectorQuery, type SetupContextWithTypeProps, type SetupFunction, type SetupFunctionWithTypeProps, type ShallowRef, type ShallowUnwrapRef, type StateTree, type StoreActions, type StoreDefinition, type StoreGeneric, type StoreManager, type StoreState, type StoreSubscribeOptions, type StoreToRefsResult, type SubscriptionCallback, type SubscriptionCallbackMutation, type TemplateRef, TemplateRefValue, TemplateRefs, type ToRefs, type HostMiniProgramTriggerEventOptions as TriggerEventOptions, type TtMiniProgramHostNamespace, type TtMiniProgramHostSourceContract, UpdatePerformanceListener, UpdatePerformanceListenerResult, UseAllBoundingClientRectOptions, UseAllScrollOffsetOptions, UseAllSelectorFieldsOptions, type UseAsyncDerivationOptions, UseAsyncPullDownRefreshOptions, UseBoundingClientRectOptions, UseElementIntersectionObserverOptions, UseElementIntersectionObserverReturn, UseIntersectionObserverOptions, UseIntersectionObserverResult, type UseModelOptions, UseNavigationBarMetricsOptions, UsePageScrollThrottleOptions, UsePageScrollThrottleStopHandle, UsePageStackOptions, UseScrollOffsetOptions, UseSelectorFieldsOptions, UseSelectorQueryOptions, UseUpdatePerformanceListenerStopHandle, type VNode, type VNodeProps, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, type WechatMiniProgramHostNamespace, type WechatMiniProgramHostSourceContract, type WevuComponentConstructor, type WevuDefaults, type WevuDefinedComponent, WevuGlobalComponents, WevuGlobalDirectives, type WevuPageLayoutMap, type WevuPlugin, type WevuTypedRouterRouteMap, type WritableComputedOptions, type WritableComputedRef, addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createPinia, createStore, createWevuComponent, createWevuScopedSlotComponent, customRef, defineAppSetup, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, definePageMeta, defineProps, defineSlots, defineStore, disposePinia, effect, effectScope, endBatch, getActivePinia, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getNavigationBarMetrics, getReactiveVersion, hasInjectionContext, inject, injectGlobal, isNoSetData, isProxy, isRaw, isReactive, isReadonly, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, registerPageLayoutBridge, registerRuntimeLayoutHosts, removeMutationRecorder, resetWevuDefaults, resolveLayoutBridge, resolveLayoutHost, resolvePropValue, resolveRuntimePageLayoutName, runSetupFunction, setActivePinia, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, storeToRefs, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, teardownRuntimeInstance, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, use, useAsyncDerivation, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useCssModule, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, version, waitForLayoutHost, watch, watchEffect, watchPostEffect, watchSyncEffect, withDefaults };
@@ -1,6 +1,7 @@
1
+ import { ComputedGetter, ComputedSetter, WritableComputedOptions } from "./types/reactivity.mjs";
1
2
  import { AsyncDerivation, AsyncDerivationContext, AsyncDerivationState, AsyncDerivationStatus, UseAsyncDerivationOptions, useAsyncDerivation } from "./reactivity/asyncDerivation.mjs";
2
3
  import { CustomRefFactory, CustomRefOptions, CustomRefSource, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, customRef, isRef, ref, toValue, unref } from "./reactivity/ref.mjs";
3
- import { ComputedGetter, ComputedRef, ComputedSetter, WritableComputedOptions, WritableComputedRef, computed } from "./reactivity/computed.mjs";
4
+ import { ComputedRef, WritableComputedRef, computed } from "./reactivity/computed.mjs";
4
5
  import { nextTick } from "./scheduler.mjs";
5
6
  import { EffectScope, batch, effect, effectScope, endBatch, getCurrentScope, onScopeDispose, startBatch, stop } from "./reactivity/core.mjs";
6
7
  import { MutationKind, MutationOp, MutationRecord, addMutationRecorder, removeMutationRecorder } from "./reactivity/reactive/mutation.mjs";
@@ -1 +1 @@
1
- import{normalizeClass as e,normalizeStyle as t,resolvePropValue as n}from"./runtime/template.mjs";export{e as normalizeClass,t as normalizeStyle,n as resolvePropValue};
1
+ export{normalizeClass,normalizeStyle,resolvePropValue}from"./runtime/template.mjs";
@@ -55,4 +55,5 @@ export declare namespace JSX {
55
55
  interface IntrinsicAttributes extends WevuJsxHostAttributes {}
56
56
  interface IntrinsicElements extends WevuJsxGlobalComponents {}
57
57
  }
58
- //#endregion
58
+ //#endregion
59
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { HostMiniProgramComponentAllFullProperty, HostMiniProgramComponentAllProperty, HostMiniProgramComponentBehaviorOptions, HostMiniProgramComponentEmptyArray, HostMiniProgramComponentMethodOption, HostMiniProgramComponentPropertyOption, HostMiniProgramTriggerEventOptions } from "../runtime/types/miniprogramHost.mjs";
2
2
  import { MiniProgramComponentInstance, MiniProgramComponentPropertyValue } from "../runtime/types/miniprogram.mjs";
3
3
  import { ComponentPropsOptions, InferProps } from "../runtime/types/props/propTypes.mjs";
4
- import { ComputedDefinitions, MethodDefinitions } from "../runtime/types/core.mjs";
4
+ import { ComputedDefinitions, MethodDefinitions } from "../types/definitions.mjs";
5
5
  import { DefineComponentOptions } from "../runtime/types/options.mjs";
6
6
  import "../runtime/index.mjs";
7
7
  //#region src/macros/shared.d.ts
@@ -79,4 +79,5 @@ export type ScriptSetupDefineOptions<D extends object = Record<string, any>, C e
79
79
  */
80
80
  setupLifecycle?: 'created' | 'attached';
81
81
  };
82
- //#endregion
82
+ //#endregion
83
+ export {};
package/dist/macros.d.mts CHANGED
@@ -1,8 +1,9 @@
1
+ import { PageLayoutMeta, PageMeta } from "./types/pageMeta.mjs";
1
2
  import { HostMiniProgramComponentPropertyOption } from "./runtime/types/miniprogramHost.mjs";
2
3
  import { ComponentPropsOptions } from "./runtime/types/props/propTypes.mjs";
4
+ import { ComputedDefinitions, MethodDefinitions } from "./types/definitions.mjs";
3
5
  import { Ref } from "./reactivity/ref.mjs";
4
6
  import "./reactivity/index.mjs";
5
- import { ComputedDefinitions, MethodDefinitions } from "./runtime/types/core.mjs";
6
7
  import "./runtime/index.mjs";
7
8
  import { BooleanKey, ComponentTypeEmits, DefineProps, DefinePropsFromArray, DefinePropsFromOptions, EmitFn, EmitsOptions, InferDefaults, PropsWithDefaults, ScriptSetupDefineOptions, ShortEmits } from "./macros/shared.mjs";
8
9
  //#region src/macros.d.ts
@@ -35,14 +36,6 @@ export declare function defineOptions<D extends object = Record<string, any>, C
35
36
  * defineSlots 声明 slots 类型(仅类型层)。
36
37
  */
37
38
  export declare function defineSlots<T extends Record<string, any> = Record<string, any>>(): T;
38
- export type PageLayoutMeta = string | false | {
39
- name: string;
40
- props?: Record<string, unknown>;
41
- };
42
- export interface PageMeta {
43
- layout?: PageLayoutMeta;
44
- [key: string]: unknown;
45
- }
46
39
  /**
47
40
  * definePageMeta 声明页面级元信息(仅类型层)。
48
41
  */
@@ -67,4 +60,4 @@ export declare function defineModel<T = any, M extends PropertyKey = string, G =
67
60
  export declare function defineModel<T = any, M extends PropertyKey = string, G = T, S = T>(options?: DefineModelBaseOptions<T | undefined, M, G | undefined, S | undefined>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
68
61
  export declare function defineModel<T = any, M extends PropertyKey = string, G = T, S = T>(name?: string, options?: DefineModelBaseOptions<T | undefined, M, G | undefined, S | undefined>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
69
62
  //#endregion
70
- export type { ComponentTypeEmits, EmitFn, EmitsOptions };
63
+ export type { ComponentTypeEmits, EmitFn, EmitsOptions, PageLayoutMeta, PageMeta };
package/dist/package.mjs CHANGED
@@ -1 +1 @@
1
- var e=`7.4.0`;export{e as version};
1
+ var e=`7.6.0`;export{e as version};
@@ -37,4 +37,5 @@ export type AsyncDerivation<T> = AsyncDerivationState<T> & AsyncDerivationContro
37
37
  * 加载错误通过 `status` 与 `error` 暴露,`refresh()` 始终正常完成。
38
38
  */
39
39
  export declare function useAsyncDerivation<T>(loader: (context: AsyncDerivationContext) => T | PromiseLike<T>, options?: UseAsyncDerivationOptions): AsyncDerivation<T>;
40
- //#endregion
40
+ //#endregion
41
+ export {};
@@ -1,7 +1,6 @@
1
+ import { ComputedGetter, ComputedSetter, WritableComputedOptions } from "../types/reactivity.mjs";
1
2
  import { Ref } from "./ref.mjs";
2
3
  //#region src/reactivity/computed.d.ts
3
- export type ComputedGetter<T> = () => T;
4
- export type ComputedSetter<T> = (value: T) => void;
5
4
  declare const computedBrand: unique symbol;
6
5
  declare const writableComputedBrand: unique symbol;
7
6
  interface BaseComputedRef<T, S = T> extends Ref<T, S> {
@@ -15,10 +14,7 @@ export interface WritableComputedRef<T, S = T> extends BaseComputedRef<T, S> {
15
14
  readonly [writableComputedBrand]: true;
16
15
  value: T;
17
16
  }
18
- export interface WritableComputedOptions<T> {
19
- get: ComputedGetter<T>;
20
- set: ComputedSetter<T>;
21
- }
22
17
  export declare function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>;
23
18
  export declare function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>;
24
- //#endregion
19
+ //#endregion
20
+ export type { ComputedGetter, ComputedSetter, WritableComputedOptions };
@@ -1 +1 @@
1
- import{queueJob as e}from"../scheduler.mjs";import t from"../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/defineProperty.mjs";const n=/* @__PURE__ */ new WeakMap;let r=null;const i=[];let a=!0,o,s=0,c=!1;const l=/* @__PURE__ */ new Set,u=/* @__PURE__ */ new Set;function d(e){if(e.active){if(e.scheduler){let t=o;o=e._scope;try{e.scheduler()}finally{o=t}return}e()}}function f(e){if(s>0||c){u.add(e);return}u.delete(e),e()}function p(){s++}function m(e){let t=e.values().next();if(!t.done)return e.delete(t.value),t.value}function h(){let e,t=!1;c=!0;try{for(;l.size;){let n=m(l);if(n)try{d(n)}catch(n){t||(e=n,t=!0)}}}finally{c=!1}for(;u.size;){let n=u.values().next().value;u.delete(n);try{n()}catch(n){t||(e=n,t=!0)}}if(t)throw e}function g(){s!==0&&(s--,s===0&&!c&&h())}function _(e){p();try{return e()}finally{g()}}function v(e){let{deps:t}=e;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}function y(e){e.active&&(e.active=!1,v(e),e.onStop?.())}var b=class{constructor(e=!1){if(this.detached=e,t(this,`active`,!0),t(this,`effects`,[]),t(this,`cleanups`,[]),t(this,`parent`,void 0),t(this,`scopes`,void 0),!e&&o){var n;if(!o.active){this.active=!1;return}this.parent=o,((n=o).scopes||(n.scopes=[])).push(this)}}run(e){if(!this.active)return;let t=o;o=this;try{return e()}finally{o=t}}stop(){if(!this.active)return;this.active=!1;let e=o;o=this;let t,n=!1,r=e=>{n||(t=e,n=!0)};try{let e=this.effects.splice(0);for(let t of e)try{y(t)}catch(e){r(e)}let t=this.cleanups.splice(0);for(let e of t)try{e()}catch(e){r(e)}let n=this.scopes;if(this.scopes=void 0,n){for(let e of n)try{e.stop()}catch(e){r(e)}n.length=0}}finally{if(this.parent?.scopes){let e=this.parent.scopes.indexOf(this);e>=0&&this.parent.scopes.splice(e,1)}this.parent=void 0,o=e}if(n)throw t}};function x(e=!1){return new b(e)}function S(){return o}function C(e){o?.active&&o.cleanups.push(e)}function w(e){let t=a;a=!1;try{return e()}finally{a=t}}function T(e){if(o){if(o.active){o.effects.push(e);return}y(e)}}function E(e,t={}){let n=function(){if(!n.active||n._running)return e();v(n);let t=o;o=n._scope;let s=a;try{return a=!0,n._running=!0,i.push(n),r=n,e()}finally{i.pop(),r=i[i.length-1]??null,n._running=!1,o=t,a=s}};return n.deps=[],n.scheduler=t.scheduler,n.onStop=t.onStop,n.active=!0,n._running=!1,n._fn=e,n._scope=o,n}function D(e,t,n){let r=E(e,t);return r._computed=n,T(r),t.lazy||r(),r}function O(e,t={}){return D(e,t,!1)}function k(e,t={}){return D(e,t,!0)}function A(e,t){if(!a||!r)return;let i=n.get(e);i||(i=/* @__PURE__ */ new Map,n.set(e,i));let o=i.get(t);o||(o=/* @__PURE__ */ new Set,i.set(t,o)),o.has(r)||(o.add(r),r.deps.push(o))}function j(e){if(!e._running){if(e._computed){d(e);return}if(s>0||c){l.add(e);return}d(e)}}function M(e,t){let i=n.get(e);if(!i)return;let a=i.get(t);if(!a)return;let o=/* @__PURE__ */ new Set;a.forEach(e=>{e!==r&&o.add(e)}),o.forEach(j)}function N(e){a&&r&&(e.has(r)||(e.add(r),r.deps.push(e)))}function P(e){new Set(e).forEach(j)}export{_ as batch,k as createComputedEffect,E as createReactiveEffect,O as effect,x as effectScope,g as endBatch,S as getCurrentScope,C as onScopeDispose,f as queueBatchCallback,e as queueJob,w as runWithoutTracking,p as startBatch,y as stop,A as track,N as trackEffects,M as trigger,P as triggerEffects};
1
+ import{queueJob as e}from"../scheduler.mjs";import t from"../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.mjs";const n=/* @__PURE__ */ new WeakMap;let r=null;const i=[];let a=!0,o,s=0,c=!1;const l=/* @__PURE__ */ new Set,u=/* @__PURE__ */ new Set;function d(e){if(e.active){if(e.scheduler){let t=o;o=e._scope;try{e.scheduler()}finally{o=t}}else e()}}function f(e){s>0||c?u.add(e):(u.delete(e),e())}function p(){s++}function m(e){let t=e.values().next();if(!t.done)return e.delete(t.value),t.value}function h(){let e,t=!1;c=!0;try{for(;l.size;){let n=m(l);if(n)try{d(n)}catch(n){t||(e=n,t=!0)}}}finally{c=!1}for(;u.size;){let n=u.values().next().value;u.delete(n);try{n()}catch(n){t||(e=n,t=!0)}}if(t)throw e}function g(){s!==0&&(s--,s===0&&!c&&h())}function _(e){p();try{return e()}finally{g()}}function v(e){let{deps:t}=e;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}function y(e){e.active&&(e.active=!1,v(e),e.onStop?.())}var b=class{constructor(e=!1){if(this.detached=e,t(this,`active`,!0),t(this,`effects`,[]),t(this,`cleanups`,[]),t(this,`parent`,void 0),t(this,`scopes`,void 0),!e&&o){var n;if(!o.active){this.active=!1;return}this.parent=o,((n=o).scopes||(n.scopes=[])).push(this)}}run(e){if(!this.active)return;let t=o;o=this;try{return e()}finally{o=t}}stop(){if(!this.active)return;this.active=!1;let e=o;o=this;let t,n=!1,r=e=>{n||(t=e,n=!0)};try{let e=this.effects.splice(0);for(let t of e)try{y(t)}catch(e){r(e)}let t=this.cleanups.splice(0);for(let e of t)try{e()}catch(e){r(e)}let n=this.scopes;if(this.scopes=void 0,n){for(let e of n)try{e.stop()}catch(e){r(e)}n.length=0}}finally{if(this.parent?.scopes){let e=this.parent.scopes.indexOf(this);e>=0&&this.parent.scopes.splice(e,1)}this.parent=void 0,o=e}if(n)throw t}};function x(e=!1){return new b(e)}function S(){return o}function C(e){o?.active&&o.cleanups.push(e)}function w(e){let t=a;a=!1;try{return e()}finally{a=t}}function T(e){o&&(o.active?o.effects.push(e):y(e))}function E(e,t={}){let n=function(){if(!n.active||n._running)return e();v(n);let t=o;o=n._scope;let s=a;try{return a=!0,n._running=!0,i.push(n),r=n,e()}finally{i.pop(),r=i[i.length-1]??null,n._running=!1,o=t,a=s}};return n.deps=[],n.scheduler=t.scheduler,n.onStop=t.onStop,n.active=!0,n._running=!1,n._fn=e,n._scope=o,n}function D(e,t,n){let r=E(e,t);return r._computed=n,T(r),t.lazy||r(),r}function O(e,t={}){return D(e,t,!1)}function k(e,t={}){return D(e,t,!0)}function A(e,t){if(!a||!r)return;let i=n.get(e);i||(i=/* @__PURE__ */ new Map,n.set(e,i));let o=i.get(t);o||(o=/* @__PURE__ */ new Set,i.set(t,o)),o.has(r)||(o.add(r),r.deps.push(o))}function j(e){e._running||(e._computed?d(e):s>0||c?l.add(e):d(e))}function M(e,t){let i=n.get(e);if(!i)return;let a=i.get(t);if(!a)return;let o=/* @__PURE__ */ new Set;a.forEach(e=>{e!==r&&o.add(e)}),o.forEach(j)}function N(e){a&&r&&(e.has(r)||(e.add(r),r.deps.push(e)))}function P(e){new Set(e).forEach(j)}export{_ as batch,k as createComputedEffect,E as createReactiveEffect,O as effect,x as effectScope,g as endBatch,S as getCurrentScope,C as onScopeDispose,f as queueBatchCallback,e as queueJob,w as runWithoutTracking,p as startBatch,y as stop,A as track,N as trackEffects,M as trigger,P as triggerEffects};
@@ -1,6 +1,7 @@
1
+ import { ComputedGetter, ComputedSetter, WritableComputedOptions } from "../types/reactivity.mjs";
1
2
  import { AsyncDerivation, AsyncDerivationContext, AsyncDerivationState, AsyncDerivationStatus, UseAsyncDerivationOptions, useAsyncDerivation } from "./asyncDerivation.mjs";
2
3
  import { CustomRefFactory, CustomRefOptions, CustomRefSource, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, customRef, isRef, ref, toValue, unref } from "./ref.mjs";
3
- import { ComputedGetter, ComputedRef, ComputedSetter, WritableComputedOptions, WritableComputedRef, computed } from "./computed.mjs";
4
+ import { ComputedRef, WritableComputedRef, computed } from "./computed.mjs";
4
5
  import { EffectScope, batch, effect, effectScope, endBatch, getCurrentScope, onScopeDispose, startBatch, stop } from "./core.mjs";
5
6
  import { MutationKind, MutationOp, MutationRecord, addMutationRecorder, removeMutationRecorder } from "./reactive/mutation.mjs";
6
7
  import { PrelinkReactiveTreeOptions, prelinkReactiveTree, touchReactive } from "./reactive/patch.mjs";
@@ -17,4 +17,5 @@ export interface MutationRecord {
17
17
  type MutationRecorder = (record: MutationRecord) => void;
18
18
  export declare function addMutationRecorder(recorder: MutationRecorder): void;
19
19
  export declare function removeMutationRecorder(recorder: MutationRecorder): void;
20
- //#endregion
20
+ //#endregion
21
+ export {};
@@ -1 +1 @@
1
- import{track as e}from"../core.mjs";import{adoptReactiveRoot as t,indexPatchNode as n,rawMultiParentSet as r,rawParentMap as i,rawParentsMap as a,rawPathMap as o,rawRootMap as s,rawVersionMap as c,recordParentLink as l,rootPatchNodesMap as u}from"./patchState.mjs";import{VERSION_KEY as d,isObject as f,toRaw as p}from"./shared.mjs";function m(e,i){let a=p(e);o.set(a,``),n(a,a);let s=i?.shouldIncludeTopKey,c=typeof i?.maxDepth==`number`?Math.max(0,Math.floor(i.maxDepth)):1/0,u=typeof i?.maxKeys==`number`?Math.max(0,Math.floor(i.maxKeys)):1/0,d=/* @__PURE__ */ new WeakSet,m=[{current:a,path:``,depth:0}],h=0;for(;m.length;){let e=m.pop();if(d.has(e.current)||(d.add(e.current),o.set(e.current,e.path),n(a,e.current),h+=1,h>=u)||e.depth>=c||Array.isArray(e.current))continue;let i=Object.entries(e.current);for(let[c,u]of i){if(e.path===``&&s&&!s(c)||!f(u)||u.__r_skip)continue;let i=p(u);if(t(i,e.current),l(i,e.current,c),!r.has(i)){let t=e.path?`${e.path}.${c}`:c;o.set(i,t)}n(a,i),m.push({current:i,path:e.path?`${e.path}.${c}`:c,depth:e.depth+1})}}}function h(e){let t=p(e),n=u.get(t);if(!n){o.delete(t);return}for(let e of n)i.delete(e),a.delete(e),o.delete(e),r.delete(e),s.delete(e),c.delete(e);u.delete(t)}function g(t){let n=p(t);e(n,d)}export{h as clearPatchIndices,m as prelinkReactiveTree,g as touchReactive};
1
+ import{track as e}from"../core.mjs";import{adoptReactiveRoot as t,indexPatchNode as n,rawMultiParentSet as r,rawParentMap as i,rawParentsMap as a,rawPathMap as o,rawRootMap as s,rawVersionMap as c,recordParentLink as l,rootPatchNodesMap as u}from"./patchState.mjs";import{VERSION_KEY as d,isObject as f,toRaw as p}from"./shared.mjs";function m(e,i){let a=p(e);o.set(a,``),n(a,a);let s=i?.shouldIncludeTopKey,c=typeof i?.maxDepth==`number`?Math.max(0,Math.floor(i.maxDepth)):1/0,u=typeof i?.maxKeys==`number`?Math.max(0,Math.floor(i.maxKeys)):1/0,d=/* @__PURE__ */ new WeakSet,m=[{current:a,path:``,depth:0}],h=0;for(;m.length;){let e=m.pop();if(d.has(e.current)||(d.add(e.current),o.set(e.current,e.path),n(a,e.current),h+=1,h>=u)||e.depth>=c||Array.isArray(e.current))continue;let i=Object.entries(e.current);for(let[c,u]of i){if(e.path===``&&s&&!s(c)||!f(u)||u.__r_skip)continue;let i=p(u);if(t(i,e.current),l(i,e.current,c),!r.has(i)){let t=e.path?`${e.path}.${c}`:c;o.set(i,t)}n(a,i),m.push({current:i,path:e.path?`${e.path}.${c}`:c,depth:e.depth+1})}}}function h(e){let t=p(e),n=u.get(t);if(!n)o.delete(t);else{for(let e of n)i.delete(e),a.delete(e),o.delete(e),r.delete(e),s.delete(e),c.delete(e);u.delete(t)}}function g(t){let n=p(t);e(n,d)}export{h as clearPatchIndices,m as prelinkReactiveTree,g as touchReactive};
@@ -1 +1 @@
1
- import{mutationRecorders as e}from"./mutation.mjs";const t=/* @__PURE__ */ new WeakMap,n=/* @__PURE__ */ new WeakMap,r=/* @__PURE__ */ new WeakMap,i=/* @__PURE__ */ new WeakMap,a=/* @__PURE__ */ new WeakSet,o=/* @__PURE__ */ new WeakMap,s=/* @__PURE__ */ new WeakMap;function c(e){let t=s.get(e);return t||(t=/* @__PURE__ */ new Set,s.set(e,t)),t}function l(e,t){c(e).add(t)}function u(e){n.set(e,(n.get(e)??0)+1)}function d(e){return n.get(e)??0}function f(e,n){let r=t.get(n)??n,i=t.get(e);(!i||i===e||i===n)&&t.set(e,r)}function p(e){let t=/* @__PURE__ */ new Set,n=[e];for(let e=0;e<2e3&&n.length;e++){let e=n.pop(),r=i.get(e);if(r)for(let e of r.keys())t.has(e)||(t.add(e),u(e),n.push(e))}}function m(e){let t=i.get(e);if(!t){a.delete(e),r.delete(e);return}let n,o,s=0;for(let[e,r]of t){for(let t of r){if(s+=1,s>1)break;n=e,o=t}if(s>1)break}if(s===1&&n&&o){a.delete(e),r.set(e,{parent:n,key:o});return}a.add(e),r.delete(e)}function h(n,o,s){if(typeof s!=`string`){a.add(n),r.delete(n);return}if(e.size){let e=t.get(o)??o;l(e,o),l(e,n)}let c=i.get(n);c||(c=/* @__PURE__ */ new Map,i.set(n,c));let u=c.get(o);u||(u=/* @__PURE__ */ new Set,c.set(o,u)),u.add(s),m(n)}function g(e,t,n){let r=i.get(e);if(!r)return;let a=r.get(t);a&&(a.delete(n),a.size||r.delete(t),r.size||i.delete(e),m(e))}function _(e,t){if(t===e)return[];if(a.has(t))return;let n=[],i=t;for(let t=0;t<2e3;t++){if(i===e)return n.reverse();if(a.has(i))return;let t=r.get(i);if(!t||typeof t.key!=`string`)return;n.push(t.key),i=t.parent}}export{f as adoptReactiveRoot,p as bumpAncestorVersions,u as bumpRawVersion,d as getRawVersion,l as indexPatchNode,a as rawMultiParentSet,r as rawParentMap,i as rawParentsMap,o as rawPathMap,t as rawRootMap,n as rawVersionMap,h as recordParentLink,g as removeParentLink,_ as resolvePathToTarget,s as rootPatchNodesMap};
1
+ import{mutationRecorders as e}from"./mutation.mjs";const t=/* @__PURE__ */ new WeakMap,n=/* @__PURE__ */ new WeakMap,r=/* @__PURE__ */ new WeakMap,i=/* @__PURE__ */ new WeakMap,a=/* @__PURE__ */ new WeakSet,o=/* @__PURE__ */ new WeakMap,s=/* @__PURE__ */ new WeakMap;function c(e){let t=s.get(e);return t||(t=/* @__PURE__ */ new Set,s.set(e,t)),t}function l(e,t){c(e).add(t)}function u(e){n.set(e,(n.get(e)??0)+1)}function d(e){return n.get(e)??0}function f(e,n){let r=t.get(n)??n,i=t.get(e);(!i||i===e||i===n)&&t.set(e,r)}function p(e){let t=/* @__PURE__ */ new Set,n=[e];for(let e=0;e<2e3&&n.length;e++){let e=n.pop(),r=i.get(e);if(r)for(let e of r.keys())t.has(e)||(t.add(e),u(e),n.push(e))}}function m(e){let t=i.get(e);if(!t){a.delete(e),r.delete(e);return}let n,o,s=0;for(let[e,r]of t){for(let t of r){if(s+=1,s>1)break;n=e,o=t}if(s>1)break}s===1&&n&&o?(a.delete(e),r.set(e,{parent:n,key:o})):(a.add(e),r.delete(e))}function h(n,o,s){if(typeof s!=`string`){a.add(n),r.delete(n);return}if(e.size){let e=t.get(o)??o;l(e,o),l(e,n)}let c=i.get(n);c||(c=/* @__PURE__ */ new Map,i.set(n,c));let u=c.get(o);u||(u=/* @__PURE__ */ new Set,c.set(o,u)),u.add(s),m(n)}function g(e,t,n){let r=i.get(e);if(!r)return;let a=r.get(t);a&&(a.delete(n),a.size||r.delete(t),r.size||i.delete(e),m(e))}function _(e,t){if(t===e)return[];if(a.has(t))return;let n=[],i=t;for(let t=0;t<2e3;t++){if(i===e)return n.reverse();if(a.has(i))return;let t=r.get(i);if(!t||typeof t.key!=`string`)return;n.push(t.key),i=t.parent}}export{f as adoptReactiveRoot,p as bumpAncestorVersions,u as bumpRawVersion,d as getRawVersion,l as indexPatchNode,a as rawMultiParentSet,r as rawParentMap,i as rawParentsMap,o as rawPathMap,t as rawRootMap,n as rawVersionMap,h as recordParentLink,g as removeParentLink,_ as resolvePathToTarget,s as rootPatchNodesMap};