wevu 7.0.4 → 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/types.d.mts +172 -0
- package/dist/dev/router/useRoute.d.mts +19 -0
- 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 +1 -1
- 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/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 +47 -9
- package/dist/jsxTypes.d.mts +8 -0
- 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.mjs +1 -1
- package/dist/reactivity/core.d.mts +1 -0
- package/dist/reactivity/core.mjs +1 -1
- package/dist/reactivity/index.d.mts +2 -1
- package/dist/reactivity/readonly.d.mts +1 -1
- package/dist/reactivity/ref.mjs +1 -1
- 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/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.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/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 +5 -13
- package/dist/runtime/define.mjs +1 -1
- package/dist/runtime/diff.mjs +1 -1
- 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/vue.d.mts +1 -2
- 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/jsxIsland.d.mts +2 -6
- package/dist/runtime/layoutBridge.d.mts +5 -9
- package/dist/runtime/pageLayout.d.mts +3 -4
- package/dist/runtime/publicRuntime.d.mts +21 -0
- package/dist/runtime/publicRuntime.mjs +1 -0
- 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/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.mjs +1 -1
- package/dist/runtime/register/snapshot.mjs +1 -1
- package/dist/runtime/scopedSlots.mjs +1 -1
- package/dist/runtime/selectorQuery.mjs +1 -1
- package/dist/runtime/teardown.mjs +1 -0
- package/dist/runtime/templateRefTypes.d.mts +5 -2
- package/dist/runtime/templateRefs.mjs +1 -1
- package/dist/runtime/types/miniprogram.d.mts +3 -0
- package/dist/runtime/types/options.d.mts +2 -2
- package/dist/runtime/types/props.d.mts +1 -1
- package/dist/runtime/types/setData.d.mts +18 -1
- package/dist/runtime/types.d.mts +3 -3
- package/dist/runtime/vueCompat/templateRef.mjs +1 -1
- 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 +10 -8
- package/dist/store/types.d.mts +4 -4
- 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/vue-demi.d.mts +13 -14
- package/dist/vue-demi.mjs +1 -1
- package/dist/weapp/jsx-runtime.d.mts +13 -0
- package/dist/weapp/jsx-runtime.mjs +1 -0
- package/dist/weappIntrinsicElements/base.d.mts +2 -19
- package/dist/weappIntrinsicElements/elements/ad-custom.d.mts +5 -4
- package/dist/weappIntrinsicElements/elements/ad.d.mts +6 -5
- package/dist/weappIntrinsicElements/elements/audio.d.mts +8 -7
- package/dist/weappIntrinsicElements/elements/block.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/button.d.mts +17 -15
- package/dist/weappIntrinsicElements/elements/camera.d.mts +11 -10
- package/dist/weappIntrinsicElements/elements/canvas.d.mts +9 -8
- package/dist/weappIntrinsicElements/elements/checkbox-group.d.mts +5 -7
- package/dist/weappIntrinsicElements/elements/checkbox.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/cover-image.d.mts +8 -4
- package/dist/weappIntrinsicElements/elements/cover-view.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/editor.d.mts +8 -7
- package/dist/weappIntrinsicElements/elements/form.d.mts +6 -5
- package/dist/weappIntrinsicElements/elements/functional-page-navigator.d.mts +8 -7
- package/dist/weappIntrinsicElements/elements/icon.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/image.d.mts +6 -5
- package/dist/weappIntrinsicElements/elements/import.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/include.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/input.d.mts +16 -16
- package/dist/weappIntrinsicElements/elements/keyboard-accessory.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/label.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/live-player.d.mts +17 -16
- package/dist/weappIntrinsicElements/elements/live-pusher.d.mts +18 -17
- package/dist/weappIntrinsicElements/elements/map.d.mts +17 -16
- package/dist/weappIntrinsicElements/elements/match-media.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/movable-area.d.mts +7 -6
- package/dist/weappIntrinsicElements/elements/movable-view.d.mts +7 -6
- package/dist/weappIntrinsicElements/elements/navigation-bar.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/navigator.d.mts +9 -8
- package/dist/weappIntrinsicElements/elements/official-account.d.mts +5 -4
- package/dist/weappIntrinsicElements/elements/open-data.d.mts +4 -3
- package/dist/weappIntrinsicElements/elements/page-container.d.mts +10 -9
- package/dist/weappIntrinsicElements/elements/page-meta.d.mts +6 -5
- package/dist/weappIntrinsicElements/elements/picker-view-column.d.mts +6 -5
- package/dist/weappIntrinsicElements/elements/picker-view.d.mts +6 -5
- package/dist/weappIntrinsicElements/elements/picker.d.mts +8 -7
- package/dist/weappIntrinsicElements/elements/progress.d.mts +4 -3
- package/dist/weappIntrinsicElements/elements/radio-group.d.mts +5 -7
- package/dist/weappIntrinsicElements/elements/radio.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/rich-text.d.mts +5 -5
- package/dist/weappIntrinsicElements/elements/scroll-view.d.mts +19 -23
- package/dist/weappIntrinsicElements/elements/share-element.d.mts +4 -5
- package/dist/weappIntrinsicElements/elements/slider.d.mts +5 -4
- package/dist/weappIntrinsicElements/elements/slot.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/swiper-item.d.mts +5 -36
- package/dist/weappIntrinsicElements/elements/swiper.d.mts +10 -12
- package/dist/weappIntrinsicElements/elements/switch.d.mts +4 -3
- package/dist/weappIntrinsicElements/elements/template.d.mts +2 -2
- package/dist/weappIntrinsicElements/elements/text.d.mts +4 -4
- package/dist/weappIntrinsicElements/elements/textarea.d.mts +15 -14
- package/dist/weappIntrinsicElements/elements/video.d.mts +23 -22
- package/dist/weappIntrinsicElements/elements/view.d.mts +4 -2
- package/dist/weappIntrinsicElements/elements/voip-room.d.mts +6 -5
- package/dist/weappIntrinsicElements/elements/web-view.d.mts +6 -5
- 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 -10
- /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,75 @@
|
|
|
1
|
+
//#region src/runtime/inlineDataset.ts
|
|
2
|
+
const AMP_RE = /&/g;
|
|
3
|
+
const QUOT_RE = /"/g;
|
|
4
|
+
const NUM_QUOT_RE = /"/g;
|
|
5
|
+
const APOS_RE = /'/g;
|
|
6
|
+
const NUM_APOS_RE = /'/g;
|
|
7
|
+
const LT_RE = /</g;
|
|
8
|
+
const GT_RE = />/g;
|
|
9
|
+
const DATASET_ARRAY_INDEX_RE = /^(?:0|[1-9]\d*)$/;
|
|
10
|
+
const NON_ALNUM_RE = /[^a-z0-9]+/gi;
|
|
11
|
+
const LEADING_TRAILING_DASH_RE = /^-+|-+$/g;
|
|
12
|
+
const DASH_ALNUM_RE = /-([a-z0-9])/g;
|
|
13
|
+
const DATASET_KEY_SEPARATOR_RE = /[-_]/g;
|
|
14
|
+
function normalizeDatasetIndex(value) {
|
|
15
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
16
|
+
if (typeof value === "string" && value.trim()) {
|
|
17
|
+
const trimmed = value.trim();
|
|
18
|
+
return DATASET_ARRAY_INDEX_RE.test(trimmed) ? Number(trimmed) : trimmed;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function normalizeEventToken(value) {
|
|
22
|
+
return value.trim().replace(NON_ALNUM_RE, "-").replace(LEADING_TRAILING_DASH_RE, "").toLowerCase();
|
|
23
|
+
}
|
|
24
|
+
function resolveNormalizedDatasetValue(dataset, key) {
|
|
25
|
+
const normalizedKey = key.replace(DATASET_KEY_SEPARATOR_RE, "").toLowerCase();
|
|
26
|
+
for (const [datasetKey, value] of Object.entries(dataset)) if (datasetKey.replace(DATASET_KEY_SEPARATOR_RE, "").toLowerCase() === normalizedKey) return value;
|
|
27
|
+
}
|
|
28
|
+
function resolveEventDatasetKey(baseKey, event) {
|
|
29
|
+
const token = normalizeEventToken(event && typeof event === "object" && "type" in event && typeof event.type === "string" ? event.type : "");
|
|
30
|
+
if (!token) return;
|
|
31
|
+
const camelToken = token.replace(DASH_ALNUM_RE, (_, character) => character.toUpperCase());
|
|
32
|
+
if (!camelToken) return;
|
|
33
|
+
return `${baseKey}${camelToken[0].toUpperCase()}${camelToken.slice(1)}`;
|
|
34
|
+
}
|
|
35
|
+
const DATASET_KEY_ALIASES = {
|
|
36
|
+
wvEventDetail: ["wd", "wvEventDetail"],
|
|
37
|
+
wvHandler: ["wh", "wvHandler"],
|
|
38
|
+
wvInlineId: ["wi", "wvInlineId"]
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 解码 WXML 数据集传递时可能保留的实体。
|
|
42
|
+
*/
|
|
43
|
+
function decodeWxmlEntities(value) {
|
|
44
|
+
return value.replace(AMP_RE, "&").replace(QUOT_RE, "\"").replace(NUM_QUOT_RE, "\"").replace(APOS_RE, "'").replace(NUM_APOS_RE, "'").replace(LT_RE, "<").replace(GT_RE, ">");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 解析模板事件数据集键,兼容平台的大小写和事件后缀归一化。
|
|
48
|
+
*/
|
|
49
|
+
function resolveDatasetEventValue(dataset, baseKey, event) {
|
|
50
|
+
var _DATASET_KEY_ALIASES$;
|
|
51
|
+
const aliasKeys = (_DATASET_KEY_ALIASES$ = DATASET_KEY_ALIASES[baseKey]) !== null && _DATASET_KEY_ALIASES$ !== void 0 ? _DATASET_KEY_ALIASES$ : [baseKey];
|
|
52
|
+
for (const aliasKey of aliasKeys) {
|
|
53
|
+
const specificKey = resolveEventDatasetKey(aliasKey, event);
|
|
54
|
+
if (specificKey && dataset[specificKey] !== void 0) return dataset[specificKey];
|
|
55
|
+
if (specificKey) {
|
|
56
|
+
const normalizedValue = resolveNormalizedDatasetValue(dataset, specificKey);
|
|
57
|
+
if (normalizedValue !== void 0) return normalizedValue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const aliasKey of aliasKeys) {
|
|
61
|
+
if (dataset[aliasKey] !== void 0) return dataset[aliasKey];
|
|
62
|
+
const normalizedValue = resolveNormalizedDatasetValue(dataset, aliasKey);
|
|
63
|
+
if (normalizedValue !== void 0) return normalizedValue;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 将模板循环索引转换为稳定的数字或字符串键。
|
|
68
|
+
*/
|
|
69
|
+
function resolveDatasetIndex(value) {
|
|
70
|
+
return normalizeDatasetIndex(value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
export { decodeWxmlEntities, resolveDatasetEventValue, resolveDatasetIndex };
|
|
75
|
+
//# sourceMappingURL=inlineDataset.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inlineDataset.mjs","names":[],"sources":["../../../src/runtime/inlineDataset.ts"],"sourcesContent":["const AMP_RE = /&/g\nconst QUOT_RE = /"/g\nconst NUM_QUOT_RE = /"/g\nconst APOS_RE = /'/g\nconst NUM_APOS_RE = /'/g\nconst LT_RE = /</g\nconst GT_RE = />/g\n\nconst DATASET_ARRAY_INDEX_RE = /^(?:0|[1-9]\\d*)$/\nconst NON_ALNUM_RE = /[^a-z0-9]+/gi\nconst LEADING_TRAILING_DASH_RE = /^-+|-+$/g\nconst DASH_ALNUM_RE = /-([a-z0-9])/g\nconst DATASET_KEY_SEPARATOR_RE = /[-_]/g\n\nfunction normalizeDatasetIndex(value: unknown): number | string | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value\n }\n if (typeof value === 'string' && value.trim()) {\n const trimmed = value.trim()\n return DATASET_ARRAY_INDEX_RE.test(trimmed) ? Number(trimmed) : trimmed\n }\n return undefined\n}\n\nfunction normalizeEventToken(value: string): string {\n return value\n .trim()\n .replace(NON_ALNUM_RE, '-')\n .replace(LEADING_TRAILING_DASH_RE, '')\n .toLowerCase()\n}\n\nfunction resolveNormalizedDatasetValue(dataset: Record<string, unknown>, key: string): unknown {\n const normalizedKey = key.replace(DATASET_KEY_SEPARATOR_RE, '').toLowerCase()\n for (const [datasetKey, value] of Object.entries(dataset)) {\n if (datasetKey.replace(DATASET_KEY_SEPARATOR_RE, '').toLowerCase() === normalizedKey) {\n return value\n }\n }\n return undefined\n}\n\nfunction resolveEventDatasetKey(baseKey: string, event: unknown): string | undefined {\n const eventType = event && typeof event === 'object' && 'type' in event && typeof event.type === 'string'\n ? event.type\n : ''\n const token = normalizeEventToken(eventType)\n if (!token) {\n return undefined\n }\n const camelToken = token.replace(DASH_ALNUM_RE, (_, character: string) => character.toUpperCase())\n if (!camelToken) {\n return undefined\n }\n return `${baseKey}${camelToken[0].toUpperCase()}${camelToken.slice(1)}`\n}\n\nconst DATASET_KEY_ALIASES: Record<string, string[]> = {\n wvEventDetail: ['wd', 'wvEventDetail'],\n wvHandler: ['wh', 'wvHandler'],\n wvInlineId: ['wi', 'wvInlineId'],\n}\n\n/**\n * 解码 WXML 数据集传递时可能保留的实体。\n */\nexport function decodeWxmlEntities(value: string): string {\n return value\n .replace(AMP_RE, '&')\n .replace(QUOT_RE, '\"')\n .replace(NUM_QUOT_RE, '\"')\n .replace(APOS_RE, '\\'')\n .replace(NUM_APOS_RE, '\\'')\n .replace(LT_RE, '<')\n .replace(GT_RE, '>')\n}\n\n/**\n * 解析模板事件数据集键,兼容平台的大小写和事件后缀归一化。\n */\nexport function resolveDatasetEventValue(\n dataset: Record<string, unknown>,\n baseKey: string,\n event: unknown,\n): unknown {\n const aliasKeys = DATASET_KEY_ALIASES[baseKey] ?? [baseKey]\n for (const aliasKey of aliasKeys) {\n const specificKey = resolveEventDatasetKey(aliasKey, event)\n if (specificKey && dataset[specificKey] !== undefined) {\n return dataset[specificKey]\n }\n if (specificKey) {\n const normalizedValue = resolveNormalizedDatasetValue(dataset, specificKey)\n if (normalizedValue !== undefined) {\n return normalizedValue\n }\n }\n }\n for (const aliasKey of aliasKeys) {\n if (dataset[aliasKey] !== undefined) {\n return dataset[aliasKey]\n }\n const normalizedValue = resolveNormalizedDatasetValue(dataset, aliasKey)\n if (normalizedValue !== undefined) {\n return normalizedValue\n }\n }\n return undefined\n}\n\n/**\n * 将模板循环索引转换为稳定的数字或字符串键。\n */\nexport function resolveDatasetIndex(value: unknown): number | string | undefined {\n return normalizeDataset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eAAe,CAAC,MAAM,eAAe;CACrC,WAAW,CAAC,MAAM,WAAW;CAC7B,YAAY,CAAC,MAAM,YAAY;AACjC;;;;AAKA,SAAgB,mBAAmB,OAAuB;CACxD,OAAO,MACJ,QAAQ,QAAQ,GAAG,CAAC,CACpB,QAAQ,SAAS,IAAG,CAAC,CACrB,QAAQ,aAAa,IAAG,CAAC,CACzB,QAAQ,SAAS,GAAI,CAAC,CACtB,QAAQ,aAAa,GAAI,CAAC,CAC1B,QAAQ,OAAO,GAAG,CAAC,CACnB,QAAQ,OAAO,GAAG;AACvB;;;;AAKA,SAAgB,yBACd,SACA,SACA,OACS;;CACT,MAAM,qCAAY,oBAAoB,iFAAY,CAAC,OAAO;CAC1D,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,cAAc,uBAAuB,UAAU,KAAK;EAC1D,IAAI,eAAe,QAAQ,iBAAiB,QAC1C,OAAO,QAAQ;EAEjB,IAAI,aAAa;GACf,MAAM,kBAAkB,8BAA8B,SAAS,WAAW;GAC1E,IAAI,oBAAoB,QACtB,OAAO;EAEX;CACF;CACA,KAAK,MAAM,YAAY,WAAW;EAChC,IAAI,QAAQ,cAAc,QACxB,OAAO,QAAQ;EAEjB,MAAM,kBAAkB,8BAA8B,SAAS,QAAQ;EACvE,IAAI,oBAAoB,QACtB,OAAO;CAEX;AAEF;;;;AAKA,SAAgB,oBAAoB,OAA6C;CAC/E,OAAO,sBAAsB,KAAK;AACpC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HostMiniProgramIntersectionObserver, HostMiniProgramIntersectionObserverOptions } from "./types/miniprogramHost.mjs";
|
|
2
|
+
import "./types.mjs";
|
|
3
|
+
//#region src/runtime/intersectionObserver.d.ts
|
|
4
|
+
export type UseIntersectionObserverOptions = HostMiniProgramIntersectionObserverOptions;
|
|
5
|
+
export type UseIntersectionObserverResult = HostMiniProgramIntersectionObserver;
|
|
6
|
+
/**
|
|
7
|
+
* 在 setup 中创建 IntersectionObserver,并在卸载时自动断开。
|
|
8
|
+
*
|
|
9
|
+
* - 优先使用 `ctx.instance.createIntersectionObserver(options)`。
|
|
10
|
+
* - 不可用时回退到宿主全局对象的 `createIntersectionObserver(...)`。
|
|
11
|
+
*/
|
|
12
|
+
export declare function useIntersectionObserver(options?: UseIntersectionObserverOptions): UseIntersectionObserverResult;
|
|
13
|
+
//#endregion
|
|
14
|
+
//# sourceMappingURL=intersectionObserver.d.mts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { WevuJsxVNode } from "../jsxTypes.mjs";
|
|
2
|
+
//#region src/runtime/jsxIsland.d.ts
|
|
3
|
+
export declare const Fragment: unique symbol;
|
|
4
|
+
export interface WevuJsxIslandNode {
|
|
5
|
+
children?: WevuJsxIslandNode[];
|
|
6
|
+
events?: Record<string, string>;
|
|
7
|
+
kind: 'element' | 'fragment' | 'text';
|
|
8
|
+
props?: Record<string, any>;
|
|
9
|
+
tag?: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WevuJsxIslandAdapters {
|
|
13
|
+
normalizeClass: (value: unknown) => string;
|
|
14
|
+
normalizeStyle: (value: unknown) => string;
|
|
15
|
+
}
|
|
16
|
+
export declare function createVNode(type: unknown, props?: Record<string, any> | null, children?: unknown): WevuJsxVNode;
|
|
17
|
+
export declare function createTextVNode(text: unknown): WevuJsxVNode;
|
|
18
|
+
export declare function isVNode(value: unknown): value is WevuJsxVNode;
|
|
19
|
+
export declare function mergeProps(...sources: Array<Record<string, any> | null | undefined>): Record<string, any>;
|
|
20
|
+
export declare function transformOn(events: Record<string, unknown>): Record<string, unknown>;
|
|
21
|
+
export declare function resolveComponent(name: string): string;
|
|
22
|
+
export declare const vShow = "show";
|
|
23
|
+
export declare const vModelText = "model-text";
|
|
24
|
+
export declare const vModelCheckbox = "model-checkbox";
|
|
25
|
+
export declare const vModelRadio = "model-radio";
|
|
26
|
+
export declare const vModelSelect = "model-select";
|
|
27
|
+
export declare function withDirectives(vnode: WevuJsxVNode, directives: unknown[]): {
|
|
28
|
+
props: {
|
|
29
|
+
[x: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
children?: unknown;
|
|
32
|
+
type: unknown;
|
|
33
|
+
};
|
|
34
|
+
export declare function resolveDirective(name: string): string;
|
|
35
|
+
export declare function normalizeJsxIsland(this: any, value: unknown, islandId: string, adapters: WevuJsxIslandAdapters): WevuJsxIslandNode | null;
|
|
36
|
+
//#endregion
|
|
37
|
+
//# sourceMappingURL=jsxIsland.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsxIsland.mjs","names":["slots"],"sources":["../../../src/runtime/jsxIsland.ts"],"sourcesContent":["import { WEVU_JSX_ISLAND_HANDLER_MAP_KEY } from '@weapp-core/constants'\n\nexport const Fragment = Symbol.for('wevu.jsx.fragment')\n\nexport interface WevuJsxVNode {\n children?: unknown\n props?: Record<string, any> | null\n type: unknown\n}\n\nexport interface WevuJsxIslandNode {\n children?: WevuJsxIslandNode[]\n events?: Record<string, string>\n kind: 'element' | 'fragment' | 'text'\n props?: Record<string, any>\n tag?: string\n text?: string\n}\n\nexport interface WevuJsxIslandAdapters {\n normalizeClass: (value: unknown) => string\n normalizeStyle: (value: unknown) => string\n}\n\nexport function createVNode(type: unknown, props?: Record<string, any> | null, children?: unknown): WevuJsxVNode {\n return { type, props, children }\n}\n\nexport function createTextVNode(text: unknown): WevuJsxVNode {\n return { type: 'text', props: null, children: String(text ?? '') }\n}\n\nexport function isVNode(value: unknown): value is WevuJsxVNode {\n return !!value && typeof value === 'object' && 'type' in value\n}\n\nexport function mergeProps(...sources: Array<Record<string, any> | null | undefined>) {\n const output: Record<string, any> = {}\n for (const source of sources) {\n if (!source) {\n continue\n }\n for (const [key, value] of Object.entries(source)) {\n if (key === 'class' && output.class) {\n output.class = [output.class, value]\n }\n else if (key === 'style' && output.style) {\n output.style = [output.style, value]\n }\n else {\n output[key] = value\n }\n }\n }\n return output\n}\n\nexport function transformOn(events: Record<string, unknown>) {\n const output: Record<string, unknown> = {}\n for (const [name, handler] of Object.entries(events)) {\n output[`on${name.charAt(0).toUpperCase()}${name.slice(1)}`] = handler\n }\n return output\n}\n\nexport function resolveComponent(name: string) {\n return name\n}\n\nexport const vShow = 'show'\nexport const vModelText = 'model-text'\nexport const vModelCheckbox = 'model-checkbox'\nexport const vModelRadio = 'model-radio'\nexport const vModelSelect = 'model-select'\n\nexport function withDirectives(vnode: WevuJsxVNode, directives: unknown[]) {\n const props = { ...(vnode.props ?? {}) }\n for (const raw of directives) {\n if (!Array.isArray(raw)) {\n continue\n }\n const [directive, value, argument] = raw\n if (directive === vShow) {\n props.hidden = !value\n continue\n }\n if (\n directive === vModelText\n || directive === vModelCheckbox\n || directive === vModelRadio\n || directive === vModelSelect\n ) {\n const modelName = typeof argument === 'string' && argument ? argument : 'modelValue'\n const updater = props[`onUpdate:${modelName}`]\n props[modelName === 'modelValue' ? 'value' : modelName] = value\n if (typeof updater === 'function') {\n const eventName = directive === vModelText ? 'onInput' : 'onChange'\n props[eventName] = (event: any) => updater(event?.detail?.value ?? event?.detail)\n }\n }\n }\n return { ...vnode, props }\n}\n\nexport function resolveDirective(name: string) {\n return name\n}\n\nfunction eventNameFromProp(name: string) {\n if (!/^on[A-Z]/.test(name)) {\n return undefined\n }\n return name.slice(2).toLowerCase()\n}\n\nfunction getHandlerMap(target: any): Record<string, (...args: any[]) => any> {\n const existing = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n const next: Record<string, (...args: any[]) => any> = Object.create(null)\n if (target && (typeof target === 'object' || typeof target === 'function')) {\n Object.defineProperty(target, WEVU_JSX_ISLAND_HANDLER_MAP_KEY, {\n value: next,\n configurable: true,\n writable: true,\n })\n }\n return next\n}\n\nfunction normalizeChildren(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode[] {\n const resolved = typeof value === 'function' ? value() : value\n if (resolved == null || resolved === false || resolved === true) {\n return []\n }\n if (Array.isArray(resolved)) {\n const children: WevuJsxIslandNode[] = []\n for (const item of resolved) {\n children.push(...normalizeChildren(item, target, islandId, seed, adapters))\n }\n return children\n }\n if (typeof resolved === 'object' && !isVNode(resolved)) {\n const slots = resolved as Record<string, unknown>\n return normalizeChildren(slots.default, target, islandId, seed, adapters)\n }\n // eslint-disable-next-line ts/no-use-before-define\n const node = normalizeNode(resolved, target, islandId, seed, adapters)\n return node ? [node] : []\n}\n\nfunction normalizeNode(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | undefined {\n if (value == null || value === false || value === true) {\n return undefined\n }\n if (Array.isArray(value)) {\n return { kind: 'fragment', children: normalizeChildren(value, target, islandId, seed, adapters) }\n }\n if (typeof value === 'string' || typeof value === 'number') {\n return { kind: 'text', text: String(value) }\n }\n if (!isVNode(value)) {\n return { kind: 'text', text: String(value) }\n }\n if (value.type === Fragment) {\n return { kind: 'fragment', children: normalizeChildren(value.children, target, islandId, seed, adapters) }\n }\n if (value.type === 'text') {\n return { kind: 'text', text: String(value.children ?? '') }\n }\n if (typeof value.type === 'function') {\n return normalizeNode(value.type(value.props ?? {}, value.children), target, islandId, seed, adapters)\n }\n if (value.type && typeof value.type === 'object' && typeof (value.type as any).render === 'function') {\n return normalizeNode((value.type as any).render.call(value.props ?? {}), target, islandId, seed, adapters)\n }\n const tag = typeof value.type === 'string' ? value.type : undefined\n if (!tag) {\n return undefined\n }\n\n const props: Record<string, any> = {}\n const events: Record<string, string> = {}\n const handlers = getHandlerMap(target)\n for (const [name, raw] of Object.entries(value.props ?? {})) {\n const eventName = eventNameFromProp(name)\n if (eventName && typeof raw === 'function') {\n const handlerId = `${islandId}:${seed.value++}`\n handlers[handlerId] = raw\n events[eventName] = handlerId\n continue\n }\n if (typeof raw === 'function' || raw === undefined) {\n continue\n }\n if (name === 'class' || name === 'className') {\n props.class = adapters.normalizeClass(raw)\n }\n else if (name === 'style') {\n props.style = adapters.normalizeStyle(raw)\n }\n else {\n props[name] = raw\n }\n }\n return {\n kind: 'element',\n tag,\n props,\n events,\n children: normalizeChildren(value.children, target, islandId, seed, adapters),\n }\n}\n\nexport function normalizeJsxIsland(\n this: any,\n value: unknown,\n islandId: string,\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | null {\n const handlers = getHandlerMap(this)\n for (const key of Object.keys(handlers)) {\n if (key.startsWith(`${islandId}:`)) {\n delete handlers[key]\n }\n }\n return normalizeNode(value, this, islandId, { value: 0 }, adapters) ?? null\n}\n\nexport function runJsxIslandHandler(target: any, event: any) {\n const handlerId = event?.currentTarget?.dataset?.wvJsxHandler ?? event?.target?.dataset?.wvJsxHandler\n if (typeof handlerId !== 'string' || !handlerId) {\n return undefined\n }\n const runtime = target?.__wevu\n const handlers = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n ?? runtime?.proxy?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n const handler = handlers?.[handlerId]\n return typeof handler === 'function' ? handler.call(runtime?.proxy ?? target, event) : undefined\n}\n"],"mappings":";;;AAEA,MAAa,WAAW,OAAO,IAAI,mBAAmB;AAsBtD,SAAgB,YAAY,MAAe,OAAoC,UAAkC;CAC/G,OAAO;EAAE;EAAM;EAAO;CAAS;AACjC;AAEA,SAAgB,gBAAgB,MAA6B;CAC3D,OAAO;EAAE,MAAM;EAAQ,OAAO;EAAM,UAAU,OAAO,0CAAQ,EAAE;CAAE;AACnE;AAEA,SAAgB,QAAQ,OAAuC;CAC7D,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,UAAU;AAC3D;AAEA,SAAgB,WAAW,GAAG,SAAwD;CACpF,MAAM,SAA8B,CAAC;CACrC,KAAK,MAAM,UAAU,SAAS;EAC5B,IAAI,CAAC,QACH;EAEF,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC9C,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ACL,MAAM;EACN;EACA;EACA;EACA,UAAU,kBAAkB,MAAM,UAAU,QAAQ,UAAU,MAAM,QAAQ;CAC9E;AACF;AAEA,SAAgB,mBAEd,OACA,UACA,UAC0B;;CAC1B,MAAM,WAAW,cAAc,IAAI;CACnC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GACpC,IAAI,IAAI,WAAW,GAAG,SAAS,EAAE,GAC/B,OAAO,SAAS;CAGpB,yBAAO,cAAc,OAAO,MAAM,UAAU,EAAE,OAAO,EAAE,GAAG,QAAQ,4DAAK;AACzE;AAEA,SAAgB,oBAAoB,QAAa,OAAY;;CAC3D,MAAM,mGAAY,MAAO,2GAAe,qFAAS,4IAAgB,MAAO,+EAAQ,uEAAS;CACzF,IAAI,OAAO,cAAc,YAAY,CAAC,WACpC;CAEF,MAAM,0DAAU,OAAQ;CACxB,MAAM,oFAAW,OAAS,qKACrB,QAAS,uEAAQ;CACtB,MAAM,8DAAU,SAAW;CAC3B,OAAO,OAAO,YAAY,aAAa,QAAQ,0EAAK,QAAS,kEAAS,QAAQ,KAAK,IAAI;AACzF"}
|
|
1
|
+
{"version":3,"file":"jsxIsland.mjs","names":["slots"],"sources":["../../../src/runtime/jsxIsland.ts"],"sourcesContent":["import type { WevuJsxVNode } from '../jsxTypes'\nimport { WEVU_JSX_ISLAND_HANDLER_MAP_KEY } from '@weapp-core/constants'\n\nexport const Fragment = Symbol.for('wevu.jsx.fragment')\n\nexport interface WevuJsxIslandNode {\n children?: WevuJsxIslandNode[]\n events?: Record<string, string>\n kind: 'element' | 'fragment' | 'text'\n props?: Record<string, any>\n tag?: string\n text?: string\n}\n\nexport interface WevuJsxIslandAdapters {\n normalizeClass: (value: unknown) => string\n normalizeStyle: (value: unknown) => string\n}\n\nexport function createVNode(type: unknown, props?: Record<string, any> | null, children?: unknown): WevuJsxVNode {\n return { type, props, children }\n}\n\nexport function createTextVNode(text: unknown): WevuJsxVNode {\n return { type: 'text', props: null, children: String(text ?? '') }\n}\n\nexport function isVNode(value: unknown): value is WevuJsxVNode {\n return !!value && typeof value === 'object' && 'type' in value\n}\n\nexport function mergeProps(...sources: Array<Record<string, any> | null | undefined>) {\n const output: Record<string, any> = {}\n for (const source of sources) {\n if (!source) {\n continue\n }\n for (const [key, value] of Object.entries(source)) {\n if (key === 'class' && output.class) {\n output.class = [output.class, value]\n }\n else if (key === 'style' && output.style) {\n output.style = [output.style, value]\n }\n else {\n output[key] = value\n }\n }\n }\n return output\n}\n\nexport function transformOn(events: Record<string, unknown>) {\n const output: Record<string, unknown> = {}\n for (const [name, handler] of Object.entries(events)) {\n output[`on${name.charAt(0).toUpperCase()}${name.slice(1)}`] = handler\n }\n return output\n}\n\nexport function resolveComponent(name: string) {\n return name\n}\n\nexport const vShow = 'show'\nexport const vModelText = 'model-text'\nexport const vModelCheckbox = 'model-checkbox'\nexport const vModelRadio = 'model-radio'\nexport const vModelSelect = 'model-select'\n\nexport function withDirectives(vnode: WevuJsxVNode, directives: unknown[]) {\n const props = { ...(vnode.props ?? {}) }\n for (const raw of directives) {\n if (!Array.isArray(raw)) {\n continue\n }\n const [directive, value, argument] = raw\n if (directive === vShow) {\n props.hidden = !value\n continue\n }\n if (\n directive === vModelText\n || directive === vModelCheckbox\n || directive === vModelRadio\n || directive === vModelSelect\n ) {\n const modelName = typeof argument === 'string' && argument ? argument : 'modelValue'\n const updater = props[`onUpdate:${modelName}`]\n props[modelName === 'modelValue' ? 'value' : modelName] = value\n if (typeof updater === 'function') {\n const eventName = directive === vModelText ? 'onInput' : 'onChange'\n props[eventName] = (event: any) => updater(event?.detail?.value ?? event?.detail)\n }\n }\n }\n return { ...vnode, props }\n}\n\nexport function resolveDirective(name: string) {\n return name\n}\n\nfunction eventNameFromProp(name: string) {\n if (!/^on[A-Z]/.test(name)) {\n return undefined\n }\n return name.slice(2).toLowerCase()\n}\n\nfunction getHandlerMap(target: any): Record<string, (...args: any[]) => any> {\n const existing = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n const next: Record<string, (...args: any[]) => any> = Object.create(null)\n if (target && (typeof target === 'object' || typeof target === 'function')) {\n Object.defineProperty(target, WEVU_JSX_ISLAND_HANDLER_MAP_KEY, {\n value: next,\n configurable: true,\n writable: true,\n })\n }\n return next\n}\n\nfunction normalizeChildren(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode[] {\n const resolved = typeof value === 'function' ? value() : value\n if (resolved == null || resolved === false || resolved === true) {\n return []\n }\n if (Array.isArray(resolved)) {\n const children: WevuJsxIslandNode[] = []\n for (const item of resolved) {\n children.push(...normalizeChildren(item, target, islandId, seed, adapters))\n }\n return children\n }\n if (typeof resolved === 'object' && !isVNode(resolved)) {\n const slots = resolved as Record<string, unknown>\n return normalizeChildren(slots.default, target, islandId, seed, adapters)\n }\n // eslint-disable-next-line ts/no-use-before-define\n const node = normalizeNode(resolved, target, islandId, seed, adapters)\n return node ? [node] : []\n}\n\nfunction normalizeNode(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | undefined {\n if (value == null || value === false || value === true) {\n return undefined\n }\n if (Array.isArray(value)) {\n return { kind: 'fragment', children: normalizeChildren(value, target, islandId, seed, adapters) }\n }\n if (typeof value === 'string' || typeof value === 'number') {\n return { kind: 'text', text: String(value) }\n }\n if (!isVNode(value)) {\n return { kind: 'text', text: String(value) }\n }\n if (value.type === Fragment) {\n return { kind: 'fragment', children: normalizeChildren(value.children, target, islandId, seed, adapters) }\n }\n if (value.type === 'text') {\n return { kind: 'text', text: String(value.children ?? '') }\n }\n if (typeof value.type === 'function') {\n return normalizeNode(value.type(value.props ?? {}, value.children), target, islandId, seed, adapters)\n }\n if (value.type && typeof value.type === 'object' && typeof (value.type as any).render === 'function') {\n return normalizeNode((value.type as any).render.call(value.props ?? {}), target, islandId, seed, adapters)\n }\n const tag = typeof value.type === 'string' ? value.type : undefined\n if (!tag) {\n return undefined\n }\n\n const props: Record<string, any> = {}\n const events: Record<string, string> = {}\n const handlers = getHandlerMap(target)\n for (const [name, raw] of Object.entries(value.props ?? {})) {\n const eventName = eventNameFromProp(name)\n if (eventName && typeof raw === 'function') {\n const handlerId = `${islandId}:${seed.value++}`\n handlers[handlerId] = raw as unknown as (...args: unknown[]) => unknown\n events[eventName] = handlerId\n continue\n }\n if (typeof raw === 'function' || raw === undefined) {\n continue\n }\n if (name === 'class' || name === 'className') {\n props.class = adapters.normalizeClass(raw)\n }\n else if (name === 'style') {\n props.style = adapters.normalizeStyle(raw)\n }\n else {\n props[name] = raw\n }\n }\n return {\n kind: 'element',\n tag,\n props,\n events,\n children: normalizeChildren(value.children, target, islandId, seed, adapters),\n }\n}\n\nexport function normalizeJsxIsland(\n this: any,\n value: unknown,\n islandId: string,\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | null {\n const handlers = getHandlerMap(this)\n for (const key of Object.keys(handlers)) {\n if (key.startsWith(`${islandId}:`)) {\n delete handlers[key]\n }\n }\n return normalizeNode(value, this, islandId, { value: 0 }, adapters) ?? null\n}\n\nexport function runJsxIslandHandler(target: any, event: any) {\n const handlerId = event?.currentTarget?.dataset?.wvJsxHandler ?? event?.target?.dataset?.wvJsxHandler\n if (typeof handlerId !== 'string' || !handlerId) {\n return undefined\n }\n const runtime = target?.__wevu\n const handlers = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n ?? runtime?.proxy?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n const handler = handlers?.[handlerId]\n return typeof handler === 'function' ? handler.call(runtime?.proxy ?? target, event) : undefined\n}\n"],"mappings":";;;AAGA,MAAa,WAAW,OAAO,IAAI,mBAAmB;AAgBtD,SAAgB,YAAY,MAAe,OAAoC,UAAkC;CAC/G,OAAO;EAAE;EAAM;EAAO;CAAS;AACjC;AAEA,SAAgB,gBAAgB,MAA6B;CAC3D,OAAO;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EACxC,IAAI,aAAa,OAAO,QAAQ,YAAY;GAC1C,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK;GACtC,SAAS,aAAa;GACtB,OAAO,aAAa;GACpB;EACF;EACA,IAAI,OAAO,QAAQ,cAAc,QAAQ,QACvC;EAEF,IAAI,SAAS,WAAW,SAAS,aAC/B,MAAM,QAAQ,SAAS,eAAe,GAAG;OAEtC,IAAI,SAAS,SAChB,MAAM,QAAQ,SAAS,eAAe,GAAG;OAGzC,MAAM,QAAQ;CAElB;CACA,OAAO;EACL,MAAM;EACN;EACA;EACA;EACA,UAAU,kBAAkB,MAAM,UAAU,QAAQ,UAAU,MAAM,QAAQ;CAC9E;AACF;AAEA,SAAgB,mBAEd,OACA,UACA,UAC0B;;CAC1B,MAAM,WAAW,cAAc,IAAI;CACnC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GACpC,IAAI,IAAI,WAAW,GAAG,SAAS,EAAE,GAC/B,OAAO,SAAS;CAGpB,yBAAO,cAAc,OAAO,MAAM,UAAU,EAAE,OAAO,EAAE,GAAG,QAAQ,4DAAK;AACzE;AAEA,SAAgB,oBAAoB,QAAa,OAAY;;CAC3D,MAAM,mGAAY,MAAO,2GAAe,qFAAS,4IAAgB,MAAO,+EAAQ,uEAAS;CACzF,IAAI,OAAO,cAAc,YAAY,CAAC,WACpC;CAEF,MAAM,0DAAU,OAAQ;CACxB,MAAM,oFAAW,OAAS,qKACrB,QAAS,uEAAQ;CACtB,MAAM,8DAAU,SAAW;CAC3B,OAAO,OAAO,YAAY,aAAa,QAAQ,0EAAK,QAAS,kEAAS,QAAQ,KAAK,IAAI;AACzF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { LayoutHostBinding } from "./capabilities.mjs";
|
|
2
|
+
//#region src/runtime/layoutBridge.d.ts
|
|
3
|
+
type LayoutBridgeContext = Record<string, any>;
|
|
4
|
+
type LayoutBridgeComponentResolver = (selector: string) => any;
|
|
5
|
+
type LayoutHostMap = Record<string, unknown>;
|
|
6
|
+
export type LayoutBridgeInstance<T = LayoutBridgeContext> = T & {
|
|
7
|
+
selectComponent?: LayoutBridgeComponentResolver;
|
|
8
|
+
};
|
|
9
|
+
interface LayoutHostResolveOptions<T = any> {
|
|
10
|
+
context?: T;
|
|
11
|
+
fallbackContext?: T;
|
|
12
|
+
interval?: number;
|
|
13
|
+
retries?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 为当前页面注册 layout bridge,使页面或子组件可消费 layout 内部能力。
|
|
17
|
+
*/
|
|
18
|
+
export declare function registerPageLayoutBridge(selectors: string | string[], context?: LayoutBridgeContext): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 移除当前页面的 layout bridge 注册。
|
|
21
|
+
*/
|
|
22
|
+
export declare function unregisterPageLayoutBridge(selectors: string | string[], context?: LayoutBridgeContext): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 解析当前页面已注册的 layout bridge,找不到时回退到传入上下文。
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveLayoutBridge<T = any>(selector: string, fallbackContext?: T): LayoutBridgeInstance<T> | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* 解析当前页面 layout 内通过指定 key 暴露的宿主实例。
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveLayoutHost<T = any, C = any>(key: string, options?: LayoutHostResolveOptions<C>): NonNullable<T> | null;
|
|
31
|
+
/**
|
|
32
|
+
* 等待当前页面 layout 宿主实例可用,适合页面初次进入时的异步宿主解析。
|
|
33
|
+
*/
|
|
34
|
+
export declare function waitForLayoutHost<T = any, C = any>(key: string, options?: LayoutHostResolveOptions<C>): Promise<T | null>;
|
|
35
|
+
/**
|
|
36
|
+
* 在 layout 生命周期内暴露 bridge,使页面或子组件可访问 layout 内部实例。
|
|
37
|
+
*/
|
|
38
|
+
export declare function useLayoutBridge(selectors: string | string[], options?: {
|
|
39
|
+
resolveComponent?: LayoutBridgeComponentResolver;
|
|
40
|
+
}): void;
|
|
41
|
+
/**
|
|
42
|
+
* 使用编译期注入的宿主绑定信息,直接从当前 layout 运行时实例解析子组件宿主并注册 bridge。
|
|
43
|
+
*/
|
|
44
|
+
export declare function registerRuntimeLayoutHosts(bindings: readonly LayoutHostBinding[], context?: LayoutBridgeContext): any;
|
|
45
|
+
/**
|
|
46
|
+
* 移除运行时自动注册的 layout 宿主 bridge。
|
|
47
|
+
*/
|
|
48
|
+
export declare function unregisterRuntimeLayoutHosts(bindings: readonly LayoutHostBinding[], context?: LayoutBridgeContext): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 使用 key -> 宿主实例的映射批量暴露 layout 内部宿主,适合 toast/dialog 等共享反馈节点。
|
|
51
|
+
*/
|
|
52
|
+
export declare function useLayoutHosts(hosts: LayoutHostMap): void;
|
|
53
|
+
//#endregion
|
|
54
|
+
export type { LayoutHostBinding };
|
|
55
|
+
//# sourceMappingURL=layoutBridge.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layoutBridge.mjs","names":[],"sources":["../../../src/runtime/layoutBridge.ts"],"sourcesContent":["import type { Ref } from '../reactivity'\nimport {\n WEVU_LAYOUT_BRIDGE_PAGE_KEYS,\n WEVU_NATIVE_INSTANCE_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n} from '@weapp-core/constants'\nimport { isRef } from '../reactivity'\nimport { getCurrentInstance, getCurrentSetupContext, onAttached, onDetached } from './hooks'\nimport { getCurrentMiniProgramPages } from './platform'\nimport { getTemplateRefMap } from './templateRefs/helpers'\n\ntype LayoutBridgeContext = Record<string, any>\ntype LayoutBridgeComponentResolver = (selector: string) => any\ntype LayoutHostMap = Record<string, unknown>\nexport type LayoutBridgeInstance<T = LayoutBridgeContext> = T & {\n selectComponent?: LayoutBridgeComponentResolver\n}\nexport interface LayoutHostBinding {\n key: string\n refName?: string\n selector: string\n kind?: 'component'\n}\ninterface LayoutHostResolveOptions<T = any> {\n context?: T\n fallbackContext?: T\n interval?: number\n retries?: number\n}\n\n/**\n * @description 对 layout host key 去重并过滤空字符串。\n */\nfunction normalizeLayoutHostKeys(keys: string | string[]) {\n return Array.from(new Set(Array.isArray(keys) ? keys : [keys]))\n .filter((key): key is string => typeof key === 'string' && key.length > 0)\n}\n\n/**\n * @description 解析小程序页面实例的稳定身份 key。\n */\nfunction resolvePageIdentityKeys(page?: Record<string, any>): string[] {\n if (!page || typeof page !== 'object') {\n return []\n }\n\n const keys: string[] = []\n const route = typeof page.route === 'string' ? page.route.replace(/^\\/+/, '') : ''\n if (route) {\n keys.push(`route:${route}`)\n }\n for (const [prefix, field] of [\n ['webview', '__wxWebviewId__'],\n ['exparser', '__wxExparserNodeId__'],\n ] as const) {\n const value = page[field]\n if (typeof value === 'number' || typeof value === 'string') {\n keys.push(`${prefix}:${String(value)}`)\n }\n }\n\n return Array.from(new Set(keys))\n}\n\n/**\n * @description 创建小程序 layout host 注册表。\n */\nfunction createLayoutHostRegistry<TBridge>() {\n const registries = new Map<string, Map<string, TBridge>>()\n\n function register(keys: string | string[], bridge: TBridge, pageKeys: string[]) {\n const normalizedKeys = normalizeLayoutHostKeys(keys)\n if (normalizedKeys.length === 0 || pageKeys.length === 0) {\n return null\n }\n\n for (const pageKey of pageKeys) {\n const registry = registries.get(pageKey) ?? new Map<string, TBridge>()\n for (const key of normalizedKeys) {\n registry.set(key, bridge)\n }\n registries.set(pageKey, registry)\n }\n\n return normalizedKeys\n }\n\n function unregister(keys: string | string[], bridge: TBridge, pageKeys: string[]) {\n const normalizedKeys = normalizeLayoutHostKeys(keys)\n if (normalizedKeys.length === 0 || pageKeys.length === 0) {\n return false\n }\n\n let removed = false\n for (const pageKey of pageKeys) {\n const registry = registries.get(pageKey)\n if (!registry) {\n continue\n }\n\n for (const key of normalizedKeys) {\n if (registry.get(key) === bridge) {\n registry.delete(key)\n removed = true\n }\n }\n\n if (registry.size === 0) {\n registries.delete(pageKey)\n }\n }\n\n return removed\n }\n\n function resolveBridge(key: string, pageKeys: string[]) {\n return pageKeys\n .map(pageKey => registries.get(pageKey)?.get(key))\n .find(Boolean)\n }\n\n function resolveHost<THost>(\n key: string,\n pageKeys: string[],\n resolver: (bridge: TBridge, key: string) => THost | null | undefined,\n ) {\n const bridge = resolveBridge(key, pageKeys)\n if (!bridge) {\n return null\n }\n return resolver(bridge, key) ?? null\n }\n\n function waitForHost<THost>(\n key: string,\n resolvePageKeys: () => string[],\n resolver: (bridge: TBridge, key: string) => THost | null | undefined,\n options: { interval?: number, retries?: number } = {},\n ): Promise<THost | null> {\n const retries = options.retries ?? 20\n const interval = options.interval ?? 16\n const host = resolveHost(key, resolvePageKeys(), resolver)\n if (host || retries <= 0) {\n return Promise.resolve(host)\n }\n\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(waitForHost(key, resolvePageKeys, resolver, {\n ...options,\n retries: retries - 1,\n }))\n }, interval)\n })\n }\n\n return {\n register,\n resolveBridge,\n resolveHost,\n unregister,\n waitForHost,\n }\n}\n\nconst pageLayoutBridgeRegistry = createLayoutHostRegistry<LayoutBridgeContext>()\n\nfunction resolveCurrentPageInstance() {\n const pages = getCurrentMiniProgramPages()\n return pages[pages.length - 1]\n}\n\nfunction resolvePageKeys(page?: LayoutBridgeContext) {\n return resolvePageIdentityKeys(page as Record<string, any> | undefined)\n}\n\nfunction resolveNativeLayoutContext(context?: LayoutBridgeContext) {\n if (!context || typeof context !== 'object') {\n return undefined\n }\n\n const runtimeNativeInstance = context[WEVU_PUBLIC_RUNTIME_KEY]?.state?.[WEVU_NATIVE_INSTANCE_KEY]\n if (runtimeNativeInstance && typeof runtimeNativeInstance === 'object') {\n return runtimeNativeInstance as LayoutBridgeContext\n }\n\n const stateNativeInstance = context.$state?.[WEVU_NATIVE_INSTANCE_KEY]\n if (stateNativeInstance && typeof stateNativeInstance === 'object') {\n return stateNativeInstance as LayoutBridgeContext\n }\n\n if (context[WEVU_NATIVE_INSTANCE_KEY] && typeof context[WEVU_NATIVE_INSTANCE_KEY] === 'object') {\n return context[WEVU_NATIVE_INSTANCE_KEY] as LayoutBridgeContext\n }\n\n return context\n}\n\nfunction resolvePageFromContext(\n context?: LayoutBridgeContext,\n visited = new Set<LayoutBridgeContext>(),\n): LayoutBridgeContext | undefined {\n if (!context || typeof context !== 'object' || visited.has(context)) {\n return resolveCurrentPageInstance()\n }\n visited.add(context)\n\n if (typeof context.__wevuSetPageLayout === 'function') {\n return context\n }\n\n const nativeContext = resolveNativeLayoutContext(context)\n if (nativeContext && nativeContext !== context) {\n const nativePage = resolvePageFromContext(nativeContext, visited)\n if (nativePage) {\n return nativePage\n }\n }\n\n const publicNativePage = context.$\n if (publicNativePage && typeof publicNativePage === 'object') {\n const nativePage = resolvePageFromContext(publicNativePage as LayoutBridgeContext, visited)\n if (nativePage) {\n return nativePage\n }\n }\n\n const ownerContext = nativeContext ?? context\n const selectOwnerComponent = ownerContext.selectOwnerComponent\n if (typeof selectOwnerComponent === 'function') {\n try {\n const owner = selectOwnerComponent.call(ownerContext) as LayoutBridgeContext | undefined\n if (owner && owner !== ownerContext) {\n const ownerPage = resolvePageFromContext(owner, visited)\n if (ownerPage) {\n return ownerPage\n }\n }\n }\n catch {\n // 部分宿主或生命周期阶段暂不支持 owner 查询,继续使用页面栈兜底。\n }\n }\n\n return resolveCurrentPageInstance()\n}\n\nfunction resolveHostEntry(entry: unknown) {\n if (typeof entry === 'function') {\n return (entry as () => unknown)()\n }\n if (isRef(entry as Ref<unknown>)) {\n return (entry as Ref<unknown>).value\n }\n return entry\n}\n\nfunction findLayoutHostBinding(bindings: LayoutHostBinding[], key: string) {\n return bindings.find(binding => binding.key === key)\n}\n\nfunction safeSelectComponent(target: LayoutBridgeContext | undefined, selector: string) {\n const selectComponent = target?.selectComponent\n if (typeof selectComponent !== 'function') {\n return null\n }\n try {\n return selectComponent.call(target, selector) ?? null\n }\n catch {\n return null\n }\n}\n\nfunction resolveDeclaredLayoutHostFromRefs(\n binding: LayoutHostBinding,\n context: LayoutBridgeContext,\n) {\n if (!binding.refName) {\n return null\n }\n const refMap = getTemplateRefMap(context as any)\n const stateRefs = context[WEVU_PUBLIC_RUNTIME_KEY]?.state?.$refs\n ?? context.__wevu?.state?.$refs\n ?? context.$state?.$refs\n ?? context.$refs\n const refValue = refMap?.get(binding.refName)?.value\n ?? stateRefs?.[binding.refName]\n if (Array.isArray(refValue)) {\n return refValue[0] ?? null\n }\n return refValue ?? null\n}\n\nfunction createDeclaredLayoutHostBridge(bindings: LayoutHostBinding[], context: LayoutBridgeContext) {\n const nativeContext = resolveNativeLayoutContext(context)\n const bridgeBase = nativeContext && typeof nativeContext === 'object'\n ? Object.create(nativeContext)\n : {}\n return Object.assign(bridgeBase, {\n selectComponent(key: string) {\n const binding = findLayoutHostBinding(bindings, key)\n if (!binding) {\n return null\n }\n if (binding.kind === 'component' || !binding.kind) {\n const cachedHost = resolveDeclaredLayoutHostFromRefs(binding, context)\n if (cachedHost) {\n return cachedHost\n }\n return safeSelectComponent(nativeContext, binding.selector)\n ?? safeSelectComponent(resolveCurrentPageInstance(), binding.selector)\n ?? null\n }\n return null\n },\n })\n}\n\n/**\n * 为当前页面注册 layout bridge,使页面或子组件可消费 layout 内部能力。\n */\nexport function registerPageLayoutBridge(\n selectors: string | string[],\n context?: LayoutBridgeContext,\n) {\n const bridgeContext = context ?? getCurrentInstance<LayoutBridgeContext>()\n const page = resolvePageFromContext(bridgeContext)\n const pageKeys = resolvePageKeys(page)\n if (!bridgeContext || !page || pageKeys.length === 0) {\n return false\n }\n\n const normalizedSelectors = pageLayoutBridgeRegistry.register(selectors, bridgeContext, pageKeys)\n if (!normalizedSelectors) {\n return false\n }\n\n bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS] = pageKeys\n return true\n}\n\n/**\n * 移除当前页面的 layout bridge 注册。\n */\nexport function unregisterPageLayoutBridge(\n selectors: string | string[],\n context?: LayoutBridgeContext,\n) {\n const bridgeContext = context ?? getCurrentInstance<LayoutBridgeContext>()\n const page = resolvePageFromContext(bridgeContext)\n const pageKeys = bridgeContext?.[WEVU_LAYOUT_BRIDGE_PAGE_KEYS] ?? resolvePageKeys(page)\n if (!bridgeContext || !Array.isArray(pageKeys) || pageKeys.length === 0) {\n return false\n }\n\n const removed = pageLayoutBridgeRegistry.unregister(selectors, bridgeContext, pageKeys)\n delete bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS]\n return removed\n}\n\n/**\n * 解析当前页面已注册的 layout bridge,找不到时回退到传入上下文。\n */\nexport function resolveLayoutBridge<T = any>(\n selector: string,\n fallbackContext?: T,\n) {\n const page = resolveCurrentPageInstance() ?? resolvePageFromContext(fallbackContext as LayoutBridgeContext | undefined)\n const bridgeContext = pageLayoutBridgeRegistry.resolveBridge(selector, resolvePageKeys(page))\n return (bridgeContext ?? fallbackContext ?? getCurrentInstance()) as LayoutBridgeInstance<T> | undefined\n}\n\n/**\n * 解析当前页面 layout 内通过指定 key 暴露的宿主实例。\n */\nexport function resolveLayoutHost<T = any, C = any>(\n key: string,\n options: LayoutHostResolveOptions<C> = {},\n) {\n const context = options.context ?? options.fallbackContext\n const page = resolveCurrentPageInstance() ?? resolvePageFromContext(context as LayoutBridgeContext | undefined)\n return pageLayoutBridgeRegistry.resolveHost<T>(\n key,\n resolvePageKeys(page),\n (bridge, key) => bridge.selectComponent?.(key) as T | null,\n )\n}\n\n/**\n * 等待当前页面 layout 宿主实例可用,适合页面初次进入时的异步宿主解析。\n */\nexport function waitForLayoutHost<T = any, C = any>(\n key: string,\n options: LayoutHostResolveOptions<C> = {},\n) {\n const context = options.context ?? options.fallbackContext\n return pageLayoutBridgeRegistry.waitForHost<T>(\n key,\n () => resolvePageKeys(resolveCurrentPageInstance() ?? resolvePageFromContext(context as LayoutBridgeContext | undefined)),\n (bridge, key) => bridge.selectComponent?.(key) as T | null,\n options,\n )\n}\n\n/**\n * 在 layout 生命周期内暴露 bridge,使页面或子组件可访问 layout 内部实例。\n */\nexport function useLayoutBridge(\n selectors: string | string[],\n options: {\n resolveComponent?: LayoutBridgeComponentResolver\n } = {},\n) {\n if (!getCurrentSetupContext()) {\n throw new Error('useLayoutBridge() 必须在 setup() 的同步阶段调用')\n }\n\n const context = getCurrentInstance<LayoutBridgeContext>()\n const normalizedSelectors = normalizeLayoutHostKeys(selectors)\n const resolveComponent = options.resolveComponent\n const nativeContext = resolveNativeLayoutContext(context)\n const bridgeBase = nativeContext && typeof nativeContext === 'object'\n ? Object.create(nativeContext)\n : {}\n const bridge = Object.assign(bridgeBase, {\n selectComponent(selector: string) {\n if (!normalizedSelectors.includes(selector)) {\n return null\n }\n\n const resolvedComponent = resolveComponent?.(selector)\n if (resolvedComponent !== undefined) {\n return resolvedComponent\n }\n\n const nativeContext = resolveNativeLayoutContext(context)\n const directMatch = nativeContext?.selectComponent?.(selector)\n if (directMatch) {\n return directMatch\n }\n\n const currentPage = resolveCurrentPageInstance()\n return currentPage?.selectComponent?.(selector) ?? null\n },\n })\n\n registerPageLayoutBridge(normalizedSelectors, bridge)\n\n onAttached(() => {\n registerPageLayoutBridge(normalizedSelectors, bridge)\n })\n\n onDetached(() => {\n unregisterPageLayoutBridge(normalizedSelectors, bridge)\n })\n}\n\n/**\n * 使用编译期注入的宿主绑定信息,直接从当前 layout 运行时实例解析子组件宿主并注册 bridge。\n */\nexport function registerRuntimeLayoutHosts(\n bindings: LayoutHostBinding[],\n context?: LayoutBridgeContext,\n) {\n if (!bindings.length) {\n return null\n }\n const bridgeContext = context ?? getCurrentInstance<LayoutBridgeContext>()\n if (!bridgeContext) {\n return null\n }\n const bridge = createDeclaredLayoutHostBridge(bindings, bridgeContext)\n registerPageLayoutBridge(bindings.map(binding => binding.key), bridge)\n return bridge\n}\n\n/**\n * 移除运行时自动注册的 layout 宿主 bridge。\n */\nexport function unregisterRuntimeLayoutHosts(\n bindings: LayoutHostBinding[],\n context?: LayoutBridgeContext,\n) {\n if (!bindings.length) {\n return false\n }\n const bridgeContext = context ?? getCurrentInstance<LayoutBridgeContext>()\n if (!bridgeContext) {\n return false\n }\n return unregisterPageLayoutBridge(\n bindings.map(binding => binding.key),\n bridgeContext,\n )\n}\n\n/**\n * 使用 key -> 宿主实例的映射批量暴露 layout 内部宿主,适合 toast/dialog 等共享反馈节点。\n */\nexport function useLayoutHosts(hosts: LayoutHostMap) {\n const selectors = Object.keys(hosts)\n useLayoutBridge(selectors, {\n resolveComponent(key) {\n return resolveHostEntry(hosts[key])\n },\n })\n}\n"],"mappings":";;;;;;;;;;;AAiCA,SAAS,wBAAwB,MAAyB;CACxD,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5D,QAAQ,QAAuB,OAAO,QAAQ,YAAY,IAAI,SAAS,CAAC;AAC7E;;;;AAKA,SAAS,wBAAwB,MAAsC;CACrE,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B,OAAO,CAAC;CAGV,MAAM,OAAiB,CAAC;CACxB,MAAM,QAAQ,OAAO,KAAK,UAAU,WAAW,KAAK,MAAM,QAAQ,QAAQ,EAAE,IAAI;CAChF,IAAI,OACF,KAAK,KAAK,SAAS,OAAO;CAE5B,KAAK,MAAM,CAAC,QAAQ,UAAU,CAC5B,CAAC,WAAW,iBAAiB,GAC7B,CAAC,YAAY,sBAAsB,CACrC,GAAY;EACV,MAAM,QAAQ,KAAK;EACnB,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAChD,KAAK,KAAK,GAAG,OAAO,GAAG,OAAO,KAAK,GAAG;CAE1C;CAEA,OAAO,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC;AACjC;;;;AAKA,SAAS,2BAAoC;CAC3C,MAAM,6BAAa,IAAI,IAAkC;CAEzD,SAAS,SAAS,MAAyB,QAAiB,UAAoB;EAC9E,MAAM,iBAAiB,wBAAwB,IAAI;EACnD,IAAI,eAAe,WAAW,KAAK,SAAS,WAAW,GACrD,OAAO;EAGT,KAAK,MAAM,WAAW,UAAU;;GAC9B,MAAM,8BAAW,WAAW,IA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AAG,GAAG,MAAM;CACrE,OAAO;AACT;;;;AAKA,SAAgB,6BACd,UACA,SACA;CACA,IAAI,CAAC,SAAS,QACZ,OAAO;CAET,MAAM,gBAAgB,mDAAW,mBAAwC;CACzE,IAAI,CAAC,eACH,OAAO;CAET,OAAO,2BACL,SAAS,KAAI,YAAW,QAAQ,GAAG,GACnC,aACF;AACF;;;;AAKA,SAAgB,eAAe,OAAsB;CAEnD,gBADkB,OAAO,KAAK,KACN,GAAG,EACzB,iBAAiB,KAAK;EACpB,OAAO,iBAAiB,MAAM,IAAI;CACpC,EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"layoutBridge.mjs","names":[],"sources":["../../../src/runtime/layoutBridge.ts"],"sourcesContent":["import type { Ref } from '../reactivity'\nimport type { LayoutHostBinding } from './capabilities'\nimport {\n WEVU_LAYOUT_BRIDGE_PAGE_KEYS,\n WEVU_NATIVE_INSTANCE_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n} from '@weapp-core/constants'\nimport { isRef } from '../reactivity'\nimport { getCurrentInstance, getCurrentSetupContext, onAttached, onDetached } from './hooks'\nimport { getCurrentMiniProgramPages } from './platform'\nimport { getTemplateRefMap } from './templateRefs/helpers'\n\ntype LayoutBridgeContext = Record<string, any>\ntype LayoutBridgeComponentResolver = (selector: string) => any\ntype LayoutHostMap = Record<string, unknown>\nexport type LayoutBridgeInstance<T = LayoutBridgeContext> = T & {\n selectComponent?: LayoutBridgeComponentResolver\n}\nexport type { LayoutHostBinding } from './capabilities'\ninterface LayoutHostResolveOptions<T = any> {\n context?: T\n fallbackContext?: T\n interval?: number\n retries?: number\n}\n\n/**\n * @description 对 layout host key 去重并过滤空字符串。\n */\nfunction normalizeLayoutHostKeys(keys: string | string[]) {\n return Array.from(new Set(Array.isArray(keys) ? keys : [keys]))\n .filter((key): key is string => typeof key === 'string' && key.length > 0)\n}\n\n/**\n * @description 解析小程序页面实例的稳定身份 key。\n */\nfunction resolvePageIdentityKeys(page?: Record<string, any>): string[] {\n if (!page || typeof page !== 'object') {\n return []\n }\n\n const keys: string[] = []\n const route = typeof page.route === 'string' ? page.route.replace(/^\\/+/, '') : ''\n if (route) {\n keys.push(`route:${route}`)\n }\n for (const [prefix, field] of [\n ['webview', '__wxWebviewId__'],\n ['exparser', '__wxExparserNodeId__'],\n ] as const) {\n const value = page[field]\n if (typeof value === 'number' || typeof value === 'string') {\n keys.push(`${prefix}:${String(value)}`)\n }\n }\n\n return Array.from(new Set(keys))\n}\n\n/**\n * @description 创建小程序 layout host 注册表。\n */\nfunction createLayoutHostRegistry<TBridge>() {\n const registries = new Map<string, Map<string, TBridge>>()\n\n function register(keys: string | string[], bridge: TBridge, pageKeys: string[]) {\n const normalizedKeys = normalizeLayoutHostKeys(keys)\n if (normalizedKeys.length === 0 || pageKeys.length === 0) {\n return null\n }\n\n for (const pageKey of pageKeys) {\n const registry = registries.get(pageKey) ?? new Map<string, TBridge>()\n for (const key of normalizedKeys) {\n registry.set(key, bridge)\n }\n registries.set(pageKey, registry)\n }\n\n return normalizedKeys\n }\n\n function unregister(keys: string | string[], bridge: TBridge, pageKeys: string[]) {\n const normalizedKeys = normalizeLayoutHostKeys(keys)\n if (normalizedKeys.length === 0 || pageKeys.length === 0) {\n return false\n }\n\n let removed = false\n for (const pageKey of pageKeys) {\n const registry = registries.get(pageKey)\n if (!registry) {\n continue\n }\n\n for (const key of normalizedKeys) {\n if (registry.get(key) === bridge) {\n registry.delete(key)\n removed = true\n }\n }\n\n if (registry.size === 0) {\n registries.delete(pageKey)\n }\n }\n\n return removed\n }\n\n function resolveBridge(key: string, pageKeys: string[]) {\n return pageKeys\n .map(pageKey => registries.get(pageKey)?.get(key))\n .find(Boolean)\n }\n\n function resolveHost<THost>(\n key: string,\n pageKeys: string[],\n resolver: (bridge: TBridge, key: string) => THost | null | undefined,\n ) {\n const bridge = resolveBridge(key, pageKeys)\n if (!bridge) {\n return null\n }\n return resolver(bridge, key) ?? null\n }\n\n function waitForHost<THost>(\n key: string,\n resolvePageKeys: () => string[],\n resolver: (bridge: TBridge, key: string) => THost | null | undefined,\n options: { interval?: number, retries?: number } = {},\n ): Promise<THost | null> {\n const retries = options.retries ?? 20\n const interval = options.interval ?? 16\n const host = resolveHost(key, resolvePageKeys(), resolver)\n if (host || retries <= 0) {\n return Promise.resolve(host)\n }\n\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(waitForHost(key, resolvePageKeys, resolver, {\n ...options,\n retries: retries - 1,\n }))\n }, interval)\n })\n }\n\n return {\n register,\n resolveBridge,\n resolveHost,\n unregister,\n waitForHost,\n }\n}\n\nconst pageLayoutBridgeRegistry = createLayoutHostRegistry<LayoutBridgeContext>()\n\nfunction resolveCurrentPageInstance() {\n const pages = getCurrentMiniProgramPages()\n return pages[pages.length - 1]\n}\n\nfunction resolvePageKeys(page?: LayoutBridgeContext) {\n return resolvePageIdentityKeys(page as Record<string, any> | undefined)\n}\n\nfunction resolveNativeLayoutContext(context?: LayoutBridgeContext) {\n if (!context || typeof context !== 'object') {\n return undefined\n }\n\n const runtimeNativeInstance = context[WEVU_PUBLIC_RUNTIME_KEY]?.state?.[WEVU_NATIVE_INSTANCE_KEY]\n if (runtimeNativeInstance && typeof runtimeNativeInstance === 'object') {\n return runtimeNativeInstance as LayoutBridgeContext\n }\n\n const stateNativeInstance = context.$state?.[WEVU_NATIVE_INSTANCE_KEY]\n if (stateNativeInstance && typeof stateNativeInstance === 'object') {\n return stateNativeInstance as LayoutBridgeContext\n }\n\n if (context[WEVU_NATIVE_INSTANCE_KEY] && typeof context[WEVU_NATIVE_INSTANCE_KEY] === 'object') {\n return context[WEVU_NATIVE_INSTANCE_KEY] as LayoutBridgeContext\n }\n\n return context\n}\n\nfunction resolvePageFromContext(\n context?: LayoutBridgeContext,\n visited = new Set<LayoutBridgeContext>(),\n): LayoutBridgeContext | undefined {\n if (!context || typeof context !== 'object' || visited.has(context)) {\n return resolveCurrentPageInstance()\n }\n visited.add(context)\n\n if (typeof context.__wevuSetPageLayout === 'function') {\n return context\n }\n\n const nativeContext = resolveNativeLayoutContext(context)\n if (nativeContext && nativeContext !== context) {\n const nativePage = resolvePageFromContext(nativeContext, visited)\n if (nativePage) {\n return nativePage\n }\n }\n\n const publicNativePage = context.$\n if (publicNativePage && typeof publicNativePage === 'object') {\n const nativePage = resolvePageFromContext(publicNativePage as LayoutBridgeContext, visited)\n if (nativePage) {\n return nativePage\n }\n }\n\n const ownerContext = nativeContext ?? context\n const selectOwnerComponent = ownerContext.selectOwnerComponent\n if (typeof selectOwnerComponent === 'function') {\n try {\n const owner = selectOwnerComponent.call(ownerContext) as LayoutBridgeContext | undefined\n if (owner && owner !== ownerContext) {\n const ownerPage = resolvePageFromContext(owner, visited)\n if (ownerPage) {\n return ownerPage\n }\n }\n }\n catch {\n // 部分宿主或生命周期阶段暂不支持 owner 查询,继续使用页面栈兜底。\n }\n }\n\n return resolveCurrentPageInstance()\n}\n\nfunction resolveHostEntry(entry: unknown) {\n if (typeof entry === 'function') {\n return (entry as () => unknown)()\n }\n if (isRef(entry as Ref<unknown>)) {\n return (entry as Ref<unknown>).value\n }\n return entry\n}\n\nfunction findLayoutHostBinding(bindings: readonly LayoutHostBinding[], key: string) {\n return bindings.find(binding => binding.key === key)\n}\n\nfunction safeSelectComponent(target: LayoutBridgeContext | undefined, selector: string) {\n const selectComponent = target?.selectComponent\n if (typeof selectComponent !== 'function') {\n return null\n }\n try {\n return selectComponent.call(target, selector) ?? null\n }\n catch {\n return null\n }\n}\n\nfunction resolveDeclaredLayoutHostFromRefs(\n binding: LayoutHostBinding,\n context: LayoutBridgeContext,\n) {\n if (!binding.refName) {\n return null\n }\n const refMap = getTemplateRefMap(context as any)\n const stateRefs = context[WEVU_PUBLIC_RUNTIME_KEY]?.state?.$refs\n ?? context.__wevu?.state?.$refs\n ?? context.$state?.$refs\n ?? context.$refs\n const refValue = refMap?.get(binding.refName)?.value\n ?? stateRefs?.[binding.refName]\n if (Array.isArray(refValue)) {\n return refValue[0] ?? null\n }\n return refValue ?? null\n}\n\nfunction createDeclaredLayoutHostBridge(bindings: readonly LayoutHostBinding[], context: LayoutBridgeContext) {\n const nativeContext = resolveNativeLayoutContext(context)\n const bridgeBase = nativeContext && typeof nativeContext === 'object'\n ? Object.create(nativeContext)\n : {}\n return Object.assign(bridgeBase, {\n selectComponent(key: string) {\n const binding = findLayoutHostBinding(bindings, key)\n if (!binding) {\n return null\n }\n if (binding.kind === 'component' || !binding.kind) {\n const cachedHost = resolveDeclaredLayoutHostFromRefs(binding, context)\n if (cachedHost) {\n return cachedHost\n }\n return safeSelectComponent(nativeContext, binding.selector)\n ?? safeSelectComponent(resolveCurrentPageInstance(), binding.selector)\n ?? null\n }\n return null\n },\n })\n}\n\n/**\n * 为当前页面注册 layout bridge,使页面或子组件可消费 layout 内部能力。\n */\nexport function registerPageLayoutBridge(\n selectors: string | string[],\n context?: LayoutBridgeContext,\n) {\n const bridgeContext = context ?? getCurrentInstance<LayoutBridgeContext>()\n const page = resolvePageFromContext(bridgeContext)\n const pageKeys = resolvePageKeys(page)\n if (!bridgeContext || !page || pageKeys.length === 0) {\n return false\n }\n\n const normalizedSelectors = pageLayoutBridgeRegistry.register(selectors, bridgeContext, pageKeys)\n if (!normalizedSelectors) {\n return false\n }\n\n bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS] = pageKeys\n return true\n}\n\n/**\n * 移除当前页面的 layout bridge 注册。\n */\nexport function unregisterPageLayoutBridge(\n selectors: string | string[],\n context?: LayoutBridgeContext,\n) {\n const bridgeContext = context ?? getCurrentInstance<LayoutBridgeContext>()\n const page = resolvePageFromContext(bridgeContext)\n const pageKeys = bridgeContext?.[WEVU_LAYOUT_BRIDGE_PAGE_KEYS] ?? resolvePageKeys(page)\n if (!bridgeContext || !Array.isArray(pageKeys) || pageKeys.length === 0) {\n return false\n }\n\n const removed = pageLayoutBridgeRegistry.unregister(selectors, bridgeContext, pageKeys)\n delete bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS]\n return removed\n}\n\n/**\n * 解析当前页面已注册的 layout bridge,找不到时回退到传入上下文。\n */\nexport function resolveLayoutBridge<T = any>(\n selector: string,\n fallbackContext?: T,\n) {\n const page = resolveCurrentPageInstance() ?? resolvePageFromContext(fallbackContext as LayoutBridgeContext | undefined)\n const bridgeContext = pageLayoutBridgeRegistry.resolveBridge(selector, resolvePageKeys(page))\n return (bridgeContext ?? fallbackContext ?? getCurrentInstance()) as LayoutBridgeInstance<T> | undefined\n}\n\n/**\n * 解析当前页面 layout 内通过指定 key 暴露的宿主实例。\n */\nexport function resolveLayoutHost<T = any, C = any>(\n key: string,\n options: LayoutHostResolveOptions<C> = {},\n) {\n const context = options.context ?? options.fallbackContext\n const page = resolveCurrentPageInstance() ?? resolvePageFromContext(context as LayoutBridgeContext | undefined)\n return pageLayoutBridgeRegistry.resolveHost<T>(\n key,\n resolvePageKeys(page),\n (bridge, key) => bridge.selectComponent?.(key) as T | null,\n )\n}\n\n/**\n * 等待当前页面 layout 宿主实例可用,适合页面初次进入时的异步宿主解析。\n */\nexport function waitForLayoutHost<T = any, C = any>(\n key: string,\n options: LayoutHostResolveOptions<C> = {},\n) {\n const context = options.context ?? options.fallbackContext\n return pageLayoutBridgeRegistry.waitForHost<T>(\n key,\n () => resolvePageKeys(resolveCurrentPageInstance() ?? resolvePageFromContext(context as LayoutBridgeContext | undefined)),\n (bridge, key) => bridge.selectComponent?.(key) as T | null,\n options,\n )\n}\n\n/**\n * 在 layout 生命周期内暴露 bridge,使页面或子组件可访问 layout 内部实例。\n */\nexport function useLayoutBridge(\n selectors: string | string[],\n options: {\n resolveComponent?: LayoutBridgeComponentResolver\n } = {},\n) {\n if (!getCurrentSetupContext()) {\n throw new Error('useLayoutBridge() 必须在 setup() 的同步阶段调用')\n }\n\n const context = getCurrentInstance<LayoutBridgeContext>()\n const normalizedSelectors = normalizeLayoutHostKeys(selectors)\n const resolveComponent = options.resolveComponent\n const nativeContext = resolveNativeLayoutContext(context)\n const bridgeBase = nativeContext && typeof nativeContext === 'object'\n ? Object.create(nativeContext)\n : {}\n const bridge = Object.assign(bridgeBase, {\n selectComponent(selector: string) {\n if (!normalizedSelectors.includes(selector)) {\n return null\n }\n\n const resolvedComponent = resolveComponent?.(selector)\n if (resolvedComponent !== undefined) {\n return resolvedComponent\n }\n\n const nativeContext = resolveNativeLayoutContext(context)\n const directMatch = nativeContext?.selectComponent?.(selector)\n if (directMatch) {\n return directMatch\n }\n\n const currentPage = resolveCurrentPageInstance()\n return currentPage?.selectComponent?.(selector) ?? null\n },\n })\n\n registerPageLayoutBridge(normalizedSelectors, bridge)\n\n onAttached(() => {\n registerPageLayoutBridge(normalizedSelectors, bridge)\n })\n\n onDetached(() => {\n unregisterPageLayoutBridge(normalizedSelectors, bridge)\n })\n}\n\n/**\n * 使用编译期注入的宿主绑定信息,直接从当前 layout 运行时实例解析子组件宿主并注册 bridge。\n */\nexport function registerRuntimeLayoutHosts(\n bindings: readonly LayoutHostBinding[],\n context?: LayoutBridgeContext,\n) {\n if (!bindings.length) {\n return null\n }\n const bridgeContext = context ?? getCurrentInstance<LayoutBridgeContext>()\n if (!bridgeContext) {\n return null\n }\n const bridge = createDeclaredLayoutHostBridge(bindings, bridgeContext)\n registerPageLayoutBridge(bindings.map(binding => binding.key), bridge)\n return bridge\n}\n\n/**\n * 移除运行时自动注册的 layout 宿主 bridge。\n */\nexport function unregisterRuntimeLayoutHosts(\n bindings: readonly LayoutHostBinding[],\n context?: LayoutBridgeContext,\n) {\n if (!bindings.length) {\n return false\n }\n const bridgeContext = context ?? getCurrentInstance<LayoutBridgeContext>()\n if (!bridgeContext) {\n return false\n }\n return unregisterPageLayoutBridge(\n bindings.map(binding => binding.key),\n bridgeContext,\n )\n}\n\n/**\n * 使用 key -> 宿主实例的映射批量暴露 layout 内部宿主,适合 toast/dialog 等共享反馈节点。\n */\nexport function useLayoutHosts(hosts: LayoutHostMap) {\n const selectors = Object.keys(hosts)\n useLayoutBridge(selectors, {\n resolveComponent(key)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AAG,GACnC,aACF;AACF;;;;AAKA,SAAgB,eAAe,OAAsB;CAEnD,gBADkB,OAAO,KAAK,KACN,GAAG,EACzB,iBAAiB,KAAK;EACpB,OAAO,iBAAiB,MAAM,IAAI;CACpC,EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Ref } from "../reactivity/ref.mjs";
|
|
2
|
+
import { ComputedRef } from "../reactivity/computed.mjs";
|
|
3
|
+
import "../index.mjs";
|
|
4
|
+
//#region src/runtime/pageEnvironment.d.ts
|
|
5
|
+
export interface PageStackSnapshot {
|
|
6
|
+
canGoBack: boolean;
|
|
7
|
+
currentRoute: string;
|
|
8
|
+
stackLength: number;
|
|
9
|
+
}
|
|
10
|
+
export interface UsePageStackOptions {
|
|
11
|
+
autoRefresh?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface NavigationBarMetrics {
|
|
14
|
+
navigationBarHeight: number;
|
|
15
|
+
navigationHeight: number;
|
|
16
|
+
statusBarHeight: number;
|
|
17
|
+
}
|
|
18
|
+
export interface UseNavigationBarMetricsOptions {
|
|
19
|
+
autoRefresh?: boolean;
|
|
20
|
+
defaultNavigationBarHeight?: number;
|
|
21
|
+
defaultStatusBarHeight?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 获取当前小程序页面栈的稳定快照。
|
|
25
|
+
*/
|
|
26
|
+
export declare function getCurrentPageStackSnapshot(): PageStackSnapshot;
|
|
27
|
+
/**
|
|
28
|
+
* 在 setup 中跟踪当前小程序页面栈状态。
|
|
29
|
+
*/
|
|
30
|
+
export declare function usePageStack(options?: UsePageStackOptions): {
|
|
31
|
+
canGoBack: ComputedRef<boolean>;
|
|
32
|
+
currentRoute: Ref<string, string>;
|
|
33
|
+
refresh: () => void;
|
|
34
|
+
stackLength: Ref<number, number>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 计算自定义导航栏所需的状态栏和胶囊占位高度。
|
|
38
|
+
*/
|
|
39
|
+
export declare function getNavigationBarMetrics(options?: Omit<UseNavigationBarMetricsOptions, 'autoRefresh'>): NavigationBarMetrics;
|
|
40
|
+
/**
|
|
41
|
+
* 在 setup 中跟踪自定义导航栏尺寸。
|
|
42
|
+
*/
|
|
43
|
+
export declare function useNavigationBarMetrics(options?: UseNavigationBarMetricsOptions): {
|
|
44
|
+
navigationBarHeight: Ref<number, number>;
|
|
45
|
+
navigationHeight: ComputedRef<number>;
|
|
46
|
+
refresh: () => void;
|
|
47
|
+
statusBarHeight: Ref<number, number>;
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
//# sourceMappingURL=pageEnvironment.d.mts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/runtime/pageLayout.d.ts
|
|
2
|
+
type PageLayoutProps = object;
|
|
3
|
+
export interface WevuPageLayoutMap {}
|
|
4
|
+
type ResolveTypedPageLayoutName = keyof WevuPageLayoutMap extends never ? string : Extract<keyof WevuPageLayoutMap, string>;
|
|
5
|
+
type ResolveTypedPageLayoutProps<Name extends string> = Name extends keyof WevuPageLayoutMap ? WevuPageLayoutMap[Name] : PageLayoutProps;
|
|
6
|
+
type PageLayoutNamedState = { [Name in ResolveTypedPageLayoutName]: {
|
|
7
|
+
name: Name;
|
|
8
|
+
props: ResolveTypedPageLayoutProps<Name>;
|
|
9
|
+
}; }[ResolveTypedPageLayoutName];
|
|
10
|
+
export type PageLayoutState = PageLayoutNamedState | {
|
|
11
|
+
name: false;
|
|
12
|
+
props: Record<string, any>;
|
|
13
|
+
} | {
|
|
14
|
+
name: undefined;
|
|
15
|
+
props: Record<string, any>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 获取当前页面 layout 状态。
|
|
19
|
+
*/
|
|
20
|
+
export declare function usePageLayout(): Readonly<PageLayoutState>;
|
|
21
|
+
export declare function syncRuntimePageLayoutState(target: Record<string, any>, layout: string | false, props: PageLayoutProps): void;
|
|
22
|
+
export declare function syncRuntimePageLayoutStateFromRuntime(target: Record<string, any>): void;
|
|
23
|
+
export declare function resolveRuntimePageLayoutName(layout: string | false): string;
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=pageLayout.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageLayout.mjs","names":[],"sources":["../../../src/runtime/pageLayout.ts"],"sourcesContent":["import {\n WEVU_PAGE_LAYOUT_NAME_KEY,\n WEVU_PAGE_LAYOUT_NONE,\n WEVU_PAGE_LAYOUT_PROPS_KEY,\n WEVU_PAGE_LAYOUT_SETTER_KEY,\n} from '@weapp-core/constants'\nimport { reactive, readonly } from '../reactivity'\nimport { getCurrentInstance, getCurrentSetupContext } from './hooks'\nimport { getCurrentMiniProgramPages } from './platform'\nimport { getCurrentPageInstance } from './register/component/lifecycle/platform'\n\ntype PageLayoutSetter = (layout: string | false, props?:
|
|
1
|
+
{"version":3,"file":"pageLayout.mjs","names":[],"sources":["../../../src/runtime/pageLayout.ts"],"sourcesContent":["import {\n WEVU_PAGE_LAYOUT_NAME_KEY,\n WEVU_PAGE_LAYOUT_NONE,\n WEVU_PAGE_LAYOUT_PROPS_KEY,\n WEVU_PAGE_LAYOUT_SETTER_KEY,\n} from '@weapp-core/constants'\nimport { reactive, readonly } from '../reactivity'\nimport { getCurrentInstance, getCurrentSetupContext } from './hooks'\nimport { getCurrentMiniProgramPages } from './platform'\nimport { getCurrentPageInstance } from './register/component/lifecycle/platform'\n\ntype PageLayoutProps = object\n\ntype PageLayoutSetter = (layout: string | false, props?: PageLayoutProps) => void\n\nexport interface WevuPageLayoutMap {}\n\ntype ResolveTypedPageLayoutName = keyof WevuPageLayoutMap extends never\n ? string\n : Extract<keyof WevuPageLayoutMap, string>\n\ntype ResolveTypedPageLayoutProps<Name extends string> = Name extends keyof WevuPageLayoutMap\n ? WevuPageLayoutMap[Name]\n : PageLayoutProps\n\ntype PageLayoutNamedState = {\n [Name in ResolveTypedPageLayoutName]: {\n name: Name\n props: ResolveTypedPageLayoutProps<Name>\n }\n}[ResolveTypedPageLayoutName]\n\nexport type PageLayoutState\n = | PageLayoutNamedState\n | {\n name: false\n props: Record<string, any>\n }\n | {\n name: undefined\n props: Record<string, any>\n }\n\ninterface MutablePageLayoutState {\n name: string | false | undefined\n props: Record<string, any>\n}\n\nfunction resolveCurrentPageInstance() {\n const runtimeCurrentPage = getCurrentPageInstance()\n if (runtimeCurrentPage) {\n return runtimeCurrentPage\n }\n const pages = getCurrentMiniProgramPages()\n return pages[pages.length - 1]\n}\n\nfunction normalizeRuntimePageLayoutName(layout: string | undefined) {\n return layout === WEVU_PAGE_LAYOUT_NONE ? false : layout\n}\n\n/**\n * 获取当前页面 layout 状态。\n */\nexport function usePageLayout(): Readonly<PageLayoutState> {\n if (!getCurrentSetupContext()) {\n throw new Error('usePageLayout() 必须在 setup() 的同步阶段调用')\n }\n\n const currentInstance = getCurrentInstance() as Record<string, any> | undefined\n const runtimeState = currentInstance?.__wevu?.state as Record<string, any> | undefined\n const pageLayoutState = reactive<MutablePageLayoutState>({\n name: normalizeRuntimePageLayoutName(runtimeState?.[WEVU_PAGE_LAYOUT_NAME_KEY]) as string | false | undefined,\n props: { ...(runtimeState?.[WEVU_PAGE_LAYOUT_PROPS_KEY] ?? {}) },\n })\n\n if (currentInstance) {\n currentInstance.__wevuPageLayoutState = pageLayoutState\n }\n\n return readonly(pageLayoutState) as Readonly<PageLayoutState>\n}\n\nexport function syncRuntimePageLayoutState(target: Record<string, any>, layout: string | false, props: PageLayoutProps) {\n const state = target.__wevuPageLayoutState as MutablePageLayoutState | undefined\n if (!state) {\n return\n }\n state.name = layout\n state.props = { ...props }\n}\n\nexport function syncRuntimePageLayoutStateFromRuntime(target: Record<string, any>) {\n const state = target.__wevuPageLayoutState as MutablePageLayoutState | undefined\n const runtimeState = target.__wevu?.state as Record<string, any> | undefined\n if (!state || !runtimeState) {\n return\n }\n state.name = normalizeRuntimePageLayoutName(runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY]) as string | false | undefined\n state.props = { ...(runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] ?? {}) }\n}\n\nexport function setPageLayout(layout: false): void\nexport function setPageLayout<Name extends ResolveTypedPageLayoutName>(layout: Name, props?: ResolveTypedPageLayoutProps<Name>): void\n\n/**\n * 显式切换当前页面使用的 layout。\n */\nexport function setPageLayout(layout: string | false, props?: PageLayoutProps): void {\n const currentInstance = getCurrentInstance() as Record<string, any> | undefined\n const directSetter = currentInstance?.[WEVU_PAGE_LAYOUT_SETTER_KEY] as PageLayoutSetter | undefined\n if (typeof directSetter === 'function') {\n directSetter(layout, props)\n return\n }\n\n const currentPage = resolveCurrentPageInstance()\n const pageSetter = currentPage?.[WEVU_PAGE_LAYOUT_SETTER_KEY] as PageLayoutSetter | undefined\n if (typeof pageSetter === 'function') {\n pageSetter(layout, props)\n return\n }\n\n throw new Error('setPageLayout() 未找到当前页面实例。请在页面 setup()、事件回调或当前页面上下文中调用。')\n}\n\nexport function resolveRuntimePageLayoutName(layout: string | false) {\n return layout === false ? WEVU_PAGE_LAYOUT_NONE : layout\n}\n"],"mappings":";;;;;;;;AAgDA,SAAS,6BAA6B;CACpC,MAAM,qBAAqB,uBAAuB;CAClD,IAAI,oBACF,OAAO;CAET,MAAM,QAAQ,2BAA2B;CACzC,OAAO,MAAM,MAAM,SAAS;AAC9B;AAEA,SAAS,+BAA+B,QAA4B;CAClE,OAAO,WAAW,wBAAwB,QAAQ;AACpD;;;;AAKA,SAAgB,gBAA2C;;CACzD,IAAI,CAAC,uBAAuB,GAC1B,MAAM,IAAI,MAAM,qCAAqC;CAGvD,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,kGAAe,gBAAiB,sFAAQ;CAC9C,MAAM,kBAAkB,SAAiC;EACvD,MAAM,2FAA+B,aAAe,0BAA0B;EAC9E,OAAO,EAAE,wFAAI,aAAe,oGAA+B,CAAC,EAAG;CACjE,CAAC;CAED,IAAI,iBACF,gBAAgB,wBAAwB;CAG1C,OAAO,SAAS,eAAe;AACjC;AAEA,SAAgB,2BAA2B,QAA6B,QAAwB,OAAwB;CACtH,MAAM,QAAQ,OAAO;CACrB,IAAI,CAAC,OACH;CAEF,MAAM,OAAO;CACb,MAAM,QAAQ,EAAE,GAAG,MAAM;AAC3B;AAEA,SAAgB,sCAAsC,QAA6B;;CACjF,MAAM,QAAQ,OAAO;CACrB,MAAM,iCAAe,OAAO,wEAAQ;CACpC,IAAI,CAAC,SAAS,CAAC,cACb;CAEF,MAAM,OAAO,+BAA+B,aAAa,0BAA0B;CACnF,MAAM,QAAQ,EAAE,6BAAI,aAAa,sGAA+B,CAAC,EAAG;AACtE;;;;AAQA,SAAgB,cAAc,QAAwB,OAA+B;CACnF,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,iFAAe,gBAAkB;CACvC,IAAI,OAAO,iBAAiB,YAAY;EACtC,aAAa,QAAQ,KAAK;EAC1B;CACF;CAEA,MAAM,cAAc,2BAA2B;CAC/C,MAAM,uEAAa,YAAc;CACjC,IAAI,OAAO,eAAe,YAAY;EACpC,WAAW,QAAQ,KAAK;EACxB;CACF;CAEA,MAAM,IAAI,MAAM,yDAAyD;AAC3E;AAEA,SAAgB,6BAA6B,QAAwB;CACnE,OAAO,WAAW,QAAQ,wBAAwB;AACpD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HostMiniProgramPageScrollOption } from "./types/miniprogramHost.mjs";
|
|
2
|
+
import "./types.mjs";
|
|
3
|
+
//#region src/runtime/pageScroll.d.ts
|
|
4
|
+
export interface UsePageScrollThrottleOptions {
|
|
5
|
+
/**
|
|
6
|
+
* 节流间隔(毫秒),默认 80ms。
|
|
7
|
+
*/
|
|
8
|
+
interval?: number;
|
|
9
|
+
/**
|
|
10
|
+
* 是否在窗口起始边缘立即触发,默认 true。
|
|
11
|
+
*/
|
|
12
|
+
leading?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 是否在窗口结束边缘补一次回调,默认 true。
|
|
15
|
+
*/
|
|
16
|
+
trailing?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 持续滚动时的最大等待时间(毫秒)。
|
|
19
|
+
* 当 trailing 为 false 时,可用于兜底触发一次回调。
|
|
20
|
+
*/
|
|
21
|
+
maxWait?: number;
|
|
22
|
+
}
|
|
23
|
+
export type UsePageScrollThrottleStopHandle = () => void;
|
|
24
|
+
/**
|
|
25
|
+
* 在 setup 中注册节流后的 onPageScroll 监听,并在卸载时自动清理。
|
|
26
|
+
*/
|
|
27
|
+
export declare function usePageScrollThrottle(handler: (opt: HostMiniProgramPageScrollOption) => void, options?: UsePageScrollThrottleOptions): UsePageScrollThrottleStopHandle;
|
|
28
|
+
//#endregion
|
|
29
|
+
//# sourceMappingURL=pageScroll.d.mts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { setGlobalProvidedValue } from "./provideStore.mjs";
|
|
2
|
+
//#region src/runtime/provide.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* 判断当前是否存在可用的注入上下文。
|
|
5
|
+
*
|
|
6
|
+
* wevu 的依赖注入上下文来自同步 `setup()` 阶段的当前实例。
|
|
7
|
+
*/
|
|
8
|
+
export declare function hasInjectionContext(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 在组件上下文中向后代注入值(与 Vue 3 行为兼容),若没有当前实例则回落到全局存储。
|
|
11
|
+
*
|
|
12
|
+
* @param key 注入键,可为字符串、Symbol 或对象
|
|
13
|
+
* @param value 提供的值
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* defineComponent({
|
|
18
|
+
* setup() {
|
|
19
|
+
* provide(TOKEN_KEY, { data: 'value' })
|
|
20
|
+
* }
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function provide<T>(key: any, value: T): void;
|
|
25
|
+
/**
|
|
26
|
+
* 从祖先组件(或全局存储)读取提供的值。
|
|
27
|
+
*
|
|
28
|
+
* @param key 注入键,需与 provide 使用的键保持一致
|
|
29
|
+
* @param defaultValue 未找到提供者时的默认值
|
|
30
|
+
* @returns 匹配到的值或默认值
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* defineComponent({
|
|
35
|
+
* setup() {
|
|
36
|
+
* const data = inject(TOKEN_KEY)
|
|
37
|
+
* const value = inject('key', 'default')
|
|
38
|
+
* }
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function inject<T>(key: any, defaultValue: T): T;
|
|
43
|
+
export declare function inject<T>(key: any): T | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* 全局注入值,适用于历史兼容场景。
|
|
46
|
+
*
|
|
47
|
+
* @deprecated 已弃用,仅用于兼容/过渡。推荐优先使用 `provide()`,
|
|
48
|
+
* 在无实例上下文时 `provide()` 会自动回落到全局存储。
|
|
49
|
+
*/
|
|
50
|
+
export declare function provideGlobal<T>(key: any, value: T): void;
|
|
51
|
+
/**
|
|
52
|
+
* 从全局存储读取值,适用于历史兼容场景。
|
|
53
|
+
*
|
|
54
|
+
* @deprecated 已弃用,仅用于兼容/过渡。推荐优先使用 `inject()`,
|
|
55
|
+
* 在无实例上下文时 `inject()` 会自动从全局存储读取。
|
|
56
|
+
*/
|
|
57
|
+
export declare function injectGlobal<T>(key: any, defaultValue?: T): T;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { setGlobalProvidedValue };
|
|
60
|
+
//# sourceMappingURL=provide.d.mts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { setWevuDefaults as setWevuDefaults$1 } from "./defaults.mjs";
|
|
2
|
+
import { createWevuComponent as createWevuComponent$1, defineComponent as defineComponent$1 } from "./define.mjs";
|
|
3
|
+
import { CreateWevuScopedSlotComponentOptions } from "./features/scopedSlots.mjs";
|
|
4
|
+
import { createApp as createApp$1 } from "./app.mjs";
|
|
5
|
+
import { registerApp as registerApp$1 } from "./register/app.mjs";
|
|
6
|
+
import { registerComponent as registerComponent$1 } from "./register/component.mjs";
|
|
7
|
+
import { mountRuntimeInstance as mountRuntimeInstance$1 } from "./register/runtimeInstance.mjs";
|
|
8
|
+
import "./register.mjs";
|
|
9
|
+
//#region src/runtime/publicRuntime.d.ts
|
|
10
|
+
export declare const createApp: typeof createApp$1;
|
|
11
|
+
export declare const defineComponent: typeof defineComponent$1;
|
|
12
|
+
export declare const createWevuComponent: typeof createWevuComponent$1;
|
|
13
|
+
export declare const registerApp: typeof registerApp$1;
|
|
14
|
+
export declare const registerComponent: typeof registerComponent$1;
|
|
15
|
+
export declare const mountRuntimeInstance: typeof mountRuntimeInstance$1;
|
|
16
|
+
export declare const setWevuDefaults: typeof setWevuDefaults$1;
|
|
17
|
+
/**
|
|
18
|
+
* 创建公开入口的作用域插槽组件,并保留历史上的完整能力行为。
|
|
19
|
+
*/
|
|
20
|
+
export declare function createWevuScopedSlotComponent(overrides?: CreateWevuScopedSlotComponentOptions): void;
|
|
21
|
+
//#endregion
|
|
22
|
+
//# sourceMappingURL=publicRuntime.d.mts.map
|