wevu 7.0.4 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/README.md +20 -4
  2. package/dist/alipay/jsx-runtime.d.mts +12 -0
  3. package/dist/alipay/jsx-runtime.mjs +1 -0
  4. package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/defineProperty.mjs +1 -1
  5. package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPrimitive.mjs +1 -1
  6. package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPropertyKey.mjs +1 -1
  7. package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/typeof.mjs +1 -1
  8. package/dist/dev/api/vitest/setup.d.mts +1 -0
  9. package/dist/dev/api/vitest.d.mts +1 -0
  10. package/dist/dev/api.d.mts +1 -0
  11. package/dist/dev/compiler.d.mts +1 -0
  12. package/dist/dev/fetch.d.mts +9 -0
  13. package/dist/dev/index.d.mts +72 -0
  14. package/dist/dev/index.mjs +12 -15
  15. package/dist/dev/internal-reactivity.d.mts +18 -0
  16. package/dist/dev/internal-reactivity.mjs +3 -2
  17. package/dist/dev/internal-runtime.d.mts +44 -0
  18. package/dist/dev/internal-runtime.mjs +19 -14
  19. package/dist/dev/internal-template.d.mts +2 -0
  20. package/dist/dev/jsxTypes.d.mts +9 -0
  21. package/dist/dev/macros/shared.d.mts +81 -0
  22. package/dist/dev/macros.d.mts +71 -0
  23. package/dist/dev/package.mjs +1 -1
  24. package/dist/dev/reactivity/asyncDerivation.d.mts +41 -0
  25. package/dist/dev/reactivity/asyncDerivation.mjs +130 -0
  26. package/dist/dev/reactivity/asyncDerivation.mjs.map +1 -0
  27. package/dist/dev/reactivity/computed.d.mts +21 -0
  28. package/dist/dev/reactivity/computed.mjs +2 -2
  29. package/dist/dev/reactivity/computed.mjs.map +1 -1
  30. package/dist/dev/reactivity/core.d.mts +35 -0
  31. package/dist/dev/reactivity/core.mjs +156 -32
  32. package/dist/dev/reactivity/core.mjs.map +1 -1
  33. package/dist/dev/reactivity/index.d.mts +16 -0
  34. package/dist/dev/reactivity/reactive/mutation.d.mts +21 -0
  35. package/dist/dev/reactivity/reactive/patch.d.mts +18 -0
  36. package/dist/dev/reactivity/reactive/shallow.d.mts +22 -0
  37. package/dist/dev/reactivity/reactive/shared.d.mts +4 -0
  38. package/dist/dev/reactivity/reactive.d.mts +42 -0
  39. package/dist/dev/reactivity/readonly.d.mts +27 -0
  40. package/dist/dev/reactivity/readonly.mjs.map +1 -1
  41. package/dist/dev/reactivity/ref.d.mts +27 -0
  42. package/dist/dev/reactivity/ref.mjs +1 -1
  43. package/dist/dev/reactivity/shallowRef.d.mts +19 -0
  44. package/dist/dev/reactivity/toRefs.d.mts +43 -0
  45. package/dist/dev/reactivity/traverse.d.mts +8 -0
  46. package/dist/dev/reactivity/watch/types.d.mts +43 -0
  47. package/dist/dev/reactivity/watch.d.mts +22 -0
  48. package/dist/dev/router/createRouter.d.mts +8 -0
  49. package/dist/dev/router/createRouter.mjs +16 -3
  50. package/dist/dev/router/createRouter.mjs.map +1 -1
  51. package/dist/dev/router/navigationCore.d.mts +6 -0
  52. package/dist/dev/router/resolve.d.mts +6 -0
  53. package/dist/dev/router/routeSync.d.mts +1 -0
  54. package/dist/dev/router/types.d.mts +172 -0
  55. package/dist/dev/router/useRoute.d.mts +19 -0
  56. package/dist/dev/router/useRoute.mjs +23 -5
  57. package/dist/dev/router/useRoute.mjs.map +1 -1
  58. package/dist/dev/router/useRouter.d.mts +8 -0
  59. package/dist/dev/router.d.mts +10 -0
  60. package/dist/dev/routerInternal/query.d.mts +7 -0
  61. package/dist/dev/routerInternal/types.d.mts +9 -0
  62. package/dist/dev/runtime/app/computed.mjs +2 -2
  63. package/dist/dev/runtime/app/computed.mjs.map +1 -1
  64. package/dist/dev/runtime/app/context.mjs +8 -2
  65. package/dist/dev/runtime/app/context.mjs.map +1 -1
  66. package/dist/dev/runtime/app/diagnostics.mjs +12 -0
  67. package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
  68. package/dist/dev/runtime/app/mount.mjs +31 -28
  69. package/dist/dev/runtime/app/mount.mjs.map +1 -1
  70. package/dist/dev/runtime/app/pending.d.mts +10 -0
  71. package/dist/dev/runtime/app/setData/commitTracker.d.mts +13 -0
  72. package/dist/dev/runtime/app/setData/commitTracker.mjs +265 -0
  73. package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -0
  74. package/dist/dev/runtime/app/setData/patchScheduler.mjs +47 -51
  75. package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -1
  76. package/dist/dev/runtime/app/setData/scheduler.d.mts +51 -0
  77. package/dist/dev/runtime/app/setData/scheduler.mjs +98 -111
  78. package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
  79. package/dist/dev/runtime/app/setData/snapshot.mjs +11 -1
  80. package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -1
  81. package/dist/dev/runtime/app.d.mts +8 -0
  82. package/dist/dev/runtime/app.mjs +18 -6
  83. package/dist/dev/runtime/app.mjs.map +1 -1
  84. package/dist/dev/runtime/bindingManifest.mjs +105 -0
  85. package/dist/dev/runtime/bindingManifest.mjs.map +1 -0
  86. package/dist/dev/runtime/capabilities.d.mts +75 -0
  87. package/dist/dev/runtime/capabilities.mjs +40 -0
  88. package/dist/dev/runtime/capabilities.mjs.map +1 -0
  89. package/dist/dev/runtime/css.d.mts +14 -0
  90. package/dist/dev/runtime/defaults.d.mts +12 -0
  91. package/dist/dev/runtime/define/componentDefinition.mjs +3 -0
  92. package/dist/dev/runtime/define/componentDefinition.mjs.map +1 -1
  93. package/dist/dev/runtime/define/optionsApi.mjs +1 -1
  94. package/dist/dev/runtime/define/props.mjs +30 -60
  95. package/dist/dev/runtime/define/props.mjs.map +1 -1
  96. package/dist/dev/runtime/define/scopedSlotOptions.mjs +37 -21
  97. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
  98. package/dist/dev/runtime/define.d.mts +118 -0
  99. package/dist/dev/runtime/define.mjs +32 -44
  100. package/dist/dev/runtime/define.mjs.map +1 -1
  101. package/dist/dev/runtime/diff.mjs +1 -1
  102. package/dist/dev/runtime/disposables.d.mts +31 -0
  103. package/dist/dev/runtime/elementIntersectionObserver.d.mts +26 -0
  104. package/dist/dev/runtime/features/inlineEvents.d.mts +7 -0
  105. package/dist/dev/runtime/features/inlineEvents.mjs +25 -0
  106. package/dist/dev/runtime/features/inlineEvents.mjs.map +1 -0
  107. package/dist/dev/runtime/features/layout.d.mts +7 -0
  108. package/dist/dev/runtime/features/layout.mjs +44 -0
  109. package/dist/dev/runtime/features/layout.mjs.map +1 -0
  110. package/dist/dev/runtime/features/patchStrategy.d.mts +7 -0
  111. package/dist/dev/runtime/features/patchStrategy.mjs +129 -0
  112. package/dist/dev/runtime/features/patchStrategy.mjs.map +1 -0
  113. package/dist/dev/runtime/features/publicLayout.d.mts +24 -0
  114. package/dist/dev/runtime/features/publicLayout.mjs +81 -0
  115. package/dist/dev/runtime/features/publicLayout.mjs.map +1 -0
  116. package/dist/dev/runtime/features/scopedSlots.d.mts +23 -0
  117. package/dist/dev/runtime/features/scopedSlots.mjs +88 -0
  118. package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -0
  119. package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +7 -0
  120. package/dist/dev/runtime/features/setDataHighFrequencyWarning.mjs +15 -0
  121. package/dist/dev/runtime/features/setDataHighFrequencyWarning.mjs.map +1 -0
  122. package/dist/dev/runtime/features/templateRefs.d.mts +7 -0
  123. package/dist/dev/runtime/features/templateRefs.mjs +39 -0
  124. package/dist/dev/runtime/features/templateRefs.mjs.map +1 -0
  125. package/dist/dev/runtime/hooks/base.d.mts +27 -0
  126. package/dist/dev/runtime/hooks/register.d.mts +30 -0
  127. package/dist/dev/runtime/hooks/vue.d.mts +52 -0
  128. package/dist/dev/runtime/hooks/vue.mjs +3 -5
  129. package/dist/dev/runtime/hooks/vue.mjs.map +1 -1
  130. package/dist/dev/runtime/hooks.d.mts +4 -0
  131. package/dist/dev/runtime/index.d.mts +46 -0
  132. package/dist/dev/runtime/inlineDataset.mjs +75 -0
  133. package/dist/dev/runtime/inlineDataset.mjs.map +1 -0
  134. package/dist/dev/runtime/intersectionObserver.d.mts +14 -0
  135. package/dist/dev/runtime/jsxIsland.d.mts +37 -0
  136. package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
  137. package/dist/dev/runtime/layoutBridge.d.mts +55 -0
  138. package/dist/dev/runtime/layoutBridge.mjs.map +1 -1
  139. package/dist/dev/runtime/noSetData.d.mts +5 -0
  140. package/dist/dev/runtime/pageEnvironment.d.mts +50 -0
  141. package/dist/dev/runtime/pageLayout.d.mts +25 -0
  142. package/dist/dev/runtime/pageLayout.mjs.map +1 -1
  143. package/dist/dev/runtime/pageScroll.d.mts +29 -0
  144. package/dist/dev/runtime/platform.mjs +18 -1
  145. package/dist/dev/runtime/platform.mjs.map +1 -1
  146. package/dist/dev/runtime/provide.d.mts +60 -0
  147. package/dist/dev/runtime/provideStore.d.mts +7 -0
  148. package/dist/dev/runtime/publicRuntime.d.mts +22 -0
  149. package/dist/dev/runtime/publicRuntime.mjs +91 -0
  150. package/dist/dev/runtime/publicRuntime.mjs.map +1 -0
  151. package/dist/dev/runtime/pullDownRefresh.d.mts +12 -0
  152. package/dist/dev/runtime/register/app.d.mts +14 -0
  153. package/dist/dev/runtime/register/app.mjs +7 -10
  154. package/dist/dev/runtime/register/app.mjs.map +1 -1
  155. package/dist/dev/runtime/register/component/lifecycle.mjs +22 -6
  156. package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
  157. package/dist/dev/runtime/register/component/methods.mjs +7 -10
  158. package/dist/dev/runtime/register/component/methods.mjs.map +1 -1
  159. package/dist/dev/runtime/register/component/options.mjs.map +1 -1
  160. package/dist/dev/runtime/register/component/registerDefinition.mjs +64 -69
  161. package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
  162. package/dist/dev/runtime/register/component.d.mts +17 -0
  163. package/dist/dev/runtime/register/inline.d.mts +15 -0
  164. package/dist/dev/runtime/register/inline.mjs +4 -64
  165. package/dist/dev/runtime/register/inline.mjs.map +1 -1
  166. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +1 -1
  167. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
  168. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +4 -6
  169. package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
  170. package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +26 -0
  171. package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs.map +1 -0
  172. package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
  173. package/dist/dev/runtime/register/runtimeInstance.d.mts +26 -0
  174. package/dist/dev/runtime/register/runtimeInstance.mjs +402 -160
  175. package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
  176. package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -1
  177. package/dist/dev/runtime/register/setup.d.mts +11 -0
  178. package/dist/dev/runtime/register/snapshot.mjs +6 -10
  179. package/dist/dev/runtime/register/snapshot.mjs.map +1 -1
  180. package/dist/dev/runtime/register/watch.d.mts +12 -0
  181. package/dist/dev/runtime/register.d.mts +5 -0
  182. package/dist/dev/runtime/scopedSlots.mjs +1 -1
  183. package/dist/dev/runtime/scopedSlots.mjs.map +1 -1
  184. package/dist/dev/runtime/selectorQuery.d.mts +54 -0
  185. package/dist/dev/runtime/selectorQuery.mjs +5 -0
  186. package/dist/dev/runtime/selectorQuery.mjs.map +1 -1
  187. package/dist/dev/runtime/teardown.mjs +18 -0
  188. package/dist/dev/runtime/teardown.mjs.map +1 -0
  189. package/dist/dev/runtime/template.d.mts +6 -0
  190. package/dist/dev/runtime/templateRefTypes.d.mts +12 -0
  191. package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -1
  192. package/dist/dev/runtime/templateRefs.mjs +187 -118
  193. package/dist/dev/runtime/templateRefs.mjs.map +1 -1
  194. package/dist/dev/runtime/types/core.d.mts +35 -0
  195. package/dist/dev/runtime/types/miniprogram.d.mts +84 -0
  196. package/dist/dev/runtime/types/miniprogramHost.d.mts +45 -0
  197. package/dist/dev/runtime/types/miniprogramHostSources.d.mts +112 -0
  198. package/dist/dev/runtime/types/options.d.mts +136 -0
  199. package/dist/dev/runtime/types/props/propTypes.d.mts +79 -0
  200. package/dist/dev/runtime/types/props/router.d.mts +51 -0
  201. package/dist/dev/runtime/types/props/setup.d.mts +96 -0
  202. package/dist/dev/runtime/types/props.d.mts +4 -0
  203. package/dist/dev/runtime/types/runtime.d.mts +59 -0
  204. package/dist/dev/runtime/types/setData.d.mts +237 -0
  205. package/dist/dev/runtime/types.d.mts +29 -0
  206. package/dist/dev/runtime/uniAppHost.d.mts +8 -0
  207. package/dist/dev/runtime/updatePerformance.d.mts +13 -0
  208. package/dist/dev/runtime/use.d.mts +13 -0
  209. package/dist/dev/runtime/vueCompat/context.d.mts +8 -0
  210. package/dist/dev/runtime/vueCompat/model.d.mts +30 -0
  211. package/dist/dev/runtime/vueCompat/router.d.mts +29 -0
  212. package/dist/dev/runtime/vueCompat/router.mjs +18 -13
  213. package/dist/dev/runtime/vueCompat/router.mjs.map +1 -1
  214. package/dist/dev/runtime/vueCompat/templateRef.d.mts +9 -0
  215. package/dist/dev/runtime/vueCompat/templateRef.mjs +2 -0
  216. package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -1
  217. package/dist/dev/runtime/vueCompat.d.mts +5 -0
  218. package/dist/dev/scheduler.d.mts +4 -0
  219. package/dist/dev/store/base.mjs +12 -18
  220. package/dist/dev/store/base.mjs.map +1 -1
  221. package/dist/dev/store/define/optionsStyle.mjs +13 -23
  222. package/dist/dev/store/define/optionsStyle.mjs.map +1 -1
  223. package/dist/dev/store/define/setupStyle.mjs +14 -24
  224. package/dist/dev/store/define/setupStyle.mjs.map +1 -1
  225. package/dist/dev/store/define/shared.mjs +44 -1
  226. package/dist/dev/store/define/shared.mjs.map +1 -1
  227. package/dist/dev/store/define.d.mts +28 -0
  228. package/dist/dev/store/define.mjs.map +1 -1
  229. package/dist/dev/store/manager.d.mts +8 -0
  230. package/dist/dev/store/storeToRefs.d.mts +13 -0
  231. package/dist/dev/store/types.d.mts +70 -0
  232. package/dist/dev/store.d.mts +5 -0
  233. package/dist/dev/version.d.mts +4 -0
  234. package/dist/dev/vue-augment.d.mts +8 -0
  235. package/dist/dev/vue-demi.d.mts +87 -0
  236. package/dist/dev/vue-demi.mjs +12 -15
  237. package/dist/dev/vue-demi.mjs.map +1 -1
  238. package/dist/dev/vue-types.d.mts +19 -0
  239. package/dist/dev/web-apis.d.mts +3 -0
  240. package/dist/index.d.mts +13 -14
  241. package/dist/index.mjs +1 -1
  242. package/dist/internal-reactivity.d.mts +2 -1
  243. package/dist/internal-reactivity.mjs +1 -1
  244. package/dist/internal-runtime.d.mts +13 -6
  245. package/dist/internal-runtime.mjs +1 -1
  246. package/dist/jsx-runtime.d.mts +47 -9
  247. package/dist/jsxTypes.d.mts +8 -0
  248. package/dist/miniprogram/jsx-runtime.d.mts +12 -0
  249. package/dist/miniprogram/jsx-runtime.mjs +1 -0
  250. package/dist/package.mjs +1 -1
  251. package/dist/reactivity/asyncDerivation.d.mts +40 -0
  252. package/dist/reactivity/asyncDerivation.mjs +1 -0
  253. package/dist/reactivity/computed.mjs +1 -1
  254. package/dist/reactivity/core.d.mts +1 -0
  255. package/dist/reactivity/core.mjs +1 -1
  256. package/dist/reactivity/index.d.mts +2 -1
  257. package/dist/reactivity/readonly.d.mts +1 -1
  258. package/dist/reactivity/ref.mjs +1 -1
  259. package/dist/router/createRouter.mjs +1 -1
  260. package/dist/router/useRoute.mjs +1 -1
  261. package/dist/runtime/app/computed.mjs +1 -1
  262. package/dist/runtime/app/context.mjs +1 -1
  263. package/dist/runtime/app/diagnostics.mjs +1 -1
  264. package/dist/runtime/app/mount.mjs +1 -1
  265. package/dist/runtime/app/setData/commitTracker.d.mts +12 -0
  266. package/dist/runtime/app/setData/commitTracker.mjs +1 -0
  267. package/dist/runtime/app/setData/patchScheduler.mjs +1 -1
  268. package/dist/runtime/app/setData/scheduler.d.mts +50 -0
  269. package/dist/runtime/app/setData/scheduler.mjs +1 -1
  270. package/dist/runtime/app/setData/snapshot.mjs +1 -1
  271. package/dist/runtime/app.mjs +1 -1
  272. package/dist/runtime/bindingManifest.mjs +1 -0
  273. package/dist/runtime/capabilities.d.mts +74 -0
  274. package/dist/runtime/capabilities.mjs +1 -0
  275. package/dist/runtime/define/componentDefinition.mjs +1 -1
  276. package/dist/runtime/define/optionsApi.mjs +1 -1
  277. package/dist/runtime/define/props.mjs +1 -1
  278. package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
  279. package/dist/runtime/define.d.mts +5 -13
  280. package/dist/runtime/define.mjs +1 -1
  281. package/dist/runtime/diff.mjs +1 -1
  282. package/dist/runtime/features/inlineEvents.d.mts +6 -0
  283. package/dist/runtime/features/inlineEvents.mjs +1 -0
  284. package/dist/runtime/features/layout.d.mts +6 -0
  285. package/dist/runtime/features/layout.mjs +1 -0
  286. package/dist/runtime/features/patchStrategy.d.mts +6 -0
  287. package/dist/runtime/features/patchStrategy.mjs +1 -0
  288. package/dist/runtime/features/publicLayout.d.mts +23 -0
  289. package/dist/runtime/features/publicLayout.mjs +1 -0
  290. package/dist/runtime/features/scopedSlots.d.mts +22 -0
  291. package/dist/runtime/features/scopedSlots.mjs +1 -0
  292. package/dist/runtime/features/setDataHighFrequencyWarning.d.mts +6 -0
  293. package/dist/runtime/features/setDataHighFrequencyWarning.mjs +1 -0
  294. package/dist/runtime/features/templateRefs.d.mts +6 -0
  295. package/dist/runtime/features/templateRefs.mjs +1 -0
  296. package/dist/runtime/hooks/vue.d.mts +1 -2
  297. package/dist/runtime/hooks/vue.mjs +1 -1
  298. package/dist/runtime/index.d.mts +12 -14
  299. package/dist/runtime/inlineDataset.mjs +1 -0
  300. package/dist/runtime/jsxIsland.d.mts +2 -6
  301. package/dist/runtime/layoutBridge.d.mts +5 -9
  302. package/dist/runtime/pageLayout.d.mts +3 -4
  303. package/dist/runtime/platform.mjs +1 -1
  304. package/dist/runtime/publicRuntime.d.mts +21 -0
  305. package/dist/runtime/publicRuntime.mjs +1 -0
  306. package/dist/runtime/register/app.mjs +1 -1
  307. package/dist/runtime/register/component/lifecycle.mjs +1 -1
  308. package/dist/runtime/register/component/methods.mjs +1 -1
  309. package/dist/runtime/register/component/registerDefinition.mjs +1 -1
  310. package/dist/runtime/register/inline.mjs +1 -1
  311. package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -1
  312. package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
  313. package/dist/runtime/register/runtimeInstance/setupSnapshot.mjs +1 -0
  314. package/dist/runtime/register/runtimeInstance.mjs +1 -1
  315. package/dist/runtime/register/snapshot.mjs +1 -1
  316. package/dist/runtime/scopedSlots.mjs +1 -1
  317. package/dist/runtime/selectorQuery.mjs +1 -1
  318. package/dist/runtime/teardown.mjs +1 -0
  319. package/dist/runtime/templateRefTypes.d.mts +5 -2
  320. package/dist/runtime/templateRefs.mjs +1 -1
  321. package/dist/runtime/types/miniprogram.d.mts +3 -0
  322. package/dist/runtime/types/options.d.mts +2 -2
  323. package/dist/runtime/types/props.d.mts +1 -1
  324. package/dist/runtime/types/setData.d.mts +18 -1
  325. package/dist/runtime/types.d.mts +3 -3
  326. package/dist/runtime/vueCompat/router.d.mts +5 -4
  327. package/dist/runtime/vueCompat/router.mjs +1 -1
  328. package/dist/runtime/vueCompat/templateRef.mjs +1 -1
  329. package/dist/store/base.mjs +1 -1
  330. package/dist/store/define/optionsStyle.mjs +1 -1
  331. package/dist/store/define/setupStyle.mjs +1 -1
  332. package/dist/store/define/shared.mjs +1 -1
  333. package/dist/store/define.d.mts +10 -8
  334. package/dist/store/types.d.mts +4 -4
  335. package/dist/tt/jsx-runtime.d.mts +12 -0
  336. package/dist/tt/jsx-runtime.mjs +1 -0
  337. package/dist/vue-demi.d.mts +13 -14
  338. package/dist/vue-demi.mjs +1 -1
  339. package/dist/weapp/jsx-runtime.d.mts +12 -0
  340. package/dist/weapp/jsx-runtime.mjs +1 -0
  341. package/package.json +26 -22
  342. package/dist/dev/jsx-runtime.mjs +0 -1
  343. package/dist/runtime/templateRefs.d.mts +0 -10
  344. package/dist/weappIntrinsicElements/base.d.mts +0 -21
  345. package/dist/weappIntrinsicElements/elements/ad-custom.d.mts +0 -12
  346. package/dist/weappIntrinsicElements/elements/ad.d.mts +0 -15
  347. package/dist/weappIntrinsicElements/elements/audio.d.mts +0 -19
  348. package/dist/weappIntrinsicElements/elements/block.d.mts +0 -7
  349. package/dist/weappIntrinsicElements/elements/button.d.mts +0 -39
  350. package/dist/weappIntrinsicElements/elements/camera.d.mts +0 -17
  351. package/dist/weappIntrinsicElements/elements/canvas.d.mts +0 -17
  352. package/dist/weappIntrinsicElements/elements/checkbox-group.d.mts +0 -12
  353. package/dist/weappIntrinsicElements/elements/checkbox.d.mts +0 -12
  354. package/dist/weappIntrinsicElements/elements/cover-image.d.mts +0 -9
  355. package/dist/weappIntrinsicElements/elements/cover-view.d.mts +0 -9
  356. package/dist/weappIntrinsicElements/elements/editor.d.mts +0 -21
  357. package/dist/weappIntrinsicElements/elements/form.d.mts +0 -15
  358. package/dist/weappIntrinsicElements/elements/functional-page-navigator.d.mts +0 -14
  359. package/dist/weappIntrinsicElements/elements/icon.d.mts +0 -11
  360. package/dist/weappIntrinsicElements/elements/image.d.mts +0 -17
  361. package/dist/weappIntrinsicElements/elements/import.d.mts +0 -9
  362. package/dist/weappIntrinsicElements/elements/include.d.mts +0 -9
  363. package/dist/weappIntrinsicElements/elements/input.d.mts +0 -46
  364. package/dist/weappIntrinsicElements/elements/keyboard-accessory.d.mts +0 -7
  365. package/dist/weappIntrinsicElements/elements/label.d.mts +0 -9
  366. package/dist/weappIntrinsicElements/elements/live-player.d.mts +0 -34
  367. package/dist/weappIntrinsicElements/elements/live-pusher.d.mts +0 -56
  368. package/dist/weappIntrinsicElements/elements/map.d.mts +0 -104
  369. package/dist/weappIntrinsicElements/elements/match-media.d.mts +0 -15
  370. package/dist/weappIntrinsicElements/elements/movable-area.d.mts +0 -25
  371. package/dist/weappIntrinsicElements/elements/movable-view.d.mts +0 -25
  372. package/dist/weappIntrinsicElements/elements/navigation-bar.d.mts +0 -14
  373. package/dist/weappIntrinsicElements/elements/navigator.d.mts +0 -24
  374. package/dist/weappIntrinsicElements/elements/official-account.d.mts +0 -12
  375. package/dist/weappIntrinsicElements/elements/open-data.d.mts +0 -14
  376. package/dist/weappIntrinsicElements/elements/page-container.d.mts +0 -24
  377. package/dist/weappIntrinsicElements/elements/page-meta.d.mts +0 -22
  378. package/dist/weappIntrinsicElements/elements/picker-view-column.d.mts +0 -17
  379. package/dist/weappIntrinsicElements/elements/picker-view.d.mts +0 -17
  380. package/dist/weappIntrinsicElements/elements/picker.d.mts +0 -22
  381. package/dist/weappIntrinsicElements/elements/progress.d.mts +0 -20
  382. package/dist/weappIntrinsicElements/elements/radio-group.d.mts +0 -12
  383. package/dist/weappIntrinsicElements/elements/radio.d.mts +0 -12
  384. package/dist/weappIntrinsicElements/elements/rich-text.d.mts +0 -16
  385. package/dist/weappIntrinsicElements/elements/scroll-view.d.mts +0 -67
  386. package/dist/weappIntrinsicElements/elements/share-element.d.mts +0 -17
  387. package/dist/weappIntrinsicElements/elements/slider.d.mts +0 -22
  388. package/dist/weappIntrinsicElements/elements/slot.d.mts +0 -9
  389. package/dist/weappIntrinsicElements/elements/swiper-item.d.mts +0 -41
  390. package/dist/weappIntrinsicElements/elements/swiper.d.mts +0 -41
  391. package/dist/weappIntrinsicElements/elements/switch.d.mts +0 -13
  392. package/dist/weappIntrinsicElements/elements/template.d.mts +0 -11
  393. package/dist/weappIntrinsicElements/elements/text.d.mts +0 -14
  394. package/dist/weappIntrinsicElements/elements/textarea.d.mts +0 -39
  395. package/dist/weappIntrinsicElements/elements/video.d.mts +0 -70
  396. package/dist/weappIntrinsicElements/elements/view.d.mts +0 -12
  397. package/dist/weappIntrinsicElements/elements/voip-room.d.mts +0 -13
  398. package/dist/weappIntrinsicElements/elements/web-view.d.mts +0 -12
  399. package/dist/weappIntrinsicElements.d.mts +0 -153
  400. /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/defineProperty.mjs +0 -0
  401. /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPrimitive.mjs +0 -0
  402. /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPropertyKey.mjs +0 -0
  403. /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/typeof.mjs +0 -0
