wevu 6.16.27 → 6.16.29

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,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, 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-DAstlXwV.mjs";
2
- import { i as computed, n as defineStore, r as createStore, t as storeToRefs } from "./store-Bazm64zK.mjs";
3
- import { $ as onUnhandledRejection, A as setGlobalProvidedValue, B as onPageNotFound, C as releaseCurrentPageInstance, D as attachRuntimeProvideContext, E as attachRuntimeLayoutProvideContext, F as onHide, G as onResize, H as onPullDownRefresh, I as onLaunch, J as onShareAppMessage, K as onRouteDone, L as onLoad, M as onAttached, N as onDetached, O as ensureRuntimeAppProvides, P as onError, Q as onThemeChange, R as onMemoryWarning, S as getCurrentPageInstance, T as runInPageScrollHook, U as onReachBottom, V as onPageScroll, W as onReady, X as onShow, Y as onShareTimeline, Z as onTabItemTap, _ as provide, _t as readonly, at as getCurrentSetupContext, b as ensureMiniProgramGlobalPatched, ct as setCurrentSetupContext, dt as getCurrentMiniProgramRuntimeCapabilities, et as onUnload, ft as getMiniProgramGlobalObject, g as injectGlobal, gt as isReadonly, h as inject, ht as isProxy, it as getCurrentInstance, j as onAddToFavorites, k as setRuntimeAppProvidedValue, lt as getCurrentMiniProgramHostConfig, m as hasInjectionContext, mt as supportsCurrentMiniProgramRuntimeCapability, n as useNativeRouter, nt as callHookList, ot as pushHook, pt as getScopedSlotHostGlobalObject, q as onSaveExitState, rt as callHookReturn, st as setCurrentInstance, t as useNativePageRouter, tt as assertInSetup, ut as getCurrentMiniProgramPages, v as provideGlobal, vt as shallowReadonly, w as resolvePageOptions, x as ensurePageShareMenus, y as bindCurrentPageInstance, z as onMoved } from "./router-D68ovdoh.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, 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-BoBfMdVt.mjs";
2
+ import { i as computed, n as defineStore, r as createStore, t as storeToRefs } from "./store-eNxaNZbj.mjs";
3
+ import { $ as onUnhandledRejection, A as setGlobalProvidedValue, B as onPageNotFound, C as releaseCurrentPageInstance, D as attachRuntimeProvideContext, E as attachRuntimeLayoutProvideContext, F as onHide, G as onResize, H as onPullDownRefresh, I as onLaunch, J as onShareAppMessage, K as onRouteDone, L as onLoad, M as onAttached, N as onDetached, O as ensureRuntimeAppProvides, P as onError, Q as onThemeChange, R as onMemoryWarning, S as getCurrentPageInstance, T as runInPageScrollHook, U as onReachBottom, V as onPageScroll, W as onReady, X as onShow, Y as onShareTimeline, Z as onTabItemTap, _ as provide, _t as readonly, at as getCurrentSetupContext, b as ensureMiniProgramGlobalPatched, ct as setCurrentSetupContext, dt as getCurrentMiniProgramRuntimeCapabilities, et as onUnload, ft as getMiniProgramGlobalObject, g as injectGlobal, gt as isReadonly, h as inject, ht as isProxy, it as getCurrentInstance, j as onAddToFavorites, k as setRuntimeAppProvidedValue, lt as getCurrentMiniProgramHostConfig, m as hasInjectionContext, mt as supportsCurrentMiniProgramRuntimeCapability, n as useNativeRouter, nt as callHookList, ot as pushHook, pt as getScopedSlotHostGlobalObject, q as onSaveExitState, rt as callHookReturn, st as setCurrentInstance, t as useNativePageRouter, tt as assertInSetup, ut as getCurrentMiniProgramPages, v as provideGlobal, vt as shallowReadonly, w as resolvePageOptions, x as ensurePageShareMenus, y as bindCurrentPageInstance, z as onMoved } from "./router-ByTtgUmi.mjs";
4
4
  import { WEVU_ATTRS_KEY, WEVU_EFFECT_SCOPE_KEY, WEVU_EXPOSED_KEY, WEVU_FUNCTION_PROP_PATHS_KEY, WEVU_HOOKS_KEY, WEVU_INLINE_HANDLER, WEVU_INLINE_MAP_KEY, WEVU_IS_APP_INSTANCE_KEY, WEVU_LAYOUT_BRIDGE_PAGE_KEYS, WEVU_LAYOUT_HOST_BRIDGE_KEY, WEVU_MODEL_HANDLER, WEVU_NATIVE_INSTANCE_KEY, WEVU_ON_BEFORE_UPDATE_HOOK, WEVU_ON_LOAD_CALLED_KEY, WEVU_ON_UPDATED_HOOK, WEVU_OWNER_HANDLER, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_NONE, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY, WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY, WEVU_PARENT_INSTANCE_KEY, WEVU_PENDING_PROP_VALUES_KEY, WEVU_PROPS_ALIASES_KEY, WEVU_PROPS_DERIVED_KEYS_KEY, WEVU_PROPS_KEY, WEVU_PROP_KEYS_KEY, WEVU_PUBLIC_RUNTIME_KEY, WEVU_READY_CALLED_KEY, WEVU_RESERVED_METHOD_PREFIX, WEVU_ROUTE_DONE_CALLED_KEY, WEVU_ROUTE_DONE_IN_TICK_KEY, WEVU_RUNTIME_APP_KEY, WEVU_RUNTIME_KEY, WEVU_SCOPED_SLOT_CREATOR_KEY, WEVU_SCOPED_SLOT_OWNER_SEED_KEY, WEVU_SCOPED_SLOT_OWNER_STORE_KEY, WEVU_SETUP_CONTEXT_INSTANCE_KEY, WEVU_SETUP_STATE_KEY, WEVU_SLOT_NAMES_PROP, WEVU_SLOT_OWNER_ID_KEY, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_OWNER_KEY, WEVU_SLOT_OWNER_PROXY_KEY, WEVU_SLOT_PROPS_DATA_KEY, WEVU_SLOT_PROPS_KEY, WEVU_SLOT_SCOPE_KEY, WEVU_TEMPLATE_REFS_CALLBACKS_KEY, WEVU_TEMPLATE_REFS_KEY, WEVU_TEMPLATE_REFS_PENDING_KEY, WEVU_TEMPLATE_REF_MAP_KEY, WEVU_WATCH_STOPS_KEY } from "@weapp-core/constants";
