wevu 6.15.6 → 6.15.8

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.
@@ -1,5 +1,247 @@
1
1
  import { AllowedComponentProps, Component, ComponentCustomProps, ComponentOptionsMixin, ComponentProvideOptions, ComputedOptions, DefineComponent, Directive, EmitsOptions, MethodOptions, ObjectDirective, PublicProps, Ref, ShallowRef, ShallowUnwrapRef, SlotsType, VNode, VNodeProps } from "vue";
2
2
 
3
+ //#region src/runtime/types/miniprogramHostSources.d.ts
4
+ declare namespace WechatMiniProgramHostNamespace {
5
+ export import App = WechatMiniprogram.App;
6
+ export import Behavior = WechatMiniprogram.Behavior;
7
+ export import Component = WechatMiniprogram.Component;
8
+ export import Page = WechatMiniprogram.Page;
9
+ export import BoundingClientRectCallbackResult = WechatMiniprogram.BoundingClientRectCallbackResult;
10
+ export import ScrollOffsetCallbackResult = WechatMiniprogram.ScrollOffsetCallbackResult;
11
+ export import NodesRef = WechatMiniprogram.NodesRef;
12
+ export import SelectorQuery = WechatMiniprogram.SelectorQuery;
13
+ export import CreateIntersectionObserverOption = WechatMiniprogram.CreateIntersectionObserverOption;
14
+ export import IntersectionObserver = WechatMiniprogram.IntersectionObserver;
15
+ export import OnUnhandledRejectionListenerResult = WechatMiniprogram.OnUnhandledRejectionListenerResult;
16
+ export import OnThemeChangeListenerResult = WechatMiniprogram.OnThemeChangeListenerResult;
17
+ export import OnMemoryWarningListenerResult = WechatMiniprogram.OnMemoryWarningListenerResult;
18
+ export import SwitchTabOption = WechatMiniprogram.SwitchTabOption;
19
+ export import ReLaunchOption = WechatMiniprogram.ReLaunchOption;
20
+ export import RedirectToOption = WechatMiniprogram.RedirectToOption;
21
+ export import NavigateToOption = WechatMiniprogram.NavigateToOption;
22
+ }
23
+ declare namespace AlipayMiniProgramHostNamespace {}
24
+ declare namespace DouyinMiniProgramHostNamespace {}
25
+ declare namespace TtMiniProgramHostNamespace {}
26
+ declare namespace DefaultMiniProgramHostNamespace {
27
+ export import App = WechatMiniProgramHostNamespace.App;
28
+ export import Behavior = WechatMiniProgramHostNamespace.Behavior;
29
+ export import Component = WechatMiniProgramHostNamespace.Component;
30
+ export import Page = WechatMiniProgramHostNamespace.Page;
31
+ export import BoundingClientRectCallbackResult = WechatMiniProgramHostNamespace.BoundingClientRectCallbackResult;
32
+ export import ScrollOffsetCallbackResult = WechatMiniProgramHostNamespace.ScrollOffsetCallbackResult;
33
+ export import NodesRef = WechatMiniProgramHostNamespace.NodesRef;
34
+ export import SelectorQuery = WechatMiniProgramHostNamespace.SelectorQuery;
35
+ export import CreateIntersectionObserverOption = WechatMiniProgramHostNamespace.CreateIntersectionObserverOption;
36
+ export import IntersectionObserver = WechatMiniProgramHostNamespace.IntersectionObserver;
37
+ export import OnUnhandledRejectionListenerResult = WechatMiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
38
+ export import OnThemeChangeListenerResult = WechatMiniProgramHostNamespace.OnThemeChangeListenerResult;
39
+ export import OnMemoryWarningListenerResult = WechatMiniProgramHostNamespace.OnMemoryWarningListenerResult;
40
+ export import SwitchTabOption = WechatMiniProgramHostNamespace.SwitchTabOption;
41
+ export import ReLaunchOption = WechatMiniProgramHostNamespace.ReLaunchOption;
42
+ export import RedirectToOption = WechatMiniProgramHostNamespace.RedirectToOption;
43
+ export import NavigateToOption = WechatMiniProgramHostNamespace.NavigateToOption;
44
+ }
45
+ declare namespace MiniProgramHostNamespace {
46
+ export import App = DefaultMiniProgramHostNamespace.App;
47
+ export import Behavior = DefaultMiniProgramHostNamespace.Behavior;
48
+ export import Component = DefaultMiniProgramHostNamespace.Component;
49
+ export import Page = DefaultMiniProgramHostNamespace.Page;
50
+ export import BoundingClientRectCallbackResult = DefaultMiniProgramHostNamespace.BoundingClientRectCallbackResult;
51
+ export import ScrollOffsetCallbackResult = DefaultMiniProgramHostNamespace.ScrollOffsetCallbackResult;
52
+ export import NodesRef = DefaultMiniProgramHostNamespace.NodesRef;
53
+ export import SelectorQuery = DefaultMiniProgramHostNamespace.SelectorQuery;
54
+ export import CreateIntersectionObserverOption = DefaultMiniProgramHostNamespace.CreateIntersectionObserverOption;
55
+ export import IntersectionObserver = DefaultMiniProgramHostNamespace.IntersectionObserver;
56
+ export import OnUnhandledRejectionListenerResult = DefaultMiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
57
+ export import OnThemeChangeListenerResult = DefaultMiniProgramHostNamespace.OnThemeChangeListenerResult;
58
+ export import OnMemoryWarningListenerResult = DefaultMiniProgramHostNamespace.OnMemoryWarningListenerResult;
59
+ export import SwitchTabOption = DefaultMiniProgramHostNamespace.SwitchTabOption;
60
+ export import ReLaunchOption = DefaultMiniProgramHostNamespace.ReLaunchOption;
61
+ export import RedirectToOption = DefaultMiniProgramHostNamespace.RedirectToOption;
62
+ export import NavigateToOption = DefaultMiniProgramHostNamespace.NavigateToOption;
63
+ }
64
+ type MiniProgramPlatformHostSourceName = 'default' | 'wechat' | 'alipay' | 'douyin';
65
+ type MiniProgramRuntimeHostSourceName = 'wx' | 'my' | 'tt';
66
+ type MiniProgramHostSourceName = MiniProgramPlatformHostSourceName | MiniProgramRuntimeHostSourceName;
67
+ interface DefaultMiniProgramHostSourceContract {
68
+ BoundingClientRectCallbackResult: DefaultMiniProgramHostNamespace.BoundingClientRectCallbackResult;
69
+ ScrollOffsetCallbackResult: DefaultMiniProgramHostNamespace.ScrollOffsetCallbackResult;
70
+ NodesRef: DefaultMiniProgramHostNamespace.NodesRef;
71
+ SelectorQuery: DefaultMiniProgramHostNamespace.SelectorQuery;
72
+ CreateIntersectionObserverOption: DefaultMiniProgramHostNamespace.CreateIntersectionObserverOption;
73
+ IntersectionObserver: DefaultMiniProgramHostNamespace.IntersectionObserver;
74
+ OnUnhandledRejectionListenerResult: DefaultMiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
75
+ OnThemeChangeListenerResult: DefaultMiniProgramHostNamespace.OnThemeChangeListenerResult;
76
+ OnMemoryWarningListenerResult: DefaultMiniProgramHostNamespace.OnMemoryWarningListenerResult;
77
+ SwitchTabOption: DefaultMiniProgramHostNamespace.SwitchTabOption;
78
+ ReLaunchOption: DefaultMiniProgramHostNamespace.ReLaunchOption;
79
+ RedirectToOption: DefaultMiniProgramHostNamespace.RedirectToOption;
80
+ NavigateToOption: DefaultMiniProgramHostNamespace.NavigateToOption;
81
+ }
82
+ interface WechatMiniProgramHostSourceContract {
83
+ BoundingClientRectCallbackResult: WechatMiniProgramHostNamespace.BoundingClientRectCallbackResult;
84
+ ScrollOffsetCallbackResult: WechatMiniProgramHostNamespace.ScrollOffsetCallbackResult;
85
+ NodesRef: WechatMiniProgramHostNamespace.NodesRef;
86
+ SelectorQuery: WechatMiniProgramHostNamespace.SelectorQuery;
87
+ CreateIntersectionObserverOption: WechatMiniProgramHostNamespace.CreateIntersectionObserverOption;
88
+ IntersectionObserver: WechatMiniProgramHostNamespace.IntersectionObserver;
89
+ OnUnhandledRejectionListenerResult: WechatMiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
90
+ OnThemeChangeListenerResult: WechatMiniProgramHostNamespace.OnThemeChangeListenerResult;
91
+ OnMemoryWarningListenerResult: WechatMiniProgramHostNamespace.OnMemoryWarningListenerResult;
92
+ SwitchTabOption: WechatMiniProgramHostNamespace.SwitchTabOption;
93
+ ReLaunchOption: WechatMiniProgramHostNamespace.ReLaunchOption;
94
+ RedirectToOption: WechatMiniProgramHostNamespace.RedirectToOption;
95
+ NavigateToOption: WechatMiniProgramHostNamespace.NavigateToOption;
96
+ }
97
+ /**
98
+ * @description 支付宝宿主类型契约占位;后续接入稳定 typings 时在此扩展。
99
+ */
100
+ interface AlipayMiniProgramHostSourceContract extends Record<never, never> {}
101
+ /**
102
+ * @description 抖音宿主类型契约占位;后续接入稳定 typings 时在此扩展。
103
+ */
104
+ interface DouyinMiniProgramHostSourceContract extends Record<never, never> {}
105
+ /**
106
+ * @description `tt` 命名兼容入口,保持与抖音宿主语义主名一致。
107
+ */
108
+ interface TtMiniProgramHostSourceContract extends DouyinMiniProgramHostSourceContract {}
109
+ interface MiniProgramPlatformHostSourceRegistry {
110
+ default: DefaultMiniProgramHostSourceContract;
111
+ wechat: WechatMiniProgramHostSourceContract;
112
+ alipay: AlipayMiniProgramHostSourceContract;
113
+ douyin: DouyinMiniProgramHostSourceContract;
114
+ }
115
+ interface MiniProgramRuntimeHostSourceRegistry {
116
+ wx: WechatMiniProgramHostSourceContract;
117
+ my: AlipayMiniProgramHostSourceContract;
118
+ tt: TtMiniProgramHostSourceContract;
119
+ }
120
+ interface MiniProgramHostSourceRegistry extends MiniProgramPlatformHostSourceRegistry, MiniProgramRuntimeHostSourceRegistry {}
121
+ type MiniProgramPlatformHostNamespaceBySource<TSourceName extends MiniProgramPlatformHostSourceName = MiniProgramPlatformHostSourceName> = MiniProgramPlatformHostSourceRegistry[TSourceName];
122
+ type MiniProgramRuntimeHostNamespaceBySource<TSourceName extends MiniProgramRuntimeHostSourceName = MiniProgramRuntimeHostSourceName> = MiniProgramRuntimeHostSourceRegistry[TSourceName];
123
+ type MiniProgramHostNamespaceBySource<TSourceName extends MiniProgramHostSourceName = MiniProgramHostSourceName> = MiniProgramHostSourceRegistry[TSourceName];
124
+ //#endregion
125
+ //#region src/runtime/types/miniprogramHost.d.ts
126
+ type HostMiniProgramComponentBehaviorOptions = MiniProgramHostNamespace.Component.ComponentOptions;
127
+ type HostMiniProgramComponentTrivialOption = MiniProgramHostNamespace.Component.TrivialOption;
128
+ type HostMiniProgramBehaviorIdentifier = MiniProgramHostNamespace.Behavior.Identifier;
129
+ type HostMiniProgramLaunchOptions = MiniProgramHostNamespace.App.LaunchShowOption;
130
+ type HostMiniProgramPageNotFoundOptions = MiniProgramHostNamespace.App.PageNotFoundOption;
131
+ type HostMiniProgramUnhandledRejectionResult = MiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
132
+ type HostMiniProgramThemeChangeResult = MiniProgramHostNamespace.OnThemeChangeListenerResult;
133
+ type HostMiniProgramMemoryWarningResult = MiniProgramHostNamespace.OnMemoryWarningListenerResult;
134
+ type HostMiniProgramPageScrollOption = MiniProgramHostNamespace.Page.IPageScrollOption;
135
+ type HostMiniProgramTabItemTapOption = MiniProgramHostNamespace.Page.ITabItemTapOption;
136
+ type HostMiniProgramPageResizeOption = MiniProgramHostNamespace.Page.IResizeOption;
137
+ type HostMiniProgramShareAppMessageOption = MiniProgramHostNamespace.Page.IShareAppMessageOption;
138
+ type HostMiniProgramAddToFavoritesOption = MiniProgramHostNamespace.Page.IAddToFavoritesOption;
139
+ type HostMiniProgramSaveExitState = MiniProgramHostNamespace.Page.ISaveExitState;
140
+ type HostMiniProgramRouter = MiniProgramHostNamespace.Component.Router;
141
+ type HostMiniProgramSwitchTabOption = MiniProgramHostNamespace.SwitchTabOption;
142
+ type HostMiniProgramReLaunchOption = MiniProgramHostNamespace.ReLaunchOption;
143
+ type HostMiniProgramRedirectToOption = MiniProgramHostNamespace.RedirectToOption;
144
+ type HostMiniProgramNavigateToOption = MiniProgramHostNamespace.NavigateToOption;
145
+ type HostMiniProgramPageLifetime = MiniProgramHostNamespace.Page.ILifetime;
146
+ type HostMiniProgramNodesRef = MiniProgramHostNamespace.NodesRef;
147
+ type HostMiniProgramNodesRefFields = Parameters<HostMiniProgramNodesRef['fields']>[0];
148
+ type HostMiniProgramBoundingClientRectResult = MiniProgramHostNamespace.BoundingClientRectCallbackResult;
149
+ type HostMiniProgramScrollOffsetResult = MiniProgramHostNamespace.ScrollOffsetCallbackResult;
150
+ type HostMiniProgramSelectorQuery = MiniProgramHostNamespace.SelectorQuery;
151
+ type HostMiniProgramIntersectionObserverOptions = MiniProgramHostNamespace.CreateIntersectionObserverOption;
152
+ type HostMiniProgramIntersectionObserver = MiniProgramHostNamespace.IntersectionObserver;
153
+ type HostMiniProgramComponentPropertyOption = MiniProgramHostNamespace.Component.PropertyOption;
154
+ type HostMiniProgramComponentMethodOption = MiniProgramHostNamespace.Component.MethodOption;
155
+ type HostMiniProgramComponentEmptyArray = MiniProgramHostNamespace.Component.IEmptyArray;
156
+ type HostMiniProgramComponentAllProperty = MiniProgramHostNamespace.Component.AllProperty;
157
+ type HostMiniProgramComponentAllFullProperty = MiniProgramHostNamespace.Component.AllFullProperty;
158
+ type HostMiniProgramComponentShortProperty = MiniProgramHostNamespace.Component.ShortProperty;
159
+ type HostMiniProgramComponentPropertyValue<TProperty extends HostMiniProgramComponentAllFullProperty> = MiniProgramHostNamespace.Component.PropertyToData<TProperty>;
160
+ type HostMiniProgramComponentInstance<D extends object, P extends HostMiniProgramComponentPropertyOption, M extends HostMiniProgramComponentMethodOption, B extends HostMiniProgramComponentEmptyArray = HostMiniProgramComponentEmptyArray> = MiniProgramHostNamespace.Component.Instance<D, P, M, B>;
161
+ type HostMiniProgramTriggerEventOptions = MiniProgramHostNamespace.Component.TriggerEventOption;
162
+ type HostMiniProgramAppOptions<T extends Record<string, any>> = MiniProgramHostNamespace.App.Options<T>;
163
+ type HostMiniProgramComponentTrivialInstance = MiniProgramHostNamespace.Component.TrivialInstance;
164
+ type HostMiniProgramPageTrivialInstance = MiniProgramHostNamespace.Page.TrivialInstance;
165
+ type HostMiniProgramAppTrivialInstance = MiniProgramHostNamespace.App.TrivialInstance;
166
+ //#endregion
167
+ //#region src/runtime/types/miniprogram.d.ts
168
+ interface MiniProgramAdapter {
169
+ setData?: (payload: Record<string, any>) => void | Promise<void>;
170
+ }
171
+ type MpComponentOptions = HostMiniProgramComponentTrivialOption;
172
+ type MiniProgramBehaviorIdentifier = HostMiniProgramBehaviorIdentifier | string;
173
+ type MiniProgramComponentPropertyValue<TProperty extends HostMiniProgramComponentAllFullProperty> = HostMiniProgramComponentPropertyValue<TProperty>;
174
+ type MiniProgramComponentInstance<D extends object, P extends HostMiniProgramComponentPropertyOption, M extends HostMiniProgramComponentMethodOption, B extends HostMiniProgramComponentEmptyArray = HostMiniProgramComponentEmptyArray> = HostMiniProgramComponentInstance<D, P, M, B>;
175
+ interface MiniProgramComponentOptions {
176
+ /**
177
+ * 类似于 mixins/traits 的组件间代码复用机制(behaviors)。
178
+ */
179
+ behaviors?: MiniProgramBehaviorIdentifier[];
180
+ /**
181
+ * 组件接受的外部样式类。
182
+ */
183
+ externalClasses?: MpComponentOptions['externalClasses'];
184
+ /**
185
+ * 组件间关系定义。
186
+ */
187
+ relations?: MpComponentOptions['relations'];
188
+ /**
189
+ * 组件数据字段监听器,用于监听 properties 和 data 的变化。
190
+ */
191
+ observers?: MpComponentOptions['observers'];
192
+ /**
193
+ * 组件生命周期声明对象:
194
+ * `created`/`attached`/`ready`/`moved`/`detached`/`error`。
195
+ *
196
+ * 注意:wevu 会在 `attached/ready/detached/moved/error` 阶段做桥接与包装。
197
+ * setup 默认在 `attached` 执行,可通过 `setupLifecycle = "created"` 切换回旧行为。
198
+ */
199
+ lifetimes?: MpComponentOptions['lifetimes'];
200
+ /**
201
+ * 组件所在页面的生命周期声明对象:`show`/`hide`/`resize`/`routeDone`。
202
+ */
203
+ pageLifetimes?: MpComponentOptions['pageLifetimes'];
204
+ /**
205
+ * 组件选项(multipleSlots/styleIsolation/pureDataPattern/virtualHost 等)。
206
+ */
207
+ options?: MpComponentOptions['options'];
208
+ /**
209
+ * 定义段过滤器,用于自定义组件扩展。
210
+ */
211
+ definitionFilter?: MpComponentOptions['definitionFilter'];
212
+ /**
213
+ * 组件自定义导出:当使用组件导出 behavior(例如微信中的 `wx://component-export`)时,
214
+ * 可用于指定组件被 selectComponent 调用时的返回值。
215
+ *
216
+ * wevu 默认会将 setup() 中通过 `expose()` 写入的内容作为 export() 返回值,
217
+ * 因此大多数情况下无需手动编写 export();若同时提供 export(),则会与 expose() 结果浅合并。
218
+ */
219
+ export?: MpComponentOptions['export'];
220
+ /**
221
+ * 原生 properties(与 wevu 的 props 不同)。
222
+ *
223
+ * - 推荐:使用 wevu 的 `props` 选项,让运行时规范化为小程序 `properties`。
224
+ * - 兼容:也可以直接传入小程序 `properties`。
225
+ */
226
+ properties?: MpComponentOptions['properties'];
227
+ /**
228
+ * 旧式生命周期(基础库 `2.2.3` 起推荐使用 `lifetimes` 字段)。
229
+ * 保留以增强类型提示与兼容性。
230
+ */
231
+ created?: MpComponentOptions['created'];
232
+ attached?: MpComponentOptions['attached'];
233
+ ready?: MpComponentOptions['ready'];
234
+ moved?: MpComponentOptions['moved'];
235
+ detached?: MpComponentOptions['detached'];
236
+ error?: MpComponentOptions['error'];
237
+ }
238
+ type MiniProgramAppOptions<T extends Record<string, any> = Record<string, any>> = HostMiniProgramAppOptions<T>;
239
+ type MiniProgramInstance = HostMiniProgramComponentTrivialInstance | HostMiniProgramPageTrivialInstance | HostMiniProgramAppTrivialInstance;
240
+ type MiniProgramPageLifetimes = Partial<HostMiniProgramPageLifetime>;
241
+ type MiniProgramComponentRawOptions = Omit<HostMiniProgramComponentTrivialOption, 'behaviors'> & {
242
+ behaviors?: MiniProgramBehaviorIdentifier[];
243
+ } & MiniProgramPageLifetimes & Record<string, any>;
244
+ //#endregion
3
245
  //#region src/runtime/types/props/propTypes.d.ts
