wevu 6.16.20 → 6.16.22
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-fYd456WG.mjs} +253 -106
- package/dist/dev/src-fYd456WG.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-dZU2YIbb.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.22";
|
|
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 {
|
|
@@ -944,7 +965,7 @@ function isPlainObject$1(value) {
|
|
|
944
965
|
const proto = Object.getPrototypeOf(value);
|
|
945
966
|
return proto === null || proto === Object.prototype;
|
|
946
967
|
}
|
|
947
|
-
function toPlainInternal(value, seen, cache, depth, budget, includeFunctions, functionPathSet, currentPath) {
|
|
968
|
+
function toPlainInternal(value, seen, visiting, cache, depth, budget, includeFunctions, functionPathSet, currentPath) {
|
|
948
969
|
const unwrapped = unref(value);
|
|
949
970
|
if (typeof unwrapped === "bigint") {
|
|
950
971
|
const asNumber = Number(unwrapped);
|
|
@@ -962,23 +983,28 @@ function toPlainInternal(value, seen, cache, depth, budget, includeFunctions, fu
|
|
|
962
983
|
const cached = cacheRef.get(raw);
|
|
963
984
|
if (cached && cached.version === version) return cached.value;
|
|
964
985
|
}
|
|
986
|
+
if (visiting.has(raw)) return;
|
|
965
987
|
if (seen.has(raw)) return seen.get(raw);
|
|
966
988
|
if (raw instanceof Date) return raw.getTime();
|
|
967
989
|
if (raw instanceof RegExp) return raw.toString();
|
|
968
990
|
if (raw instanceof Map) {
|
|
969
991
|
const entries = [];
|
|
970
992
|
seen.set(raw, entries);
|
|
993
|
+
visiting.add(raw);
|
|
971
994
|
raw.forEach((mapValue, mapKey) => {
|
|
972
|
-
entries.push([toPlainInternal(mapKey, seen, void 0, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, void 0, ""), toPlainInternal(mapValue, seen, void 0, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, void 0, "")]);
|
|
995
|
+
entries.push([toPlainInternal(mapKey, seen, visiting, void 0, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, void 0, ""), toPlainInternal(mapValue, seen, visiting, void 0, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, void 0, "")]);
|
|
973
996
|
});
|
|
997
|
+
visiting.delete(raw);
|
|
974
998
|
return entries;
|
|
975
999
|
}
|
|
976
1000
|
if (raw instanceof Set) {
|
|
977
1001
|
const values = [];
|
|
978
1002
|
seen.set(raw, values);
|
|
1003
|
+
visiting.add(raw);
|
|
979
1004
|
raw.forEach((setValue) => {
|
|
980
|
-
values.push(toPlainInternal(setValue, seen, void 0, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, void 0, ""));
|
|
1005
|
+
values.push(toPlainInternal(setValue, seen, visiting, void 0, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, void 0, ""));
|
|
981
1006
|
});
|
|
1007
|
+
visiting.delete(raw);
|
|
982
1008
|
return values;
|
|
983
1009
|
}
|
|
984
1010
|
if (typeof ArrayBuffer !== "undefined") {
|
|
@@ -988,7 +1014,7 @@ function toPlainInternal(value, seen, cache, depth, budget, includeFunctions, fu
|
|
|
988
1014
|
if (typeof view[Symbol.iterator] === "function") {
|
|
989
1015
|
const values = [...view];
|
|
990
1016
|
seen.set(raw, values);
|
|
991
|
-
return values.map((item) => toPlainInternal(item, seen, void 0, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, void 0, ""));
|
|
1017
|
+
return values.map((item) => toPlainInternal(item, seen, visiting, void 0, Number.POSITIVE_INFINITY, { keys: Number.POSITIVE_INFINITY }, includeFunctions, void 0, ""));
|
|
992
1018
|
}
|
|
993
1019
|
const bytes = [...new Uint8Array(view.buffer, view.byteOffset, view.byteLength)];
|
|
994
1020
|
seen.set(raw, bytes);
|
|
@@ -1002,12 +1028,14 @@ function toPlainInternal(value, seen, cache, depth, budget, includeFunctions, fu
|
|
|
1002
1028
|
if (Array.isArray(raw)) {
|
|
1003
1029
|
const arr = [];
|
|
1004
1030
|
seen.set(raw, arr);
|
|
1031
|
+
visiting.add(raw);
|
|
1005
1032
|
const nextDepth = depth - 1;
|
|
1006
1033
|
for (let index = 0; index < raw.length; index += 1) {
|
|
1007
1034
|
const childPath = currentPath ? `${currentPath}.${index}` : String(index);
|
|
1008
|
-
const next = toPlainInternal(raw[index], seen, cache, nextDepth, budget, includeFunctions, functionPathSet, childPath);
|
|
1035
|
+
const next = toPlainInternal(raw[index], seen, visiting, cache, nextDepth, budget, includeFunctions, functionPathSet, childPath);
|
|
1009
1036
|
arr[index] = next === void 0 ? null : next;
|
|
1010
1037
|
}
|
|
1038
|
+
visiting.delete(raw);
|
|
1011
1039
|
if (cacheRef) cacheRef.set(raw, {
|
|
1012
1040
|
version: getReactiveVersion(raw),
|
|
1013
1041
|
value: arr
|
|
@@ -1016,14 +1044,16 @@ function toPlainInternal(value, seen, cache, depth, budget, includeFunctions, fu
|
|
|
1016
1044
|
}
|
|
1017
1045
|
const output = {};
|
|
1018
1046
|
seen.set(raw, output);
|
|
1047
|
+
visiting.add(raw);
|
|
1019
1048
|
const nextDepth = depth - 1;
|
|
1020
1049
|
for (const key of Object.keys(raw)) {
|
|
1021
1050
|
budget.keys -= 1;
|
|
1022
1051
|
if (budget.keys <= 0) break;
|
|
1023
1052
|
const childPath = currentPath ? `${currentPath}.${key}` : key;
|
|
1024
|
-
const next = toPlainInternal(raw[key], seen, cache, nextDepth, budget, includeFunctions, functionPathSet, childPath);
|
|
1053
|
+
const next = toPlainInternal(raw[key], seen, visiting, cache, nextDepth, budget, includeFunctions, functionPathSet, childPath);
|
|
1025
1054
|
if (next !== void 0) output[key] = next;
|
|
1026
1055
|
}
|
|
1056
|
+
visiting.delete(raw);
|
|
1027
1057
|
if (cacheRef) cacheRef.set(raw, {
|
|
1028
1058
|
version: getReactiveVersion(raw),
|
|
1029
1059
|
value: output
|
|
@@ -1035,7 +1065,7 @@ function toPlain(value, seen = /* @__PURE__ */ new WeakMap(), options) {
|
|
|
1035
1065
|
const depth = (_options$_depth = options === null || options === void 0 ? void 0 : options._depth) !== null && _options$_depth !== void 0 ? _options$_depth : typeof (options === null || options === void 0 ? void 0 : options.maxDepth) === "number" ? Math.max(0, Math.floor(options.maxDepth)) : Number.POSITIVE_INFINITY;
|
|
1036
1066
|
const budget = (_options$_budget = options === null || options === void 0 ? void 0 : options._budget) !== null && _options$_budget !== void 0 ? _options$_budget : typeof (options === null || options === void 0 ? void 0 : options.maxKeys) === "number" ? { keys: Math.max(0, Math.floor(options.maxKeys)) } : { keys: Number.POSITIVE_INFINITY };
|
|
1037
1067
|
const functionPathSet = Array.isArray(options === null || options === void 0 ? void 0 : options.functionPaths) && options.functionPaths.length ? new Set(options.functionPaths) : void 0;
|
|
1038
|
-
return toPlainInternal(value, seen, options === null || options === void 0 ? void 0 : options.cache, depth, budget, Boolean(options === null || options === void 0 ? void 0 : options.includeFunctions), functionPathSet, (_options$_path = options === null || options === void 0 ? void 0 : options._path) !== null && _options$_path !== void 0 ? _options$_path : "");
|
|
1068
|
+
return toPlainInternal(value, seen, /* @__PURE__ */ new WeakSet(), options === null || options === void 0 ? void 0 : options.cache, depth, budget, Boolean(options === null || options === void 0 ? void 0 : options.includeFunctions), functionPathSet, (_options$_path = options === null || options === void 0 ? void 0 : options._path) !== null && _options$_path !== void 0 ? _options$_path : "");
|
|
1039
1069
|
}
|
|
1040
1070
|
function isArrayEqual(a, b, compare) {
|
|
1041
1071
|
if (a.length !== b.length) return false;
|
|
@@ -1325,12 +1355,14 @@ function applySnapshotUpdate(snapshot, path, value, op, options) {
|
|
|
1325
1355
|
else current[leaf] = cloneValue ? cloneSnapshotValue(value) : value;
|
|
1326
1356
|
}
|
|
1327
1357
|
function collectSnapshot(options) {
|
|
1328
|
-
const { state, computedRefs, includeComputed, shouldIncludeKey, plainCache, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths = [] } = options;
|
|
1358
|
+
const { state, setupState, computedRefs, includeComputed, shouldIncludeKey, plainCache, toPlainMaxDepth, toPlainMaxKeys, includeFunctions = false, functionPaths = [] } = options;
|
|
1329
1359
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
1330
1360
|
const out = {};
|
|
1331
1361
|
const budget = Number.isFinite(toPlainMaxKeys) ? { keys: toPlainMaxKeys } : void 0;
|
|
1332
1362
|
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
1363
|
+
const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
|
|
1333
1364
|
const stateKeys = Object.keys(rawState);
|
|
1365
|
+
const setupStateKeys = rawSetupState ? Object.keys(rawSetupState) : [];
|
|
1334
1366
|
const computedKeys = includeComputed ? Object.keys(computedRefs) : [];
|
|
1335
1367
|
for (const key of stateKeys) {
|
|
1336
1368
|
if (!shouldIncludeKey(key)) continue;
|
|
@@ -1343,6 +1375,17 @@ function collectSnapshot(options) {
|
|
|
1343
1375
|
_path: key
|
|
1344
1376
|
});
|
|
1345
1377
|
}
|
|
1378
|
+
for (const key of setupStateKeys) {
|
|
1379
|
+
if (!shouldIncludeKey(key)) continue;
|
|
1380
|
+
out[key] = toPlain(rawSetupState[key], seen, {
|
|
1381
|
+
cache: plainCache,
|
|
1382
|
+
maxDepth: toPlainMaxDepth,
|
|
1383
|
+
includeFunctions,
|
|
1384
|
+
functionPaths,
|
|
1385
|
+
_budget: budget,
|
|
1386
|
+
_path: key
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1346
1389
|
for (const key of computedKeys) {
|
|
1347
1390
|
if (!shouldIncludeKey(key)) continue;
|
|
1348
1391
|
out[key] = toPlain(computedRefs[key].value, seen, {
|
|
@@ -1512,7 +1555,7 @@ function runPatchUpdate(options) {
|
|
|
1512
1555
|
//#endregion
|
|
1513
1556
|
//#region src/runtime/app/setData/scheduler.ts
|
|
1514
1557
|
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;
|
|
1558
|
+
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
1559
|
const plainCache = /* @__PURE__ */ new WeakMap();
|
|
1517
1560
|
let latestSnapshot = {};
|
|
1518
1561
|
let latestComputedSnapshot = Object.create(null);
|
|
@@ -1565,9 +1608,10 @@ function createSetDataScheduler(options) {
|
|
|
1565
1608
|
};
|
|
1566
1609
|
const resolveTopKeysByRoot = (root) => {
|
|
1567
1610
|
const matches = [];
|
|
1568
|
-
|
|
1611
|
+
const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
|
|
1612
|
+
for (const key of new Set([...Object.keys(state), ...rawSetupState ? Object.keys(rawSetupState) : []])) {
|
|
1569
1613
|
if (!shouldIncludeKey(key)) continue;
|
|
1570
|
-
const value = state[key];
|
|
1614
|
+
const value = rawSetupState && hasOwn(rawSetupState, key) ? rawSetupState[key] : state[key];
|
|
1571
1615
|
const candidate = isRef(value) ? value.value : value;
|
|
1572
1616
|
if (!candidate || typeof candidate !== "object") continue;
|
|
1573
1617
|
if (toRaw(candidate) === root) matches.push(key);
|
|
@@ -1585,6 +1629,7 @@ function createSetDataScheduler(options) {
|
|
|
1585
1629
|
};
|
|
1586
1630
|
const collect = () => collectSnapshot({
|
|
1587
1631
|
state,
|
|
1632
|
+
setupState,
|
|
1588
1633
|
computedRefs,
|
|
1589
1634
|
includeComputed,
|
|
1590
1635
|
shouldIncludeKey,
|
|
@@ -1596,18 +1641,20 @@ function createSetDataScheduler(options) {
|
|
|
1596
1641
|
});
|
|
1597
1642
|
const collectDiffSnapshot = () => {
|
|
1598
1643
|
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
1644
|
+
const rawSetupState = setupState && typeof setupState === "object" ? isReactive(setupState) ? toRaw(setupState) : setupState : void 0;
|
|
1599
1645
|
const nextSnapshot = { ...latestSnapshot };
|
|
1600
1646
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
1601
1647
|
const includedStateKeys = /* @__PURE__ */ new Set();
|
|
1602
1648
|
const includedComputedKeys = /* @__PURE__ */ new Set();
|
|
1603
1649
|
const replacedTopLevelKeys = /* @__PURE__ */ new Set();
|
|
1604
|
-
for (const key of Object.keys(rawState)) {
|
|
1650
|
+
for (const key of new Set([...Object.keys(rawState), ...rawSetupState ? Object.keys(rawSetupState) : []])) {
|
|
1605
1651
|
if (!shouldIncludeKey(key)) continue;
|
|
1606
1652
|
includedStateKeys.add(key);
|
|
1607
|
-
const
|
|
1653
|
+
const source = rawSetupState && hasOwn(rawSetupState, key) ? rawSetupState : rawState;
|
|
1654
|
+
const token = createValueToken(source[key]);
|
|
1608
1655
|
const previousToken = latestStateTokens[key];
|
|
1609
1656
|
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(
|
|
1657
|
+
if (!isSameToken(previousToken, token) || !hasOwn(latestSnapshot, key)) nextSnapshot[key] = toPlain(source[key], seen, {
|
|
1611
1658
|
cache: plainCache,
|
|
1612
1659
|
maxDepth: toPlainMaxDepth,
|
|
1613
1660
|
maxKeys: toPlainMaxKeys,
|
|
@@ -1855,6 +1902,15 @@ function createRuntimeMount(options) {
|
|
|
1855
1902
|
});
|
|
1856
1903
|
} catch (_unused) {}
|
|
1857
1904
|
const state = reactive(rawState);
|
|
1905
|
+
const setupState = reactive(Object.create(null));
|
|
1906
|
+
if (rawState && typeof rawState === "object" && !hasOwn(rawState, WEVU_SETUP_STATE_KEY)) try {
|
|
1907
|
+
Object.defineProperty(rawState, WEVU_SETUP_STATE_KEY, {
|
|
1908
|
+
value: setupState,
|
|
1909
|
+
configurable: true,
|
|
1910
|
+
enumerable: false,
|
|
1911
|
+
writable: false
|
|
1912
|
+
});
|
|
1913
|
+
} catch (_unused2) {}
|
|
1858
1914
|
const computedDefs = resolvedComputed;
|
|
1859
1915
|
const methodDefs = resolvedMethods;
|
|
1860
1916
|
let mounted = true;
|
|
@@ -1873,6 +1929,7 @@ function createRuntimeMount(options) {
|
|
|
1873
1929
|
const mergedDebugWhen = diagnostics === "always" ? "always" : debugWhen;
|
|
1874
1930
|
const { boundMethods, computedRefs, computedSetters, dirtyComputedKeys, computedProxy, publicInstance, touchSetupMethodsVersion } = createRuntimeContext({
|
|
1875
1931
|
state,
|
|
1932
|
+
setupState,
|
|
1876
1933
|
computedDefs,
|
|
1877
1934
|
methodDefs,
|
|
1878
1935
|
appConfig,
|
|
@@ -1884,6 +1941,7 @@ function createRuntimeMount(options) {
|
|
|
1884
1941
|
let tracker;
|
|
1885
1942
|
const scheduler = createSetDataScheduler({
|
|
1886
1943
|
state,
|
|
1944
|
+
setupState,
|
|
1887
1945
|
computedRefs,
|
|
1888
1946
|
dirtyComputedKeys,
|
|
1889
1947
|
includeComputed,
|
|
@@ -1919,8 +1977,8 @@ function createRuntimeMount(options) {
|
|
|
1919
1977
|
const runtimeAttrs = state[WEVU_ATTRS_KEY];
|
|
1920
1978
|
if (isReactive(runtimeAttrs)) touchReactive(runtimeAttrs);
|
|
1921
1979
|
trackedSetupReactiveKeys.forEach((key) => {
|
|
1922
|
-
|
|
1923
|
-
touchSetupBinding(
|
|
1980
|
+
var _key;
|
|
1981
|
+
touchSetupBinding((_key = setupState[key]) !== null && _key !== void 0 ? _key : state[key]);
|
|
1924
1982
|
});
|
|
1925
1983
|
}, {
|
|
1926
1984
|
lazy: true,
|
|
@@ -1954,7 +2012,7 @@ function createRuntimeMount(options) {
|
|
|
1954
2012
|
stopHandles.forEach((handle) => {
|
|
1955
2013
|
try {
|
|
1956
2014
|
handle();
|
|
1957
|
-
} catch (
|
|
2015
|
+
} catch (_unused3) {}
|
|
1958
2016
|
});
|
|
1959
2017
|
stopHandles.length = 0;
|
|
1960
2018
|
};
|
|
@@ -1962,6 +2020,9 @@ function createRuntimeMount(options) {
|
|
|
1962
2020
|
get state() {
|
|
1963
2021
|
return state;
|
|
1964
2022
|
},
|
|
2023
|
+
get setupState() {
|
|
2024
|
+
return setupState;
|
|
2025
|
+
},
|
|
1965
2026
|
get proxy() {
|
|
1966
2027
|
return publicInstance;
|
|
1967
2028
|
},
|
|
@@ -1986,7 +2047,7 @@ function createRuntimeMount(options) {
|
|
|
1986
2047
|
enumerable: false,
|
|
1987
2048
|
writable: false
|
|
1988
2049
|
});
|
|
1989
|
-
} catch (
|
|
2050
|
+
} catch (_unused4) {
|
|
1990
2051
|
runtimeInstance.__wevu_touchSetupMethodsVersion = touchSetupMethodsVersion;
|
|
1991
2052
|
}
|
|
1992
2053
|
try {
|
|
@@ -1996,7 +2057,7 @@ function createRuntimeMount(options) {
|
|
|
1996
2057
|
enumerable: false,
|
|
1997
2058
|
writable: false
|
|
1998
2059
|
});
|
|
1999
|
-
} catch (
|
|
2060
|
+
} catch (_unused5) {
|
|
2000
2061
|
runtimeInstance.__wevu_flushSetupSnapshotSync = job;
|
|
2001
2062
|
}
|
|
2002
2063
|
try {
|
|
@@ -2006,7 +2067,7 @@ function createRuntimeMount(options) {
|
|
|
2006
2067
|
enumerable: false,
|
|
2007
2068
|
writable: false
|
|
2008
2069
|
});
|
|
2009
|
-
} catch (
|
|
2070
|
+
} catch (_unused6) {
|
|
2010
2071
|
runtimeInstance.__wevu_cloneLatestSnapshot = scheduler.cloneLatestSnapshot;
|
|
2011
2072
|
}
|
|
2012
2073
|
try {
|
|
@@ -2018,7 +2079,7 @@ function createRuntimeMount(options) {
|
|
|
2018
2079
|
enumerable: false,
|
|
2019
2080
|
writable: false
|
|
2020
2081
|
});
|
|
2021
|
-
} catch (
|
|
2082
|
+
} catch (_unused7) {
|
|
2022
2083
|
runtimeInstance.__wevu_trackSetupReactiveKey = (key) => {
|
|
2023
2084
|
trackedSetupReactiveKeys.add(key);
|
|
2024
2085
|
};
|
|
@@ -3044,6 +3105,7 @@ function runSetupFunction(setup, props, context) {
|
|
|
3044
3105
|
const runtimeContext = (_context$runtime = context === null || context === void 0 ? void 0 : context.runtime) !== null && _context$runtime !== void 0 ? _context$runtime : {
|
|
3045
3106
|
methods: Object.create(null),
|
|
3046
3107
|
state: {},
|
|
3108
|
+
setupState: {},
|
|
3047
3109
|
proxy: {},
|
|
3048
3110
|
watch: () => () => {},
|
|
3049
3111
|
bindModel: () => {}
|
|
@@ -3069,6 +3131,18 @@ function attachRuntimeProxyProps(state, props) {
|
|
|
3069
3131
|
state[WEVU_PROPS_KEY] = props;
|
|
3070
3132
|
}
|
|
3071
3133
|
}
|
|
3134
|
+
function attachRuntimeSetupState(state, setupState) {
|
|
3135
|
+
try {
|
|
3136
|
+
Object.defineProperty(state, WEVU_SETUP_STATE_KEY, {
|
|
3137
|
+
value: setupState,
|
|
3138
|
+
configurable: true,
|
|
3139
|
+
enumerable: false,
|
|
3140
|
+
writable: false
|
|
3141
|
+
});
|
|
3142
|
+
} catch (_unused2) {
|
|
3143
|
+
state[WEVU_SETUP_STATE_KEY] = setupState;
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3072
3146
|
function attachNativeInstanceRef(state, instance) {
|
|
3073
3147
|
try {
|
|
3074
3148
|
Object.defineProperty(state, WEVU_NATIVE_INSTANCE_KEY, {
|
|
@@ -3077,7 +3151,7 @@ function attachNativeInstanceRef(state, instance) {
|
|
|
3077
3151
|
enumerable: false,
|
|
3078
3152
|
writable: true
|
|
3079
3153
|
});
|
|
3080
|
-
} catch (
|
|
3154
|
+
} catch (_unused3) {
|
|
3081
3155
|
state[WEVU_NATIVE_INSTANCE_KEY] = instance;
|
|
3082
3156
|
}
|
|
3083
3157
|
}
|
|
@@ -3089,7 +3163,7 @@ function attachRuntimeRef(state, runtime) {
|
|
|
3089
3163
|
enumerable: false,
|
|
3090
3164
|
writable: true
|
|
3091
3165
|
});
|
|
3092
|
-
} catch (
|
|
3166
|
+
} catch (_unused4) {
|
|
3093
3167
|
state[WEVU_RUNTIME_KEY] = runtime;
|
|
3094
3168
|
}
|
|
3095
3169
|
}
|
|
@@ -3101,10 +3175,10 @@ function attachRuntimeInstance(runtime, instance) {
|
|
|
3101
3175
|
enumerable: false,
|
|
3102
3176
|
writable: true
|
|
3103
3177
|
});
|
|
3104
|
-
} catch (
|
|
3178
|
+
} catch (_unused5) {
|
|
3105
3179
|
try {
|
|
3106
3180
|
runtime.instance = instance;
|
|
3107
|
-
} catch (
|
|
3181
|
+
} catch (_unused6) {}
|
|
3108
3182
|
}
|
|
3109
3183
|
}
|
|
3110
3184
|
function resolveNativeSetData(instance) {
|
|
@@ -3135,7 +3209,7 @@ function syncRuntimeProps(props, mpProperties) {
|
|
|
3135
3209
|
const currentKeys = Object.keys(props);
|
|
3136
3210
|
for (const key of currentKeys) if (!hasOwn(mpProperties, key)) try {
|
|
3137
3211
|
delete props[key];
|
|
3138
|
-
} catch (
|
|
3212
|
+
} catch (_unused7) {}
|
|
3139
3213
|
for (const [key, value] of Object.entries(mpProperties)) props[key] = value;
|
|
3140
3214
|
}
|
|
3141
3215
|
function ensureRuntimeProps(target, runtimeState, mpProperties = target.properties || {}) {
|
|
@@ -3150,7 +3224,7 @@ function ensureRuntimeProps(target, runtimeState, mpProperties = target.properti
|
|
|
3150
3224
|
enumerable: false,
|
|
3151
3225
|
writable: true
|
|
3152
3226
|
});
|
|
3153
|
-
} catch (
|
|
3227
|
+
} catch (_unused8) {
|
|
3154
3228
|
target[WEVU_PROPS_KEY] = props;
|
|
3155
3229
|
}
|
|
3156
3230
|
return props;
|
|
@@ -3162,6 +3236,7 @@ function normalizeEmitEventName(eventName) {
|
|
|
3162
3236
|
return eventName.includes(":") ? eventName.replaceAll(":", "-").toLowerCase() : eventName;
|
|
3163
3237
|
}
|
|
3164
3238
|
function runRuntimeSetupPhase(options) {
|
|
3239
|
+
var _runtimeWithDefaults$;
|
|
3165
3240
|
const { target, runtime, runtimeWithDefaults, runtimeState, runtimeProxy, setup } = options;
|
|
3166
3241
|
const props = ensureRuntimeProps(target, runtimeState, target.properties || {});
|
|
3167
3242
|
const attrs = shallowReactive(Object.create(null));
|
|
@@ -3191,6 +3266,7 @@ function runRuntimeSetupPhase(options) {
|
|
|
3191
3266
|
}
|
|
3192
3267
|
const setupInstance = ensureSetupContextInstance(target, runtimeWithDefaults);
|
|
3193
3268
|
const slots = createSetupSlotsProxy(props);
|
|
3269
|
+
attachRuntimeSetupState(runtimeState, (_runtimeWithDefaults$ = runtimeWithDefaults.setupState) !== null && _runtimeWithDefaults$ !== void 0 ? _runtimeWithDefaults$ : Object.create(null));
|
|
3194
3270
|
try {
|
|
3195
3271
|
Object.defineProperty(runtimeState, "$slots", {
|
|
3196
3272
|
value: slots,
|
|
@@ -3228,43 +3304,20 @@ function runRuntimeSetupPhase(options) {
|
|
|
3228
3304
|
const result = instanceScope.run(() => runSetupFunction(setup, props, context));
|
|
3229
3305
|
let methodsChanged = false;
|
|
3230
3306
|
if (result && typeof result === "object") {
|
|
3231
|
-
const
|
|
3307
|
+
const runtimeSetupState = runtime.setupState && typeof runtime.setupState === "object" ? isReactive(runtime.setupState) ? toRaw(runtime.setupState) : runtime.setupState : Object.create(null);
|
|
3232
3308
|
Object.keys(result).forEach((key) => {
|
|
3233
3309
|
const val = result[key];
|
|
3234
3310
|
if (typeof val === "function") {
|
|
3235
3311
|
runtime.methods[key] = (...args) => val.apply(runtime.proxy, args);
|
|
3312
|
+
runtime.state[key] = (...args) => val.apply(runtime.proxy, args);
|
|
3236
3313
|
methodsChanged = true;
|
|
3237
3314
|
} else {
|
|
3238
3315
|
if (hasTrackableSetupBinding(val)) {
|
|
3239
3316
|
var _wevu_trackSetupReact;
|
|
3240
3317
|
(_wevu_trackSetupReact = runtime.__wevu_trackSetupReactiveKey) === null || _wevu_trackSetupReact === void 0 || _wevu_trackSetupReact.call(runtime, key);
|
|
3241
3318
|
}
|
|
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
3319
|
runtime.state[key] = val;
|
|
3320
|
+
runtimeSetupState[key] = val;
|
|
3268
3321
|
}
|
|
3269
3322
|
});
|
|
3270
3323
|
}
|
|
@@ -3444,7 +3497,7 @@ function attachPageLayoutSetter(target) {
|
|
|
3444
3497
|
* @internal
|
|
3445
3498
|
*/
|
|
3446
3499
|
function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
3447
|
-
var _wevuSetDataOptions, _wevuSetDataOptions2, _runtime$proxy, _runtime$state, _computed, _runtime$methods, _watch, _bindModel, _snapshot, _unmount;
|
|
3500
|
+
var _wevuSetDataOptions, _wevuSetDataOptions2, _runtime$proxy, _runtime$state, _runtime$setupState, _computed, _runtime$methods, _watch, _bindModel, _snapshot, _unmount;
|
|
3448
3501
|
if (target.__wevu) return target.__wevu;
|
|
3449
3502
|
attachRuntimeProvideParentContext(target, runtimeApp);
|
|
3450
3503
|
safeMarkNoSetData(target);
|
|
@@ -3535,6 +3588,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3535
3588
|
attachRuntimeInstance(runtime, target);
|
|
3536
3589
|
const runtimeProxy = (_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : {};
|
|
3537
3590
|
const runtimeState = (_runtime$state = runtime === null || runtime === void 0 ? void 0 : runtime.state) !== null && _runtime$state !== void 0 ? _runtime$state : {};
|
|
3591
|
+
const runtimeSetupState = (_runtime$setupState = runtime === null || runtime === void 0 ? void 0 : runtime.setupState) !== null && _runtime$setupState !== void 0 ? _runtime$setupState : Object.create(null);
|
|
3538
3592
|
if (runtimeState && typeof runtimeState === "object") {
|
|
3539
3593
|
attachRuntimeRef(runtimeState, runtime);
|
|
3540
3594
|
attachNativeInstanceRef(runtimeState, target);
|
|
@@ -3549,6 +3603,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3549
3603
|
const runtimeWithDefaults = {
|
|
3550
3604
|
...runtime !== null && runtime !== void 0 ? runtime : {},
|
|
3551
3605
|
state: runtimeState,
|
|
3606
|
+
setupState: runtimeSetupState,
|
|
3552
3607
|
proxy: runtimeProxy,
|
|
3553
3608
|
methods: runtimeMethods,
|
|
3554
3609
|
computed: runtimeComputed,
|
|
@@ -3893,19 +3948,26 @@ function attachOptionalPageLifecycleHooks(pageLifecycleHooks, options) {
|
|
|
3893
3948
|
//#endregion
|
|
3894
3949
|
//#region src/runtime/register/component/lifecycle.ts
|
|
3895
3950
|
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;
|
|
3951
|
+
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;
|
|
3952
|
+
const flushPageSnapshotIfPossible = (target) => {
|
|
3953
|
+
var _wevu, _wevu$__wevu_flushSet;
|
|
3954
|
+
(_wevu = target.__wevu) === null || _wevu === void 0 || (_wevu$__wevu_flushSet = _wevu.__wevu_flushSetupSnapshotSync) === null || _wevu$__wevu_flushSet === void 0 || _wevu$__wevu_flushSet.call(_wevu);
|
|
3955
|
+
};
|
|
3897
3956
|
const pageLifecycleHooks = {
|
|
3898
3957
|
onLoad(...args) {
|
|
3899
3958
|
if (this[WEVU_ON_LOAD_CALLED_KEY]) return;
|
|
3900
3959
|
this[WEVU_ON_LOAD_CALLED_KEY] = true;
|
|
3901
3960
|
mountRuntimeInstance(this, runtimeApp, watch, setup);
|
|
3961
|
+
const pageOptions = args[0] && typeof args[0] === "object" ? args[0] : resolvePageOptions(this);
|
|
3962
|
+
syncWevuPropsFromValues === null || syncWevuPropsFromValues === void 0 || syncWevuPropsFromValues(this, pageOptions);
|
|
3963
|
+
flushPageSnapshotIfPossible(this);
|
|
3902
3964
|
enableDeferredSetData(this);
|
|
3903
3965
|
if (isPage) ensurePageShareMenus({
|
|
3904
3966
|
enableOnShareAppMessage,
|
|
3905
3967
|
enableOnShareTimeline
|
|
3906
3968
|
});
|
|
3907
3969
|
callHookList(this, "onLoad", args);
|
|
3908
|
-
if (typeof userOnLoad === "function") return userOnLoad.apply(this, args);
|
|
3970
|
+
if (typeof userOnLoad === "function") return userOnLoad.apply(this, args.length ? args : [pageOptions]);
|
|
3909
3971
|
},
|
|
3910
3972
|
onUnload(...args) {
|
|
3911
3973
|
if (isPage) releaseCurrentPageInstance(this);
|
|
@@ -3917,6 +3979,8 @@ function createPageLifecycleHooks(options) {
|
|
|
3917
3979
|
ensureMiniProgramGlobalPatched();
|
|
3918
3980
|
bindCurrentPageInstance(this);
|
|
3919
3981
|
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
3982
|
+
syncWevuPropsFromValues === null || syncWevuPropsFromValues === void 0 || syncWevuPropsFromValues(this, resolvePageOptions(this));
|
|
3983
|
+
flushPageSnapshotIfPossible(this);
|
|
3920
3984
|
ensurePageShareMenus({
|
|
3921
3985
|
enableOnShareAppMessage,
|
|
3922
3986
|
enableOnShareTimeline
|
|
@@ -3936,6 +4000,8 @@ function createPageLifecycleHooks(options) {
|
|
|
3936
4000
|
onReady(...args) {
|
|
3937
4001
|
if (isPage) {
|
|
3938
4002
|
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
4003
|
+
syncWevuPropsFromValues === null || syncWevuPropsFromValues === void 0 || syncWevuPropsFromValues(this, resolvePageOptions(this));
|
|
4004
|
+
flushPageSnapshotIfPossible(this);
|
|
3939
4005
|
ensurePageShareMenus({
|
|
3940
4006
|
enableOnShareAppMessage,
|
|
3941
4007
|
enableOnShareTimeline
|
|
@@ -4136,6 +4202,8 @@ function prepareComponentOptions(mpOptions) {
|
|
|
4136
4202
|
"export",
|
|
4137
4203
|
"__wevuTemplateRefs",
|
|
4138
4204
|
"__wevuLayoutHosts",
|
|
4205
|
+
WEVU_PROPS_ALIASES_KEY,
|
|
4206
|
+
WEVU_PROPS_DERIVED_KEYS_KEY,
|
|
4139
4207
|
"setupLifecycle",
|
|
4140
4208
|
"features",
|
|
4141
4209
|
"__wevu_isPage"
|
|
@@ -4186,6 +4254,10 @@ function prepareComponentOptions(mpOptions) {
|
|
|
4186
4254
|
delete restOptions.__wevuTemplateRefs;
|
|
4187
4255
|
const layoutHosts = restOptions.__wevuLayoutHosts;
|
|
4188
4256
|
delete restOptions.__wevuLayoutHosts;
|
|
4257
|
+
const propsAliases = restOptions[WEVU_PROPS_ALIASES_KEY];
|
|
4258
|
+
delete restOptions[WEVU_PROPS_ALIASES_KEY];
|
|
4259
|
+
const propsDerivedKeys = restOptions[WEVU_PROPS_DERIVED_KEYS_KEY];
|
|
4260
|
+
delete restOptions[WEVU_PROPS_DERIVED_KEYS_KEY];
|
|
4189
4261
|
const userObservers = restOptions.observers;
|
|
4190
4262
|
const setupLifecycle = restOptions.setupLifecycle === "created" ? "created" : "attached";
|
|
4191
4263
|
delete restOptions.setupLifecycle;
|
|
@@ -4206,6 +4278,8 @@ function prepareComponentOptions(mpOptions) {
|
|
|
4206
4278
|
topLevelMethods,
|
|
4207
4279
|
templateRefs,
|
|
4208
4280
|
layoutHosts,
|
|
4281
|
+
propsAliases,
|
|
4282
|
+
propsDerivedKeys,
|
|
4209
4283
|
userObservers,
|
|
4210
4284
|
setupLifecycle,
|
|
4211
4285
|
legacyCreated,
|
|
@@ -4246,9 +4320,48 @@ function refreshOwnerSnapshotFromInstance(instance) {
|
|
|
4246
4320
|
//#endregion
|
|
4247
4321
|
//#region src/runtime/register/component/props.ts
|
|
4248
4322
|
function createPropsSync(options) {
|
|
4249
|
-
const { restOptions, userObservers } = options;
|
|
4323
|
+
const { restOptions, propsAliases, propsDerivedKeys, userObservers } = options;
|
|
4250
4324
|
const propKeys = restOptions.properties && typeof restOptions.properties === "object" ? Object.keys(restOptions.properties) : [];
|
|
4251
4325
|
const propKeySet = new Set(propKeys);
|
|
4326
|
+
const propsDerivedKeySet = new Set(propsDerivedKeys !== null && propsDerivedKeys !== void 0 ? propsDerivedKeys : []);
|
|
4327
|
+
const aliasEntries = Object.entries(propsAliases !== null && propsAliases !== void 0 ? propsAliases : {}).filter(([alias, propName]) => alias && propName);
|
|
4328
|
+
const syncedAliases = /* @__PURE__ */ new WeakMap();
|
|
4329
|
+
const syncSetupStatePropsAliases = (instance, propsProxy) => {
|
|
4330
|
+
var _syncedAliases$get;
|
|
4331
|
+
if (!aliasEntries.length) return;
|
|
4332
|
+
const runtime = instance.__wevu;
|
|
4333
|
+
const setupState = runtime === null || runtime === void 0 ? void 0 : runtime.setupState;
|
|
4334
|
+
const state = runtime === null || runtime === void 0 ? void 0 : runtime.state;
|
|
4335
|
+
if (!setupState || typeof setupState !== "object") return;
|
|
4336
|
+
const aliases = (_syncedAliases$get = syncedAliases.get(instance)) !== null && _syncedAliases$get !== void 0 ? _syncedAliases$get : /* @__PURE__ */ new Set();
|
|
4337
|
+
syncedAliases.set(instance, aliases);
|
|
4338
|
+
for (const [alias, propName] of aliasEntries) {
|
|
4339
|
+
if (hasOwn(setupState, alias) && !aliases.has(alias)) continue;
|
|
4340
|
+
const value = propsProxy[propName];
|
|
4341
|
+
try {
|
|
4342
|
+
setupState[alias] = value;
|
|
4343
|
+
aliases.add(alias);
|
|
4344
|
+
} catch (_unused) {}
|
|
4345
|
+
if (state && typeof state === "object" && (!hasOwn(state, alias) || aliases.has(alias))) try {
|
|
4346
|
+
state[alias] = value;
|
|
4347
|
+
} catch (_unused2) {}
|
|
4348
|
+
}
|
|
4349
|
+
};
|
|
4350
|
+
const syncPropsDerivedKeys = (instance, propsProxy) => {
|
|
4351
|
+
if (!propsDerivedKeySet.size) return;
|
|
4352
|
+
const runtime = instance.__wevu;
|
|
4353
|
+
const setupState = runtime === null || runtime === void 0 ? void 0 : runtime.setupState;
|
|
4354
|
+
if (!setupState || typeof setupState !== "object") return;
|
|
4355
|
+
const aliasToPropName = new Map(aliasEntries);
|
|
4356
|
+
for (const key of propsDerivedKeySet) {
|
|
4357
|
+
var _aliasToPropName$get;
|
|
4358
|
+
const propName = (_aliasToPropName$get = aliasToPropName.get(key)) !== null && _aliasToPropName$get !== void 0 ? _aliasToPropName$get : key;
|
|
4359
|
+
if (!hasOwn(propsProxy, propName)) continue;
|
|
4360
|
+
try {
|
|
4361
|
+
setupState[key] = propsProxy[propName];
|
|
4362
|
+
} catch (_unused3) {}
|
|
4363
|
+
}
|
|
4364
|
+
};
|
|
4252
4365
|
const attachWevuPropKeys = (instance) => {
|
|
4253
4366
|
try {
|
|
4254
4367
|
Object.defineProperty(instance, WEVU_PROP_KEYS_KEY, {
|
|
@@ -4257,7 +4370,7 @@ function createPropsSync(options) {
|
|
|
4257
4370
|
enumerable: false,
|
|
4258
4371
|
writable: false
|
|
4259
4372
|
});
|
|
4260
|
-
} catch (
|
|
4373
|
+
} catch (_unused4) {
|
|
4261
4374
|
instance[WEVU_PROP_KEYS_KEY] = propKeys;
|
|
4262
4375
|
}
|
|
4263
4376
|
};
|
|
@@ -4274,7 +4387,7 @@ function createPropsSync(options) {
|
|
|
4274
4387
|
const currentKeys = Object.keys(attrsProxy);
|
|
4275
4388
|
for (const existingKey of currentKeys) if (!next || !hasOwn(next, existingKey) || propKeySet.has(existingKey) || hasRuntimeStateKey(existingKey)) try {
|
|
4276
4389
|
delete attrsProxy[existingKey];
|
|
4277
|
-
} catch (
|
|
4390
|
+
} catch (_unused5) {}
|
|
4278
4391
|
if (!next) {
|
|
4279
4392
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4280
4393
|
return;
|
|
@@ -4283,7 +4396,7 @@ function createPropsSync(options) {
|
|
|
4283
4396
|
if (propKeySet.has(key) || hasRuntimeStateKey(key)) continue;
|
|
4284
4397
|
try {
|
|
4285
4398
|
attrsProxy[key] = value;
|
|
4286
|
-
} catch (
|
|
4399
|
+
} catch (_unused6) {}
|
|
4287
4400
|
}
|
|
4288
4401
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4289
4402
|
};
|
|
@@ -4296,32 +4409,54 @@ function createPropsSync(options) {
|
|
|
4296
4409
|
const currentKeys = Object.keys(propsProxy);
|
|
4297
4410
|
for (const existingKey of currentKeys) if (!hasOwn(next, existingKey)) try {
|
|
4298
4411
|
delete propsProxy[existingKey];
|
|
4299
|
-
} catch (
|
|
4412
|
+
} catch (_unused7) {}
|
|
4300
4413
|
for (const [k, v] of Object.entries(next)) {
|
|
4301
4414
|
const nextValue = pendingPropValues && hasOwn(pendingPropValues, k) ? pendingPropValues[k] : v;
|
|
4302
4415
|
try {
|
|
4303
4416
|
propsProxy[k] = nextValue;
|
|
4304
|
-
} catch (
|
|
4417
|
+
} catch (_unused8) {}
|
|
4305
4418
|
}
|
|
4306
4419
|
if (pendingPropValues) {
|
|
4307
4420
|
for (const [k, v] of Object.entries(pendingPropValues)) if (!hasOwn(next, k)) try {
|
|
4308
4421
|
propsProxy[k] = v;
|
|
4309
|
-
} catch (
|
|
4422
|
+
} catch (_unused9) {}
|
|
4310
4423
|
}
|
|
4424
|
+
syncPropsDerivedKeys(instance, propsProxy);
|
|
4425
|
+
syncSetupStatePropsAliases(instance, propsProxy);
|
|
4311
4426
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4312
4427
|
}
|
|
4313
4428
|
if (pendingPropValues) delete instance[WEVU_PENDING_PROP_VALUES_KEY];
|
|
4314
4429
|
syncWevuAttrsFromInstance(instance);
|
|
4315
4430
|
};
|
|
4431
|
+
const syncWevuPropsFromValues = (instance, values) => {
|
|
4432
|
+
if (!values || typeof values !== "object") return;
|
|
4433
|
+
const propsProxy = instance[WEVU_PROPS_KEY];
|
|
4434
|
+
if (!propsProxy || typeof propsProxy !== "object") return;
|
|
4435
|
+
let changed = false;
|
|
4436
|
+
for (const key of propKeys) {
|
|
4437
|
+
if (!hasOwn(values, key)) continue;
|
|
4438
|
+
try {
|
|
4439
|
+
propsProxy[key] = values[key];
|
|
4440
|
+
changed = true;
|
|
4441
|
+
} catch (_unused10) {}
|
|
4442
|
+
}
|
|
4443
|
+
if (!changed) return;
|
|
4444
|
+
syncPropsDerivedKeys(instance, propsProxy);
|
|
4445
|
+
syncSetupStatePropsAliases(instance, propsProxy);
|
|
4446
|
+
refreshOwnerSnapshotFromInstance(instance);
|
|
4447
|
+
syncWevuAttrsFromInstance(instance);
|
|
4448
|
+
};
|
|
4316
4449
|
const syncWevuPropValue = (instance, key, value) => {
|
|
4317
4450
|
var _ref, _ref$WEVU_PENDING_PRO;
|
|
4318
4451
|
const propsProxy = instance[WEVU_PROPS_KEY];
|
|
4319
4452
|
if (!propsProxy || typeof propsProxy !== "object") return;
|
|
4320
4453
|
try {
|
|
4321
4454
|
propsProxy[key] = value;
|
|
4322
|
-
} catch (
|
|
4455
|
+
} catch (_unused11) {}
|
|
4323
4456
|
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
4457
|
pendingPropValues[key] = value;
|
|
4458
|
+
syncPropsDerivedKeys(instance, propsProxy);
|
|
4459
|
+
syncSetupStatePropsAliases(instance, propsProxy);
|
|
4325
4460
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4326
4461
|
syncWevuAttrsFromInstance(instance);
|
|
4327
4462
|
};
|
|
@@ -4346,6 +4481,7 @@ function createPropsSync(options) {
|
|
|
4346
4481
|
return {
|
|
4347
4482
|
attachWevuPropKeys,
|
|
4348
4483
|
syncWevuPropsFromInstance,
|
|
4484
|
+
syncWevuPropsFromValues,
|
|
4349
4485
|
finalObservers
|
|
4350
4486
|
};
|
|
4351
4487
|
}
|
|
@@ -4739,7 +4875,7 @@ function registerComponentDefinition(options) {
|
|
|
4739
4875
|
*/
|
|
4740
4876
|
function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
4741
4877
|
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);
|
|
4878
|
+
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
4879
|
const { enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnRouteDoneFallback, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, enableOnSaveExitState, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites } = resolveComponentFeatures({
|
|
4744
4880
|
features,
|
|
4745
4881
|
userOnSaveExitState,
|
|
@@ -4778,8 +4914,10 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4778
4914
|
multipleSlots: (_multipleSlots = userOptions.multipleSlots) !== null && _multipleSlots !== void 0 ? _multipleSlots : true,
|
|
4779
4915
|
...userOptions
|
|
4780
4916
|
};
|
|
4781
|
-
const { attachWevuPropKeys, syncWevuPropsFromInstance, finalObservers } = createPropsSync({
|
|
4917
|
+
const { attachWevuPropKeys, syncWevuPropsFromInstance, syncWevuPropsFromValues, finalObservers } = createPropsSync({
|
|
4782
4918
|
restOptions,
|
|
4919
|
+
propsAliases,
|
|
4920
|
+
propsDerivedKeys,
|
|
4783
4921
|
userObservers
|
|
4784
4922
|
});
|
|
4785
4923
|
const { finalMethods } = createComponentMethods({
|
|
@@ -4815,6 +4953,7 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4815
4953
|
enableOnShareAppMessage,
|
|
4816
4954
|
enableOnShareTimeline,
|
|
4817
4955
|
enableOnAddToFavorites,
|
|
4956
|
+
syncWevuPropsFromValues,
|
|
4818
4957
|
effectiveOnSaveExitState,
|
|
4819
4958
|
effectiveOnPullDownRefresh,
|
|
4820
4959
|
effectiveOnReachBottom,
|
|
@@ -4838,6 +4977,7 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4838
4977
|
attachWevuPropKeys,
|
|
4839
4978
|
setupLifecycle,
|
|
4840
4979
|
syncWevuPropsFromInstance,
|
|
4980
|
+
syncWevuPropsFromValues,
|
|
4841
4981
|
isPage,
|
|
4842
4982
|
legacyCreated,
|
|
4843
4983
|
getRuntimeOwnerLabel
|
|
@@ -5169,7 +5309,7 @@ function flushScopedSlotComputedBindings(instance, computed) {
|
|
|
5169
5309
|
const payload = collectComputedPayload(instance, computed);
|
|
5170
5310
|
if (payload && Object.keys(payload).length > 0 && typeof (instance === null || instance === void 0 ? void 0 : instance.setData) === "function") instance.setData(payload);
|
|
5171
5311
|
}
|
|
5172
|
-
function
|
|
5312
|
+
function syncSlotPropsData(instance, override) {
|
|
5173
5313
|
var _instance$properties, _instance$properties2, _instance$__wevu3;
|
|
5174
5314
|
const scopeSource = hasOwn(override !== null && override !== void 0 ? override : {}, WEVU_SLOT_SCOPE_KEY) ? override[WEVU_SLOT_SCOPE_KEY] : instance === null || instance === void 0 || (_instance$properties = instance.properties) === null || _instance$properties === void 0 ? void 0 : _instance$properties[WEVU_SLOT_SCOPE_KEY];
|
|
5175
5315
|
const propsSource = hasOwn(override !== null && override !== void 0 ? override : {}, WEVU_SLOT_PROPS_KEY) ? override[WEVU_SLOT_PROPS_KEY] : instance === null || instance === void 0 || (_instance$properties2 = instance.properties) === null || _instance$properties2 === void 0 ? void 0 : _instance$properties2[WEVU_SLOT_PROPS_KEY];
|
|
@@ -5179,8 +5319,13 @@ function mergeSlotProps(instance, computed, override) {
|
|
|
5179
5319
|
...scope,
|
|
5180
5320
|
...slotProps
|
|
5181
5321
|
};
|
|
5322
|
+
instance[WEVU_SLOT_PROPS_DATA_KEY] = merged;
|
|
5182
5323
|
const runtimeState = instance === null || instance === void 0 || (_instance$__wevu3 = instance.__wevu) === null || _instance$__wevu3 === void 0 ? void 0 : _instance$__wevu3.state;
|
|
5183
5324
|
if (runtimeState && typeof runtimeState === "object") runtimeState[WEVU_SLOT_PROPS_DATA_KEY] = merged;
|
|
5325
|
+
return merged;
|
|
5326
|
+
}
|
|
5327
|
+
function mergeSlotProps(instance, computed, override) {
|
|
5328
|
+
const merged = syncSlotPropsData(instance, override);
|
|
5184
5329
|
if (typeof (instance === null || instance === void 0 ? void 0 : instance.setData) === "function") instance.setData({ [WEVU_SLOT_PROPS_DATA_KEY]: merged });
|
|
5185
5330
|
flushScopedSlotComputedBindings(instance, computed);
|
|
5186
5331
|
}
|
|
@@ -5204,6 +5349,8 @@ function setOwnerProxy(instance, proxy) {
|
|
|
5204
5349
|
function updateOwnerBindings(instance, snapshot, proxy, computed) {
|
|
5205
5350
|
var _instance$__wevu5;
|
|
5206
5351
|
setOwnerProxy(instance, proxy);
|
|
5352
|
+
syncSlotPropsData(instance);
|
|
5353
|
+
instance[WEVU_SLOT_OWNER_KEY] = snapshot || {};
|
|
5207
5354
|
const runtimeState = instance === null || instance === void 0 || (_instance$__wevu5 = instance.__wevu) === null || _instance$__wevu5 === void 0 ? void 0 : _instance$__wevu5.state;
|
|
5208
5355
|
if (runtimeState && typeof runtimeState === "object") runtimeState[WEVU_SLOT_OWNER_KEY] = snapshot || {};
|
|
5209
5356
|
if (typeof (instance === null || instance === void 0 ? void 0 : instance.setData) === "function") instance.setData({ [WEVU_SLOT_OWNER_KEY]: snapshot || {} });
|
|
@@ -5342,12 +5489,12 @@ function shouldExposeInSnapshot(value) {
|
|
|
5342
5489
|
return isPlainObject(value);
|
|
5343
5490
|
}
|
|
5344
5491
|
function applySetupResult(runtime, target, result, options) {
|
|
5345
|
-
var _runtime$methods, _runtime$state;
|
|
5492
|
+
var _runtime$methods, _runtime$state, _runtime$setupState;
|
|
5346
5493
|
const includeFunctionsInState = Boolean(options === null || options === void 0 ? void 0 : options.includeFunctionsInState);
|
|
5347
5494
|
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
5495
|
const methods = (_runtime$methods = runtime === null || runtime === void 0 ? void 0 : runtime.methods) !== null && _runtime$methods !== void 0 ? _runtime$methods : Object.create(null);
|
|
5350
5496
|
const state = (_runtime$state = runtime === null || runtime === void 0 ? void 0 : runtime.state) !== null && _runtime$state !== void 0 ? _runtime$state : Object.create(null);
|
|
5497
|
+
const setupState = (_runtime$setupState = runtime === null || runtime === void 0 ? void 0 : runtime.setupState) !== null && _runtime$setupState !== void 0 ? _runtime$setupState : Object.create(null);
|
|
5351
5498
|
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
5352
5499
|
let methodsChanged = false;
|
|
5353
5500
|
if (runtime && !runtime.methods) try {
|
|
@@ -5356,6 +5503,9 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
5356
5503
|
if (runtime && !runtime.state) try {
|
|
5357
5504
|
runtime.state = state;
|
|
5358
5505
|
} catch (_unused2) {}
|
|
5506
|
+
if (runtime && !runtime.setupState) try {
|
|
5507
|
+
runtime.setupState = setupState;
|
|
5508
|
+
} catch (_unused3) {}
|
|
5359
5509
|
Object.keys(result).forEach((key) => {
|
|
5360
5510
|
const val = result[key];
|
|
5361
5511
|
if (typeof val === "function") {
|
|
@@ -5364,38 +5514,15 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
5364
5514
|
return val.apply((_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : runtime, args);
|
|
5365
5515
|
};
|
|
5366
5516
|
methods[key] = bound;
|
|
5367
|
-
|
|
5517
|
+
state[key] = bound;
|
|
5518
|
+
if (includeFunctionsInState || (functionPropPaths === null || functionPropPaths === void 0 ? void 0 : functionPropPaths.has(key))) setupState[key] = bound;
|
|
5368
5519
|
methodsChanged = true;
|
|
5369
5520
|
} else {
|
|
5370
5521
|
if (hasTrackableSetupBinding(val)) {
|
|
5371
5522
|
var _runtime$__wevu_track;
|
|
5372
5523
|
runtime === null || runtime === void 0 || (_runtime$__wevu_track = runtime.__wevu_trackSetupReactiveKey) === null || _runtime$__wevu_track === void 0 || _runtime$__wevu_track.call(runtime, key);
|
|
5373
5524
|
}
|
|
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
|
-
}
|
|
5525
|
+
state[key] = val;
|
|
5399
5526
|
if (val === target || !shouldExposeInSnapshot(val)) try {
|
|
5400
5527
|
Object.defineProperty(rawState, key, {
|
|
5401
5528
|
value: val,
|
|
@@ -5403,10 +5530,8 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
5403
5530
|
enumerable: false,
|
|
5404
5531
|
writable: true
|
|
5405
5532
|
});
|
|
5406
|
-
} catch (
|
|
5407
|
-
|
|
5408
|
-
}
|
|
5409
|
-
else state[key] = val;
|
|
5533
|
+
} catch (_unused4) {}
|
|
5534
|
+
setupState[key] = val;
|
|
5410
5535
|
}
|
|
5411
5536
|
});
|
|
5412
5537
|
if (runtime) {
|
|
@@ -5955,6 +6080,9 @@ function useScrollOffset(options = {}) {
|
|
|
5955
6080
|
//#endregion
|
|
5956
6081
|
//#region src/runtime/template.ts
|
|
5957
6082
|
const hyphenateRE = /\B([A-Z])/g;
|
|
6083
|
+
function hasOwnProperty(target, key) {
|
|
6084
|
+
return Object.prototype.hasOwnProperty.call(target, key);
|
|
6085
|
+
}
|
|
5958
6086
|
function hyphenate(value) {
|
|
5959
6087
|
if (!value) return "";
|
|
5960
6088
|
if (value.startsWith("--")) return value;
|
|
@@ -6016,6 +6144,25 @@ function normalizeClass(value) {
|
|
|
6016
6144
|
}
|
|
6017
6145
|
return res;
|
|
6018
6146
|
}
|
|
6147
|
+
function resolvePropValue(target, key, fallback, preferProps = false) {
|
|
6148
|
+
if (target == null) return fallback;
|
|
6149
|
+
const propsObject = unref(target.__wevuProps);
|
|
6150
|
+
if (key === "data") {
|
|
6151
|
+
if (propsObject != null && (propsObject[key] !== void 0 || hasOwnProperty(propsObject, key))) return propsObject[key];
|
|
6152
|
+
return key in target ? target[key] : fallback;
|
|
6153
|
+
}
|
|
6154
|
+
const hasPropsValue = propsObject != null && (propsObject[key] !== void 0 || hasOwnProperty(propsObject, key));
|
|
6155
|
+
if (preferProps) {
|
|
6156
|
+
if (hasPropsValue) return propsObject[key];
|
|
6157
|
+
if (key in target) return target[key];
|
|
6158
|
+
return fallback;
|
|
6159
|
+
}
|
|
6160
|
+
const stateObject = unref(target.$state);
|
|
6161
|
+
if (stateObject != null && hasOwnProperty(stateObject, key)) return target[key];
|
|
6162
|
+
if (hasPropsValue) return propsObject[key];
|
|
6163
|
+
if (!(key in target)) return fallback;
|
|
6164
|
+
return target[key];
|
|
6165
|
+
}
|
|
6019
6166
|
|
|
6020
6167
|
//#endregion
|
|
6021
6168
|
//#region src/runtime/updatePerformance.ts
|
|
@@ -6237,5 +6384,5 @@ function useTemplateRef(name) {
|
|
|
6237
6384
|
}
|
|
6238
6385
|
|
|
6239
6386
|
//#endregion
|
|
6240
|
-
export {
|
|
6241
|
-
//# sourceMappingURL=src-
|
|
6387
|
+
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 };
|
|
6388
|
+
//# sourceMappingURL=src-fYd456WG.mjs.map
|