@@ -1,22 +1,24 @@
1
1
  import { toPlain } from "../../diff.mjs";
2
- import { checkPayloadSize, collapsePayload, mergeSiblingPayload } from "./payload.mjs";
3
2
  import { applySnapshotUpdate, cloneSnapshotValue, isDeepEqualValue, isShallowEqualValue, normalizeSetDataValue } from "./snapshot.mjs";
3
+ import { checkPayloadSize, collapsePayload, mergeSiblingPayload } from "./payload.mjs";
4
4
 
5
5
  //#region src/runtime/app/setData/patchScheduler.ts
6
- function runPatchUpdate(options) {
7
- const { state, computedRefs, dirtyComputedKeys, includeComputed, computedCompare, computedCompareMaxDepth, computedCompareMaxKeys, currentAdapter, shouldIncludeKey, maxPatchKeys, maxPayloadBytes, mergeSiblingThreshold, mergeSiblingMaxInflationRatio, mergeSiblingMaxParentBytes, mergeSiblingSkipArray, elevateTopKeyThreshold, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths, plainCache, plainCacheEligibility, pendingPatches, fallbackTopKeys, latestSnapshot, latestComputedSnapshot, needsFullSnapshot, emitDebug, runDiffUpdate } = options;
6
+ function preparePatchUpdate(options) {
7
+ const { state, computedRefs, dirtyComputedKeys, includeComputed, computedCompare, computedCompareMaxDepth, computedCompareMaxKeys, shouldIncludeKey, maxPatchKeys, maxPayloadBytes, mergeSiblingThreshold, mergeSiblingMaxInflationRatio, mergeSiblingMaxParentBytes, mergeSiblingSkipArray, elevateTopKeyThreshold, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths, plainCache, plainCacheEligibility, pendingPatches, fallbackTopKeys, dispatchedSnapshot, dispatchedComputedSnapshot } = options;
8
8
  if (pendingPatches.size > maxPatchKeys) {
9
- needsFullSnapshot.value = true;
10
9
  const pendingCount = pendingPatches.size;
11
10
  pendingPatches.clear();
12
11
  dirtyComputedKeys.clear();
13
- emitDebug({
14
- mode: "diff",
12
+ return {
13
+ type: "fallback",
15
14
  reason: "maxPatchKeys",
16
- pendingPatchKeys: pendingCount,
17
- payloadKeys: 0
18
- });
19
- return runDiffUpdate("maxPatchKeys");
15
+ debug: {
16
+ mode: "diff",
17
+ reason: "maxPatchKeys",
18
+ pendingPatchKeys: pendingCount,
19
+ payloadKeys: 0
20
+ }
21
+ };
20
22
  }
21
23
  const seen = /* @__PURE__ */ new WeakMap();
22
24
  const plainByPath = /* @__PURE__ */ new Map();
@@ -40,9 +42,9 @@ function runPatchUpdate(options) {
40
42
  const getStateValueByPath = (path) => {
41
43
  const segments = path.split(".").filter(Boolean);
42
44
  let current = state;
43
- for (const seg of segments) {
44
- if (current == null) return current;
45
- current = current[seg];
45
+ for (const segment of segments) {
46
+ if (current == null || typeof current !== "object") return current;
47
+ current = Reflect.get(current, segment);
46
48
  }
47
49
  return current;
48
50
  };
@@ -71,16 +73,10 @@ function runPatchUpdate(options) {
71
73
  }
72
74
  fallbackTopKeys.clear();
73
75
  }
74
- for (const [path, entry] of patchEntries) {
75
- if ((entry.kind === "array" ? "set" : entry.op) === "delete") {
76
- payload[path] = null;
77
- continue;
78
- }
79
- payload[path] = getPlainByPath(path);
80
- }
76
+ for (const [path, entry] of patchEntries) payload[path] = (entry.kind === "array" ? "set" : entry.op) === "delete" ? null : getPlainByPath(path);
81
77
  let computedDirtyProcessed = 0;
78
+ const computedUpdates = Object.create(null);
82
79
  if (includeComputed && dirtyComputedKeys.size) {
83
- const computedPatch = Object.create(null);
84
80
  const keys = [...dirtyComputedKeys];
85
81
  dirtyComputedKeys.clear();
86
82
  computedDirtyProcessed = keys.length;
@@ -95,12 +91,11 @@ function runPatchUpdate(options) {
95
91
  functionPaths,
96
92
  _path: key
97
93
  });
98
- const prevValue = latestComputedSnapshot[key];
94
+ const prevValue = dispatchedComputedSnapshot[key];
99
95
  if (computedCompare === "deep" ? isDeepEqualValue(prevValue, nextValue, computedCompareMaxDepth, { keys: computedCompareMaxKeys }) : computedCompare === "shallow" ? isShallowEqualValue(prevValue, nextValue) : Object.is(prevValue, nextValue)) continue;
100
- computedPatch[key] = normalizeSetDataValue(nextValue);
101
- latestComputedSnapshot[key] = cloneSnapshotValue(nextValue);
96
+ payload[key] = normalizeSetDataValue(nextValue);
97
+ computedUpdates[key] = cloneSnapshotValue(nextValue);
102
98
  }
103
- Object.assign(payload, computedPatch);
104
99
  }
105
100
  let collapsedPayload = collapsePayload(payload);
106
101
  let mergedSiblingParents = 0;
@@ -118,41 +113,42 @@ function runPatchUpdate(options) {
118
113
  collapsedPayload = collapsePayload(mergedResult.out);
119
114
  }
120
115
  const sizeCheck = checkPayloadSize(collapsedPayload, maxPayloadBytes);
121
- const shouldFallback = sizeCheck.fallback;
122
- emitDebug({
123
- mode: shouldFallback ? "diff" : "patch",
124
- reason: shouldFallback ? "maxPayloadBytes" : "patch",
116
+ const payloadKeys = Object.keys(collapsedPayload).length;
117
+ const debug = {
118
+ mode: sizeCheck.fallback ? "diff" : "patch",
119
+ reason: sizeCheck.fallback ? "maxPayloadBytes" : "patch",
125
120
  pendingPatchKeys: patchEntries.length,
126
- payloadKeys: Object.keys(collapsedPayload).length,
121
+ payloadKeys,
127
122
  mergedSiblingParents: mergedSiblingParents || void 0,
128
123
  computedDirtyKeys: computedDirtyProcessed || void 0,
129
124
  estimatedBytes: sizeCheck.estimatedBytes,
130
125
  bytes: sizeCheck.bytes
131
- });
132
- if (shouldFallback) {
133
- needsFullSnapshot.value = true;
134
- pendingPatches.clear();
135
- dirtyComputedKeys.clear();
136
- return runDiffUpdate("maxPayloadBytes");
137
- }
138
- if (!Object.keys(collapsedPayload).length) return;
126
+ };
127
+ if (sizeCheck.fallback) return {
128
+ type: "fallback",
129
+ reason: "maxPayloadBytes",
130
+ debug
131
+ };
132
+ if (!payloadKeys) return;
133
+ const snapshot = { ...dispatchedSnapshot };
134
+ const clonedParents = /* @__PURE__ */ new WeakSet();
139
135
  for (const [path, value] of Object.entries(collapsedPayload)) {
136
+ var _entry$op;
140
137
  const entry = entryMap.get(path);
141
- if (entry) applySnapshotUpdate(latestSnapshot, path, value, entry.kind === "array" ? "set" : entry.op, { cloneValue: false });
142
- else applySnapshotUpdate(latestSnapshot, path, value, "set", { cloneValue: false });
143
- }
144
- if (typeof currentAdapter.setData === "function") {
145
- const result = currentAdapter.setData(collapsedPayload);
146
- if (result && typeof result.then === "function") return result.catch(() => {});
138
+ applySnapshotUpdate(snapshot, path, value, (entry === null || entry === void 0 ? void 0 : entry.kind) === "array" ? "set" : (_entry$op = entry === null || entry === void 0 ? void 0 : entry.op) !== null && _entry$op !== void 0 ? _entry$op : "set", {
139
+ cloneValue: false,
140
+ clonedParents
141
+ });
147
142
  }
148
- emitDebug({
149
- mode: "patch",
150
- reason: "patch",
151
- pendingPatchKeys: patchEntries.length,
152
- payloadKeys: Object.keys(collapsedPayload).length
153
- });
143
+ return {
144
+ type: "patch",
145
+ payload: collapsedPayload,
146
+ snapshot,
147
+ computedUpdates: Object.keys(computedUpdates).length ? computedUpdates : void 0,
148
+ debug
149
+ };
154
150
  }
