@vue/compat 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/vue.cjs.js +361 -250
- package/dist/vue.cjs.prod.js +341 -236
- package/dist/vue.esm-browser.js +308 -251
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +308 -251
- package/dist/vue.global.js +296 -230
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +295 -251
- package/dist/vue.runtime.esm-browser.prod.js +2 -2
- package/dist/vue.runtime.esm-bundler.js +295 -251
- package/dist/vue.runtime.global.js +283 -230
- package/dist/vue.runtime.global.prod.js +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compat v3.5.0-beta.
|
|
2
|
+
* @vue/compat v3.5.0-beta.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1070,14 +1070,14 @@ function iterator(self, method, wrapValue) {
|
|
|
1070
1070
|
const arrayProto = Array.prototype;
|
|
1071
1071
|
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
1072
1072
|
const arr = shallowReadArray(self);
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1073
|
+
const needsWrap = arr !== self && !isShallow(self);
|
|
1074
|
+
const methodFn = arr[method];
|
|
1075
|
+
if (methodFn !== arrayProto[method]) {
|
|
1076
|
+
const result2 = methodFn.apply(arr, args);
|
|
1077
|
+
return needsWrap ? toReactive(result2) : result2;
|
|
1076
1078
|
}
|
|
1077
|
-
let needsWrap = false;
|
|
1078
1079
|
let wrappedFn = fn;
|
|
1079
1080
|
if (arr !== self) {
|
|
1080
|
-
needsWrap = !isShallow(self);
|
|
1081
1081
|
if (needsWrap) {
|
|
1082
1082
|
wrappedFn = function(item, index) {
|
|
1083
1083
|
return fn.call(this, toReactive(item), index, self);
|
|
@@ -1939,6 +1939,220 @@ const TriggerOpTypes = {
|
|
|
1939
1939
|
"CLEAR": "clear"
|
|
1940
1940
|
};
|
|
1941
1941
|
|
|
1942
|
+
const INITIAL_WATCHER_VALUE = {};
|
|
1943
|
+
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1944
|
+
let activeWatcher = void 0;
|
|
1945
|
+
function getCurrentWatcher() {
|
|
1946
|
+
return activeWatcher;
|
|
1947
|
+
}
|
|
1948
|
+
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1949
|
+
if (owner) {
|
|
1950
|
+
let cleanups = cleanupMap.get(owner);
|
|
1951
|
+
if (!cleanups) cleanupMap.set(owner, cleanups = []);
|
|
1952
|
+
cleanups.push(cleanupFn);
|
|
1953
|
+
} else if (!failSilently) {
|
|
1954
|
+
warn$2(
|
|
1955
|
+
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
1956
|
+
);
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
function watch$1(source, cb, options = EMPTY_OBJ) {
|
|
1960
|
+
const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
|
1961
|
+
const warnInvalidSource = (s) => {
|
|
1962
|
+
(options.onWarn || warn$2)(
|
|
1963
|
+
`Invalid watch source: `,
|
|
1964
|
+
s,
|
|
1965
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
1966
|
+
);
|
|
1967
|
+
};
|
|
1968
|
+
const reactiveGetter = (source2) => {
|
|
1969
|
+
if (deep) return source2;
|
|
1970
|
+
if (isShallow(source2) || deep === false || deep === 0)
|
|
1971
|
+
return traverse(source2, 1);
|
|
1972
|
+
return traverse(source2);
|
|
1973
|
+
};
|
|
1974
|
+
let effect;
|
|
1975
|
+
let getter;
|
|
1976
|
+
let cleanup;
|
|
1977
|
+
let boundCleanup;
|
|
1978
|
+
let forceTrigger = false;
|
|
1979
|
+
let isMultiSource = false;
|
|
1980
|
+
if (isRef(source)) {
|
|
1981
|
+
getter = () => source.value;
|
|
1982
|
+
forceTrigger = isShallow(source);
|
|
1983
|
+
} else if (isReactive(source)) {
|
|
1984
|
+
getter = () => reactiveGetter(source);
|
|
1985
|
+
forceTrigger = true;
|
|
1986
|
+
} else if (isArray(source)) {
|
|
1987
|
+
isMultiSource = true;
|
|
1988
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
1989
|
+
getter = () => source.map((s) => {
|
|
1990
|
+
if (isRef(s)) {
|
|
1991
|
+
return s.value;
|
|
1992
|
+
} else if (isReactive(s)) {
|
|
1993
|
+
return reactiveGetter(s);
|
|
1994
|
+
} else if (isFunction(s)) {
|
|
1995
|
+
return call ? call(s, 2) : s();
|
|
1996
|
+
} else {
|
|
1997
|
+
warnInvalidSource(s);
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
} else if (isFunction(source)) {
|
|
2001
|
+
if (cb) {
|
|
2002
|
+
getter = call ? () => call(source, 2) : source;
|
|
2003
|
+
} else {
|
|
2004
|
+
getter = () => {
|
|
2005
|
+
if (cleanup) {
|
|
2006
|
+
pauseTracking();
|
|
2007
|
+
try {
|
|
2008
|
+
cleanup();
|
|
2009
|
+
} finally {
|
|
2010
|
+
resetTracking();
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
const currentEffect = activeWatcher;
|
|
2014
|
+
activeWatcher = effect;
|
|
2015
|
+
try {
|
|
2016
|
+
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
2017
|
+
} finally {
|
|
2018
|
+
activeWatcher = currentEffect;
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
}
|
|
2022
|
+
} else {
|
|
2023
|
+
getter = NOOP;
|
|
2024
|
+
warnInvalidSource(source);
|
|
2025
|
+
}
|
|
2026
|
+
if (cb && deep) {
|
|
2027
|
+
const baseGetter = getter;
|
|
2028
|
+
const depth = deep === true ? Infinity : deep;
|
|
2029
|
+
getter = () => traverse(baseGetter(), depth);
|
|
2030
|
+
}
|
|
2031
|
+
if (once) {
|
|
2032
|
+
if (cb) {
|
|
2033
|
+
const _cb = cb;
|
|
2034
|
+
cb = (...args) => {
|
|
2035
|
+
_cb(...args);
|
|
2036
|
+
effect.stop();
|
|
2037
|
+
};
|
|
2038
|
+
} else {
|
|
2039
|
+
const _getter = getter;
|
|
2040
|
+
getter = () => {
|
|
2041
|
+
_getter();
|
|
2042
|
+
effect.stop();
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2047
|
+
const job = (immediateFirstRun) => {
|
|
2048
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
2049
|
+
return;
|
|
2050
|
+
}
|
|
2051
|
+
if (cb) {
|
|
2052
|
+
const newValue = effect.run();
|
|
2053
|
+
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2054
|
+
if (cleanup) {
|
|
2055
|
+
cleanup();
|
|
2056
|
+
}
|
|
2057
|
+
const currentWatcher = activeWatcher;
|
|
2058
|
+
activeWatcher = effect;
|
|
2059
|
+
try {
|
|
2060
|
+
const args = [
|
|
2061
|
+
newValue,
|
|
2062
|
+
// pass undefined as the old value when it's changed for the first time
|
|
2063
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2064
|
+
boundCleanup
|
|
2065
|
+
];
|
|
2066
|
+
call ? call(cb, 3, args) : (
|
|
2067
|
+
// @ts-expect-error
|
|
2068
|
+
cb(...args)
|
|
2069
|
+
);
|
|
2070
|
+
oldValue = newValue;
|
|
2071
|
+
} finally {
|
|
2072
|
+
activeWatcher = currentWatcher;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
} else {
|
|
2076
|
+
effect.run();
|
|
2077
|
+
}
|
|
2078
|
+
};
|
|
2079
|
+
if (augmentJob) {
|
|
2080
|
+
augmentJob(job);
|
|
2081
|
+
}
|
|
2082
|
+
effect = new ReactiveEffect(getter);
|
|
2083
|
+
effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
2084
|
+
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
|
2085
|
+
cleanup = effect.onStop = () => {
|
|
2086
|
+
const cleanups = cleanupMap.get(effect);
|
|
2087
|
+
if (cleanups) {
|
|
2088
|
+
if (call) {
|
|
2089
|
+
call(cleanups, 4);
|
|
2090
|
+
} else {
|
|
2091
|
+
for (const cleanup2 of cleanups) cleanup2();
|
|
2092
|
+
}
|
|
2093
|
+
cleanupMap.delete(effect);
|
|
2094
|
+
}
|
|
2095
|
+
};
|
|
2096
|
+
{
|
|
2097
|
+
effect.onTrack = options.onTrack;
|
|
2098
|
+
effect.onTrigger = options.onTrigger;
|
|
2099
|
+
}
|
|
2100
|
+
if (cb) {
|
|
2101
|
+
if (immediate) {
|
|
2102
|
+
job(true);
|
|
2103
|
+
} else {
|
|
2104
|
+
oldValue = effect.run();
|
|
2105
|
+
}
|
|
2106
|
+
} else if (scheduler) {
|
|
2107
|
+
scheduler(job.bind(null, true), true);
|
|
2108
|
+
} else {
|
|
2109
|
+
effect.run();
|
|
2110
|
+
}
|
|
2111
|
+
const scope = getCurrentScope();
|
|
2112
|
+
const watchHandle = () => {
|
|
2113
|
+
effect.stop();
|
|
2114
|
+
if (scope) {
|
|
2115
|
+
remove(scope.effects, effect);
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
watchHandle.pause = effect.pause.bind(effect);
|
|
2119
|
+
watchHandle.resume = effect.resume.bind(effect);
|
|
2120
|
+
watchHandle.stop = watchHandle;
|
|
2121
|
+
return watchHandle;
|
|
2122
|
+
}
|
|
2123
|
+
function traverse(value, depth = Infinity, seen) {
|
|
2124
|
+
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
2125
|
+
return value;
|
|
2126
|
+
}
|
|
2127
|
+
seen = seen || /* @__PURE__ */ new Set();
|
|
2128
|
+
if (seen.has(value)) {
|
|
2129
|
+
return value;
|
|
2130
|
+
}
|
|
2131
|
+
seen.add(value);
|
|
2132
|
+
depth--;
|
|
2133
|
+
if (isRef(value)) {
|
|
2134
|
+
traverse(value.value, depth, seen);
|
|
2135
|
+
} else if (isArray(value)) {
|
|
2136
|
+
for (let i = 0; i < value.length; i++) {
|
|
2137
|
+
traverse(value[i], depth, seen);
|
|
2138
|
+
}
|
|
2139
|
+
} else if (isSet(value) || isMap(value)) {
|
|
2140
|
+
value.forEach((v) => {
|
|
2141
|
+
traverse(v, depth, seen);
|
|
2142
|
+
});
|
|
2143
|
+
} else if (isPlainObject(value)) {
|
|
2144
|
+
for (const key in value) {
|
|
2145
|
+
traverse(value[key], depth, seen);
|
|
2146
|
+
}
|
|
2147
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
2148
|
+
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
2149
|
+
traverse(value[key], depth, seen);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
return value;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
1942
2156
|
const stack = [];
|
|
1943
2157
|
function pushWarningContext(vnode) {
|
|
1944
2158
|
stack.push(vnode);
|
|
@@ -2066,12 +2280,6 @@ const ErrorCodes = {
|
|
|
2066
2280
|
"0": "SETUP_FUNCTION",
|
|
2067
2281
|
"RENDER_FUNCTION": 1,
|
|
2068
2282
|
"1": "RENDER_FUNCTION",
|
|
2069
|
-
"WATCH_GETTER": 2,
|
|
2070
|
-
"2": "WATCH_GETTER",
|
|
2071
|
-
"WATCH_CALLBACK": 3,
|
|
2072
|
-
"3": "WATCH_CALLBACK",
|
|
2073
|
-
"WATCH_CLEANUP": 4,
|
|
2074
|
-
"4": "WATCH_CLEANUP",
|
|
2075
2283
|
"NATIVE_EVENT_HANDLER": 5,
|
|
2076
2284
|
"5": "NATIVE_EVENT_HANDLER",
|
|
2077
2285
|
"COMPONENT_EVENT_HANDLER": 6,
|
|
@@ -2223,7 +2431,7 @@ function nextTick(fn) {
|
|
|
2223
2431
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2224
2432
|
}
|
|
2225
2433
|
function findInsertionIndex(id) {
|
|
2226
|
-
let start = flushIndex + 1;
|
|
2434
|
+
let start = isFlushing ? flushIndex + 1 : 0;
|
|
2227
2435
|
let end = queue.length;
|
|
2228
2436
|
while (start < end) {
|
|
2229
2437
|
const middle = start + end >>> 1;
|
|
@@ -2239,15 +2447,13 @@ function findInsertionIndex(id) {
|
|
|
2239
2447
|
}
|
|
2240
2448
|
function queueJob(job) {
|
|
2241
2449
|
if (!(job.flags & 1)) {
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
!(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
|
|
2247
|
-
) {
|
|
2450
|
+
const jobId = getId(job);
|
|
2451
|
+
const lastJob = queue[queue.length - 1];
|
|
2452
|
+
if (!lastJob || // fast path when the job id is larger than the tail
|
|
2453
|
+
!(job.flags & 2) && jobId >= getId(lastJob)) {
|
|
2248
2454
|
queue.push(job);
|
|
2249
2455
|
} else {
|
|
2250
|
-
queue.splice(findInsertionIndex(
|
|
2456
|
+
queue.splice(findInsertionIndex(jobId), 0, job);
|
|
2251
2457
|
}
|
|
2252
2458
|
if (!(job.flags & 4)) {
|
|
2253
2459
|
job.flags |= 1;
|
|
@@ -2261,12 +2467,6 @@ function queueFlush() {
|
|
|
2261
2467
|
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
2262
2468
|
}
|
|
2263
2469
|
}
|
|
2264
|
-
function invalidateJob(job) {
|
|
2265
|
-
const i = queue.indexOf(job);
|
|
2266
|
-
if (i > flushIndex) {
|
|
2267
|
-
queue.splice(i, 1);
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
2470
|
function queuePostFlushCb(cb) {
|
|
2271
2471
|
if (!isArray(cb)) {
|
|
2272
2472
|
if (activePostFlushCbs && cb.id === -1) {
|
|
@@ -2328,24 +2528,13 @@ function flushPostFlushCbs(seen) {
|
|
|
2328
2528
|
postFlushIndex = 0;
|
|
2329
2529
|
}
|
|
2330
2530
|
}
|
|
2331
|
-
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
2332
|
-
const comparator = (a, b) => {
|
|
2333
|
-
const diff = getId(a) - getId(b);
|
|
2334
|
-
if (diff === 0) {
|
|
2335
|
-
const isAPre = a.flags & 2;
|
|
2336
|
-
const isBPre = b.flags & 2;
|
|
2337
|
-
if (isAPre && !isBPre) return -1;
|
|
2338
|
-
if (isBPre && !isAPre) return 1;
|
|
2339
|
-
}
|
|
2340
|
-
return diff;
|
|
2341
|
-
};
|
|
2531
|
+
const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
2342
2532
|
function flushJobs(seen) {
|
|
2343
2533
|
isFlushPending = false;
|
|
2344
2534
|
isFlushing = true;
|
|
2345
2535
|
{
|
|
2346
2536
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2347
2537
|
}
|
|
2348
|
-
queue.sort(comparator);
|
|
2349
2538
|
const check = (job) => checkRecursiveUpdates(seen, job) ;
|
|
2350
2539
|
try {
|
|
2351
2540
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
@@ -2986,7 +3175,7 @@ function on(instance, event, fn) {
|
|
|
2986
3175
|
function once(instance, event, fn) {
|
|
2987
3176
|
const wrapped = (...args) => {
|
|
2988
3177
|
off(instance, event, wrapped);
|
|
2989
|
-
fn.
|
|
3178
|
+
fn.apply(instance.proxy, args);
|
|
2990
3179
|
};
|
|
2991
3180
|
wrapped.fn = fn;
|
|
2992
3181
|
on(instance, event, wrapped);
|
|
@@ -6520,23 +6709,43 @@ function callHook$1(hook, instance, type) {
|
|
|
6520
6709
|
);
|
|
6521
6710
|
}
|
|
6522
6711
|
function createWatcher(raw, ctx, publicThis, key) {
|
|
6523
|
-
|
|
6712
|
+
let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
|
6713
|
+
const options = {};
|
|
6714
|
+
{
|
|
6715
|
+
const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
|
|
6716
|
+
const newValue = getter();
|
|
6717
|
+
if (isArray(newValue) && isCompatEnabled("WATCH_ARRAY", instance)) {
|
|
6718
|
+
options.deep = true;
|
|
6719
|
+
}
|
|
6720
|
+
const baseGetter = getter;
|
|
6721
|
+
getter = () => {
|
|
6722
|
+
const val = baseGetter();
|
|
6723
|
+
if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
|
|
6724
|
+
traverse(val);
|
|
6725
|
+
}
|
|
6726
|
+
return val;
|
|
6727
|
+
};
|
|
6728
|
+
}
|
|
6524
6729
|
if (isString(raw)) {
|
|
6525
6730
|
const handler = ctx[raw];
|
|
6526
6731
|
if (isFunction(handler)) {
|
|
6527
|
-
|
|
6732
|
+
{
|
|
6733
|
+
watch(getter, handler, options);
|
|
6734
|
+
}
|
|
6528
6735
|
} else {
|
|
6529
6736
|
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
6530
6737
|
}
|
|
6531
6738
|
} else if (isFunction(raw)) {
|
|
6532
|
-
|
|
6739
|
+
{
|
|
6740
|
+
watch(getter, raw.bind(publicThis), options);
|
|
6741
|
+
}
|
|
6533
6742
|
} else if (isObject(raw)) {
|
|
6534
6743
|
if (isArray(raw)) {
|
|
6535
6744
|
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
6536
6745
|
} else {
|
|
6537
6746
|
const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
|
6538
6747
|
if (isFunction(handler)) {
|
|
6539
|
-
watch(getter, handler, raw);
|
|
6748
|
+
watch(getter, handler, extend(raw, options) );
|
|
6540
6749
|
} else {
|
|
6541
6750
|
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
6542
6751
|
}
|
|
@@ -6760,7 +6969,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6760
6969
|
return vm;
|
|
6761
6970
|
}
|
|
6762
6971
|
}
|
|
6763
|
-
Vue.version = `2.6.14-compat:${"3.5.0-beta.
|
|
6972
|
+
Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
|
|
6764
6973
|
Vue.config = singletonApp.config;
|
|
6765
6974
|
Vue.use = (plugin, ...options) => {
|
|
6766
6975
|
if (plugin && isFunction(plugin.install)) {
|
|
@@ -7092,7 +7301,7 @@ function defineReactive(obj, key, val) {
|
|
|
7092
7301
|
if (isArray(val)) {
|
|
7093
7302
|
methodsToPatch.forEach((m) => {
|
|
7094
7303
|
val[m] = (...args) => {
|
|
7095
|
-
Array.prototype[m].
|
|
7304
|
+
Array.prototype[m].apply(reactiveVal, args);
|
|
7096
7305
|
};
|
|
7097
7306
|
});
|
|
7098
7307
|
} else {
|
|
@@ -8287,7 +8496,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8287
8496
|
if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
|
8288
8497
|
subTree = filterSingleRoot(subTree.children) || subTree;
|
|
8289
8498
|
}
|
|
8290
|
-
if (vnode === subTree) {
|
|
8499
|
+
if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
|
|
8291
8500
|
const parentVNode = parentComponent.vnode;
|
|
8292
8501
|
setScopeId(
|
|
8293
8502
|
el,
|
|
@@ -8617,7 +8826,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8617
8826
|
return;
|
|
8618
8827
|
} else {
|
|
8619
8828
|
instance.next = n2;
|
|
8620
|
-
invalidateJob(instance.update);
|
|
8621
8829
|
instance.update();
|
|
8622
8830
|
}
|
|
8623
8831
|
} else {
|
|
@@ -9541,7 +9749,6 @@ function watchSyncEffect(effect, options) {
|
|
|
9541
9749
|
extend({}, options, { flush: "sync" })
|
|
9542
9750
|
);
|
|
9543
9751
|
}
|
|
9544
|
-
const INITIAL_WATCHER_VALUE = {};
|
|
9545
9752
|
function watch(source, cb, options) {
|
|
9546
9753
|
if (!isFunction(cb)) {
|
|
9547
9754
|
warn$1(
|
|
@@ -9550,21 +9757,8 @@ function watch(source, cb, options) {
|
|
|
9550
9757
|
}
|
|
9551
9758
|
return doWatch(source, cb, options);
|
|
9552
9759
|
}
|
|
9553
|
-
function doWatch(source, cb, {
|
|
9554
|
-
immediate,
|
|
9555
|
-
deep,
|
|
9556
|
-
flush,
|
|
9557
|
-
once,
|
|
9558
|
-
onTrack,
|
|
9559
|
-
onTrigger
|
|
9560
|
-
} = EMPTY_OBJ) {
|
|
9561
|
-
if (cb && once) {
|
|
9562
|
-
const _cb = cb;
|
|
9563
|
-
cb = (...args) => {
|
|
9564
|
-
_cb(...args);
|
|
9565
|
-
watchHandle();
|
|
9566
|
-
};
|
|
9567
|
-
}
|
|
9760
|
+
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
9761
|
+
const { immediate, deep, flush, once } = options;
|
|
9568
9762
|
if (!cb) {
|
|
9569
9763
|
if (immediate !== void 0) {
|
|
9570
9764
|
warn$1(
|
|
@@ -9582,173 +9776,53 @@ function doWatch(source, cb, {
|
|
|
9582
9776
|
);
|
|
9583
9777
|
}
|
|
9584
9778
|
}
|
|
9585
|
-
const
|
|
9586
|
-
|
|
9587
|
-
`Invalid watch source: `,
|
|
9588
|
-
s,
|
|
9589
|
-
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
9590
|
-
);
|
|
9591
|
-
};
|
|
9592
|
-
const instance = currentInstance;
|
|
9593
|
-
const reactiveGetter = (source2) => {
|
|
9594
|
-
if (deep) return source2;
|
|
9595
|
-
if (isShallow(source2) || deep === false || deep === 0)
|
|
9596
|
-
return traverse(source2, 1);
|
|
9597
|
-
return traverse(source2);
|
|
9598
|
-
};
|
|
9599
|
-
let getter;
|
|
9600
|
-
let forceTrigger = false;
|
|
9601
|
-
let isMultiSource = false;
|
|
9602
|
-
if (isRef(source)) {
|
|
9603
|
-
getter = () => source.value;
|
|
9604
|
-
forceTrigger = isShallow(source);
|
|
9605
|
-
} else if (isReactive(source)) {
|
|
9606
|
-
getter = () => reactiveGetter(source);
|
|
9607
|
-
forceTrigger = true;
|
|
9608
|
-
} else if (isArray(source)) {
|
|
9609
|
-
isMultiSource = true;
|
|
9610
|
-
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
9611
|
-
getter = () => source.map((s) => {
|
|
9612
|
-
if (isRef(s)) {
|
|
9613
|
-
return s.value;
|
|
9614
|
-
} else if (isReactive(s)) {
|
|
9615
|
-
return reactiveGetter(s);
|
|
9616
|
-
} else if (isFunction(s)) {
|
|
9617
|
-
return callWithErrorHandling(s, instance, 2);
|
|
9618
|
-
} else {
|
|
9619
|
-
warnInvalidSource(s);
|
|
9620
|
-
}
|
|
9621
|
-
});
|
|
9622
|
-
} else if (isFunction(source)) {
|
|
9623
|
-
if (cb) {
|
|
9624
|
-
getter = () => callWithErrorHandling(source, instance, 2);
|
|
9625
|
-
} else {
|
|
9626
|
-
getter = () => {
|
|
9627
|
-
if (cleanup) {
|
|
9628
|
-
cleanup();
|
|
9629
|
-
}
|
|
9630
|
-
return callWithAsyncErrorHandling(
|
|
9631
|
-
source,
|
|
9632
|
-
instance,
|
|
9633
|
-
3,
|
|
9634
|
-
[onCleanup]
|
|
9635
|
-
);
|
|
9636
|
-
};
|
|
9637
|
-
}
|
|
9638
|
-
} else {
|
|
9639
|
-
getter = NOOP;
|
|
9640
|
-
warnInvalidSource(source);
|
|
9641
|
-
}
|
|
9642
|
-
if (cb && !deep) {
|
|
9643
|
-
const baseGetter = getter;
|
|
9644
|
-
getter = () => {
|
|
9645
|
-
const val = baseGetter();
|
|
9646
|
-
if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
|
|
9647
|
-
traverse(val);
|
|
9648
|
-
}
|
|
9649
|
-
return val;
|
|
9650
|
-
};
|
|
9651
|
-
}
|
|
9652
|
-
if (cb && deep) {
|
|
9653
|
-
const baseGetter = getter;
|
|
9654
|
-
const depth = deep === true ? Infinity : deep;
|
|
9655
|
-
getter = () => traverse(baseGetter(), depth);
|
|
9656
|
-
}
|
|
9657
|
-
let cleanup;
|
|
9658
|
-
let onCleanup = (fn) => {
|
|
9659
|
-
cleanup = effect.onStop = () => {
|
|
9660
|
-
callWithErrorHandling(fn, instance, 4);
|
|
9661
|
-
cleanup = effect.onStop = void 0;
|
|
9662
|
-
};
|
|
9663
|
-
};
|
|
9779
|
+
const baseWatchOptions = extend({}, options);
|
|
9780
|
+
baseWatchOptions.onWarn = warn$1;
|
|
9664
9781
|
let ssrCleanup;
|
|
9665
9782
|
if (isInSSRComponentSetup) {
|
|
9666
|
-
onCleanup = NOOP;
|
|
9667
|
-
if (!cb) {
|
|
9668
|
-
getter();
|
|
9669
|
-
} else if (immediate) {
|
|
9670
|
-
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
9671
|
-
getter(),
|
|
9672
|
-
isMultiSource ? [] : void 0,
|
|
9673
|
-
onCleanup
|
|
9674
|
-
]);
|
|
9675
|
-
}
|
|
9676
9783
|
if (flush === "sync") {
|
|
9677
9784
|
const ctx = useSSRContext();
|
|
9678
9785
|
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
|
|
9786
|
+
} else if (!cb || immediate) {
|
|
9787
|
+
baseWatchOptions.once = true;
|
|
9679
9788
|
} else {
|
|
9680
|
-
|
|
9789
|
+
return {
|
|
9790
|
+
stop: NOOP,
|
|
9791
|
+
resume: NOOP,
|
|
9792
|
+
pause: NOOP
|
|
9681
9793
|
};
|
|
9682
|
-
watchHandle2.stop = NOOP;
|
|
9683
|
-
watchHandle2.resume = NOOP;
|
|
9684
|
-
watchHandle2.pause = NOOP;
|
|
9685
|
-
return watchHandle2;
|
|
9686
9794
|
}
|
|
9687
9795
|
}
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
9703
|
-
onCleanup
|
|
9704
|
-
]);
|
|
9705
|
-
oldValue = newValue;
|
|
9796
|
+
const instance = currentInstance;
|
|
9797
|
+
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
9798
|
+
let isPre = false;
|
|
9799
|
+
if (flush === "post") {
|
|
9800
|
+
baseWatchOptions.scheduler = (job) => {
|
|
9801
|
+
queuePostRenderEffect(job, instance && instance.suspense);
|
|
9802
|
+
};
|
|
9803
|
+
} else if (flush !== "sync") {
|
|
9804
|
+
isPre = true;
|
|
9805
|
+
baseWatchOptions.scheduler = (job, isFirstRun) => {
|
|
9806
|
+
if (isFirstRun) {
|
|
9807
|
+
job();
|
|
9808
|
+
} else {
|
|
9809
|
+
queueJob(job);
|
|
9706
9810
|
}
|
|
9707
|
-
}
|
|
9708
|
-
effect.run();
|
|
9709
|
-
}
|
|
9710
|
-
};
|
|
9711
|
-
if (cb) job.flags |= 4;
|
|
9712
|
-
const effect = new ReactiveEffect(getter);
|
|
9713
|
-
let scheduler;
|
|
9714
|
-
if (flush === "sync") {
|
|
9715
|
-
scheduler = job;
|
|
9716
|
-
} else if (flush === "post") {
|
|
9717
|
-
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
9718
|
-
} else {
|
|
9719
|
-
job.flags |= 2;
|
|
9720
|
-
if (instance) job.id = instance.uid;
|
|
9721
|
-
scheduler = () => queueJob(job);
|
|
9811
|
+
};
|
|
9722
9812
|
}
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
effect.stop();
|
|
9727
|
-
if (scope) {
|
|
9728
|
-
remove(scope.effects, effect);
|
|
9813
|
+
baseWatchOptions.augmentJob = (job) => {
|
|
9814
|
+
if (cb) {
|
|
9815
|
+
job.flags |= 4;
|
|
9729
9816
|
}
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
effect.onTrigger = onTrigger;
|
|
9737
|
-
}
|
|
9738
|
-
if (cb) {
|
|
9739
|
-
if (immediate) {
|
|
9740
|
-
job(true);
|
|
9741
|
-
} else {
|
|
9742
|
-
oldValue = effect.run();
|
|
9817
|
+
if (isPre) {
|
|
9818
|
+
job.flags |= 2;
|
|
9819
|
+
if (instance) {
|
|
9820
|
+
job.id = instance.uid;
|
|
9821
|
+
job.i = instance;
|
|
9822
|
+
}
|
|
9743
9823
|
}
|
|
9744
|
-
}
|
|
9745
|
-
|
|
9746
|
-
effect.run.bind(effect),
|
|
9747
|
-
instance && instance.suspense
|
|
9748
|
-
);
|
|
9749
|
-
} else {
|
|
9750
|
-
effect.run();
|
|
9751
|
-
}
|
|
9824
|
+
};
|
|
9825
|
+
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
9752
9826
|
if (ssrCleanup) ssrCleanup.push(watchHandle);
|
|
9753
9827
|
return watchHandle;
|
|
9754
9828
|
}
|
|
@@ -9777,38 +9851,6 @@ function createPathGetter(ctx, path) {
|
|
|
9777
9851
|
return cur;
|
|
9778
9852
|
};
|
|
9779
9853
|
}
|
|
9780
|
-
function traverse(value, depth = Infinity, seen) {
|
|
9781
|
-
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
9782
|
-
return value;
|
|
9783
|
-
}
|
|
9784
|
-
seen = seen || /* @__PURE__ */ new Set();
|
|
9785
|
-
if (seen.has(value)) {
|
|
9786
|
-
return value;
|
|
9787
|
-
}
|
|
9788
|
-
seen.add(value);
|
|
9789
|
-
depth--;
|
|
9790
|
-
if (isRef(value)) {
|
|
9791
|
-
traverse(value.value, depth, seen);
|
|
9792
|
-
} else if (isArray(value)) {
|
|
9793
|
-
for (let i = 0; i < value.length; i++) {
|
|
9794
|
-
traverse(value[i], depth, seen);
|
|
9795
|
-
}
|
|
9796
|
-
} else if (isSet(value) || isMap(value)) {
|
|
9797
|
-
value.forEach((v) => {
|
|
9798
|
-
traverse(v, depth, seen);
|
|
9799
|
-
});
|
|
9800
|
-
} else if (isPlainObject(value)) {
|
|
9801
|
-
for (const key in value) {
|
|
9802
|
-
traverse(value[key], depth, seen);
|
|
9803
|
-
}
|
|
9804
|
-
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
9805
|
-
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
9806
|
-
traverse(value[key], depth, seen);
|
|
9807
|
-
}
|
|
9808
|
-
}
|
|
9809
|
-
}
|
|
9810
|
-
return value;
|
|
9811
|
-
}
|
|
9812
9854
|
|
|
9813
9855
|
function useModel(props, name, options = EMPTY_OBJ) {
|
|
9814
9856
|
const i = getCurrentInstance();
|
|
@@ -12063,7 +12105,7 @@ function isMemoSame(cached, memo) {
|
|
|
12063
12105
|
return true;
|
|
12064
12106
|
}
|
|
12065
12107
|
|
|
12066
|
-
const version = "3.5.0-beta.
|
|
12108
|
+
const version = "3.5.0-beta.3";
|
|
12067
12109
|
const warn = warn$1 ;
|
|
12068
12110
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
12069
12111
|
const devtools = devtools$1 ;
|
|
@@ -14105,6 +14147,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
14105
14147
|
effectScope: effectScope,
|
|
14106
14148
|
getCurrentInstance: getCurrentInstance,
|
|
14107
14149
|
getCurrentScope: getCurrentScope,
|
|
14150
|
+
getCurrentWatcher: getCurrentWatcher,
|
|
14108
14151
|
getTransitionRawChildren: getTransitionRawChildren,
|
|
14109
14152
|
guardReactiveProps: guardReactiveProps,
|
|
14110
14153
|
h: h,
|
|
@@ -14147,6 +14190,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
14147
14190
|
onServerPrefetch: onServerPrefetch,
|
|
14148
14191
|
onUnmounted: onUnmounted,
|
|
14149
14192
|
onUpdated: onUpdated,
|
|
14193
|
+
onWatcherCleanup: onWatcherCleanup,
|
|
14150
14194
|
openBlock: openBlock,
|
|
14151
14195
|
popScopeId: popScopeId,
|
|
14152
14196
|
provide: provide,
|
|
@@ -14260,4 +14304,4 @@ Vue.compile = () => {
|
|
|
14260
14304
|
|
|
14261
14305
|
const configureCompat = Vue.configureCompat;
|
|
14262
14306
|
|
|
14263
|
-
export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
|
|
14307
|
+
export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
|