wevu 6.15.0 → 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/fetch.d.mts +4 -2
- package/dist/fetch.mjs +104 -92
- package/dist/{index-5l-9KY-_.d.mts → index-gXdStbgb.d.mts} +8 -2
- package/dist/{index-BZkMfL_L.d.mts → index-xg5b-v5q.d.mts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{router-DKQJSUWb.mjs → router-BCfYPEq2.mjs} +9 -8
- package/dist/router.d.mts +1 -1
- package/dist/router.mjs +1 -1
- package/dist/{src-C5U2KbED.mjs → src-BufOrhxF.mjs} +235 -192
- package/dist/store.d.mts +1 -1
- package/dist/vue-demi.d.mts +3 -3
- package/dist/vue-demi.mjs +2 -2
- package/dist/{vue-types-CxI8OQhB.d.mts → vue-types-BCW41JNB.d.mts} +1 -0
- package/package.json +3 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
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-
|
|
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.15.
|
|
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];
|
|
@@ -2117,7 +2118,6 @@ function runInlineExpression(ctx, expr, event, inlineMap) {
|
|
|
2117
2118
|
//#region src/runtime/register/component/lifecycle/platform.ts
|
|
2118
2119
|
let wxPatched = false;
|
|
2119
2120
|
let currentPageInstance;
|
|
2120
|
-
const PAGE_SCROLL_HOOK_DEPTH_KEY = "__wevuPageScrollHookDepth";
|
|
2121
2121
|
function getCurrentPageInstance() {
|
|
2122
2122
|
return currentPageInstance;
|
|
2123
2123
|
}
|
|
@@ -2128,15 +2128,15 @@ function releaseCurrentPageInstance(target) {
|
|
|
2128
2128
|
if (currentPageInstance === target) currentPageInstance = void 0;
|
|
2129
2129
|
}
|
|
2130
2130
|
function runInPageScrollHook(target, task) {
|
|
2131
|
-
var
|
|
2132
|
-
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;
|
|
2133
2133
|
try {
|
|
2134
2134
|
return task();
|
|
2135
2135
|
} finally {
|
|
2136
|
-
var
|
|
2137
|
-
const nextDepth = Number((
|
|
2138
|
-
if (nextDepth <= 0) delete target[
|
|
2139
|
-
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;
|
|
2140
2140
|
}
|
|
2141
2141
|
}
|
|
2142
2142
|
function resolvePageOptions(target) {
|
|
@@ -2193,8 +2193,6 @@ function ensurePageShareMenus(options) {
|
|
|
2193
2193
|
}
|
|
2194
2194
|
//#endregion
|
|
2195
2195
|
//#region src/runtime/pageLayout.ts
|
|
2196
|
-
const PAGE_LAYOUT_SETTER_KEY = "__wevuSetPageLayout";
|
|
2197
|
-
const NO_LAYOUT_RUNTIME_KEY = "__wv_no_layout";
|
|
2198
2196
|
function resolveCurrentPageInstance$1() {
|
|
2199
2197
|
const runtimeCurrentPage = getCurrentPageInstance();
|
|
2200
2198
|
if (runtimeCurrentPage) return runtimeCurrentPage;
|
|
@@ -2203,19 +2201,19 @@ function resolveCurrentPageInstance$1() {
|
|
|
2203
2201
|
return getCurrentPagesFn().at(-1);
|
|
2204
2202
|
}
|
|
2205
2203
|
function normalizeRuntimePageLayoutName(layout) {
|
|
2206
|
-
return layout ===
|
|
2204
|
+
return layout === WEVU_PAGE_LAYOUT_NONE ? false : layout;
|
|
2207
2205
|
}
|
|
2208
2206
|
/**
|
|
2209
2207
|
* 获取当前页面 layout 状态。
|
|
2210
2208
|
*/
|
|
2211
2209
|
function usePageLayout() {
|
|
2212
|
-
var _currentInstance$__we, _runtimeState$
|
|
2210
|
+
var _currentInstance$__we, _runtimeState$WEVU_PA;
|
|
2213
2211
|
if (!getCurrentSetupContext()) throw new Error("usePageLayout() 必须在 setup() 的同步阶段调用");
|
|
2214
2212
|
const currentInstance = getCurrentInstance();
|
|
2215
2213
|
const runtimeState = currentInstance === null || currentInstance === void 0 || (_currentInstance$__we = currentInstance.__wevu) === null || _currentInstance$__we === void 0 ? void 0 : _currentInstance$__we.state;
|
|
2216
2214
|
const pageLayoutState = reactive({
|
|
2217
|
-
name: normalizeRuntimePageLayoutName(runtimeState === null || runtimeState === void 0 ? void 0 : runtimeState
|
|
2218
|
-
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 : {} }
|
|
2219
2217
|
});
|
|
2220
2218
|
if (currentInstance) currentInstance.__wevuPageLayoutState = pageLayoutState;
|
|
2221
2219
|
return readonly(pageLayoutState);
|
|
@@ -2227,25 +2225,25 @@ function syncRuntimePageLayoutState(target, layout, props) {
|
|
|
2227
2225
|
state.props = { ...props };
|
|
2228
2226
|
}
|
|
2229
2227
|
function syncRuntimePageLayoutStateFromRuntime(target) {
|
|
2230
|
-
var _target$__wevu, _runtimeState$
|
|
2228
|
+
var _target$__wevu, _runtimeState$WEVU_PA2;
|
|
2231
2229
|
const state = target.__wevuPageLayoutState;
|
|
2232
2230
|
const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
|
|
2233
2231
|
if (!state || !runtimeState) return;
|
|
2234
|
-
state.name = normalizeRuntimePageLayoutName(runtimeState
|
|
2235
|
-
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 : {} };
|
|
2236
2234
|
}
|
|
2237
2235
|
/**
|
|
2238
2236
|
* 显式切换当前页面使用的 layout。
|
|
2239
2237
|
*/
|
|
2240
2238
|
function setPageLayout(layout, props) {
|
|
2241
2239
|
const currentInstance = getCurrentInstance();
|
|
2242
|
-
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];
|
|
2243
2241
|
if (typeof directSetter === "function") {
|
|
2244
2242
|
directSetter(layout, props);
|
|
2245
2243
|
return;
|
|
2246
2244
|
}
|
|
2247
2245
|
const currentPage = resolveCurrentPageInstance$1();
|
|
2248
|
-
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];
|
|
2249
2247
|
if (typeof pageSetter === "function") {
|
|
2250
2248
|
pageSetter(layout, props);
|
|
2251
2249
|
return;
|
|
@@ -2309,15 +2307,15 @@ function resolveOwnerSnapshot(runtime) {
|
|
|
2309
2307
|
return typeof runtime.snapshot === "function" ? runtime.snapshot() : {};
|
|
2310
2308
|
}
|
|
2311
2309
|
function attachOwnerSnapshot(target, runtime, ownerId) {
|
|
2312
|
-
var
|
|
2310
|
+
var _WEVU_PROPS_KEY;
|
|
2313
2311
|
try {
|
|
2314
|
-
runtime.state
|
|
2312
|
+
runtime.state[WEVU_SLOT_OWNER_ID_KEY] = ownerId;
|
|
2315
2313
|
} catch (_unused2) {}
|
|
2316
2314
|
try {
|
|
2317
|
-
target
|
|
2315
|
+
target[WEVU_SLOT_OWNER_ID_KEY] = ownerId;
|
|
2318
2316
|
} catch (_unused3) {}
|
|
2319
2317
|
const snapshot = resolveOwnerSnapshot(runtime);
|
|
2320
|
-
const propsSource = (
|
|
2318
|
+
const propsSource = (_WEVU_PROPS_KEY = target[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : target.properties;
|
|
2321
2319
|
if (propsSource && typeof propsSource === "object") for (const [key, value] of Object.entries(propsSource)) snapshot[key] = value;
|
|
2322
2320
|
updateOwnerSnapshot(ownerId, snapshot, runtime.proxy);
|
|
2323
2321
|
}
|
|
@@ -2402,16 +2400,16 @@ function mergeComponentRefValue(wrapper, exposed) {
|
|
|
2402
2400
|
}));
|
|
2403
2401
|
}
|
|
2404
2402
|
function resolveComponentPublicInstance(value) {
|
|
2405
|
-
var _instance$
|
|
2403
|
+
var _instance$WEVU_PUBLIC;
|
|
2406
2404
|
if (!value || typeof value !== "object") return value !== null && value !== void 0 ? value : null;
|
|
2407
2405
|
const instance = value;
|
|
2408
|
-
const exposed = instance
|
|
2406
|
+
const exposed = instance[WEVU_EXPOSED_KEY];
|
|
2409
2407
|
if (exposed && typeof exposed === "object") return getExposeProxy(instance, exposed);
|
|
2410
|
-
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;
|
|
2411
2409
|
return value;
|
|
2412
2410
|
}
|
|
2413
2411
|
function getTemplateRefMap(target) {
|
|
2414
|
-
return target
|
|
2412
|
+
return target[WEVU_TEMPLATE_REF_MAP_KEY];
|
|
2415
2413
|
}
|
|
2416
2414
|
function updateTemplateRefMapValue(refMap, name, value) {
|
|
2417
2415
|
if (!refMap) return;
|
|
@@ -2538,12 +2536,12 @@ function buildTemplateRefValue(target, binding, result) {
|
|
|
2538
2536
|
//#endregion
|
|
2539
2537
|
//#region src/runtime/templateRefs.ts
|
|
2540
2538
|
function updateTemplateRefs(target, onResolved) {
|
|
2541
|
-
const bindings = target
|
|
2539
|
+
const bindings = target[WEVU_TEMPLATE_REFS_KEY];
|
|
2542
2540
|
if (!bindings || !bindings.length) {
|
|
2543
2541
|
onResolved === null || onResolved === void 0 || onResolved();
|
|
2544
2542
|
return;
|
|
2545
2543
|
}
|
|
2546
|
-
if (!target
|
|
2544
|
+
if (!target[WEVU_READY_CALLED_KEY]) {
|
|
2547
2545
|
onResolved === null || onResolved === void 0 || onResolved();
|
|
2548
2546
|
return;
|
|
2549
2547
|
}
|
|
@@ -2630,28 +2628,28 @@ function updateTemplateRefs(target, onResolved) {
|
|
|
2630
2628
|
});
|
|
2631
2629
|
}
|
|
2632
2630
|
function scheduleTemplateRefUpdate(target, onResolved) {
|
|
2633
|
-
const bindings = target
|
|
2631
|
+
const bindings = target[WEVU_TEMPLATE_REFS_KEY];
|
|
2634
2632
|
if (!bindings || !bindings.length) {
|
|
2635
2633
|
onResolved === null || onResolved === void 0 || onResolved();
|
|
2636
2634
|
return;
|
|
2637
2635
|
}
|
|
2638
2636
|
if (onResolved) {
|
|
2639
|
-
var
|
|
2640
|
-
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 : [];
|
|
2641
2639
|
callbacks.push(onResolved);
|
|
2642
|
-
if (!target
|
|
2640
|
+
if (!target[WEVU_TEMPLATE_REFS_CALLBACKS_KEY]) Object.defineProperty(target, WEVU_TEMPLATE_REFS_CALLBACKS_KEY, {
|
|
2643
2641
|
value: callbacks,
|
|
2644
2642
|
configurable: true,
|
|
2645
2643
|
enumerable: false,
|
|
2646
2644
|
writable: true
|
|
2647
2645
|
});
|
|
2648
2646
|
}
|
|
2649
|
-
if (target
|
|
2650
|
-
target
|
|
2647
|
+
if (target[WEVU_TEMPLATE_REFS_PENDING_KEY]) return;
|
|
2648
|
+
target[WEVU_TEMPLATE_REFS_PENDING_KEY] = true;
|
|
2651
2649
|
nextTick(() => {
|
|
2652
|
-
target
|
|
2650
|
+
target[WEVU_TEMPLATE_REFS_PENDING_KEY] = false;
|
|
2653
2651
|
const flushCallbacks = () => {
|
|
2654
|
-
const callbacks = target
|
|
2652
|
+
const callbacks = target[WEVU_TEMPLATE_REFS_CALLBACKS_KEY];
|
|
2655
2653
|
if (!callbacks || !callbacks.length) return;
|
|
2656
2654
|
callbacks.splice(0).forEach((cb) => {
|
|
2657
2655
|
try {
|
|
@@ -2664,7 +2662,7 @@ function scheduleTemplateRefUpdate(target, onResolved) {
|
|
|
2664
2662
|
}
|
|
2665
2663
|
function clearTemplateRefs(target) {
|
|
2666
2664
|
var _target$__wevu$proxy2, _target$__wevu2;
|
|
2667
|
-
const bindings = target
|
|
2665
|
+
const bindings = target[WEVU_TEMPLATE_REFS_KEY];
|
|
2668
2666
|
if (!bindings || !bindings.length) return;
|
|
2669
2667
|
const refsContainer = ensureRefsContainer(target);
|
|
2670
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;
|
|
@@ -2698,7 +2696,6 @@ const setupInstanceMethodNames = [
|
|
|
2698
2696
|
"setData",
|
|
2699
2697
|
"setUpdatePerformanceListener"
|
|
2700
2698
|
];
|
|
2701
|
-
const SETUP_CONTEXT_INSTANCE_KEY$1 = "__wevuSetupContextInstance";
|
|
2702
2699
|
function createSetupSlotsFallback() {
|
|
2703
2700
|
return Object.freeze(Object.create(null));
|
|
2704
2701
|
}
|
|
@@ -2759,7 +2756,7 @@ function resolveRuntimeNativeMethodOwner(runtime, target, methodName) {
|
|
|
2759
2756
|
if (isBridgeMethod(candidate)) return false;
|
|
2760
2757
|
return typeof candidate[methodName] === "function";
|
|
2761
2758
|
};
|
|
2762
|
-
const nativeFromState = runtimeRawState ? runtimeRawState
|
|
2759
|
+
const nativeFromState = runtimeRawState ? runtimeRawState[WEVU_NATIVE_INSTANCE_KEY] : void 0;
|
|
2763
2760
|
if (isValidNativeCandidate(nativeFromState)) return nativeFromState;
|
|
2764
2761
|
const runtimeInstance = runtime === null || runtime === void 0 ? void 0 : runtime.instance;
|
|
2765
2762
|
if (isValidNativeCandidate(runtimeInstance)) return runtimeInstance;
|
|
@@ -2778,7 +2775,7 @@ function defineSetupInstanceMethod(target, methodName, handler) {
|
|
|
2778
2775
|
}
|
|
2779
2776
|
}
|
|
2780
2777
|
function ensureSetupContextInstance(target, runtime) {
|
|
2781
|
-
const maybeCached = target[
|
|
2778
|
+
const maybeCached = target[WEVU_SETUP_CONTEXT_INSTANCE_KEY];
|
|
2782
2779
|
if (maybeCached && typeof maybeCached === "object") return maybeCached;
|
|
2783
2780
|
const setupInstanceBridge = Object.create(null);
|
|
2784
2781
|
const resolveSetupBridgeOwner = (methodName) => {
|
|
@@ -2845,14 +2842,14 @@ function ensureSetupContextInstance(target, runtime) {
|
|
|
2845
2842
|
}
|
|
2846
2843
|
}));
|
|
2847
2844
|
try {
|
|
2848
|
-
Object.defineProperty(target,
|
|
2845
|
+
Object.defineProperty(target, WEVU_SETUP_CONTEXT_INSTANCE_KEY, {
|
|
2849
2846
|
value: setupInstance,
|
|
2850
2847
|
configurable: true,
|
|
2851
2848
|
enumerable: false,
|
|
2852
2849
|
writable: true
|
|
2853
2850
|
});
|
|
2854
2851
|
} catch (_unused3) {
|
|
2855
|
-
target[
|
|
2852
|
+
target[WEVU_SETUP_CONTEXT_INSTANCE_KEY] = setupInstance;
|
|
2856
2853
|
}
|
|
2857
2854
|
return setupInstance;
|
|
2858
2855
|
}
|
|
@@ -2864,9 +2861,10 @@ function bridgeRuntimeMethodsToTarget(target, runtime) {
|
|
|
2864
2861
|
for (const name of Object.keys(methods)) {
|
|
2865
2862
|
if (setupInstanceMethodNames.includes(name)) continue;
|
|
2866
2863
|
if (typeof target[name] !== "function") target[name] = function bridged(...args) {
|
|
2867
|
-
var
|
|
2868
|
-
const
|
|
2869
|
-
|
|
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);
|
|
2870
2868
|
};
|
|
2871
2869
|
}
|
|
2872
2870
|
} catch (_unused) {}
|
|
@@ -2894,22 +2892,22 @@ function runSetupFunction(setup, props, context) {
|
|
|
2894
2892
|
function runRuntimeSetupPhase(options) {
|
|
2895
2893
|
const { target, runtime, runtimeWithDefaults, runtimeState, runtimeProxy, setup, syncRuntimeProps, attachRuntimeProxyProps } = options;
|
|
2896
2894
|
const mpProperties = target.properties || {};
|
|
2897
|
-
const runtimeProps = runtimeState && typeof runtimeState === "object" ? runtimeState
|
|
2895
|
+
const runtimeProps = runtimeState && typeof runtimeState === "object" ? runtimeState[WEVU_PROPS_KEY] : void 0;
|
|
2898
2896
|
const props = runtimeProps && typeof runtimeProps === "object" ? runtimeProps : shallowReactive({});
|
|
2899
2897
|
syncRuntimeProps(props, mpProperties);
|
|
2900
2898
|
if (runtimeState && typeof runtimeState === "object") attachRuntimeProxyProps(runtimeState, props);
|
|
2901
2899
|
try {
|
|
2902
|
-
Object.defineProperty(target,
|
|
2900
|
+
Object.defineProperty(target, WEVU_PROPS_KEY, {
|
|
2903
2901
|
value: props,
|
|
2904
2902
|
configurable: true,
|
|
2905
2903
|
enumerable: false,
|
|
2906
2904
|
writable: false
|
|
2907
2905
|
});
|
|
2908
2906
|
} catch (_unused) {
|
|
2909
|
-
target
|
|
2907
|
+
target[WEVU_PROPS_KEY] = props;
|
|
2910
2908
|
}
|
|
2911
2909
|
const attrs = shallowReactive(Object.create(null));
|
|
2912
|
-
const declaredPropKeys = new Set(Array.isArray(target
|
|
2910
|
+
const declaredPropKeys = new Set(Array.isArray(target[WEVU_PROP_KEYS_KEY]) ? target[WEVU_PROP_KEYS_KEY] : []);
|
|
2913
2911
|
const hasRuntimeStateKey = (key) => {
|
|
2914
2912
|
return runtimeState != null && typeof runtimeState === "object" && Object.hasOwn(runtimeState, key);
|
|
2915
2913
|
};
|
|
@@ -2924,14 +2922,14 @@ function runRuntimeSetupPhase(options) {
|
|
|
2924
2922
|
};
|
|
2925
2923
|
syncAttrsFromProperties();
|
|
2926
2924
|
try {
|
|
2927
|
-
Object.defineProperty(target,
|
|
2925
|
+
Object.defineProperty(target, WEVU_ATTRS_KEY, {
|
|
2928
2926
|
value: attrs,
|
|
2929
2927
|
configurable: true,
|
|
2930
2928
|
enumerable: false,
|
|
2931
2929
|
writable: false
|
|
2932
2930
|
});
|
|
2933
2931
|
} catch (_unused2) {
|
|
2934
|
-
target
|
|
2932
|
+
target[WEVU_ATTRS_KEY] = attrs;
|
|
2935
2933
|
}
|
|
2936
2934
|
const setupInstance = ensureSetupContextInstance(target, runtimeWithDefaults);
|
|
2937
2935
|
const context = safeMarkNoSetData({
|
|
@@ -2947,13 +2945,13 @@ function runRuntimeSetupPhase(options) {
|
|
|
2947
2945
|
setupInstance.triggerEvent(event, detail, options);
|
|
2948
2946
|
},
|
|
2949
2947
|
expose: (exposed) => {
|
|
2950
|
-
target
|
|
2948
|
+
target[WEVU_EXPOSED_KEY] = exposed;
|
|
2951
2949
|
},
|
|
2952
2950
|
attrs,
|
|
2953
2951
|
slots: createSetupSlotsFallback()
|
|
2954
2952
|
});
|
|
2955
2953
|
const instanceScope = effectScope(true);
|
|
2956
|
-
target
|
|
2954
|
+
target[WEVU_EFFECT_SCOPE_KEY] = instanceScope;
|
|
2957
2955
|
setCurrentInstance(target);
|
|
2958
2956
|
setCurrentSetupContext(context);
|
|
2959
2957
|
try {
|
|
@@ -2978,13 +2976,13 @@ function runRuntimeSetupPhase(options) {
|
|
|
2978
2976
|
configurable: true,
|
|
2979
2977
|
enumerable: false,
|
|
2980
2978
|
get() {
|
|
2981
|
-
const propsSource = runtimeRawState
|
|
2979
|
+
const propsSource = runtimeRawState[WEVU_PROPS_KEY];
|
|
2982
2980
|
if (propsSource && typeof propsSource === "object" && Object.hasOwn(propsSource, key)) return propsSource[key];
|
|
2983
2981
|
return fallbackValue;
|
|
2984
2982
|
},
|
|
2985
2983
|
set(next) {
|
|
2986
2984
|
fallbackValue = next;
|
|
2987
|
-
const propsSource = runtimeRawState
|
|
2985
|
+
const propsSource = runtimeRawState[WEVU_PROPS_KEY];
|
|
2988
2986
|
if (!propsSource || typeof propsSource !== "object") return;
|
|
2989
2987
|
try {
|
|
2990
2988
|
propsSource[key] = next;
|
|
@@ -3006,7 +3004,7 @@ function runRuntimeSetupPhase(options) {
|
|
|
3006
3004
|
}
|
|
3007
3005
|
} catch (error) {
|
|
3008
3006
|
instanceScope.stop();
|
|
3009
|
-
target
|
|
3007
|
+
target[WEVU_EFFECT_SCOPE_KEY] = void 0;
|
|
3010
3008
|
throw error;
|
|
3011
3009
|
} finally {
|
|
3012
3010
|
setCurrentSetupContext(void 0);
|
|
@@ -3015,41 +3013,40 @@ function runRuntimeSetupPhase(options) {
|
|
|
3015
3013
|
}
|
|
3016
3014
|
//#endregion
|
|
3017
3015
|
//#region src/runtime/register/runtimeInstance/utils.ts
|
|
3018
|
-
const SETUP_CONTEXT_INSTANCE_KEY = "__wevuSetupContextInstance";
|
|
3019
3016
|
function attachRuntimeProxyProps(state, props) {
|
|
3020
3017
|
try {
|
|
3021
|
-
Object.defineProperty(state,
|
|
3018
|
+
Object.defineProperty(state, WEVU_PROPS_KEY, {
|
|
3022
3019
|
value: props,
|
|
3023
3020
|
configurable: true,
|
|
3024
3021
|
enumerable: false,
|
|
3025
3022
|
writable: false
|
|
3026
3023
|
});
|
|
3027
3024
|
} catch (_unused) {
|
|
3028
|
-
state
|
|
3025
|
+
state[WEVU_PROPS_KEY] = props;
|
|
3029
3026
|
}
|
|
3030
3027
|
}
|
|
3031
3028
|
function attachNativeInstanceRef(state, instance) {
|
|
3032
3029
|
try {
|
|
3033
|
-
Object.defineProperty(state,
|
|
3030
|
+
Object.defineProperty(state, WEVU_NATIVE_INSTANCE_KEY, {
|
|
3034
3031
|
value: instance,
|
|
3035
3032
|
configurable: true,
|
|
3036
3033
|
enumerable: false,
|
|
3037
3034
|
writable: true
|
|
3038
3035
|
});
|
|
3039
3036
|
} catch (_unused2) {
|
|
3040
|
-
state
|
|
3037
|
+
state[WEVU_NATIVE_INSTANCE_KEY] = instance;
|
|
3041
3038
|
}
|
|
3042
3039
|
}
|
|
3043
3040
|
function attachRuntimeRef(state, runtime) {
|
|
3044
3041
|
try {
|
|
3045
|
-
Object.defineProperty(state,
|
|
3042
|
+
Object.defineProperty(state, WEVU_RUNTIME_KEY, {
|
|
3046
3043
|
value: runtime,
|
|
3047
3044
|
configurable: true,
|
|
3048
3045
|
enumerable: false,
|
|
3049
3046
|
writable: true
|
|
3050
3047
|
});
|
|
3051
3048
|
} catch (_unused3) {
|
|
3052
|
-
state
|
|
3049
|
+
state[WEVU_RUNTIME_KEY] = runtime;
|
|
3053
3050
|
}
|
|
3054
3051
|
}
|
|
3055
3052
|
function attachRuntimeInstance(runtime, instance) {
|
|
@@ -3067,7 +3064,7 @@ function attachRuntimeInstance(runtime, instance) {
|
|
|
3067
3064
|
}
|
|
3068
3065
|
}
|
|
3069
3066
|
function resolveNativeSetData(instance) {
|
|
3070
|
-
const setupInstance = instance[
|
|
3067
|
+
const setupInstance = instance[WEVU_SETUP_CONTEXT_INSTANCE_KEY];
|
|
3071
3068
|
const setupOverride = setupInstance && typeof setupInstance.setData === "function" ? setupInstance.setData : void 0;
|
|
3072
3069
|
if (typeof setupOverride === "function" && !isNativeBridgeMethod(setupOverride)) return setupOverride;
|
|
3073
3070
|
const candidate = instance.setData;
|
|
@@ -3243,13 +3240,13 @@ function registerWatches(runtime, watchMap, instance) {
|
|
|
3243
3240
|
//#region src/runtime/register/runtimeInstance.ts
|
|
3244
3241
|
function attachPageLayoutSetter(target) {
|
|
3245
3242
|
if (typeof target.route !== "string" || !target.route) return;
|
|
3246
|
-
target
|
|
3243
|
+
target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
|
|
3247
3244
|
var _target$__wevu;
|
|
3248
3245
|
const runtimeState = (_target$__wevu = target.__wevu) === null || _target$__wevu === void 0 ? void 0 : _target$__wevu.state;
|
|
3249
3246
|
if (!runtimeState || typeof runtimeState !== "object") return;
|
|
3250
|
-
runtimeState
|
|
3247
|
+
runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout);
|
|
3251
3248
|
const nextProps = layout === false ? {} : props !== null && props !== void 0 ? props : {};
|
|
3252
|
-
runtimeState
|
|
3249
|
+
runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps;
|
|
3253
3250
|
syncRuntimePageLayoutState(target, layout, nextProps);
|
|
3254
3251
|
};
|
|
3255
3252
|
}
|
|
@@ -3260,7 +3257,7 @@ function attachPageLayoutSetter(target) {
|
|
|
3260
3257
|
function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
3261
3258
|
var _wevuSetDataOptions, _wevuSetDataOptions2, _runtime$proxy, _runtime$state, _computed, _runtime$methods, _watch, _bindModel, _snapshot, _unmount;
|
|
3262
3259
|
if (target.__wevu) return target.__wevu;
|
|
3263
|
-
target
|
|
3260
|
+
target[WEVU_RUNTIME_APP_KEY] = runtimeApp;
|
|
3264
3261
|
safeMarkNoSetData(target);
|
|
3265
3262
|
const ownerId = allocateOwnerId();
|
|
3266
3263
|
const suspendWhenHidden = Boolean(runtimeApp === null || runtimeApp === void 0 || (_wevuSetDataOptions = runtimeApp.__wevuSetDataOptions) === null || _wevuSetDataOptions === void 0 ? void 0 : _wevuSetDataOptions.suspendWhenHidden);
|
|
@@ -3269,8 +3266,8 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3269
3266
|
option: runtimeApp === null || runtimeApp === void 0 || (_wevuSetDataOptions2 = runtimeApp.__wevuSetDataOptions) === null || _wevuSetDataOptions2 === void 0 ? void 0 : _wevuSetDataOptions2.highFrequencyWarning,
|
|
3270
3267
|
targetLabel,
|
|
3271
3268
|
isInPageScrollHook: () => {
|
|
3272
|
-
var
|
|
3273
|
-
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;
|
|
3274
3271
|
}
|
|
3275
3272
|
});
|
|
3276
3273
|
const createDeferredAdapter = (instance) => {
|
|
@@ -3311,10 +3308,10 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3311
3308
|
...payload
|
|
3312
3309
|
});
|
|
3313
3310
|
const refreshOwnerSnapshot = () => {
|
|
3314
|
-
var
|
|
3311
|
+
var _WEVU_PROPS_KEY;
|
|
3315
3312
|
if (!runtimeRef) return;
|
|
3316
3313
|
const snapshot = resolveOwnerSnapshot(runtimeRef);
|
|
3317
|
-
const propsSource = (
|
|
3314
|
+
const propsSource = (_WEVU_PROPS_KEY = target[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : target.properties;
|
|
3318
3315
|
if (propsSource && typeof propsSource === "object") for (const [key, value] of Object.entries(propsSource)) snapshot[key] = value;
|
|
3319
3316
|
updateOwnerSnapshot(ownerId, snapshot, runtimeRef.proxy);
|
|
3320
3317
|
};
|
|
@@ -3386,7 +3383,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3386
3383
|
writable: true
|
|
3387
3384
|
});
|
|
3388
3385
|
}
|
|
3389
|
-
Object.defineProperty(target,
|
|
3386
|
+
Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {
|
|
3390
3387
|
value: runtimeWithDefaults,
|
|
3391
3388
|
configurable: true,
|
|
3392
3389
|
enumerable: false,
|
|
@@ -3397,7 +3394,7 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
|
3397
3394
|
attachOwnerSnapshot(target, runtimeWithDefaults, ownerId);
|
|
3398
3395
|
if (watchMap) {
|
|
3399
3396
|
const stops = registerWatches(runtimeWithDefaults, watchMap, target);
|
|
3400
|
-
if (stops.length) target
|
|
3397
|
+
if (stops.length) target[WEVU_WATCH_STOPS_KEY] = stops;
|
|
3401
3398
|
}
|
|
3402
3399
|
if (setup) {
|
|
3403
3400
|
var _runtimeWithSyncFlush;
|
|
@@ -3431,30 +3428,30 @@ function setRuntimeSetDataVisibility(target, visible) {
|
|
|
3431
3428
|
* @internal
|
|
3432
3429
|
*/
|
|
3433
3430
|
function teardownRuntimeInstance(target) {
|
|
3434
|
-
var _target$
|
|
3431
|
+
var _target$WEVU_EFFECT_S;
|
|
3435
3432
|
const runtime = target.__wevu;
|
|
3436
|
-
const ownerId = target
|
|
3433
|
+
const ownerId = target[WEVU_SLOT_OWNER_ID_KEY];
|
|
3437
3434
|
if (ownerId) removeOwner(ownerId);
|
|
3438
3435
|
clearTemplateRefs(target);
|
|
3439
|
-
if (runtime && target
|
|
3440
|
-
if (target
|
|
3441
|
-
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];
|
|
3442
3439
|
if (Array.isArray(stops)) for (const stop of stops) try {
|
|
3443
3440
|
stop();
|
|
3444
3441
|
} catch (_unused2) {}
|
|
3445
|
-
target
|
|
3446
|
-
(_target$
|
|
3447
|
-
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;
|
|
3448
3445
|
if (runtime) runtime.unmount();
|
|
3449
3446
|
delete target.__wevu;
|
|
3450
|
-
if (
|
|
3447
|
+
if (WEVU_PUBLIC_RUNTIME_KEY in target) delete target[WEVU_PUBLIC_RUNTIME_KEY];
|
|
3451
3448
|
}
|
|
3452
3449
|
//#endregion
|
|
3453
3450
|
//#region src/runtime/register/app.ts
|
|
3454
3451
|
const APP_GLOBAL_LISTENER_STORE_KEY = "__wevuAppGlobalListeners";
|
|
3455
3452
|
const MEMORY_WARNING_LISTENER_KEY = "__wevuOnMemoryWarningListener";
|
|
3456
3453
|
function bindMemoryWarningListener(target) {
|
|
3457
|
-
const hooks = target
|
|
3454
|
+
const hooks = target[WEVU_HOOKS_KEY];
|
|
3458
3455
|
const hasMemoryWarningHook = Boolean(hooks === null || hooks === void 0 ? void 0 : hooks.onMemoryWarning);
|
|
3459
3456
|
const wxGlobal = getMiniProgramGlobalObject();
|
|
3460
3457
|
const onMemoryWarning = wxGlobal === null || wxGlobal === void 0 ? void 0 : wxGlobal.onMemoryWarning;
|
|
@@ -3477,7 +3474,7 @@ function bindMemoryWarningListener(target) {
|
|
|
3477
3474
|
function bindAppGlobalListener(target, options) {
|
|
3478
3475
|
var _ref, _ref$APP_GLOBAL_LISTE;
|
|
3479
3476
|
const { hookName, onApiName, offApiName, userHandler } = options;
|
|
3480
|
-
const hooks = target
|
|
3477
|
+
const hooks = target[WEVU_HOOKS_KEY];
|
|
3481
3478
|
const hasHook = Boolean(hooks === null || hooks === void 0 ? void 0 : hooks[hookName]);
|
|
3482
3479
|
const wxGlobal = getMiniProgramGlobalObject();
|
|
3483
3480
|
const onApi = wxGlobal === null || wxGlobal === void 0 ? void 0 : wxGlobal[onApiName];
|
|
@@ -3535,10 +3532,10 @@ function registerApp(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
3535
3532
|
const methodNames = Object.keys(methods !== null && methods !== void 0 ? methods : {});
|
|
3536
3533
|
const appOptions = { ...mpOptions };
|
|
3537
3534
|
appOptions.globalData = (_appOptions$globalDat = appOptions.globalData) !== null && _appOptions$globalDat !== void 0 ? _appOptions$globalDat : {};
|
|
3538
|
-
if (!appOptions
|
|
3535
|
+
if (!appOptions[WEVU_INLINE_HANDLER]) appOptions[WEVU_INLINE_HANDLER] = function __weapp_vite_inline(event) {
|
|
3539
3536
|
var _runtime$proxy, _runtime$methods;
|
|
3540
3537
|
const runtime = this.__wevu;
|
|
3541
|
-
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]);
|
|
3542
3539
|
};
|
|
3543
3540
|
const userOnLaunch = appOptions.onLaunch;
|
|
3544
3541
|
const userOnError = appOptions.onError;
|
|
@@ -3546,7 +3543,7 @@ function registerApp(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
3546
3543
|
const userOnUnhandledRejection = appOptions.onUnhandledRejection;
|
|
3547
3544
|
const userOnThemeChange = appOptions.onThemeChange;
|
|
3548
3545
|
appOptions.onLaunch = function onLaunch(...args) {
|
|
3549
|
-
this
|
|
3546
|
+
this[WEVU_IS_APP_INSTANCE_KEY] = true;
|
|
3550
3547
|
mountRuntimeInstance(this, runtimeApp, watch, setup);
|
|
3551
3548
|
bindMemoryWarningListener(this);
|
|
3552
3549
|
bindAppGlobalListeners(this, {
|
|
@@ -3650,12 +3647,12 @@ function attachOptionalPageLifecycleHooks(pageLifecycleHooks, options) {
|
|
|
3650
3647
|
});
|
|
3651
3648
|
};
|
|
3652
3649
|
if (enableOnRouteDone) pageLifecycleHooks.onRouteDone = function onRouteDone(...args) {
|
|
3653
|
-
if (this
|
|
3654
|
-
this
|
|
3650
|
+
if (this[WEVU_ROUTE_DONE_IN_TICK_KEY]) return;
|
|
3651
|
+
this[WEVU_ROUTE_DONE_IN_TICK_KEY] = true;
|
|
3655
3652
|
Promise.resolve().then(() => {
|
|
3656
|
-
this
|
|
3653
|
+
this[WEVU_ROUTE_DONE_IN_TICK_KEY] = false;
|
|
3657
3654
|
});
|
|
3658
|
-
this
|
|
3655
|
+
this[WEVU_ROUTE_DONE_CALLED_KEY] = true;
|
|
3659
3656
|
callHookList(this, "onRouteDone", args);
|
|
3660
3657
|
if (!hasHook(this, "onRouteDone")) return effectiveOnRouteDone.apply(this, args);
|
|
3661
3658
|
};
|
|
@@ -3689,8 +3686,8 @@ function createPageLifecycleHooks(options) {
|
|
|
3689
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;
|
|
3690
3687
|
const pageLifecycleHooks = {
|
|
3691
3688
|
onLoad(...args) {
|
|
3692
|
-
if (this
|
|
3693
|
-
this
|
|
3689
|
+
if (this[WEVU_ON_LOAD_CALLED_KEY]) return;
|
|
3690
|
+
this[WEVU_ON_LOAD_CALLED_KEY] = true;
|
|
3694
3691
|
mountRuntimeInstance(this, runtimeApp, watch, setup);
|
|
3695
3692
|
enableDeferredSetData(this);
|
|
3696
3693
|
if (isPage) ensurePageShareMenus({
|
|
@@ -3709,12 +3706,12 @@ function createPageLifecycleHooks(options) {
|
|
|
3709
3706
|
if (isPage) {
|
|
3710
3707
|
ensureWxPatched();
|
|
3711
3708
|
bindCurrentPageInstance(this);
|
|
3712
|
-
if (!this
|
|
3709
|
+
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
3713
3710
|
ensurePageShareMenus({
|
|
3714
3711
|
enableOnShareAppMessage,
|
|
3715
3712
|
enableOnShareTimeline
|
|
3716
3713
|
});
|
|
3717
|
-
this
|
|
3714
|
+
this[WEVU_ROUTE_DONE_CALLED_KEY] = false;
|
|
3718
3715
|
}
|
|
3719
3716
|
setRuntimeSetDataVisibility(this, true);
|
|
3720
3717
|
callHookList(this, "onShow", args);
|
|
@@ -3728,18 +3725,18 @@ function createPageLifecycleHooks(options) {
|
|
|
3728
3725
|
},
|
|
3729
3726
|
onReady(...args) {
|
|
3730
3727
|
if (isPage) {
|
|
3731
|
-
if (!this
|
|
3728
|
+
if (!this[WEVU_ON_LOAD_CALLED_KEY]) pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this));
|
|
3732
3729
|
ensurePageShareMenus({
|
|
3733
3730
|
enableOnShareAppMessage,
|
|
3734
3731
|
enableOnShareTimeline
|
|
3735
3732
|
});
|
|
3736
3733
|
}
|
|
3737
|
-
if (!this
|
|
3738
|
-
this
|
|
3734
|
+
if (!this[WEVU_READY_CALLED_KEY]) {
|
|
3735
|
+
this[WEVU_READY_CALLED_KEY] = true;
|
|
3739
3736
|
if (isPage && enableOnRouteDone && enableOnRouteDoneFallback) {
|
|
3740
3737
|
const current = this;
|
|
3741
3738
|
setTimeout(() => {
|
|
3742
|
-
if (!current
|
|
3739
|
+
if (!current[WEVU_ROUTE_DONE_CALLED_KEY]) {
|
|
3743
3740
|
var _pageLifecycleHooks$o;
|
|
3744
3741
|
(_pageLifecycleHooks$o = pageLifecycleHooks.onRouteDone) === null || _pageLifecycleHooks$o === void 0 || _pageLifecycleHooks$o.call(current);
|
|
3745
3742
|
}
|
|
@@ -3784,12 +3781,12 @@ function createPageLifecycleHooks(options) {
|
|
|
3784
3781
|
function createComponentMethods(options) {
|
|
3785
3782
|
const { userMethods, runtimeMethods } = options;
|
|
3786
3783
|
const finalMethods = { ...userMethods };
|
|
3787
|
-
if (!finalMethods
|
|
3784
|
+
if (!finalMethods[WEVU_INLINE_HANDLER]) finalMethods[WEVU_INLINE_HANDLER] = function __weapp_vite_inline(event) {
|
|
3788
3785
|
var _runtime$proxy, _runtime$methods;
|
|
3789
3786
|
const runtime = this.__wevu;
|
|
3790
|
-
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]);
|
|
3791
3788
|
};
|
|
3792
|
-
if (!finalMethods
|
|
3789
|
+
if (!finalMethods[WEVU_MODEL_HANDLER]) finalMethods[WEVU_MODEL_HANDLER] = function __weapp_vite_model(event) {
|
|
3793
3790
|
var _event$currentTarget$, _event$currentTarget, _event$target;
|
|
3794
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;
|
|
3795
3792
|
if (typeof path !== "string" || !path) return;
|
|
@@ -3800,13 +3797,13 @@ function createComponentMethods(options) {
|
|
|
3800
3797
|
runtime.bindModel(path).update(value);
|
|
3801
3798
|
} catch (_unused) {}
|
|
3802
3799
|
};
|
|
3803
|
-
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];
|
|
3804
3801
|
const methodNames = Object.keys(runtimeMethods !== null && runtimeMethods !== void 0 ? runtimeMethods : {});
|
|
3805
3802
|
function resolveRuntime(instance) {
|
|
3806
3803
|
const directRuntime = instance.__wevu;
|
|
3807
3804
|
if (directRuntime) return directRuntime;
|
|
3808
3805
|
const runtimeState = instance.$state;
|
|
3809
|
-
if (runtimeState && typeof runtimeState === "object") return runtimeState
|
|
3806
|
+
if (runtimeState && typeof runtimeState === "object") return runtimeState[WEVU_RUNTIME_KEY];
|
|
3810
3807
|
}
|
|
3811
3808
|
function syncRuntimeNativeInstance(runtime, instance) {
|
|
3812
3809
|
if ((runtime === null || runtime === void 0 ? void 0 : runtime.proxy) === instance) return;
|
|
@@ -3823,18 +3820,18 @@ function createComponentMethods(options) {
|
|
|
3823
3820
|
if (!runtimeState || typeof runtimeState !== "object") return;
|
|
3824
3821
|
if (instance.$state === runtimeState) return;
|
|
3825
3822
|
try {
|
|
3826
|
-
Object.defineProperty(runtimeState,
|
|
3823
|
+
Object.defineProperty(runtimeState, WEVU_NATIVE_INSTANCE_KEY, {
|
|
3827
3824
|
value: instance,
|
|
3828
3825
|
configurable: true,
|
|
3829
3826
|
enumerable: false,
|
|
3830
3827
|
writable: true
|
|
3831
3828
|
});
|
|
3832
3829
|
} catch (_unused2) {
|
|
3833
|
-
runtimeState
|
|
3830
|
+
runtimeState[WEVU_NATIVE_INSTANCE_KEY] = instance;
|
|
3834
3831
|
}
|
|
3835
3832
|
}
|
|
3836
3833
|
for (const methodName of methodNames) {
|
|
3837
|
-
if (methodName.startsWith(
|
|
3834
|
+
if (methodName === WEVU_INLINE_MAP_KEY || methodName.startsWith(WEVU_RESERVED_METHOD_PREFIX)) continue;
|
|
3838
3835
|
const userMethod = finalMethods[methodName];
|
|
3839
3836
|
finalMethods[methodName] = function componentMethod(...args) {
|
|
3840
3837
|
var _runtime$methods2;
|
|
@@ -4023,12 +4020,12 @@ function prepareComponentOptions(mpOptions) {
|
|
|
4023
4020
|
//#endregion
|
|
4024
4021
|
//#region src/runtime/register/snapshot.ts
|
|
4025
4022
|
function refreshOwnerSnapshotFromInstance(instance) {
|
|
4026
|
-
var
|
|
4023
|
+
var _WEVU_PROPS_KEY;
|
|
4027
4024
|
const runtime = instance.__wevu;
|
|
4028
|
-
const ownerId = instance
|
|
4025
|
+
const ownerId = instance[WEVU_SLOT_OWNER_ID_KEY];
|
|
4029
4026
|
if (!runtime || !ownerId || typeof runtime.snapshot !== "function") return;
|
|
4030
4027
|
const snapshot = runtime.snapshot();
|
|
4031
|
-
const propsSource = (
|
|
4028
|
+
const propsSource = (_WEVU_PROPS_KEY = instance[WEVU_PROPS_KEY]) !== null && _WEVU_PROPS_KEY !== void 0 ? _WEVU_PROPS_KEY : instance.properties;
|
|
4032
4029
|
if (propsSource && typeof propsSource === "object") for (const [key, value] of Object.entries(propsSource)) snapshot[key] = value;
|
|
4033
4030
|
updateOwnerSnapshot(ownerId, snapshot, runtime.proxy);
|
|
4034
4031
|
}
|
|
@@ -4036,23 +4033,22 @@ function refreshOwnerSnapshotFromInstance(instance) {
|
|
|
4036
4033
|
//#region src/runtime/register/component/props.ts
|
|
4037
4034
|
function createPropsSync(options) {
|
|
4038
4035
|
const { restOptions, userObservers } = options;
|
|
4039
|
-
const PENDING_PROP_VALUES_KEY = "__wevuPendingPropValues";
|
|
4040
4036
|
const propKeys = restOptions.properties && typeof restOptions.properties === "object" ? Object.keys(restOptions.properties) : [];
|
|
4041
4037
|
const propKeySet = new Set(propKeys);
|
|
4042
4038
|
const attachWevuPropKeys = (instance) => {
|
|
4043
4039
|
try {
|
|
4044
|
-
Object.defineProperty(instance,
|
|
4040
|
+
Object.defineProperty(instance, WEVU_PROP_KEYS_KEY, {
|
|
4045
4041
|
value: propKeys,
|
|
4046
4042
|
configurable: true,
|
|
4047
4043
|
enumerable: false,
|
|
4048
4044
|
writable: false
|
|
4049
4045
|
});
|
|
4050
4046
|
} catch (_unused) {
|
|
4051
|
-
instance
|
|
4047
|
+
instance[WEVU_PROP_KEYS_KEY] = propKeys;
|
|
4052
4048
|
}
|
|
4053
4049
|
};
|
|
4054
4050
|
const syncWevuAttrsFromInstance = (instance) => {
|
|
4055
|
-
const attrsProxy = instance
|
|
4051
|
+
const attrsProxy = instance[WEVU_ATTRS_KEY];
|
|
4056
4052
|
if (!attrsProxy || typeof attrsProxy !== "object") return;
|
|
4057
4053
|
const hasRuntimeStateKey = (key) => {
|
|
4058
4054
|
var _wevu;
|
|
@@ -4078,9 +4074,9 @@ function createPropsSync(options) {
|
|
|
4078
4074
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4079
4075
|
};
|
|
4080
4076
|
const syncWevuPropsFromInstance = (instance) => {
|
|
4081
|
-
const propsProxy = instance
|
|
4077
|
+
const propsProxy = instance[WEVU_PROPS_KEY];
|
|
4082
4078
|
const properties = instance.properties;
|
|
4083
|
-
const pendingPropValues = instance[
|
|
4079
|
+
const pendingPropValues = instance[WEVU_PENDING_PROP_VALUES_KEY];
|
|
4084
4080
|
if (propsProxy && typeof propsProxy === "object" && properties && typeof properties === "object") {
|
|
4085
4081
|
const next = properties;
|
|
4086
4082
|
const currentKeys = Object.keys(propsProxy);
|
|
@@ -4100,17 +4096,17 @@ function createPropsSync(options) {
|
|
|
4100
4096
|
}
|
|
4101
4097
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4102
4098
|
}
|
|
4103
|
-
if (pendingPropValues) delete instance[
|
|
4099
|
+
if (pendingPropValues) delete instance[WEVU_PENDING_PROP_VALUES_KEY];
|
|
4104
4100
|
syncWevuAttrsFromInstance(instance);
|
|
4105
4101
|
};
|
|
4106
4102
|
const syncWevuPropValue = (instance, key, value) => {
|
|
4107
|
-
var _ref, _ref$
|
|
4108
|
-
const propsProxy = instance
|
|
4103
|
+
var _ref, _ref$WEVU_PENDING_PRO;
|
|
4104
|
+
const propsProxy = instance[WEVU_PROPS_KEY];
|
|
4109
4105
|
if (!propsProxy || typeof propsProxy !== "object") return;
|
|
4110
4106
|
try {
|
|
4111
4107
|
propsProxy[key] = value;
|
|
4112
4108
|
} catch (_unused7) {}
|
|
4113
|
-
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);
|
|
4114
4110
|
pendingPropValues[key] = value;
|
|
4115
4111
|
refreshOwnerSnapshotFromInstance(instance);
|
|
4116
4112
|
syncWevuAttrsFromInstance(instance);
|
|
@@ -4142,7 +4138,6 @@ function createPropsSync(options) {
|
|
|
4142
4138
|
//#endregion
|
|
4143
4139
|
//#region src/runtime/layoutBridge.ts
|
|
4144
4140
|
const pageLayoutBridges = /* @__PURE__ */ new Map();
|
|
4145
|
-
const layoutBridgePageKeys = "__wevuLayoutBridgePageKeys";
|
|
4146
4141
|
const LEADING_SLASH_RE = /^\/+/;
|
|
4147
4142
|
function resolveCurrentPageInstance() {
|
|
4148
4143
|
const getCurrentPagesFn = globalThis.getCurrentPages;
|
|
@@ -4168,13 +4163,13 @@ function resolvePageFromContext(context) {
|
|
|
4168
4163
|
return resolveCurrentPageInstance();
|
|
4169
4164
|
}
|
|
4170
4165
|
function resolveNativeLayoutContext(context) {
|
|
4171
|
-
var _context$
|
|
4166
|
+
var _context$WEVU_PUBLIC_, _context$$state;
|
|
4172
4167
|
if (!context || typeof context !== "object") return;
|
|
4173
|
-
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];
|
|
4174
4169
|
if (runtimeNativeInstance && typeof runtimeNativeInstance === "object") return runtimeNativeInstance;
|
|
4175
|
-
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];
|
|
4176
4171
|
if (stateNativeInstance && typeof stateNativeInstance === "object") return stateNativeInstance;
|
|
4177
|
-
if (context
|
|
4172
|
+
if (context[WEVU_NATIVE_INSTANCE_KEY] && typeof context[WEVU_NATIVE_INSTANCE_KEY] === "object") return context[WEVU_NATIVE_INSTANCE_KEY];
|
|
4178
4173
|
return context;
|
|
4179
4174
|
}
|
|
4180
4175
|
function resolveHostEntry(entry) {
|
|
@@ -4196,10 +4191,10 @@ function safeSelectComponent(target, selector) {
|
|
|
4196
4191
|
}
|
|
4197
4192
|
}
|
|
4198
4193
|
function resolveDeclaredLayoutHostFromRefs(binding, context) {
|
|
4199
|
-
var _ref, _context$
|
|
4194
|
+
var _ref, _ref2, _context$WEVU_PUBLIC_2, _context$WEVU_PUBLIC_3, _context$__wevu, _context$$state2, _refMap$get$value, _refMap$get;
|
|
4200
4195
|
if (!binding.refName) return null;
|
|
4201
4196
|
const refMap = getTemplateRefMap(context);
|
|
4202
|
-
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;
|
|
4203
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];
|
|
4204
4199
|
if (Array.isArray(refValue)) {
|
|
4205
4200
|
var _refValue$;
|
|
@@ -4213,10 +4208,10 @@ function createDeclaredLayoutHostBridge(bindings, context) {
|
|
|
4213
4208
|
const binding = findLayoutHostBinding(bindings, key);
|
|
4214
4209
|
if (!binding) return null;
|
|
4215
4210
|
if (binding.kind === "component" || !binding.kind) {
|
|
4216
|
-
var
|
|
4211
|
+
var _ref3, _safeSelectComponent;
|
|
4217
4212
|
const cachedHost = resolveDeclaredLayoutHostFromRefs(binding, context);
|
|
4218
4213
|
if (cachedHost) return cachedHost;
|
|
4219
|
-
return (
|
|
4214
|
+
return (_ref3 = (_safeSelectComponent = safeSelectComponent(nativeContext, binding.selector)) !== null && _safeSelectComponent !== void 0 ? _safeSelectComponent : safeSelectComponent(resolveCurrentPageInstance(), binding.selector)) !== null && _ref3 !== void 0 ? _ref3 : null;
|
|
4220
4215
|
}
|
|
4221
4216
|
return null;
|
|
4222
4217
|
} });
|
|
@@ -4235,17 +4230,17 @@ function registerPageLayoutBridge(selectors, context) {
|
|
|
4235
4230
|
for (const selector of normalizeSelectors(selectors)) registry.set(selector, bridgeContext);
|
|
4236
4231
|
pageLayoutBridges.set(pageKey, registry);
|
|
4237
4232
|
}
|
|
4238
|
-
bridgeContext[
|
|
4233
|
+
bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS] = pageKeys;
|
|
4239
4234
|
return true;
|
|
4240
4235
|
}
|
|
4241
4236
|
/**
|
|
4242
4237
|
* 移除当前页面的 layout bridge 注册。
|
|
4243
4238
|
*/
|
|
4244
4239
|
function unregisterPageLayoutBridge(selectors, context) {
|
|
4245
|
-
var _bridgeContext$
|
|
4240
|
+
var _bridgeContext$WEVU_L;
|
|
4246
4241
|
const bridgeContext = context !== null && context !== void 0 ? context : getCurrentInstance();
|
|
4247
4242
|
const page = resolvePageFromContext(bridgeContext);
|
|
4248
|
-
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);
|
|
4249
4244
|
if (!bridgeContext || !Array.isArray(pageKeys) || pageKeys.length === 0) return false;
|
|
4250
4245
|
let removed = false;
|
|
4251
4246
|
for (const pageKey of pageKeys) {
|
|
@@ -4257,19 +4252,19 @@ function unregisterPageLayoutBridge(selectors, context) {
|
|
|
4257
4252
|
}
|
|
4258
4253
|
if (registry.size === 0) pageLayoutBridges.delete(pageKey);
|
|
4259
4254
|
}
|
|
4260
|
-
delete bridgeContext[
|
|
4255
|
+
delete bridgeContext[WEVU_LAYOUT_BRIDGE_PAGE_KEYS];
|
|
4261
4256
|
return removed;
|
|
4262
4257
|
}
|
|
4263
4258
|
/**
|
|
4264
4259
|
* 解析当前页面已注册的 layout bridge,找不到时回退到传入上下文。
|
|
4265
4260
|
*/
|
|
4266
4261
|
function resolveLayoutBridge(selector, fallbackContext) {
|
|
4267
|
-
var _resolveCurrentPageIn,
|
|
4262
|
+
var _resolveCurrentPageIn, _ref4;
|
|
4268
4263
|
const bridgeContext = resolvePageKeys((_resolveCurrentPageIn = resolveCurrentPageInstance()) !== null && _resolveCurrentPageIn !== void 0 ? _resolveCurrentPageIn : resolvePageFromContext(fallbackContext)).map((pageKey) => {
|
|
4269
4264
|
var _pageLayoutBridges$ge2;
|
|
4270
4265
|
return (_pageLayoutBridges$ge2 = pageLayoutBridges.get(pageKey)) === null || _pageLayoutBridges$ge2 === void 0 ? void 0 : _pageLayoutBridges$ge2.get(selector);
|
|
4271
4266
|
}).find(Boolean);
|
|
4272
|
-
return (
|
|
4267
|
+
return (_ref4 = bridgeContext !== null && bridgeContext !== void 0 ? bridgeContext : fallbackContext) !== null && _ref4 !== void 0 ? _ref4 : getCurrentInstance();
|
|
4273
4268
|
}
|
|
4274
4269
|
/**
|
|
4275
4270
|
* 解析当前页面 layout 内通过指定 key 暴露的宿主实例。
|
|
@@ -4361,19 +4356,19 @@ function registerComponentDefinition(options) {
|
|
|
4361
4356
|
const pageShareMethodBridges = {};
|
|
4362
4357
|
const attachRuntimeLayoutHosts = (instance) => {
|
|
4363
4358
|
if (!Array.isArray(layoutHosts) || !layoutHosts.length) return;
|
|
4364
|
-
if (instance
|
|
4359
|
+
if (instance[WEVU_LAYOUT_HOST_BRIDGE_KEY]) return;
|
|
4365
4360
|
const bridge = registerRuntimeLayoutHosts(layoutHosts, instance);
|
|
4366
|
-
if (bridge) instance
|
|
4361
|
+
if (bridge) instance[WEVU_LAYOUT_HOST_BRIDGE_KEY] = bridge;
|
|
4367
4362
|
};
|
|
4368
4363
|
const attachPageLayoutSetter = (instance) => {
|
|
4369
4364
|
if (!isPage) return;
|
|
4370
|
-
instance
|
|
4365
|
+
instance[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
|
|
4371
4366
|
var _instance$__wevu;
|
|
4372
4367
|
const runtimeState = (_instance$__wevu = instance.__wevu) === null || _instance$__wevu === void 0 ? void 0 : _instance$__wevu.state;
|
|
4373
4368
|
if (!runtimeState || typeof runtimeState !== "object") return;
|
|
4374
|
-
runtimeState
|
|
4369
|
+
runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout);
|
|
4375
4370
|
const nextProps = layout === false ? {} : props !== null && props !== void 0 ? props : {};
|
|
4376
|
-
runtimeState
|
|
4371
|
+
runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps;
|
|
4377
4372
|
syncRuntimePageLayoutState(instance, layout, nextProps);
|
|
4378
4373
|
};
|
|
4379
4374
|
};
|
|
@@ -4397,7 +4392,7 @@ function registerComponentDefinition(options) {
|
|
|
4397
4392
|
...userLifetimes,
|
|
4398
4393
|
created: function created(...args) {
|
|
4399
4394
|
applyExtraInstanceFields(this);
|
|
4400
|
-
if (Array.isArray(templateRefs) && templateRefs.length) Object.defineProperty(this,
|
|
4395
|
+
if (Array.isArray(templateRefs) && templateRefs.length) Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {
|
|
4401
4396
|
value: templateRefs,
|
|
4402
4397
|
configurable: true,
|
|
4403
4398
|
enumerable: false,
|
|
@@ -4423,7 +4418,7 @@ function registerComponentDefinition(options) {
|
|
|
4423
4418
|
},
|
|
4424
4419
|
attached: function attached(...args) {
|
|
4425
4420
|
applyExtraInstanceFields(this);
|
|
4426
|
-
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, {
|
|
4427
4422
|
value: templateRefs,
|
|
4428
4423
|
configurable: true,
|
|
4429
4424
|
enumerable: false,
|
|
@@ -4449,8 +4444,8 @@ function registerComponentDefinition(options) {
|
|
|
4449
4444
|
if (typeof userLifetimes.ready === "function") userLifetimes.ready.apply(this, args);
|
|
4450
4445
|
return;
|
|
4451
4446
|
}
|
|
4452
|
-
if (!this
|
|
4453
|
-
this
|
|
4447
|
+
if (!this[WEVU_READY_CALLED_KEY]) {
|
|
4448
|
+
this[WEVU_READY_CALLED_KEY] = true;
|
|
4454
4449
|
syncWevuPropsFromInstance(this);
|
|
4455
4450
|
scheduleTemplateRefUpdate(this, () => {
|
|
4456
4451
|
callHookList(this, "onReady", args);
|
|
@@ -4468,9 +4463,9 @@ function registerComponentDefinition(options) {
|
|
|
4468
4463
|
return;
|
|
4469
4464
|
}
|
|
4470
4465
|
clearTemplateRefs(this);
|
|
4471
|
-
if (Array.isArray(layoutHosts) && layoutHosts.length && this
|
|
4472
|
-
unregisterRuntimeLayoutHosts(layoutHosts, this
|
|
4473
|
-
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];
|
|
4474
4469
|
}
|
|
4475
4470
|
teardownRuntimeInstance(this);
|
|
4476
4471
|
if (typeof userLifetimes.detached === "function") userLifetimes.detached.apply(this, args);
|
|
@@ -4551,7 +4546,7 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4551
4546
|
userOnAddToFavorites
|
|
4552
4547
|
});
|
|
4553
4548
|
const hasHook = (target, name) => {
|
|
4554
|
-
const hooks = target
|
|
4549
|
+
const hooks = target[WEVU_HOOKS_KEY];
|
|
4555
4550
|
if (!hooks) return false;
|
|
4556
4551
|
const entry = hooks[name];
|
|
4557
4552
|
if (!entry) return false;
|
|
@@ -4561,8 +4556,8 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
|
|
|
4561
4556
|
{
|
|
4562
4557
|
const userExport = restOptions.export;
|
|
4563
4558
|
restOptions.export = function __wevu_export() {
|
|
4564
|
-
var
|
|
4565
|
-
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 : {};
|
|
4566
4561
|
const base = typeof userExport === "function" ? userExport.call(this) : {};
|
|
4567
4562
|
if (base && typeof base === "object" && !Array.isArray(base)) return {
|
|
4568
4563
|
...exposed,
|
|
@@ -4713,6 +4708,7 @@ function createApp(options) {
|
|
|
4713
4708
|
//#endregion
|
|
4714
4709
|
//#region src/runtime/define/props.ts
|
|
4715
4710
|
const ALLOW_NULL_PROP_INPUT_KEY = "__wevu_allowNullPropInput";
|
|
4711
|
+
const PUBLIC_ALLOW_NULL_PROP_INPUT_KEY = "allowNullPropInput";
|
|
4716
4712
|
const NATIVE_PROPERTY_TYPE_MAP = new Map([
|
|
4717
4713
|
[String, String],
|
|
4718
4714
|
[Number, Number],
|
|
@@ -4762,18 +4758,62 @@ function appendOptionalType(target, candidate) {
|
|
|
4762
4758
|
optionalTypes.push(candidate);
|
|
4763
4759
|
target.optionalTypes = optionalTypes;
|
|
4764
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
|
+
}
|
|
4765
4804
|
function normalizeProps(baseOptions, props, explicitProperties) {
|
|
4766
|
-
|
|
4767
|
-
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;
|
|
4768
4808
|
const baseProperties = baseOptions.properties;
|
|
4769
4809
|
const resolvedExplicit = explicitProperties !== null && explicitProperties !== void 0 ? explicitProperties : baseProperties && typeof baseProperties === "object" ? baseProperties : void 0;
|
|
4770
4810
|
const attachInternalProps = (source) => {
|
|
4771
4811
|
const next = { ...source !== null && source !== void 0 ? source : {} };
|
|
4772
|
-
if (!Object.hasOwn(next,
|
|
4812
|
+
if (!Object.hasOwn(next, WEVU_SLOT_OWNER_ID_PROP)) next[WEVU_SLOT_OWNER_ID_PROP] = {
|
|
4773
4813
|
type: String,
|
|
4774
4814
|
value: ""
|
|
4775
4815
|
};
|
|
4776
|
-
if (!Object.hasOwn(next,
|
|
4816
|
+
if (!Object.hasOwn(next, WEVU_SLOT_SCOPE_KEY)) next[WEVU_SLOT_SCOPE_KEY] = {
|
|
4777
4817
|
type: null,
|
|
4778
4818
|
value: null
|
|
4779
4819
|
};
|
|
@@ -4781,9 +4821,10 @@ function normalizeProps(baseOptions, props, explicitProperties) {
|
|
|
4781
4821
|
};
|
|
4782
4822
|
if (resolvedExplicit || !props) {
|
|
4783
4823
|
const { properties: _ignored, ...rest } = normalizedBaseOptions;
|
|
4824
|
+
const normalizedExplicitProperties = resolvedExplicit ? allowNullPropInput ? normalizeExplicitProperties(resolvedExplicit, allowNullPropInput) : resolvedExplicit : void 0;
|
|
4784
4825
|
return {
|
|
4785
4826
|
...rest,
|
|
4786
|
-
properties: attachInternalProps(
|
|
4827
|
+
properties: attachInternalProps(normalizedExplicitProperties)
|
|
4787
4828
|
};
|
|
4788
4829
|
}
|
|
4789
4830
|
const properties = {};
|
|
@@ -4878,51 +4919,51 @@ function normalizeSlotBindings(value) {
|
|
|
4878
4919
|
}
|
|
4879
4920
|
function mergeSlotProps(instance, override) {
|
|
4880
4921
|
var _instance$properties, _instance$properties2;
|
|
4881
|
-
const scopeSource = Object.hasOwn(override !== null && override !== void 0 ? override : {},
|
|
4882
|
-
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];
|
|
4883
4924
|
const scope = normalizeSlotBindings(scopeSource);
|
|
4884
4925
|
const slotProps = normalizeSlotBindings(propsSource);
|
|
4885
4926
|
const merged = {
|
|
4886
4927
|
...scope,
|
|
4887
4928
|
...slotProps
|
|
4888
4929
|
};
|
|
4889
|
-
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 });
|
|
4890
4931
|
}
|
|
4891
4932
|
function createScopedSlotOptions(overrides) {
|
|
4892
4933
|
const baseOptions = {
|
|
4893
4934
|
properties: {
|
|
4894
|
-
|
|
4935
|
+
[WEVU_SLOT_OWNER_ID_KEY]: {
|
|
4895
4936
|
type: String,
|
|
4896
4937
|
value: ""
|
|
4897
4938
|
},
|
|
4898
|
-
|
|
4939
|
+
[WEVU_SLOT_PROPS_KEY]: {
|
|
4899
4940
|
type: null,
|
|
4900
4941
|
value: null,
|
|
4901
4942
|
observer(next) {
|
|
4902
|
-
mergeSlotProps(this, {
|
|
4943
|
+
mergeSlotProps(this, { [WEVU_SLOT_PROPS_KEY]: next });
|
|
4903
4944
|
}
|
|
4904
4945
|
},
|
|
4905
|
-
|
|
4946
|
+
[WEVU_SLOT_SCOPE_KEY]: {
|
|
4906
4947
|
type: null,
|
|
4907
4948
|
value: null,
|
|
4908
4949
|
observer(next) {
|
|
4909
|
-
mergeSlotProps(this, {
|
|
4950
|
+
mergeSlotProps(this, { [WEVU_SLOT_SCOPE_KEY]: next });
|
|
4910
4951
|
}
|
|
4911
4952
|
}
|
|
4912
4953
|
},
|
|
4913
4954
|
data: () => ({
|
|
4914
|
-
|
|
4915
|
-
|
|
4955
|
+
[WEVU_SLOT_OWNER_KEY]: {},
|
|
4956
|
+
[WEVU_SLOT_PROPS_DATA_KEY]: {}
|
|
4916
4957
|
}),
|
|
4917
4958
|
lifetimes: {
|
|
4918
4959
|
attached() {
|
|
4919
|
-
var _this$properties$
|
|
4920
|
-
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 : "";
|
|
4921
4962
|
mergeSlotProps(this);
|
|
4922
4963
|
if (!ownerId) return;
|
|
4923
4964
|
const updateOwner = (snapshot, proxy) => {
|
|
4924
4965
|
this.__wvOwnerProxy = proxy;
|
|
4925
|
-
if (typeof this.setData === "function") this.setData({
|
|
4966
|
+
if (typeof this.setData === "function") this.setData({ [WEVU_SLOT_OWNER_KEY]: snapshot || {} });
|
|
4926
4967
|
};
|
|
4927
4968
|
this.__wvOwnerUnsub = subscribeOwner(ownerId, updateOwner);
|
|
4928
4969
|
const snapshot = getOwnerSnapshot(ownerId);
|
|
@@ -4934,10 +4975,10 @@ function createScopedSlotOptions(overrides) {
|
|
|
4934
4975
|
this.__wvOwnerProxy = void 0;
|
|
4935
4976
|
}
|
|
4936
4977
|
},
|
|
4937
|
-
methods: {
|
|
4978
|
+
methods: { [WEVU_OWNER_HANDLER](event) {
|
|
4938
4979
|
var _wevu, _ref2, _event$currentTarget$2, _event$currentTarget2, _event$target2;
|
|
4939
4980
|
const owner = this.__wvOwnerProxy;
|
|
4940
|
-
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]);
|
|
4941
4982
|
if (result !== void 0) return result;
|
|
4942
4983
|
if (!owner) return;
|
|
4943
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);
|
|
@@ -4951,7 +4992,7 @@ function createScopedSlotOptions(overrides) {
|
|
|
4951
4992
|
if ((overrides === null || overrides === void 0 ? void 0 : overrides.computed) && Object.keys(overrides.computed).length > 0) baseOptions.computed = overrides.computed;
|
|
4952
4993
|
if ((overrides === null || overrides === void 0 ? void 0 : overrides.inlineMap) && Object.keys(overrides.inlineMap).length > 0) baseOptions.methods = {
|
|
4953
4994
|
...baseOptions.methods,
|
|
4954
|
-
|
|
4995
|
+
[WEVU_INLINE_MAP_KEY]: overrides.inlineMap
|
|
4955
4996
|
};
|
|
4956
4997
|
return baseOptions;
|
|
4957
4998
|
}
|
|
@@ -4971,7 +5012,7 @@ function shouldExposeInSnapshot(value) {
|
|
|
4971
5012
|
}
|
|
4972
5013
|
function applySetupResult(runtime, target, result) {
|
|
4973
5014
|
var _runtime$methods, _runtime$state;
|
|
4974
|
-
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] : []);
|
|
4975
5016
|
const methods = (_runtime$methods = runtime === null || runtime === void 0 ? void 0 : runtime.methods) !== null && _runtime$methods !== void 0 ? _runtime$methods : Object.create(null);
|
|
4976
5017
|
const state = (_runtime$state = runtime === null || runtime === void 0 ? void 0 : runtime.state) !== null && _runtime$state !== void 0 ? _runtime$state : Object.create(null);
|
|
4977
5018
|
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
@@ -5002,13 +5043,13 @@ function applySetupResult(runtime, target, result) {
|
|
|
5002
5043
|
configurable: true,
|
|
5003
5044
|
enumerable: false,
|
|
5004
5045
|
get() {
|
|
5005
|
-
const propsSource = rawState
|
|
5046
|
+
const propsSource = rawState[WEVU_PROPS_KEY];
|
|
5006
5047
|
if (propsSource && typeof propsSource === "object" && Object.hasOwn(propsSource, key)) return propsSource[key];
|
|
5007
5048
|
return fallbackValue;
|
|
5008
5049
|
},
|
|
5009
5050
|
set(next) {
|
|
5010
5051
|
fallbackValue = next;
|
|
5011
|
-
const propsSource = rawState
|
|
5052
|
+
const propsSource = rawState[WEVU_PROPS_KEY];
|
|
5012
5053
|
if (!propsSource || typeof propsSource !== "object") return;
|
|
5013
5054
|
try {
|
|
5014
5055
|
propsSource[key] = next;
|
|
@@ -5050,7 +5091,7 @@ function ensureScopedSlotComponentGlobal() {
|
|
|
5050
5091
|
const globalObject = getScopedSlotHostGlobalObject();
|
|
5051
5092
|
if (!globalObject) return;
|
|
5052
5093
|
const globalRecord = globalObject;
|
|
5053
|
-
if (!globalRecord
|
|
5094
|
+
if (!globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] && scopedSlotCreator) globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] = scopedSlotCreator;
|
|
5054
5095
|
}
|
|
5055
5096
|
function defineComponent(options) {
|
|
5056
5097
|
ensureScopedSlotComponentGlobal();
|
|
@@ -5094,10 +5135,12 @@ function defineComponent(options) {
|
|
|
5094
5135
|
* @internal
|
|
5095
5136
|
*/
|
|
5096
5137
|
function createWevuComponent(options) {
|
|
5138
|
+
var _allowNullPropInput;
|
|
5097
5139
|
ensureScopedSlotComponentGlobal();
|
|
5098
5140
|
const { properties, props, ...restOptions } = options;
|
|
5099
5141
|
defineComponent(normalizeProps({
|
|
5100
5142
|
...restOptions,
|
|
5143
|
+
allowNullPropInput: (_allowNullPropInput = restOptions.allowNullPropInput) !== null && _allowNullPropInput !== void 0 ? _allowNullPropInput : true,
|
|
5101
5144
|
__wevu_allowNullPropInput: true
|
|
5102
5145
|
}, props, properties));
|
|
5103
5146
|
}
|
|
@@ -5430,7 +5473,7 @@ function useUpdatePerformanceListener(listener) {
|
|
|
5430
5473
|
//#region src/runtime/use.ts
|
|
5431
5474
|
function resolveCurrentRuntimeApp() {
|
|
5432
5475
|
const instance = getCurrentInstance();
|
|
5433
|
-
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];
|
|
5434
5477
|
throw new Error("defineAppSetup() / use() 只能在 app setup 上下文中调用");
|
|
5435
5478
|
}
|
|
5436
5479
|
/**
|
|
@@ -5569,18 +5612,18 @@ function mergeModels(a, b) {
|
|
|
5569
5612
|
//#endregion
|
|
5570
5613
|
//#region src/runtime/vueCompat/templateRef.ts
|
|
5571
5614
|
function ensureTemplateRefMap(target) {
|
|
5572
|
-
const existing = target
|
|
5615
|
+
const existing = target[WEVU_TEMPLATE_REF_MAP_KEY];
|
|
5573
5616
|
if (existing) return existing;
|
|
5574
5617
|
const next = /* @__PURE__ */ new Map();
|
|
5575
5618
|
try {
|
|
5576
|
-
Object.defineProperty(target,
|
|
5619
|
+
Object.defineProperty(target, WEVU_TEMPLATE_REF_MAP_KEY, {
|
|
5577
5620
|
value: next,
|
|
5578
5621
|
configurable: true,
|
|
5579
5622
|
enumerable: false,
|
|
5580
5623
|
writable: false
|
|
5581
5624
|
});
|
|
5582
5625
|
} catch (_unused) {
|
|
5583
|
-
target
|
|
5626
|
+
target[WEVU_TEMPLATE_REF_MAP_KEY] = next;
|
|
5584
5627
|
}
|
|
5585
5628
|
return next;
|
|
5586
5629
|
}
|