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
|
@@ -1,26 +1,86 @@
|
|
|
1
1
|
import { queueJob } from "../scheduler.mjs";
|
|
2
|
-
import _defineProperty from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import _defineProperty from "../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/defineProperty.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/reactivity/core.ts
|
|
5
5
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
6
6
|
let activeEffect = null;
|
|
7
7
|
const effectStack = [];
|
|
8
|
+
let shouldTrack = true;
|
|
9
|
+
let activeEffectScope;
|
|
8
10
|
let batchDepth = 0;
|
|
11
|
+
let isFlushingBatch = false;
|
|
9
12
|
const batchedEffects = /* @__PURE__ */ new Set();
|
|
13
|
+
const batchedCallbacks = /* @__PURE__ */ new Set();
|
|
14
|
+
function runScheduledEffect(ef) {
|
|
15
|
+
if (!ef.active) return;
|
|
16
|
+
if (ef.scheduler) {
|
|
17
|
+
const previousScope = activeEffectScope;
|
|
18
|
+
activeEffectScope = ef._scope;
|
|
19
|
+
try {
|
|
20
|
+
ef.scheduler();
|
|
21
|
+
} finally {
|
|
22
|
+
activeEffectScope = previousScope;
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
ef();
|
|
27
|
+
}
|
|
28
|
+
/** 在当前批次的同步副作用全部完成后执行包内通知。 */
|
|
29
|
+
function queueBatchCallback(callback) {
|
|
30
|
+
if (batchDepth > 0 || isFlushingBatch) {
|
|
31
|
+
batchedCallbacks.add(callback);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
batchedCallbacks.delete(callback);
|
|
35
|
+
callback();
|
|
36
|
+
}
|
|
10
37
|
function startBatch() {
|
|
11
38
|
batchDepth++;
|
|
12
39
|
}
|
|
40
|
+
function takeBatchedEffect(effects) {
|
|
41
|
+
const next = effects.values().next();
|
|
42
|
+
if (next.done) return;
|
|
43
|
+
effects.delete(next.value);
|
|
44
|
+
return next.value;
|
|
45
|
+
}
|
|
13
46
|
function flushBatchedEffects() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
47
|
+
let firstError;
|
|
48
|
+
let hasError = false;
|
|
49
|
+
isFlushingBatch = true;
|
|
50
|
+
try {
|
|
51
|
+
while (batchedEffects.size) {
|
|
52
|
+
const effect = takeBatchedEffect(batchedEffects);
|
|
53
|
+
if (!effect) continue;
|
|
54
|
+
try {
|
|
55
|
+
runScheduledEffect(effect);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (!hasError) {
|
|
58
|
+
firstError = error;
|
|
59
|
+
hasError = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} finally {
|
|
64
|
+
isFlushingBatch = false;
|
|
65
|
+
}
|
|
66
|
+
while (batchedCallbacks.size) {
|
|
67
|
+
const callback = batchedCallbacks.values().next().value;
|
|
68
|
+
batchedCallbacks.delete(callback);
|
|
69
|
+
try {
|
|
70
|
+
callback();
|
|
71
|
+
} catch (error) {
|
|
72
|
+
if (!hasError) {
|
|
73
|
+
firstError = error;
|
|
74
|
+
hasError = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
18
77
|
}
|
|
78
|
+
if (hasError) throw firstError;
|
|
19
79
|
}
|
|
20
80
|
function endBatch() {
|
|
21
81
|
if (batchDepth === 0) return;
|
|
22
82
|
batchDepth--;
|
|
23
|
-
if (batchDepth === 0) flushBatchedEffects();
|
|
83
|
+
if (batchDepth === 0 && !isFlushingBatch) flushBatchedEffects();
|
|
24
84
|
}
|
|
25
85
|
function batch(fn) {
|
|
26
86
|
startBatch();
|
|
@@ -42,7 +102,6 @@ function stop(runner) {
|
|
|
42
102
|
cleanupEffect(runner);
|
|
43
103
|
(_runner$onStop = runner.onStop) === null || _runner$onStop === void 0 || _runner$onStop.call(runner);
|
|
44
104
|
}
|
|
45
|
-
let activeEffectScope;
|
|
46
105
|
var EffectScopeImpl = class {
|
|
47
106
|
constructor(detached = false) {
|
|
48
107
|
this.detached = detached;
|
|
@@ -53,6 +112,10 @@ var EffectScopeImpl = class {
|
|
|
53
112
|
_defineProperty(this, "scopes", void 0);
|
|
54
113
|
if (!detached && activeEffectScope) {
|
|
55
114
|
var _activeEffectScope;
|
|
115
|
+
if (!activeEffectScope.active) {
|
|
116
|
+
this.active = false;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
56
119
|
this.parent = activeEffectScope;
|
|
57
120
|
((_activeEffectScope = activeEffectScope).scopes || (_activeEffectScope.scopes = [])).push(this);
|
|
58
121
|
}
|
|
@@ -68,22 +131,50 @@ var EffectScopeImpl = class {
|
|
|
68
131
|
}
|
|
69
132
|
}
|
|
70
133
|
stop() {
|
|
71
|
-
var _this$parent;
|
|
72
134
|
if (!this.active) return;
|
|
73
135
|
this.active = false;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
136
|
+
const prev = activeEffectScope;
|
|
137
|
+
activeEffectScope = this;
|
|
138
|
+
let firstError;
|
|
139
|
+
let hasError = false;
|
|
140
|
+
const recordError = (error) => {
|
|
141
|
+
if (hasError) return;
|
|
142
|
+
firstError = error;
|
|
143
|
+
hasError = true;
|
|
144
|
+
};
|
|
145
|
+
try {
|
|
146
|
+
const effects = this.effects.splice(0);
|
|
147
|
+
for (const effect of effects) try {
|
|
148
|
+
stop(effect);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
recordError(error);
|
|
151
|
+
}
|
|
152
|
+
const cleanups = this.cleanups.splice(0);
|
|
153
|
+
for (const cleanup of cleanups) try {
|
|
154
|
+
cleanup();
|
|
155
|
+
} catch (error) {
|
|
156
|
+
recordError(error);
|
|
157
|
+
}
|
|
158
|
+
const scopes = this.scopes;
|
|
159
|
+
this.scopes = void 0;
|
|
160
|
+
if (scopes) {
|
|
161
|
+
for (const scope of scopes) try {
|
|
162
|
+
scope.stop();
|
|
163
|
+
} catch (error) {
|
|
164
|
+
recordError(error);
|
|
165
|
+
}
|
|
166
|
+
scopes.length = 0;
|
|
167
|
+
}
|
|
168
|
+
} finally {
|
|
169
|
+
var _this$parent;
|
|
170
|
+
if ((_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.scopes) {
|
|
171
|
+
const index = this.parent.scopes.indexOf(this);
|
|
172
|
+
if (index >= 0) this.parent.scopes.splice(index, 1);
|
|
173
|
+
}
|
|
174
|
+
this.parent = void 0;
|
|
175
|
+
activeEffectScope = prev;
|
|
85
176
|
}
|
|
86
|
-
|
|
177
|
+
if (hasError) throw firstError;
|
|
87
178
|
}
|
|
88
179
|
};
|
|
89
180
|
function effectScope(detached = false) {
|
|
@@ -95,15 +186,37 @@ function getCurrentScope() {
|
|
|
95
186
|
function onScopeDispose(fn) {
|
|
96
187
|
if (activeEffectScope === null || activeEffectScope === void 0 ? void 0 : activeEffectScope.active) activeEffectScope.cleanups.push(fn);
|
|
97
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* 在不把读取记录到当前副作用的情况下执行函数。
|
|
191
|
+
* 函数内部主动运行的新副作用仍会正常收集自己的依赖。
|
|
192
|
+
*/
|
|
193
|
+
function runWithoutTracking(fn) {
|
|
194
|
+
const previousShouldTrack = shouldTrack;
|
|
195
|
+
shouldTrack = false;
|
|
196
|
+
try {
|
|
197
|
+
return fn();
|
|
198
|
+
} finally {
|
|
199
|
+
shouldTrack = previousShouldTrack;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
98
202
|
function recordEffectScope(effect) {
|
|
99
|
-
if (activeEffectScope
|
|
203
|
+
if (!activeEffectScope) return;
|
|
204
|
+
if (activeEffectScope.active) {
|
|
205
|
+
activeEffectScope.effects.push(effect);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
stop(effect);
|
|
100
209
|
}
|
|
101
210
|
function createReactiveEffect(fn, options = {}) {
|
|
102
211
|
const effect = function reactiveEffect() {
|
|
103
212
|
if (!effect.active) return fn();
|
|
104
213
|
if (effect._running) return fn();
|
|
105
214
|
cleanupEffect(effect);
|
|
215
|
+
const previousScope = activeEffectScope;
|
|
216
|
+
activeEffectScope = effect._scope;
|
|
217
|
+
const previousShouldTrack = shouldTrack;
|
|
106
218
|
try {
|
|
219
|
+
shouldTrack = true;
|
|
107
220
|
effect._running = true;
|
|
108
221
|
effectStack.push(effect);
|
|
109
222
|
activeEffect = effect;
|
|
@@ -113,6 +226,8 @@ function createReactiveEffect(fn, options = {}) {
|
|
|
113
226
|
effectStack.pop();
|
|
114
227
|
activeEffect = (_effectStack = effectStack[effectStack.length - 1]) !== null && _effectStack !== void 0 ? _effectStack : null;
|
|
115
228
|
effect._running = false;
|
|
229
|
+
activeEffectScope = previousScope;
|
|
230
|
+
shouldTrack = previousShouldTrack;
|
|
116
231
|
}
|
|
117
232
|
};
|
|
118
233
|
effect.deps = [];
|
|
@@ -121,16 +236,24 @@ function createReactiveEffect(fn, options = {}) {
|
|
|
121
236
|
effect.active = true;
|
|
122
237
|
effect._running = false;
|
|
123
238
|
effect._fn = fn;
|
|
239
|
+
effect._scope = activeEffectScope;
|
|
124
240
|
return effect;
|
|
125
241
|
}
|
|
242
|
+
function createEffect(fn, options, computed) {
|
|
243
|
+
const runner = createReactiveEffect(fn, options);
|
|
244
|
+
runner._computed = computed;
|
|
245
|
+
recordEffectScope(runner);
|
|
246
|
+
if (!options.lazy) runner();
|
|
247
|
+
return runner;
|
|
248
|
+
}
|
|
126
249
|
function effect(fn, options = {}) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return
|
|
250
|
+
return createEffect(fn, options, false);
|
|
251
|
+
}
|
|
252
|
+
function createComputedEffect(fn, options = {}) {
|
|
253
|
+
return createEffect(fn, options, true);
|
|
131
254
|
}
|
|
132
255
|
function track(target, key) {
|
|
133
|
-
if (!activeEffect) return;
|
|
256
|
+
if (!shouldTrack || !activeEffect) return;
|
|
134
257
|
let depsMap = targetMap.get(target);
|
|
135
258
|
if (!depsMap) {
|
|
136
259
|
depsMap = /* @__PURE__ */ new Map();
|
|
@@ -147,15 +270,16 @@ function track(target, key) {
|
|
|
147
270
|
}
|
|
148
271
|
}
|
|
149
272
|
function scheduleEffect(ef) {
|
|
150
|
-
if (ef.
|
|
151
|
-
|
|
273
|
+
if (ef._running) return;
|
|
274
|
+
if (ef._computed) {
|
|
275
|
+
runScheduledEffect(ef);
|
|
152
276
|
return;
|
|
153
277
|
}
|
|
154
|
-
if (batchDepth > 0) {
|
|
278
|
+
if (batchDepth > 0 || isFlushingBatch) {
|
|
155
279
|
batchedEffects.add(ef);
|
|
156
280
|
return;
|
|
157
281
|
}
|
|
158
|
-
ef
|
|
282
|
+
runScheduledEffect(ef);
|
|
159
283
|
}
|
|
160
284
|
function trigger(target, key) {
|
|
161
285
|
const depsMap = targetMap.get(target);
|
|
@@ -169,7 +293,7 @@ function trigger(target, key) {
|
|
|
169
293
|
effectsToRun.forEach(scheduleEffect);
|
|
170
294
|
}
|
|
171
295
|
function trackEffects(dep) {
|
|
172
|
-
if (!activeEffect) return;
|
|
296
|
+
if (!shouldTrack || !activeEffect) return;
|
|
173
297
|
if (!dep.has(activeEffect)) {
|
|
174
298
|
dep.add(activeEffect);
|
|
175
299
|
activeEffect.deps.push(dep);
|
|
@@ -180,5 +304,5 @@ function triggerEffects(dep) {
|
|
|
180
304
|
}
|
|
181
305
|
|
|
182
306
|
//#endregion
|
|
183
|
-
export { batch, createReactiveEffect, effect, effectScope, endBatch, getCurrentScope, onScopeDispose, queueJob, startBatch, stop, track, trackEffects, trigger, triggerEffects };
|
|
307
|
+
export { batch, createComputedEffect, createReactiveEffect, effect, effectScope, endBatch, getCurrentScope, onScopeDispose, queueBatchCallback, queueJob, runWithoutTracking, startBatch, stop, track, trackEffects, trigger, triggerEffects };
|
|
184
308
|
//# sourceMappingURL=core.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.mjs","names":[],"sources":["../../../src/reactivity/core.ts"],"sourcesContent":["import { queueJob } from '../scheduler'\n\nexport type EffectScheduler = () => void\n\nexport type Dep = Set<ReactiveEffect>\n\nexport interface ReactiveEffect<T = any> {\n (): T\n deps: Dep[]\n scheduler?: EffectScheduler\n active: boolean\n _running: boolean\n _fn: () => T\n onStop?: () => void\n}\n\nconst targetMap = new WeakMap<object, Map<PropertyKey, Dep>>()\n\nlet activeEffect: ReactiveEffect | null = null\nconst effectStack: ReactiveEffect[] = []\n\nlet batchDepth = 0\nconst batchedEffects = new Set<ReactiveEffect>()\n\nexport function startBatch() {\n batchDepth++\n}\n\nfunction flushBatchedEffects() {\n while (batchedEffects.size) {\n const effects = [...batchedEffects]\n batchedEffects.clear()\n for (const ef of effects) {\n ef()\n }\n }\n}\n\nexport function endBatch() {\n if (batchDepth === 0) {\n return\n }\n batchDepth--\n if (batchDepth === 0) {\n flushBatchedEffects()\n }\n}\n\nexport function batch<T>(fn: () => T): T {\n startBatch()\n try {\n return fn()\n }\n finally {\n endBatch()\n }\n}\n\nfunction cleanupEffect(effect: ReactiveEffect) {\n const { deps } = effect\n for (let i = 0; i < deps.length; i++) {\n deps[i].delete(effect)\n }\n deps.length = 0\n}\n\nexport function stop(runner: ReactiveEffect) {\n if (!runner.active) {\n return\n }\n runner.active = false\n cleanupEffect(runner)\n runner.onStop?.()\n}\n\nexport interface EffectScope {\n active: boolean\n effects: ReactiveEffect[]\n cleanups: (() => void)[]\n run: <T>(fn: () => T) => T | undefined\n stop: () => void\n}\n\nlet activeEffectScope: EffectScopeImpl | undefined\n\nclass EffectScopeImpl implements EffectScope {\n active = true\n effects: ReactiveEffect[] = []\n cleanups: (() => void)[] = []\n private parent: EffectScopeImpl | undefined\n private scopes: EffectScopeImpl[] | undefined\n\n constructor(private detached = false) {\n if (!detached && activeEffectScope) {\n this.parent = activeEffectScope\n ;(activeEffectScope.scopes ||= []).push(this)\n }\n }\n\n run<T>(fn: () => T): T | undefined {\n if (!this.active) {\n return\n }\n const prev = activeEffectScope\n // eslint-disable-next-line ts/no-this-alias -- 允许 this 临时别名\n activeEffectScope = this\n try {\n return fn()\n }\n finally {\n activeEffectScope = prev\n }\n }\n\n stop(): void {\n if (!this.active) {\n return\n }\n this.active = false\n\n for (const effect of this.effects) {\n stop(effect)\n }\n this.effects.length = 0\n\n for (const cleanup of this.cleanups) {\n cleanup()\n }\n this.cleanups.length = 0\n\n if (this.scopes) {\n for (const scope of this.scopes) {\n scope.stop()\n }\n this.scopes.length = 0\n }\n\n if (this.parent?.scopes) {\n const index = this.parent.scopes.indexOf(this)\n if (index >= 0) {\n this.parent.scopes.splice(index, 1)\n }\n }\n this.parent = undefined\n }\n}\n\nexport function effectScope(detached = false): EffectScope {\n return new EffectScopeImpl(detached)\n}\n\nexport function getCurrentScope(): EffectScope | undefined {\n return activeEffectScope\n}\n\nexport function onScopeDispose(fn: () => void): void {\n if (activeEffectScope?.active) {\n activeEffectScope.cleanups.push(fn)\n }\n}\n\nfunction recordEffectScope(effect: ReactiveEffect) {\n if (activeEffectScope?.active) {\n activeEffectScope.effects.push(effect)\n }\n}\n\nexport interface EffectOptions {\n scheduler?: EffectScheduler\n lazy?: boolean\n onStop?: () => void\n}\n\nexport function createReactiveEffect<T>(fn: () => T, options: EffectOptions = {}): ReactiveEffect<T> {\n const effect = function reactiveEffect() {\n if (!effect.active) {\n return fn()\n }\n if (effect._running) {\n return fn()\n }\n cleanupEffect(effect)\n try {\n effect._running = true\n effectStack.push(effect)\n activeEffect = effect\n return fn()\n }\n finally {\n effectStack.pop()\n activeEffect = effectStack[effectStack.length - 1] ?? null\n effect._running = false\n }\n } as ReactiveEffect<T>\n\n effect.deps = []\n effect.scheduler = options.scheduler\n effect.onStop = options.onStop\n effect.active = true\n effect._running = false\n effect._fn = fn\n\n return effect\n}\n\nexport function effect<T = any>(fn: () => T, options: EffectOptions = {}): ReactiveEffect<T> {\n const _effect = createReactiveEffect(fn, options)\n recordEffectScope(_effect)\n if (!options.lazy) {\n _effect()\n }\n return _effect\n}\n\nexport function track(target: object, key: PropertyKey) {\n if (!activeEffect) {\n return\n }\n let depsMap = targetMap.get(target)\n if (!depsMap) {\n depsMap = new Map()\n targetMap.set(target, depsMap)\n }\n let dep = depsMap.get(key)\n if (!dep) {\n dep = new Set()\n depsMap.set(key, dep)\n }\n if (!dep.has(activeEffect)) {\n dep.add(activeEffect)\n activeEffect.deps.push(dep)\n }\n}\n\nfunction scheduleEffect(ef: ReactiveEffect) {\n if (ef.scheduler) {\n ef.scheduler()\n return\n }\n if (batchDepth > 0) {\n batchedEffects.add(ef)\n return\n }\n ef()\n}\n\nexport function trigger(target: object, key: PropertyKey) {\n const depsMap = targetMap.get(target)\n if (!depsMap) {\n return\n }\n const effects = depsMap.get(key)\n if (!effects) {\n return\n }\n const effectsToRun = new Set<ReactiveEffect>()\n effects.forEach((ef) => {\n if (ef !== activeEffect) {\n effectsToRun.add(ef)\n }\n })\n effectsToRun.forEach(scheduleEffect)\n}\n\nexport function trackEffects(dep: Dep) {\n if (!activeEffect) {\n return\n }\n if (!dep.has(activeEffect)) {\n dep.add(activeEffect)\n activeEffect.deps.push(dep)\n }\n}\n\nexport function triggerEffects(dep: Dep) {\n // 迭代时复制依赖集合,避免遍历过程中被重新加入导致死循环。\n const effectsToRun = new Set(dep)\n effectsToRun.forEach(scheduleEffect)\n}\n\n// 导出队列调度工具,供 watch/watchEffect 等高层 API 复用同一批处理逻辑\nexport { queueJob }\n"],"mappings":";;;;AAgBA,MAAM,4BAAY,IAAI,QAAuC;AAE7D,IAAI,eAAsC;AAC1C,MAAM,cAAgC,CAAC;AAEvC,IAAI,aAAa;AACjB,MAAM,iCAAiB,IAAI,IAAoB;AAE/C,SAAgB,aAAa;CAC3B;AACF;AAEA,SAAS,sBAAsB;CAC7B,OAAO,eAAe,MAAM;EAC1B,MAAM,UAAU,CAAC,GAAG,cAAc;EAClC,eAAe,MAAM;EACrB,KAAK,MAAM,MAAM,SACf,GAAG;CAEP;AACF;AAEA,SAAgB,WAAW;CACzB,IAAI,eAAe,GACjB;CAEF;CACA,IAAI,eAAe,GACjB,oBAAoB;AAExB;AAEA,SAAgB,MAAS,IAAgB;CACvC,WAAW;CACX,IAAI;EACF,OAAO,GAAG;CACZ,UACQ;EACN,SAAS;CACX;AACF;AAEA,SAAS,cAAc,QAAwB;CAC7C,MAAM,EAAE,SAAS;CACjB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAC/B,KAAK,EAAE,CAAC,OAAO,MAAM;CAEvB,KAAK,SAAS;AAChB;AAEA,SAAgB,KAAK,QAAwB;;CAC3C,IAAI,CAAC,OAAO,QACV;CAEF,OAAO,SAAS;CA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B,QAAQ,QAAgB,KAAkB;CACxD,MAAM,UAAU,UAAU,IAAI,MAAM;CACpC,IAAI,CAAC,SACH;CAEF,MAAM,UAAU,QAAQ,IAAI,GAAG;CAC/B,IAAI,CAAC,SACH;CAEF,MAAM,+BAAe,IAAI,IAAoB;CAC7C,QAAQ,SAAS,OAAO;EACtB,IAAI,OAAO,cACT,aAAa,IAAI,EAAE;CAEvB,CAAC;CACD,aAAa,QAAQ,cAAc;AACrC;AAEA,SAAgB,aAAa,KAAU;CACrC,IAAI,CAAC,cACH;CAEF,IAAI,CAAC,IAAI,IAAI,YAAY,GAAG;EAC1B,IAAI,IAAI,YAAY;EACpB,aAAa,KAAK,KAAK,GAAG;CAC5B;AACF;AAEA,SAAgB,eAAe,KAAU;CAGvC,IADyB,IAAI,GAClB,CAAC,CAAC,QAAQ,cAAc;AACrC"}
|
|
1
|
+
{"version":3,"file":"core.mjs","names":[],"sources":["../../../src/reactivity/core.ts"],"sourcesContent":["import { queueJob } from '../scheduler'\n\nexport type EffectScheduler = () => void\n\nexport type Dep = Set<ReactiveEffect>\n\nexport interface ReactiveEffect<T = any> {\n (): T\n deps: Dep[]\n scheduler?: EffectScheduler\n active: boolean\n _running: boolean\n _fn: () => T\n _computed?: boolean\n onStop?: () => void\n}\n\nconst targetMap = new WeakMap<object, Map<PropertyKey, Dep>>()\n\nlet activeEffect: ReactiveEffect | null = null\nconst effectStack: ReactiveEffect[] = []\nlet shouldTrack = true\nlet activeEffectScope: EffectScopeImpl | undefined\n\nlet batchDepth = 0\nlet isFlushingBatch = false\nconst batchedEffects = new Set<ReactiveEffect>()\nconst batchedCallbacks = new Set<() => void>()\n\nfunction runScheduledEffect(ef: ReactiveEffect) {\n if (!ef.active) {\n return\n }\n if (ef.scheduler) {\n const previousScope = activeEffectScope\n activeEffectScope = (ef as ScopedReactiveEffect)._scope\n try {\n ef.scheduler()\n }\n finally {\n activeEffectScope = previousScope\n }\n return\n }\n ef()\n}\n\n/** 在当前批次的同步副作用全部完成后执行包内通知。 */\nexport function queueBatchCallback(callback: () => void) {\n if (batchDepth > 0 || isFlushingBatch) {\n batchedCallbacks.add(callback)\n return\n }\n batchedCallbacks.delete(callback)\n callback()\n}\n\nexport function startBatch() {\n batchDepth++\n}\n\nfunction takeBatchedEffect(effects: Set<ReactiveEffect>): ReactiveEffect | undefined {\n const next = effects.values().next()\n if (next.done) {\n return undefined\n }\n effects.delete(next.value)\n return next.value\n}\n\nfunction flushBatchedEffects() {\n let firstError: unknown\n let hasError = false\n isFlushingBatch = true\n try {\n while (batchedEffects.size) {\n const effect = takeBatchedEffect(batchedEffects)\n if (!effect) {\n continue\n }\n try {\n runScheduledEffect(effect)\n }\n catch (error) {\n if (!hasError) {\n firstError = error\n hasError = true\n }\n }\n }\n }\n finally {\n isFlushingBatch = false\n }\n // 通知属于已完成批次之后的操作,保留订阅回调内同步变更的重入保护。\n while (batchedCallbacks.size) {\n const callback = batchedCallbacks.values().next().value!\n batchedCallbacks.delete(callback)\n try {\n callback()\n }\n catch (error) {\n if (!hasError) {\n firstError = error\n hasError = true\n }\n }\n }\n if (hasError) {\n throw firstError\n }\n}\n\nexport function endBatch() {\n if (batchDepth === 0) {\n return\n }\n batchDepth--\n if (batchDepth === 0 && !isFlushingBatch) {\n flushBatchedEffects()\n }\n}\n\nexport function batch<T>(fn: () => T): T {\n startBatch()\n try {\n return fn()\n }\n finally {\n endBatch()\n }\n}\n\nfunction cleanupEffect(effect: ReactiveEffect) {\n const { deps } = effect\n for (let i = 0; i < deps.length; i++) {\n deps[i].delete(effect)\n }\n deps.length = 0\n}\n\nexport function stop(runner: ReactiveEffect) {\n if (!runner.active) {\n return\n }\n runner.active = false\n cleanupEffect(runner)\n runner.onStop?.()\n}\n\nexport interface EffectScope {\n active: boolean\n effects: ReactiveEffect[]\n cleanups: (() => void)[]\n run: <T>(fn: () => T) => T | undefined\n stop: () => void\n}\n\nclass EffectScopeImpl implements EffectScope {\n active = true\n effects: ReactiveEffect[] = []\n cleanups: (() => void)[] = []\n private parent: EffectScopeImpl | undefined\n private scopes: EffectScopeImpl[] | undefined\n\n constructor(private detached = false) {\n if (!detached && activeEffectScope) {\n if (!activeEffectScope.active) {\n this.active = false\n return\n }\n this.parent = activeEffectScope\n ;(activeEffectScope.scopes ||= []).push(this)\n }\n }\n\n run<T>(fn: () => T): T | undefined {\n if (!this.active) {\n return\n }\n const prev = activeEffectScope\n // eslint-disable-next-line ts/no-this-alias -- 允许 this 临时别名\n activeEffectScope = this\n try {\n return fn()\n }\n finally {\n activeEffectScope = prev\n }\n }\n\n stop(): void {\n if (!this.active) {\n return\n }\n this.active = false\n const prev = activeEffectScope\n // eslint-disable-next-line ts/no-this-alias -- teardown 期间需要把新建 scope 绑定到当前停止中的 scope\n activeEffectScope = this\n\n let firstError: unknown\n let hasError = false\n const recordError = (error: unknown) => {\n if (hasError) {\n return\n }\n firstError = error\n hasError = true\n }\n\n try {\n const effects = this.effects.splice(0)\n for (const effect of effects) {\n try {\n stop(effect)\n }\n catch (error) {\n recordError(error)\n }\n }\n\n const cleanups = this.cleanups.splice(0)\n for (const cleanup of cleanups) {\n try {\n cleanup()\n }\n catch (error) {\n recordError(error)\n }\n }\n\n const scopes = this.scopes\n this.scopes = undefined\n if (scopes) {\n for (const scope of scopes) {\n try {\n scope.stop()\n }\n catch (error) {\n recordError(error)\n }\n }\n scopes.length = 0\n }\n }\n finally {\n if (this.parent?.scopes) {\n const index = this.parent.scopes.indexOf(this)\n if (index >= 0) {\n this.parent.scopes.splice(index, 1)\n }\n }\n this.parent = undefined\n activeEffectScope = prev\n }\n\n if (hasError) {\n throw firstError\n }\n }\n}\n\ninterface ScopedReactiveEffect<T = any> extends ReactiveEffect<T> {\n _scope: EffectScopeImpl | undefined\n}\n\nexport function effectScope(detached = false): EffectScope {\n return new EffectScopeImpl(detached)\n}\n\nexport function getCurrentScope(): EffectScope | undefined {\n return activeEffectScope\n}\n\nexport function onScopeDispose(fn: () => void): void {\n if (activeEffectScope?.active) {\n activeEffectScope.cleanups.push(fn)\n }\n}\n\n/**\n * 在不把读取记录到当前副作用的情况下执行函数。\n * 函数内部主动运行的新副作用仍会正常收集自己的依赖。\n */\nexport function runWithoutTracking<T>(fn: () => T): T {\n const previousShouldTrack = shouldTrack\n shouldTrack = false\n try {\n return fn()\n }\n finally {\n shouldTrack = previousShouldTrack\n }\n}\n\nfunction recordEffectScope(effect: ReactiveEffect) {\n if (!activeEffectScope) {\n return\n }\n if (activeEffectScope.active) {\n activeEffectScope.effects.push(effect)\n return\n }\n stop(effect)\n}\n\nexport interface EffectOptions {\n scheduler?: EffectScheduler\n lazy?: boolean\n onStop?: () => void\n}\n\nexport function createReactiveEffect<T>(fn: () => T, options: EffectOptions = {}): ReactiveEffect<T> {\n const effect = function reactiveEffect() {\n if (!effect.active) {\n return fn()\n }\n if (effect._running) {\n return fn()\n }\n cleanupEffect(effect)\n const previousScope = activeEffectScope\n activeEffectScope = effect._scope\n const previousShouldTrack = shouldTrack\n try {\n shouldTrack = true\n effect._running = true\n effectStack.push(effect)\n activeEffect = effect\n return fn()\n }\n finally {\n effectStack.pop()\n activeEffect = effectStack[effectStack.length - 1] ?? null\n effect._running = false\n activeEffectScope = previousScope\n shouldTrack = previousShouldTrack\n }\n } as ScopedReactiveEffect<T>\n\n effect.deps = []\n effect.scheduler = options.scheduler\n effect.onStop = options.onStop\n effect.active = true\n effect._running = false\n effect._fn = fn\n effect._scope = activeEffectScope\n\n return effect\n}\n\nfunction createEffect<T>(\n fn: () => T,\n options: EffectOptions,\n computed: boolean,\n): ReactiveEffect<T> {\n const runner = createReactiveEffect(fn, options)\n runner._computed = computed\n recordEffectScope(runner)\n if (!options.lazy) {\n runner()\n }\n return runner\n}\n\nexport function effect<T = any>(fn: () => T, options: EffectOptions = {}): ReactiveEffect<T> {\n return createEffect(fn, options, false)\n}\n\nexport function createComputedEffect<T>(\n fn: () => T,\n options: EffectOptions = {},\n): ReactiveEffect<T> {\n return createEffect(fn, options, true)\n}\n\nexport function track(target: object, key: PropertyKey) {\n if (!shouldTrack || !activeEffect) {\n return\n }\n let depsMap = targetMap.get(target)\n if (!depsMap) {\n depsMap = new Map()\n targetMap.set(target, depsMap)\n }\n let dep = depsMap.get(key)\n if (!dep) {\n dep = new Set()\n depsMap.set(key, dep)\n }\n if (!dep.has(activeEffect)) {\n dep.add(activeEffect)\n activeEffect.deps.push(dep)\n }\n}\n\nfunction scheduleEffect(ef: ReactiveEffect) {\n if (ef._running) {\n return\n }\n // 计算属性只同步失效缓存,普通消费者仍由批处理队列合并。\n if (ef._computed) {\n runScheduledEffect(ef)\n return\n }\n if (batchDepth > 0 || isFlushingBatch) {\n batchedEffects.add(ef)\n return\n }\n runScheduledEffect(ef)\n}\n\nexport function trigger(target: object, key: PropertyKey) {\n const depsMap = targetMap.get(target)\n if (!depsMap) {\n return\n }\n const effects = depsMap.get(key)\n if (!effects) {\n return\n }\n const effectsToRun = new Set<ReactiveEffect>()\n effects.forEach((ef) => {\n if (ef !== activeEffect) {\n effectsToRun.add(ef)\n }\n })\n effectsToRun.forEach(scheduleEffect)\n}\n\nexport function trackEffects(dep: Dep) {\n if (!shouldTrack || !activeEffect) {\n return\n }\n if (!dep.has(activeEffect)) {\n dep.add(activeEffect)\n activeEffect.deps.push(dep)\n }\n}\n\nexport function triggerEffects(dep: Dep) {\n // 迭代时复制依赖集合,避免遍历过程中被重新加入导致死循环。\n const effectsToRun = new Set(dep)\n effectsToRun.forEach(scheduleEffect)\n}\n\n// 导出队列调度工具,供 watch/watchEffect 等高层 API 复用同一批处理逻辑\nexport { queueJob }\n"],"mappings":";;;;AAiBA,MAAM,4BAAY,IAAI,QAAuC;AAE7D,IAAI,eAAsC;AAC1C,MAAM,cAAgC,CAAC;AACvC,IAAI,cAAc;AAClB,IAAI;AAEJ,IAAI,aAAa;AACjB,IAAI,kBAAkB;AACtB,MAAM,iCAAiB,IAAI,IAAoB;AAC/C,MAAM,mCAAmB,IAAI,IAAgB;AAE7C,SAAS,mBAAmB,IAAoB;C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AgB,QAAQ,QAAgB,KAAkB;CACxD,MAAM,UAAU,UAAU,IAAI,MAAM;CACpC,IAAI,CAAC,SACH;CAEF,MAAM,UAAU,QAAQ,IAAI,GAAG;CAC/B,IAAI,CAAC,SACH;CAEF,MAAM,+BAAe,IAAI,IAAoB;CAC7C,QAAQ,SAAS,OAAO;EACtB,IAAI,OAAO,cACT,aAAa,IAAI,EAAE;CAEvB,CAAC;CACD,aAAa,QAAQ,cAAc;AACrC;AAEA,SAAgB,aAAa,KAAU;CACrC,IAAI,CAAC,eAAe,CAAC,cACnB;CAEF,IAAI,CAAC,IAAI,IAAI,YAAY,GAAG;EAC1B,IAAI,IAAI,YAAY;EACpB,aAAa,KAAK,KAAK,GAAG;CAC5B;AACF;AAEA,SAAgB,eAAe,KAAU;CAGvC,IADyB,IAAI,GAClB,CAAC,CAAC,QAAQ,cAAc;AACrC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AsyncDerivation, AsyncDerivationContext, AsyncDerivationState, AsyncDerivationStatus, UseAsyncDerivationOptions, useAsyncDerivation } from "./asyncDerivation.mjs";
|
|
2
|
+
import { CustomRefFactory, CustomRefOptions, CustomRefSource, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, customRef, isRef, ref, toValue, unref } from "./ref.mjs";
|
|
3
|
+
import { ComputedGetter, ComputedRef, ComputedSetter, WritableComputedOptions, WritableComputedRef, computed } from "./computed.mjs";
|
|
4
|
+
import { EffectScope, batch, effect, effectScope, endBatch, getCurrentScope, onScopeDispose, startBatch, stop } from "./core.mjs";
|
|
5
|
+
import { MutationKind, MutationOp, MutationRecord, addMutationRecorder, removeMutationRecorder } from "./reactive/mutation.mjs";
|
|
6
|
+
import { PrelinkReactiveTreeOptions, prelinkReactiveTree, touchReactive } from "./reactive/patch.mjs";
|
|
7
|
+
import { isShallowReactive, shallowReactive } from "./reactive/shallow.mjs";
|
|
8
|
+
import { toRaw } from "./reactive/shared.mjs";
|
|
9
|
+
import { getReactiveVersion, isRaw, isReactive, markRaw, reactive } from "./reactive.mjs";
|
|
10
|
+
import { isProxy, isReadonly, readonly, shallowReadonly } from "./readonly.mjs";
|
|
11
|
+
import { isShallowRef, shallowRef, triggerRef } from "./shallowRef.mjs";
|
|
12
|
+
import { ToRefs, toRef, toRefs } from "./toRefs.mjs";
|
|
13
|
+
import { traverse } from "./traverse.mjs";
|
|
14
|
+
import { MapSources, MaybeUndefined, MultiWatchSources, OnCleanup, WatchCallback, WatchEffect, WatchEffectOptions, WatchMultiSources, WatchOptions, WatchScheduler, WatchSource, WatchSourceValue, WatchSources, WatchStopHandle, getDeepWatchStrategy, setDeepWatchStrategy } from "./watch/types.mjs";
|
|
15
|
+
import { watch, watchEffect, watchPostEffect, watchSyncEffect } from "./watch.mjs";
|
|
16
|
+
export { type AsyncDerivation, type AsyncDerivationContext, type AsyncDerivationState, type AsyncDerivationStatus, type ComputedGetter, type ComputedRef, type ComputedSetter, type CustomRefFactory, type CustomRefOptions, type CustomRefSource, type EffectScope, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MaybeUndefined, type MultiWatchSources, type MutationKind, type MutationOp, type MutationRecord, type OnCleanup, type PrelinkReactiveTreeOptions, type Ref, type ShallowRef, type ToRefs, type UseAsyncDerivationOptions, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, type WritableComputedOptions, type WritableComputedRef, addMutationRecorder, batch, computed, customRef, effect, effectScope, endBatch, getCurrentScope, getDeepWatchStrategy, getReactiveVersion, isProxy, isRaw, isReactive, isReadonly, isRef, isShallowReactive, isShallowRef, markRaw, onScopeDispose, prelinkReactiveTree, reactive, readonly, ref, removeMutationRecorder, setDeepWatchStrategy, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, useAsyncDerivation, watch, watchEffect, watchPostEffect, watchSyncEffect };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/reactivity/reactive/mutation.d.ts
|
|
2
|
+
export type MutationOp = 'set' | 'delete';
|
|
3
|
+
export type MutationKind = 'property' | 'array';
|
|
4
|
+
export interface MutationRecord {
|
|
5
|
+
root: object;
|
|
6
|
+
kind: MutationKind;
|
|
7
|
+
op: MutationOp;
|
|
8
|
+
/**
|
|
9
|
+
* 点路径(例如 `a.b.c`);当路径不可靠时为 undefined。
|
|
10
|
+
*/
|
|
11
|
+
path?: string;
|
|
12
|
+
/**
|
|
13
|
+
* 当路径不唯一时回退使用的顶层键列表。
|
|
14
|
+
*/
|
|
15
|
+
fallbackTopKeys?: string[];
|
|
16
|
+
}
|
|
17
|
+
type MutationRecorder = (record: MutationRecord) => void;
|
|
18
|
+
export declare function addMutationRecorder(recorder: MutationRecorder): void;
|
|
19
|
+
export declare function removeMutationRecorder(recorder: MutationRecorder): void;
|
|
20
|
+
//#endregion
|
|
21
|
+
//# sourceMappingURL=mutation.d.mts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/reactivity/reactive/patch.d.ts
|
|
2
|
+
export interface PrelinkReactiveTreeOptions {
|
|
3
|
+
shouldIncludeTopKey?: (key: string) => boolean;
|
|
4
|
+
maxDepth?: number;
|
|
5
|
+
maxKeys?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 预链接响应式树结构,供运行时差量路径追踪使用。
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function prelinkReactiveTree(root: object, options?: PrelinkReactiveTreeOptions): void;
|
|
12
|
+
/**
|
|
13
|
+
* 让 effect 订阅整个对象的“版本号”,无需深度遍历即可对任何字段变化做出响应。
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function touchReactive(target: object): void;
|
|
17
|
+
//#endregion
|
|
18
|
+
//# sourceMappingURL=patch.d.mts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/reactivity/reactive/shallow.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* 创建一个浅层响应式代理:仅跟踪第一层属性变更,不深度递归嵌套对象。
|
|
4
|
+
*
|
|
5
|
+
* @param target 待转换的对象
|
|
6
|
+
* @returns 浅层响应式代理
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const state = shallowReactive({ nested: { count: 0 } })
|
|
11
|
+
*
|
|
12
|
+
* state.nested.count++ // 不会触发 effect(嵌套对象未深度代理)
|
|
13
|
+
* state.nested = { count: 1 } // 会触发 effect(顶层属性变更)
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function shallowReactive<T extends object>(target: T): T;
|
|
17
|
+
/**
|
|
18
|
+
* 判断一个值是否为 shallowReactive 创建的浅层响应式对象
|
|
19
|
+
*/
|
|
20
|
+
export declare function isShallowReactive(value: unknown): boolean;
|
|
21
|
+
//#endregion
|
|
22
|
+
//# sourceMappingURL=shallow.d.mts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MutationKind, MutationOp, MutationRecord, addMutationRecorder, removeMutationRecorder } from "./reactive/mutation.mjs";
|
|
2
|
+
import { PrelinkReactiveTreeOptions, prelinkReactiveTree, touchReactive } from "./reactive/patch.mjs";
|
|
3
|
+
import { isShallowReactive, shallowReactive } from "./reactive/shallow.mjs";
|
|
4
|
+
import { toRaw } from "./reactive/shared.mjs";
|
|
5
|
+
//#region src/reactivity/reactive.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 读取响应式版本号(框架内部调试能力)。
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function getReactiveVersion(target: object): number;
|
|
11
|
+
export declare function reactive<T extends object>(target: T): T;
|
|
12
|
+
export declare function isReactive(value: unknown): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 标记对象为“原始”状态,后续不会被转换为响应式,返回原对象本身。
|
|
15
|
+
*
|
|
16
|
+
* @param value 需要标记的对象
|
|
17
|
+
* @returns 带有跳过标记的原对象
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const foo = markRaw({
|
|
22
|
+
* nested: {}
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* const state = reactive({
|
|
26
|
+
* foo
|
|
27
|
+
* })
|
|
28
|
+
*
|
|
29
|
+
* state.foo // 不是响应式对象
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function markRaw<T extends object>(value: T): T;
|
|
33
|
+
/**
|
|
34
|
+
* 判断某个值是否被标记为原始(即不应转换为响应式)。
|
|
35
|
+
*
|
|
36
|
+
* @param value 待检测的值
|
|
37
|
+
* @returns 若含有跳过标记则返回 true
|
|
38
|
+
*/
|
|
39
|
+
export declare function isRaw(value: unknown): boolean;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { type MutationKind, type MutationOp, type MutationRecord, type PrelinkReactiveTreeOptions, addMutationRecorder, isShallowReactive, prelinkReactiveTree, removeMutationRecorder, shallowReactive, toRaw, touchReactive };
|
|
42
|
+
//# sourceMappingURL=reactive.d.mts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Ref } from "./ref.mjs";
|
|
2
|
+
//#region src/reactivity/readonly.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* readonly 会为对象/数组创建一个“浅层”只读代理,并为 Ref 创建只读包装。
|
|
5
|
+
* 选择浅层而非深层递归,是为了在小程序环境中保持实现和运行时开销最小,
|
|
6
|
+
* 仅阻止直接属性写入/删除,嵌套对象仍按原样透传。
|
|
7
|
+
*/
|
|
8
|
+
export declare function readonly<T extends object>(target: T): Readonly<T>;
|
|
9
|
+
export declare function readonly<T>(target: Ref<T>): Readonly<Ref<T>>;
|
|
10
|
+
/**
|
|
11
|
+
* 与 Vue 3 的 `shallowReadonly()` 对齐。
|
|
12
|
+
*
|
|
13
|
+
* 当前 wevu 的只读语义本身就是浅层只读,因此这里直接复用同一套实现,
|
|
14
|
+
* 让依赖 Vue 兼容 API 的代码可以无缝迁移。
|
|
15
|
+
*/
|
|
16
|
+
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
|
17
|
+
export declare function shallowReadonly<T>(target: Ref<T>): Readonly<Ref<T>>;
|
|
18
|
+
/**
|
|
19
|
+
* 判断值是否为只读代理或只读 ref 包装。
|
|
20
|
+
*/
|
|
21
|
+
export declare function isReadonly(value: unknown): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 判断值是否为响应式代理或只读代理。
|
|
24
|
+
*/
|
|
25
|
+
export declare function isProxy(value: unknown): boolean;
|
|
26
|
+
//#endregion
|
|
27
|
+
//# sourceMappingURL=readonly.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readonly.mjs","names":[],"sources":["../../../src/reactivity/readonly.ts"],"sourcesContent":["import type { Ref } from './ref'\nimport { isObject, isReactive } from './reactive'\nimport { getTargetType, ReactiveFlags, TargetType } from './reactive/shared'\nimport { isRef, markAsRef } from './ref'\n\nfunction createReadonlyWrapper(target: any): any {\n if (isRef(target)) {\n const source = target\n const readonlyRef = markAsRef({\n get value() {\n return source.value\n },\n set value(_v: any) {\n throw new Error('无法给只读 ref 赋值')\n },\n })\n Object.defineProperties(readonlyRef, {\n [ReactiveFlags.IS_READONLY]: {\n value: true,\n configurable: true,\n },\n [ReactiveFlags.RAW]: {\n value: source,\n configurable: true,\n },\n })\n return readonlyRef\n }\n if (!isObject(target)) {\n return target\n }\n if (getTargetType(target as object) === TargetType.INVALID) {\n return target\n }\n return new Proxy(target as object, {\n set() {\n throw new Error('无法在只读对象上设置属性')\n },\n deleteProperty() {\n throw new Error('无法在只读对象上删除属性')\n },\n defineProperty() {\n throw new Error('无法在只读对象上定义属性')\n },\n get(target, key, receiver) {\n if (key === ReactiveFlags.IS_READONLY) {\n return true\n }\n if (key === ReactiveFlags.RAW) {\n return target\n }\n const res = Reflect.get(target, key, receiver)\n // 仅处理顶层属性,嵌套对象维持原引用以避免深拷贝和额外代理\n return res\n },\n })\n}\n\n/**\n * readonly 会为对象/数组创建一个“浅层”只读代理,并为 Ref 创建只读包装。\n * 选择浅层而非深层递归,是为了在小程序环境中保持实现和运行时开销最小,\n * 仅阻止直接属性写入/删除,嵌套对象仍按原样透传。\n */\nexport function readonly<T extends object>(target: T): T
|
|
1
|
+
{"version":3,"file":"readonly.mjs","names":[],"sources":["../../../src/reactivity/readonly.ts"],"sourcesContent":["import type { Ref } from './ref'\nimport { isObject, isReactive } from './reactive'\nimport { getTargetType, ReactiveFlags, TargetType } from './reactive/shared'\nimport { isRef, markAsRef } from './ref'\n\nfunction createReadonlyWrapper(target: any): any {\n if (isRef(target)) {\n const source = target\n const readonlyRef = markAsRef({\n get value() {\n return source.value\n },\n set value(_v: any) {\n throw new Error('无法给只读 ref 赋值')\n },\n })\n Object.defineProperties(readonlyRef, {\n [ReactiveFlags.IS_READONLY]: {\n value: true,\n configurable: true,\n },\n [ReactiveFlags.RAW]: {\n value: source,\n configurable: true,\n },\n })\n return readonlyRef\n }\n if (!isObject(target)) {\n return target\n }\n if (getTargetType(target as object) === TargetType.INVALID) {\n return target\n }\n return new Proxy(target as object, {\n set() {\n throw new Error('无法在只读对象上设置属性')\n },\n deleteProperty() {\n throw new Error('无法在只读对象上删除属性')\n },\n defineProperty() {\n throw new Error('无法在只读对象上定义属性')\n },\n get(target, key, receiver) {\n if (key === ReactiveFlags.IS_READONLY) {\n return true\n }\n if (key === ReactiveFlags.RAW) {\n return target\n }\n const res = Reflect.get(target, key, receiver)\n // 仅处理顶层属性,嵌套对象维持原引用以避免深拷贝和额外代理\n return res\n },\n })\n}\n\n/**\n * readonly 会为对象/数组创建一个“浅层”只读代理,并为 Ref 创建只读包装。\n * 选择浅层而非深层递归,是为了在小程序环境中保持实现和运行时开销最小,\n * 仅阻止直接属性写入/删除,嵌套对象仍按原样透传。\n */\nexport function readonly<T extends object>(target: T): Readonly<T>\nexport function readonly<T>(target: Ref<T>): Readonly<Ref<T>>\nexport function readonly(target: any): any {\n return createReadonlyWrapper(target)\n}\n\n/**\n * 与 Vue 3 的 `shallowReadonly()` 对齐。\n *\n * 当前 wevu 的只读语义本身就是浅层只读,因此这里直接复用同一套实现,\n * 让依赖 Vue 兼容 API 的代码可以无缝迁移。\n */\nexport function shallowReadonly<T extends object>(target: T): Readonly<T>\nexport function shallowReadonly<T>(target: Ref<T>): Readonly<Ref<T>>\nexport function shallowReadonly(target: any): any {\n return createReadonlyWrapper(target)\n}\n\n/**\n * 判断值是否为只读代理或只读 ref 包装。\n */\nexport function isReadonly(value: unknown): boolean {\n return Boolean(value && (value as any)[ReactiveFlags.IS_READONLY])\n}\n\n/**\n * 判断值是否为响应式代理或只读代理。\n */\nexport function isProxy(value: unknown): boolean {\n return isReactive(value) || isReadonly(value)\n}\n"],"mappings":";;;;;AAKA,SAAS,sBAAsB,QAAkB;CAC/C,IAAI,MAAM,MAAM,GAAG;EACjB,MAAM,SAAS;EACf,MAAM,cAAc,UAAU;GAC5B,IAAI,QAAQ;IACV,OAAO,OAAO;GAChB;GACA,IAAI,MAAM,IAAS;IACjB,MAAM,IAAI,MAAM,cAAc;GAChC;EACF,CAAC;EACD,OAAO,iBAAiB,aAAa;uBACN;IAC3B,OAAO;IACP,cAAc;GAChB;gBACqB;IACnB,OAAO;IACP,cAAc;GAChB;EACF,CAAC;EACD,OAAO;CACT;CACA,IAAI,CAAC,SAAS,MAAM,GAClB,OAAO;CAET,IAAI,cAAc,MAAgB,SAChC,OAAO;CAET,OAAO,IAAI,MAAM,QAAkB;EACjC,MAAM;GACJ,MAAM,IAAI,MAAM,cAAc;EAChC;EACA,iBAAiB;GACf,MAAM,IAAI,MAAM,cAAc;EAChC;EACA,iBAAiB;GACf,MAAM,IAAI,MAAM,cAAc;EAChC;EACA,IAAI,QAAQ,KAAK,UAAU;GACzB,IAAI,0BACF,OAAO;GAET,IAAI,mBACF,OAAO;GAIT,OAFY,QAAQ,IAAI,QAAQ,KAAK,QAE5B;EACX;CACF,CAAC;AACH;AASA,SAAgB,SAAS,QAAkB;CACzC,OAAO,sBAAsB,MAAM;AACrC;AAUA,SAAgB,gBAAgB,QAAkB;CAChD,OAAO,sBAAsB,MAAM;AACrC;;;;AAKA,SAAgB,WAAW,OAAyB;CAClD,OAAO,QAAQ,SAAU,uBAAwC;AACnE;;;;AAKA,SAAgB,QAAQ,OAAyB;CAC/C,OAAO,WAAW,KAAK,KAAK,WAAW,KAAK;AAC9C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ComputedRef, WritableComputedRef } from "./computed.mjs";
|
|
2
|
+
import { Ref as Ref$1, ShallowRef as ShallowRef$1 } from "../vue-types.mjs";
|
|
3
|
+
//#region src/reactivity/ref.d.ts
|
|
4
|
+
export type Ref<T = any, S = T> = Ref$1<T, S>;
|
|
5
|
+
export type ShallowRef<T = any> = ShallowRef$1<T>;
|
|
6
|
+
export type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;
|
|
7
|
+
export type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T);
|
|
8
|
+
export declare function isRef(value: unknown): value is Ref<any>;
|
|
9
|
+
export declare function ref<T = any>(): Ref<T | undefined>;
|
|
10
|
+
export declare function ref<T>(value: T): Ref<T>;
|
|
11
|
+
export declare function unref<T>(value: MaybeRef<T> | ComputedRef<T>): T;
|
|
12
|
+
export declare function toValue<T>(source: MaybeRefOrGetter<T>): T;
|
|
13
|
+
/**
|
|
14
|
+
* 自定义 ref 工厂:用于创建可显式控制 track/trigger 的自定义 ref
|
|
15
|
+
*/
|
|
16
|
+
export type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
|
17
|
+
get: () => T;
|
|
18
|
+
set: (value: T) => void;
|
|
19
|
+
};
|
|
20
|
+
export interface CustomRefOptions<T> {
|
|
21
|
+
get: () => T;
|
|
22
|
+
set: (value: T) => void;
|
|
23
|
+
}
|
|
24
|
+
export type CustomRefSource<T> = CustomRefFactory<T> | CustomRefOptions<T>;
|
|
25
|
+
export declare function customRef<T>(factory: CustomRefSource<T>, defaultValue?: T): Ref<T>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//# sourceMappingURL=ref.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _defineProperty from "../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/defineProperty.mjs";
|
|
2
2
|
import { trackEffects, triggerEffects } from "./core.mjs";
|
|
3
3
|
import { convertToReactive, markRaw } from "./reactive.mjs";
|
|
4
4
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ref } from "./ref.mjs";
|
|
2
|
+
//#region src/reactivity/shallowRef.d.ts
|
|
3
|
+
export declare function shallowRef<T>(value: T): Ref<T>;
|
|
4
|
+
export declare function shallowRef<T>(value: T, defaultValue: T): Ref<T>;
|
|
5
|
+
/**
|
|
6
|
+
* 判断传入值是否为浅层 ref。
|
|
7
|
+
*
|
|
8
|
+
* @param r 待判断的值
|
|
9
|
+
* @returns 若为浅层 ref 则返回 true
|
|
10
|
+
*/
|
|
11
|
+
export declare function isShallowRef(r: any): r is Ref<any>;
|
|
12
|
+
/**
|
|
13
|
+
* 主动触发一次浅层 ref 的更新(无需深度比较)。
|
|
14
|
+
*
|
|
15
|
+
* @param ref 需要触发的 ref
|
|
16
|
+
*/
|
|
17
|
+
export declare function triggerRef<T>(ref: Ref<T>): void;
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=shallowRef.d.mts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Ref } from "./ref.mjs";
|
|
2
|
+
//#region src/reactivity/toRefs.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* 为源响应式对象的单个属性创建 ref,可读可写并与原属性保持同步。
|
|
5
|
+
*
|
|
6
|
+
* @param object 源响应式对象
|
|
7
|
+
* @param key 属性名
|
|
8
|
+
* @returns 指向该属性的 ref
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const state = reactive({ foo: 1 })
|
|
13
|
+
* const fooRef = toRef(state, 'foo')
|
|
14
|
+
*
|
|
15
|
+
* fooRef.value++
|
|
16
|
+
* console.log(state.foo) // 2
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
20
|
+
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<T[K]>;
|
|
21
|
+
/**
|
|
22
|
+
* 将一个响应式对象转换成“同结构的普通对象”,其中每个字段都是指向原对象对应属性的 ref。
|
|
23
|
+
*
|
|
24
|
+
* @param object 待转换的响应式对象
|
|
25
|
+
* @returns 包含若干 ref 的普通对象
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const state = reactive({ foo: 1, bar: 2 })
|
|
30
|
+
* const stateAsRefs = toRefs(state)
|
|
31
|
+
*
|
|
32
|
+
* stateAsRefs.foo.value++ // 2
|
|
33
|
+
* state.foo // 2
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
|
37
|
+
/**
|
|
38
|
+
* toRefs 返回值的类型辅助
|
|
39
|
+
*/
|
|
40
|
+
type ToRef<T> = T extends Ref<any> ? T : Ref<T>;
|
|
41
|
+
export type ToRefs<T extends object> = { [K in keyof T]: ToRef<T[K]>; };
|
|
42
|
+
//#endregion
|
|
43
|
+
//# sourceMappingURL=toRefs.d.mts.map
|