wevu 7.3.0 → 7.5.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 (262) hide show
  1. package/README.md +2 -0
  2. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.mjs +1 -1
  3. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.mjs +1 -1
  4. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.mjs +1 -1
  5. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.mjs +1 -1
  6. package/dist/dev/package.mjs +1 -1
  7. package/dist/dev/reactivity/core.mjs +1 -1
  8. package/dist/dev/reactivity/ref.mjs +1 -1
  9. package/dist/dev/router/initialNavigation.mjs +4 -1
  10. package/dist/dev/router/initialNavigation.mjs.map +1 -1
  11. package/dist/dev/router/scrollRestoration/adapters.mjs +86 -0
  12. package/dist/dev/router/scrollRestoration/adapters.mjs.map +1 -0
  13. package/dist/dev/router/scrollRestoration/controller.mjs +148 -0
  14. package/dist/dev/router/scrollRestoration/controller.mjs.map +1 -0
  15. package/dist/dev/router/scrollRestoration/host.mjs +76 -0
  16. package/dist/dev/router/scrollRestoration/host.mjs.map +1 -0
  17. package/dist/dev/router/scrollRestoration/index.mjs +156 -0
  18. package/dist/dev/router/scrollRestoration/index.mjs.map +1 -0
  19. package/dist/dev/router.mjs +4 -1
  20. package/dist/dev/runtime/app/diagnostics.mjs +5 -1
  21. package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
  22. package/dist/dev/runtime/app/mount.mjs +8 -3
  23. package/dist/dev/runtime/app/mount.mjs.map +1 -1
  24. package/dist/dev/runtime/app/setData/commitTracker.mjs +39 -4
  25. package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -1
  26. package/dist/dev/runtime/app/setData/observation.mjs +109 -0
  27. package/dist/dev/runtime/app/setData/observation.mjs.map +1 -0
  28. package/dist/dev/runtime/app/setData/scheduler.mjs +12 -1
  29. package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
  30. package/dist/dev/runtime/app/setDataOptions.mjs +1 -0
  31. package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -1
  32. package/dist/dev/runtime/define/initialComputed.mjs +13 -12
  33. package/dist/dev/runtime/define/initialComputed.mjs.map +1 -1
  34. package/dist/dev/runtime/define/props.mjs +5 -1
  35. package/dist/dev/runtime/define/props.mjs.map +1 -1
  36. package/dist/dev/runtime/define/scopedSlotOptions.mjs +2 -1
  37. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
  38. package/dist/dev/runtime/define.mjs +1 -1
  39. package/dist/dev/runtime/define.mjs.map +1 -1
  40. package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
  41. package/dist/dev/runtime/hooks/base.mjs +1 -13
  42. package/dist/dev/runtime/hooks/base.mjs.map +1 -1
  43. package/dist/dev/runtime/hooks/pageScroll.mjs +41 -0
  44. package/dist/dev/runtime/hooks/pageScroll.mjs.map +1 -0
  45. package/dist/dev/runtime/hooks/register.mjs +2 -1
  46. package/dist/dev/runtime/hooks/register.mjs.map +1 -1
  47. package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs +2 -5
  48. package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs.map +1 -1
  49. package/dist/dev/runtime/register/component/lifecycle/platform.mjs +8 -20
  50. package/dist/dev/runtime/register/component/lifecycle/platform.mjs.map +1 -1
  51. package/dist/dev/runtime/register/component/props.mjs +14 -4
  52. package/dist/dev/runtime/register/component/props.mjs.map +1 -1
  53. package/dist/dev/runtime/register/component/registerDefinition.mjs +30 -17
  54. package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
  55. package/dist/dev/runtime/register/component.mjs +2 -1
  56. package/dist/dev/runtime/register/component.mjs.map +1 -1
  57. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +14 -7
  58. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -1
  59. package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs +78 -0
  60. package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs.map +1 -0
  61. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +52 -8
  62. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -1
  63. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +7 -2
  64. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
  65. package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
  66. package/dist/dev/runtime/register/runtimeInstance.mjs +60 -19
  67. package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
  68. package/dist/fetch.mjs +1 -1
  69. package/dist/internal-template.mjs +1 -1
  70. package/dist/package.mjs +1 -1
  71. package/dist/reactivity/core.mjs +1 -1
  72. package/dist/reactivity/reactive/patch.mjs +1 -1
  73. package/dist/reactivity/reactive/patchState.mjs +1 -1
  74. package/dist/reactivity/ref.mjs +1 -1
  75. package/dist/reactivity/watch/helpers.mjs +1 -1
  76. package/dist/router/initialNavigation.mjs +1 -1
  77. package/dist/router/scrollRestoration/adapters.d.mts +7 -0
  78. package/dist/router/scrollRestoration/adapters.mjs +1 -0
  79. package/dist/router/scrollRestoration/controller.d.mts +7 -0
  80. package/dist/router/scrollRestoration/controller.mjs +1 -0
  81. package/dist/router/scrollRestoration/host.d.mts +3 -0
  82. package/dist/router/scrollRestoration/host.mjs +1 -0
  83. package/dist/router/scrollRestoration/index.d.mts +8 -0
  84. package/dist/router/scrollRestoration/index.mjs +1 -0
  85. package/dist/router/scrollRestoration/types.d.mts +60 -0
  86. package/dist/router/useRoute.mjs +1 -1
  87. package/dist/router.d.mts +5 -1
  88. package/dist/router.mjs +1 -1
  89. package/dist/routerInternal/matching.mjs +1 -1
  90. package/dist/routerInternal/params.mjs +1 -1
  91. package/dist/routerInternal/path.mjs +1 -1
  92. package/dist/routerInternal/query.mjs +1 -1
  93. package/dist/routerInternal/records.mjs +1 -1
  94. package/dist/runtime/app/context.mjs +1 -1
  95. package/dist/runtime/app/diagnostics.mjs +1 -1
  96. package/dist/runtime/app/mount.mjs +1 -1
  97. package/dist/runtime/app/setData/commitTracker.d.mts +2 -1
  98. package/dist/runtime/app/setData/commitTracker.mjs +1 -1
  99. package/dist/runtime/app/setData/observation.d.mts +12 -0
  100. package/dist/runtime/app/setData/observation.mjs +1 -0
  101. package/dist/runtime/app/setData/scheduler.d.mts +1 -0
  102. package/dist/runtime/app/setData/scheduler.mjs +1 -1
  103. package/dist/runtime/app/setDataOptions.mjs +1 -1
  104. package/dist/runtime/define/initialComputed.mjs +1 -1
  105. package/dist/runtime/define/props.mjs +1 -1
  106. package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
  107. package/dist/runtime/define.mjs +1 -1
  108. package/dist/runtime/diff.mjs +1 -1
  109. package/dist/runtime/features/publicLayout.mjs +1 -1
  110. package/dist/runtime/features/scopedSlots.d.mts +2 -1
  111. package/dist/runtime/hooks/base.mjs +1 -1
  112. package/dist/runtime/hooks/pageScroll.mjs +1 -0
  113. package/dist/runtime/hooks/register.mjs +1 -1
  114. package/dist/runtime/jsxIsland.mjs +1 -1
  115. package/dist/runtime/pageLayout.mjs +1 -1
  116. package/dist/runtime/pageScroll.mjs +1 -1
  117. package/dist/runtime/register/component/alipayRegistration.mjs +1 -1
  118. package/dist/runtime/register/component/lifecycle/optionalHooks.mjs +1 -1
  119. package/dist/runtime/register/component/lifecycle/platform.mjs +1 -1
  120. package/dist/runtime/register/component/lifecycle.mjs +1 -1
  121. package/dist/runtime/register/component/props.mjs +1 -1
  122. package/dist/runtime/register/component/registerDefinition.mjs +1 -1
  123. package/dist/runtime/register/component/registerNativeDefinition.mjs +1 -1
  124. package/dist/runtime/register/component.mjs +1 -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 +8 -4
  130. package/dist/runtime/register/runtimeInstance.mjs +1 -1
  131. package/dist/runtime/setupTracking.mjs +1 -1
  132. package/dist/runtime/templateRefs.mjs +1 -1
  133. package/dist/runtime/types/runtime.d.mts +1 -0
  134. package/dist/runtime/types/setData.d.mts +30 -0
  135. package/dist/scheduler.mjs +1 -1
  136. package/dist/web-apis.mjs +1 -1
  137. package/package.json +10 -9
  138. package/dist/dev/api/vitest/setup.d.mts +0 -1
  139. package/dist/dev/api/vitest.d.mts +0 -1
  140. package/dist/dev/api.d.mts +0 -1
  141. package/dist/dev/compiler.d.mts +0 -1
  142. package/dist/dev/fetch.d.mts +0 -9
  143. package/dist/dev/index.d.mts +0 -72
  144. package/dist/dev/internal-reactivity.d.mts +0 -18
  145. package/dist/dev/internal-runtime.d.mts +0 -45
  146. package/dist/dev/internal-template.d.mts +0 -2
  147. package/dist/dev/jsxTypes.d.mts +0 -9
  148. package/dist/dev/macros/shared.d.mts +0 -83
  149. package/dist/dev/macros.d.mts +0 -71
  150. package/dist/dev/reactivity/asyncDerivation.d.mts +0 -41
  151. package/dist/dev/reactivity/computed.d.mts +0 -25
  152. package/dist/dev/reactivity/core.d.mts +0 -35
  153. package/dist/dev/reactivity/index.d.mts +0 -16
  154. package/dist/dev/reactivity/reactive/mutation.d.mts +0 -21
  155. package/dist/dev/reactivity/reactive/patch.d.mts +0 -18
  156. package/dist/dev/reactivity/reactive/shallow.d.mts +0 -22
  157. package/dist/dev/reactivity/reactive/shared.d.mts +0 -4
  158. package/dist/dev/reactivity/reactive.d.mts +0 -42
  159. package/dist/dev/reactivity/readonly.d.mts +0 -27
  160. package/dist/dev/reactivity/ref.d.mts +0 -27
  161. package/dist/dev/reactivity/shallowRef.d.mts +0 -19
  162. package/dist/dev/reactivity/toRefs.d.mts +0 -43
  163. package/dist/dev/reactivity/traverse.d.mts +0 -8
  164. package/dist/dev/reactivity/watch/types.d.mts +0 -43
  165. package/dist/dev/reactivity/watch.d.mts +0 -22
  166. package/dist/dev/router/auto-routes.d.mts +0 -8
  167. package/dist/dev/router/createRouter.d.mts +0 -9
  168. package/dist/dev/router/navigationCore.d.mts +0 -7
  169. package/dist/dev/router/resolve.d.mts +0 -7
  170. package/dist/dev/router/routeSync.d.mts +0 -2
  171. package/dist/dev/router/types.d.mts +0 -267
  172. package/dist/dev/router/useRoute.d.mts +0 -20
  173. package/dist/dev/router/useRouter.d.mts +0 -9
  174. package/dist/dev/router.d.mts +0 -26
  175. package/dist/dev/routerInternal/location.d.mts +0 -2
  176. package/dist/dev/routerInternal/matching.d.mts +0 -2
  177. package/dist/dev/routerInternal/params.d.mts +0 -2
  178. package/dist/dev/routerInternal/query.d.mts +0 -7
  179. package/dist/dev/routerInternal/records.d.mts +0 -2
  180. package/dist/dev/routerInternal/recordsWarnings.d.mts +0 -2
  181. package/dist/dev/routerInternal/shared.d.mts +0 -9
  182. package/dist/dev/routerInternal/snapshots.d.mts +0 -2
  183. package/dist/dev/routerInternal/types.d.mts +0 -9
  184. package/dist/dev/runtime/app/pending.d.mts +0 -10
  185. package/dist/dev/runtime/app/setData/commitTracker.d.mts +0 -13
  186. package/dist/dev/runtime/app/setData/scheduler.d.mts +0 -51
  187. package/dist/dev/runtime/app.d.mts +0 -8
  188. package/dist/dev/runtime/capabilities.d.mts +0 -78
  189. package/dist/dev/runtime/css.d.mts +0 -14
  190. package/dist/dev/runtime/defaults.d.mts +0 -12
  191. package/dist/dev/runtime/define.d.mts +0 -118
  192. package/dist/dev/runtime/disposables.d.mts +0 -31
  193. package/dist/dev/runtime/elementIntersectionObserver.d.mts +0 -26
  194. package/dist/dev/runtime/features/inlineEvents.d.mts +0 -7
  195. package/dist/dev/runtime/features/jsxIslands.d.mts +0 -7
  196. package/dist/dev/runtime/features/layout.d.mts +0 -7
  197. package/dist/dev/runtime/features/patchStrategy.d.mts +0 -7
  198. package/dist/dev/runtime/features/publicLayout.d.mts +0 -24
  199. package/dist/dev/runtime/features/scopedSlots.d.mts +0 -23
  200. package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +0 -7
  201. package/dist/dev/runtime/features/templateRefs.d.mts +0 -7
  202. package/dist/dev/runtime/hooks/base.d.mts +0 -27
  203. package/dist/dev/runtime/hooks/register.d.mts +0 -30
  204. package/dist/dev/runtime/hooks/vue.d.mts +0 -52
  205. package/dist/dev/runtime/hooks.d.mts +0 -4
  206. package/dist/dev/runtime/index.d.mts +0 -46
  207. package/dist/dev/runtime/intersectionObserver.d.mts +0 -14
  208. package/dist/dev/runtime/jsxIsland.d.mts +0 -37
  209. package/dist/dev/runtime/layoutBridge.d.mts +0 -55
  210. package/dist/dev/runtime/noSetData.d.mts +0 -5
  211. package/dist/dev/runtime/pageEnvironment.d.mts +0 -50
  212. package/dist/dev/runtime/pageLayout.d.mts +0 -25
  213. package/dist/dev/runtime/pageScroll.d.mts +0 -29
  214. package/dist/dev/runtime/provide.d.mts +0 -60
  215. package/dist/dev/runtime/provideStore.d.mts +0 -7
  216. package/dist/dev/runtime/publicRuntime.d.mts +0 -22
  217. package/dist/dev/runtime/pullDownRefresh.d.mts +0 -12
  218. package/dist/dev/runtime/register/app.d.mts +0 -14
  219. package/dist/dev/runtime/register/component.d.mts +0 -17
  220. package/dist/dev/runtime/register/inline.d.mts +0 -15
  221. package/dist/dev/runtime/register/runtimeInstance.d.mts +0 -26
  222. package/dist/dev/runtime/register/setup.d.mts +0 -11
  223. package/dist/dev/runtime/register/watch.d.mts +0 -12
  224. package/dist/dev/runtime/register.d.mts +0 -5
  225. package/dist/dev/runtime/selectorQuery.d.mts +0 -54
  226. package/dist/dev/runtime/template.d.mts +0 -6
  227. package/dist/dev/runtime/templateRefTypes.d.mts +0 -12
  228. package/dist/dev/runtime/types/core.d.mts +0 -35
  229. package/dist/dev/runtime/types/miniprogram.d.mts +0 -84
  230. package/dist/dev/runtime/types/miniprogramHost.d.mts +0 -45
  231. package/dist/dev/runtime/types/miniprogramHostSources.d.mts +0 -112
  232. package/dist/dev/runtime/types/options.d.mts +0 -138
  233. package/dist/dev/runtime/types/props/propTypes.d.mts +0 -79
  234. package/dist/dev/runtime/types/props/router.d.mts +0 -51
  235. package/dist/dev/runtime/types/props/setup.d.mts +0 -96
  236. package/dist/dev/runtime/types/props.d.mts +0 -4
  237. package/dist/dev/runtime/types/runtime.d.mts +0 -59
  238. package/dist/dev/runtime/types/setData.d.mts +0 -237
  239. package/dist/dev/runtime/types.d.mts +0 -29
  240. package/dist/dev/runtime/uniAppHost.d.mts +0 -8
  241. package/dist/dev/runtime/updatePerformance.d.mts +0 -13
  242. package/dist/dev/runtime/use.d.mts +0 -13
  243. package/dist/dev/runtime/vueCompat/context.d.mts +0 -8
  244. package/dist/dev/runtime/vueCompat/model.d.mts +0 -30
  245. package/dist/dev/runtime/vueCompat/router.d.mts +0 -29
  246. package/dist/dev/runtime/vueCompat/templateRef.d.mts +0 -9
  247. package/dist/dev/runtime/vueCompat.d.mts +0 -5
  248. package/dist/dev/scheduler.d.mts +0 -4
  249. package/dist/dev/store/define.d.mts +0 -8
  250. package/dist/dev/store/manager.d.mts +0 -16
  251. package/dist/dev/store/storeToRefs.d.mts +0 -11
  252. package/dist/dev/store/types.d.mts +0 -106
  253. package/dist/dev/store.d.mts +0 -5
  254. package/dist/dev/version.d.mts +0 -4
  255. package/dist/dev/vue-augment.d.mts +0 -8
  256. package/dist/dev/vue-demi.d.mts +0 -87
  257. package/dist/dev/vue-types.d.mts +0 -19
  258. package/dist/dev/web-apis.d.mts +0 -3
  259. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.mjs +0 -0
  260. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.mjs +0 -0
  261. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.mjs +0 -0
  262. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.mjs +0 -0
