wevu 7.2.2 → 7.3.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 +6 -0
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.mjs +1 -1
- package/dist/dev/internal-runtime.d.mts +2 -1
- package/dist/dev/internal-runtime.mjs +3 -2
- package/dist/dev/package.mjs +1 -1
- package/dist/dev/reactivity/asyncDerivation.mjs +8 -10
- package/dist/dev/reactivity/asyncDerivation.mjs.map +1 -1
- package/dist/dev/reactivity/core.mjs +5 -8
- package/dist/dev/reactivity/core.mjs.map +1 -1
- package/dist/dev/reactivity/reactive/patch.mjs +3 -3
- package/dist/dev/reactivity/reactive/patch.mjs.map +1 -1
- package/dist/dev/reactivity/reactive/patchState.mjs +4 -8
- package/dist/dev/reactivity/reactive/patchState.mjs.map +1 -1
- package/dist/dev/reactivity/reactive/shared.mjs +1 -2
- package/dist/dev/reactivity/reactive/shared.mjs.map +1 -1
- package/dist/dev/reactivity/reactive.mjs +5 -10
- package/dist/dev/reactivity/reactive.mjs.map +1 -1
- package/dist/dev/reactivity/ref.mjs +2 -2
- package/dist/dev/reactivity/ref.mjs.map +1 -1
- package/dist/dev/reactivity/shallowRef.mjs +1 -1
- package/dist/dev/reactivity/shallowRef.mjs.map +1 -1
- package/dist/dev/reactivity/watch/helpers.mjs +1 -1
- package/dist/dev/reactivity/watch/helpers.mjs.map +1 -1
- package/dist/dev/reactivity/watch.mjs +6 -8
- package/dist/dev/reactivity/watch.mjs.map +1 -1
- package/dist/dev/router/createRouter.mjs +17 -24
- package/dist/dev/router/createRouter.mjs.map +1 -1
- package/dist/dev/router/initialNavigation.mjs +18 -16
- package/dist/dev/router/initialNavigation.mjs.map +1 -1
- package/dist/dev/router/instance.mjs +1 -2
- package/dist/dev/router/instance.mjs.map +1 -1
- package/dist/dev/router/navigationCore.mjs +2 -2
- package/dist/dev/router/navigationCore.mjs.map +1 -1
- package/dist/dev/router/navigationResult.mjs +7 -10
- package/dist/dev/router/navigationResult.mjs.map +1 -1
- package/dist/dev/router/navigationTarget.mjs +1 -3
- package/dist/dev/router/navigationTarget.mjs.map +1 -1
- package/dist/dev/router/resolve.mjs +3 -4
- package/dist/dev/router/resolve.mjs.map +1 -1
- package/dist/dev/router/routeRegistry.mjs +1 -1
- package/dist/dev/router/routeRegistry.mjs.map +1 -1
- package/dist/dev/router/routeSync.mjs +1 -1
- package/dist/dev/router/routeSync.mjs.map +1 -1
- package/dist/dev/router/useRoute.mjs +12 -19
- package/dist/dev/router/useRoute.mjs.map +1 -1
- package/dist/dev/routerInternal/location.mjs +2 -3
- package/dist/dev/routerInternal/location.mjs.map +1 -1
- package/dist/dev/routerInternal/params.mjs +2 -3
- package/dist/dev/routerInternal/params.mjs.map +1 -1
- package/dist/dev/routerInternal/records.mjs +1 -1
- package/dist/dev/routerInternal/records.mjs.map +1 -1
- package/dist/dev/routerInternal/recordsWarnings.mjs +1 -2
- package/dist/dev/routerInternal/recordsWarnings.mjs.map +1 -1
- package/dist/dev/runtime/app/context.mjs +13 -26
- package/dist/dev/runtime/app/context.mjs.map +1 -1
- package/dist/dev/runtime/app/diagnostics.mjs +2 -4
- package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
- package/dist/dev/runtime/app/mount.mjs +27 -33
- package/dist/dev/runtime/app/mount.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/commitTracker.mjs +5 -9
- package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/patchScheduler.mjs +2 -4
- package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/payload.mjs +2 -3
- package/dist/dev/runtime/app/setData/payload.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/scheduler.mjs +7 -9
- package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/snapshot.mjs +5 -6
- package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -1
- package/dist/dev/runtime/app/setDataOptions.mjs +26 -27
- package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -1
- package/dist/dev/runtime/app.mjs +9 -9
- package/dist/dev/runtime/app.mjs.map +1 -1
- package/dist/dev/runtime/bindingManifest.mjs +6 -14
- package/dist/dev/runtime/bindingManifest.mjs.map +1 -1
- package/dist/dev/runtime/capabilities.d.mts +4 -1
- package/dist/dev/runtime/capabilities.mjs.map +1 -1
- package/dist/dev/runtime/css.mjs +4 -8
- package/dist/dev/runtime/css.mjs.map +1 -1
- package/dist/dev/runtime/defaults.mjs +4 -4
- package/dist/dev/runtime/defaults.mjs.map +1 -1
- package/dist/dev/runtime/define/initialComputed.mjs +5 -5
- package/dist/dev/runtime/define/initialComputed.mjs.map +1 -1
- package/dist/dev/runtime/define/options.mjs +10 -12
- package/dist/dev/runtime/define/options.mjs.map +1 -1
- package/dist/dev/runtime/define/props.mjs +4 -5
- package/dist/dev/runtime/define/props.mjs.map +1 -1
- package/dist/dev/runtime/define/scopedSlotOptions.mjs +43 -61
- package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
- package/dist/dev/runtime/define/setupResult.mjs +17 -28
- package/dist/dev/runtime/define/setupResult.mjs.map +1 -1
- package/dist/dev/runtime/define.mjs +9 -12
- package/dist/dev/runtime/define.mjs.map +1 -1
- package/dist/dev/runtime/diff.mjs +9 -11
- package/dist/dev/runtime/diff.mjs.map +1 -1
- package/dist/dev/runtime/disposables.mjs +2 -2
- package/dist/dev/runtime/disposables.mjs.map +1 -1
- package/dist/dev/runtime/elementIntersectionObserver.mjs +16 -24
- package/dist/dev/runtime/elementIntersectionObserver.mjs.map +1 -1
- package/dist/dev/runtime/features/inlineEvents.mjs +2 -3
- package/dist/dev/runtime/features/inlineEvents.mjs.map +1 -1
- package/dist/dev/runtime/features/jsxIslands.d.mts +7 -0
- package/dist/dev/runtime/features/jsxIslands.mjs +20 -0
- package/dist/dev/runtime/features/jsxIslands.mjs.map +1 -0
- package/dist/dev/runtime/features/layout.mjs +2 -3
- package/dist/dev/runtime/features/layout.mjs.map +1 -1
- package/dist/dev/runtime/features/publicLayout.mjs +2 -6
- package/dist/dev/runtime/features/publicLayout.mjs.map +1 -1
- package/dist/dev/runtime/features/scopedSlots.mjs +5 -9
- package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/features/templateRefs.mjs +1 -1
- package/dist/dev/runtime/features/templateRefs.mjs.map +1 -1
- package/dist/dev/runtime/hooks/base.mjs +21 -32
- package/dist/dev/runtime/hooks/base.mjs.map +1 -1
- package/dist/dev/runtime/inlineDataset.mjs +1 -2
- package/dist/dev/runtime/inlineDataset.mjs.map +1 -1
- package/dist/dev/runtime/intersectionObserver.mjs +6 -6
- package/dist/dev/runtime/intersectionObserver.mjs.map +1 -1
- package/dist/dev/runtime/jsxIsland.mjs +16 -33
- package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
- package/dist/dev/runtime/layoutBridge.mjs +32 -62
- package/dist/dev/runtime/layoutBridge.mjs.map +1 -1
- package/dist/dev/runtime/nativeBridge.mjs +1 -1
- package/dist/dev/runtime/nativeBridge.mjs.map +1 -1
- package/dist/dev/runtime/navigationLifecycle.mjs +24 -0
- package/dist/dev/runtime/navigationLifecycle.mjs.map +1 -0
- package/dist/dev/runtime/pageEnvironment.mjs +15 -18
- package/dist/dev/runtime/pageEnvironment.mjs.map +1 -1
- package/dist/dev/runtime/pageLayout.mjs +7 -11
- package/dist/dev/runtime/pageLayout.mjs.map +1 -1
- package/dist/dev/runtime/pageScroll.mjs +2 -3
- package/dist/dev/runtime/pageScroll.mjs.map +1 -1
- package/dist/dev/runtime/platform/current.mjs +12 -0
- package/dist/dev/runtime/platform/current.mjs.map +1 -0
- package/dist/dev/runtime/platform/generic.mjs +36 -0
- package/dist/dev/runtime/platform/generic.mjs.map +1 -0
- package/dist/dev/runtime/platform/globals.mjs +29 -0
- package/dist/dev/runtime/platform/globals.mjs.map +1 -0
- package/dist/dev/runtime/platform.mjs +15 -60
- package/dist/dev/runtime/platform.mjs.map +1 -1
- package/dist/dev/runtime/provideContext.mjs +7 -9
- package/dist/dev/runtime/provideContext.mjs.map +1 -1
- package/dist/dev/runtime/publicRuntime.mjs +4 -0
- package/dist/dev/runtime/publicRuntime.mjs.map +1 -1
- package/dist/dev/runtime/pullDownRefresh.mjs +2 -4
- package/dist/dev/runtime/pullDownRefresh.mjs.map +1 -1
- package/dist/dev/runtime/register/app.mjs +18 -19
- package/dist/dev/runtime/register/app.mjs.map +1 -1
- package/dist/dev/runtime/register/component/alipay.mjs +9 -18
- package/dist/dev/runtime/register/component/alipay.mjs.map +1 -1
- package/dist/dev/runtime/register/component/alipayRegistration.mjs +60 -0
- package/dist/dev/runtime/register/component/alipayRegistration.mjs.map +1 -0
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs +8 -9
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs.map +1 -1
- package/dist/dev/runtime/register/component/lifecycle.mjs +7 -12
- package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
- package/dist/dev/runtime/register/component/methods.mjs +13 -18
- package/dist/dev/runtime/register/component/methods.mjs.map +1 -1
- package/dist/dev/runtime/register/component/options.mjs +3 -4
- package/dist/dev/runtime/register/component/options.mjs.map +1 -1
- package/dist/dev/runtime/register/component/props.mjs +25 -31
- package/dist/dev/runtime/register/component/props.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +18 -40
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerNativeDefinition.mjs +18 -60
- package/dist/dev/runtime/register/component/registerNativeDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component.mjs +3 -5
- package/dist/dev/runtime/register/component.mjs.map +1 -1
- package/dist/dev/runtime/register/inline.mjs +8 -10
- package/dist/dev/runtime/register/inline.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +7 -8
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +1 -1
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +25 -34
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +6 -13
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +2 -2
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs +9 -9
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance.mjs +74 -100
- package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs +12 -15
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -1
- package/dist/dev/runtime/register/setup.mjs +2 -3
- package/dist/dev/runtime/register/setup.mjs.map +1 -1
- package/dist/dev/runtime/register/snapshot.mjs +1 -4
- package/dist/dev/runtime/register/snapshot.mjs.map +1 -1
- package/dist/dev/runtime/register/watch.mjs +3 -5
- package/dist/dev/runtime/register/watch.mjs.map +1 -1
- package/dist/dev/runtime/scopedSlots.mjs +14 -21
- package/dist/dev/runtime/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/selectorQuery.mjs +5 -9
- package/dist/dev/runtime/selectorQuery.mjs.map +1 -1
- package/dist/dev/runtime/template.mjs +1 -1
- package/dist/dev/runtime/template.mjs.map +1 -1
- package/dist/dev/runtime/templateRefs/helpers.mjs +14 -24
- package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -1
- package/dist/dev/runtime/templateRefs.mjs +8 -15
- package/dist/dev/runtime/templateRefs.mjs.map +1 -1
- package/dist/dev/runtime/uniAppHost.mjs +6 -14
- package/dist/dev/runtime/uniAppHost.mjs.map +1 -1
- package/dist/dev/runtime/updatePerformance.mjs +1 -1
- package/dist/dev/runtime/updatePerformance.mjs.map +1 -1
- package/dist/dev/runtime/use.mjs +1 -1
- package/dist/dev/runtime/use.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/context.mjs +3 -5
- package/dist/dev/runtime/vueCompat/context.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/model.mjs +9 -13
- package/dist/dev/runtime/vueCompat/model.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/router.mjs +4 -4
- package/dist/dev/runtime/vueCompat/router.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/templateRef.mjs +1 -1
- package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -1
- package/dist/dev/scheduler.mjs +3 -4
- package/dist/dev/scheduler.mjs.map +1 -1
- package/dist/dev/store/base.mjs +1 -2
- package/dist/dev/store/base.mjs.map +1 -1
- package/dist/dev/store/define/create.mjs +11 -22
- package/dist/dev/store/define/create.mjs.map +1 -1
- package/dist/dev/store/define.mjs +1 -1
- package/dist/dev/store/define.mjs.map +1 -1
- package/dist/dev/store/view.mjs +1 -1
- package/dist/dev/store/view.mjs.map +1 -1
- package/dist/internal-runtime.d.mts +2 -1
- package/dist/internal-runtime.mjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/reactivity/asyncDerivation.mjs +1 -1
- package/dist/reactivity/core.mjs +1 -1
- package/dist/reactivity/reactive/patch.mjs +1 -1
- package/dist/reactivity/reactive/patchState.mjs +1 -1
- package/dist/reactivity/reactive/shared.mjs +1 -1
- package/dist/reactivity/reactive.mjs +1 -1
- package/dist/reactivity/ref.mjs +1 -1
- package/dist/reactivity/shallowRef.mjs +1 -1
- package/dist/reactivity/watch/helpers.mjs +1 -1
- package/dist/reactivity/watch.mjs +1 -1
- package/dist/router/createRouter.mjs +1 -1
- package/dist/router/initialNavigation.mjs +1 -1
- package/dist/router/instance.mjs +1 -1
- package/dist/router/navigationCore.mjs +1 -1
- package/dist/router/navigationResult.mjs +1 -1
- package/dist/router/navigationTarget.mjs +1 -1
- package/dist/router/resolve.mjs +1 -1
- package/dist/router/routeRegistry.mjs +1 -1
- package/dist/router/routeSync.mjs +1 -1
- package/dist/router/useRoute.mjs +1 -1
- package/dist/routerInternal/location.mjs +1 -1
- package/dist/routerInternal/params.mjs +1 -1
- package/dist/routerInternal/records.mjs +1 -1
- package/dist/routerInternal/recordsWarnings.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.mjs +1 -1
- package/dist/runtime/app/setData/patchScheduler.mjs +1 -1
- package/dist/runtime/app/setData/payload.mjs +1 -1
- package/dist/runtime/app/setData/scheduler.mjs +1 -1
- package/dist/runtime/app/setData/snapshot.mjs +1 -1
- package/dist/runtime/app/setDataOptions.mjs +1 -1
- package/dist/runtime/app.mjs +1 -1
- package/dist/runtime/bindingManifest.mjs +1 -1
- package/dist/runtime/capabilities.d.mts +4 -1
- package/dist/runtime/css.mjs +1 -1
- package/dist/runtime/defaults.mjs +1 -1
- package/dist/runtime/define/initialComputed.mjs +1 -1
- package/dist/runtime/define/options.mjs +1 -1
- package/dist/runtime/define/props.mjs +1 -1
- package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
- package/dist/runtime/define/setupResult.mjs +1 -1
- package/dist/runtime/define.mjs +1 -1
- package/dist/runtime/diff.mjs +1 -1
- package/dist/runtime/disposables.mjs +1 -1
- package/dist/runtime/elementIntersectionObserver.mjs +1 -1
- package/dist/runtime/features/inlineEvents.mjs +1 -1
- package/dist/runtime/features/jsxIslands.d.mts +6 -0
- package/dist/runtime/features/jsxIslands.mjs +1 -0
- package/dist/runtime/features/layout.mjs +1 -1
- package/dist/runtime/features/publicLayout.mjs +1 -1
- package/dist/runtime/features/scopedSlots.mjs +1 -1
- package/dist/runtime/features/templateRefs.mjs +1 -1
- package/dist/runtime/hooks/base.mjs +1 -1
- package/dist/runtime/inlineDataset.mjs +1 -1
- package/dist/runtime/intersectionObserver.mjs +1 -1
- package/dist/runtime/jsxIsland.mjs +1 -1
- package/dist/runtime/layoutBridge.mjs +1 -1
- package/dist/runtime/nativeBridge.mjs +1 -1
- package/dist/runtime/navigationLifecycle.mjs +1 -0
- package/dist/runtime/pageEnvironment.mjs +1 -1
- package/dist/runtime/pageLayout.mjs +1 -1
- package/dist/runtime/pageScroll.mjs +1 -1
- package/dist/runtime/platform/current.mjs +1 -0
- package/dist/runtime/platform/generic.mjs +1 -0
- package/dist/runtime/platform/globals.mjs +1 -0
- package/dist/runtime/platform.mjs +1 -1
- package/dist/runtime/provideContext.mjs +1 -1
- package/dist/runtime/publicRuntime.mjs +1 -1
- package/dist/runtime/pullDownRefresh.mjs +1 -1
- package/dist/runtime/register/app.mjs +1 -1
- package/dist/runtime/register/component/alipay.mjs +1 -1
- package/dist/runtime/register/component/alipayRegistration.mjs +1 -0
- package/dist/runtime/register/component/lifecycle/platform.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/options.mjs +1 -1
- package/dist/runtime/register/component/props.mjs +1 -1
- package/dist/runtime/register/component/registerDefinition.mjs +1 -1
- package/dist/runtime/register/component/registerNativeDefinition.mjs +1 -1
- package/dist/runtime/register/component.mjs +1 -1
- package/dist/runtime/register/inline.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/provideContext.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 -1
- package/dist/runtime/register/runtimeInstance/utils.mjs +1 -1
- package/dist/runtime/register/runtimeInstance.mjs +1 -1
- package/dist/runtime/register/setDataFrequencyWarning.mjs +1 -1
- package/dist/runtime/register/setup.mjs +1 -1
- package/dist/runtime/register/snapshot.mjs +1 -1
- package/dist/runtime/register/watch.mjs +1 -1
- package/dist/runtime/scopedSlots.mjs +1 -1
- package/dist/runtime/selectorQuery.mjs +1 -1
- package/dist/runtime/template.mjs +1 -1
- package/dist/runtime/templateRefs/helpers.mjs +1 -1
- package/dist/runtime/templateRefs.mjs +1 -1
- package/dist/runtime/uniAppHost.mjs +1 -1
- package/dist/runtime/updatePerformance.mjs +1 -1
- package/dist/runtime/use.mjs +1 -1
- package/dist/runtime/vueCompat/context.mjs +1 -1
- package/dist/runtime/vueCompat/model.mjs +1 -1
- package/dist/runtime/vueCompat/router.mjs +1 -1
- package/dist/runtime/vueCompat/templateRef.mjs +1 -1
- package/dist/scheduler.mjs +1 -1
- package/dist/store/base.mjs +1 -1
- package/dist/store/define/create.mjs +1 -1
- package/dist/store/define.mjs +1 -1
- package/dist/store/view.mjs +1 -1
- package/package.json +7 -7
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.mjs +0 -0
|
@@ -1,71 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { resolveCurrentMiniProgramPlatform } from "../../platform/current.mjs";
|
|
2
|
+
import { getMiniProgramRuntimeGlobalObject } from "../../platform.mjs";
|
|
3
|
+
import { registerAlipayComponentDefinition } from "./alipayRegistration.mjs";
|
|
3
4
|
import { WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY } from "@weapp-core/constants";
|
|
4
5
|
|
|
5
6
|
//#region src/runtime/register/component/registerNativeDefinition.ts
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
...pageDefinition,
|
|
11
|
-
...methods,
|
|
12
|
-
onLoad(...args) {
|
|
13
|
-
var _lifetimes$created, _lifetimes$attached;
|
|
14
|
-
this.options = args[0] && typeof args[0] === "object" ? args[0] : {};
|
|
15
|
-
(_lifetimes$created = lifetimes.created) === null || _lifetimes$created === void 0 || _lifetimes$created.apply(this, args);
|
|
16
|
-
const result = pageOnLoad === null || pageOnLoad === void 0 ? void 0 : pageOnLoad.apply(this, args);
|
|
17
|
-
(_lifetimes$attached = lifetimes.attached) === null || _lifetimes$attached === void 0 || _lifetimes$attached.apply(this, args);
|
|
18
|
-
return result;
|
|
19
|
-
},
|
|
20
|
-
onShow(...args) {
|
|
21
|
-
var _pageLifetimes$show;
|
|
22
|
-
return (_pageLifetimes$show = pageLifetimes.show) === null || _pageLifetimes$show === void 0 ? void 0 : _pageLifetimes$show.apply(this, args);
|
|
23
|
-
},
|
|
24
|
-
onReady(...args) {
|
|
25
|
-
var _lifetimes$ready;
|
|
26
|
-
return (_lifetimes$ready = lifetimes.ready) === null || _lifetimes$ready === void 0 ? void 0 : _lifetimes$ready.apply(this, args);
|
|
27
|
-
},
|
|
28
|
-
onHide(...args) {
|
|
29
|
-
var _pageLifetimes$hide;
|
|
30
|
-
return (_pageLifetimes$hide = pageLifetimes.hide) === null || _pageLifetimes$hide === void 0 ? void 0 : _pageLifetimes$hide.apply(this, args);
|
|
31
|
-
},
|
|
32
|
-
onResize(...args) {
|
|
33
|
-
var _pageLifetimes$resize;
|
|
34
|
-
return (_pageLifetimes$resize = pageLifetimes.resize) === null || _pageLifetimes$resize === void 0 ? void 0 : _pageLifetimes$resize.apply(this, args);
|
|
35
|
-
},
|
|
36
|
-
onUnload(...args) {
|
|
37
|
-
var _lifetimes$detached;
|
|
38
|
-
return (_lifetimes$detached = lifetimes.detached) === null || _lifetimes$detached === void 0 ? void 0 : _lifetimes$detached.apply(this, args);
|
|
39
|
-
},
|
|
40
|
-
onError(...args) {
|
|
41
|
-
var _lifetimes$error;
|
|
42
|
-
return (_lifetimes$error = lifetimes.error) === null || _lifetimes$error === void 0 ? void 0 : _lifetimes$error.apply(this, args);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* 根据当前宿主注册 wevu 原生定义。
|
|
48
|
-
* 支付宝不支持使用 Component() 注册普通页面,需要转换为 Page() 契约。
|
|
49
|
-
*/
|
|
50
|
-
function registerNativeComponentDefinition(componentDefinition, isPage) {
|
|
51
|
-
var _getMiniProgramRuntim;
|
|
52
|
-
const statefulHmrBridge = (_getMiniProgramRuntim = getMiniProgramRuntimeGlobalObject()) === null || _getMiniProgramRuntim === void 0 ? void 0 : _getMiniProgramRuntim[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY];
|
|
53
|
-
if (isPage && resolveCurrentMiniProgramPlatform() === "alipay") {
|
|
54
|
-
const pageDefinition = createAlipayPageDefinition(componentDefinition);
|
|
55
|
-
if (typeof (statefulHmrBridge === null || statefulHmrBridge === void 0 ? void 0 : statefulHmrBridge.Page) === "function") {
|
|
56
|
-
statefulHmrBridge.Page(pageDefinition);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
Page(pageDefinition);
|
|
7
|
+
function registerWechatCompatibleComponentDefinition(componentDefinition) {
|
|
8
|
+
const statefulHmrBridge = getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY];
|
|
9
|
+
if (typeof statefulHmrBridge?.Component === "function") {
|
|
10
|
+
statefulHmrBridge.Component(componentDefinition);
|
|
60
11
|
return;
|
|
61
12
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
13
|
+
Component(componentDefinition);
|
|
14
|
+
}
|
|
15
|
+
function registerDetectedComponentDefinition(componentDefinition, isPage) {
|
|
16
|
+
if (resolveCurrentMiniProgramPlatform() === "alipay") {
|
|
17
|
+
registerAlipayComponentDefinition(componentDefinition, isPage);
|
|
65
18
|
return;
|
|
66
19
|
}
|
|
67
|
-
|
|
20
|
+
registerWechatCompatibleComponentDefinition(componentDefinition);
|
|
68
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* 按编译目标选择宿主注册器,未声明目标时保留运行时探测。
|
|
24
|
+
* 支付宝页面使用 Page 契约,Web 由自己的 Component bridge 接管。
|
|
25
|
+
*/
|
|
26
|
+
const registerNativeComponentDefinition = import.meta.env?.PLATFORM === "alipay" ? registerAlipayComponentDefinition : import.meta.env?.PLATFORM === "weapp" || import.meta.env?.PLATFORM === "tt" || import.meta.env?.PLATFORM === "swan" || import.meta.env?.PLATFORM === "jd" || import.meta.env?.PLATFORM === "xhs" || import.meta.env?.PLATFORM === "web" ? registerWechatCompatibleComponentDefinition : registerDetectedComponentDefinition;
|
|
69
27
|
|
|
70
28
|
//#endregion
|
|
71
29
|
export { registerNativeComponentDefinition };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerNativeDefinition.mjs","names":[],"sources":["../../../../../src/runtime/register/component/registerNativeDefinition.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"registerNativeDefinition.mjs","names":[],"sources":["../../../../../src/runtime/register/component/registerNativeDefinition.ts"],"sourcesContent":["import { WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY } from '@weapp-core/constants'\nimport { getMiniProgramRuntimeGlobalObject, resolveCurrentMiniProgramPlatform } from '../../platform'\nimport { registerAlipayComponentDefinition } from './alipayRegistration'\n\ntype ImportMetaWithEnv = ImportMeta & { env?: { PLATFORM?: string } }\ntype RegisterComponentDefinition = (componentDefinition: Record<string, any>, isPage: boolean) => void\n\nfunction registerWechatCompatibleComponentDefinition(componentDefinition: Record<string, any>) {\n const statefulHmrBridge = getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]\n if (typeof statefulHmrBridge?.Component === 'function') {\n statefulHmrBridge.Component(componentDefinition)\n return\n }\n Component(componentDefinition)\n}\n\nfunction registerDetectedComponentDefinition(componentDefinition: Record<string, any>, isPage: boolean) {\n if (resolveCurrentMiniProgramPlatform() === 'alipay') {\n registerAlipayComponentDefinition(componentDefinition, isPage)\n return\n }\n registerWechatCompatibleComponentDefinition(componentDefinition)\n}\n\n/**\n * 按编译目标选择宿主注册器,未声明目标时保留运行时探测。\n * 支付宝页面使用 Page 契约,Web 由自己的 Component bridge 接管。\n */\nexport const registerNativeComponentDefinition: RegisterComponentDefinition\n = (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'alipay'\n ? registerAlipayComponentDefinition\n : (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'weapp'\n || (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'tt'\n || (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'swan'\n || (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'jd'\n || (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'xhs'\n || (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'web'\n ? registerWechatCompatibleComponentDefinition\n : registerDetectedComponentDefinition\n"],"mappings":";;;;;;AAOA,SAAS,4CAA4C,qBAA0C;CAC7F,MAAM,oBAAoB,kCAAkC,CAAC,GAAG;CAChE,IAAI,OAAO,mBAAmB,cAAc,YAAY;EACtD,kBAAkB,UAAU,mBAAmB;EAC/C;CACF;CACA,UAAU,mBAAmB;AAC/B;AAEA,SAAS,oCAAoC,qBAA0C,QAAiB;CACtG,IAAI,kCAAkC,MAAM,UAAU;EACpD,kCAAkC,qBAAqB,MAAM;EAC7D;CACF;CACA,4CAA4C,mBAAmB;AACjE;;;;;AAMA,MAAa,oCACR,YAAkC,KAAK,aAAa,WACnD,oCACC,YAAkC,KAAK,aAAa,WACjD,YAAkC,KAAK,aAAa,QACpD,YAAkC,KAAK,aAAa,UACpD,YAAkC,KAAK,aAAa,QACpD,YAAkC,KAAK,aAAa,SACpD,YAAkC,KAAK,aAAa,QACpD,8CACA"}
|
|
@@ -12,7 +12,6 @@ import { WEVU_EXPOSED_KEY, WEVU_HOOKS_KEY } from "@weapp-core/constants";
|
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
14
|
function registerComponent(runtimeApp, methods, watch, setup, mpOptions, options = {}) {
|
|
15
|
-
var _multipleSlots;
|
|
16
15
|
const { userMethods, userLifetimes, userPageLifetimes, userOptions, restOptions, topLevelMethods, templateRefs, layoutHosts, propsAliases, propsDerivedKeys, userObservers, setupLifecycle, vueLifecycles, isPage, features, userOnLoad, userOnUnload, userOnShow, userOnHide, userOnReady, userOnSaveExitState, userOnPullDownRefresh, userOnReachBottom, userOnPageScroll, userOnRouteDone, userOnTabItemTap, userOnResize, userOnShareAppMessage, userOnShareTimeline, userOnAddToFavorites, applyExtraInstanceFields } = prepareComponentOptions(mpOptions);
|
|
17
16
|
const { enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnRouteDoneFallback, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, enableOnSaveExitState, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites } = resolveComponentFeatures({
|
|
18
17
|
features,
|
|
@@ -38,18 +37,17 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions, options
|
|
|
38
37
|
{
|
|
39
38
|
const userExport = restOptions.export;
|
|
40
39
|
restOptions.export = function __wevu_export() {
|
|
41
|
-
|
|
42
|
-
const exposed = (_WEVU_EXPOSED_KEY = this[WEVU_EXPOSED_KEY]) !== null && _WEVU_EXPOSED_KEY !== void 0 ? _WEVU_EXPOSED_KEY : {};
|
|
40
|
+
const exposed = this[WEVU_EXPOSED_KEY] ?? {};
|
|
43
41
|
const base = typeof userExport === "function" ? userExport.call(this) : {};
|
|
44
42
|
if (base && typeof base === "object" && !Array.isArray(base)) return {
|
|
45
43
|
...exposed,
|
|
46
44
|
...base
|
|
47
45
|
};
|
|
48
|
-
return base
|
|
46
|
+
return base ?? exposed;
|
|
49
47
|
};
|
|
50
48
|
}
|
|
51
49
|
const finalOptions = {
|
|
52
|
-
multipleSlots:
|
|
50
|
+
multipleSlots: userOptions.multipleSlots ?? true,
|
|
53
51
|
...userOptions
|
|
54
52
|
};
|
|
55
53
|
const { attachWevuPropKeys, directPropsDerivedKeys, syncWevuPropsFromInstance, syncWevuPropsFromValues, finalObservers } = createPropsSync({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.mjs","names":[],"sources":["../../../../src/runtime/register/component.ts"],"sourcesContent":["import type { ComponentPropsOptions, ComputedDefinitions, DefineComponentOptions, InternalRuntimeState, MethodDefinitions, MiniProgramComponentRawOptions, RuntimeApp } from '../types'\nimport type { WatchMap } from './watch'\nimport { WEVU_EXPOSED_KEY, WEVU_HOOKS_KEY } from '@weapp-core/constants'\nimport { resolveComponentFeatures } from './component/features'\nimport { createPageLifecycleHooks } from './component/lifecycle'\nimport { createComponentMethods } from './component/methods'\nimport { getRuntimeOwnerLabel, prepareComponentOptions } from './component/options'\nimport { createPropsSync } from './component/props'\nimport { registerComponentDefinition } from './component/registerDefinition'\n\n/**\n * 注册组件入口(框架内部使用)。\n * @internal\n */\nexport function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n runtimeApp: RuntimeApp<D, C, M>,\n methods: MethodDefinitions,\n watch: WatchMap | undefined,\n setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'],\n mpOptions: MiniProgramComponentRawOptions,\n options: { registerNative?: boolean } = {},\n) {\n const {\n userMethods,\n userLifetimes,\n userPageLifetimes,\n userOptions,\n restOptions,\n topLevelMethods,\n templateRefs,\n layoutHosts,\n propsAliases,\n propsDerivedKeys,\n userObservers,\n setupLifecycle,\n vueLifecycles,\n isPage,\n features,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n userOnSaveExitState,\n userOnPullDownRefresh,\n userOnReachBottom,\n userOnPageScroll,\n userOnRouteDone,\n userOnTabItemTap,\n userOnResize,\n userOnShareAppMessage,\n userOnShareTimeline,\n userOnAddToFavorites,\n applyExtraInstanceFields,\n } = prepareComponentOptions(mpOptions)\n\n const {\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n enableOnSaveExitState,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n } = resolveComponentFeatures({\n features,\n userOnSaveExitState,\n userOnPullDownRefresh,\n userOnReachBottom,\n userOnPageScroll,\n userOnRouteDone,\n userOnTabItemTap,\n userOnResize,\n userOnShareAppMessage,\n userOnShareTimeline,\n userOnAddToFavorites,\n })\n\n const hasHook = (target: InternalRuntimeState, name: string) => {\n const hooks = target[WEVU_HOOKS_KEY]\n if (!hooks) {\n return false\n }\n const entry = (hooks as any)[name]\n if (!entry) {\n return false\n }\n if (Array.isArray(entry)) {\n return entry.length > 0\n }\n return typeof entry === 'function'\n }\n\n // 自动对齐 Vue 3 的 expose:\n // - 若用户未提供 component-export 的 export(),默认返回 setup() 中 expose() 写入的 __wevuExposed\n // - 若用户同时提供 export() 与 expose(),则自动浅合并(export() 优先级更高)\n {\n const userExport = (restOptions as any).export\n ;(restOptions as any).export = function __wevu_export(this: InternalRuntimeState) {\n const exposed = (this as any)[WEVU_EXPOSED_KEY] ?? {}\n const base = typeof userExport === 'function' ? userExport.call(this) : {}\n\n if (base && typeof base === 'object' && !Array.isArray(base)) {\n return {\n ...exposed,\n ...base,\n }\n }\n\n // 若用户 export() 返回非对象(理论上不应发生),则保持原返回值;否则回退 exposed\n return base ?? exposed\n }\n }\n\n // 默认启用多 slot 以兼容微信小程序具名插槽写法;用户显式配置时保持原值\n const finalOptions = {\n multipleSlots: (userOptions as any).multipleSlots ?? true,\n ...(userOptions as any),\n }\n\n const { attachWevuPropKeys, directPropsDerivedKeys, syncWevuPropsFromInstance, syncWevuPropsFromValues, finalObservers } = createPropsSync({\n restOptions,\n propsAliases,\n propsDerivedKeys,\n userObservers,\n })\n\n const { finalMethods } = createComponentMethods({\n userMethods: {\n ...topLevelMethods,\n ...userMethods,\n },\n runtimeMethods: methods,\n })\n\n const pageLifecycleHooks = createPageLifecycleHooks({\n runtimeApp,\n watch,\n setup,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n isPage,\n enableOnSaveExitState,\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n syncWevuPropsFromValues,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n hasHook,\n })\n\n return registerComponentDefinition({\n runtimeApp,\n watch,\n setup,\n restOptions,\n pageLifecycleHooks,\n finalObservers,\n userLifetimes,\n userPageLifetimes,\n finalMethods,\n finalOptions,\n applyExtraInstanceFields,\n templateRefs,\n layoutHosts,\n attachWevuPropKeys,\n setupLifecycle,\n syncWevuPropsFromInstance,\n syncWevuPropsFromValues,\n directPropsDerivedKeys,\n isPage,\n vueLifecycles,\n getRuntimeOwnerLabel,\n registerNative: options.registerNative,\n })\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,kBACd,YACA,SACA,OACA,OACA,WACA,UAAwC,CAAC,GACzC
|
|
1
|
+
{"version":3,"file":"component.mjs","names":[],"sources":["../../../../src/runtime/register/component.ts"],"sourcesContent":["import type { ComponentPropsOptions, ComputedDefinitions, DefineComponentOptions, InternalRuntimeState, MethodDefinitions, MiniProgramComponentRawOptions, RuntimeApp } from '../types'\nimport type { WatchMap } from './watch'\nimport { WEVU_EXPOSED_KEY, WEVU_HOOKS_KEY } from '@weapp-core/constants'\nimport { resolveComponentFeatures } from './component/features'\nimport { createPageLifecycleHooks } from './component/lifecycle'\nimport { createComponentMethods } from './component/methods'\nimport { getRuntimeOwnerLabel, prepareComponentOptions } from './component/options'\nimport { createPropsSync } from './component/props'\nimport { registerComponentDefinition } from './component/registerDefinition'\n\n/**\n * 注册组件入口(框架内部使用)。\n * @internal\n */\nexport function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n runtimeApp: RuntimeApp<D, C, M>,\n methods: MethodDefinitions,\n watch: WatchMap | undefined,\n setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'],\n mpOptions: MiniProgramComponentRawOptions,\n options: { registerNative?: boolean } = {},\n) {\n const {\n userMethods,\n userLifetimes,\n userPageLifetimes,\n userOptions,\n restOptions,\n topLevelMethods,\n templateRefs,\n layoutHosts,\n propsAliases,\n propsDerivedKeys,\n userObservers,\n setupLifecycle,\n vueLifecycles,\n isPage,\n features,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n userOnSaveExitState,\n userOnPullDownRefresh,\n userOnReachBottom,\n userOnPageScroll,\n userOnRouteDone,\n userOnTabItemTap,\n userOnResize,\n userOnShareAppMessage,\n userOnShareTimeline,\n userOnAddToFavorites,\n applyExtraInstanceFields,\n } = prepareComponentOptions(mpOptions)\n\n const {\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n enableOnSaveExitState,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n } = resolveComponentFeatures({\n features,\n userOnSaveExitState,\n userOnPullDownRefresh,\n userOnReachBottom,\n userOnPageScroll,\n userOnRouteDone,\n userOnTabItemTap,\n userOnResize,\n userOnShareAppMessage,\n userOnShareTimeline,\n userOnAddToFavorites,\n })\n\n const hasHook = (target: InternalRuntimeState, name: string) => {\n const hooks = target[WEVU_HOOKS_KEY]\n if (!hooks) {\n return false\n }\n const entry = (hooks as any)[name]\n if (!entry) {\n return false\n }\n if (Array.isArray(entry)) {\n return entry.length > 0\n }\n return typeof entry === 'function'\n }\n\n // 自动对齐 Vue 3 的 expose:\n // - 若用户未提供 component-export 的 export(),默认返回 setup() 中 expose() 写入的 __wevuExposed\n // - 若用户同时提供 export() 与 expose(),则自动浅合并(export() 优先级更高)\n {\n const userExport = (restOptions as any).export\n ;(restOptions as any).export = function __wevu_export(this: InternalRuntimeState) {\n const exposed = (this as any)[WEVU_EXPOSED_KEY] ?? {}\n const base = typeof userExport === 'function' ? userExport.call(this) : {}\n\n if (base && typeof base === 'object' && !Array.isArray(base)) {\n return {\n ...exposed,\n ...base,\n }\n }\n\n // 若用户 export() 返回非对象(理论上不应发生),则保持原返回值;否则回退 exposed\n return base ?? exposed\n }\n }\n\n // 默认启用多 slot 以兼容微信小程序具名插槽写法;用户显式配置时保持原值\n const finalOptions = {\n multipleSlots: (userOptions as any).multipleSlots ?? true,\n ...(userOptions as any),\n }\n\n const { attachWevuPropKeys, directPropsDerivedKeys, syncWevuPropsFromInstance, syncWevuPropsFromValues, finalObservers } = createPropsSync({\n restOptions,\n propsAliases,\n propsDerivedKeys,\n userObservers,\n })\n\n const { finalMethods } = createComponentMethods({\n userMethods: {\n ...topLevelMethods,\n ...userMethods,\n },\n runtimeMethods: methods,\n })\n\n const pageLifecycleHooks = createPageLifecycleHooks({\n runtimeApp,\n watch,\n setup,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n isPage,\n enableOnSaveExitState,\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n syncWevuPropsFromValues,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n hasHook,\n })\n\n return registerComponentDefinition({\n runtimeApp,\n watch,\n setup,\n restOptions,\n pageLifecycleHooks,\n finalObservers,\n userLifetimes,\n userPageLifetimes,\n finalMethods,\n finalOptions,\n applyExtraInstanceFields,\n templateRefs,\n layoutHosts,\n attachWevuPropKeys,\n setupLifecycle,\n syncWevuPropsFromInstance,\n syncWevuPropsFromValues,\n directPropsDerivedKeys,\n isPage,\n vueLifecycles,\n getRuntimeOwnerLabel,\n registerNative: options.registerNative,\n })\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,kBACd,YACA,SACA,OACA,OACA,WACA,UAAwC,CAAC,GACzC;CACA,MAAM,EACJ,aACA,eACA,mBACA,aACA,aACA,iBACA,cACA,aACA,cACA,kBACA,eACA,gBACA,eACA,QACA,UACA,YACA,cACA,YACA,YACA,aACA,qBACA,uBACA,mBACA,kBACA,iBACA,kBACA,cACA,uBACA,qBACA,sBACA,6BACE,wBAAwB,SAAS;CAErC,MAAM,EACJ,yBACA,qBACA,oBACA,mBACA,2BACA,oBACA,gBACA,yBACA,uBACA,wBACA,uBACA,0BACA,4BACA,wBACA,uBACA,sBACA,uBACA,mBACA,4BACA,0BACA,8BACE,yBAAyB;EAC3B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,WAAW,QAA8B,SAAiB;EAC9D,MAAM,QAAQ,OAAO;EACrB,IAAI,CAAC,OACH,OAAO;EAET,MAAM,QAAS,MAAc;EAC7B,IAAI,CAAC,OACH,OAAO;EAET,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,SAAS;EAExB,OAAO,OAAO,UAAU;CAC1B;CAKA;EACE,MAAM,aAAc,YAAoB;EACvC,AAAC,YAAoB,SAAS,SAAS,gBAA0C;GAChF,MAAM,UAAW,KAAa,qBAAqB,CAAC;GACpD,MAAM,OAAO,OAAO,eAAe,aAAa,WAAW,KAAK,IAAI,IAAI,CAAC;GAEzE,IAAI,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI,GACzD,OAAO;IACL,GAAG;IACH,GAAG;GACL;GAIF,OAAO,QAAQ;EACjB;CACF;CAGA,MAAM,eAAe;EACnB,eAAgB,YAAoB,iBAAiB;EACrD,GAAI;CACN;CAEA,MAAM,EAAE,oBAAoB,wBAAwB,2BAA2B,yBAAyB,mBAAmB,gBAAgB;EACzI;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,iBAAiB,uBAAuB;EAC9C,aAAa;GACX,GAAG;GACH,GAAG;EACL;EACA,gBAAgB;CAClB,CAAC;CAED,MAAM,qBAAqB,yBAAyB;EAClD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OAAO,4BAA4B;EACjC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,gBAAgB,QAAQ;CAC1B,CAAC;AACH"}
|
|
@@ -27,8 +27,7 @@ function normalizeResolvedScopeValue(value) {
|
|
|
27
27
|
return value;
|
|
28
28
|
}
|
|
29
29
|
function runInlineExpression(ctx, expr, event, inlineMap) {
|
|
30
|
-
|
|
31
|
-
const dataset = (_ref = (_dataset = event === null || event === void 0 || (_ref2 = event.currentTarget) === null || _ref2 === void 0 ? void 0 : _ref2.dataset) !== null && _dataset !== void 0 ? _dataset : event === null || event === void 0 || (_ref3 = event.target) === null || _ref3 === void 0 ? void 0 : _ref3.dataset) !== null && _ref !== void 0 ? _ref : {};
|
|
30
|
+
const dataset = (event?.currentTarget)?.dataset ?? (event?.target)?.dataset ?? {};
|
|
32
31
|
const inlineEvent = resolveInlineEventArg(event, dataset);
|
|
33
32
|
const inlineId = resolveDatasetEventValue(dataset, "wvInlineId", event);
|
|
34
33
|
if (typeof inlineId === "string" && inlineId && inlineMap) {
|
|
@@ -38,12 +37,12 @@ function runInlineExpression(ctx, expr, event, inlineMap) {
|
|
|
38
37
|
const keys = Array.isArray(entry.keys) ? entry.keys : [];
|
|
39
38
|
for (let i = 0; i < keys.length; i += 1) {
|
|
40
39
|
const key = keys[i];
|
|
41
|
-
scope[key] = dataset
|
|
40
|
+
scope[key] = dataset?.[`wvS${i}`];
|
|
42
41
|
}
|
|
43
42
|
const indexKeys = Array.isArray(entry.indexKeys) ? entry.indexKeys : [];
|
|
44
43
|
for (let i = 0; i < indexKeys.length; i += 1) {
|
|
45
44
|
const indexKey = indexKeys[i];
|
|
46
|
-
const indexValue = resolveDatasetIndex(dataset
|
|
45
|
+
const indexValue = resolveDatasetIndex(dataset?.[`wvI${i}`]);
|
|
47
46
|
if (indexValue !== void 0) scope[indexKey] = indexValue;
|
|
48
47
|
}
|
|
49
48
|
const scopeResolvers = Array.isArray(entry.scopeResolvers) ? entry.scopeResolvers : [];
|
|
@@ -55,11 +54,10 @@ function runInlineExpression(ctx, expr, event, inlineMap) {
|
|
|
55
54
|
if (typeof resolver === "function") resolved = resolver(ctx, scope, inlineEvent);
|
|
56
55
|
else if (resolver && typeof resolver === "object" && resolver.type === "for-item") {
|
|
57
56
|
const index = scope[resolver.indexKey];
|
|
58
|
-
|
|
59
|
-
resolved = list === null || list === void 0 ? void 0 : list[index];
|
|
57
|
+
resolved = getByPath(ctx, resolver.path)?.[index];
|
|
60
58
|
} else continue;
|
|
61
59
|
if (resolved !== void 0) scope[key] = normalizeResolvedScopeValue(resolved);
|
|
62
|
-
} catch
|
|
60
|
+
} catch {}
|
|
63
61
|
}
|
|
64
62
|
const result = entry.fn(ctx, scope, inlineEvent);
|
|
65
63
|
if (typeof result === "function") return result.call(ctx, inlineEvent);
|
|
@@ -74,16 +72,16 @@ function runInlineExpression(ctx, expr, event, inlineMap) {
|
|
|
74
72
|
if (Array.isArray(argsRaw)) args = argsRaw;
|
|
75
73
|
else if (typeof argsRaw === "string") try {
|
|
76
74
|
args = JSON.parse(argsRaw);
|
|
77
|
-
} catch
|
|
75
|
+
} catch {
|
|
78
76
|
try {
|
|
79
77
|
args = JSON.parse(decodeWxmlEntities(argsRaw));
|
|
80
|
-
} catch
|
|
78
|
+
} catch {
|
|
81
79
|
args = [];
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
82
|
if (!Array.isArray(args)) args = [];
|
|
85
83
|
const resolvedArgs = args.map((item) => item === "$event" ? inlineEvent : item);
|
|
86
|
-
const handler = ctx
|
|
84
|
+
const handler = ctx?.[handlerName];
|
|
87
85
|
if (typeof handler === "function") return handler.apply(ctx, resolvedArgs);
|
|
88
86
|
}
|
|
89
87
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.mjs","names":[],"sources":["../../../../src/runtime/register/inline.ts"],"sourcesContent":["import { isRef } from '../../reactivity'\nimport { decodeWxmlEntities, resolveDatasetEventValue, resolveDatasetIndex } from '../inlineDataset'\n\nexport interface InlineExpressionEntry {\n keys: string[]\n indexKeys?: string[]\n scopeResolvers?: Array<InlineExpressionScopeResolver | ((ctx: any, scope: Record<string, any>, event: any) => any) | undefined>\n fn: (ctx: any, scope: Record<string, any>, event: any) => any\n}\n\ninterface InlineExpressionScopeResolver {\n type: 'for-item'\n path: string\n indexKey: string\n}\n\nexport type InlineExpressionMap = Record<string, InlineExpressionEntry>\n\nfunction shouldUseDetailPayload(dataset: Record<string, any>, event: any): boolean {\n const flag = resolveDatasetEventValue(dataset, 'wvEventDetail', event)\n return flag === true || flag === 1 || flag === '1' || flag === 'true'\n}\n\nfunction resolveInlineEventArg(event: any, dataset: Record<string, any>): any {\n if (!shouldUseDetailPayload(dataset, event)) {\n return event\n }\n if (!event || typeof event !== 'object' || !('detail' in event)) {\n return undefined\n }\n return (event as any).detail\n}\n\nfunction getByPath(target: any, path: string) {\n if (!path) {\n return undefined\n }\n const segments = path.split('.').filter(Boolean)\n let current = isRef(target) ? target.value : target\n for (const segment of segments) {\n if (isRef(current)) {\n current = current.value\n }\n if (current == null) {\n return undefined\n }\n current = current[segment]\n }\n if (isRef(current)) {\n return current.value\n }\n return current\n}\n\nfunction normalizeResolvedScopeValue(value: any) {\n return value\n}\n\nexport function runInlineExpression(\n ctx: any,\n expr: unknown,\n event: any,\n inlineMap?: InlineExpressionMap,\n) {\n const dataset = (event?.currentTarget as any)?.dataset ?? (event?.target as any)?.dataset ?? {}\n const inlineEvent = resolveInlineEventArg(event, dataset)\n const inlineId = resolveDatasetEventValue(dataset, 'wvInlineId', event)\n if (typeof inlineId === 'string' && inlineId && inlineMap) {\n const entry = inlineMap[inlineId]\n if (entry && typeof entry.fn === 'function') {\n const scope: Record<string, any> = {}\n const keys = Array.isArray(entry.keys) ? entry.keys : []\n for (let i = 0; i < keys.length; i += 1) {\n const key = keys[i]\n scope[key] = dataset?.[`wvS${i}`]\n }\n const indexKeys = Array.isArray(entry.indexKeys) ? entry.indexKeys : []\n for (let i = 0; i < indexKeys.length; i += 1) {\n const indexKey = indexKeys[i]\n const indexValue = resolveDatasetIndex(dataset?.[`wvI${i}`])\n if (indexValue !== undefined) {\n scope[indexKey] = indexValue\n }\n }\n const scopeResolvers = Array.isArray(entry.scopeResolvers) ? entry.scopeResolvers : []\n for (let i = 0; i < keys.length; i += 1) {\n const key = keys[i]\n const resolver = scopeResolvers[i]\n try {\n let resolved: any\n if (typeof resolver === 'function') {\n resolved = resolver(ctx, scope, inlineEvent)\n }\n else if (resolver && typeof resolver === 'object' && resolver.type === 'for-item') {\n const index = scope[resolver.indexKey]\n const list = getByPath(ctx, resolver.path)\n resolved = list?.[index]\n }\n else {\n continue\n }\n if (resolved !== undefined) {\n scope[key] = normalizeResolvedScopeValue(resolved)\n }\n }\n catch {\n // 解析失败时保持 dataset 快照回退。\n }\n }\n const result = entry.fn(ctx, scope, inlineEvent)\n if (typeof result === 'function') {\n return result.call(ctx, inlineEvent)\n }\n return result\n }\n }\n\n const datasetHandler = resolveDatasetEventValue(dataset, 'wvHandler', event)\n const handlerName = typeof expr === 'string' && expr\n ? expr\n : (typeof datasetHandler === 'string' ? datasetHandler : undefined)\n if (!handlerName) {\n return undefined\n }\n const argsRaw = resolveDatasetEventValue(dataset, 'wvArgs', event)\n let args: any[] = []\n if (Array.isArray(argsRaw)) {\n args = argsRaw\n }\n else if (typeof argsRaw === 'string') {\n try {\n args = JSON.parse(argsRaw)\n }\n catch {\n try {\n args = JSON.parse(decodeWxmlEntities(argsRaw))\n }\n catch {\n args = []\n }\n }\n }\n if (!Array.isArray(args)) {\n args = []\n }\n const resolvedArgs = args.map((item: any) => item === '$event' ? inlineEvent : item)\n const handler = (ctx as any)?.[handlerName]\n if (typeof handler === 'function') {\n return handler.apply(ctx, resolvedArgs)\n }\n return undefined\n}\n"],"mappings":";;;;AAkBA,SAAS,uBAAuB,SAA8B,OAAqB;CACjF,MAAM,OAAO,yBAAyB,SAAS,iBAAiB,KAAK;CACrE,OAAO,SAAS,QAAQ,SAAS,KAAK,SAAS,OAAO,SAAS;AACjE;AAEA,SAAS,sBAAsB,OAAY,SAAmC;CAC5E,IAAI,CAAC,uBAAuB,SAAS,KAAK,GACxC,OAAO;CAET,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,EAAE,YAAY,QACvD;CAEF,OAAQ,MAAc;AACxB;AAEA,SAAS,UAAU,QAAa,MAAc;CAC5C,IAAI,CAAC,MACH;CAEF,MAAM,WAAW,KAAK,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC/C,IAAI,UAAU,MAAM,MAAM,IAAI,OAAO,QAAQ;CAC7C,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,MAAM,OAAO,GACf,UAAU,QAAQ;EAEpB,IAAI,WAAW,MACb;EAEF,UAAU,QAAQ;CACpB;CACA,IAAI,MAAM,OAAO,GACf,OAAO,QAAQ;CAEjB,OAAO;AACT;AAEA,SAAS,4BAA4B,OAAY;CAC/C,OAAO;AACT;AAEA,SAAgB,oBACd,KACA,MACA,OACA,WACA
|
|
1
|
+
{"version":3,"file":"inline.mjs","names":[],"sources":["../../../../src/runtime/register/inline.ts"],"sourcesContent":["import { isRef } from '../../reactivity'\nimport { decodeWxmlEntities, resolveDatasetEventValue, resolveDatasetIndex } from '../inlineDataset'\n\nexport interface InlineExpressionEntry {\n keys: string[]\n indexKeys?: string[]\n scopeResolvers?: Array<InlineExpressionScopeResolver | ((ctx: any, scope: Record<string, any>, event: any) => any) | undefined>\n fn: (ctx: any, scope: Record<string, any>, event: any) => any\n}\n\ninterface InlineExpressionScopeResolver {\n type: 'for-item'\n path: string\n indexKey: string\n}\n\nexport type InlineExpressionMap = Record<string, InlineExpressionEntry>\n\nfunction shouldUseDetailPayload(dataset: Record<string, any>, event: any): boolean {\n const flag = resolveDatasetEventValue(dataset, 'wvEventDetail', event)\n return flag === true || flag === 1 || flag === '1' || flag === 'true'\n}\n\nfunction resolveInlineEventArg(event: any, dataset: Record<string, any>): any {\n if (!shouldUseDetailPayload(dataset, event)) {\n return event\n }\n if (!event || typeof event !== 'object' || !('detail' in event)) {\n return undefined\n }\n return (event as any).detail\n}\n\nfunction getByPath(target: any, path: string) {\n if (!path) {\n return undefined\n }\n const segments = path.split('.').filter(Boolean)\n let current = isRef(target) ? target.value : target\n for (const segment of segments) {\n if (isRef(current)) {\n current = current.value\n }\n if (current == null) {\n return undefined\n }\n current = current[segment]\n }\n if (isRef(current)) {\n return current.value\n }\n return current\n}\n\nfunction normalizeResolvedScopeValue(value: any) {\n return value\n}\n\nexport function runInlineExpression(\n ctx: any,\n expr: unknown,\n event: any,\n inlineMap?: InlineExpressionMap,\n) {\n const dataset = (event?.currentTarget as any)?.dataset ?? (event?.target as any)?.dataset ?? {}\n const inlineEvent = resolveInlineEventArg(event, dataset)\n const inlineId = resolveDatasetEventValue(dataset, 'wvInlineId', event)\n if (typeof inlineId === 'string' && inlineId && inlineMap) {\n const entry = inlineMap[inlineId]\n if (entry && typeof entry.fn === 'function') {\n const scope: Record<string, any> = {}\n const keys = Array.isArray(entry.keys) ? entry.keys : []\n for (let i = 0; i < keys.length; i += 1) {\n const key = keys[i]\n scope[key] = dataset?.[`wvS${i}`]\n }\n const indexKeys = Array.isArray(entry.indexKeys) ? entry.indexKeys : []\n for (let i = 0; i < indexKeys.length; i += 1) {\n const indexKey = indexKeys[i]\n const indexValue = resolveDatasetIndex(dataset?.[`wvI${i}`])\n if (indexValue !== undefined) {\n scope[indexKey] = indexValue\n }\n }\n const scopeResolvers = Array.isArray(entry.scopeResolvers) ? entry.scopeResolvers : []\n for (let i = 0; i < keys.length; i += 1) {\n const key = keys[i]\n const resolver = scopeResolvers[i]\n try {\n let resolved: any\n if (typeof resolver === 'function') {\n resolved = resolver(ctx, scope, inlineEvent)\n }\n else if (resolver && typeof resolver === 'object' && resolver.type === 'for-item') {\n const index = scope[resolver.indexKey]\n const list = getByPath(ctx, resolver.path)\n resolved = list?.[index]\n }\n else {\n continue\n }\n if (resolved !== undefined) {\n scope[key] = normalizeResolvedScopeValue(resolved)\n }\n }\n catch {\n // 解析失败时保持 dataset 快照回退。\n }\n }\n const result = entry.fn(ctx, scope, inlineEvent)\n if (typeof result === 'function') {\n return result.call(ctx, inlineEvent)\n }\n return result\n }\n }\n\n const datasetHandler = resolveDatasetEventValue(dataset, 'wvHandler', event)\n const handlerName = typeof expr === 'string' && expr\n ? expr\n : (typeof datasetHandler === 'string' ? datasetHandler : undefined)\n if (!handlerName) {\n return undefined\n }\n const argsRaw = resolveDatasetEventValue(dataset, 'wvArgs', event)\n let args: any[] = []\n if (Array.isArray(argsRaw)) {\n args = argsRaw\n }\n else if (typeof argsRaw === 'string') {\n try {\n args = JSON.parse(argsRaw)\n }\n catch {\n try {\n args = JSON.parse(decodeWxmlEntities(argsRaw))\n }\n catch {\n args = []\n }\n }\n }\n if (!Array.isArray(args)) {\n args = []\n }\n const resolvedArgs = args.map((item: any) => item === '$event' ? inlineEvent : item)\n const handler = (ctx as any)?.[handlerName]\n if (typeof handler === 'function') {\n return handler.apply(ctx, resolvedArgs)\n }\n return undefined\n}\n"],"mappings":";;;;AAkBA,SAAS,uBAAuB,SAA8B,OAAqB;CACjF,MAAM,OAAO,yBAAyB,SAAS,iBAAiB,KAAK;CACrE,OAAO,SAAS,QAAQ,SAAS,KAAK,SAAS,OAAO,SAAS;AACjE;AAEA,SAAS,sBAAsB,OAAY,SAAmC;CAC5E,IAAI,CAAC,uBAAuB,SAAS,KAAK,GACxC,OAAO;CAET,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,EAAE,YAAY,QACvD;CAEF,OAAQ,MAAc;AACxB;AAEA,SAAS,UAAU,QAAa,MAAc;CAC5C,IAAI,CAAC,MACH;CAEF,MAAM,WAAW,KAAK,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC/C,IAAI,UAAU,MAAM,MAAM,IAAI,OAAO,QAAQ;CAC7C,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,MAAM,OAAO,GACf,UAAU,QAAQ;EAEpB,IAAI,WAAW,MACb;EAEF,UAAU,QAAQ;CACpB;CACA,IAAI,MAAM,OAAO,GACf,OAAO,QAAQ;CAEjB,OAAO;AACT;AAEA,SAAS,4BAA4B,OAAY;CAC/C,OAAO;AACT;AAEA,SAAgB,oBACd,KACA,MACA,OACA,WACA;CACA,MAAM,WAAW,OAAO,cAAa,EAAU,YAAY,OAAO,OAAM,EAAU,WAAW,CAAC;CAC9F,MAAM,cAAc,sBAAsB,OAAO,OAAO;CACxD,MAAM,WAAW,yBAAyB,SAAS,cAAc,KAAK;CACtE,IAAI,OAAO,aAAa,YAAY,YAAY,WAAW;EACzD,MAAM,QAAQ,UAAU;EACxB,IAAI,SAAS,OAAO,MAAM,OAAO,YAAY;GAC3C,MAAM,QAA6B,CAAC;GACpC,MAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,IAAI,MAAM,OAAO,CAAC;GACvD,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,GAAG;IACvC,MAAM,MAAM,KAAK;IACjB,MAAM,OAAO,UAAU,MAAM;GAC/B;GACA,MAAM,YAAY,MAAM,QAAQ,MAAM,SAAS,IAAI,MAAM,YAAY,CAAC;GACtE,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK,GAAG;IAC5C,MAAM,WAAW,UAAU;IAC3B,MAAM,aAAa,oBAAoB,UAAU,MAAM,IAAI;IAC3D,IAAI,eAAe,QACjB,MAAM,YAAY;GAEtB;GACA,MAAM,iBAAiB,MAAM,QAAQ,MAAM,cAAc,IAAI,MAAM,iBAAiB,CAAC;GACrF,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,GAAG;IACvC,MAAM,MAAM,KAAK;IACjB,MAAM,WAAW,eAAe;IAChC,IAAI;KACF,IAAI;KACJ,IAAI,OAAO,aAAa,YACtB,WAAW,SAAS,KAAK,OAAO,WAAW;UAExC,IAAI,YAAY,OAAO,aAAa,YAAY,SAAS,SAAS,YAAY;MACjF,MAAM,QAAQ,MAAM,SAAS;MAE7B,WADa,UAAU,KAAK,SAAS,IACvB,CAAC,GAAG;KACpB,OAEE;KAEF,IAAI,aAAa,QACf,MAAM,OAAO,4BAA4B,QAAQ;IAErD,QACM,CAEN;GACF;GACA,MAAM,SAAS,MAAM,GAAG,KAAK,OAAO,WAAW;GAC/C,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,KAAK,KAAK,WAAW;GAErC,OAAO;EACT;CACF;CAEA,MAAM,iBAAiB,yBAAyB,SAAS,aAAa,KAAK;CAC3E,MAAM,cAAc,OAAO,SAAS,YAAY,OAC5C,OACC,OAAO,mBAAmB,WAAW,iBAAiB;CAC3D,IAAI,CAAC,aACH;CAEF,MAAM,UAAU,yBAAyB,SAAS,UAAU,KAAK;CACjE,IAAI,OAAc,CAAC;CACnB,IAAI,MAAM,QAAQ,OAAO,GACvB,OAAO;MAEJ,IAAI,OAAO,YAAY,UAC1B,IAAI;EACF,OAAO,KAAK,MAAM,OAAO;CAC3B,QACM;EACJ,IAAI;GACF,OAAO,KAAK,MAAM,mBAAmB,OAAO,CAAC;EAC/C,QACM;GACJ,OAAO,CAAC;EACV;CACF;CAEF,IAAI,CAAC,MAAM,QAAQ,IAAI,GACrB,OAAO,CAAC;CAEV,MAAM,eAAe,KAAK,KAAK,SAAc,SAAS,WAAW,cAAc,IAAI;CACnF,MAAM,UAAW,MAAc;CAC/B,IAAI,OAAO,YAAY,YACrB,OAAO,QAAQ,MAAM,KAAK,YAAY;AAG1C"}
|
|
@@ -8,11 +8,11 @@ function hasNativeApis(instance) {
|
|
|
8
8
|
return typeof instance.triggerEvent === "function" || typeof instance.createSelectorQuery === "function" || typeof instance.createIntersectionObserver === "function" || typeof instance.setData === "function";
|
|
9
9
|
}
|
|
10
10
|
function isBridgeMethod(runtime, instance, methodName) {
|
|
11
|
-
const instanceMethod = instance
|
|
11
|
+
const instanceMethod = instance?.[methodName];
|
|
12
12
|
if (typeof instanceMethod !== "function") return false;
|
|
13
13
|
if (isNativeBridgeMethod(instanceMethod)) return true;
|
|
14
|
-
const runtimeProxy = runtime
|
|
15
|
-
return typeof
|
|
14
|
+
const runtimeProxy = runtime?.proxy;
|
|
15
|
+
return typeof runtimeProxy?.[methodName] === "function" && instanceMethod === runtimeProxy[methodName];
|
|
16
16
|
}
|
|
17
17
|
function syncRuntimeNativeInstance(runtime, instance) {
|
|
18
18
|
if (!runtime || !hasNativeApis(instance)) return;
|
|
@@ -28,7 +28,7 @@ function syncRuntimeNativeInstance(runtime, instance) {
|
|
|
28
28
|
enumerable: false,
|
|
29
29
|
writable: true
|
|
30
30
|
});
|
|
31
|
-
} catch
|
|
31
|
+
} catch {
|
|
32
32
|
runtimeState[WEVU_NATIVE_INSTANCE_KEY] = nativeCandidate;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -38,14 +38,13 @@ function bridgeRuntimeMethodsToTarget(target, runtime) {
|
|
|
38
38
|
for (const name of Object.keys(methods)) {
|
|
39
39
|
if (setupInstanceMethodNames.includes(name)) continue;
|
|
40
40
|
if (typeof target[name] !== "function") target[name] = function bridged(...args) {
|
|
41
|
-
|
|
42
|
-
const runtime = (_this$WEVU_PUBLIC_RUN = this[WEVU_PUBLIC_RUNTIME_KEY]) !== null && _this$WEVU_PUBLIC_RUN !== void 0 ? _this$WEVU_PUBLIC_RUN : target[WEVU_PUBLIC_RUNTIME_KEY];
|
|
41
|
+
const runtime = this[WEVU_PUBLIC_RUNTIME_KEY] ?? target[WEVU_PUBLIC_RUNTIME_KEY];
|
|
43
42
|
syncRuntimeNativeInstance(runtime, this);
|
|
44
|
-
const bound =
|
|
43
|
+
const bound = (runtime?.methods)?.[name];
|
|
45
44
|
if (typeof bound === "function") return bound.apply(runtime.proxy, args);
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
|
-
} catch
|
|
47
|
+
} catch {}
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methodBridge.mjs","names":[],"sources":["../../../../../src/runtime/register/runtimeInstance/methodBridge.ts"],"sourcesContent":["import type { InternalRuntimeState, RuntimeInstance } from '../../types'\nimport type { SetupInstanceMethodName } from './setupContext'\nimport {\n WEVU_NATIVE_INSTANCE_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n} from '@weapp-core/constants'\nimport { isNativeBridgeMethod } from '../../nativeBridge'\nimport { setupInstanceMethodNames } from './setupContext'\n\nfunction hasNativeApis(instance: unknown) {\n if (!instance || typeof instance !== 'object') {\n return false\n }\n return typeof (instance as any).triggerEvent === 'function'\n || typeof (instance as any).createSelectorQuery === 'function'\n || typeof (instance as any).createIntersectionObserver === 'function'\n || typeof (instance as any).setData === 'function'\n}\n\nfunction isBridgeMethod(runtime: RuntimeInstance<any, any, any>, instance: any, methodName: 'triggerEvent' | 'createSelectorQuery' | 'createIntersectionObserver' | 'setData') {\n const instanceMethod = instance?.[methodName]\n if (typeof instanceMethod !== 'function') {\n return false\n }\n if (isNativeBridgeMethod(instanceMethod)) {\n return true\n }\n const runtimeProxy = runtime?.proxy as Record<string, any> | undefined\n return typeof runtimeProxy?.[methodName] === 'function' && instanceMethod === runtimeProxy[methodName]\n}\n\nfunction syncRuntimeNativeInstance(runtime: RuntimeInstance<any, any, any>, instance: unknown) {\n if (!runtime || !hasNativeApis(instance)) {\n return\n }\n if (instance === runtime.proxy) {\n return\n }\n const nativeCandidate = instance as Record<string, any>\n if (\n isBridgeMethod(runtime, nativeCandidate, 'triggerEvent')\n || isBridgeMethod(runtime, nativeCandidate, 'createSelectorQuery')\n || isBridgeMethod(runtime, nativeCandidate, 'createIntersectionObserver')\n || isBridgeMethod(runtime, nativeCandidate, 'setData')\n ) {\n return\n }\n const runtimeState = runtime.state\n if (!runtimeState || typeof runtimeState !== 'object') {\n return\n }\n try {\n Object.defineProperty(runtimeState, WEVU_NATIVE_INSTANCE_KEY, {\n value: nativeCandidate,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(runtimeState as any)[WEVU_NATIVE_INSTANCE_KEY] = nativeCandidate\n }\n}\n\nexport function bridgeRuntimeMethodsToTarget(\n target: InternalRuntimeState,\n runtime: RuntimeInstance<any, any, any>,\n) {\n try {\n const methods = (runtime.methods as unknown) as Record<string, any>\n for (const name of Object.keys(methods)) {\n if (setupInstanceMethodNames.includes(name as SetupInstanceMethodName)) {\n continue\n }\n if (typeof (target as any)[name] !== 'function') {\n ;(target as any)[name] = function bridged(this: any, ...args: any[]) {\n const runtime = this[WEVU_PUBLIC_RUNTIME_KEY] ?? target[WEVU_PUBLIC_RUNTIME_KEY]\n syncRuntimeNativeInstance(runtime, this)\n const bound = (runtime?.methods as any)?.[name]\n if (typeof bound === 'function') {\n return bound.apply(runtime.proxy, args)\n }\n }\n }\n }\n }\n catch {\n // 桥接过程中若发生错误(如目标被封装)则忽略,避免阻断后续流程\n }\n}\n"],"mappings":";;;;;AASA,SAAS,cAAc,UAAmB;CACxC,IAAI,CAAC,YAAY,OAAO,aAAa,UACnC,OAAO;CAET,OAAO,OAAQ,SAAiB,iBAAiB,cAC5C,OAAQ,SAAiB,wBAAwB,cACjD,OAAQ,SAAiB,+BAA+B,cACxD,OAAQ,SAAiB,YAAY;AAC5C;AAEA,SAAS,eAAe,SAAyC,UAAe,YAA+F;CAC7K,MAAM,
|
|
1
|
+
{"version":3,"file":"methodBridge.mjs","names":[],"sources":["../../../../../src/runtime/register/runtimeInstance/methodBridge.ts"],"sourcesContent":["import type { InternalRuntimeState, RuntimeInstance } from '../../types'\nimport type { SetupInstanceMethodName } from './setupContext'\nimport {\n WEVU_NATIVE_INSTANCE_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n} from '@weapp-core/constants'\nimport { isNativeBridgeMethod } from '../../nativeBridge'\nimport { setupInstanceMethodNames } from './setupContext'\n\nfunction hasNativeApis(instance: unknown) {\n if (!instance || typeof instance !== 'object') {\n return false\n }\n return typeof (instance as any).triggerEvent === 'function'\n || typeof (instance as any).createSelectorQuery === 'function'\n || typeof (instance as any).createIntersectionObserver === 'function'\n || typeof (instance as any).setData === 'function'\n}\n\nfunction isBridgeMethod(runtime: RuntimeInstance<any, any, any>, instance: any, methodName: 'triggerEvent' | 'createSelectorQuery' | 'createIntersectionObserver' | 'setData') {\n const instanceMethod = instance?.[methodName]\n if (typeof instanceMethod !== 'function') {\n return false\n }\n if (isNativeBridgeMethod(instanceMethod)) {\n return true\n }\n const runtimeProxy = runtime?.proxy as Record<string, any> | undefined\n return typeof runtimeProxy?.[methodName] === 'function' && instanceMethod === runtimeProxy[methodName]\n}\n\nfunction syncRuntimeNativeInstance(runtime: RuntimeInstance<any, any, any>, instance: unknown) {\n if (!runtime || !hasNativeApis(instance)) {\n return\n }\n if (instance === runtime.proxy) {\n return\n }\n const nativeCandidate = instance as Record<string, any>\n if (\n isBridgeMethod(runtime, nativeCandidate, 'triggerEvent')\n || isBridgeMethod(runtime, nativeCandidate, 'createSelectorQuery')\n || isBridgeMethod(runtime, nativeCandidate, 'createIntersectionObserver')\n || isBridgeMethod(runtime, nativeCandidate, 'setData')\n ) {\n return\n }\n const runtimeState = runtime.state\n if (!runtimeState || typeof runtimeState !== 'object') {\n return\n }\n try {\n Object.defineProperty(runtimeState, WEVU_NATIVE_INSTANCE_KEY, {\n value: nativeCandidate,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(runtimeState as any)[WEVU_NATIVE_INSTANCE_KEY] = nativeCandidate\n }\n}\n\nexport function bridgeRuntimeMethodsToTarget(\n target: InternalRuntimeState,\n runtime: RuntimeInstance<any, any, any>,\n) {\n try {\n const methods = (runtime.methods as unknown) as Record<string, any>\n for (const name of Object.keys(methods)) {\n if (setupInstanceMethodNames.includes(name as SetupInstanceMethodName)) {\n continue\n }\n if (typeof (target as any)[name] !== 'function') {\n ;(target as any)[name] = function bridged(this: any, ...args: any[]) {\n const runtime = this[WEVU_PUBLIC_RUNTIME_KEY] ?? target[WEVU_PUBLIC_RUNTIME_KEY]\n syncRuntimeNativeInstance(runtime, this)\n const bound = (runtime?.methods as any)?.[name]\n if (typeof bound === 'function') {\n return bound.apply(runtime.proxy, args)\n }\n }\n }\n }\n }\n catch {\n // 桥接过程中若发生错误(如目标被封装)则忽略,避免阻断后续流程\n }\n}\n"],"mappings":";;;;;AASA,SAAS,cAAc,UAAmB;CACxC,IAAI,CAAC,YAAY,OAAO,aAAa,UACnC,OAAO;CAET,OAAO,OAAQ,SAAiB,iBAAiB,cAC5C,OAAQ,SAAiB,wBAAwB,cACjD,OAAQ,SAAiB,+BAA+B,cACxD,OAAQ,SAAiB,YAAY;AAC5C;AAEA,SAAS,eAAe,SAAyC,UAAe,YAA+F;CAC7K,MAAM,iBAAiB,WAAW;CAClC,IAAI,OAAO,mBAAmB,YAC5B,OAAO;CAET,IAAI,qBAAqB,cAAc,GACrC,OAAO;CAET,MAAM,eAAe,SAAS;CAC9B,OAAO,OAAO,eAAe,gBAAgB,cAAc,mBAAmB,aAAa;AAC7F;AAEA,SAAS,0BAA0B,SAAyC,UAAmB;CAC7F,IAAI,CAAC,WAAW,CAAC,cAAc,QAAQ,GACrC;CAEF,IAAI,aAAa,QAAQ,OACvB;CAEF,MAAM,kBAAkB;CACxB,IACE,eAAe,SAAS,iBAAiB,cAAc,KACpD,eAAe,SAAS,iBAAiB,qBAAqB,KAC9D,eAAe,SAAS,iBAAiB,4BAA4B,KACrE,eAAe,SAAS,iBAAiB,SAAS,GAErD;CAEF,MAAM,eAAe,QAAQ;CAC7B,IAAI,CAAC,gBAAgB,OAAO,iBAAiB,UAC3C;CAEF,IAAI;EACF,OAAO,eAAe,cAAc,0BAA0B;GAC5D,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,QACM;EACH,AAAC,aAAqB,4BAA4B;CACrD;AACF;AAEA,SAAgB,6BACd,QACA,SACA;CACA,IAAI;EACF,MAAM,UAAW,QAAQ;EACzB,KAAK,MAAM,QAAQ,OAAO,KAAK,OAAO,GAAG;GACvC,IAAI,yBAAyB,SAAS,IAA+B,GACnE;GAEF,IAAI,OAAQ,OAAe,UAAU,YAClC,AAAC,OAAe,QAAQ,SAAS,QAAmB,GAAG,MAAa;IACnE,MAAM,UAAU,KAAK,4BAA4B,OAAO;IACxD,0BAA0B,SAAS,IAAI;IACvC,MAAM,SAAS,SAAS,QAAO,GAAW;IAC1C,IAAI,OAAO,UAAU,YACnB,OAAO,MAAM,MAAM,QAAQ,OAAO,IAAI;GAE1C;EAEJ;CACF,QACM,CAEN;AACF"}
|
|
@@ -12,7 +12,7 @@ function resolveRuntimeParentInstance(target) {
|
|
|
12
12
|
if (typeof selectOwnerComponent === "function") try {
|
|
13
13
|
const owner = selectOwnerComponent.call(target);
|
|
14
14
|
if (owner && owner !== target && typeof owner === "object" && owner.__wevu) return owner;
|
|
15
|
-
} catch
|
|
15
|
+
} catch {}
|
|
16
16
|
const pages = getCurrentMiniProgramPages();
|
|
17
17
|
const currentPage = pages[pages.length - 1];
|
|
18
18
|
if (currentPage && currentPage !== target && typeof currentPage === "object" && currentPage.__wevu) return currentPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provideContext.mjs","names":[],"sources":["../../../../../src/runtime/register/runtimeInstance/provideContext.ts"],"sourcesContent":["import type { InternalRuntimeState, RuntimeApp } from '../../types'\nimport {\n WEVU_PARENT_INSTANCE_KEY,\n WEVU_RUNTIME_APP_KEY,\n} from '@weapp-core/constants'\nimport { isRuntimeLayoutComponentTarget } from '../../layoutComponentMatcher'\nimport { getCurrentMiniProgramPages } from '../../platform'\nimport { attachRuntimeLayoutProvideContext, attachRuntimeProvideContext } from '../../provideContext'\n\nfunction resolveRuntimeParentInstance(target: InternalRuntimeState): InternalRuntimeState | undefined {\n if (isRuntimeLayoutComponentTarget(target)) {\n return undefined\n }\n\n const cached = target[WEVU_PARENT_INSTANCE_KEY]\n if (cached && typeof cached === 'object') {\n return cached\n }\n\n const selectOwnerComponent = (target as any).selectOwnerComponent\n if (typeof selectOwnerComponent === 'function') {\n try {\n const owner = selectOwnerComponent.call(target) as InternalRuntimeState | undefined\n if (owner && owner !== target && typeof owner === 'object' && owner.__wevu) {\n return owner\n }\n }\n catch {\n // 部分宿主或生命周期阶段可能暂不支持 owner 查询,继续使用页面兜底。\n }\n }\n\n const pages = getCurrentMiniProgramPages()\n const currentPage = pages[pages.length - 1] as InternalRuntimeState | undefined\n if (\n currentPage\n && currentPage !== target\n && typeof currentPage === 'object'\n && currentPage.__wevu\n ) {\n return currentPage\n }\n\n return undefined\n}\n\nfunction attachRuntimeLayoutParentContext(target: InternalRuntimeState) {\n if (!isRuntimeLayoutComponentTarget(target)) {\n return\n }\n const pages = getCurrentMiniProgramPages()\n const currentPage = pages[pages.length - 1] as InternalRuntimeState | undefined\n if (\n currentPage\n && currentPage !== target\n && typeof currentPage === 'object'\n && currentPage.__wevu\n ) {\n attachRuntimeLayoutProvideContext(target, currentPage)\n }\n}\n\nexport function attachRuntimeProvideParentContext(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<any, any, any>,\n) {\n target[WEVU_RUNTIME_APP_KEY] = runtimeApp\n attachRuntimeProvideContext(target, runtimeApp, resolveRuntimeParentInstance(target))\n attachRuntimeLayoutParentContext(target)\n}\n"],"mappings":";;;;;;AASA,SAAS,6BAA6B,QAAgE;CACpG,IAAI,+BAA+B,MAAM,GACvC;CAGF,MAAM,SAAS,OAAO;CACtB,IAAI,UAAU,OAAO,WAAW,UAC9B,OAAO;CAGT,MAAM,uBAAwB,OAAe;CAC7C,IAAI,OAAO,yBAAyB,YAClC,IAAI;EACF,MAAM,QAAQ,qBAAqB,KAAK,MAAM;EAC9C,IAAI,SAAS,UAAU,UAAU,OAAO,UAAU,YAAY,MAAM,QAClE,OAAO;CAEX,
|
|
1
|
+
{"version":3,"file":"provideContext.mjs","names":[],"sources":["../../../../../src/runtime/register/runtimeInstance/provideContext.ts"],"sourcesContent":["import type { InternalRuntimeState, RuntimeApp } from '../../types'\nimport {\n WEVU_PARENT_INSTANCE_KEY,\n WEVU_RUNTIME_APP_KEY,\n} from '@weapp-core/constants'\nimport { isRuntimeLayoutComponentTarget } from '../../layoutComponentMatcher'\nimport { getCurrentMiniProgramPages } from '../../platform'\nimport { attachRuntimeLayoutProvideContext, attachRuntimeProvideContext } from '../../provideContext'\n\nfunction resolveRuntimeParentInstance(target: InternalRuntimeState): InternalRuntimeState | undefined {\n if (isRuntimeLayoutComponentTarget(target)) {\n return undefined\n }\n\n const cached = target[WEVU_PARENT_INSTANCE_KEY]\n if (cached && typeof cached === 'object') {\n return cached\n }\n\n const selectOwnerComponent = (target as any).selectOwnerComponent\n if (typeof selectOwnerComponent === 'function') {\n try {\n const owner = selectOwnerComponent.call(target) as InternalRuntimeState | undefined\n if (owner && owner !== target && typeof owner === 'object' && owner.__wevu) {\n return owner\n }\n }\n catch {\n // 部分宿主或生命周期阶段可能暂不支持 owner 查询,继续使用页面兜底。\n }\n }\n\n const pages = getCurrentMiniProgramPages()\n const currentPage = pages[pages.length - 1] as InternalRuntimeState | undefined\n if (\n currentPage\n && currentPage !== target\n && typeof currentPage === 'object'\n && currentPage.__wevu\n ) {\n return currentPage\n }\n\n return undefined\n}\n\nfunction attachRuntimeLayoutParentContext(target: InternalRuntimeState) {\n if (!isRuntimeLayoutComponentTarget(target)) {\n return\n }\n const pages = getCurrentMiniProgramPages()\n const currentPage = pages[pages.length - 1] as InternalRuntimeState | undefined\n if (\n currentPage\n && currentPage !== target\n && typeof currentPage === 'object'\n && currentPage.__wevu\n ) {\n attachRuntimeLayoutProvideContext(target, currentPage)\n }\n}\n\nexport function attachRuntimeProvideParentContext(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<any, any, any>,\n) {\n target[WEVU_RUNTIME_APP_KEY] = runtimeApp\n attachRuntimeProvideContext(target, runtimeApp, resolveRuntimeParentInstance(target))\n attachRuntimeLayoutParentContext(target)\n}\n"],"mappings":";;;;;;AASA,SAAS,6BAA6B,QAAgE;CACpG,IAAI,+BAA+B,MAAM,GACvC;CAGF,MAAM,SAAS,OAAO;CACtB,IAAI,UAAU,OAAO,WAAW,UAC9B,OAAO;CAGT,MAAM,uBAAwB,OAAe;CAC7C,IAAI,OAAO,yBAAyB,YAClC,IAAI;EACF,MAAM,QAAQ,qBAAqB,KAAK,MAAM;EAC9C,IAAI,SAAS,UAAU,UAAU,OAAO,UAAU,YAAY,MAAM,QAClE,OAAO;CAEX,QACM,CAEN;CAGF,MAAM,QAAQ,2BAA2B;CACzC,MAAM,cAAc,MAAM,MAAM,SAAS;CACzC,IACE,eACG,gBAAgB,UAChB,OAAO,gBAAgB,YACvB,YAAY,QAEf,OAAO;AAIX;AAEA,SAAS,iCAAiC,QAA8B;CACtE,IAAI,CAAC,+BAA+B,MAAM,GACxC;CAEF,MAAM,QAAQ,2BAA2B;CACzC,MAAM,cAAc,MAAM,MAAM,SAAS;CACzC,IACE,eACG,gBAAgB,UAChB,OAAO,gBAAgB,YACvB,YAAY,QAEf,kCAAkC,QAAQ,WAAW;AAEzD;AAEA,SAAgB,kCACd,QACA,YACA;CACA,OAAO,wBAAwB;CAC/B,4BAA4B,QAAQ,YAAY,6BAA6B,MAAM,CAAC;CACpF,iCAAiC,MAAM;AACzC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toRaw } from "../../../reactivity/reactive/shared.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabilities } from "../../platform/current.mjs";
|
|
3
|
+
import { supportsCurrentMiniProgramRuntimeCapability } from "../../platform.mjs";
|
|
3
4
|
import { markNoSetData } from "../../noSetData.mjs";
|
|
4
5
|
import { hasOwn } from "../../../utils.mjs";
|
|
5
6
|
import { normalizeEmitPayload } from "../../emit.mjs";
|
|
@@ -62,7 +63,7 @@ function attachRuntimeSlots(runtimeState, props) {
|
|
|
62
63
|
enumerable: false,
|
|
63
64
|
writable: false
|
|
64
65
|
});
|
|
65
|
-
} catch
|
|
66
|
+
} catch {
|
|
66
67
|
runtimeState.$slots = slots;
|
|
67
68
|
}
|
|
68
69
|
return slots;
|
|
@@ -77,14 +78,14 @@ function createNoopWatchStopHandle() {
|
|
|
77
78
|
function safeMarkNoSetData(value) {
|
|
78
79
|
try {
|
|
79
80
|
return markNoSetData(value);
|
|
80
|
-
} catch
|
|
81
|
+
} catch {
|
|
81
82
|
return value;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
function resolveRuntimeNativeMethodOwner(runtime, target, methodName) {
|
|
85
|
-
const runtimeState = runtime
|
|
86
|
+
const runtimeState = runtime?.state;
|
|
86
87
|
const runtimeRawState = runtimeState && typeof runtimeState === "object" ? toRaw(runtimeState) : void 0;
|
|
87
|
-
const runtimeProxy = runtime
|
|
88
|
+
const runtimeProxy = runtime?.proxy;
|
|
88
89
|
const isBridgeMethod = (candidate) => {
|
|
89
90
|
const candidateMethod = candidate[methodName];
|
|
90
91
|
if (typeof candidateMethod !== "function") return false;
|
|
@@ -100,7 +101,7 @@ function resolveRuntimeNativeMethodOwner(runtime, target, methodName) {
|
|
|
100
101
|
};
|
|
101
102
|
const nativeFromState = runtimeRawState ? runtimeRawState[WEVU_NATIVE_INSTANCE_KEY] : void 0;
|
|
102
103
|
if (isValidNativeCandidate(nativeFromState)) return nativeFromState;
|
|
103
|
-
const runtimeInstance = runtime
|
|
104
|
+
const runtimeInstance = runtime?.instance;
|
|
104
105
|
if (isValidNativeCandidate(runtimeInstance)) return runtimeInstance;
|
|
105
106
|
}
|
|
106
107
|
function defineSetupInstanceMethod(target, methodName, handler) {
|
|
@@ -112,7 +113,7 @@ function defineSetupInstanceMethod(target, methodName, handler) {
|
|
|
112
113
|
enumerable: false,
|
|
113
114
|
writable: true
|
|
114
115
|
});
|
|
115
|
-
} catch
|
|
116
|
+
} catch {
|
|
116
117
|
target[methodName] = handler;
|
|
117
118
|
}
|
|
118
119
|
}
|
|
@@ -125,23 +126,21 @@ function ensureSetupContextInstance(target, runtime) {
|
|
|
125
126
|
configurable: true,
|
|
126
127
|
enumerable: false,
|
|
127
128
|
get() {
|
|
128
|
-
const runtimeState = runtime
|
|
129
|
-
const
|
|
130
|
-
const nativeInstance = rawRuntimeState === null || rawRuntimeState === void 0 ? void 0 : rawRuntimeState[WEVU_NATIVE_INSTANCE_KEY];
|
|
129
|
+
const runtimeState = runtime?.state;
|
|
130
|
+
const nativeInstance = (runtimeState && typeof runtimeState === "object" ? toRaw(runtimeState) : void 0)?.[WEVU_NATIVE_INSTANCE_KEY];
|
|
131
131
|
return nativeInstance && typeof nativeInstance === "object" ? nativeInstance : target;
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
} catch
|
|
134
|
+
} catch {
|
|
135
135
|
setupInstanceBridge[WEVU_NATIVE_INSTANCE_KEY] = target;
|
|
136
136
|
}
|
|
137
137
|
const resolvePublicValue = (key) => {
|
|
138
|
-
|
|
139
|
-
const runtimeProxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy;
|
|
138
|
+
const runtimeProxy = runtime?.proxy;
|
|
140
139
|
if (runtimeProxy && Reflect.has(runtimeProxy, key)) return {
|
|
141
140
|
found: true,
|
|
142
141
|
value: Reflect.get(runtimeProxy, key)
|
|
143
142
|
};
|
|
144
|
-
const runtimeProps = (
|
|
143
|
+
const runtimeProps = (runtime?.state)?.[WEVU_PROPS_KEY] ?? target[WEVU_PROPS_KEY];
|
|
145
144
|
if (runtimeProps && typeof runtimeProps === "object" && hasOwn(runtimeProps, key)) return {
|
|
146
145
|
found: true,
|
|
147
146
|
value: Reflect.get(runtimeProps, key)
|
|
@@ -166,32 +165,30 @@ function ensureSetupContextInstance(target, runtime) {
|
|
|
166
165
|
}
|
|
167
166
|
});
|
|
168
167
|
defineSetupInstanceMethod(setupInstanceBridge, "createSelectorQuery", () => {
|
|
169
|
-
var _resolveRuntimeNative;
|
|
170
168
|
const nativeOwner = resolveSetupBridgeOwner("createSelectorQuery");
|
|
171
169
|
if (nativeOwner && typeof nativeOwner.createSelectorQuery === "function") return nativeOwner.createSelectorQuery();
|
|
172
|
-
const miniProgramGlobal =
|
|
170
|
+
const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
|
|
173
171
|
if (!supportsCurrentMiniProgramRuntimeCapability("globalCreateSelectorQuery") || !miniProgramGlobal || typeof miniProgramGlobal.createSelectorQuery !== "function") return;
|
|
174
172
|
const query = miniProgramGlobal.createSelectorQuery();
|
|
175
173
|
if (!query) return query;
|
|
176
174
|
if (!getCurrentMiniProgramRuntimeCapabilities().selectorQueryScopeByIn || typeof query.in !== "function") return query;
|
|
177
|
-
const scopedOwner =
|
|
175
|
+
const scopedOwner = resolveRuntimeNativeMethodOwner(runtime, target, "setData") ?? target;
|
|
178
176
|
return query.in(scopedOwner);
|
|
179
177
|
});
|
|
180
178
|
defineSetupInstanceMethod(setupInstanceBridge, "createIntersectionObserver", (options) => {
|
|
181
|
-
var _resolveRuntimeNative2;
|
|
182
179
|
const nativeOwner = resolveSetupBridgeOwner("createIntersectionObserver");
|
|
183
|
-
if (nativeOwner && typeof nativeOwner.createIntersectionObserver === "function") return nativeOwner.createIntersectionObserver(options
|
|
184
|
-
const miniProgramGlobal =
|
|
180
|
+
if (nativeOwner && typeof nativeOwner.createIntersectionObserver === "function") return nativeOwner.createIntersectionObserver(options ?? {});
|
|
181
|
+
const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
|
|
185
182
|
if (!supportsCurrentMiniProgramRuntimeCapability("globalCreateIntersectionObserver") || !miniProgramGlobal || typeof miniProgramGlobal.createIntersectionObserver !== "function") return;
|
|
186
|
-
const scopedOwner =
|
|
187
|
-
if (getCurrentMiniProgramRuntimeCapabilities().intersectionObserverScopeByParameter) return miniProgramGlobal.createIntersectionObserver(scopedOwner, options
|
|
188
|
-
return miniProgramGlobal.createIntersectionObserver(options
|
|
183
|
+
const scopedOwner = resolveRuntimeNativeMethodOwner(runtime, target, "setData") ?? target;
|
|
184
|
+
if (getCurrentMiniProgramRuntimeCapabilities().intersectionObserverScopeByParameter) return miniProgramGlobal.createIntersectionObserver(scopedOwner, options ?? {});
|
|
185
|
+
return miniProgramGlobal.createIntersectionObserver(options ?? {});
|
|
189
186
|
});
|
|
190
187
|
defineSetupInstanceMethod(setupInstanceBridge, "setData", (payload, callback) => {
|
|
191
188
|
const nativeOwner = resolveSetupBridgeOwner("setData");
|
|
192
189
|
if (nativeOwner && typeof nativeOwner.setData === "function") return nativeOwner.setData(payload, callback);
|
|
193
|
-
const adapter = runtime
|
|
194
|
-
const result = typeof
|
|
190
|
+
const adapter = runtime?.adapter;
|
|
191
|
+
const result = typeof adapter?.setData === "function" ? adapter.setData(payload) : void 0;
|
|
195
192
|
if (typeof callback === "function") callback();
|
|
196
193
|
return result;
|
|
197
194
|
});
|
|
@@ -202,14 +199,8 @@ function ensureSetupContextInstance(target, runtime) {
|
|
|
202
199
|
const setupInstance = safeMarkNoSetData(new Proxy(setupInstanceBridge, {
|
|
203
200
|
get(bridgeTarget, key, receiver) {
|
|
204
201
|
if (Reflect.has(bridgeTarget, key)) return Reflect.get(bridgeTarget, key, receiver);
|
|
205
|
-
if (key === "$el")
|
|
206
|
-
|
|
207
|
-
return (_resolveRuntimeNative3 = resolveRuntimeNativeMethodOwner(runtime, target, "setData")) !== null && _resolveRuntimeNative3 !== void 0 ? _resolveRuntimeNative3 : target;
|
|
208
|
-
}
|
|
209
|
-
if (key === "renderRoot" || key === "shadowRoot") {
|
|
210
|
-
var _resolveRuntimeNative4;
|
|
211
|
-
return ((_resolveRuntimeNative4 = resolveRuntimeNativeMethodOwner(runtime, target, "setData")) !== null && _resolveRuntimeNative4 !== void 0 ? _resolveRuntimeNative4 : target)[key];
|
|
212
|
-
}
|
|
202
|
+
if (key === "$el") return resolveRuntimeNativeMethodOwner(runtime, target, "setData") ?? target;
|
|
203
|
+
if (key === "renderRoot" || key === "shadowRoot") return (resolveRuntimeNativeMethodOwner(runtime, target, "setData") ?? target)[key];
|
|
213
204
|
const publicValue = resolvePublicValue(key);
|
|
214
205
|
if (publicValue.found) return publicValue.value;
|
|
215
206
|
const value = target[key];
|
|
@@ -235,7 +226,7 @@ function ensureSetupContextInstance(target, runtime) {
|
|
|
235
226
|
enumerable: false,
|
|
236
227
|
writable: true
|
|
237
228
|
});
|
|
238
|
-
} catch
|
|
229
|
+
} catch {
|
|
239
230
|
target[WEVU_SETUP_CONTEXT_INSTANCE_KEY] = setupInstance;
|
|
240
231
|
}
|
|
241
232
|
return setupInstance;
|