wevu 7.0.3 → 7.1.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.
- package/README.md +20 -4
- package/dist/alipay/jsx-runtime.d.mts +13 -0
- package/dist/alipay/jsx-runtime.mjs +1 -0
- package/dist/alipayIntrinsicElements/base.d.mts +4 -0
- package/dist/alipayIntrinsicElements/elements/button.d.mts +29 -0
- package/dist/alipayIntrinsicElements/elements/camera.d.mts +18 -0
- package/dist/alipayIntrinsicElements/elements/canvas.d.mts +20 -0
- package/dist/alipayIntrinsicElements/elements/checkbox-group.d.mts +11 -0
- package/dist/alipayIntrinsicElements/elements/checkbox.d.mts +14 -0
- package/dist/alipayIntrinsicElements/elements/contact-button.d.mts +15 -0
- package/dist/alipayIntrinsicElements/elements/cover-image.d.mts +11 -0
- package/dist/alipayIntrinsicElements/elements/cover-view.d.mts +11 -0
- package/dist/alipayIntrinsicElements/elements/error-view.d.mts +14 -0
- package/dist/alipayIntrinsicElements/elements/form.d.mts +12 -0
- package/dist/alipayIntrinsicElements/elements/icon.d.mts +11 -0
- package/dist/alipayIntrinsicElements/elements/image.d.mts +17 -0
- package/dist/alipayIntrinsicElements/elements/input.d.mts +31 -0
- package/dist/alipayIntrinsicElements/elements/join-group-chat.d.mts +9 -0
- package/dist/alipayIntrinsicElements/elements/label.d.mts +9 -0
- package/dist/alipayIntrinsicElements/elements/lifestyle.d.mts +11 -0
- package/dist/alipayIntrinsicElements/elements/lottie.d.mts +25 -0
- package/dist/alipayIntrinsicElements/elements/map.d.mts +44 -0
- package/dist/alipayIntrinsicElements/elements/match-media.d.mts +15 -0
- package/dist/alipayIntrinsicElements/elements/movable-area.d.mts +9 -0
- package/dist/alipayIntrinsicElements/elements/movable-view.d.mts +32 -0
- package/dist/alipayIntrinsicElements/elements/navigator.d.mts +13 -0
- package/dist/alipayIntrinsicElements/elements/page-container.d.mts +27 -0
- package/dist/alipayIntrinsicElements/elements/page-meta.d.mts +19 -0
- package/dist/alipayIntrinsicElements/elements/picker-view-column.d.mts +7 -0
- package/dist/alipayIntrinsicElements/elements/picker-view.d.mts +18 -0
- package/dist/alipayIntrinsicElements/elements/picker.d.mts +15 -0
- package/dist/alipayIntrinsicElements/elements/progress.d.mts +14 -0
- package/dist/alipayIntrinsicElements/elements/radio-group.d.mts +11 -0
- package/dist/alipayIntrinsicElements/elements/radio.d.mts +12 -0
- package/dist/alipayIntrinsicElements/elements/rich-text.d.mts +17 -0
- package/dist/alipayIntrinsicElements/elements/root-portal.d.mts +9 -0
- package/dist/alipayIntrinsicElements/elements/scroll-view.d.mts +29 -0
- package/dist/alipayIntrinsicElements/elements/share-element.d.mts +12 -0
- package/dist/alipayIntrinsicElements/elements/slider.d.mts +23 -0
- package/dist/alipayIntrinsicElements/elements/subscribe-message.d.mts +11 -0
- package/dist/alipayIntrinsicElements/elements/swiper-item.d.mts +7 -0
- package/dist/alipayIntrinsicElements/elements/swiper.d.mts +36 -0
- package/dist/alipayIntrinsicElements/elements/switch.d.mts +15 -0
- package/dist/alipayIntrinsicElements/elements/text.d.mts +12 -0
- package/dist/alipayIntrinsicElements/elements/textarea.d.mts +24 -0
- package/dist/alipayIntrinsicElements/elements/video.d.mts +39 -0
- package/dist/alipayIntrinsicElements/elements/view.d.mts +29 -0
- package/dist/alipayIntrinsicElements/elements/web-view.d.mts +13 -0
- package/dist/alipayIntrinsicElements.d.mts +94 -0
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/defineProperty.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPrimitive.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPropertyKey.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/typeof.mjs +1 -1
- package/dist/dev/alipayIntrinsicElements/base.d.mts +5 -0
- package/dist/dev/alipayIntrinsicElements/elements/button.d.mts +30 -0
- package/dist/dev/alipayIntrinsicElements/elements/camera.d.mts +19 -0
- package/dist/dev/alipayIntrinsicElements/elements/canvas.d.mts +21 -0
- package/dist/dev/alipayIntrinsicElements/elements/checkbox-group.d.mts +12 -0
- package/dist/dev/alipayIntrinsicElements/elements/checkbox.d.mts +15 -0
- package/dist/dev/alipayIntrinsicElements/elements/contact-button.d.mts +16 -0
- package/dist/dev/alipayIntrinsicElements/elements/cover-image.d.mts +12 -0
- package/dist/dev/alipayIntrinsicElements/elements/cover-view.d.mts +12 -0
- package/dist/dev/alipayIntrinsicElements/elements/error-view.d.mts +15 -0
- package/dist/dev/alipayIntrinsicElements/elements/form.d.mts +13 -0
- package/dist/dev/alipayIntrinsicElements/elements/icon.d.mts +12 -0
- package/dist/dev/alipayIntrinsicElements/elements/image.d.mts +18 -0
- package/dist/dev/alipayIntrinsicElements/elements/input.d.mts +32 -0
- package/dist/dev/alipayIntrinsicElements/elements/join-group-chat.d.mts +10 -0
- package/dist/dev/alipayIntrinsicElements/elements/label.d.mts +10 -0
- package/dist/dev/alipayIntrinsicElements/elements/lifestyle.d.mts +12 -0
- package/dist/dev/alipayIntrinsicElements/elements/lottie.d.mts +26 -0
- package/dist/dev/alipayIntrinsicElements/elements/map.d.mts +45 -0
- package/dist/dev/alipayIntrinsicElements/elements/match-media.d.mts +16 -0
- package/dist/dev/alipayIntrinsicElements/elements/movable-area.d.mts +10 -0
- package/dist/dev/alipayIntrinsicElements/elements/movable-view.d.mts +33 -0
- package/dist/dev/alipayIntrinsicElements/elements/navigator.d.mts +14 -0
- package/dist/dev/alipayIntrinsicElements/elements/page-container.d.mts +28 -0
- package/dist/dev/alipayIntrinsicElements/elements/page-meta.d.mts +20 -0
- package/dist/dev/alipayIntrinsicElements/elements/picker-view-column.d.mts +8 -0
- package/dist/dev/alipayIntrinsicElements/elements/picker-view.d.mts +19 -0
- package/dist/dev/alipayIntrinsicElements/elements/picker.d.mts +16 -0
- package/dist/dev/alipayIntrinsicElements/elements/progress.d.mts +15 -0
- package/dist/dev/alipayIntrinsicElements/elements/radio-group.d.mts +12 -0
- package/dist/dev/alipayIntrinsicElements/elements/radio.d.mts +13 -0
- package/dist/dev/alipayIntrinsicElements/elements/rich-text.d.mts +18 -0
- package/dist/dev/alipayIntrinsicElements/elements/root-portal.d.mts +10 -0
- package/dist/dev/alipayIntrinsicElements/elements/scroll-view.d.mts +30 -0
- package/dist/dev/alipayIntrinsicElements/elements/share-element.d.mts +13 -0
- package/dist/dev/alipayIntrinsicElements/elements/slider.d.mts +24 -0
- package/dist/dev/alipayIntrinsicElements/elements/subscribe-message.d.mts +12 -0
- package/dist/dev/alipayIntrinsicElements/elements/swiper-item.d.mts +8 -0
- package/dist/dev/alipayIntrinsicElements/elements/swiper.d.mts +37 -0
- package/dist/dev/alipayIntrinsicElements/elements/switch.d.mts +16 -0
- package/dist/dev/alipayIntrinsicElements/elements/text.d.mts +13 -0
- package/dist/dev/alipayIntrinsicElements/elements/textarea.d.mts +25 -0
- package/dist/dev/alipayIntrinsicElements/elements/video.d.mts +40 -0
- package/dist/dev/alipayIntrinsicElements/elements/view.d.mts +30 -0
- package/dist/dev/alipayIntrinsicElements/elements/web-view.d.mts +14 -0
- package/dist/dev/alipayIntrinsicElements.d.mts +94 -0
- package/dist/dev/api/vitest/setup.d.mts +1 -0
- package/dist/dev/api/vitest.d.mts +1 -0
- package/dist/dev/api.d.mts +1 -0
- package/dist/dev/compiler.d.mts +1 -0
- package/dist/dev/fetch.d.mts +9 -0
- package/dist/dev/index.d.mts +72 -0
- package/dist/dev/index.mjs +12 -15
- package/dist/dev/internal-reactivity.d.mts +18 -0
- package/dist/dev/internal-reactivity.mjs +3 -2
- package/dist/dev/internal-runtime.d.mts +44 -0
- package/dist/dev/internal-runtime.mjs +19 -14
- package/dist/dev/internal-template.d.mts +2 -0
- package/dist/dev/jsx-runtime.d.mts +44 -0
- package/dist/dev/jsxTypes.d.mts +9 -0
- package/dist/dev/macros/shared.d.mts +81 -0
- package/dist/dev/macros.d.mts +71 -0
- package/dist/dev/package.mjs +1 -1
- package/dist/dev/reactivity/asyncDerivation.d.mts +41 -0
- package/dist/dev/reactivity/asyncDerivation.mjs +130 -0
- package/dist/dev/reactivity/asyncDerivation.mjs.map +1 -0
- package/dist/dev/reactivity/computed.d.mts +21 -0
- package/dist/dev/reactivity/computed.mjs +2 -2
- package/dist/dev/reactivity/computed.mjs.map +1 -1
- package/dist/dev/reactivity/core.d.mts +35 -0
- package/dist/dev/reactivity/core.mjs +156 -32
- package/dist/dev/reactivity/core.mjs.map +1 -1
- package/dist/dev/reactivity/index.d.mts +16 -0
- package/dist/dev/reactivity/reactive/mutation.d.mts +21 -0
- package/dist/dev/reactivity/reactive/patch.d.mts +18 -0
- package/dist/dev/reactivity/reactive/shallow.d.mts +22 -0
- package/dist/dev/reactivity/reactive/shared.d.mts +4 -0
- package/dist/dev/reactivity/reactive.d.mts +42 -0
- package/dist/dev/reactivity/readonly.d.mts +27 -0
- package/dist/dev/reactivity/readonly.mjs.map +1 -1
- package/dist/dev/reactivity/ref.d.mts +27 -0
- package/dist/dev/reactivity/ref.mjs +1 -1
- package/dist/dev/reactivity/shallowRef.d.mts +19 -0
- package/dist/dev/reactivity/toRefs.d.mts +43 -0
- package/dist/dev/reactivity/traverse.d.mts +8 -0
- package/dist/dev/reactivity/watch/types.d.mts +43 -0
- package/dist/dev/reactivity/watch.d.mts +22 -0
- package/dist/dev/router/createRouter.d.mts +8 -0
- package/dist/dev/router/navigationCore.d.mts +6 -0
- package/dist/dev/router/resolve.d.mts +6 -0
- package/dist/dev/router/routeSync.d.mts +1 -0
- package/dist/dev/router/routeSync.mjs +8 -2
- package/dist/dev/router/routeSync.mjs.map +1 -1
- package/dist/dev/router/types.d.mts +172 -0
- package/dist/dev/router/useRoute.d.mts +19 -0
- package/dist/dev/router/useRoute.mjs +14 -7
- package/dist/dev/router/useRoute.mjs.map +1 -1
- package/dist/dev/router/useRouter.d.mts +8 -0
- package/dist/dev/router.d.mts +10 -0
- package/dist/dev/routerInternal/query.d.mts +7 -0
- package/dist/dev/routerInternal/types.d.mts +9 -0
- package/dist/dev/runtime/app/computed.mjs +2 -2
- package/dist/dev/runtime/app/computed.mjs.map +1 -1
- package/dist/dev/runtime/app/context.mjs +8 -2
- package/dist/dev/runtime/app/context.mjs.map +1 -1
- package/dist/dev/runtime/app/diagnostics.mjs +12 -0
- package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
- package/dist/dev/runtime/app/mount.mjs +31 -28
- package/dist/dev/runtime/app/mount.mjs.map +1 -1
- package/dist/dev/runtime/app/pending.d.mts +10 -0
- package/dist/dev/runtime/app/setData/commitTracker.d.mts +13 -0
- package/dist/dev/runtime/app/setData/commitTracker.mjs +265 -0
- package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -0
- package/dist/dev/runtime/app/setData/patchScheduler.mjs +47 -51
- package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/scheduler.d.mts +51 -0
- package/dist/dev/runtime/app/setData/scheduler.mjs +98 -111
- package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/snapshot.mjs +11 -1
- package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -1
- package/dist/dev/runtime/app.d.mts +8 -0
- package/dist/dev/runtime/app.mjs +18 -6
- package/dist/dev/runtime/app.mjs.map +1 -1
- package/dist/dev/runtime/bindingManifest.mjs +105 -0
- package/dist/dev/runtime/bindingManifest.mjs.map +1 -0
- package/dist/dev/runtime/capabilities.d.mts +75 -0
- package/dist/dev/runtime/capabilities.mjs +40 -0
- package/dist/dev/runtime/capabilities.mjs.map +1 -0
- package/dist/dev/runtime/css.d.mts +14 -0
- package/dist/dev/runtime/defaults.d.mts +12 -0
- package/dist/dev/runtime/define/componentDefinition.mjs +3 -0
- package/dist/dev/runtime/define/componentDefinition.mjs.map +1 -1
- package/dist/dev/runtime/define/optionsApi.mjs +1 -1
- package/dist/dev/runtime/define/props.mjs +30 -60
- package/dist/dev/runtime/define/props.mjs.map +1 -1
- package/dist/dev/runtime/define/scopedSlotOptions.mjs +37 -21
- package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
- package/dist/dev/runtime/define.d.mts +118 -0
- package/dist/dev/runtime/define.mjs +32 -44
- package/dist/dev/runtime/define.mjs.map +1 -1
- package/dist/dev/runtime/diff.mjs +1 -1
- package/dist/dev/runtime/disposables.d.mts +31 -0
- package/dist/dev/runtime/elementIntersectionObserver.d.mts +26 -0
- package/dist/dev/runtime/features/inlineEvents.d.mts +7 -0
- package/dist/dev/runtime/features/inlineEvents.mjs +25 -0
- package/dist/dev/runtime/features/inlineEvents.mjs.map +1 -0
- package/dist/dev/runtime/features/layout.d.mts +7 -0
- package/dist/dev/runtime/features/layout.mjs +44 -0
- package/dist/dev/runtime/features/layout.mjs.map +1 -0
- package/dist/dev/runtime/features/patchStrategy.d.mts +7 -0
- package/dist/dev/runtime/features/patchStrategy.mjs +129 -0
- package/dist/dev/runtime/features/patchStrategy.mjs.map +1 -0
- package/dist/dev/runtime/features/publicLayout.d.mts +24 -0
- package/dist/dev/runtime/features/publicLayout.mjs +81 -0
- package/dist/dev/runtime/features/publicLayout.mjs.map +1 -0
- package/dist/dev/runtime/features/scopedSlots.d.mts +23 -0
- package/dist/dev/runtime/features/scopedSlots.mjs +88 -0
- package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -0
- package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +7 -0
- package/dist/dev/runtime/features/setDataHighFrequencyWarning.mjs +15 -0
- package/dist/dev/runtime/features/setDataHighFrequencyWarning.mjs.map +1 -0
- package/dist/dev/runtime/features/templateRefs.d.mts +7 -0
- package/dist/dev/runtime/features/templateRefs.mjs +39 -0
- package/dist/dev/runtime/features/templateRefs.mjs.map +1 -0
- package/dist/dev/runtime/hooks/base.d.mts +27 -0
- package/dist/dev/runtime/hooks/register.d.mts +30 -0
- package/dist/dev/runtime/hooks/vue.d.mts +52 -0
- package/dist/dev/runtime/hooks/vue.mjs +3 -5
- package/dist/dev/runtime/hooks/vue.mjs.map +1 -1
- package/dist/dev/runtime/hooks.d.mts +4 -0
- package/dist/dev/runtime/index.d.mts +46 -0
- package/dist/dev/runtime/inlineDataset.mjs +75 -0
- package/dist/dev/runtime/inlineDataset.mjs.map +1 -0
- package/dist/dev/runtime/intersectionObserver.d.mts +14 -0
- package/dist/dev/runtime/jsxIsland.d.mts +37 -0
- package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
- package/dist/dev/runtime/layoutBridge.d.mts +55 -0
- package/dist/dev/runtime/layoutBridge.mjs.map +1 -1
- package/dist/dev/runtime/noSetData.d.mts +5 -0
- package/dist/dev/runtime/pageEnvironment.d.mts +50 -0
- package/dist/dev/runtime/pageLayout.d.mts +25 -0
- package/dist/dev/runtime/pageLayout.mjs.map +1 -1
- package/dist/dev/runtime/pageScroll.d.mts +29 -0
- package/dist/dev/runtime/provide.d.mts +60 -0
- package/dist/dev/runtime/provideStore.d.mts +7 -0
- package/dist/dev/runtime/publicRuntime.d.mts +22 -0
- package/dist/dev/runtime/publicRuntime.mjs +91 -0
- package/dist/dev/runtime/publicRuntime.mjs.map +1 -0
- package/dist/dev/runtime/pullDownRefresh.d.mts +12 -0
- package/dist/dev/runtime/register/app.d.mts +14 -0
- package/dist/dev/runtime/register/app.mjs +7 -10
- package/dist/dev/runtime/register/app.mjs.map +1 -1
- package/dist/dev/runtime/register/component/lifecycle.mjs +22 -6
- package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
- package/dist/dev/runtime/register/component/methods.mjs +7 -10
- package/dist/dev/runtime/register/component/methods.mjs.map +1 -1
- package/dist/dev/runtime/register/component/options.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +64 -69
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component.d.mts +17 -0
- package/dist/dev/runtime/register/inline.d.mts +15 -0
- package/dist/dev/runtime/register/inline.mjs +4 -64
- package/dist/dev/runtime/register/inline.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +16 -2
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +0 -4
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +26 -0
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs.map +1 -0
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance.d.mts +26 -0
- package/dist/dev/runtime/register/runtimeInstance.mjs +402 -160
- package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -1
- package/dist/dev/runtime/register/setup.d.mts +11 -0
- package/dist/dev/runtime/register/snapshot.mjs +6 -10
- package/dist/dev/runtime/register/snapshot.mjs.map +1 -1
- package/dist/dev/runtime/register/watch.d.mts +12 -0
- package/dist/dev/runtime/register.d.mts +5 -0
- package/dist/dev/runtime/scopedSlots.mjs +1 -1
- package/dist/dev/runtime/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/selectorQuery.d.mts +54 -0
- package/dist/dev/runtime/selectorQuery.mjs +5 -0
- package/dist/dev/runtime/selectorQuery.mjs.map +1 -1
- package/dist/dev/runtime/teardown.mjs +18 -0
- package/dist/dev/runtime/teardown.mjs.map +1 -0
- package/dist/dev/runtime/template.d.mts +6 -0
- package/dist/dev/runtime/templateRefTypes.d.mts +12 -0
- package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -1
- package/dist/dev/runtime/templateRefs.mjs +187 -118
- package/dist/dev/runtime/templateRefs.mjs.map +1 -1
- package/dist/dev/runtime/types/core.d.mts +35 -0
- package/dist/dev/runtime/types/miniprogram.d.mts +84 -0
- package/dist/dev/runtime/types/miniprogramHost.d.mts +45 -0
- package/dist/dev/runtime/types/miniprogramHostSources.d.mts +112 -0
- package/dist/dev/runtime/types/options.d.mts +136 -0
- package/dist/dev/runtime/types/props/propTypes.d.mts +79 -0
- package/dist/dev/runtime/types/props/router.d.mts +51 -0
- package/dist/dev/runtime/types/props/setup.d.mts +96 -0
- package/dist/dev/runtime/types/props.d.mts +4 -0
- package/dist/dev/runtime/types/runtime.d.mts +59 -0
- package/dist/dev/runtime/types/setData.d.mts +237 -0
- package/dist/dev/runtime/types.d.mts +29 -0
- package/dist/dev/runtime/uniAppHost.d.mts +8 -0
- package/dist/dev/runtime/updatePerformance.d.mts +13 -0
- package/dist/dev/runtime/use.d.mts +13 -0
- package/dist/dev/runtime/vueCompat/context.d.mts +8 -0
- package/dist/dev/runtime/vueCompat/model.d.mts +30 -0
- package/dist/dev/runtime/vueCompat/router.d.mts +28 -0
- package/dist/dev/runtime/vueCompat/templateRef.d.mts +9 -0
- package/dist/dev/runtime/vueCompat/templateRef.mjs +2 -0
- package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat.d.mts +5 -0
- package/dist/dev/scheduler.d.mts +4 -0
- package/dist/dev/store/base.mjs +12 -18
- package/dist/dev/store/base.mjs.map +1 -1
- package/dist/dev/store/define/optionsStyle.mjs +13 -23
- package/dist/dev/store/define/optionsStyle.mjs.map +1 -1
- package/dist/dev/store/define/setupStyle.mjs +14 -24
- package/dist/dev/store/define/setupStyle.mjs.map +1 -1
- package/dist/dev/store/define/shared.mjs +44 -1
- package/dist/dev/store/define/shared.mjs.map +1 -1
- package/dist/dev/store/define.d.mts +28 -0
- package/dist/dev/store/define.mjs.map +1 -1
- package/dist/dev/store/manager.d.mts +8 -0
- package/dist/dev/store/storeToRefs.d.mts +13 -0
- package/dist/dev/store/types.d.mts +70 -0
- package/dist/dev/store.d.mts +5 -0
- package/dist/dev/ttIntrinsicElements/base.d.mts +5 -0
- package/dist/dev/ttIntrinsicElements/elements/ad.d.mts +8 -0
- package/dist/dev/ttIntrinsicElements/elements/aweme-data.d.mts +15 -0
- package/dist/dev/ttIntrinsicElements/elements/aweme-user-card.d.mts +16 -0
- package/dist/dev/ttIntrinsicElements/elements/button.d.mts +23 -0
- package/dist/dev/ttIntrinsicElements/elements/camera.d.mts +19 -0
- package/dist/dev/ttIntrinsicElements/elements/canvas.d.mts +16 -0
- package/dist/dev/ttIntrinsicElements/elements/checkbox-group.d.mts +12 -0
- package/dist/dev/ttIntrinsicElements/elements/checkbox.d.mts +12 -0
- package/dist/dev/ttIntrinsicElements/elements/draw-ad.d.mts +16 -0
- package/dist/dev/ttIntrinsicElements/elements/form.d.mts +14 -0
- package/dist/dev/ttIntrinsicElements/elements/icon.d.mts +11 -0
- package/dist/dev/ttIntrinsicElements/elements/image.d.mts +16 -0
- package/dist/dev/ttIntrinsicElements/elements/input.d.mts +32 -0
- package/dist/dev/ttIntrinsicElements/elements/label.d.mts +10 -0
- package/dist/dev/ttIntrinsicElements/elements/live-player.d.mts +19 -0
- package/dist/dev/ttIntrinsicElements/elements/live-preview.d.mts +13 -0
- package/dist/dev/ttIntrinsicElements/elements/map.d.mts +36 -0
- package/dist/dev/ttIntrinsicElements/elements/mask.d.mts +8 -0
- package/dist/dev/ttIntrinsicElements/elements/match-media.d.mts +16 -0
- package/dist/dev/ttIntrinsicElements/elements/movable-area.d.mts +10 -0
- package/dist/dev/ttIntrinsicElements/elements/movable-view.d.mts +27 -0
- package/dist/dev/ttIntrinsicElements/elements/navigator.d.mts +16 -0
- package/dist/dev/ttIntrinsicElements/elements/open-data.d.mts +15 -0
- package/dist/dev/ttIntrinsicElements/elements/picker-view-column.d.mts +8 -0
- package/dist/dev/ttIntrinsicElements/elements/picker-view.d.mts +19 -0
- package/dist/dev/ttIntrinsicElements/elements/picker.d.mts +22 -0
- package/dist/dev/ttIntrinsicElements/elements/progress.d.mts +16 -0
- package/dist/dev/ttIntrinsicElements/elements/radio-group.d.mts +12 -0
- package/dist/dev/ttIntrinsicElements/elements/radio.d.mts +12 -0
- package/dist/dev/ttIntrinsicElements/elements/rich-text.d.mts +10 -0
- package/dist/dev/ttIntrinsicElements/elements/rtc-room.d.mts +13 -0
- package/dist/dev/ttIntrinsicElements/elements/scroll-view.d.mts +32 -0
- package/dist/dev/ttIntrinsicElements/elements/slider.d.mts +19 -0
- package/dist/dev/ttIntrinsicElements/elements/swiper-item.d.mts +10 -0
- package/dist/dev/ttIntrinsicElements/elements/swiper.d.mts +27 -0
- package/dist/dev/ttIntrinsicElements/elements/switch.d.mts +14 -0
- package/dist/dev/ttIntrinsicElements/elements/text.d.mts +12 -0
- package/dist/dev/ttIntrinsicElements/elements/textarea.d.mts +34 -0
- package/dist/dev/ttIntrinsicElements/elements/video.d.mts +58 -0
- package/dist/dev/ttIntrinsicElements/elements/view.d.mts +15 -0
- package/dist/dev/ttIntrinsicElements/elements/web-view.d.mts +15 -0
- package/dist/dev/ttIntrinsicElements.d.mts +88 -0
- package/dist/dev/version.d.mts +4 -0
- package/dist/dev/vue-augment.d.mts +8 -0
- package/dist/dev/vue-demi.d.mts +87 -0
- package/dist/dev/vue-demi.mjs +12 -15
- package/dist/dev/vue-demi.mjs.map +1 -1
- package/dist/dev/vue-types.d.mts +19 -0
- package/dist/dev/weappIntrinsicElements/base.d.mts +5 -0
- package/dist/dev/weappIntrinsicElements/elements/ad-custom.d.mts +14 -0
- package/dist/dev/weappIntrinsicElements/elements/ad.d.mts +17 -0
- package/dist/dev/weappIntrinsicElements/elements/audio.d.mts +21 -0
- package/dist/dev/weappIntrinsicElements/elements/block.d.mts +8 -0
- package/dist/dev/weappIntrinsicElements/elements/button.d.mts +42 -0
- package/dist/dev/weappIntrinsicElements/elements/camera.d.mts +19 -0
- package/dist/dev/weappIntrinsicElements/elements/canvas.d.mts +19 -0
- package/dist/dev/weappIntrinsicElements/elements/checkbox-group.d.mts +11 -0
- package/dist/dev/weappIntrinsicElements/elements/checkbox.d.mts +13 -0
- package/dist/dev/weappIntrinsicElements/elements/cover-image.d.mts +14 -0
- package/dist/dev/weappIntrinsicElements/elements/cover-view.d.mts +10 -0
- package/dist/dev/weappIntrinsicElements/elements/editor.d.mts +23 -0
- package/dist/dev/weappIntrinsicElements/elements/form.d.mts +17 -0
- package/dist/dev/weappIntrinsicElements/elements/functional-page-navigator.d.mts +16 -0
- package/dist/dev/weappIntrinsicElements/elements/icon.d.mts +12 -0
- package/dist/dev/weappIntrinsicElements/elements/image.d.mts +19 -0
- package/dist/dev/weappIntrinsicElements/elements/import.d.mts +10 -0
- package/dist/dev/weappIntrinsicElements/elements/include.d.mts +10 -0
- package/dist/dev/weappIntrinsicElements/elements/input.d.mts +47 -0
- package/dist/dev/weappIntrinsicElements/elements/keyboard-accessory.d.mts +8 -0
- package/dist/dev/weappIntrinsicElements/elements/label.d.mts +10 -0
- package/dist/dev/weappIntrinsicElements/elements/live-player.d.mts +36 -0
- package/dist/dev/weappIntrinsicElements/elements/live-pusher.d.mts +58 -0
- package/dist/dev/weappIntrinsicElements/elements/map.d.mts +106 -0
- package/dist/dev/weappIntrinsicElements/elements/match-media.d.mts +16 -0
- package/dist/dev/weappIntrinsicElements/elements/movable-area.d.mts +27 -0
- package/dist/dev/weappIntrinsicElements/elements/movable-view.d.mts +27 -0
- package/dist/dev/weappIntrinsicElements/elements/navigation-bar.d.mts +15 -0
- package/dist/dev/weappIntrinsicElements/elements/navigator.d.mts +26 -0
- package/dist/dev/weappIntrinsicElements/elements/official-account.d.mts +14 -0
- package/dist/dev/weappIntrinsicElements/elements/open-data.d.mts +16 -0
- package/dist/dev/weappIntrinsicElements/elements/page-container.d.mts +26 -0
- package/dist/dev/weappIntrinsicElements/elements/page-meta.d.mts +24 -0
- package/dist/dev/weappIntrinsicElements/elements/picker-view-column.d.mts +19 -0
- package/dist/dev/weappIntrinsicElements/elements/picker-view.d.mts +19 -0
- package/dist/dev/weappIntrinsicElements/elements/picker.d.mts +24 -0
- package/dist/dev/weappIntrinsicElements/elements/progress.d.mts +22 -0
- package/dist/dev/weappIntrinsicElements/elements/radio-group.d.mts +11 -0
- package/dist/dev/weappIntrinsicElements/elements/radio.d.mts +13 -0
- package/dist/dev/weappIntrinsicElements/elements/rich-text.d.mts +17 -0
- package/dist/dev/weappIntrinsicElements/elements/scroll-view.d.mts +64 -0
- package/dist/dev/weappIntrinsicElements/elements/share-element.d.mts +17 -0
- package/dist/dev/weappIntrinsicElements/elements/slider.d.mts +24 -0
- package/dist/dev/weappIntrinsicElements/elements/slot.d.mts +10 -0
- package/dist/dev/weappIntrinsicElements/elements/swiper-item.d.mts +11 -0
- package/dist/dev/weappIntrinsicElements/elements/swiper.d.mts +40 -0
- package/dist/dev/weappIntrinsicElements/elements/switch.d.mts +15 -0
- package/dist/dev/weappIntrinsicElements/elements/template.d.mts +12 -0
- package/dist/dev/weappIntrinsicElements/elements/text.d.mts +15 -0
- package/dist/dev/weappIntrinsicElements/elements/textarea.d.mts +41 -0
- package/dist/dev/weappIntrinsicElements/elements/video.d.mts +72 -0
- package/dist/dev/weappIntrinsicElements/elements/view.d.mts +15 -0
- package/dist/dev/weappIntrinsicElements/elements/voip-room.d.mts +15 -0
- package/dist/dev/weappIntrinsicElements/elements/web-view.d.mts +14 -0
- package/dist/dev/weappIntrinsicElements.d.mts +114 -0
- package/dist/dev/web-apis.d.mts +3 -0
- package/dist/fetch.d.mts +4 -4
- package/dist/index.d.mts +13 -14
- package/dist/index.mjs +1 -1
- package/dist/internal-reactivity.d.mts +2 -1
- package/dist/internal-reactivity.mjs +1 -1
- package/dist/internal-runtime.d.mts +13 -6
- package/dist/internal-runtime.mjs +1 -1
- package/dist/jsx-runtime.d.mts +51 -14
- package/dist/jsxTypes.d.mts +8 -0
- package/dist/macros/shared.d.mts +14 -15
- package/dist/macros.d.mts +22 -22
- package/dist/miniprogram/jsx-runtime.d.mts +13 -0
- package/dist/miniprogram/jsx-runtime.mjs +1 -0
- package/dist/miniprogramIntrinsicElements/base.d.mts +4 -0
- package/dist/miniprogramIntrinsicElements/elements/button.d.mts +23 -0
- package/dist/miniprogramIntrinsicElements/elements/camera.d.mts +18 -0
- package/dist/miniprogramIntrinsicElements/elements/canvas.d.mts +16 -0
- package/dist/miniprogramIntrinsicElements/elements/checkbox-group.d.mts +12 -0
- package/dist/miniprogramIntrinsicElements/elements/checkbox.d.mts +13 -0
- package/dist/miniprogramIntrinsicElements/elements/form.d.mts +13 -0
- package/dist/miniprogramIntrinsicElements/elements/icon.d.mts +12 -0
- package/dist/miniprogramIntrinsicElements/elements/image.d.mts +16 -0
- package/dist/miniprogramIntrinsicElements/elements/input.d.mts +29 -0
- package/dist/miniprogramIntrinsicElements/elements/label.d.mts +11 -0
- package/dist/miniprogramIntrinsicElements/elements/map.d.mts +31 -0
- package/dist/miniprogramIntrinsicElements/elements/match-media.d.mts +13 -0
- package/dist/miniprogramIntrinsicElements/elements/movable-area.d.mts +9 -0
- package/dist/miniprogramIntrinsicElements/elements/movable-view.d.mts +26 -0
- package/dist/miniprogramIntrinsicElements/elements/navigator.d.mts +15 -0
- package/dist/miniprogramIntrinsicElements/elements/picker-view-column.d.mts +9 -0
- package/dist/miniprogramIntrinsicElements/elements/picker-view.d.mts +20 -0
- package/dist/miniprogramIntrinsicElements/elements/picker.d.mts +14 -0
- package/dist/miniprogramIntrinsicElements/elements/progress.d.mts +12 -0
- package/dist/miniprogramIntrinsicElements/elements/radio-group.d.mts +12 -0
- package/dist/miniprogramIntrinsicElements/elements/radio.d.mts +13 -0
- package/dist/miniprogramIntrinsicElements/elements/rich-text.d.mts +11 -0
- package/dist/miniprogramIntrinsicElements/elements/scroll-view.d.mts +22 -0
- package/dist/miniprogramIntrinsicElements/elements/slider.d.mts +19 -0
- package/dist/miniprogramIntrinsicElements/elements/swiper-item.d.mts +9 -0
- package/dist/miniprogramIntrinsicElements/elements/swiper.d.mts +24 -0
- package/dist/miniprogramIntrinsicElements/elements/switch.d.mts +14 -0
- package/dist/miniprogramIntrinsicElements/elements/text.d.mts +13 -0
- package/dist/miniprogramIntrinsicElements/elements/textarea.d.mts +23 -0
- package/dist/miniprogramIntrinsicElements/elements/video.d.mts +29 -0
- package/dist/miniprogramIntrinsicElements/elements/view.d.mts +16 -0
- package/dist/miniprogramIntrinsicElements/elements/web-view.d.mts +15 -0
- package/dist/miniprogramIntrinsicElements.d.mts +70 -0
- package/dist/package.mjs +1 -1
- package/dist/reactivity/asyncDerivation.d.mts +40 -0
- package/dist/reactivity/asyncDerivation.mjs +1 -0
- package/dist/reactivity/computed.d.mts +8 -9
- package/dist/reactivity/computed.mjs +1 -1
- package/dist/reactivity/core.d.mts +15 -15
- package/dist/reactivity/core.mjs +1 -1
- package/dist/reactivity/index.d.mts +2 -1
- package/dist/reactivity/reactive/mutation.d.mts +6 -7
- package/dist/reactivity/reactive/patch.d.mts +4 -5
- package/dist/reactivity/reactive/shallow.d.mts +3 -4
- package/dist/reactivity/reactive/shared.d.mts +2 -3
- package/dist/reactivity/reactive.d.mts +6 -6
- package/dist/reactivity/readonly.d.mts +7 -8
- package/dist/reactivity/ref.d.mts +14 -15
- package/dist/reactivity/ref.mjs +1 -1
- package/dist/reactivity/shallowRef.d.mts +5 -6
- package/dist/reactivity/toRefs.d.mts +5 -6
- package/dist/reactivity/traverse.d.mts +2 -3
- package/dist/reactivity/watch/types.d.mts +18 -19
- package/dist/reactivity/watch.d.mts +8 -8
- package/dist/router/createRouter.d.mts +2 -3
- package/dist/router/navigationCore.d.mts +3 -4
- package/dist/router/resolve.d.mts +2 -3
- package/dist/router/routeSync.mjs +1 -1
- package/dist/router/types.d.mts +38 -39
- package/dist/router/useRoute.d.mts +5 -6
- package/dist/router/useRoute.mjs +1 -1
- package/dist/router/useRouter.d.mts +2 -3
- package/dist/routerInternal/query.d.mts +3 -4
- package/dist/routerInternal/types.d.mts +2 -3
- package/dist/runtime/app/computed.mjs +1 -1
- package/dist/runtime/app/context.mjs +1 -1
- package/dist/runtime/app/diagnostics.mjs +1 -1
- package/dist/runtime/app/mount.mjs +1 -1
- package/dist/runtime/app/pending.d.mts +3 -4
- package/dist/runtime/app/setData/commitTracker.d.mts +12 -0
- package/dist/runtime/app/setData/commitTracker.mjs +1 -0
- package/dist/runtime/app/setData/patchScheduler.mjs +1 -1
- package/dist/runtime/app/setData/scheduler.d.mts +50 -0
- package/dist/runtime/app/setData/scheduler.mjs +1 -1
- package/dist/runtime/app/setData/snapshot.mjs +1 -1
- package/dist/runtime/app.d.mts +2 -3
- package/dist/runtime/app.mjs +1 -1
- package/dist/runtime/bindingManifest.mjs +1 -0
- package/dist/runtime/capabilities.d.mts +74 -0
- package/dist/runtime/capabilities.mjs +1 -0
- package/dist/runtime/css.d.mts +3 -4
- package/dist/runtime/defaults.d.mts +5 -6
- package/dist/runtime/define/componentDefinition.mjs +1 -1
- package/dist/runtime/define/optionsApi.mjs +1 -1
- package/dist/runtime/define/props.mjs +1 -1
- package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
- package/dist/runtime/define.d.mts +18 -27
- package/dist/runtime/define.mjs +1 -1
- package/dist/runtime/diff.mjs +1 -1
- package/dist/runtime/disposables.d.mts +6 -7
- package/dist/runtime/elementIntersectionObserver.d.mts +5 -6
- package/dist/runtime/features/inlineEvents.d.mts +6 -0
- package/dist/runtime/features/inlineEvents.mjs +1 -0
- package/dist/runtime/features/layout.d.mts +6 -0
- package/dist/runtime/features/layout.mjs +1 -0
- package/dist/runtime/features/patchStrategy.d.mts +6 -0
- package/dist/runtime/features/patchStrategy.mjs +1 -0
- package/dist/runtime/features/publicLayout.d.mts +23 -0
- package/dist/runtime/features/publicLayout.mjs +1 -0
- package/dist/runtime/features/scopedSlots.d.mts +22 -0
- package/dist/runtime/features/scopedSlots.mjs +1 -0
- package/dist/runtime/features/setDataHighFrequencyWarning.d.mts +6 -0
- package/dist/runtime/features/setDataHighFrequencyWarning.mjs +1 -0
- package/dist/runtime/features/templateRefs.d.mts +6 -0
- package/dist/runtime/features/templateRefs.mjs +1 -0
- package/dist/runtime/hooks/base.d.mts +7 -8
- package/dist/runtime/hooks/register.d.mts +26 -27
- package/dist/runtime/hooks/vue.d.mts +13 -15
- package/dist/runtime/hooks/vue.mjs +1 -1
- package/dist/runtime/index.d.mts +12 -14
- package/dist/runtime/inlineDataset.mjs +1 -0
- package/dist/runtime/intersectionObserver.d.mts +4 -5
- package/dist/runtime/jsxIsland.d.mts +20 -25
- package/dist/runtime/layoutBridge.d.mts +12 -17
- package/dist/runtime/noSetData.d.mts +3 -4
- package/dist/runtime/pageEnvironment.d.mts +9 -10
- package/dist/runtime/pageLayout.d.mts +9 -11
- package/dist/runtime/pageScroll.d.mts +4 -5
- package/dist/runtime/provide.d.mts +7 -7
- package/dist/runtime/provideStore.d.mts +2 -3
- package/dist/runtime/publicRuntime.d.mts +21 -0
- package/dist/runtime/publicRuntime.mjs +1 -0
- package/dist/runtime/pullDownRefresh.d.mts +4 -5
- package/dist/runtime/register/app.d.mts +2 -3
- package/dist/runtime/register/app.mjs +1 -1
- package/dist/runtime/register/component/lifecycle.mjs +1 -1
- package/dist/runtime/register/component/methods.mjs +1 -1
- package/dist/runtime/register/component/registerDefinition.mjs +1 -1
- package/dist/runtime/register/component.d.mts +2 -3
- package/dist/runtime/register/inline.d.mts +3 -4
- package/dist/runtime/register/inline.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupSnapshot.mjs +1 -0
- package/dist/runtime/register/runtimeInstance.d.mts +4 -5
- package/dist/runtime/register/runtimeInstance.mjs +1 -1
- package/dist/runtime/register/setup.d.mts +2 -3
- package/dist/runtime/register/snapshot.mjs +1 -1
- package/dist/runtime/register/watch.d.mts +3 -4
- package/dist/runtime/scopedSlots.mjs +1 -1
- package/dist/runtime/selectorQuery.d.mts +15 -16
- package/dist/runtime/selectorQuery.mjs +1 -1
- package/dist/runtime/teardown.mjs +1 -0
- package/dist/runtime/template.d.mts +4 -5
- package/dist/runtime/templateRefTypes.d.mts +7 -3
- package/dist/runtime/templateRefs.mjs +1 -1
- package/dist/runtime/types/core.d.mts +9 -10
- package/dist/runtime/types/miniprogram.d.mts +13 -10
- package/dist/runtime/types/miniprogramHost.d.mts +41 -41
- package/dist/runtime/types/miniprogramHostSources.d.mts +21 -22
- package/dist/runtime/types/options.d.mts +8 -9
- package/dist/runtime/types/props/propTypes.d.mts +16 -17
- package/dist/runtime/types/props/router.d.mts +13 -14
- package/dist/runtime/types/props/setup.d.mts +7 -8
- package/dist/runtime/types/props.d.mts +1 -1
- package/dist/runtime/types/runtime.d.mts +7 -8
- package/dist/runtime/types/setData.d.mts +21 -5
- package/dist/runtime/types.d.mts +10 -10
- package/dist/runtime/uniAppHost.d.mts +2 -3
- package/dist/runtime/updatePerformance.d.mts +5 -6
- package/dist/runtime/use.d.mts +3 -4
- package/dist/runtime/vueCompat/context.d.mts +4 -5
- package/dist/runtime/vueCompat/model.d.mts +9 -10
- package/dist/runtime/vueCompat/router.d.mts +3 -4
- package/dist/runtime/vueCompat/templateRef.d.mts +4 -5
- package/dist/runtime/vueCompat/templateRef.mjs +1 -1
- package/dist/scheduler.d.mts +2 -3
- package/dist/store/base.mjs +1 -1
- package/dist/store/define/optionsStyle.mjs +1 -1
- package/dist/store/define/setupStyle.mjs +1 -1
- package/dist/store/define/shared.mjs +1 -1
- package/dist/store/define.d.mts +12 -11
- package/dist/store/manager.d.mts +2 -3
- package/dist/store/storeToRefs.d.mts +3 -4
- package/dist/store/types.d.mts +12 -13
- package/dist/tt/jsx-runtime.d.mts +13 -0
- package/dist/tt/jsx-runtime.mjs +1 -0
- package/dist/ttIntrinsicElements/base.d.mts +4 -0
- package/dist/ttIntrinsicElements/elements/ad.d.mts +7 -0
- package/dist/ttIntrinsicElements/elements/aweme-data.d.mts +14 -0
- package/dist/ttIntrinsicElements/elements/aweme-user-card.d.mts +15 -0
- package/dist/ttIntrinsicElements/elements/button.d.mts +22 -0
- package/dist/ttIntrinsicElements/elements/camera.d.mts +18 -0
- package/dist/ttIntrinsicElements/elements/canvas.d.mts +15 -0
- package/dist/ttIntrinsicElements/elements/checkbox-group.d.mts +11 -0
- package/dist/ttIntrinsicElements/elements/checkbox.d.mts +11 -0
- package/dist/ttIntrinsicElements/elements/draw-ad.d.mts +15 -0
- package/dist/ttIntrinsicElements/elements/form.d.mts +13 -0
- package/dist/ttIntrinsicElements/elements/icon.d.mts +10 -0
- package/dist/ttIntrinsicElements/elements/image.d.mts +15 -0
- package/dist/ttIntrinsicElements/elements/input.d.mts +31 -0
- package/dist/ttIntrinsicElements/elements/label.d.mts +9 -0
- package/dist/ttIntrinsicElements/elements/live-player.d.mts +18 -0
- package/dist/ttIntrinsicElements/elements/live-preview.d.mts +12 -0
- package/dist/ttIntrinsicElements/elements/map.d.mts +35 -0
- package/dist/ttIntrinsicElements/elements/mask.d.mts +7 -0
- package/dist/ttIntrinsicElements/elements/match-media.d.mts +15 -0
- package/dist/ttIntrinsicElements/elements/movable-area.d.mts +9 -0
- package/dist/ttIntrinsicElements/elements/movable-view.d.mts +26 -0
- package/dist/ttIntrinsicElements/elements/navigator.d.mts +15 -0
- package/dist/ttIntrinsicElements/elements/open-data.d.mts +14 -0
- package/dist/ttIntrinsicElements/elements/picker-view-column.d.mts +7 -0
- package/dist/ttIntrinsicElements/elements/picker-view.d.mts +18 -0
- package/dist/ttIntrinsicElements/elements/picker.d.mts +21 -0
- package/dist/ttIntrinsicElements/elements/progress.d.mts +15 -0
- package/dist/ttIntrinsicElements/elements/radio-group.d.mts +11 -0
- package/dist/ttIntrinsicElements/elements/radio.d.mts +11 -0
- package/dist/ttIntrinsicElements/elements/rich-text.d.mts +9 -0
- package/dist/ttIntrinsicElements/elements/rtc-room.d.mts +12 -0
- package/dist/ttIntrinsicElements/elements/scroll-view.d.mts +31 -0
- package/dist/ttIntrinsicElements/elements/slider.d.mts +18 -0
- package/dist/ttIntrinsicElements/elements/swiper-item.d.mts +9 -0
- package/dist/ttIntrinsicElements/elements/swiper.d.mts +26 -0
- package/dist/ttIntrinsicElements/elements/switch.d.mts +13 -0
- package/dist/ttIntrinsicElements/elements/text.d.mts +11 -0
- package/dist/ttIntrinsicElements/elements/textarea.d.mts +33 -0
- package/dist/ttIntrinsicElements/elements/video.d.mts +57 -0
- package/dist/ttIntrinsicElements/elements/view.d.mts +14 -0
- package/dist/ttIntrinsicElements/elements/web-view.d.mts +14 -0
- package/dist/ttIntrinsicElements.d.mts +88 -0
- package/dist/version.d.mts +2 -3
- package/dist/vue-augment.d.mts +2 -1
- package/dist/vue-demi.d.mts +17 -18
- package/dist/vue-demi.mjs +1 -1
- package/dist/vue-types.d.mts +2 -2
- package/dist/weapp/jsx-runtime.d.mts +13 -0
- package/dist/weapp/jsx-runtime.mjs +1 -0
- package/dist/weappIntrinsicElements/base.d.mts +3 -21
- package/dist/weappIntrinsicElements/elements/ad-custom.d.mts +6 -6
- package/dist/weappIntrinsicElements/elements/ad.d.mts +7 -7
- package/dist/weappIntrinsicElements/elements/audio.d.mts +9 -9
- package/dist/weappIntrinsicElements/elements/block.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/button.d.mts +18 -17
- package/dist/weappIntrinsicElements/elements/camera.d.mts +12 -12
- package/dist/weappIntrinsicElements/elements/canvas.d.mts +10 -10
- package/dist/weappIntrinsicElements/elements/checkbox-group.d.mts +6 -9
- package/dist/weappIntrinsicElements/elements/checkbox.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/cover-image.d.mts +9 -6
- package/dist/weappIntrinsicElements/elements/cover-view.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/editor.d.mts +9 -9
- package/dist/weappIntrinsicElements/elements/form.d.mts +7 -7
- package/dist/weappIntrinsicElements/elements/functional-page-navigator.d.mts +9 -9
- package/dist/weappIntrinsicElements/elements/icon.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/image.d.mts +7 -7
- package/dist/weappIntrinsicElements/elements/import.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/include.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/input.d.mts +17 -18
- package/dist/weappIntrinsicElements/elements/keyboard-accessory.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/label.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/live-player.d.mts +18 -18
- package/dist/weappIntrinsicElements/elements/live-pusher.d.mts +19 -19
- package/dist/weappIntrinsicElements/elements/map.d.mts +18 -18
- package/dist/weappIntrinsicElements/elements/match-media.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/movable-area.d.mts +8 -8
- package/dist/weappIntrinsicElements/elements/movable-view.d.mts +8 -8
- package/dist/weappIntrinsicElements/elements/navigation-bar.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/navigator.d.mts +10 -10
- package/dist/weappIntrinsicElements/elements/official-account.d.mts +6 -6
- package/dist/weappIntrinsicElements/elements/open-data.d.mts +5 -5
- package/dist/weappIntrinsicElements/elements/page-container.d.mts +11 -11
- package/dist/weappIntrinsicElements/elements/page-meta.d.mts +7 -7
- package/dist/weappIntrinsicElements/elements/picker-view-column.d.mts +7 -7
- package/dist/weappIntrinsicElements/elements/picker-view.d.mts +7 -7
- package/dist/weappIntrinsicElements/elements/picker.d.mts +9 -9
- package/dist/weappIntrinsicElements/elements/progress.d.mts +5 -5
- package/dist/weappIntrinsicElements/elements/radio-group.d.mts +6 -9
- package/dist/weappIntrinsicElements/elements/radio.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/rich-text.d.mts +6 -7
- package/dist/weappIntrinsicElements/elements/scroll-view.d.mts +20 -25
- package/dist/weappIntrinsicElements/elements/share-element.d.mts +5 -7
- package/dist/weappIntrinsicElements/elements/slider.d.mts +6 -6
- package/dist/weappIntrinsicElements/elements/slot.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/swiper-item.d.mts +6 -38
- package/dist/weappIntrinsicElements/elements/swiper.d.mts +11 -14
- package/dist/weappIntrinsicElements/elements/switch.d.mts +5 -5
- package/dist/weappIntrinsicElements/elements/template.d.mts +3 -4
- package/dist/weappIntrinsicElements/elements/text.d.mts +5 -6
- package/dist/weappIntrinsicElements/elements/textarea.d.mts +16 -16
- package/dist/weappIntrinsicElements/elements/video.d.mts +24 -24
- package/dist/weappIntrinsicElements/elements/view.d.mts +5 -4
- package/dist/weappIntrinsicElements/elements/voip-room.d.mts +7 -7
- package/dist/weappIntrinsicElements/elements/web-view.d.mts +7 -7
- package/dist/weappIntrinsicElements.d.mts +111 -150
- package/package.json +19 -19
- package/dist/dev/jsx-runtime.mjs +0 -1
- package/dist/runtime/templateRefs.d.mts +0 -11
- /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/defineProperty.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPrimitive.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/toPropertyKey.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.148.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/typeof.mjs +0 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { cloneSnapshotValue } from "./snapshot.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/app/setData/commitTracker.ts
|
|
4
|
+
const resolvedCommitPromise = Promise.resolve();
|
|
5
|
+
function isThenable(value) {
|
|
6
|
+
return Boolean(value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function");
|
|
7
|
+
}
|
|
8
|
+
function formatCommitFailureCause(cause) {
|
|
9
|
+
try {
|
|
10
|
+
return cause instanceof Error ? cause.message : String(cause);
|
|
11
|
+
} catch (_unused) {
|
|
12
|
+
return "<unprintable cause>";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function createCommitError(kind, record, cause) {
|
|
16
|
+
const causeMessage = formatCommitFailureCause(cause);
|
|
17
|
+
const error = /* @__PURE__ */ new Error(`[wevu] setData commit failed (${kind === "adapter" ? "adapter failure" : "out-of-order completion"}, revision=${record.revision}, mode=${record.mode}, kind=${record.kind}): ${causeMessage}`);
|
|
18
|
+
error.cause = cause;
|
|
19
|
+
return error;
|
|
20
|
+
}
|
|
21
|
+
function observeSetDataCompletion(options) {
|
|
22
|
+
let settled = false;
|
|
23
|
+
let invoking = true;
|
|
24
|
+
let callbackCalled = false;
|
|
25
|
+
let returnIsAuthoritative = false;
|
|
26
|
+
const settleOnce = (settlement, cause) => {
|
|
27
|
+
if (settled) return;
|
|
28
|
+
settled = true;
|
|
29
|
+
options.settle(settlement, cause);
|
|
30
|
+
};
|
|
31
|
+
const callback = () => {
|
|
32
|
+
if (invoking) {
|
|
33
|
+
callbackCalled = true;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (returnIsAuthoritative) return;
|
|
37
|
+
if (options.completion === "callback") settleOnce("committed");
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
const result = options.invoke(callback);
|
|
41
|
+
const resultIsThenable = isThenable(result);
|
|
42
|
+
returnIsAuthoritative = resultIsThenable;
|
|
43
|
+
invoking = false;
|
|
44
|
+
if (resultIsThenable) {
|
|
45
|
+
result.then(() => settleOnce("committed"), (cause) => settleOnce("failed", cause));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (options.completion === "return" || callbackCalled) settleOnce("committed");
|
|
49
|
+
} catch (cause) {
|
|
50
|
+
invoking = false;
|
|
51
|
+
settleOnce("failed", cause);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function createSetDataCommitTracker(options) {
|
|
55
|
+
const initialSnapshot = options.initialSnapshot ? cloneSnapshotValue(options.initialSnapshot) : {};
|
|
56
|
+
const knownHostTopKeys = new Set(Object.keys(initialSnapshot));
|
|
57
|
+
let epoch = 0;
|
|
58
|
+
let highestCompletedRevision = 0;
|
|
59
|
+
let head;
|
|
60
|
+
let tail;
|
|
61
|
+
function ensureCommitBarrier(record) {
|
|
62
|
+
if (!record.inLedger) return resolvedCommitPromise;
|
|
63
|
+
if (!record.commitPromise) record.commitPromise = new Promise((resolve) => {
|
|
64
|
+
record.resolveCommit = resolve;
|
|
65
|
+
});
|
|
66
|
+
return record.commitPromise;
|
|
67
|
+
}
|
|
68
|
+
const state = {
|
|
69
|
+
preparedSnapshot: initialSnapshot,
|
|
70
|
+
dispatchedSnapshot: initialSnapshot,
|
|
71
|
+
committedSnapshot: initialSnapshot,
|
|
72
|
+
revision: 0,
|
|
73
|
+
committedRevision: 0,
|
|
74
|
+
failedRevision: void 0,
|
|
75
|
+
needsFullSnapshot: false,
|
|
76
|
+
get commitPromise() {
|
|
77
|
+
return tail ? ensureCommitBarrier(tail) : resolvedCommitPromise;
|
|
78
|
+
},
|
|
79
|
+
disposed: false
|
|
80
|
+
};
|
|
81
|
+
const reportFailure = (kind, record, cause) => {
|
|
82
|
+
const error = createCommitError(kind, record, cause);
|
|
83
|
+
try {
|
|
84
|
+
options.onFailure({
|
|
85
|
+
kind,
|
|
86
|
+
revision: record.revision,
|
|
87
|
+
committedRevision: state.committedRevision,
|
|
88
|
+
mode: record.mode,
|
|
89
|
+
cause,
|
|
90
|
+
error,
|
|
91
|
+
payloadKeys: record.payloadKeys,
|
|
92
|
+
pendingPatchKeys: record.pendingPatchKeys
|
|
93
|
+
});
|
|
94
|
+
} catch (_unused2) {}
|
|
95
|
+
};
|
|
96
|
+
const resolveRecord = (record) => {
|
|
97
|
+
var _record$resolveCommit;
|
|
98
|
+
(_record$resolveCommit = record.resolveCommit) === null || _record$resolveCommit === void 0 || _record$resolveCommit.call(record);
|
|
99
|
+
record.resolveCommit = void 0;
|
|
100
|
+
};
|
|
101
|
+
const removePrefixThrough = (last) => {
|
|
102
|
+
let current = head;
|
|
103
|
+
while (current) {
|
|
104
|
+
const next = current.next;
|
|
105
|
+
current.inLedger = false;
|
|
106
|
+
current.next = void 0;
|
|
107
|
+
resolveRecord(current);
|
|
108
|
+
if (current === last) {
|
|
109
|
+
head = next;
|
|
110
|
+
if (!head) tail = void 0;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
current = next;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const invalidateLedger = () => {
|
|
117
|
+
let current = head;
|
|
118
|
+
while (current) {
|
|
119
|
+
const next = current.next;
|
|
120
|
+
current.inLedger = false;
|
|
121
|
+
current.next = void 0;
|
|
122
|
+
if (!current.physicalSettled) current.status = "abandoned";
|
|
123
|
+
resolveRecord(current);
|
|
124
|
+
current = next;
|
|
125
|
+
}
|
|
126
|
+
head = void 0;
|
|
127
|
+
tail = void 0;
|
|
128
|
+
epoch += 1;
|
|
129
|
+
highestCompletedRevision = state.committedRevision;
|
|
130
|
+
};
|
|
131
|
+
const armRecovery = () => {
|
|
132
|
+
state.needsFullSnapshot = true;
|
|
133
|
+
};
|
|
134
|
+
const failLineage = (kind, record, cause) => {
|
|
135
|
+
record.status = "failed";
|
|
136
|
+
state.failedRevision = record.revision;
|
|
137
|
+
armRecovery();
|
|
138
|
+
invalidateLedger();
|
|
139
|
+
reportFailure(kind, record, cause);
|
|
140
|
+
};
|
|
141
|
+
const drainSucceededPrefix = () => {
|
|
142
|
+
while ((head === null || head === void 0 ? void 0 : head.status) === "succeeded") {
|
|
143
|
+
const record = head;
|
|
144
|
+
state.committedSnapshot = record.snapshot;
|
|
145
|
+
state.committedRevision = record.revision;
|
|
146
|
+
head = record.next;
|
|
147
|
+
record.inLedger = false;
|
|
148
|
+
record.next = void 0;
|
|
149
|
+
resolveRecord(record);
|
|
150
|
+
}
|
|
151
|
+
if (!head) tail = void 0;
|
|
152
|
+
};
|
|
153
|
+
const commitFullCheckpoint = (record) => {
|
|
154
|
+
state.committedSnapshot = record.snapshot;
|
|
155
|
+
state.committedRevision = record.revision;
|
|
156
|
+
state.failedRevision = void 0;
|
|
157
|
+
state.needsFullSnapshot = false;
|
|
158
|
+
removePrefixThrough(record);
|
|
159
|
+
drainSucceededPrefix();
|
|
160
|
+
};
|
|
161
|
+
const handleLateSettlement = (record, settlement, cause) => {
|
|
162
|
+
if (settlement === "failed") {
|
|
163
|
+
reportFailure("adapter", record, cause);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (settlement === "committed" && state.committedRevision > record.revision) {
|
|
167
|
+
if (head) invalidateLedger();
|
|
168
|
+
armRecovery();
|
|
169
|
+
reportFailure("out-of-order", record, `revision ${record.revision} completed after committed revision ${state.committedRevision}`);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const settleRecord = (record, settlement, cause) => {
|
|
173
|
+
if (state.disposed || record.physicalSettled) return;
|
|
174
|
+
record.physicalSettled = true;
|
|
175
|
+
if (!record.inLedger || record.epoch !== epoch) {
|
|
176
|
+
handleLateSettlement(record, settlement, cause);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (settlement === "abandoned") {
|
|
180
|
+
record.status = "abandoned";
|
|
181
|
+
armRecovery();
|
|
182
|
+
invalidateLedger();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (settlement === "failed") {
|
|
186
|
+
failLineage("adapter", record, cause);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
record.status = "succeeded";
|
|
190
|
+
if (highestCompletedRevision > record.revision) {
|
|
191
|
+
failLineage("out-of-order", record, `revision ${record.revision} completed after revision ${highestCompletedRevision}`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
highestCompletedRevision = record.revision;
|
|
195
|
+
if (record.kind === "full") {
|
|
196
|
+
commitFullCheckpoint(record);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
drainSucceededPrefix();
|
|
200
|
+
};
|
|
201
|
+
const createFullPayload = (snapshot) => {
|
|
202
|
+
const payload = {};
|
|
203
|
+
const snapshotKeys = new Set(Object.keys(snapshot));
|
|
204
|
+
for (const [key, value] of Object.entries(snapshot)) payload[key] = value === void 0 ? null : value;
|
|
205
|
+
for (const key of knownHostTopKeys) if (!snapshotKeys.has(key)) payload[key] = null;
|
|
206
|
+
return payload;
|
|
207
|
+
};
|
|
208
|
+
const dispatch = (update) => {
|
|
209
|
+
if (state.disposed) return state.revision;
|
|
210
|
+
const revision = state.revision + 1;
|
|
211
|
+
state.revision = revision;
|
|
212
|
+
state.preparedSnapshot = update.snapshot;
|
|
213
|
+
const record = {
|
|
214
|
+
revision,
|
|
215
|
+
epoch,
|
|
216
|
+
mode: update.mode,
|
|
217
|
+
kind: update.kind,
|
|
218
|
+
snapshot: update.snapshot,
|
|
219
|
+
payloadKeys: Object.keys(update.payload).length,
|
|
220
|
+
pendingPatchKeys: update.pendingPatchKeys,
|
|
221
|
+
status: "dispatched",
|
|
222
|
+
physicalSettled: false,
|
|
223
|
+
inLedger: true,
|
|
224
|
+
next: void 0
|
|
225
|
+
};
|
|
226
|
+
if (tail) tail.next = record;
|
|
227
|
+
else head = record;
|
|
228
|
+
tail = record;
|
|
229
|
+
state.dispatchedSnapshot = update.snapshot;
|
|
230
|
+
for (const key of Object.keys(update.payload)) knownHostTopKeys.add(key.split(".", 1)[0]);
|
|
231
|
+
const settle = (settlement, cause) => {
|
|
232
|
+
settleRecord(record, settlement, cause);
|
|
233
|
+
};
|
|
234
|
+
const hostPayload = cloneSnapshotValue(update.payload);
|
|
235
|
+
if (typeof options.adapter.__wevu_dispatchSetData === "function") try {
|
|
236
|
+
options.adapter.__wevu_dispatchSetData(hostPayload, settle);
|
|
237
|
+
} catch (cause) {
|
|
238
|
+
settle("failed", cause);
|
|
239
|
+
}
|
|
240
|
+
else observeSetDataCompletion({
|
|
241
|
+
invoke: () => {
|
|
242
|
+
var _options$adapter$setD, _options$adapter;
|
|
243
|
+
return (_options$adapter$setD = (_options$adapter = options.adapter).setData) === null || _options$adapter$setD === void 0 ? void 0 : _options$adapter$setD.call(_options$adapter, hostPayload);
|
|
244
|
+
},
|
|
245
|
+
completion: "return",
|
|
246
|
+
settle
|
|
247
|
+
});
|
|
248
|
+
return revision;
|
|
249
|
+
};
|
|
250
|
+
const dispose = () => {
|
|
251
|
+
if (state.disposed) return;
|
|
252
|
+
state.disposed = true;
|
|
253
|
+
invalidateLedger();
|
|
254
|
+
};
|
|
255
|
+
return {
|
|
256
|
+
state,
|
|
257
|
+
dispatch,
|
|
258
|
+
createFullPayload,
|
|
259
|
+
dispose
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
//#endregion
|
|
264
|
+
export { createSetDataCommitTracker, observeSetDataCompletion };
|
|
265
|
+
//# sourceMappingURL=commitTracker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commitTracker.mjs","names":[],"sources":["../../../../../src/runtime/app/setData/commitTracker.ts"],"sourcesContent":["import type { MiniProgramAdapter, SetDataDebugInfo } from '../../types'\nimport { cloneSnapshotValue } from './snapshot'\n\nexport type SetDataSnapshot = Record<string, unknown>\nexport type SetDataPayload = Record<string, unknown>\nexport type SetDataMode = 'diff' | 'patch'\nexport type SetDataRevisionKind = 'delta' | 'full'\nexport type SetDataAdapterSettlement = 'committed' | 'failed' | 'abandoned'\n\nexport type SetDataAdapterSettler = (\n settlement: SetDataAdapterSettlement,\n cause?: unknown,\n) => void\n\nexport interface CommitAwareSetDataAdapter extends MiniProgramAdapter {\n __wevu_dispatchSetData?: (\n payload: SetDataPayload,\n settle: SetDataAdapterSettler,\n ) => void\n __wevu_reportSetDataError?: (error: Error) => void\n __wevu_disposeSetData?: () => void\n}\n\nexport interface PreparedSetDataUpdate {\n mode: SetDataMode\n kind: SetDataRevisionKind\n reason: SetDataDebugInfo['reason']\n snapshot: SetDataSnapshot\n payload: SetDataPayload\n pendingPatchKeys: number\n}\n\nexport interface SetDataCommitFailure {\n kind: 'adapter' | 'out-of-order'\n revision: number\n committedRevision: number\n mode: SetDataMode\n cause: unknown\n error: Error\n payloadKeys: number\n pendingPatchKeys: number\n}\n\nexport interface SetDataCommitState {\n preparedSnapshot: SetDataSnapshot\n dispatchedSnapshot: SetDataSnapshot\n committedSnapshot: SetDataSnapshot\n revision: number\n committedRevision: number\n failedRevision: number | undefined\n needsFullSnapshot: boolean\n commitPromise: Promise<void>\n disposed: boolean\n}\n\nexport interface SetDataCommitTracker {\n readonly state: SetDataCommitState\n dispatch: (update: PreparedSetDataUpdate) => number\n createFullPayload: (snapshot: SetDataSnapshot) => SetDataPayload\n dispose: () => void\n}\n\ntype RevisionStatus = 'dispatched' | 'succeeded' | 'failed' | 'abandoned'\n\ninterface RevisionRecord {\n revision: number\n epoch: number\n mode: SetDataMode\n kind: SetDataRevisionKind\n snapshot: SetDataSnapshot\n payloadKeys: number\n pendingPatchKeys: number\n status: RevisionStatus\n physicalSettled: boolean\n inLedger: boolean\n next: RevisionRecord | undefined\n commitPromise?: Promise<void>\n resolveCommit?: () => void\n}\n\nconst resolvedCommitPromise = Promise.resolve()\n\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return Boolean(\n value\n && (typeof value === 'object' || typeof value === 'function')\n && typeof (value as PromiseLike<unknown>).then === 'function',\n )\n}\n\nfunction formatCommitFailureCause(cause: unknown): string {\n try {\n return cause instanceof Error ? cause.message : String(cause)\n }\n catch {\n return '<unprintable cause>'\n }\n}\n\nfunction createCommitError(\n kind: SetDataCommitFailure['kind'],\n record: RevisionRecord,\n cause: unknown,\n) {\n const causeMessage = formatCommitFailureCause(cause)\n const label = kind === 'adapter' ? 'adapter failure' : 'out-of-order completion'\n const error = new Error(\n `[wevu] setData commit failed (${label}, revision=${record.revision}, mode=${record.mode}, kind=${record.kind}): ${causeMessage}`,\n )\n ;(error as Error & { cause?: unknown }).cause = cause\n return error\n}\n\nexport function observeSetDataCompletion(options: {\n invoke: (callback: () => void) => unknown\n completion: 'return' | 'callback'\n settle: SetDataAdapterSettler\n}): void {\n let settled = false\n let invoking = true\n let callbackCalled = false\n let returnIsAuthoritative = false\n const settleOnce: SetDataAdapterSettler = (settlement, cause) => {\n if (settled) {\n return\n }\n settled = true\n options.settle(settlement, cause)\n }\n const callback = () => {\n if (invoking) {\n callbackCalled = true\n return\n }\n if (returnIsAuthoritative) {\n return\n }\n if (options.completion === 'callback') {\n settleOnce('committed')\n }\n }\n\n try {\n const result = options.invoke(callback)\n const resultIsThenable = isThenable(result)\n returnIsAuthoritative = resultIsThenable\n invoking = false\n if (resultIsThenable) {\n result.then(\n () => settleOnce('committed'),\n cause => settleOnce('failed', cause),\n )\n return\n }\n if (options.completion === 'return' || callbackCalled) {\n settleOnce('committed')\n }\n }\n catch (cause) {\n invoking = false\n settleOnce('failed', cause)\n }\n}\n\nexport function createSetDataCommitTracker(options: {\n initialSnapshot?: SetDataSnapshot\n adapter: CommitAwareSetDataAdapter\n onFailure: (failure: SetDataCommitFailure) => void\n}): SetDataCommitTracker {\n const initialSnapshot = options.initialSnapshot ? cloneSnapshotValue(options.initialSnapshot) : {}\n const knownHostTopKeys = new Set(Object.keys(initialSnapshot))\n let epoch = 0\n let highestCompletedRevision = 0\n let head: RevisionRecord | undefined\n let tail: RevisionRecord | undefined\n\n function ensureCommitBarrier(record: RevisionRecord) {\n if (!record.inLedger) {\n return resolvedCommitPromise\n }\n if (!record.commitPromise) {\n record.commitPromise = new Promise<void>((resolve) => {\n record.resolveCommit = resolve\n })\n }\n return record.commitPromise\n }\n\n const state: SetDataCommitState = {\n preparedSnapshot: initialSnapshot,\n dispatchedSnapshot: initialSnapshot,\n committedSnapshot: initialSnapshot,\n revision: 0,\n committedRevision: 0,\n failedRevision: undefined,\n needsFullSnapshot: false,\n get commitPromise() {\n return tail ? ensureCommitBarrier(tail) : resolvedCommitPromise\n },\n disposed: false,\n }\n\n const reportFailure = (\n kind: SetDataCommitFailure['kind'],\n record: RevisionRecord,\n cause: unknown,\n ) => {\n const error = createCommitError(kind, record, cause)\n try {\n options.onFailure({\n kind,\n revision: record.revision,\n committedRevision: state.committedRevision,\n mode: record.mode,\n cause,\n error,\n payloadKeys: record.payloadKeys,\n pendingPatchKeys: record.pendingPatchKeys,\n })\n }\n catch {\n // 错误上报不得反向破坏提交状态机。\n }\n }\n\n const resolveRecord = (record: RevisionRecord) => {\n record.resolveCommit?.()\n record.resolveCommit = undefined\n }\n\n const removePrefixThrough = (last: RevisionRecord) => {\n let current = head\n while (current) {\n const next = current.next\n current.inLedger = false\n current.next = undefined\n resolveRecord(current)\n if (current === last) {\n head = next\n if (!head) {\n tail = undefined\n }\n return\n }\n current = next\n }\n }\n\n const invalidateLedger = () => {\n let current = head\n while (current) {\n const next = current.next\n current.inLedger = false\n current.next = undefined\n if (!current.physicalSettled) {\n current.status = 'abandoned'\n }\n resolveRecord(current)\n current = next\n }\n head = undefined\n tail = undefined\n epoch += 1\n highestCompletedRevision = state.committedRevision\n }\n\n const armRecovery = () => {\n state.needsFullSnapshot = true\n }\n\n const failLineage = (\n kind: SetDataCommitFailure['kind'],\n record: RevisionRecord,\n cause: unknown,\n ) => {\n record.status = 'failed'\n state.failedRevision = record.revision\n armRecovery()\n invalidateLedger()\n reportFailure(kind, record, cause)\n }\n\n const drainSucceededPrefix = () => {\n while (head?.status === 'succeeded') {\n const record = head\n state.committedSnapshot = record.snapshot\n state.committedRevision = record.revision\n head = record.next\n record.inLedger = false\n record.next = undefined\n resolveRecord(record)\n }\n if (!head) {\n tail = undefined\n }\n }\n\n const commitFullCheckpoint = (record: RevisionRecord) => {\n state.committedSnapshot = record.snapshot\n state.committedRevision = record.revision\n state.failedRevision = undefined\n state.needsFullSnapshot = false\n removePrefixThrough(record)\n drainSucceededPrefix()\n }\n\n const handleLateSettlement = (\n record: RevisionRecord,\n settlement: SetDataAdapterSettlement,\n cause: unknown,\n ) => {\n if (settlement === 'failed') {\n reportFailure('adapter', record, cause)\n return\n }\n if (settlement === 'committed' && state.committedRevision > record.revision) {\n if (head) {\n invalidateLedger()\n }\n armRecovery()\n reportFailure(\n 'out-of-order',\n record,\n `revision ${record.revision} completed after committed revision ${state.committedRevision}`,\n )\n }\n }\n\n const settleRecord = (\n record: RevisionRecord,\n settlement: SetDataAdapterSettlement,\n cause?: unknown,\n ) => {\n if (state.disposed || record.physicalSettled) {\n return\n }\n record.physicalSettled = true\n\n if (!record.inLedger || record.epoch !== epoch) {\n handleLateSettlement(record, settlement, cause)\n return\n }\n\n if (settlement === 'abandoned') {\n record.status = 'abandoned'\n armRecovery()\n invalidateLedger()\n return\n }\n if (settlement === 'failed') {\n failLineage('adapter', record, cause)\n return\n }\n\n record.status = 'succeeded'\n if (highestCompletedRevision > record.revision) {\n failLineage(\n 'out-of-order',\n record,\n `revision ${record.revision} completed after revision ${highestCompletedRevision}`,\n )\n return\n }\n highestCompletedRevision = record.revision\n\n if (record.kind === 'full') {\n commitFullCheckpoint(record)\n return\n }\n drainSucceededPrefix()\n }\n\n const createFullPayload = (snapshot: SetDataSnapshot): SetDataPayload => {\n const payload: SetDataPayload = {}\n const snapshotKeys = new Set(Object.keys(snapshot))\n for (const [key, value] of Object.entries(snapshot)) {\n payload[key] = value === undefined ? null : value\n }\n for (const key of knownHostTopKeys) {\n if (!snapshotKeys.has(key)) {\n payload[key] = null\n }\n }\n return payload\n }\n\n const dispatch = (update: PreparedSetDataUpdate) => {\n if (state.disposed) {\n return state.revision\n }\n\n const revision = state.revision + 1\n state.revision = revision\n state.preparedSnapshot = update.snapshot\n const record: RevisionRecord = {\n revision,\n epoch,\n mode: update.mode,\n kind: update.kind,\n snapshot: update.snapshot,\n payloadKeys: Object.keys(update.payload).length,\n pendingPatchKeys: update.pendingPatchKeys,\n status: 'dispatched',\n physicalSettled: false,\n inLedger: true,\n next: undefined,\n }\n if (tail) {\n tail.next = record\n }\n else {\n head = record\n }\n tail = record\n state.dispatchedSnapshot = update.snapshot\n for (const key of Object.keys(update.payload)) {\n knownHostTopKeys.add(key.split('.', 1)[0]!)\n }\n\n const settle: SetDataAdapterSettler = (settlement, cause) => {\n settleRecord(record, settlement, cause)\n }\n // 宿主会保留对象并在后续路径更新时原地修改,载荷不能与序列化缓存及快照共享引用。\n const hostPayload = cloneSnapshotValue(update.payload)\n if (typeof options.adapter.__wevu_dispatchSetData === 'function') {\n try {\n options.adapter.__wevu_dispatchSetData(hostPayload, settle)\n }\n catch (cause) {\n settle('failed', cause)\n }\n }\n else {\n observeSetDataCompletion({\n invoke: () => options.adapter.setData?.(hostPayload),\n completion: 'return',\n settle,\n })\n }\n return revision\n }\n\n const dispose = () => {\n if (state.disposed) {\n return\n }\n state.disposed = true\n invalidateLedger()\n }\n\n return {\n state,\n dispatch,\n createFullPayload,\n dispose,\n }\n}\n"],"mappings":";;;AAgFA,MAAM,wBAAwB,QAAQ,QAAQ;AAE9C,SAAS,WAAW,OAA+C;CACjE,OAAO,QACL,UACI,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C,OAAQ,MAA+B,SAAS,UACrD;AACF;AAEA,SAAS,yBAAyB,OAAwB;CACxD,IAAI;EACF,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CAC9D,kBACM;EACJ,OAAO;CACT;AACF;AAEA,SAAS,kBACP,MACA,QACA,OACA;CACA,MAAM,eAAe,yBAAyB,KAAK;CAEnD,MAAM,wBAAQ,IAAI,MAChB,iCAFY,SAAS,YAAY,oBAAoB,0BAEd,aAAa,OAAO,SAAS,SAAS,OAAO,KAAK,SAAS,OAAO,KAAK,KAAK,cACrH;CACC,AAAC,MAAsC,QAAQ;CAChD,OAAO;AACT;AAEA,SAAgB,yBAAyB,SAIhC;CACP,IAAI,UAAU;CACd,IAAI,WAAW;CACf,IAAI,iBAAiB;CACrB,IAAI,wBAAwB;CAC5B,MAAM,cAAqC,YAAY,UAAU;EAC/D,IAAI,SACF;EAEF,UAAU;EACV,QAAQ,OAAO,YAAY,KAAK;CAClC;CACA,MAAM,iBAAiB;EACrB,IAAI,UAAU;GACZ,iBAAiB;GACjB;EACF;EACA,IAAI,uBACF;EAEF,IAAI,QAAQ,eAA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B,aAAa,OAAO,KAAK,OAAO,OAAO,CAAC,CAAC;GACzC,kBAAkB,OAAO;GACzB,QAAQ;GACR,iBAAiB;GACjB,UAAU;GACV,MAAM;EACR;EACA,IAAI,MACF,KAAK,OAAO;OAGZ,OAAO;EAET,OAAO;EACP,MAAM,qBAAqB,OAAO;EAClC,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,OAAO,GAC1C,iBAAiB,IAAI,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC,EAAG;EAG5C,MAAM,UAAiC,YAAY,UAAU;GAC3D,aAAa,QAAQ,YAAY,KAAK;EACxC;EAEA,MAAM,cAAc,mBAAmB,OAAO,OAAO;EACrD,IAAI,OAAO,QAAQ,QAAQ,2BAA2B,YACpD,IAAI;GACF,QAAQ,QAAQ,uBAAuB,aAAa,MAAM;EAC5D,SACO,OAAO;GACZ,OAAO,UAAU,KAAK;EACxB;OAGA,yBAAyB;GACvB,cAAc;;gEAAQ,SAAQ,8GAAU,WAAW;;GACnD,YAAY;GACZ;EACF,CAAC;EAEH,OAAO;CACT;CAEA,MAAM,gBAAgB;EACpB,IAAI,MAAM,UACR;EAEF,MAAM,WAAW;EACjB,iBAAiB;CACnB;CAEA,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -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
|
|
7
|
-
const { state, computedRefs, dirtyComputedKeys, includeComputed, computedCompare, computedCompareMaxDepth, computedCompareMaxKeys,
|
|
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
|
-
|
|
14
|
-
|
|
12
|
+
return {
|
|
13
|
+
type: "fallback",
|
|
15
14
|
reason: "maxPatchKeys",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
44
|
-
if (current == null) return current;
|
|
45
|
-
current = current
|
|
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 =
|
|
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
|
-
|
|
101
|
-
|
|
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
|
|
122
|
-
|
|
123
|
-
mode:
|
|
124
|
-
reason:
|
|
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
|
|
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 (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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 {
|
|
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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AAO,EAAE,YAAY,MAAM,CAAC;CAEjF;CAEA,IAAI,OAAO,eAAe,YAAY,YAAY;EAChD,MAAM,SAAS,eAAe,QAAQ,gBAAgB;EACtD,IAAI,UAAU,OAAQ,OAAwB,SAAS,YACrD,OAAQ,OAAyB,YAAY,CAAC,CAAC;CAEnD;CACA,UAAU;EACR,MAAM;EACN,QAAQ;EACR,kBAAkB,aAAa;EAC/B,aAAa,OAAO,KAAK,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AACH"}
|
|
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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AS,GAElC;GAEF,QAAQ,OAAO,sBAAsB,SAAS;GAC9C,gBAAgB,OAAO,mBAAmB,SAAS;EACrD;CACF;CAEA,IAAI,mBAAmB,gBAAgB,OAAO;CAC9C,IAAI,uBAAuB;CAC3B,IAAI,uBAAuB;EACzB,MAAM,eAAe,oBAAoB;GACvC,OAAO;GACP;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;EACD,uBAAuB,aAAa;EACpC,mBAAmB,gBAAgB,aAAa,GAAG;CACrD;CACA,MAAM,YAAY,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
|