wevu 6.15.6 → 6.15.7

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,255 @@
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/miniprogramHostDefault.d.ts
4
+ declare namespace DefaultMiniProgramHostNamespace {
5
+ export import App = WechatMiniProgramHostNamespace.App;
6
+ export import Behavior = WechatMiniProgramHostNamespace.Behavior;
7
+ export import Component = WechatMiniProgramHostNamespace.Component;
8
+ export import Page = WechatMiniProgramHostNamespace.Page;
9
+ export import BoundingClientRectCallbackResult = WechatMiniProgramHostNamespace.BoundingClientRectCallbackResult;
10
+ export import ScrollOffsetCallbackResult = WechatMiniProgramHostNamespace.ScrollOffsetCallbackResult;
11
+ export import NodesRef = WechatMiniProgramHostNamespace.NodesRef;
12
+ export import SelectorQuery = WechatMiniProgramHostNamespace.SelectorQuery;
13
+ export import CreateIntersectionObserverOption = WechatMiniProgramHostNamespace.CreateIntersectionObserverOption;
14
+ export import IntersectionObserver = WechatMiniProgramHostNamespace.IntersectionObserver;
15
+ export import OnUnhandledRejectionListenerResult = WechatMiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
16
+ export import OnThemeChangeListenerResult = WechatMiniProgramHostNamespace.OnThemeChangeListenerResult;
17
+ export import OnMemoryWarningListenerResult = WechatMiniProgramHostNamespace.OnMemoryWarningListenerResult;
18
+ export import SwitchTabOption = WechatMiniProgramHostNamespace.SwitchTabOption;
19
+ export import ReLaunchOption = WechatMiniProgramHostNamespace.ReLaunchOption;
20
+ export import RedirectToOption = WechatMiniProgramHostNamespace.RedirectToOption;
21
+ export import NavigateToOption = WechatMiniProgramHostNamespace.NavigateToOption;
22
+ }
23
+ //#endregion
24
+ //#region src/runtime/types/miniprogramHostWechat.d.ts
25
+ declare namespace WechatMiniProgramHostNamespace {
26
+ export import App = WechatMiniprogram.App;
27
+ export import Behavior = WechatMiniprogram.Behavior;
28
+ export import Component = WechatMiniprogram.Component;
29
+ export import Page = WechatMiniprogram.Page;
30
+ export import BoundingClientRectCallbackResult = WechatMiniprogram.BoundingClientRectCallbackResult;
31
+ export import ScrollOffsetCallbackResult = WechatMiniprogram.ScrollOffsetCallbackResult;
32
+ export import NodesRef = WechatMiniprogram.NodesRef;
33
+ export import SelectorQuery = WechatMiniprogram.SelectorQuery;
34
+ export import CreateIntersectionObserverOption = WechatMiniprogram.CreateIntersectionObserverOption;
35
+ export import IntersectionObserver = WechatMiniprogram.IntersectionObserver;
36
+ export import OnUnhandledRejectionListenerResult = WechatMiniprogram.OnUnhandledRejectionListenerResult;
37
+ export import OnThemeChangeListenerResult = WechatMiniprogram.OnThemeChangeListenerResult;
38
+ export import OnMemoryWarningListenerResult = WechatMiniprogram.OnMemoryWarningListenerResult;
39
+ export import SwitchTabOption = WechatMiniprogram.SwitchTabOption;
40
+ export import ReLaunchOption = WechatMiniprogram.ReLaunchOption;
41
+ export import RedirectToOption = WechatMiniprogram.RedirectToOption;
42
+ export import NavigateToOption = WechatMiniprogram.NavigateToOption;
43
+ }
44
+ //#endregion
45
+ //#region src/runtime/types/miniprogramHostAlipay.d.ts
46
+ declare namespace AlipayMiniProgramHostNamespace {}
47
+ //#endregion
48
+ //#region src/runtime/types/miniprogramHostTt.d.ts
49
+ declare namespace DouyinMiniProgramHostNamespace {}
50
+ declare namespace TtMiniProgramHostNamespace {}
51
+ //#endregion
52
+ //#region src/runtime/types/miniprogramHostSources.d.ts
53
+ type MiniProgramPlatformHostSourceName = 'default' | 'wechat' | 'alipay' | 'douyin';
54
+ type MiniProgramRuntimeHostSourceName = 'wx' | 'my' | 'tt';
55
+ type MiniProgramHostSourceName = MiniProgramPlatformHostSourceName | MiniProgramRuntimeHostSourceName;
56
+ interface DefaultMiniProgramHostSourceContract {
57
+ BoundingClientRectCallbackResult: DefaultMiniProgramHostNamespace.BoundingClientRectCallbackResult;
58
+ ScrollOffsetCallbackResult: DefaultMiniProgramHostNamespace.ScrollOffsetCallbackResult;
59
+ NodesRef: DefaultMiniProgramHostNamespace.NodesRef;
60
+ SelectorQuery: DefaultMiniProgramHostNamespace.SelectorQuery;
61
+ CreateIntersectionObserverOption: DefaultMiniProgramHostNamespace.CreateIntersectionObserverOption;
62
+ IntersectionObserver: DefaultMiniProgramHostNamespace.IntersectionObserver;
63
+ OnUnhandledRejectionListenerResult: DefaultMiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
64
+ OnThemeChangeListenerResult: DefaultMiniProgramHostNamespace.OnThemeChangeListenerResult;
65
+ OnMemoryWarningListenerResult: DefaultMiniProgramHostNamespace.OnMemoryWarningListenerResult;
66
+ SwitchTabOption: DefaultMiniProgramHostNamespace.SwitchTabOption;
67
+ ReLaunchOption: DefaultMiniProgramHostNamespace.ReLaunchOption;
68
+ RedirectToOption: DefaultMiniProgramHostNamespace.RedirectToOption;
69
+ NavigateToOption: DefaultMiniProgramHostNamespace.NavigateToOption;
70
+ }
71
+ interface WechatMiniProgramHostSourceContract {
72
+ BoundingClientRectCallbackResult: WechatMiniProgramHostNamespace.BoundingClientRectCallbackResult;
73
+ ScrollOffsetCallbackResult: WechatMiniProgramHostNamespace.ScrollOffsetCallbackResult;
74
+ NodesRef: WechatMiniProgramHostNamespace.NodesRef;
75
+ SelectorQuery: WechatMiniProgramHostNamespace.SelectorQuery;
76
+ CreateIntersectionObserverOption: WechatMiniProgramHostNamespace.CreateIntersectionObserverOption;
77
+ IntersectionObserver: WechatMiniProgramHostNamespace.IntersectionObserver;
78
+ OnUnhandledRejectionListenerResult: WechatMiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
79
+ OnThemeChangeListenerResult: WechatMiniProgramHostNamespace.OnThemeChangeListenerResult;
80
+ OnMemoryWarningListenerResult: WechatMiniProgramHostNamespace.OnMemoryWarningListenerResult;
81
+ SwitchTabOption: WechatMiniProgramHostNamespace.SwitchTabOption;
82
+ ReLaunchOption: WechatMiniProgramHostNamespace.ReLaunchOption;
83
+ RedirectToOption: WechatMiniProgramHostNamespace.RedirectToOption;
84
+ NavigateToOption: WechatMiniProgramHostNamespace.NavigateToOption;
85
+ }
86
+ /**
87
+ * @description 支付宝宿主类型契约占位;后续接入稳定 typings 时在此扩展。
88
+ */
89
+ interface AlipayMiniProgramHostSourceContract extends Record<never, never> {}
90
+ /**
91
+ * @description 抖音宿主类型契约占位;后续接入稳定 typings 时在此扩展。
92
+ */
93
+ interface DouyinMiniProgramHostSourceContract extends Record<never, never> {}
94
+ /**
95
+ * @description `tt` 命名兼容入口,保持与抖音宿主语义主名一致。
96
+ */
97
+ interface TtMiniProgramHostSourceContract extends DouyinMiniProgramHostSourceContract {}
98
+ interface MiniProgramPlatformHostSourceRegistry {
99
+ default: DefaultMiniProgramHostSourceContract;
100
+ wechat: WechatMiniProgramHostSourceContract;
101
+ alipay: AlipayMiniProgramHostSourceContract;
102
+ douyin: DouyinMiniProgramHostSourceContract;
103
+ }
104
+ interface MiniProgramRuntimeHostSourceRegistry {
105
+ wx: WechatMiniProgramHostSourceContract;
106
+ my: AlipayMiniProgramHostSourceContract;
107
+ tt: TtMiniProgramHostSourceContract;
108
+ }
109
+ interface MiniProgramHostSourceRegistry extends MiniProgramPlatformHostSourceRegistry, MiniProgramRuntimeHostSourceRegistry {}
110
+ type MiniProgramPlatformHostNamespaceBySource<TSourceName extends MiniProgramPlatformHostSourceName = MiniProgramPlatformHostSourceName> = MiniProgramPlatformHostSourceRegistry[TSourceName];
111
+ type MiniProgramRuntimeHostNamespaceBySource<TSourceName extends MiniProgramRuntimeHostSourceName = MiniProgramRuntimeHostSourceName> = MiniProgramRuntimeHostSourceRegistry[TSourceName];
112
+ type MiniProgramHostNamespaceBySource<TSourceName extends MiniProgramHostSourceName = MiniProgramHostSourceName> = MiniProgramHostSourceRegistry[TSourceName];
113
+ //#endregion
114
+ //#region src/runtime/types/miniprogramHost.d.ts
115
+ declare namespace MiniProgramHostNamespace {
116
+ export import App = DefaultMiniProgramHostNamespace.App;
117
+ export import Behavior = DefaultMiniProgramHostNamespace.Behavior;
118
+ export import Component = DefaultMiniProgramHostNamespace.Component;
119
+ export import Page = DefaultMiniProgramHostNamespace.Page;
120
+ export import BoundingClientRectCallbackResult = DefaultMiniProgramHostNamespace.BoundingClientRectCallbackResult;
121
+ export import ScrollOffsetCallbackResult = DefaultMiniProgramHostNamespace.ScrollOffsetCallbackResult;
122
+ export import NodesRef = DefaultMiniProgramHostNamespace.NodesRef;
123
+ export import SelectorQuery = DefaultMiniProgramHostNamespace.SelectorQuery;
124
+ export import CreateIntersectionObserverOption = DefaultMiniProgramHostNamespace.CreateIntersectionObserverOption;
125
+ export import IntersectionObserver = DefaultMiniProgramHostNamespace.IntersectionObserver;
126
+ export import OnUnhandledRejectionListenerResult = DefaultMiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
127
+ export import OnThemeChangeListenerResult = DefaultMiniProgramHostNamespace.OnThemeChangeListenerResult;
128
+ export import OnMemoryWarningListenerResult = DefaultMiniProgramHostNamespace.OnMemoryWarningListenerResult;
129
+ export import SwitchTabOption = DefaultMiniProgramHostNamespace.SwitchTabOption;
130
+ export import ReLaunchOption = DefaultMiniProgramHostNamespace.ReLaunchOption;
131
+ export import RedirectToOption = DefaultMiniProgramHostNamespace.RedirectToOption;
132
+ export import NavigateToOption = DefaultMiniProgramHostNamespace.NavigateToOption;
133
+ }
134
+ type HostMiniProgramComponentBehaviorOptions = MiniProgramHostNamespace.Component.ComponentOptions;
135
+ type HostMiniProgramComponentTrivialOption = MiniProgramHostNamespace.Component.TrivialOption;
136
+ type HostMiniProgramBehaviorIdentifier = MiniProgramHostNamespace.Behavior.Identifier;
137
+ type HostMiniProgramLaunchOptions = MiniProgramHostNamespace.App.LaunchShowOption;
138
+ type HostMiniProgramPageNotFoundOptions = MiniProgramHostNamespace.App.PageNotFoundOption;
139
+ type HostMiniProgramUnhandledRejectionResult = MiniProgramHostNamespace.OnUnhandledRejectionListenerResult;
140
+ type HostMiniProgramThemeChangeResult = MiniProgramHostNamespace.OnThemeChangeListenerResult;
141
+ type HostMiniProgramMemoryWarningResult = MiniProgramHostNamespace.OnMemoryWarningListenerResult;
142
+ type HostMiniProgramPageScrollOption = MiniProgramHostNamespace.Page.IPageScrollOption;
143
+ type HostMiniProgramTabItemTapOption = MiniProgramHostNamespace.Page.ITabItemTapOption;
144
+ type HostMiniProgramPageResizeOption = MiniProgramHostNamespace.Page.IResizeOption;
145
+ type HostMiniProgramShareAppMessageOption = MiniProgramHostNamespace.Page.IShareAppMessageOption;
146
+ type HostMiniProgramAddToFavoritesOption = MiniProgramHostNamespace.Page.IAddToFavoritesOption;
147
+ type HostMiniProgramSaveExitState = MiniProgramHostNamespace.Page.ISaveExitState;
148
+ type HostMiniProgramRouter = MiniProgramHostNamespace.Component.Router;
149
+ type HostMiniProgramSwitchTabOption = MiniProgramHostNamespace.SwitchTabOption;
150
+ type HostMiniProgramReLaunchOption = MiniProgramHostNamespace.ReLaunchOption;
151
+ type HostMiniProgramRedirectToOption = MiniProgramHostNamespace.RedirectToOption;
152
+ type HostMiniProgramNavigateToOption = MiniProgramHostNamespace.NavigateToOption;
153
+ type HostMiniProgramPageLifetime = MiniProgramHostNamespace.Page.ILifetime;
154
+ type HostMiniProgramNodesRef = MiniProgramHostNamespace.NodesRef;
155
+ type HostMiniProgramNodesRefFields = Parameters<HostMiniProgramNodesRef['fields']>[0];
156
+ type HostMiniProgramBoundingClientRectResult = MiniProgramHostNamespace.BoundingClientRectCallbackResult;
157
+ type HostMiniProgramScrollOffsetResult = MiniProgramHostNamespace.ScrollOffsetCallbackResult;
158
+ type HostMiniProgramSelectorQuery = MiniProgramHostNamespace.SelectorQuery;
159
+ type HostMiniProgramIntersectionObserverOptions = MiniProgramHostNamespace.CreateIntersectionObserverOption;
160
+ type HostMiniProgramIntersectionObserver = MiniProgramHostNamespace.IntersectionObserver;
161
+ type HostMiniProgramComponentPropertyOption = MiniProgramHostNamespace.Component.PropertyOption;
162
+ type HostMiniProgramComponentMethodOption = MiniProgramHostNamespace.Component.MethodOption;
163
+ type HostMiniProgramComponentEmptyArray = MiniProgramHostNamespace.Component.IEmptyArray;
164
+ type HostMiniProgramComponentAllProperty = MiniProgramHostNamespace.Component.AllProperty;
165
+ type HostMiniProgramComponentAllFullProperty = MiniProgramHostNamespace.Component.AllFullProperty;
166
+ type HostMiniProgramComponentShortProperty = MiniProgramHostNamespace.Component.ShortProperty;
167
+ type HostMiniProgramComponentPropertyValue<TProperty extends HostMiniProgramComponentAllFullProperty> = MiniProgramHostNamespace.Component.PropertyToData<TProperty>;
168
+ type HostMiniProgramComponentInstance<D extends object, P extends HostMiniProgramComponentPropertyOption, M extends HostMiniProgramComponentMethodOption, B extends HostMiniProgramComponentEmptyArray = HostMiniProgramComponentEmptyArray> = MiniProgramHostNamespace.Component.Instance<D, P, M, B>;
169
+ type HostMiniProgramTriggerEventOptions = MiniProgramHostNamespace.Component.TriggerEventOption;
170
+ type HostMiniProgramAppOptions<T extends Record<string, any>> = MiniProgramHostNamespace.App.Options<T>;
171
+ type HostMiniProgramComponentTrivialInstance = MiniProgramHostNamespace.Component.TrivialInstance;
172
+ type HostMiniProgramPageTrivialInstance = MiniProgramHostNamespace.Page.TrivialInstance;
173
+ type HostMiniProgramAppTrivialInstance = MiniProgramHostNamespace.App.TrivialInstance;
174
+ //#endregion
175
+ //#region src/runtime/types/miniprogram.d.ts
176
+ interface MiniProgramAdapter {
177
+ setData?: (payload: Record<string, any>) => void | Promise<void>;
178
+ }
179
+ type MpComponentOptions = HostMiniProgramComponentTrivialOption;
180
+ type MiniProgramBehaviorIdentifier = HostMiniProgramBehaviorIdentifier | string;
181
+ type MiniProgramComponentPropertyValue<TProperty extends HostMiniProgramComponentAllFullProperty> = HostMiniProgramComponentPropertyValue<TProperty>;
182
+ type MiniProgramComponentInstance<D extends object, P extends HostMiniProgramComponentPropertyOption, M extends HostMiniProgramComponentMethodOption, B extends HostMiniProgramComponentEmptyArray = HostMiniProgramComponentEmptyArray> = HostMiniProgramComponentInstance<D, P, M, B>;
183
+ interface MiniProgramComponentOptions {
184
+ /**
185
+ * 类似于 mixins/traits 的组件间代码复用机制(behaviors)。
186
+ */
187
+ behaviors?: MiniProgramBehaviorIdentifier[];
188
+ /**
189
+ * 组件接受的外部样式类。
190
+ */
191
+ externalClasses?: MpComponentOptions['externalClasses'];
192
+ /**
193
+ * 组件间关系定义。
194
+ */
195
+ relations?: MpComponentOptions['relations'];
196
+ /**
197
+ * 组件数据字段监听器,用于监听 properties 和 data 的变化。
198
+ */
199
+ observers?: MpComponentOptions['observers'];
200
+ /**
201
+ * 组件生命周期声明对象:
202
+ * `created`/`attached`/`ready`/`moved`/`detached`/`error`。
203
+ *
204
+ * 注意:wevu 会在 `attached/ready/detached/moved/error` 阶段做桥接与包装。
205
+ * setup 默认在 `attached` 执行,可通过 `setupLifecycle = "created"` 切换回旧行为。
206
+ */
207
+ lifetimes?: MpComponentOptions['lifetimes'];
208
+ /**
209
+ * 组件所在页面的生命周期声明对象:`show`/`hide`/`resize`/`routeDone`。
210
+ */
211
+ pageLifetimes?: MpComponentOptions['pageLifetimes'];
212
+ /**
213
+ * 组件选项(multipleSlots/styleIsolation/pureDataPattern/virtualHost 等)。
214
+ */
215
+ options?: MpComponentOptions['options'];
216
+ /**
217
+ * 定义段过滤器,用于自定义组件扩展。
218
+ */
219
+ definitionFilter?: MpComponentOptions['definitionFilter'];
220
+ /**
221
+ * 组件自定义导出:当使用组件导出 behavior(例如微信中的 `wx://component-export`)时,
222
+ * 可用于指定组件被 selectComponent 调用时的返回值。
223
+ *
224
+ * wevu 默认会将 setup() 中通过 `expose()` 写入的内容作为 export() 返回值,
225
+ * 因此大多数情况下无需手动编写 export();若同时提供 export(),则会与 expose() 结果浅合并。
226
+ */
227
+ export?: MpComponentOptions['export'];
228
+ /**
229
+ * 原生 properties(与 wevu 的 props 不同)。
230
+ *
231
+ * - 推荐:使用 wevu 的 `props` 选项,让运行时规范化为小程序 `properties`。
232
+ * - 兼容:也可以直接传入小程序 `properties`。
233
+ */
234
+ properties?: MpComponentOptions['properties'];
235
+ /**
236
+ * 旧式生命周期(基础库 `2.2.3` 起推荐使用 `lifetimes` 字段)。
237
+ * 保留以增强类型提示与兼容性。
238
+ */
239
+ created?: MpComponentOptions['created'];
240
+ attached?: MpComponentOptions['attached'];
241
+ ready?: MpComponentOptions['ready'];
242
+ moved?: MpComponentOptions['moved'];
243
+ detached?: MpComponentOptions['detached'];
244
+ error?: MpComponentOptions['error'];
245
+ }
246
+ type MiniProgramAppOptions<T extends Record<string, any> = Record<string, any>> = HostMiniProgramAppOptions<T>;
247
+ type MiniProgramInstance = HostMiniProgramComponentTrivialInstance | HostMiniProgramPageTrivialInstance | HostMiniProgramAppTrivialInstance;
248
+ type MiniProgramPageLifetimes = Partial<HostMiniProgramPageLifetime>;
249
+ type MiniProgramComponentRawOptions = Omit<HostMiniProgramComponentTrivialOption, 'behaviors'> & {
250
+ behaviors?: MiniProgramBehaviorIdentifier[];
251
+ } & MiniProgramPageLifetimes & Record<string, any>;
252
+ //#endregion
3
253
  //#region src/runtime/types/props/propTypes.d.ts