@@ -1 +1 @@
1
- import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_HOST_COMMIT_PROMISE_KEY as f,WEVU_INLINE_MAP_KEY as p,WEVU_NATIVE_INSTANCE_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROPS_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_APP_KEY as v,WEVU_RUNTIME_KEY as y}from"@weapp-core/constants";function b(b){let{state:x,setupState:S,computedDefs:C,methodDefs:w,appConfig:T,includeComputed:E,setDataStrategy:D}=b,O={},{computedRefs:k,computedSetters:A,dirtyComputedKeys:j,createTrackedComputed:M,computedProxy:N}=u({includeComputed:E,setDataStrategy:D}),P=r(0),F=Object.create(null),I=(e,n)=>{let r=t(e),i=r[y],a=i?.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[m];if(s(l))return l;let u=i?.instance;if(s(u))return u},L=e=>{if(i(O,e))return;let t=(...t)=>{let n=I(x,x);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),O[e]=t},R=(e,t)=>{let n=/* @__PURE__ */ new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=r[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[h]}let a=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof a==`function`)try{let e=a()?.[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]}}catch{}return{found:!1,value:void 0}},z=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{let n=t.call(e);if(!n||typeof n!=`object`)return;let r=Reflect.get(n,_);if(typeof r==`function`){let e=r.call(n);if(e)return e}return n[y]?.proxy??n.__wevu?.proxy??n}catch{return}},B=new Proxy(x,{get(n,r,a){if(typeof r==`string`){if(P.value,i(S,r))return Reflect.get(S,r,a);if(r===`props`){let e=n[g];if(e&&typeof e==`object`)return e}if(r===`$props`){let e=n[g];if(e&&typeof e==`object`)return e}let c=n[g];if(c&&typeof c==`object`&&i(c,r))return Reflect.get(c,r);if(r===`data`||r===`$state`)return x;if(r===`$computed`)return N;if(r===`$emit`)return(e,...t)=>{let r=I(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return async t=>{await e();let r=I(n,a),i=r&&Reflect.get(r,f);if(i&&(typeof i==`object`||typeof i==`function`)&&`then`in i&&typeof i.then==`function`&&await i,t)return t.call(B)};if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`)return t(n).$slots??Object.freeze(Object.create(null));if(r===`$refs`)return t(n).$refs??Object.create(null);if(r===`$parent`)return z(I(n,a));if(r===`$options`){let e=I(n,a);return{name:e?.[d]??e?.name??e?.is}}if(i(F,r))return Reflect.get(F,r);if(i(O,r))return O[r];if(k[r])return k[r].value;if(i(T.globalProperties,r))return T.globalProperties[r];let l=R(I(n,a),r);if(l.found)return l.value}if(!Reflect.has(n,r)){let e=I(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let c=Reflect.get(n,r,a);return typeof r==`string`&&i(S,r)?Reflect.get(S,r,a):c},set(e,t,r,o){if(typeof t==`string`&&k[t])return a(A,t,r),!0;if(i(S,t)){let e=Reflect.get(S,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(S,t,r,o)}if(i(F,t))return Reflect.set(F,t,r);if(Reflect.has(e,t)){let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i(e[g]??{},t)?Reflect.set(S,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(F,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(S,t)||k[t]||i(O,t))||i(F,t))return!0;let n=I(e,e);return typeof t==`string`&&R(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=/* @__PURE__ */ new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(S).forEach(e=>{t.add(e)}),Reflect.ownKeys(F).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),Object.keys(k).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(S,t))return Object.getOwnPropertyDescriptor(S,t);if(i(F,t))return Object.getOwnPropertyDescriptor(F,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return x}};if(k[t])return{configurable:!0,enumerable:!0,get(){return k[t].value},set(e){a(A,t,e)}};if(i(O,t))return{configurable:!0,enumerable:!1,value:O[t]}}}});return Object.keys(w).forEach(e=>{let t=w[e];if(typeof t==`function`){O[e]=(...e)=>t.apply(B,e);return}e===p&&t&&typeof t==`object`&&(O[e]=t)}),L(`triggerEvent`),L(`createSelectorQuery`),L(`createIntersectionObserver`),L(`setData`),Object.keys(C).forEach(e=>{let t=C[e];if(typeof t==`function`)k[e]=M(e,()=>t.call(B));else{let n=t.get?.bind(B);if(!n)throw Error(`计算属性 "${e}" 需要提供 getter`);let r=t.set?.bind(B);r?(A[e]=r,k[e]=M(e,n,r)):k[e]=M(e,n)}}),{boundMethods:O,computedRefs:k,computedSetters:A,dirtyComputedKeys:j,computedProxy:N,publicInstance:B,touchSetupMethodsVersion(){P.value+=1}}}export{b as createRuntimeContext};
1
+ import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_HOST_COMMIT_PROMISE_KEY as f,WEVU_INLINE_MAP_KEY as p,WEVU_NATIVE_INSTANCE_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROPS_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_APP_KEY as v,WEVU_RUNTIME_KEY as y}from"@weapp-core/constants";function b(b){let{state:x,setupState:S,computedDefs:C,methodDefs:w,appConfig:T,includeComputed:E,setDataStrategy:D}=b,O={},{computedRefs:k,computedSetters:A,dirtyComputedKeys:j,createTrackedComputed:M,computedProxy:N}=u({includeComputed:E,setDataStrategy:D}),P=r(0),F=Object.create(null),I=(e,n)=>{let r=t(e),i=r[y],a=i?.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[m];if(s(l))return l;let u=i?.instance;if(s(u))return u},L=e=>{if(i(O,e))return;let t=(...t)=>{let n=I(x,x);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),O[e]=t},R=(e,t)=>{let n=/* @__PURE__ */ new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=r[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[h]}let a=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof a==`function`)try{let e=a()?.[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]}}catch{}return{found:!1,value:void 0}},z=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{let n=t.call(e);if(!n||typeof n!=`object`)return;let r=Reflect.get(n,_);if(typeof r==`function`){let e=r.call(n);if(e)return e}return n[y]?.proxy??n.__wevu?.proxy??n}catch{return}},B=new Proxy(x,{get(n,r,a){if(typeof r==`string`){if(P.value,i(S,r))return Reflect.get(S,r,a);if(r===`props`){let e=n[g];if(e&&typeof e==`object`)return e}if(r===`$props`){let e=n[g];if(e&&typeof e==`object`)return e}let c=n[g];if(c&&typeof c==`object`&&i(c,r))return Reflect.get(c,r);if(r===`data`||r===`$state`)return x;if(r===`$computed`)return N;if(r===`$emit`)return(e,...t)=>{let r=I(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return async t=>{await e();let r=I(n,a),i=r&&Reflect.get(r,f);if(i&&(typeof i==`object`||typeof i==`function`)&&`then`in i&&typeof i.then==`function`&&await i,t)return t.call(B)};if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`)return t(n).$slots??Object.freeze(Object.create(null));if(r===`$refs`)return t(n).$refs??Object.create(null);if(r===`$parent`)return z(I(n,a));if(r===`$options`){let e=I(n,a);return{name:e?.[d]??e?.name??e?.is}}if(i(F,r))return Reflect.get(F,r);if(i(O,r))return O[r];if(k[r])return k[r].value;if(i(T.globalProperties,r))return T.globalProperties[r];let l=R(I(n,a),r);if(l.found)return l.value}if(!Reflect.has(n,r)){let e=I(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let c=Reflect.get(n,r,a);return typeof r==`string`&&i(S,r)?Reflect.get(S,r,a):c},set(e,t,r,o){if(typeof t==`string`&&k[t])return a(A,t,r),!0;if(i(S,t)){let e=Reflect.get(S,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(S,t,r,o)}if(i(F,t))return Reflect.set(F,t,r);if(Reflect.has(e,t)){let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i(e[g]??{},t)?Reflect.set(S,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(F,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(S,t)||k[t]||i(O,t))||i(F,t))return!0;let n=I(e,e);return typeof t==`string`&&R(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=/* @__PURE__ */ new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(S).forEach(e=>{t.add(e)}),Reflect.ownKeys(F).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),Object.keys(k).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(S,t))return Object.getOwnPropertyDescriptor(S,t);if(i(F,t))return Object.getOwnPropertyDescriptor(F,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return x}};if(k[t])return{configurable:!0,enumerable:!0,get(){return k[t].value},set(e){a(A,t,e)}};if(i(O,t))return{configurable:!0,enumerable:!1,value:O[t]}}}});return Object.keys(w).forEach(e=>{let t=w[e];typeof t==`function`?O[e]=(...e)=>t.apply(B,e):e===p&&t&&typeof t==`object`&&(O[e]=t)}),L(`triggerEvent`),L(`createSelectorQuery`),L(`createIntersectionObserver`),L(`setData`),Object.keys(C).forEach(e=>{let t=C[e];if(typeof t==`function`)k[e]=M(e,()=>t.call(B));else{let n=t.get?.bind(B);if(!n)throw Error(`计算属性 "${e}" 需要提供 getter`);let r=t.set?.bind(B);r?(A[e]=r,k[e]=M(e,n,r)):k[e]=M(e,n)}}),{boundMethods:O,computedRefs:k,computedSetters:A,dirtyComputedKeys:j,computedProxy:N,publicInstance:B,touchSetupMethodsVersion(){P.value+=1}}}export{b as createRuntimeContext};
@@ -1 +1 @@
1
- function e(e){return e!==`patch`&&e!==`diff`}function t(t){if(t!==`off`)return n=>{if(t===`fallback`&&!e(n.reason))return;let r=typeof n.bytes==`number`?n.bytes:n.estimatedBytes,i=typeof r==`number`?`${r}B`:`unknown`,a=[`mode=${n.mode}`,`reason=${n.reason}`,`pending=${n.pendingPatchKeys}`,`keys=${n.payloadKeys}`,`bytes=${i}`];if(typeof n.revision==`number`&&a.push(`revision=${n.revision}`),typeof n.committedRevision==`number`&&a.push(`committedRevision=${n.committedRevision}`),typeof n.mergedSiblingParents==`number`&&a.push(`mergedParents=${n.mergedSiblingParents}`),typeof n.computedDirtyKeys==`number`&&a.push(`computedDirty=${n.computedDirtyKeys}`),typeof n.flushCount==`number`&&a.push(`flushes=${n.flushCount}`),typeof n.windowMs==`number`&&a.push(`window=${n.windowMs}ms`),n.targetLabel&&a.push(`target=${n.targetLabel}`),n.bindings?.length){let e=n.bindings.map(e=>{let t=e.sourceLocation?.start;return t?`${e.id}@${e.sourceFile}:${t.line}:${t.column}`:`${e.id}@${e.sourceFile}`});a.push(`bindings=${e.join(`,`)}`)}n.message&&a.push(`message=${n.message}`);let o=`[wevu:setData] ${a.join(` `)}`;if(e(n.reason)){console.warn(o);return}console.info(o)}}export{t as createDiagnosticsLogger};
1
+ function e(e){return e!==`patch`&&e!==`diff`}function t(t){if(t!==`off`)return n=>{if(t===`fallback`&&!e(n.reason))return;let r=n.phase?n.phase.dispatch?.payloadBytes:typeof n.bytes==`number`?n.bytes:n.estimatedBytes,i=typeof r==`number`?`${r}B`:`unknown`,a=[`mode=${n.mode}`,`reason=${n.reason}`,`pending=${n.pendingPatchKeys}`,`keys=${n.payloadKeys}`,`bytes=${i}`];if(typeof n.revision==`number`&&a.push(`revision=${n.revision}`),typeof n.committedRevision==`number`&&a.push(`committedRevision=${n.committedRevision}`),n.phase){let e=n.phase;a.push(`phase=${e.name}`,`observer=${e.observerId}`,`result=${e.result}`,`completion=${e.completion}`,`dispatch=${e.dispatch?.id??`unknown`}`,`prepareMs=${e.prepareDurationMs??`unknown`}`,`dispatchMs=${e.dispatch?.durationMs??`unknown`}`,`commitMs=${e.commitDurationMs??`unknown`}`,`visibleAt=unknown`)}if(typeof n.mergedSiblingParents==`number`&&a.push(`mergedParents=${n.mergedSiblingParents}`),typeof n.computedDirtyKeys==`number`&&a.push(`computedDirty=${n.computedDirtyKeys}`),typeof n.flushCount==`number`&&a.push(`flushes=${n.flushCount}`),typeof n.windowMs==`number`&&a.push(`window=${n.windowMs}ms`),n.targetLabel&&a.push(`target=${n.targetLabel}`),n.bindings?.length){let e=n.bindings.map(e=>{let t=e.sourceLocation?.start;return t?`${e.id}@${e.sourceFile}:${t.line}:${t.column}`:`${e.id}@${e.sourceFile}`});a.push(`bindings=${e.join(`,`)}`)}n.message&&a.push(`message=${n.message}`);let o=`[wevu:setData] ${a.join(` `)}`;e(n.reason)?console.warn(o):console.info(o)}}export{t as createDiagnosticsLogger};
@@ -1 +1 @@
1
- import{queueJob as e}from"../../scheduler.mjs";import{effect as t,stop as n}from"../../reactivity/core.mjs";import{touchReactive as r}from"../../reactivity/reactive/patch.mjs";import{shallowReactive as i}from"../../reactivity/reactive/shallow.mjs";import{isReactive as a,reactive as o}from"../../reactivity/reactive.mjs";import{watch as ee}from"../../reactivity/watch.mjs";import{requireRuntimeCapability as s}from"../capabilities.mjs";import{hasOwn as c}from"../../utils.mjs";import{createBindModel as te}from"../bindModel.mjs";import{hasTrackableSetupBinding as ne,touchSetupBinding as re}from"../setupTracking.mjs";import{createRuntimeContext as ie}from"./context.mjs";import{createDiagnosticsLogger as l}from"./diagnostics.mjs";import{createSetDataScheduler as ae}from"./setData/scheduler.mjs";import{resolveSetDataOptions as oe}from"./setDataOptions.mjs";import{WEVU_ATTRS_KEY as se,WEVU_PROPS_DERIVED_KEYS_KEY as u,WEVU_PROPS_KEY as d,WEVU_SETUP_STATE_KEY as f}from"@weapp-core/constants";function p(e,t){let n=(()=>{e()});return n.stop=()=>n(),n.pause=()=>{t?.pause?.()},n.resume=()=>{t?.resume?.()},n}function ce(e){return typeof e==`function`?e():e??{}}function m(m){let{data:le,resolvedComputed:ue,resolvedMethods:de,appConfig:h,setDataOptions:g,bindingManifest:_}=m;return m=>{g?.strategy===`patch`&&s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`);let v=ce(le),y=m?.__wevu_initialProps;if(v&&typeof v==`object`&&!c(v,d))try{Object.defineProperty(v,d,{value:i(Object.create(null)),configurable:!0,enumerable:!1,writable:!1})}catch{}let b=v&&typeof v==`object`?v[d]:void 0;b&&typeof b==`object`&&y&&typeof y==`object`&&Object.assign(b,y);let x=o(v),S=o(Object.create(null)),C=m?.__wevu_snapshotOmitKeys,fe=!!m?.__wevu_deferInitialSnapshot,w=m?.__wevu_initialSnapshot,T=m?.__wevu_initialState,E=new Set(C instanceof Set||Array.isArray(C)?C:[]);if(v&&typeof v==`object`&&!c(v,f))try{Object.defineProperty(v,f,{value:S,configurable:!0,enumerable:!1,writable:!1})}catch{}if(v&&typeof v==`object`&&T&&typeof T==`object`)for(let[e,t]of Object.entries(T))E.has(e)||(v[e]=t);let pe=ue,me=de,D=!0,O=[],k=/* @__PURE__ */ new Set;Object.keys(x).forEach(e=>{let t=x[e];ne(t)&&k.add(e)});let{includeComputed:A,setDataStrategy:j,maxPatchKeys:M,maxPayloadBytes:N,mergeSiblingThreshold:P,mergeSiblingMaxInflationRatio:F,mergeSiblingMaxParentBytes:I,mergeSiblingSkipArray:L,computedCompare:R,computedCompareMaxDepth:z,computedCompareMaxKeys:he,prelinkMaxDepth:ge,prelinkMaxKeys:_e,debug:B,diagnostics:V,loopWarning:H,debugWhen:ve,debugSampleRate:ye,elevateTopKeyThreshold:be,toPlainMaxDepth:xe,toPlainMaxKeys:Se,includeFunctions:Ce,functionPaths:we,shouldIncludeKey:Te}=oe(g),U=l(V),W=V===`off`&&H?l(`fallback`):void 0,Ee=B||U||W?e=>{if(typeof B==`function`)try{B(e)}catch{}U?.(e),e.reason===`loopWarning`&&W?.(e)}:void 0,De=V===`always`?`always`:ve,{boundMethods:Oe,computedRefs:G,computedSetters:ke,dirtyComputedKeys:Ae,computedProxy:je,publicInstance:K,touchSetupMethodsVersion:q}=ie({state:x,setupState:S,computedDefs:pe,methodDefs:me,appConfig:h,includeComputed:A,setDataStrategy:j}),J=m??{setData:()=>{}},Me=J.__wevu_targetLabel,Y,X={state:x,setupState:S,snapshotOmitKeys:E,computedRefs:G,dirtyComputedKeys:Ae,includeComputed:A,setDataStrategy:j,computedCompare:R,computedCompareMaxDepth:z,computedCompareMaxKeys:he,currentAdapter:J,shouldIncludeKey:Te,maxPatchKeys:M,maxPayloadBytes:N,mergeSiblingThreshold:P,mergeSiblingMaxInflationRatio:F,mergeSiblingMaxParentBytes:I,mergeSiblingSkipArray:L,elevateTopKeyThreshold:be,prelinkMaxDepth:ge,prelinkMaxKeys:_e,toPlainMaxDepth:xe,toPlainMaxKeys:Se,includeFunctions:Ce,functionPaths:we,debug:Ee,debugWhen:De,debugSampleRate:ye,bindingManifest:_,loopWarning:H,targetLabel:Me,runTracker:()=>Y?.(),isMounted:()=>D,initialSnapshot:w&&typeof w==`object`?w:void 0,initialState:T&&typeof T==`object`?T:void 0},Z=j===`patch`?s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`).createScheduler(X):ae(X),Q=()=>Z.job();Y=t(()=>{r(x);let e=x[d];a(e)&&r(e);let t=x[se];a(t)&&r(t),k.forEach(e=>{let t=S[e]??x[e];re(t)})},{lazy:!0,scheduler:()=>e(Q)}),fe||Q(),O.push(p(()=>n(Y))),Z.start?.(),Z.dispose&&O.push(p(Z.dispose));function Ne(e,t,n){let r=ee(e,(e,n)=>t(e,n),n);return O.push(r),p(()=>{r();let e=O.indexOf(r);e>=0&&O.splice(e,1)},r)}let $={get state(){return x},get setupState(){return S},get proxy(){return K},get methods(){return Oe},get computed(){return je},get adapter(){return J},bindModel:te(K,x,G,ke,S),watch:Ne,snapshot:()=>Z.snapshot(),unmount:()=>{if(D){D=!1,Z.dispose?.();try{J.__wevu_disposeSetData?.()}catch{}O.forEach(e=>{try{e()}catch{}}),O.length=0}}};try{Object.defineProperty($,"__wevu_touchSetupMethodsVersion",{value:q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_touchSetupMethodsVersion=q}try{Object.defineProperty($,"__wevu_flushSetupSnapshotSync",{value:Q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_flushSetupSnapshotSync=Q}try{Object.defineProperty($,"__wevu_cloneDispatchedSnapshot",{value:Z.cloneLatestSnapshot,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_cloneDispatchedSnapshot=Z.cloneLatestSnapshot}try{Object.defineProperty($,"__wevu_trackSetupReactiveKey",{value:e=>{k.add(e)},configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_trackSetupReactiveKey=e=>{k.add(e)}}try{Object.defineProperty($,u,{value:E,configurable:!0,enumerable:!1,writable:!1})}catch{$[u]=E}return $}}export{m as createRuntimeMount};
1
+ import{queueJob as e}from"../../scheduler.mjs";import{effect as t,stop as n}from"../../reactivity/core.mjs";import{touchReactive as r}from"../../reactivity/reactive/patch.mjs";import{shallowReactive as i}from"../../reactivity/reactive/shallow.mjs";import{isReactive as a,reactive as o}from"../../reactivity/reactive.mjs";import{watch as ee}from"../../reactivity/watch.mjs";import{requireRuntimeCapability as s}from"../capabilities.mjs";import{hasOwn as c}from"../../utils.mjs";import{createBindModel as te}from"../bindModel.mjs";import{hasTrackableSetupBinding as ne,touchSetupBinding as re}from"../setupTracking.mjs";import{createRuntimeContext as ie}from"./context.mjs";import{createDiagnosticsLogger as l}from"./diagnostics.mjs";import{createSetDataScheduler as ae}from"./setData/scheduler.mjs";import{resolveSetDataOptions as oe}from"./setDataOptions.mjs";import{WEVU_ATTRS_KEY as se,WEVU_PROPS_DERIVED_KEYS_KEY as u,WEVU_PROPS_KEY as d,WEVU_SETUP_STATE_KEY as f}from"@weapp-core/constants";function p(e,t){let n=(()=>{e()});return n.stop=()=>n(),n.pause=()=>{t?.pause?.()},n.resume=()=>{t?.resume?.()},n}function ce(e){return typeof e==`function`?e():e??{}}function m(m){let{data:le,resolvedComputed:ue,resolvedMethods:de,appConfig:fe,setDataOptions:h,bindingManifest:g}=m;return m=>{h?.strategy===`patch`&&s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`);let _=ce(le),v=m?.__wevu_initialProps;if(_&&typeof _==`object`&&!c(_,d))try{Object.defineProperty(_,d,{value:i(Object.create(null)),configurable:!0,enumerable:!1,writable:!1})}catch{}let y=_&&typeof _==`object`?_[d]:void 0;y&&typeof y==`object`&&v&&typeof v==`object`&&Object.assign(y,v);let b=o(_),x=o(Object.create(null)),S=m?.__wevu_snapshotOmitKeys,pe=!!m?.__wevu_deferInitialSnapshot,C=m?.__wevu_initialSnapshot,w=m?.__wevu_initialState,T=new Set(S instanceof Set||Array.isArray(S)?S:[]);if(_&&typeof _==`object`&&!c(_,f))try{Object.defineProperty(_,f,{value:x,configurable:!0,enumerable:!1,writable:!1})}catch{}if(_&&typeof _==`object`&&w&&typeof w==`object`)for(let[e,t]of Object.entries(w))T.has(e)||(_[e]=t);let me=ue,he=de,E=!0,D=[],O=/* @__PURE__ */ new Set;Object.keys(b).forEach(e=>{let t=b[e];ne(t)&&O.add(e)});let{includeComputed:k,setDataStrategy:A,maxPatchKeys:j,maxPayloadBytes:M,mergeSiblingThreshold:N,mergeSiblingMaxInflationRatio:P,mergeSiblingMaxParentBytes:F,mergeSiblingSkipArray:I,computedCompare:L,computedCompareMaxDepth:R,computedCompareMaxKeys:ge,prelinkMaxDepth:_e,prelinkMaxKeys:ve,debug:z,diagnostics:B,loopWarning:V,debugWhen:ye,debugSampleRate:be,debugPhases:xe,elevateTopKeyThreshold:Se,toPlainMaxDepth:Ce,toPlainMaxKeys:we,includeFunctions:Te,functionPaths:Ee,shouldIncludeKey:De}=oe(h),H=l(B),U=B===`off`&&V?l(`fallback`):void 0,Oe=z||H||U?e=>{if(typeof z==`function`)try{z(e)}catch{}H?.(e),e.reason===`loopWarning`&&U?.(e)}:void 0,ke=B===`always`?`always`:ye,{boundMethods:Ae,computedRefs:W,computedSetters:je,dirtyComputedKeys:Me,computedProxy:Ne,publicInstance:G,touchSetupMethodsVersion:K}=ie({state:b,setupState:x,computedDefs:me,methodDefs:he,appConfig:fe,includeComputed:k,setDataStrategy:A}),q=m??{setData:()=>{}},Pe=q.__wevu_targetLabel,J,Y={state:b,setupState:x,snapshotOmitKeys:T,computedRefs:W,dirtyComputedKeys:Me,includeComputed:k,setDataStrategy:A,computedCompare:L,computedCompareMaxDepth:R,computedCompareMaxKeys:ge,currentAdapter:q,shouldIncludeKey:De,maxPatchKeys:j,maxPayloadBytes:M,mergeSiblingThreshold:N,mergeSiblingMaxInflationRatio:P,mergeSiblingMaxParentBytes:F,mergeSiblingSkipArray:I,elevateTopKeyThreshold:Se,prelinkMaxDepth:_e,prelinkMaxKeys:ve,toPlainMaxDepth:Ce,toPlainMaxKeys:we,includeFunctions:Te,functionPaths:Ee,debug:Oe,debugWhen:ke,debugSampleRate:be,debugPhases:xe,bindingManifest:g,loopWarning:V,targetLabel:Pe,runTracker:()=>J?.(),isMounted:()=>E,initialSnapshot:C&&typeof C==`object`?C:void 0,initialState:w&&typeof w==`object`?w:void 0},X=A===`patch`?s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`).createScheduler(Y):ae(Y),Z=()=>X.job(),Q=()=>{J?.(),X.job()};J=t(()=>{r(b);let e=b[d];a(e)&&r(e);let t=b[se];a(t)&&r(t),O.forEach(e=>{let t=x[e]??b[e];re(t)})},{lazy:!0,scheduler:()=>e(Z)}),pe||Z(),D.push(p(()=>n(J))),X.start?.(),X.dispose&&D.push(p(X.dispose));function Fe(e,t,n){let r=ee(e,(e,n)=>t(e,n),n);return D.push(r),p(()=>{r();let e=D.indexOf(r);e>=0&&D.splice(e,1)},r)}let $={get state(){return b},get setupState(){return x},get proxy(){return G},get methods(){return Ae},get computed(){return Ne},get adapter(){return q},bindModel:te(G,b,W,je,x),watch:Fe,snapshot:()=>X.snapshot(),unmount:()=>{if(E){E=!1,X.dispose?.();try{q.__wevu_disposeSetData?.()}catch{}D.forEach(e=>{try{e()}catch{}}),D.length=0}}};try{Object.defineProperty($,"__wevu_touchSetupMethodsVersion",{value:K,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_touchSetupMethodsVersion=K}try{Object.defineProperty($,"__wevu_flushSetupSnapshotSync",{value:Q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_flushSetupSnapshotSync=Q}try{Object.defineProperty($,"__wevu_cloneDispatchedSnapshot",{value:X.cloneLatestSnapshot,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_cloneDispatchedSnapshot=X.cloneLatestSnapshot}try{Object.defineProperty($,"__wevu_trackSetupReactiveKey",{value:e=>{O.add(e)},configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_trackSetupReactiveKey=e=>{O.add(e)}}try{Object.defineProperty($,u,{value:T,configurable:!0,enumerable:!1,writable:!1})}catch{$[u]=T}return $}}export{m as createRuntimeMount};
@@ -1,11 +1,12 @@
1
1
  import { MiniProgramAdapter } from "../../types/miniprogram.mjs";
2
2
  import "../../types.mjs";
3
+ import { PhysicalSetDataObserver } from "./observation.mjs";
3
4
  //#region src/runtime/app/setData/commitTracker.d.ts
4
5
  export type SetDataPayload = Record<string, unknown>;
5
6
  export type SetDataAdapterSettlement = 'committed' | 'failed' | 'abandoned';
6
7
  export type SetDataAdapterSettler = (settlement: SetDataAdapterSettlement, cause?: unknown) => void;
7
8
  export interface CommitAwareSetDataAdapter extends MiniProgramAdapter {
8
- __wevu_dispatchSetData?: (payload: SetDataPayload, settle: SetDataAdapterSettler) => void;
9
+ __wevu_dispatchSetData?: (payload: SetDataPayload, settle: SetDataAdapterSettler, observer?: PhysicalSetDataObserver) => void;
9
10
  __wevu_reportSetDataError?: (error: Error) => void;
10
11
  __wevu_disposeSetData?: () => void;
11
12
  }
@@ -1 +1 @@
1
- import{cloneSnapshotValue as e}from"./snapshot.mjs";const t=Promise.resolve();function n(e){return!(!e||typeof e!=`object`&&typeof e!=`function`||typeof e.then!=`function`)}function r(e){try{return e instanceof Error?e.message:String(e)}catch{return`<unprintable cause>`}}function i(e,t,n){let i=r(n),a=/* @__PURE__ */ Error(`[wevu] setData commit failed (${e===`adapter`?`adapter failure`:`out-of-order completion`}, revision=${t.revision}, mode=${t.mode}, kind=${t.kind}): ${i}`);return a.cause=n,a}function a(e){let t=!1,r=!0,i=!1,a=!1,o=(n,r)=>{t||(t=!0,e.settle(n,r))},s=()=>{if(r){i=!0;return}a||e.completion===`callback`&&o(`committed`)};try{let t=e.invoke(s),c=n(t);if(a=c,r=!1,c){t.then(()=>o(`committed`),e=>o(`failed`,e));return}(e.completion===`return`||i)&&o(`committed`)}catch(e){r=!1,o(`failed`,e)}}function o(n){let r=n.initialSnapshot?e(n.initialSnapshot):{},o=new Set(Object.keys(r)),s=0,c=0,l,u;function d(e){return e.inLedger?(e.commitPromise||(e.commitPromise=new Promise(t=>{e.resolveCommit=t})),e.commitPromise):t}let f={preparedSnapshot:r,dispatchedSnapshot:r,committedSnapshot:r,revision:0,committedRevision:0,failedRevision:void 0,needsFullSnapshot:!1,get commitPromise(){return u?d(u):t},disposed:!1},p=(e,t,r)=>{let a=i(e,t,r);try{n.onFailure({kind:e,revision:t.revision,committedRevision:f.committedRevision,mode:t.mode,cause:r,error:a,payloadKeys:t.payloadKeys,pendingPatchKeys:t.pendingPatchKeys})}catch{}},m=e=>{e.resolveCommit?.(),e.resolveCommit=void 0},h=e=>{let t=l;for(;t;){let n=t.next;if(t.inLedger=!1,t.next=void 0,m(t),t===e){l=n,l||(u=void 0);return}t=n}},g=()=>{let e=l;for(;e;){let t=e.next;e.inLedger=!1,e.next=void 0,e.physicalSettled||(e.status=`abandoned`),m(e),e=t}l=void 0,u=void 0,s+=1,c=f.committedRevision},_=()=>{f.needsFullSnapshot=!0},v=(e,t,n)=>{t.status=`failed`,f.failedRevision=t.revision,_(),g(),p(e,t,n)},y=()=>{for(;l?.status===`succeeded`;){let e=l;f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,l=e.next,e.inLedger=!1,e.next=void 0,m(e)}l||(u=void 0)},b=e=>{f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,f.failedRevision=void 0,f.needsFullSnapshot=!1,h(e),y()},x=(e,t,n)=>{if(t===`failed`){p(`adapter`,e,n);return}t===`committed`&&f.committedRevision>e.revision&&(l&&g(),_(),p(`out-of-order`,e,`revision ${e.revision} completed after committed revision ${f.committedRevision}`))},S=(e,t,n)=>{if(!(f.disposed||e.physicalSettled)){if(e.physicalSettled=!0,!e.inLedger||e.epoch!==s){x(e,t,n);return}if(t===`abandoned`){e.status=`abandoned`,_(),g();return}if(t===`failed`){v(`adapter`,e,n);return}if(e.status=`succeeded`,c>e.revision){v(`out-of-order`,e,`revision ${e.revision} completed after revision ${c}`);return}if(c=e.revision,e.kind===`full`){b(e);return}y()}};return{state:f,dispatch:t=>{if(f.disposed)return f.revision;let r=f.revision+1;f.revision=r,f.preparedSnapshot=t.snapshot;let i={revision:r,epoch:s,mode:t.mode,kind:t.kind,snapshot:t.snapshot,payloadKeys:Object.keys(t.payload).length,pendingPatchKeys:t.pendingPatchKeys,status:`dispatched`,physicalSettled:!1,inLedger:!0,next:void 0};u?u.next=i:l=i,u=i,f.dispatchedSnapshot=t.snapshot;for(let e of Object.keys(t.payload))o.add(e.split(`.`,1)[0]);let c=(e,t)=>{S(i,e,t)},d=e(t.payload);if(typeof n.adapter.__wevu_dispatchSetData==`function`)try{n.adapter.__wevu_dispatchSetData(d,c)}catch(e){c(`failed`,e)}else a({invoke:()=>n.adapter.setData?.(d),completion:`return`,settle:c});return r},createFullPayload:e=>{let t={},n=new Set(Object.keys(e));for(let[n,r]of Object.entries(e))t[n]=r===void 0?null:r;for(let e of o)n.has(e)||(t[e]=null);return t},dispose:()=>{f.disposed||(f.disposed=!0,g())}}}export{o as createSetDataCommitTracker,a as observeSetDataCompletion};
1
+ import{observePhysicalDispatch as e}from"./observation.mjs";import{cloneSnapshotValue as t}from"./snapshot.mjs";const n=Promise.resolve();function r(e){return!(!e||typeof e!=`object`&&typeof e!=`function`||typeof e.then!=`function`)}function i(e){try{return e instanceof Error?e.message:String(e)}catch{return`<unprintable cause>`}}function a(e,t,n){let r=i(n),a=/* @__PURE__ */ Error(`[wevu] setData commit failed (${e===`adapter`?`adapter failure`:`out-of-order completion`}, revision=${t.revision}, mode=${t.mode}, kind=${t.kind}): ${r}`);return a.cause=n,a}function o(t){let n=!1,i=!0,a=!1,o=!1,s=!1,c=t.completion,l=(e,r)=>{n||(n=!0,t.observer?.complete(c),t.settle(e,r))},u=()=>{i?a=!0:s||t.completion===`callback`&&l(`committed`)};try{t.observer&&t.payload&&e(t.observer,t.payload);let n=t.invoke(u),d=r(n);if(s=d,i=!1,t.observer&&!o&&(o=!0,t.observer.returned(Date.now())),d){c=`promise`,n.then(()=>l(`committed`),e=>l(`failed`,e));return}(t.completion===`return`||a)&&l(`committed`)}catch(e){c=`throw`,i=!1,t.observer&&!o&&(o=!0,t.observer.returned(Date.now())),l(`failed`,e)}}function s(e){let r=e.initialSnapshot?t(e.initialSnapshot):{},i=new Set(Object.keys(r)),s=0,c=0,l,u;function d(e){return e.inLedger?(e.commitPromise||(e.commitPromise=new Promise(t=>{e.resolveCommit=t})),e.commitPromise):n}let f={preparedSnapshot:r,dispatchedSnapshot:r,committedSnapshot:r,revision:0,committedRevision:0,failedRevision:void 0,needsFullSnapshot:!1,get commitPromise(){return u?d(u):n},disposed:!1},p=(t,n,r)=>{let i=a(t,n,r);try{e.onFailure({kind:t,revision:n.revision,committedRevision:f.committedRevision,mode:n.mode,cause:r,error:i,payloadKeys:n.payloadKeys,pendingPatchKeys:n.pendingPatchKeys})}catch{}},m=e=>{e.resolveCommit?.(),e.resolveCommit=void 0},h=e=>{let t=l;for(;t;){let n=t.next;if(t.inLedger=!1,t.next=void 0,m(t),t===e){l=n,l||(u=void 0);return}t=n}},g=()=>{let e,t=f.disposed?`disposed`:`abandoned`,n=l;for(;n;){let t=n.next;n.inLedger=!1,n.next=void 0,n.physicalSettled||(n.status=`abandoned`,n.observation&&(e??(e=[])).push(n.observation)),m(n),n=t}l=void 0,u=void 0,s+=1,c=f.committedRevision,e?.forEach(e=>e.finish(t))},_=()=>{f.needsFullSnapshot=!0},v=(e,t,n)=>{t.status=`failed`,f.failedRevision=t.revision,_(),g(),p(e,t,n)},y=()=>{for(;l?.status===`succeeded`;){let e=l;f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,l=e.next,e.inLedger=!1,e.next=void 0,m(e)}l||(u=void 0)},b=e=>{f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,f.failedRevision=void 0,f.needsFullSnapshot=!1,h(e),y()},x=(e,t,n)=>{t===`failed`?p(`adapter`,e,n):t===`committed`&&f.committedRevision>e.revision&&(l&&g(),_(),p(`out-of-order`,e,`revision ${e.revision} completed after committed revision ${f.committedRevision}`))},S=(e,t,n)=>{f.disposed||e.physicalSettled||(e.physicalSettled=!0,!e.inLedger||e.epoch!==s?x(e,t,n):t===`abandoned`?(e.status=`abandoned`,_(),g()):t===`failed`?v(`adapter`,e,n):(e.status=`succeeded`,c>e.revision?v(`out-of-order`,e,`revision ${e.revision} completed after revision ${c}`):(c=e.revision,e.kind===`full`?b(e):y())))},C=(e,t,n)=>{if(f.disposed||e.physicalSettled)return;if(!e.observation){S(e,t,n);return}let r=!e.inLedger||e.epoch!==s,i=t===`committed`&&(r?f.committedRevision>e.revision:c>e.revision);S(e,t,n),e.observation?.finish(i?`out-of-order`:r?t===`failed`?`late-failed`:t===`committed`?`late-committed`:`abandoned`:t)};return{state:f,dispatch:n=>{if(f.disposed)return f.revision;let r=f.revision+1;f.revision=r,f.preparedSnapshot=n.snapshot;let a={revision:r,epoch:s,mode:n.mode,kind:n.kind,snapshot:n.snapshot,payloadKeys:Object.keys(n.payload).length,pendingPatchKeys:n.pendingPatchKeys,status:`dispatched`,physicalSettled:!1,inLedger:!0,next:void 0};u?u.next=a:l=a,u=a,f.dispatchedSnapshot=n.snapshot;for(let e of Object.keys(n.payload))i.add(e.split(`.`,1)[0]);a.observation=e.observe?.(n,r);let c=(e,t)=>{C(a,e,t)},d=t(n.payload);if(typeof e.adapter.__wevu_dispatchSetData==`function`)try{e.adapter.__wevu_dispatchSetData(d,c,a.observation?.physical)}catch(e){c(`failed`,e)}else o({invoke:()=>e.adapter.setData?.(d),completion:`return`,settle:c,payload:d,observer:e.adapter.setData?a.observation?.physical:void 0});return r},createFullPayload:e=>{let t={},n=new Set(Object.keys(e));for(let[n,r]of Object.entries(e))t[n]=r===void 0?null:r;for(let e of i)n.has(e)||(t[e]=null);return t},dispose:()=>{f.disposed||(f.disposed=!0,g())}}}export{s as createSetDataCommitTracker,o as observeSetDataCompletion};
@@ -0,0 +1,12 @@
1
+ import { SetDataDebugInfo } from "../../types/setData.mjs";
2
+ import "../../types.mjs";
3
+ import "./commitTracker.mjs";
4
+ //#region src/runtime/app/setData/observation.d.ts
5
+ type Phase = NonNullable<SetDataDebugInfo['phase']>;
6
+ export type SetDataCompletionBoundary = Phase['completion'];
7
+ export interface PhysicalSetDataObserver {
8
+ dispatch: (dispatch: NonNullable<Phase['dispatch']>) => void;
9
+ returned: (returnedAt: number) => void;
10
+ complete: (boundary: SetDataCompletionBoundary) => void;
11
+ }
12
+ //#endregion
@@ -0,0 +1 @@
1
+ let e=0,t=0;function n(e,t){return e!==null&&t>=e?t-e:null}function r(e){try{let t=JSON.stringify(e),n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);r<128?n+=1:r<2048?n+=2:r>=55296&&r<=56319&&t.charCodeAt(e+1)>=56320&&t.charCodeAt(e+1)<=57343?(n+=4,e+=1):n+=3}return n}catch{return null}}function i(e,n){let i=r(n);e.dispatch({id:++t,startedAt:Date.now(),payloadBytes:i,returnedAt:null,durationMs:null})}function a(t){let r=++e,i=null;return{prepare(){i=Date.now()},revision(e,a){let o=i;if(i=null,t.debugWhen===`fallback`&&(e.reason===`patch`||e.reason===`diff`)||t.debugSampleRate<=0||t.debugSampleRate<1&&Math.random()>=t.debugSampleRate)return;let s=Date.now(),c=null,l=`unknown`,u={mode:e.mode,reason:e.reason,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:Object.keys(e.payload).length,revision:a,targetLabel:t.targetLabel},d=(e,i,a=null)=>{try{t.debug({...u,committedRevision:t.committedRevision(),phase:{version:1,observerId:r,name:e,result:i,completion:l,prepareStartedAt:o,preparedAt:s,prepareDurationMs:n(o,s),settledAt:a,commitDurationMs:a===null?null:n(c?.startedAt??null,a),visibleAt:null,dispatch:c?{...c}:null}})}catch{}};return d(`prepare`,`prepared`),{physical:{dispatch(e){c=e},returned(e){c&&(c={...c,returnedAt:e,durationMs:n(c.startedAt,e)},d(`dispatch`,`pending`))},complete(e){(c||e===`throw`)&&(l=e)}},finish(e){d(`commit`,e,Date.now())}}}}}export{a as createSetDataObservation,i as observePhysicalDispatch};
@@ -35,6 +35,7 @@ export interface SetDataSchedulerOptions {
35
35
  debug: ((info: SetDataDebugInfo) => void) | undefined;
36
36
  debugWhen: 'fallback' | 'always';
37
37
  debugSampleRate: number;
38
+ debugPhases?: boolean;
38
39
  bindingManifest?: WevuRuntimeBindingManifestV1;
39
40
  loopWarning: false | {
40
41
  sampleWindowMs: number;
@@ -1 +1 @@
1
- import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../../../reactivity/reactive.mjs";import{isRef as r}from"../../../reactivity/ref.mjs";import{hasOwn as i}from"../../../utils.mjs";import{hasTrackableSetupBinding as a}from"../../setupTracking.mjs";import{resolveBindingDiagnostics as o}from"../../bindingManifest.mjs";import{diffSnapshots as s,toPlain as c}from"../../diff.mjs";import{collectSnapshot as l}from"./snapshot.mjs";import{createSetDataCommitTracker as u}from"./commitTracker.mjs";function d(d){let{state:f,setupState:p,snapshotOmitKeys:m,computedRefs:h,dirtyComputedKeys:g,includeComputed:_,setDataStrategy:v,currentAdapter:y,shouldIncludeKey:b,toPlainMaxDepth:x,toPlainMaxKeys:S,includeFunctions:C=!1,functionPaths:w,debug:T,debugWhen:ee,debugSampleRate:E,bindingManifest:D,loopWarning:O,targetLabel:k,runTracker:A,isMounted:j,initialSnapshot:M,initialState:N}=d,P=/* @__PURE__ */ new WeakMap,F=/* @__PURE__ */ new WeakMap,I={},L=Object.create(null),R=Object.create(null),z=[],B=-1/0,V=new Set(N&&typeof N==`object`?Object.keys(N):[]),H=e=>{if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype},U=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>U(e,t[n]));if(H(e)&&H(t)){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>i(t,n)&&U(e[n],t[n]))}return!1},W=i=>{let o=r(i)?i.value:i;if(typeof o!=`object`||!o)return o;if(!n(o)&&a(o))return{snapshot:c(o,/* @__PURE__ */ new WeakMap,{cacheEligibility:F,maxDepth:x,maxKeys:S,includeFunctions:C,functionPaths:w})};let s=n(o)?e(o):o;return{raw:s,version:t(s)}},G=(e,t)=>Object.is(e,t)?!0:!e||!t||typeof e!=`object`||typeof t!=`object`||!i(e,`raw`)||!i(t,`raw`)?e&&t&&typeof e==`object`&&typeof t==`object`&&i(e,`snapshot`)&&i(t,`snapshot`)?U(e.snapshot,t.snapshot):!1:e.raw===t.raw&&e.version===t.version,K=e=>b(e)&&!m?.has(e);if(M)for(let[e,t]of Object.entries(M))K(e)&&(I[e]=t);let q=()=>{if(!M)return;let t=n(f)?e(f):f,r=p&&typeof p==`object`?n(p)?e(p):p:void 0;for(let e of Object.keys(M))if(K(e)){if(r&&i(r,e)){L[e]=W(r[e]);continue}if(i(t,e)){if(V.has(e))continue;t[e]=M[e],L[e]=W(t[e])}}},J=t=>{let a=[],o=p&&typeof p==`object`?n(p)?e(p):p:void 0;for(let n of/* @__PURE__ */ new Set([...Object.keys(f),...o?Object.keys(o):[]])){if(!K(n))continue;let s=o&&i(o,n)?o[n]:f[n],c=r(s)?s.value:s;c&&typeof c==`object`&&e(c)===t&&a.push(n)}return a},Y=(e,t)=>{if(!T)return;let n=e.reason!==`patch`&&e.reason!==`diff`;if(ee===`fallback`&&!n||e.reason!==`commitFailure`&&E<1&&Math.random()>E)return;let r=e;if(D){let n=typeof t==`function`?t():t??[],i=e.reason===`needsFullSnapshot`||e.reason===`maxPatchKeys`||e.reason===`maxPayloadBytes`;r={...e,bindings:o(D,n,i)}}try{T(r)}catch{}},X=u({initialSnapshot:I,adapter:y,onFailure:e=>{Y({mode:e.mode,reason:`commitFailure`,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:e.payloadKeys,revision:e.revision,committedRevision:e.committedRevision,targetLabel:k,message:e.error.message});try{y.__wevu_reportSetDataError?.(e.error)}catch{}}}),te=(e=0,t)=>{if(!O)return;let n=Date.now();z.push(n);let r=n-O.sampleWindowMs;for(;z.length&&z[0]<r;)z.shift();z.length<=O.maxFlushes||O.coolDownMs>0&&n-B<O.coolDownMs||(B=n,Y({mode:v,reason:`loopWarning`,pendingPatchKeys:e,payloadKeys:0,computedDirtyKeys:_?g.size:0,flushCount:z.length,windowMs:O.sampleWindowMs,targetLabel:k,message:`${k?`${k} `:``}疑似运行时更新循环:${z.length} 次 setData flush/${O.sampleWindowMs}ms`},t))},Z=()=>l({state:f,setupState:p,computedRefs:h,includeComputed:_,shouldIncludeKey:K,plainCache:P,plainCacheEligibility:F,toPlainMaxDepth:x,toPlainMaxKeys:S,includeFunctions:C,functionPaths:w});q();let ne=()=>{let t=n(f)?e(f):f,r=p&&typeof p==`object`?n(p)?e(p):p:void 0,a=X.state.dispatchedSnapshot,o={...a},s=/* @__PURE__ */ new WeakMap,l=/* @__PURE__ */ new Set,u=/* @__PURE__ */ new Set,d=/* @__PURE__ */ new Set;for(let e of/* @__PURE__ */ new Set([...Object.keys(t),...r?Object.keys(r):[]])){if(!K(e))continue;l.add(e);let n=r&&i(r,e)?r:t,u=W(n[e]),f=L[e];f&&u&&typeof f==`object`&&typeof u==`object`&&i(f,`raw`)&&i(u,`raw`)&&Array.isArray(f.raw)&&Array.isArray(u.raw)&&f.raw!==u.raw&&d.add(e),(!G(f,u)||!i(a,e))&&(o[e]=c(n[e],s,{cache:P,cacheEligibility:F,maxDepth:x,maxKeys:S,includeFunctions:C,functionPaths:w,_path:e})),L[e]=u}for(let e of Object.keys(L))l.has(e)||(delete L[e],(!_||!i(h,e))&&delete o[e]);if(!_){for(let e of Object.keys(R))delete R[e];return{snapshot:o,replacedTopLevelKeys:d}}for(let e of Object.keys(h)){if(!K(e))continue;u.add(e);let t=h[e].value,n=W(t);(!G(R[e],n)||!i(a,e))&&(o[e]=c(t,s,{cache:P,cacheEligibility:F,maxDepth:x,maxKeys:S,includeFunctions:C,functionPaths:w,_path:e})),R[e]=n}for(let e of Object.keys(R))u.has(e)||(delete R[e],(!i(t,e)||!K(e))&&delete o[e]);return{snapshot:o,replacedTopLevelKeys:d}},Q=(e=`diff`,t=0,n)=>{let r=v===`diff`?ne():void 0,i=r?.snapshot??Z(),a=X.state.dispatchedSnapshot,o=X.state.needsFullSnapshot,c=o?X.createFullPayload(i):r?(()=>{let e={};for(let t of r.replacedTopLevelKeys)e[t]=i[t];return{...s(a,i,{skipKeys:r.replacedTopLevelKeys}),...e}})():s(a,i);n?.(i);let l=Object.keys(c).length;if(!l&&!o)return;let u=o?`needsFullSnapshot`:e;Y({mode:`diff`,reason:u,pendingPatchKeys:t,payloadKeys:l},Object.keys(c)),X.dispatch({mode:`diff`,kind:o?`full`:`delta`,reason:u,snapshot:i,payload:c,pendingPatchKeys:t})},$=(e=0,t)=>j()?(te(e,t),A(),!0):!1;return{collect:Z,emitDebug:Y,getLatestSnapshot:()=>X.state.dispatchedSnapshot,dispatchUpdate:X.dispatch,needsFullSnapshot:()=>X.state.needsFullSnapshot,job:e=>{if($())return Q(`diff`)},plainCache:P,plainCacheEligibility:F,prepareJob:$,resolveTopKeysByRoot:J,runDiffUpdate:Q,shouldIncludeSnapshotKey:K,snapshot:()=>v===`patch`?Z():{...X.state.dispatchedSnapshot},cloneLatestSnapshot:()=>({...X.state.dispatchedSnapshot}),dispose:X.dispose}}export{d as createSetDataScheduler};
1
+ import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../../../reactivity/reactive.mjs";import{isRef as r}from"../../../reactivity/ref.mjs";import{hasOwn as i}from"../../../utils.mjs";import{hasTrackableSetupBinding as a}from"../../setupTracking.mjs";import{resolveBindingDiagnostics as o}from"../../bindingManifest.mjs";import{diffSnapshots as s,toPlain as c}from"../../diff.mjs";import{createSetDataObservation as l}from"./observation.mjs";import{collectSnapshot as u}from"./snapshot.mjs";import{createSetDataCommitTracker as d}from"./commitTracker.mjs";function f(f){let{state:p,setupState:m,snapshotOmitKeys:h,computedRefs:g,dirtyComputedKeys:_,includeComputed:v,setDataStrategy:y,currentAdapter:b,shouldIncludeKey:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w=!1,functionPaths:T,debug:E,debugWhen:D,debugSampleRate:O,bindingManifest:k,loopWarning:A,targetLabel:j,runTracker:M,isMounted:ee,initialSnapshot:N,initialState:P}=f,F=/* @__PURE__ */ new WeakMap,I=/* @__PURE__ */ new WeakMap,L={},R=Object.create(null),z=Object.create(null),B=[],V=-1/0,H=new Set(P&&typeof P==`object`?Object.keys(P):[]),U=e=>{if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype},W=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>W(e,t[n]));if(U(e)&&U(t)){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>i(t,n)&&W(e[n],t[n]))}return!1},G=i=>{let o=r(i)?i.value:i;if(typeof o!=`object`||!o)return o;if(!n(o)&&a(o))return{snapshot:c(o,/* @__PURE__ */ new WeakMap,{cacheEligibility:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T})};let s=n(o)?e(o):o;return{raw:s,version:t(s)}},K=(e,t)=>Object.is(e,t)?!0:!e||!t||typeof e!=`object`||typeof t!=`object`||!i(e,`raw`)||!i(t,`raw`)?e&&t&&typeof e==`object`&&typeof t==`object`&&i(e,`snapshot`)&&i(t,`snapshot`)?W(e.snapshot,t.snapshot):!1:e.raw===t.raw&&e.version===t.version,q=e=>x(e)&&!h?.has(e);if(N)for(let[e,t]of Object.entries(N))q(e)&&(L[e]=t);let te=()=>{if(!N)return;let t=n(p)?e(p):p,r=m&&typeof m==`object`?n(m)?e(m):m:void 0;for(let e of Object.keys(N))if(q(e)){if(r&&i(r,e))R[e]=G(r[e]);else if(i(t,e)){if(H.has(e))continue;t[e]=N[e],R[e]=G(t[e])}}},ne=t=>{let a=[],o=m&&typeof m==`object`?n(m)?e(m):m:void 0;for(let n of/* @__PURE__ */ new Set([...Object.keys(p),...o?Object.keys(o):[]])){if(!q(n))continue;let s=o&&i(o,n)?o[n]:p[n],c=r(s)?s.value:s;c&&typeof c==`object`&&e(c)===t&&a.push(n)}return a},J=(e,t)=>{if(!E)return;let n=e.reason!==`patch`&&e.reason!==`diff`;if(D===`fallback`&&!n||e.reason!==`commitFailure`&&O<1&&Math.random()>O)return;let r=e;if(k){let n=typeof t==`function`?t():t??[],i=e.reason===`needsFullSnapshot`||e.reason===`maxPatchKeys`||e.reason===`maxPayloadBytes`;r={...e,bindings:o(k,n,i)}}try{E(r)}catch{}},Y,X=f.debugPhases&&E?l({debug:E,debugWhen:D,debugSampleRate:O,targetLabel:j,committedRevision:()=>Y.state.committedRevision}):void 0;Y=d({observe:X?.revision,initialSnapshot:L,adapter:b,onFailure:e=>{J({mode:e.mode,reason:`commitFailure`,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:e.payloadKeys,revision:e.revision,committedRevision:e.committedRevision,targetLabel:j,message:e.error.message});try{b.__wevu_reportSetDataError?.(e.error)}catch{}}});let re=(e=0,t)=>{if(!A)return;let n=Date.now();B.push(n);let r=n-A.sampleWindowMs;for(;B.length&&B[0]<r;)B.shift();B.length<=A.maxFlushes||A.coolDownMs>0&&n-V<A.coolDownMs||(V=n,J({mode:y,reason:`loopWarning`,pendingPatchKeys:e,payloadKeys:0,computedDirtyKeys:v?_.size:0,flushCount:B.length,windowMs:A.sampleWindowMs,targetLabel:j,message:`${j?`${j} `:``}疑似运行时更新循环:${B.length} 次 setData flush/${A.sampleWindowMs}ms`},t))},Z=()=>u({state:p,setupState:m,computedRefs:g,includeComputed:v,shouldIncludeKey:q,plainCache:F,plainCacheEligibility:I,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T});te();let ie=()=>{let t=n(p)?e(p):p,r=m&&typeof m==`object`?n(m)?e(m):m:void 0,a=Y.state.dispatchedSnapshot,o={...a},s=/* @__PURE__ */ new WeakMap,l=/* @__PURE__ */ new Set,u=/* @__PURE__ */ new Set,d=/* @__PURE__ */ new Set;for(let e of/* @__PURE__ */ new Set([...Object.keys(t),...r?Object.keys(r):[]])){if(!q(e))continue;l.add(e);let n=r&&i(r,e)?r:t,u=G(n[e]),f=R[e];f&&u&&typeof f==`object`&&typeof u==`object`&&i(f,`raw`)&&i(u,`raw`)&&Array.isArray(f.raw)&&Array.isArray(u.raw)&&f.raw!==u.raw&&d.add(e),(!K(f,u)||!i(a,e))&&(o[e]=c(n[e],s,{cache:F,cacheEligibility:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T,_path:e})),R[e]=u}for(let e of Object.keys(R))l.has(e)||(delete R[e],(!v||!i(g,e))&&delete o[e]);if(!v){for(let e of Object.keys(z))delete z[e];return{snapshot:o,replacedTopLevelKeys:d}}for(let e of Object.keys(g)){if(!q(e))continue;u.add(e);let t=g[e].value,n=G(t);(!K(z[e],n)||!i(a,e))&&(o[e]=c(t,s,{cache:F,cacheEligibility:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T,_path:e})),z[e]=n}for(let e of Object.keys(z))u.has(e)||(delete z[e],(!i(t,e)||!q(e))&&delete o[e]);return{snapshot:o,replacedTopLevelKeys:d}},Q=(e=`diff`,t=0,n)=>{let r=y===`diff`?ie():void 0,i=r?.snapshot??Z(),a=Y.state.dispatchedSnapshot,o=Y.state.needsFullSnapshot,c=o?Y.createFullPayload(i):r?(()=>{let e={};for(let t of r.replacedTopLevelKeys)e[t]=i[t];return{...s(a,i,{skipKeys:r.replacedTopLevelKeys}),...e}})():s(a,i);n?.(i);let l=Object.keys(c).length;if(!l&&!o)return;let u=o?`needsFullSnapshot`:e;J({mode:`diff`,reason:u,pendingPatchKeys:t,payloadKeys:l},Object.keys(c)),Y.dispatch({mode:`diff`,kind:o?`full`:`delta`,reason:u,snapshot:i,payload:c,pendingPatchKeys:t})},$=(e=0,t)=>ee()?(X?.prepare(),re(e,t),M(),!0):!1;return{collect:Z,emitDebug:J,getLatestSnapshot:()=>Y.state.dispatchedSnapshot,dispatchUpdate:Y.dispatch,needsFullSnapshot:()=>Y.state.needsFullSnapshot,job:e=>{if($())return Q(`diff`)},plainCache:F,plainCacheEligibility:I,prepareJob:$,resolveTopKeysByRoot:ne,runDiffUpdate:Q,shouldIncludeSnapshotKey:q,snapshot:()=>y===`patch`?Z():{...Y.state.dispatchedSnapshot},cloneLatestSnapshot:()=>({...Y.state.dispatchedSnapshot}),dispose:Y.dispose}}export{f as createSetDataScheduler};
@@ -1 +1 @@
1
- function e(e){let t=e?.includeComputed??!0,n=e?.suspendWhenHidden??!1,r=e?.strategy??`diff`,i=typeof e?.maxPatchKeys==`number`?Math.max(0,e.maxPatchKeys):1/0,a=typeof e?.maxPayloadBytes==`number`?Math.max(0,e.maxPayloadBytes):1/0,o=typeof e?.mergeSiblingThreshold==`number`?Math.max(2,Math.floor(e.mergeSiblingThreshold)):0,s=typeof e?.mergeSiblingMaxInflationRatio==`number`?Math.max(0,e.mergeSiblingMaxInflationRatio):1.25,c=typeof e?.mergeSiblingMaxParentBytes==`number`?Math.max(0,e.mergeSiblingMaxParentBytes):1/0,l=e?.mergeSiblingSkipArray??!0,u=e?.computedCompare??(r===`patch`?`deep`:`reference`),d=typeof e?.computedCompareMaxDepth==`number`?Math.max(0,Math.floor(e.computedCompareMaxDepth)):4,f=typeof e?.computedCompareMaxKeys==`number`?Math.max(0,Math.floor(e.computedCompareMaxKeys)):200,p=e?.prelinkMaxDepth,m=e?.prelinkMaxKeys,h=e?.debug,g=e?.diagnostics??`off`,_=e?.loopWarning,v=_===!1||_&&typeof _==`object`&&_.enabled===!1?!1:{sampleWindowMs:typeof _==`object`&&typeof _.sampleWindowMs==`number`?Math.max(100,Math.floor(_.sampleWindowMs)):1e3,maxFlushes:typeof _==`object`&&typeof _.maxFlushes==`number`?Math.max(1,Math.floor(_.maxFlushes)):50,coolDownMs:typeof _==`object`&&typeof _.coolDownMs==`number`?Math.max(0,Math.floor(_.coolDownMs)):5e3},y=e?.debugWhen??`fallback`,b=typeof e?.debugSampleRate==`number`?Math.min(1,Math.max(0,e.debugSampleRate)):1,x=typeof e?.elevateTopKeyThreshold==`number`?Math.max(0,Math.floor(e.elevateTopKeyThreshold)):1/0,S=typeof e?.toPlainMaxDepth==`number`?Math.max(0,Math.floor(e.toPlainMaxDepth)):1/0,C=typeof e?.toPlainMaxKeys==`number`?Math.max(0,Math.floor(e.toPlainMaxKeys)):1/0,w=!!e?.includeFunctions,T=Array.isArray(e?.functionPaths)?[...new Set(e.functionPaths.filter(e=>typeof e==`string`&&e.length>0))]:[],E=Array.isArray(e?.pick)&&e.pick.length>0?new Set(e.pick):void 0,D=Array.isArray(e?.omit)&&e.omit.length>0?new Set(e.omit):void 0;return{includeComputed:t,suspendWhenHidden:n,setDataStrategy:r,maxPatchKeys:i,maxPayloadBytes:a,mergeSiblingThreshold:o,mergeSiblingMaxInflationRatio:s,mergeSiblingMaxParentBytes:c,mergeSiblingSkipArray:l,computedCompare:u,computedCompareMaxDepth:d,computedCompareMaxKeys:f,prelinkMaxDepth:p,prelinkMaxKeys:m,debug:h,diagnostics:g,loopWarning:v,debugWhen:y,debugSampleRate:b,elevateTopKeyThreshold:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T,pickSet:E,omitSet:D,shouldIncludeKey:e=>!(E&&!E.has(e)||D&&D.has(e))}}export{e as resolveSetDataOptions};
1
+ function e(e){let t=e?.includeComputed??!0,n=e?.suspendWhenHidden??!1,r=e?.strategy??`diff`,i=typeof e?.maxPatchKeys==`number`?Math.max(0,e.maxPatchKeys):1/0,a=typeof e?.maxPayloadBytes==`number`?Math.max(0,e.maxPayloadBytes):1/0,o=typeof e?.mergeSiblingThreshold==`number`?Math.max(2,Math.floor(e.mergeSiblingThreshold)):0,s=typeof e?.mergeSiblingMaxInflationRatio==`number`?Math.max(0,e.mergeSiblingMaxInflationRatio):1.25,c=typeof e?.mergeSiblingMaxParentBytes==`number`?Math.max(0,e.mergeSiblingMaxParentBytes):1/0,l=e?.mergeSiblingSkipArray??!0,u=e?.computedCompare??(r===`patch`?`deep`:`reference`),d=typeof e?.computedCompareMaxDepth==`number`?Math.max(0,Math.floor(e.computedCompareMaxDepth)):4,f=typeof e?.computedCompareMaxKeys==`number`?Math.max(0,Math.floor(e.computedCompareMaxKeys)):200,p=e?.prelinkMaxDepth,m=e?.prelinkMaxKeys,h=e?.debug,g=e?.diagnostics??`off`,_=e?.loopWarning,v=_===!1||_&&typeof _==`object`&&_.enabled===!1?!1:{sampleWindowMs:typeof _==`object`&&typeof _.sampleWindowMs==`number`?Math.max(100,Math.floor(_.sampleWindowMs)):1e3,maxFlushes:typeof _==`object`&&typeof _.maxFlushes==`number`?Math.max(1,Math.floor(_.maxFlushes)):50,coolDownMs:typeof _==`object`&&typeof _.coolDownMs==`number`?Math.max(0,Math.floor(_.coolDownMs)):5e3},y=e?.debugWhen??`fallback`,b=typeof e?.debugSampleRate==`number`?Math.min(1,Math.max(0,e.debugSampleRate)):1,x=typeof e?.elevateTopKeyThreshold==`number`?Math.max(0,Math.floor(e.elevateTopKeyThreshold)):1/0,S=typeof e?.toPlainMaxDepth==`number`?Math.max(0,Math.floor(e.toPlainMaxDepth)):1/0,C=typeof e?.toPlainMaxKeys==`number`?Math.max(0,Math.floor(e.toPlainMaxKeys)):1/0,w=!!e?.includeFunctions,T=Array.isArray(e?.functionPaths)?[...new Set(e.functionPaths.filter(e=>typeof e==`string`&&e.length>0))]:[],E=Array.isArray(e?.pick)&&e.pick.length>0?new Set(e.pick):void 0,D=Array.isArray(e?.omit)&&e.omit.length>0?new Set(e.omit):void 0;return{includeComputed:t,suspendWhenHidden:n,setDataStrategy:r,maxPatchKeys:i,maxPayloadBytes:a,mergeSiblingThreshold:o,mergeSiblingMaxInflationRatio:s,mergeSiblingMaxParentBytes:c,mergeSiblingSkipArray:l,computedCompare:u,computedCompareMaxDepth:d,computedCompareMaxKeys:f,prelinkMaxDepth:p,prelinkMaxKeys:m,debug:h,debugPhases:e?.debugPhases===!0,diagnostics:g,loopWarning:v,debugWhen:y,debugSampleRate:b,elevateTopKeyThreshold:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T,pickSet:E,omitSet:D,shouldIncludeKey:e=>!(E&&!E.has(e)||D&&D.has(e))}}export{e as resolveSetDataOptions};
@@ -1 +1 @@
1
- import{hasOwn as e}from"../../utils.mjs";import{toPlain as t}from"../diff.mjs";import{resolveSetDataOptions as n}from"../app/setDataOptions.mjs";import{WEVU_SLOT_OWNER_ID_KEY as r}from"@weapp-core/constants";var i=class extends Error{};function a(e){if(typeof e==`function`)return e;let t=e?.get;return typeof t==`function`?t:void 0}function o(e){return e.startsWith(`__wv_bind_`)||e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`)}function s(e,t){if(!e.startsWith(`__wv_bind_`))return!1;try{return!/\bthis\b/.test(Function.prototype.toString.call(t))}catch{return!1}}function c(e){if(e===r)return``;if(e.startsWith(`__wv_bind_`))return null;if(e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`))return``}function l(t,n){let r=Array.isArray(n?.pick)?n.pick:[];if(!r.length)return;let i=new Set(Array.isArray(n?.omit)?n.omit:[]),a={};for(let n of r){if(i.has(n)||e(t,n))continue;let r=c(n);r!==void 0&&(a[n]=r)}return Object.keys(a).length?a:void 0}function u(r){let{data:c,computed:l,methods:u,setData:d}=r,f=l?Object.keys(l):[];if(!f.length)return;let{includeComputed:p,shouldIncludeKey:m,toPlainMaxDepth:h,toPlainMaxKeys:g,includeFunctions:_,functionPaths:v}=n(d);if(!p)return;let y={},b=/* @__PURE__ */ new Set,x,S=n=>{if(e(c,n)||!m(n))return{ok:!1};if(e(y,n))return{ok:!0,value:y[n]};if(b.has(n))return{ok:!1};let r=a(l[n]);if(!r)return{ok:!1};b.add(n);try{let e=r.call(x);if(e===void 0)return{ok:!1};let i=t(e,/* @__PURE__ */ new WeakMap,{maxDepth:h,maxKeys:g,includeFunctions:_,functionPaths:v,_path:n});return i===void 0?{ok:!1}:(y[n]=i,{ok:!0,value:i})}catch{return{ok:!1}}finally{b.delete(n)}};x=new Proxy(c,{get(t,n,r){if(typeof n==`string`){if(n===`data`||n===`$state`)return c;if(n===`props`||n===`$props`||n===`$attrs`)throw new i;if(e(c,n))return Reflect.get(t,n,r);if(u&&e(u,n)){let e=u[n];return typeof e==`function`?e.bind(x):e}if(l&&e(l,n)){let e=S(n);if(e.ok)return e.value;throw new i}throw new i}return Reflect.get(t,n,r)},has(t,n){return Reflect.has(t,n)||typeof n==`string`&&!!(l&&e(l,n))}});for(let e of f){let t=a(l[e]);(!o(e)||t&&s(e,t))&&S(e)}return Object.keys(y).length?y:void 0}function d(e,t,n,r){if(!e||typeof e!=`object`)return e;let i=u({data:e,computed:t,methods:r,setData:n}),a=l(e,n);return i||a?{...e,...a,...i}:e}export{u as resolveInitialComputedData,d as resolveNativeInitialData};
1
+ import{hasOwn as e}from"../../utils.mjs";import{toPlain as t}from"../diff.mjs";import{resolveSetDataOptions as n}from"../app/setDataOptions.mjs";import{WEVU_SLOT_OWNER_ID_KEY as r}from"@weapp-core/constants";var i=class extends Error{};function a(e){if(typeof e==`function`)return e;let t=e?.get;return typeof t==`function`?t:void 0}function o(e){return e.startsWith(`__wv_bind_`)||e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`)}function s(e,t){if(!e.startsWith(`__wv_bind_`))return!1;try{return!/\bthis\b/.test(Function.prototype.toString.call(t))}catch{return!1}}function c(e){if(e===r)return``;if(e.startsWith(`__wv_bind_`))return null;if(e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`))return``}function l(t,r,i){let a=/* @__PURE__ */ new Set([...Array.isArray(r?.pick)?r.pick:[],...i?.bindings.map(e=>e.outputPath)??[]]);if(!a.size)return;let{shouldIncludeKey:o}=n(r),s={};for(let n of a){if(!o(n)||e(t,n)||n.includes(`.`)||n.includes(`[`))continue;let r=c(n);r!==void 0&&(s[n]=r)}return Object.keys(s).length?s:void 0}function u(r){let{data:c,computed:l,methods:u,setData:d}=r,f=l?Object.keys(l):[];if(!f.length)return;let{includeComputed:p,shouldIncludeKey:m,toPlainMaxDepth:h,toPlainMaxKeys:g,includeFunctions:_,functionPaths:v}=n(d);if(!p)return;let y={},b=/* @__PURE__ */ new Set,x,S=n=>{if(e(c,n)||!m(n))return{ok:!1};if(e(y,n))return{ok:!0,value:y[n]};if(b.has(n))return{ok:!1};let r=a(l[n]);if(!r)return{ok:!1};b.add(n);try{let e=r.call(x);if(e===void 0)return{ok:!1};let i=t(e,/* @__PURE__ */ new WeakMap,{maxDepth:h,maxKeys:g,includeFunctions:_,functionPaths:v,_path:n});return i===void 0?{ok:!1}:(y[n]=i,{ok:!0,value:i})}catch{return{ok:!1}}finally{b.delete(n)}};x=new Proxy(c,{get(t,n,r){if(typeof n==`string`){if(n===`data`||n===`$state`)return c;if(n===`props`||n===`$props`||n===`$attrs`)throw new i;if(e(c,n))return Reflect.get(t,n,r);if(u&&e(u,n)){let e=u[n];return typeof e==`function`?e.bind(x):e}if(l&&e(l,n)){let e=S(n);if(e.ok)return e.value;throw new i}throw new i}return Reflect.get(t,n,r)},has(t,n){return Reflect.has(t,n)||typeof n==`string`&&!!(l&&e(l,n))}});for(let e of f){let t=a(l[e]);(!o(e)||t&&s(e,t))&&S(e)}return Object.keys(y).length?y:void 0}function d(e,t,n,r,i){if(e!==void 0&&(!e||typeof e!=`object`))return e;let a=e??{},o=e===void 0?void 0:u({data:a,computed:t,methods:r,setData:n}),s=l(a,n,i);return o||s?{...a,...s,...o}:e}export{u as resolveInitialComputedData,d as resolveNativeInitialData};
@@ -1 +1 @@
1
- import{hasOwn as e}from"../../utils.mjs";import{WEVU_SLOT_NAMES_PROP as t,WEVU_SLOT_OWNER_ID_PROP as n,WEVU_SLOT_SCOPE_KEY as r}from"@weapp-core/constants";const i=`__wevu_allowNullPropInput`,a=`allowNullPropInput`,o=/* @__PURE__ */ new Map([[String,String],[Number,Number],[Boolean,Boolean],[Object,Object],[Array,Array],[Function,Function],[`String`,String],[`Number`,Number],[`Boolean`,Boolean],[`Object`,Object],[`Array`,Array],[`Function`,Function],[null,null],[`null`,null],[`Null`,null]]);function s(e){return o.get(e)}function c(e,t=[]){if(Array.isArray(e)){for(let n of e)c(n,t);return t}let n=s(e);return n!==void 0&&!t.includes(n)&&t.push(n),t}function l(e){if(e===void 0)return[];let t=c(e).filter(e=>e!==null);return t.length>0?t:[null]}function u(e,t){let n=l(t);if(n.length!==0&&(e.type=n[0],n.length>1)){let t=[];for(let e of n.slice(1))t.includes(e)||t.push(e);t.length>0&&(e.optionalTypes=t)}}function d(t){e(t,`value`)||(t.type===String?t.value=``:t.type===Number?t.value=0:t.type===Boolean?t.value=!1:t.type===Array&&(t.value=[]))}function f(e,t,n){if(!n||e.type===null)return;let r=t&&typeof t==`object`&&!Array.isArray(t)?t:void 0,i=c(r?[r.type,r.optionalTypes]:t),a=i.includes(null),o=i.filter(e=>e!==null).length>1,s=r?.required!==!0;(a||o||s)&&(a||d(e),e.type=null,delete e.optionalTypes)}function p(t,n){let r={};return t&&Object.entries(t).forEach(([t,i])=>{if(i!==void 0){if(i===null){r[t]={type:null};return}if(Array.isArray(i)||typeof i==`function`){let a={};u(a,i),e(a,`type`)||(a.type=null),f(a,i,n),r[t]=a;return}if(typeof i==`object`){if(t.endsWith(`Modifiers`)&&Object.keys(i).length===0){r[t]={type:Object,value:{}};return}let a={};if(`type`in i&&i.type!==void 0&&u(a,i.type),Array.isArray(i.optionalTypes)){let e=i.optionalTypes.map(e=>s(e)).filter(e=>e!=null);if(e.length>0){let t=Array.isArray(a.optionalTypes)?a.optionalTypes:[];for(let n of e)n!==a.type&&(t.includes(n)||t.push(n));t.length>0&&(a.optionalTypes=t)}}`observer`in i&&(typeof i.observer==`function`||typeof i.observer==`string`)&&(a.observer=i.observer);let o=`default`in i?i.default:i.value;o!==void 0&&(a.value=typeof o==`function`?o():o),e(a,`type`)||(a.type=null),f(a,i,n),r[t]=a}}}),r}function m(o,s,c){let l=!!(o[i]??o[a]),{[i]:u,[a]:d,...f}=o,m=o.properties,h=m&&typeof m==`object`&&Object.keys(m).length>0?m:void 0,g=c??h,_=!!(s||g),v=i=>{let a={...i??{}};return _?(e(a,n)||(a[n]={type:String,value:``}),e(a,r)||(a[r]={type:null,value:null}),e(a,t)||(a[t]={type:null,value:null}),a):a};if(g){let{properties:e,...t}=f,n=g,r=p(s,l);return{...t,properties:v({...r,...n})}}return{...f,properties:v(p(s,l))}}export{m as normalizeProps};
1
+ import{hasOwn as e}from"../../utils.mjs";import{WEVU_NATIVE_DECLARATION_ADDRESS_PROP as t,WEVU_NATIVE_SLOT_CONTEXT_KEY as n,WEVU_SLOT_NAMES_PROP as r,WEVU_SLOT_OWNER_ID_PROP as i,WEVU_SLOT_SCOPE_KEY as a}from"@weapp-core/constants";const o=`__wevu_allowNullPropInput`,s=`allowNullPropInput`,c=/* @__PURE__ */ new Map([[String,String],[Number,Number],[Boolean,Boolean],[Object,Object],[Array,Array],[Function,Function],[`String`,String],[`Number`,Number],[`Boolean`,Boolean],[`Object`,Object],[`Array`,Array],[`Function`,Function],[null,null],[`null`,null],[`Null`,null]]);function l(e){return c.get(e)}function u(e,t=[]){if(Array.isArray(e)){for(let n of e)u(n,t);return t}let n=l(e);return n!==void 0&&!t.includes(n)&&t.push(n),t}function d(e){if(e===void 0)return[];let t=u(e).filter(e=>e!==null);return t.length>0?t:[null]}function f(e,t){let n=d(t);if(n.length!==0&&(e.type=n[0],n.length>1)){let t=[];for(let e of n.slice(1))t.includes(e)||t.push(e);t.length>0&&(e.optionalTypes=t)}}function p(t){e(t,`value`)||(t.type===String?t.value=``:t.type===Number?t.value=0:t.type===Boolean?t.value=!1:t.type===Array&&(t.value=[]))}function m(e,t,n){if(!n||e.type===null)return;let r=t&&typeof t==`object`&&!Array.isArray(t)?t:void 0,i=u(r?[r.type,r.optionalTypes]:t),a=i.includes(null),o=i.filter(e=>e!==null).length>1,s=r?.required!==!0;(a||o||s)&&(a||p(e),e.type=null,delete e.optionalTypes)}function h(t,n){let r={};return t&&Object.entries(t).forEach(([t,i])=>{if(i!==void 0){if(i===null)r[t]={type:null};else if(Array.isArray(i)||typeof i==`function`){let a={};f(a,i),e(a,`type`)||(a.type=null),m(a,i,n),r[t]=a}else if(typeof i==`object`){if(t.endsWith(`Modifiers`)&&Object.keys(i).length===0){r[t]={type:Object,value:{}};return}let a={};if(`type`in i&&i.type!==void 0&&f(a,i.type),Array.isArray(i.optionalTypes)){let e=i.optionalTypes.map(e=>l(e)).filter(e=>e!=null);if(e.length>0){let t=Array.isArray(a.optionalTypes)?a.optionalTypes:[];for(let n of e)n!==a.type&&(t.includes(n)||t.push(n));t.length>0&&(a.optionalTypes=t)}}`observer`in i&&(typeof i.observer==`function`||typeof i.observer==`string`)&&(a.observer=i.observer);let o=`default`in i?i.default:i.value;o!==void 0&&(a.value=typeof o==`function`?o():o),e(a,`type`)||(a.type=null),m(a,i,n),r[t]=a}}}),r}function g(c,l,u){let d=!!(c[o]??c[s]),{[o]:f,[s]:p,...m}=c,g=c.properties,_=g&&typeof g==`object`&&Object.keys(g).length>0?g:void 0,v=u??_,y=!!(l||v),b=o=>{let s={...o??{}};return(!import.meta.env?.PLATFORM||import.meta.env?.PLATFORM===`weapp`)&&c[n]===!0&&(s[t]={type:Array,value:[]}),y&&(e(s,i)||(s[i]={type:String,value:``}),e(s,a)||(s[a]={type:null,value:null}),e(s,r)||(s[r]={type:null,value:null})),s};if(v){let{properties:e,...t}=m,n=v,r=h(l,d);return{...t,properties:b({...r,...n})}}return{...m,properties:b(h(l,d))}}export{g as normalizeProps};
@@ -1 +1 @@
1
- import{requireRuntimeCapability as e,runtimeCapabilityRegistry as t}from"../capabilities.mjs";import{runTeardownSteps as n}from"../teardown.mjs";import{hasOwn as r}from"../../utils.mjs";import{cloneSnapshotValue as i,isDeepEqualValue as a}from"../app/setData/snapshot.mjs";import{decodeWxmlEntities as o,resolveDatasetEventValue as s}from"../inlineDataset.mjs";import{getOwnerProxy as c,getOwnerSnapshot as l,getOwnerTarget as u,subscribeOwner as d}from"../scopedSlots.mjs";import{WEVU_BINDING_MANIFEST_KEY as f,WEVU_INLINE_HANDLER as p,WEVU_INLINE_MAP_KEY as m,WEVU_LAYOUT_HOSTS_KEY as h,WEVU_OWNER_HANDLER as g,WEVU_PROPS_DERIVED_KEYS_KEY as _,WEVU_PUBLIC_RUNTIME_KEY as v,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as y,WEVU_SLOT_FUNCTION_TOKEN as b,WEVU_SLOT_OWNER_ID_KEY as x,WEVU_SLOT_OWNER_ID_PROP as S,WEVU_SLOT_OWNER_KEY as C,WEVU_SLOT_OWNER_PROXY_KEY as w,WEVU_SLOT_PROPS_DATA_KEY as T,WEVU_SLOT_PROPS_KEY as E,WEVU_SLOT_SCOPE_KEY as D,WEVU_TEMPLATE_REFS_KEY as O}from"@weapp-core/constants";const k=[x,S,w,C,T,E,D];function A(e){let t=e?.currentTarget?.dataset??e?.target?.dataset??{},n=s(t,`wvArgs`,e),r=[];if(Array.isArray(n))r=n;else if(typeof n==`string`)try{r=JSON.parse(n)}catch{try{r=JSON.parse(o(n))}catch{r=[]}}return Array.isArray(r)||(r=[]),r.map(t=>t===`$event`?e:t)}function j(e){if(!e||typeof e!=`object`)return{};if(Array.isArray(e)){let t={};for(let n=0;n<e.length;n+=2){let r=e[n];typeof r==`string`&&r&&(t[r]=e[n+1])}return t}return e}function M(e){return Array.isArray(e)&&e[0]===b&&typeof e[1]==`string`}function N(e,t){return(...n)=>{let r=e?.selectOwnerComponent?.(),i=r?.[p];if(typeof i!=`function`)return;let a={wd:1,wi:t[1]},o=Array.isArray(t[2])?t[2]:[],s=Array.isArray(t[3])?t[3]:[];o.forEach((e,t)=>a[`wvS${t}`]=e),s.forEach((e,t)=>a[`wvI${t}`]=e);let c={type:`wv-slot-function`,detail:n,currentTarget:{dataset:a},target:{dataset:a}};return i.call(r,c)}}function P(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=M(i)?N(e,i):i;return n}function F(e){return e?.__wevu?.proxy??e?.[v]?.proxy??e}function I(e,t){if(!t||Object.keys(t).length===0)return;let n=F(e),r={};for(let[e,i]of Object.entries(t))try{let t;typeof i==`function`?t=i.call(n):typeof i?.get==`function`&&(t=i.get.call(n)),t!==void 0&&(r[e]=t)}catch{}return r}function L(e){e?.__wevu?.__wevu_flushSetupSnapshotSync?.()}function R(e,t,n){L(e);let o=I(e,t);if(!o||typeof e?.setData!=`function`)return;let s=r(e,`__wvScopedSlotComputedSnapshot`),c=e.__wvScopedSlotComputedSnapshot??{},l={},u={};for(let[e,t]of Object.entries(o))l[e]=i(t),(n?.force||!s||!r(c,e)||!a(c[e],t,20,{keys:1e4}))&&(u[e]=t);for(let e of Object.keys(c))r(o,e)||(u[e]=null);e.__wvScopedSlotComputedSnapshot=l,Object.keys(u).length>0&&e.setData(u)}function z(e,t){let n=r(t??{},D)?t[D]:e?.properties?.[D],o=r(t??{},E)?t[E]:e?.properties?.[E],s=j(n),c=j(o),l={...s,...c},u=!r(e,`__wvSlotPropsSnapshot`)||!a(e.__wvSlotPropsSnapshot??{},l,20,{keys:1e4}),d=u||!e[T]?P(e,l):e[T];u&&(e.__wvSlotPropsSnapshot=i(l)),e[T]=d;let f=e?.__wevu?.state,p=!(!f||typeof f!=`object`||r(f,T)&&a(f[T]??{},l,20,{keys:1e4}));return f&&typeof f==`object`&&(f[T]=d),{merged:d,runtimeSnapshotChanged:p,snapshot:l,snapshotChanged:u}}function B(e,t,n){let{runtimeSnapshotChanged:r,snapshot:i,snapshotChanged:a}=z(e,n);(a||r)&&typeof e?.setData==`function`&&e.setData({[T]:i}),a&&R(e,t)}function V(e,t){let n=!1;e[w]!==t&&(e[w]=t,n=!0);let r=e?.data;if(r&&typeof r==`object`&&r[w]!==t){try{Object.defineProperty(r,w,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch{r[w]=t}n=!0}let i=e?.__wevu?.state;return i&&typeof i==`object`&&i[w]!==t&&(i[w]=t,n=!0),n}function H(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function U(e,t,n,r){if(typeof e==`function`){n[t]=e;return}if(typeof e!=`object`||!e)return e;if(r.has(e))return;if(Array.isArray(e)){r.add(e);let i=e.map((e,i)=>{let a=U(e,`${t}.${i}`,n,r);return a===void 0?null:a});return r.delete(e),i}if(!H(e))return i(e);r.add(e);let a={};for(let[i,o]of Object.entries(e)){let e=U(o,`${t}.${i}`,n,r);e!==void 0&&(a[i]=e)}return r.delete(e),a}function W(e){let t={},n=U(e,C,t,/* @__PURE__ */ new WeakSet);return{[C]:n,...t}}function G(e,t,n,o){let s=V(e,n),{snapshotChanged:c}=z(e),l=t||{},u=!r(e,`__wvOwnerSnapshot`)||!a(e.__wvOwnerSnapshot??{},l,20,{keys:1e4});if(u){e.__wvOwnerSnapshot=i(l),e[C]=l;let t=e?.__wevu?.state;t&&typeof t==`object`&&(t[C]=l)}u&&typeof e?.setData==`function`&&e.setData(W(l)),(u||s||c)&&R(e,o)}function K(e,t,n){if(!t){typeof e?.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerUnsub=void 0,e.__wvOwnerBoundId=``,V(e,void 0);return}let r=(t,r)=>{G(e,t,r,n)};e.__wvOwnerBoundId!==t&&(typeof e.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerBoundId=t,e.__wvOwnerUnsub=d(t,r));let i=l(t);i&&r(i,c(t))}function q(e){return e?.properties?.[S]??e?.properties?.[x]??``}function J(e,t){B(e,t);let n=q(e);n&&K(e,n,t)}function Y(){let e={[C]:{},[T]:{}};return Object.defineProperty(e,w,{value:void 0,configurable:!0,enumerable:!1,writable:!0}),e}function X(r){let i=r?.computed,a=r?.layoutHosts,o=r?.templateRefs;o?.length&&e(`templateRefs`,`createWevuScopedSlotComponent(templateRefs)`);let c=!!(r?.inlineMap&&Object.keys(r.inlineMap).length);c&&e(`inlineEvents`,`createWevuScopedSlotComponent(inlineMap)`),a?.length&&e(`layout`,`createWevuScopedSlotComponent(layoutHosts)`);let l=e=>{let t=q(e);return t?u(t):void 0},d={[y]:!0,options:{virtualHost:!0},setData:{omit:k},[_]:k,properties:{[S]:{type:String,value:``,observer(e){K(this,e||``,i)}},[x]:{type:String,value:``,observer(e){K(this,e||``,i)}},[E]:{type:null,value:null,observer(e){B(this,i,{[E]:e})}},[D]:{type:null,value:null,observer(e){B(this,i,{[D]:e})}}},data:Y,lifetimes:{attached(){J(this,i)},ready(){J(this,i),R(this,i,{force:!0});let e=l(this);e&&o?.length&&t.templateRefs?.schedule(this,void 0,e)},detached(){let e=l(this);n([()=>{e&&o?.length&&t.templateRefs?.clear(this,e)},()=>{typeof this.__wvOwnerUnsub==`function`&&this.__wvOwnerUnsub()},()=>{this.__wvOwnerUnsub=void 0,this.__wvOwnerBoundId=``},()=>V(this,void 0)])}},methods:{[g](e){let n=this[w],r=this.__wevu?.methods?.[m];if(c){let i=t.inlineEvents?.run(n,void 0,e,r);if(i!==void 0)return i}if(!n)return;let i=e?.currentTarget?.dataset??e?.target?.dataset??{},a=s(i,`wvHandler`,e);if(typeof a!=`string`||!a)return;let o=n?.[a];if(typeof o!=`function`)return;let l=A(e);return o.apply(n,l)}}};return r?.computed&&Object.keys(r.computed).length>0&&(d.computed=r.computed),r?.inlineMap&&Object.keys(r.inlineMap).length>0&&(d.methods={...d.methods,[m]:r.inlineMap}),o?.length&&(d[O]=o),a?.length&&(d[h]=a),r?.[f]&&(d[f]=r[f]),d}export{X as createScopedSlotOptions};
1
+ import{requireRuntimeCapability as e,runtimeCapabilityRegistry as t}from"../capabilities.mjs";import{runTeardownSteps as n}from"../teardown.mjs";import{hasOwn as r}from"../../utils.mjs";import{cloneSnapshotValue as i,isDeepEqualValue as a}from"../app/setData/snapshot.mjs";import{decodeWxmlEntities as o,resolveDatasetEventValue as s}from"../inlineDataset.mjs";import{getOwnerProxy as c,getOwnerSnapshot as l,getOwnerTarget as u,subscribeOwner as d}from"../scopedSlots.mjs";import{WEVU_BINDING_MANIFEST_KEY as f,WEVU_INLINE_HANDLER as p,WEVU_INLINE_MAP_KEY as m,WEVU_LAYOUT_HOSTS_KEY as h,WEVU_NATIVE_SLOT_CONTEXT_KEY as g,WEVU_OWNER_HANDLER as _,WEVU_PROPS_DERIVED_KEYS_KEY as v,WEVU_PUBLIC_RUNTIME_KEY as y,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as b,WEVU_SLOT_FUNCTION_TOKEN as x,WEVU_SLOT_OWNER_ID_KEY as S,WEVU_SLOT_OWNER_ID_PROP as C,WEVU_SLOT_OWNER_KEY as w,WEVU_SLOT_OWNER_PROXY_KEY as T,WEVU_SLOT_PROPS_DATA_KEY as E,WEVU_SLOT_PROPS_KEY as D,WEVU_SLOT_SCOPE_KEY as O,WEVU_TEMPLATE_REFS_KEY as k}from"@weapp-core/constants";const A=[S,C,T,w,E,D,O];function j(e){let t=e?.currentTarget?.dataset??e?.target?.dataset??{},n=s(t,`wvArgs`,e),r=[];if(Array.isArray(n))r=n;else if(typeof n==`string`)try{r=JSON.parse(n)}catch{try{r=JSON.parse(o(n))}catch{r=[]}}return Array.isArray(r)||(r=[]),r.map(t=>t===`$event`?e:t)}function M(e){if(!e||typeof e!=`object`)return{};if(Array.isArray(e)){let t={};for(let n=0;n<e.length;n+=2){let r=e[n];typeof r==`string`&&r&&(t[r]=e[n+1])}return t}return e}function N(e){return Array.isArray(e)&&e[0]===x&&typeof e[1]==`string`}function P(e,t){return(...n)=>{let r=e?.selectOwnerComponent?.(),i=r?.[p];if(typeof i!=`function`)return;let a={wd:1,wi:t[1]},o=Array.isArray(t[2])?t[2]:[],s=Array.isArray(t[3])?t[3]:[];o.forEach((e,t)=>a[`wvS${t}`]=e),s.forEach((e,t)=>a[`wvI${t}`]=e);let c={type:`wv-slot-function`,detail:n,currentTarget:{dataset:a},target:{dataset:a}};return i.call(r,c)}}function F(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=N(i)?P(e,i):i;return n}function I(e){return e?.__wevu?.proxy??e?.[y]?.proxy??e}function L(e,t){if(!t||Object.keys(t).length===0)return;let n=I(e),r={};for(let[e,i]of Object.entries(t))try{let t;typeof i==`function`?t=i.call(n):typeof i?.get==`function`&&(t=i.get.call(n)),t!==void 0&&(r[e]=t)}catch{}return r}function R(e){e?.__wevu?.__wevu_flushSetupSnapshotSync?.()}function z(e,t,n){R(e);let o=L(e,t);if(!o||typeof e?.setData!=`function`)return;let s=r(e,`__wvScopedSlotComputedSnapshot`),c=e.__wvScopedSlotComputedSnapshot??{},l={},u={};for(let[e,t]of Object.entries(o))l[e]=i(t),(n?.force||!s||!r(c,e)||!a(c[e],t,20,{keys:1e4}))&&(u[e]=t);for(let e of Object.keys(c))r(o,e)||(u[e]=null);e.__wvScopedSlotComputedSnapshot=l,Object.keys(u).length>0&&e.setData(u)}function B(e,t){let n=r(t??{},O)?t[O]:e?.properties?.[O],o=r(t??{},D)?t[D]:e?.properties?.[D],s=M(n),c=M(o),l={...s,...c},u=!r(e,`__wvSlotPropsSnapshot`)||!a(e.__wvSlotPropsSnapshot??{},l,20,{keys:1e4}),d=u||!e[E]?F(e,l):e[E];u&&(e.__wvSlotPropsSnapshot=i(l)),e[E]=d;let f=e?.__wevu?.state,p=!(!f||typeof f!=`object`||r(f,E)&&a(f[E]??{},l,20,{keys:1e4}));return f&&typeof f==`object`&&(f[E]=d),{merged:d,runtimeSnapshotChanged:p,snapshot:l,snapshotChanged:u}}function V(e,t,n){let{runtimeSnapshotChanged:r,snapshot:i,snapshotChanged:a}=B(e,n);(a||r)&&typeof e?.setData==`function`&&e.setData({[E]:i}),a&&z(e,t)}function H(e,t){let n=!1;e[T]!==t&&(e[T]=t,n=!0);let r=e?.data;if(r&&typeof r==`object`&&r[T]!==t){try{Object.defineProperty(r,T,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch{r[T]=t}n=!0}let i=e?.__wevu?.state;return i&&typeof i==`object`&&i[T]!==t&&(i[T]=t,n=!0),n}function U(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function W(e,t,n,r){if(typeof e==`function`){n[t]=e;return}if(typeof e!=`object`||!e)return e;if(r.has(e))return;if(Array.isArray(e)){r.add(e);let i=e.map((e,i)=>{let a=W(e,`${t}.${i}`,n,r);return a===void 0?null:a});return r.delete(e),i}if(!U(e))return i(e);r.add(e);let a={};for(let[i,o]of Object.entries(e)){let e=W(o,`${t}.${i}`,n,r);e!==void 0&&(a[i]=e)}return r.delete(e),a}function G(e){let t={},n=W(e,w,t,/* @__PURE__ */ new WeakSet);return{[w]:n,...t}}function K(e,t,n,o){let s=H(e,n),{snapshotChanged:c}=B(e),l=t||{},u=!r(e,`__wvOwnerSnapshot`)||!a(e.__wvOwnerSnapshot??{},l,20,{keys:1e4});if(u){e.__wvOwnerSnapshot=i(l),e[w]=l;let t=e?.__wevu?.state;t&&typeof t==`object`&&(t[w]=l)}u&&typeof e?.setData==`function`&&e.setData(G(l)),(u||s||c)&&z(e,o)}function q(e,t,n){if(!t){typeof e?.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerUnsub=void 0,e.__wvOwnerBoundId=``,H(e,void 0);return}let r=(t,r)=>{K(e,t,r,n)};e.__wvOwnerBoundId!==t&&(typeof e.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerBoundId=t,e.__wvOwnerUnsub=d(t,r));let i=l(t);i&&r(i,c(t))}function J(e){return e?.properties?.[C]??e?.properties?.[S]??``}function Y(e,t){V(e,t);let n=J(e);n&&q(e,n,t)}function X(){let e={[w]:{},[E]:{}};return Object.defineProperty(e,T,{value:void 0,configurable:!0,enumerable:!1,writable:!0}),e}function Z(r){let i=r?.computed,a=r?.layoutHosts,o=r?.templateRefs;o?.length&&e(`templateRefs`,`createWevuScopedSlotComponent(templateRefs)`);let c=!!(r?.inlineMap&&Object.keys(r.inlineMap).length);c&&e(`inlineEvents`,`createWevuScopedSlotComponent(inlineMap)`),a?.length&&e(`layout`,`createWevuScopedSlotComponent(layoutHosts)`);let l=e=>{let t=J(e);return t?u(t):void 0},d={[g]:r?.[g],[b]:!0,options:{virtualHost:!0},setData:{omit:A},[v]:A,properties:{[C]:{type:String,value:``,observer(e){q(this,e||``,i)}},[S]:{type:String,value:``,observer(e){q(this,e||``,i)}},[D]:{type:null,value:null,observer(e){V(this,i,{[D]:e})}},[O]:{type:null,value:null,observer(e){V(this,i,{[O]:e})}}},data:X,lifetimes:{attached(){Y(this,i)},ready(){Y(this,i),z(this,i,{force:!0});let e=l(this);e&&o?.length&&t.templateRefs?.schedule(this,void 0,e)},detached(){let e=l(this);n([()=>{e&&o?.length&&t.templateRefs?.clear(this,e)},()=>{typeof this.__wvOwnerUnsub==`function`&&this.__wvOwnerUnsub()},()=>{this.__wvOwnerUnsub=void 0,this.__wvOwnerBoundId=``},()=>H(this,void 0)])}},methods:{[_](e){let n=this[T],r=this.__wevu?.methods?.[m];if(c){let i=t.inlineEvents?.run(n,void 0,e,r);if(i!==void 0)return i}if(!n)return;let i=e?.currentTarget?.dataset??e?.target?.dataset??{},a=s(i,`wvHandler`,e);if(typeof a!=`string`||!a)return;let o=n?.[a];if(typeof o!=`function`)return;let l=j(e);return o.apply(n,l)}}};return r?.computed&&Object.keys(r.computed).length>0&&(d.computed=r.computed),r?.inlineMap&&Object.keys(r.inlineMap).length>0&&(d.methods={...d.methods,[m]:r.inlineMap}),o?.length&&(d[k]=o),a?.length&&(d[h]=a),r?.[f]&&(d[f]=r[f]),d}export{Z as createScopedSlotOptions};
@@ -1 +1 @@
1
- import{applyWevuComponentDefaults as e}from"./defaults.mjs";import{requireRuntimeCapability as t}from"./capabilities.mjs";import{hasOwn as n}from"../utils.mjs";import{hasBindingOutputPath as r,resolveBindingManifest as i}from"./bindingManifest.mjs";import{applySetupResult as a,mergeSetupResultDescriptors as o}from"./define/setupResult.mjs";import{runSetupFunction as s}from"./register/setup.mjs";import{createRuntimeComponentDefinition as c}from"./define/componentDefinition.mjs";import{resolveNativeInitialData as l}from"./define/initialComputed.mjs";import{resolveVueComponentOptions as u}from"./define/options.mjs";import{applyOptionsApiProvide as d,resolveOptionsApiInjections as f}from"./define/optionsApi.mjs";import{normalizeProps as p}from"./define/props.mjs";import{WEVU_BINDING_MANIFEST_KEY as m,WEVU_CSS_MODULES_KEY as h,WEVU_FUNCTION_PROP_PATHS_KEY as g,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as _,WEVU_SLOT_OWNER_ID_KEY as v,WEVU_SLOT_OWNER_ID_PROP as y,WEVU_SLOT_SCOPE_KEY as b}from"@weapp-core/constants";const x=/* @__PURE__ */ new WeakMap;function S(e,t){let r={...t??{}};if(!e||typeof e!=`object`)return r;for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&n(i,`value`)&&(r[t]=i.value);return r}function C(e,t){return Array.isArray(e?.pick)&&e.pick.includes(v)||t?.features?.scopedSlots===!0&&r(t,v)}function w(e){return!!e.__wevu_isPage}function T(e){let t=e.properties;return!!(t&&typeof t==`object`&&(y in t||b in t))}function E(e,t){return t?.strategy!==`patch`||!T(e)?t:{...t,strategy:`diff`}}function D(e,t=!1){let{lifecycleDefinition:n,runtimeApp:r}=c(e,t),i={__wevu_runtime:r,__wevu_options:e};return x.set(i,n),i}function O(e){return k(e,!0)}function k(n,r){let{__typeProps:c,[_]:y,data:b,computed:x,methods:T,setData:O,watch:k,setup:A,props:j,inject:M,provide:N,allowFunctionProps:P,[m]:F,[h]:I,...L}=u(e(n)),R=i(F),z=L[g],B=Array.isArray(z)?[...new Set(z.filter(e=>typeof e==`string`&&e.length>0))]:[];delete L[g];let V=E(L,P===!0?{...O??{},includeFunctions:!0,functionPaths:B}:P===!1?O:B.length?{...O??{},functionPaths:B}:O),H=new Set(B.filter(e=>!e.includes(`.`))),U=p(L,j,L.properties),W=S(U.properties,T),G=typeof b==`function`?()=>b.call(W):b,K=typeof A==`function`||M!=null||N!=null||I?((e,t)=>{I&&typeof I==`object`&&(t.instance[h]=I);let n=t?.proxy??t?.instance??Object.create(null),r=f(M,n);N!=null&&d(N,n);let i=typeof A==`function`?s(A,e,t):void 0,c=o({...r,...I??{}},i);return t&&Object.keys(c).length&&a(t.runtime,t.instance,c,{includeFunctionsInState:P===!0,functionPropPaths:P===!1?void 0:H}),c}):void 0,q=typeof G==`function`?G():G,J=q&&typeof q==`object`?Reflect.get(q,v):void 0,Y=C(V,R),X=Y?t(`scopedSlots`,`defineComponent(scoped-slot owner metadata)`):void 0,Z=Y?{...q&&typeof q==`object`?q:{},[v]:w(L)?J||X?.allocateOwnerId():J||``}:q,Q=l(Z,x,V,T),$=Q===void 0?U:{...U,data:Q};return D({scopedSlotOwnerRequired:y===!0,data:G,computed:x,methods:T,setData:V,bindingManifest:R,watch:k,setup:K,mpOptions:$},r)}function A(e){return k(e,!1)}function j(e){let t=e.__wevu_options;if(!t)throw TypeError(`无法从非 Wevu 组件定义创建独立运行时`);return D(t)}function M(e){return x.get(e)}function N(e){let t=e.allowNullPropInput??!0;O({...e,allowNullPropInput:t,__wevu_allowNullPropInput:t})}export{j as createIsolatedWevuComponentDefinition,N as createWevuComponent,A as createWevuComponentDefinition,O as defineComponent,M as getWevuComponentLifecycleDefinition};
1
+ import{applyWevuComponentDefaults as e}from"./defaults.mjs";import{requireRuntimeCapability as t}from"./capabilities.mjs";import{hasOwn as n}from"../utils.mjs";import{hasBindingOutputPath as r,resolveBindingManifest as i}from"./bindingManifest.mjs";import{applySetupResult as a,mergeSetupResultDescriptors as o}from"./define/setupResult.mjs";import{runSetupFunction as s}from"./register/setup.mjs";import{createRuntimeComponentDefinition as c}from"./define/componentDefinition.mjs";import{resolveNativeInitialData as l}from"./define/initialComputed.mjs";import{resolveVueComponentOptions as u}from"./define/options.mjs";import{applyOptionsApiProvide as d,resolveOptionsApiInjections as f}from"./define/optionsApi.mjs";import{normalizeProps as p}from"./define/props.mjs";import{WEVU_BINDING_MANIFEST_KEY as m,WEVU_CSS_MODULES_KEY as h,WEVU_FUNCTION_PROP_PATHS_KEY as g,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as _,WEVU_SLOT_OWNER_ID_KEY as v,WEVU_SLOT_OWNER_ID_PROP as y,WEVU_SLOT_SCOPE_KEY as b}from"@weapp-core/constants";const x=/* @__PURE__ */ new WeakMap;function S(e,t){let r={...t??{}};if(!e||typeof e!=`object`)return r;for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&n(i,`value`)&&(r[t]=i.value);return r}function C(e,t){return Array.isArray(e?.pick)&&e.pick.includes(v)||t?.features?.scopedSlots===!0&&r(t,v)}function w(e){return!!e.__wevu_isPage}function T(e){let t=e.properties;return!!(t&&typeof t==`object`&&(y in t||b in t))}function E(e,t){return t?.strategy!==`patch`||!T(e)?t:{...t,strategy:`diff`}}function D(e,t=!1){let{lifecycleDefinition:n,runtimeApp:r}=c(e,t),i={__wevu_runtime:r,__wevu_options:e};return x.set(i,n),i}function O(e){return k(e,!0)}function k(n,r){let{__typeProps:c,[_]:y,data:b,computed:x,methods:T,setData:O,watch:k,setup:A,props:j,inject:M,provide:N,allowFunctionProps:P,[m]:F,[h]:I,...L}=u(e(n)),R=i(F),z=L[g],B=Array.isArray(z)?[...new Set(z.filter(e=>typeof e==`string`&&e.length>0))]:[];delete L[g];let V=E(L,P===!0?{...O??{},includeFunctions:!0,functionPaths:B}:P===!1?O:B.length?{...O??{},functionPaths:B}:O),H=new Set(B.filter(e=>!e.includes(`.`))),U=p(L,j,L.properties),W=S(U.properties,T),G=typeof b==`function`?()=>b.call(W):b,K=typeof A==`function`||M!=null||N!=null||I?((e,t)=>{I&&typeof I==`object`&&(t.instance[h]=I);let n=t?.proxy??t?.instance??Object.create(null),r=f(M,n);N!=null&&d(N,n);let i=typeof A==`function`?s(A,e,t):void 0,c=o({...r,...I??{}},i);return t&&Object.keys(c).length&&a(t.runtime,t.instance,c,{includeFunctionsInState:P===!0,functionPropPaths:P===!1?void 0:H}),c}):void 0,q=typeof G==`function`?G():G,J=q&&typeof q==`object`?Reflect.get(q,v):void 0,Y=C(V,R),X=Y?t(`scopedSlots`,`defineComponent(scoped-slot owner metadata)`):void 0,Z=Y?{...q&&typeof q==`object`?q:{},[v]:w(L)?J||X?.allocateOwnerId():J||``}:q,Q=l(Z,x,V,T,R),$=Q===void 0?U:{...U,data:Q};return D({scopedSlotOwnerRequired:y===!0,data:G,computed:x,methods:T,setData:V,bindingManifest:R,watch:k,setup:K,mpOptions:$},r)}function A(e){return k(e,!1)}function j(e){let t=e.__wevu_options;if(!t)throw TypeError(`无法从非 Wevu 组件定义创建独立运行时`);return D(t)}function M(e){return x.get(e)}function N(e){let t=e.allowNullPropInput??!0;O({...e,allowNullPropInput:t,__wevu_allowNullPropInput:t})}export{j as createIsolatedWevuComponentDefinition,N as createWevuComponent,A as createWevuComponentDefinition,O as defineComponent,M as getWevuComponentLifecycleDefinition};
@@ -1 +1 @@
1
- import{toRaw as e}from"../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../reactivity/reactive.mjs";import{unref as r}from"../reactivity/ref.mjs";import{isNoSetData as i}from"./noSetData.mjs";import{hasOwn as a}from"../utils.mjs";import{hasTrackableSetupBinding as o}from"./setupTracking.mjs";function s(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function c(e,t){if(!e||!t)return!1;let n=t;for(;n;){if(e.has(n))return!0;let t=n.lastIndexOf(`.`);if(t<0)return!1;n=n.slice(0,t)}return!1}function l(a,s,u,d,f,p,m,h,g,_){let v=r(a);if(typeof v==`bigint`){let e=Number(v);return Number.isSafeInteger(e)?e:v.toString()}if(typeof v==`symbol`)return v.toString();if(typeof v==`function`)return h||c(g,_)?v:void 0;if(typeof v!=`object`||!v)return v;if(i(v))return;let y=n(v),b=y?e(v):v,x=!!d&&y;d&&!x&&(x=f?.get(b)??!o(b),f?.set(b,x));let S=x?d:void 0;if(p<=0||m.keys<=0)return b;if(S){let e=t(b),n=S.get(b);if(n&&n.version===e)return n.value}if(u.has(b))return;if(s.has(b))return s.get(b);if(b instanceof Date)return b.getTime();if(b instanceof RegExp)return b.toString();if(b instanceof Map){let e=[];return s.set(b,e),u.add(b),b.forEach((t,n)=>{e.push([l(n,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``),l(t,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``)])}),u.delete(b),e}if(b instanceof Set){let e=[];return s.set(b,e),u.add(b),b.forEach(t=>{e.push(l(t,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``))}),u.delete(b),e}if(typeof ArrayBuffer<`u`){if(b instanceof ArrayBuffer)return b.byteLength;if(ArrayBuffer.isView(b)){let e=b;if(typeof e[Symbol.iterator]==`function`){let t=[...e];return s.set(b,t),t.map(e=>l(e,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``))}let t=[...new Uint8Array(e.buffer,e.byteOffset,e.byteLength)];return s.set(b,t),t}}if(b instanceof Error)return{name:b.name,message:b.message};if(Array.isArray(b)){let e=[];s.set(b,e),u.add(b);let n=p-1;for(let t=0;t<b.length;t+=1){let r=_?`${_}.${t}`:String(t),i=l(b[t],s,u,d,f,n,m,h,g,r);e[t]=i===void 0?null:i}return u.delete(b),S&&S.set(b,{version:t(b),value:e}),e}let C={};s.set(b,C),u.add(b);let w=p-1;for(let e of Object.keys(b)){if(--m.keys,m.keys<=0)break;let t=_?`${_}.${e}`:e,n=l(b[e],s,u,d,f,w,m,h,g,t);n!==void 0&&(C[e]=n)}return u.delete(b),S&&S.set(b,{version:t(b),value:C}),C}function u(e,t=/* @__PURE__ */ new WeakMap,n){let r=n?._depth??(typeof n?.maxDepth==`number`?Math.max(0,Math.floor(n.maxDepth)):1/0),i=n?._budget??(typeof n?.maxKeys==`number`?{keys:Math.max(0,Math.floor(n.maxKeys))}:{keys:1/0}),a=Array.isArray(n?.functionPaths)&&n.functionPaths.length?new Set(n.functionPaths):void 0;return l(e,t,/* @__PURE__ */ new WeakSet,n?.cache,n?.cacheEligibility,r,i,!!n?.includeFunctions,a,n?._path??``)}function d(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function f(e,t,n){let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let i of r)if(!a(t,i)||!n(e[i],t[i]))return!1;return!0}function p(e,t){return Object.is(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?d(e,t,p):s(e)&&s(t)?f(e,t,p):!1}function m(e){return e===void 0?null:e}function h(e,t,n,r){if(!p(e,t)){if(s(e)&&s(t)){for(let i of Object.keys(t)){if(!a(e,i)){r[`${n}.${i}`]=m(t[i]);continue}h(e[i],t[i],`${n}.${i}`,r)}for(let i of Object.keys(e))a(t,i)||(r[`${n}.${i}`]=null);return}if(Array.isArray(e)&&Array.isArray(t)){d(e,t,p)||(r[n]=m(t));return}r[n]=m(t)}}function g(e,t,n){let r={},i=n?.skipKeys;for(let n of Object.keys(t))i?.has(n)||h(e[n],t[n],n,r);for(let n of Object.keys(e))i?.has(n)||a(t,n)||(r[n]=null);return r}export{g as diffSnapshots,u as toPlain};
1
+ import{toRaw as e}from"../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../reactivity/reactive.mjs";import{unref as r}from"../reactivity/ref.mjs";import{isNoSetData as i}from"./noSetData.mjs";import{hasOwn as a}from"../utils.mjs";import{hasTrackableSetupBinding as o}from"./setupTracking.mjs";function s(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function c(e,t){if(!e||!t)return!1;let n=t;for(;n;){if(e.has(n))return!0;let t=n.lastIndexOf(`.`);if(t<0)return!1;n=n.slice(0,t)}return!1}function l(a,s,u,d,f,p,m,h,g,_){let v=r(a);if(typeof v==`bigint`){let e=Number(v);return Number.isSafeInteger(e)?e:v.toString()}if(typeof v==`symbol`)return v.toString();if(typeof v==`function`)return h||c(g,_)?v:void 0;if(typeof v!=`object`||!v)return v;if(i(v))return;let y=n(v),b=y?e(v):v,x=!!d&&y;d&&!x&&(x=f?.get(b)??!o(b),f?.set(b,x));let S=x?d:void 0;if(p<=0||m.keys<=0)return b;if(S){let e=t(b),n=S.get(b);if(n&&n.version===e)return n.value}if(u.has(b))return;if(s.has(b))return s.get(b);if(b instanceof Date)return b.getTime();if(b instanceof RegExp)return b.toString();if(b instanceof Map){let e=[];return s.set(b,e),u.add(b),b.forEach((t,n)=>{e.push([l(n,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``),l(t,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``)])}),u.delete(b),e}if(b instanceof Set){let e=[];return s.set(b,e),u.add(b),b.forEach(t=>{e.push(l(t,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``))}),u.delete(b),e}if(typeof ArrayBuffer<`u`){if(b instanceof ArrayBuffer)return b.byteLength;if(ArrayBuffer.isView(b)){let e=b;if(typeof e[Symbol.iterator]==`function`){let t=[...e];return s.set(b,t),t.map(e=>l(e,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``))}let t=[...new Uint8Array(e.buffer,e.byteOffset,e.byteLength)];return s.set(b,t),t}}if(b instanceof Error)return{name:b.name,message:b.message};if(Array.isArray(b)){let e=[];s.set(b,e),u.add(b);let n=p-1;for(let t=0;t<b.length;t+=1){let r=_?`${_}.${t}`:String(t),i=l(b[t],s,u,d,f,n,m,h,g,r);e[t]=i===void 0?null:i}return u.delete(b),S&&S.set(b,{version:t(b),value:e}),e}let C={};s.set(b,C),u.add(b);let w=p-1;for(let e of Object.keys(b)){if(--m.keys,m.keys<=0)break;let t=_?`${_}.${e}`:e,n=l(b[e],s,u,d,f,w,m,h,g,t);n!==void 0&&(C[e]=n)}return u.delete(b),S&&S.set(b,{version:t(b),value:C}),C}function u(e,t=/* @__PURE__ */ new WeakMap,n){let r=n?._depth??(typeof n?.maxDepth==`number`?Math.max(0,Math.floor(n.maxDepth)):1/0),i=n?._budget??(typeof n?.maxKeys==`number`?{keys:Math.max(0,Math.floor(n.maxKeys))}:{keys:1/0}),a=Array.isArray(n?.functionPaths)&&n.functionPaths.length?new Set(n.functionPaths):void 0;return l(e,t,/* @__PURE__ */ new WeakSet,n?.cache,n?.cacheEligibility,r,i,!!n?.includeFunctions,a,n?._path??``)}function d(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function f(e,t,n){let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let i of r)if(!a(t,i)||!n(e[i],t[i]))return!1;return!0}function p(e,t){return Object.is(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?d(e,t,p):s(e)&&s(t)?f(e,t,p):!1}function m(e){return e===void 0?null:e}function h(e,t,n,r){if(!p(e,t)){if(s(e)&&s(t)){for(let i of Object.keys(t))a(e,i)?h(e[i],t[i],`${n}.${i}`,r):r[`${n}.${i}`]=m(t[i]);for(let i of Object.keys(e))a(t,i)||(r[`${n}.${i}`]=null)}else Array.isArray(e)&&Array.isArray(t)&&d(e,t,p)||(r[n]=m(t))}}function g(e,t,n){let r={},i=n?.skipKeys;for(let n of Object.keys(t))i?.has(n)||h(e[n],t[n],n,r);for(let n of Object.keys(e))i?.has(n)||a(t,n)||(r[n]=null);return r}export{g as diffSnapshots,u as toPlain};
@@ -1 +1 @@
1
- import{getCurrentMiniProgramPages as e}from"../platform.mjs";import{getCurrentInstance as t}from"../hooks/base.mjs";import{runtimeCapabilityRegistry as n}from"../capabilities.mjs";import{registerPageLayoutBridge as r,registerRuntimeLayoutHosts as i,resolveLayoutBridge as a,resolveLayoutHost as o,unregisterPageLayoutBridge as s,unregisterRuntimeLayoutHosts as c,useLayoutBridge as l,useLayoutHosts as u,waitForLayoutHost as d}from"../layoutBridge.mjs";import{getCurrentPageInstance as f}from"../register/component/lifecycle/platform.mjs";import{resolveRuntimePageLayoutName as p,setPageLayout as m,syncRuntimePageLayoutState as h,syncRuntimePageLayoutStateFromRuntime as g,usePageLayout as _}from"../pageLayout.mjs";import{installLayout as v}from"./layout.mjs";const y=(...e)=>(v(),r(...e)),b=(...e)=>(v(),s(...e)),x=(...e)=>(v(),a(...e)),S=(...e)=>(v(),o(...e)),C=(...e)=>(v(),d(...e)),w=(...e)=>(v(),l(...e)),T=(...e)=>(v(),i(...e)),E=(...e)=>(v(),c(...e)),D=(...e)=>(v(),u(...e)),O=(...e)=>(v(),_(...e));function k(r,i){v();let a=e(),o=t(),s=o&&typeof o.route==`string`&&o.route?o:f()??a[a.length-1];if(s&&n.layout?.attachPageSetter(s),r===!1){m(!1);return}m(r,i)}const A=(...e)=>(v(),h(...e)),j=(...e)=>(v(),g(...e)),M=(...e)=>(v(),p(...e));export{y as registerPageLayoutBridge,T as registerRuntimeLayoutHosts,x as resolveLayoutBridge,S as resolveLayoutHost,M as resolveRuntimePageLayoutName,k as setPageLayout,A as syncRuntimePageLayoutState,j as syncRuntimePageLayoutStateFromRuntime,b as unregisterPageLayoutBridge,E as unregisterRuntimeLayoutHosts,w as useLayoutBridge,D as useLayoutHosts,O as usePageLayout,C as waitForLayoutHost};
1
+ import{getCurrentMiniProgramPages as e}from"../platform.mjs";import{getCurrentInstance as t}from"../hooks/base.mjs";import{runtimeCapabilityRegistry as n}from"../capabilities.mjs";import{registerPageLayoutBridge as r,registerRuntimeLayoutHosts as i,resolveLayoutBridge as a,resolveLayoutHost as o,unregisterPageLayoutBridge as s,unregisterRuntimeLayoutHosts as c,useLayoutBridge as l,useLayoutHosts as u,waitForLayoutHost as d}from"../layoutBridge.mjs";import{getCurrentPageInstance as f}from"../register/component/lifecycle/platform.mjs";import{resolveRuntimePageLayoutName as p,setPageLayout as m,syncRuntimePageLayoutState as h,syncRuntimePageLayoutStateFromRuntime as g,usePageLayout as _}from"../pageLayout.mjs";import{installLayout as v}from"./layout.mjs";const y=(...e)=>(v(),r(...e)),b=(...e)=>(v(),s(...e)),x=(...e)=>(v(),a(...e)),S=(...e)=>(v(),o(...e)),C=(...e)=>(v(),d(...e)),w=(...e)=>(v(),l(...e)),T=(...e)=>(v(),i(...e)),E=(...e)=>(v(),c(...e)),D=(...e)=>(v(),u(...e)),O=(...e)=>(v(),_(...e));function k(r,i){v();let a=e(),o=t(),s=o&&typeof o.route==`string`&&o.route?o:f()??a[a.length-1];s&&n.layout?.attachPageSetter(s),r===!1?m(!1):m(r,i)}const A=(...e)=>(v(),h(...e)),j=(...e)=>(v(),g(...e)),M=(...e)=>(v(),p(...e));export{y as registerPageLayoutBridge,T as registerRuntimeLayoutHosts,x as resolveLayoutBridge,S as resolveLayoutHost,M as resolveRuntimePageLayoutName,k as setPageLayout,A as syncRuntimePageLayoutState,j as syncRuntimePageLayoutStateFromRuntime,b as unregisterPageLayoutBridge,E as unregisterRuntimeLayoutHosts,w as useLayoutBridge,D as useLayoutHosts,O as usePageLayout,C as waitForLayoutHost};
@@ -2,7 +2,7 @@ import { ComputedDefinitions } from "../types/core.mjs";
2
2
  import "../types.mjs";
3
3
  import { InlineExpressionMap } from "../register/inline.mjs";
4
4
  import { LayoutHostBinding, TemplateRefBinding } from "../capabilities.mjs";
5
- import { WEVU_BINDING_MANIFEST_KEY, WevuRuntimeBindingManifestV1 } from "@weapp-core/constants";
5
+ import { WEVU_BINDING_MANIFEST_KEY, WEVU_NATIVE_SLOT_CONTEXT_KEY, WevuRuntimeBindingManifestV1 } from "@weapp-core/constants";
6
6
  //#region src/runtime/features/scopedSlots.d.ts
7
7
  export interface CreateWevuScopedSlotComponentOptions {
8
8
  computed?: ComputedDefinitions;
@@ -10,6 +10,7 @@ export interface CreateWevuScopedSlotComponentOptions {
10
10
  layoutHosts?: LayoutHostBinding[];
11
11
  templateRefs?: TemplateRefBinding[];
12
12
  [WEVU_BINDING_MANIFEST_KEY]?: WevuRuntimeBindingManifestV1;
13
+ [WEVU_NATIVE_SLOT_CONTEXT_KEY]?: boolean;
13
14
  }
14
15
  /**
15
16
  * 创建编译器生成的作用域插槽组件。
@@ -1 +1 @@
1
- import{getCurrentMiniProgramGlobalObject as e,getCurrentMiniProgramRuntimeCapabilities as t}from"../platform/current.mjs";import{getMiniProgramRuntimeGlobalObject as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../platform.mjs";import{WEVU_CURRENT_SETUP_STATE_KEY as i,WEVU_HOOKS_KEY as a}from"@weapp-core/constants";const o=(()=>{let e=typeof globalThis<`u`?globalThis:n();return e?e[i]??(e[i]={}):{}})();function s(){return o.instance}function c(e){o.instance=e}function l(){return o.context}function u(e){o.context=e}function d(e){if(!o.instance)throw Error(`${e}() 必须在 setup() 的同步阶段调用`);return o.instance}function f(e){return e[a]||(e[a]=Object.create(null)),e[a]}function p(e,n){let r=t().shareTimelineRequiresShareAppMessage?e||n:e,i=[];return r&&i.push(`shareAppMessage`),n&&i.push(`shareTimeline`),i}function m(e,t){let n=[{withShareTicket:!0,menus:t},{menus:t},t.includes(`shareTimeline`)?{withShareTicket:!0}:void 0,t.includes(`shareTimeline`)?{}:void 0,void 0];for(let t of n)try{t===void 0?e():e(t);return}catch{}}function h(e,t,n,{single:r=!1}={}){let i=f(e);r?i[t]=n:(i[t]??(i[t]=[])).push(n)}function g(e,t){var n;let r=(n=e).__wevuShareHookBridges??(n.__wevuShareHookBridges=Object.create(null));if(typeof r[t]==`function`)return;let i=e[t],o=function(...e){let n=this[a]?.[t],r=this.__wevu?.proxy??this,o;if(typeof n==`function`)try{o=n.apply(r,e)}catch{o=void 0}else if(Array.isArray(n))for(let t of n)try{o=t.apply(r,e)}catch{}if(o!==void 0)return o;if(typeof i==`function`)return i.apply(this,e)};r[t]=o,e[t]=o}function _(t){if(!r(`pageShareMenu`))return;let n=e();if(!n||typeof n.showShareMenu!=`function`)return;let i=t[a]??{},o=typeof i.onShareAppMessage==`function`,s=typeof i.onShareTimeline==`function`;if(!o&&!s)return;let c=p(o,s);c.length&&m(n.showShareMenu.bind(n),c)}function v(e,t,n=[]){let r=e[a];if(!r)return;let i=r[t];if(!i)return;let o=e.__wevu?.proxy??e;if(Array.isArray(i))for(let e of i)try{e.apply(o,n)}catch{}else if(typeof i==`function`)try{i.apply(o,n)}catch{}}function y(e,t){var n;let r=(n=e).__wevuPageHookBridges??(n.__wevuPageHookBridges=Object.create(null));if(typeof r[t]==`function`)return;let i=e[t],a=function(...e){if(v(this,t,e),typeof i==`function`)return i.apply(this,e)};r[t]=a,e[t]=a}function b(e,t,n=[]){let r=e[a];if(!r)return;let i=r[t];if(!i)return;let o=e.__wevu?.proxy??e;if(typeof i==`function`)try{return i.apply(o,n)}catch{return}if(Array.isArray(i)){let e;for(let t of i)try{e=t.apply(o,n)}catch{}return e}}export{d as assertInSetup,v as callHookList,b as callHookReturn,y as ensurePageHookOnInstance,_ as ensurePageShareMenusOnSetup,g as ensureSinglePageHookOnInstance,s as getCurrentInstance,l as getCurrentSetupContext,h as pushHook,c as setCurrentInstance,u as setCurrentSetupContext};
1
+ import{getCurrentMiniProgramGlobalObject as e,getCurrentMiniProgramRuntimeCapabilities as t}from"../platform/current.mjs";import{getMiniProgramRuntimeGlobalObject as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../platform.mjs";import{WEVU_CURRENT_SETUP_STATE_KEY as i,WEVU_HOOKS_KEY as a}from"@weapp-core/constants";const o=(()=>{let e=typeof globalThis<`u`?globalThis:n();return e?e[i]??(e[i]={}):{}})();function s(){return o.instance}function c(e){o.instance=e}function l(){return o.context}function u(e){o.context=e}function d(e){if(!o.instance)throw Error(`${e}() 必须在 setup() 的同步阶段调用`);return o.instance}function f(e){return e[a]||(e[a]=Object.create(null)),e[a]}function p(e,n){let r=t().shareTimelineRequiresShareAppMessage?e||n:e,i=[];return r&&i.push(`shareAppMessage`),n&&i.push(`shareTimeline`),i}function m(e,t){let n=[{withShareTicket:!0,menus:t},{menus:t},t.includes(`shareTimeline`)?{withShareTicket:!0}:void 0,t.includes(`shareTimeline`)?{}:void 0,void 0];for(let t of n)try{t===void 0?e():e(t);return}catch{}}function h(e,t,n,{single:r=!1}={}){let i=f(e);r?i[t]=n:(i[t]??(i[t]=[])).push(n)}function g(e,t){var n;let r=(n=e).__wevuShareHookBridges??(n.__wevuShareHookBridges=Object.create(null));if(typeof r[t]==`function`)return;let i=e[t],o=function(...e){let n=this[a]?.[t],r=this.__wevu?.proxy??this,o;if(typeof n==`function`)try{o=n.apply(r,e)}catch{o=void 0}else if(Array.isArray(n))for(let t of n)try{o=t.apply(r,e)}catch{}if(o!==void 0)return o;if(typeof i==`function`)return i.apply(this,e)};r[t]=o,e[t]=o}function _(t){if(!r(`pageShareMenu`))return;let n=e();if(!n||typeof n.showShareMenu!=`function`)return;let i=t[a]??{},o=typeof i.onShareAppMessage==`function`,s=typeof i.onShareTimeline==`function`;if(!o&&!s)return;let c=p(o,s);c.length&&m(n.showShareMenu.bind(n),c)}function v(e,t,n=[]){let r=e[a];if(!r)return;let i=r[t];if(!i)return;let o=e.__wevu?.proxy??e;if(Array.isArray(i))for(let e of i)try{e.apply(o,n)}catch{}else if(typeof i==`function`)try{i.apply(o,n)}catch{}}function y(e,t,n=[]){let r=e[a];if(!r)return;let i=r[t];if(!i)return;let o=e.__wevu?.proxy??e;if(typeof i==`function`)try{return i.apply(o,n)}catch{return}if(Array.isArray(i)){let e;for(let t of i)try{e=t.apply(o,n)}catch{}return e}}export{d as assertInSetup,v as callHookList,y as callHookReturn,_ as ensurePageShareMenusOnSetup,g as ensureSinglePageHookOnInstance,s as getCurrentInstance,l as getCurrentSetupContext,h as pushHook,c as setCurrentInstance,u as setCurrentSetupContext};
@@ -0,0 +1 @@
1
+ import{callHookList as e}from"./base.mjs";import{WEVU_PAGE_HOOK_BRIDGES_KEY as t,WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY as n,WEVU_PAGE_SCROLL_OBSERVERS_KEY as r}from"@weapp-core/constants";function i(e,t){let r=e,i=Number(r[n]??0);r[n]=i+1;try{return t()}finally{i===0?delete r[n]:r[n]=i}}function a(t,a,o){let s=Number(t[n]??0)>0;return i(t,()=>(s||(e(t,r,a),e(t,`onPageScroll`,a)),o?.apply(t,a)))}function o(e,n){let r=e,i=r[t]??(r[t]={});if(typeof i[n]==`function`)return;let o=r[n],s=function(...e){return a(this,e,o)};i[n]=s,r[n]=s}export{a as callPageScrollHooks,o as ensurePageHookOnInstance,i as runInPageScrollHook};
@@ -1 +1 @@
1
- import{assertInSetup as e,ensurePageHookOnInstance as t,ensurePageShareMenusOnSetup as n,ensureSinglePageHookOnInstance as r,pushHook as i}from"./base.mjs";function a(t,n,r){i(e(t),t,n,r)}function o(e){a(`onLaunch`,e)}function s(e){a(`onPageNotFound`,e)}function c(e){a(`onUnhandledRejection`,e)}function l(e){a(`onThemeChange`,e)}function u(e){a(`onMemoryWarning`,e)}function d(e){a(`onShow`,e)}function f(e){a(`onLoad`,e)}function p(e){a(`onHide`,e)}function m(e){a(`onUnload`,e)}function h(e){a(`onReady`,e)}function g(e){a(`onPullDownRefresh`,e)}function _(e){a(`onReachBottom`,e)}function v(n){let r=e(`onPageScroll`);i(r,`onPageScroll`,n),t(r,`onPageScroll`)}function y(e){a(`onRouteDone`,e)}function b(e){a(`onTabItemTap`,e)}function x(e){a(`onResize`,e)}function S(e){a(`onMoved`,e)}function C(e){a(`onAttached`,e)}function w(e){a(`onDetached`,e)}function T(e){a(`onError`,e)}function E(e){a(`onSaveExitState`,e,{single:!0})}function D(t){let a=e(`onShareAppMessage`);i(a,`onShareAppMessage`,t,{single:!0}),r(a,`onShareAppMessage`),n(a)}function O(t){let a=e(`onShareTimeline`);i(a,`onShareTimeline`,t,{single:!0}),r(a,`onShareTimeline`),n(a)}function k(t){let n=e(`onAddToFavorites`);i(n,`onAddToFavorites`,t,{single:!0}),r(n,`onAddToFavorites`)}export{k as onAddToFavorites,C as onAttached,w as onDetached,T as onError,p as onHide,o as onLaunch,f as onLoad,u as onMemoryWarning,S as onMoved,s as onPageNotFound,v as onPageScroll,g as onPullDownRefresh,_ as onReachBottom,h as onReady,x as onResize,y as onRouteDone,E as onSaveExitState,D as onShareAppMessage,O as onShareTimeline,d as onShow,b as onTabItemTap,l as onThemeChange,c as onUnhandledRejection,m as onUnload};
1
+ import{assertInSetup as e,ensurePageShareMenusOnSetup as t,ensureSinglePageHookOnInstance as n,pushHook as r}from"./base.mjs";import{ensurePageHookOnInstance as i}from"./pageScroll.mjs";function a(t,n,i){r(e(t),t,n,i)}function o(e){a(`onLaunch`,e)}function s(e){a(`onPageNotFound`,e)}function c(e){a(`onUnhandledRejection`,e)}function l(e){a(`onThemeChange`,e)}function u(e){a(`onMemoryWarning`,e)}function d(e){a(`onShow`,e)}function f(e){a(`onLoad`,e)}function p(e){a(`onHide`,e)}function m(e){a(`onUnload`,e)}function h(e){a(`onReady`,e)}function g(e){a(`onPullDownRefresh`,e)}function _(e){a(`onReachBottom`,e)}function v(t){let n=e(`onPageScroll`);r(n,`onPageScroll`,t),i(n,`onPageScroll`)}function y(e){a(`onRouteDone`,e)}function b(e){a(`onTabItemTap`,e)}function x(e){a(`onResize`,e)}function S(e){a(`onMoved`,e)}function C(e){a(`onAttached`,e)}function w(e){a(`onDetached`,e)}function T(e){a(`onError`,e)}function E(e){a(`onSaveExitState`,e,{single:!0})}function D(i){let a=e(`onShareAppMessage`);r(a,`onShareAppMessage`,i,{single:!0}),n(a,`onShareAppMessage`),t(a)}function O(i){let a=e(`onShareTimeline`);r(a,`onShareTimeline`,i,{single:!0}),n(a,`onShareTimeline`),t(a)}function k(t){let i=e(`onAddToFavorites`);r(i,`onAddToFavorites`,t,{single:!0}),n(i,`onAddToFavorites`)}export{k as onAddToFavorites,C as onAttached,w as onDetached,T as onError,p as onHide,o as onLaunch,f as onLoad,u as onMemoryWarning,S as onMoved,s as onPageNotFound,v as onPageScroll,g as onPullDownRefresh,_ as onReachBottom,h as onReady,x as onResize,y as onRouteDone,E as onSaveExitState,D as onShareAppMessage,O as onShareTimeline,d as onShow,b as onTabItemTap,l as onThemeChange,c as onUnhandledRejection,m as onUnload};
@@ -1 +1 @@
1
- import{WEVU_JSX_ISLAND_HANDLER_MAP_KEY as e}from"@weapp-core/constants";const t=Symbol.for(`wevu.jsx.fragment`);function n(e,t,n){return{type:e,props:t,children:n}}function r(e){return{type:`text`,props:null,children:String(e??``)}}function i(e){return!!e&&typeof e==`object`&&`type`in e}function a(...e){let t={};for(let n of e)if(n)for(let[e,r]of Object.entries(n))e===`class`&&t.class?t.class=[t.class,r]:e===`style`&&t.style?t.style=[t.style,r]:t[e]=r;return t}function o(e){let t={};for(let[n,r]of Object.entries(e))t[`on${n.charAt(0).toUpperCase()}${n.slice(1)}`]=r;return t}function s(e){return e}const c=`show`,l=`model-text`,u=`model-checkbox`,d=`model-radio`,f=`model-select`;function p(e,t){let n={...e.props??{}};for(let e of t){if(!Array.isArray(e))continue;let[t,r,i]=e;if(t===`show`){n.hidden=!r;continue}if(t===`model-text`||t===`model-checkbox`||t===`model-radio`||t===`model-select`){let e=typeof i==`string`&&i?i:`modelValue`,a=n[`onUpdate:${e}`];if(n[e===`modelValue`?`value`:e]=r,typeof a==`function`){let e=t===`model-text`?`onInput`:`onChange`;n[e]=e=>a(e?.detail?.value??e?.detail)}}}return{...e,props:n}}function m(e){return e}function h(e){if(/^on[A-Z]/.test(e))return e.slice(2).toLowerCase()}function g(t){let n=t?.[e];if(n&&typeof n==`object`)return n;let r=Object.create(null);return t&&(typeof t==`object`||typeof t==`function`)&&Object.defineProperty(t,e,{value:r,configurable:!0,writable:!0}),r}function _(e,t,n,r,a){let o=typeof e==`function`?e():e;if(o==null||o===!1||o===!0)return[];if(Array.isArray(o)){let e=[];for(let i of o)e.push(..._(i,t,n,r,a));return e}if(typeof o==`object`&&!i(o))return _(o.default,t,n,r,a);let s=v(o,t,n,r,a);return s?[s]:[]}function v(e,n,r,a,o){if(e==null||e===!1||e===!0)return;if(Array.isArray(e))return{kind:`fragment`,children:_(e,n,r,a,o)};if(typeof e==`string`||typeof e==`number`||!i(e))return{kind:`text`,text:String(e)};if(e.type===t)return{kind:`fragment`,children:_(e.children,n,r,a,o)};if(e.type===`text`)return{kind:`text`,text:String(e.children??``)};if(typeof e.type==`function`)return v(e.type(e.props??{},e.children),n,r,a,o);if(e.type&&typeof e.type==`object`&&typeof e.type.render==`function`)return v(e.type.render.call(e.props??{}),n,r,a,o);let s=typeof e.type==`string`?e.type:void 0;if(!s)return;let c={},l={},u=g(n);for(let[t,n]of Object.entries(e.props??{})){let e=h(t);if(e&&typeof n==`function`){let t=`${r}:${a.value++}`;u[t]=n,l[e]=t;continue}typeof n!=`function`&&n!==void 0&&(t===`class`||t===`className`?c.class=o.normalizeClass(n):t===`style`?c.style=o.normalizeStyle(n):c[t]=n)}return{kind:`element`,tag:s,props:c,events:l,children:_(e.children,n,r,a,o)}}function y(e,t,n){let r=g(this);for(let e of Object.keys(r))e.startsWith(`${t}:`)&&delete r[e];return v(e,this,t,{value:0},n)??null}function b(t,n){let r=n?.currentTarget?.dataset?.wvJsxHandler??n?.target?.dataset?.wvJsxHandler;if(typeof r!=`string`||!r)return;let i=t?.__wevu,a=(t?.[e]??i?.proxy?.[e])?.[r];return typeof a==`function`?a.call(i?.proxy??t,n):void 0}export{t as Fragment,r as createTextVNode,n as createVNode,i as isVNode,a as mergeProps,y as normalizeJsxIsland,s as resolveComponent,m as resolveDirective,b as runJsxIslandHandler,o as transformOn,u as vModelCheckbox,d as vModelRadio,f as vModelSelect,l as vModelText,c as vShow,p as withDirectives};
1
+ import{WEVU_JSX_ISLAND_HANDLER_MAP_KEY as e}from"@weapp-core/constants";const t=Symbol.for(`wevu.jsx.fragment`);function n(e,t,n){return{type:e,props:t,children:n}}function r(e){return{type:`text`,props:null,children:String(e??``)}}function i(e){return!!e&&typeof e==`object`&&`type`in e}function a(...e){let t={};for(let n of e)if(n)for(let[e,r]of Object.entries(n))e===`class`&&t.class?t.class=[t.class,r]:e===`style`&&t.style?t.style=[t.style,r]:t[e]=r;return t}function o(e){let t={};for(let[n,r]of Object.entries(e))t[`on${n.charAt(0).toUpperCase()}${n.slice(1)}`]=r;return t}function s(e){return e}const c=`show`,l=`model-text`,u=`model-checkbox`,d=`model-radio`,f=`model-select`;function p(e,t){let n={...e.props??{}};for(let e of t){if(!Array.isArray(e))continue;let[t,r,i]=e;if(t===`show`)n.hidden=!r;else if(t===`model-text`||t===`model-checkbox`||t===`model-radio`||t===`model-select`){let e=typeof i==`string`&&i?i:`modelValue`,a=n[`onUpdate:${e}`];if(n[e===`modelValue`?`value`:e]=r,typeof a==`function`){let e=t===`model-text`?`onInput`:`onChange`;n[e]=e=>a(e?.detail?.value??e?.detail)}}}return{...e,props:n}}function m(e){return e}function h(e){if(/^on[A-Z]/.test(e))return e.slice(2).toLowerCase()}function g(t){let n=t?.[e];if(n&&typeof n==`object`)return n;let r=Object.create(null);return t&&(typeof t==`object`||typeof t==`function`)&&Object.defineProperty(t,e,{value:r,configurable:!0,writable:!0}),r}function _(e,t,n,r,a){let o=typeof e==`function`?e():e;if(o==null||o===!1||o===!0)return[];if(Array.isArray(o)){let e=[];for(let i of o)e.push(..._(i,t,n,r,a));return e}if(typeof o==`object`&&!i(o))return _(o.default,t,n,r,a);let s=v(o,t,n,r,a);return s?[s]:[]}function v(e,n,r,a,o){if(e==null||e===!1||e===!0)return;if(Array.isArray(e))return{kind:`fragment`,children:_(e,n,r,a,o)};if(typeof e==`string`||typeof e==`number`||!i(e))return{kind:`text`,text:String(e)};if(e.type===t)return{kind:`fragment`,children:_(e.children,n,r,a,o)};if(e.type===`text`)return{kind:`text`,text:String(e.children??``)};if(typeof e.type==`function`)return v(e.type(e.props??{},e.children),n,r,a,o);if(e.type&&typeof e.type==`object`&&typeof e.type.render==`function`)return v(e.type.render.call(e.props??{}),n,r,a,o);let s=typeof e.type==`string`?e.type:void 0;if(!s)return;let c={},l={},u=g(n);for(let[t,n]of Object.entries(e.props??{})){let e=h(t);if(e&&typeof n==`function`){let t=`${r}:${a.value++}`;u[t]=n,l[e]=t}else typeof n!=`function`&&n!==void 0&&(t===`class`||t===`className`?c.class=o.normalizeClass(n):t===`style`?c.style=o.normalizeStyle(n):c[t]=n)}return{kind:`element`,tag:s,props:c,events:l,children:_(e.children,n,r,a,o)}}function y(e,t,n){let r=g(this);for(let e of Object.keys(r))e.startsWith(`${t}:`)&&delete r[e];return v(e,this,t,{value:0},n)??null}function b(t,n){let r=n?.currentTarget?.dataset?.wvJsxHandler??n?.target?.dataset?.wvJsxHandler;if(typeof r!=`string`||!r)return;let i=t?.__wevu,a=(t?.[e]??i?.proxy?.[e])?.[r];return typeof a==`function`?a.call(i?.proxy??t,n):void 0}export{t as Fragment,r as createTextVNode,n as createVNode,i as isVNode,a as mergeProps,y as normalizeJsxIsland,s as resolveComponent,m as resolveDirective,b as runJsxIslandHandler,o as transformOn,u as vModelCheckbox,d as vModelRadio,f as vModelSelect,l as vModelText,c as vShow,p as withDirectives};
@@ -1 +1 @@
1
- import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"./platform.mjs";import{getCurrentInstance as r,getCurrentSetupContext as i}from"./hooks/base.mjs";import{getCurrentPageInstance as a}from"./register/component/lifecycle/platform.mjs";import{WEVU_PAGE_LAYOUT_NAME_KEY as o,WEVU_PAGE_LAYOUT_NONE as s,WEVU_PAGE_LAYOUT_PROPS_KEY as c,WEVU_PAGE_LAYOUT_SETTER_KEY as l}from"@weapp-core/constants";function u(){let e=a();if(e)return e;let t=n();return t[t.length-1]}function d(e){return e!==s&&e}function f(){if(!i())throw Error(`usePageLayout() 必须在 setup() 的同步阶段调用`);let n=r(),a=n?.__wevu?.state,s=e({name:d(a?.[o]),props:{...a?.[c]??{}}});return n&&(n.__wevuPageLayoutState=s),t(s)}function p(e,t,n){let r=e.__wevuPageLayoutState;r&&(r.name=t,r.props={...n})}function m(e){let t=e.__wevuPageLayoutState,n=e.__wevu?.state;t&&n&&(t.name=d(n[o]),t.props={...n[c]??{}})}function h(e,t){let n=r()?.[l];if(typeof n==`function`){n(e,t);return}let i=u()?.[l];if(typeof i==`function`){i(e,t);return}throw Error(`setPageLayout() 未找到当前页面实例。请在页面 setup()、事件回调或当前页面上下文中调用。`)}function g(e){return e===!1?s:e}export{g as resolveRuntimePageLayoutName,h as setPageLayout,p as syncRuntimePageLayoutState,m as syncRuntimePageLayoutStateFromRuntime,f as usePageLayout};
1
+ import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"./platform.mjs";import{getCurrentInstance as r,getCurrentSetupContext as i}from"./hooks/base.mjs";import{getCurrentPageInstance as a}from"./register/component/lifecycle/platform.mjs";import{WEVU_PAGE_LAYOUT_NAME_KEY as o,WEVU_PAGE_LAYOUT_NONE as s,WEVU_PAGE_LAYOUT_PROPS_KEY as c,WEVU_PAGE_LAYOUT_SETTER_KEY as l}from"@weapp-core/constants";function u(){let e=a();if(e)return e;let t=n();return t[t.length-1]}function d(e){return e!==s&&e}function f(){if(!i())throw Error(`usePageLayout() 必须在 setup() 的同步阶段调用`);let n=r(),a=n?.__wevu?.state,s=e({name:d(a?.[o]),props:{...a?.[c]??{}}});return n&&(n.__wevuPageLayoutState=s),t(s)}function p(e,t,n){let r=e.__wevuPageLayoutState;r&&(r.name=t,r.props={...n})}function m(e){let t=e.__wevuPageLayoutState,n=e.__wevu?.state;t&&n&&(t.name=d(n[o]),t.props={...n[c]??{}})}function h(e,t){let n=r()?.[l];if(typeof n==`function`){n(e,t);return}let i=u()?.[l];if(typeof i==`function`)i(e,t);else throw Error(`setPageLayout() 未找到当前页面实例。请在页面 setup()、事件回调或当前页面上下文中调用。`)}function g(e){return e===!1?s:e}export{g as resolveRuntimePageLayoutName,h as setPageLayout,p as syncRuntimePageLayoutState,m as syncRuntimePageLayoutStateFromRuntime,f as usePageLayout};
@@ -1 +1 @@
1
- import{getCurrentInstance as e}from"./hooks/base.mjs";import{onDetached as t,onPageScroll as n,onUnload as r}from"./hooks/register.mjs";function i(e){return typeof e!=`number`||!Number.isFinite(e)?80:Math.max(0,e)}function a(e){if(typeof e==`number`&&Number.isFinite(e))return Math.max(0,e)}function o(o,s={}){if(!e())throw Error(`usePageScrollThrottle() 必须在 setup() 的同步阶段调用`);if(typeof o!=`function`)throw TypeError(`usePageScrollThrottle() 需要传入回调函数`);let c=i(s.interval),l=s.leading??!0,u=s.trailing??!0,d=a(s.maxWait),f,p,m=!1,h=0,g,_=()=>{f&&(clearTimeout(f),f=void 0)},v=()=>{p&&(clearTimeout(p),p=void 0)},y=e=>{_(),v(),g=void 0,h=Date.now(),o(e)},b=()=>{let e=g;g=void 0,f=void 0,e&&!m&&y(e)},x=()=>{let e=g;p=void 0,e&&!m&&y(e)},S=e=>{if(!u||f)return;let t=Math.max(0,c-(e-(h===0?e:h)));f=setTimeout(b,t)},C=e=>{if(typeof d!=`number`||p)return;let t=d-(e-(h===0?e:h));if(t<=0){x();return}p=setTimeout(x,t)};n(e=>{if(m)return;if(c===0){y(e);return}let t=Date.now();if(g=e,l&&(h===0||t-h>=c)){y(e);return}if(typeof d==`number`&&t-(h===0?t:h)>=d){y(e);return}(u||typeof d==`number`)&&(S(t),C(t))});let w=()=>{m||(m=!0,g=void 0,_(),v())};return r(w),t(w),w}export{o as usePageScrollThrottle};
1
+ import{getCurrentInstance as e}from"./hooks/base.mjs";import{onDetached as t,onPageScroll as n,onUnload as r}from"./hooks/register.mjs";function i(e){return typeof e!=`number`||!Number.isFinite(e)?80:Math.max(0,e)}function a(e){if(typeof e==`number`&&Number.isFinite(e))return Math.max(0,e)}function o(o,s={}){if(!e())throw Error(`usePageScrollThrottle() 必须在 setup() 的同步阶段调用`);if(typeof o!=`function`)throw TypeError(`usePageScrollThrottle() 需要传入回调函数`);let c=i(s.interval),l=s.leading??!0,u=s.trailing??!0,d=a(s.maxWait),f,p,m=!1,h=0,g,_=()=>{f&&(clearTimeout(f),f=void 0)},v=()=>{p&&(clearTimeout(p),p=void 0)},y=e=>{_(),v(),g=void 0,h=Date.now(),o(e)},b=()=>{let e=g;g=void 0,f=void 0,e&&!m&&y(e)},x=()=>{let e=g;p=void 0,e&&!m&&y(e)},S=e=>{if(!u||f)return;let t=Math.max(0,c-(e-(h===0?e:h)));f=setTimeout(b,t)},C=e=>{if(typeof d!=`number`||p)return;let t=d-(e-(h===0?e:h));t<=0?x():p=setTimeout(x,t)};n(e=>{if(m)return;if(c===0){y(e);return}let t=Date.now();g=e,l&&(h===0||t-h>=c)||typeof d==`number`&&t-(h===0?t:h)>=d?y(e):(u||typeof d==`number`)&&(S(t),C(t))});let w=()=>{m||(m=!0,g=void 0,_(),v())};return r(w),t(w),w}export{o as usePageScrollThrottle};
@@ -1 +1 @@
1
- import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{createAlipayComponentDefinition as t}from"./alipay.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as n}from"@weapp-core/constants";function r(e){let{lifetimes:t={},methods:n={},observers:r,options:i,pageLifetimes:a={},properties:o,...s}=e,c=s.onLoad;return{...s,...n,onLoad(...e){this.options=e[0]&&typeof e[0]==`object`?e[0]:{},t.created?.apply(this,e);let n=c?.apply(this,e);return t.attached?.apply(this,e),n},onShow(...e){return a.show?.apply(this,e)},onReady(...e){return t.ready?.apply(this,e)},onHide(...e){return a.hide?.apply(this,e)},onResize(...e){return a.resize?.apply(this,e)},onUnload(...e){return t.detached?.apply(this,e)},onError(...e){return t.error?.apply(this,e)}}}function i(i,a){let o=e()?.[n];if(a){let e=r(i);if(typeof o?.Page==`function`){o.Page(e);return}Page(e);return}let s=t(i);if(typeof o?.Component==`function`){o.Component(s);return}Component(s)}export{i as registerAlipayComponentDefinition};
1
+ import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{createAlipayComponentDefinition as t}from"./alipay.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as n}from"@weapp-core/constants";function r(e){let{lifetimes:t={},methods:n={},observers:r,options:i,pageLifetimes:a={},properties:o,...s}=e,c=s.onLoad;return{...s,...n,onLoad(...e){this.options=e[0]&&typeof e[0]==`object`?e[0]:{},t.created?.apply(this,e);let n=c?.apply(this,e);return t.attached?.apply(this,e),n},onShow(...e){return a.show?.apply(this,e)},onReady(...e){return t.ready?.apply(this,e)},onHide(...e){return a.hide?.apply(this,e)},onResize(...e){return a.resize?.apply(this,e)},onUnload(...e){return t.detached?.apply(this,e)},onError(...e){return t.error?.apply(this,e)}}}function i(i,a){let o=e()?.[n];if(a){let e=r(i);if(typeof o?.Page==`function`){o.Page(e);return}Page(e);return}let s=t(i);typeof o?.Component==`function`?o.Component(s):Component(s)}export{i as registerAlipayComponentDefinition};
@@ -1 +1 @@
1
- import{callHookList as e,callHookReturn as t}from"../../../hooks/base.mjs";import{runInPageScrollHook as n}from"./platform.mjs";import{WEVU_ROUTE_DONE_CALLED_KEY as r,WEVU_ROUTE_DONE_IN_TICK_KEY as i}from"@weapp-core/constants";function a(a,o){let{enableOnSaveExitState:s,enableOnPullDownRefresh:c,enableOnReachBottom:l,enableOnPageScroll:u,enableOnRouteDone:d,enableOnTabItemTap:f,enableOnResize:p,enableOnShareAppMessage:m,enableOnShareTimeline:h,enableOnAddToFavorites:g,effectiveOnSaveExitState:_,effectiveOnPullDownRefresh:v,effectiveOnReachBottom:y,effectiveOnPageScroll:b,effectiveOnRouteDone:x,effectiveOnTabItemTap:S,effectiveOnResize:C,effectiveOnShareAppMessage:w,effectiveOnShareTimeline:T,effectiveOnAddToFavorites:E,hasHook:D}=o;s&&(a.onSaveExitState=function(...e){let n=t(this,`onSaveExitState`,e);return n===void 0?_.apply(this,e):n}),c&&(a.onPullDownRefresh=function(...t){if(e(this,`onPullDownRefresh`,t),!D(this,`onPullDownRefresh`))return v.apply(this,t)}),l&&(a.onReachBottom=function(...t){if(e(this,`onReachBottom`,t),!D(this,`onReachBottom`))return y.apply(this,t)}),u&&(a.onPageScroll=function(...t){return n(this,()=>{if(e(this,`onPageScroll`,t),!D(this,`onPageScroll`))return b.apply(this,t)})}),d&&(a.onRouteDone=function(...t){if(!this[i]&&(this[i]=!0,Promise.resolve().then(()=>{this[i]=!1}),this[r]=!0,e(this,`onRouteDone`,t),!D(this,`onRouteDone`)))return x.apply(this,t)}),f&&(a.onTabItemTap=function(...t){if(e(this,`onTabItemTap`,t),!D(this,`onTabItemTap`))return S.apply(this,t)}),p&&(a.onResize=function(...t){if(e(this,`onResize`,t),!D(this,`onResize`))return C.apply(this,t)}),m&&(a.onShareAppMessage=function(...e){let n=t(this,`onShareAppMessage`,e);return n===void 0?w.apply(this,e):n}),h&&(a.onShareTimeline=function(...e){let n=t(this,`onShareTimeline`,e);return n===void 0?T.apply(this,e):n}),g&&(a.onAddToFavorites=function(...e){let n=t(this,`onAddToFavorites`,e);return n===void 0?E.apply(this,e):n})}export{a as attachOptionalPageLifecycleHooks};
1
+ import{callHookList as e,callHookReturn as t}from"../../../hooks/base.mjs";import{callPageScrollHooks as n}from"../../../hooks/pageScroll.mjs";import{WEVU_ROUTE_DONE_CALLED_KEY as r,WEVU_ROUTE_DONE_IN_TICK_KEY as i}from"@weapp-core/constants";function a(a,o){let{enableOnSaveExitState:s,enableOnPullDownRefresh:c,enableOnReachBottom:l,enableOnPageScroll:u,enableOnRouteDone:d,enableOnTabItemTap:f,enableOnResize:p,enableOnShareAppMessage:m,enableOnShareTimeline:h,enableOnAddToFavorites:g,effectiveOnSaveExitState:_,effectiveOnPullDownRefresh:v,effectiveOnReachBottom:y,effectiveOnPageScroll:b,effectiveOnRouteDone:x,effectiveOnTabItemTap:S,effectiveOnResize:C,effectiveOnShareAppMessage:w,effectiveOnShareTimeline:T,effectiveOnAddToFavorites:E,hasHook:D}=o;s&&(a.onSaveExitState=function(...e){let n=t(this,`onSaveExitState`,e);return n===void 0?_.apply(this,e):n}),c&&(a.onPullDownRefresh=function(...t){if(e(this,`onPullDownRefresh`,t),!D(this,`onPullDownRefresh`))return v.apply(this,t)}),l&&(a.onReachBottom=function(...t){if(e(this,`onReachBottom`,t),!D(this,`onReachBottom`))return y.apply(this,t)}),u&&(a.onPageScroll=function(...e){return n(this,e,D(this,`onPageScroll`)?void 0:b)}),d&&(a.onRouteDone=function(...t){if(!this[i]&&(this[i]=!0,Promise.resolve().then(()=>{this[i]=!1}),this[r]=!0,e(this,`onRouteDone`,t),!D(this,`onRouteDone`)))return x.apply(this,t)}),f&&(a.onTabItemTap=function(...t){if(e(this,`onTabItemTap`,t),!D(this,`onTabItemTap`))return S.apply(this,t)}),p&&(a.onResize=function(...t){if(e(this,`onResize`,t),!D(this,`onResize`))return C.apply(this,t)}),m&&(a.onShareAppMessage=function(...e){let n=t(this,`onShareAppMessage`,e);return n===void 0?w.apply(this,e):n}),h&&(a.onShareTimeline=function(...e){let n=t(this,`onShareTimeline`,e);return n===void 0?T.apply(this,e):n}),g&&(a.onAddToFavorites=function(...e){let n=t(this,`onAddToFavorites`,e);return n===void 0?E.apply(this,e):n})}export{a as attachOptionalPageLifecycleHooks};
@@ -1 +1 @@
1
- import{getCurrentMiniProgramGlobalObject as e,getCurrentMiniProgramRuntimeCapabilities as t}from"../../../platform/current.mjs";import{getCurrentMiniProgramPages as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../../../platform.mjs";import{callHookList as i}from"../../../hooks/base.mjs";import{WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY as a}from"@weapp-core/constants";let o=!1,s;function c(){return s}function l(e){s=e}function u(e){s===e&&(s=void 0)}function d(e,t){let n=Number(e[a]??0);e[a]=n+1;try{return t()}finally{let t=Number(e[a]??1)-1;t<=0?delete e[a]:e[a]=t}}function f(e){let t=e.options;if(t&&typeof t==`object`)return t;let r=n(),i=r[r.length-1],a=i&&typeof i==`object`?i.options:void 0;return a&&typeof a==`object`?a:{}}function p(){if(o)return;o=!0;let t=e();if(t&&typeof t==`object`){if(r(`pullDownRefreshApi`)){let e=t.startPullDownRefresh;typeof e==`function`&&(t.startPullDownRefresh=function(...t){let n=e.apply(this,t);return s&&i(s,`onPullDownRefresh`,[]),n})}if(r(`pageScrollApi`)){let e=t.pageScrollTo;typeof e==`function`&&(t.pageScrollTo=function(t,...n){let r=e.apply(this,[t,...n]);if(s){let e=s;d(e,()=>{i(e,`onPageScroll`,[t??{}])})}return r})}}}function m(n){let{enableOnShareAppMessage:i,enableOnShareTimeline:a}=n;if(!i&&!a||!r(`pageShareMenu`))return;let o=e();if(!o||typeof o.showShareMenu!=`function`)return;let s=t().shareTimelineRequiresShareAppMessage?i||a:i;if(!s&&!a)return;let c=[];s&&c.push(`shareAppMessage`),a&&c.push(`shareTimeline`);let l=[{withShareTicket:!0,menus:c},{menus:c},a?{withShareTicket:!0}:void 0,a?{}:void 0,void 0];for(let e of l)try{e===void 0?o.showShareMenu():o.showShareMenu(e);break}catch{}}export{l as bindCurrentPageInstance,p as ensureMiniProgramGlobalPatched,m as ensurePageShareMenus,c as getCurrentPageInstance,u as releaseCurrentPageInstance,f as resolvePageOptions,d as runInPageScrollHook};
1
+ import{getCurrentMiniProgramGlobalObject as e,getCurrentMiniProgramRuntimeCapabilities as t}from"../../../platform/current.mjs";import{getCurrentMiniProgramPages as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../../../platform.mjs";import{callHookList as i}from"../../../hooks/base.mjs";import{runInPageScrollHook as a}from"../../../hooks/pageScroll.mjs";import{WEVU_PAGE_SCROLL_EVENT_CONTRACT_KEY as o}from"@weapp-core/constants";let s=!1,c;function l(){return c}function u(e){c=e}function d(e){c===e&&(c=void 0)}function f(e){let t=e.options;if(t&&typeof t==`object`)return t;let r=n(),i=r[r.length-1],a=i&&typeof i==`object`?i.options:void 0;return a&&typeof a==`object`?a:{}}function p(){if(s)return;s=!0;let t=e();if(t&&typeof t==`object`){if(r(`pullDownRefreshApi`)){let e=t.startPullDownRefresh;typeof e==`function`&&(t.startPullDownRefresh=function(...t){let n=e.apply(this,t);return c&&i(c,`onPullDownRefresh`,[]),n})}if(r(`pageScrollApi`)&&t[o]!==1){let e=t.pageScrollTo;typeof e==`function`&&(t.pageScrollTo=function(t,...n){let r=c,o=e.apply(this,[t,...n]);return r&&a(r,()=>{i(r,`onPageScroll`,[t??{}])}),o})}}}function m(n){let{enableOnShareAppMessage:i,enableOnShareTimeline:a}=n;if(!i&&!a||!r(`pageShareMenu`))return;let o=e();if(!o||typeof o.showShareMenu!=`function`)return;let s=t().shareTimelineRequiresShareAppMessage?i||a:i;if(!s&&!a)return;let c=[];s&&c.push(`shareAppMessage`),a&&c.push(`shareTimeline`);let l=[{withShareTicket:!0,menus:c},{menus:c},a?{withShareTicket:!0}:void 0,a?{}:void 0,void 0];for(let e of l)try{e===void 0?o.showShareMenu():o.showShareMenu(e);break}catch{}}export{u as bindCurrentPageInstance,p as ensureMiniProgramGlobalPatched,m as ensurePageShareMenus,l as getCurrentPageInstance,d as releaseCurrentPageInstance,f as resolvePageOptions};
@@ -1 +1 @@
1
- import{callHookList as e}from"../../hooks/base.mjs";import{runtimeCapabilityRegistry as t}from"../../capabilities.mjs";import{bindCurrentPageInstance as n,ensureMiniProgramGlobalPatched as r,ensurePageShareMenus as i,releaseCurrentPageInstance as a,resolvePageOptions as o}from"./lifecycle/platform.mjs";import{runTeardownSteps as s}from"../../teardown.mjs";import{enableDeferredSetData as c,mountRuntimeInstance as l,setRuntimeSetDataVisibility as u,teardownRuntimeInstance as d}from"../runtimeInstance.mjs";import{notifyRouteStateSync as f}from"../../../router/routeSync.mjs";import{cancelInitialNavigation as p,ensureInitialNavigation as m}from"../../navigationLifecycle.mjs";import{attachOptionalPageLifecycleHooks as h}from"./lifecycle/optionalHooks.mjs";import{WEVU_ON_LOAD_CALLED_KEY as g,WEVU_READY_CALLED_KEY as _,WEVU_ROUTE_DONE_CALLED_KEY as v}from"@weapp-core/constants";function y(y){let{runtimeApp:b,watch:x,setup:S,userOnLoad:C,userOnUnload:w,userOnShow:T,userOnHide:E,userOnReady:D,isPage:O,enableOnSaveExitState:k,enableOnPullDownRefresh:A,enableOnReachBottom:j,enableOnPageScroll:M,enableOnRouteDone:N,enableOnRouteDoneFallback:P,enableOnTabItemTap:F,enableOnResize:I,enableOnShareAppMessage:L,enableOnShareTimeline:R,enableOnAddToFavorites:z,syncWevuPropsFromValues:B,effectiveOnSaveExitState:V,effectiveOnPullDownRefresh:H,effectiveOnReachBottom:U,effectiveOnPageScroll:W,effectiveOnRouteDone:G,effectiveOnTabItemTap:K,effectiveOnResize:q,effectiveOnShareAppMessage:J,effectiveOnShareTimeline:Y,effectiveOnAddToFavorites:X,hasHook:Z}=y,Q=e=>{e.__wevu?.__wevu_flushSetupSnapshotSync?.()},$={onLoad(...t){if(this[g])return;this[g]=!0;let n=()=>{l(this,b,x,S);let n=t[0]&&typeof t[0]==`object`?t[0]:o(this);if(B?.(this,n),Q(this),c(this),O&&i({enableOnShareAppMessage:L,enableOnShareTimeline:R}),e(this,`onLoad`,t),typeof C==`function`)return C.apply(this,t.length?t:[n])};return(O?m(this,t[0],{onComplete:e=>{e&&n()}}):void 0)||n()},onUnload(...e){let t;return s([()=>p(this),()=>{O&&a(this)},()=>d(this),()=>{typeof w==`function`&&(t=w.apply(this,e))}]),t},onShow(...t){if(O&&(r(),n(this),this[g]||$.onLoad.call(this,o(this)),B?.(this,o(this)),Q(this),i({enableOnShareAppMessage:L,enableOnShareTimeline:R}),this[v]=!1),u(this,!0),O&&f({page:this,source:`page`}),e(this,`onShow`,t),typeof T==`function`)return T.apply(this,t)},onHide(...t){if(O&&a(this),u(this,!1),e(this,`onHide`,t),typeof E==`function`)return E.apply(this,t)},onReady(...n){if(O&&(this[g]||$.onLoad.call(this,o(this)),B?.(this,o(this)),Q(this),i({enableOnShareAppMessage:L,enableOnShareTimeline:R})),!this[_]){if(this[_]=!0,O&&N&&P){let e=this;setTimeout(()=>{e[v]||$.onRouteDone?.call(e)},0)}let r=()=>{e(this,`onReady`,n),typeof D==`function`&&D.apply(this,n)},i=()=>{if(Array.isArray(this.__wevuTemplateRefs)&&this.__wevuTemplateRefs.length>0){t.templateRefs?.schedule(this,r);return}r()};O&&m(this,void 0,{start:!1,onComplete:e=>{e&&i()}})||i();return}if(typeof D==`function`)return D.apply(this,n)}};return h($,{enableOnSaveExitState:k,enableOnPullDownRefresh:A,enableOnReachBottom:j,enableOnPageScroll:M,enableOnRouteDone:N,enableOnTabItemTap:F,enableOnResize:I,enableOnShareAppMessage:L,enableOnShareTimeline:R,enableOnAddToFavorites:z,effectiveOnSaveExitState:V,effectiveOnPullDownRefresh:H,effectiveOnReachBottom:U,effectiveOnPageScroll:W,effectiveOnRouteDone:G,effectiveOnTabItemTap:K,effectiveOnResize:q,effectiveOnShareAppMessage:J,effectiveOnShareTimeline:Y,effectiveOnAddToFavorites:X,hasHook:Z}),$}export{y as createPageLifecycleHooks};
1
+ import{callHookList as e}from"../../hooks/base.mjs";import{runtimeCapabilityRegistry as t}from"../../capabilities.mjs";import{bindCurrentPageInstance as n,ensureMiniProgramGlobalPatched as r,ensurePageShareMenus as i,releaseCurrentPageInstance as a,resolvePageOptions as o}from"./lifecycle/platform.mjs";import{runTeardownSteps as s}from"../../teardown.mjs";import{enableDeferredSetData as c,mountRuntimeInstance as l,setRuntimeSetDataVisibility as u,teardownRuntimeInstance as d}from"../runtimeInstance.mjs";import{notifyRouteStateSync as f}from"../../../router/routeSync.mjs";import{cancelInitialNavigation as p,ensureInitialNavigation as m}from"../../navigationLifecycle.mjs";import{attachOptionalPageLifecycleHooks as h}from"./lifecycle/optionalHooks.mjs";import{WEVU_ON_LOAD_CALLED_KEY as g,WEVU_READY_CALLED_KEY as _,WEVU_ROUTE_DONE_CALLED_KEY as v}from"@weapp-core/constants";function y(y){let{runtimeApp:b,watch:x,setup:S,userOnLoad:C,userOnUnload:w,userOnShow:T,userOnHide:E,userOnReady:D,isPage:O,enableOnSaveExitState:k,enableOnPullDownRefresh:A,enableOnReachBottom:j,enableOnPageScroll:M,enableOnRouteDone:N,enableOnRouteDoneFallback:P,enableOnTabItemTap:F,enableOnResize:I,enableOnShareAppMessage:L,enableOnShareTimeline:R,enableOnAddToFavorites:z,syncWevuPropsFromValues:B,effectiveOnSaveExitState:V,effectiveOnPullDownRefresh:H,effectiveOnReachBottom:U,effectiveOnPageScroll:W,effectiveOnRouteDone:G,effectiveOnTabItemTap:K,effectiveOnResize:q,effectiveOnShareAppMessage:J,effectiveOnShareTimeline:Y,effectiveOnAddToFavorites:X,hasHook:Z}=y,Q=e=>{e.__wevu?.__wevu_flushSetupSnapshotSync?.()},$={onLoad(...t){if(this[g])return;this[g]=!0;let n=()=>{l(this,b,x,S);let n=t[0]&&typeof t[0]==`object`?t[0]:o(this);if(B?.(this,n),Q(this),c(this),O&&i({enableOnShareAppMessage:L,enableOnShareTimeline:R}),e(this,`onLoad`,t),typeof C==`function`)return C.apply(this,t.length?t:[n])};return(O?m(this,t[0],{onComplete:e=>{e&&n()}}):void 0)||n()},onUnload(...e){let t;return s([()=>p(this),()=>{O&&a(this)},()=>d(this),()=>{typeof w==`function`&&(t=w.apply(this,e))}]),t},onShow(...t){if(O&&(r(),n(this),this[g]||$.onLoad.call(this,o(this)),B?.(this,o(this)),Q(this),i({enableOnShareAppMessage:L,enableOnShareTimeline:R}),this[v]=!1),u(this,!0),O&&f({page:this,source:`page`}),e(this,`onShow`,t),typeof T==`function`)return T.apply(this,t)},onHide(...t){if(O&&a(this),u(this,!1),e(this,`onHide`,t),typeof E==`function`)return E.apply(this,t)},onReady(...n){if(O&&(this[g]||$.onLoad.call(this,o(this)),B?.(this,o(this)),Q(this),i({enableOnShareAppMessage:L,enableOnShareTimeline:R})),!this[_]){if(this[_]=!0,O&&N&&P){let e=this;setTimeout(()=>{e[v]||$.onRouteDone?.call(e)},0)}let r=()=>{e(this,`onReady`,n),typeof D==`function`&&D.apply(this,n)},i=()=>{Array.isArray(this.__wevuTemplateRefs)&&this.__wevuTemplateRefs.length>0?t.templateRefs?.schedule(this,r):r()};O&&m(this,void 0,{start:!1,onComplete:e=>{e&&i()}})||i()}else if(typeof D==`function`)return D.apply(this,n)}};return h($,{enableOnSaveExitState:k,enableOnPullDownRefresh:A,enableOnReachBottom:j,enableOnPageScroll:M,enableOnRouteDone:N,enableOnTabItemTap:F,enableOnResize:I,enableOnShareAppMessage:L,enableOnShareTimeline:R,enableOnAddToFavorites:z,effectiveOnSaveExitState:V,effectiveOnPullDownRefresh:H,effectiveOnReachBottom:U,effectiveOnPageScroll:W,effectiveOnRouteDone:G,effectiveOnTabItemTap:K,effectiveOnResize:q,effectiveOnShareAppMessage:J,effectiveOnShareTimeline:Y,effectiveOnAddToFavorites:X,hasHook:Z}),$}export{y as createPageLifecycleHooks};
@@ -1 +1 @@
1
- import{hasOwn as e}from"../../../utils.mjs";import{isDeepEqualValue as t}from"../../app/setData/snapshot.mjs";import{refreshOwnerSnapshotFromInstance as n}from"../snapshot.mjs";import{WEVU_ATTRS_KEY as r,WEVU_PENDING_PROP_VALUES_KEY as i,WEVU_PROPS_DERIVED_KEYS_KEY as a,WEVU_PROPS_KEY as o,WEVU_PROP_KEYS_KEY as s,WEVU_SLOT_NAMES_PROP as c,WEVU_SLOT_OWNER_ID_PROP as l,WEVU_SLOT_SCOPE_KEY as u}from"@weapp-core/constants";function d(d){let{restOptions:f,propsAliases:p,propsDerivedKeys:m,userObservers:h}=d,g=f.properties&&typeof f.properties==`object`?Object.keys(f.properties):[],_=new Set(g),v=new Set(m??[]),y=Object.entries(p??{}).filter(([e,t])=>e&&t),b=/* @__PURE__ */ new Set([c,l,u]),x=g.filter(e=>!b.has(e)),S=/* @__PURE__ */ new WeakMap,C=e=>e.startsWith(`__wv_`),w=e=>{let t=e.__wevu?.[a];if(t instanceof Set)for(let e of x)t.add(e)},T=(t,n,r)=>e(t,n)&&Object.is(t[n],r)?!1:(t[n]=r,!0),E=(n,r,i)=>b.has(r)&&e(n,r)&&t(n[r],i,20,{keys:1e4})?!1:T(n,r,i),D=(e,t,n)=>{if(!b.has(t))return;let r=!1,i=e.__wevu?.state;try{i&&typeof i==`object`&&E(i,t,n);let a=e.data;a&&typeof a==`object`&&(r=E(a,t,n))}catch{}if(r&&typeof e.setData==`function`)try{e.setData({[t]:n})}catch{}},O=(t,n)=>{if(!y.length)return;let r=t.__wevu,i=r?.setupState,a=r?.state;if(!i||typeof i!=`object`)return;w(t);let o=S.get(t)??/* @__PURE__ */ new Set;S.set(t,o);for(let[t,r]of y){if(e(i,t)&&!o.has(t))continue;let s=n[r];try{T(i,t,s),o.add(t)}catch{}if(a&&typeof a==`object`&&(!e(a,t)||o.has(t)))try{T(a,t,s)}catch{}}},k=(t,n)=>{if(!v.size)return;let r=t.__wevu?.setupState;if(!r||typeof r!=`object`)return;w(t);let i=new Map(y);for(let t of v){let a=i.get(t)??t;if(e(n,a))try{T(r,t,n[a])}catch{}}},A=e=>{try{Object.defineProperty(e,s,{value:g,configurable:!0,enumerable:!1,writable:!1})}catch{e[s]=g}},j=t=>{let i=t[r];if(!i||typeof i!=`object`)return;let a=n=>{let r=t.__wevu?.state;return typeof r==`object`&&!!r&&e(r,n)},o=t.properties,s=o&&typeof o==`object`?o:void 0,c=Object.keys(i);for(let t of c)if(!s||!e(s,t)||C(t)||_.has(t)||a(t))try{delete i[t]}catch{}if(!s){n(t);return}for(let[e,t]of Object.entries(s))if(!(C(e)||_.has(e)||a(e)))try{i[e]=t}catch{}n(t)},M=t=>{let r=t[o],a=t.properties,s=t[i];if(r&&typeof r==`object`&&a&&typeof a==`object`){let i=a,o=Object.keys(r);for(let t of o)if(!_.has(t)||!e(i,t))try{delete r[t]}catch{}for(let n of g){let a=s&&e(s,n);if(!a&&!e(i,n))continue;let o=a?s[n]:i[n];try{E(r,n,o)}catch{}D(t,n,o)}k(t,r),O(t,r),n(t)}s&&delete t[i],j(t)},N=(t,r)=>{if(!r||typeof r!=`object`)return;let i=t[o];if(!i||typeof i!=`object`)return;let a=!1;for(let n of g)if(e(r,n)){try{a=E(i,n,r[n])||a}catch{}D(t,n,r[n])}a&&(k(t,i),O(t,i),n(t),j(t))},P=(e,t,r)=>{var a;let s=e[o];if(!s||typeof s!=`object`)return;try{if(!E(s,t,r)){D(e,t,r);return}}catch{}D(e,t,r);let c=(a=e)[i]??(a[i]=Object.create(null));c[t]=r,k(e,s),O(e,s),n(e),j(e)},F={};if(g.length)for(let e of g)F[e]=function(t){P(this,e,t)};let I={...h??{}};for(let[e,t]of Object.entries(F)){let n=I[e];I[e]=typeof n==`function`?function(...e){n.apply(this,e),t.apply(this,e)}:t}let L=I[`**`];return I[`**`]=function(...e){typeof L==`function`&&L.apply(this,e),M(this)},{attachWevuPropKeys:A,directPropsDerivedKeys:x,syncWevuPropsFromInstance:M,syncWevuPropsFromValues:N,finalObservers:I}}export{d as createPropsSync};
1
+ import{hasOwn as e}from"../../../utils.mjs";import{isDeepEqualValue as t}from"../../app/setData/snapshot.mjs";import{updateNativeDeclarationAddress as n}from"../runtimeInstance/nativeDeclaration.mjs";import{refreshOwnerSnapshotFromInstance as r}from"../snapshot.mjs";import{WEVU_ATTRS_KEY as i,WEVU_NATIVE_DECLARATION_ADDRESS_PROP as a,WEVU_PENDING_PROP_VALUES_KEY as o,WEVU_PROPS_DERIVED_KEYS_KEY as s,WEVU_PROPS_KEY as c,WEVU_PROP_KEYS_KEY as l,WEVU_SLOT_NAMES_PROP as u,WEVU_SLOT_OWNER_ID_PROP as d,WEVU_SLOT_SCOPE_KEY as f}from"@weapp-core/constants";function p(p){let{restOptions:m,propsAliases:h,propsDerivedKeys:g,userObservers:_}=p,v=m.properties&&typeof m.properties==`object`?Object.keys(m.properties):[],y=new Set(v),b=new Set(g??[]),x=Object.entries(h??{}).filter(([e,t])=>e&&t),S=/* @__PURE__ */ new Set([u,d,f]),C=v.filter(e=>!S.has(e)),w=/* @__PURE__ */ new WeakMap,T=e=>e.startsWith(`__wv_`),E=e=>{let t=e.__wevu?.[s];if(t instanceof Set)for(let e of C)t.add(e)},D=(t,n,r)=>e(t,n)&&Object.is(t[n],r)?!1:(t[n]=r,!0),O=(n,r,i)=>S.has(r)&&e(n,r)&&t(n[r],i,20,{keys:1e4})?!1:D(n,r,i),k=(e,t,n)=>{if(!S.has(t))return;let r=!1,i=e.__wevu?.state;try{i&&typeof i==`object`&&O(i,t,n);let a=e.data;a&&typeof a==`object`&&(r=O(a,t,n))}catch{}if(r&&typeof e.setData==`function`)try{e.setData({[t]:n})}catch{}},A=(t,n)=>{if(!x.length)return;let r=t.__wevu,i=r?.setupState,a=r?.state;if(!i||typeof i!=`object`)return;E(t);let o=w.get(t)??/* @__PURE__ */ new Set;w.set(t,o);for(let[t,r]of x){if(e(i,t)&&!o.has(t))continue;let s=n[r];try{D(i,t,s),o.add(t)}catch{}if(a&&typeof a==`object`&&(!e(a,t)||o.has(t)))try{D(a,t,s)}catch{}}},j=(t,n)=>{if(!b.size)return;let r=t.__wevu?.setupState;if(!r||typeof r!=`object`)return;E(t);let i=new Map(x);for(let t of b){let a=i.get(t)??t;if(e(n,a))try{D(r,t,n[a])}catch{}}},M=e=>{try{Object.defineProperty(e,l,{value:v,configurable:!0,enumerable:!1,writable:!1})}catch{e[l]=v}},N=t=>{let n=t[i];if(!n||typeof n!=`object`)return;let a=n=>{let r=t.__wevu?.state;return typeof r==`object`&&!!r&&e(r,n)},o=t.properties,s=o&&typeof o==`object`?o:void 0,c=Object.keys(n);for(let t of c)if(!s||!e(s,t)||T(t)||y.has(t)||a(t))try{delete n[t]}catch{}if(!s)r(t);else{for(let[e,t]of Object.entries(s))if(!(T(e)||y.has(e)||a(e)))try{n[e]=t}catch{}r(t)}},P=t=>{let n=t[c],i=t.properties,a=t[o];if(n&&typeof n==`object`&&i&&typeof i==`object`){let o=i,s=Object.keys(n);for(let t of s)if(!y.has(t)||!e(o,t))try{delete n[t]}catch{}for(let r of v){let i=a&&e(a,r);if(!i&&!e(o,r))continue;let s=i?a[r]:o[r];try{O(n,r,s)}catch{}k(t,r,s)}j(t,n),A(t,n),r(t)}a&&delete t[o],N(t)},F=(t,n)=>{if(!n||typeof n!=`object`)return;let i=t[c];if(!i||typeof i!=`object`)return;let a=!1;for(let r of v)if(e(n,r)){try{a=O(i,r,n[r])||a}catch{}k(t,r,n[r])}a&&(j(t,i),A(t,i),r(t),N(t))},I=(e,t,n)=>{var i;let a=e[c];if(!a||typeof a!=`object`)return;try{if(!O(a,t,n)){k(e,t,n);return}}catch{}k(e,t,n);let s=(i=e)[o]??(i[o]=Object.create(null));s[t]=n,j(e,a),A(e,a),r(e),N(e)},L={};if(v.length)for(let e of v)L[e]=function(t){(!import.meta.env?.PLATFORM||import.meta.env?.PLATFORM===`weapp`)&&e===a&&n(this,t),I(this,e,t)};let R={...(!import.meta.env?.PLATFORM||import.meta.env?.PLATFORM===`weapp`)&&y.has(a)?{[a]:void 0}:{},..._??{}};for(let[e,t]of Object.entries(L)){let n=R[e];R[e]=typeof n==`function`?function(...r){e===a?(t.apply(this,r),n.apply(this,r)):(n.apply(this,r),t.apply(this,r))}:t}let z=R[`**`];return R[`**`]=function(...e){typeof z==`function`&&z.apply(this,e),P(this)},{attachWevuPropKeys:M,directPropsDerivedKeys:C,syncWevuPropsFromInstance:P,syncWevuPropsFromValues:F,finalObservers:R}}export{p as createPropsSync};
@@ -1 +1 @@
1
- import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{callHookList as t}from"../../hooks/base.mjs";import{requireRuntimeCapability as n,runtimeCapabilityRegistry as r}from"../../capabilities.mjs";import{runTeardownSteps as i}from"../../teardown.mjs";import{enableDeferredSetData as a,mountRuntimeInstance as o,refreshRuntimeInstance as s,setRuntimeSetDataVisibility as c,teardownRuntimeInstance as l}from"../runtimeInstance.mjs";import{ensureInitialNavigation as u}from"../../navigationLifecycle.mjs";import{registerNativeComponentDefinition as d}from"./registerNativeDefinition.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as f,WEVU_PUBLIC_RUNTIME_KEY as p,WEVU_READY_CALLED_KEY as m,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as h,WEVU_RUNTIME_KEY as g}from"@weapp-core/constants";function _(_){let{runtimeApp:v,watch:y,setup:b,restOptions:x,pageLifecycleHooks:S,finalObservers:ee,userLifetimes:C,userPageLifetimes:w,finalMethods:T,finalOptions:E,applyExtraInstanceFields:D,templateRefs:O,layoutHosts:k,attachWevuPropKeys:A,setupLifecycle:j,syncWevuPropsFromInstance:M,directPropsDerivedKeys:N,isPage:P,vueLifecycles:F,getRuntimeOwnerLabel:I,registerNative:L=!0}=_,R=Array.isArray(O)&&O.length>0?O:void 0,z=/* @__PURE__ */ new WeakSet;R&&n(`templateRefs`,`registerComponentDefinition(template refs)`);let B=Array.isArray(k)&&k.length>0?k:void 0,V=B?n(`layout`,`registerComponentDefinition(layout hosts)`):void 0,H=(e,t)=>{if(R){r.templateRefs?.schedule(e,t);return}t?.()},U=e=>{let t=e.__wevu??e[p];if(t)return t;let n=e.$state;if(n&&typeof n==`object`)return n[g]},W=e=>U(e)?.proxy||(r.scopedSlots?.resolveLifecycleProxy(e)??e),G=e=>{let t=U(e);return t?{runtime:t,mounted:!1}:(D(e),A(e),o(e,v,y,b,{deferSetData:!0,snapshotOmitKeys:N}),M(e),a(e),{runtime:U(e),mounted:!0})},K=(e,t,n)=>{let r=F[t];if(typeof r==`function`)return r.apply(W(e),n)},q=(e,t)=>{if(!P){t();return}u(e,void 0,{start:!1,onComplete:e=>{e&&t()}})||t()},J=e=>{U(e)||typeof F.mounted!=`function`||G(e).mounted&&(K(e,`created`,[]),K(e,`beforeMount`,[]))},Y={},X=e=>{B&&V?.attachHosts(B,e)},Z=e=>{P&&V&&V?.attachPageSetter(e)};if(P)for(let e of[`onPullDownRefresh`,`onReachBottom`,`onShareAppMessage`,`onShareTimeline`,`onAddToFavorites`]){let t=S[e];typeof t==`function`&&typeof T[e]!=`function`&&(Y[e]=function(...e){return t.apply(this,e)})}let Q={...x,...P?S:{},observers:ee,lifetimes:{...C,created:function(...e){z.add(this),D(this),A(this),R&&r.templateRefs?.attachBindings(this,R),q(this,()=>{if(K(this,`beforeCreate`,e),j===`created`){try{o(this,v,y,b,{deferSetData:!0,snapshotOmitKeys:N})}catch(e){let t=I(this);throw Error(`[wevu] mount runtime failed in created (${t}): ${e instanceof Error?e.message:String(e)}`)}M(this),Z(this)}typeof C.created==`function`&&C.created.apply(this,e)})},moved:function(...e){t(this,`onMoved`,e),typeof C.moved==`function`&&C.moved.apply(this,e)},attached:function(...e){z.delete(this),D(this),A(this),R&&!r.templateRefs?.hasBindings(this)&&r.templateRefs?.attachBindings(this,R),q(this,()=>{if(j!==`created`||!this.__wevu)try{o(this,v,y,b,{deferSetData:!0,snapshotOmitKeys:N})}catch(e){let t=I(this);throw Error(`[wevu] mount runtime failed in attached (${t}): ${e instanceof Error?e.message:String(e)}`)}M(this),K(this,`created`,e),K(this,`beforeMount`,e),Z(this),X(this),a(this),t(this,`onAttached`,e),typeof C.attached==`function`&&C.attached.apply(this,e)})},ready:function(...e){if(z.has(this))return C.ready?.apply(this,e);if(!P||this[m]||!u(this,void 0,{start:!0,onComplete:t=>{t&&!this.__wevuInitialNavigationReady&&(this.__wevuInitialNavigationReady=!0,Q.lifetimes.ready.call(this,...e))}})||this.__wevuInitialNavigationReady){if(J(this),P&&typeof S.onReady==`function`){let t=!!this[m];if(S.onReady.call(this,...e),!t){let t=()=>K(this,`mounted`,e);u(this,void 0,{start:!1,onComplete:e=>{e&&t()}})||t()}typeof C.ready==`function`&&C.ready.apply(this,e);return}if(!this[m]){this[m]=!0,M(this),r.templateRefs?.scheduleOwner(this),H(this,()=>{t(this,`onReady`,e),K(this,`mounted`,e),typeof C.ready==`function`&&C.ready.apply(this,e)});return}typeof C.ready==`function`&&C.ready.apply(this,e)}},detached:function(...e){if(P&&typeof S.onUnload==`function`){i([()=>K(this,`beforeUnmount`,e),()=>K(this,`beforeDestroy`,e),()=>r.templateRefs?.scheduleOwner(this),()=>t(this,`onDetached`,e),()=>S.onUnload.call(this,...e),()=>{typeof C.detached==`function`&&C.detached.apply(this,e)},()=>K(this,`unmounted`,e),()=>K(this,`destroyed`,e)]);return}i([()=>K(this,`beforeUnmount`,e),()=>K(this,`beforeDestroy`,e),()=>r.templateRefs?.scheduleOwner(this),()=>t(this,`onDetached`,e),()=>{B&&V?.detachHosts(B,this)},()=>l(this),()=>K(this,`unmounted`,e),()=>K(this,`destroyed`,e),()=>{typeof C.detached==`function`&&C.detached.apply(this,e)}])},error:function(...e){t(this,`onError`,e),typeof C.error==`function`&&C.error.apply(this,e)}},pageLifetimes:{...w,show:function(...e){if(P&&typeof S.onShow==`function`){S.onShow.call(this,...e),typeof w.show==`function`&&w.show.apply(this,e);return}c(this,!0),t(this,`onShow`,e),typeof w.show==`function`&&w.show.apply(this,e)},hide:function(...e){if(P&&typeof S.onHide==`function`){S.onHide.call(this,...e),typeof w.hide==`function`&&w.hide.apply(this,e);return}c(this,!1),t(this,`onHide`,e),typeof w.hide==`function`&&w.hide.apply(this,e)},resize:function(...e){if(P&&typeof S.onResize==`function`){S.onResize.call(this,...e),typeof w.resize==`function`&&w.resize.apply(this,e);return}t(this,`onResize`,e),typeof w.resize==`function`&&w.resize.apply(this,e)},routeDone:function(...e){if(P&&typeof S.onRouteDone==`function`){S.onRouteDone.call(this,...e),typeof w.routeDone==`function`&&w.routeDone.apply(this,e);return}t(this,`onRouteDone`,e),typeof w.routeDone==`function`&&w.routeDone.apply(this,e)}},methods:{...Y,...T,[h]:function(){let e=G(this);return e.mounted&&(K(this,`created`,[]),K(this,`beforeMount`,[])),e.runtime?.proxy}},options:E};if(!L)return Q;let $=e()?.[f];if(typeof $?.trackWevuComponent==`function`){let e=$.trackWevuComponent(Q,(e,t)=>{s(e,v,y,b,{snapshotOmitKeys:N,stateSnapshot:t}),M(e),Z(e),X(e),a(e,{rehydrateSetupState:!0})});return $.isApplying()||d(e,P),e}return d(Q,P),Q}export{_ as registerComponentDefinition};
1
+ import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{callHookList as t}from"../../hooks/base.mjs";import{requireRuntimeCapability as n,runtimeCapabilityRegistry as r}from"../../capabilities.mjs";import{runTeardownSteps as i}from"../../teardown.mjs";import{receiveNativeDeclaration as ee}from"../runtimeInstance/nativeDeclaration.mjs";import{receiveNativeSlotParent as a}from"../runtimeInstance/provideContext.mjs";import{enableDeferredSetData as o,mountRuntimeInstance as s,refreshRuntimeInstance as c,setRuntimeSetDataVisibility as l,teardownRuntimeInstance as u}from"../runtimeInstance.mjs";import{ensureInitialNavigation as d}from"../../navigationLifecycle.mjs";import{registerNativeComponentDefinition as f}from"./registerNativeDefinition.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as p,WEVU_NATIVE_DECLARATION_METHOD as m,WEVU_NATIVE_SLOT_PARENT_METHOD as h,WEVU_PUBLIC_RUNTIME_KEY as te,WEVU_READY_CALLED_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_KEY as v}from"@weapp-core/constants";function y(y){let{runtimeApp:b,watch:x,setup:S,restOptions:C,pageLifecycleHooks:w,finalObservers:ne,userLifetimes:T,userPageLifetimes:E,finalMethods:D,finalOptions:re,applyExtraInstanceFields:O,templateRefs:k,layoutHosts:A,attachWevuPropKeys:j,setupLifecycle:M,syncWevuPropsFromInstance:N,directPropsDerivedKeys:P,isPage:F,nativeSlotContext:ie,vueLifecycles:I,getRuntimeOwnerLabel:L,registerNative:ae=!0}=y,R=Array.isArray(k)&&k.length>0?k:void 0,z=/* @__PURE__ */ new WeakSet;R&&n(`templateRefs`,`registerComponentDefinition(template refs)`);let B=Array.isArray(A)&&A.length>0?A:void 0,V=B?n(`layout`,`registerComponentDefinition(layout hosts)`):void 0,H=(e,t)=>{R?r.templateRefs?.schedule(e,t):t?.()},U=e=>{let t=e.__wevu??e[te];if(t)return t;let n=e.$state;if(n&&typeof n==`object`)return n[v]},W=e=>U(e)?.proxy||(r.scopedSlots?.resolveLifecycleProxy(e)??e),G=e=>{let t=U(e);return t?{runtime:t,mounted:!1}:(O(e),j(e),s(e,b,x,S,{deferSetData:!0,snapshotOmitKeys:P,attached:!z.has(e)}),N(e),o(e),{runtime:U(e),mounted:!0})},K=(e,t,n)=>{let r=I[t];if(typeof r==`function`)return r.apply(W(e),n)},q=(e,t)=>{F&&d(e,void 0,{start:!1,onComplete:e=>{e&&t()}})||t()},oe=e=>{U(e)||typeof I.mounted!=`function`||G(e).mounted&&(K(e,`created`,[]),K(e,`beforeMount`,[]))},J={},Y=e=>{B&&V?.attachHosts(B,e)},X=e=>{F&&V&&V?.attachPageSetter(e)};if(F)for(let e of[`onPageScroll`,`onPullDownRefresh`,`onReachBottom`,`onShareAppMessage`,`onShareTimeline`,`onAddToFavorites`]){let t=w[e];typeof t==`function`&&typeof D[e]!=`function`&&(J[e]=function(...e){return t.apply(this,e)})}let Z={...J,...D,[_]:function(){let e=G(this);return e.mounted&&(K(this,`created`,[]),K(this,`beforeMount`,[])),e.runtime?.proxy}};(!import.meta.env?.PLATFORM||import.meta.env?.PLATFORM===`weapp`)&&(Z[h]=a,ie&&(Z[m]=ee));let Q={...C,...F?w:{},observers:ne,lifetimes:{...T,created:function(...e){z.add(this),O(this),j(this),R&&r.templateRefs?.attachBindings(this,R),q(this,()=>{if(K(this,`beforeCreate`,e),M===`created`){try{s(this,b,x,S,{deferSetData:!0,snapshotOmitKeys:P})}catch(e){let t=L(this);throw Error(`[wevu] mount runtime failed in created (${t}): ${e instanceof Error?e.message:String(e)}`)}N(this),X(this)}typeof T.created==`function`&&T.created.apply(this,e)})},moved:function(...e){t(this,`onMoved`,e),typeof T.moved==`function`&&T.moved.apply(this,e)},attached:function(...e){z.delete(this),O(this),j(this),R&&!r.templateRefs?.hasBindings(this)&&r.templateRefs?.attachBindings(this,R),q(this,()=>{if(M!==`created`||!this.__wevu)try{s(this,b,x,S,{deferSetData:!0,snapshotOmitKeys:P,attached:!0})}catch(e){let t=L(this);throw Error(`[wevu] mount runtime failed in attached (${t}): ${e instanceof Error?e.message:String(e)}`)}N(this),K(this,`created`,e),K(this,`beforeMount`,e),X(this),Y(this),o(this),t(this,`onAttached`,e),typeof T.attached==`function`&&T.attached.apply(this,e)})},ready:function(...e){if(z.has(this))return T.ready?.apply(this,e);if(!F||this[g]||!d(this,void 0,{start:!0,onComplete:t=>{t&&!this.__wevuInitialNavigationReady&&(this.__wevuInitialNavigationReady=!0,Q.lifetimes.ready.call(this,...e))}})||this.__wevuInitialNavigationReady){if(oe(this),F&&typeof w.onReady==`function`){let t=!!this[g];if(w.onReady.call(this,...e),!t){let t=()=>K(this,`mounted`,e);d(this,void 0,{start:!1,onComplete:e=>{e&&t()}})||t()}typeof T.ready==`function`&&T.ready.apply(this,e)}else this[g]?typeof T.ready==`function`&&T.ready.apply(this,e):(this[g]=!0,N(this),r.templateRefs?.scheduleOwner(this),H(this,()=>{t(this,`onReady`,e),K(this,`mounted`,e),typeof T.ready==`function`&&T.ready.apply(this,e)}))}},detached:function(...e){F&&typeof w.onUnload==`function`?i([()=>K(this,`beforeUnmount`,e),()=>K(this,`beforeDestroy`,e),()=>r.templateRefs?.scheduleOwner(this),()=>t(this,`onDetached`,e),()=>w.onUnload.call(this,...e),()=>{typeof T.detached==`function`&&T.detached.apply(this,e)},()=>K(this,`unmounted`,e),()=>K(this,`destroyed`,e)]):i([()=>K(this,`beforeUnmount`,e),()=>K(this,`beforeDestroy`,e),()=>r.templateRefs?.scheduleOwner(this),()=>t(this,`onDetached`,e),()=>{B&&V?.detachHosts(B,this)},()=>u(this),()=>K(this,`unmounted`,e),()=>K(this,`destroyed`,e),()=>{typeof T.detached==`function`&&T.detached.apply(this,e)}])},error:function(...e){t(this,`onError`,e),typeof T.error==`function`&&T.error.apply(this,e)}},pageLifetimes:{...E,show:function(...e){F&&typeof w.onShow==`function`?(w.onShow.call(this,...e),typeof E.show==`function`&&E.show.apply(this,e)):(l(this,!0),t(this,`onShow`,e),typeof E.show==`function`&&E.show.apply(this,e))},hide:function(...e){F&&typeof w.onHide==`function`?(w.onHide.call(this,...e),typeof E.hide==`function`&&E.hide.apply(this,e)):(l(this,!1),t(this,`onHide`,e),typeof E.hide==`function`&&E.hide.apply(this,e))},resize:function(...e){F&&typeof w.onResize==`function`?(w.onResize.call(this,...e),typeof E.resize==`function`&&E.resize.apply(this,e)):(t(this,`onResize`,e),typeof E.resize==`function`&&E.resize.apply(this,e))},routeDone:function(...e){F&&typeof w.onRouteDone==`function`?(w.onRouteDone.call(this,...e),typeof E.routeDone==`function`&&E.routeDone.apply(this,e)):(t(this,`onRouteDone`,e),typeof E.routeDone==`function`&&E.routeDone.apply(this,e))}},methods:Z,options:re};if(!ae)return Q;let $=e()?.[p];if(typeof $?.trackWevuComponent==`function`){let e=$.trackWevuComponent(Q,(e,t)=>{c(e,b,x,S,{snapshotOmitKeys:P,stateSnapshot:t,attached:!z.has(e)}),N(e),X(e),Y(e),o(e,{rehydrateSetupState:!0})},e=>{i([()=>B&&V?.detachHosts(B,e),()=>u(e,{skipHooks:!0})])});return $.isApplying()||f(e,F),e}return f(Q,F),Q}export{y as registerComponentDefinition};