wevu 7.2.1 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.mjs +1 -1
- package/dist/dev/api/vitest/setup.d.mts +1 -0
- package/dist/dev/api/vitest.d.mts +1 -0
- package/dist/dev/api.d.mts +1 -0
- package/dist/dev/compiler.d.mts +1 -0
- package/dist/dev/fetch.d.mts +9 -0
- package/dist/dev/index.d.mts +72 -0
- package/dist/dev/internal-reactivity.d.mts +18 -0
- package/dist/dev/internal-runtime.d.mts +45 -0
- package/dist/dev/internal-runtime.mjs +3 -2
- package/dist/dev/internal-template.d.mts +2 -0
- package/dist/dev/jsxTypes.d.mts +9 -0
- package/dist/dev/macros/shared.d.mts +83 -0
- package/dist/dev/macros.d.mts +71 -0
- package/dist/dev/package.mjs +1 -1
- package/dist/dev/reactivity/asyncDerivation.d.mts +41 -0
- package/dist/dev/reactivity/asyncDerivation.mjs +8 -10
- package/dist/dev/reactivity/asyncDerivation.mjs.map +1 -1
- package/dist/dev/reactivity/computed.d.mts +25 -0
- package/dist/dev/reactivity/core.d.mts +35 -0
- package/dist/dev/reactivity/core.mjs +5 -8
- package/dist/dev/reactivity/core.mjs.map +1 -1
- package/dist/dev/reactivity/index.d.mts +16 -0
- package/dist/dev/reactivity/reactive/mutation.d.mts +21 -0
- package/dist/dev/reactivity/reactive/patch.d.mts +18 -0
- package/dist/dev/reactivity/reactive/patch.mjs +3 -3
- package/dist/dev/reactivity/reactive/patch.mjs.map +1 -1
- package/dist/dev/reactivity/reactive/patchState.mjs +4 -8
- package/dist/dev/reactivity/reactive/patchState.mjs.map +1 -1
- package/dist/dev/reactivity/reactive/shallow.d.mts +22 -0
- package/dist/dev/reactivity/reactive/shared.d.mts +4 -0
- package/dist/dev/reactivity/reactive/shared.mjs +1 -2
- package/dist/dev/reactivity/reactive/shared.mjs.map +1 -1
- package/dist/dev/reactivity/reactive.d.mts +42 -0
- package/dist/dev/reactivity/reactive.mjs +5 -10
- package/dist/dev/reactivity/reactive.mjs.map +1 -1
- package/dist/dev/reactivity/readonly.d.mts +27 -0
- package/dist/dev/reactivity/ref.d.mts +27 -0
- package/dist/dev/reactivity/ref.mjs +2 -2
- package/dist/dev/reactivity/ref.mjs.map +1 -1
- package/dist/dev/reactivity/shallowRef.d.mts +19 -0
- package/dist/dev/reactivity/shallowRef.mjs +1 -1
- package/dist/dev/reactivity/shallowRef.mjs.map +1 -1
- package/dist/dev/reactivity/toRefs.d.mts +43 -0
- package/dist/dev/reactivity/traverse.d.mts +8 -0
- package/dist/dev/reactivity/watch/helpers.mjs +1 -1
- package/dist/dev/reactivity/watch/helpers.mjs.map +1 -1
- package/dist/dev/reactivity/watch/types.d.mts +43 -0
- package/dist/dev/reactivity/watch.d.mts +22 -0
- package/dist/dev/reactivity/watch.mjs +6 -8
- package/dist/dev/reactivity/watch.mjs.map +1 -1
- package/dist/dev/router/auto-routes.d.mts +8 -0
- package/dist/dev/router/createRouter.d.mts +9 -0
- package/dist/dev/router/createRouter.mjs +17 -24
- package/dist/dev/router/createRouter.mjs.map +1 -1
- package/dist/dev/router/initialNavigation.mjs +18 -16
- package/dist/dev/router/initialNavigation.mjs.map +1 -1
- package/dist/dev/router/instance.mjs +1 -2
- package/dist/dev/router/instance.mjs.map +1 -1
- package/dist/dev/router/navigationCore.d.mts +7 -0
- package/dist/dev/router/navigationCore.mjs +2 -2
- package/dist/dev/router/navigationCore.mjs.map +1 -1
- package/dist/dev/router/navigationResult.mjs +7 -10
- package/dist/dev/router/navigationResult.mjs.map +1 -1
- package/dist/dev/router/navigationTarget.mjs +1 -3
- package/dist/dev/router/navigationTarget.mjs.map +1 -1
- package/dist/dev/router/resolve.d.mts +7 -0
- package/dist/dev/router/resolve.mjs +3 -4
- package/dist/dev/router/resolve.mjs.map +1 -1
- package/dist/dev/router/routeRegistry.mjs +1 -1
- package/dist/dev/router/routeRegistry.mjs.map +1 -1
- package/dist/dev/router/routeSync.d.mts +2 -0
- package/dist/dev/router/routeSync.mjs +1 -1
- package/dist/dev/router/routeSync.mjs.map +1 -1
- package/dist/dev/router/types.d.mts +267 -0
- package/dist/dev/router/useRoute.d.mts +20 -0
- package/dist/dev/router/useRoute.mjs +12 -19
- package/dist/dev/router/useRoute.mjs.map +1 -1
- package/dist/dev/router/useRouter.d.mts +9 -0
- package/dist/dev/router.d.mts +26 -0
- package/dist/dev/routerInternal/location.d.mts +2 -0
- package/dist/dev/routerInternal/location.mjs +2 -3
- package/dist/dev/routerInternal/location.mjs.map +1 -1
- package/dist/dev/routerInternal/matching.d.mts +2 -0
- package/dist/dev/routerInternal/params.d.mts +2 -0
- package/dist/dev/routerInternal/params.mjs +2 -3
- package/dist/dev/routerInternal/params.mjs.map +1 -1
- package/dist/dev/routerInternal/query.d.mts +7 -0
- package/dist/dev/routerInternal/records.d.mts +2 -0
- package/dist/dev/routerInternal/records.mjs +1 -1
- package/dist/dev/routerInternal/records.mjs.map +1 -1
- package/dist/dev/routerInternal/recordsWarnings.d.mts +2 -0
- package/dist/dev/routerInternal/recordsWarnings.mjs +1 -2
- package/dist/dev/routerInternal/recordsWarnings.mjs.map +1 -1
- package/dist/dev/routerInternal/shared.d.mts +9 -0
- package/dist/dev/routerInternal/snapshots.d.mts +2 -0
- package/dist/dev/routerInternal/types.d.mts +9 -0
- package/dist/dev/runtime/app/context.mjs +13 -26
- package/dist/dev/runtime/app/context.mjs.map +1 -1
- package/dist/dev/runtime/app/diagnostics.mjs +2 -4
- package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
- package/dist/dev/runtime/app/mount.mjs +27 -33
- package/dist/dev/runtime/app/mount.mjs.map +1 -1
- package/dist/dev/runtime/app/pending.d.mts +10 -0
- package/dist/dev/runtime/app/setData/commitTracker.d.mts +13 -0
- package/dist/dev/runtime/app/setData/commitTracker.mjs +5 -9
- package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/patchScheduler.mjs +2 -4
- package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/payload.mjs +2 -3
- package/dist/dev/runtime/app/setData/payload.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/scheduler.d.mts +51 -0
- package/dist/dev/runtime/app/setData/scheduler.mjs +7 -9
- package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/snapshot.mjs +5 -6
- package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -1
- package/dist/dev/runtime/app/setDataOptions.mjs +26 -27
- package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -1
- package/dist/dev/runtime/app.d.mts +8 -0
- package/dist/dev/runtime/app.mjs +9 -9
- package/dist/dev/runtime/app.mjs.map +1 -1
- package/dist/dev/runtime/bindingManifest.mjs +6 -14
- package/dist/dev/runtime/bindingManifest.mjs.map +1 -1
- package/dist/dev/runtime/capabilities.d.mts +78 -0
- package/dist/dev/runtime/capabilities.mjs.map +1 -1
- package/dist/dev/runtime/css.d.mts +14 -0
- package/dist/dev/runtime/css.mjs +4 -8
- package/dist/dev/runtime/css.mjs.map +1 -1
- package/dist/dev/runtime/defaults.d.mts +12 -0
- package/dist/dev/runtime/defaults.mjs +4 -4
- package/dist/dev/runtime/defaults.mjs.map +1 -1
- package/dist/dev/runtime/define/initialComputed.mjs +5 -5
- package/dist/dev/runtime/define/initialComputed.mjs.map +1 -1
- package/dist/dev/runtime/define/options.mjs +10 -12
- package/dist/dev/runtime/define/options.mjs.map +1 -1
- package/dist/dev/runtime/define/props.mjs +4 -5
- package/dist/dev/runtime/define/props.mjs.map +1 -1
- package/dist/dev/runtime/define/scopedSlotOptions.mjs +43 -61
- package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
- package/dist/dev/runtime/define/setupResult.mjs +17 -28
- package/dist/dev/runtime/define/setupResult.mjs.map +1 -1
- package/dist/dev/runtime/define.d.mts +118 -0
- package/dist/dev/runtime/define.mjs +9 -12
- package/dist/dev/runtime/define.mjs.map +1 -1
- package/dist/dev/runtime/diff.mjs +9 -11
- package/dist/dev/runtime/diff.mjs.map +1 -1
- package/dist/dev/runtime/disposables.d.mts +31 -0
- package/dist/dev/runtime/disposables.mjs +2 -2
- package/dist/dev/runtime/disposables.mjs.map +1 -1
- package/dist/dev/runtime/elementIntersectionObserver.d.mts +26 -0
- package/dist/dev/runtime/elementIntersectionObserver.mjs +16 -24
- package/dist/dev/runtime/elementIntersectionObserver.mjs.map +1 -1
- package/dist/dev/runtime/features/inlineEvents.d.mts +7 -0
- package/dist/dev/runtime/features/inlineEvents.mjs +2 -3
- package/dist/dev/runtime/features/inlineEvents.mjs.map +1 -1
- package/dist/dev/runtime/features/jsxIslands.d.mts +7 -0
- package/dist/dev/runtime/features/jsxIslands.mjs +20 -0
- package/dist/dev/runtime/features/jsxIslands.mjs.map +1 -0
- package/dist/dev/runtime/features/layout.d.mts +7 -0
- package/dist/dev/runtime/features/layout.mjs +2 -3
- package/dist/dev/runtime/features/layout.mjs.map +1 -1
- package/dist/dev/runtime/features/patchStrategy.d.mts +7 -0
- package/dist/dev/runtime/features/publicLayout.d.mts +24 -0
- package/dist/dev/runtime/features/publicLayout.mjs +2 -6
- package/dist/dev/runtime/features/publicLayout.mjs.map +1 -1
- package/dist/dev/runtime/features/scopedSlots.d.mts +23 -0
- package/dist/dev/runtime/features/scopedSlots.mjs +5 -9
- package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +7 -0
- package/dist/dev/runtime/features/templateRefs.d.mts +7 -0
- package/dist/dev/runtime/features/templateRefs.mjs +1 -1
- package/dist/dev/runtime/features/templateRefs.mjs.map +1 -1
- package/dist/dev/runtime/hooks/base.d.mts +27 -0
- package/dist/dev/runtime/hooks/base.mjs +21 -32
- package/dist/dev/runtime/hooks/base.mjs.map +1 -1
- package/dist/dev/runtime/hooks/register.d.mts +30 -0
- package/dist/dev/runtime/hooks/vue.d.mts +52 -0
- package/dist/dev/runtime/hooks.d.mts +4 -0
- package/dist/dev/runtime/index.d.mts +46 -0
- package/dist/dev/runtime/inlineDataset.mjs +1 -2
- package/dist/dev/runtime/inlineDataset.mjs.map +1 -1
- package/dist/dev/runtime/intersectionObserver.d.mts +14 -0
- package/dist/dev/runtime/intersectionObserver.mjs +6 -6
- package/dist/dev/runtime/intersectionObserver.mjs.map +1 -1
- package/dist/dev/runtime/jsxIsland.d.mts +37 -0
- package/dist/dev/runtime/jsxIsland.mjs +16 -33
- package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
- package/dist/dev/runtime/layoutBridge.d.mts +55 -0
- package/dist/dev/runtime/layoutBridge.mjs +32 -62
- package/dist/dev/runtime/layoutBridge.mjs.map +1 -1
- package/dist/dev/runtime/nativeBridge.mjs +1 -1
- package/dist/dev/runtime/nativeBridge.mjs.map +1 -1
- package/dist/dev/runtime/navigationLifecycle.mjs +24 -0
- package/dist/dev/runtime/navigationLifecycle.mjs.map +1 -0
- package/dist/dev/runtime/noSetData.d.mts +5 -0
- package/dist/dev/runtime/pageEnvironment.d.mts +50 -0
- package/dist/dev/runtime/pageEnvironment.mjs +15 -18
- package/dist/dev/runtime/pageEnvironment.mjs.map +1 -1
- package/dist/dev/runtime/pageLayout.d.mts +25 -0
- package/dist/dev/runtime/pageLayout.mjs +7 -11
- package/dist/dev/runtime/pageLayout.mjs.map +1 -1
- package/dist/dev/runtime/pageScroll.d.mts +29 -0
- package/dist/dev/runtime/pageScroll.mjs +2 -3
- package/dist/dev/runtime/pageScroll.mjs.map +1 -1
- package/dist/dev/runtime/platform/current.mjs +12 -0
- package/dist/dev/runtime/platform/current.mjs.map +1 -0
- package/dist/dev/runtime/platform/generic.mjs +36 -0
- package/dist/dev/runtime/platform/generic.mjs.map +1 -0
- package/dist/dev/runtime/platform/globals.mjs +29 -0
- package/dist/dev/runtime/platform/globals.mjs.map +1 -0
- package/dist/dev/runtime/platform.mjs +15 -60
- package/dist/dev/runtime/platform.mjs.map +1 -1
- package/dist/dev/runtime/provide.d.mts +60 -0
- package/dist/dev/runtime/provideContext.mjs +7 -9
- package/dist/dev/runtime/provideContext.mjs.map +1 -1
- package/dist/dev/runtime/provideStore.d.mts +7 -0
- package/dist/dev/runtime/publicRuntime.d.mts +22 -0
- package/dist/dev/runtime/publicRuntime.mjs +4 -0
- package/dist/dev/runtime/publicRuntime.mjs.map +1 -1
- package/dist/dev/runtime/pullDownRefresh.d.mts +12 -0
- package/dist/dev/runtime/pullDownRefresh.mjs +2 -4
- package/dist/dev/runtime/pullDownRefresh.mjs.map +1 -1
- package/dist/dev/runtime/register/app.d.mts +14 -0
- package/dist/dev/runtime/register/app.mjs +18 -19
- package/dist/dev/runtime/register/app.mjs.map +1 -1
- package/dist/dev/runtime/register/component/alipay.mjs +9 -18
- package/dist/dev/runtime/register/component/alipay.mjs.map +1 -1
- package/dist/dev/runtime/register/component/alipayRegistration.mjs +60 -0
- package/dist/dev/runtime/register/component/alipayRegistration.mjs.map +1 -0
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs +8 -9
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs.map +1 -1
- package/dist/dev/runtime/register/component/lifecycle.mjs +7 -12
- package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
- package/dist/dev/runtime/register/component/methods.mjs +13 -18
- package/dist/dev/runtime/register/component/methods.mjs.map +1 -1
- package/dist/dev/runtime/register/component/options.mjs +3 -4
- package/dist/dev/runtime/register/component/options.mjs.map +1 -1
- package/dist/dev/runtime/register/component/props.mjs +25 -31
- package/dist/dev/runtime/register/component/props.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +18 -40
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerNativeDefinition.mjs +18 -60
- package/dist/dev/runtime/register/component/registerNativeDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component.d.mts +17 -0
- package/dist/dev/runtime/register/component.mjs +3 -5
- package/dist/dev/runtime/register/component.mjs.map +1 -1
- package/dist/dev/runtime/register/inline.d.mts +15 -0
- package/dist/dev/runtime/register/inline.mjs +8 -10
- package/dist/dev/runtime/register/inline.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +7 -8
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +1 -1
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +25 -34
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +6 -13
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +2 -2
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs +9 -9
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance.d.mts +26 -0
- package/dist/dev/runtime/register/runtimeInstance.mjs +74 -100
- package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs +12 -15
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -1
- package/dist/dev/runtime/register/setup.d.mts +11 -0
- package/dist/dev/runtime/register/setup.mjs +2 -3
- package/dist/dev/runtime/register/setup.mjs.map +1 -1
- package/dist/dev/runtime/register/snapshot.mjs +1 -4
- package/dist/dev/runtime/register/snapshot.mjs.map +1 -1
- package/dist/dev/runtime/register/watch.d.mts +12 -0
- package/dist/dev/runtime/register/watch.mjs +3 -5
- package/dist/dev/runtime/register/watch.mjs.map +1 -1
- package/dist/dev/runtime/register.d.mts +5 -0
- package/dist/dev/runtime/scopedSlots.mjs +14 -21
- package/dist/dev/runtime/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/selectorQuery.d.mts +54 -0
- package/dist/dev/runtime/selectorQuery.mjs +5 -9
- package/dist/dev/runtime/selectorQuery.mjs.map +1 -1
- package/dist/dev/runtime/template.d.mts +6 -0
- package/dist/dev/runtime/template.mjs +1 -1
- package/dist/dev/runtime/template.mjs.map +1 -1
- package/dist/dev/runtime/templateRefTypes.d.mts +12 -0
- package/dist/dev/runtime/templateRefs/helpers.mjs +14 -24
- package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -1
- package/dist/dev/runtime/templateRefs.mjs +8 -15
- package/dist/dev/runtime/templateRefs.mjs.map +1 -1
- package/dist/dev/runtime/types/core.d.mts +35 -0
- package/dist/dev/runtime/types/miniprogram.d.mts +84 -0
- package/dist/dev/runtime/types/miniprogramHost.d.mts +45 -0
- package/dist/dev/runtime/types/miniprogramHostSources.d.mts +112 -0
- package/dist/dev/runtime/types/options.d.mts +138 -0
- package/dist/dev/runtime/types/props/propTypes.d.mts +79 -0
- package/dist/dev/runtime/types/props/router.d.mts +51 -0
- package/dist/dev/runtime/types/props/setup.d.mts +96 -0
- package/dist/dev/runtime/types/props.d.mts +4 -0
- package/dist/dev/runtime/types/runtime.d.mts +59 -0
- package/dist/dev/runtime/types/setData.d.mts +237 -0
- package/dist/dev/runtime/types.d.mts +29 -0
- package/dist/dev/runtime/uniAppHost.d.mts +8 -0
- package/dist/dev/runtime/uniAppHost.mjs +6 -14
- package/dist/dev/runtime/uniAppHost.mjs.map +1 -1
- package/dist/dev/runtime/updatePerformance.d.mts +13 -0
- package/dist/dev/runtime/updatePerformance.mjs +1 -1
- package/dist/dev/runtime/updatePerformance.mjs.map +1 -1
- package/dist/dev/runtime/use.d.mts +13 -0
- package/dist/dev/runtime/use.mjs +1 -1
- package/dist/dev/runtime/use.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/context.d.mts +8 -0
- package/dist/dev/runtime/vueCompat/context.mjs +3 -5
- package/dist/dev/runtime/vueCompat/context.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/model.d.mts +30 -0
- package/dist/dev/runtime/vueCompat/model.mjs +9 -13
- package/dist/dev/runtime/vueCompat/model.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/router.d.mts +29 -0
- package/dist/dev/runtime/vueCompat/router.mjs +4 -4
- package/dist/dev/runtime/vueCompat/router.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/templateRef.d.mts +9 -0
- package/dist/dev/runtime/vueCompat/templateRef.mjs +1 -1
- package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat.d.mts +5 -0
- package/dist/dev/scheduler.d.mts +4 -0
- package/dist/dev/scheduler.mjs +3 -4
- package/dist/dev/scheduler.mjs.map +1 -1
- package/dist/dev/store/base.mjs +1 -2
- package/dist/dev/store/base.mjs.map +1 -1
- package/dist/dev/store/define/create.mjs +11 -22
- package/dist/dev/store/define/create.mjs.map +1 -1
- package/dist/dev/store/define.d.mts +8 -0
- package/dist/dev/store/define.mjs +1 -1
- package/dist/dev/store/define.mjs.map +1 -1
- package/dist/dev/store/manager.d.mts +16 -0
- package/dist/dev/store/storeToRefs.d.mts +11 -0
- package/dist/dev/store/types.d.mts +106 -0
- package/dist/dev/store/view.mjs +1 -1
- package/dist/dev/store/view.mjs.map +1 -1
- package/dist/dev/store.d.mts +5 -0
- package/dist/dev/version.d.mts +4 -0
- package/dist/dev/vue-augment.d.mts +8 -0
- package/dist/dev/vue-demi.d.mts +87 -0
- package/dist/dev/vue-types.d.mts +19 -0
- package/dist/dev/web-apis.d.mts +3 -0
- package/dist/internal-runtime.d.mts +2 -1
- package/dist/internal-runtime.mjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/reactivity/asyncDerivation.mjs +1 -1
- package/dist/reactivity/core.mjs +1 -1
- package/dist/reactivity/reactive/patch.mjs +1 -1
- package/dist/reactivity/reactive/patchState.mjs +1 -1
- package/dist/reactivity/reactive/shared.mjs +1 -1
- package/dist/reactivity/reactive.mjs +1 -1
- package/dist/reactivity/ref.mjs +1 -1
- package/dist/reactivity/shallowRef.mjs +1 -1
- package/dist/reactivity/watch/helpers.mjs +1 -1
- package/dist/reactivity/watch.mjs +1 -1
- package/dist/router/createRouter.mjs +1 -1
- package/dist/router/initialNavigation.mjs +1 -1
- package/dist/router/instance.mjs +1 -1
- package/dist/router/navigationCore.mjs +1 -1
- package/dist/router/navigationResult.mjs +1 -1
- package/dist/router/navigationTarget.mjs +1 -1
- package/dist/router/resolve.mjs +1 -1
- package/dist/router/routeRegistry.mjs +1 -1
- package/dist/router/routeSync.mjs +1 -1
- package/dist/router/useRoute.mjs +1 -1
- package/dist/routerInternal/location.mjs +1 -1
- package/dist/routerInternal/params.mjs +1 -1
- package/dist/routerInternal/records.mjs +1 -1
- package/dist/routerInternal/recordsWarnings.mjs +1 -1
- package/dist/runtime/app/context.mjs +1 -1
- package/dist/runtime/app/diagnostics.mjs +1 -1
- package/dist/runtime/app/mount.mjs +1 -1
- package/dist/runtime/app/setData/commitTracker.mjs +1 -1
- package/dist/runtime/app/setData/patchScheduler.mjs +1 -1
- package/dist/runtime/app/setData/payload.mjs +1 -1
- package/dist/runtime/app/setData/scheduler.mjs +1 -1
- package/dist/runtime/app/setData/snapshot.mjs +1 -1
- package/dist/runtime/app/setDataOptions.mjs +1 -1
- package/dist/runtime/app.mjs +1 -1
- package/dist/runtime/bindingManifest.mjs +1 -1
- package/dist/runtime/capabilities.d.mts +4 -1
- package/dist/runtime/css.mjs +1 -1
- package/dist/runtime/defaults.mjs +1 -1
- package/dist/runtime/define/initialComputed.mjs +1 -1
- package/dist/runtime/define/options.mjs +1 -1
- package/dist/runtime/define/props.mjs +1 -1
- package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
- package/dist/runtime/define/setupResult.mjs +1 -1
- package/dist/runtime/define.mjs +1 -1
- package/dist/runtime/diff.mjs +1 -1
- package/dist/runtime/disposables.mjs +1 -1
- package/dist/runtime/elementIntersectionObserver.mjs +1 -1
- package/dist/runtime/features/inlineEvents.mjs +1 -1
- package/dist/runtime/features/jsxIslands.d.mts +6 -0
- package/dist/runtime/features/jsxIslands.mjs +1 -0
- package/dist/runtime/features/layout.mjs +1 -1
- package/dist/runtime/features/publicLayout.mjs +1 -1
- package/dist/runtime/features/scopedSlots.mjs +1 -1
- package/dist/runtime/features/templateRefs.mjs +1 -1
- package/dist/runtime/hooks/base.mjs +1 -1
- package/dist/runtime/inlineDataset.mjs +1 -1
- package/dist/runtime/intersectionObserver.mjs +1 -1
- package/dist/runtime/jsxIsland.mjs +1 -1
- package/dist/runtime/layoutBridge.mjs +1 -1
- package/dist/runtime/nativeBridge.mjs +1 -1
- package/dist/runtime/navigationLifecycle.mjs +1 -0
- package/dist/runtime/pageEnvironment.mjs +1 -1
- package/dist/runtime/pageLayout.mjs +1 -1
- package/dist/runtime/pageScroll.mjs +1 -1
- package/dist/runtime/platform/current.mjs +1 -0
- package/dist/runtime/platform/generic.mjs +1 -0
- package/dist/runtime/platform/globals.mjs +1 -0
- package/dist/runtime/platform.mjs +1 -1
- package/dist/runtime/provideContext.mjs +1 -1
- package/dist/runtime/publicRuntime.mjs +1 -1
- package/dist/runtime/pullDownRefresh.mjs +1 -1
- package/dist/runtime/register/app.mjs +1 -1
- package/dist/runtime/register/component/alipay.mjs +1 -1
- package/dist/runtime/register/component/alipayRegistration.mjs +1 -0
- package/dist/runtime/register/component/lifecycle/platform.mjs +1 -1
- package/dist/runtime/register/component/lifecycle.mjs +1 -1
- package/dist/runtime/register/component/methods.mjs +1 -1
- package/dist/runtime/register/component/options.mjs +1 -1
- package/dist/runtime/register/component/props.mjs +1 -1
- package/dist/runtime/register/component/registerDefinition.mjs +1 -1
- package/dist/runtime/register/component/registerNativeDefinition.mjs +1 -1
- package/dist/runtime/register/component.mjs +1 -1
- package/dist/runtime/register/inline.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/provideContext.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupSnapshot.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/utils.mjs +1 -1
- package/dist/runtime/register/runtimeInstance.mjs +1 -1
- package/dist/runtime/register/setDataFrequencyWarning.mjs +1 -1
- package/dist/runtime/register/setup.mjs +1 -1
- package/dist/runtime/register/snapshot.mjs +1 -1
- package/dist/runtime/register/watch.mjs +1 -1
- package/dist/runtime/scopedSlots.mjs +1 -1
- package/dist/runtime/selectorQuery.mjs +1 -1
- package/dist/runtime/template.mjs +1 -1
- package/dist/runtime/templateRefs/helpers.mjs +1 -1
- package/dist/runtime/templateRefs.mjs +1 -1
- package/dist/runtime/uniAppHost.mjs +1 -1
- package/dist/runtime/updatePerformance.mjs +1 -1
- package/dist/runtime/use.mjs +1 -1
- package/dist/runtime/vueCompat/context.mjs +1 -1
- package/dist/runtime/vueCompat/model.mjs +1 -1
- package/dist/runtime/vueCompat/router.mjs +1 -1
- package/dist/runtime/vueCompat/templateRef.mjs +1 -1
- package/dist/scheduler.mjs +1 -1
- package/dist/store/base.mjs +1 -1
- package/dist/store/define/create.mjs +1 -1
- package/dist/store/define.mjs +1 -1
- package/dist/store/view.mjs +1 -1
- package/package.json +7 -7
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{registerInitialNavigationLifecycle as e}from"../runtime/navigationLifecycle.mjs";import{getActiveRouter as t}from"./instance.mjs";import{WEVU_INITIAL_NAVIGATION_TIMEOUT_MARKER as n}from"@weapp-core/constants";import{queueMicrotaskPolyfill as r}from"@wevu/web-apis";const i=1e4,a=/* @__PURE__ */ new WeakMap,o=/* @__PURE__ */ new WeakMap;function s(e){return Number.isFinite(e)&&e>0?Math.max(1,Math.trunc(e)):i}function c(e){return{route:typeof e.route==`string`?e.route:void 0,__route__:typeof e.__route__==`string`?e.__route__:void 0,options:e.options&&typeof e.options==`object`?{...e.options}:void 0}}function l(e){if(!e||typeof e!=`object`)return;let t={};for(let[n,r]of Object.entries(e))t[n]=Array.isArray(r)?[...r]:r;return t}function u(){let e=t();return e?a.get(e)?.timeoutMs??1e4:i}function d(e){return!!(e&&typeof e==`object`&&e.__wevuNavigationFailure)}function f(e,i,s={}){let f=o.get(e);if(f)return s.onComplete&&f.blocking&&f.subscribe(s.onComplete),s.start!==!1&&f.start(i),f.blocking?f.promise:void 0;let p=t(),m=p?a.get(p):void 0,h=m?.runner;if(!h)return;let g=m?.mode===`blocking`,_=c(e),v=l(i),y=`idle`,b,x=u(),S,C=/* @__PURE__ */ new Set,w=new Promise(e=>{S=e}),T=(e,t)=>{if(y!==`idle`&&y!==`running`)return;y=e,b!==void 0&&(clearTimeout(b),b=void 0);let n=[...C];C.clear(),h=void 0,_=void 0,v=void 0,S(t),r(()=>{if(y===`allowed`||y===`timed-out`)for(let e of n)e.active&&(e.callback(t),e.active=!1)})},E={promise:w,blocking:g,status:()=>y,subscribe(e){let t={callback:e,active:!0};return y!==`idle`&&y!==`running`?r(()=>{t.active&&(y===`allowed`||y===`timed-out`)&&(e(y===`allowed`||y===`timed-out`),t.active=!1)}):C.add(t),()=>{t.active=!1,C.delete(t)}},start(e){if(y!==`idle`)return;y=`running`,g&&(b=setTimeout(()=>{y===`running`&&(console.warn(`${n} initial navigation exceeded ${x}ms; mounting page`,_?.route??_?.__route__??``),T(`timed-out`,!0))},x));let t=_,r=l(e??v),i=h;if(h=void 0,!i||!t){T(`aborted`,!1);return}i(t,r,()=>y===`running`).then(e=>{let t=d(e);T(t?`aborted`:`allowed`,!t)},()=>{T(`aborted`,!1)})},cancel(){T(`cancelled`,!1)}};return o.set(e,E),s.onComplete&&g&&E.subscribe(s.onComplete),s.start!==!1&&E.start(i),g?w:void 0}function p(e){o.get(e)?.cancel()}function m(t,n,r=i,o=`blocking`){e({ensure:f,cancel:p}),a.set(t,{runner:n,mode:o,timeoutMs:s(r)})}export{i as DEFAULT_INITIAL_NAVIGATION_TIMEOUT,p as cancelInitialNavigation,f as ensureInitialNavigation,u as getInitialNavigationTimeout,m as registerInitialNavigationRunner};
|
package/dist/router/instance.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{injectGlobal as e,provideGlobal as t}from"../runtime/provide.mjs";const n=Symbol(`wevu.router.instance`);let r;function i(e){r=e,t(n,e)}function a(){
|
|
1
|
+
import{injectGlobal as e,provideGlobal as t}from"../runtime/provide.mjs";const n=Symbol(`wevu.router.instance`);let r;function i(e){r=e,t(n,e)}function a(){return r??e(n,void 0)}export{a as getActiveRouter,i as setActiveRouter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NavigationFailureType as e}from"./types.mjs";const t=/already|same|duplicat|重复/,n=/cancel|取消/,r=/abort|interrupt|中断/;function i(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e.errMsg;if(typeof t==`string`)return t;if(e instanceof Error)return e.message}return``}function a(a){let o=i(a).toLowerCase();return t.test(o)?e.duplicated:n.test(o)?e.cancelled:r.test(o)?e.aborted:e.unknown}function o(e,t,n,r){let a=i(r)||`Navigation failed`;return Object.assign(Error(a),{__wevuNavigationFailure:!0,type:e,to:t,from:n,cause:r})}function s(e,t){if(!e||typeof e!=`object`)return!1;let n=e;return n.__wevuNavigationFailure===!0?t===void 0||n.type===t:!1}function c(e){return!e||typeof e!=`object`?!1:`to`in e}function l(e){if(typeof e==`string`)return!0;if(!e||typeof e!=`object`)return!1;let t=e;return`path`in t||`fullPath`in t||`query`in t||`hash`in t||`name`in t||`params`in t}async function u(t,n,r){for(let i of t)try{let t=await i(n.to,n.from,n);if(s(t))return{status:`failure`,failure:t};if(t===!1)return{status:`failure`,failure:o(e.aborted,n.to,n.from,`Navigation aborted by guard`)};if(c(t))return n.to?{status:`redirect`,target:r(t.to,n.to.path),replace:t.replace}:{status:`failure`,failure:o(e.aborted,n.to,n.from,`Redirect is not supported in back navigation guards`)};if(l(t))return n.to?{status:`redirect`,target:r(t,n.to.path)}:{status:`failure`,failure:o(e.aborted,n.to,n.from,`Redirect is not supported in back navigation guards`)}}catch(t){return{status:`failure`,failure:o(e.aborted,n.to,n.from,t)}}return{status:`continue`}}function d(e,t,n,r){return new Promise(i=>{let s=!1,c=e=>{s||(s=!0,i(e))};try{let i=e({...t,success:()=>c(),fail:e=>{c(o(a(e),n,r,e))}});i&&typeof i.then==`function`&&i.then(()=>c(),e=>c(o(a(e),n,r,e)))}catch(e){c(o(a(e),n,r,e))}})}async function f(e,t){for(let n of e)try{await n(t.to,t.from,t.failure,t)}catch
|
|
1
|
+
import{NavigationFailureType as e}from"./types.mjs";const t=/already|same|duplicat|重复/,n=/cancel|取消/,r=/abort|interrupt|中断/;function i(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e.errMsg;if(typeof t==`string`)return t;if(e instanceof Error)return e.message}return``}function a(a){let o=i(a).toLowerCase();return t.test(o)?e.duplicated:n.test(o)?e.cancelled:r.test(o)?e.aborted:e.unknown}function o(e,t,n,r){let a=i(r)||`Navigation failed`;return Object.assign(Error(a),{__wevuNavigationFailure:!0,type:e,to:t,from:n,cause:r})}function s(e,t){if(!e||typeof e!=`object`)return!1;let n=e;return n.__wevuNavigationFailure===!0?t===void 0||n.type===t:!1}function c(e){return!e||typeof e!=`object`?!1:`to`in e}function l(e){if(typeof e==`string`)return!0;if(!e||typeof e!=`object`)return!1;let t=e;return`path`in t||`fullPath`in t||`query`in t||`hash`in t||`name`in t||`params`in t}async function u(t,n,r){for(let i of t)try{let t=await i(n.to,n.from,n);if(s(t))return{status:`failure`,failure:t};if(t===!1)return{status:`failure`,failure:o(e.aborted,n.to,n.from,`Navigation aborted by guard`)};if(c(t))return n.to?{status:`redirect`,target:r(t.to,n.to.path),replace:t.replace}:{status:`failure`,failure:o(e.aborted,n.to,n.from,`Redirect is not supported in back navigation guards`)};if(l(t))return n.to?{status:`redirect`,target:r(t,n.to.path)}:{status:`failure`,failure:o(e.aborted,n.to,n.from,`Redirect is not supported in back navigation guards`)}}catch(t){return{status:`failure`,failure:o(e.aborted,n.to,n.from,t)}}return{status:`continue`}}function d(e,t,n,r){return new Promise(i=>{let s=!1,c=e=>{s||(s=!0,i(e))};try{let i=e({...t,success:()=>c(),fail:e=>{c(o(a(e),n,r,e))}});i&&typeof i.then==`function`&&i.then(()=>c(),e=>c(o(a(e),n,r,e)))}catch(e){c(o(a(e),n,r,e))}})}async function f(e,t){for(let n of e)try{await n(t.to,t.from,t.failure,t)}catch{}}async function p(e,t,n){for(let r of e)try{await r(t,n)}catch{}}function m(e){return!e||typeof e!=`object`?!1:typeof e.errMsg==`string`}function h(t){return t.type===e.unknown||t.cause instanceof Error||t.type===e.aborted&&t.cause!==void 0&&!(typeof t.cause==`string`||m(t.cause))}export{o as createNavigationFailure,d as executeNavigationMethod,s as isNavigationFailure,c as isNavigationRedirectCandidate,f as runAfterEachHooks,p as runNavigationErrorHooks,u as runNavigationGuards,h as shouldEmitNavigationError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{notifyRouteStateSync as e}from"./routeSync.mjs";import{runAfterEachHooks as t,runNavigationErrorHooks as n,shouldEmitNavigationError as r}from"./navigationCore.mjs";function i(e,t,n,r){return{mode:e,from:t,to:n,failure:r}}function a(i){let{afterEachHooks:a,errorHandlers:o,nativeRouter:s,rejectOnError:c}=i;async function l(e){
|
|
1
|
+
import{notifyRouteStateSync as e}from"./routeSync.mjs";import{runAfterEachHooks as t,runNavigationErrorHooks as n,shouldEmitNavigationError as r}from"./navigationCore.mjs";function i(e,t,n,r){return{mode:e,from:t,to:n,failure:r}}function a(i){let{afterEachHooks:a,errorHandlers:o,nativeRouter:s,rejectOnError:c}=i;async function l(e){await t(a,{mode:e.mode,to:e.to,from:e.from,nativeRouter:s,failure:e.failure}),e.failure&&r(e.failure)&&await n(o,e.failure.cause??e.failure,{mode:e.mode,to:e.to,from:e.from,nativeRouter:s,failure:e.failure})}function u(e){return c&&r(e)}async function d(t){if(t.failure||e(t.to?{route:t.to,source:`router`}:void 0),await l(t),t.failure&&u(t.failure))throw t.failure;return t.failure}return{emitNavigationAfterEach:l,settleNavigationResult:d}}export{a as createNavigationResultController,i as createNavigationRunResult};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createAbsoluteRoutePath as e}from"../routerInternal/path.mjs";import{resolveMatchedRouteRecord as t}from"../routerInternal/matching.mjs";import{createNativeRouteUrl as n,hasLocationQuery as r}from"../routerInternal/snapshots.mjs";import{NavigationFailureType as i}from"./types.mjs";import{createNavigationFailure as a,executeNavigationMethod as o,isNavigationFailure as s,runNavigationGuards as c}from"./navigationCore.mjs";import{createNavigationRunResult as l}from"./navigationResult.mjs";import{applyRedirectedFrom as u,createDuplicatedFailure as d,createHashOnlyNavigationFailure as f,createTabBarQueryFailure as p,createTooManyRedirectsFailure as m,resolveRouteRecordRedirect as h}from"./navigationTargetHelpers.mjs";async function g(g){let{mode:_,target:v,from:y,nativeRouter:b,routeResolveCodec:x,namedRouteLookup:S,beforeEachGuards:C,beforeResolveGuards:w,maxRedirects:T,tabBarPathSet:E,resolveWithCodec:D,executeNative:O=!0,allowSameLocation:k=!1}=g,A=v,j=_,M=0;for(;;){
|
|
1
|
+
import{createAbsoluteRoutePath as e}from"../routerInternal/path.mjs";import{resolveMatchedRouteRecord as t}from"../routerInternal/matching.mjs";import{createNativeRouteUrl as n,hasLocationQuery as r}from"../routerInternal/snapshots.mjs";import{NavigationFailureType as i}from"./types.mjs";import{createNavigationFailure as a,executeNavigationMethod as o,isNavigationFailure as s,runNavigationGuards as c}from"./navigationCore.mjs";import{createNavigationRunResult as l}from"./navigationResult.mjs";import{applyRedirectedFrom as u,createDuplicatedFailure as d,createHashOnlyNavigationFailure as f,createTabBarQueryFailure as p,createTooManyRedirectsFailure as m,resolveRouteRecordRedirect as h}from"./navigationTargetHelpers.mjs";async function g(g){let{mode:_,target:v,from:y,nativeRouter:b,routeResolveCodec:x,namedRouteLookup:S,beforeEachGuards:C,beforeResolveGuards:w,maxRedirects:T,tabBarPathSet:E,resolveWithCodec:D,executeNative:O=!0,allowSameLocation:k=!1}=g,A=v,j=_,M=0;for(;;){let g=E.has(A.path);if(n(A,x.stringifyQuery)===n(y,x.stringifyQuery)&&A.hash!==y.hash)return l(j,y,A,f(A,y));if(!k&&(g?A.path===y.path:A.fullPath===y.fullPath))return l(j,y,A,d(A,y));if(g&&r(A.query))return l(j,y,A,p(A,y));let _=await c(C,{mode:j,to:A,from:y,nativeRouter:b},D);if(_.status===`failure`)return l(j,y,A,_.failure);if(_.status===`redirect`){let e=_.target,t=_.replace===!0?`replace`:_.replace===!1?`push`:j;if(e.fullPath!==A.fullPath||t!==j){if(u(e,A),A=e,j=t,M+=1,M>T)return l(j,y,A,m(A,y,T));continue}}let v=t(A,S)?.matchedRecords??[],N=!1;for(let e of v){if(e.redirect===void 0)continue;let t;try{t=await h(e.redirect,A,y,D)}catch(e){return l(j,y,A,a(i.aborted,A,y,e))}let n=t.replace===!1?`push`:`replace`,r=t.target;if(r.fullPath!==A.fullPath||n!==j){if(u(r,A),A=r,j=n,M+=1,M>T)return l(j,y,A,m(A,y,T));N=!0;break}}if(N)continue;let P=!1;for(let e of v){if(e.beforeEnterGuards.length===0)continue;let t=await c(new Set(e.beforeEnterGuards),{mode:j,to:A,from:y,nativeRouter:b},D);if(t.status===`failure`)return l(j,y,A,t.failure);if(t.status===`redirect`){let e=t.target,n=t.replace===!0?`replace`:t.replace===!1?`push`:j;if(e.fullPath!==A.fullPath||n!==j){if(u(e,A),A=e,j=n,M+=1,M>T)return l(j,y,A,m(A,y,T));P=!0;break}}}if(P)continue;let F=await c(w,{mode:j,to:A,from:y,nativeRouter:b},D);if(F.status===`failure`)return l(j,y,A,F.failure);if(F.status===`redirect`){let e=F.target,t=F.replace===!0?`replace`:F.replace===!1?`push`:j;if(e.fullPath!==A.fullPath||t!==j){if(u(e,A),A=e,j=t,M+=1,M>T)return l(j,y,A,m(A,y,T));continue}}if(!O)return l(j,y,A);if(g){let t=await o(b.switchTab,{url:e(A.path)},A,y);return s(t)?l(j,y,A,t):l(j,y,A)}let I=j===`push`?b.navigateTo:b.redirectTo,L=await o(I,{url:n(A,x.stringifyQuery)},A,y);return s(L)?l(j,y,A,L):l(j,y,A)}}export{g as navigateWithTarget};
|
package/dist/router/resolve.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolvePath as e}from"../routerInternal/path.mjs";import{normalizeHash as t,normalizeQuery as n,normalizeRouteParams as r,parseQuery as i,stringifyQuery as a}from"../routerInternal/query.mjs";import{createRouteLocation as o,parsePathInput as s}from"../routerInternal/location.mjs";const c={parseQuery:i,stringifyQuery:a};function l(i,a=``,l=c){
|
|
1
|
+
import{resolvePath as e}from"../routerInternal/path.mjs";import{normalizeHash as t,normalizeQuery as n,normalizeRouteParams as r,parseQuery as i,stringifyQuery as a}from"../routerInternal/query.mjs";import{createRouteLocation as o,parsePathInput as s}from"../routerInternal/location.mjs";const c={parseQuery:i,stringifyQuery:a};function l(i,a=``,l=c){if(typeof i==`string`){let t=s(i,l),n=e(t.path,a);return o(n,t.query,t.hash,void 0,{},l.stringifyQuery)}let u=typeof i.fullPath==`string`?s(i.fullPath,l):void 0,d=i.path??u?.path??a,f=e(d,a),p=i.query?n(i.query):u?.query??{},m=t(i.hash??u?.hash),h=typeof i.name==`string`?i.name:void 0,g=i.params?r(i.params):{};return o(f,p,m,h,g,l.stringifyQuery)}export{c as DEFAULT_ROUTE_RESOLVE_CODEC,l as resolveRouteLocation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createAbsoluteRoutePath as e}from"../routerInternal/path.mjs";import{collectRouteNamesForRemoval as t}from"../routerInternal/matching.mjs";import{assertValidAddRouteInput as n,warnRouteConfig as r}from"../routerInternal/recordsWarnings.mjs";import{createNamedRouteNameByStaticPath as i,flattenNamedRouteRecords as a,normalizeRouteRecordRaw as o}from"../routerInternal/records.mjs";import{cloneRouteMeta as s}from"../routerInternal/snapshots.mjs";function c(t){let n={name:t.name,path:t.path?`/${t.path}`:`/`};return t.meta!==void 0&&(n.meta=s(t.meta)),t.aliasPaths.length===1?n.alias=e(t.aliasPaths[0]):t.aliasPaths.length>1&&(n.alias=t.aliasPaths.map(t=>e(t))),t.beforeEnterGuards.length===1?n.beforeEnter=t.beforeEnterGuards[0]:t.beforeEnterGuards.length>1&&(n.beforeEnter=t.beforeEnterGuards.slice()),t.redirect!==void 0&&(n.redirect=t.redirect),n}function l(s){let l=e=>s.recordByName.has(e),u=()=>Array.from(s.recordByName.values(),c),d=((c,l)=>{let u=typeof c==`string`?l:c;if(!u)throw Error(`Route record is required when adding a child route`);n(u);let d=typeof c==`string`?c:void 0,f=d?s.recordByName.get(d):void 0;if(d&&!f)throw Error(`Parent route "${d}" is not defined in createRouter({ routes | namedRoutes })`);let p=a([u],f
|
|
1
|
+
import{createAbsoluteRoutePath as e}from"../routerInternal/path.mjs";import{collectRouteNamesForRemoval as t}from"../routerInternal/matching.mjs";import{assertValidAddRouteInput as n,warnRouteConfig as r}from"../routerInternal/recordsWarnings.mjs";import{createNamedRouteNameByStaticPath as i,flattenNamedRouteRecords as a,normalizeRouteRecordRaw as o}from"../routerInternal/records.mjs";import{cloneRouteMeta as s}from"../routerInternal/snapshots.mjs";function c(t){let n={name:t.name,path:t.path?`/${t.path}`:`/`};return t.meta!==void 0&&(n.meta=s(t.meta)),t.aliasPaths.length===1?n.alias=e(t.aliasPaths[0]):t.aliasPaths.length>1&&(n.alias=t.aliasPaths.map(t=>e(t))),t.beforeEnterGuards.length===1?n.beforeEnter=t.beforeEnterGuards[0]:t.beforeEnterGuards.length>1&&(n.beforeEnter=t.beforeEnterGuards.slice()),t.redirect!==void 0&&(n.redirect=t.redirect),n}function l(s){let l=e=>s.recordByName.has(e),u=()=>Array.from(s.recordByName.values(),c),d=((c,l)=>{let u=typeof c==`string`?l:c;if(!u)throw Error(`Route record is required when adding a child route`);n(u);let d=typeof c==`string`?c:void 0,f=d?s.recordByName.get(d):void 0;if(d&&!f)throw Error(`Parent route "${d}" is not defined in createRouter({ routes | namedRoutes })`);let p=a([u],f?.path,d,f?.aliasPaths,void 0,`addRoute`);if(p.length===0)throw Error(`Route name and path are required when adding a named route`);let m=[];for(let n of p){let i=o(n.route,n.parentName);if(!i)continue;let a=s.recordByName.get(i.name);if(a){let n=t(a.name,s.recordByName);for(let e of n)s.recordByName.delete(e);r(`addRoute() replaced existing route "${i.name}" (${e(a.path)} -> ${e(i.path)}) and removed ${n.size-1} nested route(s)`)}s.recordByName.set(i.name,i),m.push(i)}return s.nameByStaticPath=i(s.recordByName),()=>{let e=!1;for(let t of m)s.recordByName.get(t.name)===t&&(s.recordByName.delete(t.name),e=!0);e&&(s.nameByStaticPath=i(s.recordByName))}});function f(e){let n=t(e,s.recordByName);if(n.size===0)return;let r=!1;for(let e of n)r=s.recordByName.delete(e)||r;r&&(s.nameByStaticPath=i(s.recordByName))}function p(){s.recordByName.clear(),s.nameByStaticPath.clear()}return{hasRoute:l,getRoutes:u,addRoute:d,removeRoute:f,clearRoutes:p}}export{l as createRouteRegistry};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentMiniProgramPages as e}from"../runtime/platform.mjs";const t=[`switchTab`,`reLaunch`,`redirectTo`,`navigateTo`,`navigateBack`],n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new WeakSet;function i(e){return n.add(e),()=>{n.delete(e)}}function a(e){for(let t of n)try{t(e)}catch
|
|
1
|
+
import{getCurrentMiniProgramPages as e}from"../runtime/platform.mjs";const t=[`switchTab`,`reLaunch`,`redirectTo`,`navigateTo`,`navigateBack`],n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new WeakSet;function i(e){return n.add(e),()=>{n.delete(e)}}function a(e){for(let t of n)try{t(e)}catch{}}function o(e,t,n){if(e===`navigateBack`)return{method:e,source:`native`};if(t&&typeof t==`object`){let r=t.url;if(typeof r==`string`)return{method:e,page:n,source:`native`,url:r}}return{method:e,page:n,source:`native`}}function s(n){if(!n||typeof n!=`object`)return;let i=n;if(!r.has(i)){r.add(i);for(let n of t){let t=i[n];typeof t==`function`&&(i[n]=function(r,...i){let s=e(),c=s[s.length-1],l=!1,u=()=>{l||(l=!0,a(o(n,r,c)))},d=r&&typeof r==`object`?{...r,success:(...e)=>{u();let t=r.success;return typeof t==`function`?t(...e):void 0}}:r,f=t.call(this,d,...i);return f&&typeof f.then==`function`&&f.then(u,()=>{}),f})}}}export{s as installRouteStateSyncOnNativeRouter,a as notifyRouteStateSync,i as registerRouteStateSyncHandler};
|
package/dist/router/useRoute.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"../runtime/platform.mjs";import{getCurrentSetupContext as r}from"../runtime/hooks/base.mjs";import{onLoad as i,onReady as a,onRouteDone as o,onShow as s,onUnload as c}from"../runtime/hooks/register.mjs";import{
|
|
1
|
+
import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"../runtime/platform.mjs";import{getCurrentSetupContext as r}from"../runtime/hooks/base.mjs";import{onLoad as i,onReady as a,onRouteDone as o,onShow as s,onUnload as c}from"../runtime/hooks/register.mjs";import{registerRouteStateSyncHandler as l}from"./routeSync.mjs";import{resolveCurrentRoute as u,resolvePageRoute as d}from"../routerInternal/location.mjs";import{cloneLocationQuery as f,cloneRouteLocationRedirectedFrom as p,cloneRouteMeta as m,cloneRouteParams as h,cloneRouteRecordMatchedList as g}from"../routerInternal/snapshots.mjs";import{useNativePageRouter as _,useNativeRouter as v}from"../runtime/vueCompat/router.mjs";import{getActiveRouter as y}from"./instance.mjs";import{resolveRouteLocation as b}from"./resolve.mjs";import{WEVU_NATIVE_INSTANCE_KEY as x}from"@weapp-core/constants";function S(e){return typeof e.route==`string`||typeof e.__route__==`string`}function C(e){let t=e[x];return t&&typeof t==`object`?t:e}function w(e,t,r){if(r?.source===`router`||!t)return!0;let i=C(e);if(r?.page)return r.page===i;let a=n();return a[a.length-1]===i}function T(e,t){e.path=t.path,e.fullPath=t.fullPath,e.query=f(t.query),e.hash=t.hash,e.params=h(t.params),t.name===void 0?delete e.name:e.name=t.name,t.meta===void 0?delete e.meta:e.meta=m(t.meta),t.href===void 0?delete e.href:e.href=t.href,t.matched===void 0?delete e.matched:e.matched=g(t.matched),t.redirectedFrom===void 0?delete e.redirectedFrom:e.redirectedFrom=p(t.redirectedFrom)}function E(p={}){let m=r(),g=m?.instance&&typeof m.instance==`object`?m.instance:void 0,_=p.resolveRoute??(e=>y()?.resolve(e)??e),v=_(u(void 0,g)),x=e({path:v.path,fullPath:v.fullPath,query:f(v.query),hash:v.hash,params:h(v.params)});T(x,v);function E(e,t,n){let r=_(t||u(e,g));n&&p.beforeRouteStateSync?.(r,n),T(x,r)}if(!g)return l(e=>{if(e?.route){E(void 0,e.route,e);return}if(e?.url){E(void 0,b(e.url,x.path),e);return}if(e?.page){E(void 0,d(e.page),e);return}E(void 0,void 0,e)}),{route:t(x)};let D=g,O=C(D),k=S(O)||n().includes(O);i(e=>{E(e)}),a(()=>{E()}),s(()=>{E()}),o(()=>{E()});let A=l(e=>{if(w(D,k,e)){if(e?.route){E(void 0,e.route,e);return}if(e?.url){E(void 0,b(e.url,x.path),e);return}if(e?.page){E(void 0,d(e.page),e);return}E(void 0,void 0,e)}});return c(()=>{A()}),{route:t(x)}}function D(e={}){return E(e).route}function O(){return v()}function k(){return _()}export{E as createRouteStateController,k as useNativePageRouter,O as useNativeRouter,D as useRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentMiniProgramPages as e}from"../runtime/platform.mjs";import{getCurrentPageInstance as t}from"../runtime/register/component/lifecycle/platform.mjs";import{createAbsoluteRoutePath as n,resolvePath as r}from"./path.mjs";import{normalizeHash as i,normalizeQuery as a,parseQuery as o,stringifyQuery as s}from"./query.mjs";const c={parseQuery:o,stringifyQuery:s};function l(e,t=c){let n=e.indexOf(`#`),r=n>=0?e.slice(0,n):e,o=n>=0?i(e.slice(n+1)):``,s=r.indexOf(`?`);return s<0?{path:r,query:{},hash:o}:{path:r.slice(0,s),query:a(t.parseQuery(r.slice(s+1))),hash:o}}function u(e,t,a=``,o,c={},l=s){let u=r(e,``),d=l(t),f=n(u),p=i(a),m=d?`${f}?${d}`:f,h={path:u,fullPath:p?`${m}${p}`:m,query:t,hash:p,params:c};return o!==void 0&&(h.name=o),h}function d(e){return typeof
|
|
1
|
+
import{getCurrentMiniProgramPages as e}from"../runtime/platform.mjs";import{getCurrentPageInstance as t}from"../runtime/register/component/lifecycle/platform.mjs";import{createAbsoluteRoutePath as n,resolvePath as r}from"./path.mjs";import{normalizeHash as i,normalizeQuery as a,parseQuery as o,stringifyQuery as s}from"./query.mjs";const c={parseQuery:o,stringifyQuery:s};function l(e,t=c){let n=e.indexOf(`#`),r=n>=0?e.slice(0,n):e,o=n>=0?i(e.slice(n+1)):``,s=r.indexOf(`?`);return s<0?{path:r,query:{},hash:o}:{path:r.slice(0,s),query:a(t.parseQuery(r.slice(s+1))),hash:o}}function u(e,t,a=``,o,c={},l=s){let u=r(e,``),d=l(t),f=n(u),p=i(a),m=d?`${f}?${d}`:f,h={path:u,fullPath:p?`${m}${p}`:m,query:t,hash:p,params:c};return o!==void 0&&(h.name=o),h}function d(e){return typeof e?.route==`string`&&e.route.length>0||typeof e?.__route__==`string`&&e.__route__.length>0}function f(n){let r=e();if(Array.isArray(r)&&r.length>0){let e=r[r.length-1];if(d(e))return e}let i=t();return d(i)?i:n}function p(e,t){if(!e)return u(``,{});let n=typeof e.route==`string`?e.route:typeof e.__route__==`string`?e.__route__:``,r=t??e.options??{};return u(n,a(r),``,void 0,{})}function m(e,t){return p(f(t),e)}export{u as createRouteLocation,l as parsePathInput,m as resolveCurrentRoute,p as resolvePageRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{normalizeRouteParams as e}from"./query.mjs";const t=/^:(\w+)(?:\([^)]*\))?([+*?])?$/;function n(e){
|
|
1
|
+
import{normalizeRouteParams as e}from"./query.mjs";const t=/^:(\w+)(?:\([^)]*\))?([+*?])?$/;function n(e){let n=t.exec(e);if(n)return{key:n[1],modifier:n[2]??``}}function r(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function i(e){return encodeURIComponent(e)}function a(e){try{return decodeURIComponent(e)}catch{return e}}function o(e,t,a){let o=[],s=/* @__PURE__ */ new Set;for(let c of e.split(`/`)){if(!c)continue;let e=n(c);if(!e){o.push(c);continue}let l=r(t[e.key]);if(e.modifier===``){if(l.length!==1)throw Error(`Missing required param "${e.key}" for named route "${a}"`);s.add(e.key),o.push(i(l[0]));continue}if(e.modifier===`?`){if(l.length===0)continue;if(l.length>1)throw Error(`Param "${e.key}" for named route "${a}" must be a single value`);s.add(e.key),o.push(i(l[0]));continue}if(e.modifier===`+`){if(l.length===0)throw Error(`Missing required repeatable param "${e.key}" for named route "${a}"`);s.add(e.key);for(let e of l)o.push(i(e));continue}l.length>0&&s.add(e.key);for(let e of l)o.push(i(e))}return{path:o.join(`/`),consumedKeys:s}}function s(e){return e===void 0?!1:!Array.isArray(e)||e.length>0}function c(e,t,n){let r=Object.keys(e).filter(e=>!t.has(e)).filter(t=>s(e[t]));if(r.length!==0)throw Error(`Unexpected params for named route "${n}": ${r.join(`, `)}`)}function l(t,n,r){let i=t.name;if(typeof i!=`string`||!i||t.path!==void 0||t.fullPath!==void 0)return t;let a=n.recordByName.get(i);if(!a)throw Error(`Named route "${i}" is not defined in createRouter({ routes | namedRoutes })`);let s=t.params?e(t.params):{},l=o(a.path,s,i);return r===`strict`&&c(s,l.consumedKeys,i),{...t,path:l.path?`/${l.path}`:`/`,params:s}}export{a as decodeRouteParamSegment,n as parsePathParamToken,l as resolveNamedRouteLocation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createAbsoluteRoutePath as e,isDynamicRoutePath as t,resolvePath as n}from"./path.mjs";import{warnRouteConfig as r}from"./recordsWarnings.mjs";function i(e){return e?Array.isArray(e)?e:[e]:[]}function a(e,t,n=`namedRoutes`){return typeof e.name==`string`&&e.name.trim()?e.name.trim():n===`routes`?t||`/`:``}function o(e,t){if(!e)return[];let r=Array.isArray(e)?e:[e],i=[];for(let e of r){if(typeof e!=`string`)continue;let r=n(e,``);r&&r!==t&&(i.includes(r)||i.push(r))}return i}function s(e,t,r=`namedRoutes`){let s=n(e.path,``);if(!s&&e.path!==`/`)return;let c=a(e,s,r);if(c)return{name:c,path:s,aliasPaths:o(e.alias,s),parentName:t,meta:e.meta,beforeEnterGuards:i(e.beforeEnter),redirect:e.redirect}}function c(t,r){return!r||t.startsWith(`/`)?n(t,``):n(`${e(r)}/${t}`,``)}function l(e){return e?Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]:[]}function u(e){let t=[];for(let n of e)n&&!t.includes(n)&&t.push(n);return t}function d(t){if(t.length!==0)return t.length===1?e(t[0]):t.map(t=>e(t))}function f(t,n,i,o=[],s,p=`namedRoutes`,m=/* @__PURE__ */ new Set){let h=[];for(let[g,_]of t.entries()){let t=`${p}[${g}]`;if(m.has(_)){r(`ignored route record at ${t}: detected circular children reference`);continue}if(typeof _.path!=`string`||!_.path){let e=typeof
|
|
1
|
+
import{createAbsoluteRoutePath as e,isDynamicRoutePath as t,resolvePath as n}from"./path.mjs";import{warnRouteConfig as r}from"./recordsWarnings.mjs";function i(e){return e?Array.isArray(e)?e:[e]:[]}function a(e,t,n=`namedRoutes`){return typeof e.name==`string`&&e.name.trim()?e.name.trim():n===`routes`?t||`/`:``}function o(e,t){if(!e)return[];let r=Array.isArray(e)?e:[e],i=[];for(let e of r){if(typeof e!=`string`)continue;let r=n(e,``);r&&r!==t&&(i.includes(r)||i.push(r))}return i}function s(e,t,r=`namedRoutes`){let s=n(e.path,``);if(!s&&e.path!==`/`)return;let c=a(e,s,r);if(c)return{name:c,path:s,aliasPaths:o(e.alias,s),parentName:t,meta:e.meta,beforeEnterGuards:i(e.beforeEnter),redirect:e.redirect}}function c(t,r){return!r||t.startsWith(`/`)?n(t,``):n(`${e(r)}/${t}`,``)}function l(e){return e?Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]:[]}function u(e){let t=[];for(let n of e)n&&!t.includes(n)&&t.push(n);return t}function d(t){if(t.length!==0)return t.length===1?e(t[0]):t.map(t=>e(t))}function f(t,n,i,o=[],s,p=`namedRoutes`,m=/* @__PURE__ */ new Set){let h=[];for(let[g,_]of t.entries()){let t=`${p}[${g}]`;if(m.has(_)){r(`ignored route record at ${t}: detected circular children reference`);continue}if(typeof _.path!=`string`||!_.path){let e=typeof _?.name==`string`?_.name.trim():``;r(`ignored route record "${e}" at ${t}: route path is required`);continue}let v=c(_.path,n),y=a(_,v,s);if(!y){r(`ignored route record at ${t}: route name is required`);continue}let b=[],x=/* @__PURE__ */ new Map;for(let i of l(_.alias)){let a=c(i,n);if(!a)continue;if(a===v){r(`ignored alias "${e(a)}" for route "${y}" at ${t}: alias is same as route path`);continue}let o=x.get(a);if(o){r(`ignored duplicate alias "${e(a)}" for route "${y}" at ${t}: already declared by "${o}"`);continue}x.set(a,i),b.push(a)}let S=_.path.startsWith(`/`)?[]:o.map(e=>c(_.path,e)).filter(Boolean).filter(e=>e!==v),C=u([...b,...S]),w={name:y,path:v?e(v):`/`,alias:d(C),meta:_.meta,beforeEnter:_.beforeEnter,redirect:_.redirect};if(h.push({route:w,parentName:i,source:s}),Array.isArray(_.children)&&_.children.length>0){let e=new Set(m);e.add(_),h.push(...f(_.children,v,y,C,s,`${t}.children`,e))}}return h}function p(e,t=`namedRoutes`){if(!e)return[];if(Array.isArray(e))return f(e,void 0,void 0,[],t,t);let n=[];for(let[i,a]of Object.entries(e)){let e=typeof i==`string`?i.trim():``;if(!e){r(`ignored route record at ${t}: route name is required`);continue}if(typeof a!=`string`||!a){r(`ignored route record "${e}" at ${t}: route path is required`);continue}n.push({route:{name:e,path:a},source:t})}return n}function m(e){return[...p(e.routes,`routes`),...p(e.namedRoutes,`namedRoutes`)]}function h(e){let n=/* @__PURE__ */ new Map;for(let[r,i]of e.entries()){!t(i.path)&&!n.has(i.path)&&n.set(i.path,r);for(let e of i.aliasPaths)!t(e)&&!n.has(e)&&n.set(e,r)}return n}function g(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=s(n.route,n.parentName,n.source);e&&t.set(e.name,e)}return{recordByName:t,nameByStaticPath:h(t)}}export{g as createNamedRouteLookup,h as createNamedRouteNameByStaticPath,d as createRouteRecordAliasValue,f as flattenNamedRouteRecords,s as normalizeRouteRecordRaw,m as resolveRouteOptionEntries};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createAbsoluteRoutePath as e,resolvePath as t}from"./path.mjs";function n(e){typeof console<`u`&&typeof console.warn==`function`&&console.warn(`[wevu/router] ${e}`)}function r(n){let r=t(n,``);return r?e(r):`/`}function i(e,t=/* @__PURE__ */ new Set){if(t.has(e))return!0;if(!Array.isArray(e.children)||e.children.length===0)return!1;let n=new Set(t);n.add(e);for(let t of e.children)if(i(t,n))return!0;return!1}function a(e){let t=typeof e.name==`string`?e.name.trim():``;if(!t)throw Error(`Route name is required when adding a named route`);if(typeof e.path!=`string`||!e.path)throw Error(`Route path is required when adding named route "${t}"`);if(i(e))throw Error(`Circular children reference detected when adding named route "${t}"`)}function o(e){let t=/* @__PURE__ */ new Map,i=[];for(let n of e){
|
|
1
|
+
import{createAbsoluteRoutePath as e,resolvePath as t}from"./path.mjs";function n(e){typeof console<`u`&&typeof console.warn==`function`&&console.warn(`[wevu/router] ${e}`)}function r(n){let r=t(n,``);return r?e(r):`/`}function i(e,t=/* @__PURE__ */ new Set){if(t.has(e))return!0;if(!Array.isArray(e.children)||e.children.length===0)return!1;let n=new Set(t);n.add(e);for(let t of e.children)if(i(t,n))return!0;return!1}function a(e){let t=typeof e.name==`string`?e.name.trim():``;if(!t)throw Error(`Route name is required when adding a named route`);if(typeof e.path!=`string`||!e.path)throw Error(`Route path is required when adding named route "${t}"`);if(i(e))throw Error(`Circular children reference detected when adding named route "${t}"`)}function o(e){let t=/* @__PURE__ */ new Map,i=[];for(let n of e){let e=typeof n.route.name==`string`?n.route.name.trim():``;if(!e)continue;let a=n.source??`namedRoutes`,o=r(n.route.path),s=t.get(e);s&&i.push(`"${e}" (${s.source}:${s.path} -> ${a}:${o})`),t.set(e,{source:a,path:o})}i.length!==0&&n(`duplicate route names detected, later entries override earlier ones: ${i.join(`, `)}`)}export{a as assertValidAddRouteInput,o as warnDuplicateRouteEntries,n as warnRouteConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_HOST_COMMIT_PROMISE_KEY as f,WEVU_INLINE_MAP_KEY as p,WEVU_NATIVE_INSTANCE_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROPS_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_APP_KEY as v,WEVU_RUNTIME_KEY as y}from"@weapp-core/constants";function b(b){let{state:x,setupState:S,computedDefs:C,methodDefs:w,appConfig:T,includeComputed:E,setDataStrategy:D}=b,O={},{computedRefs:k,computedSetters:A,dirtyComputedKeys:j,createTrackedComputed:M,computedProxy:N}=u({includeComputed:E,setDataStrategy:D}),P=r(0),F=Object.create(null),I=(e,n)=>{let r=t(e),i=r[y],a=i
|
|
1
|
+
import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_HOST_COMMIT_PROMISE_KEY as f,WEVU_INLINE_MAP_KEY as p,WEVU_NATIVE_INSTANCE_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROPS_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_APP_KEY as v,WEVU_RUNTIME_KEY as y}from"@weapp-core/constants";function b(b){let{state:x,setupState:S,computedDefs:C,methodDefs:w,appConfig:T,includeComputed:E,setDataStrategy:D}=b,O={},{computedRefs:k,computedSetters:A,dirtyComputedKeys:j,createTrackedComputed:M,computedProxy:N}=u({includeComputed:E,setDataStrategy:D}),P=r(0),F=Object.create(null),I=(e,n)=>{let r=t(e),i=r[y],a=i?.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[m];if(s(l))return l;let u=i?.instance;if(s(u))return u},L=e=>{if(i(O,e))return;let t=(...t)=>{let n=I(x,x);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),O[e]=t},R=(e,t)=>{let n=/* @__PURE__ */ new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=r[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[h]}let a=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof a==`function`)try{let e=a()?.[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]}}catch{}return{found:!1,value:void 0}},z=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{let n=t.call(e);if(!n||typeof n!=`object`)return;let r=Reflect.get(n,_);if(typeof r==`function`){let e=r.call(n);if(e)return e}return n[y]?.proxy??n.__wevu?.proxy??n}catch{return}},B=new Proxy(x,{get(n,r,a){if(typeof r==`string`){if(P.value,i(S,r))return Reflect.get(S,r,a);if(r===`props`){let e=n[g];if(e&&typeof e==`object`)return e}if(r===`$props`){let e=n[g];if(e&&typeof e==`object`)return e}let c=n[g];if(c&&typeof c==`object`&&i(c,r))return Reflect.get(c,r);if(r===`data`||r===`$state`)return x;if(r===`$computed`)return N;if(r===`$emit`)return(e,...t)=>{let r=I(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return async t=>{await e();let r=I(n,a),i=r&&Reflect.get(r,f);if(i&&(typeof i==`object`||typeof i==`function`)&&`then`in i&&typeof i.then==`function`&&await i,t)return t.call(B)};if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`)return t(n).$slots??Object.freeze(Object.create(null));if(r===`$refs`)return t(n).$refs??Object.create(null);if(r===`$parent`)return z(I(n,a));if(r===`$options`){let e=I(n,a);return{name:e?.[d]??e?.name??e?.is}}if(i(F,r))return Reflect.get(F,r);if(i(O,r))return O[r];if(k[r])return k[r].value;if(i(T.globalProperties,r))return T.globalProperties[r];let l=R(I(n,a),r);if(l.found)return l.value}if(!Reflect.has(n,r)){let e=I(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let c=Reflect.get(n,r,a);return typeof r==`string`&&i(S,r)?Reflect.get(S,r,a):c},set(e,t,r,o){if(typeof t==`string`&&k[t])return a(A,t,r),!0;if(i(S,t)){let e=Reflect.get(S,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(S,t,r,o)}if(i(F,t))return Reflect.set(F,t,r);if(Reflect.has(e,t)){let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i(e[g]??{},t)?Reflect.set(S,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(F,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(S,t)||k[t]||i(O,t))||i(F,t))return!0;let n=I(e,e);return typeof t==`string`&&R(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=/* @__PURE__ */ new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(S).forEach(e=>{t.add(e)}),Reflect.ownKeys(F).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),Object.keys(k).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(S,t))return Object.getOwnPropertyDescriptor(S,t);if(i(F,t))return Object.getOwnPropertyDescriptor(F,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return x}};if(k[t])return{configurable:!0,enumerable:!0,get(){return k[t].value},set(e){a(A,t,e)}};if(i(O,t))return{configurable:!0,enumerable:!1,value:O[t]}}}});return Object.keys(w).forEach(e=>{let t=w[e];if(typeof t==`function`){O[e]=(...e)=>t.apply(B,e);return}e===p&&t&&typeof t==`object`&&(O[e]=t)}),L(`triggerEvent`),L(`createSelectorQuery`),L(`createIntersectionObserver`),L(`setData`),Object.keys(C).forEach(e=>{let t=C[e];if(typeof t==`function`)k[e]=M(e,()=>t.call(B));else{let n=t.get?.bind(B);if(!n)throw Error(`计算属性 "${e}" 需要提供 getter`);let r=t.set?.bind(B);r?(A[e]=r,k[e]=M(e,n,r)):k[e]=M(e,n)}}),{boundMethods:O,computedRefs:k,computedSetters:A,dirtyComputedKeys:j,computedProxy:N,publicInstance:B,touchSetupMethodsVersion(){P.value+=1}}}export{b as createRuntimeContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e!==`patch`&&e!==`diff`}function t(t){if(t!==`off`)return n=>{
|
|
1
|
+
function e(e){return e!==`patch`&&e!==`diff`}function t(t){if(t!==`off`)return n=>{if(t===`fallback`&&!e(n.reason))return;let r=typeof n.bytes==`number`?n.bytes:n.estimatedBytes,i=typeof r==`number`?`${r}B`:`unknown`,a=[`mode=${n.mode}`,`reason=${n.reason}`,`pending=${n.pendingPatchKeys}`,`keys=${n.payloadKeys}`,`bytes=${i}`];if(typeof n.revision==`number`&&a.push(`revision=${n.revision}`),typeof n.committedRevision==`number`&&a.push(`committedRevision=${n.committedRevision}`),typeof n.mergedSiblingParents==`number`&&a.push(`mergedParents=${n.mergedSiblingParents}`),typeof n.computedDirtyKeys==`number`&&a.push(`computedDirty=${n.computedDirtyKeys}`),typeof n.flushCount==`number`&&a.push(`flushes=${n.flushCount}`),typeof n.windowMs==`number`&&a.push(`window=${n.windowMs}ms`),n.targetLabel&&a.push(`target=${n.targetLabel}`),n.bindings?.length){let e=n.bindings.map(e=>{let t=e.sourceLocation?.start;return t?`${e.id}@${e.sourceFile}:${t.line}:${t.column}`:`${e.id}@${e.sourceFile}`});a.push(`bindings=${e.join(`,`)}`)}n.message&&a.push(`message=${n.message}`);let o=`[wevu:setData] ${a.join(` `)}`;if(e(n.reason)){console.warn(o);return}console.info(o)}}export{t as createDiagnosticsLogger};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{queueJob as e}from"../../scheduler.mjs";import{effect as t,stop as n}from"../../reactivity/core.mjs";import{touchReactive as r}from"../../reactivity/reactive/patch.mjs";import{shallowReactive as i}from"../../reactivity/reactive/shallow.mjs";import{isReactive as a,reactive as o}from"../../reactivity/reactive.mjs";import{watch as ee}from"../../reactivity/watch.mjs";import{requireRuntimeCapability as s}from"../capabilities.mjs";import{hasOwn as c}from"../../utils.mjs";import{createBindModel as te}from"../bindModel.mjs";import{hasTrackableSetupBinding as ne,touchSetupBinding as re}from"../setupTracking.mjs";import{createRuntimeContext as ie}from"./context.mjs";import{createDiagnosticsLogger as l}from"./diagnostics.mjs";import{createSetDataScheduler as
|
|
1
|
+
import{queueJob as e}from"../../scheduler.mjs";import{effect as t,stop as n}from"../../reactivity/core.mjs";import{touchReactive as r}from"../../reactivity/reactive/patch.mjs";import{shallowReactive as i}from"../../reactivity/reactive/shallow.mjs";import{isReactive as a,reactive as o}from"../../reactivity/reactive.mjs";import{watch as ee}from"../../reactivity/watch.mjs";import{requireRuntimeCapability as s}from"../capabilities.mjs";import{hasOwn as c}from"../../utils.mjs";import{createBindModel as te}from"../bindModel.mjs";import{hasTrackableSetupBinding as ne,touchSetupBinding as re}from"../setupTracking.mjs";import{createRuntimeContext as ie}from"./context.mjs";import{createDiagnosticsLogger as l}from"./diagnostics.mjs";import{createSetDataScheduler as ae}from"./setData/scheduler.mjs";import{resolveSetDataOptions as oe}from"./setDataOptions.mjs";import{WEVU_ATTRS_KEY as se,WEVU_PROPS_DERIVED_KEYS_KEY as u,WEVU_PROPS_KEY as d,WEVU_SETUP_STATE_KEY as f}from"@weapp-core/constants";function p(e,t){let n=(()=>{e()});return n.stop=()=>n(),n.pause=()=>{t?.pause?.()},n.resume=()=>{t?.resume?.()},n}function ce(e){return typeof e==`function`?e():e??{}}function m(m){let{data:le,resolvedComputed:ue,resolvedMethods:de,appConfig:h,setDataOptions:g,bindingManifest:_}=m;return m=>{g?.strategy===`patch`&&s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`);let v=ce(le),y=m?.__wevu_initialProps;if(v&&typeof v==`object`&&!c(v,d))try{Object.defineProperty(v,d,{value:i(Object.create(null)),configurable:!0,enumerable:!1,writable:!1})}catch{}let b=v&&typeof v==`object`?v[d]:void 0;b&&typeof b==`object`&&y&&typeof y==`object`&&Object.assign(b,y);let x=o(v),S=o(Object.create(null)),C=m?.__wevu_snapshotOmitKeys,fe=!!m?.__wevu_deferInitialSnapshot,w=m?.__wevu_initialSnapshot,T=m?.__wevu_initialState,E=new Set(C instanceof Set||Array.isArray(C)?C:[]);if(v&&typeof v==`object`&&!c(v,f))try{Object.defineProperty(v,f,{value:S,configurable:!0,enumerable:!1,writable:!1})}catch{}if(v&&typeof v==`object`&&T&&typeof T==`object`)for(let[e,t]of Object.entries(T))E.has(e)||(v[e]=t);let pe=ue,me=de,D=!0,O=[],k=/* @__PURE__ */ new Set;Object.keys(x).forEach(e=>{let t=x[e];ne(t)&&k.add(e)});let{includeComputed:A,setDataStrategy:j,maxPatchKeys:M,maxPayloadBytes:N,mergeSiblingThreshold:P,mergeSiblingMaxInflationRatio:F,mergeSiblingMaxParentBytes:I,mergeSiblingSkipArray:L,computedCompare:R,computedCompareMaxDepth:z,computedCompareMaxKeys:he,prelinkMaxDepth:ge,prelinkMaxKeys:_e,debug:B,diagnostics:V,loopWarning:H,debugWhen:ve,debugSampleRate:ye,elevateTopKeyThreshold:be,toPlainMaxDepth:xe,toPlainMaxKeys:Se,includeFunctions:Ce,functionPaths:we,shouldIncludeKey:Te}=oe(g),U=l(V),W=V===`off`&&H?l(`fallback`):void 0,Ee=B||U||W?e=>{if(typeof B==`function`)try{B(e)}catch{}U?.(e),e.reason===`loopWarning`&&W?.(e)}:void 0,De=V===`always`?`always`:ve,{boundMethods:Oe,computedRefs:G,computedSetters:ke,dirtyComputedKeys:Ae,computedProxy:je,publicInstance:K,touchSetupMethodsVersion:q}=ie({state:x,setupState:S,computedDefs:pe,methodDefs:me,appConfig:h,includeComputed:A,setDataStrategy:j}),J=m??{setData:()=>{}},Me=J.__wevu_targetLabel,Y,X={state:x,setupState:S,snapshotOmitKeys:E,computedRefs:G,dirtyComputedKeys:Ae,includeComputed:A,setDataStrategy:j,computedCompare:R,computedCompareMaxDepth:z,computedCompareMaxKeys:he,currentAdapter:J,shouldIncludeKey:Te,maxPatchKeys:M,maxPayloadBytes:N,mergeSiblingThreshold:P,mergeSiblingMaxInflationRatio:F,mergeSiblingMaxParentBytes:I,mergeSiblingSkipArray:L,elevateTopKeyThreshold:be,prelinkMaxDepth:ge,prelinkMaxKeys:_e,toPlainMaxDepth:xe,toPlainMaxKeys:Se,includeFunctions:Ce,functionPaths:we,debug:Ee,debugWhen:De,debugSampleRate:ye,bindingManifest:_,loopWarning:H,targetLabel:Me,runTracker:()=>Y?.(),isMounted:()=>D,initialSnapshot:w&&typeof w==`object`?w:void 0,initialState:T&&typeof T==`object`?T:void 0},Z=j===`patch`?s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`).createScheduler(X):ae(X),Q=()=>Z.job();Y=t(()=>{r(x);let e=x[d];a(e)&&r(e);let t=x[se];a(t)&&r(t),k.forEach(e=>{let t=S[e]??x[e];re(t)})},{lazy:!0,scheduler:()=>e(Q)}),fe||Q(),O.push(p(()=>n(Y))),Z.start?.(),Z.dispose&&O.push(p(Z.dispose));function Ne(e,t,n){let r=ee(e,(e,n)=>t(e,n),n);return O.push(r),p(()=>{r();let e=O.indexOf(r);e>=0&&O.splice(e,1)},r)}let $={get state(){return x},get setupState(){return S},get proxy(){return K},get methods(){return Oe},get computed(){return je},get adapter(){return J},bindModel:te(K,x,G,ke,S),watch:Ne,snapshot:()=>Z.snapshot(),unmount:()=>{if(D){D=!1,Z.dispose?.();try{J.__wevu_disposeSetData?.()}catch{}O.forEach(e=>{try{e()}catch{}}),O.length=0}}};try{Object.defineProperty($,"__wevu_touchSetupMethodsVersion",{value:q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_touchSetupMethodsVersion=q}try{Object.defineProperty($,"__wevu_flushSetupSnapshotSync",{value:Q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_flushSetupSnapshotSync=Q}try{Object.defineProperty($,"__wevu_cloneDispatchedSnapshot",{value:Z.cloneLatestSnapshot,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_cloneDispatchedSnapshot=Z.cloneLatestSnapshot}try{Object.defineProperty($,"__wevu_trackSetupReactiveKey",{value:e=>{k.add(e)},configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_trackSetupReactiveKey=e=>{k.add(e)}}try{Object.defineProperty($,u,{value:E,configurable:!0,enumerable:!1,writable:!1})}catch{$[u]=E}return $}}export{m as createRuntimeMount};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cloneSnapshotValue as e}from"./snapshot.mjs";const t=Promise.resolve();function n(e){return!(!e||typeof e!=`object`&&typeof e!=`function`||typeof e.then!=`function`)}function r(e){try{return e instanceof Error?e.message:String(e)}catch
|
|
1
|
+
import{cloneSnapshotValue as e}from"./snapshot.mjs";const t=Promise.resolve();function n(e){return!(!e||typeof e!=`object`&&typeof e!=`function`||typeof e.then!=`function`)}function r(e){try{return e instanceof Error?e.message:String(e)}catch{return`<unprintable cause>`}}function i(e,t,n){let i=r(n),a=/* @__PURE__ */ Error(`[wevu] setData commit failed (${e===`adapter`?`adapter failure`:`out-of-order completion`}, revision=${t.revision}, mode=${t.mode}, kind=${t.kind}): ${i}`);return a.cause=n,a}function a(e){let t=!1,r=!0,i=!1,a=!1,o=(n,r)=>{t||(t=!0,e.settle(n,r))},s=()=>{if(r){i=!0;return}a||e.completion===`callback`&&o(`committed`)};try{let t=e.invoke(s),c=n(t);if(a=c,r=!1,c){t.then(()=>o(`committed`),e=>o(`failed`,e));return}(e.completion===`return`||i)&&o(`committed`)}catch(e){r=!1,o(`failed`,e)}}function o(n){let r=n.initialSnapshot?e(n.initialSnapshot):{},o=new Set(Object.keys(r)),s=0,c=0,l,u;function d(e){return e.inLedger?(e.commitPromise||(e.commitPromise=new Promise(t=>{e.resolveCommit=t})),e.commitPromise):t}let f={preparedSnapshot:r,dispatchedSnapshot:r,committedSnapshot:r,revision:0,committedRevision:0,failedRevision:void 0,needsFullSnapshot:!1,get commitPromise(){return u?d(u):t},disposed:!1},p=(e,t,r)=>{let a=i(e,t,r);try{n.onFailure({kind:e,revision:t.revision,committedRevision:f.committedRevision,mode:t.mode,cause:r,error:a,payloadKeys:t.payloadKeys,pendingPatchKeys:t.pendingPatchKeys})}catch{}},m=e=>{e.resolveCommit?.(),e.resolveCommit=void 0},h=e=>{let t=l;for(;t;){let n=t.next;if(t.inLedger=!1,t.next=void 0,m(t),t===e){l=n,l||(u=void 0);return}t=n}},g=()=>{let e=l;for(;e;){let t=e.next;e.inLedger=!1,e.next=void 0,e.physicalSettled||(e.status=`abandoned`),m(e),e=t}l=void 0,u=void 0,s+=1,c=f.committedRevision},_=()=>{f.needsFullSnapshot=!0},v=(e,t,n)=>{t.status=`failed`,f.failedRevision=t.revision,_(),g(),p(e,t,n)},y=()=>{for(;l?.status===`succeeded`;){let e=l;f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,l=e.next,e.inLedger=!1,e.next=void 0,m(e)}l||(u=void 0)},b=e=>{f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,f.failedRevision=void 0,f.needsFullSnapshot=!1,h(e),y()},x=(e,t,n)=>{if(t===`failed`){p(`adapter`,e,n);return}t===`committed`&&f.committedRevision>e.revision&&(l&&g(),_(),p(`out-of-order`,e,`revision ${e.revision} completed after committed revision ${f.committedRevision}`))},S=(e,t,n)=>{if(!(f.disposed||e.physicalSettled)){if(e.physicalSettled=!0,!e.inLedger||e.epoch!==s){x(e,t,n);return}if(t===`abandoned`){e.status=`abandoned`,_(),g();return}if(t===`failed`){v(`adapter`,e,n);return}if(e.status=`succeeded`,c>e.revision){v(`out-of-order`,e,`revision ${e.revision} completed after revision ${c}`);return}if(c=e.revision,e.kind===`full`){b(e);return}y()}};return{state:f,dispatch:t=>{if(f.disposed)return f.revision;let r=f.revision+1;f.revision=r,f.preparedSnapshot=t.snapshot;let i={revision:r,epoch:s,mode:t.mode,kind:t.kind,snapshot:t.snapshot,payloadKeys:Object.keys(t.payload).length,pendingPatchKeys:t.pendingPatchKeys,status:`dispatched`,physicalSettled:!1,inLedger:!0,next:void 0};u?u.next=i:l=i,u=i,f.dispatchedSnapshot=t.snapshot;for(let e of Object.keys(t.payload))o.add(e.split(`.`,1)[0]);let c=(e,t)=>{S(i,e,t)},d=e(t.payload);if(typeof n.adapter.__wevu_dispatchSetData==`function`)try{n.adapter.__wevu_dispatchSetData(d,c)}catch(e){c(`failed`,e)}else a({invoke:()=>n.adapter.setData?.(d),completion:`return`,settle:c});return r},createFullPayload:e=>{let t={},n=new Set(Object.keys(e));for(let[n,r]of Object.entries(e))t[n]=r===void 0?null:r;for(let e of o)n.has(e)||(t[e]=null);return t},dispose:()=>{f.disposed||(f.disposed=!0,g())}}}export{o as createSetDataCommitTracker,a as observeSetDataCompletion};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toPlain as e}from"../../diff.mjs";import{applySnapshotUpdate as t,cloneSnapshotValue as n,isDeepEqualValue as r,isShallowEqualValue as i,normalizeSetDataValue as a}from"./snapshot.mjs";import{checkPayloadSize as o,collapsePayload as s,mergeSiblingPayload as c}from"./payload.mjs";function l(l){let{state:u,computedRefs:d,dirtyComputedKeys:f,includeComputed:p,computedCompare:m,computedCompareMaxDepth:h,computedCompareMaxKeys:g,shouldIncludeKey:_,maxPatchKeys:v,maxPayloadBytes:y,mergeSiblingThreshold:b,mergeSiblingMaxInflationRatio:x,mergeSiblingMaxParentBytes:S,mergeSiblingSkipArray:C,elevateTopKeyThreshold:w,toPlainMaxDepth:T,toPlainMaxKeys:E,includeFunctions:D=!1,functionPaths:O,plainCache:k,plainCacheEligibility:A,pendingPatches:j,fallbackTopKeys:M,dispatchedSnapshot:N,dispatchedComputedSnapshot:P}=l;if(j.size>v){let e=j.size;return j.clear(),f.clear(),{type:`fallback`,reason:`maxPatchKeys`,debug:{mode:`diff`,reason:`maxPatchKeys`,pendingPatchKeys:e,payloadKeys:0}}}let F=/* @__PURE__ */ new WeakMap,I=/* @__PURE__ */ new Map,L=Object.create(null),R=[...j.entries()];if(Number.isFinite(w)&&w>0){let e=/* @__PURE__ */ new Map;for(let[t]of R){
|
|
1
|
+
import{toPlain as e}from"../../diff.mjs";import{applySnapshotUpdate as t,cloneSnapshotValue as n,isDeepEqualValue as r,isShallowEqualValue as i,normalizeSetDataValue as a}from"./snapshot.mjs";import{checkPayloadSize as o,collapsePayload as s,mergeSiblingPayload as c}from"./payload.mjs";function l(l){let{state:u,computedRefs:d,dirtyComputedKeys:f,includeComputed:p,computedCompare:m,computedCompareMaxDepth:h,computedCompareMaxKeys:g,shouldIncludeKey:_,maxPatchKeys:v,maxPayloadBytes:y,mergeSiblingThreshold:b,mergeSiblingMaxInflationRatio:x,mergeSiblingMaxParentBytes:S,mergeSiblingSkipArray:C,elevateTopKeyThreshold:w,toPlainMaxDepth:T,toPlainMaxKeys:E,includeFunctions:D=!1,functionPaths:O,plainCache:k,plainCacheEligibility:A,pendingPatches:j,fallbackTopKeys:M,dispatchedSnapshot:N,dispatchedComputedSnapshot:P}=l;if(j.size>v){let e=j.size;return j.clear(),f.clear(),{type:`fallback`,reason:`maxPatchKeys`,debug:{mode:`diff`,reason:`maxPatchKeys`,pendingPatchKeys:e,payloadKeys:0}}}let F=/* @__PURE__ */ new WeakMap,I=/* @__PURE__ */ new Map,L=Object.create(null),R=[...j.entries()];if(Number.isFinite(w)&&w>0){let e=/* @__PURE__ */ new Map;for(let[t]of R){let n=t.split(`.`,1)[0];e.set(n,(e.get(n)??0)+1)}for(let[t,n]of e)n>=w&&M.add(t)}let z=R.filter(([e])=>{for(let t of M)if(e===t||e.startsWith(`${t}.`))return!1;return!0}),B=new Map(z);j.clear();let V=e=>{let t=e.split(`.`).filter(Boolean),n=u;for(let e of t){if(typeof n!=`object`||!n)return n;n=Reflect.get(n,e)}return n},H=t=>{if(I.has(t))return I.get(t);let n=a(e(V(t),F,{cache:k,cacheEligibility:A,maxDepth:T,maxKeys:E,includeFunctions:D,functionPaths:O,_path:t}));return I.set(t,n),n};if(M.size){for(let e of M)_(e)&&(L[e]=H(e),B.set(e,{kind:`property`,op:`set`}));M.clear()}for(let[e,t]of z)L[e]=(t.kind===`array`?`set`:t.op)===`delete`?null:H(e);let U=0,W=Object.create(null);if(p&&f.size){let t=[...f];f.clear(),U=t.length;for(let o of t){if(!_(o))continue;let t=e(d[o].value,F,{cache:k,cacheEligibility:A,maxDepth:T,maxKeys:E,includeFunctions:D,functionPaths:O,_path:o}),s=P[o];(m===`deep`?r(s,t,h,{keys:g}):m===`shallow`?i(s,t):Object.is(s,t))||(L[o]=a(t),W[o]=n(t))}}let G=s(L),K=0;if(b){let e=c({input:G,entryMap:B,getPlainByPath:H,mergeSiblingThreshold:b,mergeSiblingSkipArray:C,mergeSiblingMaxParentBytes:S,mergeSiblingMaxInflationRatio:x});K=e.merged,G=s(e.out)}let q=o(G,y),J=Object.keys(G).length,Y={mode:q.fallback?`diff`:`patch`,reason:q.fallback?`maxPayloadBytes`:`patch`,pendingPatchKeys:z.length,payloadKeys:J,mergedSiblingParents:K||void 0,computedDirtyKeys:U||void 0,estimatedBytes:q.estimatedBytes,bytes:q.bytes};if(q.fallback)return{type:`fallback`,reason:`maxPayloadBytes`,debug:Y};if(!J)return;let X={...N},Z=/* @__PURE__ */ new WeakSet;for(let[e,n]of Object.entries(G)){let r=B.get(e);t(X,e,n,r?.kind===`array`?`set`:r?.op??`set`,{cloneValue:!1,clonedParents:Z})}return{type:`patch`,payload:G,snapshot:X,computedUpdates:Object.keys(W).length?W:void 0,debug:Y}}export{l as preparePatchUpdate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasOwn as e}from"../../../utils.mjs";function t(e){let t=Object.keys(e).sort();if(t.length<=1)return e;let n={},r=[];for(let i of t){for(;r.length;){let e=r[r.length-1];if(i.startsWith(e))break;r.pop()}r.length||(n[i]=e[i],r.push(`${i}.`))}return n}function n(e,t,r){if(t<=0)return t+1;if(e===null)return 4;let i=typeof e;if(i===`string`)return 2+e.length;if(i===`number`)return Number.isFinite(e)?String(e).length:4;if(i===`boolean`)return e?4:5;if(i===`undefined`||i===`function`||i===`symbol`||i!==`object`||r.has(e))return 4;if(r.add(e),Array.isArray(e)){let i=2;for(let a=0;a<e.length;a++)if(a&&(i+=1),i+=n(e[a],t-i,r),i>t)return i;return i}let a=2;for(let[i,o]of Object.entries(e))if(a>2&&(a+=1),a+=2+i.length+1,a+=n(o,t-a,r),a>t)return a;return a}function r(e,t){if(t===1/0)return{fallback:!1,estimatedBytes:void 0,bytes:void 0};let r=t,i=Object.keys(e).length,a=n(e,r+1,/* @__PURE__ */ new WeakSet);if(a>r)return{fallback:!0,estimatedBytes:a,bytes:void 0};if(a>=r*.85&&i>2)try{let t=JSON.stringify(e).length;return{fallback:t>r,estimatedBytes:a,bytes:t}}catch
|
|
1
|
+
import{hasOwn as e}from"../../../utils.mjs";function t(e){let t=Object.keys(e).sort();if(t.length<=1)return e;let n={},r=[];for(let i of t){for(;r.length;){let e=r[r.length-1];if(i.startsWith(e))break;r.pop()}r.length||(n[i]=e[i],r.push(`${i}.`))}return n}function n(e,t,r){if(t<=0)return t+1;if(e===null)return 4;let i=typeof e;if(i===`string`)return 2+e.length;if(i===`number`)return Number.isFinite(e)?String(e).length:4;if(i===`boolean`)return e?4:5;if(i===`undefined`||i===`function`||i===`symbol`||i!==`object`||r.has(e))return 4;if(r.add(e),Array.isArray(e)){let i=2;for(let a=0;a<e.length;a++)if(a&&(i+=1),i+=n(e[a],t-i,r),i>t)return i;return i}let a=2;for(let[i,o]of Object.entries(e))if(a>2&&(a+=1),a+=2+i.length+1,a+=n(o,t-a,r),a>t)return a;return a}function r(e,t){if(t===1/0)return{fallback:!1,estimatedBytes:void 0,bytes:void 0};let r=t,i=Object.keys(e).length,a=n(e,r+1,/* @__PURE__ */ new WeakSet);if(a>r)return{fallback:!0,estimatedBytes:a,bytes:void 0};if(a>=r*.85&&i>2)try{let t=JSON.stringify(e).length;return{fallback:t>r,estimatedBytes:a,bytes:t}}catch{return{fallback:!1,estimatedBytes:a,bytes:void 0}}return{fallback:!1,estimatedBytes:a,bytes:void 0}}function i(t){let{input:r,entryMap:i,getPlainByPath:a,mergeSiblingThreshold:o,mergeSiblingSkipArray:s,mergeSiblingMaxParentBytes:c,mergeSiblingMaxInflationRatio:l}=t;if(!o)return{out:r,merged:0};let u=Object.keys(r);if(u.length<o)return{out:r,merged:0};let d=/* @__PURE__ */ new Map,f=/* @__PURE__ */ new Set;for(let e of u){let t=i.get(e);if(!t)continue;if(r[e]===null||t.op===`delete`){let t=e.lastIndexOf(`.`);t>0&&f.add(e.slice(0,t));continue}let n=e.lastIndexOf(`.`);if(n<=0)continue;let a=e.slice(0,n),o=d.get(a)??[];o.push(e),d.set(a,o)}let p=[...d.entries()].filter(([e,t])=>t.length>=o&&!f.has(e)).sort((e,t)=>t[0].split(`.`).length-e[0].split(`.`).length);if(!p.length)return{out:r,merged:0};let m={};Object.assign(m,r);let h=0,g=/* @__PURE__ */ new WeakMap,_=e=>{if(e&&typeof e==`object`){let t=g.get(e);if(t!==void 0)return t;let r=n(e,1/0,/* @__PURE__ */ new WeakSet);return g.set(e,r),r}return n(e,1/0,/* @__PURE__ */ new WeakSet)},v=(e,t)=>2+e.length+1+_(t);for(let[t,n]of p){if(e(m,t))continue;let r=n.filter(t=>e(m,t));if(r.length<o)continue;let i=a(t);if(!(s&&Array.isArray(i))&&!(c!==1/0&&v(t,i)>c)){if(l!==1/0){let e=0;for(let t of r)e+=v(t,m[t]);if(v(t,i)>e*l)continue}m[t]=i;for(let e of r)delete m[e];h+=1}}return{out:m,merged:h}}export{r as checkPayloadSize,t as collapsePayload,n as estimateJsonSize,i as mergeSiblingPayload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../../../reactivity/reactive.mjs";import{isRef as r}from"../../../reactivity/ref.mjs";import{hasOwn as i}from"../../../utils.mjs";import{hasTrackableSetupBinding as a}from"../../setupTracking.mjs";import{resolveBindingDiagnostics as o}from"../../bindingManifest.mjs";import{diffSnapshots as s,toPlain as c}from"../../diff.mjs";import{collectSnapshot as l}from"./snapshot.mjs";import{createSetDataCommitTracker as u}from"./commitTracker.mjs";function d(d){let{state:f,setupState:p,snapshotOmitKeys:m,computedRefs:h,dirtyComputedKeys:g,includeComputed:_,setDataStrategy:v,currentAdapter:y,shouldIncludeKey:b,toPlainMaxDepth:x,toPlainMaxKeys:S,includeFunctions:C=!1,functionPaths:w,debug:T,debugWhen:
|
|
1
|
+
import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../../../reactivity/reactive.mjs";import{isRef as r}from"../../../reactivity/ref.mjs";import{hasOwn as i}from"../../../utils.mjs";import{hasTrackableSetupBinding as a}from"../../setupTracking.mjs";import{resolveBindingDiagnostics as o}from"../../bindingManifest.mjs";import{diffSnapshots as s,toPlain as c}from"../../diff.mjs";import{collectSnapshot as l}from"./snapshot.mjs";import{createSetDataCommitTracker as u}from"./commitTracker.mjs";function d(d){let{state:f,setupState:p,snapshotOmitKeys:m,computedRefs:h,dirtyComputedKeys:g,includeComputed:_,setDataStrategy:v,currentAdapter:y,shouldIncludeKey:b,toPlainMaxDepth:x,toPlainMaxKeys:S,includeFunctions:C=!1,functionPaths:w,debug:T,debugWhen:ee,debugSampleRate:E,bindingManifest:D,loopWarning:O,targetLabel:k,runTracker:A,isMounted:j,initialSnapshot:M,initialState:N}=d,P=/* @__PURE__ */ new WeakMap,F=/* @__PURE__ */ new WeakMap,I={},L=Object.create(null),R=Object.create(null),z=[],B=-1/0,V=new Set(N&&typeof N==`object`?Object.keys(N):[]),H=e=>{if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype},U=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>U(e,t[n]));if(H(e)&&H(t)){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>i(t,n)&&U(e[n],t[n]))}return!1},W=i=>{let o=r(i)?i.value:i;if(typeof o!=`object`||!o)return o;if(!n(o)&&a(o))return{snapshot:c(o,/* @__PURE__ */ new WeakMap,{cacheEligibility:F,maxDepth:x,maxKeys:S,includeFunctions:C,functionPaths:w})};let s=n(o)?e(o):o;return{raw:s,version:t(s)}},G=(e,t)=>Object.is(e,t)?!0:!e||!t||typeof e!=`object`||typeof t!=`object`||!i(e,`raw`)||!i(t,`raw`)?e&&t&&typeof e==`object`&&typeof t==`object`&&i(e,`snapshot`)&&i(t,`snapshot`)?U(e.snapshot,t.snapshot):!1:e.raw===t.raw&&e.version===t.version,K=e=>b(e)&&!m?.has(e);if(M)for(let[e,t]of Object.entries(M))K(e)&&(I[e]=t);let q=()=>{if(!M)return;let t=n(f)?e(f):f,r=p&&typeof p==`object`?n(p)?e(p):p:void 0;for(let e of Object.keys(M))if(K(e)){if(r&&i(r,e)){L[e]=W(r[e]);continue}if(i(t,e)){if(V.has(e))continue;t[e]=M[e],L[e]=W(t[e])}}},J=t=>{let a=[],o=p&&typeof p==`object`?n(p)?e(p):p:void 0;for(let n of/* @__PURE__ */ new Set([...Object.keys(f),...o?Object.keys(o):[]])){if(!K(n))continue;let s=o&&i(o,n)?o[n]:f[n],c=r(s)?s.value:s;c&&typeof c==`object`&&e(c)===t&&a.push(n)}return a},Y=(e,t)=>{if(!T)return;let n=e.reason!==`patch`&&e.reason!==`diff`;if(ee===`fallback`&&!n||e.reason!==`commitFailure`&&E<1&&Math.random()>E)return;let r=e;if(D){let n=typeof t==`function`?t():t??[],i=e.reason===`needsFullSnapshot`||e.reason===`maxPatchKeys`||e.reason===`maxPayloadBytes`;r={...e,bindings:o(D,n,i)}}try{T(r)}catch{}},X=u({initialSnapshot:I,adapter:y,onFailure:e=>{Y({mode:e.mode,reason:`commitFailure`,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:e.payloadKeys,revision:e.revision,committedRevision:e.committedRevision,targetLabel:k,message:e.error.message});try{y.__wevu_reportSetDataError?.(e.error)}catch{}}}),te=(e=0,t)=>{if(!O)return;let n=Date.now();z.push(n);let r=n-O.sampleWindowMs;for(;z.length&&z[0]<r;)z.shift();z.length<=O.maxFlushes||O.coolDownMs>0&&n-B<O.coolDownMs||(B=n,Y({mode:v,reason:`loopWarning`,pendingPatchKeys:e,payloadKeys:0,computedDirtyKeys:_?g.size:0,flushCount:z.length,windowMs:O.sampleWindowMs,targetLabel:k,message:`${k?`${k} `:``}疑似运行时更新循环:${z.length} 次 setData flush/${O.sampleWindowMs}ms`},t))},Z=()=>l({state:f,setupState:p,computedRefs:h,includeComputed:_,shouldIncludeKey:K,plainCache:P,plainCacheEligibility:F,toPlainMaxDepth:x,toPlainMaxKeys:S,includeFunctions:C,functionPaths:w});q();let ne=()=>{let t=n(f)?e(f):f,r=p&&typeof p==`object`?n(p)?e(p):p:void 0,a=X.state.dispatchedSnapshot,o={...a},s=/* @__PURE__ */ new WeakMap,l=/* @__PURE__ */ new Set,u=/* @__PURE__ */ new Set,d=/* @__PURE__ */ new Set;for(let e of/* @__PURE__ */ new Set([...Object.keys(t),...r?Object.keys(r):[]])){if(!K(e))continue;l.add(e);let n=r&&i(r,e)?r:t,u=W(n[e]),f=L[e];f&&u&&typeof f==`object`&&typeof u==`object`&&i(f,`raw`)&&i(u,`raw`)&&Array.isArray(f.raw)&&Array.isArray(u.raw)&&f.raw!==u.raw&&d.add(e),(!G(f,u)||!i(a,e))&&(o[e]=c(n[e],s,{cache:P,cacheEligibility:F,maxDepth:x,maxKeys:S,includeFunctions:C,functionPaths:w,_path:e})),L[e]=u}for(let e of Object.keys(L))l.has(e)||(delete L[e],(!_||!i(h,e))&&delete o[e]);if(!_){for(let e of Object.keys(R))delete R[e];return{snapshot:o,replacedTopLevelKeys:d}}for(let e of Object.keys(h)){if(!K(e))continue;u.add(e);let t=h[e].value,n=W(t);(!G(R[e],n)||!i(a,e))&&(o[e]=c(t,s,{cache:P,cacheEligibility:F,maxDepth:x,maxKeys:S,includeFunctions:C,functionPaths:w,_path:e})),R[e]=n}for(let e of Object.keys(R))u.has(e)||(delete R[e],(!i(t,e)||!K(e))&&delete o[e]);return{snapshot:o,replacedTopLevelKeys:d}},Q=(e=`diff`,t=0,n)=>{let r=v===`diff`?ne():void 0,i=r?.snapshot??Z(),a=X.state.dispatchedSnapshot,o=X.state.needsFullSnapshot,c=o?X.createFullPayload(i):r?(()=>{let e={};for(let t of r.replacedTopLevelKeys)e[t]=i[t];return{...s(a,i,{skipKeys:r.replacedTopLevelKeys}),...e}})():s(a,i);n?.(i);let l=Object.keys(c).length;if(!l&&!o)return;let u=o?`needsFullSnapshot`:e;Y({mode:`diff`,reason:u,pendingPatchKeys:t,payloadKeys:l},Object.keys(c)),X.dispatch({mode:`diff`,kind:o?`full`:`delta`,reason:u,snapshot:i,payload:c,pendingPatchKeys:t})},$=(e=0,t)=>j()?(te(e,t),A(),!0):!1;return{collect:Z,emitDebug:Y,getLatestSnapshot:()=>X.state.dispatchedSnapshot,dispatchUpdate:X.dispatch,needsFullSnapshot:()=>X.state.needsFullSnapshot,job:e=>{if($())return Q(`diff`)},plainCache:P,plainCacheEligibility:F,prepareJob:$,resolveTopKeysByRoot:J,runDiffUpdate:Q,shouldIncludeSnapshotKey:K,snapshot:()=>v===`patch`?Z():{...X.state.dispatchedSnapshot},cloneLatestSnapshot:()=>({...X.state.dispatchedSnapshot}),dispose:X.dispose}}export{d as createSetDataScheduler};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{isReactive as t}from"../../../reactivity/reactive.mjs";import{hasOwn as n}from"../../../utils.mjs";import{toPlain as r}from"../../diff.mjs";function i(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function a(e){return e===void 0?null:e}function o(e){if(Array.isArray(e))return e.map(e=>o(e));if(!i(e))return e;let t={};for(let n of Object.keys(e))t[n]=o(e[n]);return t}function s(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}if(!i(e)||!i(t))return!1;let r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(let i of r)if(!n(t,i)||!Object.is(e[i],t[i]))return!1;return!0}function c(e,t,r,a){if(Object.is(e,t))return!0;if(r<=0)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!c(e[n],t[n],r-1,a))return!1;return!0}if(!i(e)||!i(t))return!1;let o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(let i of o)if(--a.keys,a.keys<=0||!n(t,i)||!c(e[i],t[i],r-1,a))return!1;return!0}function l(e,t,n,r,i){
|
|
1
|
+
import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{isReactive as t}from"../../../reactivity/reactive.mjs";import{hasOwn as n}from"../../../utils.mjs";import{toPlain as r}from"../../diff.mjs";function i(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function a(e){return e===void 0?null:e}function o(e){if(Array.isArray(e))return e.map(e=>o(e));if(!i(e))return e;let t={};for(let n of Object.keys(e))t[n]=o(e[n]);return t}function s(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}if(!i(e)||!i(t))return!1;let r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(let i of r)if(!n(t,i)||!Object.is(e[i],t[i]))return!1;return!0}function c(e,t,r,a){if(Object.is(e,t))return!0;if(r<=0)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!c(e[n],t[n],r-1,a))return!1;return!0}if(!i(e)||!i(t))return!1;let o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(let i of o)if(--a.keys,a.keys<=0||!n(t,i)||!c(e[i],t[i],r-1,a))return!1;return!0}function l(e,t,n,r,i){let a=i?.cloneValue??!0,s=i?.clonedParents,c=t.split(`.`).filter(Boolean);if(!c.length)return;s?.add(e);let l=e;for(let e=0;e<c.length-1;e++){let t=c[e],n=l[t];if(typeof n!=`object`||!n)l[t]={},s?.add(l[t]);else if(s&&!s.has(n)){let e=Array.isArray(n)?n.slice():{...n};l[t]=e,s.add(e)}l=l[t]}let u=c[c.length-1];if(r===`delete`)try{delete l[u]}catch{l[u]=null}else l[u]=a?o(n):n}function u(n){let{state:i,setupState:a,computedRefs:o,includeComputed:s,shouldIncludeKey:c,plainCache:l,plainCacheEligibility:u,toPlainMaxDepth:d,toPlainMaxKeys:f,includeFunctions:p=!1,functionPaths:m=[]}=n,h=/* @__PURE__ */ new WeakMap,g={},_=Number.isFinite(f)?{keys:f}:void 0,v=t(i)?e(i):i,y=a&&typeof a==`object`?t(a)?e(a):a:void 0,b=Object.keys(v),x=y?Object.keys(y):[],S=s?Object.keys(o):[];for(let e of b)c(e)&&(g[e]=r(v[e],h,{cache:l,cacheEligibility:u,maxDepth:d,includeFunctions:p,functionPaths:m,_budget:_,_path:e}));for(let e of x)c(e)&&(g[e]=r(y[e],h,{cache:l,cacheEligibility:u,maxDepth:d,includeFunctions:p,functionPaths:m,_budget:_,_path:e}));for(let e of S)c(e)&&(g[e]=r(o[e].value,h,{cache:l,cacheEligibility:u,maxDepth:d,includeFunctions:p,functionPaths:m,_budget:_,_path:e}));return g}export{l as applySnapshotUpdate,o as cloneSnapshotValue,u as collectSnapshot,c as isDeepEqualValue,i as isPlainObjectLike,s as isShallowEqualValue,a as normalizeSetDataValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){
|
|
1
|
+
function e(e){let t=e?.includeComputed??!0,n=e?.suspendWhenHidden??!1,r=e?.strategy??`diff`,i=typeof e?.maxPatchKeys==`number`?Math.max(0,e.maxPatchKeys):1/0,a=typeof e?.maxPayloadBytes==`number`?Math.max(0,e.maxPayloadBytes):1/0,o=typeof e?.mergeSiblingThreshold==`number`?Math.max(2,Math.floor(e.mergeSiblingThreshold)):0,s=typeof e?.mergeSiblingMaxInflationRatio==`number`?Math.max(0,e.mergeSiblingMaxInflationRatio):1.25,c=typeof e?.mergeSiblingMaxParentBytes==`number`?Math.max(0,e.mergeSiblingMaxParentBytes):1/0,l=e?.mergeSiblingSkipArray??!0,u=e?.computedCompare??(r===`patch`?`deep`:`reference`),d=typeof e?.computedCompareMaxDepth==`number`?Math.max(0,Math.floor(e.computedCompareMaxDepth)):4,f=typeof e?.computedCompareMaxKeys==`number`?Math.max(0,Math.floor(e.computedCompareMaxKeys)):200,p=e?.prelinkMaxDepth,m=e?.prelinkMaxKeys,h=e?.debug,g=e?.diagnostics??`off`,_=e?.loopWarning,v=_===!1||_&&typeof _==`object`&&_.enabled===!1?!1:{sampleWindowMs:typeof _==`object`&&typeof _.sampleWindowMs==`number`?Math.max(100,Math.floor(_.sampleWindowMs)):1e3,maxFlushes:typeof _==`object`&&typeof _.maxFlushes==`number`?Math.max(1,Math.floor(_.maxFlushes)):50,coolDownMs:typeof _==`object`&&typeof _.coolDownMs==`number`?Math.max(0,Math.floor(_.coolDownMs)):5e3},y=e?.debugWhen??`fallback`,b=typeof e?.debugSampleRate==`number`?Math.min(1,Math.max(0,e.debugSampleRate)):1,x=typeof e?.elevateTopKeyThreshold==`number`?Math.max(0,Math.floor(e.elevateTopKeyThreshold)):1/0,S=typeof e?.toPlainMaxDepth==`number`?Math.max(0,Math.floor(e.toPlainMaxDepth)):1/0,C=typeof e?.toPlainMaxKeys==`number`?Math.max(0,Math.floor(e.toPlainMaxKeys)):1/0,w=!!e?.includeFunctions,T=Array.isArray(e?.functionPaths)?[...new Set(e.functionPaths.filter(e=>typeof e==`string`&&e.length>0))]:[],E=Array.isArray(e?.pick)&&e.pick.length>0?new Set(e.pick):void 0,D=Array.isArray(e?.omit)&&e.omit.length>0?new Set(e.omit):void 0;return{includeComputed:t,suspendWhenHidden:n,setDataStrategy:r,maxPatchKeys:i,maxPayloadBytes:a,mergeSiblingThreshold:o,mergeSiblingMaxInflationRatio:s,mergeSiblingMaxParentBytes:c,mergeSiblingSkipArray:l,computedCompare:u,computedCompareMaxDepth:d,computedCompareMaxKeys:f,prelinkMaxDepth:p,prelinkMaxKeys:m,debug:h,diagnostics:g,loopWarning:v,debugWhen:y,debugSampleRate:b,elevateTopKeyThreshold:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T,pickSet:E,omitSet:D,shouldIncludeKey:e=>!(E&&!E.has(e)||D&&D.has(e))}}export{e as resolveSetDataOptions};
|
package/dist/runtime/app.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getCurrentMiniProgramGlobalObject as e}from"./platform/current.mjs";import{INTERNAL_DEFAULTS_SCOPE_KEY as t,applyWevuAppDefaults as n}from"./defaults.mjs";import{isSetDataHighFrequencyWarningRequested as r,requireRuntimeCapability as i}from"./capabilities.mjs";import{ensureRuntimeAppProvides as a,setRuntimeAppProvidedValue as o}from"./provideContext.mjs";import{version as s}from"../version.mjs";import{resolveBindingManifest as c}from"./bindingManifest.mjs";import{createRuntimeMount as l}from"./app/mount.mjs";import{setPendingRuntimeAppRegistration as u}from"./app/pending.mjs";import{registerApp as d}from"./register/app.mjs";import{WEVU_BINDING_MANIFEST_KEY as f,WEVU_INLINE_HANDLER as p,WEVU_INLINE_MAP_KEY as m,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as h,WEVU_SLOT_OWNER_ID_KEY as g}from"@weapp-core/constants";function _(_){let v=_[t],{[t]:y,[f]:b,[h]:x,data:S,computed:C,methods:w,setData:T,watch:E,setup:D,...O}=v===`component`?_:n(_),k=c(b),A=w??{},j=C??{},M=x===!0||Array.isArray(T?.pick)&&T.pick.includes(g),N=A,P=N[m];Object.prototype.hasOwnProperty.call(N,m)&&P&&typeof P==`object`&&Object.keys(P).length>0&&typeof N[p]!=`function`&&typeof O[p]!=`function`&&i(`inlineEvents`,`createApp(inline event metadata)`),T?.strategy===`patch`&&i(`patchStrategy`,`createApp(setData.strategy="patch")`),r(T?.highFrequencyWarning)&&i(`setDataHighFrequencyWarning`,`createApp(setData.highFrequencyWarning)`),M&&i(`scopedSlots`,`createApp(scoped-slot bindings)`);let F=/* @__PURE__ */ new Set,I=/* @__PURE__ */ new Set,L=!1,R={globalProperties:{}},z={mount:l({data:S,resolvedComputed:j,resolvedMethods:A,appConfig:R,setDataOptions:T,bindingManifest:k}),use(e,...t){if(!e||F.has(e))return z;if(F.add(e),typeof e==`function`)e(z,...t);else if(typeof e.install==`function`)e.install(z,...t);else throw TypeError(`插件必须是函数,或包含 install 方法的对象`);return z},provide(e,t){return o(z,e,t,{syncGlobal:v!==`component`}),z},onUnmount(e){if(typeof e!=`function`)throw TypeError(`onUnmount 只接受函数`);return L?(e(),z):(I.add(e),z)},unmount(){if(!L){L=!0;for(let e of I)e();I.clear()}},config:R,version:s};try{a(z),Object.defineProperty(z,"__wevuSetDataOptions",{value:T,configurable:!0,enumerable:!1,writable:!1}),Object.defineProperty(z,"__wevuHasTemplateRuntimeBindings",{value:M,configurable:!0,enumerable:!1,writable:!1})}catch{z.__wevuSetDataOptions=T,z.__wevuHasTemplateRuntimeBindings=M}let B=()=>{let t=e(),n=`__wevuAppRegistered`;t&&t[n]||(t&&(t[n]=!0),d(z,w??{},E,D,O))};return v!==`component`&&typeof App==`function`?B():v!==`component`&&u({app:z,register:B}),z}export{_ as createApp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={"exact-path":!0,"snapshot-fallback":!0,"top-level":!0};function t(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function n(e){return typeof e==`number`&&Number.isFinite(e)&&Number.isInteger(e)}function r(e){if(!e||typeof e!=`object`)return!1;let t=e;return n(t.offset)&&t.offset>=0&&n(t.line)&&t.line>=1&&n(t.column)&&t.column>=1}function i(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.start,i=t.end;return r(n)&&r(i)&&i.offset>=n.offset}function a(e){return Object.values(e).every(e=>e===!0)}function o(n){if(!n||typeof n!=`object`)return!1;let r=n;return typeof r.id==`string`&&r.id.length>0&&typeof r.outputPath==`string`&&r.outputPath.length>0&&(r.sourceFile===void 0||typeof r.sourceFile==`string`&&r.sourceFile.length>0)&&(r.updateMode===void 0||typeof r.updateMode==`string`&&e[r.updateMode]===!0)&&(r.sourceRoots===void 0||t(r.sourceRoots))&&(r.sourceLocation===void 0||i(r.sourceLocation))}function s(e){if(!e||typeof e!=`object`)return;let t=e;if(t.version===1&&typeof t.sourceFile==`string`&&Array.isArray(t.bindings)&&t.bindings.every(o)&&(t.features===void 0||t.features&&typeof t.features==`object`&&!Array.isArray(t.features)&&a(t.features)))return t}function c(e,t){
|
|
1
|
+
const e={"exact-path":!0,"snapshot-fallback":!0,"top-level":!0};function t(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function n(e){return typeof e==`number`&&Number.isFinite(e)&&Number.isInteger(e)}function r(e){if(!e||typeof e!=`object`)return!1;let t=e;return n(t.offset)&&t.offset>=0&&n(t.line)&&t.line>=1&&n(t.column)&&t.column>=1}function i(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.start,i=t.end;return r(n)&&r(i)&&i.offset>=n.offset}function a(e){return Object.values(e).every(e=>e===!0)}function o(n){if(!n||typeof n!=`object`)return!1;let r=n;return typeof r.id==`string`&&r.id.length>0&&typeof r.outputPath==`string`&&r.outputPath.length>0&&(r.sourceFile===void 0||typeof r.sourceFile==`string`&&r.sourceFile.length>0)&&(r.updateMode===void 0||typeof r.updateMode==`string`&&e[r.updateMode]===!0)&&(r.sourceRoots===void 0||t(r.sourceRoots))&&(r.sourceLocation===void 0||i(r.sourceLocation))}function s(e){if(!e||typeof e!=`object`)return;let t=e;if(t.version===1&&typeof t.sourceFile==`string`&&Array.isArray(t.bindings)&&t.bindings.every(o)&&(t.features===void 0||t.features&&typeof t.features==`object`&&!Array.isArray(t.features)&&a(t.features)))return t}function c(e,t){return e?.bindings.some(e=>e.outputPath===t)??!1}function l(e){return e.replace(/\[(?:'([^']+)'|"([^"]+)"|([^\]]+))\]/g,(e,t,n,r)=>`.${t??n??r}`).replace(/^\./,``)}function u(e){return l(e).split(`.`,1)[0]??``}function d(e,t){let n=l(e),r=l(t);return n===r||n.startsWith(`${r}.`)||r.startsWith(`${n}.`)}function f(e){return e.updateMode??`exact-path`}function p(e,t){if(!t)return!1;let n=f(e);if(n===`snapshot-fallback`&&e.outputPath===`*`)return!0;if(n===`exact-path`)return d(e.outputPath,t);let r=u(t);return u(e.outputPath)===r||n===`snapshot-fallback`&&(e.sourceRoots??[]).some(e=>u(e)===r)}function m(e,t,n=!1){let r=[...t],i=/* @__PURE__ */ new Set,a=[];for(let t of e.bindings){if(i.has(t.id))continue;let o=f(t);if(!(r.length>0?r.some(e=>p(t,e)):n&&o===`snapshot-fallback`))continue;i.add(t.id);let s={id:t.id,outputPath:t.outputPath,updateMode:o,sourceFile:t.sourceFile??e.sourceFile};t.sourceLocation&&(s.sourceLocation=t.sourceLocation),a.push(s)}return a}export{c as hasBindingOutputPath,m as resolveBindingDiagnostics,s as resolveBindingManifest};
|
|
@@ -5,7 +5,7 @@ import "./types.mjs";
|
|
|
5
5
|
import { SetDataSchedulerOptions } from "./app/setData/scheduler.mjs";
|
|
6
6
|
import { InlineExpressionMap } from "./register/inline.mjs";
|
|
7
7
|
//#region src/runtime/capabilities.d.ts
|
|
8
|
-
export type RuntimeCapabilityName = 'patchStrategy' | 'templateRefs' | 'inlineEvents' | 'setDataHighFrequencyWarning' | 'scopedSlots' | 'layout';
|
|
8
|
+
export type RuntimeCapabilityName = 'patchStrategy' | 'templateRefs' | 'inlineEvents' | 'setDataHighFrequencyWarning' | 'scopedSlots' | 'layout' | 'jsxIslands';
|
|
9
9
|
export interface TemplateRefBinding {
|
|
10
10
|
selector: string;
|
|
11
11
|
inFor: boolean;
|
|
@@ -69,6 +69,9 @@ export interface RuntimeCapabilityRegistry {
|
|
|
69
69
|
attachHosts: (bindings: readonly LayoutHostBinding[], target: InternalRuntimeState) => void;
|
|
70
70
|
detachHosts: (bindings: readonly LayoutHostBinding[], target: InternalRuntimeState) => void;
|
|
71
71
|
};
|
|
72
|
+
jsxIslands?: {
|
|
73
|
+
attachMethods: (methods: Record<string, (...args: any[]) => any>) => void;
|
|
74
|
+
};
|
|
72
75
|
}
|
|
73
76
|
//#endregion
|
|
74
77
|
export type { SetDataSchedulerOptions };
|
package/dist/runtime/css.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{unref as e}from"../reactivity/ref.mjs";import{computed as t}from"../reactivity/computed.mjs";import{assertInSetup as n}from"./hooks/base.mjs";import{WEVU_CSS_MODULES_KEY as r,WEVU_CSS_VARS_STYLE_KEY as i}from"@weapp-core/constants";function a(t){return Object.entries(t).map(([t,n])=>`--${t}:${n==null?``:String(e(n))}`).join(`;`)}function o(e=`$style`){let t=n(`useCssModule`)[r]
|
|
1
|
+
import{unref as e}from"../reactivity/ref.mjs";import{computed as t}from"../reactivity/computed.mjs";import{assertInSetup as n}from"./hooks/base.mjs";import{WEVU_CSS_MODULES_KEY as r,WEVU_CSS_VARS_STYLE_KEY as i}from"@weapp-core/constants";function a(t){return Object.entries(t).map(([t,n])=>`--${t}:${n==null?``:String(e(n))}`).join(`;`)}function o(e=`$style`){let t=n(`useCssModule`)[r]?.[e];if(!t||typeof t!=`object`)throw Error(`useCssModule() 找不到名为 ${JSON.stringify(e)} 的 CSS Module`);return t}function s(e){let r=n(`useCssVars`),o=r.__wevu,s=t(()=>a(e(o?.proxy??r)));return o?.state&&typeof o.state==`object`&&(o.state[i]=s),o?.setupState&&typeof o.setupState==`object`&&(o.setupState[i]=s),s}export{o as useCssModule,s as useCssVars};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=`__wevuDefaultsScope`;let t={};function n(e){if(e&&typeof e==`object`&&!Array.isArray(e))return e}function r(e,t){if(!e)return t;if(!t)return e;let r={...e,...t},i=n(e.setData),a=n(t.setData);(i||a)&&(r.setData={...i
|
|
1
|
+
const e=`__wevuDefaultsScope`;let t={};function n(e){if(e&&typeof e==`object`&&!Array.isArray(e))return e}function r(e,t){if(!e)return t;if(!t)return e;let r={...e,...t},i=n(e.setData),a=n(t.setData);(i||a)&&(r.setData={...i??{},...a??{}});let o=n(e.options),s=n(t.options);return(o||s)&&(r.options={...o??{},...s??{}}),r}function i(e,t){return r(e,t)}function a(e,t){return{app:r(e.app,t.app),component:r(e.component,t.component)}}function o(e){t=a(t,e)}function s(){t={}}function c(e){return i(t.app,e)}function l(e){return i(t.component,e)}export{e as INTERNAL_DEFAULTS_SCOPE_KEY,c as applyWevuAppDefaults,l as applyWevuComponentDefaults,s as resetWevuDefaults,o as setWevuDefaults};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasOwn as e}from"../../utils.mjs";import{toPlain as t}from"../diff.mjs";import{resolveSetDataOptions as n}from"../app/setDataOptions.mjs";import{WEVU_SLOT_OWNER_ID_KEY as r}from"@weapp-core/constants";var i=class extends Error{};function a(e){if(typeof e==`function`)return e;let t=e
|
|
1
|
+
import{hasOwn as e}from"../../utils.mjs";import{toPlain as t}from"../diff.mjs";import{resolveSetDataOptions as n}from"../app/setDataOptions.mjs";import{WEVU_SLOT_OWNER_ID_KEY as r}from"@weapp-core/constants";var i=class extends Error{};function a(e){if(typeof e==`function`)return e;let t=e?.get;return typeof t==`function`?t:void 0}function o(e){return e.startsWith(`__wv_bind_`)||e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`)}function s(e,t){if(!e.startsWith(`__wv_bind_`))return!1;try{return!/\bthis\b/.test(Function.prototype.toString.call(t))}catch{return!1}}function c(e){if(e===r)return``;if(e.startsWith(`__wv_bind_`))return null;if(e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`))return``}function l(t,n){let r=Array.isArray(n?.pick)?n.pick:[];if(!r.length)return;let i=new Set(Array.isArray(n?.omit)?n.omit:[]),a={};for(let n of r){if(i.has(n)||e(t,n))continue;let r=c(n);r!==void 0&&(a[n]=r)}return Object.keys(a).length?a:void 0}function u(r){let{data:c,computed:l,methods:u,setData:d}=r,f=l?Object.keys(l):[];if(!f.length)return;let{includeComputed:p,shouldIncludeKey:m,toPlainMaxDepth:h,toPlainMaxKeys:g,includeFunctions:_,functionPaths:v}=n(d);if(!p)return;let y={},b=/* @__PURE__ */ new Set,x,S=n=>{if(e(c,n)||!m(n))return{ok:!1};if(e(y,n))return{ok:!0,value:y[n]};if(b.has(n))return{ok:!1};let r=a(l[n]);if(!r)return{ok:!1};b.add(n);try{let e=r.call(x);if(e===void 0)return{ok:!1};let i=t(e,/* @__PURE__ */ new WeakMap,{maxDepth:h,maxKeys:g,includeFunctions:_,functionPaths:v,_path:n});return i===void 0?{ok:!1}:(y[n]=i,{ok:!0,value:i})}catch{return{ok:!1}}finally{b.delete(n)}};x=new Proxy(c,{get(t,n,r){if(typeof n==`string`){if(n===`data`||n===`$state`)return c;if(n===`props`||n===`$props`||n===`$attrs`)throw new i;if(e(c,n))return Reflect.get(t,n,r);if(u&&e(u,n)){let e=u[n];return typeof e==`function`?e.bind(x):e}if(l&&e(l,n)){let e=S(n);if(e.ok)return e.value;throw new i}throw new i}return Reflect.get(t,n,r)},has(t,n){return Reflect.has(t,n)||typeof n==`string`&&!!(l&&e(l,n))}});for(let e of f){let t=a(l[e]);(!o(e)||t&&s(e,t))&&S(e)}return Object.keys(y).length?y:void 0}function d(e,t,n,r){if(!e||typeof e!=`object`)return e;let i=u({data:e,computed:t,methods:r,setData:n}),a=l(e,n);return i||a?{...e,...a,...i}:e}export{u as resolveInitialComputedData,d as resolveNativeInitialData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=[`components`,`computed`,`directives`,`inject`,`methods`,`props`,`provide`],t=/* @__PURE__ */ new Set(/* @__PURE__ */ `activated.attached.beforeCreate.beforeDestroy.beforeMount.beforeUnmount.beforeUpdate.created.deactivated.destroyed.detached.errorCaptured.hide.mounted.moved.onAddToFavorites.onHide.onLoad.onPageScroll.onPullDownRefresh.onReachBottom.onReady.onResize.onRouteDone.onSaveExitState.onShareAppMessage.onShareTimeline.onShow.onTabItemTap.onUnload.ready.renderTracked.renderTriggered.serverPrefetch.show.unmounted.updated`.split(`.`));function n(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:void 0}function r(e,t){return typeof e==`function`?typeof t==`function`?function(...n){return e.apply(this,n),t.apply(this,n)}:e:t}function i(e,t){let i=n(e),a=n(t);if(!i)return a;if(!a)return i;let o={...i,...a};for(let e of/* @__PURE__ */ new Set([...Object.keys(i),...Object.keys(a)]))o[e]=r(i[e],a[e]);return o}function a(e,t){return e===void 0?t:t===void 0?e:function(){
|
|
1
|
+
const e=[`components`,`computed`,`directives`,`inject`,`methods`,`props`,`provide`],t=/* @__PURE__ */ new Set(/* @__PURE__ */ `activated.attached.beforeCreate.beforeDestroy.beforeMount.beforeUnmount.beforeUpdate.created.deactivated.destroyed.detached.errorCaptured.hide.mounted.moved.onAddToFavorites.onHide.onLoad.onPageScroll.onPullDownRefresh.onReachBottom.onReady.onResize.onRouteDone.onSaveExitState.onShareAppMessage.onShareTimeline.onShow.onTabItemTap.onUnload.ready.renderTracked.renderTriggered.serverPrefetch.show.unmounted.updated`.split(`.`));function n(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:void 0}function r(e,t){return typeof e==`function`?typeof t==`function`?function(...n){return e.apply(this,n),t.apply(this,n)}:e:t}function i(e,t){let i=n(e),a=n(t);if(!i)return a;if(!a)return i;let o={...i,...a};for(let e of/* @__PURE__ */ new Set([...Object.keys(i),...Object.keys(a)]))o[e]=r(i[e],a[e]);return o}function a(e,t){return e===void 0?t:t===void 0?e:function(){let r=typeof e==`function`?e.call(this):e,i=typeof t==`function`?t.call(this):t;return{...n(r)??{},...n(i)??{}}}}function o(e,t){if(typeof e==`function`)return e;if(typeof e==`string`){let n=t[e];return typeof n==`function`?n:void 0}let r=n(e);return r?o(r.handler,t):void 0}function s(e,t){if(e===void 0)return t;if(t===void 0)return e;let r=n(e),i=n(t);return{...r??{},...i??{},handler(...n){return o(e,this)?.apply(this,n),o(t,this)?.apply(this,n)},immediate:!!(r?.immediate||i?.immediate),deep:!!(r?.deep||i?.deep)}}function c(e,t){let r=n(e),i=n(t);if(!r)return i;if(!i)return r;let a={...r,...i};for(let e of/* @__PURE__ */ new Set([...Object.keys(r),...Object.keys(i)]))a[e]=s(r[e],i[e]);return a}function l(e,t){let n=[...Array.isArray(e)?e:[],...Array.isArray(t)?t:[]];return[...new Set(n)]}function u(o,s){let u={...o,...s};for(let t of e){let e=n(o[t]),r=n(s[t]);(e||r)&&(u[t]={...e??{},...r??{}})}u.data=a(o.data,s.data),u.watch=c(o.watch,s.watch),u.lifetimes=i(o.lifetimes,s.lifetimes),u.pageLifetimes=i(o.pageLifetimes,s.pageLifetimes);for(let e of/* @__PURE__ */ new Set([...Object.keys(o),...Object.keys(s)]))t.has(e)&&(u[e]=r(o[e],s[e]));return(Array.isArray(o.emits)||Array.isArray(s.emits))&&(u.emits=l(o.emits,s.emits)),(Array.isArray(o.expose)||Array.isArray(s.expose))&&(u.expose=l(o.expose,s.expose)),u}function d(e,t,r){let i=n(t);if(!i||r.has(i))return e;r.add(i);let a=e;if(a=d(a,i.extends,r),Array.isArray(i.mixins))for(let e of i.mixins)a=d(a,e,r);let{extends:o,mixins:s,...c}=i;return u(a,c)}function f(e){return d({},e,/* @__PURE__ */ new WeakSet)}export{f as resolveVueComponentOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasOwn as e}from"../../utils.mjs";import{WEVU_SLOT_NAMES_PROP as t,WEVU_SLOT_OWNER_ID_PROP as n,WEVU_SLOT_SCOPE_KEY as r}from"@weapp-core/constants";const i=`__wevu_allowNullPropInput`,a=`allowNullPropInput`,o=/* @__PURE__ */ new Map([[String,String],[Number,Number],[Boolean,Boolean],[Object,Object],[Array,Array],[Function,Function],[`String`,String],[`Number`,Number],[`Boolean`,Boolean],[`Object`,Object],[`Array`,Array],[`Function`,Function],[null,null],[`null`,null],[`Null`,null]]);function s(e){return o.get(e)}function c(e,t=[]){if(Array.isArray(e)){for(let n of e)c(n,t);return t}let n=s(e);return n!==void 0&&!t.includes(n)&&t.push(n),t}function l(e){if(e===void 0)return[];let t=c(e).filter(e=>e!==null);return t.length>0?t:[null]}function u(e,t){let n=l(t);if(n.length!==0&&(e.type=n[0],n.length>1)){let t=[];for(let e of n.slice(1))t.includes(e)||t.push(e);t.length>0&&(e.optionalTypes=t)}}function d(t){e(t,`value`)||(t.type===String?t.value=``:t.type===Number?t.value=0:t.type===Boolean?t.value=!1:t.type===Array&&(t.value=[]))}function f(e,t,n){if(!n||e.type===null)return;let r=t&&typeof t==`object`&&!Array.isArray(t)?t:void 0,i=c(r?[r.type,r.optionalTypes]:t),a=i.includes(null),o=i.filter(e=>e!==null).length>1,s=
|
|
1
|
+
import{hasOwn as e}from"../../utils.mjs";import{WEVU_SLOT_NAMES_PROP as t,WEVU_SLOT_OWNER_ID_PROP as n,WEVU_SLOT_SCOPE_KEY as r}from"@weapp-core/constants";const i=`__wevu_allowNullPropInput`,a=`allowNullPropInput`,o=/* @__PURE__ */ new Map([[String,String],[Number,Number],[Boolean,Boolean],[Object,Object],[Array,Array],[Function,Function],[`String`,String],[`Number`,Number],[`Boolean`,Boolean],[`Object`,Object],[`Array`,Array],[`Function`,Function],[null,null],[`null`,null],[`Null`,null]]);function s(e){return o.get(e)}function c(e,t=[]){if(Array.isArray(e)){for(let n of e)c(n,t);return t}let n=s(e);return n!==void 0&&!t.includes(n)&&t.push(n),t}function l(e){if(e===void 0)return[];let t=c(e).filter(e=>e!==null);return t.length>0?t:[null]}function u(e,t){let n=l(t);if(n.length!==0&&(e.type=n[0],n.length>1)){let t=[];for(let e of n.slice(1))t.includes(e)||t.push(e);t.length>0&&(e.optionalTypes=t)}}function d(t){e(t,`value`)||(t.type===String?t.value=``:t.type===Number?t.value=0:t.type===Boolean?t.value=!1:t.type===Array&&(t.value=[]))}function f(e,t,n){if(!n||e.type===null)return;let r=t&&typeof t==`object`&&!Array.isArray(t)?t:void 0,i=c(r?[r.type,r.optionalTypes]:t),a=i.includes(null),o=i.filter(e=>e!==null).length>1,s=r?.required!==!0;(a||o||s)&&(a||d(e),e.type=null,delete e.optionalTypes)}function p(t,n){let r={};return t&&Object.entries(t).forEach(([t,i])=>{if(i!==void 0){if(i===null){r[t]={type:null};return}if(Array.isArray(i)||typeof i==`function`){let a={};u(a,i),e(a,`type`)||(a.type=null),f(a,i,n),r[t]=a;return}if(typeof i==`object`){if(t.endsWith(`Modifiers`)&&Object.keys(i).length===0){r[t]={type:Object,value:{}};return}let a={};if(`type`in i&&i.type!==void 0&&u(a,i.type),Array.isArray(i.optionalTypes)){let e=i.optionalTypes.map(e=>s(e)).filter(e=>e!=null);if(e.length>0){let t=Array.isArray(a.optionalTypes)?a.optionalTypes:[];for(let n of e)n!==a.type&&(t.includes(n)||t.push(n));t.length>0&&(a.optionalTypes=t)}}`observer`in i&&(typeof i.observer==`function`||typeof i.observer==`string`)&&(a.observer=i.observer);let o=`default`in i?i.default:i.value;o!==void 0&&(a.value=typeof o==`function`?o():o),e(a,`type`)||(a.type=null),f(a,i,n),r[t]=a}}}),r}function m(o,s,c){let l=!!(o[i]??o[a]),{[i]:u,[a]:d,...f}=o,m=o.properties,h=m&&typeof m==`object`&&Object.keys(m).length>0?m:void 0,g=c??h,_=!!(s||g),v=i=>{let a={...i??{}};return _?(e(a,n)||(a[n]={type:String,value:``}),e(a,r)||(a[r]={type:null,value:null}),e(a,t)||(a[t]={type:null,value:null}),a):a};if(g){let{properties:e,...t}=f,n=g,r=p(s,l);return{...t,properties:v({...r,...n})}}return{...f,properties:v(p(s,l))}}export{m as normalizeProps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{requireRuntimeCapability as e,runtimeCapabilityRegistry as t}from"../capabilities.mjs";import{runTeardownSteps as n}from"../teardown.mjs";import{hasOwn as r}from"../../utils.mjs";import{cloneSnapshotValue as i,isDeepEqualValue as a}from"../app/setData/snapshot.mjs";import{decodeWxmlEntities as o,resolveDatasetEventValue as s}from"../inlineDataset.mjs";import{getOwnerProxy as c,getOwnerSnapshot as l,getOwnerTarget as u,subscribeOwner as d}from"../scopedSlots.mjs";import{WEVU_BINDING_MANIFEST_KEY as f,WEVU_INLINE_HANDLER as p,WEVU_INLINE_MAP_KEY as m,WEVU_LAYOUT_HOSTS_KEY as h,WEVU_OWNER_HANDLER as g,WEVU_PROPS_DERIVED_KEYS_KEY as _,WEVU_PUBLIC_RUNTIME_KEY as v,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as y,WEVU_SLOT_FUNCTION_TOKEN as b,WEVU_SLOT_OWNER_ID_KEY as x,WEVU_SLOT_OWNER_ID_PROP as S,WEVU_SLOT_OWNER_KEY as C,WEVU_SLOT_OWNER_PROXY_KEY as w,WEVU_SLOT_PROPS_DATA_KEY as T,WEVU_SLOT_PROPS_KEY as E,WEVU_SLOT_SCOPE_KEY as D,WEVU_TEMPLATE_REFS_KEY as O}from"@weapp-core/constants";const k=[x,S,w,C,T,E,D];function A(e){
|
|
1
|
+
import{requireRuntimeCapability as e,runtimeCapabilityRegistry as t}from"../capabilities.mjs";import{runTeardownSteps as n}from"../teardown.mjs";import{hasOwn as r}from"../../utils.mjs";import{cloneSnapshotValue as i,isDeepEqualValue as a}from"../app/setData/snapshot.mjs";import{decodeWxmlEntities as o,resolveDatasetEventValue as s}from"../inlineDataset.mjs";import{getOwnerProxy as c,getOwnerSnapshot as l,getOwnerTarget as u,subscribeOwner as d}from"../scopedSlots.mjs";import{WEVU_BINDING_MANIFEST_KEY as f,WEVU_INLINE_HANDLER as p,WEVU_INLINE_MAP_KEY as m,WEVU_LAYOUT_HOSTS_KEY as h,WEVU_OWNER_HANDLER as g,WEVU_PROPS_DERIVED_KEYS_KEY as _,WEVU_PUBLIC_RUNTIME_KEY as v,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as y,WEVU_SLOT_FUNCTION_TOKEN as b,WEVU_SLOT_OWNER_ID_KEY as x,WEVU_SLOT_OWNER_ID_PROP as S,WEVU_SLOT_OWNER_KEY as C,WEVU_SLOT_OWNER_PROXY_KEY as w,WEVU_SLOT_PROPS_DATA_KEY as T,WEVU_SLOT_PROPS_KEY as E,WEVU_SLOT_SCOPE_KEY as D,WEVU_TEMPLATE_REFS_KEY as O}from"@weapp-core/constants";const k=[x,S,w,C,T,E,D];function A(e){let t=e?.currentTarget?.dataset??e?.target?.dataset??{},n=s(t,`wvArgs`,e),r=[];if(Array.isArray(n))r=n;else if(typeof n==`string`)try{r=JSON.parse(n)}catch{try{r=JSON.parse(o(n))}catch{r=[]}}return Array.isArray(r)||(r=[]),r.map(t=>t===`$event`?e:t)}function j(e){if(!e||typeof e!=`object`)return{};if(Array.isArray(e)){let t={};for(let n=0;n<e.length;n+=2){let r=e[n];typeof r==`string`&&r&&(t[r]=e[n+1])}return t}return e}function M(e){return Array.isArray(e)&&e[0]===b&&typeof e[1]==`string`}function N(e,t){return(...n)=>{let r=e?.selectOwnerComponent?.(),i=r?.[p];if(typeof i!=`function`)return;let a={wd:1,wi:t[1]},o=Array.isArray(t[2])?t[2]:[],s=Array.isArray(t[3])?t[3]:[];o.forEach((e,t)=>a[`wvS${t}`]=e),s.forEach((e,t)=>a[`wvI${t}`]=e);let c={type:`wv-slot-function`,detail:n,currentTarget:{dataset:a},target:{dataset:a}};return i.call(r,c)}}function P(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=M(i)?N(e,i):i;return n}function F(e){return e?.__wevu?.proxy??e?.[v]?.proxy??e}function I(e,t){if(!t||Object.keys(t).length===0)return;let n=F(e),r={};for(let[e,i]of Object.entries(t))try{let t;typeof i==`function`?t=i.call(n):typeof i?.get==`function`&&(t=i.get.call(n)),t!==void 0&&(r[e]=t)}catch{}return r}function L(e){e?.__wevu?.__wevu_flushSetupSnapshotSync?.()}function R(e,t,n){L(e);let o=I(e,t);if(!o||typeof e?.setData!=`function`)return;let s=r(e,`__wvScopedSlotComputedSnapshot`),c=e.__wvScopedSlotComputedSnapshot??{},l={},u={};for(let[e,t]of Object.entries(o))l[e]=i(t),(n?.force||!s||!r(c,e)||!a(c[e],t,20,{keys:1e4}))&&(u[e]=t);for(let e of Object.keys(c))r(o,e)||(u[e]=null);e.__wvScopedSlotComputedSnapshot=l,Object.keys(u).length>0&&e.setData(u)}function z(e,t){let n=r(t??{},D)?t[D]:e?.properties?.[D],o=r(t??{},E)?t[E]:e?.properties?.[E],s=j(n),c=j(o),l={...s,...c},u=!r(e,`__wvSlotPropsSnapshot`)||!a(e.__wvSlotPropsSnapshot??{},l,20,{keys:1e4}),d=u||!e[T]?P(e,l):e[T];u&&(e.__wvSlotPropsSnapshot=i(l)),e[T]=d;let f=e?.__wevu?.state,p=!(!f||typeof f!=`object`||r(f,T)&&a(f[T]??{},l,20,{keys:1e4}));return f&&typeof f==`object`&&(f[T]=d),{merged:d,runtimeSnapshotChanged:p,snapshot:l,snapshotChanged:u}}function B(e,t,n){let{runtimeSnapshotChanged:r,snapshot:i,snapshotChanged:a}=z(e,n);(a||r)&&typeof e?.setData==`function`&&e.setData({[T]:i}),a&&R(e,t)}function V(e,t){let n=!1;e[w]!==t&&(e[w]=t,n=!0);let r=e?.data;if(r&&typeof r==`object`&&r[w]!==t){try{Object.defineProperty(r,w,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch{r[w]=t}n=!0}let i=e?.__wevu?.state;return i&&typeof i==`object`&&i[w]!==t&&(i[w]=t,n=!0),n}function H(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function U(e,t,n,r){if(typeof e==`function`){n[t]=e;return}if(typeof e!=`object`||!e)return e;if(r.has(e))return;if(Array.isArray(e)){r.add(e);let i=e.map((e,i)=>{let a=U(e,`${t}.${i}`,n,r);return a===void 0?null:a});return r.delete(e),i}if(!H(e))return i(e);r.add(e);let a={};for(let[i,o]of Object.entries(e)){let e=U(o,`${t}.${i}`,n,r);e!==void 0&&(a[i]=e)}return r.delete(e),a}function W(e){let t={},n=U(e,C,t,/* @__PURE__ */ new WeakSet);return{[C]:n,...t}}function G(e,t,n,o){let s=V(e,n),{snapshotChanged:c}=z(e),l=t||{},u=!r(e,`__wvOwnerSnapshot`)||!a(e.__wvOwnerSnapshot??{},l,20,{keys:1e4});if(u){e.__wvOwnerSnapshot=i(l),e[C]=l;let t=e?.__wevu?.state;t&&typeof t==`object`&&(t[C]=l)}u&&typeof e?.setData==`function`&&e.setData(W(l)),(u||s||c)&&R(e,o)}function K(e,t,n){if(!t){typeof e?.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerUnsub=void 0,e.__wvOwnerBoundId=``,V(e,void 0);return}let r=(t,r)=>{G(e,t,r,n)};e.__wvOwnerBoundId!==t&&(typeof e.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerBoundId=t,e.__wvOwnerUnsub=d(t,r));let i=l(t);i&&r(i,c(t))}function q(e){return e?.properties?.[S]??e?.properties?.[x]??``}function J(e,t){B(e,t);let n=q(e);n&&K(e,n,t)}function Y(){let e={[C]:{},[T]:{}};return Object.defineProperty(e,w,{value:void 0,configurable:!0,enumerable:!1,writable:!0}),e}function X(r){let i=r?.computed,a=r?.layoutHosts,o=r?.templateRefs;o?.length&&e(`templateRefs`,`createWevuScopedSlotComponent(templateRefs)`);let c=!!(r?.inlineMap&&Object.keys(r.inlineMap).length);c&&e(`inlineEvents`,`createWevuScopedSlotComponent(inlineMap)`),a?.length&&e(`layout`,`createWevuScopedSlotComponent(layoutHosts)`);let l=e=>{let t=q(e);return t?u(t):void 0},d={[y]:!0,options:{virtualHost:!0},setData:{omit:k},[_]:k,properties:{[S]:{type:String,value:``,observer(e){K(this,e||``,i)}},[x]:{type:String,value:``,observer(e){K(this,e||``,i)}},[E]:{type:null,value:null,observer(e){B(this,i,{[E]:e})}},[D]:{type:null,value:null,observer(e){B(this,i,{[D]:e})}}},data:Y,lifetimes:{attached(){J(this,i)},ready(){J(this,i),R(this,i,{force:!0});let e=l(this);e&&o?.length&&t.templateRefs?.schedule(this,void 0,e)},detached(){let e=l(this);n([()=>{e&&o?.length&&t.templateRefs?.clear(this,e)},()=>{typeof this.__wvOwnerUnsub==`function`&&this.__wvOwnerUnsub()},()=>{this.__wvOwnerUnsub=void 0,this.__wvOwnerBoundId=``},()=>V(this,void 0)])}},methods:{[g](e){let n=this[w],r=this.__wevu?.methods?.[m];if(c){let i=t.inlineEvents?.run(n,void 0,e,r);if(i!==void 0)return i}if(!n)return;let i=e?.currentTarget?.dataset??e?.target?.dataset??{},a=s(i,`wvHandler`,e);if(typeof a!=`string`||!a)return;let o=n?.[a];if(typeof o!=`function`)return;let l=A(e);return o.apply(n,l)}}};return r?.computed&&Object.keys(r.computed).length>0&&(d.computed=r.computed),r?.inlineMap&&Object.keys(r.inlineMap).length>0&&(d.methods={...d.methods,[m]:r.inlineMap}),o?.length&&(d[O]=o),a?.length&&(d[h]=a),r?.[f]&&(d[f]=r[f]),d}export{X as createScopedSlotOptions};
|