@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
package/dist/vue.esm-browser.js
CHANGED
|
@@ -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
|
**/
|
|
@@ -1137,14 +1137,14 @@ function iterator(self, method, wrapValue) {
|
|
|
1137
1137
|
const arrayProto = Array.prototype;
|
|
1138
1138
|
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
1139
1139
|
const arr = shallowReadArray(self);
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1140
|
+
const needsWrap = arr !== self && !isShallow(self);
|
|
1141
|
+
const methodFn = arr[method];
|
|
1142
|
+
if (methodFn !== arrayProto[method]) {
|
|
1143
|
+
const result2 = methodFn.apply(arr, args);
|
|
1144
|
+
return needsWrap ? toReactive(result2) : result2;
|
|
1143
1145
|
}
|
|
1144
|
-
let needsWrap = false;
|
|
1145
1146
|
let wrappedFn = fn;
|
|
1146
1147
|
if (arr !== self) {
|
|
1147
|
-
needsWrap = !isShallow(self);
|
|
1148
1148
|
if (needsWrap) {
|
|
1149
1149
|
wrappedFn = function(item, index) {
|
|
1150
1150
|
return fn.call(this, toReactive(item), index, self);
|
|
@@ -2006,6 +2006,220 @@ const TriggerOpTypes = {
|
|
|
2006
2006
|
"CLEAR": "clear"
|
|
2007
2007
|
};
|
|
2008
2008
|
|
|
2009
|
+
const INITIAL_WATCHER_VALUE = {};
|
|
2010
|
+
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
2011
|
+
let activeWatcher = void 0;
|
|
2012
|
+
function getCurrentWatcher() {
|
|
2013
|
+
return activeWatcher;
|
|
2014
|
+
}
|
|
2015
|
+
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
2016
|
+
if (owner) {
|
|
2017
|
+
let cleanups = cleanupMap.get(owner);
|
|
2018
|
+
if (!cleanups) cleanupMap.set(owner, cleanups = []);
|
|
2019
|
+
cleanups.push(cleanupFn);
|
|
2020
|
+
} else if (!failSilently) {
|
|
2021
|
+
warn$2(
|
|
2022
|
+
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
2023
|
+
);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
function watch$1(source, cb, options = EMPTY_OBJ) {
|
|
2027
|
+
const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
|
2028
|
+
const warnInvalidSource = (s) => {
|
|
2029
|
+
(options.onWarn || warn$2)(
|
|
2030
|
+
`Invalid watch source: `,
|
|
2031
|
+
s,
|
|
2032
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
2033
|
+
);
|
|
2034
|
+
};
|
|
2035
|
+
const reactiveGetter = (source2) => {
|
|
2036
|
+
if (deep) return source2;
|
|
2037
|
+
if (isShallow(source2) || deep === false || deep === 0)
|
|
2038
|
+
return traverse(source2, 1);
|
|
2039
|
+
return traverse(source2);
|
|
2040
|
+
};
|
|
2041
|
+
let effect;
|
|
2042
|
+
let getter;
|
|
2043
|
+
let cleanup;
|
|
2044
|
+
let boundCleanup;
|
|
2045
|
+
let forceTrigger = false;
|
|
2046
|
+
let isMultiSource = false;
|
|
2047
|
+
if (isRef(source)) {
|
|
2048
|
+
getter = () => source.value;
|
|
2049
|
+
forceTrigger = isShallow(source);
|
|
2050
|
+
} else if (isReactive(source)) {
|
|
2051
|
+
getter = () => reactiveGetter(source);
|
|
2052
|
+
forceTrigger = true;
|
|
2053
|
+
} else if (isArray(source)) {
|
|
2054
|
+
isMultiSource = true;
|
|
2055
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
2056
|
+
getter = () => source.map((s) => {
|
|
2057
|
+
if (isRef(s)) {
|
|
2058
|
+
return s.value;
|
|
2059
|
+
} else if (isReactive(s)) {
|
|
2060
|
+
return reactiveGetter(s);
|
|
2061
|
+
} else if (isFunction(s)) {
|
|
2062
|
+
return call ? call(s, 2) : s();
|
|
2063
|
+
} else {
|
|
2064
|
+
warnInvalidSource(s);
|
|
2065
|
+
}
|
|
2066
|
+
});
|
|
2067
|
+
} else if (isFunction(source)) {
|
|
2068
|
+
if (cb) {
|
|
2069
|
+
getter = call ? () => call(source, 2) : source;
|
|
2070
|
+
} else {
|
|
2071
|
+
getter = () => {
|
|
2072
|
+
if (cleanup) {
|
|
2073
|
+
pauseTracking();
|
|
2074
|
+
try {
|
|
2075
|
+
cleanup();
|
|
2076
|
+
} finally {
|
|
2077
|
+
resetTracking();
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
const currentEffect = activeWatcher;
|
|
2081
|
+
activeWatcher = effect;
|
|
2082
|
+
try {
|
|
2083
|
+
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
2084
|
+
} finally {
|
|
2085
|
+
activeWatcher = currentEffect;
|
|
2086
|
+
}
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
} else {
|
|
2090
|
+
getter = NOOP;
|
|
2091
|
+
warnInvalidSource(source);
|
|
2092
|
+
}
|
|
2093
|
+
if (cb && deep) {
|
|
2094
|
+
const baseGetter = getter;
|
|
2095
|
+
const depth = deep === true ? Infinity : deep;
|
|
2096
|
+
getter = () => traverse(baseGetter(), depth);
|
|
2097
|
+
}
|
|
2098
|
+
if (once) {
|
|
2099
|
+
if (cb) {
|
|
2100
|
+
const _cb = cb;
|
|
2101
|
+
cb = (...args) => {
|
|
2102
|
+
_cb(...args);
|
|
2103
|
+
effect.stop();
|
|
2104
|
+
};
|
|
2105
|
+
} else {
|
|
2106
|
+
const _getter = getter;
|
|
2107
|
+
getter = () => {
|
|
2108
|
+
_getter();
|
|
2109
|
+
effect.stop();
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2114
|
+
const job = (immediateFirstRun) => {
|
|
2115
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
2116
|
+
return;
|
|
2117
|
+
}
|
|
2118
|
+
if (cb) {
|
|
2119
|
+
const newValue = effect.run();
|
|
2120
|
+
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2121
|
+
if (cleanup) {
|
|
2122
|
+
cleanup();
|
|
2123
|
+
}
|
|
2124
|
+
const currentWatcher = activeWatcher;
|
|
2125
|
+
activeWatcher = effect;
|
|
2126
|
+
try {
|
|
2127
|
+
const args = [
|
|
2128
|
+
newValue,
|
|
2129
|
+
// pass undefined as the old value when it's changed for the first time
|
|
2130
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2131
|
+
boundCleanup
|
|
2132
|
+
];
|
|
2133
|
+
call ? call(cb, 3, args) : (
|
|
2134
|
+
// @ts-expect-error
|
|
2135
|
+
cb(...args)
|
|
2136
|
+
);
|
|
2137
|
+
oldValue = newValue;
|
|
2138
|
+
} finally {
|
|
2139
|
+
activeWatcher = currentWatcher;
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
} else {
|
|
2143
|
+
effect.run();
|
|
2144
|
+
}
|
|
2145
|
+
};
|
|
2146
|
+
if (augmentJob) {
|
|
2147
|
+
augmentJob(job);
|
|
2148
|
+
}
|
|
2149
|
+
effect = new ReactiveEffect(getter);
|
|
2150
|
+
effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
2151
|
+
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
|
2152
|
+
cleanup = effect.onStop = () => {
|
|
2153
|
+
const cleanups = cleanupMap.get(effect);
|
|
2154
|
+
if (cleanups) {
|
|
2155
|
+
if (call) {
|
|
2156
|
+
call(cleanups, 4);
|
|
2157
|
+
} else {
|
|
2158
|
+
for (const cleanup2 of cleanups) cleanup2();
|
|
2159
|
+
}
|
|
2160
|
+
cleanupMap.delete(effect);
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
{
|
|
2164
|
+
effect.onTrack = options.onTrack;
|
|
2165
|
+
effect.onTrigger = options.onTrigger;
|
|
2166
|
+
}
|
|
2167
|
+
if (cb) {
|
|
2168
|
+
if (immediate) {
|
|
2169
|
+
job(true);
|
|
2170
|
+
} else {
|
|
2171
|
+
oldValue = effect.run();
|
|
2172
|
+
}
|
|
2173
|
+
} else if (scheduler) {
|
|
2174
|
+
scheduler(job.bind(null, true), true);
|
|
2175
|
+
} else {
|
|
2176
|
+
effect.run();
|
|
2177
|
+
}
|
|
2178
|
+
const scope = getCurrentScope();
|
|
2179
|
+
const watchHandle = () => {
|
|
2180
|
+
effect.stop();
|
|
2181
|
+
if (scope) {
|
|
2182
|
+
remove(scope.effects, effect);
|
|
2183
|
+
}
|
|
2184
|
+
};
|
|
2185
|
+
watchHandle.pause = effect.pause.bind(effect);
|
|
2186
|
+
watchHandle.resume = effect.resume.bind(effect);
|
|
2187
|
+
watchHandle.stop = watchHandle;
|
|
2188
|
+
return watchHandle;
|
|
2189
|
+
}
|
|
2190
|
+
function traverse(value, depth = Infinity, seen) {
|
|
2191
|
+
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
2192
|
+
return value;
|
|
2193
|
+
}
|
|
2194
|
+
seen = seen || /* @__PURE__ */ new Set();
|
|
2195
|
+
if (seen.has(value)) {
|
|
2196
|
+
return value;
|
|
2197
|
+
}
|
|
2198
|
+
seen.add(value);
|
|
2199
|
+
depth--;
|
|
2200
|
+
if (isRef(value)) {
|
|
2201
|
+
traverse(value.value, depth, seen);
|
|
2202
|
+
} else if (isArray(value)) {
|
|
2203
|
+
for (let i = 0; i < value.length; i++) {
|
|
2204
|
+
traverse(value[i], depth, seen);
|
|
2205
|
+
}
|
|
2206
|
+
} else if (isSet(value) || isMap(value)) {
|
|
2207
|
+
value.forEach((v) => {
|
|
2208
|
+
traverse(v, depth, seen);
|
|
2209
|
+
});
|
|
2210
|
+
} else if (isPlainObject(value)) {
|
|
2211
|
+
for (const key in value) {
|
|
2212
|
+
traverse(value[key], depth, seen);
|
|
2213
|
+
}
|
|
2214
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
2215
|
+
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
2216
|
+
traverse(value[key], depth, seen);
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
return value;
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2009
2223
|
const stack$1 = [];
|
|
2010
2224
|
function pushWarningContext(vnode) {
|
|
2011
2225
|
stack$1.push(vnode);
|
|
@@ -2133,12 +2347,6 @@ const ErrorCodes = {
|
|
|
2133
2347
|
"0": "SETUP_FUNCTION",
|
|
2134
2348
|
"RENDER_FUNCTION": 1,
|
|
2135
2349
|
"1": "RENDER_FUNCTION",
|
|
2136
|
-
"WATCH_GETTER": 2,
|
|
2137
|
-
"2": "WATCH_GETTER",
|
|
2138
|
-
"WATCH_CALLBACK": 3,
|
|
2139
|
-
"3": "WATCH_CALLBACK",
|
|
2140
|
-
"WATCH_CLEANUP": 4,
|
|
2141
|
-
"4": "WATCH_CLEANUP",
|
|
2142
2350
|
"NATIVE_EVENT_HANDLER": 5,
|
|
2143
2351
|
"5": "NATIVE_EVENT_HANDLER",
|
|
2144
2352
|
"COMPONENT_EVENT_HANDLER": 6,
|
|
@@ -2290,7 +2498,7 @@ function nextTick(fn) {
|
|
|
2290
2498
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2291
2499
|
}
|
|
2292
2500
|
function findInsertionIndex(id) {
|
|
2293
|
-
let start = flushIndex + 1;
|
|
2501
|
+
let start = isFlushing ? flushIndex + 1 : 0;
|
|
2294
2502
|
let end = queue.length;
|
|
2295
2503
|
while (start < end) {
|
|
2296
2504
|
const middle = start + end >>> 1;
|
|
@@ -2306,15 +2514,13 @@ function findInsertionIndex(id) {
|
|
|
2306
2514
|
}
|
|
2307
2515
|
function queueJob(job) {
|
|
2308
2516
|
if (!(job.flags & 1)) {
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
!(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
|
|
2314
|
-
) {
|
|
2517
|
+
const jobId = getId(job);
|
|
2518
|
+
const lastJob = queue[queue.length - 1];
|
|
2519
|
+
if (!lastJob || // fast path when the job id is larger than the tail
|
|
2520
|
+
!(job.flags & 2) && jobId >= getId(lastJob)) {
|
|
2315
2521
|
queue.push(job);
|
|
2316
2522
|
} else {
|
|
2317
|
-
queue.splice(findInsertionIndex(
|
|
2523
|
+
queue.splice(findInsertionIndex(jobId), 0, job);
|
|
2318
2524
|
}
|
|
2319
2525
|
if (!(job.flags & 4)) {
|
|
2320
2526
|
job.flags |= 1;
|
|
@@ -2328,12 +2534,6 @@ function queueFlush() {
|
|
|
2328
2534
|
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
2329
2535
|
}
|
|
2330
2536
|
}
|
|
2331
|
-
function invalidateJob(job) {
|
|
2332
|
-
const i = queue.indexOf(job);
|
|
2333
|
-
if (i > flushIndex) {
|
|
2334
|
-
queue.splice(i, 1);
|
|
2335
|
-
}
|
|
2336
|
-
}
|
|
2337
2537
|
function queuePostFlushCb(cb) {
|
|
2338
2538
|
if (!isArray(cb)) {
|
|
2339
2539
|
if (activePostFlushCbs && cb.id === -1) {
|
|
@@ -2395,24 +2595,13 @@ function flushPostFlushCbs(seen) {
|
|
|
2395
2595
|
postFlushIndex = 0;
|
|
2396
2596
|
}
|
|
2397
2597
|
}
|
|
2398
|
-
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
2399
|
-
const comparator = (a, b) => {
|
|
2400
|
-
const diff = getId(a) - getId(b);
|
|
2401
|
-
if (diff === 0) {
|
|
2402
|
-
const isAPre = a.flags & 2;
|
|
2403
|
-
const isBPre = b.flags & 2;
|
|
2404
|
-
if (isAPre && !isBPre) return -1;
|
|
2405
|
-
if (isBPre && !isAPre) return 1;
|
|
2406
|
-
}
|
|
2407
|
-
return diff;
|
|
2408
|
-
};
|
|
2598
|
+
const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
2409
2599
|
function flushJobs(seen) {
|
|
2410
2600
|
isFlushPending = false;
|
|
2411
2601
|
isFlushing = true;
|
|
2412
2602
|
{
|
|
2413
2603
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2414
2604
|
}
|
|
2415
|
-
queue.sort(comparator);
|
|
2416
2605
|
const check = (job) => checkRecursiveUpdates(seen, job) ;
|
|
2417
2606
|
try {
|
|
2418
2607
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
@@ -3053,7 +3242,7 @@ function on(instance, event, fn) {
|
|
|
3053
3242
|
function once(instance, event, fn) {
|
|
3054
3243
|
const wrapped = (...args) => {
|
|
3055
3244
|
off(instance, event, wrapped);
|
|
3056
|
-
fn.
|
|
3245
|
+
fn.apply(instance.proxy, args);
|
|
3057
3246
|
};
|
|
3058
3247
|
wrapped.fn = fn;
|
|
3059
3248
|
on(instance, event, wrapped);
|
|
@@ -6587,23 +6776,43 @@ function callHook$1(hook, instance, type) {
|
|
|
6587
6776
|
);
|
|
6588
6777
|
}
|
|
6589
6778
|
function createWatcher(raw, ctx, publicThis, key) {
|
|
6590
|
-
|
|
6779
|
+
let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
|
6780
|
+
const options = {};
|
|
6781
|
+
{
|
|
6782
|
+
const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
|
|
6783
|
+
const newValue = getter();
|
|
6784
|
+
if (isArray(newValue) && isCompatEnabled$1("WATCH_ARRAY", instance)) {
|
|
6785
|
+
options.deep = true;
|
|
6786
|
+
}
|
|
6787
|
+
const baseGetter = getter;
|
|
6788
|
+
getter = () => {
|
|
6789
|
+
const val = baseGetter();
|
|
6790
|
+
if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
|
|
6791
|
+
traverse(val);
|
|
6792
|
+
}
|
|
6793
|
+
return val;
|
|
6794
|
+
};
|
|
6795
|
+
}
|
|
6591
6796
|
if (isString(raw)) {
|
|
6592
6797
|
const handler = ctx[raw];
|
|
6593
6798
|
if (isFunction(handler)) {
|
|
6594
|
-
|
|
6799
|
+
{
|
|
6800
|
+
watch(getter, handler, options);
|
|
6801
|
+
}
|
|
6595
6802
|
} else {
|
|
6596
6803
|
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
6597
6804
|
}
|
|
6598
6805
|
} else if (isFunction(raw)) {
|
|
6599
|
-
|
|
6806
|
+
{
|
|
6807
|
+
watch(getter, raw.bind(publicThis), options);
|
|
6808
|
+
}
|
|
6600
6809
|
} else if (isObject(raw)) {
|
|
6601
6810
|
if (isArray(raw)) {
|
|
6602
6811
|
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
6603
6812
|
} else {
|
|
6604
6813
|
const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
|
6605
6814
|
if (isFunction(handler)) {
|
|
6606
|
-
watch(getter, handler, raw);
|
|
6815
|
+
watch(getter, handler, extend(raw, options) );
|
|
6607
6816
|
} else {
|
|
6608
6817
|
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
6609
6818
|
}
|
|
@@ -6827,7 +7036,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6827
7036
|
return vm;
|
|
6828
7037
|
}
|
|
6829
7038
|
}
|
|
6830
|
-
Vue.version = `2.6.14-compat:${"3.5.0-beta.
|
|
7039
|
+
Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
|
|
6831
7040
|
Vue.config = singletonApp.config;
|
|
6832
7041
|
Vue.use = (plugin, ...options) => {
|
|
6833
7042
|
if (plugin && isFunction(plugin.install)) {
|
|
@@ -7159,7 +7368,7 @@ function defineReactive(obj, key, val) {
|
|
|
7159
7368
|
if (isArray(val)) {
|
|
7160
7369
|
methodsToPatch.forEach((m) => {
|
|
7161
7370
|
val[m] = (...args) => {
|
|
7162
|
-
Array.prototype[m].
|
|
7371
|
+
Array.prototype[m].apply(reactiveVal, args);
|
|
7163
7372
|
};
|
|
7164
7373
|
});
|
|
7165
7374
|
} else {
|
|
@@ -8354,7 +8563,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8354
8563
|
if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
|
8355
8564
|
subTree = filterSingleRoot(subTree.children) || subTree;
|
|
8356
8565
|
}
|
|
8357
|
-
if (vnode === subTree) {
|
|
8566
|
+
if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
|
|
8358
8567
|
const parentVNode = parentComponent.vnode;
|
|
8359
8568
|
setScopeId(
|
|
8360
8569
|
el,
|
|
@@ -8684,7 +8893,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8684
8893
|
return;
|
|
8685
8894
|
} else {
|
|
8686
8895
|
instance.next = n2;
|
|
8687
|
-
invalidateJob(instance.update);
|
|
8688
8896
|
instance.update();
|
|
8689
8897
|
}
|
|
8690
8898
|
} else {
|
|
@@ -9608,7 +9816,6 @@ function watchSyncEffect(effect, options) {
|
|
|
9608
9816
|
extend({}, options, { flush: "sync" })
|
|
9609
9817
|
);
|
|
9610
9818
|
}
|
|
9611
|
-
const INITIAL_WATCHER_VALUE = {};
|
|
9612
9819
|
function watch(source, cb, options) {
|
|
9613
9820
|
if (!isFunction(cb)) {
|
|
9614
9821
|
warn$1(
|
|
@@ -9617,21 +9824,8 @@ function watch(source, cb, options) {
|
|
|
9617
9824
|
}
|
|
9618
9825
|
return doWatch(source, cb, options);
|
|
9619
9826
|
}
|
|
9620
|
-
function doWatch(source, cb, {
|
|
9621
|
-
immediate,
|
|
9622
|
-
deep,
|
|
9623
|
-
flush,
|
|
9624
|
-
once,
|
|
9625
|
-
onTrack,
|
|
9626
|
-
onTrigger
|
|
9627
|
-
} = EMPTY_OBJ) {
|
|
9628
|
-
if (cb && once) {
|
|
9629
|
-
const _cb = cb;
|
|
9630
|
-
cb = (...args) => {
|
|
9631
|
-
_cb(...args);
|
|
9632
|
-
watchHandle();
|
|
9633
|
-
};
|
|
9634
|
-
}
|
|
9827
|
+
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
9828
|
+
const { immediate, deep, flush, once } = options;
|
|
9635
9829
|
if (!cb) {
|
|
9636
9830
|
if (immediate !== void 0) {
|
|
9637
9831
|
warn$1(
|
|
@@ -9649,173 +9843,53 @@ function doWatch(source, cb, {
|
|
|
9649
9843
|
);
|
|
9650
9844
|
}
|
|
9651
9845
|
}
|
|
9652
|
-
const
|
|
9653
|
-
|
|
9654
|
-
`Invalid watch source: `,
|
|
9655
|
-
s,
|
|
9656
|
-
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
9657
|
-
);
|
|
9658
|
-
};
|
|
9659
|
-
const instance = currentInstance;
|
|
9660
|
-
const reactiveGetter = (source2) => {
|
|
9661
|
-
if (deep) return source2;
|
|
9662
|
-
if (isShallow(source2) || deep === false || deep === 0)
|
|
9663
|
-
return traverse(source2, 1);
|
|
9664
|
-
return traverse(source2);
|
|
9665
|
-
};
|
|
9666
|
-
let getter;
|
|
9667
|
-
let forceTrigger = false;
|
|
9668
|
-
let isMultiSource = false;
|
|
9669
|
-
if (isRef(source)) {
|
|
9670
|
-
getter = () => source.value;
|
|
9671
|
-
forceTrigger = isShallow(source);
|
|
9672
|
-
} else if (isReactive(source)) {
|
|
9673
|
-
getter = () => reactiveGetter(source);
|
|
9674
|
-
forceTrigger = true;
|
|
9675
|
-
} else if (isArray(source)) {
|
|
9676
|
-
isMultiSource = true;
|
|
9677
|
-
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
9678
|
-
getter = () => source.map((s) => {
|
|
9679
|
-
if (isRef(s)) {
|
|
9680
|
-
return s.value;
|
|
9681
|
-
} else if (isReactive(s)) {
|
|
9682
|
-
return reactiveGetter(s);
|
|
9683
|
-
} else if (isFunction(s)) {
|
|
9684
|
-
return callWithErrorHandling(s, instance, 2);
|
|
9685
|
-
} else {
|
|
9686
|
-
warnInvalidSource(s);
|
|
9687
|
-
}
|
|
9688
|
-
});
|
|
9689
|
-
} else if (isFunction(source)) {
|
|
9690
|
-
if (cb) {
|
|
9691
|
-
getter = () => callWithErrorHandling(source, instance, 2);
|
|
9692
|
-
} else {
|
|
9693
|
-
getter = () => {
|
|
9694
|
-
if (cleanup) {
|
|
9695
|
-
cleanup();
|
|
9696
|
-
}
|
|
9697
|
-
return callWithAsyncErrorHandling(
|
|
9698
|
-
source,
|
|
9699
|
-
instance,
|
|
9700
|
-
3,
|
|
9701
|
-
[onCleanup]
|
|
9702
|
-
);
|
|
9703
|
-
};
|
|
9704
|
-
}
|
|
9705
|
-
} else {
|
|
9706
|
-
getter = NOOP;
|
|
9707
|
-
warnInvalidSource(source);
|
|
9708
|
-
}
|
|
9709
|
-
if (cb && !deep) {
|
|
9710
|
-
const baseGetter = getter;
|
|
9711
|
-
getter = () => {
|
|
9712
|
-
const val = baseGetter();
|
|
9713
|
-
if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
|
|
9714
|
-
traverse(val);
|
|
9715
|
-
}
|
|
9716
|
-
return val;
|
|
9717
|
-
};
|
|
9718
|
-
}
|
|
9719
|
-
if (cb && deep) {
|
|
9720
|
-
const baseGetter = getter;
|
|
9721
|
-
const depth = deep === true ? Infinity : deep;
|
|
9722
|
-
getter = () => traverse(baseGetter(), depth);
|
|
9723
|
-
}
|
|
9724
|
-
let cleanup;
|
|
9725
|
-
let onCleanup = (fn) => {
|
|
9726
|
-
cleanup = effect.onStop = () => {
|
|
9727
|
-
callWithErrorHandling(fn, instance, 4);
|
|
9728
|
-
cleanup = effect.onStop = void 0;
|
|
9729
|
-
};
|
|
9730
|
-
};
|
|
9846
|
+
const baseWatchOptions = extend({}, options);
|
|
9847
|
+
baseWatchOptions.onWarn = warn$1;
|
|
9731
9848
|
let ssrCleanup;
|
|
9732
9849
|
if (isInSSRComponentSetup) {
|
|
9733
|
-
onCleanup = NOOP;
|
|
9734
|
-
if (!cb) {
|
|
9735
|
-
getter();
|
|
9736
|
-
} else if (immediate) {
|
|
9737
|
-
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
9738
|
-
getter(),
|
|
9739
|
-
isMultiSource ? [] : void 0,
|
|
9740
|
-
onCleanup
|
|
9741
|
-
]);
|
|
9742
|
-
}
|
|
9743
9850
|
if (flush === "sync") {
|
|
9744
9851
|
const ctx = useSSRContext();
|
|
9745
9852
|
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
|
|
9853
|
+
} else if (!cb || immediate) {
|
|
9854
|
+
baseWatchOptions.once = true;
|
|
9746
9855
|
} else {
|
|
9747
|
-
|
|
9856
|
+
return {
|
|
9857
|
+
stop: NOOP,
|
|
9858
|
+
resume: NOOP,
|
|
9859
|
+
pause: NOOP
|
|
9748
9860
|
};
|
|
9749
|
-
watchHandle2.stop = NOOP;
|
|
9750
|
-
watchHandle2.resume = NOOP;
|
|
9751
|
-
watchHandle2.pause = NOOP;
|
|
9752
|
-
return watchHandle2;
|
|
9753
9861
|
}
|
|
9754
9862
|
}
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
9770
|
-
onCleanup
|
|
9771
|
-
]);
|
|
9772
|
-
oldValue = newValue;
|
|
9863
|
+
const instance = currentInstance;
|
|
9864
|
+
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
9865
|
+
let isPre = false;
|
|
9866
|
+
if (flush === "post") {
|
|
9867
|
+
baseWatchOptions.scheduler = (job) => {
|
|
9868
|
+
queuePostRenderEffect(job, instance && instance.suspense);
|
|
9869
|
+
};
|
|
9870
|
+
} else if (flush !== "sync") {
|
|
9871
|
+
isPre = true;
|
|
9872
|
+
baseWatchOptions.scheduler = (job, isFirstRun) => {
|
|
9873
|
+
if (isFirstRun) {
|
|
9874
|
+
job();
|
|
9875
|
+
} else {
|
|
9876
|
+
queueJob(job);
|
|
9773
9877
|
}
|
|
9774
|
-
}
|
|
9775
|
-
effect.run();
|
|
9776
|
-
}
|
|
9777
|
-
};
|
|
9778
|
-
if (cb) job.flags |= 4;
|
|
9779
|
-
const effect = new ReactiveEffect(getter);
|
|
9780
|
-
let scheduler;
|
|
9781
|
-
if (flush === "sync") {
|
|
9782
|
-
scheduler = job;
|
|
9783
|
-
} else if (flush === "post") {
|
|
9784
|
-
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
9785
|
-
} else {
|
|
9786
|
-
job.flags |= 2;
|
|
9787
|
-
if (instance) job.id = instance.uid;
|
|
9788
|
-
scheduler = () => queueJob(job);
|
|
9878
|
+
};
|
|
9789
9879
|
}
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
effect.stop();
|
|
9794
|
-
if (scope) {
|
|
9795
|
-
remove(scope.effects, effect);
|
|
9880
|
+
baseWatchOptions.augmentJob = (job) => {
|
|
9881
|
+
if (cb) {
|
|
9882
|
+
job.flags |= 4;
|
|
9796
9883
|
}
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
effect.onTrigger = onTrigger;
|
|
9804
|
-
}
|
|
9805
|
-
if (cb) {
|
|
9806
|
-
if (immediate) {
|
|
9807
|
-
job(true);
|
|
9808
|
-
} else {
|
|
9809
|
-
oldValue = effect.run();
|
|
9884
|
+
if (isPre) {
|
|
9885
|
+
job.flags |= 2;
|
|
9886
|
+
if (instance) {
|
|
9887
|
+
job.id = instance.uid;
|
|
9888
|
+
job.i = instance;
|
|
9889
|
+
}
|
|
9810
9890
|
}
|
|
9811
|
-
}
|
|
9812
|
-
|
|
9813
|
-
effect.run.bind(effect),
|
|
9814
|
-
instance && instance.suspense
|
|
9815
|
-
);
|
|
9816
|
-
} else {
|
|
9817
|
-
effect.run();
|
|
9818
|
-
}
|
|
9891
|
+
};
|
|
9892
|
+
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
9819
9893
|
if (ssrCleanup) ssrCleanup.push(watchHandle);
|
|
9820
9894
|
return watchHandle;
|
|
9821
9895
|
}
|
|
@@ -9844,38 +9918,6 @@ function createPathGetter(ctx, path) {
|
|
|
9844
9918
|
return cur;
|
|
9845
9919
|
};
|
|
9846
9920
|
}
|
|
9847
|
-
function traverse(value, depth = Infinity, seen) {
|
|
9848
|
-
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
9849
|
-
return value;
|
|
9850
|
-
}
|
|
9851
|
-
seen = seen || /* @__PURE__ */ new Set();
|
|
9852
|
-
if (seen.has(value)) {
|
|
9853
|
-
return value;
|
|
9854
|
-
}
|
|
9855
|
-
seen.add(value);
|
|
9856
|
-
depth--;
|
|
9857
|
-
if (isRef(value)) {
|
|
9858
|
-
traverse(value.value, depth, seen);
|
|
9859
|
-
} else if (isArray(value)) {
|
|
9860
|
-
for (let i = 0; i < value.length; i++) {
|
|
9861
|
-
traverse(value[i], depth, seen);
|
|
9862
|
-
}
|
|
9863
|
-
} else if (isSet(value) || isMap(value)) {
|
|
9864
|
-
value.forEach((v) => {
|
|
9865
|
-
traverse(v, depth, seen);
|
|
9866
|
-
});
|
|
9867
|
-
} else if (isPlainObject(value)) {
|
|
9868
|
-
for (const key in value) {
|
|
9869
|
-
traverse(value[key], depth, seen);
|
|
9870
|
-
}
|
|
9871
|
-
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
9872
|
-
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
9873
|
-
traverse(value[key], depth, seen);
|
|
9874
|
-
}
|
|
9875
|
-
}
|
|
9876
|
-
}
|
|
9877
|
-
return value;
|
|
9878
|
-
}
|
|
9879
9921
|
|
|
9880
9922
|
function useModel(props, name, options = EMPTY_OBJ) {
|
|
9881
9923
|
const i = getCurrentInstance();
|
|
@@ -12130,7 +12172,7 @@ function isMemoSame(cached, memo) {
|
|
|
12130
12172
|
return true;
|
|
12131
12173
|
}
|
|
12132
12174
|
|
|
12133
|
-
const version = "3.5.0-beta.
|
|
12175
|
+
const version = "3.5.0-beta.3";
|
|
12134
12176
|
const warn = warn$1 ;
|
|
12135
12177
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
12136
12178
|
const devtools = devtools$1 ;
|
|
@@ -14172,6 +14214,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
14172
14214
|
effectScope: effectScope,
|
|
14173
14215
|
getCurrentInstance: getCurrentInstance,
|
|
14174
14216
|
getCurrentScope: getCurrentScope,
|
|
14217
|
+
getCurrentWatcher: getCurrentWatcher,
|
|
14175
14218
|
getTransitionRawChildren: getTransitionRawChildren,
|
|
14176
14219
|
guardReactiveProps: guardReactiveProps,
|
|
14177
14220
|
h: h,
|
|
@@ -14214,6 +14257,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
14214
14257
|
onServerPrefetch: onServerPrefetch,
|
|
14215
14258
|
onUnmounted: onUnmounted,
|
|
14216
14259
|
onUpdated: onUpdated,
|
|
14260
|
+
onWatcherCleanup: onWatcherCleanup,
|
|
14217
14261
|
openBlock: openBlock,
|
|
14218
14262
|
popScopeId: popScopeId,
|
|
14219
14263
|
provide: provide,
|
|
@@ -16065,7 +16109,9 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
16065
16109
|
case 17:
|
|
16066
16110
|
case 18:
|
|
16067
16111
|
case 19:
|
|
16112
|
+
// "
|
|
16068
16113
|
case 20:
|
|
16114
|
+
// '
|
|
16069
16115
|
case 21:
|
|
16070
16116
|
emitError(9, end);
|
|
16071
16117
|
break;
|
|
@@ -17047,6 +17093,7 @@ function traverseNode(node, context) {
|
|
|
17047
17093
|
context.helper(TO_DISPLAY_STRING);
|
|
17048
17094
|
}
|
|
17049
17095
|
break;
|
|
17096
|
+
// for container types, further traverse downwards
|
|
17050
17097
|
case 9:
|
|
17051
17098
|
for (let i2 = 0; i2 < node.branches.length; i2++) {
|
|
17052
17099
|
traverseNode(node.branches[i2], context);
|
|
@@ -17399,6 +17446,7 @@ function genNode(node, context) {
|
|
|
17399
17446
|
case 21:
|
|
17400
17447
|
genNodeList(node.body, context, true, false);
|
|
17401
17448
|
break;
|
|
17449
|
+
// SSR only types
|
|
17402
17450
|
case 22:
|
|
17403
17451
|
break;
|
|
17404
17452
|
case 23:
|
|
@@ -17409,6 +17457,7 @@ function genNode(node, context) {
|
|
|
17409
17457
|
break;
|
|
17410
17458
|
case 26:
|
|
17411
17459
|
break;
|
|
17460
|
+
/* istanbul ignore next */
|
|
17412
17461
|
case 10:
|
|
17413
17462
|
break;
|
|
17414
17463
|
default:
|
|
@@ -19416,27 +19465,35 @@ function parseFilter(node, context) {
|
|
|
19416
19465
|
case 34:
|
|
19417
19466
|
inDouble = true;
|
|
19418
19467
|
break;
|
|
19468
|
+
// "
|
|
19419
19469
|
case 39:
|
|
19420
19470
|
inSingle = true;
|
|
19421
19471
|
break;
|
|
19472
|
+
// '
|
|
19422
19473
|
case 96:
|
|
19423
19474
|
inTemplateString = true;
|
|
19424
19475
|
break;
|
|
19476
|
+
// `
|
|
19425
19477
|
case 40:
|
|
19426
19478
|
paren++;
|
|
19427
19479
|
break;
|
|
19480
|
+
// (
|
|
19428
19481
|
case 41:
|
|
19429
19482
|
paren--;
|
|
19430
19483
|
break;
|
|
19484
|
+
// )
|
|
19431
19485
|
case 91:
|
|
19432
19486
|
square++;
|
|
19433
19487
|
break;
|
|
19488
|
+
// [
|
|
19434
19489
|
case 93:
|
|
19435
19490
|
square--;
|
|
19436
19491
|
break;
|
|
19492
|
+
// ]
|
|
19437
19493
|
case 123:
|
|
19438
19494
|
curly++;
|
|
19439
19495
|
break;
|
|
19496
|
+
// {
|
|
19440
19497
|
case 125:
|
|
19441
19498
|
curly--;
|
|
19442
19499
|
break;
|
|
@@ -20287,4 +20344,4 @@ Vue.compile = compileToFunction;
|
|
|
20287
20344
|
|
|
20288
20345
|
const configureCompat = Vue.configureCompat;
|
|
20289
20346
|
|
|
20290
|
-
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 };
|
|
20347
|
+
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 };
|