@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
  **/
@@ -535,11 +535,11 @@ var Vue = (function () {
535
535
  }
536
536
  }
537
537
  pause() {
538
- this.flags |= 128;
538
+ this.flags |= 64;
539
539
  }
540
540
  resume() {
541
- if (this.flags & 128) {
542
- this.flags &= ~128;
541
+ if (this.flags & 64) {
542
+ this.flags &= ~64;
543
543
  if (pausedQueueEffects.has(this)) {
544
544
  pausedQueueEffects.delete(this);
545
545
  this.trigger();
@@ -553,9 +553,6 @@ var Vue = (function () {
553
553
  if (this.flags & 2 && !(this.flags & 32)) {
554
554
  return;
555
555
  }
556
- if (this.flags & 64) {
557
- return this.trigger();
558
- }
559
556
  if (!(this.flags & 8)) {
560
557
  this.flags |= 8;
561
558
  this.nextEffect = batchedEffect;
@@ -599,7 +596,7 @@ var Vue = (function () {
599
596
  }
600
597
  }
601
598
  trigger() {
602
- if (this.flags & 128) {
599
+ if (this.flags & 64) {
603
600
  pausedQueueEffects.add(this);
604
601
  } else if (this.scheduler) {
605
602
  this.scheduler();
@@ -629,6 +626,7 @@ var Vue = (function () {
629
626
  batchDepth--;
630
627
  return;
631
628
  }
629
+ batchDepth--;
632
630
  let error;
633
631
  while (batchedEffect) {
634
632
  let e = batchedEffect;
@@ -647,7 +645,6 @@ var Vue = (function () {
647
645
  e = next;
648
646
  }
649
647
  }
650
- batchDepth--;
651
648
  if (error) throw error;
652
649
  }
653
650
  function prepareDeps(sub) {
@@ -1050,26 +1047,26 @@ var Vue = (function () {
1050
1047
  });
1051
1048
  },
1052
1049
  every(fn, thisArg) {
1053
- return apply(this, "every", fn, thisArg);
1050
+ return apply(this, "every", fn, thisArg, void 0, arguments);
1054
1051
  },
1055
1052
  filter(fn, thisArg) {
1056
- return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
1053
+ return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
1057
1054
  },
1058
1055
  find(fn, thisArg) {
1059
- return apply(this, "find", fn, thisArg, toReactive);
1056
+ return apply(this, "find", fn, thisArg, toReactive, arguments);
1060
1057
  },
1061
1058
  findIndex(fn, thisArg) {
1062
- return apply(this, "findIndex", fn, thisArg);
1059
+ return apply(this, "findIndex", fn, thisArg, void 0, arguments);
1063
1060
  },
1064
1061
  findLast(fn, thisArg) {
1065
- return apply(this, "findLast", fn, thisArg, toReactive);
1062
+ return apply(this, "findLast", fn, thisArg, toReactive, arguments);
1066
1063
  },
1067
1064
  findLastIndex(fn, thisArg) {
1068
- return apply(this, "findLastIndex", fn, thisArg);
1065
+ return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
1069
1066
  },
1070
1067
  // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
1071
1068
  forEach(fn, thisArg) {
1072
- return apply(this, "forEach", fn, thisArg);
1069
+ return apply(this, "forEach", fn, thisArg, void 0, arguments);
1073
1070
  },
1074
1071
  includes(...args) {
1075
1072
  return searchProxy(this, "includes", args);
@@ -1085,7 +1082,7 @@ var Vue = (function () {
1085
1082
  return searchProxy(this, "lastIndexOf", args);
1086
1083
  },
1087
1084
  map(fn, thisArg) {
1088
- return apply(this, "map", fn, thisArg);
1085
+ return apply(this, "map", fn, thisArg, void 0, arguments);
1089
1086
  },
1090
1087
  pop() {
1091
1088
  return noTracking(this, "pop");
@@ -1104,7 +1101,7 @@ var Vue = (function () {
1104
1101
  },
1105
1102
  // slice could use ARRAY_ITERATE but also seems to beg for range tracking
1106
1103
  some(fn, thisArg) {
1107
- return apply(this, "some", fn, thisArg);
1104
+ return apply(this, "some", fn, thisArg, void 0, arguments);
1108
1105
  },
1109
1106
  splice(...args) {
1110
1107
  return noTracking(this, "splice", args);
@@ -1140,12 +1137,17 @@ var Vue = (function () {
1140
1137
  }
1141
1138
  return iter;
1142
1139
  }
1143
- function apply(self, method, fn, thisArg, wrappedRetFn) {
1140
+ const arrayProto = Array.prototype;
1141
+ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1144
1142
  const arr = shallowReadArray(self);
1145
- let needsWrap = false;
1143
+ const needsWrap = arr !== self && !isShallow(self);
1144
+ const methodFn = arr[method];
1145
+ if (methodFn !== arrayProto[method]) {
1146
+ const result2 = methodFn.apply(arr, args);
1147
+ return needsWrap ? toReactive(result2) : result2;
1148
+ }
1146
1149
  let wrappedFn = fn;
1147
1150
  if (arr !== self) {
1148
- needsWrap = !isShallow(self);
1149
1151
  if (needsWrap) {
1150
1152
  wrappedFn = function(item, index) {
1151
1153
  return fn.call(this, toReactive(item), index, self);
@@ -1156,7 +1158,7 @@ var Vue = (function () {
1156
1158
  };
1157
1159
  }
1158
1160
  }
1159
- const result = arr[method](wrappedFn, thisArg);
1161
+ const result = methodFn.call(arr, wrappedFn, thisArg);
1160
1162
  return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
1161
1163
  }
1162
1164
  function reduce(self, method, fn, args) {
@@ -2007,6 +2009,220 @@ var Vue = (function () {
2007
2009
  "CLEAR": "clear"
2008
2010
  };
2009
2011
 
2012
+ const INITIAL_WATCHER_VALUE = {};
2013
+ const cleanupMap = /* @__PURE__ */ new WeakMap();
2014
+ let activeWatcher = void 0;
2015
+ function getCurrentWatcher() {
2016
+ return activeWatcher;
2017
+ }
2018
+ function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
2019
+ if (owner) {
2020
+ let cleanups = cleanupMap.get(owner);
2021
+ if (!cleanups) cleanupMap.set(owner, cleanups = []);
2022
+ cleanups.push(cleanupFn);
2023
+ } else if (!failSilently) {
2024
+ warn$2(
2025
+ `onWatcherCleanup() was called when there was no active watcher to associate with.`
2026
+ );
2027
+ }
2028
+ }
2029
+ function watch$1(source, cb, options = EMPTY_OBJ) {
2030
+ const { immediate, deep, once, scheduler, augmentJob, call } = options;
2031
+ const warnInvalidSource = (s) => {
2032
+ (options.onWarn || warn$2)(
2033
+ `Invalid watch source: `,
2034
+ s,
2035
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2036
+ );
2037
+ };
2038
+ const reactiveGetter = (source2) => {
2039
+ if (deep) return source2;
2040
+ if (isShallow(source2) || deep === false || deep === 0)
2041
+ return traverse(source2, 1);
2042
+ return traverse(source2);
2043
+ };
2044
+ let effect;
2045
+ let getter;
2046
+ let cleanup;
2047
+ let boundCleanup;
2048
+ let forceTrigger = false;
2049
+ let isMultiSource = false;
2050
+ if (isRef(source)) {
2051
+ getter = () => source.value;
2052
+ forceTrigger = isShallow(source);
2053
+ } else if (isReactive(source)) {
2054
+ getter = () => reactiveGetter(source);
2055
+ forceTrigger = true;
2056
+ } else if (isArray(source)) {
2057
+ isMultiSource = true;
2058
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2059
+ getter = () => source.map((s) => {
2060
+ if (isRef(s)) {
2061
+ return s.value;
2062
+ } else if (isReactive(s)) {
2063
+ return reactiveGetter(s);
2064
+ } else if (isFunction(s)) {
2065
+ return call ? call(s, 2) : s();
2066
+ } else {
2067
+ warnInvalidSource(s);
2068
+ }
2069
+ });
2070
+ } else if (isFunction(source)) {
2071
+ if (cb) {
2072
+ getter = call ? () => call(source, 2) : source;
2073
+ } else {
2074
+ getter = () => {
2075
+ if (cleanup) {
2076
+ pauseTracking();
2077
+ try {
2078
+ cleanup();
2079
+ } finally {
2080
+ resetTracking();
2081
+ }
2082
+ }
2083
+ const currentEffect = activeWatcher;
2084
+ activeWatcher = effect;
2085
+ try {
2086
+ return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2087
+ } finally {
2088
+ activeWatcher = currentEffect;
2089
+ }
2090
+ };
2091
+ }
2092
+ } else {
2093
+ getter = NOOP;
2094
+ warnInvalidSource(source);
2095
+ }
2096
+ if (cb && deep) {
2097
+ const baseGetter = getter;
2098
+ const depth = deep === true ? Infinity : deep;
2099
+ getter = () => traverse(baseGetter(), depth);
2100
+ }
2101
+ if (once) {
2102
+ if (cb) {
2103
+ const _cb = cb;
2104
+ cb = (...args) => {
2105
+ _cb(...args);
2106
+ effect.stop();
2107
+ };
2108
+ } else {
2109
+ const _getter = getter;
2110
+ getter = () => {
2111
+ _getter();
2112
+ effect.stop();
2113
+ };
2114
+ }
2115
+ }
2116
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2117
+ const job = (immediateFirstRun) => {
2118
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2119
+ return;
2120
+ }
2121
+ if (cb) {
2122
+ const newValue = effect.run();
2123
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2124
+ if (cleanup) {
2125
+ cleanup();
2126
+ }
2127
+ const currentWatcher = activeWatcher;
2128
+ activeWatcher = effect;
2129
+ try {
2130
+ const args = [
2131
+ newValue,
2132
+ // pass undefined as the old value when it's changed for the first time
2133
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2134
+ boundCleanup
2135
+ ];
2136
+ call ? call(cb, 3, args) : (
2137
+ // @ts-expect-error
2138
+ cb(...args)
2139
+ );
2140
+ oldValue = newValue;
2141
+ } finally {
2142
+ activeWatcher = currentWatcher;
2143
+ }
2144
+ }
2145
+ } else {
2146
+ effect.run();
2147
+ }
2148
+ };
2149
+ if (augmentJob) {
2150
+ augmentJob(job);
2151
+ }
2152
+ effect = new ReactiveEffect(getter);
2153
+ effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2154
+ boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2155
+ cleanup = effect.onStop = () => {
2156
+ const cleanups = cleanupMap.get(effect);
2157
+ if (cleanups) {
2158
+ if (call) {
2159
+ call(cleanups, 4);
2160
+ } else {
2161
+ for (const cleanup2 of cleanups) cleanup2();
2162
+ }
2163
+ cleanupMap.delete(effect);
2164
+ }
2165
+ };
2166
+ {
2167
+ effect.onTrack = options.onTrack;
2168
+ effect.onTrigger = options.onTrigger;
2169
+ }
2170
+ if (cb) {
2171
+ if (immediate) {
2172
+ job(true);
2173
+ } else {
2174
+ oldValue = effect.run();
2175
+ }
2176
+ } else if (scheduler) {
2177
+ scheduler(job.bind(null, true), true);
2178
+ } else {
2179
+ effect.run();
2180
+ }
2181
+ const scope = getCurrentScope();
2182
+ const watchHandle = () => {
2183
+ effect.stop();
2184
+ if (scope) {
2185
+ remove(scope.effects, effect);
2186
+ }
2187
+ };
2188
+ watchHandle.pause = effect.pause.bind(effect);
2189
+ watchHandle.resume = effect.resume.bind(effect);
2190
+ watchHandle.stop = watchHandle;
2191
+ return watchHandle;
2192
+ }
2193
+ function traverse(value, depth = Infinity, seen) {
2194
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2195
+ return value;
2196
+ }
2197
+ seen = seen || /* @__PURE__ */ new Set();
2198
+ if (seen.has(value)) {
2199
+ return value;
2200
+ }
2201
+ seen.add(value);
2202
+ depth--;
2203
+ if (isRef(value)) {
2204
+ traverse(value.value, depth, seen);
2205
+ } else if (isArray(value)) {
2206
+ for (let i = 0; i < value.length; i++) {
2207
+ traverse(value[i], depth, seen);
2208
+ }
2209
+ } else if (isSet(value) || isMap(value)) {
2210
+ value.forEach((v) => {
2211
+ traverse(v, depth, seen);
2212
+ });
2213
+ } else if (isPlainObject(value)) {
2214
+ for (const key in value) {
2215
+ traverse(value[key], depth, seen);
2216
+ }
2217
+ for (const key of Object.getOwnPropertySymbols(value)) {
2218
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2219
+ traverse(value[key], depth, seen);
2220
+ }
2221
+ }
2222
+ }
2223
+ return value;
2224
+ }
2225
+
2010
2226
  const stack$1 = [];
2011
2227
  function pushWarningContext(vnode) {
2012
2228
  stack$1.push(vnode);
@@ -2134,12 +2350,6 @@ var Vue = (function () {
2134
2350
  "0": "SETUP_FUNCTION",
2135
2351
  "RENDER_FUNCTION": 1,
2136
2352
  "1": "RENDER_FUNCTION",
2137
- "WATCH_GETTER": 2,
2138
- "2": "WATCH_GETTER",
2139
- "WATCH_CALLBACK": 3,
2140
- "3": "WATCH_CALLBACK",
2141
- "WATCH_CLEANUP": 4,
2142
- "4": "WATCH_CLEANUP",
2143
2353
  "NATIVE_EVENT_HANDLER": 5,
2144
2354
  "5": "NATIVE_EVENT_HANDLER",
2145
2355
  "COMPONENT_EVENT_HANDLER": 6,
@@ -2291,7 +2501,7 @@ var Vue = (function () {
2291
2501
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2292
2502
  }
2293
2503
  function findInsertionIndex(id) {
2294
- let start = flushIndex + 1;
2504
+ let start = isFlushing ? flushIndex + 1 : 0;
2295
2505
  let end = queue.length;
2296
2506
  while (start < end) {
2297
2507
  const middle = start + end >>> 1;
@@ -2307,15 +2517,13 @@ var Vue = (function () {
2307
2517
  }
2308
2518
  function queueJob(job) {
2309
2519
  if (!(job.flags & 1)) {
2310
- if (job.id == null) {
2311
- queue.push(job);
2312
- } else if (
2313
- // fast path when the job id is larger than the tail
2314
- !(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
2315
- ) {
2520
+ const jobId = getId(job);
2521
+ const lastJob = queue[queue.length - 1];
2522
+ if (!lastJob || // fast path when the job id is larger than the tail
2523
+ !(job.flags & 2) && jobId >= getId(lastJob)) {
2316
2524
  queue.push(job);
2317
2525
  } else {
2318
- queue.splice(findInsertionIndex(job.id), 0, job);
2526
+ queue.splice(findInsertionIndex(jobId), 0, job);
2319
2527
  }
2320
2528
  if (!(job.flags & 4)) {
2321
2529
  job.flags |= 1;
@@ -2329,12 +2537,6 @@ var Vue = (function () {
2329
2537
  currentFlushPromise = resolvedPromise.then(flushJobs);
2330
2538
  }
2331
2539
  }
2332
- function invalidateJob(job) {
2333
- const i = queue.indexOf(job);
2334
- if (i > flushIndex) {
2335
- queue.splice(i, 1);
2336
- }
2337
- }
2338
2540
  function queuePostFlushCb(cb) {
2339
2541
  if (!isArray(cb)) {
2340
2542
  if (activePostFlushCbs && cb.id === -1) {
@@ -2396,24 +2598,13 @@ var Vue = (function () {
2396
2598
  postFlushIndex = 0;
2397
2599
  }
2398
2600
  }
2399
- const getId = (job) => job.id == null ? Infinity : job.id;
2400
- const comparator = (a, b) => {
2401
- const diff = getId(a) - getId(b);
2402
- if (diff === 0) {
2403
- const isAPre = a.flags & 2;
2404
- const isBPre = b.flags & 2;
2405
- if (isAPre && !isBPre) return -1;
2406
- if (isBPre && !isAPre) return 1;
2407
- }
2408
- return diff;
2409
- };
2601
+ const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2410
2602
  function flushJobs(seen) {
2411
2603
  isFlushPending = false;
2412
2604
  isFlushing = true;
2413
2605
  {
2414
2606
  seen = seen || /* @__PURE__ */ new Map();
2415
2607
  }
2416
- queue.sort(comparator);
2417
2608
  const check = (job) => checkRecursiveUpdates(seen, job) ;
2418
2609
  try {
2419
2610
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
@@ -3054,7 +3245,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3054
3245
  function once(instance, event, fn) {
3055
3246
  const wrapped = (...args) => {
3056
3247
  off(instance, event, wrapped);
3057
- fn.call(instance.proxy, ...args);
3248
+ fn.apply(instance.proxy, args);
3058
3249
  };
3059
3250
  wrapped.fn = fn;
3060
3251
  on(instance, event, wrapped);
@@ -4092,6 +4283,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4092
4283
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
4093
4284
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
4094
4285
  const getContainerType = (container) => {
4286
+ if (container.nodeType !== 1) return void 0;
4095
4287
  if (isSVGContainer(container)) return "svg";
4096
4288
  if (isMathMLContainer(container)) return "mathml";
4097
4289
  return void 0;
@@ -5014,7 +5206,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5014
5206
  function pruneCache(filter) {
5015
5207
  cache.forEach((vnode, key) => {
5016
5208
  const name = getComponentName(vnode.type);
5017
- if (name && (!filter || !filter(name))) {
5209
+ if (name && !filter(name)) {
5018
5210
  pruneCacheEntry(key);
5019
5211
  }
5020
5212
  });
@@ -5136,6 +5328,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5136
5328
  } else if (isString(pattern)) {
5137
5329
  return pattern.split(",").includes(name);
5138
5330
  } else if (isRegExp(pattern)) {
5331
+ pattern.lastIndex = 0;
5139
5332
  return pattern.test(name);
5140
5333
  }
5141
5334
  return false;
@@ -6577,23 +6770,43 @@ If this is a native custom element, make sure to exclude it from component resol
6577
6770
  );
6578
6771
  }
6579
6772
  function createWatcher(raw, ctx, publicThis, key) {
6580
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6773
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6774
+ const options = {};
6775
+ {
6776
+ const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
6777
+ const newValue = getter();
6778
+ if (isArray(newValue) && isCompatEnabled$1("WATCH_ARRAY", instance)) {
6779
+ options.deep = true;
6780
+ }
6781
+ const baseGetter = getter;
6782
+ getter = () => {
6783
+ const val = baseGetter();
6784
+ if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
6785
+ traverse(val);
6786
+ }
6787
+ return val;
6788
+ };
6789
+ }
6581
6790
  if (isString(raw)) {
6582
6791
  const handler = ctx[raw];
6583
6792
  if (isFunction(handler)) {
6584
- watch(getter, handler);
6793
+ {
6794
+ watch(getter, handler, options);
6795
+ }
6585
6796
  } else {
6586
6797
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
6587
6798
  }
6588
6799
  } else if (isFunction(raw)) {
6589
- watch(getter, raw.bind(publicThis));
6800
+ {
6801
+ watch(getter, raw.bind(publicThis), options);
6802
+ }
6590
6803
  } else if (isObject(raw)) {
6591
6804
  if (isArray(raw)) {
6592
6805
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
6593
6806
  } else {
6594
6807
  const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
6595
6808
  if (isFunction(handler)) {
6596
- watch(getter, handler, raw);
6809
+ watch(getter, handler, extend(raw, options) );
6597
6810
  } else {
6598
6811
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
6599
6812
  }
@@ -6817,7 +7030,7 @@ If this is a native custom element, make sure to exclude it from component resol
6817
7030
  return vm;
6818
7031
  }
6819
7032
  }
6820
- Vue.version = `2.6.14-compat:${"3.5.0-beta.1"}`;
7033
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
6821
7034
  Vue.config = singletonApp.config;
6822
7035
  Vue.use = (plugin, ...options) => {
6823
7036
  if (plugin && isFunction(plugin.install)) {
@@ -7149,7 +7362,7 @@ If this is a native custom element, make sure to exclude it from component resol
7149
7362
  if (isArray(val)) {
7150
7363
  methodsToPatch.forEach((m) => {
7151
7364
  val[m] = (...args) => {
7152
- Array.prototype[m].call(reactiveVal, ...args);
7365
+ Array.prototype[m].apply(reactiveVal, args);
7153
7366
  };
7154
7367
  });
7155
7368
  } else {
@@ -8344,7 +8557,7 @@ If you want to remount the same app, move your app creation logic into a factory
8344
8557
  if (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,
@@ -8674,7 +8887,6 @@ If you want to remount the same app, move your app creation logic into a factory
8674
8887
  return;
8675
8888
  } else {
8676
8889
  instance.next = n2;
8677
- invalidateJob(instance.update);
8678
8890
  instance.update();
8679
8891
  }
8680
8892
  } else {
@@ -9592,7 +9804,6 @@ If you want to remount the same app, move your app creation logic into a factory
9592
9804
  extend({}, options, { flush: "sync" })
9593
9805
  );
9594
9806
  }
9595
- const INITIAL_WATCHER_VALUE = {};
9596
9807
  function watch(source, cb, options) {
9597
9808
  if (!isFunction(cb)) {
9598
9809
  warn$1(
@@ -9601,21 +9812,8 @@ If you want to remount the same app, move your app creation logic into a factory
9601
9812
  }
9602
9813
  return doWatch(source, cb, options);
9603
9814
  }
9604
- function doWatch(source, cb, {
9605
- immediate,
9606
- deep,
9607
- flush,
9608
- once,
9609
- onTrack,
9610
- onTrigger
9611
- } = EMPTY_OBJ) {
9612
- if (cb && once) {
9613
- const _cb = cb;
9614
- cb = (...args) => {
9615
- _cb(...args);
9616
- watchHandle();
9617
- };
9618
- }
9815
+ function doWatch(source, cb, options = EMPTY_OBJ) {
9816
+ const { immediate, deep, flush, once } = options;
9619
9817
  if (!cb) {
9620
9818
  if (immediate !== void 0) {
9621
9819
  warn$1(
@@ -9633,150 +9831,38 @@ If you want to remount the same app, move your app creation logic into a factory
9633
9831
  );
9634
9832
  }
9635
9833
  }
9636
- const warnInvalidSource = (s) => {
9637
- warn$1(
9638
- `Invalid watch source: `,
9639
- s,
9640
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
9641
- );
9642
- };
9834
+ const baseWatchOptions = extend({}, options);
9835
+ baseWatchOptions.onWarn = warn$1;
9643
9836
  const instance = currentInstance;
9644
- const reactiveGetter = (source2) => {
9645
- if (deep) return source2;
9646
- if (isShallow(source2) || deep === false || deep === 0)
9647
- return traverse(source2, 1);
9648
- return traverse(source2);
9649
- };
9650
- let getter;
9651
- let forceTrigger = false;
9652
- let isMultiSource = false;
9653
- if (isRef(source)) {
9654
- getter = () => source.value;
9655
- forceTrigger = isShallow(source);
9656
- } else if (isReactive(source)) {
9657
- getter = () => reactiveGetter(source);
9658
- forceTrigger = true;
9659
- } else if (isArray(source)) {
9660
- isMultiSource = true;
9661
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
9662
- getter = () => source.map((s) => {
9663
- if (isRef(s)) {
9664
- return s.value;
9665
- } else if (isReactive(s)) {
9666
- return reactiveGetter(s);
9667
- } else if (isFunction(s)) {
9668
- return callWithErrorHandling(s, instance, 2);
9837
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
9838
+ let isPre = false;
9839
+ if (flush === "post") {
9840
+ baseWatchOptions.scheduler = (job) => {
9841
+ queuePostRenderEffect(job, instance && instance.suspense);
9842
+ };
9843
+ } else if (flush !== "sync") {
9844
+ isPre = true;
9845
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
9846
+ if (isFirstRun) {
9847
+ job();
9669
9848
  } else {
9670
- warnInvalidSource(s);
9671
- }
9672
- });
9673
- } else if (isFunction(source)) {
9674
- if (cb) {
9675
- getter = () => callWithErrorHandling(source, instance, 2);
9676
- } else {
9677
- getter = () => {
9678
- if (cleanup) {
9679
- cleanup();
9680
- }
9681
- return callWithAsyncErrorHandling(
9682
- source,
9683
- instance,
9684
- 3,
9685
- [onCleanup]
9686
- );
9687
- };
9688
- }
9689
- } else {
9690
- getter = NOOP;
9691
- warnInvalidSource(source);
9692
- }
9693
- if (cb && !deep) {
9694
- const baseGetter = getter;
9695
- getter = () => {
9696
- const val = baseGetter();
9697
- if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
9698
- traverse(val);
9849
+ queueJob(job);
9699
9850
  }
9700
- return val;
9701
9851
  };
9702
9852
  }
9703
- if (cb && deep) {
9704
- const baseGetter = getter;
9705
- const depth = deep === true ? Infinity : deep;
9706
- getter = () => traverse(baseGetter(), depth);
9707
- }
9708
- let cleanup;
9709
- let onCleanup = (fn) => {
9710
- cleanup = effect.onStop = () => {
9711
- callWithErrorHandling(fn, instance, 4);
9712
- cleanup = effect.onStop = void 0;
9713
- };
9714
- };
9715
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
9716
- const job = (immediateFirstRun) => {
9717
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
9718
- return;
9719
- }
9853
+ baseWatchOptions.augmentJob = (job) => {
9720
9854
  if (cb) {
9721
- const newValue = effect.run();
9722
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || isArray(newValue) && isCompatEnabled$1("WATCH_ARRAY", instance)) {
9723
- if (cleanup) {
9724
- cleanup();
9725
- }
9726
- callWithAsyncErrorHandling(cb, instance, 3, [
9727
- newValue,
9728
- // pass undefined as the old value when it's changed for the first time
9729
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
9730
- onCleanup
9731
- ]);
9732
- oldValue = newValue;
9733
- }
9734
- } else {
9735
- effect.run();
9855
+ job.flags |= 4;
9736
9856
  }
9737
- };
9738
- if (cb) job.flags |= 4;
9739
- const effect = new ReactiveEffect(getter);
9740
- let scheduler;
9741
- if (flush === "sync") {
9742
- effect.flags |= 64;
9743
- scheduler = job;
9744
- } else if (flush === "post") {
9745
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
9746
- } else {
9747
- job.flags |= 2;
9748
- if (instance) job.id = instance.uid;
9749
- scheduler = () => queueJob(job);
9750
- }
9751
- effect.scheduler = scheduler;
9752
- const scope = getCurrentScope();
9753
- const watchHandle = () => {
9754
- effect.stop();
9755
- if (scope) {
9756
- remove(scope.effects, effect);
9857
+ if (isPre) {
9858
+ job.flags |= 2;
9859
+ if (instance) {
9860
+ job.id = instance.uid;
9861
+ job.i = instance;
9862
+ }
9757
9863
  }
9758
9864
  };
9759
- watchHandle.pause = effect.pause.bind(effect);
9760
- watchHandle.resume = effect.resume.bind(effect);
9761
- watchHandle.stop = watchHandle;
9762
- {
9763
- effect.onTrack = onTrack;
9764
- effect.onTrigger = onTrigger;
9765
- }
9766
- if (cb) {
9767
- if (immediate) {
9768
- job(true);
9769
- } else {
9770
- oldValue = effect.run();
9771
- }
9772
- } else if (flush === "post") {
9773
- queuePostRenderEffect(
9774
- effect.run.bind(effect),
9775
- instance && instance.suspense
9776
- );
9777
- } else {
9778
- effect.run();
9779
- }
9865
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
9780
9866
  return watchHandle;
9781
9867
  }
9782
9868
  function instanceWatch(source, value, options) {
@@ -9804,38 +9890,6 @@ If you want to remount the same app, move your app creation logic into a factory
9804
9890
  return cur;
9805
9891
  };
9806
9892
  }
9807
- function traverse(value, depth = Infinity, seen) {
9808
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
9809
- return value;
9810
- }
9811
- seen = seen || /* @__PURE__ */ new Set();
9812
- if (seen.has(value)) {
9813
- return value;
9814
- }
9815
- seen.add(value);
9816
- depth--;
9817
- if (isRef(value)) {
9818
- traverse(value.value, depth, seen);
9819
- } else if (isArray(value)) {
9820
- for (let i = 0; i < value.length; i++) {
9821
- traverse(value[i], depth, seen);
9822
- }
9823
- } else if (isSet(value) || isMap(value)) {
9824
- value.forEach((v) => {
9825
- traverse(v, depth, seen);
9826
- });
9827
- } else if (isPlainObject(value)) {
9828
- for (const key in value) {
9829
- traverse(value[key], depth, seen);
9830
- }
9831
- for (const key of Object.getOwnPropertySymbols(value)) {
9832
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
9833
- traverse(value[key], depth, seen);
9834
- }
9835
- }
9836
- }
9837
- return value;
9838
- }
9839
9893
 
9840
9894
  function useModel(props, name, options = EMPTY_OBJ) {
9841
9895
  const i = getCurrentInstance();
@@ -12076,7 +12130,7 @@ Component that was made reactive: `,
12076
12130
  return true;
12077
12131
  }
12078
12132
 
12079
- const version = "3.5.0-beta.1";
12133
+ const version = "3.5.0-beta.3";
12080
12134
  const warn = warn$1 ;
12081
12135
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12082
12136
  const devtools = devtools$1 ;
@@ -13016,7 +13070,6 @@ Expected function or array of functions, received type ${typeof value}.`
13016
13070
  this._ob = null;
13017
13071
  if (this.shadowRoot && _createApp !== createApp) {
13018
13072
  this._root = this.shadowRoot;
13019
- this._mount(_def);
13020
13073
  } else {
13021
13074
  if (this.shadowRoot) {
13022
13075
  warn(
@@ -13029,9 +13082,9 @@ Expected function or array of functions, received type ${typeof value}.`
13029
13082
  } else {
13030
13083
  this._root = this;
13031
13084
  }
13032
- if (!this._def.__asyncLoader) {
13033
- this._resolveProps(this._def);
13034
- }
13085
+ }
13086
+ if (!this._def.__asyncLoader) {
13087
+ this._resolveProps(this._def);
13035
13088
  }
13036
13089
  }
13037
13090
  connectedCallback() {
@@ -13231,6 +13284,7 @@ Expected function or array of functions, received type ${typeof value}.`
13231
13284
  vnode.ce = (instance) => {
13232
13285
  this._instance = instance;
13233
13286
  instance.ce = this;
13287
+ instance.isCE = true;
13234
13288
  {
13235
13289
  instance.ceReload = (newStyles) => {
13236
13290
  if (this._styles) {
@@ -14048,6 +14102,7 @@ Expected function or array of functions, received type ${typeof value}.`
14048
14102
  effectScope: effectScope,
14049
14103
  getCurrentInstance: getCurrentInstance,
14050
14104
  getCurrentScope: getCurrentScope,
14105
+ getCurrentWatcher: getCurrentWatcher,
14051
14106
  getTransitionRawChildren: getTransitionRawChildren,
14052
14107
  guardReactiveProps: guardReactiveProps,
14053
14108
  h: h,
@@ -14090,6 +14145,7 @@ Expected function or array of functions, received type ${typeof value}.`
14090
14145
  onServerPrefetch: onServerPrefetch,
14091
14146
  onUnmounted: onUnmounted,
14092
14147
  onUpdated: onUpdated,
14148
+ onWatcherCleanup: onWatcherCleanup,
14093
14149
  openBlock: openBlock,
14094
14150
  popScopeId: popScopeId,
14095
14151
  provide: provide,
@@ -15428,8 +15484,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15428
15484
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
15429
15485
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
15430
15486
  const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
15431
- const isMemberExpressionBrowser = (path) => {
15432
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
15487
+ const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
15488
+ const isMemberExpressionBrowser = (exp) => {
15489
+ const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
15433
15490
  let state = 0 /* inMemberExp */;
15434
15491
  let stateStack = [];
15435
15492
  let currentOpenBracketCount = 0;
@@ -15491,6 +15548,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15491
15548
  return !currentOpenBracketCount && !currentOpenParensCount;
15492
15549
  };
15493
15550
  const isMemberExpression = isMemberExpressionBrowser ;
15551
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
15552
+ const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
15553
+ const isFnExpression = isFnExpressionBrowser ;
15494
15554
  function assert(condition, msg) {
15495
15555
  if (!condition) {
15496
15556
  throw new Error(msg || `unexpected compiler condition`);
@@ -15937,7 +15997,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15937
15997
  case 17:
15938
15998
  case 18:
15939
15999
  case 19:
16000
+ // "
15940
16001
  case 20:
16002
+ // '
15941
16003
  case 21:
15942
16004
  emitError(9, end);
15943
16005
  break;
@@ -16919,6 +16981,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16919
16981
  context.helper(TO_DISPLAY_STRING);
16920
16982
  }
16921
16983
  break;
16984
+ // for container types, further traverse downwards
16922
16985
  case 9:
16923
16986
  for (let i2 = 0; i2 < node.branches.length; i2++) {
16924
16987
  traverseNode(node.branches[i2], context);
@@ -17271,6 +17334,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17271
17334
  case 21:
17272
17335
  genNodeList(node.body, context, true, false);
17273
17336
  break;
17337
+ // SSR only types
17274
17338
  case 22:
17275
17339
  break;
17276
17340
  case 23:
@@ -17281,6 +17345,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17281
17345
  break;
17282
17346
  case 26:
17283
17347
  break;
17348
+ /* istanbul ignore next */
17284
17349
  case 10:
17285
17350
  break;
17286
17351
  default:
@@ -18985,7 +19050,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18985
19050
  };
18986
19051
  }
18987
19052
 
18988
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
18989
19053
  const transformOn$1 = (dir, node, context, augmentor) => {
18990
19054
  const { loc, modifiers, arg } = dir;
18991
19055
  if (!dir.exp && !modifiers.length) {
@@ -19029,8 +19093,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19029
19093
  }
19030
19094
  let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
19031
19095
  if (exp) {
19032
- const isMemberExp = isMemberExpression(exp.content);
19033
- const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
19096
+ const isMemberExp = isMemberExpression(exp);
19097
+ const isInlineStatement = !(isMemberExp || isFnExpression(exp));
19034
19098
  const hasMultipleStatements = exp.content.includes(`;`);
19035
19099
  {
19036
19100
  validateBrowserExpression(
@@ -19178,7 +19242,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19178
19242
  return createTransformProps();
19179
19243
  }
19180
19244
  const maybeRef = false;
19181
- if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
19245
+ if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
19182
19246
  context.onError(
19183
19247
  createCompilerError(42, exp.loc)
19184
19248
  );
@@ -19289,27 +19353,35 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19289
19353
  case 34:
19290
19354
  inDouble = true;
19291
19355
  break;
19356
+ // "
19292
19357
  case 39:
19293
19358
  inSingle = true;
19294
19359
  break;
19360
+ // '
19295
19361
  case 96:
19296
19362
  inTemplateString = true;
19297
19363
  break;
19364
+ // `
19298
19365
  case 40:
19299
19366
  paren++;
19300
19367
  break;
19368
+ // (
19301
19369
  case 41:
19302
19370
  paren--;
19303
19371
  break;
19372
+ // )
19304
19373
  case 91:
19305
19374
  square++;
19306
19375
  break;
19376
+ // [
19307
19377
  case 93:
19308
19378
  square--;
19309
19379
  break;
19380
+ // ]
19310
19381
  case 123:
19311
19382
  curly++;
19312
19383
  break;
19384
+ // {
19313
19385
  case 125:
19314
19386
  curly--;
19315
19387
  break;