4
246
  type PropMethod<T, TConstructor = any> = [T] extends [((...args: any) => any) | undefined] ? {
5
247
  new (): TConstructor;
@@ -17,12 +259,12 @@ type ComponentPropsOptions = Record<string, PropOptions<any> | PropType<any> | n
17
259
  interface NativeTypeHint<T = any> {
18
260
  readonly __wevuNativeType?: T;
19
261
  }
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>;
262
+ type NativePropsOptions = Record<string, HostMiniProgramComponentAllProperty | NativeTypeHint<any>>;
263
+ type NativePropType<T = any, C extends HostMiniProgramComponentShortProperty = StringConstructor> = C & NativeTypeHint<T>;
264
+ type NativeTypedProperty<T = any, P extends HostMiniProgramComponentAllProperty = HostMiniProgramComponentAllProperty> = P & NativeTypeHint<T>;
23
265
  interface PropOptions<T = any, D = T> {
24
266
  type?: PropType<T> | true | null;
25
- optionalTypes?: Array<WechatMiniprogram.Component.ShortProperty | PropConstructor<any>>;
267
+ optionalTypes?: Array<HostMiniProgramComponentShortProperty | PropConstructor<any>>;
26
268
  /**
27
269
  * 默认值(对齐 Vue 的 `default`;会被赋给小程序 property 的 `value`)
28
270
  */
@@ -98,28 +340,32 @@ type RouterUrl<Path extends string> = string extends Path ? string : AbsoluteRou
98
340
  type RouterPathUrl<Path extends string> = string extends Path ? string : AbsoluteRouterPath<Path>;
99
341
  type TypedRouterUrl = RouterUrl<ResolveTypedRouterEntries>;
100
342
  type TypedRouterTabBarUrl = RouterPathUrl<ResolveTypedRouterTabBarEntries>;
101
- type RouterSwitchTabOption = Omit<WechatMiniprogram.SwitchTabOption, 'url'> & {
343
+ type MiniProgramRouterSwitchTabOption = Omit<HostMiniProgramSwitchTabOption, 'url'> & {
102
344
  url: TypedRouterTabBarUrl;
103
345
  };
104
- type RouterReLaunchOption = Omit<WechatMiniprogram.ReLaunchOption, 'url'> & {
346
+ type RouterSwitchTabOption = MiniProgramRouterSwitchTabOption;
347
+ type MiniProgramRouterReLaunchOption = Omit<HostMiniProgramReLaunchOption, 'url'> & {
105
348
  url: TypedRouterUrl;
106
349
  };
107
- type RouterRedirectToOption = Omit<WechatMiniprogram.RedirectToOption, 'url'> & {
350
+ type RouterReLaunchOption = MiniProgramRouterReLaunchOption;
351
+ type MiniProgramRouterRedirectToOption = Omit<HostMiniProgramRedirectToOption, 'url'> & {
108
352
  url: TypedRouterUrl;
109
353
  };
110
- type RouterNavigateToOption = Omit<WechatMiniprogram.NavigateToOption, 'url'> & {
354
+ type RouterRedirectToOption = MiniProgramRouterRedirectToOption;
355
+ type MiniProgramRouterNavigateToOption = Omit<HostMiniProgramNavigateToOption, 'url'> & {
111
356
  url: TypedRouterUrl;
112
357
  };
358
+ type RouterNavigateToOption = MiniProgramRouterNavigateToOption;
113
359
  /**
114
360
  * setup 场景下推荐使用的 Router 类型。
115
361
  * 默认行为与原生 Router 一致;声明合并后可获得更精确的 `url` 类型提示。
116
362
  */
117
363
  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'];
364
+ switchTab: (option: MiniProgramRouterSwitchTabOption) => ReturnType<HostMiniProgramRouter['switchTab']>;
365
+ reLaunch: (option: MiniProgramRouterReLaunchOption) => ReturnType<HostMiniProgramRouter['reLaunch']>;
366
+ redirectTo: (option: MiniProgramRouterRedirectToOption) => ReturnType<HostMiniProgramRouter['redirectTo']>;
367
+ navigateTo: (option: MiniProgramRouterNavigateToOption) => ReturnType<HostMiniProgramRouter['navigateTo']>;
368
+ navigateBack: HostMiniProgramRouter['navigateBack'];
123
369
  }
124
370
  //#endregion
125
371
  //#region src/reactivity/ref.d.ts
@@ -471,84 +717,6 @@ interface ModelBinding<T = any> {
471
717
  model: <Event extends string = 'input', ValueProp extends string = 'value', Formatted = T>(options?: ModelBindingOptions<T, Event, ValueProp, Formatted>) => ModelBindingPayload<T, Event, ValueProp, Formatted>;
472
718
  }
473
719
  //#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
720
  //#region src/runtime/types/runtime.d.ts
553
721
  interface AppConfig {
554
722
  globalProperties: Record<string, any>;
@@ -597,20 +765,23 @@ interface InternalRuntimeStateFields {
597
765
  type InternalRuntimeState = InternalRuntimeStateFields & Partial<MiniProgramInstance>;
598
766
  //#endregion
599
767
  //#region src/runtime/types/props/setup.d.ts
768
+ type SetupContextSelectorQuery = HostMiniProgramSelectorQuery;
769
+ type SetupContextIntersectionObserverOptions = HostMiniProgramIntersectionObserverOptions;
770
+ type SetupContextIntersectionObserver = HostMiniProgramIntersectionObserver;
600
771
  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;
601
772
  type SetupContextNativeInstance = InternalRuntimeState & {
602
773
  /**
603
774
  * 派发组件事件(页面/应用场景下不可用时会安全降级为 no-op)
604
775
  */
605
- triggerEvent: (eventName: string, detail?: any, options?: TriggerEventOptions) => void;
776
+ triggerEvent: (eventName: string, detail?: any, options?: HostMiniProgramTriggerEventOptions) => void;
606
777
  /**
607
778
  * 创建选择器查询对象(不可用时返回 undefined)
608
779
  */
609
- createSelectorQuery: () => WechatMiniprogram.SelectorQuery | undefined;
780
+ createSelectorQuery: () => SetupContextSelectorQuery | undefined;
610
781
  /**
611
782
  * 创建交叉观察器(不可用时返回 undefined)
612
783
  */
613
- createIntersectionObserver: (options?: WechatMiniprogram.CreateIntersectionObserverOption) => WechatMiniprogram.IntersectionObserver | undefined;
784
+ createIntersectionObserver: (options?: SetupContextIntersectionObserverOptions) => SetupContextIntersectionObserver | undefined;
614
785
  /**
615
786
  * 提交视图层更新
616
787
  */
@@ -697,4 +868,4 @@ type ShallowUnwrapRef$1<T> = ShallowUnwrapRef<T>;
697
868
  type VNode$1<HostNode = any, HostElement = any, ExtraProps = Record<string, any>> = VNode<HostNode, HostElement, ExtraProps>;
698
869
  type VNodeProps$1 = VNodeProps;
699
870
  //#endregion
700
- 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 };
871
+ export { shallowRef as $, HostMiniProgramNodesRefFields as $n, RouterNavigateToOption as $t, watchPostEffect as A, MiniProgramPageLifetimes as An, MiniProgramRuntimeHostNamespaceBySource as Ar, nextTick as At, WatchOptions as B, HostMiniProgramComponentInstance as Bn, MaybeRef as Bt, ExtractMethods as C, MiniProgramAppOptions as Cn, MiniProgramHostNamespace as Cr, effect as Ct, ModelBindingPayload as D, MiniProgramComponentPropertyValue as Dn, MiniProgramPlatformHostNamespaceBySource as Dr, onScopeDispose as Dt, ModelBindingOptions as E, MiniProgramComponentOptions as En, MiniProgramHostSourceRegistry as Er, getCurrentScope as Et, OnCleanup as F, HostMiniProgramBoundingClientRectResult as Fn, WechatMiniProgramHostNamespace as Fr, WritableComputedRef as Ft, WatchStopHandle as G, HostMiniProgramComponentTrivialInstance as Gn, isRef as Gt, WatchSource as H, HostMiniProgramComponentPropertyOption as Hn, Ref$2 as Ht, WatchCallback as I, HostMiniProgramComponentAllFullProperty as In, WechatMiniProgramHostSourceContract as Ir, computed as It, traverse as J, HostMiniProgramIntersectionObserverOptions as Jn, unref as Jt, getDeepWatchStrategy as K, HostMiniProgramComponentTrivialOption as Kn, ref as Kt, WatchEffect as L, HostMiniProgramComponentAllProperty as Ln, CustomRefFactory as Lt, MapSources as M, HostMiniProgramAppOptions as Mn, MiniProgramRuntimeHostSourceRegistry as Mr, ComputedRef as Mt, MaybeUndefined as N, HostMiniProgramAppTrivialInstance as Nn, TtMiniProgramHostNamespace as Nr, ComputedSetter as Nt, watch as O, MiniProgramComponentRawOptions as On, MiniProgramPlatformHostSourceName as Or, startBatch as Ot, MultiWatchSources as P, HostMiniProgramBehaviorIdentifier as Pn, TtMiniProgramHostSourceContract as Pr, WritableComputedOptions as Pt, isShallowRef as Q, HostMiniProgramNodesRef as Qn, MiniProgramRouterSwitchTabOption as Qt, WatchEffectOptions as R, HostMiniProgramComponentBehaviorOptions as Rn, CustomRefOptions as Rt, ExtractComputed as S, MiniProgramAdapter as Sn, DouyinMiniProgramHostSourceContract as Sr, batch as St, ModelBinding as T, MiniProgramComponentInstance as Tn, MiniProgramHostSourceName as Tr, endBatch as Tt, WatchSourceValue as U, HostMiniProgramComponentPropertyValue as Un, ShallowRef$2 as Ut, WatchScheduler as V, HostMiniProgramComponentMethodOption as Vn, MaybeRefOrGetter as Vt, WatchSources as W, HostMiniProgramComponentShortProperty as Wn, customRef as Wt, toRef as X, HostMiniProgramMemoryWarningResult as Xn, MiniProgramRouterReLaunchOption as Xt, ToRefs as Y, HostMiniProgramLaunchOptions as Yn, MiniProgramRouterNavigateToOption as Yt, toRefs as Z, HostMiniProgramNavigateToOption as Zn, MiniProgramRouterRedirectToOption as Zt, RuntimeApp as _, NativeTypeHint as _n, AlipayMiniProgramHostNamespace as _r, MutationOp as _t, NativeComponent as a, TypedRouterUrl as an, HostMiniProgramReLaunchOption as ar, getReactiveVersion as at, ComponentPublicInstance as b, PropOptions as bn, DefaultMiniProgramHostSourceContract as br, removeMutationRecorder as bt, ShallowUnwrapRef$1 as c, ExtractDefaultPropTypes as cn, HostMiniProgramSaveExitState as cr, markRaw as ct, SetupContext as d, InferNativePropType as dn, HostMiniProgramShareAppMessageOption as dr, isShallowReactive as dt, RouterReLaunchOption as en, HostMiniProgramPageLifetime as er, triggerRef as et, SetupContextNativeInstance as f, InferNativeProps as fn, HostMiniProgramSwitchTabOption as fr, shallowReactive as ft, InternalRuntimeStateFields as g, NativePropsOptions as gn, HostMiniProgramUnhandledRejectionResult as gr, MutationKind as gt, InternalRuntimeState as h, NativePropType as hn, HostMiniProgramTriggerEventOptions as hr, touchReactive as ht, DefineComponent$1 as i, TypedRouterTabBarUrl as in, HostMiniProgramPageTrivialInstance as ir, shallowReadonly as it, watchSyncEffect as j, HostMiniProgramAddToFavoritesOption as jn, MiniProgramRuntimeHostSourceName as jr, ComputedGetter as jt, watchEffect as k, MiniProgramInstance as kn, MiniProgramPlatformHostSourceRegistry as kr, stop as kt, VNode$1 as l, ExtractPropTypes as ln, HostMiniProgramScrollOffsetResult as lr, reactive as lt, AppConfig as m, InferProps as mn, HostMiniProgramThemeChangeResult as mr, prelinkReactiveTree as mt, ComponentCustomProps$1 as n, RouterSwitchTabOption as nn, HostMiniProgramPageResizeOption as nr, isReadonly as nt, ObjectDirective$1 as o, WevuTypedRouterRouteMap as on, HostMiniProgramRedirectToOption as or, isRaw as ot, SetupFunction as p, InferPropType as pn, HostMiniProgramTabItemTapOption as pr, PrelinkReactiveTreeOptions as pt, setDeepWatchStrategy as q, HostMiniProgramIntersectionObserver as qn, toValue as qt, ComponentOptionsMixin$1 as r, SetupContextRouter as rn, HostMiniProgramPageScrollOption as rr, readonly as rt, PublicProps$1 as s, ComponentPropsOptions as sn, HostMiniProgramRouter as sr, isReactive as st, AllowedComponentProps$1 as t, RouterRedirectToOption as tn, HostMiniProgramPageNotFoundOptions as tr, isProxy as tt, VNodeProps$1 as u, ExtractPublicPropTypes as un, HostMiniProgramSelectorQuery as ur, toRaw as ut, RuntimeInstance as v, NativeTypedProperty as vn, AlipayMiniProgramHostSourceContract as vr, MutationRecord as vt, MethodDefinitions as w, MiniProgramBehaviorIdentifier as wn, MiniProgramHostNamespaceBySource as wr, effectScope as wt, ComputedDefinitions as x, PropType as xn, DouyinMiniProgramHostNamespace as xr, EffectScope as xt, WevuPlugin as y, PropConstructor as yn, DefaultMiniProgramHostNamespace as yr, addMutationRecorder as yt, WatchMultiSources as z, HostMiniProgramComponentEmptyArray as zn, CustomRefSource as zt };