@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
  **/
@@ -468,11 +468,11 @@ var Vue = (function () {
468
468
  }
469
469
  }
470
470
  pause() {
471
- this.flags |= 128;
471
+ this.flags |= 64;
472
472
  }
473
473
  resume() {
474
- if (this.flags & 128) {
475
- this.flags &= ~128;
474
+ if (this.flags & 64) {
475
+ this.flags &= ~64;
476
476
  if (pausedQueueEffects.has(this)) {
477
477
  pausedQueueEffects.delete(this);
478
478
  this.trigger();
@@ -486,9 +486,6 @@ var Vue = (function () {
486
486
  if (this.flags & 2 && !(this.flags & 32)) {
487
487
  return;
488
488
  }
489
- if (this.flags & 64) {
490
- return this.trigger();
491
- }
492
489
  if (!(this.flags & 8)) {
493
490
  this.flags |= 8;
494
491
  this.nextEffect = batchedEffect;
@@ -532,7 +529,7 @@ var Vue = (function () {
532
529
  }
533
530
  }
534
531
  trigger() {
535
- if (this.flags & 128) {
532
+ if (this.flags & 64) {
536
533
  pausedQueueEffects.add(this);
537
534
  } else if (this.scheduler) {
538
535
  this.scheduler();
@@ -562,6 +559,7 @@ var Vue = (function () {
562
559
  batchDepth--;
563
560
  return;
564
561
  }
562
+ batchDepth--;
565
563
  let error;
566
564
  while (batchedEffect) {
567
565
  let e = batchedEffect;
@@ -580,7 +578,6 @@ var Vue = (function () {
580
578
  e = next;
581
579
  }
582
580
  }
583
- batchDepth--;
584
581
  if (error) throw error;
585
582
  }
586
583
  function prepareDeps(sub) {
@@ -983,26 +980,26 @@ var Vue = (function () {
983
980
  });
984
981
  },
985
982
  every(fn, thisArg) {
986
- return apply(this, "every", fn, thisArg);
983
+ return apply(this, "every", fn, thisArg, void 0, arguments);
987
984
  },
988
985
  filter(fn, thisArg) {
989
- return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
986
+ return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
990
987
  },
991
988
  find(fn, thisArg) {
992
- return apply(this, "find", fn, thisArg, toReactive);
989
+ return apply(this, "find", fn, thisArg, toReactive, arguments);
993
990
  },
994
991
  findIndex(fn, thisArg) {
995
- return apply(this, "findIndex", fn, thisArg);
992
+ return apply(this, "findIndex", fn, thisArg, void 0, arguments);
996
993
  },
997
994
  findLast(fn, thisArg) {
998
- return apply(this, "findLast", fn, thisArg, toReactive);
995
+ return apply(this, "findLast", fn, thisArg, toReactive, arguments);
999
996
  },
1000
997
  findLastIndex(fn, thisArg) {
1001
- return apply(this, "findLastIndex", fn, thisArg);
998
+ return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
1002
999
  },
1003
1000
  // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
1004
1001
  forEach(fn, thisArg) {
1005
- return apply(this, "forEach", fn, thisArg);
1002
+ return apply(this, "forEach", fn, thisArg, void 0, arguments);
1006
1003
  },
1007
1004
  includes(...args) {
1008
1005
  return searchProxy(this, "includes", args);
@@ -1018,7 +1015,7 @@ var Vue = (function () {
1018
1015
  return searchProxy(this, "lastIndexOf", args);
1019
1016
  },
1020
1017
  map(fn, thisArg) {
1021
- return apply(this, "map", fn, thisArg);
1018
+ return apply(this, "map", fn, thisArg, void 0, arguments);
1022
1019
  },
1023
1020
  pop() {
1024
1021
  return noTracking(this, "pop");
@@ -1037,7 +1034,7 @@ var Vue = (function () {
1037
1034
  },
1038
1035
  // slice could use ARRAY_ITERATE but also seems to beg for range tracking
1039
1036
  some(fn, thisArg) {
1040
- return apply(this, "some", fn, thisArg);
1037
+ return apply(this, "some", fn, thisArg, void 0, arguments);
1041
1038
  },
1042
1039
  splice(...args) {
1043
1040
  return noTracking(this, "splice", args);
@@ -1073,12 +1070,17 @@ var Vue = (function () {
1073
1070
  }
1074
1071
  return iter;
1075
1072
  }
1076
- function apply(self, method, fn, thisArg, wrappedRetFn) {
1073
+ const arrayProto = Array.prototype;
1074
+ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1077
1075
  const arr = shallowReadArray(self);
1078
- let needsWrap = false;
1076
+ const needsWrap = arr !== self && !isShallow(self);
1077
+ const methodFn = arr[method];
1078
+ if (methodFn !== arrayProto[method]) {
1079
+ const result2 = methodFn.apply(arr, args);
1080
+ return needsWrap ? toReactive(result2) : result2;
1081
+ }
1079
1082
  let wrappedFn = fn;
1080
1083
  if (arr !== self) {
1081
- needsWrap = !isShallow(self);
1082
1084
  if (needsWrap) {
1083
1085
  wrappedFn = function(item, index) {
1084
1086
  return fn.call(this, toReactive(item), index, self);
@@ -1089,7 +1091,7 @@ var Vue = (function () {
1089
1091
  };
1090
1092
  }
1091
1093
  }
1092
- const result = arr[method](wrappedFn, thisArg);
1094
+ const result = methodFn.call(arr, wrappedFn, thisArg);
1093
1095
  return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
1094
1096
  }
1095
1097
  function reduce(self, method, fn, args) {
@@ -1940,6 +1942,220 @@ var Vue = (function () {
1940
1942
  "CLEAR": "clear"
1941
1943
  };
1942
1944
 
1945
+ const INITIAL_WATCHER_VALUE = {};
1946
+ const cleanupMap = /* @__PURE__ */ new WeakMap();
1947
+ let activeWatcher = void 0;
1948
+ function getCurrentWatcher() {
1949
+ return activeWatcher;
1950
+ }
1951
+ function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1952
+ if (owner) {
1953
+ let cleanups = cleanupMap.get(owner);
1954
+ if (!cleanups) cleanupMap.set(owner, cleanups = []);
1955
+ cleanups.push(cleanupFn);
1956
+ } else if (!failSilently) {
1957
+ warn$2(
1958
+ `onWatcherCleanup() was called when there was no active watcher to associate with.`
1959
+ );
1960
+ }
1961
+ }
1962
+ function watch$1(source, cb, options = EMPTY_OBJ) {
1963
+ const { immediate, deep, once, scheduler, augmentJob, call } = options;
1964
+ const warnInvalidSource = (s) => {
1965
+ (options.onWarn || warn$2)(
1966
+ `Invalid watch source: `,
1967
+ s,
1968
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1969
+ );
1970
+ };
1971
+ const reactiveGetter = (source2) => {
1972
+ if (deep) return source2;
1973
+ if (isShallow(source2) || deep === false || deep === 0)
1974
+ return traverse(source2, 1);
1975
+ return traverse(source2);
1976
+ };
1977
+ let effect;
1978
+ let getter;
1979
+ let cleanup;
1980
+ let boundCleanup;
1981
+ let forceTrigger = false;
1982
+ let isMultiSource = false;
1983
+ if (isRef(source)) {
1984
+ getter = () => source.value;
1985
+ forceTrigger = isShallow(source);
1986
+ } else if (isReactive(source)) {
1987
+ getter = () => reactiveGetter(source);
1988
+ forceTrigger = true;
1989
+ } else if (isArray(source)) {
1990
+ isMultiSource = true;
1991
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1992
+ getter = () => source.map((s) => {
1993
+ if (isRef(s)) {
1994
+ return s.value;
1995
+ } else if (isReactive(s)) {
1996
+ return reactiveGetter(s);
1997
+ } else if (isFunction(s)) {
1998
+ return call ? call(s, 2) : s();
1999
+ } else {
2000
+ warnInvalidSource(s);
2001
+ }
2002
+ });
2003
+ } else if (isFunction(source)) {
2004
+ if (cb) {
2005
+ getter = call ? () => call(source, 2) : source;
2006
+ } else {
2007
+ getter = () => {
2008
+ if (cleanup) {
2009
+ pauseTracking();
2010
+ try {
2011
+ cleanup();
2012
+ } finally {
2013
+ resetTracking();
2014
+ }
2015
+ }
2016
+ const currentEffect = activeWatcher;
2017
+ activeWatcher = effect;
2018
+ try {
2019
+ return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2020
+ } finally {
2021
+ activeWatcher = currentEffect;
2022
+ }
2023
+ };
2024
+ }
2025
+ } else {
2026
+ getter = NOOP;
2027
+ warnInvalidSource(source);
2028
+ }
2029
+ if (cb && deep) {
2030
+ const baseGetter = getter;
2031
+ const depth = deep === true ? Infinity : deep;
2032
+ getter = () => traverse(baseGetter(), depth);
2033
+ }
2034
+ if (once) {
2035
+ if (cb) {
2036
+ const _cb = cb;
2037
+ cb = (...args) => {
2038
+ _cb(...args);
2039
+ effect.stop();
2040
+ };
2041
+ } else {
2042
+ const _getter = getter;
2043
+ getter = () => {
2044
+ _getter();
2045
+ effect.stop();
2046
+ };
2047
+ }
2048
+ }
2049
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2050
+ const job = (immediateFirstRun) => {
2051
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2052
+ return;
2053
+ }
2054
+ if (cb) {
2055
+ const newValue = effect.run();
2056
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2057
+ if (cleanup) {
2058
+ cleanup();
2059
+ }
2060
+ const currentWatcher = activeWatcher;
2061
+ activeWatcher = effect;
2062
+ try {
2063
+ const args = [
2064
+ newValue,
2065
+ // pass undefined as the old value when it's changed for the first time
2066
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2067
+ boundCleanup
2068
+ ];
2069
+ call ? call(cb, 3, args) : (
2070
+ // @ts-expect-error
2071
+ cb(...args)
2072
+ );
2073
+ oldValue = newValue;
2074
+ } finally {
2075
+ activeWatcher = currentWatcher;
2076
+ }
2077
+ }
2078
+ } else {
2079
+ effect.run();
2080
+ }
2081
+ };
2082
+ if (augmentJob) {
2083
+ augmentJob(job);
2084
+ }
2085
+ effect = new ReactiveEffect(getter);
2086
+ effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2087
+ boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2088
+ cleanup = effect.onStop = () => {
2089
+ const cleanups = cleanupMap.get(effect);
2090
+ if (cleanups) {
2091
+ if (call) {
2092
+ call(cleanups, 4);
2093
+ } else {
2094
+ for (const cleanup2 of cleanups) cleanup2();
2095
+ }
2096
+ cleanupMap.delete(effect);
2097
+ }
2098
+ };
2099
+ {
2100
+ effect.onTrack = options.onTrack;
2101
+ effect.onTrigger = options.onTrigger;
2102
+ }
2103
+ if (cb) {
2104
+ if (immediate) {
2105
+ job(true);
2106
+ } else {
2107
+ oldValue = effect.run();
2108
+ }
2109
+ } else if (scheduler) {
2110
+ scheduler(job.bind(null, true), true);
2111
+ } else {
2112
+ effect.run();
2113
+ }
2114
+ const scope = getCurrentScope();
2115
+ const watchHandle = () => {
2116
+ effect.stop();
2117
+ if (scope) {
2118
+ remove(scope.effects, effect);
2119
+ }
2120
+ };
2121
+ watchHandle.pause = effect.pause.bind(effect);
2122
+ watchHandle.resume = effect.resume.bind(effect);
2123
+ watchHandle.stop = watchHandle;
2124
+ return watchHandle;
2125
+ }
2126
+ function traverse(value, depth = Infinity, seen) {
2127
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2128
+ return value;
2129
+ }
2130
+ seen = seen || /* @__PURE__ */ new Set();
2131
+ if (seen.has(value)) {
2132
+ return value;
2133
+ }
2134
+ seen.add(value);
2135
+ depth--;
2136
+ if (isRef(value)) {
2137
+ traverse(value.value, depth, seen);
2138
+ } else if (isArray(value)) {
2139
+ for (let i = 0; i < value.length; i++) {
2140
+ traverse(value[i], depth, seen);
2141
+ }
2142
+ } else if (isSet(value) || isMap(value)) {
2143
+ value.forEach((v) => {
2144
+ traverse(v, depth, seen);
2145
+ });
2146
+ } else if (isPlainObject(value)) {
2147
+ for (const key in value) {
2148
+ traverse(value[key], depth, seen);
2149
+ }
2150
+ for (const key of Object.getOwnPropertySymbols(value)) {
2151
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2152
+ traverse(value[key], depth, seen);
2153
+ }
2154
+ }
2155
+ }
2156
+ return value;
2157
+ }
2158
+
1943
2159
  const stack = [];
1944
2160
  function pushWarningContext(vnode) {
1945
2161
  stack.push(vnode);
@@ -2067,12 +2283,6 @@ var Vue = (function () {
2067
2283
  "0": "SETUP_FUNCTION",
2068
2284
  "RENDER_FUNCTION": 1,
2069
2285
  "1": "RENDER_FUNCTION",
2070
- "WATCH_GETTER": 2,
2071
- "2": "WATCH_GETTER",
2072
- "WATCH_CALLBACK": 3,
2073
- "3": "WATCH_CALLBACK",
2074
- "WATCH_CLEANUP": 4,
2075
- "4": "WATCH_CLEANUP",
2076
2286
  "NATIVE_EVENT_HANDLER": 5,
2077
2287
  "5": "NATIVE_EVENT_HANDLER",
2078
2288
  "COMPONENT_EVENT_HANDLER": 6,
@@ -2224,7 +2434,7 @@ var Vue = (function () {
2224
2434
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2225
2435
  }
2226
2436
  function findInsertionIndex(id) {
2227
- let start = flushIndex + 1;
2437
+ let start = isFlushing ? flushIndex + 1 : 0;
2228
2438
  let end = queue.length;
2229
2439
  while (start < end) {
2230
2440
  const middle = start + end >>> 1;
@@ -2240,15 +2450,13 @@ var Vue = (function () {
2240
2450
  }
2241
2451
  function queueJob(job) {
2242
2452
  if (!(job.flags & 1)) {
2243
- if (job.id == null) {
2244
- queue.push(job);
2245
- } else if (
2246
- // fast path when the job id is larger than the tail
2247
- !(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
2248
- ) {
2453
+ const jobId = getId(job);
2454
+ const lastJob = queue[queue.length - 1];
2455
+ if (!lastJob || // fast path when the job id is larger than the tail
2456
+ !(job.flags & 2) && jobId >= getId(lastJob)) {
2249
2457
  queue.push(job);
2250
2458
  } else {
2251
- queue.splice(findInsertionIndex(job.id), 0, job);
2459
+ queue.splice(findInsertionIndex(jobId), 0, job);
2252
2460
  }
2253
2461
  if (!(job.flags & 4)) {
2254
2462
  job.flags |= 1;
@@ -2262,12 +2470,6 @@ var Vue = (function () {
2262
2470
  currentFlushPromise = resolvedPromise.then(flushJobs);
2263
2471
  }
2264
2472
  }
2265
- function invalidateJob(job) {
2266
- const i = queue.indexOf(job);
2267
- if (i > flushIndex) {
2268
- queue.splice(i, 1);
2269
- }
2270
- }
2271
2473
  function queuePostFlushCb(cb) {
2272
2474
  if (!isArray(cb)) {
2273
2475
  if (activePostFlushCbs && cb.id === -1) {
@@ -2329,24 +2531,13 @@ var Vue = (function () {
2329
2531
  postFlushIndex = 0;
2330
2532
  }
2331
2533
  }
2332
- const getId = (job) => job.id == null ? Infinity : job.id;
2333
- const comparator = (a, b) => {
2334
- const diff = getId(a) - getId(b);
2335
- if (diff === 0) {
2336
- const isAPre = a.flags & 2;
2337
- const isBPre = b.flags & 2;
2338
- if (isAPre && !isBPre) return -1;
2339
- if (isBPre && !isAPre) return 1;
2340
- }
2341
- return diff;
2342
- };
2534
+ const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2343
2535
  function flushJobs(seen) {
2344
2536
  isFlushPending = false;
2345
2537
  isFlushing = true;
2346
2538
  {
2347
2539
  seen = seen || /* @__PURE__ */ new Map();
2348
2540
  }
2349
- queue.sort(comparator);
2350
2541
  const check = (job) => checkRecursiveUpdates(seen, job) ;
2351
2542
  try {
2352
2543
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
@@ -2987,7 +3178,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2987
3178
  function once(instance, event, fn) {
2988
3179
  const wrapped = (...args) => {
2989
3180
  off(instance, event, wrapped);
2990
- fn.call(instance.proxy, ...args);
3181
+ fn.apply(instance.proxy, args);
2991
3182
  };
2992
3183
  wrapped.fn = fn;
2993
3184
  on(instance, event, wrapped);
@@ -4025,6 +4216,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4025
4216
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
4026
4217
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
4027
4218
  const getContainerType = (container) => {
4219
+ if (container.nodeType !== 1) return void 0;
4028
4220
  if (isSVGContainer(container)) return "svg";
4029
4221
  if (isMathMLContainer(container)) return "mathml";
4030
4222
  return void 0;
@@ -4947,7 +5139,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4947
5139
  function pruneCache(filter) {
4948
5140
  cache.forEach((vnode, key) => {
4949
5141
  const name = getComponentName(vnode.type);
4950
- if (name && (!filter || !filter(name))) {
5142
+ if (name && !filter(name)) {
4951
5143
  pruneCacheEntry(key);
4952
5144
  }
4953
5145
  });
@@ -5069,6 +5261,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5069
5261
  } else if (isString(pattern)) {
5070
5262
  return pattern.split(",").includes(name);
5071
5263
  } else if (isRegExp(pattern)) {
5264
+ pattern.lastIndex = 0;
5072
5265
  return pattern.test(name);
5073
5266
  }
5074
5267
  return false;
@@ -6510,23 +6703,43 @@ If this is a native custom element, make sure to exclude it from component resol
6510
6703
  );
6511
6704
  }
6512
6705
  function createWatcher(raw, ctx, publicThis, key) {
6513
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6706
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6707
+ const options = {};
6708
+ {
6709
+ const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
6710
+ const newValue = getter();
6711
+ if (isArray(newValue) && isCompatEnabled("WATCH_ARRAY", instance)) {
6712
+ options.deep = true;
6713
+ }
6714
+ const baseGetter = getter;
6715
+ getter = () => {
6716
+ const val = baseGetter();
6717
+ if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
6718
+ traverse(val);
6719
+ }
6720
+ return val;
6721
+ };
6722
+ }
6514
6723
  if (isString(raw)) {
6515
6724
  const handler = ctx[raw];
6516
6725
  if (isFunction(handler)) {
6517
- watch(getter, handler);
6726
+ {
6727
+ watch(getter, handler, options);
6728
+ }
6518
6729
  } else {
6519
6730
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
6520
6731
  }
6521
6732
  } else if (isFunction(raw)) {
6522
- watch(getter, raw.bind(publicThis));
6733
+ {
6734
+ watch(getter, raw.bind(publicThis), options);
6735
+ }
6523
6736
  } else if (isObject(raw)) {
6524
6737
  if (isArray(raw)) {
6525
6738
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
6526
6739
  } else {
6527
6740
  const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
6528
6741
  if (isFunction(handler)) {
6529
- watch(getter, handler, raw);
6742
+ watch(getter, handler, extend(raw, options) );
6530
6743
  } else {
6531
6744
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
6532
6745
  }
@@ -6750,7 +6963,7 @@ If this is a native custom element, make sure to exclude it from component resol
6750
6963
  return vm;
6751
6964
  }
6752
6965
  }
6753
- Vue.version = `2.6.14-compat:${"3.5.0-beta.1"}`;
6966
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
6754
6967
  Vue.config = singletonApp.config;
6755
6968
  Vue.use = (plugin, ...options) => {
6756
6969
  if (plugin && isFunction(plugin.install)) {
@@ -7082,7 +7295,7 @@ If this is a native custom element, make sure to exclude it from component resol
7082
7295
  if (isArray(val)) {
7083
7296
  methodsToPatch.forEach((m) => {
7084
7297
  val[m] = (...args) => {
7085
- Array.prototype[m].call(reactiveVal, ...args);
7298
+ Array.prototype[m].apply(reactiveVal, args);
7086
7299
  };
7087
7300
  });
7088
7301
  } else {
@@ -8277,7 +8490,7 @@ If you want to remount the same app, move your app creation logic into a factory
8277
8490
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
8278
8491
  subTree = filterSingleRoot(subTree.children) || subTree;
8279
8492
  }
8280
- if (vnode === subTree) {
8493
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
8281
8494
  const parentVNode = parentComponent.vnode;
8282
8495
  setScopeId(
8283
8496
  el,
@@ -8607,7 +8820,6 @@ If you want to remount the same app, move your app creation logic into a factory
8607
8820
  return;
8608
8821
  } else {
8609
8822
  instance.next = n2;
8610
- invalidateJob(instance.update);
8611
8823
  instance.update();
8612
8824
  }
8613
8825
  } else {
@@ -9525,7 +9737,6 @@ If you want to remount the same app, move your app creation logic into a factory
9525
9737
  extend({}, options, { flush: "sync" })
9526
9738
  );
9527
9739
  }
9528
- const INITIAL_WATCHER_VALUE = {};
9529
9740
  function watch(source, cb, options) {
9530
9741
  if (!isFunction(cb)) {
9531
9742
  warn$1(
@@ -9534,21 +9745,8 @@ If you want to remount the same app, move your app creation logic into a factory
9534
9745
  }
9535
9746
  return doWatch(source, cb, options);
9536
9747
  }
9537
- function doWatch(source, cb, {
9538
- immediate,
9539
- deep,
9540
- flush,
9541
- once,
9542
- onTrack,
9543
- onTrigger
9544
- } = EMPTY_OBJ) {
9545
- if (cb && once) {
9546
- const _cb = cb;
9547
- cb = (...args) => {
9548
- _cb(...args);
9549
- watchHandle();
9550
- };
9551
- }
9748
+ function doWatch(source, cb, options = EMPTY_OBJ) {
9749
+ const { immediate, deep, flush, once } = options;
9552
9750
  if (!cb) {
9553
9751
  if (immediate !== void 0) {
9554
9752
  warn$1(
@@ -9566,150 +9764,38 @@ If you want to remount the same app, move your app creation logic into a factory
9566
9764
  );
9567
9765
  }
9568
9766
  }
9569
- const warnInvalidSource = (s) => {
9570
- warn$1(
9571
- `Invalid watch source: `,
9572
- s,
9573
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
9574
- );
9575
- };
9767
+ const baseWatchOptions = extend({}, options);
9768
+ baseWatchOptions.onWarn = warn$1;
9576
9769
  const instance = currentInstance;
9577
- const reactiveGetter = (source2) => {
9578
- if (deep) return source2;
9579
- if (isShallow(source2) || deep === false || deep === 0)
9580
- return traverse(source2, 1);
9581
- return traverse(source2);
9582
- };
9583
- let getter;
9584
- let forceTrigger = false;
9585
- let isMultiSource = false;
9586
- if (isRef(source)) {
9587
- getter = () => source.value;
9588
- forceTrigger = isShallow(source);
9589
- } else if (isReactive(source)) {
9590
- getter = () => reactiveGetter(source);
9591
- forceTrigger = true;
9592
- } else if (isArray(source)) {
9593
- isMultiSource = true;
9594
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
9595
- getter = () => source.map((s) => {
9596
- if (isRef(s)) {
9597
- return s.value;
9598
- } else if (isReactive(s)) {
9599
- return reactiveGetter(s);
9600
- } else if (isFunction(s)) {
9601
- return callWithErrorHandling(s, instance, 2);
9770
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
9771
+ let isPre = false;
9772
+ if (flush === "post") {
9773
+ baseWatchOptions.scheduler = (job) => {
9774
+ queuePostRenderEffect(job, instance && instance.suspense);
9775
+ };
9776
+ } else if (flush !== "sync") {
9777
+ isPre = true;
9778
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
9779
+ if (isFirstRun) {
9780
+ job();
9602
9781
  } else {
9603
- warnInvalidSource(s);
9782
+ queueJob(job);
9604
9783
  }
9605
- });
9606
- } else if (isFunction(source)) {
9607
- if (cb) {
9608
- getter = () => callWithErrorHandling(source, instance, 2);
9609
- } else {
9610
- getter = () => {
9611
- if (cleanup) {
9612
- cleanup();
9613
- }
9614
- return callWithAsyncErrorHandling(
9615
- source,
9616
- instance,
9617
- 3,
9618
- [onCleanup]
9619
- );
9620
- };
9621
- }
9622
- } else {
9623
- getter = NOOP;
9624
- warnInvalidSource(source);
9625
- }
9626
- if (cb && !deep) {
9627
- const baseGetter = getter;
9628
- getter = () => {
9629
- const val = baseGetter();
9630
- if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
9631
- traverse(val);
9632
- }
9633
- return val;
9634
9784
  };
9635
9785
  }
9636
- if (cb && deep) {
9637
- const baseGetter = getter;
9638
- const depth = deep === true ? Infinity : deep;
9639
- getter = () => traverse(baseGetter(), depth);
9640
- }
9641
- let cleanup;
9642
- let onCleanup = (fn) => {
9643
- cleanup = effect.onStop = () => {
9644
- callWithErrorHandling(fn, instance, 4);
9645
- cleanup = effect.onStop = void 0;
9646
- };
9647
- };
9648
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
9649
- const job = (immediateFirstRun) => {
9650
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
9651
- return;
9652
- }
9786
+ baseWatchOptions.augmentJob = (job) => {
9653
9787
  if (cb) {
9654
- const newValue = effect.run();
9655
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || isArray(newValue) && isCompatEnabled("WATCH_ARRAY", instance)) {
9656
- if (cleanup) {
9657
- cleanup();
9658
- }
9659
- callWithAsyncErrorHandling(cb, instance, 3, [
9660
- newValue,
9661
- // pass undefined as the old value when it's changed for the first time
9662
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
9663
- onCleanup
9664
- ]);
9665
- oldValue = newValue;
9666
- }
9667
- } else {
9668
- effect.run();
9788
+ job.flags |= 4;
9669
9789
  }
9670
- };
9671
- if (cb) job.flags |= 4;
9672
- const effect = new ReactiveEffect(getter);
9673
- let scheduler;
9674
- if (flush === "sync") {
9675
- effect.flags |= 64;
9676
- scheduler = job;
9677
- } else if (flush === "post") {
9678
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
9679
- } else {
9680
- job.flags |= 2;
9681
- if (instance) job.id = instance.uid;
9682
- scheduler = () => queueJob(job);
9683
- }
9684
- effect.scheduler = scheduler;
9685
- const scope = getCurrentScope();
9686
- const watchHandle = () => {
9687
- effect.stop();
9688
- if (scope) {
9689
- remove(scope.effects, effect);
9790
+ if (isPre) {
9791
+ job.flags |= 2;
9792
+ if (instance) {
9793
+ job.id = instance.uid;
9794
+ job.i = instance;
9795
+ }
9690
9796
  }
9691
9797
  };
9692
- watchHandle.pause = effect.pause.bind(effect);
9693
- watchHandle.resume = effect.resume.bind(effect);
9694
- watchHandle.stop = watchHandle;
9695
- {
9696
- effect.onTrack = onTrack;
9697
- effect.onTrigger = onTrigger;
9698
- }
9699
- if (cb) {
9700
- if (immediate) {
9701
- job(true);
9702
- } else {
9703
- oldValue = effect.run();
9704
- }
9705
- } else if (flush === "post") {
9706
- queuePostRenderEffect(
9707
- effect.run.bind(effect),
9708
- instance && instance.suspense
9709
- );
9710
- } else {
9711
- effect.run();
9712
- }
9798
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
9713
9799
  return watchHandle;
9714
9800
  }
9715
9801
  function instanceWatch(source, value, options) {
@@ -9737,38 +9823,6 @@ If you want to remount the same app, move your app creation logic into a factory
9737
9823
  return cur;
9738
9824
  };
9739
9825
  }
9740
- function traverse(value, depth = Infinity, seen) {
9741
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
9742
- return value;
9743
- }
9744
- seen = seen || /* @__PURE__ */ new Set();
9745
- if (seen.has(value)) {
9746
- return value;
9747
- }
9748
- seen.add(value);
9749
- depth--;
9750
- if (isRef(value)) {
9751
- traverse(value.value, depth, seen);
9752
- } else if (isArray(value)) {
9753
- for (let i = 0; i < value.length; i++) {
9754
- traverse(value[i], depth, seen);
9755
- }
9756
- } else if (isSet(value) || isMap(value)) {
9757
- value.forEach((v) => {
9758
- traverse(v, depth, seen);
9759
- });
9760
- } else if (isPlainObject(value)) {
9761
- for (const key in value) {
9762
- traverse(value[key], depth, seen);
9763
- }
9764
- for (const key of Object.getOwnPropertySymbols(value)) {
9765
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
9766
- traverse(value[key], depth, seen);
9767
- }
9768
- }
9769
- }
9770
- return value;
9771
- }
9772
9826
 
9773
9827
  function useModel(props, name, options = EMPTY_OBJ) {
9774
9828
  const i = getCurrentInstance();
@@ -12009,7 +12063,7 @@ Component that was made reactive: `,
12009
12063
  return true;
12010
12064
  }
12011
12065
 
12012
- const version = "3.5.0-beta.1";
12066
+ const version = "3.5.0-beta.3";
12013
12067
  const warn = warn$1 ;
12014
12068
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12015
12069
  const devtools = devtools$1 ;
@@ -12949,7 +13003,6 @@ Expected function or array of functions, received type ${typeof value}.`
12949
13003
  this._ob = null;
12950
13004
  if (this.shadowRoot && _createApp !== createApp) {
12951
13005
  this._root = this.shadowRoot;
12952
- this._mount(_def);
12953
13006
  } else {
12954
13007
  if (this.shadowRoot) {
12955
13008
  warn(
@@ -12962,9 +13015,9 @@ Expected function or array of functions, received type ${typeof value}.`
12962
13015
  } else {
12963
13016
  this._root = this;
12964
13017
  }
12965
- if (!this._def.__asyncLoader) {
12966
- this._resolveProps(this._def);
12967
- }
13018
+ }
13019
+ if (!this._def.__asyncLoader) {
13020
+ this._resolveProps(this._def);
12968
13021
  }
12969
13022
  }
12970
13023
  connectedCallback() {
@@ -13164,6 +13217,7 @@ Expected function or array of functions, received type ${typeof value}.`
13164
13217
  vnode.ce = (instance) => {
13165
13218
  this._instance = instance;
13166
13219
  instance.ce = this;
13220
+ instance.isCE = true;
13167
13221
  {
13168
13222
  instance.ceReload = (newStyles) => {
13169
13223
  if (this._styles) {
@@ -13981,6 +14035,7 @@ Expected function or array of functions, received type ${typeof value}.`
13981
14035
  effectScope: effectScope,
13982
14036
  getCurrentInstance: getCurrentInstance,
13983
14037
  getCurrentScope: getCurrentScope,
14038
+ getCurrentWatcher: getCurrentWatcher,
13984
14039
  getTransitionRawChildren: getTransitionRawChildren,
13985
14040
  guardReactiveProps: guardReactiveProps,
13986
14041
  h: h,
@@ -14023,6 +14078,7 @@ Expected function or array of functions, received type ${typeof value}.`
14023
14078
  onServerPrefetch: onServerPrefetch,
14024
14079
  onUnmounted: onUnmounted,
14025
14080
  onUpdated: onUpdated,
14081
+ onWatcherCleanup: onWatcherCleanup,
14026
14082
  openBlock: openBlock,
14027
14083
  popScopeId: popScopeId,
14028
14084
  provide: provide,