wevu 6.14.3 → 6.15.1
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/{defineProperty-doi4xRTi.mjs → defineProperty-BewxOmW8.mjs} +4 -4
- package/dist/fetch.d.mts +4 -2
- package/dist/fetch.mjs +105 -93
- package/dist/{index-DZDHxCLO.d.mts → index-gXdStbgb.d.mts} +9 -3
- package/dist/{index-BZkMfL_L.d.mts → index-xg5b-v5q.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{ref-Ber-NAmk.mjs → ref-JdrmsFSo.mjs} +1 -1
- package/dist/{router-B9F-WroF.mjs → router-BCfYPEq2.mjs} +10 -9
- package/dist/router.d.mts +1 -1
- package/dist/router.mjs +2 -2
- package/dist/{src-B3t5efJ3.mjs → src-BufOrhxF.mjs} +251 -196
- package/dist/{store-DTHoZy79.mjs → store-ClIYqg5X.mjs} +1 -1
- package/dist/store.d.mts +1 -1
- package/dist/store.mjs +1 -1
- package/dist/vue-demi.d.mts +4 -4
- package/dist/vue-demi.mjs +4 -4
- package/dist/{vue-types-CxI8OQhB.d.mts → vue-types-BCW41JNB.d.mts} +1 -0
- package/dist/{weappIntrinsicElements-BWrmJql8.d.mts → weappIntrinsicElements-CwA7kB31.d.mts} +38 -1
- package/package.json +3 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { A as track, C as effect, D as onScopeDispose, M as triggerEffects, N as nextTick, P as queueJob, _ as ReactiveFlags, b as addMutationRecorder, d as reactive, 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, v as isObject$1, w as effectScope, x as removeMutationRecorder, y as toRaw } from "./ref-
|
|
2
|
-
import { B as setCurrentSetupContext, F as callHookReturn, G as readonly, H as getScopedSlotHostGlobalObject, I as getCurrentInstance, L as getCurrentSetupContext, M as onUnload, N as assertInSetup, P as callHookList, R as pushHook, V as getMiniProgramGlobalObject, c as setGlobalProvidedValue, d as onDetached, u as onAttached, y as onPageScroll, z as setCurrentInstance } from "./router-
|
|
1
|
+
import { A as track, C as effect, D as onScopeDispose, M as triggerEffects, N as nextTick, P as queueJob, _ as ReactiveFlags, b as addMutationRecorder, d as reactive, 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, v as isObject$1, w as effectScope, x as removeMutationRecorder, y as toRaw } from "./ref-JdrmsFSo.mjs";
|
|
2
|
+
import { B as setCurrentSetupContext, F as callHookReturn, G as readonly, H as getScopedSlotHostGlobalObject, I as getCurrentInstance, L as getCurrentSetupContext, M as onUnload, N as assertInSetup, P as callHookList, R as pushHook, V as getMiniProgramGlobalObject, c as setGlobalProvidedValue, d as onDetached, u as onAttached, y as onPageScroll, z as setCurrentInstance } from "./router-BCfYPEq2.mjs";
|
|
3
|
+
import { WEVU_ATTRS_KEY, WEVU_EFFECT_SCOPE_KEY, WEVU_EXPOSED_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_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_SETUP_CONTEXT_INSTANCE_KEY, WEVU_SLOT_OWNER_ID_KEY, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_OWNER_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";
|
|
3
4
|
//#region src/reactivity/shallowRef.ts
|
|
4
5
|
/**
|
|
5
6
|
* 创建一个“浅层” ref:它只在 .value 被整体替换时触发依赖,不会对内部对象做深层响应式处理。
|
|
@@ -135,7 +136,7 @@ function onMounted(handler) {
|
|
|
135
136
|
* 小程序没有专用 update 生命周期,这里在每次 setData 完成后调用。
|
|
136
137
|
*/
|
|
137
138
|
function onUpdated(handler) {
|
|
138
|
-
pushHook(assertInSetup("onUpdated"),
|
|
139
|
+
pushHook(assertInSetup("onUpdated"), WEVU_ON_UPDATED_HOOK, handler);
|
|
139
140
|
}
|
|
140
141
|
/**
|
|
141
142
|
* Vue 3 对齐:卸载前触发。
|
|
@@ -162,7 +163,7 @@ function onBeforeMount(handler) {
|
|
|
162
163
|
* Vue 3 对齐:更新前;在每次 setData 前触发
|
|
163
164
|
*/
|
|
164
165
|
function onBeforeUpdate(handler) {
|
|
165
|
-
pushHook(assertInSetup("onBeforeUpdate"),
|
|
166
|
+
pushHook(assertInSetup("onBeforeUpdate"), WEVU_ON_BEFORE_UPDATE_HOOK, handler);
|
|
166
167
|
}
|
|
167
168
|
/**
|
|
168
169
|
* Vue 3 对齐:错误捕获;映射到小程序 onError
|
|
@@ -195,7 +196,7 @@ function onServerPrefetch(_handler) {
|
|
|
195
196
|
* @internal
|
|
196
197
|
*/
|
|
197
198
|
function callUpdateHooks(target, phase) {
|
|
198
|
-
callHookList(target, phase === "before" ?
|
|
199
|
+
callHookList(target, phase === "before" ? WEVU_ON_BEFORE_UPDATE_HOOK : WEVU_ON_UPDATED_HOOK);
|
|
199
200
|
}
|
|
200
201
|
//#endregion
|
|
201
202
|
//#region src/reactivity/watch/types.ts
|
|
@@ -431,7 +432,7 @@ function watchSyncEffect(effectFn, options = {}) {
|
|
|
431
432
|
}
|
|
432
433
|
//#endregion
|
|
433
434
|
//#region src/version.ts
|
|
434
|
-
const version = "6.
|
|
435
|
+
const version = "6.15.1";
|
|
435
436
|
//#endregion
|
|
436
437
|
//#region src/utils.ts
|
|
437
438
|
function capitalize(str) {
|
|
@@ -682,7 +683,7 @@ function createRuntimeContext(options) {
|
|
|
682
683
|
const setupMethodVersion = ref(0);
|
|
683
684
|
const resolveNativeInstance = (target, receiver) => {
|
|
684
685
|
const rawTarget = toRaw(target);
|
|
685
|
-
const runtimeRef = rawTarget
|
|
686
|
+
const runtimeRef = rawTarget[WEVU_RUNTIME_KEY];
|
|
686
687
|
const runtimeProxy = runtimeRef === null || runtimeRef === void 0 ? void 0 : runtimeRef.proxy;
|
|
687
688
|
const isBridgeMethod = (candidate, methodName) => {
|
|
688
689
|
const candidateMethod = candidate[methodName];
|
|
@@ -694,7 +695,7 @@ function createRuntimeContext(options) {
|
|
|
694
695
|
if (isBridgeMethod(candidate, "triggerEvent") || isBridgeMethod(candidate, "createSelectorQuery") || isBridgeMethod(candidate, "createIntersectionObserver") || isBridgeMethod(candidate, "setData")) return false;
|
|
695
696
|
return true;
|
|
696
697
|
};
|
|
697
|
-
const directNative = rawTarget
|
|
698
|
+
const directNative = rawTarget[WEVU_NATIVE_INSTANCE_KEY];
|
|
698
699
|
if (isValidNativeCandidate(directNative)) return directNative;
|
|
699
700
|
const runtimeNative = runtimeRef === null || runtimeRef === void 0 ? void 0 : runtimeRef.instance;
|
|
700
701
|
if (isValidNativeCandidate(runtimeNative)) return runtimeNative;
|
|
@@ -791,7 +792,7 @@ function createRuntimeContext(options) {
|
|
|
791
792
|
boundMethods[key] = (...args) => handler.apply(publicInstance, args);
|
|
792
793
|
return;
|
|
793
794
|
}
|
|
794
|
-
if (key ===
|
|
795
|
+
if (key === WEVU_INLINE_MAP_KEY && handler && typeof handler === "object") boundMethods[key] = handler;
|
|
795
796
|
});
|
|
796
797
|
installNativeMethodBridge("triggerEvent");
|
|
797
798
|
installNativeMethodBridge("createSelectorQuery");
|
|
@@ -1738,8 +1739,8 @@ function createRuntimeMount(options) {
|
|
|
1738
1739
|
const { data, resolvedComputed, resolvedMethods, appConfig, setDataOptions } = options;
|
|
1739
1740
|
return (adapter) => {
|
|
1740
1741
|
const rawState = resolveDataOption(data);
|
|
1741
|
-
if (rawState && typeof rawState === "object" && !Object.hasOwn(rawState,
|
|
1742
|
-
Object.defineProperty(rawState,
|
|
1742
|
+
if (rawState && typeof rawState === "object" && !Object.hasOwn(rawState, WEVU_PROPS_KEY)) try {
|
|
1743
|
+
Object.defineProperty(rawState, WEVU_PROPS_KEY, {
|
|
1743
1744
|
value: shallowReactive(Object.create(null)),
|
|
1744
1745
|
configurable: true,
|
|
1745
1746
|
enumerable: false,
|
|
@@ -1804,9 +1805,9 @@ function createRuntimeMount(options) {
|
|
|
1804
1805
|
const mutationRecorder = (record) => scheduler.mutationRecorder(record, stateRootRaw);
|
|
1805
1806
|
tracker = effect(() => {
|
|
1806
1807
|
touchReactive(state);
|
|
1807
|
-
const runtimeProps = state
|
|
1808
|
+
const runtimeProps = state[WEVU_PROPS_KEY];
|
|
1808
1809
|
if (isReactive(runtimeProps)) touchReactive(runtimeProps);
|
|
1809
|
-
const runtimeAttrs = state
|
|
1810
|
+
const runtimeAttrs = state[WEVU_ATTRS_KEY];
|
|
1810
1811
|
if (isReactive(runtimeAttrs)) touchReactive(runtimeAttrs);
|
|
1811
1812
|
trackedSetupReactiveKeys.forEach((key) => {
|
|
1812
1813
|
const v = state[key];
|
|
@@ -2006,10 +2007,22 @@ function resolveEventDatasetKey(baseKey, event) {
|
|
|
2006
2007
|
if (!camelToken) return;
|
|
2007
2008
|
return `${baseKey}${camelToken[0].toUpperCase()}${camelToken.slice(1)}`;
|
|
2008
2009
|
}
|
|
2010
|
+
const DATASET_KEY_ALIASES = {
|
|
2011
|
+
wvEventDetail: ["wd", "wvEventDetail"],
|
|
2012
|
+
wvHandler: ["wh", "wvHandler"],
|
|
2013
|
+
wvInlineId: ["wi", "wvInlineId"]
|
|
2014
|
+
};
|
|
2015
|
+
function resolveDatasetValueByBaseKey(dataset, baseKey, event) {
|
|
2016
|
+
var _DATASET_KEY_ALIASES$;
|
|
2017
|
+
const aliasKeys = (_DATASET_KEY_ALIASES$ = DATASET_KEY_ALIASES[baseKey]) !== null && _DATASET_KEY_ALIASES$ !== void 0 ? _DATASET_KEY_ALIASES$ : [baseKey];
|
|
2018
|
+
for (const aliasKey of aliasKeys) {
|
|
2019
|
+
const specificKey = resolveEventDatasetKey(aliasKey, event);
|
|
2020
|
+
if (specificKey && (dataset === null || dataset === void 0 ? void 0 : dataset[specificKey]) !== void 0) return dataset[specificKey];
|
|
2021
|
+
}
|
|
2022
|
+
for (const aliasKey of aliasKeys) if ((dataset === null || dataset === void 0 ? void 0 : dataset[aliasKey]) !== void 0) return dataset[aliasKey];
|
|
2023
|
+
}
|
|
2009
2024
|
function resolveDatasetEventValue(dataset, baseKey, event) {
|
|
2010
|
-
|
|
2011
|
-
if (specificKey && (dataset === null || dataset === void 0 ? void 0 : dataset[specificKey]) !== void 0) return dataset[specificKey];
|
|
2012
|
-
return dataset === null || dataset === void 0 ? void 0 : dataset[baseKey];
|
|
2025
|
+
return resolveDatasetValueByBaseKey(dataset, baseKey, event);
|
|
2013
2026
|
}
|
|
2014
2027
|
function shouldUseDetailPayload(dataset, event) {
|
|
2015
2028
|
const flag = resolveDatasetEventValue(dataset, "wvEventDetail", event);
|
|
@@ -2105,7 +2118,6 @@ function runInlineExpression(ctx, expr, event, inlineMap) {
|
|
|
2105
2118
|
//#region src/runtime/register/component/lifecycle/platform.ts
|
|
2106
2119
|
let wxPatched = false;
|
|
2107
2120
|
let currentPageInstance;
|
|
2108
|
-
const PAGE_SCROLL_HOOK_DEPTH_KEY = "__wevuPageScrollHookDepth";
|
|
2109
2121
|
function getCurrentPageInstance() {
|
|
2110
2122
|
return currentPageInstance;
|
|
2111
2123
|
}
|
|
@@ -2116,15 +2128,15 @@ function releaseCurrentPageInstance(target) {
|
|
|
2116
2128
|
if (currentPageInstance === target) currentPageInstance = void 0;
|
|
2117
2129
|
}
|
|
2118
2130
|
function runInPageScrollHook(target, task) {
|
|
2119
|
-
var
|
|
2120
|
-
target[
|
|
2131
|
+
var _WEVU_PAGE_SCROLL_HOO;
|
|
2132
|
+
target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] = Number((_WEVU_PAGE_SCROLL_HOO = target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _WEVU_PAGE_SCROLL_HOO !== void 0 ? _WEVU_PAGE_SCROLL_HOO : 0) + 1;
|
|
2121
2133
|
try {
|
|
2122
2134
|
return task();
|
|
2123
2135
|
} finally {
|
|
2124
|
-
var
|
|
2125
|
-
const nextDepth = Number((
|
|
2126
|
-
if (nextDepth <= 0) delete target[
|
|
2127
|
-
else target[
|
|
2136
|
+
var _WEVU_PAGE_SCROLL_HOO2;
|
|
2137
|
+
const nextDepth = Number((_WEVU_PAGE_SCROLL_HOO2 = target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _WEVU_PAGE_SCROLL_HOO2 !== void 0 ? _WEVU_PAGE_SCROLL_HOO2 : 1) - 1;
|
|
2138
|
+
if (nextDepth <= 0) delete target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY];
|
|
2139
|
+
else target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] = nextDepth;
|
|
2128
2140
|
}
|
|
2129
2141
|
}
|
|
2130
2142
|
function resolvePageOptions(target) {
|
|
@@ -2181,8 +2193,6 @@ function ensurePageShareMenus(options) {
|
|
|
2181
2193
|
}
|
|
2182
2194
|
//#endregion
|
|
2183
2195
|
//#region src/runtime/pageLayout.ts
|
|
2184
|
-
const PAGE_LAYOUT_SETTER_KEY = "__wevuSetPageLayout";
|
|
2185
|
-
const NO_LAYOUT_RUNTIME_KEY = "__wv_no_layout";
|
|
2186
2196
|
function resolveCurrentPageInstance$1() {
|
|
2187
2197
|
const runtimeCurrentPage = getCurrentPageInstance();
|
|
2188
2198
|
if (runtimeCurrentPage) return runtimeCurrentPage;
|
|
@@ -2191,19 +2201,19 @@ function resolveCurrentPageInstance$1() {
|
|
|
2191
2201
|
return getCurrentPagesFn().at(-1);
|
|
2192
2202
|
}
|
|
2193
2203
|
function normalizeRuntimePageLayoutName(layout) {
|
|
2194
|
-
return layout ===
|
|
2204
|
+
return layout === WEVU_PAGE_LAYOUT_NONE ? false : layout;
|
|
2195
2205
|
}
|
|
2196
2206
|
/**
|
|
2197
2207
|
* 获取当前页面 layout 状态。
|
|
2198
2208
|
*/
|
|
2199
2209
|
function usePageLayout() {
|
|
2200
|
-
var _currentInstance$__we, _runtimeState$
|
|
2210
|
+
var _currentInstance$__we, _runtimeState$WEVU_PA;
|
|
2201
2211
|
if (!getCurrentSetupContext()) throw new Error("usePageLayout() 必须在 setup() 的同步阶段调用");
|
|
2202
2212
|
const currentInstance = getCurrentInstance();
|
|
2203
2213
|
const runtimeState = currentInstance === null || currentInstance === void 0 || (_currentInstance$__we = currentInstance.__wevu) === null || _currentInstance$__we === void 0 ? void 0 : _currentInstance$__we.state;
|
|
2204
2214
|
const pageLayoutState = reactive({
|
|
2205
|
-
name: normalizeRuntimePageLayoutName(runtimeState === null || runtimeState === void 0 ? void 0 : runtimeState
|
|
2206
|
-
props: { ...(_runtimeState$
|
|
2215
|
+
name: normalizeRuntimePageLayoutName(runtimeState === null || runtimeState === void 0 ? void 0 : runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY]),
|
|
2216
|
+
props: { ...(_runtimeState$WEVU_PA = runtimeState === null || runtimeState === void 0 ? void 0 : runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY]) !== null && _runtimeState$WEVU_PA !== void 0 ? _runtimeState$WEVU_PA : {} }
|
|
2207
2217
|
});
|
|
2208
2218
|
if (currentInstance) currentInstance.__wevuPageLayoutState = pageLayoutState;
|
|
2209
2219
|
return readonly(pageLayoutState);
|
|
@@ -2215,25 +2225,25 @@ function syncRuntimePageLayoutState(target, layout, props) {
|
|
|
2215
2225
|
state.props = { ...props };
|
|
2216
2226
|
}
|
|
2217
2227
|
function syncRuntimePageLayoutStateFromRuntime(target) {
|
|
2218
|
-
var _target$__wevu, _runtimeState$
|
|
2228
|
+
var _target$__wevu, _runtimeState$WEVU_PA2;
|
|
2219
2229
|
const state = target.__wevuPageLayoutState;
|
|
2220
2230
|
const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
|
|
2221
2231
|
if (!state || !runtimeState) return;
|
|
2222
|
-
state.name = normalizeRuntimePageLayoutName(runtimeState
|
|
2223
|
-
state.props = { ...(_runtimeState$
|
|
2232
|
+
state.name = normalizeRuntimePageLayoutName(runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY]);
|
|
2233
|
+
state.props = { ...(_runtimeState$WEVU_PA2 = runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY]) !== null && _runtimeState$WEVU_PA2 !== void 0 ? _runtimeState$WEVU_PA2 : {} };
|
|
2224
2234
|
}
|
|
2225
2235
|
/**
|
|
2226
2236
|
* 显式切换当前页面使用的 layout。
|
|
2227
2237
|
*/
|
|
2228
2238
|
function setPageLayout(layout, props) {
|
|
2229
2239
|
const currentInstance = getCurrentInstance();
|
|
2230
|
-
const directSetter = currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance[
|
|
2240
|
+
const directSetter = currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance[WEVU_PAGE_LAYOUT_SETTER_KEY];
|
|
2231
2241
|
if (typeof directSetter === "function") {
|
|
2232
2242
|
directSetter(layout, props);
|
|
2233
2243
|
return;
|
|
2234
2244
|
}
|
|
2235
2245
|
const currentPage = resolveCurrentPageInstance$1();
|
|
2236
|
-
const pageSetter = currentPage === null || currentPage === void 0 ? void 0 : currentPage[
|
|
2246
|
+
const pageSetter = currentPage === null || currentPage === void 0 ? void 0 : currentPage[WEVU_PAGE_LAYOUT_SETTER_KEY];
|
|
2237
2247
|
if (typeof pageSetter === "function") {
|
|
2238
2248
|
pageSetter(layout, props);
|
|
2239
2249
|
return;
|
|
@@ -2297,15 +2307,15 @@ function resolveOwnerSnapshot(runtime) {
|
|
|
2297
2307
|
return typeof runtime.snapshot === "function" ? runtime.snapshot() : {};
|
|
2298
2308
|
}
|
|
2299
2309
|
function attachOwnerSnapshot(target, runtime, ownerId) {
|
|
2300
|
-
var
|
|
2310
|
+
var _WEVU_PROPS_KEY;
|
|
2301
2311
|
try {
|
|
2302
|
-
runtime.state
|
|
2312
|
+
runtime.state[WEVU_SLOT_OWNER_ID_KEY] = ownerId;
|
|
2303
2313
|
} catch (_unused2) {}
|
|
2304
2314
|
try {
|
|
2305
|
-
target
|
|
2315
|
+
target[WEVU_SLOT_OWNER_ID_KEY] = ownerId;
|
|
2306
2316
|
} catch (_unused3) {}
|
|
2307
2317
|
const snapshot = resolveOwnerSnapshot(runtime);
|
|
2308
|
-
const propsSource = (
|
|
2318
|
+
const propsSource = (_WEVU_PROPS_KEY = target[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : target.properties;
|
|
2309
2319
|
if (propsSource && typeof propsSource === "object") for (const [key, value] of Object.entries(propsSource)) snapshot[key] = value;
|
|
2310
2320
|
updateOwnerSnapshot(ownerId, snapshot, runtime.proxy);
|
|
2311
2321
|
}
|
|
@@ -2390,16 +2400,16 @@ function mergeComponentRefValue(wrapper, exposed) {
|
|
|
2390
2400
|
}));
|
|
2391
2401
|
}
|
|
2392
2402
|
function resolveComponentPublicInstance(value) {
|
|
2393
|
-
var _instance$
|
|
2403
|
+
var _instance$WEVU_PUBLIC;
|
|
2394
2404
|
if (!value || typeof value !== "object") return value !== null && value !== void 0 ? value : null;
|
|
2395
2405
|
const instance = value;
|
|
2396
|
-
const exposed = instance
|
|
2406
|
+
const exposed = instance[WEVU_EXPOSED_KEY];
|
|
2397
2407
|
if (exposed && typeof exposed === "object") return getExposeProxy(instance, exposed);
|
|
2398
|
-
if ((_instance$
|
|
2408
|
+
if ((_instance$WEVU_PUBLIC = instance[WEVU_PUBLIC_RUNTIME_KEY]) === null || _instance$WEVU_PUBLIC === void 0 ? void 0 : _instance$WEVU_PUBLIC.proxy) return instance[WEVU_PUBLIC_RUNTIME_KEY].proxy;
|
|
2399
2409
|
return value;
|
|
2400
2410
|
}
|
|
2401
2411
|
function getTemplateRefMap(target) {
|
|
2402
|
-
return target
|
|
2412
|
+
return target[WEVU_TEMPLATE_REF_MAP_KEY];
|
|
2403
2413
|
}
|
|
2404
2414
|
function updateTemplateRefMapValue(refMap, name, value) {
|
|
2405
2415
|
if (!refMap) return;
|
|
@@ -2526,12 +2536,12 @@ function buildTemplateRefValue(target, binding, result) {
|
|
|
2526
2536
|
//#endregion
|
|
2527
2537
|
//#region src/runtime/templateRefs.ts
|
|
2528
2538
|
function updateTemplateRefs(target, onResolved) {
|
|
2529
|
-
const bindings = target
|
|
2539
|
+
const bindings = target[WEVU_TEMPLATE_REFS_KEY];
|
|
2530
2540
|
if (!bindings || !bindings.length) {
|
|
2531
2541
|
onResolved === null || onResolved === void 0 || onResolved();
|
|
2532
2542
|
return;
|
|
2533
2543
|
}
|
|
2534
|
-
if (!target
|
|
2544
|
+
if (!target[WEVU_READY_CALLED_KEY]) {
|
|
2535
2545
|
onResolved === null || onResolved === void 0 || onResolved();
|
|
2536
2546
|
return;
|
|
2537
2547
|
}
|
|
@@ -2618,28 +2628,28 @@ function updateTemplateRefs(target, onResolved) {
|
|
|
2618
2628
|
});
|
|
2619
2629
|
}
|
|
2620
2630
|
function scheduleTemplateRefUpdate(target, onResolved) {
|
|
2621
|
-
const bindings = target
|
|
2631
|
+
const bindings = target[WEVU_TEMPLATE_REFS_KEY];
|
|
2622
2632
|
if (!bindings || !bindings.length) {
|
|
2623
2633
|
onResolved === null || onResolved === void 0 || onResolved();
|
|
2624
2634
|
return;
|
|
2625
2635
|
}
|
|
2626
2636
|
if (onResolved) {
|
|
2627
|
-
var
|
|
2628
|
-
const callbacks = (
|
|
2637
|
+
var _WEVU_TEMPLATE_REFS_C;
|
|
2638
|
+
const callbacks = (_WEVU_TEMPLATE_REFS_C = target[WEVU_TEMPLATE_REFS_CALLBACKS_KEY]) !== null && _WEVU_TEMPLATE_REFS_C !== void 0 ? _WEVU_TEMPLATE_REFS_C : [];
|
|
2629
2639
|
callbacks.push(onResolved);
|
|
2630
|
-
if (!target
|
|
2640
|
+
if (!target[WEVU_TEMPLATE_REFS_CALLBACKS_KEY]) Object.defineProperty(target, WEVU_TEMPLATE_REFS_CALLBACKS_KEY, {
|
|
2631
2641
|
value: callbacks,
|
|
2632
2642
|
configurable: true,
|
|
2633
2643
|
enumerable: false,
|
|
2634
2644
|
writable: true
|
|
2635
2645
|
});
|
|
2636
2646
|
}
|
|
2637
|
-
if (target
|
|
2638
|
-
target
|
|
2647
|
+
if (target[WEVU_TEMPLATE_REFS_PENDING_KEY]) return;
|
|
2648
|
+
target[WEVU_TEMPLATE_REFS_PENDING_KEY] = true;
|
|
2639
2649
|
nextTick(() => {
|
|
2640
|
-
target
|
|
2650
|
+
target[WEVU_TEMPLATE_REFS_PENDING_KEY] = false;
|
|
2641
2651
|
const flushCallbacks = () => {
|
|
2642
|
-
const callbacks = target
|
|
2652
|
+
const callbacks = target[WEVU_TEMPLATE_REFS_CALLBACKS_KEY];
|
|
2643
2653
|
if (!callbacks || !callbacks.length) return;
|
|
2644
2654
|
callbacks.splice(0).forEach((cb) => {
|
|
2645
2655
|
try {
|
|
@@ -2652,7 +2662,7 @@ function scheduleTemplateRefUpdate(target, onResolved) {
|
|
|
2652
2662
|
}
|
|
2653
2663
|
function clearTemplateRefs(target) {
|
|
2654
2664
|
var _target$__wevu$proxy2, _target$__wevu2;
|
|
2655
|
-
const bindings = target
|
|
2665
|
+
const bindings = target[WEVU_TEMPLATE_REFS_KEY];
|
|
2656
2666
|
if (!bindings || !bindings.length) return;
|
|
2657
2667
|
const refsContainer = ensureRefsContainer(target);
|
|
2658
2668
|
const proxy = (_target$__wevu$proxy2 = (_target$__wevu2 = target.__wevu) === null || _target$__wevu2 === void 0 ? void 0 : _target$__wevu2.proxy) !== null && _target$__wevu$proxy2 !== void 0 ? _target$__wevu$proxy2 : target;
|
|
@@ -2686,7 +2696,6 @@ const setupInstanceMethodNames = [
|
|
|
2686
2696
|
"setData",
|
|
2687
2697
|
"setUpdatePerformanceListener"
|
|
2688
2698
|
];
|
|
2689
|
-
const SETUP_CONTEXT_INSTANCE_KEY$1 = "__wevuSetupContextInstance";
|
|
2690
2699
|
function createSetupSlotsFallback() {
|
|
2691
2700
|
return Object.freeze(Object.create(null));
|
|
2692
2701
|
}
|
|
@@ -2747,7 +2756,7 @@ function resolveRuntimeNativeMethodOwner(runtime, target, methodName) {
|
|
|
2747
2756
|
if (isBridgeMethod(candidate)) return false;
|
|
2748
2757
|
return typeof candidate[methodName] === "function";
|
|
2749
2758
|
};
|
|
2750
|
-
const nativeFromState = runtimeRawState ? runtimeRawState
|
|
2759
|
+
const nativeFromState = runtimeRawState ? runtimeRawState[WEVU_NATIVE_INSTANCE_KEY] : void 0;
|
|
2751
2760
|
if (isValidNativeCandidate(nativeFromState)) return nativeFromState;
|
|
2752
2761
|
const runtimeInstance = runtime === null || runtime === void 0 ? void 0 : runtime.instance;
|
|
2753
2762
|
if (isValidNativeCandidate(runtimeInstance)) return runtimeInstance;
|
|
@@ -2766,7 +2775,7 @@ function defineSetupInstanceMethod(target, methodName, handler) {
|
|
|
2766
2775
|
}
|
|
2767
2776
|
}
|
|
2768
2777
|
function ensureSetupContextInstance(target, runtime) {
|
|
2769
|
-
const maybeCached = target[
|
|
2778
|
+
const maybeCached = target[WEVU_SETUP_CONTEXT_INSTANCE_KEY];
|
|
2770
2779
|
if (maybeCached && typeof maybeCached === "object") return maybeCached;
|
|
2771
2780
|
const setupInstanceBridge = Object.create(null);
|
|
2772
2781
|
const resolveSetupBridgeOwner = (methodName) => {
|
|
@@ -2833,14 +2842,14 @@ function ensureSetupContextInstance(target, runtime) {
|
|
|
2833
2842
|
}
|
|
2834
2843
|
}));
|
|
2835
2844
|
try {
|
|
2836
|
-
Object.defineProperty(target,
|
|
2845
|
+
Object.defineProperty(target, WEVU_SETUP_CONTEXT_INSTANCE_KEY, {
|
|
2837
2846
|
value: setupInstance,
|
|
2838
2847
|
configurable: true,
|
|
2839
2848
|
enumerable: false,
|
|
2840
2849
|
writable: true
|
|
2841
2850
|
});
|
|
2842
2851
|
} catch (_unused3) {
|
|
2843
|
-
target[
|
|
2852
|
+
target[WEVU_SETUP_CONTEXT_INSTANCE_KEY] = setupInstance;
|
|
2844
2853
|
}
|
|
2845
2854
|
return setupInstance;
|
|
2846
2855
|
}
|
|
@@ -2852,9 +2861,10 @@ function bridgeRuntimeMethodsToTarget(target, runtime) {
|
|
|
2852
2861
|
for (const name of Object.keys(methods)) {
|
|
2853
2862
|
if (setupInstanceMethodNames.includes(name)) continue;
|
|
2854
2863
|
if (typeof target[name] !== "function") target[name] = function bridged(...args) {
|
|
2855
|
-
var
|
|
2856
|
-
const
|
|
2857
|
-
|
|
2864
|
+
var _ref;
|
|
2865
|
+
const runtime = this[WEVU_PUBLIC_RUNTIME_KEY];
|
|
2866
|
+
const bound = runtime === null || runtime === void 0 || (_ref = runtime.methods) === null || _ref === void 0 ? void 0 : _ref[name];
|
|
2867
|
+
if (typeof bound === "function") return bound.apply(runtime.proxy, args);
|
|
2858
2868
|
};
|
|
2859
2869
|
}
|
|
2860
2870
|
} catch (_unused) {}
|
|
@@ -2882,22 +2892,22 @@ function runSetupFunction(setup, props, context) {
|
|
|
2882
2892
|
function runRuntimeSetupPhase(options) {
|
|
2883
2893
|
const { target, runtime, runtimeWithDefaults, runtimeState, runtimeProxy, setup, syncRuntimeProps, attachRuntimeProxyProps } = options;
|
|
2884
2894
|
const mpProperties = target.properties || {};
|
|
2885
|
-
const runtimeProps = runtimeState && typeof runtimeState === "object" ? runtimeState
|
|
2895
|
+
const runtimeProps = runtimeState && typeof runtimeState === "object" ? runtimeState[WEVU_PROPS_KEY] : void 0;
|
|
2886
2896
|
const props = runtimeProps && typeof runtimeProps === "object" ? runtimeProps : shallowReactive({});
|
|
2887
2897
|
syncRuntimeProps(props, mpProperties);
|
|
2888
2898
|
if (runtimeState && typeof runtimeState === "object") attachRuntimeProxyProps(runtimeState, props);
|
|
2889
2899
|
try {
|
|
2890
|
-
Object.defineProperty(target,
|
|
2900
|
+
Object.defineProperty(target, WEVU_PROPS_KEY, {
|
|
2891
2901
|
value: props,
|
|
2892
2902
|
configurable: true,
|
|
2893
2903
|
enumerable: false,
|
|
2894
2904
|
writable: false
|
|
2895
2905
|
});
|
|
2896
2906
|
} catch (_unused) {
|
|
2897
|
-
target
|
|
2907
|
+
target[WEVU_PROPS_KEY] = props;
|
|
2898
2908
|
}
|
|
2899
2909
|
const attrs = shallowReactive(Object.create(null));
|
|
2900
|
-
const declaredPropKeys = new Set(Array.isArray(target
|
|
2910
|
+
const declaredPropKeys = new Set(Array.isArray(target[WEVU_PROP_KEYS_KEY]) ? target[WEVU_PROP_KEYS_KEY] : []);
|
|
2901
2911
|
const hasRuntimeStateKey = (key) => {
|
|
2902
2912
|
return runtimeState != null && typeof runtimeState === "object" && Object.hasOwn(runtimeState, key);
|
|
2903
2913
|
};
|
|
@@ -2912,14 +2922,14 @@ function runRuntimeSetupPhase(options) {
|
|
|
2912
2922
|
};
|
|
2913
2923
|
syncAttrsFromProperties();
|
|
2914
2924
|
try {
|
|
2915
|
-
Object.defineProperty(target,
|
|
2925
|
+
Object.defineProperty(target, WEVU_ATTRS_KEY, {
|
|
2916
2926
|
value: attrs,
|
|
2917
2927
|
configurable: true,
|
|
2918
2928
|
enumerable: false,
|
|
2919
2929
|
writable: false
|
|
2920
2930
|
});
|
|
2921
2931
|
} catch (_unused2) {
|
|
2922
|
-
target
|
|
2932
|
+
target[WEVU_ATTRS_KEY] = attrs;
|
|
2923
2933
|
}
|
|
2924
2934
|
const setupInstance = ensureSetupContextInstance(target, runtimeWithDefaults);
|
|
2925
2935
|
const context = safeMarkNoSetData({
|
|
@@ -2935,13 +2945,13 @@ function runRuntimeSetupPhase(options) {
|
|
|
2935
2945
|
setupInstance.triggerEvent(event, detail, options);
|
|
2936
2946
|
},
|
|
2937
2947
|
expose: (exposed) => {
|
|
2938
|
-
target
|
|
2948
|
+
target[WEVU_EXPOSED_KEY] = exposed;
|
|
2939
2949
|
},
|
|
2940
2950
|
attrs,
|
|
2941
2951
|
slots: createSetupSlotsFallback()
|
|
2942
2952
|
});
|
|
2943
2953
|
const instanceScope = effectScope(true);
|
|
2944
|
-
target
|
|
2954
|
+
target[WEVU_EFFECT_SCOPE_KEY] = instanceScope;
|
|
2945
2955
|
setCurrentInstance(target);
|
|
2946
2956
|
setCurrentSetupContext(context);
|
|
2947
2957
|
try {
|
|
@@ -2966,13 +2976,13 @@ function runRuntimeSetupPhase(options) {
|
|
|
2966
2976
|
configurable: true,
|
|
2967
2977
|
enumerable: false,
|
|
2968
2978
|
get() {
|
|
2969
|
-
const propsSource = runtimeRawState
|
|
2979
|
+
const propsSource = runtimeRawState[WEVU_PROPS_KEY];
|
|
2970
2980
|
if (propsSource && typeof propsSource === "object" && Object.hasOwn(propsSource, key)) return propsSource[key];
|
|
2971
2981
|
return fallbackValue;
|
|
2972
2982
|
},
|
|
2973
2983
|
set(next) {
|
|
2974
2984
|
fallbackValue = next;
|
|
2975
|
-
const propsSource = runtimeRawState
|
|
2985
|
+
const propsSource = runtimeRawState[WEVU_PROPS_KEY];
|
|
2976
2986
|
if (!propsSource || typeof propsSource !== "object") return;
|
|
2977
2987
|
try {
|
|
2978
2988
|
propsSource[key] = next;
|
|
@@ -2994,7 +3004,7 @@ function runRuntimeSetupPhase(options) {
|
|
|
2994
3004
|
}
|
|
2995
3005
|
} catch (error) {
|
|
2996
3006
|
instanceScope.stop();
|
|
2997
|
-
target
|
|
3007
|
+
target[WEVU_EFFECT_SCOPE_KEY] = void 0;
|
|
2998
3008
|
throw error;
|
|
2999
3009
|
} finally {
|
|
3000
3010
|
setCurrentSetupContext(void 0);
|
|
@@ -3003,41 +3013,40 @@ function runRuntimeSetupPhase(options) {
|
|
|
3003
3013
|
}
|
|
3004
3014
|
//#endregion
|
|
3005
3015
|
//#region src/runtime/register/runtimeInstance/utils.ts
|
|
3006
|
-
const SETUP_CONTEXT_INSTANCE_KEY = "__wevuSetupContextInstance";
|
|
3007
3016
|
function attachRuntimeProxyProps(state, props) {
|
|
3008
3017
|
try {
|
|
3009
|
-
Object.defineProperty(state,
|
|
3018
|
+
Object.defineProperty(state, WEVU_PROPS_KEY, {
|
|
3010
3019
|
value: props,
|
|
3011
3020
|
configurable: true,
|
|
3012
3021
|
enumerable: false,
|
|
3013
3022
|
writable: false
|
|
3014
3023
|
});
|
|
3015
3024
|
} catch (_unused) {
|
|
3016
|
-
state
|
|
3025
|
+
state[WEVU_PROPS_KEY] = props;
|
|
3017
3026
|
}
|
|
3018
3027
|
}
|
|
3019
3028
|
function attachNativeInstanceRef(state, instance) {
|
|
3020
3029
|
try {
|
|
3021
|
-
Object.defineProperty(state,
|
|
3030
|
+
Object.defineProperty(state, WEVU_NATIVE_INSTANCE_KEY, {
|
|
3022
3031
|
value: instance,
|
|
3023
3032
|
configurable: true,
|
|
3024
3033
|
enumerable: false,
|
|
3025
3034
|
writable: true
|
|
3026
3035
|
});
|
|
3027
3036
|
} catch (_unused2) {
|
|
3028
|
-
state
|
|
3037
|
+
state[WEVU_NATIVE_INSTANCE_KEY] = instance;
|
|
3029
3038
|
}
|
|
3030
3039
|
}
|
|
3031
3040
|
function attachRuntimeRef(state, runtime) {
|
|
3032
3041
|
try {
|
|
3033
|
-
Object.defineProperty(state,
|
|
3042
|
+
Object.defineProperty(state, WEVU_RUNTIME_KEY, {
|
|
3034
3043
|
value: runtime,
|
|
3035
3044
|
configurable: true,
|
|
3036
3045
|
enumerable: false,
|
|
3037
3046
|
writable: true
|
|
3038
3047
|
});
|
|
3039
3048
|
} catch (_unused3) {
|
|
3040
|
-
state
|
|
3049
|
+
state[WEVU_RUNTIME_KEY] = runtime;
|
|
3041
3050
|
}
|
|
3042
3051
|
}
|
|
3043
3052
|
function attachRuntimeInstance(runtime, instance) {
|
|
@@ -3055,7 +3064,7 @@ function attachRuntimeInstance(runtime, instance) {
|
|
|
3055
3064
|
}
|
|
3056
3065
|
}
|
|
3057
3066
|
function resolveNativeSetData(instance) {
|
|
3058
|
-
const setupInstance = instance[
|
|
3067
|
+
const setupInstance = instance[WEVU_SETUP_CONTEXT_INSTANCE_KEY];
|
|
3059
3068
|
const setupOverride = setupInstance && typeof setupInstance.setData === "function" ? setupInstance.setData : void 0;
|
|
3060
3069
|
if (typeof setupOverride === "function" && !isNativeBridgeMethod(setupOverride)) return setupOverride;
|
|
3061
3070
|
const candidate = instance.setData;
|
|
@@ -3231,13 +3240,13 @@ function registerWatches(runtime, watchMap, instance) {
|
|
|
3231
3240
|
//#region src/runtime/register/runtimeInstance.ts
|
|
3232
3241
|
function attachPageLayoutSetter(target) {
|
|
3233
3242
|
if (typeof target.route !== "string" || !target.route) return;
|
|
3234
|
-
target
|
|
3243
|
+
target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
|
|
3235
3244
|
var _target$__wevu;
|
|
3236
3245
|
const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
|
|
3237
3246
|
if (!runtimeState || typeof runtimeState !== "object") return;
|
|
3238
|
-
runtimeState
|
|
3247
|
+
runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout);
|
|
3239
3248
|
const nextProps = layout === false ? {} : props !== null && props !== void 0 ? props : {};
|
|
3240
|
-
runtimeState
|
|
3249
|
+
runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps;
|
|
3241
3250
|
syncRuntimePageLayoutState(target, layout, nextProps);
|
|
3242
3251
|
};
|
|
3243
3252
|
}
|
|
@@ -3248,7 +3257,7 @@ function attachPageLayoutSetter(target) {
|
|
|
3248
3257
|
function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
3249
3258
|
var _wevuSetDataOptions, _wevuSetDataOptions2, _runtime$proxy, _runtime$state, _computed, _runtime$methods, _watch, _bindModel, _snapshot, _unmount;
|
|
3250
3259
|
if (target.__wevu) return target.__wevu;
|
|
3251
|
-
target
|
|
3260
|
+
target[WEVU_RUNTIME_APP_KEY] = runtimeApp;
|
|
3252
3261
|
safeMarkNoSetData(target);
|
|
3253
3262
|
const ownerId = allocateOwnerId();
|
|
3254
3263
|
const suspendWhenHidden = Boolean(runtimeApp === null || runtimeApp === void 0 || (_wevuSetDataOptions = runtimeApp.__wevuSetDataOptions) === null || _wevuSetDataOptions === void 0 ? void 0 : _wevuSetDataOptions.suspendWhenHidden);
|
|
@@ -3257,8 +3266,8 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3257
3266
|
option: runtimeApp === null || runtimeApp === void 0 || (_wevuSetDataOptions2 = runtimeApp.__wevuSetDataOptions) === null || _wevuSetDataOptions2 === void 0 ? void 0 : _wevuSetDataOptions2.highFrequencyWarning,
|
|
3258
3267
|
targetLabel,
|
|
3259
3268
|
isInPageScrollHook: () => {
|
|
3260
|
-
var
|
|
3261
|
-
return Number((
|
|
3269
|
+
var _WEVU_PAGE_SCROLL_HOO;
|
|
3270
|
+
return Number((_WEVU_PAGE_SCROLL_HOO = target[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY]) !== null && _WEVU_PAGE_SCROLL_HOO !== void 0 ? _WEVU_PAGE_SCROLL_HOO : 0) > 0;
|
|
3262
3271
|
}
|
|
3263
3272
|
});
|
|
3264
3273
|
const createDeferredAdapter = (instance) => {
|
|
@@ -3299,10 +3308,10 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3299
3308
|
...payload
|
|
3300
3309
|
});
|
|
3301
3310
|
const refreshOwnerSnapshot = () => {
|
|
3302
|
-
var
|
|
3311
|
+
var _WEVU_PROPS_KEY;
|
|
3303
3312
|
if (!runtimeRef) return;
|
|
3304
3313
|
const snapshot = resolveOwnerSnapshot(runtimeRef);
|
|
3305
|
-
const propsSource = (
|
|
3314
|
+
const propsSource = (_WEVU_PROPS_KEY = target[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : target.properties;
|
|
3306
3315
|
if (propsSource && typeof propsSource === "object") for (const [key, value] of Object.entries(propsSource)) snapshot[key] = value;
|
|
3307
3316
|
updateOwnerSnapshot(ownerId, snapshot, runtimeRef.proxy);
|
|
3308
3317
|
};
|
|
@@ -3374,7 +3383,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3374
3383
|
writable: true
|
|
3375
3384
|
});
|
|
3376
3385
|
}
|
|
3377
|
-
Object.defineProperty(target,
|
|
3386
|
+
Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {
|
|
3378
3387
|
value: runtimeWithDefaults,
|
|
3379
3388
|
configurable: true,
|
|
3380
3389
|
enumerable: false,
|
|
@@ -3385,7 +3394,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3385
3394
|
attachOwnerSnapshot(target, runtimeWithDefaults, ownerId);
|
|
3386
3395
|
if (watchMap) {
|
|
3387
3396
|
const stops = registerWatches(runtimeWithDefaults, watchMap, target);
|
|
3388
|
-
if (stops.length) target
|
|
3397
|
+
if (stops.length) target[WEVU_WATCH_STOPS_KEY] = stops;
|
|
3389
3398
|
}
|
|
3390
3399
|
if (setup) {
|
|
3391
3400
|
var _runtimeWithSyncFlush;
|
|
@@ -3419,30 +3428,30 @@ function setRuntimeSetDataVisibility(target, visible) {
|
|
|
3419
3428
|
* @internal
|
|
3420
3429
|
*/
|
|
3421
3430
|
function teardownRuntimeInstance(target) {
|
|
3422
|
-
var _target$
|
|
3431
|
+
var _target$WEVU_EFFECT_S;
|
|
3423
3432
|
const runtime = target.__wevu;
|
|
3424
|
-
const ownerId = target
|
|
3433
|
+
const ownerId = target[WEVU_SLOT_OWNER_ID_KEY];
|
|
3425
3434
|
if (ownerId) removeOwner(ownerId);
|
|
3426
3435
|
clearTemplateRefs(target);
|
|
3427
|
-
if (runtime && target
|
|
3428
|
-
if (target
|
|
3429
|
-
const stops = target
|
|
3436
|
+
if (runtime && target[WEVU_HOOKS_KEY]) callHookList(target, "onUnload", []);
|
|
3437
|
+
if (target[WEVU_HOOKS_KEY]) target[WEVU_HOOKS_KEY] = void 0;
|
|
3438
|
+
const stops = target[WEVU_WATCH_STOPS_KEY];
|
|
3430
3439
|
if (Array.isArray(stops)) for (const stop of stops) try {
|
|
3431
3440
|
stop();
|
|
3432
3441
|
} catch (_unused2) {}
|
|
3433
|
-
target
|
|
3434
|
-
(_target$
|
|
3435
|
-
target
|
|
3442
|
+
target[WEVU_WATCH_STOPS_KEY] = void 0;
|
|
3443
|
+
(_target$WEVU_EFFECT_S = target[WEVU_EFFECT_SCOPE_KEY]) === null || _target$WEVU_EFFECT_S === void 0 || _target$WEVU_EFFECT_S.stop();
|
|
3444
|
+
target[WEVU_EFFECT_SCOPE_KEY] = void 0;
|
|
3436
3445
|
if (runtime) runtime.unmount();
|
|
3437
3446
|
delete target.__wevu;
|
|
3438
|
-
if (
|
|
3447
|
+
if (WEVU_PUBLIC_RUNTIME_KEY in target) delete target[WEVU_PUBLIC_RUNTIME_KEY];
|
|
3439
3448
|
}
|
|
3440
3449
|
//#endregion
|
|
3441
3450
|
//#region src/runtime/register/app.ts
|
|
3442
3451
|
const APP_GLOBAL_LISTENER_STORE_KEY = "__wevuAppGlobalListeners";
|
|
3443
3452
|
const MEMORY_WARNING_LISTENER_KEY = "__wevuOnMemoryWarningListener";
|
|
3444
3453
|
function bindMemoryWarningListener(target) {
|
|
3445
|
-
const hooks = target
|
|
3454
|
+
const hooks = target[WEVU_HOOKS_KEY];
|
|
3446
3455
|
const hasMemoryWarningHook = Boolean(hooks === null || hooks === void 0 ? void 0 : hooks.onMemoryWarning);
|
|
3447
3456
|
const wxGlobal = getMiniProgramGlobalObject();
|
|
3448
3457
|
const onMemoryWarning = wxGlobal === null || wxGlobal === void 0 ? void 0 : wxGlobal.onMemoryWarning;
|
|
@@ -3465,7 +3474,7 @@ function bindMemoryWarningListener(target) {
|
|
|
3465
3474
|
function bindAppGlobalListener(target, options) {
|
|
3466
3475
|
var _ref, _ref$APP_GLOBAL_LISTE;
|
|
3467
3476
|
const { hookName, onApiName, offApiName, userHandler } = options;
|
|
3468
|
-
const hooks = target
|
|
3477
|
+
const hooks = target[WEVU_HOOKS_KEY];
|
|
3469
3478
|
const hasHook = Boolean(hooks === null || hooks === void 0 ? void 0 : hooks[hookName]);
|
|
3470
3479
|
const wxGlobal = getMiniProgramGlobalObject();
|
|
3471
3480
|
const onApi = wxGlobal === null || wxGlobal === void 0 ? void 0 : wxGlobal[onApiName];
|
|
@@ -3523,10 +3532,10 @@ function registerApp(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
3523
3532
|
const methodNames = Object.keys(methods !== null && methods !== void 0 ? methods : {});
|
|
3524
3533
|
const appOptions = { ...mpOptions };
|
|
3525
3534
|
appOptions.globalData = (_appOptions$globalDat = appOptions.globalData) !== null && _appOptions$globalDat !== void 0 ? _appOptions$globalDat : {};
|
|
3526
|
-
if (!appOptions
|
|
3535
|
+
if (!appOptions[WEVU_INLINE_HANDLER]) appOptions[WEVU_INLINE_HANDLER] = function __weapp_vite_inline(event) {
|
|
3527
3536
|
var _runtime$proxy, _runtime$methods;
|
|
3528
3537
|
const runtime = this.__wevu;
|
|
3529
|
-
return runInlineExpression((_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : this, void 0, event, runtime === null || runtime === void 0 || (_runtime$methods = runtime.methods) === null || _runtime$methods === void 0 ? void 0 : _runtime$methods
|
|
3538
|
+
return runInlineExpression((_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : this, void 0, event, runtime === null || runtime === void 0 || (_runtime$methods = runtime.methods) === null || _runtime$methods === void 0 ? void 0 : _runtime$methods[WEVU_INLINE_MAP_KEY]);
|
|
3530
3539
|
};
|
|
3531
3540
|
const userOnLaunch = appOptions.onLaunch;
|
|
3532
3541
|
const userOnError = appOptions.onError;
|
|
@@ -3534,7 +3543,7 @@ function registerApp(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
3534
3543
|
const userOnUnhandledRejection = appOptions.onUnhandledRejection;
|
|
3535
3544
|
const userOnThemeChange = appOptions.onThemeChange;
|
|
3536
3545
|
appOptions.onLaunch = function onLaunch(...args) {
|
|
3537
|
-
this
|
|
3546
|
+
this[WEVU_IS_APP_INSTANCE_KEY] = true;
|
|
3538
3547
|
mountRuntimeInstance(this, runtimeApp, watch, setup);
|
|
3539
3548
|
bindMemoryWarningListener(this);
|
|
3540
3549
|
bindAppGlobalListeners(this, {
|
|
@@ -3638,12 +3647,12 @@ function attachOptionalPageLifecycleHooks(pageLifecycleHooks, options) {
|
|
|
3638
3647
|
});
|
|
3639
3648
|
};
|
|
3640
3649
|
if (enableOnRouteDone) pageLifecycleHooks.onRouteDone = function onRouteDone(...args) {
|
|
3641
|
-
if (this
|
|
3642
|
-
this
|
|
3650
|
+
if (this[WEVU_ROUTE_DONE_IN_TICK_KEY]) return;
|
|
3651
|
+
this[WEVU_ROUTE_DONE_IN_TICK_KEY] = true;
|
|
3643
3652
|
Promise.resolve().then(() => {
|
|
3644
|
-
this
|
|
3653
|
+
this[WEVU_ROUTE_DONE_IN_TICK_KEY] = false;
|
|
3645
3654
|
});
|
|
3646
|
-
this
|
|
3655
|
+
this[WEVU_ROUTE_DONE_CALLED_KEY] = true;
|
|
3647
3656
|
callHookList(this, "onRouteDone", args);
|
|
3648
3657
|
if (!hasHook(this, "onRouteDone")) return effectiveOnRouteDone.apply(this, args);
|
|
3649
3658
|
};
|
|
@@ -3677,8 +3686,8 @@ function createPageLifecycleHooks(options) {
|
|
|
3677
3686
|
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;
|
|
3678
3687
|
const pageLifecycleHooks = {
|
|
3679
3688
|
onLoad(...args) {
|
|
3680
|
-
if (this
|
|
3681
|
-
this
|
|
3689
|
+
if (this[WEVU_ON_LOAD_CALLED_KEY]) return;
|
|
3690
|
+
this[WEVU_ON_LOAD_CALLED_KEY] = true;
|
|
3682
3691
|
mountRuntimeInstance(this, runtimeApp, watch, setup);
|
|
3683
3692
|
enableDeferredSetData(this);
|
|
3684
3693
|
if (isPage) ensurePageShareMenus({
|
|
@@ -3697,12 +3706,12 @@ function createPageLifecycleHooks(options) {
|
|
|
3697
3706
|
if (isPage) {
|
|
3698
3707
|
ensureWxPatched();
|
|
3699
3708
|
bindCurrentPageInstance(this);
|
|
3700
|
-
if (!this
|
|
3709
|
+
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
3701
3710
|
ensurePageShareMenus({
|
|
3702
3711
|
enableOnShareAppMessage,
|
|
3703
3712
|
enableOnShareTimeline
|
|
3704
3713
|
});
|
|
3705
|
-
this
|
|
3714
|
+
this[WEVU_ROUTE_DONE_CALLED_KEY] = false;
|
|
3706
3715
|
}
|
|
3707
3716
|
setRuntimeSetDataVisibility(this, true);
|
|
3708
3717
|
callHookList(this, "onShow", args);
|
|
@@ -3716,18 +3725,18 @@ function createPageLifecycleHooks(options) {
|
|
|
3716
3725
|
},
|
|
3717
3726
|
onReady(...args) {
|
|
3718
3727
|
if (isPage) {
|
|
3719
|
-
if (!this
|
|
3728
|
+
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
3720
3729
|
ensurePageShareMenus({
|
|
3721
3730
|
enableOnShareAppMessage,
|
|
3722
3731
|
enableOnShareTimeline
|
|
3723
3732
|
});
|
|
3724
3733
|
}
|
|
3725
|
-
if (!this
|
|
3726
|
-
this
|
|
3734
|
+
if (!this[WEVU_READY_CALLED_KEY]) {
|
|
3735
|
+
this[WEVU_READY_CALLED_KEY] = true;
|
|
3727
3736
|
if (isPage && enableOnRouteDone && enableOnRouteDoneFallback) {
|
|
3728
3737
|
const current = this;
|
|
3729
3738
|
setTimeout(() => {
|
|
3730
|
-
if (!current
|
|
3739
|
+
if (!current[WEVU_ROUTE_DONE_CALLED_KEY]) {
|
|
3731
3740
|
var _pageLifecycleHooks$o;
|
|
3732
3741
|
(_pageLifecycleHooks$o = pageLifecycleHooks.onRouteDone) === null || _pageLifecycleHooks$o === void 0 || _pageLifecycleHooks$o.call(current);
|
|
3733
3742
|
}
|
|
@@ -3772,12 +3781,12 @@ function createPageLifecycleHooks(options) {
|
|
|
3772
3781
|
function createComponentMethods(options) {
|
|
3773
3782
|
const { userMethods, runtimeMethods } = options;
|
|
3774
3783
|
const finalMethods = { ...userMethods };
|
|
3775
|
-
if (!finalMethods
|
|
3784
|
+
if (!finalMethods[WEVU_INLINE_HANDLER]) finalMethods[WEVU_INLINE_HANDLER] = function __weapp_vite_inline(event) {
|
|
3776
3785
|
var _runtime$proxy, _runtime$methods;
|
|
3777
3786
|
const runtime = this.__wevu;
|
|
3778
|
-
return runInlineExpression((_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : this, void 0, event, runtime === null || runtime === void 0 || (_runtime$methods = runtime.methods) === null || _runtime$methods === void 0 ? void 0 : _runtime$methods
|
|
3787
|
+
return runInlineExpression((_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : this, void 0, event, runtime === null || runtime === void 0 || (_runtime$methods = runtime.methods) === null || _runtime$methods === void 0 ? void 0 : _runtime$methods[WEVU_INLINE_MAP_KEY]);
|
|
3779
3788
|
};
|
|
3780
|
-
if (!finalMethods
|
|
3789
|
+
if (!finalMethods[WEVU_MODEL_HANDLER]) finalMethods[WEVU_MODEL_HANDLER] = function __weapp_vite_model(event) {
|
|
3781
3790
|
var _event$currentTarget$, _event$currentTarget, _event$target;
|
|
3782
3791
|
const path = (_event$currentTarget$ = event === null || event === void 0 || (_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || (_event$currentTarget = _event$currentTarget.dataset) === null || _event$currentTarget === void 0 ? void 0 : _event$currentTarget.wvModel) !== null && _event$currentTarget$ !== void 0 ? _event$currentTarget$ : event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 || (_event$target = _event$target.dataset) === null || _event$target === void 0 ? void 0 : _event$target.wvModel;
|
|
3783
3792
|
if (typeof path !== "string" || !path) return;
|
|
@@ -3788,13 +3797,13 @@ function createComponentMethods(options) {
|
|
|
3788
3797
|
runtime.bindModel(path).update(value);
|
|
3789
3798
|
} catch (_unused) {}
|
|
3790
3799
|
};
|
|
3791
|
-
if (!finalMethods
|
|
3800
|
+
if (!finalMethods[WEVU_OWNER_HANDLER] && typeof (runtimeMethods === null || runtimeMethods === void 0 ? void 0 : runtimeMethods[WEVU_OWNER_HANDLER]) === "function") finalMethods[WEVU_OWNER_HANDLER] = runtimeMethods[WEVU_OWNER_HANDLER];
|
|
3792
3801
|
const methodNames = Object.keys(runtimeMethods !== null && runtimeMethods !== void 0 ? runtimeMethods : {});
|
|
3793
3802
|
function resolveRuntime(instance) {
|
|
3794
3803
|
const directRuntime = instance.__wevu;
|
|
3795
3804
|
if (directRuntime) return directRuntime;
|
|
3796
3805
|
const runtimeState = instance.$state;
|
|
3797
|
-
if (runtimeState && typeof runtimeState === "object") return runtimeState
|
|
3806
|
+
if (runtimeState && typeof runtimeState === "object") return runtimeState[WEVU_RUNTIME_KEY];
|
|
3798
3807
|
}
|
|
3799
3808
|
function syncRuntimeNativeInstance(runtime, instance) {
|
|
3800
3809
|
if ((runtime === null || runtime === void 0 ? void 0 : runtime.proxy) === instance) return;
|
|
@@ -3811,18 +3820,18 @@ function createComponentMethods(options) {
|
|
|
3811
3820
|
if (!runtimeState || typeof runtimeState !== "object") return;
|
|
3812
3821
|
if (instance.$state === runtimeState) return;
|
|
3813
3822
|
try {
|
|
3814
|
-
Object.defineProperty(runtimeState,
|
|
3823
|
+
Object.defineProperty(runtimeState, WEVU_NATIVE_INSTANCE_KEY, {
|
|
3815
3824
|
value: instance,
|
|
3816
3825
|
configurable: true,
|
|
3817
3826
|
enumerable: false,
|
|
3818
3827
|
writable: true
|
|
3819
3828
|
});
|
|
3820
3829
|
} catch (_unused2) {
|
|
3821
|
-
runtimeState
|
|
3830
|
+
runtimeState[WEVU_NATIVE_INSTANCE_KEY] = instance;
|
|
3822
3831
|
}
|
|
3823
3832
|
}
|
|
3824
3833
|
for (const methodName of methodNames) {
|
|
3825
|
-
if (methodName.startsWith(
|
|
3834
|
+
if (methodName === WEVU_INLINE_MAP_KEY || methodName.startsWith(WEVU_RESERVED_METHOD_PREFIX)) continue;
|
|
3826
3835
|
const userMethod = finalMethods[methodName];
|
|
3827
3836
|
finalMethods[methodName] = function componentMethod(...args) {
|
|
3828
3837
|
var _runtime$methods2;
|
|
@@ -4011,12 +4020,12 @@ function prepareComponentOptions(mpOptions) {
|
|
|
4011
4020
|
//#endregion
|
|
4012
4021
|
//#region src/runtime/register/snapshot.ts
|
|
4013
4022
|
function refreshOwnerSnapshotFromInstance(instance) {
|
|
4014
|
-
var
|
|
4023
|
+
var _WEVU_PROPS_KEY;
|
|
4015
4024
|
const runtime = instance.__wevu;
|
|
4016
|
-
const ownerId = instance
|
|
4025
|
+
const ownerId = instance[WEVU_SLOT_OWNER_ID_KEY];
|
|
4017
4026
|
if (!runtime || !ownerId || typeof runtime.snapshot !== "function") return;
|
|
4018
4027
|
const snapshot = runtime.snapshot();
|
|
4019
|
-
const propsSource = (
|
|
4028
|
+
const propsSource = (_WEVU_PROPS_KEY = instance[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : instance.properties;
|
|
4020
4029
|
if (propsSource && typeof propsSource === "object") for (const [key, value] of Object.entries(propsSource)) snapshot[key] = value;
|
|
4021
4030
|
updateOwnerSnapshot(ownerId, snapshot, runtime.proxy);
|
|
4022
4031
|
}
|
|
@@ -4024,23 +4033,22 @@ function refreshOwnerSnapshotFromInstance(instance) {
|
|
|
4024
4033
|
//#region src/runtime/register/component/props.ts
|
|
4025
4034
|
function createPropsSync(options) {
|
|
4026
4035
|
const { restOptions, userObservers } = options;
|
|
4027
|
-
const PENDING_PROP_VALUES_KEY = "__wevuPendingPropValues";
|
|
4028
4036
|
const propKeys = restOptions.properties && typeof restOptions.properties === "object" ? Object.keys(restOptions.properties) : [];
|
|
4029
4037
|
const propKeySet = new Set(propKeys);
|
|
4030
4038
|
const attachWevuPropKeys = (instance) => {
|
|
4031
4039
|
try {
|
|
4032
|
-
Object.defineProperty(instance,
|
|
4040
|
+
Object.defineProperty(instance, WEVU_PROP_KEYS_KEY, {
|
|
4033
4041
|
value: propKeys,
|
|
4034
4042
|
configurable: true,
|
|
4035
4043
|
enumerable: false,
|
|
4036
4044
|
writable: false
|
|
4037
4045
|
});
|
|
4038
4046
|
} catch (_unused) {
|
|
4039
|
-
instance
|
|
4047
|
+
instance[WEVU_PROP_KEYS_KEY] = propKeys;
|
|
4040
4048
|
}
|
|
4041
4049
|
};
|
|
4042
4050
|
const syncWevuAttrsFromInstance = (instance) => {
|
|
4043
|
-
const attrsProxy = instance
|
|
4051
|
+
const attrsProxy = instance[WEVU_ATTRS_KEY];
|
|
4044
4052
|
if (!attrsProxy || typeof attrsProxy !== "object") return;
|
|
4045
4053
|
const hasRuntimeStateKey = (key) => {
|
|
4046
4054
|
var _wevu;
|
|
@@ -4066,9 +4074,9 @@ function createPropsSync(options) {
|
|
|
4066
4074
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4067
4075
|
};
|
|
4068
4076
|
const syncWevuPropsFromInstance = (instance) => {
|
|
4069
|
-
const propsProxy = instance
|
|
4077
|
+
const propsProxy = instance[WEVU_PROPS_KEY];
|
|
4070
4078
|
const properties = instance.properties;
|
|
4071
|
-
const pendingPropValues = instance[
|
|
4079
|
+
const pendingPropValues = instance[WEVU_PENDING_PROP_VALUES_KEY];
|
|
4072
4080
|
if (propsProxy && typeof propsProxy === "object" && properties && typeof properties === "object") {
|
|
4073
4081
|
const next = properties;
|
|
4074
4082
|
const currentKeys = Object.keys(propsProxy);
|
|
@@ -4088,17 +4096,17 @@ function createPropsSync(options) {
|
|
|
4088
4096
|
}
|
|
4089
4097
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4090
4098
|
}
|
|
4091
|
-
if (pendingPropValues) delete instance[
|
|
4099
|
+
if (pendingPropValues) delete instance[WEVU_PENDING_PROP_VALUES_KEY];
|
|
4092
4100
|
syncWevuAttrsFromInstance(instance);
|
|
4093
4101
|
};
|
|
4094
4102
|
const syncWevuPropValue = (instance, key, value) => {
|
|
4095
|
-
var _ref, _ref$
|
|
4096
|
-
const propsProxy = instance
|
|
4103
|
+
var _ref, _ref$WEVU_PENDING_PRO;
|
|
4104
|
+
const propsProxy = instance[WEVU_PROPS_KEY];
|
|
4097
4105
|
if (!propsProxy || typeof propsProxy !== "object") return;
|
|
4098
4106
|
try {
|
|
4099
4107
|
propsProxy[key] = value;
|
|
4100
4108
|
} catch (_unused7) {}
|
|
4101
|
-
const pendingPropValues = (_ref$
|
|
4109
|
+
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);
|
|
4102
4110
|
pendingPropValues[key] = value;
|
|
4103
4111
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4104
4112
|
syncWevuAttrsFromInstance(instance);
|
|
@@ -4130,7 +4138,6 @@ function createPropsSync(options) {
|
|
|
4130
4138
|
//#endregion
|
|
4131
4139
|
//#region src/runtime/layoutBridge.ts
|
|
4132
4140
|
const pageLayoutBridges = /* @__PURE__ */ new Map();
|
|
4133
|
-
const layoutBridgePageKeys = "__wevuLayoutBridgePageKeys";
|
|
4134
4141
|
const LEADING_SLASH_RE = /^\/+/;
|
|
4135
4142
|
function resolveCurrentPageInstance() {
|
|
4136
4143
|
const getCurrentPagesFn = globalThis.getCurrentPages;
|
|
@@ -4156,13 +4163,13 @@ function resolvePageFromContext(context) {
|
|
|
4156
4163
|
return resolveCurrentPageInstance();
|
|
4157
4164
|
}
|
|
4158
4165
|
function resolveNativeLayoutContext(context) {
|
|
4159
|
-
var _context$
|
|
4166
|
+
var _context$WEVU_PUBLIC_, _context$$state;
|
|
4160
4167
|
if (!context || typeof context !== "object") return;
|
|
4161
|
-
const runtimeNativeInstance = (_context$
|
|
4168
|
+
const runtimeNativeInstance = (_context$WEVU_PUBLIC_ = context[WEVU_PUBLIC_RUNTIME_KEY]) === null || _context$WEVU_PUBLIC_ === void 0 || (_context$WEVU_PUBLIC_ = _context$WEVU_PUBLIC_.state) === null || _context$WEVU_PUBLIC_ === void 0 ? void 0 : _context$WEVU_PUBLIC_[WEVU_NATIVE_INSTANCE_KEY];
|
|
4162
4169
|
if (runtimeNativeInstance && typeof runtimeNativeInstance === "object") return runtimeNativeInstance;
|
|
4163
|
-
const stateNativeInstance = (_context$$state = context.$state) === null || _context$$state === void 0 ? void 0 : _context$$state
|
|
4170
|
+
const stateNativeInstance = (_context$$state = context.$state) === null || _context$$state === void 0 ? void 0 : _context$$state[WEVU_NATIVE_INSTANCE_KEY];
|
|
4164
4171
|
if (stateNativeInstance && typeof stateNativeInstance === "object") return stateNativeInstance;
|
|
4165
|
-
if (context
|
|
4172
|
+
if (context[WEVU_NATIVE_INSTANCE_KEY] && typeof context[WEVU_NATIVE_INSTANCE_KEY] === "object") return context[WEVU_NATIVE_INSTANCE_KEY];
|
|
4166
4173
|
return context;
|
|
4167
4174
|
}
|
|
4168
4175
|
function resolveHostEntry(entry) {
|
|
@@ -4184,10 +4191,10 @@ function safeSelectComponent(target, selector) {
|
|
|
4184
4191
|
}
|
|
4185
4192
|
}
|
|
4186
4193
|
function resolveDeclaredLayoutHostFromRefs(binding, context) {
|
|
4187
|
-
var _ref, _context$
|
|
4194
|
+
var _ref, _ref2, _context$WEVU_PUBLIC_2, _context$WEVU_PUBLIC_3, _context$__wevu, _context$$state2, _refMap$get$value, _refMap$get;
|
|
4188
4195
|
if (!binding.refName) return null;
|
|
4189
4196
|
const refMap = getTemplateRefMap(context);
|
|
4190
|
-
const stateRefs = (_ref = (_context$
|
|
4197
|
+
const stateRefs = (_ref = (_ref2 = (_context$WEVU_PUBLIC_2 = (_context$WEVU_PUBLIC_3 = context[WEVU_PUBLIC_RUNTIME_KEY]) === null || _context$WEVU_PUBLIC_3 === void 0 || (_context$WEVU_PUBLIC_3 = _context$WEVU_PUBLIC_3.state) === null || _context$WEVU_PUBLIC_3 === void 0 ? void 0 : _context$WEVU_PUBLIC_3.$refs) !== null && _context$WEVU_PUBLIC_2 !== void 0 ? _context$WEVU_PUBLIC_2 : (_context$__wevu = context.__wevu) === null || _context$__wevu === void 0 || (_context$__wevu = _context$__wevu.state) === null || _context$__wevu === void 0 ? void 0 : _context$__wevu.$refs) !== null && _ref2 !== void 0 ? _ref2 : (_context$$state2 = context.$state) === null || _context$$state2 === void 0 ? void 0 : _context$$state2.$refs) !== null && _ref !== void 0 ? _ref : context.$refs;
|
|
4191
4198
|
const refValue = (_refMap$get$value = refMap === null || refMap === void 0 || (_refMap$get = refMap.get(binding.refName)) === null || _refMap$get === void 0 ? void 0 : _refMap$get.value) !== null && _refMap$get$value !== void 0 ? _refMap$get$value : stateRefs === null || stateRefs === void 0 ? void 0 : stateRefs[binding.refName];
|
|
4192
4199
|
if (Array.isArray(refValue)) {
|
|
4193
4200
|
var _refValue$;
|
|
@@ -4201,10 +4208,10 @@ function createDeclaredLayoutHostBridge(bindings, context) {
|
|
|
4201
4208
|
const binding = findLayoutHostBinding(bindings, key);
|
|
4202
4209
|
if (!binding) return null;
|
|
4203
4210
|
if (binding.kind === "component" || !binding.kind) {
|
|
4204
|
-
var
|
|
4211
|
+
var _ref3, _safeSelectComponent;
|
|
4205
4212
|
const cachedHost = resolveDeclaredLayoutHostFromRefs(binding, context);
|
|
4206
4213
|
if (cachedHost) return cachedHost;
|
|
4207
|
-
return (
|
|
4214
|
+
return (_ref3 = (_safeSelectComponent = safeSelectComponent(nativeContext, binding.selector)) !== null && _safeSelectComponent !== void 0 ? _safeSelectComponent : safeSelectComponent(resolveCurrentPageInstance(), binding.selector)) !== null && _ref3 !== void 0 ? _ref3 : null;
|
|
4208
4215
|
}
|
|
4209
4216
|
return null;
|
|
4210
4217
|
} });
|
|
@@ -4223,17 +4230,17 @@ function registerPageLayoutBridge(selectors, context) {
|
|
|
4223
4230
|
for (const selector of normalizeSelectors(selectors)) registry.set(selector, bridgeContext);
|
|
4224
4231
|
pageLayoutBridges.set(pageKey, registry);
|
|
4225
4232
|
}
|
|
4226
|
-
bridgeContext[
|
|
4233
|
+
bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS] = pageKeys;
|
|
4227
4234
|
return true;
|
|
4228
4235
|
}
|
|
4229
4236
|
/**
|
|
4230
4237
|
* 移除当前页面的 layout bridge 注册。
|
|
4231
4238
|
*/
|
|
4232
4239
|
function unregisterPageLayoutBridge(selectors, context) {
|
|
4233
|
-
var _bridgeContext$
|
|
4240
|
+
var _bridgeContext$WEVU_L;
|
|
4234
4241
|
const bridgeContext = context !== null && context !== void 0 ? context : getCurrentInstance();
|
|
4235
4242
|
const page = resolvePageFromContext(bridgeContext);
|
|
4236
|
-
const pageKeys = (_bridgeContext$
|
|
4243
|
+
const pageKeys = (_bridgeContext$WEVU_L = bridgeContext === null || bridgeContext === void 0 ? void 0 : bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS]) !== null && _bridgeContext$WEVU_L !== void 0 ? _bridgeContext$WEVU_L : resolvePageKeys(page);
|
|
4237
4244
|
if (!bridgeContext || !Array.isArray(pageKeys) || pageKeys.length === 0) return false;
|
|
4238
4245
|
let removed = false;
|
|
4239
4246
|
for (const pageKey of pageKeys) {
|
|
@@ -4245,19 +4252,19 @@ function unregisterPageLayoutBridge(selectors, context) {
|
|
|
4245
4252
|
}
|
|
4246
4253
|
if (registry.size === 0) pageLayoutBridges.delete(pageKey);
|
|
4247
4254
|
}
|
|
4248
|
-
delete bridgeContext[
|
|
4255
|
+
delete bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS];
|
|
4249
4256
|
return removed;
|
|
4250
4257
|
}
|
|
4251
4258
|
/**
|
|
4252
4259
|
* 解析当前页面已注册的 layout bridge,找不到时回退到传入上下文。
|
|
4253
4260
|
*/
|
|
4254
4261
|
function resolveLayoutBridge(selector, fallbackContext) {
|
|
4255
|
-
var _resolveCurrentPageIn,
|
|
4262
|
+
var _resolveCurrentPageIn, _ref4;
|
|
4256
4263
|
const bridgeContext = resolvePageKeys((_resolveCurrentPageIn = resolveCurrentPageInstance()) !== null && _resolveCurrentPageIn !== void 0 ? _resolveCurrentPageIn : resolvePageFromContext(fallbackContext)).map((pageKey) => {
|
|
4257
4264
|
var _pageLayoutBridges$ge2;
|
|
4258
4265
|
return (_pageLayoutBridges$ge2 = pageLayoutBridges.get(pageKey)) === null || _pageLayoutBridges$ge2 === void 0 ? void 0 : _pageLayoutBridges$ge2.get(selector);
|
|
4259
4266
|
}).find(Boolean);
|
|
4260
|
-
return (
|
|
4267
|
+
return (_ref4 = bridgeContext !== null && bridgeContext !== void 0 ? bridgeContext : fallbackContext) !== null && _ref4 !== void 0 ? _ref4 : getCurrentInstance();
|
|
4261
4268
|
}
|
|
4262
4269
|
/**
|
|
4263
4270
|
* 解析当前页面 layout 内通过指定 key 暴露的宿主实例。
|
|
@@ -4349,19 +4356,19 @@ function registerComponentDefinition(options) {
|
|
|
4349
4356
|
const pageShareMethodBridges = {};
|
|
4350
4357
|
const attachRuntimeLayoutHosts = (instance) => {
|
|
4351
4358
|
if (!Array.isArray(layoutHosts) || !layoutHosts.length) return;
|
|
4352
|
-
if (instance
|
|
4359
|
+
if (instance[WEVU_LAYOUT_HOST_BRIDGE_KEY]) return;
|
|
4353
4360
|
const bridge = registerRuntimeLayoutHosts(layoutHosts, instance);
|
|
4354
|
-
if (bridge) instance
|
|
4361
|
+
if (bridge) instance[WEVU_LAYOUT_HOST_BRIDGE_KEY] = bridge;
|
|
4355
4362
|
};
|
|
4356
4363
|
const attachPageLayoutSetter = (instance) => {
|
|
4357
4364
|
if (!isPage) return;
|
|
4358
|
-
instance
|
|
4365
|
+
instance[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
|
|
4359
4366
|
var _instance$__wevu;
|
|
4360
4367
|
const runtimeState = (_instance$__wevu = instance.__wevu) === null || _instance$__wevu === void 0 ? void 0 : _instance$__wevu.state;
|
|
4361
4368
|
if (!runtimeState || typeof runtimeState !== "object") return;
|
|
4362
|
-
runtimeState
|
|
4369
|
+
runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout);
|
|
4363
4370
|
const nextProps = layout === false ? {} : props !== null && props !== void 0 ? props : {};
|
|
4364
|
-
runtimeState
|
|
4371
|
+
runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps;
|
|
4365
4372
|
syncRuntimePageLayoutState(instance, layout, nextProps);
|
|
4366
4373
|
};
|
|
4367
4374
|
};
|
|
@@ -4385,7 +4392,7 @@ function registerComponentDefinition(options) {
|
|
|
4385
4392
|
...userLifetimes,
|
|
4386
4393
|
created: function created(...args) {
|
|
4387
4394
|
applyExtraInstanceFields(this);
|
|
4388
|
-
if (Array.isArray(templateRefs) && templateRefs.length) Object.defineProperty(this,
|
|
4395
|
+
if (Array.isArray(templateRefs) && templateRefs.length) Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {
|
|
4389
4396
|
value: templateRefs,
|
|
4390
4397
|
configurable: true,
|
|
4391
4398
|
enumerable: false,
|
|
@@ -4411,7 +4418,7 @@ function registerComponentDefinition(options) {
|
|
|
4411
4418
|
},
|
|
4412
4419
|
attached: function attached(...args) {
|
|
4413
4420
|
applyExtraInstanceFields(this);
|
|
4414
|
-
if (Array.isArray(templateRefs) && templateRefs.length && !this
|
|
4421
|
+
if (Array.isArray(templateRefs) && templateRefs.length && !this[WEVU_TEMPLATE_REFS_KEY]) Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {
|
|
4415
4422
|
value: templateRefs,
|
|
4416
4423
|
configurable: true,
|
|
4417
4424
|
enumerable: false,
|
|
@@ -4437,8 +4444,8 @@ function registerComponentDefinition(options) {
|
|
|
4437
4444
|
if (typeof userLifetimes.ready === "function") userLifetimes.ready.apply(this, args);
|
|
4438
4445
|
return;
|
|
4439
4446
|
}
|
|
4440
|
-
if (!this
|
|
4441
|
-
this
|
|
4447
|
+
if (!this[WEVU_READY_CALLED_KEY]) {
|
|
4448
|
+
this[WEVU_READY_CALLED_KEY] = true;
|
|
4442
4449
|
syncWevuPropsFromInstance(this);
|
|
4443
4450
|
scheduleTemplateRefUpdate(this, () => {
|
|
4444
4451
|
callHookList(this, "onReady", args);
|
|
@@ -4456,9 +4463,9 @@ function registerComponentDefinition(options) {
|
|
|
4456
4463
|
return;
|
|
4457
4464
|
}
|
|
4458
4465
|
clearTemplateRefs(this);
|
|
4459
|
-
if (Array.isArray(layoutHosts) && layoutHosts.length && this
|
|
4460
|
-
unregisterRuntimeLayoutHosts(layoutHosts, this
|
|
4461
|
-
delete this
|
|
4466
|
+
if (Array.isArray(layoutHosts) && layoutHosts.length && this[WEVU_LAYOUT_HOST_BRIDGE_KEY]) {
|
|
4467
|
+
unregisterRuntimeLayoutHosts(layoutHosts, this[WEVU_LAYOUT_HOST_BRIDGE_KEY]);
|
|
4468
|
+
delete this[WEVU_LAYOUT_HOST_BRIDGE_KEY];
|
|
4462
4469
|
}
|
|
4463
4470
|
teardownRuntimeInstance(this);
|
|
4464
4471
|
if (typeof userLifetimes.detached === "function") userLifetimes.detached.apply(this, args);
|
|
@@ -4539,7 +4546,7 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4539
4546
|
userOnAddToFavorites
|
|
4540
4547
|
});
|
|
4541
4548
|
const hasHook = (target, name) => {
|
|
4542
|
-
const hooks = target
|
|
4549
|
+
const hooks = target[WEVU_HOOKS_KEY];
|
|
4543
4550
|
if (!hooks) return false;
|
|
4544
4551
|
const entry = hooks[name];
|
|
4545
4552
|
if (!entry) return false;
|
|
@@ -4549,8 +4556,8 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4549
4556
|
{
|
|
4550
4557
|
const userExport = restOptions.export;
|
|
4551
4558
|
restOptions.export = function __wevu_export() {
|
|
4552
|
-
var
|
|
4553
|
-
const exposed = (
|
|
4559
|
+
var _WEVU_EXPOSED_KEY;
|
|
4560
|
+
const exposed = (_WEVU_EXPOSED_KEY = this[WEVU_EXPOSED_KEY]) !== null && _WEVU_EXPOSED_KEY !== void 0 ? _WEVU_EXPOSED_KEY : {};
|
|
4554
4561
|
const base = typeof userExport === "function" ? userExport.call(this) : {};
|
|
4555
4562
|
if (base && typeof base === "object" && !Array.isArray(base)) return {
|
|
4556
4563
|
...exposed,
|
|
@@ -4701,6 +4708,7 @@ function createApp(options) {
|
|
|
4701
4708
|
//#endregion
|
|
4702
4709
|
//#region src/runtime/define/props.ts
|
|
4703
4710
|
const ALLOW_NULL_PROP_INPUT_KEY = "__wevu_allowNullPropInput";
|
|
4711
|
+
const PUBLIC_ALLOW_NULL_PROP_INPUT_KEY = "allowNullPropInput";
|
|
4704
4712
|
const NATIVE_PROPERTY_TYPE_MAP = new Map([
|
|
4705
4713
|
[String, String],
|
|
4706
4714
|
[Number, Number],
|
|
@@ -4750,18 +4758,62 @@ function appendOptionalType(target, candidate) {
|
|
|
4750
4758
|
optionalTypes.push(candidate);
|
|
4751
4759
|
target.optionalTypes = optionalTypes;
|
|
4752
4760
|
}
|
|
4761
|
+
function normalizeOptionalTypeCandidates(raw) {
|
|
4762
|
+
if (!Array.isArray(raw)) return [];
|
|
4763
|
+
const normalized = [];
|
|
4764
|
+
raw.forEach((item) => {
|
|
4765
|
+
const mapped = toNativePropertyType(item);
|
|
4766
|
+
if (mapped === void 0 || mapped === null || normalized.includes(mapped)) return;
|
|
4767
|
+
normalized.push(mapped);
|
|
4768
|
+
});
|
|
4769
|
+
return normalized;
|
|
4770
|
+
}
|
|
4771
|
+
function normalizeExplicitPropertyDefinition(definition, allowNullPropInput) {
|
|
4772
|
+
if (definition === void 0) return;
|
|
4773
|
+
if (definition === null) return { type: null };
|
|
4774
|
+
if (Array.isArray(definition) || typeof definition === "function") {
|
|
4775
|
+
const propOptions = {};
|
|
4776
|
+
applyTypeOptions(propOptions, definition);
|
|
4777
|
+
if (allowNullPropInput && propOptions.type !== null) appendOptionalType(propOptions, null);
|
|
4778
|
+
if (!Object.hasOwn(propOptions, "type")) propOptions.type = null;
|
|
4779
|
+
return propOptions;
|
|
4780
|
+
}
|
|
4781
|
+
if (typeof definition !== "object") return definition;
|
|
4782
|
+
const propOptions = { ...definition };
|
|
4783
|
+
if ("type" in propOptions) {
|
|
4784
|
+
var _normalizedTypes$;
|
|
4785
|
+
const normalizedTypes = normalizeTypeCandidates(propOptions.type);
|
|
4786
|
+
propOptions.type = (_normalizedTypes$ = normalizedTypes[0]) !== null && _normalizedTypes$ !== void 0 ? _normalizedTypes$ : null;
|
|
4787
|
+
const existingOptionalTypes = normalizeOptionalTypeCandidates(propOptions.optionalTypes);
|
|
4788
|
+
for (const candidate of normalizedTypes.slice(1)) if (candidate !== null && !existingOptionalTypes.includes(candidate)) existingOptionalTypes.push(candidate);
|
|
4789
|
+
if (existingOptionalTypes.length > 0) propOptions.optionalTypes = existingOptionalTypes;
|
|
4790
|
+
else delete propOptions.optionalTypes;
|
|
4791
|
+
}
|
|
4792
|
+
if (!Object.hasOwn(propOptions, "type")) propOptions.type = null;
|
|
4793
|
+
if (allowNullPropInput && propOptions.type !== null) appendOptionalType(propOptions, null);
|
|
4794
|
+
return propOptions;
|
|
4795
|
+
}
|
|
4796
|
+
function normalizeExplicitProperties(properties, allowNullPropInput) {
|
|
4797
|
+
const normalizedProperties = {};
|
|
4798
|
+
Object.entries(properties).forEach(([key, definition]) => {
|
|
4799
|
+
const normalizedDefinition = normalizeExplicitPropertyDefinition(definition, allowNullPropInput);
|
|
4800
|
+
if (normalizedDefinition !== void 0) normalizedProperties[key] = normalizedDefinition;
|
|
4801
|
+
});
|
|
4802
|
+
return normalizedProperties;
|
|
4803
|
+
}
|
|
4753
4804
|
function normalizeProps(baseOptions, props, explicitProperties) {
|
|
4754
|
-
|
|
4755
|
-
const
|
|
4805
|
+
var _ALLOW_NULL_PROP_INPU;
|
|
4806
|
+
const allowNullPropInput = Boolean((_ALLOW_NULL_PROP_INPU = baseOptions[ALLOW_NULL_PROP_INPUT_KEY]) !== null && _ALLOW_NULL_PROP_INPU !== void 0 ? _ALLOW_NULL_PROP_INPU : baseOptions[PUBLIC_ALLOW_NULL_PROP_INPUT_KEY]);
|
|
4807
|
+
const { [ALLOW_NULL_PROP_INPUT_KEY]: _ignoredAllowNullPropInput, [PUBLIC_ALLOW_NULL_PROP_INPUT_KEY]: _ignoredPublicAllowNullPropInput, ...normalizedBaseOptions } = baseOptions;
|
|
4756
4808
|
const baseProperties = baseOptions.properties;
|
|
4757
4809
|
const resolvedExplicit = explicitProperties !== null && explicitProperties !== void 0 ? explicitProperties : baseProperties && typeof baseProperties === "object" ? baseProperties : void 0;
|
|
4758
4810
|
const attachInternalProps = (source) => {
|
|
4759
4811
|
const next = { ...source !== null && source !== void 0 ? source : {} };
|
|
4760
|
-
if (!Object.hasOwn(next,
|
|
4812
|
+
if (!Object.hasOwn(next, WEVU_SLOT_OWNER_ID_PROP)) next[WEVU_SLOT_OWNER_ID_PROP] = {
|
|
4761
4813
|
type: String,
|
|
4762
4814
|
value: ""
|
|
4763
4815
|
};
|
|
4764
|
-
if (!Object.hasOwn(next,
|
|
4816
|
+
if (!Object.hasOwn(next, WEVU_SLOT_SCOPE_KEY)) next[WEVU_SLOT_SCOPE_KEY] = {
|
|
4765
4817
|
type: null,
|
|
4766
4818
|
value: null
|
|
4767
4819
|
};
|
|
@@ -4769,9 +4821,10 @@ function normalizeProps(baseOptions, props, explicitProperties) {
|
|
|
4769
4821
|
};
|
|
4770
4822
|
if (resolvedExplicit || !props) {
|
|
4771
4823
|
const { properties: _ignored, ...rest } = normalizedBaseOptions;
|
|
4824
|
+
const normalizedExplicitProperties = resolvedExplicit ? allowNullPropInput ? normalizeExplicitProperties(resolvedExplicit, allowNullPropInput) : resolvedExplicit : void 0;
|
|
4772
4825
|
return {
|
|
4773
4826
|
...rest,
|
|
4774
|
-
properties: attachInternalProps(
|
|
4827
|
+
properties: attachInternalProps(normalizedExplicitProperties)
|
|
4775
4828
|
};
|
|
4776
4829
|
}
|
|
4777
4830
|
const properties = {};
|
|
@@ -4866,51 +4919,51 @@ function normalizeSlotBindings(value) {
|
|
|
4866
4919
|
}
|
|
4867
4920
|
function mergeSlotProps(instance, override) {
|
|
4868
4921
|
var _instance$properties, _instance$properties2;
|
|
4869
|
-
const scopeSource = Object.hasOwn(override !== null && override !== void 0 ? override : {},
|
|
4870
|
-
const propsSource = Object.hasOwn(override !== null && override !== void 0 ? override : {},
|
|
4922
|
+
const scopeSource = Object.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];
|
|
4923
|
+
const propsSource = Object.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];
|
|
4871
4924
|
const scope = normalizeSlotBindings(scopeSource);
|
|
4872
4925
|
const slotProps = normalizeSlotBindings(propsSource);
|
|
4873
4926
|
const merged = {
|
|
4874
4927
|
...scope,
|
|
4875
4928
|
...slotProps
|
|
4876
4929
|
};
|
|
4877
|
-
if (typeof (instance === null || instance === void 0 ? void 0 : instance.setData) === "function") instance.setData({
|
|
4930
|
+
if (typeof (instance === null || instance === void 0 ? void 0 : instance.setData) === "function") instance.setData({ [WEVU_SLOT_PROPS_DATA_KEY]: merged });
|
|
4878
4931
|
}
|
|
4879
4932
|
function createScopedSlotOptions(overrides) {
|
|
4880
4933
|
const baseOptions = {
|
|
4881
4934
|
properties: {
|
|
4882
|
-
|
|
4935
|
+
[WEVU_SLOT_OWNER_ID_KEY]: {
|
|
4883
4936
|
type: String,
|
|
4884
4937
|
value: ""
|
|
4885
4938
|
},
|
|
4886
|
-
|
|
4939
|
+
[WEVU_SLOT_PROPS_KEY]: {
|
|
4887
4940
|
type: null,
|
|
4888
4941
|
value: null,
|
|
4889
4942
|
observer(next) {
|
|
4890
|
-
mergeSlotProps(this, {
|
|
4943
|
+
mergeSlotProps(this, { [WEVU_SLOT_PROPS_KEY]: next });
|
|
4891
4944
|
}
|
|
4892
4945
|
},
|
|
4893
|
-
|
|
4946
|
+
[WEVU_SLOT_SCOPE_KEY]: {
|
|
4894
4947
|
type: null,
|
|
4895
4948
|
value: null,
|
|
4896
4949
|
observer(next) {
|
|
4897
|
-
mergeSlotProps(this, {
|
|
4950
|
+
mergeSlotProps(this, { [WEVU_SLOT_SCOPE_KEY]: next });
|
|
4898
4951
|
}
|
|
4899
4952
|
}
|
|
4900
4953
|
},
|
|
4901
4954
|
data: () => ({
|
|
4902
|
-
|
|
4903
|
-
|
|
4955
|
+
[WEVU_SLOT_OWNER_KEY]: {},
|
|
4956
|
+
[WEVU_SLOT_PROPS_DATA_KEY]: {}
|
|
4904
4957
|
}),
|
|
4905
4958
|
lifetimes: {
|
|
4906
4959
|
attached() {
|
|
4907
|
-
var _this$properties$
|
|
4908
|
-
const ownerId = (_this$properties$
|
|
4960
|
+
var _this$properties$WEVU, _this$properties;
|
|
4961
|
+
const ownerId = (_this$properties$WEVU = (_this$properties = this.properties) === null || _this$properties === void 0 ? void 0 : _this$properties[WEVU_SLOT_OWNER_ID_KEY]) !== null && _this$properties$WEVU !== void 0 ? _this$properties$WEVU : "";
|
|
4909
4962
|
mergeSlotProps(this);
|
|
4910
4963
|
if (!ownerId) return;
|
|
4911
4964
|
const updateOwner = (snapshot, proxy) => {
|
|
4912
4965
|
this.__wvOwnerProxy = proxy;
|
|
4913
|
-
if (typeof this.setData === "function") this.setData({
|
|
4966
|
+
if (typeof this.setData === "function") this.setData({ [WEVU_SLOT_OWNER_KEY]: snapshot || {} });
|
|
4914
4967
|
};
|
|
4915
4968
|
this.__wvOwnerUnsub = subscribeOwner(ownerId, updateOwner);
|
|
4916
4969
|
const snapshot = getOwnerSnapshot(ownerId);
|
|
@@ -4922,10 +4975,10 @@ function createScopedSlotOptions(overrides) {
|
|
|
4922
4975
|
this.__wvOwnerProxy = void 0;
|
|
4923
4976
|
}
|
|
4924
4977
|
},
|
|
4925
|
-
methods: {
|
|
4978
|
+
methods: { [WEVU_OWNER_HANDLER](event) {
|
|
4926
4979
|
var _wevu, _ref2, _event$currentTarget$2, _event$currentTarget2, _event$target2;
|
|
4927
4980
|
const owner = this.__wvOwnerProxy;
|
|
4928
|
-
const result = runInlineExpression(owner, void 0, event, (_wevu = this.__wevu) === null || _wevu === void 0 || (_wevu = _wevu.methods) === null || _wevu === void 0 ? void 0 : _wevu
|
|
4981
|
+
const result = runInlineExpression(owner, void 0, event, (_wevu = this.__wevu) === null || _wevu === void 0 || (_wevu = _wevu.methods) === null || _wevu === void 0 ? void 0 : _wevu[WEVU_INLINE_MAP_KEY]);
|
|
4929
4982
|
if (result !== void 0) return result;
|
|
4930
4983
|
if (!owner) return;
|
|
4931
4984
|
const handlerName = resolveDatasetEventValue((_ref2 = (_event$currentTarget$2 = event === null || event === void 0 || (_event$currentTarget2 = event.currentTarget) === null || _event$currentTarget2 === void 0 ? void 0 : _event$currentTarget2.dataset) !== null && _event$currentTarget$2 !== void 0 ? _event$currentTarget$2 : event === null || event === void 0 || (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.dataset) !== null && _ref2 !== void 0 ? _ref2 : {}, "wvHandler", event);
|
|
@@ -4939,7 +4992,7 @@ function createScopedSlotOptions(overrides) {
|
|
|
4939
4992
|
if ((overrides === null || overrides === void 0 ? void 0 : overrides.computed) && Object.keys(overrides.computed).length > 0) baseOptions.computed = overrides.computed;
|
|
4940
4993
|
if ((overrides === null || overrides === void 0 ? void 0 : overrides.inlineMap) && Object.keys(overrides.inlineMap).length > 0) baseOptions.methods = {
|
|
4941
4994
|
...baseOptions.methods,
|
|
4942
|
-
|
|
4995
|
+
[WEVU_INLINE_MAP_KEY]: overrides.inlineMap
|
|
4943
4996
|
};
|
|
4944
4997
|
return baseOptions;
|
|
4945
4998
|
}
|
|
@@ -4959,7 +5012,7 @@ function shouldExposeInSnapshot(value) {
|
|
|
4959
5012
|
}
|
|
4960
5013
|
function applySetupResult(runtime, target, result) {
|
|
4961
5014
|
var _runtime$methods, _runtime$state;
|
|
4962
|
-
const declaredPropKeys = new Set(Array.isArray(target === null || target === void 0 ? void 0 : target
|
|
5015
|
+
const declaredPropKeys = new Set(Array.isArray(target === null || target === void 0 ? void 0 : target[WEVU_PROP_KEYS_KEY]) ? target[WEVU_PROP_KEYS_KEY] : []);
|
|
4963
5016
|
const methods = (_runtime$methods = runtime === null || runtime === void 0 ? void 0 : runtime.methods) !== null && _runtime$methods !== void 0 ? _runtime$methods : Object.create(null);
|
|
4964
5017
|
const state = (_runtime$state = runtime === null || runtime === void 0 ? void 0 : runtime.state) !== null && _runtime$state !== void 0 ? _runtime$state : Object.create(null);
|
|
4965
5018
|
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
@@ -4990,13 +5043,13 @@ function applySetupResult(runtime, target, result) {
|
|
|
4990
5043
|
configurable: true,
|
|
4991
5044
|
enumerable: false,
|
|
4992
5045
|
get() {
|
|
4993
|
-
const propsSource = rawState
|
|
5046
|
+
const propsSource = rawState[WEVU_PROPS_KEY];
|
|
4994
5047
|
if (propsSource && typeof propsSource === "object" && Object.hasOwn(propsSource, key)) return propsSource[key];
|
|
4995
5048
|
return fallbackValue;
|
|
4996
5049
|
},
|
|
4997
5050
|
set(next) {
|
|
4998
5051
|
fallbackValue = next;
|
|
4999
|
-
const propsSource = rawState
|
|
5052
|
+
const propsSource = rawState[WEVU_PROPS_KEY];
|
|
5000
5053
|
if (!propsSource || typeof propsSource !== "object") return;
|
|
5001
5054
|
try {
|
|
5002
5055
|
propsSource[key] = next;
|
|
@@ -5038,7 +5091,7 @@ function ensureScopedSlotComponentGlobal() {
|
|
|
5038
5091
|
const globalObject = getScopedSlotHostGlobalObject();
|
|
5039
5092
|
if (!globalObject) return;
|
|
5040
5093
|
const globalRecord = globalObject;
|
|
5041
|
-
if (!globalRecord
|
|
5094
|
+
if (!globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] && scopedSlotCreator) globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] = scopedSlotCreator;
|
|
5042
5095
|
}
|
|
5043
5096
|
function defineComponent(options) {
|
|
5044
5097
|
ensureScopedSlotComponentGlobal();
|
|
@@ -5082,10 +5135,12 @@ function defineComponent(options) {
|
|
|
5082
5135
|
* @internal
|
|
5083
5136
|
*/
|
|
5084
5137
|
function createWevuComponent(options) {
|
|
5138
|
+
var _allowNullPropInput;
|
|
5085
5139
|
ensureScopedSlotComponentGlobal();
|
|
5086
5140
|
const { properties, props, ...restOptions } = options;
|
|
5087
5141
|
defineComponent(normalizeProps({
|
|
5088
5142
|
...restOptions,
|
|
5143
|
+
allowNullPropInput: (_allowNullPropInput = restOptions.allowNullPropInput) !== null && _allowNullPropInput !== void 0 ? _allowNullPropInput : true,
|
|
5089
5144
|
__wevu_allowNullPropInput: true
|
|
5090
5145
|
}, props, properties));
|
|
5091
5146
|
}
|
|
@@ -5418,7 +5473,7 @@ function useUpdatePerformanceListener(listener) {
|
|
|
5418
5473
|
//#region src/runtime/use.ts
|
|
5419
5474
|
function resolveCurrentRuntimeApp() {
|
|
5420
5475
|
const instance = getCurrentInstance();
|
|
5421
|
-
if ((instance === null || instance === void 0 ? void 0 : instance
|
|
5476
|
+
if ((instance === null || instance === void 0 ? void 0 : instance[WEVU_IS_APP_INSTANCE_KEY]) && instance[WEVU_RUNTIME_APP_KEY]) return instance[WEVU_RUNTIME_APP_KEY];
|
|
5422
5477
|
throw new Error("defineAppSetup() / use() 只能在 app setup 上下文中调用");
|
|
5423
5478
|
}
|
|
5424
5479
|
/**
|
|
@@ -5557,18 +5612,18 @@ function mergeModels(a, b) {
|
|
|
5557
5612
|
//#endregion
|
|
5558
5613
|
//#region src/runtime/vueCompat/templateRef.ts
|
|
5559
5614
|
function ensureTemplateRefMap(target) {
|
|
5560
|
-
const existing = target
|
|
5615
|
+
const existing = target[WEVU_TEMPLATE_REF_MAP_KEY];
|
|
5561
5616
|
if (existing) return existing;
|
|
5562
5617
|
const next = /* @__PURE__ */ new Map();
|
|
5563
5618
|
try {
|
|
5564
|
-
Object.defineProperty(target,
|
|
5619
|
+
Object.defineProperty(target, WEVU_TEMPLATE_REF_MAP_KEY, {
|
|
5565
5620
|
value: next,
|
|
5566
5621
|
configurable: true,
|
|
5567
5622
|
enumerable: false,
|
|
5568
5623
|
writable: false
|
|
5569
5624
|
});
|
|
5570
5625
|
} catch (_unused) {
|
|
5571
|
-
target
|
|
5626
|
+
target[WEVU_TEMPLATE_REF_MAP_KEY] = next;
|
|
5572
5627
|
}
|
|
5573
5628
|
return next;
|
|
5574
5629
|
}
|