155
151
 
156
152
  //#endregion
157
- export { runPatchUpdate };
153
+ export { preparePatchUpdate };
158
154
  //# sourceMappingURL=patchScheduler.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"patchScheduler.mjs","names":[],"sources":["../../../../../src/runtime/app/setData/patchScheduler.ts"],"sourcesContent":["import type { SetDataDebugInfo } from '../../types'\nimport { toPlain } from '../../diff'\nimport { checkPayloadSize, collapsePayload, mergeSiblingPayload } from './payload'\nimport { applySnapshotUpdate, cloneSnapshotValue, isDeepEqualValue, isShallowEqualValue, normalizeSetDataValue } from './snapshot'\n\ninterface PatchEntry {\n kind: 'property' | 'array'\n op: 'set' | 'delete'\n}\n\nexport function runPatchUpdate(options: {\n state: Record<string, any>\n computedRefs: Record<string, { value: any }>\n dirtyComputedKeys: Set<string>\n includeComputed: boolean\n computedCompare: 'reference' | 'shallow' | 'deep'\n computedCompareMaxDepth: number\n computedCompareMaxKeys: number\n currentAdapter: { setData?: (payload: Record<string, any>) => void | Promise<void> }\n shouldIncludeKey: (key: string) => boolean\n maxPatchKeys: number\n maxPayloadBytes: number\n mergeSiblingThreshold: number\n mergeSiblingMaxInflationRatio: number\n mergeSiblingMaxParentBytes: number\n mergeSiblingSkipArray: boolean\n elevateTopKeyThreshold: number\n toPlainMaxDepth: number\n toPlainMaxKeys: number\n includeFunctions?: boolean\n functionPaths: string[]\n plainCache: WeakMap<object, { version: number, value: any }>\n plainCacheEligibility?: WeakMap<object, boolean>\n pendingPatches: Map<string, PatchEntry>\n fallbackTopKeys: Set<string>\n latestSnapshot: Record<string, any>\n latestComputedSnapshot: Record<string, any>\n needsFullSnapshot: { value: boolean }\n emitDebug: (info: SetDataDebugInfo) => void\n runDiffUpdate: (reason?: SetDataDebugInfo['reason']) => void | Promise<void>\n}) {\n const {\n state,\n computedRefs,\n dirtyComputedKeys,\n includeComputed,\n computedCompare,\n computedCompareMaxDepth,\n computedCompareMaxKeys,\n currentAdapter,\n shouldIncludeKey,\n maxPatchKeys,\n maxPayloadBytes,\n mergeSiblingThreshold,\n mergeSiblingMaxInflationRatio,\n mergeSiblingMaxParentBytes,\n mergeSiblingSkipArray,\n elevateTopKeyThreshold,\n toPlainMaxDepth,\n toPlainMaxKeys,\n includeFunctions = false,\n functionPaths,\n plainCache,\n plainCacheEligibility,\n pendingPatches,\n fallbackTopKeys,\n latestSnapshot,\n latestComputedSnapshot,\n needsFullSnapshot,\n emitDebug,\n runDiffUpdate,\n } = options\n\n if (pendingPatches.size > maxPatchKeys) {\n needsFullSnapshot.value = true\n const pendingCount = pendingPatches.size\n pendingPatches.clear()\n dirtyComputedKeys.clear()\n emitDebug({\n mode: 'diff',\n reason: 'maxPatchKeys',\n pendingPatchKeys: pendingCount,\n payloadKeys: 0,\n })\n return runDiffUpdate('maxPatchKeys')\n }\n\n const seen = new WeakMap<object, any>()\n const plainByPath = new Map<string, any>()\n const payload: Record<string, any> = Object.create(null)\n const patchEntriesRaw = [...pendingPatches.entries()]\n\n if (Number.isFinite(elevateTopKeyThreshold) && elevateTopKeyThreshold > 0) {\n const counts = new Map<string, number>()\n for (const [path] of patchEntriesRaw) {\n const top = path.split('.', 1)[0]\n counts.set(top, (counts.get(top) ?? 0) + 1)\n }\n for (const [top, count] of counts) {\n if (count >= elevateTopKeyThreshold) {\n fallbackTopKeys.add(top)\n }\n }\n }\n\n const patchEntries = patchEntriesRaw.filter(([path]) => {\n for (const topKey of fallbackTopKeys) {\n if (path === topKey || path.startsWith(`${topKey}.`)) {\n return false\n }\n }\n return true\n })\n const entryMap = new Map(patchEntries)\n pendingPatches.clear()\n\n const getStateValueByPath = (path: string) => {\n const segments = path.split('.').filter(Boolean)\n let current: any = state as any\n for (const seg of segments) {\n if (current == null) {\n return current\n }\n current = current[seg]\n }\n return current\n }\n\n const getPlainByPath = (path: string) => {\n if (plainByPath.has(path)) {\n return plainByPath.get(path)\n }\n const value = normalizeSetDataValue(\n toPlain(getStateValueByPath(path), seen, { cache: plainCache, cacheEligibility: plainCacheEligibility, maxDepth: toPlainMaxDepth, maxKeys: toPlainMaxKeys, includeFunctions, functionPaths, _path: path }),\n )\n plainByPath.set(path, value)\n return value\n }\n\n if (fallbackTopKeys.size) {\n for (const topKey of fallbackTopKeys) {\n if (!shouldIncludeKey(topKey)) {\n continue\n }\n payload[topKey] = getPlainByPath(topKey)\n entryMap.set(topKey, { kind: 'property', op: 'set' })\n }\n fallbackTopKeys.clear()\n }\n\n for (const [path, entry] of patchEntries) {\n const effectiveOp = entry.kind === 'array' ? 'set' : entry.op\n if (effectiveOp === 'delete') {\n payload[path] = null\n continue\n }\n payload[path] = getPlainByPath(path)\n }\n\n let computedDirtyProcessed = 0\n if (includeComputed && dirtyComputedKeys.size) {\n const computedPatch: Record<string, any> = Object.create(null)\n const keys = [...dirtyComputedKeys]\n dirtyComputedKeys.clear()\n computedDirtyProcessed = keys.length\n for (const key of keys) {\n if (!shouldIncludeKey(key)) {\n continue\n }\n const nextValue = toPlain(computedRefs[key].value, seen, { cache: plainCache, cacheEligibility: plainCacheEligibility, maxDepth: toPlainMaxDepth, maxKeys: toPlainMaxKeys, includeFunctions, functionPaths, _path: key })\n const prevValue = latestComputedSnapshot[key]\n const equal = computedCompare === 'deep'\n ? isDeepEqualValue(prevValue, nextValue, computedCompareMaxDepth, { keys: computedCompareMaxKeys })\n : computedCompare === 'shallow'\n ? isShallowEqualValue(prevValue, nextValue)\n : Object.is(prevValue, nextValue)\n if (equal) {\n continue\n }\n computedPatch[key] = normalizeSetDataValue(nextValue)\n latestComputedSnapshot[key] = cloneSnapshotValue(nextValue)\n }\n Object.assign(payload, computedPatch)\n }\n\n let collapsedPayload = collapsePayload(payload)\n let mergedSiblingParents = 0\n if (mergeSiblingThreshold) {\n const mergedResult = mergeSiblingPayload({\n input: collapsedPayload,\n entryMap,\n getPlainByPath,\n mergeSiblingThreshold,\n mergeSiblingSkipArray,\n mergeSiblingMaxParentBytes,\n mergeSiblingMaxInflationRatio,\n })\n mergedSiblingParents = mergedResult.merged\n collapsedPayload = collapsePayload(mergedResult.out)\n }\n const sizeCheck = checkPayloadSize(collapsedPayload, maxPayloadBytes)\n const shouldFallback = sizeCheck.fallback\n emitDebug({\n mode: shouldFallback ? 'diff' : 'patch',\n reason: shouldFallback ? 'maxPayloadBytes' : 'patch',\n pendingPatchKeys: patchEntries.length,\n payloadKeys: Object.keys(collapsedPayload).length,\n mergedSiblingParents: mergedSiblingParents || undefined,\n computedDirtyKeys: computedDirtyProcessed || undefined,\n estimatedBytes: sizeCheck.estimatedBytes,\n bytes: sizeCheck.bytes,\n })\n if (shouldFallback) {\n needsFullSnapshot.value = true\n pendingPatches.clear()\n dirtyComputedKeys.clear()\n return runDiffUpdate('maxPayloadBytes')\n }\n if (!Object.keys(collapsedPayload).length) {\n return\n }\n\n // 保持快照同步,确保 patch 模式可安全回退到 diff。\n for (const [path, value] of Object.entries(collapsedPayload)) {\n const entry = entryMap.get(path)\n if (entry) {\n applySnapshotUpdate(latestSnapshot, path, value, entry.kind === 'array' ? 'set' : entry.op, { cloneValue: false })\n }\n else {\n // 计算属性或 diffSnapshots 生成的顶层键。\n applySnapshotUpdate(latestSnapshot, path, value, 'set', { cloneValue: false })\n }\n }\n\n if (typeof currentAdapter.setData === 'function') {\n const result = currentAdapter.setData(collapsedPayload)\n if (result && typeof (result as Promise<any>).then === 'function') {\n return (result as Promise<void>).catch(() => {})\n }\n }\n emitDebug({\n mode: 'patch',\n reason: 'patch',\n pendingPatchKeys: patchEntries.length,\n payloadKeys: Object.keys(collapsedPayload).length,\n })\n}\n"],"mappings":";;;;;AAUA,SAAgB,eAAe,SA8B5B;CACD,MAAM,EACJ,OACA,cACA,mBACA,iBACA,iBACA,yBACA,wBACA,gBACA,kBACA,cACA,iBACA,uBACA,+BACA,4BACA,uBACA,wBACA,iBACA,gBACA,mBAAmB,OACnB,eACA,YACA,uBACA,gBACA,iBACA,gBACA,wBACA,mBACA,WACA,kBACE;CAEJ,IAAI,eAAe,OAAO,cAAc;EACtC,kBAAkB,QAAQ;E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"}
