wevu 6.11.3 → 6.11.5

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,4 +1,4 @@
1
- //#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
1
+ //#region \0@oxc-project+runtime@0.121.0/helpers/typeof.js
2
2
  function _typeof(o) {
3
3
  "@babel/helpers - typeof";
4
4
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -8,7 +8,7 @@ function _typeof(o) {
8
8
  }, _typeof(o);
9
9
  }
10
10
  //#endregion
11
- //#region \0@oxc-project+runtime@0.115.0/helpers/toPrimitive.js
11
+ //#region \0@oxc-project+runtime@0.121.0/helpers/toPrimitive.js
12
12
  function toPrimitive(t, r) {
13
13
  if ("object" != _typeof(t) || !t) return t;
14
14
  var e = t[Symbol.toPrimitive];
@@ -20,13 +20,13 @@ function toPrimitive(t, r) {
20
20
  return ("string" === r ? String : Number)(t);
21
21
  }
22
22
  //#endregion
23
- //#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
23
+ //#region \0@oxc-project+runtime@0.121.0/helpers/toPropertyKey.js
24
24
  function toPropertyKey(t) {
25
25
  var i = toPrimitive(t, "string");
26
26
  return "symbol" == _typeof(i) ? i : i + "";
27
27
  }
28
28
  //#endregion
29
- //#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
29
+ //#region \0@oxc-project+runtime@0.121.0/helpers/defineProperty.js
30
30
  function _defineProperty(e, r, t) {
31
31
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
32
32
  value: t,
package/dist/fetch.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as _defineProperty } from "./defineProperty-JH0tR899.mjs";
1
+ import { t as _defineProperty } from "./defineProperty-BZYESRfZ.mjs";
2
2
  import { wpi } from "@wevu/api";
3
3
  //#region src/fetch.ts
4
4
  let _Symbol$iterator, _Symbol$toStringTag;
package/dist/index.d.mts CHANGED
@@ -397,6 +397,7 @@ interface InternalRuntimeStateFields {
397
397
  __wevu?: RuntimeInstance<any, any, any>;
398
398
  __wevuSetPageLayout?: (layout: string | false, props?: Record<string, any>) => void;
399
399
  __wevuWatchStops?: WatchStopHandle[];
400
+ __wevuLayoutHostBridge?: Record<string, any>;
400
401
  $wevu?: RuntimeInstance<any, any, any>;
401
402
  __wevuHooks?: Record<string, any>;
402
403
  __wevuExposed?: Record<string, any>;
@@ -1071,6 +1072,61 @@ type UseIntersectionObserverResult = WechatMiniprogram.IntersectionObserver;
1071
1072
  */
1072
1073
  declare function useIntersectionObserver(options?: UseIntersectionObserverOptions): UseIntersectionObserverResult;
1073
1074
  //#endregion
1075
+ //#region src/runtime/layoutBridge.d.ts
1076
+ type LayoutBridgeContext = Record<string, any>;
1077
+ type LayoutBridgeComponentResolver = (selector: string) => any;
1078
+ type LayoutHostMap = Record<string, unknown>;
1079
+ interface LayoutHostBinding {
1080
+ key: string;
1081
+ refName?: string;
1082
+ selector: string;
1083
+ kind?: 'component';
1084
+ }
1085
+ interface LayoutHostResolveOptions<T = any> {
1086
+ context?: T;
1087
+ fallbackContext?: T;
1088
+ interval?: number;
1089
+ retries?: number;
1090
+ }
1091
+ /**
1092
+ * 为当前页面注册 layout bridge,使页面或子组件可消费 layout 内部能力。
1093
+ */
1094
+ declare function registerPageLayoutBridge(selectors: string | string[], context?: LayoutBridgeContext): boolean;
1095
+ /**
1096
+ * 移除当前页面的 layout bridge 注册。
1097
+ */
1098
+ declare function unregisterPageLayoutBridge(selectors: string | string[], context?: LayoutBridgeContext): boolean;
1099
+ /**
1100
+ * 解析当前页面已注册的 layout bridge,找不到时回退到传入上下文。
1101
+ */
1102
+ declare function resolveLayoutBridge<T = any>(selector: string, fallbackContext?: T): T | undefined;
1103
+ /**
1104
+ * 解析当前页面 layout 内通过指定 key 暴露的宿主实例。
1105
+ */
1106
+ declare function resolveLayoutHost<T = any, C = any>(key: string, options?: LayoutHostResolveOptions<C>): T | null;
1107
+ /**
1108
+ * 等待当前页面 layout 宿主实例可用,适合页面初次进入时的异步宿主解析。
1109
+ */
1110
+ declare function waitForLayoutHost<T = any, C = any>(key: string, options?: LayoutHostResolveOptions<C>): Promise<T | null>;
1111
+ /**
1112
+ * 在 layout 生命周期内暴露 bridge,使页面或子组件可访问 layout 内部实例。
1113
+ */
1114
+ declare function useLayoutBridge(selectors: string | string[], options?: {
1115
+ resolveComponent?: LayoutBridgeComponentResolver;
1116
+ }): void;
1117
+ /**
1118
+ * 使用编译期注入的宿主绑定信息,直接从当前 layout 运行时实例解析子组件宿主并注册 bridge。
1119
+ */
1120
+ declare function registerRuntimeLayoutHosts(bindings: LayoutHostBinding[], context?: LayoutBridgeContext): any;
1121
+ /**
1122
+ * 移除运行时自动注册的 layout 宿主 bridge。
1123
+ */
1124
+ declare function unregisterRuntimeLayoutHosts(bindings: LayoutHostBinding[], context?: LayoutBridgeContext): boolean;
1125
+ /**
1126
+ * 使用 key -> 宿主实例的映射批量暴露 layout 内部宿主,适合 toast/dialog 等共享反馈节点。
1127
+ */
1128
+ declare function useLayoutHosts(hosts: LayoutHostMap): void;
1129
+ //#endregion
1074
1130
  //#region src/runtime/noSetData.d.ts
1075
1131
  declare function markNoSetData<T extends object>(value: T): T;
1076
1132
  declare function isNoSetData(value: unknown): boolean;
@@ -1437,4 +1493,4 @@ declare function defineModel<T = any, M extends PropertyKey = string, G = T, S =
1437
1493
  declare function defineModel<T = any, M extends PropertyKey = string, G = T, S = T>(options?: DefineModelBaseOptions<T | undefined, M, G | undefined, S | undefined>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
1438
1494
  declare function defineModel<T = any, M extends PropertyKey = string, G = T, S = T>(name?: string, options?: DefineModelBaseOptions<T | undefined, M, G | undefined, S | undefined>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
1439
1495
  //#endregion
1440
- export { ActionContext, ActionSubscriber, type AllowedComponentProps, type AppConfig, type ComponentCustomProps, ComponentDefinition, type ComponentOptionsMixin, type ComponentPropsOptions, type ComponentPublicInstance, type ComponentTypeEmits, type ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, type CreateAppOptions, CustomRefFactory, CustomRefOptions, CustomRefSource, type DataOption, type DefineAppOptions, type DefineComponent, type DefineComponentOptions, DefineComponentTypePropsOptions, DefineComponentWithTypeProps, DefineModelModifiers, DefineModelTransformOptions, DefineStoreOptions, DisposableBag, DisposableLike, DisposableMethodName, DisposableObject, EffectScope, type EmitFn, type EmitsOptions, type ExtractComputed, type ExtractDefaultPropTypes, type ExtractMethods, type ExtractPropTypes, type ExtractPublicPropTypes, GlobalComponents, GlobalDirectives, type InferNativePropType, type InferNativeProps, type InferPropType, type InferProps, type InternalRuntimeState, type InternalRuntimeStateFields, type MapSources, MaybeRef, MaybeRefOrGetter, type MaybeUndefined, type MethodDefinitions, type MiniProgramAdapter, type MiniProgramAppOptions, type MiniProgramBehaviorIdentifier, type MiniProgramComponentBehaviorOptions, type MiniProgramComponentOptions, type MiniProgramComponentRawOptions, type MiniProgramInstance, type MiniProgramPageLifetimes, type ModelBinding, type ModelBindingOptions, type ModelBindingPayload, ModelModifiers, ModelRef, type MultiWatchSources, type MutationKind, type MutationOp, type MutationRecord, MutationType, type NativeComponent, type NativePropType, type NativePropsOptions, type NativeTypeHint, type NativeTypedProperty, type ObjectDirective, type OnCleanup, type PageFeatures, PageLayoutMeta, PageLayoutState, PageMeta, type PrelinkReactiveTreeOptions, type PropConstructor, type PropOptions, type PropType, type PublicProps, Ref, type RuntimeApp, type RuntimeInstance, type SetDataDebugInfo, type SetDataSnapshotOptions, type SetupContext, type SetupContextNativeInstance, type SetupContextRouter, SetupContextWithTypeProps, type SetupFunction, SetupFunctionWithTypeProps, ShallowRef, type ShallowUnwrapRef, StoreManager, StoreSubscribeOptions, StoreToRefsResult, SubscriptionCallback, TemplateRef, TemplateRefValue, TemplateRefs, ToRefs, type TriggerEventOptions, UpdatePerformanceListener, UpdatePerformanceListenerResult, UseIntersectionObserverOptions, UseIntersectionObserverResult, UseModelOptions, UsePageScrollThrottleOptions, UsePageScrollThrottleStopHandle, UseUpdatePerformanceListenerStopHandle, type VNode, type VNodeProps, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, WevuComponentConstructor, WevuDefaults, WevuGlobalComponents, WevuGlobalDirectives, WevuPageLayoutMap, type WevuPlugin, type WevuTypedRouterRouteMap, WritableComputedOptions, WritableComputedRef, addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, createWevuScopedSlotComponent, customRef, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, definePageMeta, defineProps, defineSlots, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getReactiveVersion, hasInjectionContext, inject, injectGlobal, isNoSetData, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, removeMutationRecorder, resetWevuDefaults, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, storeToRefs, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, teardownRuntimeInstance, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, useAttrs, useBindModel, useDisposables, useIntersectionObserver, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, usePageLayout, usePageScrollThrottle, useSlots, useTemplateRef, useUpdatePerformanceListener, watch, watchEffect, withDefaults };
1496
+ export { ActionContext, ActionSubscriber, type AllowedComponentProps, type AppConfig, type ComponentCustomProps, ComponentDefinition, type ComponentOptionsMixin, type ComponentPropsOptions, type ComponentPublicInstance, type ComponentTypeEmits, type ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, type CreateAppOptions, CustomRefFactory, CustomRefOptions, CustomRefSource, type DataOption, type DefineAppOptions, type DefineComponent, type DefineComponentOptions, DefineComponentTypePropsOptions, DefineComponentWithTypeProps, DefineModelModifiers, DefineModelTransformOptions, DefineStoreOptions, DisposableBag, DisposableLike, DisposableMethodName, DisposableObject, EffectScope, type EmitFn, type EmitsOptions, type ExtractComputed, type ExtractDefaultPropTypes, type ExtractMethods, type ExtractPropTypes, type ExtractPublicPropTypes, GlobalComponents, GlobalDirectives, type InferNativePropType, type InferNativeProps, type InferPropType, type InferProps, type InternalRuntimeState, type InternalRuntimeStateFields, LayoutHostBinding, type MapSources, MaybeRef, MaybeRefOrGetter, type MaybeUndefined, type MethodDefinitions, type MiniProgramAdapter, type MiniProgramAppOptions, type MiniProgramBehaviorIdentifier, type MiniProgramComponentBehaviorOptions, type MiniProgramComponentOptions, type MiniProgramComponentRawOptions, type MiniProgramInstance, type MiniProgramPageLifetimes, type ModelBinding, type ModelBindingOptions, type ModelBindingPayload, ModelModifiers, ModelRef, type MultiWatchSources, type MutationKind, type MutationOp, type MutationRecord, MutationType, type NativeComponent, type NativePropType, type NativePropsOptions, type NativeTypeHint, type NativeTypedProperty, type ObjectDirective, type OnCleanup, type PageFeatures, PageLayoutMeta, PageLayoutState, PageMeta, type PrelinkReactiveTreeOptions, type PropConstructor, type PropOptions, type PropType, type PublicProps, Ref, type RuntimeApp, type RuntimeInstance, type SetDataDebugInfo, type SetDataSnapshotOptions, type SetupContext, type SetupContextNativeInstance, type SetupContextRouter, SetupContextWithTypeProps, type SetupFunction, SetupFunctionWithTypeProps, ShallowRef, type ShallowUnwrapRef, StoreManager, StoreSubscribeOptions, StoreToRefsResult, SubscriptionCallback, TemplateRef, TemplateRefValue, TemplateRefs, ToRefs, type TriggerEventOptions, UpdatePerformanceListener, UpdatePerformanceListenerResult, UseIntersectionObserverOptions, UseIntersectionObserverResult, UseModelOptions, UsePageScrollThrottleOptions, UsePageScrollThrottleStopHandle, UseUpdatePerformanceListenerStopHandle, type VNode, type VNodeProps, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, WevuComponentConstructor, WevuDefaults, WevuGlobalComponents, WevuGlobalDirectives, WevuPageLayoutMap, type WevuPlugin, type WevuTypedRouterRouteMap, WritableComputedOptions, WritableComputedRef, addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, createWevuScopedSlotComponent, customRef, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, definePageMeta, defineProps, defineSlots, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getReactiveVersion, hasInjectionContext, inject, injectGlobal, isNoSetData, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, registerPageLayoutBridge, registerRuntimeLayoutHosts, removeMutationRecorder, resetWevuDefaults, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, storeToRefs, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, teardownRuntimeInstance, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, useAttrs, useBindModel, useDisposables, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, usePageLayout, usePageScrollThrottle, useSlots, useTemplateRef, useUpdatePerformanceListener, waitForLayoutHost, watch, watchEffect, withDefaults };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { A as track, C as effect, D as onScopeDispose, E as getCurrentScope, M as triggerEffects, N as nextTick, O as startBatch, P as queueJob, S as batch, T as endBatch, _ as ReactiveFlags, a as toValue, b as addMutationRecorder, c as isRaw, d as reactive, f as isShallowReactive, g as touchReactive, h as prelinkReactiveTree, i as ref, j as trigger, k as stop, l as isReactive, m as clearPatchIndices, n as isRef, o as unref, p as shallowReactive, r as markAsRef, s as getReactiveVersion, t as customRef, u as markRaw, v as isObject$1, w as effectScope, x as removeMutationRecorder, y as toRaw } from "./ref-BjmD-qct.mjs";
2
- import { i as computed, n as defineStore, r as createStore, t as storeToRefs } from "./store-Ct-o7qtH.mjs";
3
- import { A as onUnhandledRejection, B as getMiniProgramGlobalObject, C as onRouteDone, D as onShow, E as onShareTimeline, F as getCurrentInstance, H as readonly, I as getCurrentSetupContext, L as pushHook, M as assertInSetup, N as callHookList, O as onTabItemTap, P as callHookReturn, R as setCurrentInstance, S as onResize, T as onShareAppMessage, U as shallowReadonly, V as getScopedSlotHostGlobalObject, _ as onPageNotFound, a as injectGlobal, b as onReachBottom, c as onAddToFavorites, d as onError, f as onHide, g as onMoved, h as onMemoryWarning, i as inject, j as onUnload, k as onThemeChange, l as onAttached, m as onLoad, n as useNativeRouter, o as provide, p as onLaunch, r as hasInjectionContext, s as provideGlobal, t as useNativePageRouter, u as onDetached, v as onPageScroll, w as onSaveExitState, x as onReady, y as onPullDownRefresh, z as setCurrentSetupContext } from "./router-PqZEeqhd.mjs";
1
+ import { A as track, C as effect, D as onScopeDispose, E as getCurrentScope, M as triggerEffects, N as nextTick, O as startBatch, P as queueJob, S as batch, T as endBatch, _ as ReactiveFlags, a as toValue, b as addMutationRecorder, c as isRaw, d as reactive, f as isShallowReactive, g as touchReactive, h as prelinkReactiveTree, i as ref, j as trigger, k as stop, l as isReactive, m as clearPatchIndices, n as isRef, o as unref, p as shallowReactive, r as markAsRef, s as getReactiveVersion, t as customRef, u as markRaw, v as isObject$1, w as effectScope, x as removeMutationRecorder, y as toRaw } from "./ref-B37H82Eg.mjs";
2
+ import { i as computed, n as defineStore, r as createStore, t as storeToRefs } from "./store-DDjlcddD.mjs";
3
+ import { A as onUnhandledRejection, B as getMiniProgramGlobalObject, C as onRouteDone, D as onShow, E as onShareTimeline, F as getCurrentInstance, H as readonly, I as getCurrentSetupContext, L as pushHook, M as assertInSetup, N as callHookList, O as onTabItemTap, P as callHookReturn, R as setCurrentInstance, S as onResize, T as onShareAppMessage, U as shallowReadonly, V as getScopedSlotHostGlobalObject, _ as onPageNotFound, a as injectGlobal, b as onReachBottom, c as onAddToFavorites, d as onError, f as onHide, g as onMoved, h as onMemoryWarning, i as inject, j as onUnload, k as onThemeChange, l as onAttached, m as onLoad, n as useNativeRouter, o as provide, p as onLaunch, r as hasInjectionContext, s as provideGlobal, t as useNativePageRouter, u as onDetached, v as onPageScroll, w as onSaveExitState, x as onReady, y as onPullDownRefresh, z as setCurrentSetupContext } from "./router-DHeyqsP-.mjs";
4
4
  //#region src/reactivity/shallowRef.ts
5
5
  /**
6
6
  * 创建一个“浅层” ref:它只在 .value 被整体替换时触发依赖,不会对内部对象做深层响应式处理。
@@ -124,6 +124,81 @@ function traverse(value, depth = Infinity, seen = /* @__PURE__ */ new Map()) {
124
124
  return value;
125
125
  }
126
126
  //#endregion
127
+ //#region src/runtime/hooks/vue.ts
128
+ /**
129
+ * Vue 3 对齐:组件/页面已挂载,映射小程序 onReady
130
+ */
131
+ function onMounted(handler) {
132
+ pushHook(assertInSetup("onMounted"), "onReady", handler);
133
+ }
134
+ /**
135
+ * Vue 3 对齐:组件/页面更新后触发。
136
+ * 小程序没有专用 update 生命周期,这里在每次 setData 完成后调用。
137
+ */
138
+ function onUpdated(handler) {
139
+ pushHook(assertInSetup("onUpdated"), "__wevuOnUpdated", handler);
140
+ }
141
+ /**
142
+ * Vue 3 对齐:卸载前触发。
143
+ * 小程序无 before-unload 生命周期,setup 时同步执行以保持语义。
144
+ */
145
+ function onBeforeUnmount(handler) {
146
+ assertInSetup("onBeforeUnmount");
147
+ handler();
148
+ }
149
+ /**
150
+ * Vue 3 对齐:组件/页面卸载;映射到页面 onUnload 或组件 detached
151
+ */
152
+ function onUnmounted(handler) {
153
+ pushHook(assertInSetup("onUnmounted"), "onUnload", handler);
154
+ }
155
+ /**
156
+ * Vue 3 对齐:挂载前;setup 时同步触发以模拟 beforeMount 语义
157
+ */
158
+ function onBeforeMount(handler) {
159
+ assertInSetup("onBeforeMount");
160
+ handler();
161
+ }
162
+ /**
163
+ * Vue 3 对齐:更新前;在每次 setData 前触发
164
+ */
165
+ function onBeforeUpdate(handler) {
166
+ pushHook(assertInSetup("onBeforeUpdate"), "__wevuOnBeforeUpdate", handler);
167
+ }
168
+ /**
169
+ * Vue 3 对齐:错误捕获;映射到小程序 onError
170
+ */
171
+ function onErrorCaptured(handler) {
172
+ const instance = assertInSetup("onErrorCaptured");
173
+ pushHook(instance, "onError", (err) => handler(err, instance, ""));
174
+ }
175
+ /**
176
+ * Vue 3 对齐:组件激活;映射到小程序 onShow
177
+ */
178
+ function onActivated(handler) {
179
+ pushHook(assertInSetup("onActivated"), "onShow", handler);
180
+ }
181
+ /**
182
+ * Vue 3 对齐:组件失活;映射到小程序 onHide
183
+ */
184
+ function onDeactivated(handler) {
185
+ pushHook(assertInSetup("onDeactivated"), "onHide", handler);
186
+ }
187
+ /**
188
+ * Vue 3 对齐:服务端渲染前置钩子。
189
+ * 小程序无此场景,保留空实现以保持 API 兼容。
190
+ */
191
+ function onServerPrefetch(_handler) {
192
+ assertInSetup("onServerPrefetch");
193
+ }
194
+ /**
195
+ * 派发更新阶段钩子(框架内部调度入口)。
196
+ * @internal
197
+ */
198
+ function callUpdateHooks(target, phase) {
199
+ callHookList(target, phase === "before" ? "__wevuOnBeforeUpdate" : "__wevuOnUpdated");
200
+ }
201
+ //#endregion
127
202
  //#region src/reactivity/watch/types.ts
128
203
  let __deepWatchStrategy = "version";
129
204
  /**
@@ -207,6 +282,7 @@ function dispatchScheduledJob(job, flush, isFirstRun, scheduler) {
207
282
  //#region src/reactivity/watch.ts
208
283
  function watch(source, cb, options = {}) {
209
284
  var _options$flush;
285
+ const ownerInstance = getCurrentInstance();
210
286
  const watchGetterContext = createWatchGetter(source);
211
287
  const getter = applyDeepWatchGetter(watchGetterContext.getter, source, watchGetterContext.isMultiSource, watchGetterContext.isReactiveSource, options.deep);
212
288
  let cleanup;
@@ -228,7 +304,13 @@ function watch(source, cb, options = {}) {
228
304
  if (!runner.active || paused || token !== pauseToken) return;
229
305
  const newValue = runner();
230
306
  cleanup === null || cleanup === void 0 || cleanup();
231
- cbWithOnce(newValue, oldValue, onCleanup);
307
+ const previousInstance = getCurrentInstance();
308
+ setCurrentInstance(ownerInstance);
309
+ try {
310
+ cbWithOnce(newValue, oldValue, onCleanup);
311
+ } finally {
312
+ setCurrentInstance(previousInstance);
313
+ }
232
314
  oldValue = newValue;
233
315
  };
234
316
  const scheduledJob = () => runJob(scheduledToken);
@@ -272,6 +354,7 @@ function watch(source, cb, options = {}) {
272
354
  */
273
355
  function watchEffect(effectFn, options = {}) {
274
356
  var _options$flush2;
357
+ const ownerInstance = getCurrentInstance();
275
358
  let cleanup;
276
359
  const onCleanup = (fn) => {
277
360
  cleanup = fn;
@@ -293,7 +376,13 @@ function watchEffect(effectFn, options = {}) {
293
376
  runner = effect(() => {
294
377
  cleanup === null || cleanup === void 0 || cleanup();
295
378
  cleanup = void 0;
296
- effectFn(onCleanup);
379
+ const previousInstance = getCurrentInstance();
380
+ setCurrentInstance(ownerInstance);
381
+ try {
382
+ effectFn(onCleanup);
383
+ } finally {
384
+ setCurrentInstance(previousInstance);
385
+ }
297
386
  }, {
298
387
  lazy: true,
299
388
  scheduler: () => {
@@ -1678,81 +1767,6 @@ function applyWevuComponentDefaults(options) {
1678
1767
  return mergeWithDefaults(currentDefaults.component, options);
1679
1768
  }
1680
1769
  //#endregion
1681
- //#region src/runtime/hooks/vue.ts
1682
- /**
1683
- * Vue 3 对齐:组件/页面已挂载,映射小程序 onReady
1684
- */
1685
- function onMounted(handler) {
1686
- pushHook(assertInSetup("onMounted"), "onReady", handler);
1687
- }
1688
- /**
1689
- * Vue 3 对齐:组件/页面更新后触发。
1690
- * 小程序没有专用 update 生命周期,这里在每次 setData 完成后调用。
1691
- */
1692
- function onUpdated(handler) {
1693
- pushHook(assertInSetup("onUpdated"), "__wevuOnUpdated", handler);
1694
- }
1695
- /**
1696
- * Vue 3 对齐:卸载前触发。
1697
- * 小程序无 before-unload 生命周期,setup 时同步执行以保持语义。
1698
- */
1699
- function onBeforeUnmount(handler) {
1700
- assertInSetup("onBeforeUnmount");
1701
- handler();
1702
- }
1703
- /**
1704
- * Vue 3 对齐:组件/页面卸载;映射到页面 onUnload 或组件 detached
1705
- */
1706
- function onUnmounted(handler) {
1707
- pushHook(assertInSetup("onUnmounted"), "onUnload", handler);
1708
- }
1709
- /**
1710
- * Vue 3 对齐:挂载前;setup 时同步触发以模拟 beforeMount 语义
1711
- */
1712
- function onBeforeMount(handler) {
1713
- assertInSetup("onBeforeMount");
1714
- handler();
1715
- }
1716
- /**
1717
- * Vue 3 对齐:更新前;在每次 setData 前触发
1718
- */
1719
- function onBeforeUpdate(handler) {
1720
- pushHook(assertInSetup("onBeforeUpdate"), "__wevuOnBeforeUpdate", handler);
1721
- }
1722
- /**
1723
- * Vue 3 对齐:错误捕获;映射到小程序 onError
1724
- */
1725
- function onErrorCaptured(handler) {
1726
- const instance = assertInSetup("onErrorCaptured");
1727
- pushHook(instance, "onError", (err) => handler(err, instance, ""));
1728
- }
1729
- /**
1730
- * Vue 3 对齐:组件激活;映射到小程序 onShow
1731
- */
1732
- function onActivated(handler) {
1733
- pushHook(assertInSetup("onActivated"), "onShow", handler);
1734
- }
1735
- /**
1736
- * Vue 3 对齐:组件失活;映射到小程序 onHide
1737
- */
1738
- function onDeactivated(handler) {
1739
- pushHook(assertInSetup("onDeactivated"), "onHide", handler);
1740
- }
1741
- /**
1742
- * Vue 3 对齐:服务端渲染前置钩子。
1743
- * 小程序无此场景,保留空实现以保持 API 兼容。
1744
- */
1745
- function onServerPrefetch(_handler) {
1746
- assertInSetup("onServerPrefetch");
1747
- }
1748
- /**
1749
- * 派发更新阶段钩子(框架内部调度入口)。
1750
- * @internal
1751
- */
1752
- function callUpdateHooks(target, phase) {
1753
- callHookList(target, phase === "before" ? "__wevuOnBeforeUpdate" : "__wevuOnUpdated");
1754
- }
1755
- //#endregion
1756
1770
  //#region src/runtime/register/inline.ts
1757
1771
  const AMP_RE$1 = /&amp;/g;
1758
1772
  const QUOT_RE$1 = /&quot;/g;
@@ -1880,6 +1894,148 @@ function runInlineExpression(ctx, expr, event, inlineMap) {
1880
1894
  if (typeof handler === "function") return handler.apply(ctx, resolvedArgs);
1881
1895
  }
1882
1896
  //#endregion
1897
+ //#region src/runtime/register/component/lifecycle/platform.ts
1898
+ let wxPatched = false;
1899
+ let currentPageInstance;
1900
+ const PAGE_SCROLL_HOOK_DEPTH_KEY = "__wevuPageScrollHookDepth";
1901
+ function getCurrentPageInstance() {
1902
+ return currentPageInstance;
1903
+ }
1904
+ function bindCurrentPageInstance(target) {
1905
+ currentPageInstance = target;
1906
+ }
1907
+ function releaseCurrentPageInstance(target) {
1908
+ if (currentPageInstance === target) currentPageInstance = void 0;
1909
+ }
1910
+ function runInPageScrollHook(target, task) {
1911
+ var _PAGE_SCROLL_HOOK_DEP;
1912
+ target[PAGE_SCROLL_HOOK_DEPTH_KEY] = Number((_PAGE_SCROLL_HOOK_DEP = target[PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _PAGE_SCROLL_HOOK_DEP !== void 0 ? _PAGE_SCROLL_HOOK_DEP : 0) + 1;
1913
+ try {
1914
+ return task();
1915
+ } finally {
1916
+ var _PAGE_SCROLL_HOOK_DEP2;
1917
+ const nextDepth = Number((_PAGE_SCROLL_HOOK_DEP2 = target[PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _PAGE_SCROLL_HOOK_DEP2 !== void 0 ? _PAGE_SCROLL_HOOK_DEP2 : 1) - 1;
1918
+ if (nextDepth <= 0) delete target[PAGE_SCROLL_HOOK_DEPTH_KEY];
1919
+ else target[PAGE_SCROLL_HOOK_DEPTH_KEY] = nextDepth;
1920
+ }
1921
+ }
1922
+ function resolvePageOptions(target) {
1923
+ const direct = target.options;
1924
+ if (direct && typeof direct === "object") return direct;
1925
+ if (typeof getCurrentPages === "function") {
1926
+ const pages = getCurrentPages();
1927
+ const page = Array.isArray(pages) ? pages.at(-1) : void 0;
1928
+ const options = page && typeof page === "object" ? page.options : void 0;
1929
+ if (options && typeof options === "object") return options;
1930
+ }
1931
+ return {};
1932
+ }
1933
+ function ensureWxPatched() {
1934
+ if (wxPatched) return;
1935
+ wxPatched = true;
1936
+ const wxGlobal = getMiniProgramGlobalObject();
1937
+ if (!wxGlobal || typeof wxGlobal !== "object") return;
1938
+ const rawStartPullDownRefresh = wxGlobal.startPullDownRefresh;
1939
+ if (typeof rawStartPullDownRefresh === "function") wxGlobal.startPullDownRefresh = function startPullDownRefreshPatched(...args) {
1940
+ const result = rawStartPullDownRefresh.apply(this, args);
1941
+ if (currentPageInstance) callHookList(currentPageInstance, "onPullDownRefresh", []);
1942
+ return result;
1943
+ };
1944
+ const rawPageScrollTo = wxGlobal.pageScrollTo;
1945
+ if (typeof rawPageScrollTo === "function") wxGlobal.pageScrollTo = function pageScrollToPatched(options, ...rest) {
1946
+ const result = rawPageScrollTo.apply(this, [options, ...rest]);
1947
+ if (currentPageInstance) {
1948
+ const pageInstance = currentPageInstance;
1949
+ runInPageScrollHook(pageInstance, () => {
1950
+ callHookList(pageInstance, "onPageScroll", [options !== null && options !== void 0 ? options : {}]);
1951
+ });
1952
+ }
1953
+ return result;
1954
+ };
1955
+ }
1956
+ function ensurePageShareMenus(options) {
1957
+ const { enableOnShareAppMessage, enableOnShareTimeline } = options;
1958
+ if (!enableOnShareAppMessage && !enableOnShareTimeline) return;
1959
+ const wxGlobal = getMiniProgramGlobalObject();
1960
+ if (!wxGlobal || typeof wxGlobal.showShareMenu !== "function") return;
1961
+ const showMenu = (payload) => {
1962
+ try {
1963
+ wxGlobal.showShareMenu(payload);
1964
+ } catch (_unused) {}
1965
+ };
1966
+ if (!(enableOnShareAppMessage || enableOnShareTimeline)) return;
1967
+ const menus = ["shareAppMessage"];
1968
+ if (enableOnShareTimeline) menus.push("shareTimeline");
1969
+ showMenu({
1970
+ withShareTicket: true,
1971
+ menus
1972
+ });
1973
+ }
1974
+ //#endregion
1975
+ //#region src/runtime/pageLayout.ts
1976
+ const PAGE_LAYOUT_SETTER_KEY = "__wevuSetPageLayout";
1977
+ const NO_LAYOUT_RUNTIME_KEY = "__wv_no_layout";
1978
+ function resolveCurrentPageInstance$1() {
1979
+ const runtimeCurrentPage = getCurrentPageInstance();
1980
+ if (runtimeCurrentPage) return runtimeCurrentPage;
1981
+ const getCurrentPagesFn = globalThis.getCurrentPages;
1982
+ if (typeof getCurrentPagesFn !== "function") return;
1983
+ return getCurrentPagesFn().at(-1);
1984
+ }
1985
+ function normalizeRuntimePageLayoutName(layout) {
1986
+ return layout === NO_LAYOUT_RUNTIME_KEY ? false : layout;
1987
+ }
1988
+ /**
1989
+ * 获取当前页面 layout 状态。
1990
+ */
1991
+ function usePageLayout() {
1992
+ var _currentInstance$__we, _runtimeState$__wv_pa;
1993
+ if (!getCurrentSetupContext()) throw new Error("usePageLayout() 必须在 setup() 的同步阶段调用");
1994
+ const currentInstance = getCurrentInstance();
1995
+ const runtimeState = currentInstance === null || currentInstance === void 0 || (_currentInstance$__we = currentInstance.__wevu) === null || _currentInstance$__we === void 0 ? void 0 : _currentInstance$__we.state;
1996
+ const pageLayoutState = reactive({
1997
+ name: normalizeRuntimePageLayoutName(runtimeState === null || runtimeState === void 0 ? void 0 : runtimeState.__wv_page_layout_name),
1998
+ props: { ...(_runtimeState$__wv_pa = runtimeState === null || runtimeState === void 0 ? void 0 : runtimeState.__wv_page_layout_props) !== null && _runtimeState$__wv_pa !== void 0 ? _runtimeState$__wv_pa : {} }
1999
+ });
2000
+ if (currentInstance) currentInstance.__wevuPageLayoutState = pageLayoutState;
2001
+ return readonly(pageLayoutState);
2002
+ }
2003
+ function syncRuntimePageLayoutState(target, layout, props) {
2004
+ const state = target.__wevuPageLayoutState;
2005
+ if (!state) return;
2006
+ state.name = layout;
2007
+ state.props = { ...props };
2008
+ }
2009
+ function syncRuntimePageLayoutStateFromRuntime(target) {
2010
+ var _target$__wevu, _runtimeState$__wv_pa2;
2011
+ const state = target.__wevuPageLayoutState;
2012
+ const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
2013
+ if (!state || !runtimeState) return;
2014
+ state.name = normalizeRuntimePageLayoutName(runtimeState.__wv_page_layout_name);
2015
+ state.props = { ...(_runtimeState$__wv_pa2 = runtimeState.__wv_page_layout_props) !== null && _runtimeState$__wv_pa2 !== void 0 ? _runtimeState$__wv_pa2 : {} };
2016
+ }
2017
+ /**
2018
+ * 显式切换当前页面使用的 layout。
2019
+ */
2020
+ function setPageLayout(layout, props) {
2021
+ const currentInstance = getCurrentInstance();
2022
+ const directSetter = currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance[PAGE_LAYOUT_SETTER_KEY];
2023
+ if (typeof directSetter === "function") {
2024
+ directSetter(layout, props);
2025
+ return;
2026
+ }
2027
+ const currentPage = resolveCurrentPageInstance$1();
2028
+ const pageSetter = currentPage === null || currentPage === void 0 ? void 0 : currentPage[PAGE_LAYOUT_SETTER_KEY];
2029
+ if (typeof pageSetter === "function") {
2030
+ pageSetter(layout, props);
2031
+ return;
2032
+ }
2033
+ throw new Error("setPageLayout() 未找到当前页面实例。请在页面 setup()、事件回调或当前页面上下文中调用。");
2034
+ }
2035
+ function resolveRuntimePageLayoutName(layout) {
2036
+ return layout === false ? NO_LAYOUT_RUNTIME_KEY : layout;
2037
+ }
2038
+ //#endregion
1883
2039
  //#region src/runtime/scopedSlots.ts
1884
2040
  const ownerStore = /* @__PURE__ */ new Map();
1885
2041
  let ownerSeed = 0;
@@ -1990,14 +2146,18 @@ function mergeComponentRefValue(wrapper, exposed) {
1990
2146
  return markNoSetData(new Proxy(wrapper, {
1991
2147
  get(target, key, receiver) {
1992
2148
  if (Reflect.has(target, key)) return Reflect.get(target, key, receiver);
1993
- return source[key];
2149
+ const value = source[key];
2150
+ if (typeof value === "function") return value.bind(source);
2151
+ return value;
1994
2152
  },
1995
2153
  set(target, key, value, receiver) {
2154
+ if (Reflect.has(target, key)) return Reflect.set(target, key, value, receiver);
1996
2155
  if (key in source) {
1997
2156
  source[key] = value;
1998
2157
  return true;
1999
2158
  }
2000
- return Reflect.set(target, key, value, receiver);
2159
+ source[key] = value;
2160
+ return true;
2001
2161
  },
2002
2162
  has(target, key) {
2003
2163
  return Reflect.has(target, key) || key in source;
@@ -2847,6 +3007,18 @@ function registerWatches(runtime, watchMap, instance) {
2847
3007
  }
2848
3008
  //#endregion
2849
3009
  //#region src/runtime/register/runtimeInstance.ts
3010
+ function attachPageLayoutSetter(target) {
3011
+ if (typeof target.route !== "string" || !target.route) return;
3012
+ target.__wevuSetPageLayout = (layout, props) => {
3013
+ var _target$__wevu;
3014
+ const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
3015
+ if (!runtimeState || typeof runtimeState !== "object") return;
3016
+ runtimeState.__wv_page_layout_name = resolveRuntimePageLayoutName(layout);
3017
+ const nextProps = layout === false ? {} : props !== null && props !== void 0 ? props : {};
3018
+ runtimeState.__wv_page_layout_props = nextProps;
3019
+ syncRuntimePageLayoutState(target, layout, nextProps);
3020
+ };
3021
+ }
2850
3022
  /**
2851
3023
  * 挂载运行时实例(框架内部注册流程使用)。
2852
3024
  * @internal
@@ -2972,6 +3144,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
2972
3144
  writable: false
2973
3145
  });
2974
3146
  target.__wevu = runtimeWithDefaults;
3147
+ attachPageLayoutSetter(target);
2975
3148
  attachOwnerSnapshot(target, runtimeWithDefaults, ownerId);
2976
3149
  if (watchMap) {
2977
3150
  const stops = registerWatches(runtimeWithDefaults, watchMap, target);
@@ -3158,81 +3331,6 @@ function resolveComponentFeatures(options) {
3158
3331
  };
3159
3332
  }
3160
3333
  //#endregion
3161
- //#region src/runtime/register/component/lifecycle/platform.ts
3162
- let wxPatched = false;
3163
- let currentPageInstance;
3164
- const PAGE_SCROLL_HOOK_DEPTH_KEY = "__wevuPageScrollHookDepth";
3165
- function bindCurrentPageInstance(target) {
3166
- currentPageInstance = target;
3167
- }
3168
- function releaseCurrentPageInstance(target) {
3169
- if (currentPageInstance === target) currentPageInstance = void 0;
3170
- }
3171
- function runInPageScrollHook(target, task) {
3172
- var _PAGE_SCROLL_HOOK_DEP;
3173
- target[PAGE_SCROLL_HOOK_DEPTH_KEY] = Number((_PAGE_SCROLL_HOOK_DEP = target[PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _PAGE_SCROLL_HOOK_DEP !== void 0 ? _PAGE_SCROLL_HOOK_DEP : 0) + 1;
3174
- try {
3175
- return task();
3176
- } finally {
3177
- var _PAGE_SCROLL_HOOK_DEP2;
3178
- const nextDepth = Number((_PAGE_SCROLL_HOOK_DEP2 = target[PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _PAGE_SCROLL_HOOK_DEP2 !== void 0 ? _PAGE_SCROLL_HOOK_DEP2 : 1) - 1;
3179
- if (nextDepth <= 0) delete target[PAGE_SCROLL_HOOK_DEPTH_KEY];
3180
- else target[PAGE_SCROLL_HOOK_DEPTH_KEY] = nextDepth;
3181
- }
3182
- }
3183
- function resolvePageOptions(target) {
3184
- const direct = target.options;
3185
- if (direct && typeof direct === "object") return direct;
3186
- if (typeof getCurrentPages === "function") {
3187
- const pages = getCurrentPages();
3188
- const page = Array.isArray(pages) ? pages.at(-1) : void 0;
3189
- const options = page && typeof page === "object" ? page.options : void 0;
3190
- if (options && typeof options === "object") return options;
3191
- }
3192
- return {};
3193
- }
3194
- function ensureWxPatched() {
3195
- if (wxPatched) return;
3196
- wxPatched = true;
3197
- const wxGlobal = getMiniProgramGlobalObject();
3198
- if (!wxGlobal || typeof wxGlobal !== "object") return;
3199
- const rawStartPullDownRefresh = wxGlobal.startPullDownRefresh;
3200
- if (typeof rawStartPullDownRefresh === "function") wxGlobal.startPullDownRefresh = function startPullDownRefreshPatched(...args) {
3201
- const result = rawStartPullDownRefresh.apply(this, args);
3202
- if (currentPageInstance) callHookList(currentPageInstance, "onPullDownRefresh", []);
3203
- return result;
3204
- };
3205
- const rawPageScrollTo = wxGlobal.pageScrollTo;
3206
- if (typeof rawPageScrollTo === "function") wxGlobal.pageScrollTo = function pageScrollToPatched(options, ...rest) {
3207
- const result = rawPageScrollTo.apply(this, [options, ...rest]);
3208
- if (currentPageInstance) {
3209
- const pageInstance = currentPageInstance;
3210
- runInPageScrollHook(pageInstance, () => {
3211
- callHookList(pageInstance, "onPageScroll", [options !== null && options !== void 0 ? options : {}]);
3212
- });
3213
- }
3214
- return result;
3215
- };
3216
- }
3217
- function ensurePageShareMenus(options) {
3218
- const { enableOnShareAppMessage, enableOnShareTimeline } = options;
3219
- if (!enableOnShareAppMessage && !enableOnShareTimeline) return;
3220
- const wxGlobal = getMiniProgramGlobalObject();
3221
- if (!wxGlobal || typeof wxGlobal.showShareMenu !== "function") return;
3222
- const showMenu = (payload) => {
3223
- try {
3224
- wxGlobal.showShareMenu(payload);
3225
- } catch (_unused) {}
3226
- };
3227
- if (!(enableOnShareAppMessage || enableOnShareTimeline)) return;
3228
- const menus = ["shareAppMessage"];
3229
- if (enableOnShareTimeline) menus.push("shareTimeline");
3230
- showMenu({
3231
- withShareTicket: true,
3232
- menus
3233
- });
3234
- }
3235
- //#endregion
3236
3334
  //#region src/runtime/register/component/lifecycle/optionalHooks.ts
3237
3335
  function attachOptionalPageLifecycleHooks(pageLifecycleHooks, options) {
3238
3336
  const { enableOnSaveExitState, enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites, hasHook } = options;
@@ -3532,6 +3630,7 @@ function prepareComponentOptions(mpOptions) {
3532
3630
  "definitionFilter",
3533
3631
  "export",
3534
3632
  "__wevuTemplateRefs",
3633
+ "__wevuLayoutHosts",
3535
3634
  "setupLifecycle",
3536
3635
  "features",
3537
3636
  "__wevu_isPage"
@@ -3580,6 +3679,8 @@ function prepareComponentOptions(mpOptions) {
3580
3679
  }
3581
3680
  const templateRefs = restOptions.__wevuTemplateRefs;
3582
3681
  delete restOptions.__wevuTemplateRefs;
3682
+ const layoutHosts = restOptions.__wevuLayoutHosts;
3683
+ delete restOptions.__wevuLayoutHosts;
3583
3684
  const userObservers = restOptions.observers;
3584
3685
  const setupLifecycle = restOptions.setupLifecycle === "created" ? "created" : "attached";
3585
3686
  delete restOptions.setupLifecycle;
@@ -3599,6 +3700,7 @@ function prepareComponentOptions(mpOptions) {
3599
3700
  restOptions,
3600
3701
  topLevelMethods,
3601
3702
  templateRefs,
3703
+ layoutHosts,
3602
3704
  userObservers,
3603
3705
  setupLifecycle,
3604
3706
  legacyCreated,
@@ -3742,72 +3844,231 @@ function createPropsSync(options) {
3742
3844
  };
3743
3845
  }
3744
3846
  //#endregion
3745
- //#region src/runtime/pageLayout.ts
3746
- const PAGE_LAYOUT_SETTER_KEY = "__wevuSetPageLayout";
3747
- const NO_LAYOUT_RUNTIME_KEY = "__wv_no_layout";
3847
+ //#region src/runtime/layoutBridge.ts
3848
+ const pageLayoutBridges = /* @__PURE__ */ new Map();
3849
+ const layoutBridgePageKeys = "__wevuLayoutBridgePageKeys";
3850
+ const LEADING_SLASH_RE = /^\/+/;
3748
3851
  function resolveCurrentPageInstance() {
3749
3852
  const getCurrentPagesFn = globalThis.getCurrentPages;
3750
3853
  if (typeof getCurrentPagesFn !== "function") return;
3751
3854
  return getCurrentPagesFn().at(-1);
3752
3855
  }
3753
- function normalizeRuntimePageLayoutName(layout) {
3754
- return layout === NO_LAYOUT_RUNTIME_KEY ? false : layout;
3856
+ function normalizeSelectors(selectors) {
3857
+ return Array.from(new Set(Array.isArray(selectors) ? selectors : [selectors])).filter((selector) => typeof selector === "string" && selector.length > 0);
3858
+ }
3859
+ function resolvePageKeys(page) {
3860
+ const keys = [];
3861
+ if (!page || typeof page !== "object") return keys;
3862
+ const webviewId = page.__wxWebviewId__;
3863
+ if (typeof webviewId === "number" || typeof webviewId === "string") keys.push(`webview:${String(webviewId)}`);
3864
+ const exparserNodeId = page.__wxExparserNodeId__;
3865
+ if (typeof exparserNodeId === "number" || typeof exparserNodeId === "string") keys.push(`exparser:${String(exparserNodeId)}`);
3866
+ const route = typeof page.route === "string" ? page.route.replace(LEADING_SLASH_RE, "") : "";
3867
+ if (route) keys.push(`route:${route}`);
3868
+ return Array.from(new Set(keys));
3869
+ }
3870
+ function resolvePageFromContext(context) {
3871
+ if (context && typeof context.__wevuSetPageLayout === "function") return context;
3872
+ return resolveCurrentPageInstance();
3873
+ }
3874
+ function resolveNativeLayoutContext(context) {
3875
+ var _context$__wevu, _context$$state;
3876
+ if (!context || typeof context !== "object") return;
3877
+ const runtimeNativeInstance = (_context$__wevu = context.__wevu) === null || _context$__wevu === void 0 || (_context$__wevu = _context$__wevu.state) === null || _context$__wevu === void 0 ? void 0 : _context$__wevu.__wevuNativeInstance;
3878
+ if (runtimeNativeInstance && typeof runtimeNativeInstance === "object") return runtimeNativeInstance;
3879
+ const stateNativeInstance = (_context$$state = context.$state) === null || _context$$state === void 0 ? void 0 : _context$$state.__wevuNativeInstance;
3880
+ if (stateNativeInstance && typeof stateNativeInstance === "object") return stateNativeInstance;
3881
+ if (context.__wevuNativeInstance && typeof context.__wevuNativeInstance === "object") return context.__wevuNativeInstance;
3882
+ return context;
3883
+ }
3884
+ function resolveHostEntry(entry) {
3885
+ if (typeof entry === "function") return entry();
3886
+ if (isRef(entry)) return entry.value;
3887
+ return entry;
3888
+ }
3889
+ function findLayoutHostBinding(bindings, key) {
3890
+ return bindings.find((binding) => binding.key === key);
3891
+ }
3892
+ function safeSelectComponent(target, selector) {
3893
+ const selectComponent = target === null || target === void 0 ? void 0 : target.selectComponent;
3894
+ if (typeof selectComponent !== "function") return null;
3895
+ try {
3896
+ var _selectComponent$call;
3897
+ return (_selectComponent$call = selectComponent.call(target, selector)) !== null && _selectComponent$call !== void 0 ? _selectComponent$call : null;
3898
+ } catch (_unused) {
3899
+ return null;
3900
+ }
3901
+ }
3902
+ function resolveDeclaredLayoutHostFromRefs(binding, context) {
3903
+ var _ref, _context$__wevu$state, _context$__wevu2, _context$$state2, _refMap$get$value, _refMap$get;
3904
+ if (!binding.refName) return null;
3905
+ const refMap = getTemplateRefMap(context);
3906
+ const stateRefs = (_ref = (_context$__wevu$state = (_context$__wevu2 = context.__wevu) === null || _context$__wevu2 === void 0 || (_context$__wevu2 = _context$__wevu2.state) === null || _context$__wevu2 === void 0 ? void 0 : _context$__wevu2.$refs) !== null && _context$__wevu$state !== void 0 ? _context$__wevu$state : (_context$$state2 = context.$state) === null || _context$$state2 === void 0 ? void 0 : _context$$state2.$refs) !== null && _ref !== void 0 ? _ref : context.$refs;
3907
+ const refValue = (_refMap$get$value = refMap === null || refMap === void 0 || (_refMap$get = refMap.get(binding.refName)) === null || _refMap$get === void 0 ? void 0 : _refMap$get.value) !== null && _refMap$get$value !== void 0 ? _refMap$get$value : stateRefs === null || stateRefs === void 0 ? void 0 : stateRefs[binding.refName];
3908
+ if (Array.isArray(refValue)) {
3909
+ var _refValue$;
3910
+ return (_refValue$ = refValue[0]) !== null && _refValue$ !== void 0 ? _refValue$ : null;
3911
+ }
3912
+ return refValue !== null && refValue !== void 0 ? refValue : null;
3913
+ }
3914
+ function createDeclaredLayoutHostBridge(bindings, context) {
3915
+ const nativeContext = resolveNativeLayoutContext(context);
3916
+ return Object.assign(nativeContext && typeof nativeContext === "object" ? Object.create(nativeContext) : {}, { selectComponent(key) {
3917
+ const binding = findLayoutHostBinding(bindings, key);
3918
+ if (!binding) return null;
3919
+ if (binding.kind === "component" || !binding.kind) {
3920
+ var _ref2, _safeSelectComponent;
3921
+ const cachedHost = resolveDeclaredLayoutHostFromRefs(binding, context);
3922
+ if (cachedHost) return cachedHost;
3923
+ return (_ref2 = (_safeSelectComponent = safeSelectComponent(nativeContext, binding.selector)) !== null && _safeSelectComponent !== void 0 ? _safeSelectComponent : safeSelectComponent(resolveCurrentPageInstance(), binding.selector)) !== null && _ref2 !== void 0 ? _ref2 : null;
3924
+ }
3925
+ return null;
3926
+ } });
3755
3927
  }
3756
3928
  /**
3757
- * 获取当前页面 layout 状态。
3929
+ * 为当前页面注册 layout bridge,使页面或子组件可消费 layout 内部能力。
3758
3930
  */
3759
- function usePageLayout() {
3760
- var _currentInstance$__we, _runtimeState$__wv_pa;
3761
- if (!getCurrentSetupContext()) throw new Error("usePageLayout() 必须在 setup() 的同步阶段调用");
3762
- const currentInstance = getCurrentInstance();
3763
- const runtimeState = currentInstance === null || currentInstance === void 0 || (_currentInstance$__we = currentInstance.__wevu) === null || _currentInstance$__we === void 0 ? void 0 : _currentInstance$__we.state;
3764
- const pageLayoutState = reactive({
3765
- name: normalizeRuntimePageLayoutName(runtimeState === null || runtimeState === void 0 ? void 0 : runtimeState.__wv_page_layout_name),
3766
- props: { ...(_runtimeState$__wv_pa = runtimeState === null || runtimeState === void 0 ? void 0 : runtimeState.__wv_page_layout_props) !== null && _runtimeState$__wv_pa !== void 0 ? _runtimeState$__wv_pa : {} }
3931
+ function registerPageLayoutBridge(selectors, context) {
3932
+ const bridgeContext = context !== null && context !== void 0 ? context : getCurrentInstance();
3933
+ const page = resolvePageFromContext(bridgeContext);
3934
+ const pageKeys = resolvePageKeys(page);
3935
+ if (!bridgeContext || !page || pageKeys.length === 0) return false;
3936
+ for (const pageKey of pageKeys) {
3937
+ var _pageLayoutBridges$ge;
3938
+ const registry = (_pageLayoutBridges$ge = pageLayoutBridges.get(pageKey)) !== null && _pageLayoutBridges$ge !== void 0 ? _pageLayoutBridges$ge : /* @__PURE__ */ new Map();
3939
+ for (const selector of normalizeSelectors(selectors)) registry.set(selector, bridgeContext);
3940
+ pageLayoutBridges.set(pageKey, registry);
3941
+ }
3942
+ bridgeContext[layoutBridgePageKeys] = pageKeys;
3943
+ return true;
3944
+ }
3945
+ /**
3946
+ * 移除当前页面的 layout bridge 注册。
3947
+ */
3948
+ function unregisterPageLayoutBridge(selectors, context) {
3949
+ var _bridgeContext$layout;
3950
+ const bridgeContext = context !== null && context !== void 0 ? context : getCurrentInstance();
3951
+ const page = resolvePageFromContext(bridgeContext);
3952
+ const pageKeys = (_bridgeContext$layout = bridgeContext === null || bridgeContext === void 0 ? void 0 : bridgeContext[layoutBridgePageKeys]) !== null && _bridgeContext$layout !== void 0 ? _bridgeContext$layout : resolvePageKeys(page);
3953
+ if (!bridgeContext || !Array.isArray(pageKeys) || pageKeys.length === 0) return false;
3954
+ let removed = false;
3955
+ for (const pageKey of pageKeys) {
3956
+ const registry = pageLayoutBridges.get(pageKey);
3957
+ if (!registry) continue;
3958
+ for (const selector of normalizeSelectors(selectors)) if (registry.get(selector) === bridgeContext) {
3959
+ registry.delete(selector);
3960
+ removed = true;
3961
+ }
3962
+ if (registry.size === 0) pageLayoutBridges.delete(pageKey);
3963
+ }
3964
+ delete bridgeContext[layoutBridgePageKeys];
3965
+ return removed;
3966
+ }
3967
+ /**
3968
+ * 解析当前页面已注册的 layout bridge,找不到时回退到传入上下文。
3969
+ */
3970
+ function resolveLayoutBridge(selector, fallbackContext) {
3971
+ var _resolveCurrentPageIn, _ref3;
3972
+ const bridgeContext = resolvePageKeys((_resolveCurrentPageIn = resolveCurrentPageInstance()) !== null && _resolveCurrentPageIn !== void 0 ? _resolveCurrentPageIn : resolvePageFromContext(fallbackContext)).map((pageKey) => {
3973
+ var _pageLayoutBridges$ge2;
3974
+ return (_pageLayoutBridges$ge2 = pageLayoutBridges.get(pageKey)) === null || _pageLayoutBridges$ge2 === void 0 ? void 0 : _pageLayoutBridges$ge2.get(selector);
3975
+ }).find(Boolean);
3976
+ return (_ref3 = bridgeContext !== null && bridgeContext !== void 0 ? bridgeContext : fallbackContext) !== null && _ref3 !== void 0 ? _ref3 : getCurrentInstance();
3977
+ }
3978
+ /**
3979
+ * 解析当前页面 layout 内通过指定 key 暴露的宿主实例。
3980
+ */
3981
+ function resolveLayoutHost(key, options = {}) {
3982
+ var _options$context, _bridge$selectCompone;
3983
+ const bridge = resolveLayoutBridge(key, (_options$context = options.context) !== null && _options$context !== void 0 ? _options$context : options.fallbackContext);
3984
+ const host = bridge === null || bridge === void 0 || (_bridge$selectCompone = bridge.selectComponent) === null || _bridge$selectCompone === void 0 ? void 0 : _bridge$selectCompone.call(bridge, key);
3985
+ return host !== null && host !== void 0 ? host : null;
3986
+ }
3987
+ /**
3988
+ * 等待当前页面 layout 宿主实例可用,适合页面初次进入时的异步宿主解析。
3989
+ */
3990
+ function waitForLayoutHost(key, options = {}) {
3991
+ var _options$retries, _options$interval;
3992
+ const retries = (_options$retries = options.retries) !== null && _options$retries !== void 0 ? _options$retries : 20;
3993
+ const interval = (_options$interval = options.interval) !== null && _options$interval !== void 0 ? _options$interval : 16;
3994
+ const host = resolveLayoutHost(key, options);
3995
+ if (host || retries <= 0) return Promise.resolve(host);
3996
+ return new Promise((resolve) => {
3997
+ setTimeout(() => {
3998
+ resolve(waitForLayoutHost(key, {
3999
+ ...options,
4000
+ retries: retries - 1
4001
+ }));
4002
+ }, interval);
3767
4003
  });
3768
- if (currentInstance) currentInstance.__wevuPageLayoutState = pageLayoutState;
3769
- return readonly(pageLayoutState);
3770
4004
  }
3771
- function syncRuntimePageLayoutState(target, layout, props) {
3772
- const state = target.__wevuPageLayoutState;
3773
- if (!state) return;
3774
- state.name = layout;
3775
- state.props = { ...props };
4005
+ /**
4006
+ * layout 生命周期内暴露 bridge,使页面或子组件可访问 layout 内部实例。
4007
+ */
4008
+ function useLayoutBridge(selectors, options = {}) {
4009
+ if (!getCurrentSetupContext()) throw new Error("useLayoutBridge() 必须在 setup() 的同步阶段调用");
4010
+ const context = getCurrentInstance();
4011
+ const normalizedSelectors = normalizeSelectors(selectors);
4012
+ const resolveComponent = options.resolveComponent;
4013
+ const nativeContext = resolveNativeLayoutContext(context);
4014
+ const bridge = Object.assign(nativeContext && typeof nativeContext === "object" ? Object.create(nativeContext) : {}, { selectComponent(selector) {
4015
+ var _nativeContext$select, _currentPage$selectCo, _currentPage$selectCo2;
4016
+ if (!normalizedSelectors.includes(selector)) return null;
4017
+ const resolvedComponent = resolveComponent === null || resolveComponent === void 0 ? void 0 : resolveComponent(selector);
4018
+ if (resolvedComponent !== void 0) return resolvedComponent;
4019
+ const nativeContext = resolveNativeLayoutContext(context);
4020
+ const directMatch = nativeContext === null || nativeContext === void 0 || (_nativeContext$select = nativeContext.selectComponent) === null || _nativeContext$select === void 0 ? void 0 : _nativeContext$select.call(nativeContext, selector);
4021
+ if (directMatch) return directMatch;
4022
+ const currentPage = resolveCurrentPageInstance();
4023
+ return (_currentPage$selectCo = currentPage === null || currentPage === void 0 || (_currentPage$selectCo2 = currentPage.selectComponent) === null || _currentPage$selectCo2 === void 0 ? void 0 : _currentPage$selectCo2.call(currentPage, selector)) !== null && _currentPage$selectCo !== void 0 ? _currentPage$selectCo : null;
4024
+ } });
4025
+ registerPageLayoutBridge(normalizedSelectors, bridge);
4026
+ onAttached(() => {
4027
+ registerPageLayoutBridge(normalizedSelectors, bridge);
4028
+ });
4029
+ onDetached(() => {
4030
+ unregisterPageLayoutBridge(normalizedSelectors, bridge);
4031
+ });
3776
4032
  }
3777
- function syncRuntimePageLayoutStateFromRuntime(target) {
3778
- var _target$__wevu, _runtimeState$__wv_pa2;
3779
- const state = target.__wevuPageLayoutState;
3780
- const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
3781
- if (!state || !runtimeState) return;
3782
- state.name = normalizeRuntimePageLayoutName(runtimeState.__wv_page_layout_name);
3783
- state.props = { ...(_runtimeState$__wv_pa2 = runtimeState.__wv_page_layout_props) !== null && _runtimeState$__wv_pa2 !== void 0 ? _runtimeState$__wv_pa2 : {} };
4033
+ /**
4034
+ * 使用编译期注入的宿主绑定信息,直接从当前 layout 运行时实例解析子组件宿主并注册 bridge。
4035
+ */
4036
+ function registerRuntimeLayoutHosts(bindings, context) {
4037
+ if (!bindings.length) return null;
4038
+ const bridgeContext = context !== null && context !== void 0 ? context : getCurrentInstance();
4039
+ if (!bridgeContext) return null;
4040
+ const bridge = createDeclaredLayoutHostBridge(bindings, bridgeContext);
4041
+ registerPageLayoutBridge(bindings.map((binding) => binding.key), bridge);
4042
+ return bridge;
3784
4043
  }
3785
4044
  /**
3786
- * 显式切换当前页面使用的 layout。
4045
+ * 移除运行时自动注册的 layout 宿主 bridge
3787
4046
  */
3788
- function setPageLayout(layout, props) {
3789
- const currentInstance = getCurrentInstance();
3790
- const directSetter = currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance[PAGE_LAYOUT_SETTER_KEY];
3791
- if (typeof directSetter === "function") {
3792
- directSetter(layout, props);
3793
- return;
3794
- }
3795
- const currentPage = resolveCurrentPageInstance();
3796
- const pageSetter = currentPage === null || currentPage === void 0 ? void 0 : currentPage[PAGE_LAYOUT_SETTER_KEY];
3797
- if (typeof pageSetter === "function") {
3798
- pageSetter(layout, props);
3799
- return;
3800
- }
3801
- throw new Error("setPageLayout() 未找到当前页面实例。请在页面 setup()、事件回调或当前页面上下文中调用。");
4047
+ function unregisterRuntimeLayoutHosts(bindings, context) {
4048
+ if (!bindings.length) return false;
4049
+ const bridgeContext = context !== null && context !== void 0 ? context : getCurrentInstance();
4050
+ if (!bridgeContext) return false;
4051
+ return unregisterPageLayoutBridge(bindings.map((binding) => binding.key), bridgeContext);
3802
4052
  }
3803
- function resolveRuntimePageLayoutName(layout) {
3804
- return layout === false ? NO_LAYOUT_RUNTIME_KEY : layout;
4053
+ /**
4054
+ * 使用 key -> 宿主实例的映射批量暴露 layout 内部宿主,适合 toast/dialog 等共享反馈节点。
4055
+ */
4056
+ function useLayoutHosts(hosts) {
4057
+ useLayoutBridge(Object.keys(hosts), { resolveComponent(key) {
4058
+ return resolveHostEntry(hosts[key]);
4059
+ } });
3805
4060
  }
3806
4061
  //#endregion
3807
4062
  //#region src/runtime/register/component/registerDefinition.ts
3808
4063
  function registerComponentDefinition(options) {
3809
- const { runtimeApp, watch, setup, restOptions, pageLifecycleHooks, finalObservers, userLifetimes, userPageLifetimes, finalMethods, finalOptions, applyExtraInstanceFields, templateRefs, attachWevuPropKeys, setupLifecycle, syncWevuPropsFromInstance, isPage, legacyCreated, getRuntimeOwnerLabel } = options;
4064
+ const { runtimeApp, watch, setup, restOptions, pageLifecycleHooks, finalObservers, userLifetimes, userPageLifetimes, finalMethods, finalOptions, applyExtraInstanceFields, templateRefs, layoutHosts, attachWevuPropKeys, setupLifecycle, syncWevuPropsFromInstance, isPage, legacyCreated, getRuntimeOwnerLabel } = options;
3810
4065
  const pageShareMethodBridges = {};
4066
+ const attachRuntimeLayoutHosts = (instance) => {
4067
+ if (!Array.isArray(layoutHosts) || !layoutHosts.length) return;
4068
+ if (instance.__wevuLayoutHostBridge) return;
4069
+ const bridge = registerRuntimeLayoutHosts(layoutHosts, instance);
4070
+ if (bridge) instance.__wevuLayoutHostBridge = bridge;
4071
+ };
3811
4072
  const attachPageLayoutSetter = (instance) => {
3812
4073
  if (!isPage) return;
3813
4074
  instance.__wevuSetPageLayout = (layout, props) => {
@@ -3881,6 +4142,7 @@ function registerComponentDefinition(options) {
3881
4142
  }
3882
4143
  syncWevuPropsFromInstance(this);
3883
4144
  attachPageLayoutSetter(this);
4145
+ attachRuntimeLayoutHosts(this);
3884
4146
  if (setupLifecycle === "created") enableDeferredSetData(this);
3885
4147
  callHookList(this, "onAttached", args);
3886
4148
  if (typeof userLifetimes.attached === "function") userLifetimes.attached.apply(this, args);
@@ -3910,6 +4172,10 @@ function registerComponentDefinition(options) {
3910
4172
  return;
3911
4173
  }
3912
4174
  clearTemplateRefs(this);
4175
+ if (Array.isArray(layoutHosts) && layoutHosts.length && this.__wevuLayoutHostBridge) {
4176
+ unregisterRuntimeLayoutHosts(layoutHosts, this.__wevuLayoutHostBridge);
4177
+ delete this.__wevuLayoutHostBridge;
4178
+ }
3913
4179
  teardownRuntimeInstance(this);
3914
4180
  if (typeof userLifetimes.detached === "function") userLifetimes.detached.apply(this, args);
3915
4181
  },
@@ -3974,7 +4240,7 @@ function registerComponentDefinition(options) {
3974
4240
  */
3975
4241
  function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
3976
4242
  var _multipleSlots;
3977
- const { userMethods, userLifetimes, userPageLifetimes, userOptions, restOptions, topLevelMethods, templateRefs, userObservers, setupLifecycle, legacyCreated, isPage, features, userOnLoad, userOnUnload, userOnShow, userOnHide, userOnReady, userOnSaveExitState, userOnPullDownRefresh, userOnReachBottom, userOnPageScroll, userOnRouteDone, userOnTabItemTap, userOnResize, userOnShareAppMessage, userOnShareTimeline, userOnAddToFavorites, applyExtraInstanceFields } = prepareComponentOptions(mpOptions);
4243
+ const { userMethods, userLifetimes, userPageLifetimes, userOptions, restOptions, topLevelMethods, templateRefs, layoutHosts, userObservers, setupLifecycle, legacyCreated, isPage, features, userOnLoad, userOnUnload, userOnShow, userOnHide, userOnReady, userOnSaveExitState, userOnPullDownRefresh, userOnReachBottom, userOnPageScroll, userOnRouteDone, userOnTabItemTap, userOnResize, userOnShareAppMessage, userOnShareTimeline, userOnAddToFavorites, applyExtraInstanceFields } = prepareComponentOptions(mpOptions);
3978
4244
  const { enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnRouteDoneFallback, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, enableOnSaveExitState, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites } = resolveComponentFeatures({
3979
4245
  features,
3980
4246
  userOnSaveExitState,
@@ -4069,6 +4335,7 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
4069
4335
  finalOptions,
4070
4336
  applyExtraInstanceFields,
4071
4337
  templateRefs,
4338
+ layoutHosts,
4072
4339
  attachWevuPropKeys,
4073
4340
  setupLifecycle,
4074
4341
  syncWevuPropsFromInstance,
@@ -4692,8 +4959,7 @@ function usePageScrollThrottle(handler, options = {}) {
4692
4959
  };
4693
4960
  const scheduleTrailing = (now) => {
4694
4961
  if (!trailing || trailingTimer) return;
4695
- const base = lastInvokeTime === 0 ? now : lastInvokeTime;
4696
- const remaining = Math.max(0, interval - (now - base));
4962
+ const remaining = Math.max(0, interval - (now - (lastInvokeTime === 0 ? now : lastInvokeTime)));
4697
4963
  trailingTimer = setTimeout(flushTrailing, remaining);
4698
4964
  };
4699
4965
  const scheduleMaxWait = (now) => {
@@ -4990,4 +5256,4 @@ function useTemplateRef(name) {
4990
5256
  return target;
4991
5257
  }
4992
5258
  //#endregion
4993
- export { addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, createWevuScopedSlotComponent, customRef, defineComponent, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getReactiveVersion, hasInjectionContext, inject, injectGlobal, isNoSetData, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, removeMutationRecorder, resetWevuDefaults, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, storeToRefs, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, teardownRuntimeInstance, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, useAttrs, useBindModel, useDisposables, useIntersectionObserver, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, usePageLayout, usePageScrollThrottle, useSlots, useTemplateRef, useUpdatePerformanceListener, watch, watchEffect };
5259
+ export { addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, createWevuScopedSlotComponent, customRef, defineComponent, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getReactiveVersion, hasInjectionContext, inject, injectGlobal, isNoSetData, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, registerPageLayoutBridge, registerRuntimeLayoutHosts, removeMutationRecorder, resetWevuDefaults, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, storeToRefs, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, teardownRuntimeInstance, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, useAttrs, useBindModel, useDisposables, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, usePageLayout, usePageScrollThrottle, useSlots, useTemplateRef, useUpdatePerformanceListener, waitForLayoutHost, watch, watchEffect };
@@ -1,4 +1,4 @@
1
- import { t as _defineProperty } from "./defineProperty-JH0tR899.mjs";
1
+ import { t as _defineProperty } from "./defineProperty-BZYESRfZ.mjs";
2
2
  //#region src/scheduler.ts
3
3
  const resolvedPromise = Promise.resolve();
4
4
  const jobQueue = /* @__PURE__ */ new Set();
@@ -1,4 +1,4 @@
1
- import { n as isRef, r as markAsRef, v as isObject } from "./ref-BjmD-qct.mjs";
1
+ import { n as isRef, r as markAsRef, v as isObject } from "./ref-B37H82Eg.mjs";
2
2
  //#region src/reactivity/readonly.ts
3
3
  function createReadonlyWrapper(target) {
4
4
  if (isRef(target)) {
package/dist/router.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { d as reactive } from "./ref-BjmD-qct.mjs";
2
- import { C as onRouteDone, D as onShow, H as readonly, I as getCurrentSetupContext, a as injectGlobal, m as onLoad, n as useNativeRouter$1, s as provideGlobal, t as useNativePageRouter$1 } from "./router-PqZEeqhd.mjs";
1
+ import { d as reactive } from "./ref-B37H82Eg.mjs";
2
+ import { C as onRouteDone, D as onShow, H as readonly, I as getCurrentSetupContext, a as injectGlobal, m as onLoad, n as useNativeRouter$1, s as provideGlobal, t as useNativePageRouter$1 } from "./router-DHeyqsP-.mjs";
3
3
  //#region src/routerInternal/path.ts
4
4
  function normalizePathSegments(path) {
5
5
  const segments = [];
@@ -1,4 +1,4 @@
1
- import { A as track, C as effect, d as reactive, g as touchReactive, j as trigger, l as isReactive, n as isRef, r as markAsRef, y as toRaw } from "./ref-BjmD-qct.mjs";
1
+ import { A as track, C as effect, d as reactive, g as touchReactive, j as trigger, l as isReactive, n as isRef, r as markAsRef, y as toRaw } from "./ref-B37H82Eg.mjs";
2
2
  //#region src/reactivity/computed.ts
3
3
  function computed(getterOrOptions) {
4
4
  let getter;
package/dist/store.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as defineStore, r as createStore, t as storeToRefs } from "./store-Ct-o7qtH.mjs";
1
+ import { n as defineStore, r as createStore, t as storeToRefs } from "./store-DDjlcddD.mjs";
2
2
  export { createStore, defineStore, storeToRefs };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wevu",
3
3
  "type": "module",
4
- "version": "6.11.3",
4
+ "version": "6.11.5",
5
5
  "description": "Vue 3 风格的小程序运行时,包含响应式、diff+setData 与轻量状态管理",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -96,7 +96,7 @@
96
96
  "dependencies": {
97
97
  "vue": "^3.5.30",
98
98
  "@wevu/api": "0.2.2",
99
- "@wevu/compiler": "6.11.3"
99
+ "@wevu/compiler": "6.11.5"
100
100
  },
101
101
  "scripts": {
102
102
  "dev": "tsdown -w",