@vue/compat 3.5.0-beta.1 → 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.0-beta.1
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
  **/
@@ -465,11 +465,11 @@ class ReactiveEffect {
465
465
  }
466
466
  }
467
467
  pause() {
468
- this.flags |= 128;
468
+ this.flags |= 64;
469
469
  }
470
470
  resume() {
471
- if (this.flags & 128) {
472
- this.flags &= ~128;
471
+ if (this.flags & 64) {
472
+ this.flags &= ~64;
473
473
  if (pausedQueueEffects.has(this)) {
474
474
  pausedQueueEffects.delete(this);
475
475
  this.trigger();
@@ -483,9 +483,6 @@ class ReactiveEffect {
483
483
  if (this.flags & 2 && !(this.flags & 32)) {
484
484
  return;
485
485
  }
486
- if (this.flags & 64) {
487
- return this.trigger();
488
- }
489
486
  if (!(this.flags & 8)) {
490
487
  this.flags |= 8;
491
488
  this.nextEffect = batchedEffect;
@@ -529,7 +526,7 @@ class ReactiveEffect {
529
526
  }
530
527
  }
531
528
  trigger() {
532
- if (this.flags & 128) {
529
+ if (this.flags & 64) {
533
530
  pausedQueueEffects.add(this);
534
531
  } else if (this.scheduler) {
535
532
  this.scheduler();
@@ -559,6 +556,7 @@ function endBatch() {
559
556
  batchDepth--;
560
557
  return;
561
558
  }
559
+ batchDepth--;
562
560
  let error;
563
561
  while (batchedEffect) {
564
562
  let e = batchedEffect;
@@ -577,7 +575,6 @@ function endBatch() {
577
575
  e = next;
578
576
  }
579
577
  }
580
- batchDepth--;
581
578
  if (error) throw error;
582
579
  }
583
580
  function prepareDeps(sub) {
@@ -984,26 +981,26 @@ const arrayInstrumentations = {
984
981
  });
985
982
  },
986
983
  every(fn, thisArg) {
987
- return apply(this, "every", fn, thisArg);
984
+ return apply(this, "every", fn, thisArg, void 0, arguments);
988
985
  },
989
986
  filter(fn, thisArg) {
990
- return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
987
+ return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
991
988
  },
992
989
  find(fn, thisArg) {
993
- return apply(this, "find", fn, thisArg, toReactive);
990
+ return apply(this, "find", fn, thisArg, toReactive, arguments);
994
991
  },
995
992
  findIndex(fn, thisArg) {
996
- return apply(this, "findIndex", fn, thisArg);
993
+ return apply(this, "findIndex", fn, thisArg, void 0, arguments);
997
994
  },
998
995
  findLast(fn, thisArg) {
999
- return apply(this, "findLast", fn, thisArg, toReactive);
996
+ return apply(this, "findLast", fn, thisArg, toReactive, arguments);
1000
997
  },
1001
998
  findLastIndex(fn, thisArg) {
1002
- return apply(this, "findLastIndex", fn, thisArg);
999
+ return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
1003
1000
  },
1004
1001
  // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
1005
1002
  forEach(fn, thisArg) {
1006
- return apply(this, "forEach", fn, thisArg);
1003
+ return apply(this, "forEach", fn, thisArg, void 0, arguments);
1007
1004
  },
1008
1005
  includes(...args) {
1009
1006
  return searchProxy(this, "includes", args);
@@ -1019,7 +1016,7 @@ const arrayInstrumentations = {
1019
1016
  return searchProxy(this, "lastIndexOf", args);
1020
1017
  },
1021
1018
  map(fn, thisArg) {
1022
- return apply(this, "map", fn, thisArg);
1019
+ return apply(this, "map", fn, thisArg, void 0, arguments);
1023
1020
  },
1024
1021
  pop() {
1025
1022
  return noTracking(this, "pop");
@@ -1038,7 +1035,7 @@ const arrayInstrumentations = {
1038
1035
  },
1039
1036
  // slice could use ARRAY_ITERATE but also seems to beg for range tracking
1040
1037
  some(fn, thisArg) {
1041
- return apply(this, "some", fn, thisArg);
1038
+ return apply(this, "some", fn, thisArg, void 0, arguments);
1042
1039
  },
1043
1040
  splice(...args) {
1044
1041
  return noTracking(this, "splice", args);
@@ -1074,12 +1071,17 @@ function iterator(self, method, wrapValue) {
1074
1071
  }
1075
1072
  return iter;
1076
1073
  }
1077
- function apply(self, method, fn, thisArg, wrappedRetFn) {
1074
+ const arrayProto = Array.prototype;
1075
+ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1078
1076
  const arr = shallowReadArray(self);
1079
- let needsWrap = false;
1077
+ const needsWrap = arr !== self && !isShallow(self);
1078
+ const methodFn = arr[method];
1079
+ if (methodFn !== arrayProto[method]) {
1080
+ const result2 = methodFn.apply(arr, args);
1081
+ return needsWrap ? toReactive(result2) : result2;
1082
+ }
1080
1083
  let wrappedFn = fn;
1081
1084
  if (arr !== self) {
1082
- needsWrap = !isShallow(self);
1083
1085
  if (needsWrap) {
1084
1086
  wrappedFn = function(item, index) {
1085
1087
  return fn.call(this, toReactive(item), index, self);
@@ -1090,7 +1092,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn) {
1090
1092
  };
1091
1093
  }
1092
1094
  }
1093
- const result = arr[method](wrappedFn, thisArg);
1095
+ const result = methodFn.call(arr, wrappedFn, thisArg);
1094
1096
  return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
1095
1097
  }
1096
1098
  function reduce(self, method, fn, args) {
@@ -1947,6 +1949,220 @@ const TriggerOpTypes = {
1947
1949
  "CLEAR": "clear"
1948
1950
  };
1949
1951
 
1952
+ const INITIAL_WATCHER_VALUE = {};
1953
+ const cleanupMap = /* @__PURE__ */ new WeakMap();
1954
+ let activeWatcher = void 0;
1955
+ function getCurrentWatcher() {
1956
+ return activeWatcher;
1957
+ }
1958
+ function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1959
+ if (owner) {
1960
+ let cleanups = cleanupMap.get(owner);
1961
+ if (!cleanups) cleanupMap.set(owner, cleanups = []);
1962
+ cleanups.push(cleanupFn);
1963
+ } else if (!!(process.env.NODE_ENV !== "production") && !failSilently) {
1964
+ warn$2(
1965
+ `onWatcherCleanup() was called when there was no active watcher to associate with.`
1966
+ );
1967
+ }
1968
+ }
1969
+ function watch$1(source, cb, options = EMPTY_OBJ) {
1970
+ const { immediate, deep, once, scheduler, augmentJob, call } = options;
1971
+ const warnInvalidSource = (s) => {
1972
+ (options.onWarn || warn$2)(
1973
+ `Invalid watch source: `,
1974
+ s,
1975
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1976
+ );
1977
+ };
1978
+ const reactiveGetter = (source2) => {
1979
+ if (deep) return source2;
1980
+ if (isShallow(source2) || deep === false || deep === 0)
1981
+ return traverse(source2, 1);
1982
+ return traverse(source2);
1983
+ };
1984
+ let effect;
1985
+ let getter;
1986
+ let cleanup;
1987
+ let boundCleanup;
1988
+ let forceTrigger = false;
1989
+ let isMultiSource = false;
1990
+ if (isRef(source)) {
1991
+ getter = () => source.value;
1992
+ forceTrigger = isShallow(source);
1993
+ } else if (isReactive(source)) {
1994
+ getter = () => reactiveGetter(source);
1995
+ forceTrigger = true;
1996
+ } else if (isArray(source)) {
1997
+ isMultiSource = true;
1998
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1999
+ getter = () => source.map((s) => {
2000
+ if (isRef(s)) {
2001
+ return s.value;
2002
+ } else if (isReactive(s)) {
2003
+ return reactiveGetter(s);
2004
+ } else if (isFunction(s)) {
2005
+ return call ? call(s, 2) : s();
2006
+ } else {
2007
+ !!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
2008
+ }
2009
+ });
2010
+ } else if (isFunction(source)) {
2011
+ if (cb) {
2012
+ getter = call ? () => call(source, 2) : source;
2013
+ } else {
2014
+ getter = () => {
2015
+ if (cleanup) {
2016
+ pauseTracking();
2017
+ try {
2018
+ cleanup();
2019
+ } finally {
2020
+ resetTracking();
2021
+ }
2022
+ }
2023
+ const currentEffect = activeWatcher;
2024
+ activeWatcher = effect;
2025
+ try {
2026
+ return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2027
+ } finally {
2028
+ activeWatcher = currentEffect;
2029
+ }
2030
+ };
2031
+ }
2032
+ } else {
2033
+ getter = NOOP;
2034
+ !!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
2035
+ }
2036
+ if (cb && deep) {
2037
+ const baseGetter = getter;
2038
+ const depth = deep === true ? Infinity : deep;
2039
+ getter = () => traverse(baseGetter(), depth);
2040
+ }
2041
+ if (once) {
2042
+ if (cb) {
2043
+ const _cb = cb;
2044
+ cb = (...args) => {
2045
+ _cb(...args);
2046
+ effect.stop();
2047
+ };
2048
+ } else {
2049
+ const _getter = getter;
2050
+ getter = () => {
2051
+ _getter();
2052
+ effect.stop();
2053
+ };
2054
+ }
2055
+ }
2056
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2057
+ const job = (immediateFirstRun) => {
2058
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2059
+ return;
2060
+ }
2061
+ if (cb) {
2062
+ const newValue = effect.run();
2063
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2064
+ if (cleanup) {
2065
+ cleanup();
2066
+ }
2067
+ const currentWatcher = activeWatcher;
2068
+ activeWatcher = effect;
2069
+ try {
2070
+ const args = [
2071
+ newValue,
2072
+ // pass undefined as the old value when it's changed for the first time
2073
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2074
+ boundCleanup
2075
+ ];
2076
+ call ? call(cb, 3, args) : (
2077
+ // @ts-expect-error
2078
+ cb(...args)
2079
+ );
2080
+ oldValue = newValue;
2081
+ } finally {
2082
+ activeWatcher = currentWatcher;
2083
+ }
2084
+ }
2085
+ } else {
2086
+ effect.run();
2087
+ }
2088
+ };
2089
+ if (augmentJob) {
2090
+ augmentJob(job);
2091
+ }
2092
+ effect = new ReactiveEffect(getter);
2093
+ effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2094
+ boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2095
+ cleanup = effect.onStop = () => {
2096
+ const cleanups = cleanupMap.get(effect);
2097
+ if (cleanups) {
2098
+ if (call) {
2099
+ call(cleanups, 4);
2100
+ } else {
2101
+ for (const cleanup2 of cleanups) cleanup2();
2102
+ }
2103
+ cleanupMap.delete(effect);
2104
+ }
2105
+ };
2106
+ if (!!(process.env.NODE_ENV !== "production")) {
2107
+ effect.onTrack = options.onTrack;
2108
+ effect.onTrigger = options.onTrigger;
2109
+ }
2110
+ if (cb) {
2111
+ if (immediate) {
2112
+ job(true);
2113
+ } else {
2114
+ oldValue = effect.run();
2115
+ }
2116
+ } else if (scheduler) {
2117
+ scheduler(job.bind(null, true), true);
2118
+ } else {
2119
+ effect.run();
2120
+ }
2121
+ const scope = getCurrentScope();
2122
+ const watchHandle = () => {
2123
+ effect.stop();
2124
+ if (scope) {
2125
+ remove(scope.effects, effect);
2126
+ }
2127
+ };
2128
+ watchHandle.pause = effect.pause.bind(effect);
2129
+ watchHandle.resume = effect.resume.bind(effect);
2130
+ watchHandle.stop = watchHandle;
2131
+ return watchHandle;
2132
+ }
2133
+ function traverse(value, depth = Infinity, seen) {
2134
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2135
+ return value;
2136
+ }
2137
+ seen = seen || /* @__PURE__ */ new Set();
2138
+ if (seen.has(value)) {
2139
+ return value;
2140
+ }
2141
+ seen.add(value);
2142
+ depth--;
2143
+ if (isRef(value)) {
2144
+ traverse(value.value, depth, seen);
2145
+ } else if (isArray(value)) {
2146
+ for (let i = 0; i < value.length; i++) {
2147
+ traverse(value[i], depth, seen);
2148
+ }
2149
+ } else if (isSet(value) || isMap(value)) {
2150
+ value.forEach((v) => {
2151
+ traverse(v, depth, seen);
2152
+ });
2153
+ } else if (isPlainObject(value)) {
2154
+ for (const key in value) {
2155
+ traverse(value[key], depth, seen);
2156
+ }
2157
+ for (const key of Object.getOwnPropertySymbols(value)) {
2158
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2159
+ traverse(value[key], depth, seen);
2160
+ }
2161
+ }
2162
+ }
2163
+ return value;
2164
+ }
2165
+
1950
2166
  const stack = [];
1951
2167
  function pushWarningContext(vnode) {
1952
2168
  stack.push(vnode);
@@ -2075,12 +2291,6 @@ const ErrorCodes = {
2075
2291
  "0": "SETUP_FUNCTION",
2076
2292
  "RENDER_FUNCTION": 1,
2077
2293
  "1": "RENDER_FUNCTION",
2078
- "WATCH_GETTER": 2,
2079
- "2": "WATCH_GETTER",
2080
- "WATCH_CALLBACK": 3,
2081
- "3": "WATCH_CALLBACK",
2082
- "WATCH_CLEANUP": 4,
2083
- "4": "WATCH_CLEANUP",
2084
2294
  "NATIVE_EVENT_HANDLER": 5,
2085
2295
  "5": "NATIVE_EVENT_HANDLER",
2086
2296
  "COMPONENT_EVENT_HANDLER": 6,
@@ -2236,7 +2446,7 @@ function nextTick(fn) {
2236
2446
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2237
2447
  }
2238
2448
  function findInsertionIndex(id) {
2239
- let start = flushIndex + 1;
2449
+ let start = isFlushing ? flushIndex + 1 : 0;
2240
2450
  let end = queue.length;
2241
2451
  while (start < end) {
2242
2452
  const middle = start + end >>> 1;
@@ -2252,15 +2462,13 @@ function findInsertionIndex(id) {
2252
2462
  }
2253
2463
  function queueJob(job) {
2254
2464
  if (!(job.flags & 1)) {
2255
- if (job.id == null) {
2256
- queue.push(job);
2257
- } else if (
2258
- // fast path when the job id is larger than the tail
2259
- !(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
2260
- ) {
2465
+ const jobId = getId(job);
2466
+ const lastJob = queue[queue.length - 1];
2467
+ if (!lastJob || // fast path when the job id is larger than the tail
2468
+ !(job.flags & 2) && jobId >= getId(lastJob)) {
2261
2469
  queue.push(job);
2262
2470
  } else {
2263
- queue.splice(findInsertionIndex(job.id), 0, job);
2471
+ queue.splice(findInsertionIndex(jobId), 0, job);
2264
2472
  }
2265
2473
  if (!(job.flags & 4)) {
2266
2474
  job.flags |= 1;
@@ -2274,12 +2482,6 @@ function queueFlush() {
2274
2482
  currentFlushPromise = resolvedPromise.then(flushJobs);
2275
2483
  }
2276
2484
  }
2277
- function invalidateJob(job) {
2278
- const i = queue.indexOf(job);
2279
- if (i > flushIndex) {
2280
- queue.splice(i, 1);
2281
- }
2282
- }
2283
2485
  function queuePostFlushCb(cb) {
2284
2486
  if (!isArray(cb)) {
2285
2487
  if (activePostFlushCbs && cb.id === -1) {
@@ -2341,24 +2543,13 @@ function flushPostFlushCbs(seen) {
2341
2543
  postFlushIndex = 0;
2342
2544
  }
2343
2545
  }
2344
- const getId = (job) => job.id == null ? Infinity : job.id;
2345
- const comparator = (a, b) => {
2346
- const diff = getId(a) - getId(b);
2347
- if (diff === 0) {
2348
- const isAPre = a.flags & 2;
2349
- const isBPre = b.flags & 2;
2350
- if (isAPre && !isBPre) return -1;
2351
- if (isBPre && !isAPre) return 1;
2352
- }
2353
- return diff;
2354
- };
2546
+ const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2355
2547
  function flushJobs(seen) {
2356
2548
  isFlushPending = false;
2357
2549
  isFlushing = true;
2358
2550
  if (!!(process.env.NODE_ENV !== "production")) {
2359
2551
  seen = seen || /* @__PURE__ */ new Map();
2360
2552
  }
2361
- queue.sort(comparator);
2362
2553
  const check = !!(process.env.NODE_ENV !== "production") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
2363
2554
  try {
2364
2555
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
@@ -3002,7 +3193,7 @@ function on(instance, event, fn) {
3002
3193
  function once(instance, event, fn) {
3003
3194
  const wrapped = (...args) => {
3004
3195
  off(instance, event, wrapped);
3005
- fn.call(instance.proxy, ...args);
3196
+ fn.apply(instance.proxy, args);
3006
3197
  };
3007
3198
  wrapped.fn = fn;
3008
3199
  on(instance, event, wrapped);
@@ -4041,6 +4232,7 @@ const logMismatchError = () => {
4041
4232
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
4042
4233
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
4043
4234
  const getContainerType = (container) => {
4235
+ if (container.nodeType !== 1) return void 0;
4044
4236
  if (isSVGContainer(container)) return "svg";
4045
4237
  if (isMathMLContainer(container)) return "mathml";
4046
4238
  return void 0;
@@ -4980,7 +5172,7 @@ const KeepAliveImpl = {
4980
5172
  function pruneCache(filter) {
4981
5173
  cache.forEach((vnode, key) => {
4982
5174
  const name = getComponentName(vnode.type);
4983
- if (name && (!filter || !filter(name))) {
5175
+ if (name && !filter(name)) {
4984
5176
  pruneCacheEntry(key);
4985
5177
  }
4986
5178
  });
@@ -5102,6 +5294,7 @@ function matches(pattern, name) {
5102
5294
  } else if (isString(pattern)) {
5103
5295
  return pattern.split(",").includes(name);
5104
5296
  } else if (isRegExp(pattern)) {
5297
+ pattern.lastIndex = 0;
5105
5298
  return pattern.test(name);
5106
5299
  }
5107
5300
  return false;
@@ -6548,23 +6741,43 @@ function callHook$1(hook, instance, type) {
6548
6741
  );
6549
6742
  }
6550
6743
  function createWatcher(raw, ctx, publicThis, key) {
6551
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6744
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6745
+ const options = {};
6746
+ {
6747
+ const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
6748
+ const newValue = getter();
6749
+ if (isArray(newValue) && isCompatEnabled("WATCH_ARRAY", instance)) {
6750
+ options.deep = true;
6751
+ }
6752
+ const baseGetter = getter;
6753
+ getter = () => {
6754
+ const val = baseGetter();
6755
+ if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
6756
+ traverse(val);
6757
+ }
6758
+ return val;
6759
+ };
6760
+ }
6552
6761
  if (isString(raw)) {
6553
6762
  const handler = ctx[raw];
6554
6763
  if (isFunction(handler)) {
6555
- watch(getter, handler);
6764
+ {
6765
+ watch(getter, handler, options);
6766
+ }
6556
6767
  } else if (!!(process.env.NODE_ENV !== "production")) {
6557
6768
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
6558
6769
  }
6559
6770
  } else if (isFunction(raw)) {
6560
- watch(getter, raw.bind(publicThis));
6771
+ {
6772
+ watch(getter, raw.bind(publicThis), options);
6773
+ }
6561
6774
  } else if (isObject(raw)) {
6562
6775
  if (isArray(raw)) {
6563
6776
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
6564
6777
  } else {
6565
6778
  const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
6566
6779
  if (isFunction(handler)) {
6567
- watch(getter, handler, raw);
6780
+ watch(getter, handler, extend(raw, options) );
6568
6781
  } else if (!!(process.env.NODE_ENV !== "production")) {
6569
6782
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
6570
6783
  }
@@ -6788,7 +7001,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6788
7001
  return vm;
6789
7002
  }
6790
7003
  }
6791
- Vue.version = `2.6.14-compat:${"3.5.0-beta.1"}`;
7004
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
6792
7005
  Vue.config = singletonApp.config;
6793
7006
  Vue.use = (plugin, ...options) => {
6794
7007
  if (plugin && isFunction(plugin.install)) {
@@ -7120,7 +7333,7 @@ function defineReactive(obj, key, val) {
7120
7333
  if (isArray(val)) {
7121
7334
  methodsToPatch.forEach((m) => {
7122
7335
  val[m] = (...args) => {
7123
- Array.prototype[m].call(reactiveVal, ...args);
7336
+ Array.prototype[m].apply(reactiveVal, args);
7124
7337
  };
7125
7338
  });
7126
7339
  } else {
@@ -8344,7 +8557,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8344
8557
  if (!!(process.env.NODE_ENV !== "production") && subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
8345
8558
  subTree = filterSingleRoot(subTree.children) || subTree;
8346
8559
  }
8347
- if (vnode === subTree) {
8560
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
8348
8561
  const parentVNode = parentComponent.vnode;
8349
8562
  setScopeId(
8350
8563
  el,
@@ -8685,7 +8898,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8685
8898
  return;
8686
8899
  } else {
8687
8900
  instance.next = n2;
8688
- invalidateJob(instance.update);
8689
8901
  instance.update();
8690
8902
  }
8691
8903
  } else {
@@ -9609,7 +9821,6 @@ function watchSyncEffect(effect, options) {
9609
9821
  !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "sync" }) : { flush: "sync" }
9610
9822
  );
9611
9823
  }
9612
- const INITIAL_WATCHER_VALUE = {};
9613
9824
  function watch(source, cb, options) {
9614
9825
  if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
9615
9826
  warn$1(
@@ -9618,21 +9829,8 @@ function watch(source, cb, options) {
9618
9829
  }
9619
9830
  return doWatch(source, cb, options);
9620
9831
  }
9621
- function doWatch(source, cb, {
9622
- immediate,
9623
- deep,
9624
- flush,
9625
- once,
9626
- onTrack,
9627
- onTrigger
9628
- } = EMPTY_OBJ) {
9629
- if (cb && once) {
9630
- const _cb = cb;
9631
- cb = (...args) => {
9632
- _cb(...args);
9633
- watchHandle();
9634
- };
9635
- }
9832
+ function doWatch(source, cb, options = EMPTY_OBJ) {
9833
+ const { immediate, deep, flush, once } = options;
9636
9834
  if (!!(process.env.NODE_ENV !== "production") && !cb) {
9637
9835
  if (immediate !== void 0) {
9638
9836
  warn$1(
@@ -9650,174 +9848,53 @@ function doWatch(source, cb, {
9650
9848
  );
9651
9849
  }
9652
9850
  }
9653
- const warnInvalidSource = (s) => {
9654
- warn$1(
9655
- `Invalid watch source: `,
9656
- s,
9657
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
9658
- );
9659
- };
9660
- const instance = currentInstance;
9661
- const reactiveGetter = (source2) => {
9662
- if (deep) return source2;
9663
- if (isShallow(source2) || deep === false || deep === 0)
9664
- return traverse(source2, 1);
9665
- return traverse(source2);
9666
- };
9667
- let getter;
9668
- let forceTrigger = false;
9669
- let isMultiSource = false;
9670
- if (isRef(source)) {
9671
- getter = () => source.value;
9672
- forceTrigger = isShallow(source);
9673
- } else if (isReactive(source)) {
9674
- getter = () => reactiveGetter(source);
9675
- forceTrigger = true;
9676
- } else if (isArray(source)) {
9677
- isMultiSource = true;
9678
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
9679
- getter = () => source.map((s) => {
9680
- if (isRef(s)) {
9681
- return s.value;
9682
- } else if (isReactive(s)) {
9683
- return reactiveGetter(s);
9684
- } else if (isFunction(s)) {
9685
- return callWithErrorHandling(s, instance, 2);
9686
- } else {
9687
- !!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
9688
- }
9689
- });
9690
- } else if (isFunction(source)) {
9691
- if (cb) {
9692
- getter = () => callWithErrorHandling(source, instance, 2);
9693
- } else {
9694
- getter = () => {
9695
- if (cleanup) {
9696
- cleanup();
9697
- }
9698
- return callWithAsyncErrorHandling(
9699
- source,
9700
- instance,
9701
- 3,
9702
- [onCleanup]
9703
- );
9704
- };
9705
- }
9706
- } else {
9707
- getter = NOOP;
9708
- !!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
9709
- }
9710
- if (cb && !deep) {
9711
- const baseGetter = getter;
9712
- getter = () => {
9713
- const val = baseGetter();
9714
- if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
9715
- traverse(val);
9716
- }
9717
- return val;
9718
- };
9719
- }
9720
- if (cb && deep) {
9721
- const baseGetter = getter;
9722
- const depth = deep === true ? Infinity : deep;
9723
- getter = () => traverse(baseGetter(), depth);
9724
- }
9725
- let cleanup;
9726
- let onCleanup = (fn) => {
9727
- cleanup = effect.onStop = () => {
9728
- callWithErrorHandling(fn, instance, 4);
9729
- cleanup = effect.onStop = void 0;
9730
- };
9731
- };
9851
+ const baseWatchOptions = extend({}, options);
9852
+ if (!!(process.env.NODE_ENV !== "production")) baseWatchOptions.onWarn = warn$1;
9732
9853
  let ssrCleanup;
9733
9854
  if (isInSSRComponentSetup) {
9734
- onCleanup = NOOP;
9735
- if (!cb) {
9736
- getter();
9737
- } else if (immediate) {
9738
- callWithAsyncErrorHandling(cb, instance, 3, [
9739
- getter(),
9740
- isMultiSource ? [] : void 0,
9741
- onCleanup
9742
- ]);
9743
- }
9744
9855
  if (flush === "sync") {
9745
9856
  const ctx = useSSRContext();
9746
9857
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
9858
+ } else if (!cb || immediate) {
9859
+ baseWatchOptions.once = true;
9747
9860
  } else {
9748
- const watchHandle2 = () => {
9861
+ return {
9862
+ stop: NOOP,
9863
+ resume: NOOP,
9864
+ pause: NOOP
9749
9865
  };
9750
- watchHandle2.stop = NOOP;
9751
- watchHandle2.resume = NOOP;
9752
- watchHandle2.pause = NOOP;
9753
- return watchHandle2;
9754
9866
  }
9755
9867
  }
9756
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
9757
- const job = (immediateFirstRun) => {
9758
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
9759
- return;
9760
- }
9761
- if (cb) {
9762
- const newValue = effect.run();
9763
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || isArray(newValue) && isCompatEnabled("WATCH_ARRAY", instance)) {
9764
- if (cleanup) {
9765
- cleanup();
9766
- }
9767
- callWithAsyncErrorHandling(cb, instance, 3, [
9768
- newValue,
9769
- // pass undefined as the old value when it's changed for the first time
9770
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
9771
- onCleanup
9772
- ]);
9773
- oldValue = newValue;
9868
+ const instance = currentInstance;
9869
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
9870
+ let isPre = false;
9871
+ if (flush === "post") {
9872
+ baseWatchOptions.scheduler = (job) => {
9873
+ queuePostRenderEffect(job, instance && instance.suspense);
9874
+ };
9875
+ } else if (flush !== "sync") {
9876
+ isPre = true;
9877
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
9878
+ if (isFirstRun) {
9879
+ job();
9880
+ } else {
9881
+ queueJob(job);
9774
9882
  }
9775
- } else {
9776
- effect.run();
9777
- }
9778
- };
9779
- if (cb) job.flags |= 4;
9780
- const effect = new ReactiveEffect(getter);
9781
- let scheduler;
9782
- if (flush === "sync") {
9783
- effect.flags |= 64;
9784
- scheduler = job;
9785
- } else if (flush === "post") {
9786
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
9787
- } else {
9788
- job.flags |= 2;
9789
- if (instance) job.id = instance.uid;
9790
- scheduler = () => queueJob(job);
9883
+ };
9791
9884
  }
9792
- effect.scheduler = scheduler;
9793
- const scope = getCurrentScope();
9794
- const watchHandle = () => {
9795
- effect.stop();
9796
- if (scope) {
9797
- remove(scope.effects, effect);
9885
+ baseWatchOptions.augmentJob = (job) => {
9886
+ if (cb) {
9887
+ job.flags |= 4;
9798
9888
  }
9799
- };
9800
- watchHandle.pause = effect.pause.bind(effect);
9801
- watchHandle.resume = effect.resume.bind(effect);
9802
- watchHandle.stop = watchHandle;
9803
- if (!!(process.env.NODE_ENV !== "production")) {
9804
- effect.onTrack = onTrack;
9805
- effect.onTrigger = onTrigger;
9806
- }
9807
- if (cb) {
9808
- if (immediate) {
9809
- job(true);
9810
- } else {
9811
- oldValue = effect.run();
9889
+ if (isPre) {
9890
+ job.flags |= 2;
9891
+ if (instance) {
9892
+ job.id = instance.uid;
9893
+ job.i = instance;
9894
+ }
9812
9895
  }
9813
- } else if (flush === "post") {
9814
- queuePostRenderEffect(
9815
- effect.run.bind(effect),
9816
- instance && instance.suspense
9817
- );
9818
- } else {
9819
- effect.run();
9820
- }
9896
+ };
9897
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
9821
9898
  if (ssrCleanup) ssrCleanup.push(watchHandle);
9822
9899
  return watchHandle;
9823
9900
  }
@@ -9846,38 +9923,6 @@ function createPathGetter(ctx, path) {
9846
9923
  return cur;
9847
9924
  };
9848
9925
  }
9849
- function traverse(value, depth = Infinity, seen) {
9850
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
9851
- return value;
9852
- }
9853
- seen = seen || /* @__PURE__ */ new Set();
9854
- if (seen.has(value)) {
9855
- return value;
9856
- }
9857
- seen.add(value);
9858
- depth--;
9859
- if (isRef(value)) {
9860
- traverse(value.value, depth, seen);
9861
- } else if (isArray(value)) {
9862
- for (let i = 0; i < value.length; i++) {
9863
- traverse(value[i], depth, seen);
9864
- }
9865
- } else if (isSet(value) || isMap(value)) {
9866
- value.forEach((v) => {
9867
- traverse(v, depth, seen);
9868
- });
9869
- } else if (isPlainObject(value)) {
9870
- for (const key in value) {
9871
- traverse(value[key], depth, seen);
9872
- }
9873
- for (const key of Object.getOwnPropertySymbols(value)) {
9874
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
9875
- traverse(value[key], depth, seen);
9876
- }
9877
- }
9878
- }
9879
- return value;
9880
- }
9881
9926
 
9882
9927
  function useModel(props, name, options = EMPTY_OBJ) {
9883
9928
  const i = getCurrentInstance();
@@ -12146,7 +12191,7 @@ function isMemoSame(cached, memo) {
12146
12191
  return true;
12147
12192
  }
12148
12193
 
12149
- const version = "3.5.0-beta.1";
12194
+ const version = "3.5.0-beta.3";
12150
12195
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12151
12196
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12152
12197
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13103,7 +13148,6 @@ class VueElement extends BaseClass {
13103
13148
  this._ob = null;
13104
13149
  if (this.shadowRoot && _createApp !== createApp) {
13105
13150
  this._root = this.shadowRoot;
13106
- this._mount(_def);
13107
13151
  } else {
13108
13152
  if (!!(process.env.NODE_ENV !== "production") && this.shadowRoot) {
13109
13153
  warn(
@@ -13116,9 +13160,9 @@ class VueElement extends BaseClass {
13116
13160
  } else {
13117
13161
  this._root = this;
13118
13162
  }
13119
- if (!this._def.__asyncLoader) {
13120
- this._resolveProps(this._def);
13121
- }
13163
+ }
13164
+ if (!this._def.__asyncLoader) {
13165
+ this._resolveProps(this._def);
13122
13166
  }
13123
13167
  }
13124
13168
  connectedCallback() {
@@ -13318,6 +13362,7 @@ class VueElement extends BaseClass {
13318
13362
  vnode.ce = (instance) => {
13319
13363
  this._instance = instance;
13320
13364
  instance.ce = this;
13365
+ instance.isCE = true;
13321
13366
  if (!!(process.env.NODE_ENV !== "production")) {
13322
13367
  instance.ceReload = (newStyles) => {
13323
13368
  if (this._styles) {
@@ -14188,6 +14233,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
14188
14233
  effectScope: effectScope,
14189
14234
  getCurrentInstance: getCurrentInstance,
14190
14235
  getCurrentScope: getCurrentScope,
14236
+ getCurrentWatcher: getCurrentWatcher,
14191
14237
  getTransitionRawChildren: getTransitionRawChildren,
14192
14238
  guardReactiveProps: guardReactiveProps,
14193
14239
  h: h,
@@ -14230,6 +14276,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
14230
14276
  onServerPrefetch: onServerPrefetch,
14231
14277
  onUnmounted: onUnmounted,
14232
14278
  onUpdated: onUpdated,
14279
+ onWatcherCleanup: onWatcherCleanup,
14233
14280
  openBlock: openBlock,
14234
14281
  popScopeId: popScopeId,
14235
14282
  provide: provide,
@@ -14337,4 +14384,4 @@ Vue.compile = () => {
14337
14384
 
14338
14385
  const configureCompat = Vue.configureCompat;
14339
14386
 
14340
- 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 };
14387
+ 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 };