wevu 6.13.0 → 6.13.2
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/index-BPZxNlC8.d.mts +246 -0
- package/dist/{index-B7QVA9YG.d.mts → index-BvyrZ_XI.d.mts} +524 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/router-DW4Yf9Yj.d.mts +46 -0
- package/dist/router.d.mts +1 -1
- package/dist/{src-DLHIGzBf.mjs → src-xqSS8INA.mjs} +6 -2
- package/dist/store.d.mts +1 -1
- package/dist/vue-demi.d.mts +3 -4
- package/dist/vue-demi.mjs +1 -2
- package/package.json +3 -3
- package/dist/index-CJdlA5zG.d.mts +0 -112
- package/dist/vue-types-D8BVm-8u.d.mts +0 -698
|
@@ -1,698 +0,0 @@
|
|
|
1
|
-
import { AllowedComponentProps, ComponentCustomProps, ComponentOptionsMixin, ComputedOptions, DefineComponent, EmitsOptions, MethodOptions, ObjectDirective, PublicProps, Ref, ShallowRef, ShallowUnwrapRef, SlotsType, VNode, VNodeProps } from "vue";
|
|
2
|
-
|
|
3
|
-
//#region src/runtime/types/props/propTypes.d.ts
|
|
4
|
-
type PropMethod<T, TConstructor = any> = [T] extends [((...args: any) => any) | undefined] ? {
|
|
5
|
-
new (): TConstructor;
|
|
6
|
-
(): T;
|
|
7
|
-
readonly prototype: TConstructor;
|
|
8
|
-
} : never;
|
|
9
|
-
type PropConstructor<T = any> = {
|
|
10
|
-
new (...args: any[]): T & {};
|
|
11
|
-
} | {
|
|
12
|
-
(): T;
|
|
13
|
-
} | PropMethod<T>;
|
|
14
|
-
type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
|
|
15
|
-
type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
16
|
-
type ComponentPropsOptions = Record<string, PropOptions<any> | PropType<any> | null>;
|
|
17
|
-
interface NativeTypeHint<T = any> {
|
|
18
|
-
readonly __wevuNativeType?: T;
|
|
19
|
-
}
|
|
20
|
-
type NativePropsOptions = Record<string, WechatMiniprogram.Component.AllProperty | NativeTypeHint<any>>;
|
|
21
|
-
type NativePropType<T = any, C extends WechatMiniprogram.Component.ShortProperty = StringConstructor> = C & NativeTypeHint<T>;
|
|
22
|
-
type NativeTypedProperty<T = any, P extends WechatMiniprogram.Component.AllProperty = WechatMiniprogram.Component.AllProperty> = P & NativeTypeHint<T>;
|
|
23
|
-
interface PropOptions<T = any, D = T> {
|
|
24
|
-
type?: PropType<T> | true | null;
|
|
25
|
-
optionalTypes?: Array<WechatMiniprogram.Component.ShortProperty | PropConstructor<any>>;
|
|
26
|
-
/**
|
|
27
|
-
* 默认值(对齐 Vue 的 `default`;会被赋给小程序 property 的 `value`)
|
|
28
|
-
*/
|
|
29
|
-
default?: D | (() => D);
|
|
30
|
-
/**
|
|
31
|
-
* 小程序 `value` 的别名
|
|
32
|
-
*/
|
|
33
|
-
value?: D | (() => D);
|
|
34
|
-
observer?: string | ((newVal: T, oldVal: T, changedPath: Array<string | number>) => void);
|
|
35
|
-
required?: boolean;
|
|
36
|
-
}
|
|
37
|
-
type HasDefault<T> = T extends {
|
|
38
|
-
default: infer D;
|
|
39
|
-
} ? D extends (() => undefined) | undefined ? false : true : T extends {
|
|
40
|
-
value: infer V;
|
|
41
|
-
} ? V extends (() => undefined) | undefined ? false : true : false;
|
|
42
|
-
type IsBooleanProp<T> = T extends {
|
|
43
|
-
type?: infer U;
|
|
44
|
-
} ? IsBooleanProp<U> : T extends readonly any[] ? true extends IsBooleanProp<T[number]> ? true : false : T extends BooleanConstructor ? true : false;
|
|
45
|
-
type RequiredKeys<T> = { [K in keyof T]: T[K] extends {
|
|
46
|
-
required: true;
|
|
47
|
-
} ? K : HasDefault<T[K]> extends true ? K : IsBooleanProp<T[K]> extends true ? K : never }[keyof T];
|
|
48
|
-
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
49
|
-
type DefaultKeys<T> = { [K in keyof T]: HasDefault<T[K]> extends true ? K : IsBooleanProp<T[K]> extends true ? K : never }[keyof T];
|
|
50
|
-
type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
|
|
51
|
-
type InferPropType<O, NullAsAny = true> = [O] extends [null] ? NullAsAny extends true ? any : null : [O] extends [{
|
|
52
|
-
type: null | true;
|
|
53
|
-
}] ? any : [O] extends [ObjectConstructor | {
|
|
54
|
-
type: ObjectConstructor;
|
|
55
|
-
}] ? Record<string, any> : [O] extends [BooleanConstructor | {
|
|
56
|
-
type: BooleanConstructor;
|
|
57
|
-
}] ? boolean : [O] extends [DateConstructor | {
|
|
58
|
-
type: DateConstructor;
|
|
59
|
-
}] ? Date : [O] extends [(infer U)[] | {
|
|
60
|
-
type: (infer U)[];
|
|
61
|
-
}] ? U extends DateConstructor ? Date | InferPropType<U, false> : InferPropType<U, false> : [O] extends [Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? IfAny<V, V, D> : V : V : O;
|
|
62
|
-
type IsUnion<T, U = T> = T extends any ? ([U] extends [T] ? false : true) : never;
|
|
63
|
-
type WidenLiteral<T> = T extends string ? string extends T ? string : IsUnion<T> extends true ? T : string : T extends number ? number extends T ? number : IsUnion<T> extends true ? T : number : T extends boolean ? boolean extends T ? boolean : IsUnion<T> extends true ? T : boolean : T;
|
|
64
|
-
type NativeInferByCtor<C> = C extends readonly any[] ? NativeInferByCtor<C[number]> : C extends StringConstructor ? string : C extends NumberConstructor ? number : C extends BooleanConstructor ? boolean : C extends DateConstructor ? Date : C extends ArrayConstructor ? any[] : C extends ObjectConstructor ? Record<string, any> : C extends null ? any : C extends PropConstructor<infer V> ? V : any;
|
|
65
|
-
type MergeNativeType<Base, V> = Base extends string ? Exclude<Extract<WidenLiteral<V>, string>, never> | (Extract<WidenLiteral<V>, string> extends never ? string : never) : Base extends number ? Exclude<Extract<WidenLiteral<V>, number>, never> | (Extract<WidenLiteral<V>, number> extends never ? number : never) : Base extends boolean ? Exclude<Extract<WidenLiteral<V>, boolean>, never> | (Extract<WidenLiteral<V>, boolean> extends never ? boolean : never) : Base;
|
|
66
|
-
type InferNativeByOption<O extends {
|
|
67
|
-
type?: any;
|
|
68
|
-
}> = O['type'] extends NativeTypeHint<infer THint> ? THint : O extends {
|
|
69
|
-
value: infer V;
|
|
70
|
-
} ? MergeNativeType<NativeInferByCtor<O['type']>, V> : NativeInferByCtor<O['type']>;
|
|
71
|
-
type InferNativePropType<O> = O extends NativeTypeHint<infer T> ? T : O extends {
|
|
72
|
-
type?: any;
|
|
73
|
-
} ? InferNativeByOption<O> : NativeInferByCtor<O>;
|
|
74
|
-
type InferNativeProps<P extends NativePropsOptions = NativePropsOptions> = { readonly [K in keyof P]?: InferNativePropType<P[K]> };
|
|
75
|
-
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]> };
|
|
76
|
-
type ExtractPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = InferProps<P>;
|
|
77
|
-
type ExtractPublicPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = InferProps<P>;
|
|
78
|
-
type ExtractDefaultPropTypes<P extends ComponentPropsOptions = ComponentPropsOptions> = { [K in keyof Pick<P, DefaultKeys<P>>]: InferPropType<P[K]> };
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/runtime/types/props/router.d.ts
|
|
81
|
-
/**
|
|
82
|
-
* Router 路由类型映射(供声明合并扩展)。
|
|
83
|
-
*
|
|
84
|
-
* 典型用法:在业务项目的类型声明中补充 `entries` 联合类型,
|
|
85
|
-
* 让 `useNativeRouter()/useNativePageRouter()` 的 `url` 参数获得字面量约束。
|
|
86
|
-
*/
|
|
87
|
-
interface WevuTypedRouterRouteMap {}
|
|
88
|
-
type ResolveTypedRouterEntries = WevuTypedRouterRouteMap extends {
|
|
89
|
-
entries: infer Entries;
|
|
90
|
-
} ? Extract<Entries, string> : string;
|
|
91
|
-
type ResolveTypedRouterTabBarEntries = WevuTypedRouterRouteMap extends {
|
|
92
|
-
tabBarEntries: infer Entries;
|
|
93
|
-
} ? Extract<Entries, string> : ResolveTypedRouterEntries;
|
|
94
|
-
type RelativeRouterUrl = `./${string}` | `../${string}`;
|
|
95
|
-
type AbsoluteRouterPath<Path extends string> = Path | `/${Path}`;
|
|
96
|
-
type AbsoluteRouterUrl<Path extends string> = AbsoluteRouterPath<Path> | `${Path}?${string}` | `/${Path}?${string}`;
|
|
97
|
-
type RouterUrl<Path extends string> = string extends Path ? string : AbsoluteRouterUrl<Path> | RelativeRouterUrl;
|
|
98
|
-
type RouterPathUrl<Path extends string> = string extends Path ? string : AbsoluteRouterPath<Path>;
|
|
99
|
-
type TypedRouterUrl = RouterUrl<ResolveTypedRouterEntries>;
|
|
100
|
-
type TypedRouterTabBarUrl = RouterPathUrl<ResolveTypedRouterTabBarEntries>;
|
|
101
|
-
type RouterSwitchTabOption = Omit<WechatMiniprogram.SwitchTabOption, 'url'> & {
|
|
102
|
-
url: TypedRouterTabBarUrl;
|
|
103
|
-
};
|
|
104
|
-
type RouterReLaunchOption = Omit<WechatMiniprogram.ReLaunchOption, 'url'> & {
|
|
105
|
-
url: TypedRouterUrl;
|
|
106
|
-
};
|
|
107
|
-
type RouterRedirectToOption = Omit<WechatMiniprogram.RedirectToOption, 'url'> & {
|
|
108
|
-
url: TypedRouterUrl;
|
|
109
|
-
};
|
|
110
|
-
type RouterNavigateToOption = Omit<WechatMiniprogram.NavigateToOption, 'url'> & {
|
|
111
|
-
url: TypedRouterUrl;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* setup 场景下推荐使用的 Router 类型。
|
|
115
|
-
* 默认行为与原生 Router 一致;声明合并后可获得更精确的 `url` 类型提示。
|
|
116
|
-
*/
|
|
117
|
-
interface SetupContextRouter {
|
|
118
|
-
switchTab: (option: RouterSwitchTabOption) => ReturnType<WechatMiniprogram.Component.Router['switchTab']>;
|
|
119
|
-
reLaunch: (option: RouterReLaunchOption) => ReturnType<WechatMiniprogram.Component.Router['reLaunch']>;
|
|
120
|
-
redirectTo: (option: RouterRedirectToOption) => ReturnType<WechatMiniprogram.Component.Router['redirectTo']>;
|
|
121
|
-
navigateTo: (option: RouterNavigateToOption) => ReturnType<WechatMiniprogram.Component.Router['navigateTo']>;
|
|
122
|
-
navigateBack: WechatMiniprogram.Component.Router['navigateBack'];
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
125
|
-
//#region src/reactivity/ref.d.ts
|
|
126
|
-
type Ref$2<T = any, S = T> = Ref$1<T, S>;
|
|
127
|
-
type ShallowRef$2<T = any> = ShallowRef$1<T>;
|
|
128
|
-
type MaybeRef<T = any> = T | Ref$2<T> | ShallowRef$2<T> | WritableComputedRef<T>;
|
|
129
|
-
type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T);
|
|
130
|
-
declare function isRef(value: unknown): value is Ref$2<any>;
|
|
131
|
-
declare function ref<T = any>(): Ref$2<T | undefined>;
|
|
132
|
-
declare function ref<T>(value: T): Ref$2<T>;
|
|
133
|
-
declare function unref<T>(value: MaybeRef<T> | ComputedRef<T>): T;
|
|
134
|
-
declare function toValue<T>(source: MaybeRefOrGetter<T>): T;
|
|
135
|
-
/**
|
|
136
|
-
* 自定义 ref 工厂:用于创建可显式控制 track/trigger 的自定义 ref
|
|
137
|
-
*/
|
|
138
|
-
type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
|
139
|
-
get: () => T;
|
|
140
|
-
set: (value: T) => void;
|
|
141
|
-
};
|
|
142
|
-
interface CustomRefOptions<T> {
|
|
143
|
-
get: () => T;
|
|
144
|
-
set: (value: T) => void;
|
|
145
|
-
}
|
|
146
|
-
type CustomRefSource<T> = CustomRefFactory<T> | CustomRefOptions<T>;
|
|
147
|
-
declare function customRef<T>(factory: CustomRefSource<T>, defaultValue?: T): Ref$2<T>;
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/reactivity/computed.d.ts
|
|
150
|
-
type ComputedGetter<T> = () => T;
|
|
151
|
-
type ComputedSetter<T> = (value: T) => void;
|
|
152
|
-
interface BaseComputedRef<T, S = T> extends Ref$2<T, S> {
|
|
153
|
-
[key: symbol]: any;
|
|
154
|
-
}
|
|
155
|
-
interface ComputedRef<T = any> extends BaseComputedRef<T> {
|
|
156
|
-
readonly value: T;
|
|
157
|
-
}
|
|
158
|
-
interface WritableComputedRef<T, S = T> extends BaseComputedRef<T, S> {
|
|
159
|
-
value: T;
|
|
160
|
-
}
|
|
161
|
-
interface WritableComputedOptions<T> {
|
|
162
|
-
get: ComputedGetter<T>;
|
|
163
|
-
set: ComputedSetter<T>;
|
|
164
|
-
}
|
|
165
|
-
declare function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>;
|
|
166
|
-
declare function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>;
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region src/scheduler.d.ts
|
|
169
|
-
declare function nextTick<T>(fn?: () => T): Promise<T>;
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region src/reactivity/core.d.ts
|
|
172
|
-
type EffectScheduler = () => void;
|
|
173
|
-
type Dep = Set<ReactiveEffect>;
|
|
174
|
-
interface ReactiveEffect<T = any> {
|
|
175
|
-
(): T;
|
|
176
|
-
deps: Dep[];
|
|
177
|
-
scheduler?: EffectScheduler;
|
|
178
|
-
active: boolean;
|
|
179
|
-
_running: boolean;
|
|
180
|
-
_fn: () => T;
|
|
181
|
-
onStop?: () => void;
|
|
182
|
-
}
|
|
183
|
-
declare function startBatch(): void;
|
|
184
|
-
declare function endBatch(): void;
|
|
185
|
-
declare function batch<T>(fn: () => T): T;
|
|
186
|
-
declare function stop(runner: ReactiveEffect): void;
|
|
187
|
-
interface EffectScope {
|
|
188
|
-
active: boolean;
|
|
189
|
-
effects: ReactiveEffect[];
|
|
190
|
-
cleanups: (() => void)[];
|
|
191
|
-
run: <T>(fn: () => T) => T | undefined;
|
|
192
|
-
stop: () => void;
|
|
193
|
-
}
|
|
194
|
-
declare function effectScope(detached?: boolean): EffectScope;
|
|
195
|
-
declare function getCurrentScope(): EffectScope | undefined;
|
|
196
|
-
declare function onScopeDispose(fn: () => void): void;
|
|
197
|
-
interface EffectOptions {
|
|
198
|
-
scheduler?: EffectScheduler;
|
|
199
|
-
lazy?: boolean;
|
|
200
|
-
onStop?: () => void;
|
|
201
|
-
}
|
|
202
|
-
declare function effect<T = any>(fn: () => T, options?: EffectOptions): ReactiveEffect<T>;
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region src/reactivity/reactive/mutation.d.ts
|
|
205
|
-
type MutationOp = 'set' | 'delete';
|
|
206
|
-
type MutationKind = 'property' | 'array';
|
|
207
|
-
interface MutationRecord {
|
|
208
|
-
root: object;
|
|
209
|
-
kind: MutationKind;
|
|
210
|
-
op: MutationOp;
|
|
211
|
-
/**
|
|
212
|
-
* 点路径(例如 `a.b.c`);当路径不可靠时为 undefined。
|
|
213
|
-
*/
|
|
214
|
-
path?: string;
|
|
215
|
-
/**
|
|
216
|
-
* 当路径不唯一时回退使用的顶层键列表。
|
|
217
|
-
*/
|
|
218
|
-
fallbackTopKeys?: string[];
|
|
219
|
-
}
|
|
220
|
-
type MutationRecorder = (record: MutationRecord) => void;
|
|
221
|
-
declare function addMutationRecorder(recorder: MutationRecorder): void;
|
|
222
|
-
declare function removeMutationRecorder(recorder: MutationRecorder): void;
|
|
223
|
-
//#endregion
|
|
224
|
-
//#region src/reactivity/reactive/patch.d.ts
|
|
225
|
-
interface PrelinkReactiveTreeOptions {
|
|
226
|
-
shouldIncludeTopKey?: (key: string) => boolean;
|
|
227
|
-
maxDepth?: number;
|
|
228
|
-
maxKeys?: number;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* 预链接响应式树结构,供运行时差量路径追踪使用。
|
|
232
|
-
* @internal
|
|
233
|
-
*/
|
|
234
|
-
declare function prelinkReactiveTree(root: object, options?: PrelinkReactiveTreeOptions): void;
|
|
235
|
-
/**
|
|
236
|
-
* 让 effect 订阅整个对象的“版本号”,无需深度遍历即可对任何字段变化做出响应。
|
|
237
|
-
* @internal
|
|
238
|
-
*/
|
|
239
|
-
declare function touchReactive(target: object): void;
|
|
240
|
-
//#endregion
|
|
241
|
-
//#region src/reactivity/reactive/shallow.d.ts
|
|
242
|
-
/**
|
|
243
|
-
* 创建一个浅层响应式代理:仅跟踪第一层属性变更,不深度递归嵌套对象。
|
|
244
|
-
*
|
|
245
|
-
* @param target 待转换的对象
|
|
246
|
-
* @returns 浅层响应式代理
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* ```ts
|
|
250
|
-
* const state = shallowReactive({ nested: { count: 0 } })
|
|
251
|
-
*
|
|
252
|
-
* state.nested.count++ // 不会触发 effect(嵌套对象未深度代理)
|
|
253
|
-
* state.nested = { count: 1 } // 会触发 effect(顶层属性变更)
|
|
254
|
-
* ```
|
|
255
|
-
*/
|
|
256
|
-
declare function shallowReactive<T extends object>(target: T): T;
|
|
257
|
-
/**
|
|
258
|
-
* 判断一个值是否为 shallowReactive 创建的浅层响应式对象
|
|
259
|
-
*/
|
|
260
|
-
declare function isShallowReactive(value: unknown): boolean;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/reactivity/reactive/shared.d.ts
|
|
263
|
-
declare function toRaw<T>(observed: T): T;
|
|
264
|
-
//#endregion
|
|
265
|
-
//#region src/reactivity/reactive.d.ts
|
|
266
|
-
/**
|
|
267
|
-
* 读取响应式版本号(框架内部调试能力)。
|
|
268
|
-
* @internal
|
|
269
|
-
*/
|
|
270
|
-
declare function getReactiveVersion(target: object): number;
|
|
271
|
-
declare function reactive<T extends object>(target: T): T;
|
|
272
|
-
declare function isReactive(value: unknown): boolean;
|
|
273
|
-
/**
|
|
274
|
-
* 标记对象为“原始”状态,后续不会被转换为响应式,返回原对象本身。
|
|
275
|
-
*
|
|
276
|
-
* @param value 需要标记的对象
|
|
277
|
-
* @returns 带有跳过标记的原对象
|
|
278
|
-
*
|
|
279
|
-
* @example
|
|
280
|
-
* ```ts
|
|
281
|
-
* const foo = markRaw({
|
|
282
|
-
* nested: {}
|
|
283
|
-
* })
|
|
284
|
-
*
|
|
285
|
-
* const state = reactive({
|
|
286
|
-
* foo
|
|
287
|
-
* })
|
|
288
|
-
*
|
|
289
|
-
* state.foo // 不是响应式对象
|
|
290
|
-
* ```
|
|
291
|
-
*/
|
|
292
|
-
declare function markRaw<T extends object>(value: T): T;
|
|
293
|
-
/**
|
|
294
|
-
* 判断某个值是否被标记为原始(即不应转换为响应式)。
|
|
295
|
-
*
|
|
296
|
-
* @param value 待检测的值
|
|
297
|
-
* @returns 若含有跳过标记则返回 true
|
|
298
|
-
*/
|
|
299
|
-
declare function isRaw(value: unknown): boolean;
|
|
300
|
-
//#endregion
|
|
301
|
-
//#region src/reactivity/readonly.d.ts
|
|
302
|
-
/**
|
|
303
|
-
* readonly 会为对象/数组创建一个“浅层”只读代理,并为 Ref 创建只读包装。
|
|
304
|
-
* 选择浅层而非深层递归,是为了在小程序环境中保持实现和运行时开销最小,
|
|
305
|
-
* 仅阻止直接属性写入/删除,嵌套对象仍按原样透传。
|
|
306
|
-
*/
|
|
307
|
-
declare function readonly<T extends object>(target: T): T;
|
|
308
|
-
declare function readonly<T>(target: Ref$2<T>): Readonly<Ref$2<T>>;
|
|
309
|
-
/**
|
|
310
|
-
* 与 Vue 3 的 `shallowReadonly()` 对齐。
|
|
311
|
-
*
|
|
312
|
-
* 当前 wevu 的只读语义本身就是浅层只读,因此这里直接复用同一套实现,
|
|
313
|
-
* 让依赖 Vue 兼容 API 的代码可以无缝迁移。
|
|
314
|
-
*/
|
|
315
|
-
declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
|
316
|
-
declare function shallowReadonly<T>(target: Ref$2<T>): Readonly<Ref$2<T>>;
|
|
317
|
-
/**
|
|
318
|
-
* 判断值是否为只读代理或只读 ref 包装。
|
|
319
|
-
*/
|
|
320
|
-
declare function isReadonly(value: unknown): boolean;
|
|
321
|
-
/**
|
|
322
|
-
* 判断值是否为响应式代理或只读代理。
|
|
323
|
-
*/
|
|
324
|
-
declare function isProxy(value: unknown): boolean;
|
|
325
|
-
//#endregion
|
|
326
|
-
//#region src/reactivity/shallowRef.d.ts
|
|
327
|
-
declare function shallowRef<T>(value: T): Ref$2<T>;
|
|
328
|
-
declare function shallowRef<T>(value: T, defaultValue: T): Ref$2<T>;
|
|
329
|
-
/**
|
|
330
|
-
* 判断传入值是否为浅层 ref。
|
|
331
|
-
*
|
|
332
|
-
* @param r 待判断的值
|
|
333
|
-
* @returns 若为浅层 ref 则返回 true
|
|
334
|
-
*/
|
|
335
|
-
declare function isShallowRef(r: any): r is Ref$2<any>;
|
|
336
|
-
/**
|
|
337
|
-
* 主动触发一次浅层 ref 的更新(无需深度比较)。
|
|
338
|
-
*
|
|
339
|
-
* @param ref 需要触发的 ref
|
|
340
|
-
*/
|
|
341
|
-
declare function triggerRef<T>(ref: Ref$2<T>): void;
|
|
342
|
-
//#endregion
|
|
343
|
-
//#region src/reactivity/toRefs.d.ts
|
|
344
|
-
/**
|
|
345
|
-
* 为源响应式对象的单个属性创建 ref,可读可写并与原属性保持同步。
|
|
346
|
-
*
|
|
347
|
-
* @param object 源响应式对象
|
|
348
|
-
* @param key 属性名
|
|
349
|
-
* @returns 指向该属性的 ref
|
|
350
|
-
*
|
|
351
|
-
* @example
|
|
352
|
-
* ```ts
|
|
353
|
-
* const state = reactive({ foo: 1 })
|
|
354
|
-
* const fooRef = toRef(state, 'foo')
|
|
355
|
-
*
|
|
356
|
-
* fooRef.value++
|
|
357
|
-
* console.log(state.foo) // 2
|
|
358
|
-
* ```
|
|
359
|
-
*/
|
|
360
|
-
declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
361
|
-
declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<T[K]>;
|
|
362
|
-
/**
|
|
363
|
-
* 将一个响应式对象转换成“同结构的普通对象”,其中每个字段都是指向原对象对应属性的 ref。
|
|
364
|
-
*
|
|
365
|
-
* @param object 待转换的响应式对象
|
|
366
|
-
* @returns 包含若干 ref 的普通对象
|
|
367
|
-
*
|
|
368
|
-
* @example
|
|
369
|
-
* ```ts
|
|
370
|
-
* const state = reactive({ foo: 1, bar: 2 })
|
|
371
|
-
* const stateAsRefs = toRefs(state)
|
|
372
|
-
*
|
|
373
|
-
* stateAsRefs.foo.value++ // 2
|
|
374
|
-
* state.foo // 2
|
|
375
|
-
* ```
|
|
376
|
-
*/
|
|
377
|
-
declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
|
378
|
-
/**
|
|
379
|
-
* toRefs 返回值的类型辅助
|
|
380
|
-
*/
|
|
381
|
-
type ToRef<T> = T extends Ref$2<any> ? T : Ref$2<T>;
|
|
382
|
-
type ToRefs<T extends object> = { [K in keyof T]: ToRef<T[K]> };
|
|
383
|
-
//#endregion
|
|
384
|
-
//#region src/reactivity/traverse.d.ts
|
|
385
|
-
/**
|
|
386
|
-
* 深度遍历工具(框架内部依赖收集使用)。
|
|
387
|
-
* @internal
|
|
388
|
-
*/
|
|
389
|
-
declare function traverse(value: any, depth?: number, seen?: Map<object, number>): any;
|
|
390
|
-
//#endregion
|
|
391
|
-
//#region src/reactivity/watch/types.d.ts
|
|
392
|
-
type OnCleanup = (cleanupFn: () => void) => void;
|
|
393
|
-
type WatchEffect = (onCleanup: OnCleanup) => void;
|
|
394
|
-
type WatchSource<T = any> = Ref$2<T> | ComputedRef<T> | (() => T);
|
|
395
|
-
type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => void;
|
|
396
|
-
type WatchScheduler = (job: () => void, isFirstRun: boolean) => void;
|
|
397
|
-
type MaybeUndefined<T, Immediate> = Immediate extends true ? T | undefined : T;
|
|
398
|
-
type MultiWatchSources = (WatchSource<unknown> | object)[];
|
|
399
|
-
type MapSources<T, Immediate> = { [K in keyof T]: T[K] extends WatchSource<infer V> ? MaybeUndefined<V, Immediate> : T[K] extends object ? MaybeUndefined<T[K], Immediate> : never };
|
|
400
|
-
type WatchSourceValue<S> = S extends WatchSource<infer V> ? V : S extends object ? S : never;
|
|
401
|
-
type WatchSources<T = any> = WatchSource<T> | ReadonlyArray<WatchSource<unknown> | object> | (T extends object ? T : never);
|
|
402
|
-
type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false : true;
|
|
403
|
-
type WatchMultiSources<T extends ReadonlyArray<WatchSource<unknown> | object>> = IsTuple<T> extends true ? { [K in keyof T]: WatchSourceValue<T[K]> } : Array<WatchSourceValue<T[number]>>;
|
|
404
|
-
interface WatchEffectOptions {
|
|
405
|
-
flush?: 'pre' | 'post' | 'sync';
|
|
406
|
-
}
|
|
407
|
-
interface WatchOptions<Immediate extends boolean = false> extends WatchEffectOptions {
|
|
408
|
-
immediate?: Immediate;
|
|
409
|
-
deep?: boolean | number;
|
|
410
|
-
once?: boolean;
|
|
411
|
-
scheduler?: WatchScheduler;
|
|
412
|
-
}
|
|
413
|
-
interface WatchStopHandle {
|
|
414
|
-
(): void;
|
|
415
|
-
stop: () => void;
|
|
416
|
-
pause: () => void;
|
|
417
|
-
resume: () => void;
|
|
418
|
-
}
|
|
419
|
-
type DeepWatchStrategy = 'version' | 'traverse';
|
|
420
|
-
/**
|
|
421
|
-
* 设置深度 watch 内部策略(测试/框架内部使用)。
|
|
422
|
-
* @internal
|
|
423
|
-
*/
|
|
424
|
-
declare function setDeepWatchStrategy(strategy: DeepWatchStrategy): void;
|
|
425
|
-
/**
|
|
426
|
-
* 获取深度 watch 内部策略(测试/框架内部使用)。
|
|
427
|
-
* @internal
|
|
428
|
-
*/
|
|
429
|
-
declare function getDeepWatchStrategy(): DeepWatchStrategy;
|
|
430
|
-
//#endregion
|
|
431
|
-
//#region src/reactivity/watch.d.ts
|
|
432
|
-
declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
433
|
-
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;
|
|
434
|
-
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;
|
|
435
|
-
declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
436
|
-
/**
|
|
437
|
-
* watchEffect 注册一个响应式副作用,可选清理函数。
|
|
438
|
-
* 副作用会立即执行,并在依赖变化时重新运行。
|
|
439
|
-
*/
|
|
440
|
-
declare function watchEffect(effectFn: WatchEffect, options?: WatchEffectOptions): WatchStopHandle;
|
|
441
|
-
/**
|
|
442
|
-
* 以后置刷新的方式运行副作用,与 Vue 的 `watchPostEffect()` 兼容。
|
|
443
|
-
*/
|
|
444
|
-
declare function watchPostEffect(effectFn: WatchEffect, options?: Omit<WatchEffectOptions, 'flush'>): WatchStopHandle;
|
|
445
|
-
/**
|
|
446
|
-
* 以同步刷新的方式运行副作用,与 Vue 的 `watchSyncEffect()` 兼容。
|
|
447
|
-
*/
|
|
448
|
-
declare function watchSyncEffect(effectFn: WatchEffect, options?: Omit<WatchEffectOptions, 'flush'>): WatchStopHandle;
|
|
449
|
-
//#endregion
|
|
450
|
-
//#region src/runtime/types/core.d.ts
|
|
451
|
-
type ComputedDefinitions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
|
|
452
|
-
type MethodDefinitions = Record<string, (...args: any[]) => any>;
|
|
453
|
-
type ExtractComputed<C extends ComputedDefinitions> = { [K in keyof C]: C[K] extends ComputedGetter<infer R> ? R : C[K] extends WritableComputedOptions<infer R> ? R : never };
|
|
454
|
-
type ExtractMethods<M extends MethodDefinitions> = { [K in keyof M]: M[K] extends ((...args: infer P) => infer R) ? (...args: P) => R : never };
|
|
455
|
-
type ComponentPublicInstance<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions, P = Record<string, any>, S = Record<string, any>> = D & ExtractComputed<C> & ExtractMethods<M> & {
|
|
456
|
-
$attrs: Record<string, any>;
|
|
457
|
-
$props: P;
|
|
458
|
-
$slots: S;
|
|
459
|
-
$emit: (event: string, ...args: any[]) => void;
|
|
460
|
-
};
|
|
461
|
-
interface ModelBindingOptions<T = any, Event extends string = string, ValueProp extends string = string, Formatted = T> {
|
|
462
|
-
event?: Event;
|
|
463
|
-
valueProp?: ValueProp;
|
|
464
|
-
parser?: (payload: any) => T;
|
|
465
|
-
formatter?: (value: T) => Formatted;
|
|
466
|
-
}
|
|
467
|
-
type ModelBindingPayload<T = any, Event extends string = 'input', ValueProp extends string = 'value', Formatted = T> = { [K in ValueProp]: Formatted } & { [K in `on${Capitalize<Event>}`]: (event: any) => void };
|
|
468
|
-
interface ModelBinding<T = any> {
|
|
469
|
-
value: T;
|
|
470
|
-
update: (value: T) => void;
|
|
471
|
-
model: <Event extends string = 'input', ValueProp extends string = 'value', Formatted = T>(options?: ModelBindingOptions<T, Event, ValueProp, Formatted>) => ModelBindingPayload<T, Event, ValueProp, Formatted>;
|
|
472
|
-
}
|
|
473
|
-
//#endregion
|
|
474
|
-
//#region src/runtime/types/miniprogram.d.ts
|
|
475
|
-
interface MiniProgramAdapter {
|
|
476
|
-
setData?: (payload: Record<string, any>) => void | Promise<void>;
|
|
477
|
-
}
|
|
478
|
-
type MiniProgramComponentBehaviorOptions = WechatMiniprogram.Component.ComponentOptions;
|
|
479
|
-
type MpComponentOptions = WechatMiniprogram.Component.TrivialOption;
|
|
480
|
-
type MiniProgramBehaviorIdentifier = WechatMiniprogram.Behavior.Identifier | string;
|
|
481
|
-
interface MiniProgramComponentOptions {
|
|
482
|
-
/**
|
|
483
|
-
* 类似于 mixins/traits 的组件间代码复用机制(behaviors)。
|
|
484
|
-
*/
|
|
485
|
-
behaviors?: MiniProgramBehaviorIdentifier[];
|
|
486
|
-
/**
|
|
487
|
-
* 组件接受的外部样式类。
|
|
488
|
-
*/
|
|
489
|
-
externalClasses?: MpComponentOptions['externalClasses'];
|
|
490
|
-
/**
|
|
491
|
-
* 组件间关系定义。
|
|
492
|
-
*/
|
|
493
|
-
relations?: MpComponentOptions['relations'];
|
|
494
|
-
/**
|
|
495
|
-
* 组件数据字段监听器,用于监听 properties 和 data 的变化。
|
|
496
|
-
*/
|
|
497
|
-
observers?: MpComponentOptions['observers'];
|
|
498
|
-
/**
|
|
499
|
-
* 组件生命周期声明对象:
|
|
500
|
-
* `created`/`attached`/`ready`/`moved`/`detached`/`error`。
|
|
501
|
-
*
|
|
502
|
-
* 注意:wevu 会在 `attached/ready/detached/moved/error` 阶段做桥接与包装。
|
|
503
|
-
* setup 默认在 `attached` 执行,可通过 `setupLifecycle = "created"` 切换回旧行为。
|
|
504
|
-
*/
|
|
505
|
-
lifetimes?: MpComponentOptions['lifetimes'];
|
|
506
|
-
/**
|
|
507
|
-
* 组件所在页面的生命周期声明对象:`show`/`hide`/`resize`/`routeDone`。
|
|
508
|
-
*/
|
|
509
|
-
pageLifetimes?: MpComponentOptions['pageLifetimes'];
|
|
510
|
-
/**
|
|
511
|
-
* 组件选项(multipleSlots/styleIsolation/pureDataPattern/virtualHost 等)。
|
|
512
|
-
*/
|
|
513
|
-
options?: MpComponentOptions['options'];
|
|
514
|
-
/**
|
|
515
|
-
* 定义段过滤器,用于自定义组件扩展。
|
|
516
|
-
*/
|
|
517
|
-
definitionFilter?: MpComponentOptions['definitionFilter'];
|
|
518
|
-
/**
|
|
519
|
-
* 组件自定义导出:当使用 `behavior: wx://component-export` 时,
|
|
520
|
-
* 可用于指定组件被 selectComponent 调用时的返回值。
|
|
521
|
-
*
|
|
522
|
-
* wevu 默认会将 setup() 中通过 `expose()` 写入的内容作为 export() 返回值,
|
|
523
|
-
* 因此大多数情况下无需手动编写 export();若同时提供 export(),则会与 expose() 结果浅合并。
|
|
524
|
-
*/
|
|
525
|
-
export?: MpComponentOptions['export'];
|
|
526
|
-
/**
|
|
527
|
-
* 原生 properties(与 wevu 的 props 不同)。
|
|
528
|
-
*
|
|
529
|
-
* - 推荐:使用 wevu 的 `props` 选项,让运行时规范化为小程序 `properties`。
|
|
530
|
-
* - 兼容:也可以直接传入小程序 `properties`。
|
|
531
|
-
*/
|
|
532
|
-
properties?: MpComponentOptions['properties'];
|
|
533
|
-
/**
|
|
534
|
-
* 旧式生命周期(基础库 `2.2.3` 起推荐使用 `lifetimes` 字段)。
|
|
535
|
-
* 保留以增强类型提示与兼容性。
|
|
536
|
-
*/
|
|
537
|
-
created?: MpComponentOptions['created'];
|
|
538
|
-
attached?: MpComponentOptions['attached'];
|
|
539
|
-
ready?: MpComponentOptions['ready'];
|
|
540
|
-
moved?: MpComponentOptions['moved'];
|
|
541
|
-
detached?: MpComponentOptions['detached'];
|
|
542
|
-
error?: MpComponentOptions['error'];
|
|
543
|
-
}
|
|
544
|
-
type MiniProgramAppOptions<T extends Record<string, any> = Record<string, any>> = WechatMiniprogram.App.Options<T>;
|
|
545
|
-
type TriggerEventOptions = WechatMiniprogram.Component.TriggerEventOption;
|
|
546
|
-
type MiniProgramInstance = WechatMiniprogram.Component.TrivialInstance | WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.App.TrivialInstance;
|
|
547
|
-
type MiniProgramPageLifetimes = Partial<WechatMiniprogram.Page.ILifetime>;
|
|
548
|
-
type MiniProgramComponentRawOptions = Omit<WechatMiniprogram.Component.TrivialOption, 'behaviors'> & {
|
|
549
|
-
behaviors?: MiniProgramBehaviorIdentifier[];
|
|
550
|
-
} & MiniProgramPageLifetimes & Record<string, any>;
|
|
551
|
-
//#endregion
|
|
552
|
-
//#region src/runtime/types/runtime.d.ts
|
|
553
|
-
interface AppConfig {
|
|
554
|
-
globalProperties: Record<string, any>;
|
|
555
|
-
}
|
|
556
|
-
type WevuPlugin = ((app: RuntimeApp<any, any, any>, ...options: any[]) => any) | {
|
|
557
|
-
install: (app: RuntimeApp<any, any, any>, ...options: any[]) => any;
|
|
558
|
-
};
|
|
559
|
-
interface RuntimeApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
|
|
560
|
-
mount: (adapter?: MiniProgramAdapter) => RuntimeInstance<D, C, M>;
|
|
561
|
-
use: (plugin: WevuPlugin, ...options: any[]) => RuntimeApp<D, C, M>;
|
|
562
|
-
provide: <T>(key: any, value: T) => RuntimeApp<D, C, M>;
|
|
563
|
-
onUnmount: (cleanup: () => void) => RuntimeApp<D, C, M>;
|
|
564
|
-
unmount: () => void;
|
|
565
|
-
config: AppConfig;
|
|
566
|
-
}
|
|
567
|
-
interface RuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
|
|
568
|
-
readonly state: D;
|
|
569
|
-
readonly proxy: ComponentPublicInstance<D, C, M>;
|
|
570
|
-
readonly methods: ExtractMethods<M>;
|
|
571
|
-
readonly computed: Readonly<ExtractComputed<C>>;
|
|
572
|
-
readonly adapter?: MiniProgramAdapter;
|
|
573
|
-
bindModel: <T = any>(path: string, options?: ModelBindingOptions<T>) => ModelBinding<T>;
|
|
574
|
-
watch: <T>(source: (() => T) | Record<string, any>, cb: (value: T, oldValue: T) => void, options?: WatchOptions) => WatchStopHandle;
|
|
575
|
-
snapshot: () => Record<string, any>;
|
|
576
|
-
unmount: () => void;
|
|
577
|
-
}
|
|
578
|
-
interface InternalRuntimeStateFields {
|
|
579
|
-
__wevu?: RuntimeInstance<any, any, any>;
|
|
580
|
-
__wevuIsAppInstance?: boolean;
|
|
581
|
-
__wevuRuntimeApp?: RuntimeApp<any, any, any>;
|
|
582
|
-
__wevuSetPageLayout?: (layout: string | false, props?: Record<string, any>) => void;
|
|
583
|
-
__wevuWatchStops?: WatchStopHandle[];
|
|
584
|
-
__wevuLayoutHostBridge?: Record<string, any>;
|
|
585
|
-
$wevu?: RuntimeInstance<any, any, any>;
|
|
586
|
-
__wevuHooks?: Record<string, any>;
|
|
587
|
-
__wevuExposed?: Record<string, any>;
|
|
588
|
-
__wevuAttrs?: Record<string, any>;
|
|
589
|
-
__wevuEffectScope?: EffectScope;
|
|
590
|
-
__wevuPropKeys?: string[];
|
|
591
|
-
__wevuTemplateRefs?: unknown[];
|
|
592
|
-
__wevuTemplateRefMap?: Map<string, Ref$2<any>>;
|
|
593
|
-
__wevuTemplateRefsPending?: boolean;
|
|
594
|
-
}
|
|
595
|
-
type InternalRuntimeState = InternalRuntimeStateFields & Partial<MiniProgramInstance>;
|
|
596
|
-
//#endregion
|
|
597
|
-
//#region src/runtime/types/props/setup.d.ts
|
|
598
|
-
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;
|
|
599
|
-
type SetupContextNativeInstance = InternalRuntimeState & {
|
|
600
|
-
/**
|
|
601
|
-
* 派发组件事件(页面/应用场景下不可用时会安全降级为 no-op)
|
|
602
|
-
*/
|
|
603
|
-
triggerEvent: (eventName: string, detail?: any, options?: TriggerEventOptions) => void;
|
|
604
|
-
/**
|
|
605
|
-
* 创建选择器查询对象(不可用时返回 undefined)
|
|
606
|
-
*/
|
|
607
|
-
createSelectorQuery: () => WechatMiniprogram.SelectorQuery | undefined;
|
|
608
|
-
/**
|
|
609
|
-
* 创建交叉观察器(不可用时返回 undefined)
|
|
610
|
-
*/
|
|
611
|
-
createIntersectionObserver: (options?: WechatMiniprogram.CreateIntersectionObserverOption) => WechatMiniprogram.IntersectionObserver | undefined;
|
|
612
|
-
/**
|
|
613
|
-
* 提交视图层更新
|
|
614
|
-
*/
|
|
615
|
-
setData: (payload: Record<string, any>, callback?: () => void) => void | Promise<void> | undefined;
|
|
616
|
-
/**
|
|
617
|
-
* 监听组件更新性能统计(不可用时返回 undefined)
|
|
618
|
-
*/
|
|
619
|
-
setUpdatePerformanceListener: (listener?: ((result: Record<string, any>) => void)) => void | undefined;
|
|
620
|
-
/**
|
|
621
|
-
* 相对于当前组件路径的 Router(基础库 2.16.1+)。
|
|
622
|
-
* 低版本基础库可能不存在,建议优先使用 `useNativeRouter()` 获取带降级能力的路由对象。
|
|
623
|
-
*/
|
|
624
|
-
router?: SetupContextRouter;
|
|
625
|
-
/**
|
|
626
|
-
* 相对于当前页面路径的 Router(基础库 2.16.1+)。
|
|
627
|
-
* 低版本基础库可能不存在,建议优先使用 `useNativePageRouter()` 获取带降级能力的路由对象。
|
|
628
|
-
*/
|
|
629
|
-
pageRouter?: SetupContextRouter;
|
|
630
|
-
};
|
|
631
|
-
interface SetupContext<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions, P extends ComponentPropsOptions = ComponentPropsOptions> {
|
|
632
|
-
/**
|
|
633
|
-
* 组件 props(来自小程序 properties)
|
|
634
|
-
*/
|
|
635
|
-
props: InferProps<P>;
|
|
636
|
-
/**
|
|
637
|
-
* 运行时实例
|
|
638
|
-
*/
|
|
639
|
-
runtime: RuntimeInstance<D, C, M>;
|
|
640
|
-
/**
|
|
641
|
-
* 响应式状态
|
|
642
|
-
*/
|
|
643
|
-
state: D;
|
|
644
|
-
/**
|
|
645
|
-
* 公开实例代理
|
|
646
|
-
*/
|
|
647
|
-
proxy: RuntimeInstance<D, C, M>['proxy'];
|
|
648
|
-
/**
|
|
649
|
-
* 双向绑定辅助方法
|
|
650
|
-
*/
|
|
651
|
-
bindModel: RuntimeInstance<D, C, M>['bindModel'];
|
|
652
|
-
/**
|
|
653
|
-
* watch 辅助方法
|
|
654
|
-
*/
|
|
655
|
-
watch: RuntimeInstance<D, C, M>['watch'];
|
|
656
|
-
/**
|
|
657
|
-
* 小程序内部实例
|
|
658
|
-
*/
|
|
659
|
-
instance: SetupContextNativeInstance;
|
|
660
|
-
/**
|
|
661
|
-
* 通过小程序 `triggerEvent(eventName, detail?, options?)` 派发事件。
|
|
662
|
-
*
|
|
663
|
-
* 为兼容 Vue 3 的 `emit(event, ...args)`:
|
|
664
|
-
* - `emit(name)` -> `detail = undefined`
|
|
665
|
-
* - `emit(name, payload)` -> `detail = payload`
|
|
666
|
-
* - `emit(name, payload, options)`(当最后一个参数是事件选项)-> `detail = payload`
|
|
667
|
-
* - `emit(name, a, b, c)` -> `detail = [a, b, c]`
|
|
668
|
-
*/
|
|
669
|
-
emit: (event: string, ...args: any[]) => void;
|
|
670
|
-
/**
|
|
671
|
-
* Vue 3 对齐:expose 公共属性
|
|
672
|
-
*/
|
|
673
|
-
expose: (exposed: Record<string, any>) => void;
|
|
674
|
-
/**
|
|
675
|
-
* Vue 3 对齐:attrs(小程序场景为非 props 属性集合)
|
|
676
|
-
*/
|
|
677
|
-
attrs: Record<string, any>;
|
|
678
|
-
/**
|
|
679
|
-
* Vue 3 对齐:slots(小程序场景为只读空对象兜底,不提供可调用 slot 函数)
|
|
680
|
-
*/
|
|
681
|
-
slots: Record<string, any>;
|
|
682
|
-
}
|
|
683
|
-
//#endregion
|
|
684
|
-
//#region src/vue-types.d.ts
|
|
685
|
-
type Ref$1<T = any, S = T> = Ref<T, S>;
|
|
686
|
-
type ShallowRef$1<T = any, S = T> = ShallowRef<T, S>;
|
|
687
|
-
type AllowedComponentProps$1 = AllowedComponentProps;
|
|
688
|
-
type ComponentCustomProps$1 = ComponentCustomProps;
|
|
689
|
-
type ComponentOptionsMixin$1 = ComponentOptionsMixin;
|
|
690
|
-
type DefineComponent$1<PropsOrPropOptions = ComponentPropsOptions, RawBindings = Record<string, any>, D = Record<string, any>, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, PP = PublicProps, Props = (PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions), Defaults = (PropsOrPropOptions extends ComponentPropsOptions ? ExtractDefaultPropTypes<PropsOrPropOptions> : {}), S extends SlotsType = SlotsType> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PP, Props, Defaults, S>;
|
|
691
|
-
type NativeComponent<Props = Record<string, any>> = new (...args: any[]) => InstanceType<DefineComponent$1<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Props, {}>>;
|
|
692
|
-
type ObjectDirective$1<HostElement = any, Value = any, Modifiers extends string = string, Arg = any> = ObjectDirective<HostElement, Value, Modifiers, Arg>;
|
|
693
|
-
type PublicProps$1 = PublicProps;
|
|
694
|
-
type ShallowUnwrapRef$1<T> = ShallowUnwrapRef<T>;
|
|
695
|
-
type VNode$1<HostNode = any, HostElement = any, ExtraProps = Record<string, any>> = VNode<HostNode, HostElement, ExtraProps>;
|
|
696
|
-
type VNodeProps$1 = VNodeProps;
|
|
697
|
-
//#endregion
|
|
698
|
-
export { WatchSources as $, customRef as $t, ComputedDefinitions as A, EffectScope as At, watchSyncEffect as B, ComputedGetter as Bt, MiniProgramComponentBehaviorOptions as C, NativeTypedProperty as Cn, prelinkReactiveTree as Ct, MiniProgramPageLifetimes as D, MutationRecord as Dt, MiniProgramInstance as E, PropType as En, MutationOp as Et, ModelBindingOptions as F, getCurrentScope as Ft, WatchCallback as G, computed as Gt, MaybeUndefined as H, ComputedSetter as Ht, ModelBindingPayload as I, onScopeDispose as It, WatchMultiSources as J, CustomRefSource as Jt, WatchEffect as K, CustomRefFactory as Kt, watch as L, startBatch as Lt, ExtractMethods as M, effect as Mt, MethodDefinitions as N, effectScope as Nt, TriggerEventOptions as O, addMutationRecorder as Ot, ModelBinding as P, endBatch as Pt, WatchSourceValue as Q, ShallowRef$2 as Qt, watchEffect as R, stop as Rt, MiniProgramBehaviorIdentifier as S, NativeTypeHint as Sn, PrelinkReactiveTreeOptions as St, MiniProgramComponentRawOptions as T, PropOptions as Tn, MutationKind as Tt, MultiWatchSources as U, WritableComputedOptions as Ut, MapSources as V, ComputedRef as Vt, OnCleanup as W, WritableComputedRef as Wt, WatchScheduler as X, MaybeRefOrGetter as Xt, WatchOptions as Y, MaybeRef as Yt, WatchSource as Z, Ref$2 as Zt, RuntimeApp as _, InferNativeProps as _n, markRaw as _t, NativeComponent as a, RouterReLaunchOption as an, toRef as at, MiniProgramAdapter as b, NativePropType as bn, isShallowReactive as bt, ShallowUnwrapRef$1 as c, SetupContextRouter as cn, shallowRef as ct, SetupContext as d, WevuTypedRouterRouteMap as dn, isReadonly as dt, isRef as en, WatchStopHandle as et, SetupContextNativeInstance as f, ComponentPropsOptions as fn, readonly as ft, InternalRuntimeStateFields as g, InferNativePropType as gn, isReactive as gt, InternalRuntimeState as h, ExtractPublicPropTypes as hn, isRaw as ht, DefineComponent$1 as i, RouterNavigateToOption as in, ToRefs as it, ExtractComputed as j, batch as jt, ComponentPublicInstance as k, removeMutationRecorder as kt, VNode$1 as l, TypedRouterTabBarUrl as ln, triggerRef as lt, AppConfig as m, ExtractPropTypes as mn, getReactiveVersion as mt, ComponentCustomProps$1 as n, toValue as nn, setDeepWatchStrategy as nt, ObjectDirective$1 as o, RouterRedirectToOption as on, toRefs as ot, SetupFunction as p, ExtractDefaultPropTypes as pn, shallowReadonly as pt, WatchEffectOptions as q, CustomRefOptions as qt, ComponentOptionsMixin$1 as r, unref as rn, traverse as rt, PublicProps$1 as s, RouterSwitchTabOption as sn, isShallowRef as st, AllowedComponentProps$1 as t, ref as tn, getDeepWatchStrategy as tt, VNodeProps$1 as u, TypedRouterUrl as un, isProxy as ut, RuntimeInstance as v, InferPropType as vn, reactive as vt, MiniProgramComponentOptions as w, PropConstructor as wn, touchReactive as wt, MiniProgramAppOptions as x, NativePropsOptions as xn, shallowReactive as xt, WevuPlugin as y, InferProps as yn, toRaw as yt, watchPostEffect as z, nextTick as zt };
|