5
5
  import { resolveMiniProgramPageKeys } from "@weapp-core/shared";
6
6
  import { wpi } from "@wevu/api";
@@ -478,7 +478,7 @@ function watchSyncEffect(effectFn, options = {}) {
478
478
 
479
479
  //#endregion
480
480
  //#region package.json
481
- var version$1 = "6.16.27";
481
+ var version$1 = "6.16.29";
482
482
 
483
483
  //#endregion
484
484
  //#region src/version.ts
@@ -1555,7 +1555,7 @@ function runPatchUpdate(options) {
1555
1555
  //#endregion
1556
1556
  //#region src/runtime/app/setData/scheduler.ts
1557
1557
  function createSetDataScheduler(options) {
1558
- const { state, setupState, snapshotOmitKeys, computedRefs, dirtyComputedKeys, includeComputed, setDataStrategy, computedCompare, computedCompareMaxDepth, computedCompareMaxKeys, currentAdapter, shouldIncludeKey, maxPatchKeys, maxPayloadBytes, mergeSiblingThreshold, mergeSiblingMaxInflationRatio, mergeSiblingMaxParentBytes, mergeSiblingSkipArray, elevateTopKeyThreshold, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths, debug, debugWhen, debugSampleRate, runTracker, isMounted } = options;
1558
+ const { state, setupState, snapshotOmitKeys, computedRefs, dirtyComputedKeys, includeComputed, setDataStrategy, computedCompare, computedCompareMaxDepth, computedCompareMaxKeys, currentAdapter, shouldIncludeKey, maxPatchKeys, maxPayloadBytes, mergeSiblingThreshold, mergeSiblingMaxInflationRatio, mergeSiblingMaxParentBytes, mergeSiblingSkipArray, elevateTopKeyThreshold, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths, debug, debugWhen, debugSampleRate, runTracker, isMounted, initialSnapshot } = options;
1559
1559
  const plainCache = /* @__PURE__ */ new WeakMap();
1560
1560
  let latestSnapshot = {};
1561
1561
  let latestComputedSnapshot = Object.create(null);
@@ -1607,6 +1607,25 @@ function createSetDataScheduler(options) {
1607
1607
  return left.raw === right.raw && left.version === right.version;
1608
1608
  };
1609
1609
  const shouldIncludeSnapshotKey = (key) => shouldIncludeKey(key) && !(snapshotOmitKeys === null || snapshotOmitKeys === void 0 ? void 0 : snapshotOmitKeys.has(key));
1610
+ if (initialSnapshot) {
1611
+ for (const [key, value] of Object.entries(initialSnapshot)) if (shouldIncludeSnapshotKey(key)) latestSnapshot[key] = value;
1612
+ }
1613
+ const syncInitialSnapshotTokens = () => {
1614
+ if (!initialSnapshot) return;
1615
+ const rawState = isReactive(state) ? toRaw(state) : state;
1616
+ const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
1617
+ for (const key of Object.keys(initialSnapshot)) {
1618
+ if (!shouldIncludeSnapshotKey(key)) continue;
1619
+ if (rawSetupState && hasOwn(rawSetupState, key)) {
1620
+ latestStateTokens[key] = createValueToken(rawSetupState[key]);
1621
+ continue;
1622
+ }
1623
+ if (hasOwn(rawState, key)) {
1624
+ rawState[key] = initialSnapshot[key];
1625
+ latestStateTokens[key] = createValueToken(rawState[key]);
1626
+ }
1627
+ }
1628
+ };
1610
1629
  const resolveTopKeysByRoot = (root) => {
1611
1630
  const matches = [];
1612
1631
  const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
@@ -1640,6 +1659,7 @@ function createSetDataScheduler(options) {
1640
1659
  includeFunctions,
1641
1660
  functionPaths
1642
1661
  });
1662
+ syncInitialSnapshotTokens();
1643
1663
  const collectDiffSnapshot = () => {
1644
1664
  const rawState = isReactive(state) ? toRaw(state) : state;
1645
1665
  const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
@@ -1906,6 +1926,7 @@ function createRuntimeMount(options) {
1906
1926
  const setupState = reactive(Object.create(null));
1907
1927
  const adapterSnapshotOmitKeys = adapter === null || adapter === void 0 ? void 0 : adapter.__wevu_snapshotOmitKeys;
1908
1928
  const deferInitialSnapshot = Boolean(adapter === null || adapter === void 0 ? void 0 : adapter.__wevu_deferInitialSnapshot);
1929
+ const adapterInitialSnapshot = adapter === null || adapter === void 0 ? void 0 : adapter.__wevu_initialSnapshot;
1909
1930
  const snapshotOmitKeys = new Set(adapterSnapshotOmitKeys instanceof Set ? adapterSnapshotOmitKeys : Array.isArray(adapterSnapshotOmitKeys) ? adapterSnapshotOmitKeys : []);
1910
1931
  if (rawState && typeof rawState === "object" && !hasOwn(rawState, WEVU_SETUP_STATE_KEY)) try {
1911
1932
  Object.defineProperty(rawState, WEVU_SETUP_STATE_KEY, {
@@ -1971,7 +1992,8 @@ function createRuntimeMount(options) {
1971
1992
  debugWhen: mergedDebugWhen,
1972
1993
  debugSampleRate,
1973
1994
  runTracker: () => tracker === null || tracker === void 0 ? void 0 : tracker(),
1974
- isMounted: () => mounted
1995
+ isMounted: () => mounted,
1996
+ initialSnapshot: adapterInitialSnapshot && typeof adapterInitialSnapshot === "object" ? adapterInitialSnapshot : void 0
1975
1997
  });
1976
1998
  const job = () => scheduler.job(stateRootRaw);
1977
1999
  const mutationRecorder = (record) => scheduler.mutationRecorder(record, stateRootRaw);
@@ -3250,6 +3272,9 @@ function ensureRuntimeProps(target, runtimeState, mpProperties = target.properti
3250
3272
  function normalizeEmitEventName(eventName) {
3251
3273
  return eventName.includes(":") ? eventName.replaceAll(":", "-").toLowerCase() : eventName;
3252
3274
  }
3275
+ function isInternalAttrKey(key) {
3276
+ return key.startsWith("__wv_");
3277
+ }
3253
3278
  function runRuntimeSetupPhase(options) {
3254
3279
  var _runtimeWithDefaults$;
3255
3280
  const { target, runtime, runtimeWithDefaults, runtimeState, runtimeProxy, setup } = options;
@@ -3261,10 +3286,10 @@ function runRuntimeSetupPhase(options) {
3261
3286
  };
3262
3287
  const syncAttrsFromProperties = () => {
3263
3288
  const next = target.properties && typeof target.properties === "object" ? target.properties : void 0;
3264
- for (const existingKey of Object.keys(attrs)) if (!next || !hasOwn(next, existingKey) || declaredPropKeys.has(existingKey) || hasRuntimeStateKey(existingKey)) delete attrs[existingKey];
3289
+ for (const existingKey of Object.keys(attrs)) if (!next || !hasOwn(next, existingKey) || isInternalAttrKey(existingKey) || declaredPropKeys.has(existingKey) || hasRuntimeStateKey(existingKey)) delete attrs[existingKey];
3265
3290
  if (!next) return;
3266
3291
  for (const [key, value] of Object.entries(next)) {
3267
- if (declaredPropKeys.has(key) || hasRuntimeStateKey(key)) continue;
3292
+ if (isInternalAttrKey(key) || declaredPropKeys.has(key) || hasRuntimeStateKey(key)) continue;
3268
3293
  attrs[key] = value;
3269
3294
  }
3270
3295
  };
@@ -3495,6 +3520,38 @@ function registerWatches(runtime, watchMap, instance) {
3495
3520
 
3496
3521
  //#endregion
3497
3522
  //#region src/runtime/register/runtimeInstance.ts
3523
+ function cloneInitialSnapshotValue(value, cache = /* @__PURE__ */ new WeakMap()) {
3524
+ if (!value || typeof value !== "object") return value;
3525
+ if (cache.has(value)) return cache.get(value);
3526
+ if (Array.isArray(value)) {
3527
+ const next = [];
3528
+ cache.set(value, next);
3529
+ for (const item of value) next.push(cloneInitialSnapshotValue(item, cache));
3530
+ return next;
3531
+ }
3532
+ const next = {};
3533
+ cache.set(value, next);
3534
+ for (const [key, child] of Object.entries(value)) next[key] = cloneInitialSnapshotValue(child, cache);
3535
+ return next;
3536
+ }
3537
+ function resolveInitialSnapshotFromNativeData(target, omitKeys, extraEntries) {
3538
+ const data = target.data;
3539
+ if ((!data || typeof data !== "object") && (!extraEntries || !Object.keys(extraEntries).length)) return;
3540
+ const omitSet = Array.isArray(omitKeys) && omitKeys.length ? new Set(omitKeys) : void 0;
3541
+ const snapshot = {};
3542
+ if (data && typeof data === "object") for (const [key, value] of Object.entries(data)) {
3543
+ if (omitSet === null || omitSet === void 0 ? void 0 : omitSet.has(key)) continue;
3544
+ snapshot[key] = cloneInitialSnapshotValue(value);
3545
+ }
3546
+ if (extraEntries) for (const [key, value] of Object.entries(extraEntries)) {
3547
+ if (omitSet === null || omitSet === void 0 ? void 0 : omitSet.has(key)) continue;
3548
+ snapshot[key] = cloneInitialSnapshotValue(value);
3549
+ }
3550
+ return snapshot;
3551
+ }
3552
+ function hasTemplateRuntimeBindings(runtimeApp) {
3553
+ return Boolean(runtimeApp === null || runtimeApp === void 0 ? void 0 : runtimeApp.__wevuHasTemplateRuntimeBindings);
3554
+ }
3498
3555
  function attachPageLayoutSetter(target) {
3499
3556
  if (typeof target.route !== "string" || !target.route) return;
3500
3557
  target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
@@ -3604,7 +3661,15 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
3604
3661
  value: options.snapshotOmitKeys,
3605
3662
  writable: false
3606
3663
  });
3607
- if (setup) Object.defineProperty(baseMountAdapter, "__wevu_deferInitialSnapshot", {
3664
+ const initialSnapshot = resolveInitialSnapshotFromNativeData(target, options === null || options === void 0 ? void 0 : options.snapshotOmitKeys, hasTemplateRuntimeBindings(runtimeApp) ? void 0 : { [WEVU_SLOT_OWNER_ID_KEY]: ownerId });
3665
+ if (initialSnapshot && Object.keys(initialSnapshot).length) Object.defineProperty(baseMountAdapter, "__wevu_initialSnapshot", {
3666
+ configurable: true,
3667
+ enumerable: false,
3668
+ value: initialSnapshot,
3669
+ writable: false
3670
+ });
3671
+ const targetProperties = target.properties;
3672
+ if (Boolean(setup) || Boolean(targetProperties && typeof targetProperties === "object" && Object.keys(targetProperties).length > 0)) Object.defineProperty(baseMountAdapter, "__wevu_deferInitialSnapshot", {
3608
3673
  configurable: true,
3609
3674
  enumerable: false,
3610
3675
  value: true,
@@ -3669,7 +3734,6 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
3669
3734
  if (stops.length) target[WEVU_WATCH_STOPS_KEY] = stops;
3670
3735
  }
3671
3736
  if (setup) {
3672
- var _runtimeWithSyncFlush;
3673
3737
  runRuntimeSetupPhase({
3674
3738
  target,
3675
3739
  runtime,
@@ -3678,7 +3742,10 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
3678
3742
  runtimeProxy,
3679
3743
  setup
3680
3744
  });
3681
- (_runtimeWithSyncFlush = runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync) === null || _runtimeWithSyncFlush === void 0 || _runtimeWithSyncFlush.call(runtimeWithSyncFlush);
3745
+ if (!(options === null || options === void 0 ? void 0 : options.deferSetData)) {
3746
+ var _runtimeWithSyncFlush;
3747
+ (_runtimeWithSyncFlush = runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync) === null || _runtimeWithSyncFlush === void 0 || _runtimeWithSyncFlush.call(runtimeWithSyncFlush);
3748
+ }
3682
3749
  refreshOwnerSnapshot();
3683
3750
  } else if (target.properties && typeof target.properties === "object" && Object.keys(target.properties).length > 0) {
3684
3751
  var _runtimeWithSyncFlush2;
@@ -3688,14 +3755,23 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
3688
3755
  bridgeRuntimeMethodsToTarget(target, runtime);
3689
3756
  return runtime;
3690
3757
  }
3758
+ function syncRuntimeStateFromNativeData(target) {
3759
+ var _target$__wevu2;
3760
+ const runtimeState = (_target$__wevu2 = target.__wevu) === null || _target$__wevu2 === void 0 ? void 0 : _target$__wevu2.state;
3761
+ const nativeData = target.data;
3762
+ if (!runtimeState || typeof runtimeState !== "object" || !nativeData || typeof nativeData !== "object") return;
3763
+ for (const [key, value] of Object.entries(nativeData)) if (Object.prototype.hasOwnProperty.call(runtimeState, key)) runtimeState[key] = value;
3764
+ }
3691
3765
  function enableDeferredSetData(target) {
3692
- var _wevu;
3766
+ var _wevu, _wevu2, _wevu2$__wevu_flushSe;
3693
3767
  const adapter = (_wevu = target.__wevu) === null || _wevu === void 0 ? void 0 : _wevu.adapter;
3768
+ syncRuntimeStateFromNativeData(target);
3769
+ (_wevu2 = target.__wevu) === null || _wevu2 === void 0 || (_wevu2$__wevu_flushSe = _wevu2.__wevu_flushSetupSnapshotSync) === null || _wevu2$__wevu_flushSe === void 0 || _wevu2$__wevu_flushSe.call(_wevu2);
3694
3770
  if (adapter && typeof adapter.__wevu_enableSetData === "function") adapter.__wevu_enableSetData();
3695
3771
  }
3696
3772
  function setRuntimeSetDataVisibility(target, visible) {
3697
- var _wevu2;
3698
- const adapter = (_wevu2 = target.__wevu) === null || _wevu2 === void 0 ? void 0 : _wevu2.adapter;
3773
+ var _wevu3;
3774
+ const adapter = (_wevu3 = target.__wevu) === null || _wevu3 === void 0 ? void 0 : _wevu3.adapter;
3699
3775
  if (adapter && typeof adapter.__wevu_setVisibility === "function") adapter.__wevu_setVisibility(visible);
3700
3776
  }
3701
3777
  /**
@@ -4355,6 +4431,7 @@ function createPropsSync(options) {
4355
4431
  const aliasKeySet = new Set(aliasEntries.map(([alias]) => alias));
4356
4432
  const directPropsDerivedKeys = [...propsDerivedKeySet].filter((key) => propKeySet.has(key) && !aliasKeySet.has(key));
4357
4433
  const syncedAliases = /* @__PURE__ */ new WeakMap();
4434
+ const isInternalAttrKey = (key) => key.startsWith("__wv_");
4358
4435
  const updateSnapshotOmitKeys = (instance) => {
4359
4436
  const runtime = instance.__wevu;
4360
4437
  const snapshotOmitKeys = runtime === null || runtime === void 0 ? void 0 : runtime[WEVU_PROPS_DERIVED_KEYS_KEY];
@@ -4427,7 +4504,7 @@ function createPropsSync(options) {
4427
4504
  const properties = instance.properties;
4428
4505
  const next = properties && typeof properties === "object" ? properties : void 0;
4429
4506
  const currentKeys = Object.keys(attrsProxy);
4430
- for (const existingKey of currentKeys) if (!next || !hasOwn(next, existingKey) || propKeySet.has(existingKey) || hasRuntimeStateKey(existingKey)) try {
4507
+ for (const existingKey of currentKeys) if (!next || !hasOwn(next, existingKey) || isInternalAttrKey(existingKey) || propKeySet.has(existingKey) || hasRuntimeStateKey(existingKey)) try {
4431
4508
  delete attrsProxy[existingKey];
4432
4509
  } catch (_unused5) {}
4433
4510
  if (!next) {
@@ -4435,7 +4512,7 @@ function createPropsSync(options) {
4435
4512
  return;
4436
4513
  }
4437
4514
  for (const [key, value] of Object.entries(next)) {
4438
- if (propKeySet.has(key) || hasRuntimeStateKey(key)) continue;
4515
+ if (isInternalAttrKey(key) || propKeySet.has(key) || hasRuntimeStateKey(key)) continue;
4439
4516
  try {
4440
4517
  attrsProxy[key] = value;
4441
4518
  } catch (_unused6) {}
@@ -5088,8 +5165,15 @@ function createApp(options) {
5088
5165
  enumerable: false,
5089
5166
  writable: false
5090
5167
  });
5168
+ Object.defineProperty(runtimeApp, "__wevuHasTemplateRuntimeBindings", {
5169
+ value: Object.keys(resolvedComputed).some((key) => key.startsWith("__wv_bind_")),
5170
+ configurable: true,
5171
+ enumerable: false,
5172
+ writable: false
5173
+ });
5091
5174
  } catch (_unused) {
5092
5175
  runtimeApp.__wevuSetDataOptions = setDataOptions;
5176
+ runtimeApp.__wevuHasTemplateRuntimeBindings = Object.keys(resolvedComputed).some((key) => key.startsWith("__wv_bind_"));
5093
5177
  }
5094
5178
  if (hasGlobalApp) {
5095
5179
  const globalObject = getMiniProgramGlobalObject();
@@ -5102,6 +5186,90 @@ function createApp(options) {
5102
5186
  return runtimeApp;
5103
5187
  }
5104
5188
 
5189
+ //#endregion
5190
+ //#region src/runtime/define/initialComputed.ts
5191
+ var InitialComputedBailout = class extends Error {};
5192
+ function resolveComputedGetter(definition) {
5193
+ if (typeof definition === "function") return definition;
5194
+ const getter = definition === null || definition === void 0 ? void 0 : definition.get;
5195
+ return typeof getter === "function" ? getter : void 0;
5196
+ }
5197
+ function resolveInitialComputedData(options) {
5198
+ const { data, computed, setData } = options;
5199
+ const computedKeys = computed ? Object.keys(computed) : [];
5200
+ if (!computedKeys.length) return;
5201
+ const { includeComputed, shouldIncludeKey, toPlainMaxDepth, toPlainMaxKeys, includeFunctions, functionPaths } = resolveSetDataOptions(setData);
5202
+ if (!includeComputed) return;
5203
+ const resolved = {};
5204
+ const resolving = /* @__PURE__ */ new Set();
5205
+ let proxy;
5206
+ const resolveComputedValue = (key) => {
5207
+ if (hasOwn(data, key) || !shouldIncludeKey(key)) return { ok: false };
5208
+ if (hasOwn(resolved, key)) return {
5209
+ ok: true,
5210
+ value: resolved[key]
5211
+ };
5212
+ if (resolving.has(key)) return { ok: false };
5213
+ const getter = resolveComputedGetter(computed[key]);
5214
+ if (!getter) return { ok: false };
5215
+ resolving.add(key);
5216
+ try {
5217
+ const rawValue = getter.call(proxy);
5218
+ if (rawValue === void 0) return { ok: false };
5219
+ const value = toPlain(rawValue, /* @__PURE__ */ new WeakMap(), {
5220
+ maxDepth: toPlainMaxDepth,
5221
+ maxKeys: toPlainMaxKeys,
5222
+ includeFunctions,
5223
+ functionPaths,
5224
+ _path: key
5225
+ });
5226
+ if (value === void 0) return { ok: false };
5227
+ resolved[key] = value;
5228
+ return {
5229
+ ok: true,
5230
+ value
5231
+ };
5232
+ } catch (_unused) {
5233
+ return { ok: false };
5234
+ } finally {
5235
+ resolving.delete(key);
5236
+ }
5237
+ };
5238
+ proxy = new Proxy(data, {
5239
+ get(target, key, receiver) {
5240
+ if (typeof key === "string") {
5241
+ if (key === "data" || key === "$state") return data;
5242
+ if (key === "props" || key === "$props" || key === "$attrs") throw new InitialComputedBailout();
5243
+ if (hasOwn(data, key)) return Reflect.get(target, key, receiver);
5244
+ if (computed && hasOwn(computed, key)) {
5245
+ const computedValue = resolveComputedValue(key);
5246
+ if (computedValue.ok) return computedValue.value;
5247
+ throw new InitialComputedBailout();
5248
+ }
5249
+ throw new InitialComputedBailout();
5250
+ }
5251
+ return Reflect.get(target, key, receiver);
5252
+ },
5253
+ has(target, key) {
5254
+ return Reflect.has(target, key) || typeof key === "string" && Boolean(computed && hasOwn(computed, key));
5255
+ }
5256
+ });
5257
+ for (const key of computedKeys) resolveComputedValue(key);
5258
+ return Object.keys(resolved).length ? resolved : void 0;
5259
+ }
5260
+ function resolveNativeInitialData(data, computed, setData) {
5261
+ if (!data || typeof data !== "object") return data;
5262
+ const initialComputedData = resolveInitialComputedData({
5263
+ data,
5264
+ computed,
5265
+ setData
5266
+ });
5267
+ return initialComputedData ? {
5268
+ ...data,
5269
+ ...initialComputedData
5270
+ } : data;
5271
+ }
5272
+
5105
5273
  //#endregion
5106
5274
  //#region src/runtime/define/props.ts
5107
5275
  const ALLOW_NULL_PROP_INPUT_KEY = "__wevu_allowNullPropInput";
@@ -5631,10 +5799,10 @@ function defineComponent(options) {
5631
5799
  });
5632
5800
  return result;
5633
5801
  }) : void 0;
5634
- const nativeData = typeof data === "function" ? data() : data;
5635
- const mpOptionsWithProps = normalizeProps(nativeData !== void 0 ? {
5802
+ const nativeInitialData = resolveNativeInitialData(typeof data === "function" ? data() : data, computed, resolvedSetData);
5803
+ const mpOptionsWithProps = normalizeProps(nativeInitialData !== void 0 ? {
5636
5804
  ...mpOptions,
5637
- data: nativeData
5805
+ data: nativeInitialData
5638
5806
  } : mpOptions, props);
5639
5807
  const componentOptions = {
5640
5808
  data,
@@ -6432,4 +6600,4 @@ function useTemplateRef(name) {
6432
6600
 
6433
6601
  //#endregion
6434
6602
  export { setWevuDefaults as $, defineComponent as A, useLayoutHosts as B, useNavigationBarMetrics as C, isShallowRef as Ct, useDisposables as D, __reExport as Dt, useElementIntersectionObserver as E, __exportAll as Et, resolveLayoutBridge as F, teardownRuntimeInstance as G, registerApp as H, resolveLayoutHost as I, setPageLayout as J, runSetupFunction as K, unregisterPageLayoutBridge as L, registerComponent as M, registerPageLayoutBridge as N, createWevuComponent as O, registerRuntimeLayoutHosts as P, resetWevuDefaults as Q, unregisterRuntimeLayoutHosts as R, getNavigationBarMetrics as S, toRefs as St, useIntersectionObserver as T, triggerRef as Tt, mountRuntimeInstance as U, waitForLayoutHost as V, setRuntimeSetDataVisibility as W, syncRuntimePageLayoutStateFromRuntime as X, syncRuntimePageLayoutState as Y, usePageLayout as Z, useSelectorFields as _, onServerPrefetch as _t, useModel as a, watchPostEffect as at, usePageScrollThrottle as b, traverse as bt, useSlots as c, setDeepWatchStrategy as ct, useUpdatePerformanceListener as d, onBeforeMount as dt, isNoSetData as et, normalizeClass as f, onBeforeUnmount as ft, useScrollOffset as g, onMounted as gt, useBoundingClientRect as h, onErrorCaptured as ht, useChangeModel as i, watchEffect as it, createApp as j, createWevuScopedSlotComponent as k, defineAppSetup as l, callUpdateHooks as lt, resolvePropValue as m, onDeactivated as mt, mergeModels as n, version as nt, useAttrs as o, watchSyncEffect as ot, normalizeStyle as p, onBeforeUpdate as pt, resolveRuntimePageLayoutName as q, useBindModel as r, watch as rt, useNativeInstance as s, getDeepWatchStrategy as st, useTemplateRef as t, markNoSetData as tt, use as u, onActivated as ut, useSelectorQuery as v, onUnmounted as vt, usePageStack as w, shallowRef as wt, getCurrentPageStackSnapshot as x, toRef as xt, useAsyncPullDownRefresh as y, onUpdated as yt, useLayoutBridge as z };
6435
- //# sourceMappingURL=src-BtFrzbqe.mjs.map
6603
+ //# sourceMappingURL=src-C3pTdTFG.mjs.map