1
+ {"version":3,"file":"patchScheduler.mjs","names":[],"sources":["../../../../../src/runtime/app/setData/patchScheduler.ts"],"sourcesContent":["import type { SetDataDebugInfo } from '../../types'\nimport type { SetDataPayload, SetDataSnapshot } from './commitTracker'\nimport { toPlain } from '../../diff'\nimport { checkPayloadSize, collapsePayload, mergeSiblingPayload } from './payload'\nimport { applySnapshotUpdate, cloneSnapshotValue, isDeepEqualValue, isShallowEqualValue, normalizeSetDataValue } from './snapshot'\n\ninterface PatchEntry {\n kind: 'property' | 'array'\n op: 'set' | 'delete'\n}\n\nexport type PatchPreparation\n = | undefined\n | {\n type: 'fallback'\n reason: 'maxPatchKeys' | 'maxPayloadBytes'\n debug: SetDataDebugInfo\n }\n | {\n type: 'patch'\n payload: SetDataPayload\n snapshot: SetDataSnapshot\n computedUpdates?: SetDataSnapshot\n debug: SetDataDebugInfo\n }\n\nexport interface PatchPrepareOptions {\n state: Record<string, unknown>\n computedRefs: Record<string, { value: unknown }>\n dirtyComputedKeys: Set<string>\n includeComputed: boolean\n computedCompare: 'reference' | 'shallow' | 'deep'\n computedCompareMaxDepth: number\n computedCompareMaxKeys: number\n shouldIncludeKey: (key: string) => boolean\n maxPatchKeys: number\n maxPayloadBytes: number\n mergeSiblingThreshold: number\n mergeSiblingMaxInflationRatio: number\n mergeSiblingMaxParentBytes: number\n mergeSiblingSkipArray: boolean\n elevateTopKeyThreshold: number\n toPlainMaxDepth: number\n toPlainMaxKeys: number\n includeFunctions?: boolean\n functionPaths: string[]\n plainCache: WeakMap<object, { version: number, value: unknown }>\n plainCacheEligibility?: WeakMap<object, boolean>\n pendingPatches: Map<string, PatchEntry>\n fallbackTopKeys: Set<string>\n dispatchedSnapshot: SetDataSnapshot\n dispatchedComputedSnapshot: SetDataSnapshot\n}\n\nexport function preparePatchUpdate(options: PatchPrepareOptions): PatchPreparation {\n const {\n state,\n computedRefs,\n dirtyComputedKeys,\n includeComputed,\n computedCompare,\n computedCompareMaxDepth,\n computedCompareMaxKeys,\n shouldIncludeKey,\n maxPatchKeys,\n maxPayloadBytes,\n mergeSiblingThreshold,\n mergeSiblingMaxInflationRatio,\n mergeSiblingMaxParentBytes,\n mergeSiblingSkipArray,\n elevateTopKeyThreshold,\n toPlainMaxDepth,\n toPlainMaxKeys,\n includeFunctions = false,\n functionPaths,\n plainCache,\n plainCacheEligibility,\n pendingPatches,\n fallbackTopKeys,\n dispatchedSnapshot,\n dispatchedComputedSnapshot,\n } = options\n\n if (pendingPatches.size > maxPatchKeys) {\n const pendingCount = pendingPatches.size\n pendingPatches.clear()\n dirtyComputedKeys.clear()\n return {\n type: 'fallback',\n reason: 'maxPatchKeys',\n debug: {\n mode: 'diff',\n reason: 'maxPatchKeys',\n pendingPatchKeys: pendingCount,\n payloadKeys: 0,\n },\n }\n }\n\n const seen = new WeakMap<object, unknown>()\n const plainByPath = new Map<string, unknown>()\n const payload: SetDataPayload = Object.create(null) as SetDataPayload\n const patchEntriesRaw = [...pendingPatches.entries()]\n\n if (Number.isFinite(elevateTopKeyThreshold) && elevateTopKeyThreshold > 0) {\n const counts = new Map<string, number>()\n for (const [path] of patchEntriesRaw) {\n const top = path.split('.', 1)[0]!\n counts.set(top, (counts.get(top) ?? 0) + 1)\n }\n for (const [top, count] of counts) {\n if (count >= elevateTopKeyThreshold) {\n fallbackTopKeys.add(top)\n }\n }\n }\n\n const patchEntries = patchEntriesRaw.filter(([path]) => {\n for (const topKey of fallbackTopKeys) {\n if (path === topKey || path.startsWith(`${topKey}.`)) {\n return false\n }\n }\n return true\n })\n const entryMap = new Map<string, PatchEntry>(patchEntries)\n pendingPatches.clear()\n\n const getStateValueByPath = (path: string) => {\n const segments = path.split('.').filter(Boolean)\n let current: unknown = state\n for (const segment of segments) {\n if (current == null || typeof current !== 'object') {\n return current\n }\n current = Reflect.get(current, segment)\n }\n return current\n }\n\n const getPlainByPath = (path: string) => {\n if (plainByPath.has(path)) {\n return plainByPath.get(path)\n }\n const value = normalizeSetDataValue(\n toPlain(getStateValueByPath(path), seen, {\n cache: plainCache,\n cacheEligibility: plainCacheEligibility,\n maxDepth: toPlainMaxDepth,\n maxKeys: toPlainMaxKeys,\n includeFunctions,\n functionPaths,\n _path: path,\n }),\n )\n plainByPath.set(path, value)\n return value\n }\n\n if (fallbackTopKeys.size) {\n for (const topKey of fallbackTopKeys) {\n if (!shouldIncludeKey(topKey)) {\n continue\n }\n payload[topKey] = getPlainByPath(topKey)\n entryMap.set(topKey, { kind: 'property', op: 'set' })\n }\n fallbackTopKeys.clear()\n }\n\n for (const [path, entry] of patchEntries) {\n const effectiveOp = entry.kind === 'array' ? 'set' : entry.op\n payload[path] = effectiveOp === 'delete'\n ? null\n : getPlainByPath(path)\n }\n\n let computedDirtyProcessed = 0\n const computedUpdates: SetDataSnapshot = Object.create(null) as SetDataSnapshot\n if (includeComputed && dirtyComputedKeys.size) {\n const keys = [...dirtyComputedKeys]\n dirtyComputedKeys.clear()\n computedDirtyProcessed = keys.length\n for (const key of keys) {\n if (!shouldIncludeKey(key)) {\n continue\n }\n const nextValue = toPlain(computedRefs[key]!.value, seen, {\n cache: plainCache,\n cacheEligibility: plainCacheEligibility,\n maxDepth: toPlainMaxDepth,\n maxKeys: toPlainMaxKeys,\n includeFunctions,\n functionPaths,\n _path: key,\n })\n const prevValue = dispatchedComputedSnapshot[key]\n const equal = computedCompare === 'deep'\n ? isDeepEqualValue(prevValue, nextValue, computedCompareMaxDepth, { keys: computedCompareMaxKeys })\n : computedCompare === 'shallow'\n ? isShallowEqualValue(prevValue, nextValue)\n : Object.is(prevValue, nextValue)\n if (equal) {\n continue\n }\n payload[key] = normalizeSetDataValue(nextValue)\n computedUpdates[key] = cloneSnapshotValue(nextValue)\n }\n }\n\n let collapsedPayload = collapsePayload(payload)\n let mergedSiblingParents = 0\n if (mergeSiblingThreshold) {\n const mergedResult = mergeSiblingPayload({\n input: collapsedPayload,\n entryMap,\n getPlainByPath,\n mergeSiblingThreshold,\n mergeSiblingSkipArray,\n mergeSiblingMaxParentBytes,\n mergeSiblingMaxInflationRatio,\n })\n mergedSiblingParents = mergedResult.merged\n collapsedPayload = collapsePayload(mergedResult.out)\n }\n const sizeCheck = checkPayloadSize(collapsedPayload, maxPayloadBytes)\n const payloadKeys = Object.keys(collapsedPayload).length\n const debug: SetDataDebugInfo = {\n mode: sizeCheck.fallback ? 'diff' : 'patch',\n reason: sizeCheck.fallback ? 'maxPayloadBytes' : 'patch',\n pendingPatchKeys: patchEntries.length,\n payloadKeys,\n mergedSiblingParents: mergedSiblingParents || undefined,\n computedDirtyKeys: computedDirtyProcessed || undefined,\n estimatedBytes: sizeCheck.estimatedBytes,\n bytes: sizeCheck.bytes,\n }\n if (sizeCheck.fallback) {\n return {\n type: 'fallback',\n reason: 'maxPayloadBytes',\n debug,\n }\n }\n if (!payloadKeys) {\n return undefined\n }\n\n const snapshot: SetDataSnapshot = { ...dispatchedSnapshot }\n const clonedParents = new WeakSet<object>()\n for (const [path, value] of Object.entries(collapsedPayload)) {\n const entry = entryMap.get(path)\n applySnapshotUpdate(\n snapshot,\n path,\n value,\n entry?.kind === 'array' ? 'set' : (entry?.op ?? 'set'),\n { cloneValue: false, clonedParents },\n )\n }\n\n return {\n type: 'patch',\n payload: collapsedPayload,\n snapshot,\n computedUpdates: Object.keys(computedUpdates).length ? computedUpdates : undefined,\n debug,\n }\n}\n"],"mappings":";;;;;AAsDA,SAAgB,mBAAmB,SAAgD;CACjF,MAAM,EACJ,OACA,cACA,mBACA,iBACA,iBACA,yBACA,wBACA,kBACA,cACA,iBACA,uBACA,+BACA,4BACA,uBACA,wBACA,iBACA,gBACA,mBAAmB,OACnB,eACA,YACA,uBACA,gBACA,iBACA,oBACA,+BACE;CAEJ,IAAI,eAAe,OAAO,cAAc;EACtC,MAAM,eAAe,eAAe;EACpC,eAAe,MAAM;EACrB,kBAAkB,MAAM;EACxB,OAAO;GACL,MAAM;GACN,QAAQ;GACR,OAAO;IACL,MAAM;IACN,QAAQ;IACR,kBAAkB;IAClB,aAAa;GACf;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AAY,iBAAiB,kBAAkB,eAAe;CACpE,MAAM,cAAc,OAAO,KAAK,gBAAgB,CAAC,CAAC;CAClD,MAAM,QAA0B;EAC9B,MAAM,UAAU,WAAW,SAAS;EACpC,QAAQ,UAAU,WAAW,oBAAoB;EACjD,kBAAkB,aAAa;EAC/B;EACA,sBAAsB,wBAAwB;EAC9C,mBAAmB,0BAA0B;EAC7C,gBAAgB,UAAU;EAC1B,OAAO,UAAU;CACnB;CACA,IAAI,UAAU,UACZ,OAAO;EACL,MAAM;EACN,QAAQ;EACR;CACF;CAEF,IAAI,CAAC,aACH;CAGF,MAAM,WAA4B,EAAE,GAAG,mBAAmB;CAC1D,MAAM,gCAAgB,IAAI,QAAgB;CAC1C,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,gBAAgB,GAAG;;EAC5D,MAAM,QAAQ,SAAS,IAAI,IAAI;EAC/B,oBACE,UACA,MACA,sDACA,MAAO,UAAS,UAAU,mEAAS,MAAO,mDAAM,OAChD;GAAE,YAAY;GAAO;EAAc,CACrC;CACF;CAEA,OAAO;EACL,MAAM;EACN,SAAS;EACT;EACA,iBAAiB,OAAO,KAAK,eAAe,CAAC,CAAC,SAAS,kBAAkB;EACzE;CACF;AACF"}
@@ -0,0 +1,51 @@
1
+ import { SetDataDebugInfo } from "../../types/setData.mjs";
2
+ import "../../types.mjs";
3
+ import { CommitAwareSetDataAdapter } from "./commitTracker.mjs";
4
+ import "../../capabilities.mjs";
5
+ import { WevuRuntimeBindingManifestV1 } from "@weapp-core/constants";
6
+ //#region src/runtime/app/setData/scheduler.d.ts
7
+ export interface SetDataSchedulerOptions {
8
+ state: Record<string, any>;
9
+ setupState?: Record<string, any>;
10
+ snapshotOmitKeys?: Set<string>;
11
+ computedRefs: Record<string, {
12
+ value: any;
13
+ }>;
14
+ dirtyComputedKeys: Set<string>;
15
+ includeComputed: boolean;
16
+ setDataStrategy: 'diff' | 'patch';
17
+ computedCompare: 'reference' | 'shallow' | 'deep';
18
+ computedCompareMaxDepth: number;
19
+ computedCompareMaxKeys: number;
20
+ currentAdapter: CommitAwareSetDataAdapter;
21
+ shouldIncludeKey: (key: string) => boolean;
22
+ maxPatchKeys: number;
23
+ maxPayloadBytes: number;
24
+ mergeSiblingThreshold: number;
25
+ mergeSiblingMaxInflationRatio: number;
26
+ mergeSiblingMaxParentBytes: number;
27
+ mergeSiblingSkipArray: boolean;
28
+ elevateTopKeyThreshold: number;
29
+ prelinkMaxDepth?: number;
30
+ prelinkMaxKeys?: number;
31
+ toPlainMaxDepth: number;
32
+ toPlainMaxKeys: number;
33
+ includeFunctions?: boolean;
34
+ functionPaths: string[];
35
+ debug: ((info: SetDataDebugInfo) => void) | undefined;
36
+ debugWhen: 'fallback' | 'always';
37
+ debugSampleRate: number;
38
+ bindingManifest?: WevuRuntimeBindingManifestV1;
39
+ loopWarning: false | {
40
+ sampleWindowMs: number;
41
+ maxFlushes: number;
42
+ coolDownMs: number;
43
+ };
44
+ targetLabel?: string;
45
+ runTracker: () => void;
46
+ isMounted: () => boolean;
47
+ initialSnapshot?: Record<string, any>;
48
+ initialState?: Record<string, any>;
49
+ }
50
+ //#endregion
51
+ //# sourceMappingURL=scheduler.d.mts.map
@@ -3,22 +3,19 @@ import { getReactiveVersion, isReactive } from "../../../reactivity/reactive.mjs
3
3
  import { isRef } from "../../../reactivity/ref.mjs";