4
254
  type PropMethod<T, TConstructor = any> = [T] extends [((...args: any) => any) | undefined] ? {
5
255
  new (): TConstructor;
@@ -17,12 +267,12 @@ type ComponentPropsOptions = Record<string, PropOptions<any> | PropType<any> | n
17
267
  interface NativeTypeHint<T = any> {
18
268
  readonly __wevuNativeType?: T;
19
269
  }
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>;
270
+ type NativePropsOptions = Record<string, HostMiniProgramComponentAllProperty | NativeTypeHint<any>>;
271
+ type NativePropType<T = any, C extends HostMiniProgramComponentShortProperty = StringConstructor> = C & NativeTypeHint<T>;
272
+ type NativeTypedProperty<T = any, P extends HostMiniProgramComponentAllProperty = HostMiniProgramComponentAllProperty> = P & NativeTypeHint<T>;
23
273
  interface PropOptions<T = any, D = T> {
24
274
  type?: PropType<T> | true | null;
25
- optionalTypes?: Array<WechatMiniprogram.Component.ShortProperty | PropConstructor<any>>;
275
+ optionalTypes?: Array<HostMiniProgramComponentShortProperty | PropConstructor<any>>;
26
276
  /**
27
277
  * 默认值(对齐 Vue 的 `default`;会被赋给小程序 property 的 `value`)
28
278
  */
@@ -98,28 +348,32 @@ type RouterUrl<Path extends string> = string extends Path ? string : AbsoluteRou
98
348
  type RouterPathUrl<Path extends string> = string extends Path ? string : AbsoluteRouterPath<Path>;
99
349
  type TypedRouterUrl = RouterUrl<ResolveTypedRouterEntries>;
100
350
  type TypedRouterTabBarUrl = RouterPathUrl<ResolveTypedRouterTabBarEntries>;
101
- type RouterSwitchTabOption = Omit<WechatMiniprogram.SwitchTabOption, 'url'> & {
351
+ type MiniProgramRouterSwitchTabOption = Omit<HostMiniProgramSwitchTabOption, 'url'> & {
102
352
  url: TypedRouterTabBarUrl;
103
353
  };
104
- type RouterReLaunchOption = Omit<WechatMiniprogram.ReLaunchOption, 'url'> & {
354
+ type RouterSwitchTabOption = MiniProgramRouterSwitchTabOption;
355
+ type MiniProgramRouterReLaunchOption = Omit<HostMiniProgramReLaunchOption, 'url'> & {
105
356
  url: TypedRouterUrl;
106
357
  };
107
- type RouterRedirectToOption = Omit<WechatMiniprogram.RedirectToOption, 'url'> & {
358
+ type RouterReLaunchOption = MiniProgramRouterReLaunchOption;
359
+ type MiniProgramRouterRedirectToOption = Omit<HostMiniProgramRedirectToOption, 'url'> & {
108
360
  url: TypedRouterUrl;
109
361
  };
110
- type RouterNavigateToOption = Omit<WechatMiniprogram.NavigateToOption, 'url'> & {
362
+ type RouterRedirectToOption = MiniProgramRouterRedirectToOption;
363
+ type MiniProgramRouterNavigateToOption = Omit<HostMiniProgramNavigateToOption, 'url'> & {
111
364
  url: TypedRouterUrl;
112
365
  };
366
+ type RouterNavigateToOption = MiniProgramRouterNavigateToOption;
113
367
  /**
114
368
  * setup 场景下推荐使用的 Router 类型。
115
369
  * 默认行为与原生 Router 一致;声明合并后可获得更精确的 `url` 类型提示。
116
370
  */
117
371
  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'];
372
+ switchTab: (option: MiniProgramRouterSwitchTabOption) => ReturnType<HostMiniProgramRouter['switchTab']>;
373
+ reLaunch: (option: MiniProgramRouterReLaunchOption) => ReturnType<HostMiniProgramRouter['reLaunch']>;
374
+ redirectTo: (option: MiniProgramRouterRedirectToOption) => ReturnType<HostMiniProgramRouter['redirectTo']>;
375
+ navigateTo: (option: MiniProgramRouterNavigateToOption) => ReturnType<HostMiniProgramRouter['navigateTo']>;
376
+ navigateBack: HostMiniProgramRouter['navigateBack'];
123
377
  }
124
378
  //#endregion
125
379
  //#region src/reactivity/ref.d.ts
@@ -471,84 +725,6 @@ interface ModelBinding<T = any> {
471
725
  model: <Event extends string = 'input', ValueProp extends string = 'value', Formatted = T>(options?: ModelBindingOptions<T, Event, ValueProp, Formatted>) => ModelBindingPayload<T, Event, ValueProp, Formatted>;
472
726
  }
473
727
  //#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
728
  //#region src/runtime/types/runtime.d.ts
553
729
  interface AppConfig {
554
730
  globalProperties: Record<string, any>;
@@ -597,20 +773,23 @@ interface InternalRuntimeStateFields {
597
773
  type InternalRuntimeState = InternalRuntimeStateFields & Partial<MiniProgramInstance>;
598
774
  //#endregion
599
775
  //#region src/runtime/types/props/setup.d.ts
776
+ type SetupContextSelectorQuery = HostMiniProgramSelectorQuery;
777
+ type SetupContextIntersectionObserverOptions = HostMiniProgramIntersectionObserverOptions;
778
+ type SetupContextIntersectionObserver = HostMiniProgramIntersectionObserver;
600
779
  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
780
  type SetupContextNativeInstance = InternalRuntimeState & {
602
781
  /**
603
782
  * 派发组件事件(页面/应用场景下不可用时会安全降级为 no-op)
604
783
  */
605
- triggerEvent: (eventName: string, detail?: any, options?: TriggerEventOptions) => void;
784
+ triggerEvent: (eventName: string, detail?: any, options?: HostMiniProgramTriggerEventOptions) => void;
606
785
  /**
607
786
  * 创建选择器查询对象(不可用时返回 undefined)
608
787
  */
609
- createSelectorQuery: () => WechatMiniprogram.SelectorQuery | undefined;
788
+ createSelectorQuery: () => SetupContextSelectorQuery | undefined;
610
789
  /**
611
790
  * 创建交叉观察器(不可用时返回 undefined)
612
791
  */
613
- createIntersectionObserver: (options?: WechatMiniprogram.CreateIntersectionObserverOption) => WechatMiniprogram.IntersectionObserver | undefined;
792
+ createIntersectionObserver: (options?: SetupContextIntersectionObserverOptions) => SetupContextIntersectionObserver | undefined;
614
793
  /**
615
794
  * 提交视图层更新
616
795
  */
@@ -697,4 +876,4 @@ type ShallowUnwrapRef$1<T> = ShallowUnwrapRef<T>;
697
876
  type VNode$1<HostNode = any, HostElement = any, ExtraProps = Record<string, any>> = VNode<HostNode, HostElement, ExtraProps>;
698
877
  type VNodeProps$1 = VNodeProps;
699
878
  //#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 };
879
+ export { shallowRef as $, HostMiniProgramNodesRefFields as $n, RouterNavigateToOption as $t, watchPostEffect as A, MiniProgramPageLifetimes as An, TtMiniProgramHostSourceContract as Ar, nextTick as At, WatchOptions as B, HostMiniProgramComponentInstance as Bn, MaybeRef as Bt, ExtractMethods as C, MiniProgramAppOptions as Cn, MiniProgramHostSourceRegistry as Cr, effect as Ct, ModelBindingPayload as D, MiniProgramComponentPropertyValue as Dn, MiniProgramRuntimeHostNamespaceBySource as Dr, onScopeDispose as Dt, ModelBindingOptions as E, MiniProgramComponentOptions as En, MiniProgramPlatformHostSourceRegistry 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, DefaultMiniProgramHostNamespace 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, DouyinMiniProgramHostNamespace as Mr, ComputedRef as Mt, MaybeUndefined as N, HostMiniProgramAppTrivialInstance as Nn, TtMiniProgramHostNamespace as Nr, ComputedSetter as Nt, watch as O, MiniProgramComponentRawOptions as On, MiniProgramRuntimeHostSourceName as Or, startBatch as Ot, MultiWatchSources as P, HostMiniProgramBehaviorIdentifier as Pn, AlipayMiniProgramHostNamespace 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, MiniProgramHostSourceName as Sr, batch as St, ModelBinding as T, MiniProgramComponentInstance as Tn, MiniProgramPlatformHostSourceName 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, MiniProgramHostNamespace as _r, MutationOp as _t, NativeComponent as a, TypedRouterUrl as an, HostMiniProgramReLaunchOption as ar, getReactiveVersion as at, ComponentPublicInstance as b, PropOptions as bn, DouyinMiniProgramHostSourceContract 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, WechatMiniProgramHostSourceContract as jr, ComputedGetter as jt, watchEffect as k, MiniProgramInstance as kn, MiniProgramRuntimeHostSourceRegistry 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, MiniProgramPlatformHostNamespaceBySource as wr, effectScope as wt, ComputedDefinitions as x, PropType as xn, MiniProgramHostNamespaceBySource as xr, EffectScope as xt, WevuPlugin as y, PropConstructor as yn, DefaultMiniProgramHostSourceContract as yr, addMutationRecorder as yt, WatchMultiSources as z, HostMiniProgramComponentEmptyArray as zn, CustomRefSource as zt };