wevu 7.0.3 → 7.0.4
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/dev/package.mjs +1 -1
- package/dist/dev/router/routeSync.mjs +8 -2
- package/dist/dev/router/routeSync.mjs.map +1 -1
- package/dist/dev/router/useRoute.mjs +14 -7
- package/dist/dev/router/useRoute.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +15 -1
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
- package/dist/fetch.d.mts +4 -4
- package/dist/jsx-runtime.d.mts +4 -5
- package/dist/macros/shared.d.mts +14 -15
- package/dist/macros.d.mts +22 -22
- package/dist/package.mjs +1 -1
- package/dist/reactivity/computed.d.mts +8 -9
- package/dist/reactivity/core.d.mts +14 -15
- package/dist/reactivity/reactive/mutation.d.mts +6 -7
- package/dist/reactivity/reactive/patch.d.mts +4 -5
- package/dist/reactivity/reactive/shallow.d.mts +3 -4
- package/dist/reactivity/reactive/shared.d.mts +2 -3
- package/dist/reactivity/reactive.d.mts +6 -6
- package/dist/reactivity/readonly.d.mts +7 -8
- package/dist/reactivity/ref.d.mts +14 -15
- package/dist/reactivity/shallowRef.d.mts +5 -6
- package/dist/reactivity/toRefs.d.mts +5 -6
- package/dist/reactivity/traverse.d.mts +2 -3
- package/dist/reactivity/watch/types.d.mts +18 -19
- package/dist/reactivity/watch.d.mts +8 -8
- package/dist/router/createRouter.d.mts +2 -3
- package/dist/router/navigationCore.d.mts +3 -4
- package/dist/router/resolve.d.mts +2 -3
- package/dist/router/routeSync.mjs +1 -1
- package/dist/router/types.d.mts +38 -39
- package/dist/router/useRoute.d.mts +5 -6
- package/dist/router/useRoute.mjs +1 -1
- package/dist/router/useRouter.d.mts +2 -3
- package/dist/routerInternal/query.d.mts +3 -4
- package/dist/routerInternal/types.d.mts +2 -3
- package/dist/runtime/app/pending.d.mts +3 -4
- package/dist/runtime/app.d.mts +2 -3
- package/dist/runtime/css.d.mts +3 -4
- package/dist/runtime/defaults.d.mts +5 -6
- package/dist/runtime/define.d.mts +15 -16
- package/dist/runtime/disposables.d.mts +6 -7
- package/dist/runtime/elementIntersectionObserver.d.mts +5 -6
- package/dist/runtime/hooks/base.d.mts +7 -8
- package/dist/runtime/hooks/register.d.mts +26 -27
- package/dist/runtime/hooks/vue.d.mts +12 -13
- package/dist/runtime/intersectionObserver.d.mts +4 -5
- package/dist/runtime/jsxIsland.d.mts +19 -20
- package/dist/runtime/layoutBridge.d.mts +12 -13
- package/dist/runtime/noSetData.d.mts +3 -4
- package/dist/runtime/pageEnvironment.d.mts +9 -10
- package/dist/runtime/pageLayout.d.mts +9 -10
- package/dist/runtime/pageScroll.d.mts +4 -5
- package/dist/runtime/provide.d.mts +7 -7
- package/dist/runtime/provideStore.d.mts +2 -3
- package/dist/runtime/pullDownRefresh.d.mts +4 -5
- package/dist/runtime/register/app.d.mts +2 -3
- package/dist/runtime/register/component.d.mts +2 -3
- package/dist/runtime/register/inline.d.mts +3 -4
- package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -1
- package/dist/runtime/register/runtimeInstance.d.mts +4 -5
- package/dist/runtime/register/setup.d.mts +2 -3
- package/dist/runtime/register/watch.d.mts +3 -4
- package/dist/runtime/selectorQuery.d.mts +15 -16
- package/dist/runtime/template.d.mts +4 -5
- package/dist/runtime/templateRefTypes.d.mts +2 -1
- package/dist/runtime/templateRefs.d.mts +2 -3
- package/dist/runtime/types/core.d.mts +9 -10
- package/dist/runtime/types/miniprogram.d.mts +10 -10
- package/dist/runtime/types/miniprogramHost.d.mts +41 -41
- package/dist/runtime/types/miniprogramHostSources.d.mts +21 -22
- package/dist/runtime/types/options.d.mts +6 -7
- package/dist/runtime/types/props/propTypes.d.mts +16 -17
- package/dist/runtime/types/props/router.d.mts +13 -14
- package/dist/runtime/types/props/setup.d.mts +7 -8
- package/dist/runtime/types/runtime.d.mts +7 -8
- package/dist/runtime/types/setData.d.mts +3 -4
- package/dist/runtime/types.d.mts +8 -8
- package/dist/runtime/uniAppHost.d.mts +2 -3
- package/dist/runtime/updatePerformance.d.mts +5 -6
- package/dist/runtime/use.d.mts +3 -4
- package/dist/runtime/vueCompat/context.d.mts +4 -5
- package/dist/runtime/vueCompat/model.d.mts +9 -10
- package/dist/runtime/vueCompat/router.d.mts +3 -4
- package/dist/runtime/vueCompat/templateRef.d.mts +4 -5
- package/dist/scheduler.d.mts +2 -3
- package/dist/store/define.d.mts +3 -4
- package/dist/store/manager.d.mts +2 -3
- package/dist/store/storeToRefs.d.mts +3 -4
- package/dist/store/types.d.mts +10 -11
- package/dist/version.d.mts +2 -3
- package/dist/vue-augment.d.mts +2 -1
- package/dist/vue-demi.d.mts +5 -5
- package/dist/vue-types.d.mts +2 -2
- package/dist/weappIntrinsicElements/base.d.mts +12 -13
- package/dist/weappIntrinsicElements/elements/ad-custom.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/ad.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/audio.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/block.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/button.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/camera.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/canvas.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/checkbox-group.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/checkbox.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/cover-image.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/cover-view.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/editor.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/form.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/functional-page-navigator.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/icon.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/image.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/import.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/include.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/input.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/keyboard-accessory.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/label.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/live-player.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/live-pusher.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/map.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/match-media.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/movable-area.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/movable-view.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/navigation-bar.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/navigator.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/official-account.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/open-data.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/page-container.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/page-meta.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/picker-view-column.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/picker-view.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/picker.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/progress.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/radio-group.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/radio.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/rich-text.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/scroll-view.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/share-element.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/slider.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/slot.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/swiper-item.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/swiper.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/switch.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/template.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/text.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/textarea.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/video.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/view.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/voip-room.d.mts +2 -3
- package/dist/weappIntrinsicElements/elements/web-view.d.mts +2 -3
- package/dist/weappIntrinsicElements.d.mts +5 -5
- package/package.json +2 -2
|
@@ -5,8 +5,8 @@ import { SetupContext, SetupFunction } from "./props/setup.mjs";
|
|
|
5
5
|
import "./props.mjs";
|
|
6
6
|
import { SetDataSnapshotOptions } from "./setData.mjs";
|
|
7
7
|
//#region src/runtime/types/options.d.ts
|
|
8
|
-
type DataOption<D extends object> = D | (() => D);
|
|
9
|
-
interface DefineComponentOptions<P extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions, S extends Record<string, any> | void = Record<string, any> | void> extends MiniProgramComponentOptions, MiniProgramPageLifetimes {
|
|
8
|
+
export type DataOption<D extends object> = D | (() => D);
|
|
9
|
+
export interface DefineComponentOptions<P extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions, S extends Record<string, any> | void = Record<string, any> | void> extends MiniProgramComponentOptions, MiniProgramPageLifetimes {
|
|
10
10
|
/**
|
|
11
11
|
* 页面特性开关(用于按需注入 Page 事件处理函数)。
|
|
12
12
|
*
|
|
@@ -69,12 +69,12 @@ interface DefineComponentOptions<P extends ComponentPropsOptions = ComponentProp
|
|
|
69
69
|
[key: string]: any;
|
|
70
70
|
}
|
|
71
71
|
type AppSetupProps = {};
|
|
72
|
-
interface DefineAppOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends MiniProgramAppOptions {
|
|
72
|
+
export interface DefineAppOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends MiniProgramAppOptions {
|
|
73
73
|
watch?: Record<string, any>;
|
|
74
74
|
setup?: (props: AppSetupProps, ctx: SetupContext<D, C, M, AppSetupProps>) => Record<string, any> | void;
|
|
75
75
|
[key: string]: any;
|
|
76
76
|
}
|
|
77
|
-
interface CreateAppOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends MiniProgramAppOptions {
|
|
77
|
+
export interface CreateAppOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends MiniProgramAppOptions {
|
|
78
78
|
data?: DataOption<D>;
|
|
79
79
|
computed?: C;
|
|
80
80
|
methods?: M;
|
|
@@ -83,7 +83,7 @@ interface CreateAppOptions<D extends object = Record<string, any>, C extends Com
|
|
|
83
83
|
setup?: (props: AppSetupProps, ctx: SetupContext<D, C, M, AppSetupProps>) => Record<string, any> | void;
|
|
84
84
|
[key: string]: any;
|
|
85
85
|
}
|
|
86
|
-
interface PageFeatures {
|
|
86
|
+
export interface PageFeatures {
|
|
87
87
|
/**
|
|
88
88
|
* 启用页面滚动事件(注入 `onPageScroll`)。
|
|
89
89
|
*/
|
|
@@ -132,5 +132,4 @@ interface PageFeatures {
|
|
|
132
132
|
*/
|
|
133
133
|
enableOnSaveExitState?: boolean;
|
|
134
134
|
}
|
|
135
|
-
//#endregion
|
|
136
|
-
export { CreateAppOptions, DataOption, DefineAppOptions, DefineComponentOptions, PageFeatures };
|
|
135
|
+
//#endregion
|
|
@@ -5,21 +5,21 @@ type PropMethod<T, TConstructor = any> = [T] extends [((...args: any) => any) |
|
|
|
5
5
|
(): T;
|
|
6
6
|
readonly prototype: TConstructor;
|
|
7
7
|
} : never;
|
|
8
|
-
type PropConstructor<T = any> = {
|
|
8
|
+
export type PropConstructor<T = any> = {
|
|
9
9
|
new (...args: any[]): T & {};
|
|
10
10
|
} | {
|
|
11
11
|
(): T;
|
|
12
12
|
} | PropMethod<T>;
|
|
13
|
-
type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
|
|
13
|
+
export type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
|
|
14
14
|
type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
15
|
-
type ComponentPropsOptions = Record<string, PropOptions<any> | PropType<any> | null>;
|
|
16
|
-
interface NativeTypeHint<T = any> {
|
|
15
|
+
export type ComponentPropsOptions = Record<string, PropOptions<any> | PropType<any> | null>;
|
|
16
|
+
export interface NativeTypeHint<T = any> {
|
|
17
17
|
readonly __wevuNativeType?: T;
|
|
18
18
|
}
|
|
19
|
-
type NativePropsOptions = Record<string, HostMiniProgramComponentAllProperty | NativeTypeHint<any>>;
|
|
20
|
-
type NativePropType<T = any, C extends HostMiniProgramComponentShortProperty = StringConstructor> = C & NativeTypeHint<T>;
|
|
21
|
-
type NativeTypedProperty<T = any, P extends HostMiniProgramComponentAllProperty = HostMiniProgramComponentAllProperty> = P & NativeTypeHint<T>;
|
|
22
|
-
interface PropOptions<T = any, D = T> {
|
|
19
|
+
export type NativePropsOptions = Record<string, HostMiniProgramComponentAllProperty | NativeTypeHint<any>>;
|
|
20
|
+
export type NativePropType<T = any, C extends HostMiniProgramComponentShortProperty = StringConstructor> = C & NativeTypeHint<T>;
|
|
21
|
+
export type NativeTypedProperty<T = any, P extends HostMiniProgramComponentAllProperty = HostMiniProgramComponentAllProperty> = P & NativeTypeHint<T>;
|
|
22
|
+
export interface PropOptions<T = any, D = T> {
|
|
23
23
|
type?: PropType<T> | true | null;
|
|
24
24
|
optionalTypes?: Array<HostMiniProgramComponentShortProperty | PropConstructor<any>>;
|
|
25
25
|
/**
|
|
@@ -47,7 +47,7 @@ type RequiredKeys<T> = { [K in keyof T]: T[K] extends {
|
|
|
47
47
|
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
48
48
|
type DefaultKeys<T> = { [K in keyof T]: HasDefault<T[K]> extends true ? K : IsBooleanProp<T[K]> extends true ? K : never; }[keyof T];
|
|
49
49
|
type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
|
|
50
|
-
type InferPropType<O, NullAsAny = true> = [O] extends [null] ? NullAsAny extends true ? any : null : [O] extends [{
|
|
50
|
+
export type InferPropType<O, NullAsAny = true> = [O] extends [null] ? NullAsAny extends true ? any : null : [O] extends [{
|
|
51
51
|
type: null | true;
|
|
52
52
|
}] ? any : [O] extends [ObjectConstructor | {
|
|
53
53
|
type: ObjectConstructor;
|
|
@@ -67,13 +67,12 @@ type InferNativeByOption<O extends {
|
|
|
67
67
|
}> = O['type'] extends NativeTypeHint<infer THint> ? THint : O extends {
|
|
68
68
|
value: infer V;
|
|
69
69
|
} ? MergeNativeType<NativeInferByCtor<O['type']>, V> : NativeInferByCtor<O['type']>;
|
|
70
|
-
type InferNativePropType<O> = O extends NativeTypeHint<infer T> ? T : O extends {
|
|
70
|
+
export type InferNativePropType<O> = O extends NativeTypeHint<infer T> ? T : O extends {
|
|
71
71
|
type?: any;
|
|
72
72
|
} ? InferNativeByOption<O> : NativeInferByCtor<O>;
|
|
73
|
-
type InferNativeProps<P extends NativePropsOptions = NativePropsOptions> = { readonly [K in keyof P]?: InferNativePropType<P[K]>; };
|
|
74
|
-
type InferProps<P extends ComponentPropsOptions = ComponentPropsOptions> = { [K in keyof Pick<P, RequiredKeys<P>>]: HasDefault<P[K]> extends true ? Exclude<InferPropType<P[K]>, undefined> : InferPropType<P[K]>; } & { [K in keyof Pick<P, OptionalKeys<P>>]?: InferPropType<P[K]>; };
|
|
75
|
-
type ExtractPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = InferProps<P>;
|
|
76
|
-
type ExtractPublicPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = InferProps<P>;
|
|
77
|
-
type ExtractDefaultPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = { [K in keyof Pick<P, DefaultKeys<P>>]: InferPropType<P[K]>; };
|
|
78
|
-
//#endregion
|
|
79
|
-
export { ComponentPropsOptions, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InferNativePropType, InferNativeProps, InferPropType, InferProps, NativePropType, NativePropsOptions, NativeTypeHint, NativeTypedProperty, PropConstructor, PropOptions, PropType };
|
|
73
|
+
export type InferNativeProps<P extends NativePropsOptions = NativePropsOptions> = { readonly [K in keyof P]?: InferNativePropType<P[K]>; };
|
|
74
|
+
export type InferProps<P extends ComponentPropsOptions = ComponentPropsOptions> = { [K in keyof Pick<P, RequiredKeys<P>>]: HasDefault<P[K]> extends true ? Exclude<InferPropType<P[K]>, undefined> : InferPropType<P[K]>; } & { [K in keyof Pick<P, OptionalKeys<P>>]?: InferPropType<P[K]>; };
|
|
75
|
+
export type ExtractPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = InferProps<P>;
|
|
76
|
+
export type ExtractPublicPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = InferProps<P>;
|
|
77
|
+
export type ExtractDefaultPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = { [K in keyof Pick<P, DefaultKeys<P>>]: InferPropType<P[K]>; };
|
|
78
|
+
//#endregion
|
|
@@ -6,7 +6,7 @@ import { HostMiniProgramNavigateToOption, HostMiniProgramReLaunchOption, HostMin
|
|
|
6
6
|
* 典型用法:在业务项目的类型声明中补充 `entries` 联合类型,
|
|
7
7
|
* 让 `useNativeRouter()/useNativePageRouter()` 的 `url` 参数获得字面量约束。
|
|
8
8
|
*/
|
|
9
|
-
interface WevuTypedRouterRouteMap {}
|
|
9
|
+
export interface WevuTypedRouterRouteMap {}
|
|
10
10
|
type ResolveTypedRouterEntries = WevuTypedRouterRouteMap extends {
|
|
11
11
|
entries: infer Entries;
|
|
12
12
|
} ? Extract<Entries, string> : string;
|
|
@@ -18,34 +18,33 @@ type AbsoluteRouterPath<Path extends string> = Path | `/${Path}`;
|
|
|
18
18
|
type AbsoluteRouterUrl<Path extends string> = AbsoluteRouterPath<Path> | `${Path}?${string}` | `/${Path}?${string}`;
|
|
19
19
|
type RouterUrl<Path extends string> = string extends Path ? string : AbsoluteRouterUrl<Path> | RelativeRouterUrl;
|
|
20
20
|
type RouterPathUrl<Path extends string> = string extends Path ? string : AbsoluteRouterPath<Path>;
|
|
21
|
-
type TypedRouterUrl = RouterUrl<ResolveTypedRouterEntries>;
|
|
22
|
-
type TypedRouterTabBarUrl = RouterPathUrl<ResolveTypedRouterTabBarEntries>;
|
|
23
|
-
type MiniProgramRouterSwitchTabOption = Omit<HostMiniProgramSwitchTabOption, 'url'> & {
|
|
21
|
+
export type TypedRouterUrl = RouterUrl<ResolveTypedRouterEntries>;
|
|
22
|
+
export type TypedRouterTabBarUrl = RouterPathUrl<ResolveTypedRouterTabBarEntries>;
|
|
23
|
+
export type MiniProgramRouterSwitchTabOption = Omit<HostMiniProgramSwitchTabOption, 'url'> & {
|
|
24
24
|
url: TypedRouterTabBarUrl;
|
|
25
25
|
};
|
|
26
|
-
type RouterSwitchTabOption = MiniProgramRouterSwitchTabOption;
|
|
27
|
-
type MiniProgramRouterReLaunchOption = Omit<HostMiniProgramReLaunchOption, 'url'> & {
|
|
26
|
+
export type RouterSwitchTabOption = MiniProgramRouterSwitchTabOption;
|
|
27
|
+
export type MiniProgramRouterReLaunchOption = Omit<HostMiniProgramReLaunchOption, 'url'> & {
|
|
28
28
|
url: TypedRouterUrl;
|
|
29
29
|
};
|
|
30
|
-
type RouterReLaunchOption = MiniProgramRouterReLaunchOption;
|
|
31
|
-
type MiniProgramRouterRedirectToOption = Omit<HostMiniProgramRedirectToOption, 'url'> & {
|
|
30
|
+
export type RouterReLaunchOption = MiniProgramRouterReLaunchOption;
|
|
31
|
+
export type MiniProgramRouterRedirectToOption = Omit<HostMiniProgramRedirectToOption, 'url'> & {
|
|
32
32
|
url: TypedRouterUrl;
|
|
33
33
|
};
|
|
34
|
-
type RouterRedirectToOption = MiniProgramRouterRedirectToOption;
|
|
35
|
-
type MiniProgramRouterNavigateToOption = Omit<HostMiniProgramNavigateToOption, 'url'> & {
|
|
34
|
+
export type RouterRedirectToOption = MiniProgramRouterRedirectToOption;
|
|
35
|
+
export type MiniProgramRouterNavigateToOption = Omit<HostMiniProgramNavigateToOption, 'url'> & {
|
|
36
36
|
url: TypedRouterUrl;
|
|
37
37
|
};
|
|
38
|
-
type RouterNavigateToOption = MiniProgramRouterNavigateToOption;
|
|
38
|
+
export type RouterNavigateToOption = MiniProgramRouterNavigateToOption;
|
|
39
39
|
/**
|
|
40
40
|
* setup 场景下推荐使用的 Router 类型。
|
|
41
41
|
* 默认行为与原生 Router 一致;声明合并后可获得更精确的 `url` 类型提示。
|
|
42
42
|
*/
|
|
43
|
-
interface SetupContextRouter {
|
|
43
|
+
export interface SetupContextRouter {
|
|
44
44
|
switchTab: (option: MiniProgramRouterSwitchTabOption) => ReturnType<HostMiniProgramRouter['switchTab']>;
|
|
45
45
|
reLaunch: (option: MiniProgramRouterReLaunchOption) => ReturnType<HostMiniProgramRouter['reLaunch']>;
|
|
46
46
|
redirectTo: (option: MiniProgramRouterRedirectToOption) => ReturnType<HostMiniProgramRouter['redirectTo']>;
|
|
47
47
|
navigateTo: (option: MiniProgramRouterNavigateToOption) => ReturnType<HostMiniProgramRouter['navigateTo']>;
|
|
48
48
|
navigateBack: HostMiniProgramRouter['navigateBack'];
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
|
-
export { MiniProgramRouterNavigateToOption, MiniProgramRouterReLaunchOption, MiniProgramRouterRedirectToOption, MiniProgramRouterSwitchTabOption, RouterNavigateToOption, RouterReLaunchOption, RouterRedirectToOption, RouterSwitchTabOption, SetupContextRouter, TypedRouterTabBarUrl, TypedRouterUrl, WevuTypedRouterRouteMap };
|
|
50
|
+
//#endregion
|
|
@@ -4,11 +4,11 @@ import { SetupContextRouter } from "./router.mjs";
|
|
|
4
4
|
import { ComputedDefinitions, MethodDefinitions } from "../core.mjs";
|
|
5
5
|
import { InternalRuntimeState, RuntimeInstance } from "../runtime.mjs";
|
|
6
6
|
//#region src/runtime/types/props/setup.d.ts
|
|
7
|
-
type SetupContextSelectorQuery = HostMiniProgramSelectorQuery;
|
|
8
|
-
type SetupContextIntersectionObserverOptions = HostMiniProgramIntersectionObserverOptions;
|
|
9
|
-
type SetupContextIntersectionObserver = HostMiniProgramIntersectionObserver;
|
|
10
|
-
type SetupFunction<P extends ComponentPropsOptions, D extends object, C extends ComputedDefinitions, M extends MethodDefinitions, R extends Record<string, any> | void = Record<string, any> | void> = (props: InferProps<P>, ctx: SetupContext<D, C, M, P>) => R;
|
|
11
|
-
type SetupContextNativeInstance = InternalRuntimeState & {
|
|
7
|
+
export type SetupContextSelectorQuery = HostMiniProgramSelectorQuery;
|
|
8
|
+
export type SetupContextIntersectionObserverOptions = HostMiniProgramIntersectionObserverOptions;
|
|
9
|
+
export type SetupContextIntersectionObserver = HostMiniProgramIntersectionObserver;
|
|
10
|
+
export type SetupFunction<P extends ComponentPropsOptions, D extends object, C extends ComputedDefinitions, M extends MethodDefinitions, R extends Record<string, any> | void = Record<string, any> | void> = (props: InferProps<P>, ctx: SetupContext<D, C, M, P>) => R;
|
|
11
|
+
export type SetupContextNativeInstance = InternalRuntimeState & {
|
|
12
12
|
/**
|
|
13
13
|
* 派发组件事件(页面/应用场景下不可用时会安全降级为 no-op)
|
|
14
14
|
*/
|
|
@@ -40,7 +40,7 @@ type SetupContextNativeInstance = InternalRuntimeState & {
|
|
|
40
40
|
*/
|
|
41
41
|
pageRouter?: SetupContextRouter;
|
|
42
42
|
};
|
|
43
|
-
interface SetupContext<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions, P extends ComponentPropsOptions = ComponentPropsOptions> {
|
|
43
|
+
export interface SetupContext<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions, P extends ComponentPropsOptions = ComponentPropsOptions> {
|
|
44
44
|
/**
|
|
45
45
|
* 组件 props(来自小程序 properties)
|
|
46
46
|
*/
|
|
@@ -92,5 +92,4 @@ interface SetupContext<D extends object, C extends ComputedDefinitions, M extend
|
|
|
92
92
|
*/
|
|
93
93
|
slots: Record<string, any>;
|
|
94
94
|
}
|
|
95
|
-
//#endregion
|
|
96
|
-
export { SetupContext, SetupContextIntersectionObserver, SetupContextIntersectionObserverOptions, SetupContextNativeInstance, SetupContextSelectorQuery, SetupFunction };
|
|
95
|
+
//#endregion
|
|
@@ -5,13 +5,13 @@ import { WatchOptions, WatchStopHandle } from "../../reactivity/watch/types.mjs"
|
|
|
5
5
|
import "../../reactivity/index.mjs";
|
|
6
6
|
import { ComponentPublicInstance, ComputedDefinitions, ExtractComputed, ExtractMethods, MethodDefinitions, ModelBinding, ModelBindingOptions } from "./core.mjs";
|
|
7
7
|
//#region src/runtime/types/runtime.d.ts
|
|
8
|
-
interface AppConfig {
|
|
8
|
+
export interface AppConfig {
|
|
9
9
|
globalProperties: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
-
type WevuPlugin = ((app: RuntimeApp<any, any, any>, ...options: any[]) => any) | {
|
|
11
|
+
export type WevuPlugin = ((app: RuntimeApp<any, any, any>, ...options: any[]) => any) | {
|
|
12
12
|
install: (app: RuntimeApp<any, any, any>, ...options: any[]) => any;
|
|
13
13
|
};
|
|
14
|
-
interface RuntimeApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
|
|
14
|
+
export interface RuntimeApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
|
|
15
15
|
mount: (adapter?: MiniProgramAdapter) => RuntimeInstance<D, C, M>;
|
|
16
16
|
use: (plugin: WevuPlugin, ...options: any[]) => RuntimeApp<D, C, M>;
|
|
17
17
|
provide: <T>(key: any, value: T) => RuntimeApp<D, C, M>;
|
|
@@ -21,7 +21,7 @@ interface RuntimeApp<D extends object, C extends ComputedDefinitions, M extends
|
|
|
21
21
|
version: string;
|
|
22
22
|
__wevuAppProvides?: Record<PropertyKey, any>;
|
|
23
23
|
}
|
|
24
|
-
interface RuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
|
|
24
|
+
export interface RuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
|
|
25
25
|
readonly state: D;
|
|
26
26
|
readonly setupState?: Record<string, any>;
|
|
27
27
|
readonly proxy: ComponentPublicInstance<D, C, M>;
|
|
@@ -33,7 +33,7 @@ interface RuntimeInstance<D extends object, C extends ComputedDefinitions, M ext
|
|
|
33
33
|
snapshot: () => Record<string, any>;
|
|
34
34
|
unmount: () => void;
|
|
35
35
|
}
|
|
36
|
-
interface InternalRuntimeStateFields {
|
|
36
|
+
export interface InternalRuntimeStateFields {
|
|
37
37
|
__wevu?: RuntimeInstance<any, any, any>;
|
|
38
38
|
__wevuIsAppInstance?: boolean;
|
|
39
39
|
__wevuRuntimeApp?: RuntimeApp<any, any, any>;
|
|
@@ -54,6 +54,5 @@ interface InternalRuntimeStateFields {
|
|
|
54
54
|
__wevuTemplateRefsPending?: boolean;
|
|
55
55
|
__wevuReadyCalled?: boolean;
|
|
56
56
|
}
|
|
57
|
-
type InternalRuntimeState = InternalRuntimeStateFields & Partial<MiniProgramInstance>;
|
|
58
|
-
//#endregion
|
|
59
|
-
export { AppConfig, InternalRuntimeState, InternalRuntimeStateFields, RuntimeApp, RuntimeInstance, WevuPlugin };
|
|
57
|
+
export type InternalRuntimeState = InternalRuntimeStateFields & Partial<MiniProgramInstance>;
|
|
58
|
+
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/runtime/types/setData.d.ts
|
|
2
|
-
interface SetDataSnapshotOptions {
|
|
2
|
+
export interface SetDataSnapshotOptions {
|
|
3
3
|
/**
|
|
4
4
|
* 开发态高频 setData 告警。
|
|
5
5
|
*
|
|
@@ -202,7 +202,7 @@ interface SetDataSnapshotOptions {
|
|
|
202
202
|
*/
|
|
203
203
|
functionPaths?: string[];
|
|
204
204
|
}
|
|
205
|
-
interface SetDataDebugInfo {
|
|
205
|
+
export interface SetDataDebugInfo {
|
|
206
206
|
mode: 'patch' | 'diff';
|
|
207
207
|
reason: 'patch' | 'diff' | 'needsFullSnapshot' | 'maxPatchKeys' | 'maxPayloadBytes' | 'loopWarning';
|
|
208
208
|
pendingPatchKeys: number;
|
|
@@ -216,5 +216,4 @@ interface SetDataDebugInfo {
|
|
|
216
216
|
targetLabel?: string;
|
|
217
217
|
message?: string;
|
|
218
218
|
}
|
|
219
|
-
//#endregion
|
|
220
|
-
export { SetDataDebugInfo, SetDataSnapshotOptions };
|
|
219
|
+
//#endregion
|
package/dist/runtime/types.d.mts
CHANGED
|
@@ -11,18 +11,18 @@ import { AllowedComponentProps, ComponentCustomProps, ComponentOptionsMixin, Def
|
|
|
11
11
|
import { SetDataDebugInfo, SetDataSnapshotOptions } from "./types/setData.mjs";
|
|
12
12
|
import { CreateAppOptions, DataOption, DefineAppOptions, DefineComponentOptions, PageFeatures } from "./types/options.mjs";
|
|
13
13
|
//#region src/runtime/types.d.ts
|
|
14
|
-
interface WevuGlobalComponents {}
|
|
15
|
-
interface WevuGlobalDirectives {}
|
|
16
|
-
interface GlobalComponents extends WevuGlobalComponents {}
|
|
17
|
-
interface GlobalDirectives extends WevuGlobalDirectives {}
|
|
18
|
-
interface TemplateRefs {}
|
|
19
|
-
interface TemplateRefValue {
|
|
14
|
+
export interface WevuGlobalComponents {}
|
|
15
|
+
export interface WevuGlobalDirectives {}
|
|
16
|
+
export interface GlobalComponents extends WevuGlobalComponents {}
|
|
17
|
+
export interface GlobalDirectives extends WevuGlobalDirectives {}
|
|
18
|
+
export interface TemplateRefs {}
|
|
19
|
+
export interface TemplateRefValue {
|
|
20
20
|
selector: string;
|
|
21
21
|
boundingClientRect: (cb?: (value: HostMiniProgramBoundingClientRectResult | null) => void) => Promise<HostMiniProgramBoundingClientRectResult | null>;
|
|
22
22
|
scrollOffset: (cb?: (value: HostMiniProgramScrollOffsetResult | null) => void) => Promise<HostMiniProgramScrollOffsetResult | null>;
|
|
23
23
|
fields: (fields: HostMiniProgramNodesRefFields, cb?: (value: any) => void) => Promise<any | null>;
|
|
24
24
|
node: (cb?: (value: any) => void) => Promise<any | null>;
|
|
25
25
|
}
|
|
26
|
-
type MiniProgramTemplateRefValue = TemplateRefValue;
|
|
26
|
+
export type MiniProgramTemplateRefValue = TemplateRefValue;
|
|
27
27
|
//#endregion
|
|
28
|
-
export {
|
|
28
|
+
export type { AlipayMiniProgramHostNamespace, AlipayMiniProgramHostSourceContract, AllowedComponentProps, AppConfig, ComponentCustomProps, ComponentOptionsMixin, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, CreateAppOptions, DataOption, DefaultMiniProgramHostNamespace, DefaultMiniProgramHostSourceContract, DefineAppOptions, DefineComponent, DefineComponentOptions, DouyinMiniProgramHostNamespace, DouyinMiniProgramHostSourceContract, ExtractComputed, ExtractDefaultPropTypes, ExtractMethods, ExtractPropTypes, ExtractPublicPropTypes, HostMiniProgramAddToFavoritesOption, HostMiniProgramAppOptions, HostMiniProgramAppTrivialInstance, HostMiniProgramBehaviorIdentifier, HostMiniProgramBoundingClientRectResult, HostMiniProgramComponentAllFullProperty, HostMiniProgramComponentAllProperty, HostMiniProgramComponentBehaviorOptions, HostMiniProgramComponentEmptyArray, HostMiniProgramComponentInstance, HostMiniProgramComponentMethodOption, HostMiniProgramComponentPropertyOption, HostMiniProgramComponentPropertyValue, HostMiniProgramComponentShortProperty, HostMiniProgramComponentTrivialInstance, HostMiniProgramComponentTrivialOption, HostMiniProgramIntersectionObserver, HostMiniProgramIntersectionObserverOptions, HostMiniProgramLaunchOptions, HostMiniProgramMemoryWarningResult, HostMiniProgramNavigateToOption, HostMiniProgramNodesRef, HostMiniProgramNodesRefFields, HostMiniProgramPageLifetime, HostMiniProgramPageNotFoundOptions, HostMiniProgramPageResizeOption, HostMiniProgramPageScrollOption, HostMiniProgramPageTrivialInstance, HostMiniProgramReLaunchOption, HostMiniProgramRedirectToOption, HostMiniProgramRouter, HostMiniProgramSaveExitState, HostMiniProgramScrollOffsetResult, HostMiniProgramSelectorQuery, HostMiniProgramShareAppMessageOption, HostMiniProgramSwitchTabOption, HostMiniProgramTabItemTapOption, HostMiniProgramThemeChangeResult, HostMiniProgramTriggerEventOptions, HostMiniProgramUnhandledRejectionResult, InferNativePropType, InferNativeProps, InferPropType, InferProps, InternalRuntimeState, InternalRuntimeStateFields, MethodDefinitions, MiniProgramAdapter, HostMiniProgramAddToFavoritesOption as MiniProgramAddToFavoritesOption, MiniProgramAppOptions, MiniProgramBehaviorIdentifier, HostMiniProgramBoundingClientRectResult as MiniProgramBoundingClientRectResult, HostMiniProgramComponentAllFullProperty as MiniProgramComponentAllFullProperty, HostMiniProgramComponentAllProperty as MiniProgramComponentAllProperty, HostMiniProgramComponentBehaviorOptions as MiniProgramComponentBehaviorOptions, HostMiniProgramComponentEmptyArray as MiniProgramComponentEmptyArray, MiniProgramComponentInstance, HostMiniProgramComponentMethodOption as MiniProgramComponentMethodOption, MiniProgramComponentOptions, HostMiniProgramComponentPropertyOption as MiniProgramComponentPropertyOption, MiniProgramComponentPropertyValue, MiniProgramComponentRawOptions, HostMiniProgramComponentShortProperty as MiniProgramComponentShortProperty, MiniProgramHostNamespace, MiniProgramHostNamespaceBySource, MiniProgramHostSourceName, MiniProgramHostSourceRegistry, MiniProgramInstance, HostMiniProgramIntersectionObserver as MiniProgramIntersectionObserver, HostMiniProgramIntersectionObserverOptions as MiniProgramIntersectionObserverOptions, HostMiniProgramLaunchOptions as MiniProgramLaunchOptions, HostMiniProgramMemoryWarningResult as MiniProgramMemoryWarningResult, HostMiniProgramNavigateToOption as MiniProgramNavigateToOption, HostMiniProgramNodesRef as MiniProgramNodesRef, HostMiniProgramNodesRefFields as MiniProgramNodesRefFields, HostMiniProgramPageLifetime as MiniProgramPageLifetime, MiniProgramPageLifetimes, HostMiniProgramPageNotFoundOptions as MiniProgramPageNotFoundOptions, HostMiniProgramPageResizeOption as MiniProgramPageResizeOption, HostMiniProgramPageScrollOption as MiniProgramPageScrollOption, MiniProgramPlatformHostNamespaceBySource, MiniProgramPlatformHostSourceName, MiniProgramPlatformHostSourceRegistry, HostMiniProgramReLaunchOption as MiniProgramReLaunchOption, HostMiniProgramRedirectToOption as MiniProgramRedirectToOption, HostMiniProgramRouter as MiniProgramRouter, MiniProgramRouterNavigateToOption, MiniProgramRouterReLaunchOption, MiniProgramRouterRedirectToOption, MiniProgramRouterSwitchTabOption, MiniProgramRuntimeHostNamespaceBySource, MiniProgramRuntimeHostSourceName, MiniProgramRuntimeHostSourceRegistry, HostMiniProgramSaveExitState as MiniProgramSaveExitState, HostMiniProgramScrollOffsetResult as MiniProgramScrollOffsetResult, HostMiniProgramSelectorQuery as MiniProgramSelectorQuery, HostMiniProgramShareAppMessageOption as MiniProgramShareAppMessageOption, HostMiniProgramSwitchTabOption as MiniProgramSwitchTabOption, HostMiniProgramTabItemTapOption as MiniProgramTabItemTapOption, HostMiniProgramThemeChangeResult as MiniProgramThemeChangeResult, HostMiniProgramUnhandledRejectionResult as MiniProgramUnhandledRejectionResult, ModelBinding, ModelBindingOptions, ModelBindingPayload, NativeComponent, NativePropType, NativePropsOptions, NativeTypeHint, NativeTypedProperty, ObjectDirective, PageFeatures, PropConstructor, PropOptions, PropType, PublicProps, RuntimeApp, RuntimeInstance, SetDataDebugInfo, SetDataSnapshotOptions, SetupContext, SetupContextNativeInstance, SetupContextRouter, SetupFunction, ShallowUnwrapRef, HostMiniProgramTriggerEventOptions as TriggerEventOptions, TtMiniProgramHostNamespace, TtMiniProgramHostSourceContract, VNode, VNodeProps, WechatMiniProgramHostNamespace, WechatMiniProgramHostSourceContract, WevuPlugin, WevuTypedRouterRouteMap };
|
|
@@ -3,6 +3,5 @@ type UniAppHost = Record<string, any>;
|
|
|
3
3
|
/**
|
|
4
4
|
* 在原生小程序宿主上补齐 uni-app 专属 API,并保持未适配 API 继续继承宿主实现。
|
|
5
5
|
*/
|
|
6
|
-
declare function createUniAppHost(host: UniAppHost): UniAppHost;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { createUniAppHost };
|
|
6
|
+
export declare function createUniAppHost(host: UniAppHost): UniAppHost;
|
|
7
|
+
//#endregion
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
//#region src/runtime/updatePerformance.d.ts
|
|
2
|
-
type UpdatePerformanceListenerResult = Record<string, any>;
|
|
3
|
-
type UpdatePerformanceListener = (result: UpdatePerformanceListenerResult) => void;
|
|
4
|
-
type UseUpdatePerformanceListenerStopHandle = () => void;
|
|
2
|
+
export type UpdatePerformanceListenerResult = Record<string, any>;
|
|
3
|
+
export type UpdatePerformanceListener = (result: UpdatePerformanceListenerResult) => void;
|
|
4
|
+
export type UseUpdatePerformanceListenerStopHandle = () => void;
|
|
5
5
|
/**
|
|
6
6
|
* 在 setup 中注册更新性能监听,并在卸载时自动清理。
|
|
7
7
|
*
|
|
8
8
|
* - 底层能力:`instance.setUpdatePerformanceListener(listener)`。
|
|
9
9
|
* - 清理策略:卸载时回传 `undefined` 作为监听器,平台不支持时静默降级。
|
|
10
10
|
*/
|
|
11
|
-
declare function useUpdatePerformanceListener(listener: UpdatePerformanceListener): UseUpdatePerformanceListenerStopHandle;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { UpdatePerformanceListener, UpdatePerformanceListenerResult, UseUpdatePerformanceListenerStopHandle, useUpdatePerformanceListener };
|
|
11
|
+
export declare function useUpdatePerformanceListener(listener: UpdatePerformanceListener): UseUpdatePerformanceListenerStopHandle;
|
|
12
|
+
//#endregion
|
package/dist/runtime/use.d.mts
CHANGED
|
@@ -4,10 +4,9 @@ import "./types.mjs";
|
|
|
4
4
|
/**
|
|
5
5
|
* 在 `app` 级 `setup()` 中显式获取运行时 app,提供与 `app.use()` / `app.provide()` 对齐的 SFC 写法。
|
|
6
6
|
*/
|
|
7
|
-
declare function defineAppSetup<T>(setup: (app: RuntimeApp<any, any, any>) => T): T;
|
|
7
|
+
export declare function defineAppSetup<T>(setup: (app: RuntimeApp<any, any, any>) => T): T;
|
|
8
8
|
/**
|
|
9
9
|
* 在 `app` 级 `setup()` 中安装插件,提供与 `app.use()` 对齐的 SFC 调用方式。
|
|
10
10
|
*/
|
|
11
|
-
declare function use(plugin: WevuPlugin, ...options: any[]): RuntimeApp<any, any, any>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { defineAppSetup, use };
|
|
11
|
+
export declare function use(plugin: WevuPlugin, ...options: any[]): RuntimeApp<any, any, any>;
|
|
12
|
+
//#endregion
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SetupContextNativeInstance } from "../types/props/setup.mjs";
|
|
2
2
|
import "../types.mjs";
|
|
3
3
|
//#region src/runtime/vueCompat/context.d.ts
|
|
4
|
-
declare function useAttrs(): Record<string, any>;
|
|
5
|
-
declare function useSlots(): Record<string, any>;
|
|
6
|
-
declare function useNativeInstance(): SetupContextNativeInstance;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { useAttrs, useNativeInstance, useSlots };
|
|
4
|
+
export declare function useAttrs(): Record<string, any>;
|
|
5
|
+
export declare function useSlots(): Record<string, any>;
|
|
6
|
+
export declare function useNativeInstance(): SetupContextNativeInstance;
|
|
7
|
+
//#endregion
|
|
@@ -3,14 +3,14 @@ import "../../reactivity/index.mjs";
|
|
|
3
3
|
import { ModelBinding, ModelBindingOptions, ModelBindingPayload } from "../types/core.mjs";
|
|
4
4
|
import "../types.mjs";
|
|
5
5
|
//#region src/runtime/vueCompat/model.d.ts
|
|
6
|
-
type ModelModifiers<M extends PropertyKey = string> = Record<M, true | undefined>;
|
|
7
|
-
type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [ModelRef<T, M, G, S>, ModelModifiers<M>];
|
|
8
|
-
interface UseModelOptions<T, M extends PropertyKey = string, G = T, S = T> {
|
|
6
|
+
export type ModelModifiers<M extends PropertyKey = string> = Record<M, true | undefined>;
|
|
7
|
+
export type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [ModelRef<T, M, G, S>, ModelModifiers<M>];
|
|
8
|
+
export interface UseModelOptions<T, M extends PropertyKey = string, G = T, S = T> {
|
|
9
9
|
get?: (value: T, modifiers: ModelModifiers<M>) => G;
|
|
10
10
|
set?: (value: S, modifiers: ModelModifiers<M>) => T;
|
|
11
11
|
}
|
|
12
|
-
declare function useModel<T = any, M extends PropertyKey = string>(props: Record<string, any>, name: string): ModelRef<T, M, T, T>;
|
|
13
|
-
declare function useModel<T = any, M extends PropertyKey = string, G = T, S = T>(props: Record<string, any>, name: string, options: UseModelOptions<T, M, G, S>): ModelRef<T, M, G, S>;
|
|
12
|
+
export declare function useModel<T = any, M extends PropertyKey = string>(props: Record<string, any>, name: string): ModelRef<T, M, T, T>;
|
|
13
|
+
export declare function useModel<T = any, M extends PropertyKey = string, G = T, S = T>(props: Record<string, any>, name: string, options: UseModelOptions<T, M, G, S>): ModelRef<T, M, G, S>;
|
|
14
14
|
/**
|
|
15
15
|
* useBindModel 返回绑定到当前运行时实例的 bindModel。
|
|
16
16
|
* 该方法必须在 setup() 的同步阶段调用。
|
|
@@ -20,11 +20,10 @@ type BindModelWithHelper<DefaultEvent extends string = 'input', DefaultValueProp
|
|
|
20
20
|
value: <T = any, Event extends string = DefaultEvent, ValueProp extends string = DefaultValueProp, Formatted = T>(path: string, options?: ModelBindingOptions<T, Event, ValueProp, Formatted>) => Formatted;
|
|
21
21
|
on: <T = any, Event extends string = DefaultEvent, ValueProp extends string = DefaultValueProp, Formatted = T>(path: string, options?: ModelBindingOptions<T, Event, ValueProp, Formatted>) => (event: any) => void;
|
|
22
22
|
};
|
|
23
|
-
declare function useBindModel<DefaultEvent extends string = 'input', DefaultValueProp extends string = 'value'>(defaultOptions?: ModelBindingOptions<any, DefaultEvent, DefaultValueProp, any>): BindModelWithHelper<DefaultEvent, DefaultValueProp>;
|
|
23
|
+
export declare function useBindModel<DefaultEvent extends string = 'input', DefaultValueProp extends string = 'value'>(defaultOptions?: ModelBindingOptions<any, DefaultEvent, DefaultValueProp, any>): BindModelWithHelper<DefaultEvent, DefaultValueProp>;
|
|
24
24
|
/**
|
|
25
25
|
* useChangeModel 返回以 change 事件为默认更新事件的 model 绑定助手。
|
|
26
26
|
*/
|
|
27
|
-
declare function useChangeModel(): <T = any, ValueProp extends string = "value", Formatted = T>(path: string, options?: ModelBindingOptions<T, "change", ValueProp, Formatted>) => ModelBindingPayload<T, "change", ValueProp, Formatted>;
|
|
28
|
-
declare function mergeModels<T>(a: T, b: T): T;
|
|
29
|
-
//#endregion
|
|
30
|
-
export { ModelModifiers, ModelRef, UseModelOptions, mergeModels, useBindModel, useChangeModel, useModel };
|
|
27
|
+
export declare function useChangeModel(): <T = any, ValueProp extends string = "value", Formatted = T>(path: string, options?: ModelBindingOptions<T, "change", ValueProp, Formatted>) => ModelBindingPayload<T, "change", ValueProp, Formatted>;
|
|
28
|
+
export declare function mergeModels<T>(a: T, b: T): T;
|
|
29
|
+
//#endregion
|
|
@@ -12,7 +12,7 @@ type RuntimeRouter = SetupContextRouter;
|
|
|
12
12
|
* 如需更贴近 Vue Router 的高阶能力(导航守卫、失败类型、统一解析),
|
|
13
13
|
* 推荐改用 `wevu/router` 子入口的 `useRouter()`。
|
|
14
14
|
*/
|
|
15
|
-
declare function useNativeRouter(): RuntimeRouter;
|
|
15
|
+
export declare function useNativeRouter(): RuntimeRouter;
|
|
16
16
|
/**
|
|
17
17
|
* 在 setup 中获取与当前页面路径语义一致的原生 Router 对象。
|
|
18
18
|
*
|
|
@@ -23,6 +23,5 @@ declare function useNativeRouter(): RuntimeRouter;
|
|
|
23
23
|
* 如需更贴近 Vue Router 的高阶能力(导航守卫、失败类型、统一解析),
|
|
24
24
|
* 推荐改用 `wevu/router` 子入口的 `useRouter()`。
|
|
25
25
|
*/
|
|
26
|
-
declare function useNativePageRouter(): RuntimeRouter;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { useNativePageRouter, useNativeRouter };
|
|
26
|
+
export declare function useNativePageRouter(): RuntimeRouter;
|
|
27
|
+
//#endregion
|
|
@@ -2,8 +2,7 @@ import { ShallowRef } from "../../reactivity/ref.mjs";
|
|
|
2
2
|
import "../../reactivity/index.mjs";
|
|
3
3
|
import { TemplateRefs } from "../types.mjs";
|
|
4
4
|
//#region src/runtime/vueCompat/templateRef.d.ts
|
|
5
|
-
type TemplateRef<T = unknown> = Readonly<ShallowRef<T | null>>;
|
|
6
|
-
declare function useTemplateRef<K extends keyof TemplateRefs>(name: K): TemplateRef<TemplateRefs[K]>;
|
|
7
|
-
declare function useTemplateRef<T = unknown>(name: string): TemplateRef<T>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { TemplateRef, useTemplateRef };
|
|
5
|
+
export type TemplateRef<T = unknown> = Readonly<ShallowRef<T | null>>;
|
|
6
|
+
export declare function useTemplateRef<K extends keyof TemplateRefs>(name: K): TemplateRef<TemplateRefs[K]>;
|
|
7
|
+
export declare function useTemplateRef<T = unknown>(name: string): TemplateRef<T>;
|
|
8
|
+
//#endregion
|
package/dist/scheduler.d.mts
CHANGED
package/dist/store/define.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ type SetupDefinition<T> = () => T;
|
|
|
4
4
|
/**
|
|
5
5
|
* @description 定义一个 setup 风格的 store
|
|
6
6
|
*/
|
|
7
|
-
declare function defineStore<T extends Record<string, any>>(id: string, setup: SetupDefinition<T>): () => T & {
|
|
7
|
+
export declare function defineStore<T extends Record<string, any>>(id: string, setup: SetupDefinition<T>): () => T & {
|
|
8
8
|
$id: string;
|
|
9
9
|
$patch: (patch: Record<string, any> | ((state: any) => void)) => void;
|
|
10
10
|
$reset: () => void;
|
|
@@ -14,7 +14,7 @@ declare function defineStore<T extends Record<string, any>>(id: string, setup: S
|
|
|
14
14
|
/**
|
|
15
15
|
* @description 定义一个 options 风格的 store
|
|
16
16
|
*/
|
|
17
|
-
declare function defineStore<S extends Record<string, any>, G extends Record<string, any>, A extends Record<string, any>>(id: string, options: DefineStoreOptions<S, G, A>): () => S & StoreGetters<G> & A & {
|
|
17
|
+
export declare function defineStore<S extends Record<string, any>, G extends Record<string, any>, A extends Record<string, any>>(id: string, options: DefineStoreOptions<S, G, A>): () => S & StoreGetters<G> & A & {
|
|
18
18
|
$id: string;
|
|
19
19
|
$state: S;
|
|
20
20
|
$patch: (patch: Partial<S> | ((state: S) => void)) => void;
|
|
@@ -22,5 +22,4 @@ declare function defineStore<S extends Record<string, any>, G extends Record<str
|
|
|
22
22
|
$subscribe: (cb: SubscriptionCallback<S>, opts?: StoreSubscribeOptions) => () => void;
|
|
23
23
|
$onAction: (cb: ActionSubscriber<S & StoreGetters<G> & A>) => () => void;
|
|
24
24
|
};
|
|
25
|
-
//#endregion
|
|
26
|
-
export { defineStore };
|
|
25
|
+
//#endregion
|
package/dist/store/manager.d.mts
CHANGED
|
@@ -4,10 +4,9 @@ import "../reactivity/index.mjs";
|
|
|
4
4
|
/**
|
|
5
5
|
* @description storeToRefs 返回类型推导
|
|
6
6
|
*/
|
|
7
|
-
type StoreToRefsResult<T extends Record<string, any>> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? T[K] : T[K] extends Ref<infer V> ? Ref<V> : Ref<T[K]>; };
|
|
7
|
+
export type StoreToRefsResult<T extends Record<string, any>> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? T[K] : T[K] extends Ref<infer V> ? Ref<V> : Ref<T[K]>; };
|
|
8
8
|
/**
|
|
9
9
|
* @description 将 store 状态转换为 Ref
|
|
10
10
|
*/
|
|
11
|
-
declare function storeToRefs<T extends Record<string, any>>(store: T): StoreToRefsResult<T>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { StoreToRefsResult, storeToRefs };
|
|
11
|
+
export declare function storeToRefs<T extends Record<string, any>>(store: T): StoreToRefsResult<T>;
|
|
12
|
+
//#endregion
|
package/dist/store/types.d.mts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @description Store 变更类型
|
|
4
4
|
*/
|
|
5
|
-
type MutationType = 'patch object' | 'patch function' | 'direct';
|
|
5
|
+
export type MutationType = 'patch object' | 'patch function' | 'direct';
|
|
6
6
|
/**
|
|
7
7
|
* @description Store 订阅回调签名
|
|
8
8
|
*/
|
|
9
|
-
interface SubscriptionCallback<S = any> {
|
|
9
|
+
export interface SubscriptionCallback<S = any> {
|
|
10
10
|
(mutation: {
|
|
11
11
|
type: MutationType;
|
|
12
12
|
storeId: string;
|
|
@@ -15,7 +15,7 @@ interface SubscriptionCallback<S = any> {
|
|
|
15
15
|
/**
|
|
16
16
|
* @description Store 订阅选项
|
|
17
17
|
*/
|
|
18
|
-
interface StoreSubscribeOptions {
|
|
18
|
+
export interface StoreSubscribeOptions {
|
|
19
19
|
/**
|
|
20
20
|
* @description 是否在卸载后仍保留订阅(适用于跨页面生命周期的订阅)
|
|
21
21
|
*/
|
|
@@ -24,7 +24,7 @@ interface StoreSubscribeOptions {
|
|
|
24
24
|
/**
|
|
25
25
|
* @description Action 订阅回调上下文
|
|
26
26
|
*/
|
|
27
|
-
interface ActionContext<TStore = any> {
|
|
27
|
+
export interface ActionContext<TStore = any> {
|
|
28
28
|
name: string;
|
|
29
29
|
store: TStore;
|
|
30
30
|
args: any[];
|
|
@@ -34,13 +34,13 @@ interface ActionContext<TStore = any> {
|
|
|
34
34
|
/**
|
|
35
35
|
* @description Action 订阅回调类型
|
|
36
36
|
*/
|
|
37
|
-
interface ActionSubscriber<TStore = any> {
|
|
37
|
+
export interface ActionSubscriber<TStore = any> {
|
|
38
38
|
(context: ActionContext<TStore>): void;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* @description Store 管理器(插件与共享实例)
|
|
42
42
|
*/
|
|
43
|
-
interface StoreManager {
|
|
43
|
+
export interface StoreManager {
|
|
44
44
|
install: (app: any) => void;
|
|
45
45
|
_stores: Map<string, any>;
|
|
46
46
|
use: (plugin: (context: {
|
|
@@ -53,18 +53,17 @@ interface StoreManager {
|
|
|
53
53
|
/**
|
|
54
54
|
* @description Getter 定义集合
|
|
55
55
|
*/
|
|
56
|
-
type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
56
|
+
export type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
57
57
|
/**
|
|
58
58
|
* @description 从 Getter 定义中推导返回类型
|
|
59
59
|
*/
|
|
60
|
-
type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never; };
|
|
60
|
+
export type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never; };
|
|
61
61
|
/**
|
|
62
62
|
* @description defineStore(options) 的配置类型
|
|
63
63
|
*/
|
|
64
|
-
interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
64
|
+
export interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
65
65
|
state: () => S;
|
|
66
66
|
getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
|
|
67
67
|
actions?: A & ThisType<S & StoreGetters<G> & A>;
|
|
68
68
|
}
|
|
69
|
-
//#endregion
|
|
70
|
-
export { ActionContext, ActionSubscriber, DefineStoreOptions, GetterTree, MutationType, StoreGetters, StoreManager, StoreSubscribeOptions, SubscriptionCallback };
|
|
69
|
+
//#endregion
|
package/dist/version.d.mts
CHANGED
package/dist/vue-augment.d.mts
CHANGED