wevu 6.18.6 → 6.19.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/dist/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/defineProperty.mjs +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/toPrimitive.mjs +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/toPropertyKey.mjs +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/typeof.mjs +1 -0
- package/dist/{rolldown-runtime-CenpyGzJ.mjs → _virtual/_rolldown/runtime.mjs} +1 -1
- package/dist/dev/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/defineProperty.mjs +14 -0
- package/dist/dev/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/toPrimitive.mjs +16 -0
- package/dist/dev/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/toPropertyKey.mjs +11 -0
- package/dist/dev/_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/typeof.mjs +12 -0
- package/dist/dev/{rolldown-runtime-BUUfjzRC.mjs → _virtual/_rolldown/runtime.mjs} +1 -1
- package/dist/dev/index.mjs +49 -10
- package/dist/dev/internal-reactivity.mjs +15 -5
- package/dist/dev/internal-runtime.mjs +32 -4
- package/dist/dev/internal-template.mjs +1 -1
- package/dist/dev/package.mjs +6 -0
- package/dist/dev/package.mjs.map +1 -0
- package/dist/dev/reactivity/computed.mjs +49 -0
- package/dist/dev/reactivity/computed.mjs.map +1 -0
- package/dist/dev/reactivity/core.mjs +184 -0
- package/dist/dev/reactivity/core.mjs.map +1 -0
- package/dist/dev/reactivity/reactive/mutation.mjs +12 -0
- package/dist/dev/reactivity/reactive/mutation.mjs.map +1 -0
- package/dist/dev/{computed-BxRsUJgi.mjs → reactivity/reactive/patch.mjs} +6 -48
- package/dist/dev/reactivity/reactive/patch.mjs.map +1 -0
- package/dist/dev/reactivity/reactive/patchState.mjs +138 -0
- package/dist/dev/reactivity/reactive/patchState.mjs.map +1 -0
- package/dist/dev/reactivity/reactive/shallow.mjs +77 -0
- package/dist/dev/reactivity/reactive/shallow.mjs.map +1 -0
- package/dist/dev/reactivity/reactive/shared.mjs +40 -0
- package/dist/dev/reactivity/reactive/shared.mjs.map +1 -0
- package/dist/dev/reactivity/reactive/state.mjs +8 -0
- package/dist/dev/reactivity/reactive/state.mjs.map +1 -0
- package/dist/dev/reactivity/reactive.mjs +212 -0
- package/dist/dev/reactivity/reactive.mjs.map +1 -0
- package/dist/dev/reactivity/readonly.mjs +69 -0
- package/dist/dev/reactivity/readonly.mjs.map +1 -0
- package/dist/dev/reactivity/ref.mjs +97 -0
- package/dist/dev/reactivity/ref.mjs.map +1 -0
- package/dist/dev/reactivity/shallowRef.mjs +71 -0
- package/dist/dev/reactivity/shallowRef.mjs.map +1 -0
- package/dist/dev/{toRefs-D06VmFK2.mjs → reactivity/toRefs.mjs} +4 -3
- package/dist/dev/reactivity/toRefs.mjs.map +1 -0
- package/dist/dev/reactivity/traverse.mjs +40 -0
- package/dist/dev/reactivity/traverse.mjs.map +1 -0
- package/dist/dev/reactivity/watch/helpers.mjs +78 -0
- package/dist/dev/reactivity/watch/helpers.mjs.map +1 -0
- package/dist/dev/reactivity/watch/types.mjs +20 -0
- package/dist/dev/reactivity/watch/types.mjs.map +1 -0
- package/dist/dev/reactivity/watch.mjs +167 -0
- package/dist/dev/reactivity/watch.mjs.map +1 -0
- package/dist/dev/router/backNavigation.mjs +32 -0
- package/dist/dev/router/backNavigation.mjs.map +1 -0
- package/dist/dev/router/createRouter.mjs +176 -0
- package/dist/dev/router/createRouter.mjs.map +1 -0
- package/dist/dev/router/instance.mjs +17 -0
- package/dist/dev/router/instance.mjs.map +1 -0
- package/dist/dev/router/navigationApi.mjs +94 -0
- package/dist/dev/router/navigationApi.mjs.map +1 -0
- package/dist/dev/router/navigationCore.mjs +139 -0
- package/dist/dev/router/navigationCore.mjs.map +1 -0
- package/dist/dev/router/navigationResult.mjs +54 -0
- package/dist/dev/router/navigationResult.mjs.map +1 -0
- package/dist/dev/router/navigationTarget.mjs +121 -0
- package/dist/dev/router/navigationTarget.mjs.map +1 -0
- package/dist/dev/router/navigationTargetHelpers.mjs +38 -0
- package/dist/dev/router/navigationTargetHelpers.mjs.map +1 -0
- package/dist/dev/router/resolve.mjs +22 -0
- package/dist/dev/router/resolve.mjs.map +1 -0
- package/dist/dev/router/routeRegistry.mjs +78 -0
- package/dist/dev/router/routeRegistry.mjs.map +1 -0
- package/dist/dev/router/routeSync.mjs +72 -0
- package/dist/dev/router/routeSync.mjs.map +1 -0
- package/dist/dev/router/types.mjs +11 -0
- package/dist/dev/router/types.mjs.map +1 -0
- package/dist/dev/router/useRoute.mjs +106 -0
- package/dist/dev/router/useRoute.mjs.map +1 -0
- package/dist/dev/router/useRouter.mjs +15 -0
- package/dist/dev/router/useRouter.mjs.map +1 -0
- package/dist/dev/router.mjs +9 -1316
- package/dist/dev/routerInternal/location.mjs +66 -0
- package/dist/dev/routerInternal/location.mjs.map +1 -0
- package/dist/dev/routerInternal/matching.mjs +149 -0
- package/dist/dev/routerInternal/matching.mjs.map +1 -0
- package/dist/dev/routerInternal/params.mjs +95 -0
- package/dist/dev/routerInternal/params.mjs.map +1 -0
- package/dist/dev/routerInternal/path.mjs +42 -0
- package/dist/dev/routerInternal/path.mjs.map +1 -0
- package/dist/dev/routerInternal/query.mjs +113 -0
- package/dist/dev/routerInternal/query.mjs.map +1 -0
- package/dist/dev/routerInternal/records.mjs +172 -0
- package/dist/dev/routerInternal/records.mjs.map +1 -0
- package/dist/dev/routerInternal/recordsWarnings.mjs +49 -0
- package/dist/dev/routerInternal/recordsWarnings.mjs.map +1 -0
- package/dist/dev/routerInternal/snapshots.mjs +126 -0
- package/dist/dev/routerInternal/snapshots.mjs.map +1 -0
- package/dist/dev/runtime/app/computed.mjs +68 -0
- package/dist/dev/runtime/app/computed.mjs.map +1 -0
- package/dist/dev/runtime/app/context.mjs +275 -0
- package/dist/dev/runtime/app/context.mjs.map +1 -0
- package/dist/dev/runtime/app/diagnostics.mjs +34 -0
- package/dist/dev/runtime/app/diagnostics.mjs.map +1 -0
- package/dist/dev/runtime/app/mount.mjs +269 -0
- package/dist/dev/runtime/app/mount.mjs.map +1 -0
- package/dist/dev/runtime/app/pending.mjs +14 -0
- package/dist/dev/runtime/app/pending.mjs.map +1 -0
- package/dist/dev/runtime/app/setData/patchScheduler.mjs +158 -0
- package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -0
- package/dist/dev/runtime/app/setData/payload.mjs +161 -0
- package/dist/dev/runtime/app/setData/payload.mjs.map +1 -0
- package/dist/dev/runtime/app/setData/scheduler.mjs +313 -0
- package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -0
- package/dist/dev/runtime/app/setData/snapshot.mjs +129 -0
- package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -0
- package/dist/dev/runtime/app/setDataOptions.mjs +73 -0
- package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -0
- package/dist/dev/runtime/app.mjs +93 -0
- package/dist/dev/runtime/app.mjs.map +1 -0
- package/dist/dev/runtime/bindModel.mjs +92 -0
- package/dist/dev/runtime/bindModel.mjs.map +1 -0
- package/dist/dev/runtime/defaults.mjs +61 -0
- package/dist/dev/runtime/defaults.mjs.map +1 -0
- package/dist/dev/runtime/define/initialComputed.mjs +125 -0
- package/dist/dev/runtime/define/initialComputed.mjs.map +1 -0
- package/dist/dev/runtime/define/options.mjs +169 -0
- package/dist/dev/runtime/define/options.mjs.map +1 -0
- package/dist/dev/runtime/define/optionsApi.mjs +48 -0
- package/dist/dev/runtime/define/optionsApi.mjs.map +1 -0
- package/dist/dev/runtime/define/props.mjs +194 -0
- package/dist/dev/runtime/define/props.mjs.map +1 -0
- package/dist/dev/runtime/define/scopedSlotOptions.mjs +313 -0
- package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -0
- package/dist/dev/runtime/define/setupResult.mjs +78 -0
- package/dist/dev/runtime/define/setupResult.mjs.map +1 -0
- package/dist/dev/runtime/define.mjs +140 -0
- package/dist/dev/runtime/define.mjs.map +1 -0
- package/dist/dev/runtime/diff.mjs +193 -0
- package/dist/dev/runtime/diff.mjs.map +1 -0
- package/dist/dev/runtime/disposables.mjs +81 -0
- package/dist/dev/runtime/disposables.mjs.map +1 -0
- package/dist/dev/runtime/elementIntersectionObserver.mjs +80 -0
- package/dist/dev/runtime/elementIntersectionObserver.mjs.map +1 -0
- package/dist/dev/runtime/emit.mjs +36 -0
- package/dist/dev/runtime/emit.mjs.map +1 -0
- package/dist/dev/{base-CYkvI7w8.mjs → runtime/hooks/base.mjs} +3 -140
- package/dist/dev/runtime/hooks/base.mjs.map +1 -0
- package/dist/dev/runtime/hooks/register.mjs +92 -0
- package/dist/dev/runtime/hooks/register.mjs.map +1 -0
- package/dist/dev/runtime/hooks/vue.mjs +81 -0
- package/dist/dev/runtime/hooks/vue.mjs.map +1 -0
- package/dist/dev/runtime/internal.mjs +18 -0
- package/dist/dev/runtime/internal.mjs.map +1 -0
- package/dist/dev/runtime/intersectionObserver.mjs +46 -0
- package/dist/dev/runtime/intersectionObserver.mjs.map +1 -0
- package/dist/dev/runtime/layoutBridge.mjs +303 -0
- package/dist/dev/runtime/layoutBridge.mjs.map +1 -0
- package/dist/dev/runtime/layoutComponentMatcher.mjs +11 -0
- package/dist/dev/runtime/layoutComponentMatcher.mjs.map +1 -0
- package/dist/dev/runtime/nativeBridge.mjs +21 -0
- package/dist/dev/runtime/nativeBridge.mjs.map +1 -0
- package/dist/dev/runtime/noSetData.mjs +18 -0
- package/dist/dev/runtime/noSetData.mjs.map +1 -0
- package/dist/dev/runtime/pageEnvironment.mjs +100 -0
- package/dist/dev/runtime/pageEnvironment.mjs.map +1 -0
- package/dist/dev/runtime/pageLayout.mjs +71 -0
- package/dist/dev/runtime/pageLayout.mjs.map +1 -0
- package/dist/dev/runtime/pageScroll.mjs +110 -0
- package/dist/dev/runtime/pageScroll.mjs.map +1 -0
- package/dist/dev/runtime/platform.mjs +77 -0
- package/dist/dev/runtime/platform.mjs.map +1 -0
- package/dist/dev/runtime/provide.mjs +71 -0
- package/dist/dev/runtime/provide.mjs.map +1 -0
- package/dist/dev/runtime/provideContext.mjs +101 -0
- package/dist/dev/runtime/provideContext.mjs.map +1 -0
- package/dist/dev/runtime/provideStore.mjs +18 -0
- package/dist/dev/runtime/provideStore.mjs.map +1 -0
- package/dist/dev/runtime/pullDownRefresh.mjs +24 -0
- package/dist/dev/runtime/pullDownRefresh.mjs.map +1 -0
- package/dist/dev/runtime/register/app.mjs +159 -0
- package/dist/dev/runtime/register/app.mjs.map +1 -0
- package/dist/dev/runtime/register/component/features.mjs +43 -0
- package/dist/dev/runtime/register/component/features.mjs.map +1 -0
- package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs +64 -0
- package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs.map +1 -0
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs +95 -0
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs.map +1 -0
- package/dist/dev/runtime/register/component/lifecycle.mjs +122 -0
- package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -0
- package/dist/dev/runtime/register/component/methods.mjs +80 -0
- package/dist/dev/runtime/register/component/methods.mjs.map +1 -0
- package/dist/dev/runtime/register/component/options.mjs +204 -0
- package/dist/dev/runtime/register/component/options.mjs.map +1 -0
- package/dist/dev/runtime/register/component/props.mjs +218 -0
- package/dist/dev/runtime/register/component/props.mjs.map +1 -0
- package/dist/dev/runtime/register/component/registerDefinition.mjs +290 -0
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -0
- package/dist/dev/runtime/register/component.mjs +128 -0
- package/dist/dev/runtime/register/component.mjs.map +1 -0
- package/dist/dev/runtime/register/inline.mjs +145 -0
- package/dist/dev/runtime/register/inline.mjs.map +1 -0
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +53 -0
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -0
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +34 -0
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -0
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +230 -0
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -0
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +164 -0
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -0
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs +122 -0
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -0
- package/dist/dev/runtime/register/runtimeInstance.mjs +438 -0
- package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -0
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs +95 -0
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -0
- package/dist/dev/runtime/register/setup.mjs +22 -0
- package/dist/dev/runtime/register/setup.mjs.map +1 -0
- package/dist/dev/runtime/register/snapshot.mjs +17 -0
- package/dist/dev/runtime/register/snapshot.mjs.map +1 -0
- package/dist/dev/runtime/register/watch.mjs +57 -0
- package/dist/dev/runtime/register/watch.mjs.map +1 -0
- package/dist/dev/runtime/scopedSlots.mjs +115 -0
- package/dist/dev/runtime/scopedSlots.mjs.map +1 -0
- package/dist/dev/runtime/selectorQuery.mjs +49 -0
- package/dist/dev/runtime/selectorQuery.mjs.map +1 -0
- package/dist/dev/runtime/setupTracking.mjs +59 -0
- package/dist/dev/runtime/setupTracking.mjs.map +1 -0
- package/dist/dev/{template-n_iVr0ey.mjs → runtime/template.mjs} +7 -4
- package/dist/dev/runtime/template.mjs.map +1 -0
- package/dist/dev/runtime/templateRefs/helpers.mjs +254 -0
- package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -0
- package/dist/dev/runtime/templateRefs.mjs +162 -0
- package/dist/dev/runtime/templateRefs.mjs.map +1 -0
- package/dist/dev/runtime/uniAppHost.mjs +119 -0
- package/dist/dev/runtime/uniAppHost.mjs.map +1 -0
- package/dist/dev/runtime/updatePerformance.mjs +41 -0
- package/dist/dev/runtime/updatePerformance.mjs.map +1 -0
- package/dist/dev/runtime/use.mjs +25 -0
- package/dist/dev/runtime/use.mjs.map +1 -0
- package/dist/dev/runtime/vueCompat/context.mjs +25 -0
- package/dist/dev/runtime/vueCompat/context.mjs.map +1 -0
- package/dist/dev/runtime/vueCompat/model.mjs +118 -0
- package/dist/dev/runtime/vueCompat/model.mjs.map +1 -0
- package/dist/dev/runtime/vueCompat/router.mjs +124 -0
- package/dist/dev/runtime/vueCompat/router.mjs.map +1 -0
- package/dist/dev/runtime/vueCompat/templateRef.mjs +37 -0
- package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -0
- package/dist/dev/scheduler.mjs +75 -0
- package/dist/dev/scheduler.mjs.map +1 -0
- package/dist/dev/store/actions.mjs +40 -0
- package/dist/dev/store/actions.mjs.map +1 -0
- package/dist/dev/store/base.mjs +56 -0
- package/dist/dev/store/base.mjs.map +1 -0
- package/dist/dev/store/define/optionsStyle.mjs +125 -0
- package/dist/dev/store/define/optionsStyle.mjs.map +1 -0
- package/dist/dev/store/define/setupStyle.mjs +145 -0
- package/dist/dev/store/define/setupStyle.mjs.map +1 -0
- package/dist/dev/store/define/shared.mjs +38 -0
- package/dist/dev/store/define/shared.mjs.map +1 -0
- package/dist/dev/store/define.mjs +23 -0
- package/dist/dev/store/define.mjs.map +1 -0
- package/dist/dev/store/manager.mjs +21 -0
- package/dist/dev/store/manager.mjs.map +1 -0
- package/dist/dev/store/storeToRefs.mjs +29 -0
- package/dist/dev/store/storeToRefs.mjs.map +1 -0
- package/dist/dev/store/utils.mjs +49 -0
- package/dist/dev/store/utils.mjs.map +1 -0
- package/dist/dev/store.mjs +3 -1
- package/dist/dev/utils.mjs +16 -0
- package/dist/dev/utils.mjs.map +1 -0
- package/dist/dev/version.mjs +8 -0
- package/dist/dev/version.mjs.map +1 -0
- package/dist/dev/vue-demi.mjs +49 -11
- package/dist/dev/vue-demi.mjs.map +1 -1
- package/dist/index.d.mts +71 -7
- package/dist/index.mjs +1 -1
- package/dist/internal-reactivity.d.mts +16 -2
- package/dist/internal-reactivity.mjs +1 -1
- package/dist/internal-runtime.d.mts +35 -2
- package/dist/internal-runtime.mjs +1 -1
- package/dist/internal-template.d.mts +1 -1
- package/dist/internal-template.mjs +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/macros/shared.d.mts +81 -0
- package/dist/macros.d.mts +70 -0
- package/dist/package.mjs +1 -0
- package/dist/reactivity/computed.d.mts +21 -0
- package/dist/reactivity/computed.mjs +1 -0
- package/dist/reactivity/core.d.mts +34 -0
- package/dist/reactivity/core.mjs +1 -0
- package/dist/reactivity/index.d.mts +15 -0
- package/dist/reactivity/reactive/mutation.d.mts +21 -0
- package/dist/reactivity/reactive/mutation.mjs +1 -0
- package/dist/reactivity/reactive/patch.d.mts +18 -0
- package/dist/reactivity/reactive/patch.mjs +1 -0
- package/dist/reactivity/reactive/patchState.mjs +1 -0
- package/dist/reactivity/reactive/shallow.d.mts +22 -0
- package/dist/reactivity/reactive/shallow.mjs +1 -0
- package/dist/reactivity/reactive/shared.d.mts +4 -0
- package/dist/reactivity/reactive/shared.mjs +1 -0
- package/dist/reactivity/reactive/state.mjs +1 -0
- package/dist/reactivity/reactive.d.mts +41 -0
- package/dist/reactivity/reactive.mjs +1 -0
- package/dist/reactivity/readonly.d.mts +27 -0
- package/dist/reactivity/readonly.mjs +1 -0
- package/dist/reactivity/ref.d.mts +27 -0
- package/dist/reactivity/ref.mjs +1 -0
- package/dist/reactivity/shallowRef.d.mts +19 -0
- package/dist/reactivity/shallowRef.mjs +1 -0
- package/dist/reactivity/toRefs.d.mts +43 -0
- package/dist/reactivity/toRefs.mjs +1 -0
- package/dist/reactivity/traverse.d.mts +8 -0
- package/dist/reactivity/traverse.mjs +1 -0
- package/dist/reactivity/watch/helpers.mjs +1 -0
- package/dist/reactivity/watch/types.d.mts +43 -0
- package/dist/reactivity/watch/types.mjs +1 -0
- package/dist/reactivity/watch.d.mts +21 -0
- package/dist/reactivity/watch.mjs +1 -0
- package/dist/router/backNavigation.mjs +1 -0
- package/dist/router/createRouter.d.mts +8 -0
- package/dist/router/createRouter.mjs +1 -0
- package/dist/router/instance.mjs +1 -0
- package/dist/router/navigationApi.mjs +1 -0
- package/dist/router/navigationCore.d.mts +6 -0
- package/dist/router/navigationCore.mjs +1 -0
- package/dist/router/navigationResult.mjs +1 -0
- package/dist/router/navigationTarget.mjs +1 -0
- package/dist/router/navigationTargetHelpers.mjs +1 -0
- package/dist/router/resolve.d.mts +6 -0
- package/dist/router/resolve.mjs +1 -0
- package/dist/router/routeRegistry.mjs +1 -0
- package/dist/router/routeSync.d.mts +1 -0
- package/dist/router/routeSync.mjs +1 -0
- package/dist/router/types.d.mts +163 -0
- package/dist/router/types.mjs +1 -0
- package/dist/router/useRoute.d.mts +19 -0
- package/dist/router/useRoute.mjs +1 -0
- package/dist/router/useRouter.d.mts +8 -0
- package/dist/router/useRouter.mjs +1 -0
- package/dist/router.d.mts +9 -204
- package/dist/router.mjs +1 -1
- package/dist/routerInternal/location.mjs +1 -0
- package/dist/routerInternal/matching.mjs +1 -0
- package/dist/routerInternal/params.mjs +1 -0
- package/dist/routerInternal/path.mjs +1 -0
- package/dist/routerInternal/query.d.mts +7 -0
- package/dist/routerInternal/query.mjs +1 -0
- package/dist/routerInternal/records.mjs +1 -0
- package/dist/routerInternal/recordsWarnings.mjs +1 -0
- package/dist/routerInternal/snapshots.mjs +1 -0
- package/dist/routerInternal/types.d.mts +9 -0
- package/dist/runtime/app/computed.mjs +1 -0
- package/dist/runtime/app/context.mjs +1 -0
- package/dist/runtime/app/diagnostics.mjs +1 -0
- package/dist/runtime/app/mount.mjs +1 -0
- package/dist/runtime/app/pending.d.mts +10 -0
- package/dist/runtime/app/pending.mjs +1 -0
- package/dist/runtime/app/setData/patchScheduler.mjs +1 -0
- package/dist/runtime/app/setData/payload.mjs +1 -0
- package/dist/runtime/app/setData/scheduler.mjs +1 -0
- package/dist/runtime/app/setData/snapshot.mjs +1 -0
- package/dist/runtime/app/setDataOptions.mjs +1 -0
- package/dist/runtime/app.d.mts +8 -0
- package/dist/runtime/app.mjs +1 -0
- package/dist/runtime/bindModel.mjs +1 -0
- package/dist/runtime/defaults.d.mts +11 -0
- package/dist/runtime/defaults.mjs +1 -0
- package/dist/runtime/define/initialComputed.mjs +1 -0
- package/dist/runtime/define/options.mjs +1 -0
- package/dist/runtime/define/optionsApi.mjs +1 -0
- package/dist/runtime/define/props.mjs +1 -0
- package/dist/runtime/define/scopedSlotOptions.mjs +1 -0
- package/dist/runtime/define/setupResult.mjs +1 -0
- package/dist/runtime/define.d.mts +105 -0
- package/dist/runtime/define.mjs +1 -0
- package/dist/runtime/diff.mjs +1 -0
- package/dist/runtime/disposables.d.mts +31 -0
- package/dist/runtime/disposables.mjs +1 -0
- package/dist/runtime/elementIntersectionObserver.d.mts +26 -0
- package/dist/runtime/elementIntersectionObserver.mjs +1 -0
- package/dist/runtime/emit.mjs +1 -0
- package/dist/runtime/hooks/base.d.mts +27 -0
- package/dist/runtime/hooks/base.mjs +1 -0
- package/dist/runtime/hooks/register.d.mts +30 -0
- package/dist/runtime/hooks/register.mjs +1 -0
- package/dist/runtime/hooks/vue.d.mts +53 -0
- package/dist/runtime/hooks/vue.mjs +1 -0
- package/dist/runtime/hooks.d.mts +4 -0
- package/dist/runtime/index.d.mts +47 -0
- package/dist/runtime/internal.mjs +1 -0
- package/dist/runtime/intersectionObserver.d.mts +14 -0
- package/dist/runtime/intersectionObserver.mjs +1 -0
- package/dist/runtime/layoutBridge.d.mts +59 -0
- package/dist/runtime/layoutBridge.mjs +1 -0
- package/dist/runtime/layoutComponentMatcher.mjs +1 -0
- package/dist/runtime/nativeBridge.mjs +1 -0
- package/dist/runtime/noSetData.d.mts +5 -0
- package/dist/runtime/noSetData.mjs +1 -0
- package/dist/runtime/pageEnvironment.d.mts +50 -0
- package/dist/runtime/pageEnvironment.mjs +1 -0
- package/dist/runtime/pageLayout.d.mts +26 -0
- package/dist/runtime/pageLayout.mjs +1 -0
- package/dist/runtime/pageScroll.d.mts +29 -0
- package/dist/runtime/pageScroll.mjs +1 -0
- package/dist/runtime/platform.mjs +1 -0
- package/dist/runtime/provide.d.mts +59 -0
- package/dist/runtime/provide.mjs +1 -0
- package/dist/runtime/provideContext.mjs +1 -0
- package/dist/runtime/provideStore.d.mts +7 -0
- package/dist/runtime/provideStore.mjs +1 -0
- package/dist/runtime/pullDownRefresh.d.mts +12 -0
- package/dist/runtime/pullDownRefresh.mjs +1 -0
- package/dist/runtime/register/app.d.mts +14 -0
- package/dist/runtime/register/app.mjs +1 -0
- package/dist/runtime/register/component/features.mjs +1 -0
- package/dist/runtime/register/component/lifecycle/optionalHooks.mjs +1 -0
- package/dist/runtime/register/component/lifecycle/platform.mjs +1 -0
- package/dist/runtime/register/component/lifecycle.mjs +1 -0
- package/dist/runtime/register/component/methods.mjs +1 -0
- package/dist/runtime/register/component/options.mjs +1 -0
- package/dist/runtime/register/component/props.mjs +1 -0
- package/dist/runtime/register/component/registerDefinition.mjs +1 -0
- package/dist/runtime/register/component.d.mts +15 -0
- package/dist/runtime/register/component.mjs +1 -0
- package/dist/runtime/register/inline.d.mts +15 -0
- package/dist/runtime/register/inline.mjs +1 -0
- package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -0
- package/dist/runtime/register/runtimeInstance/provideContext.mjs +1 -0
- package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -0
- package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -0
- package/dist/runtime/register/runtimeInstance/utils.mjs +1 -0
- package/dist/runtime/register/runtimeInstance.d.mts +26 -0
- package/dist/runtime/register/runtimeInstance.mjs +1 -0
- package/dist/runtime/register/setDataFrequencyWarning.mjs +1 -0
- package/dist/runtime/register/setup.d.mts +11 -0
- package/dist/runtime/register/setup.mjs +1 -0
- package/dist/runtime/register/snapshot.mjs +1 -0
- package/dist/runtime/register/watch.d.mts +12 -0
- package/dist/runtime/register/watch.mjs +1 -0
- package/dist/runtime/register.d.mts +5 -0
- package/dist/runtime/scopedSlots.mjs +1 -0
- package/dist/runtime/selectorQuery.d.mts +54 -0
- package/dist/runtime/selectorQuery.mjs +1 -0
- package/dist/runtime/setupTracking.mjs +1 -0
- package/dist/{template-DE8e5dj_.d.mts → runtime/template.d.mts} +1 -1
- package/dist/runtime/template.mjs +1 -0
- package/dist/runtime/templateRefTypes.d.mts +7 -0
- package/dist/runtime/templateRefs/helpers.mjs +1 -0
- package/dist/runtime/templateRefs.d.mts +11 -0
- package/dist/runtime/templateRefs.mjs +1 -0
- package/dist/runtime/types/core.d.mts +35 -0
- package/dist/runtime/types/miniprogram.d.mts +80 -0
- package/dist/runtime/types/miniprogramHost.d.mts +44 -0
- package/dist/runtime/types/miniprogramHostSources.d.mts +112 -0
- package/dist/runtime/types/options.d.mts +136 -0
- package/dist/runtime/types/props/propTypes.d.mts +79 -0
- package/dist/runtime/types/props/router.d.mts +51 -0
- package/dist/runtime/types/props/setup.d.mts +96 -0
- package/dist/runtime/types/props.d.mts +4 -0
- package/dist/runtime/types/runtime.d.mts +59 -0
- package/dist/runtime/types/setData.d.mts +220 -0
- package/dist/runtime/types.d.mts +28 -0
- package/dist/runtime/uniAppHost.d.mts +8 -0
- package/dist/runtime/uniAppHost.mjs +1 -0
- package/dist/runtime/updatePerformance.d.mts +13 -0
- package/dist/runtime/updatePerformance.mjs +1 -0
- package/dist/runtime/use.d.mts +13 -0
- package/dist/runtime/use.mjs +1 -0
- package/dist/runtime/vueCompat/context.d.mts +8 -0
- package/dist/runtime/vueCompat/context.mjs +1 -0
- package/dist/runtime/vueCompat/model.d.mts +30 -0
- package/dist/runtime/vueCompat/model.mjs +1 -0
- package/dist/runtime/vueCompat/router.d.mts +28 -0
- package/dist/runtime/vueCompat/router.mjs +1 -0
- package/dist/runtime/vueCompat/templateRef.d.mts +9 -0
- package/dist/runtime/vueCompat/templateRef.mjs +1 -0
- package/dist/runtime/vueCompat.d.mts +5 -0
- package/dist/scheduler.d.mts +4 -0
- package/dist/scheduler.mjs +1 -0
- package/dist/store/actions.mjs +1 -0
- package/dist/store/base.mjs +1 -0
- package/dist/store/define/optionsStyle.mjs +1 -0
- package/dist/store/define/setupStyle.mjs +1 -0
- package/dist/store/define/shared.mjs +1 -0
- package/dist/store/define.d.mts +26 -0
- package/dist/store/define.mjs +1 -0
- package/dist/store/manager.d.mts +8 -0
- package/dist/store/manager.mjs +1 -0
- package/dist/store/storeToRefs.d.mts +13 -0
- package/dist/store/storeToRefs.mjs +1 -0
- package/dist/store/types.d.mts +70 -0
- package/dist/store/utils.mjs +1 -0
- package/dist/store.d.mts +4 -1
- package/dist/store.mjs +1 -1
- package/dist/utils.mjs +1 -0
- package/dist/version.d.mts +4 -0
- package/dist/version.mjs +1 -0
- package/dist/vue-augment.d.mts +6 -0
- package/dist/vue-demi.d.mts +67 -7
- package/dist/vue-demi.mjs +1 -1
- package/dist/vue-types.d.mts +18 -0
- package/dist/weappIntrinsicElements/base.d.mts +22 -0
- package/dist/weappIntrinsicElements/elements/ad-custom.d.mts +13 -0
- package/dist/weappIntrinsicElements/elements/ad.d.mts +16 -0
- package/dist/weappIntrinsicElements/elements/audio.d.mts +20 -0
- package/dist/weappIntrinsicElements/elements/block.d.mts +8 -0
- package/dist/weappIntrinsicElements/elements/button.d.mts +40 -0
- package/dist/weappIntrinsicElements/elements/camera.d.mts +18 -0
- package/dist/weappIntrinsicElements/elements/canvas.d.mts +18 -0
- package/dist/weappIntrinsicElements/elements/checkbox-group.d.mts +13 -0
- package/dist/weappIntrinsicElements/elements/checkbox.d.mts +13 -0
- package/dist/weappIntrinsicElements/elements/cover-image.d.mts +10 -0
- package/dist/weappIntrinsicElements/elements/cover-view.d.mts +10 -0
- package/dist/weappIntrinsicElements/elements/editor.d.mts +22 -0
- package/dist/weappIntrinsicElements/elements/form.d.mts +16 -0
- package/dist/weappIntrinsicElements/elements/functional-page-navigator.d.mts +15 -0
- package/dist/weappIntrinsicElements/elements/icon.d.mts +12 -0
- package/dist/weappIntrinsicElements/elements/image.d.mts +18 -0
- package/dist/weappIntrinsicElements/elements/import.d.mts +10 -0
- package/dist/weappIntrinsicElements/elements/include.d.mts +10 -0
- package/dist/weappIntrinsicElements/elements/input.d.mts +47 -0
- package/dist/weappIntrinsicElements/elements/keyboard-accessory.d.mts +8 -0
- package/dist/weappIntrinsicElements/elements/label.d.mts +10 -0
- package/dist/weappIntrinsicElements/elements/live-player.d.mts +35 -0
- package/dist/weappIntrinsicElements/elements/live-pusher.d.mts +57 -0
- package/dist/weappIntrinsicElements/elements/map.d.mts +105 -0
- package/dist/weappIntrinsicElements/elements/match-media.d.mts +16 -0
- package/dist/weappIntrinsicElements/elements/movable-area.d.mts +26 -0
- package/dist/weappIntrinsicElements/elements/movable-view.d.mts +26 -0
- package/dist/weappIntrinsicElements/elements/navigation-bar.d.mts +15 -0
- package/dist/weappIntrinsicElements/elements/navigator.d.mts +25 -0
- package/dist/weappIntrinsicElements/elements/official-account.d.mts +13 -0
- package/dist/weappIntrinsicElements/elements/open-data.d.mts +15 -0
- package/dist/weappIntrinsicElements/elements/page-container.d.mts +25 -0
- package/dist/weappIntrinsicElements/elements/page-meta.d.mts +23 -0
- package/dist/weappIntrinsicElements/elements/picker-view-column.d.mts +18 -0
- package/dist/weappIntrinsicElements/elements/picker-view.d.mts +18 -0
- package/dist/weappIntrinsicElements/elements/picker.d.mts +23 -0
- package/dist/weappIntrinsicElements/elements/progress.d.mts +21 -0
- package/dist/weappIntrinsicElements/elements/radio-group.d.mts +13 -0
- package/dist/weappIntrinsicElements/elements/radio.d.mts +13 -0
- package/dist/weappIntrinsicElements/elements/rich-text.d.mts +17 -0
- package/dist/weappIntrinsicElements/elements/scroll-view.d.mts +68 -0
- package/dist/weappIntrinsicElements/elements/share-element.d.mts +18 -0
- package/dist/weappIntrinsicElements/elements/slider.d.mts +23 -0
- package/dist/weappIntrinsicElements/elements/slot.d.mts +10 -0
- package/dist/weappIntrinsicElements/elements/swiper-item.d.mts +42 -0
- package/dist/weappIntrinsicElements/elements/swiper.d.mts +42 -0
- package/dist/weappIntrinsicElements/elements/switch.d.mts +14 -0
- package/dist/weappIntrinsicElements/elements/template.d.mts +12 -0
- package/dist/weappIntrinsicElements/elements/text.d.mts +15 -0
- package/dist/weappIntrinsicElements/elements/textarea.d.mts +40 -0
- package/dist/weappIntrinsicElements/elements/video.d.mts +71 -0
- package/dist/weappIntrinsicElements/elements/view.d.mts +13 -0
- package/dist/weappIntrinsicElements/elements/voip-room.d.mts +14 -0
- package/dist/weappIntrinsicElements/elements/web-view.d.mts +13 -0
- package/dist/weappIntrinsicElements.d.mts +153 -0
- package/package.json +6 -6
- package/dist/base-BxKbbKVO.mjs +0 -1
- package/dist/computed-Xoi9XEUx.mjs +0 -1
- package/dist/dev/base-CYkvI7w8.mjs.map +0 -1
- package/dist/dev/computed-BxRsUJgi.mjs.map +0 -1
- package/dist/dev/ref-DRZC3Kc5.mjs +0 -695
- package/dist/dev/ref-DRZC3Kc5.mjs.map +0 -1
- package/dist/dev/router-DjGhTM7A.mjs +0 -739
- package/dist/dev/router-DjGhTM7A.mjs.map +0 -1
- package/dist/dev/router.mjs.map +0 -1
- package/dist/dev/store-HNsiQJ4d.mjs +0 -479
- package/dist/dev/store-HNsiQJ4d.mjs.map +0 -1
- package/dist/dev/template-n_iVr0ey.mjs.map +0 -1
- package/dist/dev/templateRef-Dyo45y5v.mjs +0 -6436
- package/dist/dev/templateRef-Dyo45y5v.mjs.map +0 -1
- package/dist/dev/toRefs-D06VmFK2.mjs.map +0 -1
- package/dist/dev/watch-jrgL5ald.mjs +0 -445
- package/dist/dev/watch-jrgL5ald.mjs.map +0 -1
- package/dist/index-BiHILcmb.d.mts +0 -1215
- package/dist/index-CCET_bCY.d.mts +0 -111
- package/dist/ref-D37CknuD.mjs +0 -1
- package/dist/router-DJOmKqXb.mjs +0 -1
- package/dist/store-eHrHBQiv.mjs +0 -1
- package/dist/template-CNzlwH-E.mjs +0 -1
- package/dist/templateRef-L_qeTIeS.mjs +0 -1
- package/dist/toRefs-CoytPyo0.mjs +0 -1
- package/dist/traverse-B4Ez44Gd.d.mts +0 -108
- package/dist/vue-types-B3N60cGV.d.mts +0 -757
- package/dist/watch-Bbd-gmEg.mjs +0 -1
- package/dist/weappIntrinsicElements-BgDtC53_.d.mts +0 -1257
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region src/runtime/layoutBridge.d.ts
|
|
2
|
+
type LayoutBridgeContext = Record<string, any>;
|
|
3
|
+
type LayoutBridgeComponentResolver = (selector: string) => any;
|
|
4
|
+
type LayoutHostMap = Record<string, unknown>;
|
|
5
|
+
type LayoutBridgeInstance<T = LayoutBridgeContext> = T & {
|
|
6
|
+
selectComponent?: LayoutBridgeComponentResolver;
|
|
7
|
+
};
|
|
8
|
+
interface LayoutHostBinding {
|
|
9
|
+
key: string;
|
|
10
|
+
refName?: string;
|
|
11
|
+
selector: string;
|
|
12
|
+
kind?: 'component';
|
|
13
|
+
}
|
|
14
|
+
interface LayoutHostResolveOptions<T = any> {
|
|
15
|
+
context?: T;
|
|
16
|
+
fallbackContext?: T;
|
|
17
|
+
interval?: number;
|
|
18
|
+
retries?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 为当前页面注册 layout bridge,使页面或子组件可消费 layout 内部能力。
|
|
22
|
+
*/
|
|
23
|
+
declare function registerPageLayoutBridge(selectors: string | string[], context?: LayoutBridgeContext): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 移除当前页面的 layout bridge 注册。
|
|
26
|
+
*/
|
|
27
|
+
declare function unregisterPageLayoutBridge(selectors: string | string[], context?: LayoutBridgeContext): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 解析当前页面已注册的 layout bridge,找不到时回退到传入上下文。
|
|
30
|
+
*/
|
|
31
|
+
declare function resolveLayoutBridge<T = any>(selector: string, fallbackContext?: T): LayoutBridgeInstance<T> | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* 解析当前页面 layout 内通过指定 key 暴露的宿主实例。
|
|
34
|
+
*/
|
|
35
|
+
declare function resolveLayoutHost<T = any, C = any>(key: string, options?: LayoutHostResolveOptions<C>): NonNullable<T> | null;
|
|
36
|
+
/**
|
|
37
|
+
* 等待当前页面 layout 宿主实例可用,适合页面初次进入时的异步宿主解析。
|
|
38
|
+
*/
|
|
39
|
+
declare function waitForLayoutHost<T = any, C = any>(key: string, options?: LayoutHostResolveOptions<C>): Promise<T | null>;
|
|
40
|
+
/**
|
|
41
|
+
* 在 layout 生命周期内暴露 bridge,使页面或子组件可访问 layout 内部实例。
|
|
42
|
+
*/
|
|
43
|
+
declare function useLayoutBridge(selectors: string | string[], options?: {
|
|
44
|
+
resolveComponent?: LayoutBridgeComponentResolver;
|
|
45
|
+
}): void;
|
|
46
|
+
/**
|
|
47
|
+
* 使用编译期注入的宿主绑定信息,直接从当前 layout 运行时实例解析子组件宿主并注册 bridge。
|
|
48
|
+
*/
|
|
49
|
+
declare function registerRuntimeLayoutHosts(bindings: LayoutHostBinding[], context?: LayoutBridgeContext): any;
|
|
50
|
+
/**
|
|
51
|
+
* 移除运行时自动注册的 layout 宿主 bridge。
|
|
52
|
+
*/
|
|
53
|
+
declare function unregisterRuntimeLayoutHosts(bindings: LayoutHostBinding[], context?: LayoutBridgeContext): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* 使用 key -> 宿主实例的映射批量暴露 layout 内部宿主,适合 toast/dialog 等共享反馈节点。
|
|
56
|
+
*/
|
|
57
|
+
declare function useLayoutHosts(hosts: LayoutHostMap): void;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { LayoutBridgeInstance, LayoutHostBinding, registerPageLayoutBridge, registerRuntimeLayoutHosts, resolveLayoutBridge, resolveLayoutHost, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, useLayoutBridge, useLayoutHosts, waitForLayoutHost };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isRef as e}from"../reactivity/ref.mjs";import{getCurrentMiniProgramPages as t}from"./platform.mjs";import{getCurrentInstance as n,getCurrentSetupContext as r}from"./hooks/base.mjs";import{onAttached as i,onDetached as a}from"./hooks/register.mjs";import{getTemplateRefMap as o}from"./templateRefs/helpers.mjs";import{WEVU_LAYOUT_BRIDGE_PAGE_KEYS as s,WEVU_NATIVE_INSTANCE_KEY as c,WEVU_PUBLIC_RUNTIME_KEY as l}from"@weapp-core/constants";function u(e){return Array.from(new Set(Array.isArray(e)?e:[e])).filter(e=>typeof e==`string`&&e.length>0)}function d(e){if(!e||typeof e!=`object`)return[];let t=[],n=typeof e.route==`string`?e.route.replace(/^\/+/,``):``;n&&t.push(`route:${n}`);for(let[n,r]of[[`webview`,`__wxWebviewId__`],[`exparser`,`__wxExparserNodeId__`]]){let i=e[r];(typeof i==`number`||typeof i==`string`)&&t.push(`${n}:${String(i)}`)}return Array.from(new Set(t))}function f(){let e=new Map;function t(t,n,r){let i=u(t);if(i.length===0||r.length===0)return null;for(let t of r){var a;let r=(a=e.get(t))==null?new Map:a;for(let e of i)r.set(e,n);e.set(t,r)}return i}function n(t,n,r){let i=u(t);if(i.length===0||r.length===0)return!1;let a=!1;for(let t of r){let r=e.get(t);if(r){for(let e of i)r.get(e)===n&&(r.delete(e),a=!0);r.size===0&&e.delete(t)}}return a}function r(t,n){return n.map(n=>{var r;return(r=e.get(n))==null?void 0:r.get(t)}).find(Boolean)}function i(e,t,n){var i;let a=r(e,t);return a?(i=n(a,e))==null?null:i:null}function a(e,t,n,r={}){var o,s;let c=(o=r.retries)==null?20:o,l=(s=r.interval)==null?16:s,u=i(e,t(),n);return u||c<=0?Promise.resolve(u):new Promise(i=>{setTimeout(()=>{i(a(e,t,n,{...r,retries:c-1}))},l)})}return{register:t,resolveBridge:r,resolveHost:i,unregister:n,waitForHost:a}}const p=f();function m(){let e=t();return e[e.length-1]}function h(e){return d(e)}function g(e){var t,n;if(!e||typeof e!=`object`)return;let r=(t=e[l])==null||(t=t.state)==null?void 0:t[c];if(r&&typeof r==`object`)return r;let i=(n=e.$state)==null?void 0:n[c];return i&&typeof i==`object`?i:e[c]&&typeof e[c]==`object`?e[c]:e}function _(e,t=new Set){if(!e||typeof e!=`object`||t.has(e))return m();if(t.add(e),typeof e.__wevuSetPageLayout==`function`)return e;let n=g(e);if(n&&n!==e){let e=_(n,t);if(e)return e}let r=e.$;if(r&&typeof r==`object`){let e=_(r,t);if(e)return e}let i=n==null?e:n,a=i.selectOwnerComponent;if(typeof a==`function`)try{let e=a.call(i);if(e&&e!==i){let n=_(e,t);if(n)return n}}catch(e){}return m()}function v(t){return typeof t==`function`?t():e(t)?t.value:t}function y(e,t){return e.find(e=>e.key===t)}function b(e,t){let n=e==null?void 0:e.selectComponent;if(typeof n!=`function`)return null;try{var r;return(r=n.call(e,t))==null?null:r}catch(e){return null}}function x(e,t){var n,r,i,a,s,c,u,d;if(!e.refName)return null;let f=o(t),p=(n=(r=(i=(a=t[l])==null||(a=a.state)==null?void 0:a.$refs)==null?(s=t.__wevu)==null||(s=s.state)==null?void 0:s.$refs:i)==null?(c=t.$state)==null?void 0:c.$refs:r)==null?t.$refs:n,m=(u=f==null||(d=f.get(e.refName))==null?void 0:d.value)==null?p==null?void 0:p[e.refName]:u;if(Array.isArray(m)){var h;return(h=m[0])==null?null:h}return m==null?null:m}function S(e,t){let n=g(t),r=n&&typeof n==`object`?Object.create(n):{};return Object.assign(r,{selectComponent(r){let i=y(e,r);if(!i)return null;if(i.kind===`component`||!i.kind){var a,o;return x(i,t)||((a=(o=b(n,i.selector))==null?b(m(),i.selector):o)==null?null:a)}return null}})}function C(e,t){let r=t==null?n():t,i=_(r),a=h(i);return!r||!i||a.length===0||!p.register(e,r,a)?!1:(r[s]=a,!0)}function w(e,t){var r;let i=t==null?n():t,a=_(i),o=(r=i==null?void 0:i[s])==null?h(a):r;if(!i||!Array.isArray(o)||o.length===0)return!1;let c=p.unregister(e,i,o);return delete i[s],c}function T(e,t){var r,i;let a=(r=m())==null?_(t):r,o=p.resolveBridge(e,h(a));return(i=o==null?t:o)==null?n():i}function E(e,t={}){var n,r;let i=(n=t.context)==null?t.fallbackContext:n,a=(r=m())==null?_(i):r;return p.resolveHost(e,h(a),(e,t)=>{var n;return(n=e.selectComponent)==null?void 0:n.call(e,t)})}function D(e,t={}){var n;let r=(n=t.context)==null?t.fallbackContext:n;return p.waitForHost(e,()=>{var e;return h((e=m())==null?_(r):e)},(e,t)=>{var n;return(n=e.selectComponent)==null?void 0:n.call(e,t)},t)}function O(e,t={}){if(!r())throw Error(`useLayoutBridge() 必须在 setup() 的同步阶段调用`);let o=n(),s=u(e),c=t.resolveComponent,l=g(o),d=l&&typeof l==`object`?Object.create(l):{},f=Object.assign(d,{selectComponent(e){var t,n,r;if(!s.includes(e))return null;let i=c==null?void 0:c(e);if(i!==void 0)return i;let a=g(o),l=a==null||(t=a.selectComponent)==null?void 0:t.call(a,e);if(l)return l;let u=m();return(n=u==null||(r=u.selectComponent)==null?void 0:r.call(u,e))==null?null:n}});C(s,f),i(()=>{C(s,f)}),a(()=>{w(s,f)})}function k(e,t){if(!e.length)return null;let r=t==null?n():t;if(!r)return null;let i=S(e,r);return C(e.map(e=>e.key),i),i}function A(e,t){if(!e.length)return!1;let r=t==null?n():t;return r?w(e.map(e=>e.key),r):!1}function j(e){O(Object.keys(e),{resolveComponent(t){return v(e[t])}})}export{C as registerPageLayoutBridge,k as registerRuntimeLayoutHosts,T as resolveLayoutBridge,E as resolveLayoutHost,w as unregisterPageLayoutBridge,A as unregisterRuntimeLayoutHosts,O as useLayoutBridge,j as useLayoutHosts,D as waitForLayoutHost};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=e=>e.startsWith(`layouts/`);function t(t){let n=t.is;return typeof n==`string`&&e(n,t)}export{t as isRuntimeLayoutComponentTarget};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`__wevu_native_bridge__`;function t(t){try{Object.defineProperty(t,e,{value:!0,configurable:!1,enumerable:!1,writable:!1})}catch(n){t[e]=!0}}function n(t){return typeof t==`function`&&!!t[e]}export{n as isNativeBridgeMethod,t as markNativeBridgeMethod};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=Symbol(`wevu.noSetData`);function t(t){return Object.defineProperty(t,e,{value:!0,configurable:!0,enumerable:!1,writable:!1}),t}function n(t){return typeof t==`object`&&!!t&&t[e]===!0}export{n as isNoSetData,t as markNoSetData};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Ref } from "../reactivity/ref.mjs";
|
|
2
|
+
import { ComputedRef } from "../reactivity/computed.mjs";
|
|
3
|
+
import "../index.mjs";
|
|
4
|
+
//#region src/runtime/pageEnvironment.d.ts
|
|
5
|
+
interface PageStackSnapshot {
|
|
6
|
+
canGoBack: boolean;
|
|
7
|
+
currentRoute: string;
|
|
8
|
+
stackLength: number;
|
|
9
|
+
}
|
|
10
|
+
interface UsePageStackOptions {
|
|
11
|
+
autoRefresh?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface NavigationBarMetrics {
|
|
14
|
+
navigationBarHeight: number;
|
|
15
|
+
navigationHeight: number;
|
|
16
|
+
statusBarHeight: number;
|
|
17
|
+
}
|
|
18
|
+
interface UseNavigationBarMetricsOptions {
|
|
19
|
+
autoRefresh?: boolean;
|
|
20
|
+
defaultNavigationBarHeight?: number;
|
|
21
|
+
defaultStatusBarHeight?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 获取当前小程序页面栈的稳定快照。
|
|
25
|
+
*/
|
|
26
|
+
declare function getCurrentPageStackSnapshot(): PageStackSnapshot;
|
|
27
|
+
/**
|
|
28
|
+
* 在 setup 中跟踪当前小程序页面栈状态。
|
|
29
|
+
*/
|
|
30
|
+
declare function usePageStack(options?: UsePageStackOptions): {
|
|
31
|
+
canGoBack: ComputedRef<boolean>;
|
|
32
|
+
currentRoute: Ref<string, string>;
|
|
33
|
+
refresh: () => void;
|
|
34
|
+
stackLength: Ref<number, number>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 计算自定义导航栏所需的状态栏和胶囊占位高度。
|
|
38
|
+
*/
|
|
39
|
+
declare function getNavigationBarMetrics(options?: Omit<UseNavigationBarMetricsOptions, 'autoRefresh'>): NavigationBarMetrics;
|
|
40
|
+
/**
|
|
41
|
+
* 在 setup 中跟踪自定义导航栏尺寸。
|
|
42
|
+
*/
|
|
43
|
+
declare function useNavigationBarMetrics(options?: UseNavigationBarMetricsOptions): {
|
|
44
|
+
navigationBarHeight: Ref<number, number>;
|
|
45
|
+
navigationHeight: ComputedRef<number>;
|
|
46
|
+
refresh: () => void;
|
|
47
|
+
statusBarHeight: Ref<number, number>;
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { NavigationBarMetrics, PageStackSnapshot, UseNavigationBarMetricsOptions, UsePageStackOptions, getCurrentPageStackSnapshot, getNavigationBarMetrics, useNavigationBarMetrics, usePageStack };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ref as e}from"../reactivity/ref.mjs";import{computed as t}from"../reactivity/computed.mjs";import{getCurrentMiniProgramPages as n,getMiniProgramGlobalObject as r}from"./platform.mjs";import{getCurrentSetupContext as i}from"./hooks/base.mjs";import{onAttached as a,onShow as o}from"./hooks/register.mjs";function s(e){var t,n;return e?(t=(n=e.split(`?`)[0])==null?void 0:n.replace(/^\/+/,``))==null?``:t:``}function c(){let e=n(),t=e[e.length-1],r=e.length||1;return{canGoBack:r>1,currentRoute:s(t==null?void 0:t.route),stackLength:r}}function l(n={}){var r;if(!i())throw Error(`usePageStack() 必须在 setup() 的同步阶段调用`);let s=c(),l=e(s.currentRoute),u=e(s.stackLength),d=t(()=>u.value>1),f=()=>{let e=c();l.value=e.currentRoute,u.value=e.stackLength};return((r=n.autoRefresh)==null||r)&&(a(f),o(f)),{canGoBack:d,currentRoute:l,refresh:f,stackLength:u}}function u(e={}){var t,n;let i=(t=e.defaultStatusBarHeight)==null?20:t,a=(n=e.defaultNavigationBarHeight)==null?44:n,o=r(),s=typeof(o==null?void 0:o.getSystemInfoSync)==`function`?o.getSystemInfoSync():{},c=Number((s==null?void 0:s.statusBarHeight)||i),l;try{l=typeof(o==null?void 0:o.getMenuButtonBoundingClientRect)==`function`?o.getMenuButtonBoundingClientRect():void 0}catch(e){}let u=Number((l==null?void 0:l.top)||0),d=Number((l==null?void 0:l.height)||0),f=u>c&&d>0?(u-c)*2+d:a;return{navigationBarHeight:f,navigationHeight:c+f,statusBarHeight:c}}function d(n={}){var r;if(!i())throw Error(`useNavigationBarMetrics() 必须在 setup() 的同步阶段调用`);let o=u(n),s=e(o.statusBarHeight),c=e(o.navigationBarHeight),l=t(()=>s.value+c.value),d=()=>{let e=u(n);s.value=e.statusBarHeight,c.value=e.navigationBarHeight};return((r=n.autoRefresh)==null||r)&&a(d),{navigationBarHeight:c,navigationHeight:l,refresh:d,statusBarHeight:s}}export{c as getCurrentPageStackSnapshot,u as getNavigationBarMetrics,d as useNavigationBarMetrics,l as usePageStack};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/runtime/pageLayout.d.ts
|
|
2
|
+
interface WevuPageLayoutMap {}
|
|
3
|
+
type ResolveTypedPageLayoutName = keyof WevuPageLayoutMap extends never ? string : Extract<keyof WevuPageLayoutMap, string>;
|
|
4
|
+
type ResolveTypedPageLayoutProps<Name extends string> = Name extends keyof WevuPageLayoutMap ? WevuPageLayoutMap[Name] : Record<string, any>;
|
|
5
|
+
type PageLayoutNamedState = { [Name in ResolveTypedPageLayoutName]: {
|
|
6
|
+
name: Name;
|
|
7
|
+
props: ResolveTypedPageLayoutProps<Name>;
|
|
8
|
+
}; }[ResolveTypedPageLayoutName];
|
|
9
|
+
type PageLayoutState = PageLayoutNamedState | {
|
|
10
|
+
name: false;
|
|
11
|
+
props: Record<string, any>;
|
|
12
|
+
} | {
|
|
13
|
+
name: undefined;
|
|
14
|
+
props: Record<string, any>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 获取当前页面 layout 状态。
|
|
18
|
+
*/
|
|
19
|
+
declare function usePageLayout(): Readonly<PageLayoutState>;
|
|
20
|
+
declare function syncRuntimePageLayoutState(target: Record<string, any>, layout: string | false, props: Record<string, any>): void;
|
|
21
|
+
declare function syncRuntimePageLayoutStateFromRuntime(target: Record<string, any>): void;
|
|
22
|
+
declare function setPageLayout(layout: false): void;
|
|
23
|
+
declare function setPageLayout<Name extends ResolveTypedPageLayoutName>(layout: Name, props?: ResolveTypedPageLayoutProps<Name>): void;
|
|
24
|
+
declare function resolveRuntimePageLayoutName(layout: string | false): string;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { PageLayoutState, WevuPageLayoutMap, resolveRuntimePageLayoutName, setPageLayout, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, usePageLayout };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"./platform.mjs";import{getCurrentInstance as r,getCurrentSetupContext as i}from"./hooks/base.mjs";import{getCurrentPageInstance as a}from"./register/component/lifecycle/platform.mjs";import{WEVU_PAGE_LAYOUT_NAME_KEY as o,WEVU_PAGE_LAYOUT_NONE as s,WEVU_PAGE_LAYOUT_PROPS_KEY as c,WEVU_PAGE_LAYOUT_SETTER_KEY as l}from"@weapp-core/constants";function u(){let e=a();if(e)return e;let t=n();return t[t.length-1]}function d(e){return e!==s&&e}function f(){var n,a;if(!i())throw Error(`usePageLayout() 必须在 setup() 的同步阶段调用`);let s=r(),l=s==null||(n=s.__wevu)==null?void 0:n.state,u=e({name:d(l==null?void 0:l[o]),props:{...(a=l==null?void 0:l[c])==null?{}:a}});return s&&(s.__wevuPageLayoutState=u),t(u)}function p(e,t,n){let r=e.__wevuPageLayoutState;r&&(r.name=t,r.props={...n})}function m(e){var t,n;let r=e.__wevuPageLayoutState,i=(t=e.__wevu)==null?void 0:t.state;!r||!i||(r.name=d(i[o]),r.props={...(n=i[c])==null?{}:n})}function h(e,t){let n=r(),i=n==null?void 0:n[l];if(typeof i==`function`){i(e,t);return}let a=u(),o=a==null?void 0:a[l];if(typeof o==`function`){o(e,t);return}throw Error(`setPageLayout() 未找到当前页面实例。请在页面 setup()、事件回调或当前页面上下文中调用。`)}function g(e){return e===!1?s:e}export{g as resolveRuntimePageLayoutName,h as setPageLayout,p as syncRuntimePageLayoutState,m as syncRuntimePageLayoutStateFromRuntime,f as usePageLayout};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HostMiniProgramPageScrollOption } from "./types/miniprogramHost.mjs";
|
|
2
|
+
import "./types.mjs";
|
|
3
|
+
//#region src/runtime/pageScroll.d.ts
|
|
4
|
+
interface UsePageScrollThrottleOptions {
|
|
5
|
+
/**
|
|
6
|
+
* 节流间隔(毫秒),默认 80ms。
|
|
7
|
+
*/
|
|
8
|
+
interval?: number;
|
|
9
|
+
/**
|
|
10
|
+
* 是否在窗口起始边缘立即触发,默认 true。
|
|
11
|
+
*/
|
|
12
|
+
leading?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 是否在窗口结束边缘补一次回调,默认 true。
|
|
15
|
+
*/
|
|
16
|
+
trailing?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 持续滚动时的最大等待时间(毫秒)。
|
|
19
|
+
* 当 trailing 为 false 时,可用于兜底触发一次回调。
|
|
20
|
+
*/
|
|
21
|
+
maxWait?: number;
|
|
22
|
+
}
|
|
23
|
+
type UsePageScrollThrottleStopHandle = () => void;
|
|
24
|
+
/**
|
|
25
|
+
* 在 setup 中注册节流后的 onPageScroll 监听,并在卸载时自动清理。
|
|
26
|
+
*/
|
|
27
|
+
declare function usePageScrollThrottle(handler: (opt: HostMiniProgramPageScrollOption) => void, options?: UsePageScrollThrottleOptions): UsePageScrollThrottleStopHandle;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { UsePageScrollThrottleOptions, UsePageScrollThrottleStopHandle, usePageScrollThrottle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getCurrentInstance as e}from"./hooks/base.mjs";import{onDetached as t,onPageScroll as n,onUnload as r}from"./hooks/register.mjs";function i(e){return typeof e!=`number`||!Number.isFinite(e)?80:Math.max(0,e)}function a(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return Math.max(0,e)}function o(o,s={}){var c,l;if(!e())throw Error(`usePageScrollThrottle() 必须在 setup() 的同步阶段调用`);if(typeof o!=`function`)throw TypeError(`usePageScrollThrottle() 需要传入回调函数`);let u=i(s.interval),d=(c=s.leading)==null||c,f=(l=s.trailing)==null||l,p=a(s.maxWait),m,h,g=!1,_=0,v,y=()=>{m&&(clearTimeout(m),m=void 0)},b=()=>{h&&(clearTimeout(h),h=void 0)},x=e=>{y(),b(),v=void 0,_=Date.now(),o(e)},S=()=>{let e=v;v=void 0,m=void 0,!(!e||g)&&x(e)},C=()=>{let e=v;h=void 0,!(!e||g)&&x(e)},w=e=>{if(!f||m)return;let t=Math.max(0,u-(e-(_===0?e:_)));m=setTimeout(S,t)},T=e=>{if(typeof p!=`number`||h)return;let t=p-(e-(_===0?e:_));if(t<=0){C();return}h=setTimeout(C,t)};n(e=>{if(g)return;if(u===0){x(e);return}let t=Date.now();if(v=e,d&&(_===0||t-_>=u)){x(e);return}if(typeof p==`number`&&t-(_===0?t:_)>=p){x(e);return}!f&&typeof p!=`number`||(w(t),T(t))});let E=()=>{g||(g=!0,v=void 0,y(),b())};return r(E),t(E),E}export{o as usePageScrollThrottle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getMiniProgramPlatformByRuntimeGlobalKey as e,getMiniProgramRuntimeCapabilities as t,getMiniProgramRuntimeGlobalKey as n,getMiniProgramRuntimeGlobalKeys as r,getMiniProgramRuntimeHostConfigKey as i,resolveMiniProgramPlatform as a,supportsMiniProgramRuntimeCapability as o}from"@weapp-core/shared/platforms";const s=[`switchTab`,`reLaunch`,`redirectTo`,`navigateTo`,`navigateBack`];function c(){if(!(typeof globalThis>`u`))return globalThis}function l(){var t;let n=c(),i=a((t=import.meta.env)==null?void 0:t.PLATFORM);if(i)return i;for(let t of r())if(n!=null&&n[t])return e(t)}function u(){return t(l())}function d(e){return o(l(),e)}function f(){if(!d(`globalPageStack`))return[];let e=globalThis.getCurrentPages;if(typeof e!=`function`)return[];try{let t=e();return Array.isArray(t)?t:[]}catch(e){return[]}}function p(){let e=c(),t=i(l()),n=e==null?void 0:e[t];return n&&typeof n==`object`?n:void 0}function m(e){var t;let i=c(),o=a(e==null?(t=import.meta.env)==null?void 0:t.PLATFORM:e);if(o){let e=n(o);return i==null?void 0:i[e]}for(let e of r()){let t=i==null?void 0:i[e];if(t)return t}}function h(){if(!d(`globalRouterApi`))return;let e=m();if(!e)return;let t=Object.create(null);for(let n of s){let r=e[n];if(typeof r!=`function`)return;t[n]=(...t)=>r.apply(e,t)}return t}function g(){var e;return(e=m())==null?c():e}export{h as getCurrentMiniProgramGlobalRouter,p as getCurrentMiniProgramHostConfig,f as getCurrentMiniProgramPages,u as getCurrentMiniProgramRuntimeCapabilities,m as getMiniProgramGlobalObject,g as getScopedSlotHostGlobalObject,l as resolveCurrentMiniProgramPlatform,d as supportsCurrentMiniProgramRuntimeCapability};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { setGlobalProvidedValue } from "./provideStore.mjs";
|
|
2
|
+
//#region src/runtime/provide.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* 判断当前是否存在可用的注入上下文。
|
|
5
|
+
*
|
|
6
|
+
* wevu 的依赖注入上下文来自同步 `setup()` 阶段的当前实例。
|
|
7
|
+
*/
|
|
8
|
+
declare function hasInjectionContext(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 在组件上下文中向后代注入值(与 Vue 3 行为兼容),若没有当前实例则回落到全局存储。
|
|
11
|
+
*
|
|
12
|
+
* @param key 注入键,可为字符串、Symbol 或对象
|
|
13
|
+
* @param value 提供的值
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* defineComponent({
|
|
18
|
+
* setup() {
|
|
19
|
+
* provide(TOKEN_KEY, { data: 'value' })
|
|
20
|
+
* }
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function provide<T>(key: any, value: T): void;
|
|
25
|
+
/**
|
|
26
|
+
* 从祖先组件(或全局存储)读取提供的值。
|
|
27
|
+
*
|
|
28
|
+
* @param key 注入键,需与 provide 使用的键保持一致
|
|
29
|
+
* @param defaultValue 未找到提供者时的默认值
|
|
30
|
+
* @returns 匹配到的值或默认值
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* defineComponent({
|
|
35
|
+
* setup() {
|
|
36
|
+
* const data = inject(TOKEN_KEY)
|
|
37
|
+
* const value = inject('key', 'default')
|
|
38
|
+
* }
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare function inject<T>(key: any, defaultValue: T): T;
|
|
43
|
+
declare function inject<T>(key: any): T | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* 全局注入值,适用于历史兼容场景。
|
|
46
|
+
*
|
|
47
|
+
* @deprecated 已弃用,仅用于兼容/过渡。推荐优先使用 `provide()`,
|
|
48
|
+
* 在无实例上下文时 `provide()` 会自动回落到全局存储。
|
|
49
|
+
*/
|
|
50
|
+
declare function provideGlobal<T>(key: any, value: T): void;
|
|
51
|
+
/**
|
|
52
|
+
* 从全局存储读取值,适用于历史兼容场景。
|
|
53
|
+
*
|
|
54
|
+
* @deprecated 已弃用,仅用于兼容/过渡。推荐优先使用 `inject()`,
|
|
55
|
+
* 在无实例上下文时 `inject()` 会自动从全局存储读取。
|
|
56
|
+
*/
|
|
57
|
+
declare function injectGlobal<T>(key: any, defaultValue?: T): T;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { hasInjectionContext, inject, injectGlobal, provide, provideGlobal, setGlobalProvidedValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getCurrentInstance as e}from"./hooks/base.mjs";import{getGlobalProvidedValue as t,hasGlobalProvidedValue as n,setGlobalProvidedValue as r}from"./provideStore.mjs";import{getInstanceProvides as i,isRuntimeAppInstance as a}from"./provideContext.mjs";function o(){return!!e()}function s(t,n){let o=e();o?(i(o)[t]=n,a(o)&&r(t,n)):r(t,n)}function c(r,a){var o;let s=e();if(s){let e=i(s);if(r in e)return e[r]}if(n(r))return t(r);if(arguments.length>=2)return a;let c=(o=globalThis.console)==null?void 0:o.warn;typeof c==`function`&&c(`wevu.inject:未找到对应 key 的值:${String(r)}`)}function l(e,t){r(e,t)}function u(e,r){if(n(e))return t(e);if(arguments.length>=2)return r;throw Error(`injectGlobal():未找到对应 key 的 provider:${String(e)}`)}export{o as hasInjectionContext,c as inject,u as injectGlobal,s as provide,l as provideGlobal,r as setGlobalProvidedValue};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setGlobalProvidedValue as e}from"./provideStore.mjs";import{WEVU_APP_PROVIDES_KEY as t,WEVU_IS_APP_INSTANCE_KEY as n,WEVU_PARENT_INSTANCE_KEY as r,WEVU_PROVIDES_KEY as i,WEVU_RUNTIME_APP_KEY as a}from"@weapp-core/constants";function o(e){return!!(e&&typeof e==`object`&&e[n]===!0)}function s(e){return Object.create(e==null?null:e)}function c(e){if(!e)return s();let n=e[t];if(n&&typeof n==`object`)return n;let r=s();try{Object.defineProperty(e,t,{value:r,configurable:!0,enumerable:!1,writable:!1})}catch(n){e[t]=r}return r}function l(e,t){try{Object.defineProperty(e,i,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(n){e[i]=t}}function u(e){var t,n;let u=e[i];if(u&&typeof u==`object`)return u;let d=e[a],f=(t=(n=e[r])==null?void 0:n[i])==null?c(d):t,p=o(e)?c(d):s(f);return l(e,p),p}function d(e){return c(e)}function f(t,n,r){c(t)[n]=r,e(n,r)}function p(e,t,n){var a;let u=c(t),d=(a=n==null?void 0:n[i])==null?u:a,f=o(e)?u:s(d);if(n)try{Object.defineProperty(e,r,{value:n,configurable:!0,enumerable:!1,writable:!0})}catch(t){e[r]=n}l(e,f)}function m(e,t){let n=Object.getPrototypeOf(e);for(;n;){if(n===t)return!0;n=Object.getPrototypeOf(n)}return!1}function h(e,t){let n=u(e),i=u(t);if(!(n===i||m(n,i)||m(i,n))){Object.setPrototypeOf(i,n);try{Object.defineProperty(t,r,{value:e,configurable:!0,enumerable:!1,writable:!0})}catch(n){t[r]=e}}}export{l as attachInstanceProvides,h as attachRuntimeLayoutProvideContext,p as attachRuntimeProvideContext,d as ensureRuntimeAppProvides,u as getInstanceProvides,o as isRuntimeAppInstance,f as setRuntimeAppProvidedValue};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=new Map;function t(t,n){e.set(t,n)}function n(t){return e.has(t)}function r(t){return e.get(t)}export{r as getGlobalProvidedValue,n as hasGlobalProvidedValue,t as setGlobalProvidedValue};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/runtime/pullDownRefresh.d.ts
|
|
2
|
+
type PullDownRefreshHandler = () => void | Promise<void>;
|
|
3
|
+
interface UseAsyncPullDownRefreshOptions {
|
|
4
|
+
onError?: (error: unknown) => void | Promise<void>;
|
|
5
|
+
stopPullDownRefresh?: () => unknown | Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 注册下拉刷新回调,并在回调结束后自动停止宿主下拉刷新状态。
|
|
9
|
+
*/
|
|
10
|
+
declare function useAsyncPullDownRefresh(refresh: PullDownRefreshHandler, options?: UseAsyncPullDownRefreshOptions): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { PullDownRefreshHandler, UseAsyncPullDownRefreshOptions, useAsyncPullDownRefresh };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{onPullDownRefresh as e}from"./hooks/register.mjs";import{wpi as t}from"@wevu/api";function n(n,r={}){e(async()=>{try{await n()}catch(t){var e;await((e=r.onError)==null?void 0:e.call(r,t))}finally{var i;await((i=r.stopPullDownRefresh)==null?(()=>t.stopPullDownRefresh()):i)()}})}export{n as useAsyncPullDownRefresh};
|
|
@@ -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
|
+
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
|
+
export { registerApp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getMiniProgramGlobalObject as e,supportsCurrentMiniProgramRuntimeCapability as t}from"../platform.mjs";import{callHookList as n}from"../hooks/base.mjs";import{runInlineExpression as r}from"./inline.mjs";import{mountRuntimeInstance as i}from"./runtimeInstance.mjs";import{WEVU_HOOKS_KEY as a,WEVU_INLINE_HANDLER as o,WEVU_INLINE_MAP_KEY as s,WEVU_IS_APP_INSTANCE_KEY as c}from"@weapp-core/constants";const l=`__wevuAppGlobalListeners`,u=`__wevuOnMemoryWarningListener`;function d(r){let i=r[a],o=!!(i!=null&&i.onMemoryWarning);if(!t(`appMemoryWarningListener`)){delete r[u];return}let s=e(),c=s==null?void 0:s.onMemoryWarning,l=s==null?void 0:s.offMemoryWarning;if(typeof c!=`function`)return;let d=r[u];if(typeof d==`function`&&typeof l==`function`)try{l(d)}catch(e){}if(!o){delete r[u];return}let f=e=>{n(r,`onMemoryWarning`,[e])};r[u]=f,c(f)}function f(r,i){var o,s;let{hookName:c,onApiName:u,offApiName:d,capabilityName:f,userHandler:p}=i,m=r[a],h=!!(m!=null&&m[c]),g=(s=(o=r)[l])==null?o[l]=Object.create(null):s,_=g[c];if(!t(f)){delete g[c],delete r[c];return}let v=e(),y=v==null?void 0:v[u],b=v==null?void 0:v[d];if(typeof _==`function`&&typeof b==`function`)try{b(_)}catch(e){}if(!h&&typeof p!=`function`){delete g[c];return}let x=(...e)=>{n(r,c,e),typeof p==`function`&&p.apply(r,e)};r[c]=x,g[c]=x,typeof y==`function`&&y(x)}function p(e,t){f(e,{hookName:`onError`,onApiName:`onError`,offApiName:`offError`,capabilityName:`appErrorListener`,userHandler:t.onError}),f(e,{hookName:`onPageNotFound`,onApiName:`onPageNotFound`,offApiName:`offPageNotFound`,capabilityName:`appPageNotFoundListener`,userHandler:t.onPageNotFound}),f(e,{hookName:`onUnhandledRejection`,onApiName:`onUnhandledRejection`,offApiName:`offUnhandledRejection`,capabilityName:`appUnhandledRejectionListener`,userHandler:t.onUnhandledRejection}),f(e,{hookName:`onThemeChange`,onApiName:`onThemeChange`,offApiName:`offThemeChange`,capabilityName:`appThemeChangeListener`,userHandler:t.onThemeChange})}function m(e,t,a,l,u){var f;if(typeof App!=`function`)throw TypeError(`createApp 需要全局 App 构造器可用`);let m=Object.keys(t==null?{}:t),h={...u};h.globalData=(f=h.globalData)==null?{}:f,h[o]||(h[o]=function(e){var t,n;let i=this.__wevu;return r((t=i==null?void 0:i.proxy)==null?this:t,void 0,e,i==null||(n=i.methods)==null?void 0:n[s])});let g=h.onLaunch,_=h.onError,v=h.onPageNotFound,y=h.onUnhandledRejection,b=h.onThemeChange;h.onLaunch=function(...t){this[c]=!0,i(this,e,a,l),d(this),p(this,{onError:_,onPageNotFound:v,onUnhandledRejection:y,onThemeChange:b}),n(this,`onLaunch`,t),typeof g==`function`&&g.apply(this,t)};let x=h.onShow;h.onShow=function(...e){n(this,`onShow`,e),typeof x==`function`&&x.apply(this,e)};let S=h.onHide;h.onHide=function(...e){n(this,`onHide`,e),typeof S==`function`&&S.apply(this,e)},delete h.onError,delete h.onPageNotFound,delete h.onUnhandledRejection,delete h.onThemeChange;for(let e of m){let t=h[e];h[e]=function(...n){var r;let i=this.__wevu,a,o=i==null||(r=i.methods)==null?void 0:r[e];return o&&(a=o.apply(i.proxy,n)),typeof t==`function`?t.apply(this,n):a}}App(h)}export{m as registerApp};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let{features:t,userOnSaveExitState:n,userOnPullDownRefresh:r,userOnReachBottom:i,userOnPageScroll:a,userOnRouteDone:o,userOnTabItemTap:s,userOnResize:c,userOnShareAppMessage:l,userOnShareTimeline:u,userOnAddToFavorites:d}=e,f=typeof r==`function`||!!t.enableOnPullDownRefresh,p=typeof i==`function`||!!t.enableOnReachBottom,m=typeof a==`function`||!!t.enableOnPageScroll,h=typeof o==`function`||!!t.enableOnRouteDone,g=!!t.enableOnRouteDoneFallback,_=typeof s==`function`||!!t.enableOnTabItemTap,v=typeof c==`function`||!!t.enableOnResize,y=typeof u==`function`||!!t.enableOnShareTimeline,b=typeof l==`function`||!!t.enableOnShareAppMessage,x=typeof d==`function`||!!t.enableOnAddToFavorites,S=typeof n==`function`||!!t.enableOnSaveExitState,C=()=>{};return{enableOnPullDownRefresh:f,enableOnReachBottom:p,enableOnPageScroll:m,enableOnRouteDone:h,enableOnRouteDoneFallback:g,enableOnTabItemTap:_,enableOnResize:v,enableOnShareAppMessage:b,enableOnShareTimeline:y,enableOnAddToFavorites:x,enableOnSaveExitState:S,effectiveOnSaveExitState:typeof n==`function`?n:(()=>({data:void 0})),effectiveOnPullDownRefresh:typeof r==`function`?r:C,effectiveOnReachBottom:typeof i==`function`?i:C,effectiveOnPageScroll:typeof a==`function`?a:C,effectiveOnRouteDone:typeof o==`function`?o:C,effectiveOnTabItemTap:typeof s==`function`?s:C,effectiveOnResize:typeof c==`function`?c:C,effectiveOnShareAppMessage:typeof l==`function`?l:C,effectiveOnShareTimeline:typeof u==`function`?u:C,effectiveOnAddToFavorites:typeof d==`function`?d:(()=>({}))}}export{e as resolveComponentFeatures};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{callHookList as e,callHookReturn as t}from"../../../hooks/base.mjs";import{runInPageScrollHook as n}from"./platform.mjs";import{WEVU_ROUTE_DONE_CALLED_KEY as r,WEVU_ROUTE_DONE_IN_TICK_KEY as i}from"@weapp-core/constants";function a(a,o){let{enableOnSaveExitState:s,enableOnPullDownRefresh:c,enableOnReachBottom:l,enableOnPageScroll:u,enableOnRouteDone:d,enableOnTabItemTap:f,enableOnResize:p,enableOnShareAppMessage:m,enableOnShareTimeline:h,enableOnAddToFavorites:g,effectiveOnSaveExitState:_,effectiveOnPullDownRefresh:v,effectiveOnReachBottom:y,effectiveOnPageScroll:b,effectiveOnRouteDone:x,effectiveOnTabItemTap:S,effectiveOnResize:C,effectiveOnShareAppMessage:w,effectiveOnShareTimeline:T,effectiveOnAddToFavorites:E,hasHook:D}=o;s&&(a.onSaveExitState=function(...e){let n=t(this,`onSaveExitState`,e);return n===void 0?_.apply(this,e):n}),c&&(a.onPullDownRefresh=function(...t){if(e(this,`onPullDownRefresh`,t),!D(this,`onPullDownRefresh`))return v.apply(this,t)}),l&&(a.onReachBottom=function(...t){if(e(this,`onReachBottom`,t),!D(this,`onReachBottom`))return y.apply(this,t)}),u&&(a.onPageScroll=function(...t){return n(this,()=>{if(e(this,`onPageScroll`,t),!D(this,`onPageScroll`))return b.apply(this,t)})}),d&&(a.onRouteDone=function(...t){if(!this[i]&&(this[i]=!0,Promise.resolve().then(()=>{this[i]=!1}),this[r]=!0,e(this,`onRouteDone`,t),!D(this,`onRouteDone`)))return x.apply(this,t)}),f&&(a.onTabItemTap=function(...t){if(e(this,`onTabItemTap`,t),!D(this,`onTabItemTap`))return S.apply(this,t)}),p&&(a.onResize=function(...t){if(e(this,`onResize`,t),!D(this,`onResize`))return C.apply(this,t)}),m&&(a.onShareAppMessage=function(...e){let n=t(this,`onShareAppMessage`,e);return n===void 0?w.apply(this,e):n}),h&&(a.onShareTimeline=function(...e){let n=t(this,`onShareTimeline`,e);return n===void 0?T.apply(this,e):n}),g&&(a.onAddToFavorites=function(...e){let n=t(this,`onAddToFavorites`,e);return n===void 0?E.apply(this,e):n})}export{a as attachOptionalPageLifecycleHooks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getCurrentMiniProgramPages as e,getCurrentMiniProgramRuntimeCapabilities as t,getMiniProgramGlobalObject as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../../../platform.mjs";import{callHookList as i}from"../../../hooks/base.mjs";import{WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY as a}from"@weapp-core/constants";let o=!1,s;function c(){return s}function l(e){s=e}function u(e){s===e&&(s=void 0)}function d(e,t){var n;e[a]=Number((n=e[a])==null?0:n)+1;try{return t()}finally{var r;let t=Number((r=e[a])==null?1:r)-1;t<=0?delete e[a]:e[a]=t}}function f(t){let n=t.options;if(n&&typeof n==`object`)return n;let r=e(),i=r[r.length-1],a=i&&typeof i==`object`?i.options:void 0;return a&&typeof a==`object`?a:{}}function p(){if(o)return;o=!0;let e=n();if(!(!e||typeof e!=`object`)){if(r(`pullDownRefreshApi`)){let t=e.startPullDownRefresh;typeof t==`function`&&(e.startPullDownRefresh=function(...e){let n=t.apply(this,e);return s&&i(s,`onPullDownRefresh`,[]),n})}if(r(`pageScrollApi`)){let t=e.pageScrollTo;typeof t==`function`&&(e.pageScrollTo=function(e,...n){let r=t.apply(this,[e,...n]);if(s){let t=s;d(t,()=>{i(t,`onPageScroll`,[e==null?{}:e])})}return r})}}}function m(e){let{enableOnShareAppMessage:i,enableOnShareTimeline:a}=e;if(!i&&!a||!r(`pageShareMenu`))return;let o=n();if(!o||typeof o.showShareMenu!=`function`)return;let s=t().shareTimelineRequiresShareAppMessage?i||a:i;if(!s&&!a)return;let c=[];s&&c.push(`shareAppMessage`),a&&c.push(`shareTimeline`);let l=[{withShareTicket:!0,menus:c},{menus:c},a?{withShareTicket:!0}:void 0,a?{}:void 0,void 0];for(let e of l)try{e===void 0?o.showShareMenu():o.showShareMenu(e);break}catch(e){}}export{l as bindCurrentPageInstance,p as ensureMiniProgramGlobalPatched,m as ensurePageShareMenus,c as getCurrentPageInstance,u as releaseCurrentPageInstance,f as resolvePageOptions,d as runInPageScrollHook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{callHookList as e}from"../../hooks/base.mjs";import{bindCurrentPageInstance as t,ensureMiniProgramGlobalPatched as n,ensurePageShareMenus as r,releaseCurrentPageInstance as i,resolvePageOptions as a}from"./lifecycle/platform.mjs";import{scheduleTemplateRefUpdate as o}from"../../templateRefs.mjs";import{enableDeferredSetData as s,mountRuntimeInstance as c,setRuntimeSetDataVisibility as l,teardownRuntimeInstance as u}from"../runtimeInstance.mjs";import{notifyRouteStateSync as d}from"../../../router/routeSync.mjs";import{attachOptionalPageLifecycleHooks as f}from"./lifecycle/optionalHooks.mjs";import{WEVU_ON_LOAD_CALLED_KEY as p,WEVU_READY_CALLED_KEY as m,WEVU_ROUTE_DONE_CALLED_KEY as h}from"@weapp-core/constants";function g(g){let{runtimeApp:_,watch:v,setup:y,userOnLoad:b,userOnUnload:x,userOnShow:S,userOnHide:C,userOnReady:w,isPage:T,enableOnSaveExitState:E,enableOnPullDownRefresh:D,enableOnReachBottom:O,enableOnPageScroll:k,enableOnRouteDone:A,enableOnRouteDoneFallback:j,enableOnTabItemTap:M,enableOnResize:N,enableOnShareAppMessage:P,enableOnShareTimeline:F,enableOnAddToFavorites:I,syncWevuPropsFromValues:L,effectiveOnSaveExitState:R,effectiveOnPullDownRefresh:z,effectiveOnReachBottom:B,effectiveOnPageScroll:V,effectiveOnRouteDone:H,effectiveOnTabItemTap:U,effectiveOnResize:W,effectiveOnShareAppMessage:G,effectiveOnShareTimeline:K,effectiveOnAddToFavorites:q,hasHook:J}=g,Y=e=>{var t,n;(t=e.__wevu)==null||(n=t.__wevu_flushSetupSnapshotSync)==null||n.call(t)},X={onLoad(...t){if(this[p])return;this[p]=!0,c(this,_,v,y);let n=t[0]&&typeof t[0]==`object`?t[0]:a(this);if(L==null||L(this,n),Y(this),s(this),T&&r({enableOnShareAppMessage:P,enableOnShareTimeline:F}),e(this,`onLoad`,t),typeof b==`function`)return b.apply(this,t.length?t:[n])},onUnload(...e){if(T&&i(this),u(this),typeof x==`function`)return x.apply(this,e)},onShow(...i){if(T&&(n(),t(this),this[p]||X.onLoad.call(this,a(this)),L==null||L(this,a(this)),Y(this),r({enableOnShareAppMessage:P,enableOnShareTimeline:F}),this[h]=!1),l(this,!0),T&&d({page:this,source:`page`}),e(this,`onShow`,i),typeof S==`function`)return S.apply(this,i)},onHide(...t){if(T&&i(this),l(this,!1),e(this,`onHide`,t),typeof C==`function`)return C.apply(this,t)},onReady(...t){if(T&&(this[p]||X.onLoad.call(this,a(this)),L==null||L(this,a(this)),Y(this),r({enableOnShareAppMessage:P,enableOnShareTimeline:F})),!this[m]){if(this[m]=!0,T&&A&&j){let e=this;setTimeout(()=>{if(!e[h]){var t;(t=X.onRouteDone)==null||t.call(e)}},0)}o(this,()=>{e(this,`onReady`,t),typeof w==`function`&&w.apply(this,t)});return}if(typeof w==`function`)return w.apply(this,t)}};return f(X,{enableOnSaveExitState:E,enableOnPullDownRefresh:D,enableOnReachBottom:O,enableOnPageScroll:k,enableOnRouteDone:A,enableOnTabItemTap:M,enableOnResize:N,enableOnShareAppMessage:P,enableOnShareTimeline:F,enableOnAddToFavorites:I,effectiveOnSaveExitState:R,effectiveOnPullDownRefresh:z,effectiveOnReachBottom:B,effectiveOnPageScroll:V,effectiveOnRouteDone:H,effectiveOnTabItemTap:U,effectiveOnResize:W,effectiveOnShareAppMessage:G,effectiveOnShareTimeline:K,effectiveOnAddToFavorites:q,hasHook:J}),X}export{g as createPageLifecycleHooks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseModelEventValue as e}from"../../internal.mjs";import{runInlineExpression as t}from"../inline.mjs";import{WEVU_INLINE_HANDLER as n,WEVU_INLINE_MAP_KEY as r,WEVU_MODEL_HANDLER as i,WEVU_NATIVE_INSTANCE_KEY as a,WEVU_OWNER_HANDLER as o,WEVU_RESERVED_METHOD_PREFIX as s,WEVU_RUNTIME_KEY as c}from"@weapp-core/constants";function l(l){let{userMethods:u,runtimeMethods:d}=l,f={...u};f[n]||(f[n]=function(e){var n,i;let a=this.__wevu;return t((n=a==null?void 0:a.proxy)==null?this:n,void 0,e,a==null||(i=a.methods)==null?void 0:i[r])}),f[i]||(f[i]=function(t){var n,r,i;let a=(n=t==null||(r=t.currentTarget)==null||(r=r.dataset)==null?void 0:r.wvModel)==null?t==null||(i=t.target)==null||(i=i.dataset)==null?void 0:i.wvModel:n;if(typeof a!=`string`||!a)return;let o=this.__wevu;if(!o||typeof o.bindModel!=`function`)return;let s=e(t);try{o.bindModel(a).update(s)}catch(e){}}),!f[o]&&typeof(d==null?void 0:d[o])==`function`&&(f[o]=d[o]);let p=Object.keys(d==null?{}:d);function m(e){let t=e.__wevu;if(t)return t;let n=e.$state;if(n&&typeof n==`object`)return n[c]}function h(e,t){if((e==null?void 0:e.proxy)===t)return;let n=e==null?void 0:e.proxy,r=e=>{let r=t[e];if(typeof r!=`function`)return!1;let i=n==null?void 0:n[e];return typeof i==`function`&&r===i};if(r(`triggerEvent`)||r(`createSelectorQuery`)||r(`createIntersectionObserver`)||r(`setData`)||!(typeof t.triggerEvent==`function`||typeof t.createSelectorQuery==`function`||typeof t.createIntersectionObserver==`function`||typeof t.setData==`function`))return;let i=e==null?void 0:e.state;if(!(!i||typeof i!=`object`)&&t.$state!==i)try{Object.defineProperty(i,a,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(e){i[a]=t}}for(let e of p){if(e===r||e.startsWith(s))continue;let t=f[e];f[e]=function(...n){var r;let i=m(this);h(i,this);let a,o=i==null||(r=i.methods)==null?void 0:r[e];if(o&&(a=o.apply(i.proxy,n)),typeof t==`function`){let e=t.apply(this,n);return e===void 0?a:e}return a}}return{finalMethods:f}}export{l as createComponentMethods};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hasOwn as e}from"../../../utils.mjs";import{WEVU_COMPONENT_NAME_KEY as t,WEVU_PROPS_ALIASES_KEY as n,WEVU_PROPS_DERIVED_KEYS_KEY as r}from"@weapp-core/constants";function i(e,t=new WeakMap){if(!e||typeof e!=`object`)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let n=[];t.set(e,n);for(let r of e)n.push(i(r,t));return n}let n={};t.set(e,n);for(let[r,a]of Object.entries(e))n[r]=i(a,t);return n}function a(e){let t=e.route;if(typeof t==`string`&&t)return t;let n=e.is;return typeof n==`string`&&n?n:`unknown`}function o(a){var o;let{methods:s={},lifetimes:c={},pageLifetimes:l={},options:u={},...d}=a,f=d.onLoad,p=d.onUnload,m=d.onShow,h=d.onHide,g=d.onReady,_=d.onSaveExitState,v=d.onPullDownRefresh,y=d.onReachBottom,b=d.onPageScroll,x=d.onRouteDone,S=d.onTabItemTap,C=d.onResize,w=d.onShareAppMessage,T=d.onShareTimeline,E=d.onAddToFavorites,D=(o=d.features)==null?{}:o,O=[f,p,m,h,g,_,v,y,b,x,S,C,w,T,E].some(e=>typeof e==`function`),k=e(d,`__wevu_isPage`)?d.__wevu_isPage===!0:Object.keys(D==null?{}:D).length>0||O,A={...d},j=new Set([`data`,`behaviors`,`relations`,`externalClasses`,`options`,`properties`,`observers`,`pureDataPattern`,`virtualHost`,`definitionFilter`,`export`,`__wevuTemplateRefs`,`__wevuLayoutHosts`,n,r,`setupLifecycle`,`features`,`__wevu_isPage`]),M=[];for(let[e,t]of Object.entries(A))j.has(e)||typeof t!=`function`&&(M.push([e,t]),delete A[e]);let N=n=>{let r=a.name;typeof r==`string`&&r&&Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value:r});for(let[t,r]of M)if(!e(n,t))try{n[t]=i(r)}catch(e){}},P=new Set(`data.export.definitionFilter.onLoad.onUnload.onShow.onHide.onReady.onSaveExitState.onPullDownRefresh.onReachBottom.onPageScroll.onRouteDone.onTabItemTap.onResize.onShareAppMessage.onShareTimeline.onAddToFavorites.beforeCreate.created.beforeMount.mounted.beforeUnmount.beforeDestroy.unmounted.destroyed`.split(`.`)),F={};for(let[e,t]of Object.entries(A))typeof t!=`function`||P.has(e)||(F[e]=t,delete A[e]);let I=A.__wevuTemplateRefs;delete A.__wevuTemplateRefs;let L=A.__wevuLayoutHosts;delete A.__wevuLayoutHosts;let R=A[n];delete A[n];let z=A[r];delete A[r];let B=A.observers,V=A.setupLifecycle===`created`?`created`:`attached`;delete A.setupLifecycle;let H=Object.fromEntries([`beforeCreate`,`created`,`beforeMount`,`mounted`,`beforeUnmount`,`beforeDestroy`,`unmounted`,`destroyed`].map(e=>[e,A[e]]));delete A.features;for(let e of Object.keys(H))delete A[e];return delete A.onLoad,delete A.onUnload,delete A.onShow,delete A.onHide,delete A.onReady,{userMethods:s,userLifetimes:c,userPageLifetimes:l,userOptions:u,restOptions:A,topLevelMethods:F,templateRefs:I,layoutHosts:L,propsAliases:R,propsDerivedKeys:z,userObservers:B,setupLifecycle:V,vueLifecycles:H,isPage:k,features:D,userOnLoad:f,userOnUnload:p,userOnShow:m,userOnHide:h,userOnReady:g,userOnSaveExitState:_,userOnPullDownRefresh:v,userOnReachBottom:y,userOnPageScroll:b,userOnRouteDone:x,userOnTabItemTap:S,userOnResize:C,userOnShareAppMessage:w,userOnShareTimeline:T,userOnAddToFavorites:E,applyExtraInstanceFields:N}}export{a as getRuntimeOwnerLabel,o as prepareComponentOptions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hasOwn as e}from"../../../utils.mjs";import{isDeepEqualValue as t}from"../../app/setData/snapshot.mjs";import{refreshOwnerSnapshotFromInstance as n}from"../snapshot.mjs";import{WEVU_ATTRS_KEY as r,WEVU_PENDING_PROP_VALUES_KEY as i,WEVU_PROPS_DERIVED_KEYS_KEY as a,WEVU_PROPS_KEY as o,WEVU_PROP_KEYS_KEY as s,WEVU_SLOT_NAMES_PROP as c,WEVU_SLOT_OWNER_ID_PROP as l,WEVU_SLOT_SCOPE_KEY as u}from"@weapp-core/constants";function d(d){let{restOptions:f,propsAliases:p,propsDerivedKeys:m,userObservers:h}=d,g=f.properties&&typeof f.properties==`object`?Object.keys(f.properties):[],_=new Set(g),v=new Set(m==null?[]:m),y=Object.entries(p==null?{}:p).filter(([e,t])=>e&&t),b=new Set([c,l,u]),x=g.filter(e=>!b.has(e)),S=new WeakMap,C=e=>e.startsWith(`__wv_`),w=e=>{let t=e.__wevu,n=t==null?void 0:t[a];if(n instanceof Set)for(let e of x)n.add(e)},T=(t,n,r)=>e(t,n)&&Object.is(t[n],r)?!1:(t[n]=r,!0),E=(n,r,i)=>b.has(r)&&e(n,r)&&t(n[r],i,20,{keys:1e4})?!1:T(n,r,i),D=(e,t,n)=>{var r;if(!b.has(t))return;let i=!1,a=(r=e.__wevu)==null?void 0:r.state;try{a&&typeof a==`object`&&E(a,t,n);let r=e.data;r&&typeof r==`object`&&(i=E(r,t,n))}catch(e){}if(!(!i||typeof e.setData!=`function`))try{e.setData({[t]:n})}catch(e){}},O=(t,n)=>{var r;if(!y.length)return;let i=t.__wevu,a=i==null?void 0:i.setupState,o=i==null?void 0:i.state;if(!a||typeof a!=`object`)return;w(t);let s=(r=S.get(t))==null?new Set:r;S.set(t,s);for(let[t,r]of y){if(e(a,t)&&!s.has(t))continue;let i=n[r];try{T(a,t,i),s.add(t)}catch(e){}if(o&&typeof o==`object`&&(!e(o,t)||s.has(t)))try{T(o,t,i)}catch(e){}}},k=(t,n)=>{if(!v.size)return;let r=t.__wevu,i=r==null?void 0:r.setupState;if(!i||typeof i!=`object`)return;w(t);let a=new Map(y);for(let t of v){var o;let r=(o=a.get(t))==null?t:o;if(e(n,r))try{T(i,t,n[r])}catch(e){}}},A=e=>{try{Object.defineProperty(e,s,{value:g,configurable:!0,enumerable:!1,writable:!1})}catch(t){e[s]=g}},j=t=>{let i=t[r];if(!i||typeof i!=`object`)return;let a=n=>{var r;let i=(r=t.__wevu)==null?void 0:r.state;return typeof i==`object`&&!!i&&e(i,n)},o=t.properties,s=o&&typeof o==`object`?o:void 0,c=Object.keys(i);for(let t of c)if(!s||!e(s,t)||C(t)||_.has(t)||a(t))try{delete i[t]}catch(e){}if(!s){n(t);return}for(let[e,t]of Object.entries(s))if(!(C(e)||_.has(e)||a(e)))try{i[e]=t}catch(e){}n(t)},M=t=>{let r=t[o],a=t.properties,s=t[i];if(r&&typeof r==`object`&&a&&typeof a==`object`){let i=a,o=Object.keys(r);for(let t of o)if(!_.has(t)||!e(i,t))try{delete r[t]}catch(e){}for(let n of g){let a=s&&e(s,n);if(!a&&!e(i,n))continue;let o=a?s[n]:i[n];try{E(r,n,o)}catch(e){}D(t,n,o)}k(t,r),O(t,r),n(t)}s&&delete t[i],j(t)},N=(t,r)=>{if(!r||typeof r!=`object`)return;let i=t[o];if(!i||typeof i!=`object`)return;let a=!1;for(let n of g)if(e(r,n)){try{a=E(i,n,r[n])||a}catch(e){}D(t,n,r[n])}a&&(k(t,i),O(t,i),n(t),j(t))},P=(e,t,r)=>{var a,s;let c=e[o];if(!c||typeof c!=`object`)return;try{if(!E(c,t,r)){D(e,t,r);return}}catch(e){}D(e,t,r);let l=(s=(a=e)[i])==null?a[i]=Object.create(null):s;l[t]=r,k(e,c),O(e,c),n(e),j(e)},F={};if(g.length)for(let e of g)F[e]=function(t){P(this,e,t)};let I={...h==null?{}:h};for(let[e,t]of Object.entries(F)){let n=I[e];typeof n==`function`?I[e]=function(...e){n.apply(this,e),t.apply(this,e)}:I[e]=t}let L=I[`**`];return I[`**`]=function(...e){typeof L==`function`&&L.apply(this,e),M(this)},{attachWevuPropKeys:A,directPropsDerivedKeys:x,syncWevuPropsFromInstance:M,syncWevuPropsFromValues:N,finalObservers:I}}export{d as createPropsSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{callHookList as e}from"../../hooks/base.mjs";import{resolveRuntimePageLayoutName as t,syncRuntimePageLayoutState as n}from"../../pageLayout.mjs";import{getOwnerProxy as r}from"../../scopedSlots.mjs";import{clearTemplateRefs as i,scheduleTemplateRefUpdate as a}from"../../templateRefs.mjs";import{enableDeferredSetData as o,mountRuntimeInstance as s,refreshRuntimeInstance as ee,setRuntimeSetDataVisibility as c,teardownRuntimeInstance as l}from"../runtimeInstance.mjs";import{registerRuntimeLayoutHosts as u,unregisterRuntimeLayoutHosts as d}from"../../layoutBridge.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as f,WEVU_LAYOUT_HOST_BRIDGE_KEY as p,WEVU_PAGE_LAYOUT_NAME_KEY as m,WEVU_PAGE_LAYOUT_PROPS_KEY as h,WEVU_PAGE_LAYOUT_SETTER_KEY as g,WEVU_PUBLIC_RUNTIME_KEY as te,WEVU_READY_CALLED_KEY as _,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as ne,WEVU_RUNTIME_KEY as v,WEVU_RUNTIME_OWNER_ID_KEY as re,WEVU_SLOT_OWNER_ID_KEY as y,WEVU_TEMPLATE_REFS_KEY as b}from"@weapp-core/constants";function x(e){let t=e.selectOwnerComponent;if(typeof t==`function`)try{let n=t.call(e);n&&n!==e&&a(n)}catch(e){}}function S(S){let{runtimeApp:C,watch:w,setup:T,restOptions:E,pageLifecycleHooks:D,finalObservers:O,userLifetimes:k,userPageLifetimes:A,finalMethods:j,finalOptions:M,applyExtraInstanceFields:N,templateRefs:P,layoutHosts:F,attachWevuPropKeys:I,setupLifecycle:L,syncWevuPropsFromInstance:R,directPropsDerivedKeys:z,isPage:B,vueLifecycles:V,getRuntimeOwnerLabel:H}=S,U=e=>{var t;let n=(t=e.__wevu)==null?e[te]:t;if(n)return n;let r=e.$state;if(r&&typeof r==`object`)return r[v]},W=e=>{var t,n,r,i,a;return(t=(n=(r=e[re])==null?e[y]:r)==null?(i=e.data)==null?void 0:i[y]:n)==null?(a=e.properties)==null?void 0:a[y]:t},G=e=>{var t;let n=(t=U(e))==null?void 0:t.proxy;if(n)return n;let i=W(e);if(typeof i==`string`&&i){var a;return(a=r(i))==null?e:a}return e},K=e=>{let t=U(e);return t?{runtime:t,mounted:!1}:(N(e),I(e),s(e,C,w,T,{deferSetData:!0,snapshotOmitKeys:z}),R(e),o(e),{runtime:U(e),mounted:!0})},q=(e,t,n)=>{let r=V[t];if(typeof r==`function`)return r.apply(G(e),n)},J=e=>{U(e)||typeof V.mounted!=`function`||K(e).mounted&&(q(e,`created`,[]),q(e,`beforeMount`,[]))},Y={},X=e=>{if(!Array.isArray(F)||!F.length||e[p])return;let t=u(F,e);t&&(e[p]=t)},Z=e=>{B&&(e[g]=(r,i)=>{var a;let o=(a=e.__wevu)==null?void 0:a.state;if(!o||typeof o!=`object`)return;o[m]=t(r);let s=r===!1||i==null?{}:i;o[h]=s,n(e,r,s)})};if(B)for(let e of[`onPullDownRefresh`,`onReachBottom`,`onShareAppMessage`,`onShareTimeline`,`onAddToFavorites`]){let t=D[e];typeof t==`function`&&typeof j[e]!=`function`&&(Y[e]=function(...e){return t.apply(this,e)})}let Q={...E,...B?D:{},observers:O,lifetimes:{...k,created:function(...e){if(q(this,`beforeCreate`,e),N(this),Array.isArray(P)&&P.length&&Object.defineProperty(this,b,{value:P,configurable:!0,enumerable:!1,writable:!1}),I(this),L===`created`){try{s(this,C,w,T,{deferSetData:!0,snapshotOmitKeys:z})}catch(e){let t=H(this);throw Error(`[wevu] mount runtime failed in created (${t}): ${e instanceof Error?e.message:String(e)}`)}R(this),Z(this)}typeof k.created==`function`&&k.created.apply(this,e)},moved:function(...t){e(this,`onMoved`,t),typeof k.moved==`function`&&k.moved.apply(this,t)},attached:function(...t){if(N(this),Array.isArray(P)&&P.length&&!this[b]&&Object.defineProperty(this,b,{value:P,configurable:!0,enumerable:!1,writable:!1}),I(this),L!==`created`||!this.__wevu)try{s(this,C,w,T,{deferSetData:!0,snapshotOmitKeys:z})}catch(e){let t=H(this);throw Error(`[wevu] mount runtime failed in attached (${t}): ${e instanceof Error?e.message:String(e)}`)}R(this),q(this,`created`,t),q(this,`beforeMount`,t),Z(this),X(this),o(this),e(this,`onAttached`,t),typeof k.attached==`function`&&k.attached.apply(this,t)},ready:function(...t){if(J(this),B&&typeof D.onReady==`function`){let e=!!this[_];D.onReady.call(this,...t),e||q(this,`mounted`,t),typeof k.ready==`function`&&k.ready.apply(this,t);return}if(!this[_]){this[_]=!0,R(this),x(this),a(this,()=>{e(this,`onReady`,t),q(this,`mounted`,t),typeof k.ready==`function`&&k.ready.apply(this,t)});return}typeof k.ready==`function`&&k.ready.apply(this,t)},detached:function(...t){if(q(this,`beforeUnmount`,t),q(this,`beforeDestroy`,t),x(this),e(this,`onDetached`,t),B&&typeof D.onUnload==`function`){D.onUnload.call(this,...t),typeof k.detached==`function`&&k.detached.apply(this,t),q(this,`unmounted`,t),q(this,`destroyed`,t);return}i(this),Array.isArray(F)&&F.length&&this[p]&&(d(F,this[p]),delete this[p]),l(this),q(this,`unmounted`,t),q(this,`destroyed`,t),typeof k.detached==`function`&&k.detached.apply(this,t)},error:function(...t){e(this,`onError`,t),typeof k.error==`function`&&k.error.apply(this,t)}},pageLifetimes:{...A,show:function(...t){if(B&&typeof D.onShow==`function`){D.onShow.call(this,...t),typeof A.show==`function`&&A.show.apply(this,t);return}c(this,!0),e(this,`onShow`,t),typeof A.show==`function`&&A.show.apply(this,t)},hide:function(...t){if(B&&typeof D.onHide==`function`){D.onHide.call(this,...t),typeof A.hide==`function`&&A.hide.apply(this,t);return}c(this,!1),e(this,`onHide`,t),typeof A.hide==`function`&&A.hide.apply(this,t)},resize:function(...t){if(B&&typeof D.onResize==`function`){D.onResize.call(this,...t),typeof A.resize==`function`&&A.resize.apply(this,t);return}e(this,`onResize`,t),typeof A.resize==`function`&&A.resize.apply(this,t)},routeDone:function(...t){if(B&&typeof D.onRouteDone==`function`){D.onRouteDone.call(this,...t),typeof A.routeDone==`function`&&A.routeDone.apply(this,t);return}e(this,`onRouteDone`,t),typeof A.routeDone==`function`&&A.routeDone.apply(this,t)}},methods:{...Y,...j,[ne]:function(){var e;let t=K(this);return t.mounted&&(q(this,`created`,[]),q(this,`beforeMount`,[])),(e=t.runtime)==null?void 0:e.proxy}},options:M},$=globalThis[f];if(typeof($==null?void 0:$.trackWevuComponent)==`function`){let e=$.trackWevuComponent(Q,(e,t)=>{ee(e,C,w,T,{snapshotOmitKeys:z,stateSnapshot:t}),R(e),Z(e),X(e),o(e,{rehydrateSetupState:!0})});$.isApplying()||Component(e)}else Component(Q)}export{S as registerComponentDefinition};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MiniProgramComponentRawOptions } from "../types/miniprogram.mjs";
|
|
2
|
+
import { ComponentPropsOptions } from "../types/props/propTypes.mjs";
|
|
3
|
+
import { ComputedDefinitions, MethodDefinitions } from "../types/core.mjs";
|
|
4
|
+
import { RuntimeApp } from "../types/runtime.mjs";
|
|
5
|
+
import { DefineComponentOptions } from "../types/options.mjs";
|
|
6
|
+
import "../types.mjs";
|
|
7
|
+
import { WatchMap } from "./watch.mjs";
|
|
8
|
+
//#region src/runtime/register/component.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* 注册组件入口(框架内部使用)。
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
declare function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'], mpOptions: MiniProgramComponentRawOptions): void;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { registerComponent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveComponentFeatures as e}from"./component/features.mjs";import{createPageLifecycleHooks as t}from"./component/lifecycle.mjs";import{createComponentMethods as n}from"./component/methods.mjs";import{getRuntimeOwnerLabel as r,prepareComponentOptions as i}from"./component/options.mjs";import{createPropsSync as a}from"./component/props.mjs";import{registerComponentDefinition as ee}from"./component/registerDefinition.mjs";import{WEVU_EXPOSED_KEY as o,WEVU_HOOKS_KEY as s}from"@weapp-core/constants";function c(c,l,u,d,f){var p;let{userMethods:m,userLifetimes:h,userPageLifetimes:g,userOptions:_,restOptions:v,topLevelMethods:y,templateRefs:b,layoutHosts:x,propsAliases:S,propsDerivedKeys:C,userObservers:w,setupLifecycle:T,vueLifecycles:E,isPage:D,features:O,userOnLoad:k,userOnUnload:A,userOnShow:j,userOnHide:M,userOnReady:N,userOnSaveExitState:P,userOnPullDownRefresh:F,userOnReachBottom:I,userOnPageScroll:L,userOnRouteDone:R,userOnTabItemTap:z,userOnResize:te,userOnShareAppMessage:B,userOnShareTimeline:V,userOnAddToFavorites:H,applyExtraInstanceFields:U}=i(f),{enableOnPullDownRefresh:W,enableOnReachBottom:G,enableOnPageScroll:K,enableOnRouteDone:q,enableOnRouteDoneFallback:J,enableOnTabItemTap:Y,enableOnResize:X,enableOnShareAppMessage:Z,enableOnShareTimeline:Q,enableOnAddToFavorites:ne,enableOnSaveExitState:re,effectiveOnSaveExitState:ie,effectiveOnPullDownRefresh:ae,effectiveOnReachBottom:oe,effectiveOnPageScroll:se,effectiveOnRouteDone:ce,effectiveOnTabItemTap:le,effectiveOnResize:ue,effectiveOnShareAppMessage:de,effectiveOnShareTimeline:fe,effectiveOnAddToFavorites:pe}=e({features:O,userOnSaveExitState:P,userOnPullDownRefresh:F,userOnReachBottom:I,userOnPageScroll:L,userOnRouteDone:R,userOnTabItemTap:z,userOnResize:te,userOnShareAppMessage:B,userOnShareTimeline:V,userOnAddToFavorites:H}),me=(e,t)=>{let n=e[s];if(!n)return!1;let r=n[t];return r?Array.isArray(r)?r.length>0:typeof r==`function`:!1};{let e=v.export;v.export=function(){var t;let n=(t=this[o])==null?{}:t,r=typeof e==`function`?e.call(this):{};return r&&typeof r==`object`&&!Array.isArray(r)?{...n,...r}:r==null?n:r}}let he={multipleSlots:(p=_.multipleSlots)==null||p,..._},{attachWevuPropKeys:ge,directPropsDerivedKeys:_e,syncWevuPropsFromInstance:ve,syncWevuPropsFromValues:$,finalObservers:ye}=a({restOptions:v,propsAliases:S,propsDerivedKeys:C,userObservers:w}),{finalMethods:be}=n({userMethods:{...y,...m},runtimeMethods:l});ee({runtimeApp:c,watch:u,setup:d,restOptions:v,pageLifecycleHooks:t({runtimeApp:c,watch:u,setup:d,userOnLoad:k,userOnUnload:A,userOnShow:j,userOnHide:M,userOnReady:N,isPage:D,enableOnSaveExitState:re,enableOnPullDownRefresh:W,enableOnReachBottom:G,enableOnPageScroll:K,enableOnRouteDone:q,enableOnRouteDoneFallback:J,enableOnTabItemTap:Y,enableOnResize:X,enableOnShareAppMessage:Z,enableOnShareTimeline:Q,enableOnAddToFavorites:ne,syncWevuPropsFromValues:$,effectiveOnSaveExitState:ie,effectiveOnPullDownRefresh:ae,effectiveOnReachBottom:oe,effectiveOnPageScroll:se,effectiveOnRouteDone:ce,effectiveOnTabItemTap:le,effectiveOnResize:ue,effectiveOnShareAppMessage:de,effectiveOnShareTimeline:fe,effectiveOnAddToFavorites:pe,hasHook:me}),finalObservers:ye,userLifetimes:h,userPageLifetimes:g,finalMethods:be,finalOptions:he,applyExtraInstanceFields:U,templateRefs:b,layoutHosts:x,attachWevuPropKeys:ge,setupLifecycle:T,syncWevuPropsFromInstance:ve,syncWevuPropsFromValues:$,directPropsDerivedKeys:_e,isPage:D,vueLifecycles:E,getRuntimeOwnerLabel:r})}export{c as registerComponent};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/runtime/register/inline.d.ts
|
|
2
|
+
interface InlineExpressionEntry {
|
|
3
|
+
keys: string[];
|
|
4
|
+
indexKeys?: string[];
|
|
5
|
+
scopeResolvers?: Array<InlineExpressionScopeResolver | ((ctx: any, scope: Record<string, any>, event: any) => any) | undefined>;
|
|
6
|
+
fn: (ctx: any, scope: Record<string, any>, event: any) => any;
|
|
7
|
+
}
|
|
8
|
+
interface InlineExpressionScopeResolver {
|
|
9
|
+
type: 'for-item';
|
|
10
|
+
path: string;
|
|
11
|
+
indexKey: string;
|
|
12
|
+
}
|
|
13
|
+
type InlineExpressionMap = Record<string, InlineExpressionEntry>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { InlineExpressionEntry, InlineExpressionMap };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isReactive as e,reactive as t}from"../../reactivity/reactive.mjs";import{isRef as n}from"../../reactivity/ref.mjs";const r=/&/g,i=/"/g,a=/"/g,o=/'/g,s=/'/g,c=/</g,l=/>/g;function u(e){return e.replace(r,`&`).replace(i,`"`).replace(a,`"`).replace(o,`'`).replace(s,`'`).replace(c,`<`).replace(l,`>`)}function d(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim()){let t=Number(e);if(Number.isFinite(t))return t}}const f=/[^a-z0-9]+/gi,p=/^-+|-+$/g;function m(e){return e.trim().replace(f,`-`).replace(p,``).toLowerCase()}const h=/-([a-z0-9])/g;function g(e,t){let n=m(typeof(t==null?void 0:t.type)==`string`?t.type:``);if(!n)return;let r=n.replace(h,(e,t)=>t.toUpperCase());if(r)return`${e}${r[0].toUpperCase()}${r.slice(1)}`}const _={wvEventDetail:[`wd`,`wvEventDetail`],wvHandler:[`wh`,`wvHandler`],wvInlineId:[`wi`,`wvInlineId`]};function v(e,t,n){var r;let i=(r=_[t])==null?[t]:r;for(let t of i){let r=g(t,n);if(r&&(e==null?void 0:e[r])!==void 0)return e[r]}for(let t of i)if((e==null?void 0:e[t])!==void 0)return e[t]}function y(e,t,n){return v(e,t,n)}function b(e,t){let n=y(e,`wvEventDetail`,t);return n===!0||n===1||n===`1`||n===`true`}function x(e,t){if(!b(t,e))return e;if(!(!e||typeof e!=`object`||!(`detail`in e)))return e.detail}function S(e,t){if(!t)return;let r=t.split(`.`).filter(Boolean),i=n(e)?e.value:e;for(let e of r){if(n(i)&&(i=i.value),i==null)return;i=i[e]}return n(i)?i.value:i}function C(r){if(typeof r!=`object`||!r||n(r)||e(r))return r;try{return t(r)}catch(e){return r}}function w(e,t,n,r){var i,a,o,s;let c=(i=(a=n==null||(o=n.currentTarget)==null?void 0:o.dataset)==null?n==null||(s=n.target)==null?void 0:s.dataset:a)==null?{}:i,l=x(n,c),f=y(c,`wvInlineId`,n);if(f&&r){let t=r[f];if(t&&typeof t.fn==`function`){let n={},r=Array.isArray(t.keys)?t.keys:[];for(let e=0;e<r.length;e+=1){let t=r[e];n[t]=c==null?void 0:c[`wvS${e}`]}let i=Array.isArray(t.indexKeys)?t.indexKeys:[];for(let e=0;e<i.length;e+=1){let t=i[e],r=d(c==null?void 0:c[`wvI${e}`]);r!==void 0&&(n[t]=r)}let a=Array.isArray(t.scopeResolvers)?t.scopeResolvers:[];for(let t=0;t<r.length;t+=1){let i=r[t],o=a[t];try{let t;if(typeof o==`function`)t=o(e,n,l);else if(o&&typeof o==`object`&&o.type===`for-item`){let r=n[o.indexKey],i=S(e,o.path);t=i==null?void 0:i[r]}else continue;t!==void 0&&(n[i]=C(t))}catch(e){}}let o=t.fn(e,n,l);return typeof o==`function`?o.call(e,l):o}}let p=y(c,`wvHandler`,n),m=typeof t==`string`&&t?t:typeof p==`string`?p:void 0;if(!m)return;let h=y(c,`wvArgs`,n),g=[];if(Array.isArray(h))g=h;else if(typeof h==`string`)try{g=JSON.parse(h)}catch(e){try{g=JSON.parse(u(h))}catch(e){g=[]}}Array.isArray(g)||(g=[]);let _=g.map(e=>e===`$event`?l:e),v=e==null?void 0:e[m];if(typeof v==`function`)return v.apply(e,_)}export{u as decodeWxmlEntities,y as resolveDatasetEventValue,w as runInlineExpression};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isNativeBridgeMethod as e}from"../../nativeBridge.mjs";import{setupInstanceMethodNames as t}from"./setupContext.mjs";import{WEVU_NATIVE_INSTANCE_KEY as n,WEVU_PUBLIC_RUNTIME_KEY as r}from"@weapp-core/constants";function i(e){return!e||typeof e!=`object`?!1:typeof e.triggerEvent==`function`||typeof e.createSelectorQuery==`function`||typeof e.createIntersectionObserver==`function`||typeof e.setData==`function`}function a(t,n,r){let i=n==null?void 0:n[r];if(typeof i!=`function`)return!1;if(e(i))return!0;let a=t==null?void 0:t.proxy;return typeof(a==null?void 0:a[r])==`function`&&i===a[r]}function o(e,t){if(!e||!i(t)||t===e.proxy)return;let r=t;if(a(e,r,`triggerEvent`)||a(e,r,`createSelectorQuery`)||a(e,r,`createIntersectionObserver`)||a(e,r,`setData`))return;let o=e.state;if(!(!o||typeof o!=`object`))try{Object.defineProperty(o,n,{value:r,configurable:!0,enumerable:!1,writable:!0})}catch(e){o[n]=r}}function s(e,n){try{let i=n.methods;for(let n of Object.keys(i))t.includes(n)||typeof e[n]!=`function`&&(e[n]=function(...t){var i,a;let s=(i=this[r])==null?e[r]:i;o(s,this);let c=s==null||(a=s.methods)==null?void 0:a[n];if(typeof c==`function`)return c.apply(s.proxy,t)})}catch(e){}}export{s as bridgeRuntimeMethodsToTarget};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getCurrentMiniProgramPages as e}from"../../platform.mjs";import{attachRuntimeLayoutProvideContext as t,attachRuntimeProvideContext as n}from"../../provideContext.mjs";import{isRuntimeLayoutComponentTarget as r}from"../../layoutComponentMatcher.mjs";import{WEVU_PARENT_INSTANCE_KEY as i,WEVU_RUNTIME_APP_KEY as a}from"@weapp-core/constants";function o(t){if(r(t))return;let n=t[i];if(n&&typeof n==`object`)return n;let a=t.selectOwnerComponent;if(typeof a==`function`)try{let e=a.call(t);if(e&&e!==t&&typeof e==`object`&&e.__wevu)return e}catch(e){}let o=e(),s=o[o.length-1];if(s&&s!==t&&typeof s==`object`&&s.__wevu)return s}function s(n){if(!r(n))return;let i=e(),a=i[i.length-1];a&&a!==n&&typeof a==`object`&&a.__wevu&&t(n,a)}function c(e,t){e[a]=t,n(e,t,o(e)),s(e)}export{c as attachRuntimeProvideParentContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{getCurrentMiniProgramRuntimeCapabilities as t,getMiniProgramGlobalObject as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../../platform.mjs";import{hasOwn as i}from"../../../utils.mjs";import{normalizeEmitPayload as a}from"../../emit.mjs";import{isNativeBridgeMethod as o,markNativeBridgeMethod as s}from"../../nativeBridge.mjs";import{markNoSetData as c}from"../../noSetData.mjs";import{WEVU_NATIVE_INSTANCE_KEY as l,WEVU_PROPS_KEY as u,WEVU_SETUP_CONTEXT_INSTANCE_KEY as d,WEVU_SLOT_NAMES_PROP as f}from"@weapp-core/constants";const p=[`triggerEvent`,`createSelectorQuery`,`createIntersectionObserver`,`setData`,`setUpdatePerformanceListener`];function m(){return Object.freeze(Object.create(null))}const h=()=>[];function g(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`&&e.length>0))]:!e||typeof e!=`object`?[]:Object.entries(e).filter(([,e])=>!!e).map(([e])=>e)}function _(e){if(!i(e,f))return m();let t=()=>g(e[f]),n=e=>typeof e==`string`&&t().includes(e);return new Proxy(Object.create(null),{get(e,t){if(n(t))return h},has(e,t){return n(t)},ownKeys(){return t()},getOwnPropertyDescriptor(e,t){if(n(t))return{configurable:!0,enumerable:!0,value:h}},set(){return!1},deleteProperty(){return!1}})}function v(e,t){let n=_(t);try{Object.defineProperty(e,"$slots",{value:n,configurable:!0,enumerable:!1,writable:!1})}catch(t){e.$slots=n}return n}function y(){let e=(()=>{});return e.stop=()=>{},e.pause=()=>{},e.resume=()=>{},e}function b(e){try{return c(e)}catch(t){return e}}function x(t,n,r){let i=t==null?void 0:t.state,a=i&&typeof i==`object`?e(i):void 0,s=t==null?void 0:t.proxy,c=e=>{let t=e[r];if(typeof t!=`function`)return!1;if(o(t))return!0;let i=n[r];return typeof i==`function`&&t===i},u=e=>!e||typeof e!=`object`||e===n||e===s||c(e)?!1:typeof e[r]==`function`,d=a?a[l]:void 0;if(u(d))return d;let f=t==null?void 0:t.instance;if(u(f))return f}function S(e,t,n){s(n);try{Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!1,writable:!0})}catch(r){e[t]=n}}function C(e,a){let s=e[d];if(s&&typeof s==`object`)return s;let c=Object.create(null),l=t=>{var n,r;let o=a==null?void 0:a.proxy;if(o&&Reflect.has(o,t))return{found:!0,value:Reflect.get(o,t)};let s=(n=a==null||(r=a.state)==null?void 0:r[u])==null?e[u]:n;return s&&typeof s==`object`&&i(s,t)?{found:!0,value:Reflect.get(s,t)}:{found:!1,value:void 0}},f=t=>{let n=x(a,e,t);if(n)return n;let r=e[t];if(typeof r==`function`&&!o(r))return e};S(c,`triggerEvent`,(...e)=>{let[t,n,r]=e,i=f(`triggerEvent`);i&&typeof i.triggerEvent==`function`&&(e.length>=3?i.triggerEvent(t,n,r):i.triggerEvent(t,n))}),S(c,`createSelectorQuery`,()=>{var i;let o=f(`createSelectorQuery`);if(o&&typeof o.createSelectorQuery==`function`)return o.createSelectorQuery();let s=n();if(!r(`globalCreateSelectorQuery`)||!s||typeof s.createSelectorQuery!=`function`)return;let c=s.createSelectorQuery();if(!c||!t().selectorQueryScopeByIn||typeof c.in!=`function`)return c;let l=(i=x(a,e,`setData`))==null?e:i;return c.in(l)}),S(c,`createIntersectionObserver`,i=>{var o;let s=f(`createIntersectionObserver`);if(s&&typeof s.createIntersectionObserver==`function`)return s.createIntersectionObserver(i==null?{}:i);let c=n();if(!r(`globalCreateIntersectionObserver`)||!c||typeof c.createIntersectionObserver!=`function`)return;let l=(o=x(a,e,`setData`))==null?e:o;return t().intersectionObserverScopeByParameter?c.createIntersectionObserver(l,i==null?{}:i):c.createIntersectionObserver(i==null?{}:i)}),S(c,`setData`,(e,t)=>{let n=f(`setData`);if(n&&typeof n.setData==`function`)return n.setData(e,t);let r=a==null?void 0:a.adapter,i=typeof(r==null?void 0:r.setData)==`function`?r.setData(e):void 0;return typeof t==`function`&&t(),i}),S(c,`setUpdatePerformanceListener`,e=>{let t=f(`setUpdatePerformanceListener`);if(t&&typeof t.setUpdatePerformanceListener==`function`)return t.setUpdatePerformanceListener(e)});let p=b(new Proxy(c,{get(t,n,r){if(Reflect.has(t,n))return Reflect.get(t,n,r);if(n===`$el`){var i;return(i=x(a,e,`setData`))==null?e:i}if(n===`renderRoot`||n===`shadowRoot`){var o;return((o=x(a,e,`setData`))==null?e:o)[n]}let s=l(n);if(s.found)return s.value;let c=e[n];return typeof c==`function`?c.bind(e):c},has(t,n){return Reflect.has(t,n)||l(n).found||n in e},set(t,n,r){return Reflect.has(t,n)?(t[n]=r,!0):(e[n]=r,!0)}}));try{Object.defineProperty(e,d,{value:p,configurable:!0,enumerable:!1,writable:!0})}catch(t){e[d]=p}return p}export{v as attachRuntimeSlots,y as createNoopWatchStopHandle,m as createSetupSlotsFallback,_ as createSetupSlotsProxy,C as ensureSetupContextInstance,a as normalizeEmitPayload,b as safeMarkNoSetData,p as setupInstanceMethodNames};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{effectScope as e}from"../../../reactivity/core.mjs";import{toRaw as t}from"../../../reactivity/reactive/shared.mjs";import{shallowReactive as n}from"../../../reactivity/reactive/shallow.mjs";import{isReactive as r}from"../../../reactivity/reactive.mjs";import{setCurrentInstance as i,setCurrentSetupContext as a}from"../../hooks/base.mjs";import{hasOwn as o}from"../../../utils.mjs";import{hasTrackableSetupBinding as s}from"../../setupTracking.mjs";import{normalizeEmitEventName as c,normalizeEmitPayload as l}from"../../emit.mjs";import{attachRuntimeSlots as u,ensureSetupContextInstance as d,safeMarkNoSetData as f}from"./setupContext.mjs";import{runSetupFunction as p}from"../setup.mjs";import{attachRuntimeSetupState as m,ensureRuntimeProps as h}from"./utils.mjs";import{WEVU_ATTRS_KEY as g,WEVU_EFFECT_SCOPE_KEY as _,WEVU_EXPOSED_KEY as v,WEVU_PROP_KEYS_KEY as y}from"@weapp-core/constants";let b=0;function x(e,t){let n=e,r={proxy:{configurable:!0,enumerable:!1,value:t,writable:!1},$:{configurable:!0,enumerable:!1,value:e,writable:!1},uid:{configurable:!0,enumerable:!1,value:++b,writable:!1},exposed:{configurable:!0,enumerable:!1,get:()=>e[v]}};for(let[e,t]of Object.entries(r))try{Object.defineProperty(n,e,t)}catch(r){`value`in t&&(n[e]=t.value)}let i={$:{configurable:!0,enumerable:!1,value:e,writable:!1},$el:{configurable:!0,enumerable:!1,value:e,writable:!1}};for(let[e,n]of Object.entries(i))try{Object.defineProperty(t,e,n)}catch(r){t[e]=n.value}}function S(e){return e.startsWith(`__wv_`)}function C(b){var C;let{target:w,runtime:T,runtimeWithDefaults:E,runtimeState:D,runtimeProxy:O,setup:k}=b,A=h(w,D,w.properties||{}),j=n(Object.create(null)),M=new Set(Array.isArray(w[y])?w[y]:[]),N=e=>typeof D==`object`&&!!D&&o(D,e);(()=>{let e=w.properties&&typeof w.properties==`object`?w.properties:void 0;for(let t of Object.keys(j))(!e||!o(e,t)||S(t)||M.has(t)||N(t))&&delete j[t];if(e)for(let[t,n]of Object.entries(e))S(t)||M.has(t)||N(t)||(j[t]=n)})();try{Object.defineProperty(w,g,{value:j,configurable:!0,enumerable:!1,writable:!1})}catch(e){w[g]=j}let P=d(w,E);x(w,P);let F=u(D,A);m(D,(C=E.setupState)==null?Object.create(null):C);let I=f({props:A,runtime:E,state:D,proxy:O,bindModel:T.bindModel.bind(E),watch:T.watch.bind(E),instance:P,emit:(e,...t)=>{let{detail:n,options:r}=l(t),i=c(e);P.triggerEvent(i,n,r)},expose:e=>{w[v]=e},attrs:j,slots:F}),L=e(!0);w[_]=L,i(w),a(I);try{let e=L.run(()=>p(k,A,I)),n=!1;if(e&&typeof e==`object`){let i=T.setupState&&typeof T.setupState==`object`?r(T.setupState)?t(T.setupState):T.setupState:Object.create(null);Object.keys(e).forEach(t=>{let r=e[t];if(typeof r==`function`)T.methods[t]=(...e)=>r.apply(T.proxy,e),T.state[t]=(...e)=>r.apply(T.proxy,e),n=!0;else{if(s(r)){var a;(a=T.__wevu_trackSetupReactiveKey)==null||a.call(T,t)}T.state[t]=r,i[t]=r}})}if(n){var R;(R=T.__wevu_touchSetupMethodsVersion)==null||R.call(T)}}catch(e){throw L.stop(),w[_]=void 0,e}finally{a(void 0),i(void 0)}}export{C as runRuntimeSetupPhase};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{shallowReactive as e}from"../../../reactivity/reactive/shallow.mjs";import{hasOwn as t}from"../../../utils.mjs";import{isNativeBridgeMethod as n}from"../../nativeBridge.mjs";import{WEVU_NATIVE_INSTANCE_KEY as r,WEVU_PROPS_KEY as i,WEVU_PROP_KEYS_KEY as a,WEVU_RUNTIME_KEY as o,WEVU_SETUP_CONTEXT_INSTANCE_KEY as s,WEVU_SETUP_STATE_KEY as c}from"@weapp-core/constants";function l(e,t){try{Object.defineProperty(e,i,{value:t,configurable:!0,enumerable:!1,writable:!1})}catch(n){e[i]=t}}function u(e,t){try{Object.defineProperty(e,c,{value:t,configurable:!0,enumerable:!1,writable:!1})}catch(n){e[c]=t}}function d(e,t){try{Object.defineProperty(e,r,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(n){e[r]=t}}function f(e,t){try{Object.defineProperty(e,o,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(n){e[o]=t}}function p(e,t){try{Object.defineProperty(e,"instance",{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(n){try{e.instance=t}catch(e){}}}function m(e){let t=e[s],r=t&&typeof t.setData==`function`?t.setData:void 0;if(typeof r==`function`&&!n(r))return r;let i=e.setData;if(typeof i==`function`&&!n(i))return i}function h(e){let t=e.route;if(typeof t==`string`&&t)return t;let n=e.is;return typeof n==`string`&&n?n:`unknown`}function g(e,t,n,r){try{return r?t.call(e,n,r):t.call(e,n)}catch(t){let n=h(e);throw Error(`[wevu] setData failed (${n}): ${t instanceof Error?t.message:String(t)}`)}}function _(e,n,r){let i=r?new Set(r):void 0,a=Object.keys(e);for(let r of a)if(!t(n,r)||i&&!i.has(r))try{delete e[r]}catch(e){}let o=r==null?Object.keys(n):r;for(let r of o)t(n,r)&&(e[r]=n[r])}function v(t,n,r=t.properties||{}){let o=n&&typeof n==`object`?n[i]:void 0,s=o&&typeof o==`object`?o:e({});_(s,r,Array.isArray(t[a])?t[a]:void 0),n&&typeof n==`object`&&l(n,s);try{Object.defineProperty(t,i,{value:s,configurable:!0,enumerable:!1,writable:!0})}catch(e){t[i]=s}return s}export{d as attachNativeInstanceRef,p as attachRuntimeInstance,l as attachRuntimeProxyProps,f as attachRuntimeRef,u as attachRuntimeSetupState,g as callNativeSetData,v as ensureRuntimeProps,m as resolveNativeSetData,_ as syncRuntimeProps};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentPropsOptions } from "../types/props/propTypes.mjs";
|
|
2
|
+
import { ComputedDefinitions, MethodDefinitions } from "../types/core.mjs";
|
|
3
|
+
import { InternalRuntimeState, RuntimeApp, RuntimeInstance } from "../types/runtime.mjs";
|
|
4
|
+
import { DefineAppOptions, DefineComponentOptions } from "../types/options.mjs";
|
|
5
|
+
import "../types.mjs";
|
|
6
|
+
import { WatchMap } from "./watch.mjs";
|
|
7
|
+
//#region src/runtime/register/runtimeInstance.d.ts
|
|
8
|
+
type RuntimeSetupFunction<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> = DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'] | DefineAppOptions<D, C, M>['setup'];
|
|
9
|
+
/**
|
|
10
|
+
* 挂载运行时实例(框架内部注册流程使用)。
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
declare function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(target: InternalRuntimeState, runtimeApp: RuntimeApp<D, C, M>, watchMap: WatchMap | undefined, setup?: RuntimeSetupFunction<D, C, M>, options?: {
|
|
14
|
+
deferSetData?: boolean;
|
|
15
|
+
snapshotOmitKeys?: string[];
|
|
16
|
+
}): RuntimeInstance<D, C, M>;
|
|
17
|
+
declare function setRuntimeSetDataVisibility(target: InternalRuntimeState, visible: boolean): void;
|
|
18
|
+
/**
|
|
19
|
+
* 卸载运行时实例(框架内部注册流程使用)。
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
declare function teardownRuntimeInstance(target: InternalRuntimeState, options?: {
|
|
23
|
+
skipHooks?: boolean;
|
|
24
|
+
}): void;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { mountRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isRef as e}from"../../reactivity/ref.mjs";import{callHookList as t}from"../hooks/base.mjs";import{isDeepEqualValue as n}from"../app/setData/snapshot.mjs";import{resolveRuntimePageLayoutName as r,syncRuntimePageLayoutState as i}from"../pageLayout.mjs";import{allocateOwnerId as a,attachOwnerSnapshot as o,mergeOwnerSnapshotProps as s,removeOwner as c,resolveOwnerSnapshot as l,updateOwnerSnapshot as ee}from"../scopedSlots.mjs";import{clearTemplateRefs as u,scheduleTemplateRefUpdate as d}from"../templateRefs.mjs";import{attachRuntimeSlots as te,createNoopWatchStopHandle as ne,safeMarkNoSetData as re}from"./runtimeInstance/setupContext.mjs";import{bridgeRuntimeMethodsToTarget as ie}from"./runtimeInstance/methodBridge.mjs";import{attachRuntimeProvideParentContext as ae}from"./runtimeInstance/provideContext.mjs";import{attachNativeInstanceRef as oe,attachRuntimeInstance as se,attachRuntimeRef as f,callNativeSetData as p,ensureRuntimeProps as ce,resolveNativeSetData as m}from"./runtimeInstance/utils.mjs";import{runRuntimeSetupPhase as h}from"./runtimeInstance/setupPhase.mjs";import{createSetDataHighFrequencyWarningMonitor as le}from"./setDataFrequencyWarning.mjs";import{registerWatches as ue}from"./watch.mjs";import{WEVU_EFFECT_SCOPE_KEY as g,WEVU_HOOKS_KEY as _,WEVU_PAGE_LAYOUT_NAME_KEY as v,WEVU_PAGE_LAYOUT_PROPS_KEY as y,WEVU_PAGE_LAYOUT_SETTER_KEY as b,WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY as de,WEVU_PROPS_DERIVED_KEYS_KEY as x,WEVU_PROPS_KEY as fe,WEVU_PUBLIC_RUNTIME_KEY as S,WEVU_RUNTIME_OWNER_ID_KEY as C,WEVU_SLOT_OWNER_ID_KEY as w,WEVU_TEMPLATE_REFS_KEY as T,WEVU_WATCH_STOPS_KEY as E}from"@weapp-core/constants";function D(e,t=new WeakMap){if(!e||typeof e!=`object`)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let n=[];t.set(e,n);for(let r of e)n.push(D(r,t));return n}let n={};t.set(e,n);for(let[r,i]of Object.entries(e))n[r]=D(i,t);return n}function pe(e,t,n){let r=e.data;if((!r||typeof r!=`object`)&&(!n||!Object.keys(n).length))return;let i=Array.isArray(t)&&t.length?new Set(t):void 0,a={};if(r&&typeof r==`object`)for(let[e,t]of Object.entries(r))i!=null&&i.has(e)||(a[e]=D(t));if(n)for(let[e,t]of Object.entries(n))i!=null&&i.has(e)||(a[e]=D(t));return a}function me(e){return!!(e!=null&&e.__wevuHasTemplateRuntimeBindings)}function he(e){typeof e.route!=`string`||!e.route||(e[b]=(t,n)=>{var a;let o=(a=e.__wevu)==null?void 0:a.state;if(!o||typeof o!=`object`)return;o[v]=r(t);let s=t===!1||n==null?{}:n;o[y]=s,i(e,t,s)})}function O(e,t,n,r,i){var c,u,g,_,v,y,b,C,O,k,A,j;if(e.__wevu)return e.__wevu;ae(e,t),re(e);let M=(c=e.data)==null?void 0:c[w],N=typeof M==`string`&&M?M:a(),P=typeof M==`string`&&M!==N,F=!!(!(t==null||(u=t.__wevuSetDataOptions)==null)&&u.suspendWhenHidden),I=typeof e.route==`string`&&e.route?`page:${e.route}`:typeof e.is==`string`&&e.is?`component:${e.is}`:`unknown-target`,L=le({option:t==null||(g=t.__wevuSetDataOptions)==null?void 0:g.highFrequencyWarning,targetLabel:I,isInPageScrollHook:()=>{var t;return Number((t=e[de])==null?0:t)>0}}),R=i!=null&&i.deferSetData?(e=>{let t,n=[],r=!1,i={setData(i,a){if(!r){var o;t={...(o=t)==null?{}:o,...i},a&&n.push(a);return}let s=m(e);if(s)return p(e,s,i,a)}};return i.__wevu_enableSetData=(i=!1)=>{r=!0,i&&(t=void 0,n=[]);let a=m(e);if(t&&Object.keys(t).length&&a){let r=t,i=n;t=void 0,n=[],p(e,a,r,i.length?()=>i.forEach(e=>e()):void 0)}},i})(e):{setData(t,n){let r=m(e);if(r)return p(e,r,t,n)}},z,B=!0,V,ge=(e,t)=>({...e==null?{}:e,...t}),H=()=>{var t;if(!z)return;let n=l(z);s(n,(t=e[fe])==null?e.properties:t),ee(N,n,z.proxy,e)},_e=()=>{if(!P)return;let t=e.data;try{t&&typeof t==`object`&&(t[w]=N)}catch(e){}let n=m(e);n&&p(e,n,{[w]:N})},U={...R,setData(t){if(L==null||L(),F&&!B){V=ge(V,t),H(),d(e);return}let n=Array.isArray(e[T])&&e[T].length>0;if(H(),n&&m(e))return new Promise(n=>{R.setData(t,()=>{H(),d(e),n()})});let r=R.setData(t);return d(e),r},__wevu_setVisibility(t){if(B=t,!B||!V)return;let n=V;V=void 0;let r=Array.isArray(e[T])&&e[T].length>0;if(H(),r&&m(e))return new Promise(t=>{R.setData(n,()=>{H(),d(e),t()})});let i=R.setData(n);return d(e),i}};Object.defineProperty(U,"__wevu_targetLabel",{configurable:!0,enumerable:!1,value:I,writable:!1});let W=e.properties;W&&typeof W==`object`&&Object.defineProperty(U,"__wevu_initialProps",{configurable:!0,enumerable:!1,value:W,writable:!1}),Array.isArray(i==null?void 0:i.snapshotOmitKeys)&&i.snapshotOmitKeys.length&&Object.defineProperty(U,"__wevu_snapshotOmitKeys",{configurable:!0,enumerable:!1,value:i.snapshotOmitKeys,writable:!1});let G=pe(e,i==null?void 0:i.snapshotOmitKeys,me(t)?void 0:{[w]:N});G&&Object.keys(G).length&&Object.defineProperty(U,"__wevu_initialSnapshot",{configurable:!0,enumerable:!1,value:G,writable:!1}),Object.defineProperty(U,"__wevu_initialState",{configurable:!0,enumerable:!1,value:{[w]:N},writable:!1}),(i!=null&&i.deferSetData||r||W&&typeof W==`object`&&Object.keys(W).length>0)&&Object.defineProperty(U,"__wevu_deferInitialSnapshot",{configurable:!0,enumerable:!1,value:!0,writable:!1});let K=t.mount(U);z=K,se(K,e);let q=(_=K==null?void 0:K.proxy)==null?{}:_,J=(v=K==null?void 0:K.state)==null?{}:v,ve=(y=K==null?void 0:K.setupState)==null?Object.create(null):y;J&&typeof J==`object`&&(f(J,K),oe(J,e));let ye=(b=K==null?void 0:K.computed)==null?Object.create(null):b;if(!(K!=null&&K.methods))try{K.methods=Object.create(null)}catch(e){}let be=(C=K==null?void 0:K.methods)==null?Object.create(null):C,xe=(O=K==null?void 0:K.watch)==null?(()=>ne()):O,Se=(k=K==null?void 0:K.bindModel)==null?(()=>{}):k,Y={...K==null?{}:K,state:J,setupState:ve,proxy:q,methods:be,computed:ye,watch:xe,bindModel:Se,snapshot:(A=K==null?void 0:K.snapshot)==null?(()=>Object.create(null)):A,unmount:(j=K==null?void 0:K.unmount)==null?(()=>{}):j};Object.defineProperty(Y,"__wevu_initialRuntimeSnapshot",{configurable:!0,enumerable:!1,value:D(J),writable:!1});let X=Y,Ce={__wevu_flushSetupSnapshotSync:K.__wevu_flushSetupSnapshotSync,__wevu_touchSetupMethodsVersion:K.__wevu_touchSetupMethodsVersion,__wevu_trackSetupReactiveKey:K.__wevu_trackSetupReactiveKey,[x]:K[x]};for(let[e,t]of Object.entries(Ce))t&&Object.defineProperty(Y,e,{configurable:!0,enumerable:!1,value:t,writable:!0});Object.defineProperty(e,S,{value:Y,configurable:!0,enumerable:!1,writable:!1}),e.__wevu=Y,he(e),te(J,ce(e,J)),o(e,Y,N,{deferSnapshot:i==null?void 0:i.deferSetData}),_e();let Z=n?ue(Y,n,e,{deferMissingSourceBaseline:!!r}):[];if(Z.length&&(e[E]=Z),r){if(h({target:e,runtime:K,runtimeWithDefaults:Y,runtimeState:J,runtimeProxy:q,setup:r}),!(i!=null&&i.deferSetData)){var Q;(Q=X.__wevu_flushSetupSnapshotSync)==null||Q.call(X)}i!=null&&i.deferSetData||H();for(let e of Z)e.resume()}else if(!(i!=null&&i.deferSetData)&&e.properties&&typeof e.properties==`object`&&Object.keys(e.properties).length>0){var $;($=X.__wevu_flushSetupSnapshotSync)==null||$.call(X),H()}return ie(e,K),K}function k(e,t,n){for(let e of Reflect.ownKeys(t))if(!Reflect.has(n,e)){let n=Reflect.getOwnPropertyDescriptor(t,e);n!=null&&n.configurable&&Reflect.deleteProperty(t,e)}for(let e of Reflect.ownKeys(n)){let r=Reflect.getOwnPropertyDescriptor(n,e);if(r)try{Reflect.defineProperty(t,e,r)}catch(r){try{t[e]=n[e]}catch(e){}}}return f(t.state,t),e.__wevu=t,Object.defineProperty(e,S,{value:t,configurable:!0,enumerable:!1,writable:!1}),t}function A(t,n,r){let i=t.state,a=t.setupState,o={};for(let t of Object.keys(n==null?{}:n)){if(!Object.prototype.hasOwnProperty.call(i,t))continue;if(r&&Object.prototype.hasOwnProperty.call(r,t)){o[t]=D(r[t]);continue}let n=a==null?void 0:a[t];o[t]=D(e(n)?n.value:i[t])}return o}function j(t,r){var i;let a=t.__wevu,o=a==null?void 0:a.state,s=a==null?void 0:a.setupState,c=(i=r==null?void 0:r.nativeData)==null?t.data:i;if(!o||typeof o!=`object`||!c||typeof c!=`object`)return;let l=a==null?void 0:a.__wevu_initialRuntimeSnapshot;for(let[t,i]of Object.entries(c))if(!(!t||t===`undefined`)&&Object.prototype.hasOwnProperty.call(o,t))try{let a=s==null?void 0:s[t],c=D(i);if(!(r!=null&&r.includeSetupState)&&s&&Object.prototype.hasOwnProperty.call(s,t)||!(r!=null&&r.includeSetupState)&&l&&Object.prototype.hasOwnProperty.call(l,t)&&!n(o[t],l[t],20,{keys:1e4})||!(r!=null&&r.includeSetupState)&&l&&!Object.prototype.hasOwnProperty.call(l,t))continue;if(e(a)){a.value=c;continue}o[t]=c}catch(e){}}function M(e,t){var n,r,i;let a=(n=e.__wevu)==null?void 0:n.adapter;j(e,{includeSetupState:t==null?void 0:t.rehydrateSetupState}),a&&typeof a.__wevu_enableSetData==`function`&&a.__wevu_enableSetData(!0),(r=e.__wevu)==null||(i=r.__wevu_flushSetupSnapshotSync)==null||i.call(r)}function N(e,t){var n;let r=(n=e.__wevu)==null?void 0:n.adapter;r&&typeof r.__wevu_setVisibility==`function`&&r.__wevu_setVisibility(t)}function P(e,n){var r,i;let a=e.__wevu,o=(r=e[C])==null?e[w]:r;o&&c(o),u(e),!(n!=null&&n.skipHooks)&&a&&e[_]&&t(e,`onUnload`,[]),e[_]&&(e[_]=void 0);let s=e[E];if(Array.isArray(s))for(let e of s)try{e()}catch(e){}e[E]=void 0,(i=e[g])==null||i.stop(),e[g]=void 0,a&&a.unmount(),delete e.__wevu,S in e&&delete e[S]}function F(e,t,n,r,i){let a=e.__wevu,o=a?A(a,e.data,i==null?void 0:i.stateSnapshot):void 0;P(e,{skipHooks:!0});let s=O(e,t,n,r,{deferSetData:!0,snapshotOmitKeys:i==null?void 0:i.snapshotOmitKeys});if(o){let t=e.data;t&&typeof t==`object`&&Object.assign(t,D(o)),j(e,{includeSetupState:!0,nativeData:o})}return!a||a===s?s:k(e,a,s)}export{M as enableDeferredSetData,O as mountRuntimeInstance,F as refreshRuntimeInstance,N as setRuntimeSetDataVisibility,P as teardownRuntimeInstance};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getCurrentMiniProgramHostConfig as e,getMiniProgramGlobalObject as t}from"../platform.mjs";function n(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function r(e){var t,r,i;let a={devOnly:!0,sampleWindowMs:1e3,maxCalls:30,coolDownMs:5e3,warnOnPageScroll:!0,pageScrollCoolDownMs:2e3};return e===void 0||e===!1?{...a,enabled:!1}:e===!0?{...a,enabled:!0}:n(e)?{enabled:(t=e.enabled)==null||t,devOnly:(r=e.devOnly)==null?a.devOnly:r,sampleWindowMs:typeof e.sampleWindowMs==`number`?Math.max(100,Math.floor(e.sampleWindowMs)):a.sampleWindowMs,maxCalls:typeof e.maxCalls==`number`?Math.max(1,Math.floor(e.maxCalls)):a.maxCalls,coolDownMs:typeof e.coolDownMs==`number`?Math.max(0,Math.floor(e.coolDownMs)):a.coolDownMs,warnOnPageScroll:(i=e.warnOnPageScroll)==null?a.warnOnPageScroll:i,pageScrollCoolDownMs:typeof e.pageScrollCoolDownMs==`number`?Math.max(0,Math.floor(e.pageScrollCoolDownMs)):a.pageScrollCoolDownMs}:{...a,enabled:!1}}function i(){let n=e();if((n==null?void 0:n.debug)===!0||(n==null?void 0:n.envVersion)===`develop`)return!0;let r=t();try{var i;if((r==null||(i=r.getAccountInfoSync)==null||(i=i.call(r))==null||(i=i.miniProgram)==null?void 0:i.envVersion)===`develop`)return!0}catch(e){}return!1}function a(e){var t,n;let a=r(e.option);if(!a.enabled)return;let o=i();if(a.devOnly&&!o)return;let s=(t=e.now)==null?(()=>Date.now()):t,c=(n=e.logger)==null?(e=>{var t;let n=(t=globalThis)==null||(t=t.console)==null?void 0:t.warn;typeof n==`function`&&n(e)}):n,l=[],u=-1/0,d=-1/0;return()=>{var t,n;let r=s();l.push(r);let i=r-a.sampleWindowMs;for(;l.length>0&&l[0]<i;)l.shift();let o=(t=(n=e.isInPageScrollHook)==null?void 0:n.call(e))!=null&&t;a.warnOnPageScroll&&o&&(a.pageScrollCoolDownMs<=0||r-d>=a.pageScrollCoolDownMs)&&(d=r,c(`[wevu:setData] 检测到 onPageScroll 回调内调用 setData(${e.targetLabel})。建议改用 IntersectionObserver 监听可见性,或对滚动更新做节流。`)),!(l.length<=a.maxCalls)&&(a.coolDownMs>0&&r-u<a.coolDownMs||(u=r,c(`[wevu:setData] 检测到高频 setData 调用:${l.length} 次/${a.sampleWindowMs}ms(${e.targetLabel})。建议合并更新或降低调用频率。`)))}}export{a as createSetDataHighFrequencyWarningMonitor,i as isDevelopmentRuntime,r as resolveHighFrequencyWarningOptions};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/runtime/register/setup.d.ts
|
|
2
|
+
type SetupRunner = {
|
|
3
|
+
bivarianceHack: (props: Record<string, any>, ctx: any) => any;
|
|
4
|
+
}['bivarianceHack'];
|
|
5
|
+
/**
|
|
6
|
+
* 执行 setup 函数并注入运行时上下文(框架内部使用)。
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
declare function runSetupFunction(setup: SetupRunner | undefined, props: Record<string, any>, context: any): unknown;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { runSetupFunction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,n){var r;if(typeof e!=`function`)return;let i=(r=n==null?void 0:n.runtime)==null?{methods:Object.create(null),state:{},setupState:{},proxy:{},watch:()=>()=>{},bindModel:()=>{}}:r;return n&&(n.runtime=i),e(t,{...n==null?{}:n,runtime:i})}export{e as runSetupFunction};
|