wevu 7.2.1 → 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/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/internal-reactivity.d.mts +18 -0
- package/dist/dev/internal-runtime.d.mts +45 -0
- package/dist/dev/internal-runtime.mjs +3 -2
- package/dist/dev/internal-template.d.mts +2 -0
- package/dist/dev/jsxTypes.d.mts +9 -0
- package/dist/dev/macros/shared.d.mts +83 -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 +8 -10
- package/dist/dev/reactivity/asyncDerivation.mjs.map +1 -1
- package/dist/dev/reactivity/computed.d.mts +25 -0
- package/dist/dev/reactivity/core.d.mts +35 -0
- package/dist/dev/reactivity/core.mjs +5 -8
- 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/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/shallow.d.mts +22 -0
- package/dist/dev/reactivity/reactive/shared.d.mts +4 -0
- package/dist/dev/reactivity/reactive/shared.mjs +1 -2
- package/dist/dev/reactivity/reactive/shared.mjs.map +1 -1
- package/dist/dev/reactivity/reactive.d.mts +42 -0
- package/dist/dev/reactivity/reactive.mjs +5 -10
- package/dist/dev/reactivity/reactive.mjs.map +1 -1
- package/dist/dev/reactivity/readonly.d.mts +27 -0
- package/dist/dev/reactivity/ref.d.mts +27 -0
- package/dist/dev/reactivity/ref.mjs +2 -2
- package/dist/dev/reactivity/ref.mjs.map +1 -1
- package/dist/dev/reactivity/shallowRef.d.mts +19 -0
- package/dist/dev/reactivity/shallowRef.mjs +1 -1
- package/dist/dev/reactivity/shallowRef.mjs.map +1 -1
- package/dist/dev/reactivity/toRefs.d.mts +43 -0
- package/dist/dev/reactivity/traverse.d.mts +8 -0
- package/dist/dev/reactivity/watch/helpers.mjs +1 -1
- package/dist/dev/reactivity/watch/helpers.mjs.map +1 -1
- package/dist/dev/reactivity/watch/types.d.mts +43 -0
- package/dist/dev/reactivity/watch.d.mts +22 -0
- package/dist/dev/reactivity/watch.mjs +6 -8
- package/dist/dev/reactivity/watch.mjs.map +1 -1
- package/dist/dev/router/auto-routes.d.mts +8 -0
- package/dist/dev/router/createRouter.d.mts +9 -0
- 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.d.mts +7 -0
- 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.d.mts +7 -0
- 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.d.mts +2 -0
- package/dist/dev/router/routeSync.mjs +1 -1
- package/dist/dev/router/routeSync.mjs.map +1 -1
- package/dist/dev/router/types.d.mts +267 -0
- package/dist/dev/router/useRoute.d.mts +20 -0
- package/dist/dev/router/useRoute.mjs +12 -19
- package/dist/dev/router/useRoute.mjs.map +1 -1
- package/dist/dev/router/useRouter.d.mts +9 -0
- package/dist/dev/router.d.mts +26 -0
- package/dist/dev/routerInternal/location.d.mts +2 -0
- package/dist/dev/routerInternal/location.mjs +2 -3
- package/dist/dev/routerInternal/location.mjs.map +1 -1
- package/dist/dev/routerInternal/matching.d.mts +2 -0
- package/dist/dev/routerInternal/params.d.mts +2 -0
- package/dist/dev/routerInternal/params.mjs +2 -3
- package/dist/dev/routerInternal/params.mjs.map +1 -1
- package/dist/dev/routerInternal/query.d.mts +7 -0
- package/dist/dev/routerInternal/records.d.mts +2 -0
- package/dist/dev/routerInternal/records.mjs +1 -1
- package/dist/dev/routerInternal/records.mjs.map +1 -1
- package/dist/dev/routerInternal/recordsWarnings.d.mts +2 -0
- package/dist/dev/routerInternal/recordsWarnings.mjs +1 -2
- package/dist/dev/routerInternal/recordsWarnings.mjs.map +1 -1
- package/dist/dev/routerInternal/shared.d.mts +9 -0
- package/dist/dev/routerInternal/snapshots.d.mts +2 -0
- package/dist/dev/routerInternal/types.d.mts +9 -0
- 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/pending.d.mts +10 -0
- package/dist/dev/runtime/app/setData/commitTracker.d.mts +13 -0
- 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.d.mts +51 -0
- 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.d.mts +8 -0
- 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 +78 -0
- package/dist/dev/runtime/capabilities.mjs.map +1 -1
- package/dist/dev/runtime/css.d.mts +14 -0
- package/dist/dev/runtime/css.mjs +4 -8
- package/dist/dev/runtime/css.mjs.map +1 -1
- package/dist/dev/runtime/defaults.d.mts +12 -0
- 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.d.mts +118 -0
- 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.d.mts +31 -0
- package/dist/dev/runtime/disposables.mjs +2 -2
- package/dist/dev/runtime/disposables.mjs.map +1 -1
- package/dist/dev/runtime/elementIntersectionObserver.d.mts +26 -0
- package/dist/dev/runtime/elementIntersectionObserver.mjs +16 -24
- package/dist/dev/runtime/elementIntersectionObserver.mjs.map +1 -1
- package/dist/dev/runtime/features/inlineEvents.d.mts +7 -0
- 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.d.mts +7 -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/patchStrategy.d.mts +7 -0
- package/dist/dev/runtime/features/publicLayout.d.mts +24 -0
- 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.d.mts +23 -0
- package/dist/dev/runtime/features/scopedSlots.mjs +5 -9
- package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +7 -0
- package/dist/dev/runtime/features/templateRefs.d.mts +7 -0
- 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.d.mts +27 -0
- package/dist/dev/runtime/hooks/base.mjs +21 -32
- package/dist/dev/runtime/hooks/base.mjs.map +1 -1
- 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.d.mts +4 -0
- package/dist/dev/runtime/index.d.mts +46 -0
- package/dist/dev/runtime/inlineDataset.mjs +1 -2
- package/dist/dev/runtime/inlineDataset.mjs.map +1 -1
- package/dist/dev/runtime/intersectionObserver.d.mts +14 -0
- package/dist/dev/runtime/intersectionObserver.mjs +6 -6
- package/dist/dev/runtime/intersectionObserver.mjs.map +1 -1
- package/dist/dev/runtime/jsxIsland.d.mts +37 -0
- package/dist/dev/runtime/jsxIsland.mjs +16 -33
- package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
- package/dist/dev/runtime/layoutBridge.d.mts +55 -0
- 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/noSetData.d.mts +5 -0
- package/dist/dev/runtime/pageEnvironment.d.mts +50 -0
- package/dist/dev/runtime/pageEnvironment.mjs +15 -18
- package/dist/dev/runtime/pageEnvironment.mjs.map +1 -1
- package/dist/dev/runtime/pageLayout.d.mts +25 -0
- package/dist/dev/runtime/pageLayout.mjs +7 -11
- package/dist/dev/runtime/pageLayout.mjs.map +1 -1
- package/dist/dev/runtime/pageScroll.d.mts +29 -0
- 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/provide.d.mts +60 -0
- package/dist/dev/runtime/provideContext.mjs +7 -9
- package/dist/dev/runtime/provideContext.mjs.map +1 -1
- package/dist/dev/runtime/provideStore.d.mts +7 -0
- package/dist/dev/runtime/publicRuntime.d.mts +22 -0
- package/dist/dev/runtime/publicRuntime.mjs +4 -0
- package/dist/dev/runtime/publicRuntime.mjs.map +1 -1
- package/dist/dev/runtime/pullDownRefresh.d.mts +12 -0
- package/dist/dev/runtime/pullDownRefresh.mjs +2 -4
- package/dist/dev/runtime/pullDownRefresh.mjs.map +1 -1
- package/dist/dev/runtime/register/app.d.mts +14 -0
- 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.d.mts +17 -0
- 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.d.mts +15 -0
- 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.d.mts +26 -0
- 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.d.mts +11 -0
- 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.d.mts +12 -0
- package/dist/dev/runtime/register/watch.mjs +3 -5
- package/dist/dev/runtime/register/watch.mjs.map +1 -1
- package/dist/dev/runtime/register.d.mts +5 -0
- package/dist/dev/runtime/scopedSlots.mjs +14 -21
- 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 -9
- package/dist/dev/runtime/selectorQuery.mjs.map +1 -1
- package/dist/dev/runtime/template.d.mts +6 -0
- package/dist/dev/runtime/template.mjs +1 -1
- package/dist/dev/runtime/template.mjs.map +1 -1
- package/dist/dev/runtime/templateRefTypes.d.mts +12 -0
- 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/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 +138 -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/uniAppHost.mjs +6 -14
- package/dist/dev/runtime/uniAppHost.mjs.map +1 -1
- package/dist/dev/runtime/updatePerformance.d.mts +13 -0
- package/dist/dev/runtime/updatePerformance.mjs +1 -1
- package/dist/dev/runtime/updatePerformance.mjs.map +1 -1
- package/dist/dev/runtime/use.d.mts +13 -0
- package/dist/dev/runtime/use.mjs +1 -1
- package/dist/dev/runtime/use.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/context.d.mts +8 -0
- 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.d.mts +30 -0
- 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.d.mts +29 -0
- 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.d.mts +9 -0
- package/dist/dev/runtime/vueCompat/templateRef.mjs +1 -1
- 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/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.d.mts +8 -0
- package/dist/dev/store/define.mjs +1 -1
- package/dist/dev/store/define.mjs.map +1 -1
- package/dist/dev/store/manager.d.mts +16 -0
- package/dist/dev/store/storeToRefs.d.mts +11 -0
- package/dist/dev/store/types.d.mts +106 -0
- package/dist/dev/store/view.mjs +1 -1
- package/dist/dev/store/view.mjs.map +1 -1
- package/dist/dev/store.d.mts +5 -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-types.d.mts +19 -0
- package/dist/dev/web-apis.d.mts +3 -0
- 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
|
@@ -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
|
|
@@ -7,6 +7,7 @@ import { registerComponent as registerComponent$1 } from "./register/component.m
|
|
|
7
7
|
import { createApp as createApp$1 } from "./app.mjs";
|
|
8
8
|
import { createWevuComponent as createWevuComponent$1, defineComponent as defineComponent$1 } from "./define.mjs";
|
|
9
9
|
import { installInlineEvents } from "./features/inlineEvents.mjs";
|
|
10
|
+
import { installJsxIslands } from "./features/jsxIslands.mjs";
|
|
10
11
|
import { installPatchStrategy } from "./features/patchStrategy.mjs";
|
|
11
12
|
import { createWevuScopedSlotComponent as createWevuScopedSlotComponent$1, installScopedSlots } from "./features/scopedSlots.mjs";
|
|
12
13
|
import { installSetDataHighFrequencyWarning } from "./features/setDataHighFrequencyWarning.mjs";
|
|
@@ -35,6 +36,7 @@ function installPublicMetadataCapabilities(value) {
|
|
|
35
36
|
function installPublicFactoryCapabilities(options) {
|
|
36
37
|
installPublicOptionCapabilities();
|
|
37
38
|
installInlineEvents();
|
|
39
|
+
installJsxIslands();
|
|
38
40
|
installScopedSlots();
|
|
39
41
|
installPublicMetadataCapabilities(options);
|
|
40
42
|
}
|
|
@@ -59,6 +61,7 @@ const registerApp = (runtimeApp, methods, watch, setup, mpOptions) => {
|
|
|
59
61
|
};
|
|
60
62
|
const registerComponent = (runtimeApp, methods, watch, setup, mpOptions, options) => {
|
|
61
63
|
installPublicOptionCapabilities();
|
|
64
|
+
installJsxIslands();
|
|
62
65
|
installPublicMetadataCapabilities(runtimeApp);
|
|
63
66
|
installPublicMetadataCapabilities(methods);
|
|
64
67
|
installPublicMetadataCapabilities(mpOptions);
|
|
@@ -81,6 +84,7 @@ const setWevuDefaults = (defaults) => {
|
|
|
81
84
|
function createWevuScopedSlotComponent(overrides) {
|
|
82
85
|
installTemplateRefs();
|
|
83
86
|
installInlineEvents();
|
|
87
|
+
installJsxIslands();
|
|
84
88
|
installScopedSlots();
|
|
85
89
|
installLayout();
|
|
86
90
|
createWevuScopedSlotComponent$1(overrides);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicRuntime.mjs","names":["createAppCore","defineComponentCore","createWevuComponentCore","registerAppCore","registerComponentCore","mountRuntimeInstanceCore","setWevuDefaultsCore"],"sources":["../../../src/runtime/publicRuntime.ts"],"sourcesContent":["import type { CreateWevuScopedSlotComponentOptions } from './features/scopedSlots'\nimport {\n WEVU_INLINE_MAP_KEY,\n WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n} from '@weapp-core/constants'\nimport { createApp as createAppCore } from './app'\nimport { setWevuDefaults as setWevuDefaultsCore } from './defaults'\nimport {\n createWevuComponent as createWevuComponentCore,\n defineComponent as defineComponentCore,\n} from './define'\nimport { installInlineEvents } from './features/inlineEvents'\nimport { installLayout } from './features/layout'\nimport { installPatchStrategy } from './features/patchStrategy'\nimport {\n createWevuScopedSlotComponent as createWevuScopedSlotComponentCore,\n installScopedSlots,\n} from './features/scopedSlots'\nimport { installSetDataHighFrequencyWarning } from './features/setDataHighFrequencyWarning'\nimport { installTemplateRefs } from './features/templateRefs'\nimport {\n mountRuntimeInstance as mountRuntimeInstanceCore,\n registerApp as registerAppCore,\n registerComponent as registerComponentCore,\n} from './register'\n\nfunction installPublicOptionCapabilities(): void {\n installPatchStrategy()\n installSetDataHighFrequencyWarning()\n}\n\nfunction installPublicMetadataCapabilities(value: unknown): void {\n if (!value || typeof value !== 'object') {\n return\n }\n const record = value as Record<string, unknown>\n const directInlineMap = record[WEVU_INLINE_MAP_KEY]\n const methods = record.methods\n const nestedInlineMap = methods && typeof methods === 'object'\n ? (methods as Record<string, unknown>)[WEVU_INLINE_MAP_KEY]\n : undefined\n if (\n (directInlineMap && typeof directInlineMap === 'object' && Object.keys(directInlineMap).length)\n || (nestedInlineMap && typeof nestedInlineMap === 'object' && Object.keys(nestedInlineMap).length)\n ) {\n installInlineEvents()\n }\n const templateRefs = record.__wevuTemplateRefs\n if (Array.isArray(templateRefs) && templateRefs.length) {\n installTemplateRefs()\n }\n const layoutHosts = record.__wevuLayoutHosts\n if (Array.isArray(layoutHosts) && layoutHosts.length) {\n installLayout()\n }\n const setData = record.setData\n const pick = setData && typeof setData === 'object'\n ? (setData as Record<string, unknown>).pick\n : undefined\n if (\n record[WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY] === true\n || record.__wevuHasTemplateRuntimeBindings === true\n || (Array.isArray(pick) && pick.includes(WEVU_SLOT_OWNER_ID_KEY))\n ) {\n installScopedSlots()\n }\n}\n\nfunction installPublicFactoryCapabilities(options: unknown): void {\n installPublicOptionCapabilities()\n installInlineEvents()\n installScopedSlots()\n installPublicMetadataCapabilities(options)\n}\n\nexport const createApp: typeof createAppCore = (options) => {\n installPublicFactoryCapabilities(options)\n return createAppCore(options)\n}\n\nexport const defineComponent = ((options: Parameters<typeof defineComponentCore>[0]) => {\n installPublicFactoryCapabilities(options)\n return defineComponentCore(options)\n}) as typeof defineComponentCore\n\nexport const createWevuComponent: typeof createWevuComponentCore = (options) => {\n installPublicFactoryCapabilities(options)\n return createWevuComponentCore(options)\n}\n\nexport const registerApp: typeof registerAppCore = (runtimeApp, methods, watch, setup, mpOptions) => {\n installPublicOptionCapabilities()\n installPublicMetadataCapabilities(runtimeApp)\n installPublicMetadataCapabilities(methods)\n installPublicMetadataCapabilities(mpOptions)\n return registerAppCore(runtimeApp, methods, watch, setup, mpOptions)\n}\n\nexport const registerComponent: typeof registerComponentCore = (\n runtimeApp,\n methods,\n watch,\n setup,\n mpOptions,\n options,\n) => {\n installPublicOptionCapabilities()\n installPublicMetadataCapabilities(runtimeApp)\n installPublicMetadataCapabilities(methods)\n installPublicMetadataCapabilities(mpOptions)\n return registerComponentCore(runtimeApp, methods, watch, setup, mpOptions, options)\n}\n\nexport const mountRuntimeInstance: typeof mountRuntimeInstanceCore = (\n target,\n runtimeApp,\n watch,\n setup,\n options,\n) => {\n installPublicOptionCapabilities()\n installPublicMetadataCapabilities(target)\n installPublicMetadataCapabilities(runtimeApp)\n return mountRuntimeInstanceCore(target, runtimeApp, watch, setup, options)\n}\n\nexport const setWevuDefaults: typeof setWevuDefaultsCore = (defaults) => {\n installPatchStrategy()\n installSetDataHighFrequencyWarning()\n return setWevuDefaultsCore(defaults)\n}\n\n/**\n * 创建公开入口的作用域插槽组件,并保留历史上的完整能力行为。\n */\nexport function createWevuScopedSlotComponent(\n overrides?: CreateWevuScopedSlotComponentOptions,\n): void {\n installTemplateRefs()\n installInlineEvents()\n installScopedSlots()\n installLayout()\n createWevuScopedSlotComponentCore(overrides)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"publicRuntime.mjs","names":["createAppCore","defineComponentCore","createWevuComponentCore","registerAppCore","registerComponentCore","mountRuntimeInstanceCore","setWevuDefaultsCore"],"sources":["../../../src/runtime/publicRuntime.ts"],"sourcesContent":["import type { CreateWevuScopedSlotComponentOptions } from './features/scopedSlots'\nimport {\n WEVU_INLINE_MAP_KEY,\n WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n} from '@weapp-core/constants'\nimport { createApp as createAppCore } from './app'\nimport { setWevuDefaults as setWevuDefaultsCore } from './defaults'\nimport {\n createWevuComponent as createWevuComponentCore,\n defineComponent as defineComponentCore,\n} from './define'\nimport { installInlineEvents } from './features/inlineEvents'\nimport { installJsxIslands } from './features/jsxIslands'\nimport { installLayout } from './features/layout'\nimport { installPatchStrategy } from './features/patchStrategy'\nimport {\n createWevuScopedSlotComponent as createWevuScopedSlotComponentCore,\n installScopedSlots,\n} from './features/scopedSlots'\nimport { installSetDataHighFrequencyWarning } from './features/setDataHighFrequencyWarning'\nimport { installTemplateRefs } from './features/templateRefs'\nimport {\n mountRuntimeInstance as mountRuntimeInstanceCore,\n registerApp as registerAppCore,\n registerComponent as registerComponentCore,\n} from './register'\n\nfunction installPublicOptionCapabilities(): void {\n installPatchStrategy()\n installSetDataHighFrequencyWarning()\n}\n\nfunction installPublicMetadataCapabilities(value: unknown): void {\n if (!value || typeof value !== 'object') {\n return\n }\n const record = value as Record<string, unknown>\n const directInlineMap = record[WEVU_INLINE_MAP_KEY]\n const methods = record.methods\n const nestedInlineMap = methods && typeof methods === 'object'\n ? (methods as Record<string, unknown>)[WEVU_INLINE_MAP_KEY]\n : undefined\n if (\n (directInlineMap && typeof directInlineMap === 'object' && Object.keys(directInlineMap).length)\n || (nestedInlineMap && typeof nestedInlineMap === 'object' && Object.keys(nestedInlineMap).length)\n ) {\n installInlineEvents()\n }\n const templateRefs = record.__wevuTemplateRefs\n if (Array.isArray(templateRefs) && templateRefs.length) {\n installTemplateRefs()\n }\n const layoutHosts = record.__wevuLayoutHosts\n if (Array.isArray(layoutHosts) && layoutHosts.length) {\n installLayout()\n }\n const setData = record.setData\n const pick = setData && typeof setData === 'object'\n ? (setData as Record<string, unknown>).pick\n : undefined\n if (\n record[WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY] === true\n || record.__wevuHasTemplateRuntimeBindings === true\n || (Array.isArray(pick) && pick.includes(WEVU_SLOT_OWNER_ID_KEY))\n ) {\n installScopedSlots()\n }\n}\n\nfunction installPublicFactoryCapabilities(options: unknown): void {\n installPublicOptionCapabilities()\n installInlineEvents()\n installJsxIslands()\n installScopedSlots()\n installPublicMetadataCapabilities(options)\n}\n\nexport const createApp: typeof createAppCore = (options) => {\n installPublicFactoryCapabilities(options)\n return createAppCore(options)\n}\n\nexport const defineComponent = ((options: Parameters<typeof defineComponentCore>[0]) => {\n installPublicFactoryCapabilities(options)\n return defineComponentCore(options)\n}) as typeof defineComponentCore\n\nexport const createWevuComponent: typeof createWevuComponentCore = (options) => {\n installPublicFactoryCapabilities(options)\n return createWevuComponentCore(options)\n}\n\nexport const registerApp: typeof registerAppCore = (runtimeApp, methods, watch, setup, mpOptions) => {\n installPublicOptionCapabilities()\n installPublicMetadataCapabilities(runtimeApp)\n installPublicMetadataCapabilities(methods)\n installPublicMetadataCapabilities(mpOptions)\n return registerAppCore(runtimeApp, methods, watch, setup, mpOptions)\n}\n\nexport const registerComponent: typeof registerComponentCore = (\n runtimeApp,\n methods,\n watch,\n setup,\n mpOptions,\n options,\n) => {\n installPublicOptionCapabilities()\n installJsxIslands()\n installPublicMetadataCapabilities(runtimeApp)\n installPublicMetadataCapabilities(methods)\n installPublicMetadataCapabilities(mpOptions)\n return registerComponentCore(runtimeApp, methods, watch, setup, mpOptions, options)\n}\n\nexport const mountRuntimeInstance: typeof mountRuntimeInstanceCore = (\n target,\n runtimeApp,\n watch,\n setup,\n options,\n) => {\n installPublicOptionCapabilities()\n installPublicMetadataCapabilities(target)\n installPublicMetadataCapabilities(runtimeApp)\n return mountRuntimeInstanceCore(target, runtimeApp, watch, setup, options)\n}\n\nexport const setWevuDefaults: typeof setWevuDefaultsCore = (defaults) => {\n installPatchStrategy()\n installSetDataHighFrequencyWarning()\n return setWevuDefaultsCore(defaults)\n}\n\n/**\n * 创建公开入口的作用域插槽组件,并保留历史上的完整能力行为。\n */\nexport function createWevuScopedSlotComponent(\n overrides?: CreateWevuScopedSlotComponentOptions,\n): void {\n installTemplateRefs()\n installInlineEvents()\n installJsxIslands()\n installScopedSlots()\n installLayout()\n createWevuScopedSlotComponentCore(overrides)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,SAAS,kCAAwC;CAC/C,qBAAqB;CACrB,mCAAmC;AACrC;AAEA,SAAS,kCAAkC,OAAsB;CAC/D,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B;CAEF,MAAM,SAAS;CACf,MAAM,kBAAkB,OAAO;CAC/B,MAAM,UAAU,OAAO;CACvB,MAAM,kBAAkB,WAAW,OAAO,YAAY,WACjD,QAAoC,uBACrC;CACJ,IACG,mBAAmB,OAAO,oBAAoB,YAAY,OAAO,KAAK,eAAe,CAAC,CAAC,UACpF,mBAAmB,OAAO,oBAAoB,YAAY,OAAO,KAAK,eAAe,CAAC,CAAC,QAE3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OC,uBAAyB,QAAQ,YAAY,OAAO,OAAO,OAAO;AAC3E;AAEA,MAAa,mBAA+C,aAAa;CACvE,qBAAqB;CACrB,mCAAmC;CACnC,OAAOC,kBAAoB,QAAQ;AACrC;;;;AAKA,SAAgB,8BACd,WACM;CACN,oBAAoB;CACpB,oBAAoB;CACpB,kBAAkB;CAClB,mBAAmB;CACnB,cAAc;CACd,gCAAkC,SAAS;AAC7C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/runtime/pullDownRefresh.d.ts
|
|
2
|
+
export type PullDownRefreshHandler = () => void | Promise<void>;
|
|
3
|
+
export interface UseAsyncPullDownRefreshOptions {
|
|
4
|
+
onError?: (error: unknown) => void | Promise<void>;
|
|
5
|
+
stopPullDownRefresh?: () => unknown | Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 注册下拉刷新回调,并在回调结束后自动停止宿主下拉刷新状态。
|
|
9
|
+
*/
|
|
10
|
+
export declare function useAsyncPullDownRefresh(refresh: PullDownRefreshHandler, options?: UseAsyncPullDownRefreshOptions): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=pullDownRefresh.d.mts.map
|
|
@@ -10,11 +10,9 @@ function useAsyncPullDownRefresh(refresh, options = {}) {
|
|
|
10
10
|
try {
|
|
11
11
|
await refresh();
|
|
12
12
|
} catch (error) {
|
|
13
|
-
|
|
14
|
-
await ((_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options, error));
|
|
13
|
+
await options.onError?.(error);
|
|
15
14
|
} finally {
|
|
16
|
-
|
|
17
|
-
await ((_options$stopPullDown = options.stopPullDownRefresh) !== null && _options$stopPullDown !== void 0 ? _options$stopPullDown : (() => wpi.stopPullDownRefresh()))();
|
|
15
|
+
await (options.stopPullDownRefresh ?? (() => wpi.stopPullDownRefresh()))();
|
|
18
16
|
}
|
|
19
17
|
});
|
|
20
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pullDownRefresh.mjs","names":[],"sources":["../../../src/runtime/pullDownRefresh.ts"],"sourcesContent":["import { wpi } from '@wevu/api'\nimport { onPullDownRefresh } from './hooks'\n\nexport type PullDownRefreshHandler = () => void | Promise<void>\n\nexport interface UseAsyncPullDownRefreshOptions {\n onError?: (error: unknown) => void | Promise<void>\n stopPullDownRefresh?: () => unknown | Promise<unknown>\n}\n\n/**\n * 注册下拉刷新回调,并在回调结束后自动停止宿主下拉刷新状态。\n */\nexport function useAsyncPullDownRefresh(\n refresh: PullDownRefreshHandler,\n options: UseAsyncPullDownRefreshOptions = {},\n) {\n onPullDownRefresh(async () => {\n try {\n await refresh()\n }\n catch (error) {\n await options.onError?.(error)\n }\n finally {\n const stop = options.stopPullDownRefresh ?? (() => wpi.stopPullDownRefresh())\n await stop()\n }\n })\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,wBACd,SACA,UAA0C,CAAC,GAC3C;CACA,kBAAkB,YAAY;EAC5B,IAAI;GACF,MAAM,QAAQ;EAChB,SACO,OAAO
|
|
1
|
+
{"version":3,"file":"pullDownRefresh.mjs","names":[],"sources":["../../../src/runtime/pullDownRefresh.ts"],"sourcesContent":["import { wpi } from '@wevu/api'\nimport { onPullDownRefresh } from './hooks'\n\nexport type PullDownRefreshHandler = () => void | Promise<void>\n\nexport interface UseAsyncPullDownRefreshOptions {\n onError?: (error: unknown) => void | Promise<void>\n stopPullDownRefresh?: () => unknown | Promise<unknown>\n}\n\n/**\n * 注册下拉刷新回调,并在回调结束后自动停止宿主下拉刷新状态。\n */\nexport function useAsyncPullDownRefresh(\n refresh: PullDownRefreshHandler,\n options: UseAsyncPullDownRefreshOptions = {},\n) {\n onPullDownRefresh(async () => {\n try {\n await refresh()\n }\n catch (error) {\n await options.onError?.(error)\n }\n finally {\n const stop = options.stopPullDownRefresh ?? (() => wpi.stopPullDownRefresh())\n await stop()\n }\n })\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,wBACd,SACA,UAA0C,CAAC,GAC3C;CACA,kBAAkB,YAAY;EAC5B,IAAI;GACF,MAAM,QAAQ;EAChB,SACO,OAAO;GACZ,MAAM,QAAQ,UAAU,KAAK;EAC/B,UACQ;GAEN,OADa,QAAQ,8BAA8B,IAAI,oBAAoB,GACjE,CAAC;EACb;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MiniProgramAppOptions } from "../types/miniprogram.mjs";
|
|
2
|
+
import { ComputedDefinitions, MethodDefinitions } from "../types/core.mjs";
|
|
3
|
+
import { RuntimeApp } from "../types/runtime.mjs";
|
|
4
|
+
import { DefineAppOptions } from "../types/options.mjs";
|
|
5
|
+
import "../types.mjs";
|
|
6
|
+
import { WatchMap } from "./watch.mjs";
|
|
7
|
+
//#region src/runtime/register/app.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* 注册 App 入口(框架内部使用)。
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineAppOptions<D, C, M>['setup'], mpOptions: MiniProgramAppOptions): void;
|
|
13
|
+
//#endregion
|
|
14
|
+
//# sourceMappingURL=app.d.mts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCurrentMiniProgramGlobalObject } from "../platform/current.mjs";
|
|
2
|
+
import { supportsCurrentMiniProgramRuntimeCapability } from "../platform.mjs";
|
|
2
3
|
import { callHookList } from "../hooks/base.mjs";
|
|
3
4
|
import { requireRuntimeCapability } from "../capabilities.mjs";
|
|
4
5
|
import { mountRuntimeInstance } from "./runtimeInstance.mjs";
|
|
@@ -9,19 +10,19 @@ const APP_GLOBAL_LISTENER_STORE_KEY = "__wevuAppGlobalListeners";
|
|
|
9
10
|
const MEMORY_WARNING_LISTENER_KEY = "__wevuOnMemoryWarningListener";
|
|
10
11
|
function bindMemoryWarningListener(target) {
|
|
11
12
|
const hooks = target[WEVU_HOOKS_KEY];
|
|
12
|
-
const hasMemoryWarningHook = Boolean(hooks
|
|
13
|
+
const hasMemoryWarningHook = Boolean(hooks?.onMemoryWarning);
|
|
13
14
|
if (!supportsCurrentMiniProgramRuntimeCapability("appMemoryWarningListener")) {
|
|
14
15
|
delete target[MEMORY_WARNING_LISTENER_KEY];
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
const miniProgramGlobal =
|
|
18
|
-
const onMemoryWarning = miniProgramGlobal
|
|
19
|
-
const offMemoryWarning = miniProgramGlobal
|
|
18
|
+
const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
|
|
19
|
+
const onMemoryWarning = miniProgramGlobal?.onMemoryWarning;
|
|
20
|
+
const offMemoryWarning = miniProgramGlobal?.offMemoryWarning;
|
|
20
21
|
if (typeof onMemoryWarning !== "function") return;
|
|
21
22
|
const existing = target[MEMORY_WARNING_LISTENER_KEY];
|
|
22
23
|
if (typeof existing === "function" && typeof offMemoryWarning === "function") try {
|
|
23
24
|
offMemoryWarning(existing);
|
|
24
|
-
} catch
|
|
25
|
+
} catch {}
|
|
25
26
|
if (!hasMemoryWarningHook) {
|
|
26
27
|
delete target[MEMORY_WARNING_LISTENER_KEY];
|
|
27
28
|
return;
|
|
@@ -33,23 +34,23 @@ function bindMemoryWarningListener(target) {
|
|
|
33
34
|
onMemoryWarning(listener);
|
|
34
35
|
}
|
|
35
36
|
function bindAppGlobalListener(target, options) {
|
|
36
|
-
var _ref
|
|
37
|
+
var _ref;
|
|
37
38
|
const { hookName, onApiName, offApiName, capabilityName, userHandler } = options;
|
|
38
39
|
const hooks = target[WEVU_HOOKS_KEY];
|
|
39
|
-
const hasHook = Boolean(hooks
|
|
40
|
-
const store = (_ref
|
|
40
|
+
const hasHook = Boolean(hooks?.[hookName]);
|
|
41
|
+
const store = (_ref = target)[APP_GLOBAL_LISTENER_STORE_KEY] ?? (_ref[APP_GLOBAL_LISTENER_STORE_KEY] = Object.create(null));
|
|
41
42
|
const existing = store[hookName];
|
|
42
43
|
if (!supportsCurrentMiniProgramRuntimeCapability(capabilityName)) {
|
|
43
44
|
delete store[hookName];
|
|
44
45
|
delete target[hookName];
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
|
-
const miniProgramGlobal =
|
|
48
|
-
const onApi = miniProgramGlobal
|
|
49
|
-
const offApi = miniProgramGlobal
|
|
48
|
+
const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
|
|
49
|
+
const onApi = miniProgramGlobal?.[onApiName];
|
|
50
|
+
const offApi = miniProgramGlobal?.[offApiName];
|
|
50
51
|
if (typeof existing === "function" && typeof offApi === "function") try {
|
|
51
52
|
offApi(existing);
|
|
52
|
-
} catch
|
|
53
|
+
} catch {}
|
|
53
54
|
if (!hasHook && typeof userHandler !== "function") {
|
|
54
55
|
delete store[hookName];
|
|
55
56
|
return;
|
|
@@ -97,12 +98,11 @@ function bindAppGlobalListeners(target, handlers) {
|
|
|
97
98
|
* @internal
|
|
98
99
|
*/
|
|
99
100
|
function registerApp(runtimeApp, methods, watch, setup, mpOptions) {
|
|
100
|
-
var _appOptions$globalDat;
|
|
101
101
|
if (typeof App !== "function") throw new TypeError("createApp 需要全局 App 构造器可用");
|
|
102
|
-
const methodNames = Object.keys(methods
|
|
102
|
+
const methodNames = Object.keys(methods ?? {});
|
|
103
103
|
const appOptions = { ...mpOptions };
|
|
104
|
-
appOptions.globalData =
|
|
105
|
-
const methodRecord = methods
|
|
104
|
+
appOptions.globalData = appOptions.globalData ?? {};
|
|
105
|
+
const methodRecord = methods ?? {};
|
|
106
106
|
const inlineMap = methodRecord[WEVU_INLINE_MAP_KEY];
|
|
107
107
|
const requiresInlineEvents = Object.prototype.hasOwnProperty.call(methodRecord, WEVU_INLINE_MAP_KEY) && inlineMap && typeof inlineMap === "object" && Object.keys(inlineMap).length > 0;
|
|
108
108
|
if (!appOptions[WEVU_INLINE_HANDLER] && requiresInlineEvents) appOptions[WEVU_INLINE_HANDLER] = requireRuntimeCapability("inlineEvents", "registerApp(inline event metadata)").handler;
|
|
@@ -141,10 +141,9 @@ function registerApp(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
141
141
|
for (const methodName of methodNames) {
|
|
142
142
|
const userMethod = appOptions[methodName];
|
|
143
143
|
appOptions[methodName] = function runtimeMethod(...args) {
|
|
144
|
-
var _runtime$methods;
|
|
145
144
|
const runtime = this.__wevu;
|
|
146
145
|
let result;
|
|
147
|
-
const bound = runtime
|
|
146
|
+
const bound = runtime?.methods?.[methodName];
|
|
148
147
|
if (bound) result = bound.apply(runtime.proxy, args);
|
|
149
148
|
if (typeof userMethod === "function") return userMethod.apply(this, args);
|
|
150
149
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.mjs","names":[],"sources":["../../../../src/runtime/register/app.ts"],"sourcesContent":["import type {\n ComputedDefinitions,\n DefineAppOptions,\n InternalRuntimeState,\n MethodDefinitions,\n MiniProgramAppOptions,\n MiniProgramMemoryWarningResult,\n RuntimeApp,\n} from '../types'\nimport type { WatchMap } from './watch'\nimport {\n WEVU_HOOKS_KEY,\n WEVU_INLINE_HANDLER,\n WEVU_INLINE_MAP_KEY,\n WEVU_IS_APP_INSTANCE_KEY,\n} from '@weapp-core/constants'\nimport { requireRuntimeCapability } from '../capabilities'\nimport { callHookList } from '../hooks'\nimport { getMiniProgramGlobalObject, supportsCurrentMiniProgramRuntimeCapability } from '../platform'\nimport { mountRuntimeInstance } from './runtimeInstance'\n\nconst APP_GLOBAL_LISTENER_STORE_KEY = '__wevuAppGlobalListeners'\nconst MEMORY_WARNING_LISTENER_KEY = '__wevuOnMemoryWarningListener'\n\nfunction bindMemoryWarningListener(target: InternalRuntimeState) {\n const hooks = target[WEVU_HOOKS_KEY] as Record<string, any> | undefined\n const hasMemoryWarningHook = Boolean(hooks?.onMemoryWarning)\n if (!supportsCurrentMiniProgramRuntimeCapability('appMemoryWarningListener')) {\n delete (target as any)[MEMORY_WARNING_LISTENER_KEY]\n return\n }\n const miniProgramGlobal = getMiniProgramGlobalObject()\n const onMemoryWarning = miniProgramGlobal?.onMemoryWarning\n const offMemoryWarning = miniProgramGlobal?.offMemoryWarning\n if (typeof onMemoryWarning !== 'function') {\n return\n }\n\n const existing = (target as any)[MEMORY_WARNING_LISTENER_KEY]\n if (typeof existing === 'function' && typeof offMemoryWarning === 'function') {\n try {\n offMemoryWarning(existing)\n }\n catch {\n // 忽略平台差异导致的取消监听异常\n }\n }\n\n if (!hasMemoryWarningHook) {\n delete (target as any)[MEMORY_WARNING_LISTENER_KEY]\n return\n }\n\n const listener = (result: MiniProgramMemoryWarningResult) => {\n callHookList(target, 'onMemoryWarning', [result])\n }\n ;(target as any)[MEMORY_WARNING_LISTENER_KEY] = listener\n onMemoryWarning(listener)\n}\n\nfunction bindAppGlobalListener(target: InternalRuntimeState, options: {\n hookName: 'onError' | 'onPageNotFound' | 'onUnhandledRejection' | 'onThemeChange'\n onApiName: 'onError' | 'onPageNotFound' | 'onUnhandledRejection' | 'onThemeChange'\n offApiName: 'offError' | 'offPageNotFound' | 'offUnhandledRejection' | 'offThemeChange'\n capabilityName: 'appErrorListener' | 'appPageNotFoundListener' | 'appUnhandledRejectionListener' | 'appThemeChangeListener'\n userHandler?: ((...args: any[]) => any) | undefined\n}) {\n const { hookName, onApiName, offApiName, capabilityName, userHandler } = options\n const hooks = target[WEVU_HOOKS_KEY] as Record<string, any> | undefined\n const hasHook = Boolean(hooks?.[hookName])\n const store = ((target as any)[APP_GLOBAL_LISTENER_STORE_KEY] ??= Object.create(null)) as Record<string, ((...args: any[]) => void) | undefined>\n const existing = store[hookName]\n if (!supportsCurrentMiniProgramRuntimeCapability(capabilityName)) {\n delete store[hookName]\n delete (target as any)[hookName]\n return\n }\n const miniProgramGlobal = getMiniProgramGlobalObject()\n const onApi = miniProgramGlobal?.[onApiName]\n const offApi = miniProgramGlobal?.[offApiName]\n\n if (typeof existing === 'function' && typeof offApi === 'function') {\n try {\n offApi(existing)\n }\n catch {\n // 忽略平台差异导致的取消监听异常\n }\n }\n\n if (!hasHook && typeof userHandler !== 'function') {\n delete store[hookName]\n return\n }\n\n const dispatch = (...args: any[]) => {\n callHookList(target, hookName, args)\n if (typeof userHandler === 'function') {\n userHandler.apply(target, args)\n }\n }\n\n ;(target as any)[hookName] = dispatch\n store[hookName] = dispatch\n\n if (typeof onApi === 'function') {\n onApi(dispatch)\n }\n}\n\nfunction bindAppGlobalListeners(\n target: InternalRuntimeState,\n handlers: {\n onError?: ((...args: any[]) => any) | undefined\n onPageNotFound?: ((...args: any[]) => any) | undefined\n onUnhandledRejection?: ((...args: any[]) => any) | undefined\n onThemeChange?: ((...args: any[]) => any) | undefined\n },\n) {\n bindAppGlobalListener(target, {\n hookName: 'onError',\n onApiName: 'onError',\n offApiName: 'offError',\n capabilityName: 'appErrorListener',\n userHandler: handlers.onError,\n })\n bindAppGlobalListener(target, {\n hookName: 'onPageNotFound',\n onApiName: 'onPageNotFound',\n offApiName: 'offPageNotFound',\n capabilityName: 'appPageNotFoundListener',\n userHandler: handlers.onPageNotFound,\n })\n bindAppGlobalListener(target, {\n hookName: 'onUnhandledRejection',\n onApiName: 'onUnhandledRejection',\n offApiName: 'offUnhandledRejection',\n capabilityName: 'appUnhandledRejectionListener',\n userHandler: handlers.onUnhandledRejection,\n })\n bindAppGlobalListener(target, {\n hookName: 'onThemeChange',\n onApiName: 'onThemeChange',\n offApiName: 'offThemeChange',\n capabilityName: 'appThemeChangeListener',\n userHandler: handlers.onThemeChange,\n })\n}\n\n/**\n * 注册 App 入口(框架内部使用)。\n * @internal\n */\nexport function registerApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n runtimeApp: RuntimeApp<D, C, M>,\n methods: MethodDefinitions,\n watch: WatchMap | undefined,\n setup: DefineAppOptions<D, C, M>['setup'],\n mpOptions: MiniProgramAppOptions,\n) {\n if (typeof App !== 'function') {\n throw new TypeError('createApp 需要全局 App 构造器可用')\n }\n\n const methodNames = Object.keys(methods ?? {})\n const appOptions: Record<string, any> = {\n ...mpOptions,\n }\n\n appOptions.globalData = appOptions.globalData ?? {}\n\n const methodRecord = (methods ?? {}) as Record<string, unknown>\n const inlineMap = methodRecord[WEVU_INLINE_MAP_KEY]\n const requiresInlineEvents = Object.prototype.hasOwnProperty.call(methodRecord, WEVU_INLINE_MAP_KEY)\n && inlineMap\n && typeof inlineMap === 'object'\n && Object.keys(inlineMap).length > 0\n if (!appOptions[WEVU_INLINE_HANDLER] && requiresInlineEvents) {\n appOptions[WEVU_INLINE_HANDLER] = requireRuntimeCapability(\n 'inlineEvents',\n 'registerApp(inline event metadata)',\n ).handler\n }\n\n const userOnLaunch = appOptions.onLaunch\n const userOnError = appOptions.onError\n const userOnPageNotFound = (appOptions as any).onPageNotFound\n const userOnUnhandledRejection = (appOptions as any).onUnhandledRejection\n const userOnThemeChange = (appOptions as any).onThemeChange\n appOptions.onLaunch = function onLaunch(this: InternalRuntimeState, ...args: any[]) {\n this[WEVU_IS_APP_INSTANCE_KEY] = true\n mountRuntimeInstance(this, runtimeApp, watch, setup)\n bindMemoryWarningListener(this)\n bindAppGlobalListeners(this, {\n onError: userOnError,\n onPageNotFound: userOnPageNotFound,\n onUnhandledRejection: userOnUnhandledRejection,\n onThemeChange: userOnThemeChange,\n })\n callHookList(this, 'onLaunch', args)\n if (typeof userOnLaunch === 'function') {\n userOnLaunch.apply(this, args)\n }\n }\n\n const userOnShow = appOptions.onShow\n appOptions.onShow = function onShow(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, 'onShow', args)\n if (typeof userOnShow === 'function') {\n userOnShow.apply(this, args)\n }\n }\n\n const userOnHide = appOptions.onHide\n appOptions.onHide = function onHide(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, 'onHide', args)\n if (typeof userOnHide === 'function') {\n userOnHide.apply(this, args)\n }\n }\n\n delete appOptions.onError\n delete (appOptions as any).onPageNotFound\n delete (appOptions as any).onUnhandledRejection\n delete (appOptions as any).onThemeChange\n\n for (const methodName of methodNames) {\n const userMethod = appOptions[methodName]\n appOptions[methodName] = function runtimeMethod(this: InternalRuntimeState, ...args: any[]) {\n const runtime = this.__wevu\n let result: unknown\n const bound = runtime?.methods?.[methodName]\n if (bound) {\n result = bound.apply(runtime.proxy, args)\n }\n if (typeof userMethod === 'function') {\n return userMethod.apply(this, args)\n }\n return result\n }\n }\n\n App(appOptions)\n}\n"],"mappings":";;;;;;;AAqBA,MAAM,gCAAgC;AACtC,MAAM,8BAA8B;AAEpC,SAAS,0BAA0B,QAA8B;CAC/D,MAAM,QAAQ,OAAO;CACrB,MAAM,uBAAuB,sDAAQ,MAAO,eAAe;CAC3D,IAAI,CAAC,4CAA4C,0BAA0B,GAAG;EAC5E,OAAQ,OAAe;EACvB;CACF;CACA,MAAM,oBAAoB,2BAA2B;CACrD,MAAM,wFAAkB,kBAAmB;CAC3C,MAAM,yFAAmB,kBAAmB;CAC5C,IAAI,OAAO,oBAAoB,YAC7B;CAGF,MAAM,WAAY,OAAe;CACjC,IAAI,OAAO,aAAa,cAAc,OAAO,qBAAqB,YAChE,IAAI;EACF,iBAAiB,QAAQ;CAC3B,kBACM,CAEN;CAGF,IAAI,CAAC,sBAAsB;EACzB,OAAQ,OAAe;EACvB;CACF;CAEA,MAAM,YAAY,WAA2C;EAC3D,aAAa,QAAQ,mBAAmB,CAAC,MAAM,CAAC;CAClD;CACC,AAAC,OAAe,+BAA+B;CAChD,gBAAgB,QAAQ;AAC1B;AAEA,SAAS,sBAAsB,QAA8B,SAM1D;;CACD,MAAM,EAAE,UAAU,WAAW,YAAY,gBAAgB,gBAAgB;CACzE,MAAM,QAAQ,OAAO;CACrB,MAAM,UAAU,sDAAQ,MAAQ,SAAS;CACzC,MAAM,yCAAU,QAAe,6IAAmC,OAAO,OAAO,IAAI;CACpF,MAAM,WAAW,MAAM;CACvB,IAAI,CAAC,4CAA4C,cAAc,GAAG;EAChE,OAAO,MAAM;EACb,OA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,MAAM,QAAQ,OAAO,IAAI;GAE1C,IAAI,OAAO,eAAe,YACxB,OAAO,WAAW,MAAM,MAAM,IAAI;GAEpC,OAAO;EACT;CACF;CAEA,IAAI,UAAU;AAChB"}
|
|
1
|
+
{"version":3,"file":"app.mjs","names":[],"sources":["../../../../src/runtime/register/app.ts"],"sourcesContent":["import type {\n ComputedDefinitions,\n DefineAppOptions,\n InternalRuntimeState,\n MethodDefinitions,\n MiniProgramAppOptions,\n MiniProgramMemoryWarningResult,\n RuntimeApp,\n} from '../types'\nimport type { WatchMap } from './watch'\nimport {\n WEVU_HOOKS_KEY,\n WEVU_INLINE_HANDLER,\n WEVU_INLINE_MAP_KEY,\n WEVU_IS_APP_INSTANCE_KEY,\n} from '@weapp-core/constants'\nimport { requireRuntimeCapability } from '../capabilities'\nimport { callHookList } from '../hooks'\nimport { getCurrentMiniProgramGlobalObject, supportsCurrentMiniProgramRuntimeCapability } from '../platform'\nimport { mountRuntimeInstance } from './runtimeInstance'\n\nconst APP_GLOBAL_LISTENER_STORE_KEY = '__wevuAppGlobalListeners'\nconst MEMORY_WARNING_LISTENER_KEY = '__wevuOnMemoryWarningListener'\n\nfunction bindMemoryWarningListener(target: InternalRuntimeState) {\n const hooks = target[WEVU_HOOKS_KEY] as Record<string, any> | undefined\n const hasMemoryWarningHook = Boolean(hooks?.onMemoryWarning)\n if (!supportsCurrentMiniProgramRuntimeCapability('appMemoryWarningListener')) {\n delete (target as any)[MEMORY_WARNING_LISTENER_KEY]\n return\n }\n const miniProgramGlobal = getCurrentMiniProgramGlobalObject()\n const onMemoryWarning = miniProgramGlobal?.onMemoryWarning\n const offMemoryWarning = miniProgramGlobal?.offMemoryWarning\n if (typeof onMemoryWarning !== 'function') {\n return\n }\n\n const existing = (target as any)[MEMORY_WARNING_LISTENER_KEY]\n if (typeof existing === 'function' && typeof offMemoryWarning === 'function') {\n try {\n offMemoryWarning(existing)\n }\n catch {\n // 忽略平台差异导致的取消监听异常\n }\n }\n\n if (!hasMemoryWarningHook) {\n delete (target as any)[MEMORY_WARNING_LISTENER_KEY]\n return\n }\n\n const listener = (result: MiniProgramMemoryWarningResult) => {\n callHookList(target, 'onMemoryWarning', [result])\n }\n ;(target as any)[MEMORY_WARNING_LISTENER_KEY] = listener\n onMemoryWarning(listener)\n}\n\nfunction bindAppGlobalListener(target: InternalRuntimeState, options: {\n hookName: 'onError' | 'onPageNotFound' | 'onUnhandledRejection' | 'onThemeChange'\n onApiName: 'onError' | 'onPageNotFound' | 'onUnhandledRejection' | 'onThemeChange'\n offApiName: 'offError' | 'offPageNotFound' | 'offUnhandledRejection' | 'offThemeChange'\n capabilityName: 'appErrorListener' | 'appPageNotFoundListener' | 'appUnhandledRejectionListener' | 'appThemeChangeListener'\n userHandler?: ((...args: any[]) => any) | undefined\n}) {\n const { hookName, onApiName, offApiName, capabilityName, userHandler } = options\n const hooks = target[WEVU_HOOKS_KEY] as Record<string, any> | undefined\n const hasHook = Boolean(hooks?.[hookName])\n const store = ((target as any)[APP_GLOBAL_LISTENER_STORE_KEY] ??= Object.create(null)) as Record<string, ((...args: any[]) => void) | undefined>\n const existing = store[hookName]\n if (!supportsCurrentMiniProgramRuntimeCapability(capabilityName)) {\n delete store[hookName]\n delete (target as any)[hookName]\n return\n }\n const miniProgramGlobal = getCurrentMiniProgramGlobalObject()\n const onApi = miniProgramGlobal?.[onApiName]\n const offApi = miniProgramGlobal?.[offApiName]\n\n if (typeof existing === 'function' && typeof offApi === 'function') {\n try {\n offApi(existing)\n }\n catch {\n // 忽略平台差异导致的取消监听异常\n }\n }\n\n if (!hasHook && typeof userHandler !== 'function') {\n delete store[hookName]\n return\n }\n\n const dispatch = (...args: any[]) => {\n callHookList(target, hookName, args)\n if (typeof userHandler === 'function') {\n userHandler.apply(target, args)\n }\n }\n\n ;(target as any)[hookName] = dispatch\n store[hookName] = dispatch\n\n if (typeof onApi === 'function') {\n onApi(dispatch)\n }\n}\n\nfunction bindAppGlobalListeners(\n target: InternalRuntimeState,\n handlers: {\n onError?: ((...args: any[]) => any) | undefined\n onPageNotFound?: ((...args: any[]) => any) | undefined\n onUnhandledRejection?: ((...args: any[]) => any) | undefined\n onThemeChange?: ((...args: any[]) => any) | undefined\n },\n) {\n bindAppGlobalListener(target, {\n hookName: 'onError',\n onApiName: 'onError',\n offApiName: 'offError',\n capabilityName: 'appErrorListener',\n userHandler: handlers.onError,\n })\n bindAppGlobalListener(target, {\n hookName: 'onPageNotFound',\n onApiName: 'onPageNotFound',\n offApiName: 'offPageNotFound',\n capabilityName: 'appPageNotFoundListener',\n userHandler: handlers.onPageNotFound,\n })\n bindAppGlobalListener(target, {\n hookName: 'onUnhandledRejection',\n onApiName: 'onUnhandledRejection',\n offApiName: 'offUnhandledRejection',\n capabilityName: 'appUnhandledRejectionListener',\n userHandler: handlers.onUnhandledRejection,\n })\n bindAppGlobalListener(target, {\n hookName: 'onThemeChange',\n onApiName: 'onThemeChange',\n offApiName: 'offThemeChange',\n capabilityName: 'appThemeChangeListener',\n userHandler: handlers.onThemeChange,\n })\n}\n\n/**\n * 注册 App 入口(框架内部使用)。\n * @internal\n */\nexport function registerApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n runtimeApp: RuntimeApp<D, C, M>,\n methods: MethodDefinitions,\n watch: WatchMap | undefined,\n setup: DefineAppOptions<D, C, M>['setup'],\n mpOptions: MiniProgramAppOptions,\n) {\n if (typeof App !== 'function') {\n throw new TypeError('createApp 需要全局 App 构造器可用')\n }\n\n const methodNames = Object.keys(methods ?? {})\n const appOptions: Record<string, any> = {\n ...mpOptions,\n }\n\n appOptions.globalData = appOptions.globalData ?? {}\n\n const methodRecord = (methods ?? {}) as Record<string, unknown>\n const inlineMap = methodRecord[WEVU_INLINE_MAP_KEY]\n const requiresInlineEvents = Object.prototype.hasOwnProperty.call(methodRecord, WEVU_INLINE_MAP_KEY)\n && inlineMap\n && typeof inlineMap === 'object'\n && Object.keys(inlineMap).length > 0\n if (!appOptions[WEVU_INLINE_HANDLER] && requiresInlineEvents) {\n appOptions[WEVU_INLINE_HANDLER] = requireRuntimeCapability(\n 'inlineEvents',\n 'registerApp(inline event metadata)',\n ).handler\n }\n\n const userOnLaunch = appOptions.onLaunch\n const userOnError = appOptions.onError\n const userOnPageNotFound = (appOptions as any).onPageNotFound\n const userOnUnhandledRejection = (appOptions as any).onUnhandledRejection\n const userOnThemeChange = (appOptions as any).onThemeChange\n appOptions.onLaunch = function onLaunch(this: InternalRuntimeState, ...args: any[]) {\n this[WEVU_IS_APP_INSTANCE_KEY] = true\n mountRuntimeInstance(this, runtimeApp, watch, setup)\n bindMemoryWarningListener(this)\n bindAppGlobalListeners(this, {\n onError: userOnError,\n onPageNotFound: userOnPageNotFound,\n onUnhandledRejection: userOnUnhandledRejection,\n onThemeChange: userOnThemeChange,\n })\n callHookList(this, 'onLaunch', args)\n if (typeof userOnLaunch === 'function') {\n userOnLaunch.apply(this, args)\n }\n }\n\n const userOnShow = appOptions.onShow\n appOptions.onShow = function onShow(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, 'onShow', args)\n if (typeof userOnShow === 'function') {\n userOnShow.apply(this, args)\n }\n }\n\n const userOnHide = appOptions.onHide\n appOptions.onHide = function onHide(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, 'onHide', args)\n if (typeof userOnHide === 'function') {\n userOnHide.apply(this, args)\n }\n }\n\n delete appOptions.onError\n delete (appOptions as any).onPageNotFound\n delete (appOptions as any).onUnhandledRejection\n delete (appOptions as any).onThemeChange\n\n for (const methodName of methodNames) {\n const userMethod = appOptions[methodName]\n appOptions[methodName] = function runtimeMethod(this: InternalRuntimeState, ...args: any[]) {\n const runtime = this.__wevu\n let result: unknown\n const bound = runtime?.methods?.[methodName]\n if (bound) {\n result = bound.apply(runtime.proxy, args)\n }\n if (typeof userMethod === 'function') {\n return userMethod.apply(this, args)\n }\n return result\n }\n }\n\n App(appOptions)\n}\n"],"mappings":";;;;;;;;AAqBA,MAAM,gCAAgC;AACtC,MAAM,8B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AAS,SAAqC,GAAG,MAAa;EAClF,KAAK,4BAA4B;EACjC,qBAAqB,MAAM,YAAY,OAAO,KAAK;EACnD,0BAA0B,IAAI;EAC9B,uBAAuB,MAAM;GAC3B,SAAS;GACT,gBAAgB;GAChB,sBAAsB;GACtB,eAAe;EACjB,CAAC;EACD,aAAa,MAAM,YAAY,IAAI;EACnC,IAAI,OAAO,iBAAiB,YAC1B,aAAa,MAAM,MAAM,IAAI;CAEjC;CAEA,MAAM,aAAa,WAAW;CAC9B,WAAW,SAAS,SAAS,OAAmC,GAAG,MAAa;EAC9E,aAAa,MAAM,UAAU,IAAI;EACjC,IAAI,OAAO,eAAe,YACxB,WAAW,MAAM,MAAM,IAAI;CAE/B;CAEA,MAAM,aAAa,WAAW;CAC9B,WAAW,SAAS,SAAS,OAAmC,GAAG,MAAa;EAC9E,aAAa,MAAM,UAAU,IAAI;EACjC,IAAI,OAAO,eAAe,YACxB,WAAW,MAAM,MAAM,IAAI;CAE/B;CAEA,OAAO,WAAW;CAClB,OAAQ,WAAmB;CAC3B,OAAQ,WAAmB;CAC3B,OAAQ,WAAmB;CAE3B,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,aAAa,WAAW;EAC9B,WAAW,cAAc,SAAS,cAA0C,GAAG,MAAa;GAC1F,MAAM,UAAU,KAAK;GACrB,IAAI;GACJ,MAAM,QAAQ,SAAS,UAAU;GACjC,IAAI,OACF,SAAS,MAAM,MAAM,QAAQ,OAAO,IAAI;GAE1C,IAAI,OAAO,eAAe,YACxB,OAAO,WAAW,MAAM,MAAM,IAAI;GAEpC,OAAO;EACT;CACF;CAEA,IAAI,UAAU;AAChB"}
|
|
@@ -30,38 +30,29 @@ function createAlipayComponentDefinition(definition) {
|
|
|
30
30
|
...rest.methods
|
|
31
31
|
},
|
|
32
32
|
onInit() {
|
|
33
|
-
var _lifetimes$created;
|
|
34
33
|
this.properties = this.props;
|
|
35
|
-
|
|
34
|
+
lifetimes.created?.call(this);
|
|
36
35
|
},
|
|
37
36
|
didMount() {
|
|
38
|
-
var _lifetimes$attached, _lifetimes$ready;
|
|
39
37
|
this.properties = this.props;
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
lifetimes.attached?.call(this);
|
|
39
|
+
lifetimes.ready?.call(this);
|
|
42
40
|
},
|
|
43
41
|
deriveDataFromProps(nextProps) {
|
|
44
|
-
|
|
45
|
-
const previous = (_this$properties = this.properties) !== null && _this$properties !== void 0 ? _this$properties : this.props;
|
|
42
|
+
const previous = this.properties ?? this.props;
|
|
46
43
|
this.properties = nextProps;
|
|
47
|
-
for (const key of Object.keys(properties)) if (!Object.is(previous
|
|
48
|
-
|
|
49
|
-
(_observers$key = observers[key]) === null || _observers$key === void 0 || _observers$key.call(this, nextProps[key], previous === null || previous === void 0 ? void 0 : previous[key]);
|
|
50
|
-
}
|
|
51
|
-
(_observers$ = observers["**"]) === null || _observers$ === void 0 || _observers$.call(this, nextProps);
|
|
44
|
+
for (const key of Object.keys(properties)) if (!Object.is(previous?.[key], nextProps[key])) observers[key]?.call(this, nextProps[key], previous?.[key]);
|
|
45
|
+
observers["**"]?.call(this, nextProps);
|
|
52
46
|
},
|
|
53
47
|
didUnmount() {
|
|
54
|
-
|
|
55
|
-
(_lifetimes$detached = lifetimes.detached) === null || _lifetimes$detached === void 0 || _lifetimes$detached.call(this);
|
|
48
|
+
lifetimes.detached?.call(this);
|
|
56
49
|
},
|
|
57
50
|
pageEvents: {
|
|
58
51
|
onShow() {
|
|
59
|
-
|
|
60
|
-
(_pageLifetimes$show = pageLifetimes.show) === null || _pageLifetimes$show === void 0 || _pageLifetimes$show.call(this);
|
|
52
|
+
pageLifetimes.show?.call(this);
|
|
61
53
|
},
|
|
62
54
|
onHide() {
|
|
63
|
-
|
|
64
|
-
(_pageLifetimes$hide = pageLifetimes.hide) === null || _pageLifetimes$hide === void 0 || _pageLifetimes$hide.call(this);
|
|
55
|
+
pageLifetimes.hide?.call(this);
|
|
65
56
|
}
|
|
66
57
|
}
|
|
67
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alipay.mjs","names":[],"sources":["../../../../../src/runtime/register/component/alipay.ts"],"sourcesContent":["import type { InternalRuntimeState } from '../../types'\n\ntype AlipayComponentInstance = InternalRuntimeState & {\n props: Record<string, any>\n properties: Record<string, any>\n}\n\n/** 支付宝通过函数属性派发自定义事件,补齐模板分派器需要的事件与数据集。 */\nfunction triggerAlipayEvent(this: AlipayComponentInstance, eventName: string, detail: unknown) {\n const callbackName = `on${eventName.replace(/(^|-)([a-z0-9])/g, (_match, _separator, character: string) => character.toUpperCase())}`\n const callback = this.props[callbackName]\n if (typeof callback !== 'function') {\n return\n }\n const dataset: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(this.props)) {\n if (key.startsWith('data-')) {\n dataset[key.slice(5)] = value\n }\n }\n const target = { id: this.props.id, dataset }\n return callback({ type: eventName, detail, target, currentTarget: target })\n}\n\n/** 将宿主生命周期和 props 统一到现有组件运行时,避免维护第二套响应式挂载流程。 */\nexport function createAlipayComponentDefinition(definition: Record<string, any>) {\n const { lifetimes = {}, properties = {}, observers = {}, pageLifetimes = {}, ...rest } = definition\n const props: Record<string, unknown> = {}\n for (const [key, property] of Object.entries(properties)) {\n props[key] = property && typeof property === 'object' && 'value' in property ? property.value : null\n }\n\n return {\n ...rest,\n props,\n methods: {\n triggerEvent: triggerAlipayEvent,\n ...rest.methods,\n },\n onInit(this: AlipayComponentInstance) {\n this.properties = this.props\n lifetimes.created?.call(this)\n },\n didMount(this: AlipayComponentInstance) {\n this.properties = this.props\n lifetimes.attached?.call(this)\n lifetimes.ready?.call(this)\n },\n deriveDataFromProps(this: AlipayComponentInstance, nextProps: Record<string, any>) {\n const previous = this.properties ?? this.props\n // 支付宝此时的 this.props 仍是旧值,以回调参数作为唯一更新来源。\n this.properties = nextProps\n for (const key of Object.keys(properties)) {\n if (!Object.is(previous?.[key], nextProps[key])) {\n observers[key]?.call(this, nextProps[key], previous?.[key])\n }\n }\n observers['**']?.call(this, nextProps)\n },\n didUnmount(this: AlipayComponentInstance) {\n lifetimes.detached?.call(this)\n },\n pageEvents: {\n onShow(this: AlipayComponentInstance) {\n pageLifetimes.show?.call(this)\n },\n onHide(this: AlipayComponentInstance) {\n pageLifetimes.hide?.call(this)\n },\n },\n }\n}\n"],"mappings":";;AAQA,SAAS,mBAAkD,WAAmB,QAAiB;CAC7F,MAAM,eAAe,KAAK,UAAU,QAAQ,qBAAqB,QAAQ,YAAY,cAAsB,UAAU,YAAY,CAAC;CAClI,MAAM,WAAW,KAAK,MAAM;CAC5B,IAAI,OAAO,aAAa,YACtB;CAEF,MAAM,UAAmC,CAAC;CAC1C,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,KAAK,GAClD,IAAI,IAAI,WAAW,OAAO,GACxB,QAAQ,IAAI,MAAM,CAAC,KAAK;CAG5B,MAAM,SAAS;EAAE,IAAI,KAAK,MAAM;EAAI;CAAQ;CAC5C,OAAO,SAAS;EAAE,MAAM;EAAW;EAAQ;EAAQ,eAAe;CAAO,CAAC;AAC5E;;AAGA,SAAgB,gCAAgC,YAAiC;CAC/E,MAAM,EAAE,YAAY,CAAC,GAAG,aAAa,CAAC,GAAG,YAAY,CAAC,GAAG,gBAAgB,CAAC,GAAG,GAAG,SAAS;CACzF,MAAM,QAAiC,CAAC;CACxC,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QAAQ,UAAU,GACrD,MAAM,OAAO,YAAY,OAAO,aAAa,YAAY,WAAW,WAAW,SAAS,QAAQ;CAGlG,OAAO;EACL,GAAG;EACH;EACA,SAAS;GACP,cAAc;GACd,GAAG,KAAK;EACV;EACA,SAAsC
|
|
1
|
+
{"version":3,"file":"alipay.mjs","names":[],"sources":["../../../../../src/runtime/register/component/alipay.ts"],"sourcesContent":["import type { InternalRuntimeState } from '../../types'\n\ntype AlipayComponentInstance = InternalRuntimeState & {\n props: Record<string, any>\n properties: Record<string, any>\n}\n\n/** 支付宝通过函数属性派发自定义事件,补齐模板分派器需要的事件与数据集。 */\nfunction triggerAlipayEvent(this: AlipayComponentInstance, eventName: string, detail: unknown) {\n const callbackName = `on${eventName.replace(/(^|-)([a-z0-9])/g, (_match, _separator, character: string) => character.toUpperCase())}`\n const callback = this.props[callbackName]\n if (typeof callback !== 'function') {\n return\n }\n const dataset: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(this.props)) {\n if (key.startsWith('data-')) {\n dataset[key.slice(5)] = value\n }\n }\n const target = { id: this.props.id, dataset }\n return callback({ type: eventName, detail, target, currentTarget: target })\n}\n\n/** 将宿主生命周期和 props 统一到现有组件运行时,避免维护第二套响应式挂载流程。 */\nexport function createAlipayComponentDefinition(definition: Record<string, any>) {\n const { lifetimes = {}, properties = {}, observers = {}, pageLifetimes = {}, ...rest } = definition\n const props: Record<string, unknown> = {}\n for (const [key, property] of Object.entries(properties)) {\n props[key] = property && typeof property === 'object' && 'value' in property ? property.value : null\n }\n\n return {\n ...rest,\n props,\n methods: {\n triggerEvent: triggerAlipayEvent,\n ...rest.methods,\n },\n onInit(this: AlipayComponentInstance) {\n this.properties = this.props\n lifetimes.created?.call(this)\n },\n didMount(this: AlipayComponentInstance) {\n this.properties = this.props\n lifetimes.attached?.call(this)\n lifetimes.ready?.call(this)\n },\n deriveDataFromProps(this: AlipayComponentInstance, nextProps: Record<string, any>) {\n const previous = this.properties ?? this.props\n // 支付宝此时的 this.props 仍是旧值,以回调参数作为唯一更新来源。\n this.properties = nextProps\n for (const key of Object.keys(properties)) {\n if (!Object.is(previous?.[key], nextProps[key])) {\n observers[key]?.call(this, nextProps[key], previous?.[key])\n }\n }\n observers['**']?.call(this, nextProps)\n },\n didUnmount(this: AlipayComponentInstance) {\n lifetimes.detached?.call(this)\n },\n pageEvents: {\n onShow(this: AlipayComponentInstance) {\n pageLifetimes.show?.call(this)\n },\n onHide(this: AlipayComponentInstance) {\n pageLifetimes.hide?.call(this)\n },\n },\n }\n}\n"],"mappings":";;AAQA,SAAS,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,UAAU,KAAK,EAAE,KAAK,MAAM,SAAS;EACvC;EACA,aAA0C;GACxC,UAAU,UAAU,KAAK,IAAI;EAC/B;EACA,YAAY;GACV,SAAsC;IACpC,cAAc,MAAM,KAAK,IAAI;GAC/B;GACA,SAAsC;IACpC,cAAc,MAAM,KAAK,IAAI;GAC/B;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getMiniProgramRuntimeGlobalObject } from "../../platform.mjs";
|
|
2
|
+
import { createAlipayComponentDefinition } from "./alipay.mjs";
|
|
3
|
+
import { WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY } from "@weapp-core/constants";
|
|
4
|
+
|
|
5
|
+
//#region src/runtime/register/component/alipayRegistration.ts
|
|
6
|
+
function createAlipayPageDefinition(componentDefinition) {
|
|
7
|
+
const { lifetimes = {}, methods = {}, observers: _observers, options: _options, pageLifetimes = {}, properties: _properties, ...pageDefinition } = componentDefinition;
|
|
8
|
+
const pageOnLoad = pageDefinition.onLoad;
|
|
9
|
+
return {
|
|
10
|
+
...pageDefinition,
|
|
11
|
+
...methods,
|
|
12
|
+
onLoad(...args) {
|
|
13
|
+
this.options = args[0] && typeof args[0] === "object" ? args[0] : {};
|
|
14
|
+
lifetimes.created?.apply(this, args);
|
|
15
|
+
const result = pageOnLoad?.apply(this, args);
|
|
16
|
+
lifetimes.attached?.apply(this, args);
|
|
17
|
+
return result;
|
|
18
|
+
},
|
|
19
|
+
onShow(...args) {
|
|
20
|
+
return pageLifetimes.show?.apply(this, args);
|
|
21
|
+
},
|
|
22
|
+
onReady(...args) {
|
|
23
|
+
return lifetimes.ready?.apply(this, args);
|
|
24
|
+
},
|
|
25
|
+
onHide(...args) {
|
|
26
|
+
return pageLifetimes.hide?.apply(this, args);
|
|
27
|
+
},
|
|
28
|
+
onResize(...args) {
|
|
29
|
+
return pageLifetimes.resize?.apply(this, args);
|
|
30
|
+
},
|
|
31
|
+
onUnload(...args) {
|
|
32
|
+
return lifetimes.detached?.apply(this, args);
|
|
33
|
+
},
|
|
34
|
+
onError(...args) {
|
|
35
|
+
return lifetimes.error?.apply(this, args);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function registerAlipayComponentDefinition(componentDefinition, isPage) {
|
|
40
|
+
const statefulHmrBridge = getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY];
|
|
41
|
+
if (isPage) {
|
|
42
|
+
const pageDefinition = createAlipayPageDefinition(componentDefinition);
|
|
43
|
+
if (typeof statefulHmrBridge?.Page === "function") {
|
|
44
|
+
statefulHmrBridge.Page(pageDefinition);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
Page(pageDefinition);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const nativeDefinition = createAlipayComponentDefinition(componentDefinition);
|
|
51
|
+
if (typeof statefulHmrBridge?.Component === "function") {
|
|
52
|
+
statefulHmrBridge.Component(nativeDefinition);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
Component(nativeDefinition);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { registerAlipayComponentDefinition };
|
|
60
|
+
//# sourceMappingURL=alipayRegistration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alipayRegistration.mjs","names":[],"sources":["../../../../../src/runtime/register/component/alipayRegistration.ts"],"sourcesContent":["import type { InternalRuntimeState } from '../../types'\nimport { WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY } from '@weapp-core/constants'\nimport { getMiniProgramRuntimeGlobalObject } from '../../platform'\nimport { createAlipayComponentDefinition } from './alipay'\n\nfunction createAlipayPageDefinition(componentDefinition: Record<string, any>) {\n const {\n lifetimes = {},\n methods = {},\n observers: _observers,\n options: _options,\n pageLifetimes = {},\n properties: _properties,\n ...pageDefinition\n } = componentDefinition\n\n const pageOnLoad = pageDefinition.onLoad\n\n return {\n ...pageDefinition,\n ...methods,\n onLoad(this: InternalRuntimeState, ...args: any[]) {\n // 支付宝 Page 不提供微信的 options 字段,在挂载前统一页面参数契约,\n // 避免 setup 读不到 query 或后续 onShow/onReady 将其清空。\n ;(this as Record<string, any>).options = args[0] && typeof args[0] === 'object' ? args[0] : {}\n lifetimes.created?.apply(this, args)\n const result = pageOnLoad?.apply(this, args)\n lifetimes.attached?.apply(this, args)\n return result\n },\n onShow(this: InternalRuntimeState, ...args: any[]) {\n return pageLifetimes.show?.apply(this, args)\n },\n onReady(this: InternalRuntimeState, ...args: any[]) {\n return lifetimes.ready?.apply(this, args)\n },\n onHide(this: InternalRuntimeState, ...args: any[]) {\n return pageLifetimes.hide?.apply(this, args)\n },\n onResize(this: InternalRuntimeState, ...args: any[]) {\n return pageLifetimes.resize?.apply(this, args)\n },\n onUnload(this: InternalRuntimeState, ...args: any[]) {\n return lifetimes.detached?.apply(this, args)\n },\n onError(this: InternalRuntimeState, ...args: any[]) {\n return lifetimes.error?.apply(this, args)\n },\n }\n}\n\nexport function registerAlipayComponentDefinition(componentDefinition: Record<string, any>, isPage: boolean) {\n const statefulHmrBridge = getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]\n if (isPage) {\n const pageDefinition = createAlipayPageDefinition(componentDefinition)\n if (typeof statefulHmrBridge?.Page === 'function') {\n statefulHmrBridge.Page(pageDefinition)\n return\n }\n Page(pageDefinition)\n return\n }\n const nativeDefinition = createAlipayComponentDefinition(componentDefinition)\n if (typeof statefulHmrBridge?.Component === 'function') {\n statefulHmrBridge.Component(nativeDefinition)\n return\n }\n Component(nativeDefinition)\n}\n"],"mappings":";;;;;AAKA,SAAS,2BAA2B,qBAA0C;CAC5E,MAAM,EACJ,YAAY,CAAC,GACb,UAAU,CAAC,GACX,WAAW,YACX,SAAS,UACT,gBAAgB,CAAC,GACjB,YAAY,aACZ,GAAG,mBACD;CAEJ,MAAM,aAAa,eAAe;CAElC,OAAO;EACL,GAAG;EACH,GAAG;EACH,OAAmC,GAAG,MAAa;GAGhD,AAAC,KAA6B,UAAU,KAAK,MAAM,OAAO,KAAK,OAAO,WAAW,KAAK,KAAK,CAAC;GAC7F,UAAU,SAAS,MAAM,MAAM,IAAI;GACnC,MAAM,SAAS,YAAY,MAAM,MAAM,IAAI;GAC3C,UAAU,UAAU,MAAM,MAAM,IAAI;GACpC,OAAO;EACT;EACA,OAAmC,GAAG,MAAa;GACjD,OAAO,cAAc,MAAM,MAAM,MAAM,IAAI;EAC7C;EACA,QAAoC,GAAG,MAAa;GAClD,OAAO,UAAU,OAAO,MAAM,MAAM,IAAI;EAC1C;EACA,OAAmC,GAAG,MAAa;GACjD,OAAO,cAAc,MAAM,MAAM,MAAM,IAAI;EAC7C;EACA,SAAqC,GAAG,MAAa;GACnD,OAAO,cAAc,QAAQ,MAAM,MAAM,IAAI;EAC/C;EACA,SAAqC,GAAG,MAAa;GACnD,OAAO,UAAU,UAAU,MAAM,MAAM,IAAI;EAC7C;EACA,QAAoC,GAAG,MAAa;GAClD,OAAO,UAAU,OAAO,MAAM,MAAM,IAAI;EAC1C;CACF;AACF;AAEA,SAAgB,kCAAkC,qBAA0C,QAAiB;CAC3G,MAAM,oBAAoB,kCAAkC,CAAC,GAAG;CAChE,IAAI,QAAQ;EACV,MAAM,iBAAiB,2BAA2B,mBAAmB;EACrE,IAAI,OAAO,mBAAmB,SAAS,YAAY;GACjD,kBAAkB,KAAK,cAAc;GACrC;EACF;EACA,KAAK,cAAc;EACnB;CACF;CACA,MAAM,mBAAmB,gCAAgC,mBAAmB;CAC5E,IAAI,OAAO,mBAAmB,cAAc,YAAY;EACtD,kBAAkB,UAAU,gBAAgB;EAC5C;CACF;CACA,UAAU,gBAAgB;AAC5B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabilities } from "../../../platform/current.mjs";
|
|
2
|
+
import { getCurrentMiniProgramPages, supportsCurrentMiniProgramRuntimeCapability } from "../../../platform.mjs";
|
|
2
3
|
import { callHookList } from "../../../hooks/base.mjs";
|
|
3
4
|
import { WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY } from "@weapp-core/constants";
|
|
4
5
|
|
|
@@ -15,14 +16,12 @@ function releaseCurrentPageInstance(target) {
|
|
|
15
16
|
if (currentPageInstance === target) currentPageInstance = void 0;
|
|
16
17
|
}
|
|
17
18
|
function runInPageScrollHook(target, task) {
|
|
18
|
-
|
|
19
|
-
const currentDepth = Number((_WEVU_PAGE_SCROLL_HOO = target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _WEVU_PAGE_SCROLL_HOO !== void 0 ? _WEVU_PAGE_SCROLL_HOO : 0);
|
|
19
|
+
const currentDepth = Number(target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 0);
|
|
20
20
|
target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] = currentDepth + 1;
|
|
21
21
|
try {
|
|
22
22
|
return task();
|
|
23
23
|
} finally {
|
|
24
|
-
|
|
25
|
-
const nextDepth = Number((_WEVU_PAGE_SCROLL_HOO2 = target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _WEVU_PAGE_SCROLL_HOO2 !== void 0 ? _WEVU_PAGE_SCROLL_HOO2 : 1) - 1;
|
|
24
|
+
const nextDepth = Number(target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 1) - 1;
|
|
26
25
|
if (nextDepth <= 0) delete target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY];
|
|
27
26
|
else target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] = nextDepth;
|
|
28
27
|
}
|
|
@@ -39,7 +38,7 @@ function resolvePageOptions(target) {
|
|
|
39
38
|
function ensureMiniProgramGlobalPatched() {
|
|
40
39
|
if (miniProgramGlobalPatched) return;
|
|
41
40
|
miniProgramGlobalPatched = true;
|
|
42
|
-
const miniProgramGlobal =
|
|
41
|
+
const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
|
|
43
42
|
if (!miniProgramGlobal || typeof miniProgramGlobal !== "object") return;
|
|
44
43
|
if (supportsCurrentMiniProgramRuntimeCapability("pullDownRefreshApi")) {
|
|
45
44
|
const rawStartPullDownRefresh = miniProgramGlobal.startPullDownRefresh;
|
|
@@ -56,7 +55,7 @@ function ensureMiniProgramGlobalPatched() {
|
|
|
56
55
|
if (currentPageInstance) {
|
|
57
56
|
const pageInstance = currentPageInstance;
|
|
58
57
|
runInPageScrollHook(pageInstance, () => {
|
|
59
|
-
callHookList(pageInstance, "onPageScroll", [options
|
|
58
|
+
callHookList(pageInstance, "onPageScroll", [options ?? {}]);
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
return result;
|
|
@@ -67,7 +66,7 @@ function ensurePageShareMenus(options) {
|
|
|
67
66
|
const { enableOnShareAppMessage, enableOnShareTimeline } = options;
|
|
68
67
|
if (!enableOnShareAppMessage && !enableOnShareTimeline) return;
|
|
69
68
|
if (!supportsCurrentMiniProgramRuntimeCapability("pageShareMenu")) return;
|
|
70
|
-
const miniProgramGlobal =
|
|
69
|
+
const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
|
|
71
70
|
if (!miniProgramGlobal || typeof miniProgramGlobal.showShareMenu !== "function") return;
|
|
72
71
|
const shouldShowShareAppMessage = getCurrentMiniProgramRuntimeCapabilities().shareTimelineRequiresShareAppMessage ? enableOnShareAppMessage || enableOnShareTimeline : enableOnShareAppMessage;
|
|
73
72
|
if (!shouldShowShareAppMessage && !enableOnShareTimeline) return;
|
|
@@ -88,7 +87,7 @@ function ensurePageShareMenus(options) {
|
|
|
88
87
|
if (payload === void 0) miniProgramGlobal.showShareMenu();
|
|
89
88
|
else miniProgramGlobal.showShareMenu(payload);
|
|
90
89
|
break;
|
|
91
|
-
} catch
|
|
90
|
+
} catch {}
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.mjs","names":[],"sources":["../../../../../../src/runtime/register/component/lifecycle/platform.ts"],"sourcesContent":["import type { InternalRuntimeState } from '../../../types'\nimport { WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY } from '@weapp-core/constants'\nimport { callHookList } from '../../../hooks'\nimport {\n
|
|
1
|
+
{"version":3,"file":"platform.mjs","names":[],"sources":["../../../../../../src/runtime/register/component/lifecycle/platform.ts"],"sourcesContent":["import type { InternalRuntimeState } from '../../../types'\nimport { WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY } from '@weapp-core/constants'\nimport { callHookList } from '../../../hooks'\nimport {\n getCurrentMiniProgramGlobalObject,\n getCurrentMiniProgramPages,\n getCurrentMiniProgramRuntimeCapabilities,\n supportsCurrentMiniProgramRuntimeCapability,\n} from '../../../platform'\n\nlet miniProgramGlobalPatched = false\nlet currentPageInstance: InternalRuntimeState | undefined\ntype ShareMenuName = 'shareAppMessage' | 'shareTimeline'\nexport function getCurrentPageInstance() {\n return currentPageInstance\n}\n\nexport function bindCurrentPageInstance(target: InternalRuntimeState) {\n currentPageInstance = target\n}\n\nexport function releaseCurrentPageInstance(target: InternalRuntimeState) {\n if (currentPageInstance === target) {\n currentPageInstance = undefined\n }\n}\n\nexport function runInPageScrollHook<T>(\n target: InternalRuntimeState,\n task: () => T,\n): T {\n const currentDepth = Number((target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 0)\n ;(target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] = currentDepth + 1\n try {\n return task()\n }\n finally {\n const nextDepth = Number((target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 1) - 1\n if (nextDepth <= 0) {\n delete (target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY]\n }\n else {\n ;(target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] = nextDepth\n }\n }\n}\n\nexport function resolvePageOptions(target: InternalRuntimeState) {\n const direct = (target as any).options\n if (direct && typeof direct === 'object') {\n return direct\n }\n const pages = getCurrentMiniProgramPages()\n const page = pages[pages.length - 1]\n const options = page && typeof page === 'object' ? (page as any).options : undefined\n if (options && typeof options === 'object') {\n return options\n }\n return {}\n}\n\nexport function ensureMiniProgramGlobalPatched() {\n if (miniProgramGlobalPatched) {\n return\n }\n miniProgramGlobalPatched = true\n const miniProgramGlobal = getCurrentMiniProgramGlobalObject()\n if (!miniProgramGlobal || typeof miniProgramGlobal !== 'object') {\n return\n }\n if (supportsCurrentMiniProgramRuntimeCapability('pullDownRefreshApi')) {\n const rawStartPullDownRefresh = miniProgramGlobal.startPullDownRefresh as ((...args: any[]) => any) | undefined\n if (typeof rawStartPullDownRefresh === 'function') {\n miniProgramGlobal.startPullDownRefresh = function startPullDownRefreshPatched(...args: any[]) {\n const result = rawStartPullDownRefresh.apply(this, args)\n if (currentPageInstance) {\n callHookList(currentPageInstance, 'onPullDownRefresh', [])\n }\n return result\n }\n }\n }\n if (supportsCurrentMiniProgramRuntimeCapability('pageScrollApi')) {\n const rawPageScrollTo = miniProgramGlobal.pageScrollTo as ((...args: any[]) => any) | undefined\n if (typeof rawPageScrollTo === 'function') {\n miniProgramGlobal.pageScrollTo = function pageScrollToPatched(options: any, ...rest: any[]) {\n const result = rawPageScrollTo.apply(this, [options, ...rest])\n if (currentPageInstance) {\n const pageInstance = currentPageInstance\n runInPageScrollHook(pageInstance, () => {\n callHookList(pageInstance, 'onPageScroll', [options ?? {}])\n })\n }\n return result\n }\n }\n }\n}\n\nexport function ensurePageShareMenus(options: {\n enableOnShareAppMessage: boolean\n enableOnShareTimeline: boolean\n}) {\n const { enableOnShareAppMessage, enableOnShareTimeline } = options\n if (!enableOnShareAppMessage && !enableOnShareTimeline) {\n return\n }\n\n if (!supportsCurrentMiniProgramRuntimeCapability('pageShareMenu')) {\n return\n }\n\n const miniProgramGlobal = getCurrentMiniProgramGlobalObject()\n if (!miniProgramGlobal || typeof miniProgramGlobal.showShareMenu !== 'function') {\n return\n }\n\n const runtimeCapabilities = getCurrentMiniProgramRuntimeCapabilities()\n const shouldShowShareAppMessage = runtimeCapabilities.shareTimelineRequiresShareAppMessage\n ? (enableOnShareAppMessage || enableOnShareTimeline)\n : enableOnShareAppMessage\n\n if (!shouldShowShareAppMessage && !enableOnShareTimeline) {\n return\n }\n\n const menus: ShareMenuName[] = []\n if (shouldShowShareAppMessage) {\n menus.push('shareAppMessage')\n }\n if (enableOnShareTimeline) {\n menus.push('shareTimeline')\n }\n\n const payloads = [\n { withShareTicket: true, menus },\n { menus },\n enableOnShareTimeline ? { withShareTicket: true } : undefined,\n enableOnShareTimeline ? {} : undefined,\n undefined,\n ]\n\n for (const payload of payloads) {\n try {\n if (payload === undefined) {\n miniProgramGlobal.showShareMenu()\n }\n else {\n miniProgramGlobal.showShareMenu(payload as any)\n }\n break\n }\n catch {\n // 继续尝试更保守的 payload,兼容不同宿主的 showShareMenu 参数形态。\n }\n }\n}\n"],"mappings":";;;;;;AAUA,IAAI,2BAA2B;AAC/B,IAAI;AAEJ,SAAgB,yBAAyB;CACvC,OAAO;AACT;AAEA,SAAgB,wBAAwB,QAA8B;CACpE,sBAAsB;AACxB;AAEA,SAAgB,2BAA2B,QAA8B;CACvE,IAAI,wBAAwB,QAC1B,sBAAsB;AAE1B;AAEA,SAAgB,oBACd,QACA,MACG;CACH,MAAM,eAAe,OAAQ,OAAe,oCAAoC,CAAC;CAChF,AAAC,OAAe,mCAAmC,eAAe;CACnE,IAAI;EACF,OAAO,KAAK;CACd,UACQ;EACN,MAAM,YAAY,OAAQ,OAAe,oCAAoC,CAAC,IAAI;EAClF,IAAI,aAAa,GACf,OAAQ,OAAe;OAGtB,AAAC,OAAe,mCAAmC;CAExD;AACF;AAEA,SAAgB,mBAAmB,QAA8B;CAC/D,MAAM,SAAU,OAAe;CAC/B,IAAI,UAAU,OAAO,WAAW,UAC9B,OAAO;CAET,MAAM,QAAQ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;CAEJ,IAAI,CAAC,6BAA6B,CAAC,uBACjC;CAGF,MAAM,QAAyB,CAAC;CAChC,IAAI,2BACF,MAAM,KAAK,iBAAiB;CAE9B,IAAI,uBACF,MAAM,KAAK,eAAe;CAG5B,MAAM,WAAW;EACf;GAAE,iBAAiB;GAAM;EAAM;EAC/B,EAAE,MAAM;EACR,wBAAwB,EAAE,iBAAiB,KAAK,IAAI;EACpD,wBAAwB,CAAC,IAAI;EAC7B;CACF;CAEA,KAAK,MAAM,WAAW,UACpB,IAAI;EACF,IAAI,YAAY,QACd,kBAAkB,cAAc;OAGhC,kBAAkB,cAAc,OAAc;EAEhD;CACF,QACM,CAEN;AAEJ"}
|
|
@@ -3,8 +3,8 @@ import { runtimeCapabilityRegistry } from "../../capabilities.mjs";
|
|
|
3
3
|
import { bindCurrentPageInstance, ensureMiniProgramGlobalPatched, ensurePageShareMenus, releaseCurrentPageInstance, resolvePageOptions } from "./lifecycle/platform.mjs";
|
|
4
4
|
import { runTeardownSteps } from "../../teardown.mjs";
|
|
5
5
|
import { enableDeferredSetData, mountRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from "../runtimeInstance.mjs";
|
|
6
|
-
import { cancelInitialNavigation, ensureInitialNavigation } from "../../../router/initialNavigation.mjs";
|
|
7
6
|
import { notifyRouteStateSync } from "../../../router/routeSync.mjs";
|
|
7
|
+
import { cancelInitialNavigation, ensureInitialNavigation } from "../../navigationLifecycle.mjs";
|
|
8
8
|
import { attachOptionalPageLifecycleHooks } from "./lifecycle/optionalHooks.mjs";
|
|
9
9
|
import { WEVU_ON_LOAD_CALLED_KEY, WEVU_READY_CALLED_KEY, WEVU_ROUTE_DONE_CALLED_KEY } from "@weapp-core/constants";
|
|
10
10
|
|
|
@@ -12,8 +12,7 @@ import { WEVU_ON_LOAD_CALLED_KEY, WEVU_READY_CALLED_KEY, WEVU_ROUTE_DONE_CALLED_
|
|
|
12
12
|
function createPageLifecycleHooks(options) {
|
|
13
13
|
const { runtimeApp, watch, setup, userOnLoad, userOnUnload, userOnShow, userOnHide, userOnReady, isPage, enableOnSaveExitState, enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnRouteDoneFallback, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, syncWevuPropsFromValues, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites, hasHook } = options;
|
|
14
14
|
const flushPageSnapshotIfPossible = (target) => {
|
|
15
|
-
|
|
16
|
-
(_wevu = target.__wevu) === null || _wevu === void 0 || (_wevu$__wevu_flushSet = _wevu.__wevu_flushSetupSnapshotSync) === null || _wevu$__wevu_flushSet === void 0 || _wevu$__wevu_flushSet.call(_wevu);
|
|
15
|
+
target.__wevu?.__wevu_flushSetupSnapshotSync?.();
|
|
17
16
|
};
|
|
18
17
|
const pageLifecycleHooks = {
|
|
19
18
|
onLoad(...args) {
|
|
@@ -22,7 +21,7 @@ function createPageLifecycleHooks(options) {
|
|
|
22
21
|
const mountPage = () => {
|
|
23
22
|
mountRuntimeInstance(this, runtimeApp, watch, setup);
|
|
24
23
|
const pageOptions = args[0] && typeof args[0] === "object" ? args[0] : resolvePageOptions(this);
|
|
25
|
-
syncWevuPropsFromValues
|
|
24
|
+
syncWevuPropsFromValues?.(this, pageOptions);
|
|
26
25
|
flushPageSnapshotIfPossible(this);
|
|
27
26
|
enableDeferredSetData(this);
|
|
28
27
|
if (isPage) ensurePageShareMenus({
|
|
@@ -57,7 +56,7 @@ function createPageLifecycleHooks(options) {
|
|
|
57
56
|
ensureMiniProgramGlobalPatched();
|
|
58
57
|
bindCurrentPageInstance(this);
|
|
59
58
|
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
60
|
-
syncWevuPropsFromValues
|
|
59
|
+
syncWevuPropsFromValues?.(this, resolvePageOptions(this));
|
|
61
60
|
flushPageSnapshotIfPossible(this);
|
|
62
61
|
ensurePageShareMenus({
|
|
63
62
|
enableOnShareAppMessage,
|
|
@@ -82,7 +81,7 @@ function createPageLifecycleHooks(options) {
|
|
|
82
81
|
onReady(...args) {
|
|
83
82
|
if (isPage) {
|
|
84
83
|
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
85
|
-
syncWevuPropsFromValues
|
|
84
|
+
syncWevuPropsFromValues?.(this, resolvePageOptions(this));
|
|
86
85
|
flushPageSnapshotIfPossible(this);
|
|
87
86
|
ensurePageShareMenus({
|
|
88
87
|
enableOnShareAppMessage,
|
|
@@ -94,10 +93,7 @@ function createPageLifecycleHooks(options) {
|
|
|
94
93
|
if (isPage && enableOnRouteDone && enableOnRouteDoneFallback) {
|
|
95
94
|
const current = this;
|
|
96
95
|
setTimeout(() => {
|
|
97
|
-
if (!current[WEVU_ROUTE_DONE_CALLED_KEY])
|
|
98
|
-
var _pageLifecycleHooks$o;
|
|
99
|
-
(_pageLifecycleHooks$o = pageLifecycleHooks.onRouteDone) === null || _pageLifecycleHooks$o === void 0 || _pageLifecycleHooks$o.call(current);
|
|
100
|
-
}
|
|
96
|
+
if (!current[WEVU_ROUTE_DONE_CALLED_KEY]) pageLifecycleHooks.onRouteDone?.call(current);
|
|
101
97
|
}, 0);
|
|
102
98
|
}
|
|
103
99
|
const callReadyHooks = () => {
|
|
@@ -106,8 +102,7 @@ function createPageLifecycleHooks(options) {
|
|
|
106
102
|
};
|
|
107
103
|
const scheduleReadyHooks = () => {
|
|
108
104
|
if (Array.isArray(this.__wevuTemplateRefs) && this.__wevuTemplateRefs.length > 0) {
|
|
109
|
-
|
|
110
|
-
(_runtimeCapabilityReg = runtimeCapabilityRegistry.templateRefs) === null || _runtimeCapabilityReg === void 0 || _runtimeCapabilityReg.schedule(this, callReadyHooks);
|
|
105
|
+
runtimeCapabilityRegistry.templateRefs?.schedule(this, callReadyHooks);
|
|
111
106
|
return;
|
|
112
107
|
}
|
|
113
108
|
callReadyHooks();
|