wevu 7.0.2 → 7.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/dev/package.mjs +1 -1
  2. package/dist/dev/router/initialNavigation.mjs +6 -3
  3. package/dist/dev/router/initialNavigation.mjs.map +1 -1
  4. package/dist/dev/router/routeSync.mjs +8 -2
  5. package/dist/dev/router/routeSync.mjs.map +1 -1
  6. package/dist/dev/router/useRoute.mjs +14 -7
  7. package/dist/dev/router/useRoute.mjs.map +1 -1
  8. package/dist/dev/runtime/define/scopedSlotOptions.mjs +3 -1
  9. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
  10. package/dist/dev/runtime/emit.mjs +1 -1
  11. package/dist/dev/runtime/emit.mjs.map +1 -1
  12. package/dist/dev/runtime/jsxIsland.mjs +5 -1
  13. package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
  14. package/dist/dev/runtime/register/component/options.mjs +3 -2
  15. package/dist/dev/runtime/register/component/options.mjs.map +1 -1
  16. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +15 -1
  17. package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
  18. package/dist/fetch.d.mts +4 -4
  19. package/dist/jsx-runtime.d.mts +4 -5
  20. package/dist/macros/shared.d.mts +14 -15
  21. package/dist/macros.d.mts +22 -22
  22. package/dist/package.mjs +1 -1
  23. package/dist/reactivity/computed.d.mts +8 -9
  24. package/dist/reactivity/core.d.mts +14 -15
  25. package/dist/reactivity/reactive/mutation.d.mts +6 -7
  26. package/dist/reactivity/reactive/patch.d.mts +4 -5
  27. package/dist/reactivity/reactive/shallow.d.mts +3 -4
  28. package/dist/reactivity/reactive/shared.d.mts +2 -3
  29. package/dist/reactivity/reactive.d.mts +6 -6
  30. package/dist/reactivity/readonly.d.mts +7 -8
  31. package/dist/reactivity/ref.d.mts +14 -15
  32. package/dist/reactivity/shallowRef.d.mts +5 -6
  33. package/dist/reactivity/toRefs.d.mts +5 -6
  34. package/dist/reactivity/traverse.d.mts +2 -3
  35. package/dist/reactivity/watch/types.d.mts +18 -19
  36. package/dist/reactivity/watch.d.mts +8 -8
  37. package/dist/router/createRouter.d.mts +2 -3
  38. package/dist/router/initialNavigation.mjs +1 -1
  39. package/dist/router/navigationCore.d.mts +3 -4
  40. package/dist/router/resolve.d.mts +2 -3
  41. package/dist/router/routeSync.mjs +1 -1
  42. package/dist/router/types.d.mts +38 -39
  43. package/dist/router/useRoute.d.mts +5 -6
  44. package/dist/router/useRoute.mjs +1 -1
  45. package/dist/router/useRouter.d.mts +2 -3
  46. package/dist/routerInternal/query.d.mts +3 -4
  47. package/dist/routerInternal/types.d.mts +2 -3
  48. package/dist/runtime/app/pending.d.mts +3 -4
  49. package/dist/runtime/app.d.mts +2 -3
  50. package/dist/runtime/css.d.mts +3 -4
  51. package/dist/runtime/defaults.d.mts +5 -6
  52. package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
  53. package/dist/runtime/define.d.mts +15 -16
  54. package/dist/runtime/disposables.d.mts +6 -7
  55. package/dist/runtime/elementIntersectionObserver.d.mts +5 -6
  56. package/dist/runtime/emit.mjs +1 -1
  57. package/dist/runtime/hooks/base.d.mts +7 -8
  58. package/dist/runtime/hooks/register.d.mts +26 -27
  59. package/dist/runtime/hooks/vue.d.mts +12 -13
  60. package/dist/runtime/intersectionObserver.d.mts +4 -5
  61. package/dist/runtime/jsxIsland.d.mts +19 -20
  62. package/dist/runtime/jsxIsland.mjs +1 -1
  63. package/dist/runtime/layoutBridge.d.mts +12 -13
  64. package/dist/runtime/noSetData.d.mts +3 -4
  65. package/dist/runtime/pageEnvironment.d.mts +9 -10
  66. package/dist/runtime/pageLayout.d.mts +9 -10
  67. package/dist/runtime/pageScroll.d.mts +4 -5
  68. package/dist/runtime/provide.d.mts +7 -7
  69. package/dist/runtime/provideStore.d.mts +2 -3
  70. package/dist/runtime/pullDownRefresh.d.mts +4 -5
  71. package/dist/runtime/register/app.d.mts +2 -3
  72. package/dist/runtime/register/component/options.mjs +1 -1
  73. package/dist/runtime/register/component.d.mts +2 -3
  74. package/dist/runtime/register/inline.d.mts +3 -4
  75. package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -1
  76. package/dist/runtime/register/runtimeInstance.d.mts +4 -5
  77. package/dist/runtime/register/setup.d.mts +2 -3
  78. package/dist/runtime/register/watch.d.mts +3 -4
  79. package/dist/runtime/selectorQuery.d.mts +15 -16
  80. package/dist/runtime/template.d.mts +4 -5
  81. package/dist/runtime/templateRefTypes.d.mts +2 -1
  82. package/dist/runtime/templateRefs.d.mts +2 -3
  83. package/dist/runtime/types/core.d.mts +9 -10
  84. package/dist/runtime/types/miniprogram.d.mts +10 -10
  85. package/dist/runtime/types/miniprogramHost.d.mts +41 -41
  86. package/dist/runtime/types/miniprogramHostSources.d.mts +21 -22
  87. package/dist/runtime/types/options.d.mts +6 -7
  88. package/dist/runtime/types/props/propTypes.d.mts +16 -17
  89. package/dist/runtime/types/props/router.d.mts +13 -14
  90. package/dist/runtime/types/props/setup.d.mts +7 -8
  91. package/dist/runtime/types/runtime.d.mts +7 -8
  92. package/dist/runtime/types/setData.d.mts +3 -4
  93. package/dist/runtime/types.d.mts +8 -8
  94. package/dist/runtime/uniAppHost.d.mts +2 -3
  95. package/dist/runtime/updatePerformance.d.mts +5 -6
  96. package/dist/runtime/use.d.mts +3 -4
  97. package/dist/runtime/vueCompat/context.d.mts +4 -5
  98. package/dist/runtime/vueCompat/model.d.mts +9 -10
  99. package/dist/runtime/vueCompat/router.d.mts +3 -4
  100. package/dist/runtime/vueCompat/templateRef.d.mts +4 -5
  101. package/dist/scheduler.d.mts +2 -3
  102. package/dist/store/define.d.mts +3 -4
  103. package/dist/store/manager.d.mts +2 -3
  104. package/dist/store/storeToRefs.d.mts +3 -4
  105. package/dist/store/types.d.mts +10 -11
  106. package/dist/version.d.mts +2 -3
  107. package/dist/vue-augment.d.mts +2 -1
  108. package/dist/vue-demi.d.mts +5 -5
  109. package/dist/vue-types.d.mts +2 -2
  110. package/dist/weappIntrinsicElements/base.d.mts +12 -13
  111. package/dist/weappIntrinsicElements/elements/ad-custom.d.mts +2 -3
  112. package/dist/weappIntrinsicElements/elements/ad.d.mts +2 -3
  113. package/dist/weappIntrinsicElements/elements/audio.d.mts +2 -3
  114. package/dist/weappIntrinsicElements/elements/block.d.mts +2 -3
  115. package/dist/weappIntrinsicElements/elements/button.d.mts +2 -3
  116. package/dist/weappIntrinsicElements/elements/camera.d.mts +2 -3
  117. package/dist/weappIntrinsicElements/elements/canvas.d.mts +2 -3
  118. package/dist/weappIntrinsicElements/elements/checkbox-group.d.mts +2 -3
  119. package/dist/weappIntrinsicElements/elements/checkbox.d.mts +2 -3
  120. package/dist/weappIntrinsicElements/elements/cover-image.d.mts +2 -3
  121. package/dist/weappIntrinsicElements/elements/cover-view.d.mts +2 -3
  122. package/dist/weappIntrinsicElements/elements/editor.d.mts +2 -3
  123. package/dist/weappIntrinsicElements/elements/form.d.mts +2 -3
  124. package/dist/weappIntrinsicElements/elements/functional-page-navigator.d.mts +2 -3
  125. package/dist/weappIntrinsicElements/elements/icon.d.mts +2 -3
  126. package/dist/weappIntrinsicElements/elements/image.d.mts +2 -3
  127. package/dist/weappIntrinsicElements/elements/import.d.mts +2 -3
  128. package/dist/weappIntrinsicElements/elements/include.d.mts +2 -3
  129. package/dist/weappIntrinsicElements/elements/input.d.mts +2 -3
  130. package/dist/weappIntrinsicElements/elements/keyboard-accessory.d.mts +2 -3
  131. package/dist/weappIntrinsicElements/elements/label.d.mts +2 -3
  132. package/dist/weappIntrinsicElements/elements/live-player.d.mts +2 -3
  133. package/dist/weappIntrinsicElements/elements/live-pusher.d.mts +2 -3
  134. package/dist/weappIntrinsicElements/elements/map.d.mts +2 -3
  135. package/dist/weappIntrinsicElements/elements/match-media.d.mts +2 -3
  136. package/dist/weappIntrinsicElements/elements/movable-area.d.mts +2 -3
  137. package/dist/weappIntrinsicElements/elements/movable-view.d.mts +2 -3
  138. package/dist/weappIntrinsicElements/elements/navigation-bar.d.mts +2 -3
  139. package/dist/weappIntrinsicElements/elements/navigator.d.mts +2 -3
  140. package/dist/weappIntrinsicElements/elements/official-account.d.mts +2 -3
  141. package/dist/weappIntrinsicElements/elements/open-data.d.mts +2 -3
  142. package/dist/weappIntrinsicElements/elements/page-container.d.mts +2 -3
  143. package/dist/weappIntrinsicElements/elements/page-meta.d.mts +2 -3
  144. package/dist/weappIntrinsicElements/elements/picker-view-column.d.mts +2 -3
  145. package/dist/weappIntrinsicElements/elements/picker-view.d.mts +2 -3
  146. package/dist/weappIntrinsicElements/elements/picker.d.mts +2 -3
  147. package/dist/weappIntrinsicElements/elements/progress.d.mts +2 -3
  148. package/dist/weappIntrinsicElements/elements/radio-group.d.mts +2 -3
  149. package/dist/weappIntrinsicElements/elements/radio.d.mts +2 -3
  150. package/dist/weappIntrinsicElements/elements/rich-text.d.mts +2 -3
  151. package/dist/weappIntrinsicElements/elements/scroll-view.d.mts +2 -3
  152. package/dist/weappIntrinsicElements/elements/share-element.d.mts +2 -3
  153. package/dist/weappIntrinsicElements/elements/slider.d.mts +2 -3
  154. package/dist/weappIntrinsicElements/elements/slot.d.mts +2 -3
  155. package/dist/weappIntrinsicElements/elements/swiper-item.d.mts +2 -3
  156. package/dist/weappIntrinsicElements/elements/swiper.d.mts +2 -3
  157. package/dist/weappIntrinsicElements/elements/switch.d.mts +2 -3
  158. package/dist/weappIntrinsicElements/elements/template.d.mts +2 -3
  159. package/dist/weappIntrinsicElements/elements/text.d.mts +2 -3
  160. package/dist/weappIntrinsicElements/elements/textarea.d.mts +2 -3
  161. package/dist/weappIntrinsicElements/elements/video.d.mts +2 -3
  162. package/dist/weappIntrinsicElements/elements/view.d.mts +2 -3
  163. package/dist/weappIntrinsicElements/elements/voip-room.d.mts +2 -3
  164. package/dist/weappIntrinsicElements/elements/web-view.d.mts +2 -3
  165. package/dist/weappIntrinsicElements.d.mts +5 -5
  166. package/package.json +4 -4
