wevu 7.5.0 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alipay/jsx-runtime.d.mts +0 -2
- package/dist/config/defaults.d.mts +42 -0
- package/dist/config/pageFeatures.d.mts +49 -0
- package/dist/config.d.mts +4 -0
- package/dist/config.mjs +1 -0
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.mjs +1 -2
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.mjs +1 -2
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.mjs +1 -2
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.mjs +1 -2
- package/dist/dev/api/vitest/setup.mjs +1 -2
- package/dist/dev/package.mjs +2 -3
- package/dist/dev/reactivity/asyncDerivation.mjs +1 -2
- package/dist/dev/reactivity/computed.mjs +1 -2
- package/dist/dev/reactivity/computed.mjs.map +1 -1
- package/dist/dev/reactivity/core.mjs +2 -3
- package/dist/dev/reactivity/reactive/mutation.mjs +1 -2
- package/dist/dev/reactivity/reactive/patch.mjs +1 -2
- package/dist/dev/reactivity/reactive/patchState.mjs +1 -2
- package/dist/dev/reactivity/reactive/shallow.mjs +1 -2
- package/dist/dev/reactivity/reactive/shared.mjs +1 -2
- package/dist/dev/reactivity/reactive/state.mjs +1 -2
- package/dist/dev/reactivity/reactive.mjs +1 -2
- package/dist/dev/reactivity/readonly.mjs +1 -2
- package/dist/dev/reactivity/ref.mjs +2 -3
- package/dist/dev/reactivity/ref.mjs.map +1 -1
- package/dist/dev/reactivity/shallowRef.mjs +1 -2
- package/dist/dev/reactivity/toRefs.mjs +1 -2
- package/dist/dev/reactivity/traverse.mjs +1 -2
- package/dist/dev/reactivity/watch/helpers.mjs +1 -2
- package/dist/dev/reactivity/watch/types.mjs +1 -2
- package/dist/dev/reactivity/watch.mjs +1 -2
- package/dist/dev/router/auto-routes.mjs +1 -2
- package/dist/dev/router/backNavigation.mjs +1 -2
- package/dist/dev/router/createRouter.mjs +1 -2
- package/dist/dev/router/initialNavigation.mjs +1 -2
- package/dist/dev/router/instance.mjs +1 -2
- package/dist/dev/router/navigationApi.mjs +1 -2
- package/dist/dev/router/navigationCore.mjs +1 -2
- package/dist/dev/router/navigationResult.mjs +1 -2
- package/dist/dev/router/navigationTarget.mjs +1 -2
- package/dist/dev/router/navigationTargetHelpers.mjs +1 -2
- package/dist/dev/router/resolve.mjs +1 -2
- package/dist/dev/router/routeRegistry.mjs +1 -2
- package/dist/dev/router/routeSync.mjs +1 -2
- package/dist/dev/router/scrollRestoration/adapters.mjs +1 -2
- package/dist/dev/router/scrollRestoration/controller.mjs +1 -2
- package/dist/dev/router/scrollRestoration/host.mjs +1 -2
- package/dist/dev/router/scrollRestoration/index.mjs +1 -2
- package/dist/dev/router/types.mjs +1 -2
- package/dist/dev/router/useRoute.mjs +1 -2
- package/dist/dev/router/useRouter.mjs +1 -2
- package/dist/dev/routerInternal/location.mjs +1 -2
- package/dist/dev/routerInternal/matching.mjs +1 -2
- package/dist/dev/routerInternal/params.mjs +1 -2
- package/dist/dev/routerInternal/path.mjs +1 -2
- package/dist/dev/routerInternal/query.mjs +1 -2
- package/dist/dev/routerInternal/records.mjs +1 -2
- package/dist/dev/routerInternal/recordsWarnings.mjs +1 -2
- package/dist/dev/routerInternal/snapshots.mjs +1 -2
- package/dist/dev/runtime/app/computed.mjs +1 -2
- package/dist/dev/runtime/app/context.mjs +1 -2
- package/dist/dev/runtime/app/diagnostics.mjs +1 -2
- package/dist/dev/runtime/app/mount.mjs +1 -2
- package/dist/dev/runtime/app/pending.mjs +1 -2
- package/dist/dev/runtime/app/setData/commitTracker.mjs +1 -2
- package/dist/dev/runtime/app/setData/observation.mjs +1 -2
- package/dist/dev/runtime/app/setData/patchScheduler.mjs +1 -2
- package/dist/dev/runtime/app/setData/payload.mjs +1 -2
- package/dist/dev/runtime/app/setData/scheduler.mjs +1 -2
- package/dist/dev/runtime/app/setData/snapshot.mjs +1 -2
- package/dist/dev/runtime/app/setDataOptions.mjs +1 -2
- package/dist/dev/runtime/app.mjs +1 -2
- package/dist/dev/runtime/bindModel.mjs +1 -2
- package/dist/dev/runtime/bindingManifest.mjs +1 -2
- package/dist/dev/runtime/capabilities.mjs +1 -2
- package/dist/dev/runtime/css.mjs +1 -2
- package/dist/dev/runtime/defaults.mjs +1 -2
- package/dist/dev/runtime/define/componentDefinition.mjs +1 -2
- package/dist/dev/runtime/define/initialComputed.mjs +1 -2
- package/dist/dev/runtime/define/options.mjs +1 -2
- package/dist/dev/runtime/define/optionsApi.mjs +1 -2
- package/dist/dev/runtime/define/props.mjs +1 -2
- package/dist/dev/runtime/define/scopedSlotOptions.mjs +1 -2
- package/dist/dev/runtime/define/setupResult.mjs +4 -7
- package/dist/dev/runtime/define/setupResult.mjs.map +1 -1
- package/dist/dev/runtime/define.mjs +3 -9
- package/dist/dev/runtime/define.mjs.map +1 -1
- package/dist/dev/runtime/diff.mjs +1 -2
- package/dist/dev/runtime/disposables.mjs +1 -2
- package/dist/dev/runtime/elementIntersectionObserver.mjs +1 -2
- package/dist/dev/runtime/emit.mjs +1 -2
- package/dist/dev/runtime/features/inlineEvents.mjs +1 -2
- package/dist/dev/runtime/features/jsxIslands.mjs +1 -2
- package/dist/dev/runtime/features/layout.mjs +1 -2
- package/dist/dev/runtime/features/patchStrategy.mjs +1 -2
- package/dist/dev/runtime/features/publicLayout.mjs +1 -2
- package/dist/dev/runtime/features/scopedSlots.mjs +1 -2
- package/dist/dev/runtime/features/setDataHighFrequencyWarning.mjs +1 -2
- package/dist/dev/runtime/features/templateRefs.mjs +1 -2
- package/dist/dev/runtime/hooks/base.mjs +1 -2
- package/dist/dev/runtime/hooks/pageScroll.mjs +1 -2
- package/dist/dev/runtime/hooks/register.mjs +1 -2
- package/dist/dev/runtime/hooks/vue.mjs +1 -2
- package/dist/dev/runtime/inlineDataset.mjs +1 -2
- package/dist/dev/runtime/internal.mjs +1 -2
- package/dist/dev/runtime/intersectionObserver.mjs +1 -2
- package/dist/dev/runtime/jsxIsland.mjs +1 -2
- package/dist/dev/runtime/layoutBridge.mjs +1 -2
- package/dist/dev/runtime/layoutComponentMatcher.mjs +1 -2
- package/dist/dev/runtime/nativeBridge.mjs +1 -2
- package/dist/dev/runtime/navigationLifecycle.mjs +1 -2
- package/dist/dev/runtime/noSetData.mjs +1 -2
- package/dist/dev/runtime/pageEnvironment.mjs +1 -2
- package/dist/dev/runtime/pageLayout.mjs +1 -2
- package/dist/dev/runtime/pageLayout.mjs.map +1 -1
- package/dist/dev/runtime/pageScroll.mjs +1 -2
- package/dist/dev/runtime/platform/current.mjs +1 -2
- package/dist/dev/runtime/platform/generic.mjs +1 -2
- package/dist/dev/runtime/platform/globals.mjs +1 -2
- package/dist/dev/runtime/platform.mjs +1 -2
- package/dist/dev/runtime/provide.mjs +1 -2
- package/dist/dev/runtime/provideContext.mjs +1 -2
- package/dist/dev/runtime/provideStore.mjs +1 -2
- package/dist/dev/runtime/publicRuntime.mjs +1 -2
- package/dist/dev/runtime/pullDownRefresh.mjs +1 -2
- package/dist/dev/runtime/register/app.mjs +1 -2
- package/dist/dev/runtime/register/component/alipay.mjs +1 -2
- package/dist/dev/runtime/register/component/alipayRegistration.mjs +1 -2
- package/dist/dev/runtime/register/component/features.mjs +1 -2
- package/dist/dev/runtime/register/component/hmrRegistration.mjs +14 -0
- package/dist/dev/runtime/register/component/hmrRegistration.mjs.map +1 -0
- package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs +1 -2
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs +1 -2
- package/dist/dev/runtime/register/component/lifecycle.mjs +1 -2
- package/dist/dev/runtime/register/component/methods.mjs +1 -2
- package/dist/dev/runtime/register/component/options.mjs +1 -2
- package/dist/dev/runtime/register/component/props.mjs +5 -6
- package/dist/dev/runtime/register/component/props.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +7 -6
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerNativeDefinition.mjs +1 -2
- package/dist/dev/runtime/register/component.mjs +23 -14
- package/dist/dev/runtime/register/component.mjs.map +1 -1
- package/dist/dev/runtime/register/inline.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +3 -27
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance.mjs +12 -14
- package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs +1 -2
- package/dist/dev/runtime/register/setup.mjs +1 -2
- package/dist/dev/runtime/register/snapshot.mjs +1 -2
- package/dist/dev/runtime/register/watch.mjs +2 -5
- package/dist/dev/runtime/register/watch.mjs.map +1 -1
- package/dist/dev/runtime/scopedSlots.mjs +1 -2
- package/dist/dev/runtime/selectorQuery.mjs +1 -2
- package/dist/dev/runtime/setupTracking.mjs +1 -2
- package/dist/dev/runtime/teardown.mjs +1 -2
- package/dist/dev/runtime/template.mjs +1 -2
- package/dist/dev/runtime/templateRefs/helpers.mjs +1 -2
- package/dist/dev/runtime/templateRefs.mjs +1 -2
- package/dist/dev/runtime/uniAppHost.mjs +1 -2
- package/dist/dev/runtime/updatePerformance.mjs +1 -2
- package/dist/dev/runtime/use.mjs +1 -2
- package/dist/dev/runtime/vueCompat/context.mjs +1 -2
- package/dist/dev/runtime/vueCompat/model.mjs +1 -2
- package/dist/dev/runtime/vueCompat/router.mjs +1 -2
- package/dist/dev/runtime/vueCompat/templateRef.mjs +1 -2
- package/dist/dev/scheduler.mjs +1 -2
- package/dist/dev/store/actions.mjs +1 -2
- package/dist/dev/store/base.mjs +1 -2
- package/dist/dev/store/define/create.mjs +1 -2
- package/dist/dev/store/define.mjs +1 -2
- package/dist/dev/store/manager.mjs +1 -2
- package/dist/dev/store/storeToRefs.mjs +1 -2
- package/dist/dev/store/subscriptions.mjs +1 -2
- package/dist/dev/store/types.mjs +1 -2
- package/dist/dev/store/utils.mjs +1 -2
- package/dist/dev/store/view.mjs +1 -2
- package/dist/dev/utils.mjs +1 -2
- package/dist/dev/version.mjs +1 -2
- package/dist/dev/vue-demi.mjs +1 -2
- package/dist/fetch.d.mts +0 -2
- package/dist/index.d.mts +13 -8
- package/dist/internal-reactivity.d.mts +2 -1
- package/dist/jsx-runtime.d.mts +1 -2
- package/dist/jsxTypes.d.mts +1 -3
- package/dist/macros/shared.d.mts +2 -3
- package/dist/macros.d.mts +3 -12
- package/dist/miniprogram/jsx-runtime.d.mts +0 -2
- package/dist/package.mjs +1 -1
- package/dist/reactivity/asyncDerivation.d.mts +1 -2
- package/dist/reactivity/computed.d.mts +2 -8
- package/dist/reactivity/core.d.mts +1 -3
- package/dist/reactivity/core.mjs +1 -1
- package/dist/reactivity/index.d.mts +2 -1
- package/dist/reactivity/reactive/mutation.d.mts +1 -2
- package/dist/reactivity/reactive/patch.d.mts +1 -3
- package/dist/reactivity/reactive/patchState.mjs +1 -1
- package/dist/reactivity/reactive/shallow.d.mts +1 -3
- package/dist/reactivity/reactive/shared.d.mts +1 -3
- package/dist/reactivity/reactive.d.mts +0 -2
- package/dist/reactivity/readonly.d.mts +1 -3
- package/dist/reactivity/ref.d.mts +2 -4
- package/dist/reactivity/ref.mjs +1 -1
- package/dist/reactivity/shallowRef.d.mts +1 -3
- package/dist/reactivity/toRefs.d.mts +1 -2
- package/dist/reactivity/traverse.d.mts +1 -3
- package/dist/reactivity/watch/types.d.mts +1 -2
- package/dist/reactivity/watch.d.mts +0 -2
- package/dist/router/auto-routes.d.mts +0 -2
- package/dist/router/createRouter.d.mts +1 -3
- package/dist/router/navigationCore.d.mts +1 -3
- package/dist/router/resolve.d.mts +1 -3
- package/dist/router/scrollRestoration/adapters.d.mts +1 -3
- package/dist/router/scrollRestoration/controller.d.mts +1 -3
- package/dist/router/scrollRestoration/index.d.mts +0 -2
- package/dist/router/scrollRestoration/index.mjs +1 -1
- package/dist/router/scrollRestoration/types.d.mts +1 -3
- package/dist/router/types.d.mts +1 -2
- package/dist/router/useRoute.d.mts +1 -3
- package/dist/router/useRouter.d.mts +1 -3
- package/dist/router.d.mts +0 -2
- package/dist/routerInternal/query.d.mts +1 -3
- package/dist/routerInternal/types.d.mts +1 -3
- package/dist/runtime/app/pending.d.mts +1 -3
- package/dist/runtime/app/setData/commitTracker.d.mts +1 -3
- package/dist/runtime/app/setData/observation.d.mts +1 -2
- package/dist/runtime/app/setData/scheduler.d.mts +1 -3
- package/dist/runtime/app/setData/scheduler.mjs +1 -1
- package/dist/runtime/app.d.mts +2 -4
- package/dist/runtime/capabilities.d.mts +2 -4
- package/dist/runtime/css.d.mts +1 -3
- package/dist/runtime/defaults.d.mts +1 -3
- 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.d.mts +4 -4
- package/dist/runtime/define.mjs +1 -1
- package/dist/runtime/disposables.d.mts +1 -3
- package/dist/runtime/elementIntersectionObserver.d.mts +1 -3
- package/dist/runtime/features/inlineEvents.d.mts +1 -3
- package/dist/runtime/features/jsxIslands.d.mts +1 -3
- package/dist/runtime/features/layout.d.mts +1 -3
- package/dist/runtime/features/patchStrategy.d.mts +1 -3
- package/dist/runtime/features/publicLayout.d.mts +2 -3
- package/dist/runtime/features/scopedSlots.d.mts +2 -4
- package/dist/runtime/features/setDataHighFrequencyWarning.d.mts +1 -3
- package/dist/runtime/features/templateRefs.d.mts +1 -3
- package/dist/runtime/hooks/base.d.mts +1 -3
- package/dist/runtime/hooks/register.d.mts +1 -3
- package/dist/runtime/hooks/vue.d.mts +1 -3
- package/dist/runtime/index.d.mts +7 -4
- package/dist/runtime/intersectionObserver.d.mts +1 -3
- package/dist/runtime/jsxIsland.d.mts +1 -3
- package/dist/runtime/layoutBridge.d.mts +0 -2
- package/dist/runtime/noSetData.d.mts +1 -3
- package/dist/runtime/pageEnvironment.d.mts +1 -3
- package/dist/runtime/pageLayout.d.mts +2 -3
- package/dist/runtime/pageScroll.d.mts +1 -3
- package/dist/runtime/provide.d.mts +0 -2
- package/dist/runtime/provideStore.d.mts +1 -3
- package/dist/runtime/publicRuntime.d.mts +1 -3
- package/dist/runtime/pullDownRefresh.d.mts +1 -3
- package/dist/runtime/register/app.d.mts +2 -4
- package/dist/runtime/register/component/hmrRegistration.mjs +1 -0
- package/dist/runtime/register/component/props.mjs +1 -1
- package/dist/runtime/register/component/registerDefinition.mjs +1 -1
- package/dist/runtime/register/component.d.mts +2 -4
- package/dist/runtime/register/component.mjs +1 -1
- package/dist/runtime/register/inline.d.mts +1 -2
- package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
- package/dist/runtime/register/runtimeInstance.d.mts +2 -3
- package/dist/runtime/register/runtimeInstance.mjs +1 -1
- package/dist/runtime/register/setDataFrequencyWarning.mjs +1 -1
- package/dist/runtime/register/setup.d.mts +1 -2
- package/dist/runtime/register/watch.d.mts +1 -2
- package/dist/runtime/register/watch.mjs +1 -1
- package/dist/runtime/selectorQuery.d.mts +1 -3
- package/dist/runtime/template.d.mts +1 -3
- package/dist/runtime/templateRefTypes.d.mts +2 -6
- package/dist/runtime/types/core.d.mts +2 -8
- package/dist/runtime/types/miniprogram.d.mts +0 -2
- package/dist/runtime/types/miniprogramHost.d.mts +0 -2
- package/dist/runtime/types/miniprogramHostSources.d.mts +2 -3
- package/dist/runtime/types/options.d.mts +5 -53
- package/dist/runtime/types/props/propTypes.d.mts +1 -2
- package/dist/runtime/types/props/router.d.mts +1 -2
- package/dist/runtime/types/props/setup.d.mts +3 -4
- package/dist/runtime/types/runtime.d.mts +3 -4
- package/dist/runtime/types/setData.d.mts +1 -3
- package/dist/runtime/types.d.mts +5 -5
- package/dist/runtime/uniAppHost.d.mts +1 -2
- package/dist/runtime/updatePerformance.d.mts +1 -3
- package/dist/runtime/use.d.mts +1 -3
- package/dist/runtime/vueCompat/context.d.mts +1 -3
- package/dist/runtime/vueCompat/model.d.mts +2 -3
- package/dist/runtime/vueCompat/router.d.mts +1 -2
- package/dist/runtime/vueCompat/templateRef.d.mts +1 -3
- package/dist/scheduler.d.mts +1 -3
- package/dist/store/define.d.mts +1 -3
- package/dist/store/manager.d.mts +1 -3
- package/dist/store/storeToRefs.d.mts +1 -2
- package/dist/store/types.d.mts +3 -4
- package/dist/tt/jsx-runtime.d.mts +0 -2
- package/dist/types/definitions.d.mts +5 -0
- package/dist/types/pageLayout.d.mts +2 -0
- package/dist/types/pageMeta.d.mts +8 -0
- package/dist/types/reactivity.d.mts +11 -0
- package/dist/types.d.mts +5 -0
- package/dist/types.mjs +1 -0
- package/dist/version.d.mts +1 -3
- package/dist/vue-augment.d.mts +1 -3
- package/dist/vue-demi.d.mts +13 -9
- package/dist/vue-types.d.mts +3 -6
- package/dist/weapp/jsx-runtime.d.mts +0 -2
- package/package.json +22 -13
- /package/dist/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.mjs +0 -0
|
@@ -2,7 +2,6 @@ import { MutationKind, MutationOp, MutationRecord, addMutationRecorder, removeMu
|
|
|
2
2
|
import { PrelinkReactiveTreeOptions, prelinkReactiveTree, touchReactive } from "./reactive/patch.mjs";
|
|
3
3
|
import { isShallowReactive, shallowReactive } from "./reactive/shallow.mjs";
|
|
4
4
|
import { toRaw } from "./reactive/shared.mjs";
|
|
5
|
-
//#region src/reactivity/reactive.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* 读取响应式版本号(框架内部调试能力)。
|
|
8
7
|
* @internal
|
|
@@ -37,5 +36,4 @@ export declare function markRaw<T extends object>(value: T): T;
|
|
|
37
36
|
* @returns 若含有跳过标记则返回 true
|
|
38
37
|
*/
|
|
39
38
|
export declare function isRaw(value: unknown): boolean;
|
|
40
|
-
//#endregion
|
|
41
39
|
export { type MutationKind, type MutationOp, type MutationRecord, type PrelinkReactiveTreeOptions, addMutationRecorder, isShallowReactive, prelinkReactiveTree, removeMutationRecorder, shallowReactive, toRaw, touchReactive };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Ref } from "./ref.mjs";
|
|
2
|
-
//#region src/reactivity/readonly.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* readonly 会为对象/数组创建一个“浅层”只读代理,并为 Ref 创建只读包装。
|
|
5
4
|
* 选择浅层而非深层递归,是为了在小程序环境中保持实现和运行时开销最小,
|
|
@@ -22,5 +21,4 @@ export declare function isReadonly(value: unknown): boolean;
|
|
|
22
21
|
/**
|
|
23
22
|
* 判断值是否为响应式代理或只读代理。
|
|
24
23
|
*/
|
|
25
|
-
export declare function isProxy(value: unknown): boolean;
|
|
26
|
-
//#endregion
|
|
24
|
+
export declare function isProxy(value: unknown): boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import { Ref as Ref$1, ShallowRef as ShallowRef$1 } from "../types/reactivity.mjs";
|
|
1
2
|
import { ComputedRef, WritableComputedRef } from "./computed.mjs";
|
|
2
|
-
import { Ref as Ref$1, ShallowRef as ShallowRef$1 } from "../vue-types.mjs";
|
|
3
|
-
//#region src/reactivity/ref.d.ts
|
|
4
3
|
export type Ref<T = any, S = T> = Ref$1<T, S>;
|
|
5
4
|
export type ShallowRef<T = any> = ShallowRef$1<T>;
|
|
6
5
|
export type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;
|
|
@@ -22,5 +21,4 @@ export interface CustomRefOptions<T> {
|
|
|
22
21
|
set: (value: T) => void;
|
|
23
22
|
}
|
|
24
23
|
export type CustomRefSource<T> = CustomRefFactory<T> | CustomRefOptions<T>;
|
|
25
|
-
export declare function customRef<T>(factory: CustomRefSource<T>, defaultValue?: T): Ref<T>;
|
|
26
|
-
//#endregion
|
|
24
|
+
export declare function customRef<T>(factory: CustomRefSource<T>, defaultValue?: T): Ref<T>;
|
package/dist/reactivity/ref.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import e from"../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.mjs";import{trackEffects as t,triggerEffects as n}from"./core.mjs";import{convertToReactive as r,markRaw as i}from"./reactive.mjs";const a=`__v_isRef`;function o(e){try{Object.defineProperty(e,a,{value:!0,configurable:!0})}catch{e[a]=!0}return e}function s(e){return!!(e&&typeof e==`object`&&e.__v_isRef===!0)}var c=class{constructor(t){e(this,`_value`,void 0),e(this,`_rawValue`,void 0),e(this,`dep`,void 0),o(this),this._rawValue=t,this._value=r(t)}get value(){return this.dep||(this.dep=/* @__PURE__ */ new Set),t(this.dep),this._value}set value(e){Object.is(e,this._rawValue)||(this._rawValue=e,this._value=r(e),this.dep&&n(this.dep))}};function l(e){return s(e)?e:i(new c(e))}function u(e){return s(e)?e.value:e}function d(e){return typeof e==`function`?e():u(e)}var f=class{constructor(r,i){e(this,`_getValue`,void 0),e(this,`_setValue`,void 0),e(this,`dep`,void 0),o(this);let a=i,s=()=>{this.dep||(this.dep=/* @__PURE__ */ new Set),t(this.dep)},c=()=>{this.dep&&n(this.dep)},l=e=>e===void 0&&a!==void 0?a:e;if(typeof r==`function`){let e=r(s,c);this._getValue=()=>l(e.get()),this._setValue=t=>e.set(t);return}let u=r;this._getValue=()=>(s(),l(u.get())),this._setValue=e=>{u.set(e),c()}}get value(){return this._getValue()}set value(e){this._setValue(e)}};function p(e,t){return i(new f(e,t))}export{a as RefFlag,p as customRef,s as isRef,o as markAsRef,l as ref,d as toValue,u as unref};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Ref } from "./ref.mjs";
|
|
2
|
-
//#region src/reactivity/shallowRef.d.ts
|
|
3
2
|
export declare function shallowRef<T>(value: T): Ref<T>;
|
|
4
3
|
export declare function shallowRef<T>(value: T, defaultValue: T): Ref<T>;
|
|
5
4
|
/**
|
|
@@ -14,5 +13,4 @@ export declare function isShallowRef(r: any): r is Ref<any>;
|
|
|
14
13
|
*
|
|
15
14
|
* @param ref 需要触发的 ref
|
|
16
15
|
*/
|
|
17
|
-
export declare function triggerRef<T>(ref: Ref<T>): void;
|
|
18
|
-
//#endregion
|
|
16
|
+
export declare function triggerRef<T>(ref: Ref<T>): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Ref } from "./ref.mjs";
|
|
2
|
-
//#region src/reactivity/toRefs.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* 为源响应式对象的单个属性创建 ref,可读可写并与原属性保持同步。
|
|
5
4
|
*
|
|
@@ -39,4 +38,4 @@ export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
|
|
39
38
|
*/
|
|
40
39
|
type ToRef<T> = T extends Ref<any> ? T : Ref<T>;
|
|
41
40
|
export type ToRefs<T extends object> = { [K in keyof T]: ToRef<T[K]>; };
|
|
42
|
-
|
|
41
|
+
export {};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//#region src/reactivity/traverse.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* 深度遍历工具(框架内部依赖收集使用)。
|
|
4
3
|
* @internal
|
|
5
4
|
*/
|
|
6
|
-
export declare function traverse(value: any, depth?: number, seen?: Map<object, number>): any;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function traverse(value: any, depth?: number, seen?: Map<object, number>): any;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Ref } from "../ref.mjs";
|
|
2
2
|
import { ComputedRef } from "../computed.mjs";
|
|
3
|
-
//#region src/reactivity/watch/types.d.ts
|
|
4
3
|
export type OnCleanup = (cleanupFn: () => void) => void;
|
|
5
4
|
export type WatchEffect = (onCleanup: OnCleanup) => void;
|
|
6
5
|
export type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
|
|
@@ -39,4 +38,4 @@ export declare function setDeepWatchStrategy(strategy: DeepWatchStrategy): void;
|
|
|
39
38
|
* @internal
|
|
40
39
|
*/
|
|
41
40
|
export declare function getDeepWatchStrategy(): DeepWatchStrategy;
|
|
42
|
-
|
|
41
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DeepWatchStrategy, MapSources, MaybeUndefined, MultiWatchSources, OnCleanup, WatchCallback, WatchEffect, WatchEffectOptions, WatchMultiSources, WatchOptions, WatchScheduler, WatchSource, WatchSourceValue, WatchSources, WatchStopHandle, getDeepWatchStrategy, setDeepWatchStrategy } from "./watch/types.mjs";
|
|
2
|
-
//#region src/reactivity/watch.d.ts
|
|
3
2
|
export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
4
3
|
export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T extends ReadonlyArray<any> ? never : T, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
5
4
|
export declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(source: readonly [...T] | T, cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
@@ -17,5 +16,4 @@ export declare function watchPostEffect(effectFn: WatchEffect, options?: Omit<Wa
|
|
|
17
16
|
* 以同步刷新的方式运行副作用,与 Vue 的 `watchSyncEffect()` 兼容。
|
|
18
17
|
*/
|
|
19
18
|
export declare function watchSyncEffect(effectFn: WatchEffect, options?: Omit<WatchEffectOptions, 'flush'>): WatchStopHandle;
|
|
20
|
-
//#endregion
|
|
21
19
|
export { type MapSources, type MaybeUndefined, type MultiWatchSources, type OnCleanup, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, getDeepWatchStrategy, setDeepWatchStrategy };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { WevuAutoRoute } from "./types.mjs";
|
|
2
2
|
import { WevuNamedRouteMap } from "../router.mjs";
|
|
3
|
-
//#region src/router/auto-routes.d.ts
|
|
4
3
|
export type WevuAutoRoutes<TRouteMap extends object = WevuNamedRouteMap> = readonly WevuAutoRoute<TRouteMap>[];
|
|
5
4
|
export declare const routes: WevuAutoRoutes;
|
|
6
|
-
//#endregion
|
|
7
5
|
export type { WevuAutoRoute };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { RouterNavigation, UseRouterOptions } from "./types.mjs";
|
|
2
2
|
import { WevuNamedRouteMap } from "../router.mjs";
|
|
3
|
-
//#region src/router/createRouter.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* @description 创建高阶路由导航器(对齐 Vue Router 的 createRouter 心智)
|
|
6
5
|
*/
|
|
7
|
-
export declare function createRouter<TRouteMap extends object = WevuNamedRouteMap>(optionsInput?: UseRouterOptions<NoInfer<TRouteMap>>): RouterNavigation<TRouteMap>;
|
|
8
|
-
//#endregion
|
|
6
|
+
export declare function createRouter<TRouteMap extends object = WevuNamedRouteMap>(optionsInput?: UseRouterOptions<NoInfer<TRouteMap>>): RouterNavigation<TRouteMap>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { NavigationFailure, NavigationFailureTypeValue, RouteLocationNormalizedLoaded } from "./types.mjs";
|
|
2
2
|
import { WevuNamedRouteMap } from "../router.mjs";
|
|
3
|
-
//#region src/router/navigationCore.d.ts
|
|
4
3
|
export declare function createNavigationFailure<TRouteMap extends object = WevuNamedRouteMap>(type: NavigationFailureTypeValue, to?: RouteLocationNormalizedLoaded<NoInfer<TRouteMap>>, from?: RouteLocationNormalizedLoaded<NoInfer<TRouteMap>>, cause?: unknown): NavigationFailure<TRouteMap>;
|
|
5
|
-
export declare function isNavigationFailure<TRouteMap extends object = WevuNamedRouteMap>(error: unknown, type?: NavigationFailureTypeValue): error is NavigationFailure<TRouteMap>;
|
|
6
|
-
//#endregion
|
|
4
|
+
export declare function isNavigationFailure<TRouteMap extends object = WevuNamedRouteMap>(error: unknown, type?: NavigationFailureTypeValue): error is NavigationFailure<TRouteMap>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { RouteResolveCodec } from "../routerInternal/types.mjs";
|
|
2
2
|
import "../routerInternal/shared.mjs";
|
|
3
3
|
import { RouteLocationNormalizedLoaded, RouteLocationRaw, WevuBroadRouteMap } from "./types.mjs";
|
|
4
|
-
|
|
5
|
-
export declare function resolveRouteLocation(to: RouteLocationRaw<WevuBroadRouteMap>, currentPath?: string, codec?: RouteResolveCodec): RouteLocationNormalizedLoaded<WevuBroadRouteMap>;
|
|
6
|
-
//#endregion
|
|
4
|
+
export declare function resolveRouteLocation(to: RouteLocationRaw<WevuBroadRouteMap>, currentPath?: string, codec?: RouteResolveCodec): RouteLocationNormalizedLoaded<WevuBroadRouteMap>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ScrollRestorationHandle, ScrollRestorationRegistrationOptions, ScrollViewRestorationHandle } from "./types.mjs";
|
|
2
|
-
//#region src/router/scrollRestoration/adapters.d.ts
|
|
3
2
|
/** WebView 页面适配器;Skyline 没有隐式页面滚动容器。 */
|
|
4
3
|
export declare function usePageScrollRestoration(options?: ScrollRestorationRegistrationOptions): ScrollRestorationHandle;
|
|
5
4
|
/** 用属性控制 WebView/Skyline scroll-view,scroll 事件不产生 setData。 */
|
|
6
|
-
export declare function useScrollViewRestoration(options?: ScrollRestorationRegistrationOptions): ScrollViewRestorationHandle;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function useScrollViewRestoration(options?: ScrollRestorationRegistrationOptions): ScrollViewRestorationHandle;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import "../types.mjs";
|
|
2
2
|
import { ScrollRestorationController, ScrollRestorationOptions } from "./types.mjs";
|
|
3
3
|
import "./host.mjs";
|
|
4
|
-
//#region src/router/scrollRestoration/controller.d.ts
|
|
5
4
|
/** 创建显式启用的路由会话;不会安装全局默认滚动行为。 */
|
|
6
|
-
export declare function createScrollRestoration<TRouteMap extends object>(options: ScrollRestorationOptions<TRouteMap>): ScrollRestorationController;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function createScrollRestoration<TRouteMap extends object>(options: ScrollRestorationOptions<TRouteMap>): ScrollRestorationController;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ScrollRestorationContext, ScrollRestorationController, ScrollRestorationHandle, ScrollRestorationOptions, ScrollRestorationRegistrationOptions, ScrollViewRestorationHandle, UseScrollRestorationOptions } from "./types.mjs";
|
|
2
2
|
import "./host.mjs";
|
|
3
3
|
import { createScrollRestoration } from "./controller.mjs";
|
|
4
|
-
//#region src/router/scrollRestoration/index.d.ts
|
|
5
4
|
/** 在同步 setup 中注册快照;只恢复新实例,不覆盖原生保留页的位置。 */
|
|
6
5
|
export declare function useScrollRestoration<T extends object>(options: UseScrollRestorationOptions<T>): ScrollRestorationHandle;
|
|
7
|
-
//#endregion
|
|
8
6
|
export { type ScrollRestorationContext, type ScrollRestorationController, type ScrollRestorationHandle, type ScrollRestorationOptions, type ScrollRestorationRegistrationOptions, type ScrollViewRestorationHandle, type UseScrollRestorationOptions, createScrollRestoration };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{onScopeDispose as e}from"../../reactivity/core.mjs";import{assertInSetup as t,getCurrentSetupContext as n}from"../../runtime/hooks/base.mjs";import{getInitialNavigationPromise as r}from"../initialNavigation.mjs";import{addScrollHook as i,currentScrollPage as a,resolveScrollPage as o}from"./host.mjs";import{createScrollRestoration as s,resolveScrollController as c}from"./controller.mjs";import{WEVU_READY_CALLED_KEY as l}from"@weapp-core/constants";function u(){let e=t(`useScrollRestoration`),r=n()?.proxy;if(typeof r?.$nextTick!=`function`)throw TypeError(`scroll restoration 需要具有宿主提交屏障的 wevu setup 实例。`);return{instance:e,commit:()=>r.$nextTick()}}function d(t,n){let{instance:s,commit:d}=u(),f=c(t.controller),p=[],m,h,g=!1,_=!0,v=!1,y=!1,b=0,x=!!s[l],S=!1,C,w,T;function E(){(g||x&&S)&&w?.()}function D(){if(m||g)return;let e=o(s);if(!e)return;let r=f.resolveRoute(e);T.key=typeof t.key==`function`?t.key(r):t.key??r.fullPath;let a=f.register(e,T);m=e,h=r,p.push(a),S=!!e[l],p.push(i(e,`onReady`,()=>{S=!0,E(),T.restoreAutomatic()})),n?.onBindPage?.(e)}async function O(){if(g||f.disposed)return!1;if(D(),!m||!h)throw Error(`无法确定 scroll restoration 的原生归属页面,请在页面 attached 后恢复。`);if(!_||a()!==m)return!1;let e=++b,n=f.generation,i={route:h,routeEventId:f.transition?.page===m?f.transition.event.routeEventId:void 0,isActive:()=>!g&&!f.disposed&&_&&e===b&&n===f.generation&&a()===m};if(
|
|
1
|
+
import{onScopeDispose as e}from"../../reactivity/core.mjs";import{assertInSetup as t,getCurrentSetupContext as n}from"../../runtime/hooks/base.mjs";import{getInitialNavigationPromise as r}from"../initialNavigation.mjs";import{addScrollHook as i,currentScrollPage as a,resolveScrollPage as o}from"./host.mjs";import{createScrollRestoration as s,resolveScrollController as c}from"./controller.mjs";import{WEVU_READY_CALLED_KEY as l}from"@weapp-core/constants";function u(){let e=t(`useScrollRestoration`),r=n()?.proxy;if(typeof r?.$nextTick!=`function`)throw TypeError(`scroll restoration 需要具有宿主提交屏障的 wevu setup 实例。`);return{instance:e,commit:()=>r.$nextTick()}}function d(t,n){let{instance:s,commit:d}=u(),f=c(t.controller),p=[],m,h,g=!1,_=!0,v=!1,y=!1,b=0,x=!!s[l],S=!1,C,w,T;function E(){(g||x&&S)&&w?.()}function D(){if(m||g)return;let e=o(s);if(!e)return;let r=f.resolveRoute(e);T.key=typeof t.key==`function`?t.key(r):t.key??r.fullPath;let a=f.register(e,T);m=e,h=r,p.push(a),S=!!e[l],p.push(i(e,`onReady`,()=>{S=!0,E(),T.restoreAutomatic()})),n?.onBindPage?.(e)}async function O(){if(g||f.disposed)return!1;if(D(),!m||!h)throw Error(`无法确定 scroll restoration 的原生归属页面,请在页面 attached 后恢复。`);if(!_||a()!==m)return!1;let e=++b,n=f.generation,i={route:h,routeEventId:f.transition?.page===m?f.transition.event.routeEventId:void 0,isActive:()=>!g&&!f.disposed&&_&&e===b&&n===f.generation&&a()===m};if(x&&S||(C??(C=new Promise(e=>{w=e})),await C),!i.isActive()||await r(m)===!1||!i.isActive()||(await d(),!i.isActive()))return!1;let o=f.read(T.key,T.id);return await t.restore(o,i),i.isActive()}T={key:``,id:t.id??`default`,capture(){if(!(g||f.disposed||!m||!_||v)){v=!0;try{let e=t.capture();if(e!==null&&`then`in e&&typeof e.then==`function`)throw TypeError(`scroll restoration capture 必须同步返回快照,不能返回 Promise。`);f.save(T.key,T.id,e)}catch(e){f.clear(T.key,T.id),f.report(e)}}},invalidate(){b++,w?.(),C=void 0,w=void 0},restoreAutomatic(){let e=f.transition;!g&&!t.manual&&!y&&x&&S&&e?.fresh&&e.done&&e.page===m&&(y=!0,O().catch(f.report))},stop(){if(!g){g=!0,b++,E();for(let e of p)e();p.length=0,n?.onStop?.()}}};function k(){T.capture(),T.stop()}return p.push(i(s,`onAttached`,D),i(s,`onReady`,()=>{D(),x=!0,E(),T.restoreAutomatic()}),i(s,`onShow`,()=>{D(),_=!0,v=!1}),i(s,`onHide`,()=>{T.capture(),_=!1,T.invalidate()}),i(s,`onDetached`,k),i(s,`onUnload`,k)),e(k),D(),T.restoreAutomatic(),{automatic:f.controller.automatic&&!t.manual,scroll:O,clear:()=>{D(),m&&f.clear(T.key,T.id)},stop:T.stop}}function f(e){return d(e)}export{s as createScrollRestoration,u as getScrollSetupScope,d as registerScrollRestoration,f as useScrollRestoration};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Ref } from "../../reactivity/ref.mjs";
|
|
2
2
|
import "../../reactivity/index.mjs";
|
|
3
3
|
import { RouteLocationNormalizedLoaded, RouterNavigation } from "../types.mjs";
|
|
4
|
-
//#region src/router/scrollRestoration/types.d.ts
|
|
5
4
|
export interface ScrollRestorationController {
|
|
6
5
|
/** 当前宿主是否支持带 routeEventId 的自动路由关联。 */
|
|
7
6
|
readonly automatic: boolean;
|
|
@@ -56,5 +55,4 @@ export interface ScrollViewRestorationHandle extends ScrollRestorationHandle {
|
|
|
56
55
|
scrollLeft: number;
|
|
57
56
|
};
|
|
58
57
|
}) => void;
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
58
|
+
}
|
package/dist/router/types.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SetupContextRouter, TypedRouterTabBarUrl } from "../runtime/types/props/router.mjs";
|
|
2
2
|
import "../runtime/types/props.mjs";
|
|
3
3
|
import { WevuNamedRouteMap } from "../router.mjs";
|
|
4
|
-
//#region src/router/types.d.ts
|
|
5
4
|
export type LocationQueryValue = string | null;
|
|
6
5
|
export type LocationQueryValueRaw = LocationQueryValue | number | boolean | undefined;
|
|
7
6
|
export type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
|
|
@@ -263,4 +262,4 @@ export type WevuAutoRoute<TRouteMap extends object = WevuNamedRouteMap> = IsBroa
|
|
|
263
262
|
readonly path: WevuNamedRoutePath<TRouteMap, TName>;
|
|
264
263
|
readonly meta: StrictRouteRecordMeta<TRouteMap, TName>;
|
|
265
264
|
}; }[WevuRouteName<TRouteMap>];
|
|
266
|
-
|
|
265
|
+
export {};
|
|
@@ -3,7 +3,6 @@ import "../runtime/types/props.mjs";
|
|
|
3
3
|
import { RouteLocationNormalizedLoaded } from "./types.mjs";
|
|
4
4
|
import "./routeSync.mjs";
|
|
5
5
|
import { WevuNamedRouteMap } from "../router.mjs";
|
|
6
|
-
//#region src/router/useRoute.d.ts
|
|
7
6
|
export interface UseRouteOptions<TRouteMap extends object = WevuNamedRouteMap> {
|
|
8
7
|
resolveRoute?: (route: RouteLocationNormalizedLoaded<TRouteMap>) => RouteLocationNormalizedLoaded<TRouteMap>;
|
|
9
8
|
}
|
|
@@ -15,5 +14,4 @@ export declare function useNativeRouter(): SetupContextRouter;
|
|
|
15
14
|
/**
|
|
16
15
|
* @description 获取当前页面路径语义的原生 Page Router
|
|
17
16
|
*/
|
|
18
|
-
export declare function useNativePageRouter(): SetupContextRouter;
|
|
19
|
-
//#endregion
|
|
17
|
+
export declare function useNativePageRouter(): SetupContextRouter;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { RouterNavigation } from "./types.mjs";
|
|
2
2
|
import { WevuNamedRouteMap } from "../router.mjs";
|
|
3
|
-
//#region src/router/useRouter.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* @description 获取当前已创建的路由实例。
|
|
6
5
|
*/
|
|
7
|
-
export declare function useRouter<TRouteMap extends object = WevuNamedRouteMap>(): RouterNavigation<TRouteMap>;
|
|
8
|
-
//#endregion
|
|
6
|
+
export declare function useRouter<TRouteMap extends object = WevuNamedRouteMap>(): RouterNavigation<TRouteMap>;
|
package/dist/router.d.mts
CHANGED
|
@@ -13,7 +13,6 @@ import { useScrollRestoration } from "./router/scrollRestoration/index.mjs";
|
|
|
13
13
|
import { UseRouteOptions, useNativePageRouter, useNativeRouter, useRoute } from "./router/useRoute.mjs";
|
|
14
14
|
import { useRouter } from "./router/useRouter.mjs";
|
|
15
15
|
import { StaticPageDeclaration, StaticPageDeclaration as StaticPageDeclaration$1, StaticRouteValue } from "@wevu/compiler/page-route";
|
|
16
|
-
//#region src/router.d.ts
|
|
17
16
|
/**
|
|
18
17
|
* 由 weapp-vite 生成的项目级命名路由声明会扩展此接口。
|
|
19
18
|
*/
|
|
@@ -25,5 +24,4 @@ export interface WevuNamedRouteMap {}
|
|
|
25
24
|
* 参数只接受 `name` 与 `meta`;页面布局继续使用 `definePageMeta`,页面路径由构建工具推导。
|
|
26
25
|
*/
|
|
27
26
|
export declare function definePage(route: StaticPageDeclaration$1): void;
|
|
28
|
-
//#endregion
|
|
29
27
|
export { type AddRoute, type InitialNavigationMode, type LocationQuery, type LocationQueryRaw, type LocationQueryValue, type LocationQueryValueRaw, type NamedRouteRecord, type NamedRoutes, type NavigationAfterEach, type NavigationAfterEachContext, type NavigationErrorContext, type NavigationErrorHandler, type NavigationFailure, NavigationFailureType, type NavigationFailureTypeValue, type NavigationGuard, type NavigationGuardContext, type NavigationGuardResult, type NavigationMode, type NavigationRedirect, type RouteLocationNamedRaw, type RouteLocationNormalizedByName, type RouteLocationNormalizedLoaded, type RouteLocationRaw, type RouteLocationRedirectedFrom, type RouteMeta, type RouteParamValue, type RouteParamValueRaw, type RouteParams, type RouteParamsMode, type RouteParamsRaw, type RouteQueryParser, type RouteQueryStringifier, type RouteRecordInput, type RouteRecordMatched, type RouteRecordRaw, type RouteRecordRedirect, type RouterNavigateToOption, type RouterNavigation, type RouterReLaunchOption, type RouterRedirectToOption, type RouterResolve, type RouterSwitchTabOption, type ScrollRestorationContext, type ScrollRestorationController, type ScrollRestorationHandle, type ScrollRestorationOptions, type ScrollRestorationRegistrationOptions, type ScrollViewRestorationHandle, type SetupContextRouter, type StaticPageDeclaration, type StaticRouteValue, type TypedRouterTabBarUrl, type TypedRouterUrl, type UseRouteOptions, type UseRouterOptions, type UseScrollRestorationOptions, type WevuAutoRoute, type WevuBroadRouteMap, type WevuNamedRouteDefinition, type WevuNamedRouteMeta, type WevuNamedRoutePath, type WevuRouteName, type WevuTypedRouterRouteMap, createNavigationFailure, createRouter, createScrollRestoration, isNavigationFailure, parseQuery, resolveRouteLocation, stringifyQuery, useNativePageRouter, useNativeRouter, usePageScrollRestoration, useRoute, useRouter, useScrollRestoration, useScrollViewRestoration };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { LocationQuery, LocationQueryRaw } from "../router/types.mjs";
|
|
2
2
|
import "../router.mjs";
|
|
3
|
-
//#region src/routerInternal/query.d.ts
|
|
4
3
|
export declare function parseQuery(search: string): LocationQuery;
|
|
5
|
-
export declare function stringifyQuery(query?: LocationQueryRaw | LocationQuery): string;
|
|
6
|
-
//#endregion
|
|
4
|
+
export declare function stringifyQuery(query?: LocationQueryRaw | LocationQuery): string;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { RouteQueryParser, RouteQueryStringifier } from "../router/types.mjs";
|
|
2
2
|
import "../router.mjs";
|
|
3
|
-
//#region src/routerInternal/types.d.ts
|
|
4
3
|
export interface RouteResolveCodec {
|
|
5
4
|
parseQuery: RouteQueryParser;
|
|
6
5
|
stringifyQuery: RouteQueryStringifier;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
6
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { RuntimeApp } from "../types/runtime.mjs";
|
|
2
2
|
import "../types.mjs";
|
|
3
|
-
//#region src/runtime/app/pending.d.ts
|
|
4
3
|
export interface PendingRuntimeAppRegistration {
|
|
5
4
|
app: RuntimeApp<any, any, any>;
|
|
6
5
|
register: () => void;
|
|
7
6
|
}
|
|
8
|
-
export declare function takePendingRuntimeAppRegistration(): PendingRuntimeAppRegistration | undefined;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function takePendingRuntimeAppRegistration(): PendingRuntimeAppRegistration | undefined;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MiniProgramAdapter } from "../../types/miniprogram.mjs";
|
|
2
2
|
import "../../types.mjs";
|
|
3
3
|
import { PhysicalSetDataObserver } from "./observation.mjs";
|
|
4
|
-
//#region src/runtime/app/setData/commitTracker.d.ts
|
|
5
4
|
export type SetDataPayload = Record<string, unknown>;
|
|
6
5
|
export type SetDataAdapterSettlement = 'committed' | 'failed' | 'abandoned';
|
|
7
6
|
export type SetDataAdapterSettler = (settlement: SetDataAdapterSettlement, cause?: unknown) => void;
|
|
@@ -9,5 +8,4 @@ export interface CommitAwareSetDataAdapter extends MiniProgramAdapter {
|
|
|
9
8
|
__wevu_dispatchSetData?: (payload: SetDataPayload, settle: SetDataAdapterSettler, observer?: PhysicalSetDataObserver) => void;
|
|
10
9
|
__wevu_reportSetDataError?: (error: Error) => void;
|
|
11
10
|
__wevu_disposeSetData?: () => void;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
11
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SetDataDebugInfo } from "../../types/setData.mjs";
|
|
2
2
|
import "../../types.mjs";
|
|
3
3
|
import "./commitTracker.mjs";
|
|
4
|
-
//#region src/runtime/app/setData/observation.d.ts
|
|
5
4
|
type Phase = NonNullable<SetDataDebugInfo['phase']>;
|
|
6
5
|
export type SetDataCompletionBoundary = Phase['completion'];
|
|
7
6
|
export interface PhysicalSetDataObserver {
|
|
@@ -9,4 +8,4 @@ export interface PhysicalSetDataObserver {
|
|
|
9
8
|
returned: (returnedAt: number) => void;
|
|
10
9
|
complete: (boundary: SetDataCompletionBoundary) => void;
|
|
11
10
|
}
|
|
12
|
-
|
|
11
|
+
export {};
|
|
@@ -3,7 +3,6 @@ import "../../types.mjs";
|
|
|
3
3
|
import { CommitAwareSetDataAdapter } from "./commitTracker.mjs";
|
|
4
4
|
import "../../capabilities.mjs";
|
|
5
5
|
import { WevuRuntimeBindingManifestV1 } from "@weapp-core/constants";
|
|
6
|
-
//#region src/runtime/app/setData/scheduler.d.ts
|
|
7
6
|
export interface SetDataSchedulerOptions {
|
|
8
7
|
state: Record<string, any>;
|
|
9
8
|
setupState?: Record<string, any>;
|
|
@@ -47,5 +46,4 @@ export interface SetDataSchedulerOptions {
|
|
|
47
46
|
isMounted: () => boolean;
|
|
48
47
|
initialSnapshot?: Record<string, any>;
|
|
49
48
|
initialState?: Record<string, any>;
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
49
|
+
}
|
|
@@ -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{createSetDataObservation as l}from"./observation.mjs";import{collectSnapshot as u}from"./snapshot.mjs";import{createSetDataCommitTracker as d}from"./commitTracker.mjs";function f(f){let{state:p,setupState:m,snapshotOmitKeys:h,computedRefs:g,dirtyComputedKeys:_,includeComputed:v,setDataStrategy:y,currentAdapter:b,shouldIncludeKey:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w=!1,functionPaths:T,debug:E,debugWhen:D,debugSampleRate:O,bindingManifest:k,loopWarning:A,targetLabel:j,runTracker:M,isMounted:ee,initialSnapshot:N,initialState:P}=f,F=/* @__PURE__ */ new WeakMap,I=/* @__PURE__ */ new WeakMap,L={},R=Object.create(null),z=Object.create(null),B=[],V=-1/0,H=new Set(P&&typeof P==`object`?Object.keys(P):[]),U=e=>{if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype},W=(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)=>W(e,t[n]));if(U(e)&&U(t)){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>i(t,n)&&W(e[n],t[n]))}return!1},G=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:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T})};let s=n(o)?e(o):o;return{raw:s,version:t(s)}},K=(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`)?W(e.snapshot,t.snapshot):!1:e.raw===t.raw&&e.version===t.version,q=e=>x(e)&&!h?.has(e);if(N)for(let[e,t]of Object.entries(N))q(e)&&(L[e]=t);let te=()=>{if(!N)return;let t=n(p)?e(p):p,r=m&&typeof m==`object`?n(m)?e(m):m:void 0;for(let e of Object.keys(N))if(q(e)){if(r&&i(r,e))R[e]=G(r[e]);else if(i(t,e)){if(H.has(e))continue;t[e]=N[e],R[e]=G(t[e])}}},ne=t=>{let a=[],o=m&&typeof m==`object`?n(m)?e(m):m:void 0;for(let n of/* @__PURE__ */ new Set([...Object.keys(p),...o?Object.keys(o):[]])){if(!q(n))continue;let s=o&&i(o,n)?o[n]:p[n],c=r(s)?s.value:s;c&&typeof c==`object`&&e(c)===t&&a.push(n)}return a},J=(e,t)=>{if(!E)return;let n=e.reason!==`patch`&&e.reason!==`diff`;if(D===`fallback`&&!n||e.reason!==`commitFailure`&&O<1&&Math.random()>O)return;let r=e;if(k){let n=typeof t==`function`?t():t??[],i=e.reason===`needsFullSnapshot`||e.reason===`maxPatchKeys`||e.reason===`maxPayloadBytes`;r={...e,bindings:o(k,n,i)}}try{E(r)}catch{}},Y,X=f.debugPhases&&E?l({debug:E,debugWhen:D,debugSampleRate:O,targetLabel:j,committedRevision:()=>Y.state.committedRevision}):void 0;Y=d({observe:X?.revision,initialSnapshot:L,adapter:b,onFailure:e=>{J({mode:e.mode,reason:`commitFailure`,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:e.payloadKeys,revision:e.revision,committedRevision:e.committedRevision,targetLabel:j,message:e.error.message});try{b.__wevu_reportSetDataError?.(e.error)}catch{}}});let re=(e=0,t)=>{if(!A)return;let n=Date.now();B.push(n);let r=n-A.sampleWindowMs;for(;B.length&&B[0]<r;)B.shift();B.length<=A.maxFlushes||A.coolDownMs>0&&n-V<A.coolDownMs||(V=n,J({mode:y,reason:`loopWarning`,pendingPatchKeys:e,payloadKeys:0,computedDirtyKeys:v?_.size:0,flushCount:B.length,windowMs:A.sampleWindowMs,targetLabel:j,message:`${j?`${j} `:``}疑似运行时更新循环:${B.length} 次 setData flush/${A.sampleWindowMs}ms`},t))},Z=()=>u({state:p,setupState:m,computedRefs:g,includeComputed:v,shouldIncludeKey:q,plainCache:F,plainCacheEligibility:I,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T});te();let ie=()=>{let t=n(p)?e(p):p,r=m&&typeof m==`object`?n(m)?e(m):m:void 0,a=Y.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(!q(e))continue;l.add(e);let n=r&&i(r,e)?r:t,u=G(n[e]),f=R[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),
|
|
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{createSetDataObservation as l}from"./observation.mjs";import{collectSnapshot as u}from"./snapshot.mjs";import{createSetDataCommitTracker as d}from"./commitTracker.mjs";function f(f){let{state:p,setupState:m,snapshotOmitKeys:h,computedRefs:g,dirtyComputedKeys:_,includeComputed:v,setDataStrategy:y,currentAdapter:b,shouldIncludeKey:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w=!1,functionPaths:T,debug:E,debugWhen:D,debugSampleRate:O,bindingManifest:k,loopWarning:A,targetLabel:j,runTracker:M,isMounted:ee,initialSnapshot:N,initialState:P}=f,F=/* @__PURE__ */ new WeakMap,I=/* @__PURE__ */ new WeakMap,L={},R=Object.create(null),z=Object.create(null),B=[],V=-1/0,H=new Set(P&&typeof P==`object`?Object.keys(P):[]),U=e=>{if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype},W=(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)=>W(e,t[n]));if(U(e)&&U(t)){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>i(t,n)&&W(e[n],t[n]))}return!1},G=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:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T})};let s=n(o)?e(o):o;return{raw:s,version:t(s)}},K=(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`)?W(e.snapshot,t.snapshot):!1:e.raw===t.raw&&e.version===t.version,q=e=>x(e)&&!h?.has(e);if(N)for(let[e,t]of Object.entries(N))q(e)&&(L[e]=t);let te=()=>{if(!N)return;let t=n(p)?e(p):p,r=m&&typeof m==`object`?n(m)?e(m):m:void 0;for(let e of Object.keys(N))if(q(e)){if(r&&i(r,e))R[e]=G(r[e]);else if(i(t,e)){if(H.has(e))continue;t[e]=N[e],R[e]=G(t[e])}}},ne=t=>{let a=[],o=m&&typeof m==`object`?n(m)?e(m):m:void 0;for(let n of/* @__PURE__ */ new Set([...Object.keys(p),...o?Object.keys(o):[]])){if(!q(n))continue;let s=o&&i(o,n)?o[n]:p[n],c=r(s)?s.value:s;c&&typeof c==`object`&&e(c)===t&&a.push(n)}return a},J=(e,t)=>{if(!E)return;let n=e.reason!==`patch`&&e.reason!==`diff`;if(D===`fallback`&&!n||e.reason!==`commitFailure`&&O<1&&Math.random()>O)return;let r=e;if(k){let n=typeof t==`function`?t():t??[],i=e.reason===`needsFullSnapshot`||e.reason===`maxPatchKeys`||e.reason===`maxPayloadBytes`;r={...e,bindings:o(k,n,i)}}try{E(r)}catch{}},Y,X=f.debugPhases&&E?l({debug:E,debugWhen:D,debugSampleRate:O,targetLabel:j,committedRevision:()=>Y.state.committedRevision}):void 0;Y=d({observe:X?.revision,initialSnapshot:L,adapter:b,onFailure:e=>{J({mode:e.mode,reason:`commitFailure`,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:e.payloadKeys,revision:e.revision,committedRevision:e.committedRevision,targetLabel:j,message:e.error.message});try{b.__wevu_reportSetDataError?.(e.error)}catch{}}});let re=(e=0,t)=>{if(!A)return;let n=Date.now();B.push(n);let r=n-A.sampleWindowMs;for(;B.length&&B[0]<r;)B.shift();B.length<=A.maxFlushes||A.coolDownMs>0&&n-V<A.coolDownMs||(V=n,J({mode:y,reason:`loopWarning`,pendingPatchKeys:e,payloadKeys:0,computedDirtyKeys:v?_.size:0,flushCount:B.length,windowMs:A.sampleWindowMs,targetLabel:j,message:`${j?`${j} `:``}疑似运行时更新循环:${B.length} 次 setData flush/${A.sampleWindowMs}ms`},t))},Z=()=>u({state:p,setupState:m,computedRefs:g,includeComputed:v,shouldIncludeKey:q,plainCache:F,plainCacheEligibility:I,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T});te();let ie=()=>{let t=n(p)?e(p):p,r=m&&typeof m==`object`?n(m)?e(m):m:void 0,a=Y.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(!q(e))continue;l.add(e);let n=r&&i(r,e)?r:t,u=G(n[e]),f=R[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),K(f,u)&&i(a,e)||(o[e]=c(n[e],s,{cache:F,cacheEligibility:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T,_path:e})),R[e]=u}for(let e of Object.keys(R))l.has(e)||(delete R[e],v&&i(g,e)||delete o[e]);if(!v){for(let e of Object.keys(z))delete z[e];return{snapshot:o,replacedTopLevelKeys:d}}for(let e of Object.keys(g)){if(!q(e))continue;u.add(e);let t=g[e].value,n=G(t);K(z[e],n)&&i(a,e)||(o[e]=c(t,s,{cache:F,cacheEligibility:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T,_path:e})),z[e]=n}for(let e of Object.keys(z))u.has(e)||(delete z[e],i(t,e)&&q(e)||delete o[e]);return{snapshot:o,replacedTopLevelKeys:d}},Q=(e=`diff`,t=0,n)=>{let r=y===`diff`?ie():void 0,i=r?.snapshot??Z(),a=Y.state.dispatchedSnapshot,o=Y.state.needsFullSnapshot,c=o?Y.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;J({mode:`diff`,reason:u,pendingPatchKeys:t,payloadKeys:l},Object.keys(c)),Y.dispatch({mode:`diff`,kind:o?`full`:`delta`,reason:u,snapshot:i,payload:c,pendingPatchKeys:t})},$=(e=0,t)=>ee()?(X?.prepare(),re(e,t),M(),!0):!1;return{collect:Z,emitDebug:J,getLatestSnapshot:()=>Y.state.dispatchedSnapshot,dispatchUpdate:Y.dispatch,needsFullSnapshot:()=>Y.state.needsFullSnapshot,job:e=>{if($())return Q(`diff`)},plainCache:F,plainCacheEligibility:I,prepareJob:$,resolveTopKeysByRoot:ne,runDiffUpdate:Q,shouldIncludeSnapshotKey:q,snapshot:()=>y===`patch`?Z():{...Y.state.dispatchedSnapshot},cloneLatestSnapshot:()=>({...Y.state.dispatchedSnapshot}),dispose:Y.dispose}}export{f as createSetDataScheduler};
|
package/dist/runtime/app.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { ComputedDefinitions, MethodDefinitions } from "
|
|
1
|
+
import { ComputedDefinitions, MethodDefinitions } from "../types/definitions.mjs";
|
|
2
2
|
import { RuntimeApp } from "./types/runtime.mjs";
|
|
3
3
|
import { CreateAppOptions } from "./types/options.mjs";
|
|
4
4
|
import "./types.mjs";
|
|
5
|
-
|
|
6
|
-
export declare function createApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: CreateAppOptions<D, C, M>): RuntimeApp<D, C, M>;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function createApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: CreateAppOptions<D, C, M>): RuntimeApp<D, C, M>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ComputedDefinitions, MethodDefinitions } from "./types/core.mjs";
|
|
2
|
-
import { InternalRuntimeState, RuntimeInstance } from "./types/runtime.mjs";
|
|
3
1
|
import { SetDataSnapshotOptions } from "./types/setData.mjs";
|
|
2
|
+
import { ComputedDefinitions, MethodDefinitions } from "../types/definitions.mjs";
|
|
3
|
+
import { InternalRuntimeState, RuntimeInstance } from "./types/runtime.mjs";
|
|
4
4
|
import "./types.mjs";
|
|
5
5
|
import { SetDataSchedulerOptions } from "./app/setData/scheduler.mjs";
|
|
6
6
|
import { InlineExpressionMap } from "./register/inline.mjs";
|
|
7
|
-
//#region src/runtime/capabilities.d.ts
|
|
8
7
|
export type RuntimeCapabilityName = 'patchStrategy' | 'templateRefs' | 'inlineEvents' | 'setDataHighFrequencyWarning' | 'scopedSlots' | 'layout' | 'jsxIslands';
|
|
9
8
|
export interface TemplateRefBinding {
|
|
10
9
|
selector: string;
|
|
@@ -73,5 +72,4 @@ export interface RuntimeCapabilityRegistry {
|
|
|
73
72
|
attachMethods: (methods: Record<string, (...args: any[]) => any>) => void;
|
|
74
73
|
};
|
|
75
74
|
}
|
|
76
|
-
//#endregion
|
|
77
75
|
export type { SetDataSchedulerOptions };
|
package/dist/runtime/css.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComputedRef } from "../reactivity/computed.mjs";
|
|
2
2
|
import "../reactivity/index.mjs";
|
|
3
|
-
//#region src/runtime/css.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* 读取当前 SFC 的 CSS Modules 映射。
|
|
6
5
|
*/
|
|
@@ -9,5 +8,4 @@ export declare function useCssModule(name?: string): Record<string, string>;
|
|
|
9
8
|
* 注册编译器生成的响应式 CSS 变量。
|
|
10
9
|
* @internal
|
|
11
10
|
*/
|
|
12
|
-
export declare function useCssVars(getter: (context: Record<string, any>) => Record<string, unknown>): ComputedRef<string>;
|
|
13
|
-
//#endregion
|
|
11
|
+
export declare function useCssVars(getter: (context: Record<string, any>) => Record<string, unknown>): ComputedRef<string>;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { CreateAppOptions, DefineComponentOptions } from "./types/options.mjs";
|
|
2
2
|
import "./types.mjs";
|
|
3
|
-
//#region src/runtime/defaults.d.ts
|
|
4
3
|
export declare const INTERNAL_DEFAULTS_SCOPE_KEY = "__wevuDefaultsScope";
|
|
5
4
|
export interface WevuDefaults {
|
|
6
5
|
app?: Partial<CreateAppOptions<any, any, any>>;
|
|
7
6
|
component?: Partial<DefineComponentOptions<any, any, any, any>>;
|
|
8
7
|
}
|
|
9
8
|
export declare function setWevuDefaults(next: WevuDefaults): void;
|
|
10
|
-
export declare function resetWevuDefaults(): void;
|
|
11
|
-
//#endregion
|
|
9
|
+
export declare function resetWevuDefaults(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasOwn as e}from"../../utils.mjs";import{WEVU_NATIVE_DECLARATION_ADDRESS_PROP as t,WEVU_NATIVE_SLOT_CONTEXT_KEY as n,WEVU_SLOT_NAMES_PROP as r,WEVU_SLOT_OWNER_ID_PROP as i,WEVU_SLOT_SCOPE_KEY as a}from"@weapp-core/constants";const o=`__wevu_allowNullPropInput`,s=`allowNullPropInput`,c=/* @__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 l(e){return c.get(e)}function u(e,t=[]){if(Array.isArray(e)){for(let n of e)u(n,t);return t}let n=l(e);return n!==void 0&&!t.includes(n)&&t.push(n),t}function d(e){if(e===void 0)return[];let t=u(e).filter(e=>e!==null);return t.length>0?t:[null]}function f(e,t){let n=d(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 p(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 m(e,t,n){if(!n||e.type===null)return;let r=t&&typeof t==`object`&&!Array.isArray(t)?t:void 0,i=u(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||p(e),e.type=null,delete e.optionalTypes)}function h(t,n){let r={};return t&&Object.entries(t).forEach(([t,i])=>{if(i!==void 0){if(i===null)r[t]={type:null};else if(Array.isArray(i)||typeof i==`function`){let a={};f(a,i),e(a,`type`)||(a.type=null),m(a,i,n),r[t]=a}else 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&&f(a,i.type),Array.isArray(i.optionalTypes)){let e=i.optionalTypes.map(e=>l(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),m(a,i,n),r[t]=a}}}),r}function g(c,l,u){let d=!!(c[o]??c[s]),{[o]:f,[s]:p,...m}=c,g=c.properties,_=g&&typeof g==`object`&&Object.keys(g).length>0?g:void 0,v=u??_,y=!!(l||v),b=o=>{let s={...o??{}};return
|
|
1
|
+
import{hasOwn as e}from"../../utils.mjs";import{WEVU_NATIVE_DECLARATION_ADDRESS_PROP as t,WEVU_NATIVE_SLOT_CONTEXT_KEY as n,WEVU_SLOT_NAMES_PROP as r,WEVU_SLOT_OWNER_ID_PROP as i,WEVU_SLOT_SCOPE_KEY as a}from"@weapp-core/constants";const o=`__wevu_allowNullPropInput`,s=`allowNullPropInput`,c=/* @__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 l(e){return c.get(e)}function u(e,t=[]){if(Array.isArray(e)){for(let n of e)u(n,t);return t}let n=l(e);return n!==void 0&&!t.includes(n)&&t.push(n),t}function d(e){if(e===void 0)return[];let t=u(e).filter(e=>e!==null);return t.length>0?t:[null]}function f(e,t){let n=d(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 p(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 m(e,t,n){if(!n||e.type===null)return;let r=t&&typeof t==`object`&&!Array.isArray(t)?t:void 0,i=u(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||p(e),e.type=null,delete e.optionalTypes)}function h(t,n){let r={};return t&&Object.entries(t).forEach(([t,i])=>{if(i!==void 0){if(i===null)r[t]={type:null};else if(Array.isArray(i)||typeof i==`function`){let a={};f(a,i),e(a,`type`)||(a.type=null),m(a,i,n),r[t]=a}else 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&&f(a,i.type),Array.isArray(i.optionalTypes)){let e=i.optionalTypes.map(e=>l(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),m(a,i,n),r[t]=a}}}),r}function g(c,l,u){let d=!!(c[o]??c[s]),{[o]:f,[s]:p,...m}=c,g=c.properties,_=g&&typeof g==`object`&&Object.keys(g).length>0?g:void 0,v=u??_,y=!!(l||v),b=o=>{let s={...o??{}};return import.meta.env?.PLATFORM&&import.meta.env?.PLATFORM!==`weapp`||c[n]!==!0||(s[t]={type:Array,value:[]}),y&&(e(s,i)||(s[i]={type:String,value:``}),e(s,a)||(s[a]={type:null,value:null}),e(s,r)||(s[r]={type:null,value:null})),s};if(v){let{properties:e,...t}=m,n=v,r=h(l,d);return{...t,properties:b({...r,...n})}}return{...m,properties:b(h(l,d))}}export{g 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_NATIVE_SLOT_CONTEXT_KEY as g,WEVU_OWNER_HANDLER as _,WEVU_PROPS_DERIVED_KEYS_KEY as v,WEVU_PUBLIC_RUNTIME_KEY as y,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as b,WEVU_SLOT_FUNCTION_TOKEN as x,WEVU_SLOT_OWNER_ID_KEY as S,WEVU_SLOT_OWNER_ID_PROP as C,WEVU_SLOT_OWNER_KEY as w,WEVU_SLOT_OWNER_PROXY_KEY as T,WEVU_SLOT_PROPS_DATA_KEY as E,WEVU_SLOT_PROPS_KEY as D,WEVU_SLOT_SCOPE_KEY as O,WEVU_TEMPLATE_REFS_KEY as k}from"@weapp-core/constants";const A=[S,C,T,w,E,D,O];function j(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 M(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 N(e){return Array.isArray(e)&&e[0]===x&&typeof e[1]==`string`}function P(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 F(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=N(i)?P(e,i):i;return n}function I(e){return e?.__wevu?.proxy??e?.[y]?.proxy??e}function L(e,t){if(!t||Object.keys(t).length===0)return;let n=I(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 R(e){e?.__wevu?.__wevu_flushSetupSnapshotSync?.()}function z(e,t,n){R(e);let o=L(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)
|
|
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_NATIVE_SLOT_CONTEXT_KEY as g,WEVU_OWNER_HANDLER as _,WEVU_PROPS_DERIVED_KEYS_KEY as v,WEVU_PUBLIC_RUNTIME_KEY as y,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as b,WEVU_SLOT_FUNCTION_TOKEN as x,WEVU_SLOT_OWNER_ID_KEY as S,WEVU_SLOT_OWNER_ID_PROP as C,WEVU_SLOT_OWNER_KEY as w,WEVU_SLOT_OWNER_PROXY_KEY as T,WEVU_SLOT_PROPS_DATA_KEY as E,WEVU_SLOT_PROPS_KEY as D,WEVU_SLOT_SCOPE_KEY as O,WEVU_TEMPLATE_REFS_KEY as k}from"@weapp-core/constants";const A=[S,C,T,w,E,D,O];function j(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 M(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 N(e){return Array.isArray(e)&&e[0]===x&&typeof e[1]==`string`}function P(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 F(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=N(i)?P(e,i):i;return n}function I(e){return e?.__wevu?.proxy??e?.[y]?.proxy??e}function L(e,t){if(!t||Object.keys(t).length===0)return;let n=I(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 R(e){e?.__wevu?.__wevu_flushSetupSnapshotSync?.()}function z(e,t,n){R(e);let o=L(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 B(e,t){let n=r(t??{},O)?t[O]:e?.properties?.[O],o=r(t??{},D)?t[D]:e?.properties?.[D],s=M(n),c=M(o),l={...s,...c},u=!r(e,`__wvSlotPropsSnapshot`)||!a(e.__wvSlotPropsSnapshot??{},l,20,{keys:1e4}),d=u||!e[E]?F(e,l):e[E];u&&(e.__wvSlotPropsSnapshot=i(l)),e[E]=d;let f=e?.__wevu?.state,p=!(!f||typeof f!=`object`||r(f,E)&&a(f[E]??{},l,20,{keys:1e4}));return f&&typeof f==`object`&&(f[E]=d),{merged:d,runtimeSnapshotChanged:p,snapshot:l,snapshotChanged:u}}function V(e,t,n){let{runtimeSnapshotChanged:r,snapshot:i,snapshotChanged:a}=B(e,n);(a||r)&&typeof e?.setData==`function`&&e.setData({[E]:i}),a&&z(e,t)}function H(e,t){let n=!1;e[T]!==t&&(e[T]=t,n=!0);let r=e?.data;if(r&&typeof r==`object`&&r[T]!==t){try{Object.defineProperty(r,T,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch{r[T]=t}n=!0}let i=e?.__wevu?.state;return i&&typeof i==`object`&&i[T]!==t&&(i[T]=t,n=!0),n}function U(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function W(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=W(e,`${t}.${i}`,n,r);return a===void 0?null:a});return r.delete(e),i}if(!U(e))return i(e);r.add(e);let a={};for(let[i,o]of Object.entries(e)){let e=W(o,`${t}.${i}`,n,r);e!==void 0&&(a[i]=e)}return r.delete(e),a}function G(e){let t={},n=W(e,w,t,/* @__PURE__ */ new WeakSet);return{[w]:n,...t}}function K(e,t,n,o){let s=H(e,n),{snapshotChanged:c}=B(e),l=t||{},u=!r(e,`__wvOwnerSnapshot`)||!a(e.__wvOwnerSnapshot??{},l,20,{keys:1e4});if(u){e.__wvOwnerSnapshot=i(l),e[w]=l;let t=e?.__wevu?.state;t&&typeof t==`object`&&(t[w]=l)}u&&typeof e?.setData==`function`&&e.setData(G(l)),(u||s||c)&&z(e,o)}function q(e,t,n){if(!t){typeof e?.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerUnsub=void 0,e.__wvOwnerBoundId=``,H(e,void 0);return}let r=(t,r)=>{K(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 J(e){return e?.properties?.[C]??e?.properties?.[S]??``}function Y(e,t){V(e,t);let n=J(e);n&&q(e,n,t)}function X(){let e={[w]:{},[E]:{}};return Object.defineProperty(e,T,{value:void 0,configurable:!0,enumerable:!1,writable:!0}),e}function Z(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=J(e);return t?u(t):void 0},d={[g]:r?.[g],[b]:!0,options:{virtualHost:!0},setData:{omit:A},[v]:A,properties:{[C]:{type:String,value:``,observer(e){q(this,e||``,i)}},[S]:{type:String,value:``,observer(e){q(this,e||``,i)}},[D]:{type:null,value:null,observer(e){V(this,i,{[D]:e})}},[O]:{type:null,value:null,observer(e){V(this,i,{[O]:e})}}},data:X,lifetimes:{attached(){Y(this,i)},ready(){Y(this,i),z(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=``},()=>H(this,void 0)])}},methods:{[_](e){let n=this[T],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=j(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[k]=o),a?.length&&(d[h]=a),r?.[f]&&(d[f]=r[f]),d}export{Z as createScopedSlotOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toRaw as e}from"../../reactivity/reactive/shared.mjs";import{isReactive as t}from"../../reactivity/reactive.mjs";import{isRef as n}from"../../reactivity/ref.mjs";import{hasTrackableSetupBinding as r}from"../setupTracking.mjs";function i(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function a(e){return typeof e!=`object`||!e||n(e)||t(e)||Array.isArray(e)?!0:i(e)}function o(e,t){if(!t)return e;for(let n of Object.keys(t)){let r=Object.getOwnPropertyDescriptor(t,n);typeof r?.get==`function`&&typeof r.set==`function`?Object.defineProperty(e,n,r):Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t[n],writable:!0})}return e}function s(e,t,n){let r=Object.getOwnPropertyDescriptor(t,n);return typeof r?.get!=`function`||typeof r.set!=`function`?!1:(Object.defineProperty(e,n,r),!0)}function c(n,i,o
|
|
1
|
+
import{toRaw as e}from"../../reactivity/reactive/shared.mjs";import{isReactive as t}from"../../reactivity/reactive.mjs";import{isRef as n}from"../../reactivity/ref.mjs";import{hasTrackableSetupBinding as r}from"../setupTracking.mjs";function i(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function a(e){return typeof e!=`object`||!e||n(e)||t(e)||Array.isArray(e)?!0:i(e)}function o(e,t){if(!t)return e;for(let n of Object.keys(t)){let r=Object.getOwnPropertyDescriptor(t,n);typeof r?.get==`function`&&typeof r.set==`function`?Object.defineProperty(e,n,r):Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t[n],writable:!0})}return e}function s(e,t,n){let r=Object.getOwnPropertyDescriptor(t,n);return typeof r?.get!=`function`||typeof r.set!=`function`?!1:(Object.defineProperty(e,n,r),!0)}function c(n,i,o){let c=n?.methods??Object.create(null),l=n?.state??Object.create(null),u=n?.setupState??Object.create(null),d=t(l)?e(l):l,f=t(u)?e(u):u,p=!1;if(n&&!n.methods)try{n.methods=c}catch{}if(n&&!n.state)try{n.state=l}catch{}if(n&&!n.setupState)try{n.setupState=u}catch{}Object.keys(o).forEach(e=>{let t=o[e],u=s(f,o,e);if(typeof t==`function`&&!u){let r=(...e)=>t.apply(n?.proxy??n,e);c[e]=r,l[e]=r,f[e]=r,p=!0}else{if(r(t)&&n?.__wevu_trackSetupReactiveKey?.(e),l[e]=t,t===i||!a(t))try{Object.defineProperty(d,e,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch{}u||(f[e]=t)}}),n&&(n.methods=n.methods??c,n.state=n.state??l,p&&n.__wevu_touchSetupMethodsVersion?.())}export{c as applySetupResult,o as mergeSetupResultDescriptors,s as preserveSetupAccessor,a as shouldExposeInSnapshot};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { SetDataSnapshotOptions } from "./types/setData.mjs";
|
|
1
2
|
import { HostMiniProgramComponentPropertyOption } from "./types/miniprogramHost.mjs";
|
|
2
3
|
import { MiniProgramComponentRawOptions } from "./types/miniprogram.mjs";
|
|
3
4
|
import { ComponentPropsOptions, InferProps } from "./types/props/propTypes.mjs";
|
|
4
|
-
import {
|
|
5
|
+
import { ComputedDefinitions, MethodDefinitions } from "../types/definitions.mjs";
|
|
6
|
+
import { ComponentPublicInstance } from "./types/core.mjs";
|
|
5
7
|
import { RuntimeApp } from "./types/runtime.mjs";
|
|
6
8
|
import { DefineComponent, ShallowUnwrapRef } from "../vue-types.mjs";
|
|
7
|
-
import { SetDataSnapshotOptions } from "./types/setData.mjs";
|
|
8
9
|
import { DefineComponentOptions } from "./types/options.mjs";
|
|
9
10
|
import "./types.mjs";
|
|
10
11
|
import { WevuRuntimeBindingManifestV1 } from "@weapp-core/constants";
|
|
11
|
-
//#region src/runtime/define.d.ts
|
|
12
12
|
/**
|
|
13
13
|
* defineComponent 返回的组件定义描述,用于手动注册或高级用法。
|
|
14
14
|
*/
|
|
@@ -114,4 +114,4 @@ export declare function getWevuComponentLifecycleDefinition(definition: object):
|
|
|
114
114
|
export declare function createWevuComponent<P extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions>(options: DefineComponentOptions<P, D, C, M> & {
|
|
115
115
|
properties?: HostMiniProgramComponentPropertyOption;
|
|
116
116
|
}): void;
|
|
117
|
-
|
|
117
|
+
export {};
|
package/dist/runtime/define.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyWevuComponentDefaults as e}from"./defaults.mjs";import{requireRuntimeCapability as t}from"./capabilities.mjs";import{hasOwn as n}from"../utils.mjs";import{hasBindingOutputPath as r,resolveBindingManifest as i}from"./bindingManifest.mjs";import{applySetupResult as a,mergeSetupResultDescriptors as o}from"./define/setupResult.mjs";import{runSetupFunction as s}from"./register/setup.mjs";import{createRuntimeComponentDefinition as c}from"./define/componentDefinition.mjs";import{resolveNativeInitialData as l}from"./define/initialComputed.mjs";import{resolveVueComponentOptions as u}from"./define/options.mjs";import{applyOptionsApiProvide as d,resolveOptionsApiInjections as f}from"./define/optionsApi.mjs";import{normalizeProps as p}from"./define/props.mjs";import{WEVU_BINDING_MANIFEST_KEY as m,WEVU_CSS_MODULES_KEY as h,WEVU_FUNCTION_PROP_PATHS_KEY as g,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as _,WEVU_SLOT_OWNER_ID_KEY as v,WEVU_SLOT_OWNER_ID_PROP as y,WEVU_SLOT_SCOPE_KEY as b}from"@weapp-core/constants";const x=/* @__PURE__ */ new WeakMap;function S(e,t){let r={...t??{}};if(!e||typeof e!=`object`)return r;for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&n(i,`value`)&&(r[t]=i.value);return r}function C(e,t){return Array.isArray(e?.pick)&&e.pick.includes(v)||t?.features?.scopedSlots===!0&&r(t,v)}function w(e){return!!e.__wevu_isPage}function T(e){let t=e.properties;return!!(t&&typeof t==`object`&&(y in t||b in t))}function E(e,t){return t?.strategy!==`patch`||!T(e)?t:{...t,strategy:`diff`}}function D(e,t=!1){let{lifecycleDefinition:n,runtimeApp:r}=c(e,t),i={__wevu_runtime:r,__wevu_options:e};return x.set(i,n),i}function O(e){return k(e,!0)}function k(n,r){let{__typeProps:c,[_]:y,data:b,computed:x,methods:T,setData:O,watch:k,setup:A,props:j,inject:M,provide:N,allowFunctionProps:P,[m]:F,[h]:I,...L}=u(e(n)),R=i(F),z=L[g],B=Array.isArray(z)?[...new Set(z.filter(e=>typeof e==`string`&&e.length>0))]:[];delete L[g];let V=E(L,P===!0?{...O??{},includeFunctions:!0,functionPaths:B}:P===!1?O:B.length?{...O??{},functionPaths:B}:O),H=
|
|
1
|
+
import{applyWevuComponentDefaults as e}from"./defaults.mjs";import{requireRuntimeCapability as t}from"./capabilities.mjs";import{hasOwn as n}from"../utils.mjs";import{hasBindingOutputPath as r,resolveBindingManifest as i}from"./bindingManifest.mjs";import{applySetupResult as a,mergeSetupResultDescriptors as o}from"./define/setupResult.mjs";import{runSetupFunction as s}from"./register/setup.mjs";import{createRuntimeComponentDefinition as c}from"./define/componentDefinition.mjs";import{resolveNativeInitialData as l}from"./define/initialComputed.mjs";import{resolveVueComponentOptions as u}from"./define/options.mjs";import{applyOptionsApiProvide as d,resolveOptionsApiInjections as f}from"./define/optionsApi.mjs";import{normalizeProps as p}from"./define/props.mjs";import{WEVU_BINDING_MANIFEST_KEY as m,WEVU_CSS_MODULES_KEY as h,WEVU_FUNCTION_PROP_PATHS_KEY as g,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as _,WEVU_SLOT_OWNER_ID_KEY as v,WEVU_SLOT_OWNER_ID_PROP as y,WEVU_SLOT_SCOPE_KEY as b}from"@weapp-core/constants";const x=/* @__PURE__ */ new WeakMap;function S(e,t){let r={...t??{}};if(!e||typeof e!=`object`)return r;for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&n(i,`value`)&&(r[t]=i.value);return r}function C(e,t){return Array.isArray(e?.pick)&&e.pick.includes(v)||t?.features?.scopedSlots===!0&&r(t,v)}function w(e){return!!e.__wevu_isPage}function T(e){let t=e.properties;return!!(t&&typeof t==`object`&&(y in t||b in t))}function E(e,t){return t?.strategy!==`patch`||!T(e)?t:{...t,strategy:`diff`}}function D(e,t=!1){let{lifecycleDefinition:n,runtimeApp:r}=c(e,t),i={__wevu_runtime:r,__wevu_options:e};return x.set(i,n),i}function O(e){return k(e,!0)}function k(n,r){let{__typeProps:c,[_]:y,data:b,computed:x,methods:T,setData:O,watch:k,setup:A,props:j,inject:M,provide:N,allowFunctionProps:P,[m]:F,[h]:I,...L}=u(e(n)),R=i(F),z=L[g],B=Array.isArray(z)?[...new Set(z.filter(e=>typeof e==`string`&&e.length>0))]:[];delete L[g];let V=E(L,P===!0?{...O??{},includeFunctions:!0,functionPaths:B}:P===!1?O:B.length?{...O??{},functionPaths:B}:O),H=p(L,j,L.properties),U=S(H.properties,T),W=typeof b==`function`?()=>b.call(U):b,G=typeof A==`function`||M!=null||N!=null||I?((e,t)=>{I&&typeof I==`object`&&(t.instance[h]=I);let n=t?.proxy??t?.instance??Object.create(null),r=f(M,n),i=typeof A==`function`?s(A,e,t):void 0,c=o({...r,...I??{}},i);t&&Object.keys(c).length&&a(t.runtime,t.instance,c),N!=null&&d(N,n)}):void 0,K=typeof W==`function`?W():W,q=K&&typeof K==`object`?Reflect.get(K,v):void 0,J=C(V,R),Y=J?t(`scopedSlots`,`defineComponent(scoped-slot owner metadata)`):void 0,X=J?{...K&&typeof K==`object`?K:{},[v]:w(L)?q||Y?.allocateOwnerId():q||``}:K,Z=l(X,x,V,T,R),Q=Z===void 0?H:{...H,data:Z};return D({scopedSlotOwnerRequired:y===!0,data:W,computed:x,methods:T,setData:V,bindingManifest:R,watch:k,setup:G,mpOptions:Q},r)}function A(e){return k(e,!1)}function j(e){let t=e.__wevu_options;if(!t)throw TypeError(`无法从非 Wevu 组件定义创建独立运行时`);return D(t)}function M(e){return x.get(e)}function N(e){let t=e.allowNullPropInput??!0;O({...e,allowNullPropInput:t,__wevu_allowNullPropInput:t})}export{j as createIsolatedWevuComponentDefinition,N as createWevuComponent,A as createWevuComponentDefinition,O as defineComponent,M as getWevuComponentLifecycleDefinition};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/runtime/disposables.d.ts
|
|
2
1
|
export type DisposableMethodName = 'dispose' | 'abort' | 'cancel' | 'stop' | 'disconnect' | 'destroy' | 'close';
|
|
3
2
|
export type DisposableObject = Partial<Record<DisposableMethodName, () => void>>;
|
|
4
3
|
export type DisposableLike = (() => void) | DisposableObject;
|
|
@@ -26,5 +25,4 @@ export interface DisposableBag {
|
|
|
26
25
|
* 典型用法:注册定时器、请求任务、事件监听退订函数,
|
|
27
26
|
* 在页面/组件卸载时自动批量清理,减少内存泄漏风险。
|
|
28
27
|
*/
|
|
29
|
-
export declare function useDisposables(): DisposableBag;
|
|
30
|
-
//#endregion
|
|
28
|
+
export declare function useDisposables(): DisposableBag;
|