@vue/runtime-dom 3.5.0-beta.2 → 3.5.0-beta.3
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/runtime-dom.cjs.js +1 -1
- package/dist/runtime-dom.cjs.prod.js +1 -1
- package/dist/runtime-dom.d.ts +4 -2
- package/dist/runtime-dom.esm-browser.js +273 -237
- package/dist/runtime-dom.esm-browser.prod.js +2 -2
- package/dist/runtime-dom.esm-bundler.js +1 -1
- package/dist/runtime-dom.global.js +264 -217
- package/dist/runtime-dom.global.prod.js +2 -2
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.5.0-beta.
|
|
2
|
+
* @vue/runtime-dom v3.5.0-beta.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1073,14 +1073,14 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1073
1073
|
const arrayProto = Array.prototype;
|
|
1074
1074
|
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
1075
1075
|
const arr = shallowReadArray(self);
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1076
|
+
const needsWrap = arr !== self && !isShallow(self);
|
|
1077
|
+
const methodFn = arr[method];
|
|
1078
|
+
if (methodFn !== arrayProto[method]) {
|
|
1079
|
+
const result2 = methodFn.apply(arr, args);
|
|
1080
|
+
return needsWrap ? toReactive(result2) : result2;
|
|
1079
1081
|
}
|
|
1080
|
-
let needsWrap = false;
|
|
1081
1082
|
let wrappedFn = fn;
|
|
1082
1083
|
if (arr !== self) {
|
|
1083
|
-
needsWrap = !isShallow(self);
|
|
1084
1084
|
if (needsWrap) {
|
|
1085
1085
|
wrappedFn = function(item, index) {
|
|
1086
1086
|
return fn.call(this, toReactive(item), index, self);
|
|
@@ -1942,6 +1942,220 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1942
1942
|
"CLEAR": "clear"
|
|
1943
1943
|
};
|
|
1944
1944
|
|
|
1945
|
+
const INITIAL_WATCHER_VALUE = {};
|
|
1946
|
+
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1947
|
+
let activeWatcher = void 0;
|
|
1948
|
+
function getCurrentWatcher() {
|
|
1949
|
+
return activeWatcher;
|
|
1950
|
+
}
|
|
1951
|
+
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1952
|
+
if (owner) {
|
|
1953
|
+
let cleanups = cleanupMap.get(owner);
|
|
1954
|
+
if (!cleanups) cleanupMap.set(owner, cleanups = []);
|
|
1955
|
+
cleanups.push(cleanupFn);
|
|
1956
|
+
} else if (!failSilently) {
|
|
1957
|
+
warn$2(
|
|
1958
|
+
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
1959
|
+
);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
function watch$1(source, cb, options = EMPTY_OBJ) {
|
|
1963
|
+
const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
|
1964
|
+
const warnInvalidSource = (s) => {
|
|
1965
|
+
(options.onWarn || warn$2)(
|
|
1966
|
+
`Invalid watch source: `,
|
|
1967
|
+
s,
|
|
1968
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
1969
|
+
);
|
|
1970
|
+
};
|
|
1971
|
+
const reactiveGetter = (source2) => {
|
|
1972
|
+
if (deep) return source2;
|
|
1973
|
+
if (isShallow(source2) || deep === false || deep === 0)
|
|
1974
|
+
return traverse(source2, 1);
|
|
1975
|
+
return traverse(source2);
|
|
1976
|
+
};
|
|
1977
|
+
let effect;
|
|
1978
|
+
let getter;
|
|
1979
|
+
let cleanup;
|
|
1980
|
+
let boundCleanup;
|
|
1981
|
+
let forceTrigger = false;
|
|
1982
|
+
let isMultiSource = false;
|
|
1983
|
+
if (isRef(source)) {
|
|
1984
|
+
getter = () => source.value;
|
|
1985
|
+
forceTrigger = isShallow(source);
|
|
1986
|
+
} else if (isReactive(source)) {
|
|
1987
|
+
getter = () => reactiveGetter(source);
|
|
1988
|
+
forceTrigger = true;
|
|
1989
|
+
} else if (isArray(source)) {
|
|
1990
|
+
isMultiSource = true;
|
|
1991
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
1992
|
+
getter = () => source.map((s) => {
|
|
1993
|
+
if (isRef(s)) {
|
|
1994
|
+
return s.value;
|
|
1995
|
+
} else if (isReactive(s)) {
|
|
1996
|
+
return reactiveGetter(s);
|
|
1997
|
+
} else if (isFunction(s)) {
|
|
1998
|
+
return call ? call(s, 2) : s();
|
|
1999
|
+
} else {
|
|
2000
|
+
warnInvalidSource(s);
|
|
2001
|
+
}
|
|
2002
|
+
});
|
|
2003
|
+
} else if (isFunction(source)) {
|
|
2004
|
+
if (cb) {
|
|
2005
|
+
getter = call ? () => call(source, 2) : source;
|
|
2006
|
+
} else {
|
|
2007
|
+
getter = () => {
|
|
2008
|
+
if (cleanup) {
|
|
2009
|
+
pauseTracking();
|
|
2010
|
+
try {
|
|
2011
|
+
cleanup();
|
|
2012
|
+
} finally {
|
|
2013
|
+
resetTracking();
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
const currentEffect = activeWatcher;
|
|
2017
|
+
activeWatcher = effect;
|
|
2018
|
+
try {
|
|
2019
|
+
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
2020
|
+
} finally {
|
|
2021
|
+
activeWatcher = currentEffect;
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
} else {
|
|
2026
|
+
getter = NOOP;
|
|
2027
|
+
warnInvalidSource(source);
|
|
2028
|
+
}
|
|
2029
|
+
if (cb && deep) {
|
|
2030
|
+
const baseGetter = getter;
|
|
2031
|
+
const depth = deep === true ? Infinity : deep;
|
|
2032
|
+
getter = () => traverse(baseGetter(), depth);
|
|
2033
|
+
}
|
|
2034
|
+
if (once) {
|
|
2035
|
+
if (cb) {
|
|
2036
|
+
const _cb = cb;
|
|
2037
|
+
cb = (...args) => {
|
|
2038
|
+
_cb(...args);
|
|
2039
|
+
effect.stop();
|
|
2040
|
+
};
|
|
2041
|
+
} else {
|
|
2042
|
+
const _getter = getter;
|
|
2043
|
+
getter = () => {
|
|
2044
|
+
_getter();
|
|
2045
|
+
effect.stop();
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2050
|
+
const job = (immediateFirstRun) => {
|
|
2051
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
if (cb) {
|
|
2055
|
+
const newValue = effect.run();
|
|
2056
|
+
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2057
|
+
if (cleanup) {
|
|
2058
|
+
cleanup();
|
|
2059
|
+
}
|
|
2060
|
+
const currentWatcher = activeWatcher;
|
|
2061
|
+
activeWatcher = effect;
|
|
2062
|
+
try {
|
|
2063
|
+
const args = [
|
|
2064
|
+
newValue,
|
|
2065
|
+
// pass undefined as the old value when it's changed for the first time
|
|
2066
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2067
|
+
boundCleanup
|
|
2068
|
+
];
|
|
2069
|
+
call ? call(cb, 3, args) : (
|
|
2070
|
+
// @ts-expect-error
|
|
2071
|
+
cb(...args)
|
|
2072
|
+
);
|
|
2073
|
+
oldValue = newValue;
|
|
2074
|
+
} finally {
|
|
2075
|
+
activeWatcher = currentWatcher;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
} else {
|
|
2079
|
+
effect.run();
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
if (augmentJob) {
|
|
2083
|
+
augmentJob(job);
|
|
2084
|
+
}
|
|
2085
|
+
effect = new ReactiveEffect(getter);
|
|
2086
|
+
effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
2087
|
+
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
|
2088
|
+
cleanup = effect.onStop = () => {
|
|
2089
|
+
const cleanups = cleanupMap.get(effect);
|
|
2090
|
+
if (cleanups) {
|
|
2091
|
+
if (call) {
|
|
2092
|
+
call(cleanups, 4);
|
|
2093
|
+
} else {
|
|
2094
|
+
for (const cleanup2 of cleanups) cleanup2();
|
|
2095
|
+
}
|
|
2096
|
+
cleanupMap.delete(effect);
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
{
|
|
2100
|
+
effect.onTrack = options.onTrack;
|
|
2101
|
+
effect.onTrigger = options.onTrigger;
|
|
2102
|
+
}
|
|
2103
|
+
if (cb) {
|
|
2104
|
+
if (immediate) {
|
|
2105
|
+
job(true);
|
|
2106
|
+
} else {
|
|
2107
|
+
oldValue = effect.run();
|
|
2108
|
+
}
|
|
2109
|
+
} else if (scheduler) {
|
|
2110
|
+
scheduler(job.bind(null, true), true);
|
|
2111
|
+
} else {
|
|
2112
|
+
effect.run();
|
|
2113
|
+
}
|
|
2114
|
+
const scope = getCurrentScope();
|
|
2115
|
+
const watchHandle = () => {
|
|
2116
|
+
effect.stop();
|
|
2117
|
+
if (scope) {
|
|
2118
|
+
remove(scope.effects, effect);
|
|
2119
|
+
}
|
|
2120
|
+
};
|
|
2121
|
+
watchHandle.pause = effect.pause.bind(effect);
|
|
2122
|
+
watchHandle.resume = effect.resume.bind(effect);
|
|
2123
|
+
watchHandle.stop = watchHandle;
|
|
2124
|
+
return watchHandle;
|
|
2125
|
+
}
|
|
2126
|
+
function traverse(value, depth = Infinity, seen) {
|
|
2127
|
+
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
2128
|
+
return value;
|
|
2129
|
+
}
|
|
2130
|
+
seen = seen || /* @__PURE__ */ new Set();
|
|
2131
|
+
if (seen.has(value)) {
|
|
2132
|
+
return value;
|
|
2133
|
+
}
|
|
2134
|
+
seen.add(value);
|
|
2135
|
+
depth--;
|
|
2136
|
+
if (isRef(value)) {
|
|
2137
|
+
traverse(value.value, depth, seen);
|
|
2138
|
+
} else if (isArray(value)) {
|
|
2139
|
+
for (let i = 0; i < value.length; i++) {
|
|
2140
|
+
traverse(value[i], depth, seen);
|
|
2141
|
+
}
|
|
2142
|
+
} else if (isSet(value) || isMap(value)) {
|
|
2143
|
+
value.forEach((v) => {
|
|
2144
|
+
traverse(v, depth, seen);
|
|
2145
|
+
});
|
|
2146
|
+
} else if (isPlainObject(value)) {
|
|
2147
|
+
for (const key in value) {
|
|
2148
|
+
traverse(value[key], depth, seen);
|
|
2149
|
+
}
|
|
2150
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
2151
|
+
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
2152
|
+
traverse(value[key], depth, seen);
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
return value;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
1945
2159
|
const stack = [];
|
|
1946
2160
|
function pushWarningContext(vnode) {
|
|
1947
2161
|
stack.push(vnode);
|
|
@@ -2069,12 +2283,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2069
2283
|
"0": "SETUP_FUNCTION",
|
|
2070
2284
|
"RENDER_FUNCTION": 1,
|
|
2071
2285
|
"1": "RENDER_FUNCTION",
|
|
2072
|
-
"WATCH_GETTER": 2,
|
|
2073
|
-
"2": "WATCH_GETTER",
|
|
2074
|
-
"WATCH_CALLBACK": 3,
|
|
2075
|
-
"3": "WATCH_CALLBACK",
|
|
2076
|
-
"WATCH_CLEANUP": 4,
|
|
2077
|
-
"4": "WATCH_CLEANUP",
|
|
2078
2286
|
"NATIVE_EVENT_HANDLER": 5,
|
|
2079
2287
|
"5": "NATIVE_EVENT_HANDLER",
|
|
2080
2288
|
"COMPONENT_EVENT_HANDLER": 6,
|
|
@@ -2226,7 +2434,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2226
2434
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2227
2435
|
}
|
|
2228
2436
|
function findInsertionIndex(id) {
|
|
2229
|
-
let start = flushIndex + 1;
|
|
2437
|
+
let start = isFlushing ? flushIndex + 1 : 0;
|
|
2230
2438
|
let end = queue.length;
|
|
2231
2439
|
while (start < end) {
|
|
2232
2440
|
const middle = start + end >>> 1;
|
|
@@ -2242,15 +2450,13 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2242
2450
|
}
|
|
2243
2451
|
function queueJob(job) {
|
|
2244
2452
|
if (!(job.flags & 1)) {
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
!(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
|
|
2250
|
-
) {
|
|
2453
|
+
const jobId = getId(job);
|
|
2454
|
+
const lastJob = queue[queue.length - 1];
|
|
2455
|
+
if (!lastJob || // fast path when the job id is larger than the tail
|
|
2456
|
+
!(job.flags & 2) && jobId >= getId(lastJob)) {
|
|
2251
2457
|
queue.push(job);
|
|
2252
2458
|
} else {
|
|
2253
|
-
queue.splice(findInsertionIndex(
|
|
2459
|
+
queue.splice(findInsertionIndex(jobId), 0, job);
|
|
2254
2460
|
}
|
|
2255
2461
|
if (!(job.flags & 4)) {
|
|
2256
2462
|
job.flags |= 1;
|
|
@@ -2264,12 +2470,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2264
2470
|
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
2265
2471
|
}
|
|
2266
2472
|
}
|
|
2267
|
-
function invalidateJob(job) {
|
|
2268
|
-
const i = queue.indexOf(job);
|
|
2269
|
-
if (i > flushIndex) {
|
|
2270
|
-
queue.splice(i, 1);
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
2473
|
function queuePostFlushCb(cb) {
|
|
2274
2474
|
if (!isArray(cb)) {
|
|
2275
2475
|
if (activePostFlushCbs && cb.id === -1) {
|
|
@@ -2331,24 +2531,13 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2331
2531
|
postFlushIndex = 0;
|
|
2332
2532
|
}
|
|
2333
2533
|
}
|
|
2334
|
-
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
2335
|
-
const comparator = (a, b) => {
|
|
2336
|
-
const diff = getId(a) - getId(b);
|
|
2337
|
-
if (diff === 0) {
|
|
2338
|
-
const isAPre = a.flags & 2;
|
|
2339
|
-
const isBPre = b.flags & 2;
|
|
2340
|
-
if (isAPre && !isBPre) return -1;
|
|
2341
|
-
if (isBPre && !isAPre) return 1;
|
|
2342
|
-
}
|
|
2343
|
-
return diff;
|
|
2344
|
-
};
|
|
2534
|
+
const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
2345
2535
|
function flushJobs(seen) {
|
|
2346
2536
|
isFlushPending = false;
|
|
2347
2537
|
isFlushing = true;
|
|
2348
2538
|
{
|
|
2349
2539
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2350
2540
|
}
|
|
2351
|
-
queue.sort(comparator);
|
|
2352
2541
|
const check = (job) => checkRecursiveUpdates(seen, job) ;
|
|
2353
2542
|
try {
|
|
2354
2543
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
@@ -5430,16 +5619,20 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5430
5619
|
);
|
|
5431
5620
|
}
|
|
5432
5621
|
function createWatcher(raw, ctx, publicThis, key) {
|
|
5433
|
-
|
|
5622
|
+
let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
|
5434
5623
|
if (isString(raw)) {
|
|
5435
5624
|
const handler = ctx[raw];
|
|
5436
5625
|
if (isFunction(handler)) {
|
|
5437
|
-
|
|
5626
|
+
{
|
|
5627
|
+
watch(getter, handler);
|
|
5628
|
+
}
|
|
5438
5629
|
} else {
|
|
5439
5630
|
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
5440
5631
|
}
|
|
5441
5632
|
} else if (isFunction(raw)) {
|
|
5442
|
-
|
|
5633
|
+
{
|
|
5634
|
+
watch(getter, raw.bind(publicThis));
|
|
5635
|
+
}
|
|
5443
5636
|
} else if (isObject(raw)) {
|
|
5444
5637
|
if (isArray(raw)) {
|
|
5445
5638
|
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
@@ -6677,7 +6870,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6677
6870
|
if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
|
6678
6871
|
subTree = filterSingleRoot(subTree.children) || subTree;
|
|
6679
6872
|
}
|
|
6680
|
-
if (vnode === subTree) {
|
|
6873
|
+
if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
|
|
6681
6874
|
const parentVNode = parentComponent.vnode;
|
|
6682
6875
|
setScopeId(
|
|
6683
6876
|
el,
|
|
@@ -7006,7 +7199,6 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7006
7199
|
return;
|
|
7007
7200
|
} else {
|
|
7008
7201
|
instance.next = n2;
|
|
7009
|
-
invalidateJob(instance.update);
|
|
7010
7202
|
instance.update();
|
|
7011
7203
|
}
|
|
7012
7204
|
} else {
|
|
@@ -7891,7 +8083,6 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7891
8083
|
extend({}, options, { flush: "sync" })
|
|
7892
8084
|
);
|
|
7893
8085
|
}
|
|
7894
|
-
const INITIAL_WATCHER_VALUE = {};
|
|
7895
8086
|
function watch(source, cb, options) {
|
|
7896
8087
|
if (!isFunction(cb)) {
|
|
7897
8088
|
warn$1(
|
|
@@ -7900,21 +8091,8 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7900
8091
|
}
|
|
7901
8092
|
return doWatch(source, cb, options);
|
|
7902
8093
|
}
|
|
7903
|
-
function doWatch(source, cb, {
|
|
7904
|
-
immediate,
|
|
7905
|
-
deep,
|
|
7906
|
-
flush,
|
|
7907
|
-
once,
|
|
7908
|
-
onTrack,
|
|
7909
|
-
onTrigger
|
|
7910
|
-
} = EMPTY_OBJ) {
|
|
7911
|
-
if (cb && once) {
|
|
7912
|
-
const _cb = cb;
|
|
7913
|
-
cb = (...args) => {
|
|
7914
|
-
_cb(...args);
|
|
7915
|
-
watchHandle();
|
|
7916
|
-
};
|
|
7917
|
-
}
|
|
8094
|
+
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
8095
|
+
const { immediate, deep, flush, once } = options;
|
|
7918
8096
|
if (!cb) {
|
|
7919
8097
|
if (immediate !== void 0) {
|
|
7920
8098
|
warn$1(
|
|
@@ -7932,139 +8110,38 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7932
8110
|
);
|
|
7933
8111
|
}
|
|
7934
8112
|
}
|
|
7935
|
-
const
|
|
7936
|
-
|
|
7937
|
-
`Invalid watch source: `,
|
|
7938
|
-
s,
|
|
7939
|
-
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
7940
|
-
);
|
|
7941
|
-
};
|
|
8113
|
+
const baseWatchOptions = extend({}, options);
|
|
8114
|
+
baseWatchOptions.onWarn = warn$1;
|
|
7942
8115
|
const instance = currentInstance;
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
forceTrigger = isShallow(source);
|
|
7955
|
-
} else if (isReactive(source)) {
|
|
7956
|
-
getter = () => reactiveGetter(source);
|
|
7957
|
-
forceTrigger = true;
|
|
7958
|
-
} else if (isArray(source)) {
|
|
7959
|
-
isMultiSource = true;
|
|
7960
|
-
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
7961
|
-
getter = () => source.map((s) => {
|
|
7962
|
-
if (isRef(s)) {
|
|
7963
|
-
return s.value;
|
|
7964
|
-
} else if (isReactive(s)) {
|
|
7965
|
-
return reactiveGetter(s);
|
|
7966
|
-
} else if (isFunction(s)) {
|
|
7967
|
-
return callWithErrorHandling(s, instance, 2);
|
|
8116
|
+
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
8117
|
+
let isPre = false;
|
|
8118
|
+
if (flush === "post") {
|
|
8119
|
+
baseWatchOptions.scheduler = (job) => {
|
|
8120
|
+
queuePostRenderEffect(job, instance && instance.suspense);
|
|
8121
|
+
};
|
|
8122
|
+
} else if (flush !== "sync") {
|
|
8123
|
+
isPre = true;
|
|
8124
|
+
baseWatchOptions.scheduler = (job, isFirstRun) => {
|
|
8125
|
+
if (isFirstRun) {
|
|
8126
|
+
job();
|
|
7968
8127
|
} else {
|
|
7969
|
-
|
|
8128
|
+
queueJob(job);
|
|
7970
8129
|
}
|
|
7971
|
-
});
|
|
7972
|
-
} else if (isFunction(source)) {
|
|
7973
|
-
if (cb) {
|
|
7974
|
-
getter = () => callWithErrorHandling(source, instance, 2);
|
|
7975
|
-
} else {
|
|
7976
|
-
getter = () => {
|
|
7977
|
-
if (cleanup) {
|
|
7978
|
-
cleanup();
|
|
7979
|
-
}
|
|
7980
|
-
return callWithAsyncErrorHandling(
|
|
7981
|
-
source,
|
|
7982
|
-
instance,
|
|
7983
|
-
3,
|
|
7984
|
-
[onCleanup]
|
|
7985
|
-
);
|
|
7986
|
-
};
|
|
7987
|
-
}
|
|
7988
|
-
} else {
|
|
7989
|
-
getter = NOOP;
|
|
7990
|
-
warnInvalidSource(source);
|
|
7991
|
-
}
|
|
7992
|
-
if (cb && deep) {
|
|
7993
|
-
const baseGetter = getter;
|
|
7994
|
-
const depth = deep === true ? Infinity : deep;
|
|
7995
|
-
getter = () => traverse(baseGetter(), depth);
|
|
7996
|
-
}
|
|
7997
|
-
let cleanup;
|
|
7998
|
-
let onCleanup = (fn) => {
|
|
7999
|
-
cleanup = effect.onStop = () => {
|
|
8000
|
-
callWithErrorHandling(fn, instance, 4);
|
|
8001
|
-
cleanup = effect.onStop = void 0;
|
|
8002
8130
|
};
|
|
8003
|
-
}
|
|
8004
|
-
|
|
8005
|
-
const job = (immediateFirstRun) => {
|
|
8006
|
-
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
8007
|
-
return;
|
|
8008
|
-
}
|
|
8131
|
+
}
|
|
8132
|
+
baseWatchOptions.augmentJob = (job) => {
|
|
8009
8133
|
if (cb) {
|
|
8010
|
-
|
|
8011
|
-
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
|
|
8012
|
-
if (cleanup) {
|
|
8013
|
-
cleanup();
|
|
8014
|
-
}
|
|
8015
|
-
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
8016
|
-
newValue,
|
|
8017
|
-
// pass undefined as the old value when it's changed for the first time
|
|
8018
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
8019
|
-
onCleanup
|
|
8020
|
-
]);
|
|
8021
|
-
oldValue = newValue;
|
|
8022
|
-
}
|
|
8023
|
-
} else {
|
|
8024
|
-
effect.run();
|
|
8134
|
+
job.flags |= 4;
|
|
8025
8135
|
}
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
} else if (flush === "post") {
|
|
8033
|
-
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
8034
|
-
} else {
|
|
8035
|
-
job.flags |= 2;
|
|
8036
|
-
if (instance) job.id = instance.uid;
|
|
8037
|
-
scheduler = () => queueJob(job);
|
|
8038
|
-
}
|
|
8039
|
-
effect.scheduler = scheduler;
|
|
8040
|
-
const scope = getCurrentScope();
|
|
8041
|
-
const watchHandle = () => {
|
|
8042
|
-
effect.stop();
|
|
8043
|
-
if (scope) {
|
|
8044
|
-
remove(scope.effects, effect);
|
|
8136
|
+
if (isPre) {
|
|
8137
|
+
job.flags |= 2;
|
|
8138
|
+
if (instance) {
|
|
8139
|
+
job.id = instance.uid;
|
|
8140
|
+
job.i = instance;
|
|
8141
|
+
}
|
|
8045
8142
|
}
|
|
8046
8143
|
};
|
|
8047
|
-
watchHandle
|
|
8048
|
-
watchHandle.resume = effect.resume.bind(effect);
|
|
8049
|
-
watchHandle.stop = watchHandle;
|
|
8050
|
-
{
|
|
8051
|
-
effect.onTrack = onTrack;
|
|
8052
|
-
effect.onTrigger = onTrigger;
|
|
8053
|
-
}
|
|
8054
|
-
if (cb) {
|
|
8055
|
-
if (immediate) {
|
|
8056
|
-
job(true);
|
|
8057
|
-
} else {
|
|
8058
|
-
oldValue = effect.run();
|
|
8059
|
-
}
|
|
8060
|
-
} else if (flush === "post") {
|
|
8061
|
-
queuePostRenderEffect(
|
|
8062
|
-
effect.run.bind(effect),
|
|
8063
|
-
instance && instance.suspense
|
|
8064
|
-
);
|
|
8065
|
-
} else {
|
|
8066
|
-
effect.run();
|
|
8067
|
-
}
|
|
8144
|
+
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
8068
8145
|
return watchHandle;
|
|
8069
8146
|
}
|
|
8070
8147
|
function instanceWatch(source, value, options) {
|
|
@@ -8092,38 +8169,6 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8092
8169
|
return cur;
|
|
8093
8170
|
};
|
|
8094
8171
|
}
|
|
8095
|
-
function traverse(value, depth = Infinity, seen) {
|
|
8096
|
-
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
8097
|
-
return value;
|
|
8098
|
-
}
|
|
8099
|
-
seen = seen || /* @__PURE__ */ new Set();
|
|
8100
|
-
if (seen.has(value)) {
|
|
8101
|
-
return value;
|
|
8102
|
-
}
|
|
8103
|
-
seen.add(value);
|
|
8104
|
-
depth--;
|
|
8105
|
-
if (isRef(value)) {
|
|
8106
|
-
traverse(value.value, depth, seen);
|
|
8107
|
-
} else if (isArray(value)) {
|
|
8108
|
-
for (let i = 0; i < value.length; i++) {
|
|
8109
|
-
traverse(value[i], depth, seen);
|
|
8110
|
-
}
|
|
8111
|
-
} else if (isSet(value) || isMap(value)) {
|
|
8112
|
-
value.forEach((v) => {
|
|
8113
|
-
traverse(v, depth, seen);
|
|
8114
|
-
});
|
|
8115
|
-
} else if (isPlainObject(value)) {
|
|
8116
|
-
for (const key in value) {
|
|
8117
|
-
traverse(value[key], depth, seen);
|
|
8118
|
-
}
|
|
8119
|
-
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
8120
|
-
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
8121
|
-
traverse(value[key], depth, seen);
|
|
8122
|
-
}
|
|
8123
|
-
}
|
|
8124
|
-
}
|
|
8125
|
-
return value;
|
|
8126
|
-
}
|
|
8127
8172
|
|
|
8128
8173
|
function useModel(props, name, options = EMPTY_OBJ) {
|
|
8129
8174
|
const i = getCurrentInstance();
|
|
@@ -10257,7 +10302,7 @@ Component that was made reactive: `,
|
|
|
10257
10302
|
return true;
|
|
10258
10303
|
}
|
|
10259
10304
|
|
|
10260
|
-
const version = "3.5.0-beta.
|
|
10305
|
+
const version = "3.5.0-beta.3";
|
|
10261
10306
|
const warn = warn$1 ;
|
|
10262
10307
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10263
10308
|
const devtools = devtools$1 ;
|
|
@@ -12082,6 +12127,7 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
12082
12127
|
exports.effectScope = effectScope;
|
|
12083
12128
|
exports.getCurrentInstance = getCurrentInstance;
|
|
12084
12129
|
exports.getCurrentScope = getCurrentScope;
|
|
12130
|
+
exports.getCurrentWatcher = getCurrentWatcher;
|
|
12085
12131
|
exports.getTransitionRawChildren = getTransitionRawChildren;
|
|
12086
12132
|
exports.guardReactiveProps = guardReactiveProps;
|
|
12087
12133
|
exports.h = h;
|
|
@@ -12124,6 +12170,7 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
12124
12170
|
exports.onServerPrefetch = onServerPrefetch;
|
|
12125
12171
|
exports.onUnmounted = onUnmounted;
|
|
12126
12172
|
exports.onUpdated = onUpdated;
|
|
12173
|
+
exports.onWatcherCleanup = onWatcherCleanup;
|
|
12127
12174
|
exports.openBlock = openBlock;
|
|
12128
12175
|
exports.popScopeId = popScopeId;
|
|
12129
12176
|
exports.provide = provide;
|