@@ -1,27 +1,26 @@
1
1
  import { ComputedRef, WritableComputedRef } from "./computed.mjs";
2
2
  import { Ref as Ref$1, ShallowRef as ShallowRef$1 } from "../vue-types.mjs";
3
3
  //#region src/reactivity/ref.d.ts
4
- type Ref<T = any, S = T> = Ref$1<T, S>;
5
- type ShallowRef<T = any> = ShallowRef$1<T>;
6
- type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;
7
- type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T);
8
- declare function isRef(value: unknown): value is Ref<any>;
9
- declare function ref<T = any>(): Ref<T | undefined>;
10
- declare function ref<T>(value: T): Ref<T>;
11
- declare function unref<T>(value: MaybeRef<T> | ComputedRef<T>): T;
12
- declare function toValue<T>(source: MaybeRefOrGetter<T>): T;
4
+ export type Ref<T = any, S = T> = Ref$1<T, S>;
5
+ export type ShallowRef<T = any> = ShallowRef$1<T>;
6
+ export type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;
7
+ export type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T);
8
+ export declare function isRef(value: unknown): value is Ref<any>;
9
+ export declare function ref<T = any>(): Ref<T | undefined>;
10
+ export declare function ref<T>(value: T): Ref<T>;
11
+ export declare function unref<T>(value: MaybeRef<T> | ComputedRef<T>): T;
12
+ export declare function toValue<T>(source: MaybeRefOrGetter<T>): T;
13
13
  /**
14
14
  * 自定义 ref 工厂:用于创建可显式控制 track/trigger 的自定义 ref
15
15
  */
16
- type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
16
+ export type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
17
17
  get: () => T;
18
18
  set: (value: T) => void;
19
19
  };
20
- interface CustomRefOptions<T> {
20
+ export interface CustomRefOptions<T> {
21
21
  get: () => T;
22
22
  set: (value: T) => void;
23
23
  }
24
- type CustomRefSource<T> = CustomRefFactory<T> | CustomRefOptions<T>;
25
- declare function customRef<T>(factory: CustomRefSource<T>, defaultValue?: T): Ref<T>;
26
- //#endregion
27
- export { CustomRefFactory, CustomRefOptions, CustomRefSource, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, customRef, isRef, ref, toValue, unref };
24
+ export type CustomRefSource<T> = CustomRefFactory<T> | CustomRefOptions<T>;
25
+ export declare function customRef<T>(factory: CustomRefSource<T>, defaultValue?: T): Ref<T>;
26
+ //#endregion
@@ -1,19 +1,18 @@
1
1
  import { Ref } from "./ref.mjs";
2
2
  //#region src/reactivity/shallowRef.d.ts
3
- declare function shallowRef<T>(value: T): Ref<T>;
4
- declare function shallowRef<T>(value: T, defaultValue: T): Ref<T>;
3
+ export declare function shallowRef<T>(value: T): Ref<T>;
4
+ export declare function shallowRef<T>(value: T, defaultValue: T): Ref<T>;
5
5
  /**
6
6
  * 判断传入值是否为浅层 ref。
7
7
  *
8
8
  * @param r 待判断的值
9
9
  * @returns 若为浅层 ref 则返回 true
10
10
  */
11
- declare function isShallowRef(r: any): r is Ref<any>;
11
+ export declare function isShallowRef(r: any): r is Ref<any>;
12
12
  /**
13
13
  * 主动触发一次浅层 ref 的更新(无需深度比较)。
14
14
  *
15
15
  * @param ref 需要触发的 ref
16
16
  */
17
- declare function triggerRef<T>(ref: Ref<T>): void;
18
- //#endregion
19
- export { isShallowRef, shallowRef, triggerRef };
17
+ export declare function triggerRef<T>(ref: Ref<T>): void;
18
+ //#endregion
@@ -16,8 +16,8 @@ import { Ref } from "./ref.mjs";
16
16
  * console.log(state.foo) // 2
17
17
  * ```
18
18
  */
19
- declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
20
- declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<T[K]>;
19
+ export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
20
+ export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<T[K]>;
21
21
  /**
22
22
  * 将一个响应式对象转换成“同结构的普通对象”,其中每个字段都是指向原对象对应属性的 ref。
23
23
  *
@@ -33,11 +33,10 @@ declare function toRef<T extends object, K extends keyof T>(object: T, key: K, d
33
33
  * state.foo // 2
34
34
  * ```
35
35
  */
36
- declare function toRefs<T extends object>(object: T): ToRefs<T>;
36
+ export declare function toRefs<T extends object>(object: T): ToRefs<T>;
37
37
  /**
38
38
  * toRefs 返回值的类型辅助
39
39
  */
40
40
  type ToRef<T> = T extends Ref<any> ? T : Ref<T>;
41
- type ToRefs<T extends object> = { [K in keyof T]: ToRef<T[K]>; };
42
- //#endregion
43
- export { ToRefs, toRef, toRefs };
41
+ export type ToRefs<T extends object> = { [K in keyof T]: ToRef<T[K]>; };
42
+ //#endregion
@@ -3,6 +3,5 @@
3
3
  * 深度遍历工具(框架内部依赖收集使用)。
4
4
  * @internal
5
5
  */
6
- declare function traverse(value: any, depth?: number, seen?: Map<object, number>): any;
7
- //#endregion
8
- export { traverse };
6
+ export declare function traverse(value: any, depth?: number, seen?: Map<object, number>): any;
7
+ //#endregion
@@ -1,43 +1,42 @@
1
1
  import { Ref } from "../ref.mjs";
2
2
  import { ComputedRef } from "../computed.mjs";
3
3
  //#region src/reactivity/watch/types.d.ts
4
- type OnCleanup = (cleanupFn: () => void) => void;
5
- type WatchEffect = (onCleanup: OnCleanup) => void;
6
- type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
7
- type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => void;
8
- type WatchScheduler = (job: () => void, isFirstRun: boolean) => void;
9
- type MaybeUndefined<T, Immediate> = Immediate extends true ? T | undefined : T;
10
- type MultiWatchSources = (WatchSource<unknown> | object)[];
11
- 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; };
12
- type WatchSourceValue<S> = S extends WatchSource<infer V> ? V : S extends object ? S : never;
13
- type WatchSources<T = any> = WatchSource<T> | ReadonlyArray<WatchSource<unknown> | object> | (T extends object ? T : never);
4
+ export type OnCleanup = (cleanupFn: () => void) => void;
5
+ export type WatchEffect = (onCleanup: OnCleanup) => void;
6
+ export type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
7
+ export type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => void;
8
+ export type WatchScheduler = (job: () => void, isFirstRun: boolean) => void;
9
+ export type MaybeUndefined<T, Immediate> = Immediate extends true ? T | undefined : T;
10
+ export type MultiWatchSources = (WatchSource<unknown> | object)[];
11
+ export 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; };
12
+ export type WatchSourceValue<S> = S extends WatchSource<infer V> ? V : S extends object ? S : never;
13
+ export type WatchSources<T = any> = WatchSource<T> | ReadonlyArray<WatchSource<unknown> | object> | (T extends object ? T : never);
14
14
  type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false : true;