4
4
  import { hasOwn } from "../../../utils.mjs";
5
5
  import { hasTrackableSetupBinding } from "../../setupTracking.mjs";
6
+ import { resolveBindingDiagnostics } from "../../bindingManifest.mjs";
6
7
  import { diffSnapshots, toPlain } from "../../diff.mjs";
7
8
  import { collectSnapshot } from "./snapshot.mjs";
8
- import { runPatchUpdate } from "./patchScheduler.mjs";
9
+ import { createSetDataCommitTracker } from "./commitTracker.mjs";
9
10
 
10
11
  //#region src/runtime/app/setData/scheduler.ts
11
12
  function createSetDataScheduler(options) {
12
- const { state, setupState, snapshotOmitKeys, computedRefs, dirtyComputedKeys, includeComputed, setDataStrategy, computedCompare, computedCompareMaxDepth, computedCompareMaxKeys, currentAdapter, shouldIncludeKey, maxPatchKeys, maxPayloadBytes, mergeSiblingThreshold, mergeSiblingMaxInflationRatio, mergeSiblingMaxParentBytes, mergeSiblingSkipArray, elevateTopKeyThreshold, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths, debug, debugWhen, debugSampleRate, loopWarning, targetLabel, runTracker, isMounted, initialSnapshot, initialState } = options;
13
+ const { state, setupState, snapshotOmitKeys, computedRefs, dirtyComputedKeys, includeComputed, setDataStrategy, currentAdapter, shouldIncludeKey, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths, debug, debugWhen, debugSampleRate, bindingManifest, loopWarning, targetLabel, runTracker, isMounted, initialSnapshot, initialState } = options;
13
14
  const plainCache = /* @__PURE__ */ new WeakMap();
14
15
  const plainCacheEligibility = /* @__PURE__ */ new WeakMap();
15
- let latestSnapshot = {};
16
- let latestComputedSnapshot = Object.create(null);
17
- const latestStateTokens = Object.create(null);
18
- const latestComputedTokens = Object.create(null);
19
- const needsFullSnapshot = { value: setDataStrategy === "patch" };
20
- const pendingPatches = /* @__PURE__ */ new Map();
21
- const fallbackTopKeys = /* @__PURE__ */ new Set();
16
+ const initialSnapshotBaseline = {};
17
+ const dispatchedStateTokens = Object.create(null);
18
+ const dispatchedComputedTokens = Object.create(null);
22
19
  const flushTimes = [];
23
20
  let lastLoopWarningAt = Number.NEGATIVE_INFINITY;
24
21
  const initialStateKeys = new Set(initialState && typeof initialState === "object" ? Object.keys(initialState) : []);
@@ -67,7 +64,7 @@ function createSetDataScheduler(options) {
67
64
  };
68
65
  const shouldIncludeSnapshotKey = (key) => shouldIncludeKey(key) && !(snapshotOmitKeys === null || snapshotOmitKeys === void 0 ? void 0 : snapshotOmitKeys.has(key));
69
66
  if (initialSnapshot) {
70
- for (const [key, value] of Object.entries(initialSnapshot)) if (shouldIncludeSnapshotKey(key)) latestSnapshot[key] = value;
67
+ for (const [key, value] of Object.entries(initialSnapshot)) if (shouldIncludeSnapshotKey(key)) initialSnapshotBaseline[key] = value;
71
68
  }
72
69
  const syncInitialSnapshotTokens = () => {
73
70
  if (!initialSnapshot) return;
@@ -76,13 +73,13 @@ function createSetDataScheduler(options) {
76
73
  for (const key of Object.keys(initialSnapshot)) {
77
74
  if (!shouldIncludeSnapshotKey(key)) continue;
78
75
  if (rawSetupState && hasOwn(rawSetupState, key)) {
79
- latestStateTokens[key] = createValueToken(rawSetupState[key]);
76
+ dispatchedStateTokens[key] = createValueToken(rawSetupState[key]);
80
77
  continue;
81
78
  }
82
79
  if (hasOwn(rawState, key)) {
83
80
  if (initialStateKeys.has(key)) continue;
84
81
  rawState[key] = initialSnapshot[key];
85
- latestStateTokens[key] = createValueToken(rawState[key]);
82
+ dispatchedStateTokens[key] = createValueToken(rawState[key]);
86
83
  }
87
84
  }
88
85
  };
@@ -98,16 +95,45 @@ function createSetDataScheduler(options) {
98
95
  }
99
96
  return matches;
100
97
  };
101
- const emitDebug = (info) => {
98
+ const emitDebug = (info, pathSource) => {
102
99
  if (!debug) return;
103
100
  const isFallback = info.reason !== "patch" && info.reason !== "diff";
104
101
  if (debugWhen === "fallback" && !isFallback) return;
105
- if (debugSampleRate < 1 && Math.random() > debugSampleRate) return;
102
+ if (info.reason !== "commitFailure" && debugSampleRate < 1 && Math.random() > debugSampleRate) return;
103
+ let debugInfo = info;
104
+ if (bindingManifest) {
105
+ const paths = typeof pathSource === "function" ? pathSource() : pathSource !== null && pathSource !== void 0 ? pathSource : [];
106
+ const wholeSnapshotFallback = info.reason === "needsFullSnapshot" || info.reason === "maxPatchKeys" || info.reason === "maxPayloadBytes";
107
+ debugInfo = {
108
+ ...info,
109
+ bindings: resolveBindingDiagnostics(bindingManifest, paths, wholeSnapshotFallback)
110
+ };
111
+ }
106
112
  try {
107
- debug(info);
113
+ debug(debugInfo);
108
114
  } catch (_unused) {}
109
115
  };
110
- const recordFlushForLoopWarning = () => {
116
+ const commitTracker = createSetDataCommitTracker({
117
+ initialSnapshot: initialSnapshotBaseline,
118
+ adapter: currentAdapter,
119
+ onFailure: (failure) => {
120
+ emitDebug({
121
+ mode: failure.mode,
122
+ reason: "commitFailure",
123
+ pendingPatchKeys: failure.pendingPatchKeys,
124
+ payloadKeys: failure.payloadKeys,
125
+ revision: failure.revision,
126
+ committedRevision: failure.committedRevision,
127
+ targetLabel,
128
+ message: failure.error.message
129
+ });
130
+ try {
131
+ var _currentAdapter$__wev;
132
+ (_currentAdapter$__wev = currentAdapter.__wevu_reportSetDataError) === null || _currentAdapter$__wev === void 0 || _currentAdapter$__wev.call(currentAdapter, failure.error);
133
+ } catch (_unused2) {}
134
+ }
135
+ });
136
+ const recordFlushForLoopWarning = (pendingPatchKeys = 0, pathSource) => {
111
137
  if (!loopWarning) return;
112
138
  const current = Date.now();
113
139
  flushTimes.push(current);
@@ -119,14 +145,14 @@ function createSetDataScheduler(options) {
119
145
  emitDebug({
120
146
  mode: setDataStrategy,
121
147
  reason: "loopWarning",
122
- pendingPatchKeys: pendingPatches.size + fallbackTopKeys.size,
148
+ pendingPatchKeys,
123
149
  payloadKeys: 0,
124
150
  computedDirtyKeys: includeComputed ? dirtyComputedKeys.size : 0,
125
151
  flushCount: flushTimes.length,
126
152
  windowMs: loopWarning.sampleWindowMs,
127
153
  targetLabel,
128
154
  message: `${targetLabel ? `${targetLabel} ` : ""}疑似运行时更新循环:${flushTimes.length} 次 setData flush/${loopWarning.sampleWindowMs}ms`
129
- });
155
+ }, pathSource);
130
156
  };
131
157
  const collect = () => collectSnapshot({
132
158
  state,
@@ -145,7 +171,8 @@ function createSetDataScheduler(options) {
145
171
  const collectDiffSnapshot = () => {
146
172
  const rawState = isReactive(state) ? toRaw(state) : state;
147
173
  const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
148
- const nextSnapshot = { ...latestSnapshot };
174
+ const dispatchedSnapshot = commitTracker.state.dispatchedSnapshot;
175
+ const nextSnapshot = { ...dispatchedSnapshot };
149
176
  const seen = /* @__PURE__ */ new WeakMap();
150
177
  const includedStateKeys = /* @__PURE__ */ new Set();
151
178
  const includedComputedKeys = /* @__PURE__ */ new Set();
@@ -155,9 +182,9 @@ function createSetDataScheduler(options) {
155
182
  includedStateKeys.add(key);
156
183
  const source = rawSetupState && hasOwn(rawSetupState, key) ? rawSetupState : rawState;
157
184
  const token = createValueToken(source[key]);
158
- const previousToken = latestStateTokens[key];
185
+ const previousToken = dispatchedStateTokens[key];
159
186
  if (previousToken && token && typeof previousToken === "object" && typeof token === "object" && hasOwn(previousToken, "raw") && hasOwn(token, "raw") && Array.isArray(previousToken.raw) && Array.isArray(token.raw) && previousToken.raw !== token.raw) replacedTopLevelKeys.add(key);
160
- if (!isSameToken(previousToken, token) || !hasOwn(latestSnapshot, key)) nextSnapshot[key] = toPlain(source[key], seen, {
187
+ if (!isSameToken(previousToken, token) || !hasOwn(dispatchedSnapshot, key)) nextSnapshot[key] = toPlain(source[key], seen, {
161
188
  cache: plainCache,
162
189
  cacheEligibility: plainCacheEligibility,
163
190
  maxDepth: toPlainMaxDepth,
@@ -166,14 +193,14 @@ function createSetDataScheduler(options) {
166
193
  functionPaths,
167
194
  _path: key
168
195
  });
169
- latestStateTokens[key] = token;
196
+ dispatchedStateTokens[key] = token;
170
197
  }
171
- for (const key of Object.keys(latestStateTokens)) if (!includedStateKeys.has(key)) {
172
- delete latestStateTokens[key];
198
+ for (const key of Object.keys(dispatchedStateTokens)) if (!includedStateKeys.has(key)) {
199
+ delete dispatchedStateTokens[key];
173
200
  if (!includeComputed || !hasOwn(computedRefs, key)) delete nextSnapshot[key];
174
201
  }
175
202
  if (!includeComputed) {
176
- for (const key of Object.keys(latestComputedTokens)) delete latestComputedTokens[key];
203
+ for (const key of Object.keys(dispatchedComputedTokens)) delete dispatchedComputedTokens[key];
177
204
  return {
178
205
  snapshot: nextSnapshot,
179
206
  replacedTopLevelKeys
@@ -184,7 +211,7 @@ function createSetDataScheduler(options) {
184
211
  includedComputedKeys.add(key);
185
212
  const value = computedRefs[key].value;
186
213
  const token = createValueToken(value);
187
- if (!isSameToken(latestComputedTokens[key], token) || !hasOwn(latestSnapshot, key)) nextSnapshot[key] = toPlain(value, seen, {
214
+ if (!isSameToken(dispatchedComputedTokens[key], token) || !hasOwn(dispatchedSnapshot, key)) nextSnapshot[key] = toPlain(value, seen, {
188
215
  cache: plainCache,
189
216
  cacheEligibility: plainCacheEligibility,
190
217
  maxDepth: toPlainMaxDepth,
@@ -193,10 +220,10 @@ function createSetDataScheduler(options) {
193
220
  functionPaths,
194
221
  _path: key
195
222
  });
196
- latestComputedTokens[key] = token;
223
+ dispatchedComputedTokens[key] = token;
197
224
  }
198
- for (const key of Object.keys(latestComputedTokens)) if (!includedComputedKeys.has(key)) {
199
- delete latestComputedTokens[key];
225
+ for (const key of Object.keys(dispatchedComputedTokens)) if (!includedComputedKeys.has(key)) {
226
+ delete dispatchedComputedTokens[key];
200
227
  if (!hasOwn(rawState, key) || !shouldIncludeSnapshotKey(key)) delete nextSnapshot[key];
201
228
  }
202
229
  return {
@@ -204,107 +231,67 @@ function createSetDataScheduler(options) {
204
231
  replacedTopLevelKeys
205
232
  };
206
233
  };
207
- const runDiffUpdate = (reason = "diff") => {
234
+ const runDiffUpdate = (reason = "diff", pendingPatchKeys = 0, onSnapshotPrepared) => {
208
235
  var _diffCollection$snaps;
209
236
  const diffCollection = setDataStrategy === "diff" ? collectDiffSnapshot() : void 0;
210
237
  const snapshot = (_diffCollection$snaps = diffCollection === null || diffCollection === void 0 ? void 0 : diffCollection.snapshot) !== null && _diffCollection$snaps !== void 0 ? _diffCollection$snaps : collect();
211
- const diff = diffCollection ? (() => {
238
+ const dispatchedSnapshot = commitTracker.state.dispatchedSnapshot;
239
+ const needsRecovery = commitTracker.state.needsFullSnapshot;
240
+ const payload = needsRecovery ? commitTracker.createFullPayload(snapshot) : diffCollection ? (() => {
212
241
  const fastDiff = {};
213
242
  for (const key of diffCollection.replacedTopLevelKeys) fastDiff[key] = snapshot[key];
214
243
  return {
215
- ...diffSnapshots(latestSnapshot, snapshot, { skipKeys: diffCollection.replacedTopLevelKeys }),
244
+ ...diffSnapshots(dispatchedSnapshot, snapshot, { skipKeys: diffCollection.replacedTopLevelKeys }),
216
245
  ...fastDiff
217
246
  };
218
- })() : diffSnapshots(latestSnapshot, snapshot);
219
- latestSnapshot = snapshot;
220
- needsFullSnapshot.value = false;
221
- pendingPatches.clear();
222
- if (setDataStrategy === "patch" && includeComputed) {
223
- latestComputedSnapshot = Object.create(null);
224
- for (const key of Object.keys(computedRefs)) {
225
- if (!shouldIncludeSnapshotKey(key)) continue;
226
- latestComputedSnapshot[key] = snapshot[key];
227
- }
228
- dirtyComputedKeys.clear();
229
- }
230
- if (!Object.keys(diff).length) return;
231
- if (typeof currentAdapter.setData === "function") {
232
- const result = currentAdapter.setData(diff);
233
- if (result && typeof result.then === "function") return result.catch(() => {});
234
- }
247
+ })() : diffSnapshots(dispatchedSnapshot, snapshot);
248
+ onSnapshotPrepared === null || onSnapshotPrepared === void 0 || onSnapshotPrepared(snapshot);
249
+ const payloadKeys = Object.keys(payload).length;
250
+ if (!payloadKeys && !needsRecovery) return;
251
+ const effectiveReason = needsRecovery ? "needsFullSnapshot" : reason;
235
252
  emitDebug({
236
253
  mode: "diff",
237
- reason,
238
- pendingPatchKeys: 0,
239
- payloadKeys: Object.keys(diff).length
254
+ reason: effectiveReason,
255
+ pendingPatchKeys,
256
+ payloadKeys
257
+ }, Object.keys(payload));
258
+ commitTracker.dispatch({
259
+ mode: "diff",
260
+ kind: needsRecovery ? "full" : "delta",
261
+ reason: effectiveReason,
262
+ snapshot,
263
+ payload,
264
+ pendingPatchKeys
240
265
  });
241
266
  };
242
- const mutationRecorder = (record, stateRootRaw) => {
243
- if (!isMounted()) return;
244
- if (record.root !== stateRootRaw) {
245
- const topKeys = resolveTopKeysByRoot(record.root);
246
- if (topKeys.length) for (const key of topKeys) fallbackTopKeys.add(key);
247
- return;
248
- }
249
- if (!record.path) {
250
- if (Array.isArray(record.fallbackTopKeys) && record.fallbackTopKeys.length) for (const key of record.fallbackTopKeys) fallbackTopKeys.add(key);
251
- else needsFullSnapshot.value = true;
252
- return;
253
- }
254
- const topKey = record.path.split(".", 1)[0];
255
- if (!shouldIncludeSnapshotKey(topKey)) return;
256
- pendingPatches.set(record.path, {
257
- kind: record.kind,
258
- op: record.op
259
- });
267
+ const prepareJob = (pendingPatchKeys = 0, pathSource) => {
268
+ if (!isMounted()) return false;
269
+ recordFlushForLoopWarning(pendingPatchKeys, pathSource);
270
+ runTracker();
271
+ return true;
260
272
  };
261
273
  const job = (_stateRootRaw) => {
262
- if (!isMounted()) return;
263
- recordFlushForLoopWarning();
264
- runTracker();
265
- if (setDataStrategy === "patch" && !needsFullSnapshot.value) {
266
- if (!(pendingPatches.size > 0 || fallbackTopKeys.size > 0 || includeComputed && dirtyComputedKeys.size > 0)) return runDiffUpdate("diff");
267
- return runPatchUpdate({
268
- state,
269
- computedRefs,
270
- dirtyComputedKeys,
271
- includeComputed,
272
- computedCompare,
273
- computedCompareMaxDepth,
274
- computedCompareMaxKeys,
275
- currentAdapter,
276
- shouldIncludeKey: shouldIncludeSnapshotKey,
277
- maxPatchKeys,
278
- maxPayloadBytes,
279
- mergeSiblingThreshold,
280
- mergeSiblingMaxInflationRatio,
281
- mergeSiblingMaxParentBytes,
282
- mergeSiblingSkipArray,
283
- elevateTopKeyThreshold,
284
- toPlainMaxDepth,
285
- toPlainMaxKeys,
286
- includeFunctions,
287
- functionPaths,
288
- plainCache,
289
- plainCacheEligibility,
290
- pendingPatches,
291
- fallbackTopKeys,
292
- latestSnapshot,
293
- latestComputedSnapshot,
294
- needsFullSnapshot,
295
- emitDebug,
296
- runDiffUpdate
297
- });
298
- } else return runDiffUpdate(needsFullSnapshot.value ? "needsFullSnapshot" : "diff");
274
+ if (!prepareJob()) return;
275
+ return runDiffUpdate("diff");
299
276
  };
300
- const snapshot = () => setDataStrategy === "patch" ? collect() : { ...latestSnapshot };
301
- const cloneLatestSnapshot = () => ({ ...latestSnapshot });
277
+ const snapshot = () => setDataStrategy === "patch" ? collect() : { ...commitTracker.state.dispatchedSnapshot };
278
+ const cloneLatestSnapshot = () => ({ ...commitTracker.state.dispatchedSnapshot });
302
279
  return {
280
+ collect,
281
+ emitDebug,
282
+ getLatestSnapshot: () => commitTracker.state.dispatchedSnapshot,
283
+ dispatchUpdate: commitTracker.dispatch,
284
+ needsFullSnapshot: () => commitTracker.state.needsFullSnapshot,
303
285
  job,
304
- mutationRecorder,
286
+ plainCache,
287
+ plainCacheEligibility,
288
+ prepareJob,
289
+ resolveTopKeysByRoot,
290
+ runDiffUpdate,
291
+ shouldIncludeSnapshotKey,
305
292
  snapshot,
306
293
  cloneLatestSnapshot,
307
- getLatestSnapshot: () => latestSnapshot
294
+ dispose: commitTracker.dispose
308
295
  };
309
296
  }
310
297