wevu 6.16.20 → 6.16.21
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.
- package/dist/dev/index.mjs +2 -2
- package/dist/dev/{src-CJb8KQQ7.mjs → src-DzpEFK_c.mjs} +229 -98
- package/dist/dev/src-DzpEFK_c.mjs.map +1 -0
- package/dist/dev/vue-demi.mjs +3 -2
- package/dist/dev/vue-demi.mjs.map +1 -1
- package/dist/{index-D80WRkiI.d.mts → index-C6Jyiw-u.d.mts} +1 -1
- package/dist/{index-Bxb8bDDq.d.mts → index-CLoFnRY3.d.mts} +4 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/router.d.mts +1 -1
- package/dist/src-BEdCjQDq.mjs +1 -0
- package/dist/store.d.mts +1 -1
- package/dist/vue-demi.d.mts +5 -5
- package/dist/vue-demi.mjs +1 -1
- package/dist/{vue-types-CnYCFrPB.d.mts → vue-types-xMdYZRuG.d.mts} +1 -0
- package/package.json +4 -4
- package/dist/dev/src-CJb8KQQ7.mjs.map +0 -1
- package/dist/src-BKst3zxN.mjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
import { i as computed, n as defineStore, r as createStore, t as storeToRefs } from "./store-Bazm64zK.mjs";
|
|
3
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";
|
|
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_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_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";
|
|
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";
|
|
7
7
|
|
|
@@ -478,7 +478,7 @@ function watchSyncEffect(effectFn, options = {}) {
|
|
|
478
478
|
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region package.json
|
|
481
|
-
var version$1 = "6.16.
|
|
481
|
+
var version$1 = "6.16.21";
|
|
482
482
|
|
|
483
483
|
//#endregion
|
|
484
484
|
//#region src/version.ts
|
|
@@ -734,7 +734,7 @@ function createComputedAccessors(options) {
|
|
|
734
734
|
//#endregion
|
|
735
735
|
//#region src/runtime/app/context.ts
|
|
736
736
|
function createRuntimeContext(options) {
|
|
737
|
-
const { state, computedDefs, methodDefs, appConfig, includeComputed, setDataStrategy } = options;
|
|
737
|
+
const { state, setupState, computedDefs, methodDefs, appConfig, includeComputed, setDataStrategy } = options;
|
|
738
738
|
const boundMethods = {};
|
|
739
739
|
const { computedRefs, computedSetters, dirtyComputedKeys, createTrackedComputed, computedProxy } = createComputedAccessors({
|
|
740
740
|
includeComputed,
|
|
@@ -775,6 +775,11 @@ function createRuntimeContext(options) {
|
|
|
775
775
|
get(target, key, receiver) {
|
|
776
776
|
if (typeof key === "string") {
|
|
777
777
|
setupMethodVersion.value;
|
|
778
|
+
if (hasOwn(setupState, key)) return Reflect.get(setupState, key, receiver);
|
|
779
|
+
if (key === "props") {
|
|
780
|
+
const props = target[WEVU_PROPS_KEY];
|
|
781
|
+
if (props && typeof props === "object") return props;
|
|
782
|
+
}
|
|
778
783
|
if (key === "data") return state;
|
|
779
784
|
if (key === "$state") return state;
|
|
780
785
|
if (key === "$computed") return computedProxy;
|
|
@@ -790,19 +795,31 @@ function createRuntimeContext(options) {
|
|
|
790
795
|
return nativeValue;
|
|
791
796
|
}
|
|
792
797
|
}
|
|
793
|
-
|
|
798
|
+
const targetValue = Reflect.get(target, key, receiver);
|
|
799
|
+
if (typeof key === "string" && hasOwn(setupState, key)) return Reflect.get(setupState, key, receiver);
|
|
800
|
+
return targetValue;
|
|
794
801
|
},
|
|
795
802
|
set(target, key, value, receiver) {
|
|
796
803
|
if (typeof key === "string" && computedRefs[key]) {
|
|
797
804
|
setComputedValue(computedSetters, key, value);
|
|
798
805
|
return true;
|
|
799
806
|
}
|
|
807
|
+
if (hasOwn(setupState, key)) {
|
|
808
|
+
const existingValue = Reflect.get(setupState, key, receiver);
|
|
809
|
+
if (isRef(existingValue) && !isRef(value)) {
|
|
810
|
+
existingValue.value = value;
|
|
811
|
+
return true;
|
|
812
|
+
}
|
|
813
|
+
return Reflect.set(setupState, key, value, receiver);
|
|
814
|
+
}
|
|
800
815
|
if (Reflect.has(target, key)) {
|
|
816
|
+
var _WEVU_PROPS_KEY;
|
|
801
817
|
const existingValue = Reflect.get(target, key, receiver);
|
|
802
818
|
if (isRef(existingValue) && !isRef(value)) {
|
|
803
819
|
existingValue.value = value;
|
|
804
820
|
return true;
|
|
805
821
|
}
|
|
822
|
+
if (hasOwn((_WEVU_PROPS_KEY = target[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : {}, key)) return Reflect.set(setupState, key, value, receiver);
|
|
806
823
|
return Reflect.set(target, key, value, receiver);
|
|
807
824
|
}
|
|
808
825
|
const nativeInstance = resolveNativeInstance(target, receiver);
|
|
@@ -811,7 +828,7 @@ function createRuntimeContext(options) {
|
|
|
811
828
|
},
|
|
812
829
|
has(target, key) {
|
|
813
830
|
if (key === "data") return true;
|
|
814
|
-
if (typeof key === "string" && (computedRefs[key] || hasOwn(boundMethods, key))) return true;
|
|
831
|
+
if (typeof key === "string" && (hasOwn(setupState, key) || computedRefs[key] || hasOwn(boundMethods, key))) return true;
|
|
815
832
|
const nativeInstance = resolveNativeInstance(target, target);
|
|
816
833
|
if (nativeInstance && Reflect.has(nativeInstance, key)) return true;
|
|
817
834
|
return Reflect.has(target, key);
|
|
@@ -821,11 +838,15 @@ function createRuntimeContext(options) {
|
|
|
821
838
|
Reflect.ownKeys(target).forEach((key) => {
|
|
822
839
|
keys.add(key);
|
|
823
840
|
});
|
|
841
|
+
Reflect.ownKeys(setupState).forEach((key) => {
|
|
842
|
+
keys.add(key);
|
|
843
|
+
});
|
|
824
844
|
Object.keys(boundMethods).forEach((key) => keys.add(key));
|
|
825
845
|
Object.keys(computedRefs).forEach((key) => keys.add(key));
|
|
826
846
|
return [...keys];
|
|
827
847
|
},
|
|
828
848
|
getOwnPropertyDescriptor(target, key) {
|
|
849
|
+
if (typeof key === "string" && hasOwn(setupState, key)) return Object.getOwnPropertyDescriptor(setupState, key);
|
|
829
850
|
if (Reflect.has(target, key)) return Object.getOwnPropertyDescriptor(target, key);
|
|
830
851
|
if (typeof key === "string") {
|
|
831
852
|
if (key === "data") return {
|
|
@@ -1325,12 +1346,14 @@ function applySnapshotUpdate(snapshot, path, value, op, options) {
|
|
|
1325
1346
|
else current[leaf] = cloneValue ? cloneSnapshotValue(value) : value;
|
|
1326
1347
|
}
|
|
1327
1348
|
function collectSnapshot(options) {
|
|
1328
|
-
const { state, computedRefs, includeComputed, shouldIncludeKey, plainCache, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths = [] } = options;
|
|
1349
|
+
const { state, setupState, computedRefs, includeComputed, shouldIncludeKey, plainCache, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths = [] } = options;
|
|
1329
1350
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
1330
1351
|
const out = {};
|
|
1331
1352
|
const budget = Number.isFinite(toPlainMaxKeys) ? { keys: toPlainMaxKeys } : void 0;
|
|
1332
1353
|
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
1354
|
+
const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
|
|
1333
1355
|
const stateKeys = Object.keys(rawState);
|
|
1356
|
+
const setupStateKeys = rawSetupState ? Object.keys(rawSetupState) : [];
|
|
1334
1357
|
const computedKeys = includeComputed ? Object.keys(computedRefs) : [];
|
|
1335
1358
|
for (const key of stateKeys) {
|
|
1336
1359
|
if (!shouldIncludeKey(key)) continue;
|
|
@@ -1343,6 +1366,17 @@ function collectSnapshot(options) {
|
|
|
1343
1366
|
_path: key
|
|
1344
1367
|
});
|
|
1345
1368
|
}
|
|
1369
|
+
for (const key of setupStateKeys) {
|
|
1370
|
+
if (!shouldIncludeKey(key)) continue;
|
|
1371
|
+
out[key] = toPlain(rawSetupState[key], seen, {
|
|
1372
|
+
cache: plainCache,
|
|
1373
|
+
maxDepth: toPlainMaxDepth,
|
|
1374
|
+
includeFunctions,
|
|
1375
|
+
functionPaths,
|
|
1376
|
+
_budget: budget,
|
|
1377
|
+
_path: key
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1346
1380
|
for (const key of computedKeys) {
|
|
1347
1381
|
if (!shouldIncludeKey(key)) continue;
|
|
1348
1382
|
out[key] = toPlain(computedRefs[key].value, seen, {
|
|
@@ -1512,7 +1546,7 @@ function runPatchUpdate(options) {
|
|
|
1512
1546
|
//#endregion
|
|
1513
1547
|
//#region src/runtime/app/setData/scheduler.ts
|
|
1514
1548
|
function createSetDataScheduler(options) {
|
|
1515
|
-
const { state, 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;
|
|
1549
|
+
const { state, setupState, 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;
|
|
1516
1550
|
const plainCache = /* @__PURE__ */ new WeakMap();
|
|
1517
1551
|
let latestSnapshot = {};
|
|
1518
1552
|
let latestComputedSnapshot = Object.create(null);
|
|
@@ -1565,9 +1599,10 @@ function createSetDataScheduler(options) {
|
|
|
1565
1599
|
};
|
|
1566
1600
|
const resolveTopKeysByRoot = (root) => {
|
|
1567
1601
|
const matches = [];
|
|
1568
|
-
|
|
1602
|
+
const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
|
|
1603
|
+
for (const key of new Set([...Object.keys(state), ...rawSetupState ? Object.keys(rawSetupState) : []])) {
|
|
1569
1604
|
if (!shouldIncludeKey(key)) continue;
|
|
1570
|
-
const value = state[key];
|
|
1605
|
+
const value = rawSetupState && hasOwn(rawSetupState, key) ? rawSetupState[key] : state[key];
|
|
1571
1606
|
const candidate = isRef(value) ? value.value : value;
|
|
1572
1607
|
if (!candidate || typeof candidate !== "object") continue;
|
|
1573
1608
|
if (toRaw(candidate) === root) matches.push(key);
|
|
@@ -1585,6 +1620,7 @@ function createSetDataScheduler(options) {
|
|
|
1585
1620
|
};
|
|
1586
1621
|
const collect = () => collectSnapshot({
|
|
1587
1622
|
state,
|
|
1623
|
+
setupState,
|
|
1588
1624
|
computedRefs,
|
|
1589
1625
|
includeComputed,
|
|
1590
1626
|
shouldIncludeKey,
|
|
@@ -1596,18 +1632,20 @@ function createSetDataScheduler(options) {
|
|
|
1596
1632
|
});
|
|
1597
1633
|
const collectDiffSnapshot = () => {
|
|
1598
1634
|
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
1635
|
+
const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
|
|
1599
1636
|
const nextSnapshot = { ...latestSnapshot };
|
|
1600
1637
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
1601
1638
|
const includedStateKeys = /* @__PURE__ */ new Set();
|
|
1602
1639
|
const includedComputedKeys = /* @__PURE__ */ new Set();
|
|
1603
1640
|
const replacedTopLevelKeys = /* @__PURE__ */ new Set();
|
|
1604
|
-
for (const key of Object.keys(rawState)) {
|
|
1641
|
+
for (const key of new Set([...Object.keys(rawState), ...rawSetupState ? Object.keys(rawSetupState) : []])) {
|
|
1605
1642
|
if (!shouldIncludeKey(key)) continue;
|
|
1606
1643
|
includedStateKeys.add(key);
|
|
1607
|
-
const
|
|
1644
|
+
const source = rawSetupState && hasOwn(rawSetupState, key) ? rawSetupState : rawState;
|
|
1645
|
+
const token = createValueToken(source[key]);
|
|
1608
1646
|
const previousToken = latestStateTokens[key];
|
|
1609
1647
|
if (previousToken && token && typeof previousToken === "object" && typeof token === "object" && hasOwn(previousToken, "raw") && hasOwn(token, "raw") && Array.isArray(previousToken.raw) && Array.isArray(token.raw) && previousToken.raw !== token.raw) replacedTopLevelKeys.add(key);
|
|
1610
|
-
if (!isSameToken(previousToken, token) || !hasOwn(latestSnapshot, key)) nextSnapshot[key] = toPlain(
|
|
1648
|
+
if (!isSameToken(previousToken, token) || !hasOwn(latestSnapshot, key)) nextSnapshot[key] = toPlain(source[key], seen, {
|
|
1611
1649
|
cache: plainCache,
|
|
1612
1650
|
maxDepth: toPlainMaxDepth,
|
|
1613
1651
|
maxKeys: toPlainMaxKeys,
|
|
@@ -1855,6 +1893,15 @@ function createRuntimeMount(options) {
|
|
|
1855
1893
|
});
|
|
1856
1894
|
} catch (_unused) {}
|
|
1857
1895
|
const state = reactive(rawState);
|
|
1896
|
+
const setupState = reactive(Object.create(null));
|
|
1897
|
+
if (rawState && typeof rawState === "object" && !hasOwn(rawState, WEVU_SETUP_STATE_KEY)) try {
|
|
1898
|
+
Object.defineProperty(rawState, WEVU_SETUP_STATE_KEY, {
|
|
1899
|
+
value: setupState,
|
|
1900
|
+
configurable: true,
|
|
1901
|
+
enumerable: false,
|
|
1902
|
+
writable: false
|
|
1903
|
+
});
|
|
1904
|
+
} catch (_unused2) {}
|
|
1858
1905
|
const computedDefs = resolvedComputed;
|
|
1859
1906
|
const methodDefs = resolvedMethods;
|
|
1860
1907
|
let mounted = true;
|
|
@@ -1873,6 +1920,7 @@ function createRuntimeMount(options) {
|
|
|
1873
1920
|
const mergedDebugWhen = diagnostics === "always" ? "always" : debugWhen;
|
|
1874
1921
|
const { boundMethods, computedRefs, computedSetters, dirtyComputedKeys, computedProxy, publicInstance, touchSetupMethodsVersion } = createRuntimeContext({
|
|
1875
1922
|
state,
|
|
1923
|
+
setupState,
|
|
1876
1924
|
computedDefs,
|
|
1877
1925
|
methodDefs,
|
|
1878
1926
|
appConfig,
|
|
@@ -1884,6 +1932,7 @@ function createRuntimeMount(options) {
|
|
|
1884
1932
|
let tracker;
|
|
1885
1933
|
const scheduler = createSetDataScheduler({
|
|
1886
1934
|
state,
|
|
1935
|
+
setupState,
|
|
1887
1936
|
computedRefs,
|
|
1888
1937
|
dirtyComputedKeys,
|
|
1889
1938
|
includeComputed,
|
|
@@ -1919,8 +1968,8 @@ function createRuntimeMount(options) {
|
|
|
1919
1968
|
const runtimeAttrs = state[WEVU_ATTRS_KEY];
|
|
1920
1969
|
if (isReactive(runtimeAttrs)) touchReactive(runtimeAttrs);
|
|
1921
1970
|
trackedSetupReactiveKeys.forEach((key) => {
|
|
1922
|
-
|
|
1923
|
-
touchSetupBinding(
|
|
1971
|
+
var _key;
|
|
1972
|
+
touchSetupBinding((_key = setupState[key]) !== null && _key !== void 0 ? _key : state[key]);
|
|
1924
1973
|
});
|
|
1925
1974
|
}, {
|
|
1926
1975
|
lazy: true,
|
|
@@ -1954,7 +2003,7 @@ function createRuntimeMount(options) {
|
|
|
1954
2003
|
stopHandles.forEach((handle) => {
|
|
1955
2004
|
try {
|
|
1956
2005
|
handle();
|
|
1957
|
-
} catch (
|
|
2006
|
+
} catch (_unused3) {}
|
|
1958
2007
|
});
|
|
1959
2008
|
stopHandles.length = 0;
|
|
1960
2009
|
};
|
|
@@ -1962,6 +2011,9 @@ function createRuntimeMount(options) {
|
|
|
1962
2011
|
get state() {
|
|
1963
2012
|
return state;
|
|
1964
2013
|
},
|
|
2014
|
+
get setupState() {
|
|
2015
|
+
return setupState;
|
|
2016
|
+
},
|
|
1965
2017
|
get proxy() {
|
|
1966
2018
|
return publicInstance;
|
|
1967
2019
|
},
|
|
@@ -1986,7 +2038,7 @@ function createRuntimeMount(options) {
|
|
|
1986
2038
|
enumerable: false,
|
|
1987
2039
|
writable: false
|
|
1988
2040
|
});
|
|
1989
|
-
} catch (
|
|
2041
|
+
} catch (_unused4) {
|
|
1990
2042
|
runtimeInstance.__wevu_touchSetupMethodsVersion = touchSetupMethodsVersion;
|
|
1991
2043
|
}
|
|
1992
2044
|
try {
|
|
@@ -1996,7 +2048,7 @@ function createRuntimeMount(options) {
|
|
|
1996
2048
|
enumerable: false,
|
|
1997
2049
|
writable: false
|
|
1998
2050
|
});
|
|
1999
|
-
} catch (
|
|
2051
|
+
} catch (_unused5) {
|
|
2000
2052
|
runtimeInstance.__wevu_flushSetupSnapshotSync = job;
|
|
2001
2053
|
}
|
|
2002
2054
|
try {
|
|
@@ -2006,7 +2058,7 @@ function createRuntimeMount(options) {
|
|
|
2006
2058
|
enumerable: false,
|
|
2007
2059
|
writable: false
|
|
2008
2060
|
});
|
|
2009
|
-
} catch (
|
|
2061
|
+
} catch (_unused6) {
|
|
2010
2062
|
runtimeInstance.__wevu_cloneLatestSnapshot = scheduler.cloneLatestSnapshot;
|
|
2011
2063
|
}
|
|
2012
2064
|
try {
|
|
@@ -2018,7 +2070,7 @@ function createRuntimeMount(options) {
|
|
|
2018
2070
|
enumerable: false,
|
|
2019
2071
|
writable: false
|
|
2020
2072
|
});
|
|
2021
|
-
} catch (
|
|
2073
|
+
} catch (_unused7) {
|
|
2022
2074
|
runtimeInstance.__wevu_trackSetupReactiveKey = (key) => {
|
|
2023
2075
|
trackedSetupReactiveKeys.add(key);
|
|
2024
2076
|
};
|
|
@@ -3044,6 +3096,7 @@ function runSetupFunction(setup, props, context) {
|
|
|
3044
3096
|
const runtimeContext = (_context$runtime = context === null || context === void 0 ? void 0 : context.runtime) !== null && _context$runtime !== void 0 ? _context$runtime : {
|
|
3045
3097
|
methods: Object.create(null),
|
|
3046
3098
|
state: {},
|
|
3099
|
+
setupState: {},
|
|
3047
3100
|
proxy: {},
|
|
3048
3101
|
watch: () => () => {},
|
|
3049
3102
|
bindModel: () => {}
|
|
@@ -3069,6 +3122,18 @@ function attachRuntimeProxyProps(state, props) {
|
|
|
3069
3122
|
state[WEVU_PROPS_KEY] = props;
|
|
3070
3123
|
}
|
|
3071
3124
|
}
|
|
3125
|
+
function attachRuntimeSetupState(state, setupState) {
|
|
3126
|
+
try {
|
|
3127
|
+
Object.defineProperty(state, WEVU_SETUP_STATE_KEY, {
|
|
3128
|
+
value: setupState,
|
|
3129
|
+
configurable: true,
|
|
3130
|
+
enumerable: false,
|
|
3131
|
+
writable: false
|
|
3132
|
+
});
|
|
3133
|
+
} catch (_unused2) {
|
|
3134
|
+
state[WEVU_SETUP_STATE_KEY] = setupState;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3072
3137
|
function attachNativeInstanceRef(state, instance) {
|
|
3073
3138
|
try {
|
|
3074
3139
|
Object.defineProperty(state, WEVU_NATIVE_INSTANCE_KEY, {
|
|
@@ -3077,7 +3142,7 @@ function attachNativeInstanceRef(state, instance) {
|
|
|
3077
3142
|
enumerable: false,
|
|
3078
3143
|
writable: true
|
|
3079
3144
|
});
|
|
3080
|
-
} catch (
|
|
3145
|
+
} catch (_unused3) {
|
|
3081
3146
|
state[WEVU_NATIVE_INSTANCE_KEY] = instance;
|
|
3082
3147
|
}
|
|
3083
3148
|
}
|
|
@@ -3089,7 +3154,7 @@ function attachRuntimeRef(state, runtime) {
|
|
|
3089
3154
|
enumerable: false,
|
|
3090
3155
|
writable: true
|
|
3091
3156
|
});
|
|
3092
|
-
} catch (
|
|
3157
|
+
} catch (_unused4) {
|
|
3093
3158
|
state[WEVU_RUNTIME_KEY] = runtime;
|
|
3094
3159
|
}
|
|
3095
3160
|
}
|
|
@@ -3101,10 +3166,10 @@ function attachRuntimeInstance(runtime, instance) {
|
|
|
3101
3166
|
enumerable: false,
|
|
3102
3167
|
writable: true
|
|
3103
3168
|
});
|
|
3104
|
-
} catch (
|
|
3169
|
+
} catch (_unused5) {
|
|
3105
3170
|
try {
|
|
3106
3171
|
runtime.instance = instance;
|
|
3107
|
-
} catch (
|
|
3172
|
+
} catch (_unused6) {}
|
|
3108
3173
|
}
|
|
3109
3174
|
}
|
|
3110
3175
|
function resolveNativeSetData(instance) {
|
|
@@ -3135,7 +3200,7 @@ function syncRuntimeProps(props, mpProperties) {
|
|
|
3135
3200
|
const currentKeys = Object.keys(props);
|
|
3136
3201
|
for (const key of currentKeys) if (!hasOwn(mpProperties, key)) try {
|
|
3137
3202
|
delete props[key];
|
|
3138
|
-
} catch (
|
|
3203
|
+
} catch (_unused7) {}
|
|
3139
3204
|
for (const [key, value] of Object.entries(mpProperties)) props[key] = value;
|
|
3140
3205
|
}
|
|
3141
3206
|
function ensureRuntimeProps(target, runtimeState, mpProperties = target.properties || {}) {
|
|
@@ -3150,7 +3215,7 @@ function ensureRuntimeProps(target, runtimeState, mpProperties = target.properti
|
|
|
3150
3215
|
enumerable: false,
|
|
3151
3216
|
writable: true
|
|
3152
3217
|
});
|
|
3153
|
-
} catch (
|
|
3218
|
+
} catch (_unused8) {
|
|
3154
3219
|
target[WEVU_PROPS_KEY] = props;
|
|
3155
3220
|
}
|
|
3156
3221
|
return props;
|
|
@@ -3162,6 +3227,7 @@ function normalizeEmitEventName(eventName) {
|
|
|
3162
3227
|
return eventName.includes(":") ? eventName.replaceAll(":", "-").toLowerCase() : eventName;
|
|
3163
3228
|
}
|
|
3164
3229
|
function runRuntimeSetupPhase(options) {
|
|
3230
|
+
var _runtimeWithDefaults$;
|
|
3165
3231
|
const { target, runtime, runtimeWithDefaults, runtimeState, runtimeProxy, setup } = options;
|
|
3166
3232
|
const props = ensureRuntimeProps(target, runtimeState, target.properties || {});
|
|
3167
3233
|
const attrs = shallowReactive(Object.create(null));
|
|
@@ -3191,6 +3257,7 @@ function runRuntimeSetupPhase(options) {
|
|
|
3191
3257
|
}
|
|
3192
3258
|
const setupInstance = ensureSetupContextInstance(target, runtimeWithDefaults);
|
|
3193
3259
|
const slots = createSetupSlotsProxy(props);
|
|
3260
|
+
attachRuntimeSetupState(runtimeState, (_runtimeWithDefaults$ = runtimeWithDefaults.setupState) !== null && _runtimeWithDefaults$ !== void 0 ? _runtimeWithDefaults$ : Object.create(null));
|
|
3194
3261
|
try {
|
|
3195
3262
|
Object.defineProperty(runtimeState, "$slots", {
|
|
3196
3263
|
value: slots,
|
|
@@ -3228,43 +3295,20 @@ function runRuntimeSetupPhase(options) {
|
|
|
3228
3295
|
const result = instanceScope.run(() => runSetupFunction(setup, props, context));
|
|
3229
3296
|
let methodsChanged = false;
|
|
3230
3297
|
if (result && typeof result === "object") {
|
|
3231
|
-
const
|
|
3298
|
+
const runtimeSetupState = runtime.setupState && typeof runtime.setupState === "object" ? isReactive(runtime.setupState) ? toRaw(runtime.setupState) : runtime.setupState : Object.create(null);
|
|
3232
3299
|
Object.keys(result).forEach((key) => {
|
|
3233
3300
|
const val = result[key];
|
|
3234
3301
|
if (typeof val === "function") {
|
|
3235
3302
|
runtime.methods[key] = (...args) => val.apply(runtime.proxy, args);
|
|
3303
|
+
runtime.state[key] = (...args) => val.apply(runtime.proxy, args);
|
|
3236
3304
|
methodsChanged = true;
|
|
3237
3305
|
} else {
|
|
3238
3306
|
if (hasTrackableSetupBinding(val)) {
|
|
3239
3307
|
var _wevu_trackSetupReact;
|
|
3240
3308
|
(_wevu_trackSetupReact = runtime.__wevu_trackSetupReactiveKey) === null || _wevu_trackSetupReact === void 0 || _wevu_trackSetupReact.call(runtime, key);
|
|
3241
3309
|
}
|
|
3242
|
-
if (declaredPropKeys.has(key)) {
|
|
3243
|
-
let fallbackValue = val;
|
|
3244
|
-
try {
|
|
3245
|
-
Object.defineProperty(runtimeRawState, key, {
|
|
3246
|
-
configurable: true,
|
|
3247
|
-
enumerable: false,
|
|
3248
|
-
get() {
|
|
3249
|
-
const propsSource = runtimeRawState[WEVU_PROPS_KEY];
|
|
3250
|
-
if (propsSource && typeof propsSource === "object" && hasOwn(propsSource, key)) return propsSource[key];
|
|
3251
|
-
return fallbackValue;
|
|
3252
|
-
},
|
|
3253
|
-
set(next) {
|
|
3254
|
-
fallbackValue = next;
|
|
3255
|
-
const propsSource = runtimeRawState[WEVU_PROPS_KEY];
|
|
3256
|
-
if (!propsSource || typeof propsSource !== "object") return;
|
|
3257
|
-
try {
|
|
3258
|
-
propsSource[key] = next;
|
|
3259
|
-
} catch (_unused3) {}
|
|
3260
|
-
}
|
|
3261
|
-
});
|
|
3262
|
-
} catch (_unused4) {
|
|
3263
|
-
runtime.state[key] = val;
|
|
3264
|
-
}
|
|
3265
|
-
return;
|
|
3266
|
-
}
|
|
3267
3310
|
runtime.state[key] = val;
|
|
3311
|
+
runtimeSetupState[key] = val;
|
|
3268
3312
|
}
|
|
3269
3313
|
});
|
|
3270
3314
|
}
|
|
@@ -3444,7 +3488,7 @@ function attachPageLayoutSetter(target) {
|
|
|
3444
3488
|
* @internal
|
|
3445
3489
|
*/
|
|
3446
3490
|
function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
3447
|
-
var _wevuSetDataOptions, _wevuSetDataOptions2, _runtime$proxy, _runtime$state, _computed, _runtime$methods, _watch, _bindModel, _snapshot, _unmount;
|
|
3491
|
+
var _wevuSetDataOptions, _wevuSetDataOptions2, _runtime$proxy, _runtime$state, _runtime$setupState, _computed, _runtime$methods, _watch, _bindModel, _snapshot, _unmount;
|
|
3448
3492
|
if (target.__wevu) return target.__wevu;
|
|
3449
3493
|
attachRuntimeProvideParentContext(target, runtimeApp);
|
|
3450
3494
|
safeMarkNoSetData(target);
|
|
@@ -3535,6 +3579,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3535
3579
|
attachRuntimeInstance(runtime, target);
|
|
3536
3580
|
const runtimeProxy = (_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : {};
|
|
3537
3581
|
const runtimeState = (_runtime$state = runtime === null || runtime === void 0 ? void 0 : runtime.state) !== null && _runtime$state !== void 0 ? _runtime$state : {};
|
|
3582
|
+
const runtimeSetupState = (_runtime$setupState = runtime === null || runtime === void 0 ? void 0 : runtime.setupState) !== null && _runtime$setupState !== void 0 ? _runtime$setupState : Object.create(null);
|
|
3538
3583
|
if (runtimeState && typeof runtimeState === "object") {
|
|
3539
3584
|
attachRuntimeRef(runtimeState, runtime);
|
|
3540
3585
|
attachNativeInstanceRef(runtimeState, target);
|
|
@@ -3549,6 +3594,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3549
3594
|
const runtimeWithDefaults = {
|
|
3550
3595
|
...runtime !== null && runtime !== void 0 ? runtime : {},
|
|
3551
3596
|
state: runtimeState,
|
|
3597
|
+
setupState: runtimeSetupState,
|
|
3552
3598
|
proxy: runtimeProxy,
|
|
3553
3599
|
methods: runtimeMethods,
|
|
3554
3600
|
computed: runtimeComputed,
|
|
@@ -3893,19 +3939,26 @@ function attachOptionalPageLifecycleHooks(pageLifecycleHooks, options) {
|
|
|
3893
3939
|
//#endregion
|
|
3894
3940
|
//#region src/runtime/register/component/lifecycle.ts
|
|
3895
3941
|
function createPageLifecycleHooks(options) {
|
|
3896
|
-
const { runtimeApp, watch, setup, userOnLoad, userOnUnload, userOnShow, userOnHide, userOnReady, isPage, enableOnSaveExitState, enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnRouteDoneFallback, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites, hasHook } = options;
|
|
3942
|
+
const { runtimeApp, watch, setup, userOnLoad, userOnUnload, userOnShow, userOnHide, userOnReady, isPage, enableOnSaveExitState, enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnRouteDoneFallback, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, syncWevuPropsFromValues, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites, hasHook } = options;
|
|
3943
|
+
const flushPageSnapshotIfPossible = (target) => {
|
|
3944
|
+
var _wevu, _wevu$__wevu_flushSet;
|
|
3945
|
+
(_wevu = target.__wevu) === null || _wevu === void 0 || (_wevu$__wevu_flushSet = _wevu.__wevu_flushSetupSnapshotSync) === null || _wevu$__wevu_flushSet === void 0 || _wevu$__wevu_flushSet.call(_wevu);
|
|
3946
|
+
};
|
|
3897
3947
|
const pageLifecycleHooks = {
|
|
3898
3948
|
onLoad(...args) {
|
|
3899
3949
|
if (this[WEVU_ON_LOAD_CALLED_KEY]) return;
|
|
3900
3950
|
this[WEVU_ON_LOAD_CALLED_KEY] = true;
|
|
3901
3951
|
mountRuntimeInstance(this, runtimeApp, watch, setup);
|
|
3952
|
+
const pageOptions = args[0] && typeof args[0] === "object" ? args[0] : resolvePageOptions(this);
|
|
3953
|
+
syncWevuPropsFromValues === null || syncWevuPropsFromValues === void 0 || syncWevuPropsFromValues(this, pageOptions);
|
|
3954
|
+
flushPageSnapshotIfPossible(this);
|
|
3902
3955
|
enableDeferredSetData(this);
|
|
3903
3956
|
if (isPage) ensurePageShareMenus({
|
|
3904
3957
|
enableOnShareAppMessage,
|
|
3905
3958
|
enableOnShareTimeline
|
|
3906
3959
|
});
|
|
3907
3960
|
callHookList(this, "onLoad", args);
|
|
3908
|
-
if (typeof userOnLoad === "function") return userOnLoad.apply(this, args);
|
|
3961
|
+
if (typeof userOnLoad === "function") return userOnLoad.apply(this, args.length ? args : [pageOptions]);
|
|
3909
3962
|
},
|
|
3910
3963
|
onUnload(...args) {
|
|
3911
3964
|
if (isPage) releaseCurrentPageInstance(this);
|
|
@@ -3917,6 +3970,8 @@ function createPageLifecycleHooks(options) {
|
|
|
3917
3970
|
ensureMiniProgramGlobalPatched();
|
|
3918
3971
|
bindCurrentPageInstance(this);
|
|
3919
3972
|
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
3973
|
+
syncWevuPropsFromValues === null || syncWevuPropsFromValues === void 0 || syncWevuPropsFromValues(this, resolvePageOptions(this));
|
|
3974
|
+
flushPageSnapshotIfPossible(this);
|
|
3920
3975
|
ensurePageShareMenus({
|
|
3921
3976
|
enableOnShareAppMessage,
|
|
3922
3977
|
enableOnShareTimeline
|
|
@@ -3936,6 +3991,8 @@ function createPageLifecycleHooks(options) {
|
|
|
3936
3991
|
onReady(...args) {
|
|
3937
3992
|
if (isPage) {
|
|
3938
3993
|
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
3994
|
+
syncWevuPropsFromValues === null || syncWevuPropsFromValues === void 0 || syncWevuPropsFromValues(this, resolvePageOptions(this));
|
|
3995
|
+
flushPageSnapshotIfPossible(this);
|
|
3939
3996
|
ensurePageShareMenus({
|
|
3940
3997
|
enableOnShareAppMessage,
|
|
3941
3998
|
enableOnShareTimeline
|
|
@@ -4136,6 +4193,8 @@ function prepareComponentOptions(mpOptions) {
|
|
|
4136
4193
|
"export",
|
|
4137
4194
|
"__wevuTemplateRefs",
|
|
4138
4195
|
"__wevuLayoutHosts",
|
|
4196
|
+
WEVU_PROPS_ALIASES_KEY,
|
|
4197
|
+
WEVU_PROPS_DERIVED_KEYS_KEY,
|
|
4139
4198
|
"setupLifecycle",
|
|
4140
4199
|
"features",
|
|
4141
4200
|
"__wevu_isPage"
|
|
@@ -4186,6 +4245,10 @@ function prepareComponentOptions(mpOptions) {
|
|
|
4186
4245
|
delete restOptions.__wevuTemplateRefs;
|
|
4187
4246
|
const layoutHosts = restOptions.__wevuLayoutHosts;
|
|
4188
4247
|
delete restOptions.__wevuLayoutHosts;
|
|
4248
|
+
const propsAliases = restOptions[WEVU_PROPS_ALIASES_KEY];
|
|
4249
|
+
delete restOptions[WEVU_PROPS_ALIASES_KEY];
|
|
4250
|
+
const propsDerivedKeys = restOptions[WEVU_PROPS_DERIVED_KEYS_KEY];
|
|
4251
|
+
delete restOptions[WEVU_PROPS_DERIVED_KEYS_KEY];
|
|
4189
4252
|
const userObservers = restOptions.observers;
|
|
4190
4253
|
const setupLifecycle = restOptions.setupLifecycle === "created" ? "created" : "attached";
|
|
4191
4254
|
delete restOptions.setupLifecycle;
|
|
@@ -4206,6 +4269,8 @@ function prepareComponentOptions(mpOptions) {
|
|
|
4206
4269
|
topLevelMethods,
|
|
4207
4270
|
templateRefs,
|
|
4208
4271
|
layoutHosts,
|
|
4272
|
+
propsAliases,
|
|
4273
|
+
propsDerivedKeys,
|
|
4209
4274
|
userObservers,
|
|
4210
4275
|
setupLifecycle,
|
|
4211
4276
|
legacyCreated,
|
|
@@ -4246,9 +4311,48 @@ function refreshOwnerSnapshotFromInstance(instance) {
|
|
|
4246
4311
|
//#endregion
|
|
4247
4312
|
//#region src/runtime/register/component/props.ts
|
|
4248
4313
|
function createPropsSync(options) {
|
|
4249
|
-
const { restOptions, userObservers } = options;
|
|
4314
|
+
const { restOptions, propsAliases, propsDerivedKeys, userObservers } = options;
|
|
4250
4315
|
const propKeys = restOptions.properties && typeof restOptions.properties === "object" ? Object.keys(restOptions.properties) : [];
|
|
4251
4316
|
const propKeySet = new Set(propKeys);
|
|
4317
|
+
const propsDerivedKeySet = new Set(propsDerivedKeys !== null && propsDerivedKeys !== void 0 ? propsDerivedKeys : []);
|
|
4318
|
+
const aliasEntries = Object.entries(propsAliases !== null && propsAliases !== void 0 ? propsAliases : {}).filter(([alias, propName]) => alias && propName);
|
|
4319
|
+
const syncedAliases = /* @__PURE__ */ new WeakMap();
|
|
4320
|
+
const syncSetupStatePropsAliases = (instance, propsProxy) => {
|
|
4321
|
+
var _syncedAliases$get;
|
|
4322
|
+
if (!aliasEntries.length) return;
|
|
4323
|
+
const runtime = instance.__wevu;
|
|
4324
|
+
const setupState = runtime === null || runtime === void 0 ? void 0 : runtime.setupState;
|
|
4325
|
+
const state = runtime === null || runtime === void 0 ? void 0 : runtime.state;
|
|
4326
|
+
if (!setupState || typeof setupState !== "object") return;
|
|
4327
|
+
const aliases = (_syncedAliases$get = syncedAliases.get(instance)) !== null && _syncedAliases$get !== void 0 ? _syncedAliases$get : /* @__PURE__ */ new Set();
|
|
4328
|
+
syncedAliases.set(instance, aliases);
|
|
4329
|
+
for (const [alias, propName] of aliasEntries) {
|
|
4330
|
+
if (hasOwn(setupState, alias) && !aliases.has(alias)) continue;
|
|
4331
|
+
const value = propsProxy[propName];
|
|
4332
|
+
try {
|
|
4333
|
+
setupState[alias] = value;
|
|
4334
|
+
aliases.add(alias);
|
|
4335
|
+
} catch (_unused) {}
|
|
4336
|
+
if (state && typeof state === "object" && (!hasOwn(state, alias) || aliases.has(alias))) try {
|
|
4337
|
+
state[alias] = value;
|
|
4338
|
+
} catch (_unused2) {}
|
|
4339
|
+
}
|
|
4340
|
+
};
|
|
4341
|
+
const syncPropsDerivedKeys = (instance, propsProxy) => {
|
|
4342
|
+
if (!propsDerivedKeySet.size) return;
|
|
4343
|
+
const runtime = instance.__wevu;
|
|
4344
|
+
const setupState = runtime === null || runtime === void 0 ? void 0 : runtime.setupState;
|
|
4345
|
+
if (!setupState || typeof setupState !== "object") return;
|
|
4346
|
+
const aliasToPropName = new Map(aliasEntries);
|
|
4347
|
+
for (const key of propsDerivedKeySet) {
|
|
4348
|
+
var _aliasToPropName$get;
|
|
4349
|
+
const propName = (_aliasToPropName$get = aliasToPropName.get(key)) !== null && _aliasToPropName$get !== void 0 ? _aliasToPropName$get : key;
|
|
4350
|
+
if (!hasOwn(propsProxy, propName)) continue;
|
|
4351
|
+
try {
|
|
4352
|
+
setupState[key] = propsProxy[propName];
|
|
4353
|
+
} catch (_unused3) {}
|
|
4354
|
+
}
|
|
4355
|
+
};
|
|
4252
4356
|
const attachWevuPropKeys = (instance) => {
|
|
4253
4357
|
try {
|
|
4254
4358
|
Object.defineProperty(instance, WEVU_PROP_KEYS_KEY, {
|
|
@@ -4257,7 +4361,7 @@ function createPropsSync(options) {
|
|
|
4257
4361
|
enumerable: false,
|
|
4258
4362
|
writable: false
|
|
4259
4363
|
});
|
|
4260
|
-
} catch (
|
|
4364
|
+
} catch (_unused4) {
|
|
4261
4365
|
instance[WEVU_PROP_KEYS_KEY] = propKeys;
|
|
4262
4366
|
}
|
|
4263
4367
|
};
|
|
@@ -4274,7 +4378,7 @@ function createPropsSync(options) {
|
|
|
4274
4378
|
const currentKeys = Object.keys(attrsProxy);
|
|
4275
4379
|
for (const existingKey of currentKeys) if (!next || !hasOwn(next, existingKey) || propKeySet.has(existingKey) || hasRuntimeStateKey(existingKey)) try {
|
|
4276
4380
|
delete attrsProxy[existingKey];
|
|
4277
|
-
} catch (
|
|
4381
|
+
} catch (_unused5) {}
|
|
4278
4382
|
if (!next) {
|
|
4279
4383
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4280
4384
|
return;
|
|
@@ -4283,7 +4387,7 @@ function createPropsSync(options) {
|
|
|
4283
4387
|
if (propKeySet.has(key) || hasRuntimeStateKey(key)) continue;
|
|
4284
4388
|
try {
|
|
4285
4389
|
attrsProxy[key] = value;
|
|
4286
|
-
} catch (
|
|
4390
|
+
} catch (_unused6) {}
|
|
4287
4391
|
}
|
|
4288
4392
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4289
4393
|
};
|
|
@@ -4296,32 +4400,54 @@ function createPropsSync(options) {
|
|
|
4296
4400
|
const currentKeys = Object.keys(propsProxy);
|
|
4297
4401
|
for (const existingKey of currentKeys) if (!hasOwn(next, existingKey)) try {
|
|
4298
4402
|
delete propsProxy[existingKey];
|
|
4299
|
-
} catch (
|
|
4403
|
+
} catch (_unused7) {}
|
|
4300
4404
|
for (const [k, v] of Object.entries(next)) {
|
|
4301
4405
|
const nextValue = pendingPropValues && hasOwn(pendingPropValues, k) ? pendingPropValues[k] : v;
|
|
4302
4406
|
try {
|
|
4303
4407
|
propsProxy[k] = nextValue;
|
|
4304
|
-
} catch (
|
|
4408
|
+
} catch (_unused8) {}
|
|
4305
4409
|
}
|
|
4306
4410
|
if (pendingPropValues) {
|
|
4307
4411
|
for (const [k, v] of Object.entries(pendingPropValues)) if (!hasOwn(next, k)) try {
|
|
4308
4412
|
propsProxy[k] = v;
|
|
4309
|
-
} catch (
|
|
4413
|
+
} catch (_unused9) {}
|
|
4310
4414
|
}
|
|
4415
|
+
syncPropsDerivedKeys(instance, propsProxy);
|
|
4416
|
+
syncSetupStatePropsAliases(instance, propsProxy);
|
|
4311
4417
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4312
4418
|
}
|
|
4313
4419
|
if (pendingPropValues) delete instance[WEVU_PENDING_PROP_VALUES_KEY];
|
|
4314
4420
|
syncWevuAttrsFromInstance(instance);
|
|
4315
4421
|
};
|
|
4422
|
+
const syncWevuPropsFromValues = (instance, values) => {
|
|
4423
|
+
if (!values || typeof values !== "object") return;
|
|
4424
|
+
const propsProxy = instance[WEVU_PROPS_KEY];
|
|
4425
|
+
if (!propsProxy || typeof propsProxy !== "object") return;
|
|
4426
|
+
let changed = false;
|
|
4427
|
+
for (const key of propKeys) {
|
|
4428
|
+
if (!hasOwn(values, key)) continue;
|
|
4429
|
+
try {
|
|
4430
|
+
propsProxy[key] = values[key];
|
|
4431
|
+
changed = true;
|
|
4432
|
+
} catch (_unused10) {}
|
|
4433
|
+
}
|
|
4434
|
+
if (!changed) return;
|
|
4435
|
+
syncPropsDerivedKeys(instance, propsProxy);
|
|
4436
|
+
syncSetupStatePropsAliases(instance, propsProxy);
|
|
4437
|
+
refreshOwnerSnapshotFromInstance(instance);
|
|
4438
|
+
syncWevuAttrsFromInstance(instance);
|
|
4439
|
+
};
|
|
4316
4440
|
const syncWevuPropValue = (instance, key, value) => {
|
|
4317
4441
|
var _ref, _ref$WEVU_PENDING_PRO;
|
|
4318
4442
|
const propsProxy = instance[WEVU_PROPS_KEY];
|
|
4319
4443
|
if (!propsProxy || typeof propsProxy !== "object") return;
|
|
4320
4444
|
try {
|
|
4321
4445
|
propsProxy[key] = value;
|
|
4322
|
-
} catch (
|
|
4446
|
+
} catch (_unused11) {}
|
|
4323
4447
|
const pendingPropValues = (_ref$WEVU_PENDING_PRO = (_ref = instance)[WEVU_PENDING_PROP_VALUES_KEY]) !== null && _ref$WEVU_PENDING_PRO !== void 0 ? _ref$WEVU_PENDING_PRO : _ref[WEVU_PENDING_PROP_VALUES_KEY] = Object.create(null);
|
|
4324
4448
|
pendingPropValues[key] = value;
|
|
4449
|
+
syncPropsDerivedKeys(instance, propsProxy);
|
|
4450
|
+
syncSetupStatePropsAliases(instance, propsProxy);
|
|
4325
4451
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4326
4452
|
syncWevuAttrsFromInstance(instance);
|
|
4327
4453
|
};
|
|
@@ -4346,6 +4472,7 @@ function createPropsSync(options) {
|
|
|
4346
4472
|
return {
|
|
4347
4473
|
attachWevuPropKeys,
|
|
4348
4474
|
syncWevuPropsFromInstance,
|
|
4475
|
+
syncWevuPropsFromValues,
|
|
4349
4476
|
finalObservers
|
|
4350
4477
|
};
|
|
4351
4478
|
}
|
|
@@ -4739,7 +4866,7 @@ function registerComponentDefinition(options) {
|
|
|
4739
4866
|
*/
|
|
4740
4867
|
function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
4741
4868
|
var _multipleSlots;
|
|
4742
|
-
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);
|
|
4869
|
+
const { userMethods, userLifetimes, userPageLifetimes, userOptions, restOptions, topLevelMethods, templateRefs, layoutHosts, propsAliases, propsDerivedKeys, userObservers, setupLifecycle, legacyCreated, isPage, features, userOnLoad, userOnUnload, userOnShow, userOnHide, userOnReady, userOnSaveExitState, userOnPullDownRefresh, userOnReachBottom, userOnPageScroll, userOnRouteDone, userOnTabItemTap, userOnResize, userOnShareAppMessage, userOnShareTimeline, userOnAddToFavorites, applyExtraInstanceFields } = prepareComponentOptions(mpOptions);
|
|
4743
4870
|
const { enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnRouteDoneFallback, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, enableOnSaveExitState, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites } = resolveComponentFeatures({
|
|
4744
4871
|
features,
|
|
4745
4872
|
userOnSaveExitState,
|
|
@@ -4778,8 +4905,10 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4778
4905
|
multipleSlots: (_multipleSlots = userOptions.multipleSlots) !== null && _multipleSlots !== void 0 ? _multipleSlots : true,
|
|
4779
4906
|
...userOptions
|
|
4780
4907
|
};
|
|
4781
|
-
const { attachWevuPropKeys, syncWevuPropsFromInstance, finalObservers } = createPropsSync({
|
|
4908
|
+
const { attachWevuPropKeys, syncWevuPropsFromInstance, syncWevuPropsFromValues, finalObservers } = createPropsSync({
|
|
4782
4909
|
restOptions,
|
|
4910
|
+
propsAliases,
|
|
4911
|
+
propsDerivedKeys,
|
|
4783
4912
|
userObservers
|
|
4784
4913
|
});
|
|
4785
4914
|
const { finalMethods } = createComponentMethods({
|
|
@@ -4815,6 +4944,7 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4815
4944
|
enableOnShareAppMessage,
|
|
4816
4945
|
enableOnShareTimeline,
|
|
4817
4946
|
enableOnAddToFavorites,
|
|
4947
|
+
syncWevuPropsFromValues,
|
|
4818
4948
|
effectiveOnSaveExitState,
|
|
4819
4949
|
effectiveOnPullDownRefresh,
|
|
4820
4950
|
effectiveOnReachBottom,
|
|
@@ -4838,6 +4968,7 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4838
4968
|
attachWevuPropKeys,
|
|
4839
4969
|
setupLifecycle,
|
|
4840
4970
|
syncWevuPropsFromInstance,
|
|
4971
|
+
syncWevuPropsFromValues,
|
|
4841
4972
|
isPage,
|
|
4842
4973
|
legacyCreated,
|
|
4843
4974
|
getRuntimeOwnerLabel
|
|
@@ -5342,12 +5473,12 @@ function shouldExposeInSnapshot(value) {
|
|
|
5342
5473
|
return isPlainObject(value);
|
|
5343
5474
|
}
|
|
5344
5475
|
function applySetupResult(runtime, target, result, options) {
|
|
5345
|
-
var _runtime$methods, _runtime$state;
|
|
5476
|
+
var _runtime$methods, _runtime$state, _runtime$setupState;
|
|
5346
5477
|
const includeFunctionsInState = Boolean(options === null || options === void 0 ? void 0 : options.includeFunctionsInState);
|
|
5347
5478
|
const functionPropPaths = options === null || options === void 0 ? void 0 : options.functionPropPaths;
|
|
5348
|
-
const declaredPropKeys = new Set(Array.isArray(target === null || target === void 0 ? void 0 : target[WEVU_PROP_KEYS_KEY]) ? target[WEVU_PROP_KEYS_KEY] : []);
|
|
5349
5479
|
const methods = (_runtime$methods = runtime === null || runtime === void 0 ? void 0 : runtime.methods) !== null && _runtime$methods !== void 0 ? _runtime$methods : Object.create(null);
|
|
5350
5480
|
const state = (_runtime$state = runtime === null || runtime === void 0 ? void 0 : runtime.state) !== null && _runtime$state !== void 0 ? _runtime$state : Object.create(null);
|
|
5481
|
+
const setupState = (_runtime$setupState = runtime === null || runtime === void 0 ? void 0 : runtime.setupState) !== null && _runtime$setupState !== void 0 ? _runtime$setupState : Object.create(null);
|
|
5351
5482
|
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
5352
5483
|
let methodsChanged = false;
|
|
5353
5484
|
if (runtime && !runtime.methods) try {
|
|
@@ -5356,6 +5487,9 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
5356
5487
|
if (runtime && !runtime.state) try {
|
|
5357
5488
|
runtime.state = state;
|
|
5358
5489
|
} catch (_unused2) {}
|
|
5490
|
+
if (runtime && !runtime.setupState) try {
|
|
5491
|
+
runtime.setupState = setupState;
|
|
5492
|
+
} catch (_unused3) {}
|
|
5359
5493
|
Object.keys(result).forEach((key) => {
|
|
5360
5494
|
const val = result[key];
|
|
5361
5495
|
if (typeof val === "function") {
|
|
@@ -5364,38 +5498,15 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
5364
5498
|
return val.apply((_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : runtime, args);
|
|
5365
5499
|
};
|
|
5366
5500
|
methods[key] = bound;
|
|
5367
|
-
|
|
5501
|
+
state[key] = bound;
|
|
5502
|
+
if (includeFunctionsInState || (functionPropPaths === null || functionPropPaths === void 0 ? void 0 : functionPropPaths.has(key))) setupState[key] = bound;
|
|
5368
5503
|
methodsChanged = true;
|
|
5369
5504
|
} else {
|
|
5370
5505
|
if (hasTrackableSetupBinding(val)) {
|
|
5371
5506
|
var _runtime$__wevu_track;
|
|
5372
5507
|
runtime === null || runtime === void 0 || (_runtime$__wevu_track = runtime.__wevu_trackSetupReactiveKey) === null || _runtime$__wevu_track === void 0 || _runtime$__wevu_track.call(runtime, key);
|
|
5373
5508
|
}
|
|
5374
|
-
|
|
5375
|
-
let fallbackValue = val;
|
|
5376
|
-
try {
|
|
5377
|
-
Object.defineProperty(rawState, key, {
|
|
5378
|
-
configurable: true,
|
|
5379
|
-
enumerable: false,
|
|
5380
|
-
get() {
|
|
5381
|
-
const propsSource = rawState[WEVU_PROPS_KEY];
|
|
5382
|
-
if (propsSource && typeof propsSource === "object" && hasOwn(propsSource, key)) return propsSource[key];
|
|
5383
|
-
return fallbackValue;
|
|
5384
|
-
},
|
|
5385
|
-
set(next) {
|
|
5386
|
-
fallbackValue = next;
|
|
5387
|
-
const propsSource = rawState[WEVU_PROPS_KEY];
|
|
5388
|
-
if (!propsSource || typeof propsSource !== "object") return;
|
|
5389
|
-
try {
|
|
5390
|
-
propsSource[key] = next;
|
|
5391
|
-
} catch (_unused3) {}
|
|
5392
|
-
}
|
|
5393
|
-
});
|
|
5394
|
-
} catch (_unused4) {
|
|
5395
|
-
state[key] = val;
|
|
5396
|
-
}
|
|
5397
|
-
return;
|
|
5398
|
-
}
|
|
5509
|
+
state[key] = val;
|
|
5399
5510
|
if (val === target || !shouldExposeInSnapshot(val)) try {
|
|
5400
5511
|
Object.defineProperty(rawState, key, {
|
|
5401
5512
|
value: val,
|
|
@@ -5403,10 +5514,8 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
5403
5514
|
enumerable: false,
|
|
5404
5515
|
writable: true
|
|
5405
5516
|
});
|
|
5406
|
-
} catch (
|
|
5407
|
-
|
|
5408
|
-
}
|
|
5409
|
-
else state[key] = val;
|
|
5517
|
+
} catch (_unused4) {}
|
|
5518
|
+
setupState[key] = val;
|
|
5410
5519
|
}
|
|
5411
5520
|
});
|
|
5412
5521
|
if (runtime) {
|
|
@@ -5955,6 +6064,9 @@ function useScrollOffset(options = {}) {
|
|
|
5955
6064
|
//#endregion
|
|
5956
6065
|
//#region src/runtime/template.ts
|
|
5957
6066
|
const hyphenateRE = /\B([A-Z])/g;
|
|
6067
|
+
function hasOwnProperty(target, key) {
|
|
6068
|
+
return Object.prototype.hasOwnProperty.call(target, key);
|
|
6069
|
+
}
|
|
5958
6070
|
function hyphenate(value) {
|
|
5959
6071
|
if (!value) return "";
|
|
5960
6072
|
if (value.startsWith("--")) return value;
|
|
@@ -6016,6 +6128,25 @@ function normalizeClass(value) {
|
|
|
6016
6128
|
}
|
|
6017
6129
|
return res;
|
|
6018
6130
|
}
|
|
6131
|
+
function resolvePropValue(target, key, fallback, preferProps = false) {
|
|
6132
|
+
if (target == null) return fallback;
|
|
6133
|
+
const propsObject = unref(target.__wevuProps);
|
|
6134
|
+
if (key === "data") {
|
|
6135
|
+
if (propsObject != null && (propsObject[key] !== void 0 || hasOwnProperty(propsObject, key))) return propsObject[key];
|
|
6136
|
+
return key in target ? target[key] : fallback;
|
|
6137
|
+
}
|
|
6138
|
+
const hasPropsValue = propsObject != null && (propsObject[key] !== void 0 || hasOwnProperty(propsObject, key));
|
|
6139
|
+
if (preferProps) {
|
|
6140
|
+
if (hasPropsValue) return propsObject[key];
|
|
6141
|
+
if (key in target) return target[key];
|
|
6142
|
+
return fallback;
|
|
6143
|
+
}
|
|
6144
|
+
const stateObject = unref(target.$state);
|
|
6145
|
+
if (stateObject != null && hasOwnProperty(stateObject, key)) return target[key];
|
|
6146
|
+
if (hasPropsValue) return propsObject[key];
|
|
6147
|
+
if (!(key in target)) return fallback;
|
|
6148
|
+
return target[key];
|
|
6149
|
+
}
|
|
6019
6150
|
|
|
6020
6151
|
//#endregion
|
|
6021
6152
|
//#region src/runtime/updatePerformance.ts
|
|
@@ -6237,5 +6368,5 @@ function useTemplateRef(name) {
|
|
|
6237
6368
|
}
|
|
6238
6369
|
|
|
6239
6370
|
//#endregion
|
|
6240
|
-
export {
|
|
6241
|
-
//# sourceMappingURL=src-
|
|
6371
|
+
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 };
|
|
6372
|
+
//# sourceMappingURL=src-DzpEFK_c.mjs.map
|