15
- type WatchMultiSources<T extends ReadonlyArray<WatchSource<unknown> | object>> = IsTuple<T> extends true ? { [K in keyof T]: WatchSourceValue<T[K]>; } : Array<WatchSourceValue<T[number]>>;
16
- interface WatchEffectOptions {
15
+ export type WatchMultiSources<T extends ReadonlyArray<WatchSource<unknown> | object>> = IsTuple<T> extends true ? { [K in keyof T]: WatchSourceValue<T[K]>; } : Array<WatchSourceValue<T[number]>>;
16
+ export interface WatchEffectOptions {
17
17
  flush?: 'pre' | 'post' | 'sync';
18
18
  }
19
- interface WatchOptions<Immediate extends boolean = false> extends WatchEffectOptions {
19
+ export interface WatchOptions<Immediate extends boolean = false> extends WatchEffectOptions {
20
20
  immediate?: Immediate;
21
21
  deep?: boolean | number;
22
22
  once?: boolean;
23
23
  scheduler?: WatchScheduler;
24
24
  }
25
- interface WatchStopHandle {
25
+ export interface WatchStopHandle {
26
26
  (): void;
27
27
  stop: () => void;
28
28
  pause: () => void;
29
29
  resume: () => void;
30
30
  }
31
- type DeepWatchStrategy = 'version' | 'traverse';
31
+ export type DeepWatchStrategy = 'version' | 'traverse';
32
32
  /**
33
33
  * 设置深度 watch 内部策略(测试/框架内部使用)。
34
34
  * @internal
35
35
  */
36
- declare function setDeepWatchStrategy(strategy: DeepWatchStrategy): void;
36
+ export declare function setDeepWatchStrategy(strategy: DeepWatchStrategy): void;
37
37
  /**
38
38
  * 获取深度 watch 内部策略(测试/框架内部使用)。
39
39
  * @internal
40
40
  */
41
- declare function getDeepWatchStrategy(): DeepWatchStrategy;
42
- //#endregion
43
- export { DeepWatchStrategy, MapSources, MaybeUndefined, MultiWatchSources, OnCleanup, WatchCallback, WatchEffect, WatchEffectOptions, WatchMultiSources, WatchOptions, WatchScheduler, WatchSource, WatchSourceValue, WatchSources, WatchStopHandle, getDeepWatchStrategy, setDeepWatchStrategy };
41
+ export declare function getDeepWatchStrategy(): DeepWatchStrategy;
42
+ //#endregion
@@ -1,21 +1,21 @@
1
1
  import { DeepWatchStrategy, MapSources, MaybeUndefined, MultiWatchSources, OnCleanup, WatchCallback, WatchEffect, WatchEffectOptions, WatchMultiSources, WatchOptions, WatchScheduler, WatchSource, WatchSourceValue, WatchSources, WatchStopHandle, getDeepWatchStrategy, setDeepWatchStrategy } from "./watch/types.mjs";
2
2
  //#region src/reactivity/watch.d.ts
3
- declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
4
- declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T extends ReadonlyArray<any> ? never : T, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
5
- 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;
6
- 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;
3
+ export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
4
+ export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T extends ReadonlyArray<any> ? never : T, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
5
+ export declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(source: readonly [...T] | T, cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
6
+ export 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;
7
7
  /**
8
8
  * watchEffect 注册一个响应式副作用,可选清理函数。
9
9
  * 副作用会立即执行,并在依赖变化时重新运行。
10
10
  */
11
- declare function watchEffect(effectFn: WatchEffect, options?: WatchEffectOptions): WatchStopHandle;
11
+ export declare function watchEffect(effectFn: WatchEffect, options?: WatchEffectOptions): WatchStopHandle;
12
12
  /**
13
13
  * 以后置刷新的方式运行副作用,与 Vue 的 `watchPostEffect()` 兼容。
14
14
  */
15
- declare function watchPostEffect(effectFn: WatchEffect, options?: Omit<WatchEffectOptions, 'flush'>): WatchStopHandle;
15
+ export declare function watchPostEffect(effectFn: WatchEffect, options?: Omit<WatchEffectOptions, 'flush'>): WatchStopHandle;
16
16
  /**
17
17
  * 以同步刷新的方式运行副作用,与 Vue 的 `watchSyncEffect()` 兼容。
18
18
  */
19
- declare function watchSyncEffect(effectFn: WatchEffect, options?: Omit<WatchEffectOptions, 'flush'>): WatchStopHandle;
19
+ export declare function watchSyncEffect(effectFn: WatchEffect, options?: Omit<WatchEffectOptions, 'flush'>): WatchStopHandle;
20
20
  //#endregion
21
- export { type MapSources, type MaybeUndefined, type MultiWatchSources, type OnCleanup, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, getDeepWatchStrategy, setDeepWatchStrategy, watch, watchEffect, watchPostEffect, watchSyncEffect };
21
+ export { type MapSources, type MaybeUndefined, type MultiWatchSources, type OnCleanup, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, getDeepWatchStrategy, setDeepWatchStrategy };
@@ -3,6 +3,5 @@ import { RouterNavigation, UseRouterOptions } from "./types.mjs";
3
3
  /**
4
4
  * @description 创建高阶路由导航器(对齐 Vue Router 的 createRouter 心智)
5
5
  */
6
- declare function createRouter(options?: UseRouterOptions): RouterNavigation;
7
- //#endregion
8
- export { createRouter };
6
+ export declare function createRouter(options?: UseRouterOptions): RouterNavigation;
7
+ //#endregion
@@ -1 +1 @@
1
- import{getActiveRouter as e}from"./instance.mjs";import{WEVU_INITIAL_NAVIGATION_TIMEOUT_MARKER as t}from"@weapp-core/constants";const n=1e4,r=new WeakMap,i=new WeakMap;function a(e){return Number.isFinite(e)&&e>0?Math.max(1,Math.trunc(e)):n}function o(e){return{route:typeof e.route==`string`?e.route:void 0,__route__:typeof e.__route__==`string`?e.__route__:void 0,options:e.options&&typeof e.options==`object`?{...e.options}:void 0}}function s(e){if(e&&typeof e==`object`)return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?[...t]:t]))}function c(e,t,i=n,o=`blocking`){r.set(e,{runner:t,mode:o,timeoutMs:a(i)})}function l(){var t,i;let a=e();return a?(t=(i=r.get(a))==null?void 0:i.timeoutMs)==null?n:t:n}function u(e){return!!(e&&typeof e==`object`&&e.__wevuNavigationFailure)}function d(n,a,c={}){let d=i.get(n);if(d)return c.onComplete&&d.blocking&&d.subscribe(c.onComplete),c.start!==!1&&d.start(a),d.blocking?d.promise:void 0;let f=e(),p=f?r.get(f):void 0,m=p==null?void 0:p.runner;if(!m)return;let h=(p==null?void 0:p.mode)===`blocking`,g=o(n),_=s(a),v=`idle`,y,b=l(),x,S=new Set,C=new Promise(e=>{x=e}),w=(e,t)=>{if(v!==`idle`&&v!==`running`)return;v=e,y!==void 0&&(clearTimeout(y),y=void 0);let n=[...S];S.clear(),m=void 0,g=void 0,_=void 0,x(t),queueMicrotask(()=>{if(v===`allowed`||v===`timed-out`)for(let e of n)e.active&&(e.callback(t),e.active=!1)})},T={promise:C,blocking:h,status:()=>v,subscribe(e){let t={callback:e,active:!0};return v!==`idle`&&v!==`running`?queueMicrotask(()=>{t.active&&(v===`allowed`||v===`timed-out`)&&(e(v===`allowed`||v===`timed-out`),t.active=!1)}):S.add(t),()=>{t.active=!1,S.delete(t)}},start(e){if(v!==`idle`)return;v=`running`,h&&(y=setTimeout(()=>{var e,n;v===`running`&&(console.warn(`${t} initial navigation exceeded ${b}ms; mounting page`,(e=(n=g==null?void 0:g.route)==null?g==null?void 0:g.__route__:n)==null?``:e),w(`timed-out`,!0))},b));let n=g,r=s(e==null?_:e),i=m;if(m=void 0,!i||!n){w(`aborted`,!1);return}i(n,r,()=>v===`running`).then(e=>{let t=u(e);w(t?`aborted`:`allowed`,!t)},()=>{w(`aborted`,!1)})},cancel(){w(`cancelled`,!1)}};return i.set(n,T),c.onComplete&&h&&T.subscribe(c.onComplete),c.start!==!1&&T.start(a),h?C:void 0}function f(e){var t;(t=i.get(e))==null||t.cancel()}export{n as DEFAULT_INITIAL_NAVIGATION_TIMEOUT,f as cancelInitialNavigation,d as ensureInitialNavigation,l as getInitialNavigationTimeout,c as registerInitialNavigationRunner};
1
+ import{getActiveRouter as e}from"./instance.mjs";import{WEVU_INITIAL_NAVIGATION_TIMEOUT_MARKER as t}from"@weapp-core/constants";import{queueMicrotaskPolyfill as n}from"@wevu/web-apis";const r=1e4,i=new WeakMap,a=new WeakMap;function o(e){return Number.isFinite(e)&&e>0?Math.max(1,Math.trunc(e)):r}function s(e){return{route:typeof e.route==`string`?e.route:void 0,__route__:typeof e.__route__==`string`?e.__route__:void 0,options:e.options&&typeof e.options==`object`?{...e.options}:void 0}}function c(e){if(!e||typeof e!=`object`)return;let t={};for(let[n,r]of Object.entries(e))t[n]=Array.isArray(r)?[...r]:r;return t}function l(e,t,n=r,a=`blocking`){i.set(e,{runner:t,mode:a,timeoutMs:o(n)})}function u(){var t,n;let a=e();return a?(t=(n=i.get(a))==null?void 0:n.timeoutMs)==null?r:t:r}function d(e){return!!(e&&typeof e==`object`&&e.__wevuNavigationFailure)}function f(r,o,l={}){let f=a.get(r);if(f)return l.onComplete&&f.blocking&&f.subscribe(l.onComplete),l.start!==!1&&f.start(o),f.blocking?f.promise:void 0;let p=e(),m=p?i.get(p):void 0,h=m==null?void 0:m.runner;if(!h)return;let g=(m==null?void 0:m.mode)===`blocking`,_=s(r),v=c(o),y=`idle`,b,x=u(),S,C=new Set,w=new Promise(e=>{S=e}),T=(e,t)=>{if(y!==`idle`&&y!==`running`)return;y=e,b!==void 0&&(clearTimeout(b),b=void 0);let r=[...C];C.clear(),h=void 0,_=void 0,v=void 0,S(t),n(()=>{if(y===`allowed`||y===`timed-out`)for(let e of r)e.active&&(e.callback(t),e.active=!1)})},E={promise:w,blocking:g,status:()=>y,subscribe(e){let t={callback:e,active:!0};return y!==`idle`&&y!==`running`?n(()=>{t.active&&(y===`allowed`||y===`timed-out`)&&(e(y===`allowed`||y===`timed-out`),t.active=!1)}):C.add(t),()=>{t.active=!1,C.delete(t)}},start(e){if(y!==`idle`)return;y=`running`,g&&(b=setTimeout(()=>{var e,n;y===`running`&&(console.warn(`${t} initial navigation exceeded ${x}ms; mounting page`,(e=(n=_==null?void 0:_.route)==null?_==null?void 0:_.__route__:n)==null?``:e),T(`timed-out`,!0))},x));let n=_,r=c(e==null?v:e),i=h;if(h=void 0,!i||!n){T(`aborted`,!1);return}i(n,r,()=>y===`running`).then(e=>{let t=d(e);T(t?`aborted`:`allowed`,!t)},()=>{T(`aborted`,!1)})},cancel(){T(`cancelled`,!1)}};return a.set(r,E),l.onComplete&&g&&E.subscribe(l.onComplete),l.start!==!1&&E.start(o),g?w:void 0}function p(e){var t;(t=a.get(e))==null||t.cancel()}export{r as DEFAULT_INITIAL_NAVIGATION_TIMEOUT,p as cancelInitialNavigation,f as ensureInitialNavigation,u as getInitialNavigationTimeout,l as registerInitialNavigationRunner};
@@ -1,6 +1,5 @@
1
1
  import { NavigationFailure, NavigationFailureTypeValue, RouteLocationNormalizedLoaded } from "./types.mjs";
2
2
  //#region src/router/navigationCore.d.ts
3
- declare function createNavigationFailure(type: NavigationFailureTypeValue, to?: RouteLocationNormalizedLoaded, from?: RouteLocationNormalizedLoaded, cause?: unknown): NavigationFailure;
4
- declare function isNavigationFailure(error: unknown, type?: NavigationFailureTypeValue): error is NavigationFailure;
5
- //#endregion
6
- export { createNavigationFailure, isNavigationFailure };
3
+ export declare function createNavigationFailure(type: NavigationFailureTypeValue, to?: RouteLocationNormalizedLoaded, from?: RouteLocationNormalizedLoaded, cause?: unknown): NavigationFailure;
4
+ export declare function isNavigationFailure(error: unknown, type?: NavigationFailureTypeValue): error is NavigationFailure;
5
+ //#endregion
@@ -1,6 +1,5 @@
1
1
  import { RouteResolveCodec } from "../routerInternal/types.mjs";
2
2
  import { RouteLocationNormalizedLoaded, RouteLocationRaw } from "./types.mjs";
3
3
  //#region src/router/resolve.d.ts
4
- declare function resolveRouteLocation(to: RouteLocationRaw, currentPath?: string, codec?: RouteResolveCodec): RouteLocationNormalizedLoaded;
5
- //#endregion
6
- export { resolveRouteLocation };
4
+ export declare function resolveRouteLocation(to: RouteLocationRaw, currentPath?: string, codec?: RouteResolveCodec): RouteLocationNormalizedLoaded;
5
+ //#endregion
@@ -1 +1 @@
1
- const e=[`switchTab`,`reLaunch`,`redirectTo`,`navigateTo`,`navigateBack`],t=new Set,n=new WeakSet;function r(e){return t.add(e),()=>{t.delete(e)}}function i(e){for(let n of t)try{n(e)}catch(e){}}function a(e,t){if(e===`navigateBack`)return{method:e,source:`native`};if(t&&typeof t==`object`){let n=t.url;if(typeof n==`string`)return{method:e,source:`native`,url:n}}return{method:e,source:`native`}}function o(t){if(!t||typeof t!=`object`)return;let r=t;if(!n.has(r)){n.add(r);for(let t of e){let e=r[t];typeof e==`function`&&(r[t]=function(n,...r){let o=!1,s=()=>{o||(o=!0,i(a(t,n)))},c=n&&typeof n==`object`?{...n,success:(...e)=>{s();let t=n.success;return typeof t==`function`?t(...e):void 0}}:n,l=e.call(this,c,...r);return l&&typeof l.then==`function`&&l.then(s,()=>{}),l})}}}export{o as installRouteStateSyncOnNativeRouter,i as notifyRouteStateSync,r as registerRouteStateSyncHandler};
1
+ import{getCurrentMiniProgramPages as e}from"../runtime/platform.mjs";const t=[`switchTab`,`reLaunch`,`redirectTo`,`navigateTo`,`navigateBack`],n=new Set,r=new WeakSet;function i(e){return n.add(e),()=>{n.delete(e)}}function a(e){for(let t of n)try{t(e)}catch(e){}}function o(e,t,n){if(e===`navigateBack`)return{method:e,source:`native`};if(t&&typeof t==`object`){let r=t.url;if(typeof r==`string`)return{method:e,page:n,source:`native`,url:r}}return{method:e,page:n,source:`native`}}function s(n){if(!n||typeof n!=`object`)return;let i=n;if(!r.has(i)){r.add(i);for(let n of t){let t=i[n];typeof t==`function`&&(i[n]=function(r,...i){let s=e(),c=s[s.length-1],l=!1,u=()=>{l||(l=!0,a(o(n,r,c)))},d=r&&typeof r==`object`?{...r,success:(...e)=>{u();let t=r.success;return typeof t==`function`?t(...e):void 0}}:r,f=t.call(this,d,...i);return f&&typeof f.then==`function`&&f.then(u,()=>{}),f})}}}export{s as installRouteStateSyncOnNativeRouter,a as notifyRouteStateSync,i as registerRouteStateSyncHandler};
@@ -1,23 +1,23 @@
1
1
  import { SetupContextRouter, TypedRouterTabBarUrl } from "../runtime/types/props/router.mjs";
2
2
  import "../runtime/types/props.mjs";
3
3
  //#region src/router/types.d.ts
4
- type LocationQueryValue = string | null;
5
- type LocationQueryValueRaw = LocationQueryValue | number | boolean | undefined;
6
- type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
7
- type LocationQueryRaw = Record<string, LocationQueryValueRaw | LocationQueryValueRaw[]>;
8
- type RouteParamValue = string;
9
- type RouteParamValueRaw = RouteParamValue | number | boolean | null | undefined;
10
- type RouteParams = Record<string, RouteParamValue | RouteParamValue[]>;
11
- type RouteParamsRaw = Record<string, RouteParamValueRaw | RouteParamValueRaw[]>;
12
- type RouteParamsMode = 'loose' | 'strict';
13
- type RouteQueryParser = (search: string) => LocationQueryRaw | LocationQuery;
14
- type RouteQueryStringifier = (query: LocationQueryRaw | LocationQuery) => string;
15
- type RouteMeta = Record<string, unknown>;
16
- interface NamedRouteRecord {
4
+ export type LocationQueryValue = string | null;
5
+ export type LocationQueryValueRaw = LocationQueryValue | number | boolean | undefined;
6
+ export type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
7
+ export type LocationQueryRaw = Record<string, LocationQueryValueRaw | LocationQueryValueRaw[]>;
8
+ export type RouteParamValue = string;
9
+ export type RouteParamValueRaw = RouteParamValue | number | boolean | null | undefined;
10
+ export type RouteParams = Record<string, RouteParamValue | RouteParamValue[]>;
11
+ export type RouteParamsRaw = Record<string, RouteParamValueRaw | RouteParamValueRaw[]>;
12
+ export type RouteParamsMode = 'loose' | 'strict';
13
+ export type RouteQueryParser = (search: string) => LocationQueryRaw | LocationQuery;
14
+ export type RouteQueryStringifier = (query: LocationQueryRaw | LocationQuery) => string;
15
+ export type RouteMeta = Record<string, unknown>;
16
+ export interface NamedRouteRecord {
17
17
  name: string;
18
18
  path: string;
19
19
  }
20
- interface RouteRecordInput {
20
+ export interface RouteRecordInput {
21
21
  name?: string;
22
22
  path: string;
23
23
  meta?: RouteMeta;
@@ -26,8 +26,8 @@ interface RouteRecordInput {
26
26
  beforeEnter?: NavigationGuard | readonly NavigationGuard[];
27
27
  redirect?: RouteRecordRedirect;
28
28
  }
29
- type NamedRoutes = Readonly<Record<string, string>> | readonly RouteRecordRaw[];
30
- type RouteLocationRaw = string | {
29
+ export type NamedRoutes = Readonly<Record<string, string>> | readonly RouteRecordRaw[];
30
+ export type RouteLocationRaw = string | {
31
31
  path?: string;
32
32
  fullPath?: string;
33
33
  query?: LocationQueryRaw;
@@ -35,7 +35,7 @@ type RouteLocationRaw = string | {
35
35
  name?: string;
36
36
  params?: RouteParamsRaw;
37
37
  };
38
- interface RouteLocationNormalizedLoaded {
38
+ export interface RouteLocationNormalizedLoaded {
39
39
  path: string;
40
40
  fullPath: string;
41
41
  query: LocationQuery;
@@ -47,37 +47,37 @@ interface RouteLocationNormalizedLoaded {
47
47
  redirectedFrom?: RouteLocationRedirectedFrom;
48
48
  params: RouteParams;
49
49
  }
50
- declare const NavigationFailureType: {
50
+ export declare const NavigationFailureType: {
51
51
  readonly unknown: 1;
52
52
  readonly aborted: 4;
53
53
  readonly cancelled: 8;
54
54
  readonly duplicated: 16;
55
55
  };
56
- type NavigationFailureTypeValue = (typeof NavigationFailureType)[keyof typeof NavigationFailureType];
57
- interface NavigationFailure extends Error {
56
+ export type NavigationFailureTypeValue = (typeof NavigationFailureType)[keyof typeof NavigationFailureType];
57
+ export interface NavigationFailure extends Error {
58
58
  readonly __wevuNavigationFailure: true;
59
59
  readonly type: NavigationFailureTypeValue;
60
60
  readonly to?: RouteLocationNormalizedLoaded;
61
61
  readonly from?: RouteLocationNormalizedLoaded;
62
62
  readonly cause?: unknown;
63
63
  }
64
- type NavigationMode = 'push' | 'replace' | 'back';
65
- type InitialNavigationMode = 'eager' | 'blocking';
66
- interface NavigationRedirect {
64
+ export type NavigationMode = 'push' | 'replace' | 'back';
65
+ export type InitialNavigationMode = 'eager' | 'blocking';
66
+ export interface NavigationRedirect {
67
67
  to: RouteLocationRaw;
68
68
  replace?: boolean;
69
69
  }
70
- type RouteRecordRedirect = RouteLocationRaw | NavigationRedirect | ((to: RouteLocationNormalizedLoaded, from: RouteLocationNormalizedLoaded) => RouteLocationRaw | NavigationRedirect | Promise<RouteLocationRaw | NavigationRedirect>);
71
- interface RouteRecordRaw extends Omit<RouteRecordInput, 'name' | 'children'>, NamedRouteRecord {
70
+ export type RouteRecordRedirect = RouteLocationRaw | NavigationRedirect | ((to: RouteLocationNormalizedLoaded, from: RouteLocationNormalizedLoaded) => RouteLocationRaw | NavigationRedirect | Promise<RouteLocationRaw | NavigationRedirect>);
71
+ export interface RouteRecordRaw extends Omit<RouteRecordInput, 'name' | 'children'>, NamedRouteRecord {
72
72
  children?: readonly RouteRecordRaw[];
73
73
  }
74
- interface RouteRecordMatched {
74
+ export interface RouteRecordMatched {
75
75
  name: string;
76
76
  path: string;
77
77
  aliasPath?: string;
78
78
  meta?: RouteMeta;
79
79
  }
80
- interface RouteLocationRedirectedFrom {
80
+ export interface RouteLocationRedirectedFrom {
81
81
  path: string;
82
82
  fullPath: string;
83
83
  query: LocationQuery;
@@ -88,31 +88,31 @@ interface RouteLocationRedirectedFrom {
88
88
  matched?: readonly RouteRecordMatched[];
89
89
  params: RouteParams;
90
90
  }
91
- type NavigationGuardResult = void | boolean | NavigationFailure | RouteLocationRaw | NavigationRedirect;
92
- type NavigationGuard = (to: RouteLocationNormalizedLoaded | undefined, from: RouteLocationNormalizedLoaded, context?: NavigationGuardContext) => NavigationGuardResult | Promise<NavigationGuardResult>;
93
- type NavigationAfterEach = (to: RouteLocationNormalizedLoaded | undefined, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure, context?: NavigationAfterEachContext) => void | Promise<void>;
94
- interface NavigationGuardContext {
91
+ export type NavigationGuardResult = void | boolean | NavigationFailure | RouteLocationRaw | NavigationRedirect;
92
+ export type NavigationGuard = (to: RouteLocationNormalizedLoaded | undefined, from: RouteLocationNormalizedLoaded, context?: NavigationGuardContext) => NavigationGuardResult | Promise<NavigationGuardResult>;
93
+ export type NavigationAfterEach = (to: RouteLocationNormalizedLoaded | undefined, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure, context?: NavigationAfterEachContext) => void | Promise<void>;
94
+ export interface NavigationGuardContext {
95
95
  readonly mode: NavigationMode;
96
96
  readonly to?: RouteLocationNormalizedLoaded;
97
97
  readonly from: RouteLocationNormalizedLoaded;
98
98
  readonly nativeRouter: SetupContextRouter;
99
99
  }
100
- interface NavigationAfterEachContext {
100
+ export interface NavigationAfterEachContext {
101
101
  readonly mode: NavigationMode;
102
102
  readonly to?: RouteLocationNormalizedLoaded;
103
103
  readonly from: RouteLocationNormalizedLoaded;
104
104
  readonly nativeRouter: SetupContextRouter;
105
105
  readonly failure?: NavigationFailure;
106
106
  }
107
- interface NavigationErrorContext {
107
+ export interface NavigationErrorContext {
108
108
  readonly mode: NavigationMode;
109
109
  readonly to?: RouteLocationNormalizedLoaded;
110
110
  readonly from: RouteLocationNormalizedLoaded;
111
111
  readonly nativeRouter: SetupContextRouter;
112
112
  readonly failure: NavigationFailure;
113
113
  }
114
- type NavigationErrorHandler = (error: unknown, context: NavigationErrorContext) => void | Promise<void>;
115
- interface UseRouterOptions {
114
+ export type NavigationErrorHandler = (error: unknown, context: NavigationErrorContext) => void | Promise<void>;
115
+ export interface UseRouterOptions {
116
116
  tabBarEntries?: readonly (TypedRouterTabBarUrl | string)[];
117
117
  /**
118
118
  * Vue Router 对齐入口:推荐使用 `routes`
@@ -142,7 +142,7 @@ interface UseRouterOptions {
142
142
  */
143
143
  rejectOnError?: boolean;
144
144
  }
145
- interface RouterNavigation {
145
+ export interface RouterNavigation {
146
146
  readonly nativeRouter: SetupContextRouter;
147
147
  readonly options: Readonly<UseRouterOptions>;
148
148
  readonly currentRoute: Readonly<RouteLocationNormalizedLoaded>;
@@ -164,9 +164,8 @@ interface RouterNavigation {
164
164
  afterEach: (hook: NavigationAfterEach) => () => void;
165
165
  onError: (handler: NavigationErrorHandler) => () => void;
166
166
  }
167
- interface AddRoute {
167
+ export interface AddRoute {
168
168
  (route: RouteRecordRaw): () => void;
169
169
  (parentName: string, route: RouteRecordRaw): () => void;
170
170
  }
171
- //#endregion
172
- export { AddRoute, InitialNavigationMode, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, NamedRouteRecord, NamedRoutes, NavigationAfterEach, NavigationAfterEachContext, NavigationErrorContext, NavigationErrorHandler, NavigationFailure, NavigationFailureType, NavigationFailureTypeValue, NavigationGuard, NavigationGuardContext, NavigationGuardResult, NavigationMode, NavigationRedirect, RouteLocationNormalizedLoaded, RouteLocationRaw, RouteLocationRedirectedFrom, RouteMeta, RouteParamValue, RouteParamValueRaw, RouteParams, RouteParamsMode, RouteParamsRaw, RouteQueryParser, RouteQueryStringifier, RouteRecordInput, RouteRecordMatched, RouteRecordRaw, RouteRecordRedirect, RouterNavigation, UseRouterOptions };
171
+ //#endregion
@@ -3,17 +3,16 @@ import "../runtime/types/props.mjs";
3
3
  import { RouteLocationNormalizedLoaded } from "./types.mjs";
4
4
  import "./routeSync.mjs";
5
5
  //#region src/router/useRoute.d.ts
6
- interface UseRouteOptions {
6
+ export interface UseRouteOptions {
7
7
  resolveRoute?: (route: RouteLocationNormalizedLoaded) => RouteLocationNormalizedLoaded;
8
8
  }
9
- declare function useRoute(options?: UseRouteOptions): Readonly<RouteLocationNormalizedLoaded>;
9
+ export declare function useRoute(options?: UseRouteOptions): Readonly<RouteLocationNormalizedLoaded>;
10
10
  /**
11
11
  * @description 获取当前组件路径语义的原生 Router
12
12
  */
13
- declare function useNativeRouter(): SetupContextRouter;
13
+ export declare function useNativeRouter(): SetupContextRouter;
14
14
  /**
15
15
  * @description 获取当前页面路径语义的原生 Page Router
16
16
  */
17
- declare function useNativePageRouter(): SetupContextRouter;
18
- //#endregion
19
- export { UseRouteOptions, useNativePageRouter, useNativeRouter, useRoute };
17
+ export declare function useNativePageRouter(): SetupContextRouter;
18
+ //#endregion
@@ -1 +1 @@
1
- import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"../runtime/platform.mjs";import{getCurrentSetupContext as r}from"../runtime/hooks/base.mjs";import{onLoad as i,onReady as a,onRouteDone as o,onShow as s,onUnload as c}from"../runtime/hooks/register.mjs";import{getActiveRouter as l}from"./instance.mjs";import{registerRouteStateSyncHandler as u}from"./routeSync.mjs";import{resolveCurrentRoute as d,resolvePageRoute as f}from"../routerInternal/location.mjs";import{cloneLocationQuery as p,cloneRouteLocationRedirectedFrom as m,cloneRouteMeta as h,cloneRouteParams as g,cloneRouteRecordMatchedList as _}from"../routerInternal/snapshots.mjs";import{useNativePageRouter as v,useNativeRouter as y}from"../runtime/vueCompat/router.mjs";import{resolveRouteLocation as b}from"./resolve.mjs";function x(e){return typeof e.route==`string`||typeof e.__route__==`string`}function S(e,t,r){if((r==null?void 0:r.source)===`router`||!t)return!0;if(r!=null&&r.page)return r.page===e;let i=n();return i[i.length-1]===e}function C(e,t){e.path=t.path,e.fullPath=t.fullPath,e.query=p(t.query),e.hash=t.hash,e.params=g(t.params),t.name===void 0?delete e.name:e.name=t.name,t.meta===void 0?delete e.meta:e.meta=h(t.meta),t.href===void 0?delete e.href:e.href=t.href,t.matched===void 0?delete e.matched:e.matched=_(t.matched),t.redirectedFrom===void 0?delete e.redirectedFrom:e.redirectedFrom=m(t.redirectedFrom)}function w(m={}){var h;let _=r();if(!_)throw Error(`useRoute() 必须在 setup() 的同步阶段调用`);let v=_.instance,y=(h=m.resolveRoute)==null?(e=>{var t,n;return(t=(n=l())==null?void 0:n.resolve(e))==null?e:t}):h,w=y(d(void 0,v)),T=x(v)||n().includes(v),E=e({path:w.path,fullPath:w.fullPath,query:p(w.query),hash:w.hash,params:g(w.params)});C(E,w);function D(e,t,n){let r=y(t||d(e,v));if(n){var i;(i=m.beforeRouteStateSync)==null||i.call(m,r,n)}C(E,r)}i(e=>{D(e)}),a(()=>{D()}),s(()=>{D()}),o(()=>{D()});let O=u(e=>{if(S(v,T,e)){if(e!=null&&e.route){D(void 0,e.route,e);return}if(e!=null&&e.page){D(void 0,f(e.page),e);return}if(e!=null&&e.url){D(void 0,b(e.url,E.path),e);return}D(void 0,void 0,e)}});return c(()=>{O()}),{route:t(E)}}function T(e={}){return w(e).route}function E(){return y()}function D(){return v()}export{w as createRouteStateController,D as useNativePageRouter,E as useNativeRouter,T as useRoute};
1
+ import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"../runtime/platform.mjs";import{getCurrentSetupContext as r}from"../runtime/hooks/base.mjs";import{onLoad as i,onReady as a,onRouteDone as o,onShow as s,onUnload as c}from"../runtime/hooks/register.mjs";import{getActiveRouter as l}from"./instance.mjs";import{registerRouteStateSyncHandler as u}from"./routeSync.mjs";import{resolveCurrentRoute as d,resolvePageRoute as f}from"../routerInternal/location.mjs";import{cloneLocationQuery as p,cloneRouteLocationRedirectedFrom as m,cloneRouteMeta as h,cloneRouteParams as g,cloneRouteRecordMatchedList as _}from"../routerInternal/snapshots.mjs";import{useNativePageRouter as v,useNativeRouter as y}from"../runtime/vueCompat/router.mjs";import{resolveRouteLocation as b}from"./resolve.mjs";import{WEVU_NATIVE_INSTANCE_KEY as x}from"@weapp-core/constants";function S(e){return typeof e.route==`string`||typeof e.__route__==`string`}function C(e){let t=e[x];return t&&typeof t==`object`?t:e}function w(e,t,r){if((r==null?void 0:r.source)===`router`||!t)return!0;let i=C(e);if(r!=null&&r.page)return r.page===i;let a=n();return a[a.length-1]===i}function T(e,t){e.path=t.path,e.fullPath=t.fullPath,e.query=p(t.query),e.hash=t.hash,e.params=g(t.params),t.name===void 0?delete e.name:e.name=t.name,t.meta===void 0?delete e.meta:e.meta=h(t.meta),t.href===void 0?delete e.href:e.href=t.href,t.matched===void 0?delete e.matched:e.matched=_(t.matched),t.redirectedFrom===void 0?delete e.redirectedFrom:e.redirectedFrom=m(t.redirectedFrom)}function E(m={}){var h;let _=r();if(!_)throw Error(`useRoute() 必须在 setup() 的同步阶段调用`);let v=_.instance,y=C(v),x=(h=m.resolveRoute)==null?(e=>{var t,n;return(t=(n=l())==null?void 0:n.resolve(e))==null?e:t}):h,E=x(d(void 0,v)),D=S(y)||n().includes(y),O=e({path:E.path,fullPath:E.fullPath,query:p(E.query),hash:E.hash,params:g(E.params)});T(O,E);function k(e,t,n){let r=x(t||d(e,v));if(n){var i;(i=m.beforeRouteStateSync)==null||i.call(m,r,n)}T(O,r)}i(e=>{k(e)}),a(()=>{k()}),s(()=>{k()}),o(()=>{k()});let A=u(e=>{if(w(v,D,e)){if(e!=null&&e.route){k(void 0,e.route,e);return}if(e!=null&&e.url){k(void 0,b(e.url,O.path),e);return}if(e!=null&&e.page){k(void 0,f(e.page),e);return}k(void 0,void 0,e)}});return c(()=>{A()}),{route:t(O)}}function D(e={}){return E(e).route}function O(){return y()}function k(){return v()}export{E as createRouteStateController,k as useNativePageRouter,O as useNativeRouter,D as useRoute};
@@ -3,6 +3,5 @@ import { RouterNavigation } from "./types.mjs";
3
3
  /**
4
4
  * @description 获取当前已创建的路由实例。
5
5
  */
6
- declare function useRouter(): RouterNavigation;
7
- //#endregion
8
- export { useRouter };
6
+ export declare function useRouter(): RouterNavigation;
7
+ //#endregion
@@ -1,7 +1,6 @@
1
1
  import { LocationQuery, LocationQueryRaw } from "../router/types.mjs";
2
2
  import "../router.mjs";
3
3
  //#region src/routerInternal/query.d.ts
4
- declare function parseQuery(search: string): LocationQuery;
5
- declare function stringifyQuery(query?: LocationQueryRaw | LocationQuery): string;
6
- //#endregion
7
- export { parseQuery, stringifyQuery };
4
+ export declare function parseQuery(search: string): LocationQuery;
5
+ export declare function stringifyQuery(query?: LocationQueryRaw | LocationQuery): string;
6
+ //#endregion
@@ -1,9 +1,8 @@
1
1
  import { RouteQueryParser, RouteQueryStringifier } from "../router/types.mjs";
2
2
  import "../router.mjs";
3
3
  //#region src/routerInternal/types.d.ts
4
- interface RouteResolveCodec {
4
+ export interface RouteResolveCodec {
5
5
  parseQuery: RouteQueryParser;
6
6
  stringifyQuery: RouteQueryStringifier;
7
7
  }
8
- //#endregion
9
- export { RouteResolveCodec };
8
+ //#endregion
@@ -1,10 +1,9 @@
1
1
  import { RuntimeApp } from "../types/runtime.mjs";
2
2
  import "../types.mjs";
3
3
  //#region src/runtime/app/pending.d.ts
4
- interface PendingRuntimeAppRegistration {
4
+ export interface PendingRuntimeAppRegistration {
5
5
  app: RuntimeApp<any, any, any>;
6
6
  register: () => void;
7
7
  }
8
- declare function takePendingRuntimeAppRegistration(): PendingRuntimeAppRegistration | undefined;
9
- //#endregion
10
- export { PendingRuntimeAppRegistration, takePendingRuntimeAppRegistration };
8
+ export declare function takePendingRuntimeAppRegistration(): PendingRuntimeAppRegistration | undefined;
9
+ //#endregion
@@ -3,6 +3,5 @@ import { RuntimeApp } from "./types/runtime.mjs";
3
3
  import { CreateAppOptions } from "./types/options.mjs";
4
4
  import "./types.mjs";
5
5
  //#region src/runtime/app.d.ts
6
- declare function createApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: CreateAppOptions<D, C, M>): RuntimeApp<D, C, M>;
7
- //#endregion
8
- export { createApp };
6
+ export declare function createApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: CreateAppOptions<D, C, M>): RuntimeApp<D, C, M>;
7
+ //#endregion
@@ -4,11 +4,10 @@ import "../reactivity/index.mjs";
4
4
  /**
5
5
  * 读取当前 SFC 的 CSS Modules 映射。
6
6
  */
7
- declare function useCssModule(name?: string): Record<string, string>;
7
+ export declare function useCssModule(name?: string): Record<string, string>;
8
8
  /**
9
9
  * 注册编译器生成的响应式 CSS 变量。
10
10
  * @internal
11
11
  */
12
- declare function useCssVars(getter: (context: Record<string, any>) => Record<string, unknown>): ComputedRef<string>;
13
- //#endregion
14
- export { useCssModule, useCssVars };
12
+ export declare function useCssVars(getter: (context: Record<string, any>) => Record<string, unknown>): ComputedRef<string>;
13
+ //#endregion
@@ -1,12 +1,11 @@
1
1
  import { CreateAppOptions, DefineComponentOptions } from "./types/options.mjs";
2
2
  import "./types.mjs";
3
3
  //#region src/runtime/defaults.d.ts
4
- declare const INTERNAL_DEFAULTS_SCOPE_KEY = "__wevuDefaultsScope";
5
- interface WevuDefaults {
4
+ export declare const INTERNAL_DEFAULTS_SCOPE_KEY = "__wevuDefaultsScope";
5
+ export interface WevuDefaults {
6
6
  app?: Partial<CreateAppOptions<any, any, any>>;
7
7
  component?: Partial<DefineComponentOptions<any, any, any, any>>;
8
8
  }
9
- declare function setWevuDefaults(next: WevuDefaults): void;
10
- declare function resetWevuDefaults(): void;
11
- //#endregion
12
- export { INTERNAL_DEFAULTS_SCOPE_KEY, WevuDefaults, resetWevuDefaults, setWevuDefaults };
9
+ export declare function setWevuDefaults(next: WevuDefaults): void;
10
+ export declare function resetWevuDefaults(): void;
11
+ //#endregion
@@ -1 +1 @@
1
- import{hasOwn as e}from"../../utils.mjs";import{cloneSnapshotValue as t,isDeepEqualValue as n}from"../app/setData/snapshot.mjs";import{resolveDatasetEventValue as r,runInlineExpression as i}from"../register/inline.mjs";import{getOwnerProxy as a,getOwnerSnapshot as o,getOwnerTarget as s,subscribeOwner as c}from"../scopedSlots.mjs";import{clearTemplateRefs as l,scheduleTemplateRefUpdate as u}from"../templateRefs.mjs";import{WEVU_INLINE_HANDLER as d,WEVU_INLINE_MAP_KEY as f,WEVU_OWNER_HANDLER as p,WEVU_PROPS_DERIVED_KEYS_KEY as m,WEVU_PUBLIC_RUNTIME_KEY as h,WEVU_SLOT_FUNCTION_TOKEN as g,WEVU_SLOT_OWNER_ID_KEY as _,WEVU_SLOT_OWNER_ID_PROP as v,WEVU_SLOT_OWNER_KEY as y,WEVU_SLOT_OWNER_PROXY_KEY as b,WEVU_SLOT_PROPS_DATA_KEY as x,WEVU_SLOT_PROPS_KEY as S,WEVU_SLOT_SCOPE_KEY as C,WEVU_TEMPLATE_REFS_KEY as w}from"@weapp-core/constants";const T=[_,v,b,y,x,S,C],E=/&amp;/g,D=/&quot;/g,O=/&#34;/g,k=/&apos;/g,A=/&#39;/g,j=/&lt;/g,M=/&gt;/g;function N(e){return e.replace(E,`&`).replace(D,`"`).replace(O,`"`).replace(k,`'`).replace(A,`'`).replace(j,`<`).replace(M,`>`)}function P(e){var t,n,i,a;let o=(t=(n=e==null||(i=e.currentTarget)==null?void 0:i.dataset)==null?e==null||(a=e.target)==null?void 0:a.dataset:n)==null?{}:t,s=r(o,`wvArgs`,e),c=[];if(Array.isArray(s))c=s;else if(typeof s==`string`)try{c=JSON.parse(s)}catch(e){try{c=JSON.parse(N(s))}catch(e){c=[]}}return Array.isArray(c)||(c=[]),c.map(t=>t===`$event`?e:t)}function F(e){if(!e||typeof e!=`object`)return{};if(Array.isArray(e)){let t={};for(let n=0;n<e.length;n+=2){let r=e[n];typeof r==`string`&&r&&(t[r]=e[n+1])}return t}return e}function I(e){return Array.isArray(e)&&e[0]===g&&typeof e[1]==`string`}function L(e,t){return(...n)=>{var r;let i=e==null||(r=e.selectOwnerComponent)==null?void 0:r.call(e),a=i==null?void 0:i[d];if(typeof a!=`function`)return;let o={wd:1,wi:t[1]},s=Array.isArray(t[2])?t[2]:[],c=Array.isArray(t[3])?t[3]:[];s.forEach((e,t)=>o[`wvS${t}`]=e),c.forEach((e,t)=>o[`wvI${t}`]=e);let l={type:`wv-slot-function`,detail:n,currentTarget:{dataset:o},target:{dataset:o}};return a.call(i,l)}}function R(e,t){return Object.fromEntries(Object.entries(t).map(([t,n])=>[t,I(n)?L(e,n):n]))}function z(e){var t,n,r,i;return(t=(n=e==null||(r=e.__wevu)==null?void 0:r.proxy)==null?e==null||(i=e[h])==null?void 0:i.proxy:n)==null?e:t}function B(e,t){if(!t||Object.keys(t).length===0)return;let n=z(e),r={};for(let[e,i]of Object.entries(t))try{let t;typeof i==`function`?t=i.call(n):typeof(i==null?void 0:i.get)==`function`&&(t=i.get.call(n)),t!==void 0&&(r[e]=t)}catch(e){}return r}function V(e){var t,n;e==null||(t=e.__wevu)==null||(n=t.__wevu_flushSetupSnapshotSync)==null||n.call(t)}function H(r,i,a){var o;V(r);let s=B(r,i);if(!s||typeof(r==null?void 0:r.setData)!=`function`)return;let c=e(r,`__wvScopedSlotComputedSnapshot`),l=(o=r.__wvScopedSlotComputedSnapshot)==null?{}:o,u={},d={};for(let[r,i]of Object.entries(s))u[r]=t(i),(a!=null&&a.force||!c||!e(l,r)||!n(l[r],i,20,{keys:1e4}))&&(d[r]=i);for(let t of Object.keys(l))e(s,t)||(d[t]=null);r.__wvScopedSlotComputedSnapshot=u,Object.keys(d).length>0&&r.setData(d)}function U(r,i){var a,o,s,c,l;let u=e(i==null?{}:i,C)?i[C]:r==null||(a=r.properties)==null?void 0:a[C],d=e(i==null?{}:i,S)?i[S]:r==null||(o=r.properties)==null?void 0:o[S],f=F(u),p=F(d),m={...f,...p},h=!e(r,`__wvSlotPropsSnapshot`)||!n((s=r.__wvSlotPropsSnapshot)==null?{}:s,m,20,{keys:1e4}),g=h||!r[x]?R(r,m):r[x];h&&(r.__wvSlotPropsSnapshot=t(m)),r[x]=g;let _=r==null||(c=r.__wevu)==null?void 0:c.state,v=!(!_||typeof _!=`object`||e(_,x)&&n((l=_[x])==null?{}:l,m,20,{keys:1e4}));return _&&typeof _==`object`&&(_[x]=g),{merged:g,runtimeSnapshotChanged:v,snapshot:m,snapshotChanged:h}}function W(e,t,n){let{runtimeSnapshotChanged:r,snapshot:i,snapshotChanged:a}=U(e,n);(a||r)&&typeof(e==null?void 0:e.setData)==`function`&&e.setData({[x]:i}),a&&H(e,t)}function G(e,t){var n;let r=!1;e[b]!==t&&(e[b]=t,r=!0);let i=e==null?void 0:e.data;if(i&&typeof i==`object`&&i[b]!==t){try{Object.defineProperty(i,b,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(e){i[b]=t}r=!0}let a=e==null||(n=e.__wevu)==null?void 0:n.state;return a&&typeof a==`object`&&a[b]!==t&&(a[b]=t,r=!0),r}function K(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function q(e,n,r,i){if(typeof e==`function`){r[n]=e;return}if(typeof e!=`object`||!e)return e;if(i.has(e))return;if(Array.isArray(e)){i.add(e);let t=e.map((e,t)=>{let a=q(e,`${n}.${t}`,r,i);return a===void 0?null:a});return i.delete(e),t}if(!K(e))return t(e);i.add(e);let a={};for(let[t,o]of Object.entries(e)){let e=q(o,`${n}.${t}`,r,i);e!==void 0&&(a[t]=e)}return i.delete(e),a}function J(e){let t={},n=q(e,y,t,new WeakSet);return{[y]:n,...t}}function Y(r,i,a,o){var s;let c=G(r,a),{snapshotChanged:l}=U(r),u=i||{},d=!e(r,`__wvOwnerSnapshot`)||!n((s=r.__wvOwnerSnapshot)==null?{}:s,u,20,{keys:1e4});if(d){var f;r.__wvOwnerSnapshot=t(u),r[y]=u;let e=r==null||(f=r.__wevu)==null?void 0:f.state;e&&typeof e==`object`&&(e[y]=u)}d&&typeof(r==null?void 0:r.setData)==`function`&&r.setData(J(u)),(d||c||l)&&H(r,o)}function X(e,t,n){if(!t){typeof(e==null?void 0:e.__wvOwnerUnsub)==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerUnsub=void 0,e.__wvOwnerBoundId=``,G(e,void 0);return}let r=(t,r)=>{Y(e,t,r,n)};e.__wvOwnerBoundId!==t&&(typeof e.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerBoundId=t,e.__wvOwnerUnsub=c(t,r));let i=o(t);i&&r(i,a(t))}function Z(e){var t,n,r,i;return(t=(n=e==null||(r=e.properties)==null?void 0:r[v])==null?e==null||(i=e.properties)==null?void 0:i[_]:n)==null?``:t}function Q(e,t){W(e,t);let n=Z(e);n&&X(e,n,t)}function $(){let e={[y]:{},[x]:{}};return Object.defineProperty(e,b,{value:void 0,configurable:!0,enumerable:!1,writable:!0}),e}function ee(e){let t=e==null?void 0:e.computed,n=e==null?void 0:e.templateRefs,a=e=>{let t=Z(e);return t?s(t):void 0},o={options:{virtualHost:!0},setData:{omit:T},[m]:T,properties:{[v]:{type:String,value:``,observer(e){X(this,e||``,t)}},[_]:{type:String,value:``,observer(e){X(this,e||``,t)}},[S]:{type:null,value:null,observer(e){W(this,t,{[S]:e})}},[C]:{type:null,value:null,observer(e){W(this,t,{[C]:e})}}},data:$,lifetimes:{attached(){Q(this,t)},ready(){Q(this,t),H(this,t,{force:!0});let e=a(this);e&&u(this,void 0,e)},detached(){let e=a(this);e&&l(this,e),typeof this.__wvOwnerUnsub==`function`&&this.__wvOwnerUnsub(),this.__wvOwnerUnsub=void 0,this.__wvOwnerBoundId=``,G(this,void 0)}},methods:{[p](e){var t,n,a,o,s;let c=this[b],l=(t=this.__wevu)==null||(t=t.methods)==null?void 0:t[f],u=i(c,void 0,e,l);if(u!==void 0)return u;if(!c)return;let d=(n=(a=e==null||(o=e.currentTarget)==null?void 0:o.dataset)==null?e==null||(s=e.target)==null?void 0:s.dataset:a)==null?{}:n,p=r(d,`wvHandler`,e);if(typeof p!=`string`||!p)return;let m=c==null?void 0:c[p];if(typeof m!=`function`)return;let h=P(e);return m.apply(c,h)}}};return e!=null&&e.computed&&Object.keys(e.computed).length>0&&(o.computed=e.computed),e!=null&&e.inlineMap&&Object.keys(e.inlineMap).length>0&&(o.methods={...o.methods,[f]:e.inlineMap}),n!=null&&n.length&&(o[w]=n),o}export{ee as createScopedSlotOptions};
1
+ import{hasOwn as e}from"../../utils.mjs";import{cloneSnapshotValue as t,isDeepEqualValue as n}from"../app/setData/snapshot.mjs";import{resolveDatasetEventValue as r,runInlineExpression as i}from"../register/inline.mjs";import{getOwnerProxy as a,getOwnerSnapshot as o,getOwnerTarget as s,subscribeOwner as c}from"../scopedSlots.mjs";import{clearTemplateRefs as l,scheduleTemplateRefUpdate as u}from"../templateRefs.mjs";import{WEVU_INLINE_HANDLER as d,WEVU_INLINE_MAP_KEY as f,WEVU_OWNER_HANDLER as p,WEVU_PROPS_DERIVED_KEYS_KEY as m,WEVU_PUBLIC_RUNTIME_KEY as h,WEVU_SLOT_FUNCTION_TOKEN as g,WEVU_SLOT_OWNER_ID_KEY as _,WEVU_SLOT_OWNER_ID_PROP as v,WEVU_SLOT_OWNER_KEY as y,WEVU_SLOT_OWNER_PROXY_KEY as b,WEVU_SLOT_PROPS_DATA_KEY as x,WEVU_SLOT_PROPS_KEY as S,WEVU_SLOT_SCOPE_KEY as C,WEVU_TEMPLATE_REFS_KEY as w}from"@weapp-core/constants";const T=[_,v,b,y,x,S,C],E=/&amp;/g,D=/&quot;/g,O=/&#34;/g,k=/&apos;/g,A=/&#39;/g,j=/&lt;/g,M=/&gt;/g;function N(e){return e.replace(E,`&`).replace(D,`"`).replace(O,`"`).replace(k,`'`).replace(A,`'`).replace(j,`<`).replace(M,`>`)}function P(e){var t,n,i,a;let o=(t=(n=e==null||(i=e.currentTarget)==null?void 0:i.dataset)==null?e==null||(a=e.target)==null?void 0:a.dataset:n)==null?{}:t,s=r(o,`wvArgs`,e),c=[];if(Array.isArray(s))c=s;else if(typeof s==`string`)try{c=JSON.parse(s)}catch(e){try{c=JSON.parse(N(s))}catch(e){c=[]}}return Array.isArray(c)||(c=[]),c.map(t=>t===`$event`?e:t)}function F(e){if(!e||typeof e!=`object`)return{};if(Array.isArray(e)){let t={};for(let n=0;n<e.length;n+=2){let r=e[n];typeof r==`string`&&r&&(t[r]=e[n+1])}return t}return e}function I(e){return Array.isArray(e)&&e[0]===g&&typeof e[1]==`string`}function L(e,t){return(...n)=>{var r;let i=e==null||(r=e.selectOwnerComponent)==null?void 0:r.call(e),a=i==null?void 0:i[d];if(typeof a!=`function`)return;let o={wd:1,wi:t[1]},s=Array.isArray(t[2])?t[2]:[],c=Array.isArray(t[3])?t[3]:[];s.forEach((e,t)=>o[`wvS${t}`]=e),c.forEach((e,t)=>o[`wvI${t}`]=e);let l={type:`wv-slot-function`,detail:n,currentTarget:{dataset:o},target:{dataset:o}};return a.call(i,l)}}function R(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=I(i)?L(e,i):i;return n}function z(e){var t,n,r,i;return(t=(n=e==null||(r=e.__wevu)==null?void 0:r.proxy)==null?e==null||(i=e[h])==null?void 0:i.proxy:n)==null?e:t}function B(e,t){if(!t||Object.keys(t).length===0)return;let n=z(e),r={};for(let[e,i]of Object.entries(t))try{let t;typeof i==`function`?t=i.call(n):typeof(i==null?void 0:i.get)==`function`&&(t=i.get.call(n)),t!==void 0&&(r[e]=t)}catch(e){}return r}function V(e){var t,n;e==null||(t=e.__wevu)==null||(n=t.__wevu_flushSetupSnapshotSync)==null||n.call(t)}function H(r,i,a){var o;V(r);let s=B(r,i);if(!s||typeof(r==null?void 0:r.setData)!=`function`)return;let c=e(r,`__wvScopedSlotComputedSnapshot`),l=(o=r.__wvScopedSlotComputedSnapshot)==null?{}:o,u={},d={};for(let[r,i]of Object.entries(s))u[r]=t(i),(a!=null&&a.force||!c||!e(l,r)||!n(l[r],i,20,{keys:1e4}))&&(d[r]=i);for(let t of Object.keys(l))e(s,t)||(d[t]=null);r.__wvScopedSlotComputedSnapshot=u,Object.keys(d).length>0&&r.setData(d)}function U(r,i){var a,o,s,c,l;let u=e(i==null?{}:i,C)?i[C]:r==null||(a=r.properties)==null?void 0:a[C],d=e(i==null?{}:i,S)?i[S]:r==null||(o=r.properties)==null?void 0:o[S],f=F(u),p=F(d),m={...f,...p},h=!e(r,`__wvSlotPropsSnapshot`)||!n((s=r.__wvSlotPropsSnapshot)==null?{}:s,m,20,{keys:1e4}),g=h||!r[x]?R(r,m):r[x];h&&(r.__wvSlotPropsSnapshot=t(m)),r[x]=g;let _=r==null||(c=r.__wevu)==null?void 0:c.state,v=!(!_||typeof _!=`object`||e(_,x)&&n((l=_[x])==null?{}:l,m,20,{keys:1e4}));return _&&typeof _==`object`&&(_[x]=g),{merged:g,runtimeSnapshotChanged:v,snapshot:m,snapshotChanged:h}}function W(e,t,n){let{runtimeSnapshotChanged:r,snapshot:i,snapshotChanged:a}=U(e,n);(a||r)&&typeof(e==null?void 0:e.setData)==`function`&&e.setData({[x]:i}),a&&H(e,t)}function G(e,t){var n;let r=!1;e[b]!==t&&(e[b]=t,r=!0);let i=e==null?void 0:e.data;if(i&&typeof i==`object`&&i[b]!==t){try{Object.defineProperty(i,b,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(e){i[b]=t}r=!0}let a=e==null||(n=e.__wevu)==null?void 0:n.state;return a&&typeof a==`object`&&a[b]!==t&&(a[b]=t,r=!0),r}function K(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function q(e,n,r,i){if(typeof e==`function`){r[n]=e;return}if(typeof e!=`object`||!e)return e;if(i.has(e))return;if(Array.isArray(e)){i.add(e);let t=e.map((e,t)=>{let a=q(e,`${n}.${t}`,r,i);return a===void 0?null:a});return i.delete(e),t}if(!K(e))return t(e);i.add(e);let a={};for(let[t,o]of Object.entries(e)){let e=q(o,`${n}.${t}`,r,i);e!==void 0&&(a[t]=e)}return i.delete(e),a}function J(e){let t={},n=q(e,y,t,new WeakSet);return{[y]:n,...t}}function Y(r,i,a,o){var s;let c=G(r,a),{snapshotChanged:l}=U(r),u=i||{},d=!e(r,`__wvOwnerSnapshot`)||!n((s=r.__wvOwnerSnapshot)==null?{}:s,u,20,{keys:1e4});if(d){var f;r.__wvOwnerSnapshot=t(u),r[y]=u;let e=r==null||(f=r.__wevu)==null?void 0:f.state;e&&typeof e==`object`&&(e[y]=u)}d&&typeof(r==null?void 0:r.setData)==`function`&&r.setData(J(u)),(d||c||l)&&H(r,o)}function X(e,t,n){if(!t){typeof(e==null?void 0:e.__wvOwnerUnsub)==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerUnsub=void 0,e.__wvOwnerBoundId=``,G(e,void 0);return}let r=(t,r)=>{Y(e,t,r,n)};e.__wvOwnerBoundId!==t&&(typeof e.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerBoundId=t,e.__wvOwnerUnsub=c(t,r));let i=o(t);i&&r(i,a(t))}function Z(e){var t,n,r,i;return(t=(n=e==null||(r=e.properties)==null?void 0:r[v])==null?e==null||(i=e.properties)==null?void 0:i[_]:n)==null?``:t}function Q(e,t){W(e,t);let n=Z(e);n&&X(e,n,t)}function $(){let e={[y]:{},[x]:{}};return Object.defineProperty(e,b,{value:void 0,configurable:!0,enumerable:!1,writable:!0}),e}function ee(e){let t=e==null?void 0:e.computed,n=e==null?void 0:e.templateRefs,a=e=>{let t=Z(e);return t?s(t):void 0},o={options:{virtualHost:!0},setData:{omit:T},[m]:T,properties:{[v]:{type:String,value:``,observer(e){X(this,e||``,t)}},[_]:{type:String,value:``,observer(e){X(this,e||``,t)}},[S]:{type:null,value:null,observer(e){W(this,t,{[S]:e})}},[C]:{type:null,value:null,observer(e){W(this,t,{[C]:e})}}},data:$,lifetimes:{attached(){Q(this,t)},ready(){Q(this,t),H(this,t,{force:!0});let e=a(this);e&&u(this,void 0,e)},detached(){let e=a(this);e&&l(this,e),typeof this.__wvOwnerUnsub==`function`&&this.__wvOwnerUnsub(),this.__wvOwnerUnsub=void 0,this.__wvOwnerBoundId=``,G(this,void 0)}},methods:{[p](e){var t,n,a,o,s;let c=this[b],l=(t=this.__wevu)==null||(t=t.methods)==null?void 0:t[f],u=i(c,void 0,e,l);if(u!==void 0)return u;if(!c)return;let d=(n=(a=e==null||(o=e.currentTarget)==null?void 0:o.dataset)==null?e==null||(s=e.target)==null?void 0:s.dataset:a)==null?{}:n,p=r(d,`wvHandler`,e);if(typeof p!=`string`||!p)return;let m=c==null?void 0:c[p];if(typeof m!=`function`)return;let h=P(e);return m.apply(c,h)}}};return e!=null&&e.computed&&Object.keys(e.computed).length>0&&(o.computed=e.computed),e!=null&&e.inlineMap&&Object.keys(e.inlineMap).length>0&&(o.methods={...o.methods,[f]:e.inlineMap}),n!=null&&n.length&&(o[w]=n),o}export{ee as createScopedSlotOptions};