wevu 6.16.28 → 6.16.30

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
- import { $ as setWevuDefaults, A as defineComponent, B as useLayoutHosts, C as useNavigationBarMetrics, Ct as isShallowRef, D as useDisposables, E as useElementIntersectionObserver, F as resolveLayoutBridge, G as teardownRuntimeInstance, H as registerApp, I as resolveLayoutHost, J as setPageLayout, K as runSetupFunction, L as unregisterPageLayoutBridge, M as registerComponent, N as registerPageLayoutBridge, O as createWevuComponent, P as registerRuntimeLayoutHosts, Q as resetWevuDefaults, R as unregisterRuntimeLayoutHosts, S as getNavigationBarMetrics, St as toRefs, T as useIntersectionObserver, Tt as triggerRef, U as mountRuntimeInstance, V as waitForLayoutHost, W as setRuntimeSetDataVisibility, X as syncRuntimePageLayoutStateFromRuntime, Y as syncRuntimePageLayoutState, Z as usePageLayout, _ as useSelectorFields, _t as onServerPrefetch, a as useModel, at as watchPostEffect, b as usePageScrollThrottle, bt as traverse, c as useSlots, ct as setDeepWatchStrategy, d as useUpdatePerformanceListener, dt as onBeforeMount, et as isNoSetData, f as normalizeClass, ft as onBeforeUnmount, g as useScrollOffset, gt as onMounted, h as useBoundingClientRect, ht as onErrorCaptured, i as useChangeModel, it as watchEffect, j as createApp, k as createWevuScopedSlotComponent, l as defineAppSetup, lt as callUpdateHooks, m as resolvePropValue, mt as onDeactivated, n as mergeModels, nt as version, o as useAttrs, ot as watchSyncEffect, p as normalizeStyle, pt as onBeforeUpdate, q as resolveRuntimePageLayoutName, r as useBindModel, rt as watch, s as useNativeInstance, st as getDeepWatchStrategy, t as useTemplateRef, tt as markNoSetData, u as use, ut as onActivated, v as useSelectorQuery, vt as onUnmounted, w as usePageStack, wt as shallowRef, x as getCurrentPageStackSnapshot, xt as toRef, y as useAsyncPullDownRefresh, yt as onUpdated, z as useLayoutBridge } from "./src-DytVfRYX.mjs";
1
+ import { $ as setWevuDefaults, A as defineComponent, B as useLayoutHosts, C as useNavigationBarMetrics, Ct as isShallowRef, D as useDisposables, E as useElementIntersectionObserver, F as resolveLayoutBridge, G as teardownRuntimeInstance, H as registerApp, I as resolveLayoutHost, J as setPageLayout, K as runSetupFunction, L as unregisterPageLayoutBridge, M as registerComponent, N as registerPageLayoutBridge, O as createWevuComponent, P as registerRuntimeLayoutHosts, Q as resetWevuDefaults, R as unregisterRuntimeLayoutHosts, S as getNavigationBarMetrics, St as toRefs, T as useIntersectionObserver, Tt as triggerRef, U as mountRuntimeInstance, V as waitForLayoutHost, W as setRuntimeSetDataVisibility, X as syncRuntimePageLayoutStateFromRuntime, Y as syncRuntimePageLayoutState, Z as usePageLayout, _ as useSelectorFields, _t as onServerPrefetch, a as useModel, at as watchPostEffect, b as usePageScrollThrottle, bt as traverse, c as useSlots, ct as setDeepWatchStrategy, d as useUpdatePerformanceListener, dt as onBeforeMount, et as isNoSetData, f as normalizeClass, ft as onBeforeUnmount, g as useScrollOffset, gt as onMounted, h as useBoundingClientRect, ht as onErrorCaptured, i as useChangeModel, it as watchEffect, j as createApp, k as createWevuScopedSlotComponent, l as defineAppSetup, lt as callUpdateHooks, m as resolvePropValue, mt as onDeactivated, n as mergeModels, nt as version, o as useAttrs, ot as watchSyncEffect, p as normalizeStyle, pt as onBeforeUpdate, q as resolveRuntimePageLayoutName, r as useBindModel, rt as watch, s as useNativeInstance, st as getDeepWatchStrategy, t as useTemplateRef, tt as markNoSetData, u as use, ut as onActivated, v as useSelectorQuery, vt as onUnmounted, w as usePageStack, wt as shallowRef, x as getCurrentPageStackSnapshot, xt as toRef, y as useAsyncPullDownRefresh, yt as onUpdated, z as useLayoutBridge } from "./src-B6draUWz.mjs";
2
2
  import { C as effect, D as onScopeDispose, E as getCurrentScope, N as nextTick, O as startBatch, 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, k as stop, l as isReactive, n as isRef, o as unref, p as shallowReactive, s as getReactiveVersion, t as customRef, u as markRaw, w as effectScope, x as removeMutationRecorder, y as toRaw } from "./ref-BoBfMdVt.mjs";
3
3
  import { i as computed, n as defineStore, r as createStore, t as storeToRefs } from "./store-eNxaNZbj.mjs";
4
4
  import { $ as onUnhandledRejection, A as setGlobalProvidedValue, B as onPageNotFound, 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, P as onError, Q as onThemeChange, R as onMemoryWarning, 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, ct as setCurrentSetupContext, et as onUnload, g as injectGlobal, gt as isReadonly, h as inject, ht as isProxy, it as getCurrentInstance, j as onAddToFavorites, m as hasInjectionContext, n as useNativeRouter, nt as callHookList, q as onSaveExitState, rt as callHookReturn, st as setCurrentInstance, t as useNativePageRouter, v as provideGlobal, vt as shallowReadonly, z as onMoved } from "./router-ByTtgUmi.mjs";
@@ -478,7 +478,7 @@ function watchSyncEffect(effectFn, options = {}) {
478
478
 
479
479
  //#endregion
480
480
  //#region package.json
481
- var version$1 = "6.16.28";
481
+ var version$1 = "6.16.30";
482
482
 
483
483
  //#endregion
484
484
  //#region src/version.ts
@@ -525,15 +525,16 @@ function setWithSegments(target, segments, value) {
525
525
  }
526
526
  current[segments[segments.length - 1]] = value;
527
527
  }
528
- function setByPath(state, computedRefs, computedSetters, segments, value) {
528
+ function setByPath(state, setupState, computedRefs, computedSetters, segments, value) {
529
529
  if (!segments.length) return;
530
530
  const [head, ...rest] = segments;
531
531
  if (!rest.length) {
532
532
  if (computedRefs[head]) setComputedValue(computedSetters, head, value);
533
533
  else {
534
- const current = state[head];
534
+ const target = setupState && Object.prototype.hasOwnProperty.call(setupState, head) ? setupState : state;
535
+ const current = target[head];
535
536
  if (isRef(current)) current.value = value;
536
- else state[head] = value;
537
+ else target[head] = value;
537
538
  }
538
539
  return;
539
540
  }
@@ -541,8 +542,9 @@ function setByPath(state, computedRefs, computedSetters, segments, value) {
541
542
  setComputedValue(computedSetters, head, value);
542
543
  return;
543
544
  }
544
- if (state[head] == null || typeof state[head] !== "object") state[head] = {};
545
- setWithSegments(state[head], rest, value);
545
+ const target = setupState && Object.prototype.hasOwnProperty.call(setupState, head) ? setupState : state;
546
+ if (target[head] == null || typeof target[head] !== "object") target[head] = {};
547
+ setWithSegments(target[head], rest, value);
546
548
  }
547
549
  function getFromPath(target, segments) {
548
550
  return segments.reduce((acc, segment) => {
@@ -553,13 +555,13 @@ function getFromPath(target, segments) {
553
555
  function defaultParser(event) {
554
556
  return parseModelEventValue(event);
555
557
  }
556
- function createBindModel(publicInstance, state, computedRefs, computedSetters) {
558
+ function createBindModel(publicInstance, state, computedRefs, computedSetters, setupState) {
557
559
  const bindModel = (path, bindingOptions) => {
558
560
  const segments = toPathSegments(path);
559
561
  if (!segments.length) throw new Error("bindModel 需要非空路径");
560
562
  const resolveValue = () => getFromPath(publicInstance, segments);
561
563
  const assignValue = (value) => {
562
- setByPath(state, computedRefs, computedSetters, segments, value);
564
+ setByPath(state, setupState, computedRefs, computedSetters, segments, value);
563
565
  };
564
566
  const defaultOptions = {
565
567
  event: "input",
@@ -1555,7 +1557,7 @@ function runPatchUpdate(options) {
1555
1557
  //#endregion
1556
1558
  //#region src/runtime/app/setData/scheduler.ts
1557
1559
  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;
1560
+ 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
1561
  const plainCache = /* @__PURE__ */ new WeakMap();
1560
1562
  let latestSnapshot = {};
1561
1563
  let latestComputedSnapshot = Object.create(null);
@@ -1607,6 +1609,25 @@ function createSetDataScheduler(options) {
1607
1609
  return left.raw === right.raw && left.version === right.version;
1608
1610
  };
1609
1611
  const shouldIncludeSnapshotKey = (key) => shouldIncludeKey(key) && !(snapshotOmitKeys === null || snapshotOmitKeys === void 0 ? void 0 : snapshotOmitKeys.has(key));
1612
+ if (initialSnapshot) {
1613
+ for (const [key, value] of Object.entries(initialSnapshot)) if (shouldIncludeSnapshotKey(key)) latestSnapshot[key] = value;
1614
+ }
1615
+ const syncInitialSnapshotTokens = () => {
1616
+ if (!initialSnapshot) return;
1617
+ const rawState = isReactive(state) ? toRaw(state) : state;
1618
+ const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
1619
+ for (const key of Object.keys(initialSnapshot)) {
1620
+ if (!shouldIncludeSnapshotKey(key)) continue;
1621
+ if (rawSetupState && hasOwn(rawSetupState, key)) {
1622
+ latestStateTokens[key] = createValueToken(rawSetupState[key]);
1623
+ continue;
1624
+ }
1625
+ if (hasOwn(rawState, key)) {
1626
+ rawState[key] = initialSnapshot[key];
1627
+ latestStateTokens[key] = createValueToken(rawState[key]);
1628
+ }
1629
+ }
1630
+ };
1610
1631
  const resolveTopKeysByRoot = (root) => {
1611
1632
  const matches = [];
1612
1633
  const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
@@ -1640,6 +1661,7 @@ function createSetDataScheduler(options) {
1640
1661
  includeFunctions,
1641
1662
  functionPaths
1642
1663
  });
1664
+ syncInitialSnapshotTokens();
1643
1665
  const collectDiffSnapshot = () => {
1644
1666
  const rawState = isReactive(state) ? toRaw(state) : state;
1645
1667
  const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
@@ -1906,6 +1928,7 @@ function createRuntimeMount(options) {
1906
1928
  const setupState = reactive(Object.create(null));
1907
1929
  const adapterSnapshotOmitKeys = adapter === null || adapter === void 0 ? void 0 : adapter.__wevu_snapshotOmitKeys;
1908
1930
  const deferInitialSnapshot = Boolean(adapter === null || adapter === void 0 ? void 0 : adapter.__wevu_deferInitialSnapshot);
1931
+ const adapterInitialSnapshot = adapter === null || adapter === void 0 ? void 0 : adapter.__wevu_initialSnapshot;
1909
1932
  const snapshotOmitKeys = new Set(adapterSnapshotOmitKeys instanceof Set ? adapterSnapshotOmitKeys : Array.isArray(adapterSnapshotOmitKeys) ? adapterSnapshotOmitKeys : []);
1910
1933
  if (rawState && typeof rawState === "object" && !hasOwn(rawState, WEVU_SETUP_STATE_KEY)) try {
1911
1934
  Object.defineProperty(rawState, WEVU_SETUP_STATE_KEY, {
@@ -1971,7 +1994,8 @@ function createRuntimeMount(options) {
1971
1994
  debugWhen: mergedDebugWhen,
1972
1995
  debugSampleRate,
1973
1996
  runTracker: () => tracker === null || tracker === void 0 ? void 0 : tracker(),
1974
- isMounted: () => mounted
1997
+ isMounted: () => mounted,
1998
+ initialSnapshot: adapterInitialSnapshot && typeof adapterInitialSnapshot === "object" ? adapterInitialSnapshot : void 0
1975
1999
  });
1976
2000
  const job = () => scheduler.job(stateRootRaw);
1977
2001
  const mutationRecorder = (record) => scheduler.mutationRecorder(record, stateRootRaw);
@@ -2010,7 +2034,7 @@ function createRuntimeMount(options) {
2010
2034
  if (index >= 0) stopHandles.splice(index, 1);
2011
2035
  }, stopHandle);
2012
2036
  }
2013
- const bindModel = createBindModel(publicInstance, state, computedRefs, computedSetters);
2037
+ const bindModel = createBindModel(publicInstance, state, computedRefs, computedSetters, setupState);
2014
2038
  const unmount = () => {
2015
2039
  if (!mounted) return;
2016
2040
  mounted = false;
@@ -3250,6 +3274,9 @@ function ensureRuntimeProps(target, runtimeState, mpProperties = target.properti
3250
3274
  function normalizeEmitEventName(eventName) {
3251
3275
  return eventName.includes(":") ? eventName.replaceAll(":", "-").toLowerCase() : eventName;
3252
3276
  }
3277
+ function isInternalAttrKey(key) {
3278
+ return key.startsWith("__wv_");
3279
+ }
3253
3280
  function runRuntimeSetupPhase(options) {
3254
3281
  var _runtimeWithDefaults$;
3255
3282
  const { target, runtime, runtimeWithDefaults, runtimeState, runtimeProxy, setup } = options;
@@ -3261,10 +3288,10 @@ function runRuntimeSetupPhase(options) {
3261
3288
  };
3262
3289
  const syncAttrsFromProperties = () => {
3263
3290
  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];
3291
+ for (const existingKey of Object.keys(attrs)) if (!next || !hasOwn(next, existingKey) || isInternalAttrKey(existingKey) || declaredPropKeys.has(existingKey) || hasRuntimeStateKey(existingKey)) delete attrs[existingKey];
3265
3292
  if (!next) return;
3266
3293
  for (const [key, value] of Object.entries(next)) {
3267
- if (declaredPropKeys.has(key) || hasRuntimeStateKey(key)) continue;
3294
+ if (isInternalAttrKey(key) || declaredPropKeys.has(key) || hasRuntimeStateKey(key)) continue;
3268
3295
  attrs[key] = value;
3269
3296
  }
3270
3297
  };
@@ -3495,6 +3522,38 @@ function registerWatches(runtime, watchMap, instance) {
3495
3522
 
3496
3523
  //#endregion
3497
3524
  //#region src/runtime/register/runtimeInstance.ts
3525
+ function cloneInitialSnapshotValue(value, cache = /* @__PURE__ */ new WeakMap()) {
3526
+ if (!value || typeof value !== "object") return value;
3527
+ if (cache.has(value)) return cache.get(value);
3528
+ if (Array.isArray(value)) {
3529
+ const next = [];
3530
+ cache.set(value, next);
3531
+ for (const item of value) next.push(cloneInitialSnapshotValue(item, cache));
3532
+ return next;
3533
+ }
3534
+ const next = {};
3535
+ cache.set(value, next);
3536
+ for (const [key, child] of Object.entries(value)) next[key] = cloneInitialSnapshotValue(child, cache);
3537
+ return next;
3538
+ }
3539
+ function resolveInitialSnapshotFromNativeData(target, omitKeys, extraEntries) {
3540
+ const data = target.data;
3541
+ if ((!data || typeof data !== "object") && (!extraEntries || !Object.keys(extraEntries).length)) return;
3542
+ const omitSet = Array.isArray(omitKeys) && omitKeys.length ? new Set(omitKeys) : void 0;
3543
+ const snapshot = {};
3544
+ if (data && typeof data === "object") for (const [key, value] of Object.entries(data)) {
3545
+ if (omitSet === null || omitSet === void 0 ? void 0 : omitSet.has(key)) continue;
3546
+ snapshot[key] = cloneInitialSnapshotValue(value);
3547
+ }
3548
+ if (extraEntries) for (const [key, value] of Object.entries(extraEntries)) {
3549
+ if (omitSet === null || omitSet === void 0 ? void 0 : omitSet.has(key)) continue;
3550
+ snapshot[key] = cloneInitialSnapshotValue(value);
3551
+ }
3552
+ return snapshot;
3553
+ }
3554
+ function hasTemplateRuntimeBindings(runtimeApp) {
3555
+ return Boolean(runtimeApp === null || runtimeApp === void 0 ? void 0 : runtimeApp.__wevuHasTemplateRuntimeBindings);
3556
+ }
3498
3557
  function attachPageLayoutSetter(target) {
3499
3558
  if (typeof target.route !== "string" || !target.route) return;
3500
3559
  target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
@@ -3604,7 +3663,15 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
3604
3663
  value: options.snapshotOmitKeys,
3605
3664
  writable: false
3606
3665
  });
3607
- if (setup) Object.defineProperty(baseMountAdapter, "__wevu_deferInitialSnapshot", {
3666
+ const initialSnapshot = resolveInitialSnapshotFromNativeData(target, options === null || options === void 0 ? void 0 : options.snapshotOmitKeys, hasTemplateRuntimeBindings(runtimeApp) ? void 0 : { [WEVU_SLOT_OWNER_ID_KEY]: ownerId });
3667
+ if (initialSnapshot && Object.keys(initialSnapshot).length) Object.defineProperty(baseMountAdapter, "__wevu_initialSnapshot", {
3668
+ configurable: true,
3669
+ enumerable: false,
3670
+ value: initialSnapshot,
3671
+ writable: false
3672
+ });
3673
+ const targetProperties = target.properties;
3674
+ if (Boolean(setup) || Boolean(targetProperties && typeof targetProperties === "object" && Object.keys(targetProperties).length > 0)) Object.defineProperty(baseMountAdapter, "__wevu_deferInitialSnapshot", {
3608
3675
  configurable: true,
3609
3676
  enumerable: false,
3610
3677
  value: true,
@@ -3669,7 +3736,6 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
3669
3736
  if (stops.length) target[WEVU_WATCH_STOPS_KEY] = stops;
3670
3737
  }
3671
3738
  if (setup) {
3672
- var _runtimeWithSyncFlush;
3673
3739
  runRuntimeSetupPhase({
3674
3740
  target,
3675
3741
  runtime,
@@ -3678,7 +3744,10 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
3678
3744
  runtimeProxy,
3679
3745
  setup
3680
3746
  });
3681
- (_runtimeWithSyncFlush = runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync) === null || _runtimeWithSyncFlush === void 0 || _runtimeWithSyncFlush.call(runtimeWithSyncFlush);
3747
+ if (!(options === null || options === void 0 ? void 0 : options.deferSetData)) {
3748
+ var _runtimeWithSyncFlush;
3749
+ (_runtimeWithSyncFlush = runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync) === null || _runtimeWithSyncFlush === void 0 || _runtimeWithSyncFlush.call(runtimeWithSyncFlush);
3750
+ }
3682
3751
  refreshOwnerSnapshot();
3683
3752
  } else if (target.properties && typeof target.properties === "object" && Object.keys(target.properties).length > 0) {
3684
3753
  var _runtimeWithSyncFlush2;
@@ -3688,14 +3757,23 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
3688
3757
  bridgeRuntimeMethodsToTarget(target, runtime);
3689
3758
  return runtime;
3690
3759
  }
3760
+ function syncRuntimeStateFromNativeData(target) {
3761
+ var _target$__wevu2;
3762
+ const runtimeState = (_target$__wevu2 = target.__wevu) === null || _target$__wevu2 === void 0 ? void 0 : _target$__wevu2.state;
3763
+ const nativeData = target.data;
3764
+ if (!runtimeState || typeof runtimeState !== "object" || !nativeData || typeof nativeData !== "object") return;
3765
+ for (const [key, value] of Object.entries(nativeData)) if (Object.prototype.hasOwnProperty.call(runtimeState, key)) runtimeState[key] = value;
3766
+ }
3691
3767
  function enableDeferredSetData(target) {
3692
- var _wevu;
3768
+ var _wevu, _wevu2, _wevu2$__wevu_flushSe;
3693
3769
  const adapter = (_wevu = target.__wevu) === null || _wevu === void 0 ? void 0 : _wevu.adapter;
3770
+ syncRuntimeStateFromNativeData(target);
3771
+ (_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
3772
  if (adapter && typeof adapter.__wevu_enableSetData === "function") adapter.__wevu_enableSetData();
3695
3773
  }
3696
3774
  function setRuntimeSetDataVisibility(target, visible) {
3697
- var _wevu2;
3698
- const adapter = (_wevu2 = target.__wevu) === null || _wevu2 === void 0 ? void 0 : _wevu2.adapter;
3775
+ var _wevu3;
3776
+ const adapter = (_wevu3 = target.__wevu) === null || _wevu3 === void 0 ? void 0 : _wevu3.adapter;
3699
3777
  if (adapter && typeof adapter.__wevu_setVisibility === "function") adapter.__wevu_setVisibility(visible);
3700
3778
  }
3701
3779
  /**
@@ -4355,6 +4433,7 @@ function createPropsSync(options) {
4355
4433
  const aliasKeySet = new Set(aliasEntries.map(([alias]) => alias));
4356
4434
  const directPropsDerivedKeys = [...propsDerivedKeySet].filter((key) => propKeySet.has(key) && !aliasKeySet.has(key));
4357
4435
  const syncedAliases = /* @__PURE__ */ new WeakMap();
4436
+ const isInternalAttrKey = (key) => key.startsWith("__wv_");
4358
4437
  const updateSnapshotOmitKeys = (instance) => {
4359
4438
  const runtime = instance.__wevu;
4360
4439
  const snapshotOmitKeys = runtime === null || runtime === void 0 ? void 0 : runtime[WEVU_PROPS_DERIVED_KEYS_KEY];
@@ -4427,7 +4506,7 @@ function createPropsSync(options) {
4427
4506
  const properties = instance.properties;
4428
4507
  const next = properties && typeof properties === "object" ? properties : void 0;
4429
4508
  const currentKeys = Object.keys(attrsProxy);
4430
- for (const existingKey of currentKeys) if (!next || !hasOwn(next, existingKey) || propKeySet.has(existingKey) || hasRuntimeStateKey(existingKey)) try {
4509
+ for (const existingKey of currentKeys) if (!next || !hasOwn(next, existingKey) || isInternalAttrKey(existingKey) || propKeySet.has(existingKey) || hasRuntimeStateKey(existingKey)) try {
4431
4510
  delete attrsProxy[existingKey];
4432
4511
  } catch (_unused5) {}
4433
4512
  if (!next) {
@@ -4435,7 +4514,7 @@ function createPropsSync(options) {
4435
4514
  return;
4436
4515
  }
4437
4516
  for (const [key, value] of Object.entries(next)) {
4438
- if (propKeySet.has(key) || hasRuntimeStateKey(key)) continue;
4517
+ if (isInternalAttrKey(key) || propKeySet.has(key) || hasRuntimeStateKey(key)) continue;
4439
4518
  try {
4440
4519
  attrsProxy[key] = value;
4441
4520
  } catch (_unused6) {}
@@ -5088,8 +5167,15 @@ function createApp(options) {
5088
5167
  enumerable: false,
5089
5168
  writable: false
5090
5169
  });
5170
+ Object.defineProperty(runtimeApp, "__wevuHasTemplateRuntimeBindings", {
5171
+ value: Object.keys(resolvedComputed).some((key) => key.startsWith("__wv_bind_")),
5172
+ configurable: true,
5173
+ enumerable: false,
5174
+ writable: false
5175
+ });
5091
5176
  } catch (_unused) {
5092
5177
  runtimeApp.__wevuSetDataOptions = setDataOptions;
5178
+ runtimeApp.__wevuHasTemplateRuntimeBindings = Object.keys(resolvedComputed).some((key) => key.startsWith("__wv_bind_"));
5093
5179
  }
5094
5180
  if (hasGlobalApp) {
5095
5181
  const globalObject = getMiniProgramGlobalObject();
@@ -5102,6 +5188,90 @@ function createApp(options) {
5102
5188
  return runtimeApp;
5103
5189
  }
5104
5190
 
5191
+ //#endregion
5192
+ //#region src/runtime/define/initialComputed.ts
5193
+ var InitialComputedBailout = class extends Error {};
5194
+ function resolveComputedGetter(definition) {
5195
+ if (typeof definition === "function") return definition;
5196
+ const getter = definition === null || definition === void 0 ? void 0 : definition.get;
5197
+ return typeof getter === "function" ? getter : void 0;
5198
+ }
5199
+ function resolveInitialComputedData(options) {
5200
+ const { data, computed, setData } = options;
5201
+ const computedKeys = computed ? Object.keys(computed) : [];
5202
+ if (!computedKeys.length) return;
5203
+ const { includeComputed, shouldIncludeKey, toPlainMaxDepth, toPlainMaxKeys, includeFunctions, functionPaths } = resolveSetDataOptions(setData);
5204
+ if (!includeComputed) return;
5205
+ const resolved = {};
5206
+ const resolving = /* @__PURE__ */ new Set();
5207
+ let proxy;
5208
+ const resolveComputedValue = (key) => {
5209
+ if (hasOwn(data, key) || !shouldIncludeKey(key)) return { ok: false };
5210
+ if (hasOwn(resolved, key)) return {
5211
+ ok: true,
5212
+ value: resolved[key]
5213
+ };
5214
+ if (resolving.has(key)) return { ok: false };
5215
+ const getter = resolveComputedGetter(computed[key]);
5216
+ if (!getter) return { ok: false };
5217
+ resolving.add(key);
5218
+ try {
5219
+ const rawValue = getter.call(proxy);
5220
+ if (rawValue === void 0) return { ok: false };
5221
+ const value = toPlain(rawValue, /* @__PURE__ */ new WeakMap(), {
5222
+ maxDepth: toPlainMaxDepth,
5223
+ maxKeys: toPlainMaxKeys,
5224
+ includeFunctions,
5225
+ functionPaths,
5226
+ _path: key
5227
+ });
5228
+ if (value === void 0) return { ok: false };
5229
+ resolved[key] = value;
5230
+ return {
5231
+ ok: true,
5232
+ value
5233
+ };
5234
+ } catch (_unused) {
5235
+ return { ok: false };
5236
+ } finally {
5237
+ resolving.delete(key);
5238
+ }
5239
+ };
5240
+ proxy = new Proxy(data, {
5241
+ get(target, key, receiver) {
5242
+ if (typeof key === "string") {
5243
+ if (key === "data" || key === "$state") return data;
5244
+ if (key === "props" || key === "$props" || key === "$attrs") throw new InitialComputedBailout();
5245
+ if (hasOwn(data, key)) return Reflect.get(target, key, receiver);
5246
+ if (computed && hasOwn(computed, key)) {
5247
+ const computedValue = resolveComputedValue(key);
5248
+ if (computedValue.ok) return computedValue.value;
5249
+ throw new InitialComputedBailout();
5250
+ }
5251
+ throw new InitialComputedBailout();
5252
+ }
5253
+ return Reflect.get(target, key, receiver);
5254
+ },
5255
+ has(target, key) {
5256
+ return Reflect.has(target, key) || typeof key === "string" && Boolean(computed && hasOwn(computed, key));
5257
+ }
5258
+ });
5259
+ for (const key of computedKeys) resolveComputedValue(key);
5260
+ return Object.keys(resolved).length ? resolved : void 0;
5261
+ }
5262
+ function resolveNativeInitialData(data, computed, setData) {
5263
+ if (!data || typeof data !== "object") return data;
5264
+ const initialComputedData = resolveInitialComputedData({
5265
+ data,
5266
+ computed,
5267
+ setData
5268
+ });
5269
+ return initialComputedData ? {
5270
+ ...data,
5271
+ ...initialComputedData
5272
+ } : data;
5273
+ }
5274
+
5105
5275
  //#endregion
5106
5276
  //#region src/runtime/define/props.ts
5107
5277
  const ALLOW_NULL_PROP_INPUT_KEY = "__wevu_allowNullPropInput";
@@ -5631,10 +5801,10 @@ function defineComponent(options) {
5631
5801
  });
5632
5802
  return result;
5633
5803
  }) : void 0;
5634
- const nativeData = typeof data === "function" ? data() : data;
5635
- const mpOptionsWithProps = normalizeProps(nativeData !== void 0 ? {
5804
+ const nativeInitialData = resolveNativeInitialData(typeof data === "function" ? data() : data, computed, resolvedSetData);
5805
+ const mpOptionsWithProps = normalizeProps(nativeInitialData !== void 0 ? {
5636
5806
  ...mpOptions,
5637
- data: nativeData
5807
+ data: nativeInitialData
5638
5808
  } : mpOptions, props);
5639
5809
  const componentOptions = {
5640
5810
  data,
@@ -6432,4 +6602,4 @@ function useTemplateRef(name) {
6432
6602
 
6433
6603
  //#endregion
6434
6604
  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-DytVfRYX.mjs.map
6605
+ //# sourceMappingURL=src-B6draUWz.mjs.map