vue 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 v3.5.0-beta.1
2
+ * vue 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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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++) {
@@ -3561,6 +3752,7 @@ var Vue = (function (exports) {
3561
3752
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
3562
3753
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
3563
3754
  const getContainerType = (container) => {
3755
+ if (container.nodeType !== 1) return void 0;
3564
3756
  if (isSVGContainer(container)) return "svg";
3565
3757
  if (isMathMLContainer(container)) return "mathml";
3566
3758
  return void 0;
@@ -4483,7 +4675,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4483
4675
  function pruneCache(filter) {
4484
4676
  cache.forEach((vnode, key) => {
4485
4677
  const name = getComponentName(vnode.type);
4486
- if (name && (!filter || !filter(name))) {
4678
+ if (name && !filter(name)) {
4487
4679
  pruneCacheEntry(key);
4488
4680
  }
4489
4681
  });
@@ -4602,6 +4794,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4602
4794
  } else if (isString(pattern)) {
4603
4795
  return pattern.split(",").includes(name);
4604
4796
  } else if (isRegExp(pattern)) {
4797
+ pattern.lastIndex = 0;
4605
4798
  return pattern.test(name);
4606
4799
  }
4607
4800
  return false;
@@ -5493,16 +5686,20 @@ If this is a native custom element, make sure to exclude it from component resol
5493
5686
  );
5494
5687
  }
5495
5688
  function createWatcher(raw, ctx, publicThis, key) {
5496
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5689
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5497
5690
  if (isString(raw)) {
5498
5691
  const handler = ctx[raw];
5499
5692
  if (isFunction(handler)) {
5500
- watch(getter, handler);
5693
+ {
5694
+ watch(getter, handler);
5695
+ }
5501
5696
  } else {
5502
5697
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
5503
5698
  }
5504
5699
  } else if (isFunction(raw)) {
5505
- watch(getter, raw.bind(publicThis));
5700
+ {
5701
+ watch(getter, raw.bind(publicThis));
5702
+ }
5506
5703
  } else if (isObject(raw)) {
5507
5704
  if (isArray(raw)) {
5508
5705
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
@@ -6740,7 +6937,7 @@ If you want to remount the same app, move your app creation logic into a factory
6740
6937
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
6741
6938
  subTree = filterSingleRoot(subTree.children) || subTree;
6742
6939
  }
6743
- if (vnode === subTree) {
6940
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
6744
6941
  const parentVNode = parentComponent.vnode;
6745
6942
  setScopeId(
6746
6943
  el,
@@ -7069,7 +7266,6 @@ If you want to remount the same app, move your app creation logic into a factory
7069
7266
  return;
7070
7267
  } else {
7071
7268
  instance.next = n2;
7072
- invalidateJob(instance.update);
7073
7269
  instance.update();
7074
7270
  }
7075
7271
  } else {
@@ -7954,7 +8150,6 @@ If you want to remount the same app, move your app creation logic into a factory
7954
8150
  extend({}, options, { flush: "sync" })
7955
8151
  );
7956
8152
  }
7957
- const INITIAL_WATCHER_VALUE = {};
7958
8153
  function watch(source, cb, options) {
7959
8154
  if (!isFunction(cb)) {
7960
8155
  warn$1(
@@ -7963,21 +8158,8 @@ If you want to remount the same app, move your app creation logic into a factory
7963
8158
  }
7964
8159
  return doWatch(source, cb, options);
7965
8160
  }
7966
- function doWatch(source, cb, {
7967
- immediate,
7968
- deep,
7969
- flush,
7970
- once,
7971
- onTrack,
7972
- onTrigger
7973
- } = EMPTY_OBJ) {
7974
- if (cb && once) {
7975
- const _cb = cb;
7976
- cb = (...args) => {
7977
- _cb(...args);
7978
- watchHandle();
7979
- };
7980
- }
8161
+ function doWatch(source, cb, options = EMPTY_OBJ) {
8162
+ const { immediate, deep, flush, once } = options;
7981
8163
  if (!cb) {
7982
8164
  if (immediate !== void 0) {
7983
8165
  warn$1(
@@ -7995,140 +8177,38 @@ If you want to remount the same app, move your app creation logic into a factory
7995
8177
  );
7996
8178
  }
7997
8179
  }
7998
- const warnInvalidSource = (s) => {
7999
- warn$1(
8000
- `Invalid watch source: `,
8001
- s,
8002
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
8003
- );
8004
- };
8180
+ const baseWatchOptions = extend({}, options);
8181
+ baseWatchOptions.onWarn = warn$1;
8005
8182
  const instance = currentInstance;
8006
- const reactiveGetter = (source2) => {
8007
- if (deep) return source2;
8008
- if (isShallow(source2) || deep === false || deep === 0)
8009
- return traverse(source2, 1);
8010
- return traverse(source2);
8011
- };
8012
- let getter;
8013
- let forceTrigger = false;
8014
- let isMultiSource = false;
8015
- if (isRef(source)) {
8016
- getter = () => source.value;
8017
- forceTrigger = isShallow(source);
8018
- } else if (isReactive(source)) {
8019
- getter = () => reactiveGetter(source);
8020
- forceTrigger = true;
8021
- } else if (isArray(source)) {
8022
- isMultiSource = true;
8023
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
8024
- getter = () => source.map((s) => {
8025
- if (isRef(s)) {
8026
- return s.value;
8027
- } else if (isReactive(s)) {
8028
- return reactiveGetter(s);
8029
- } else if (isFunction(s)) {
8030
- return callWithErrorHandling(s, instance, 2);
8183
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
8184
+ let isPre = false;
8185
+ if (flush === "post") {
8186
+ baseWatchOptions.scheduler = (job) => {
8187
+ queuePostRenderEffect(job, instance && instance.suspense);
8188
+ };
8189
+ } else if (flush !== "sync") {
8190
+ isPre = true;
8191
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
8192
+ if (isFirstRun) {
8193
+ job();
8031
8194
  } else {
8032
- warnInvalidSource(s);
8195
+ queueJob(job);
8033
8196
  }
8034
- });
8035
- } else if (isFunction(source)) {
8036
- if (cb) {
8037
- getter = () => callWithErrorHandling(source, instance, 2);
8038
- } else {
8039
- getter = () => {
8040
- if (cleanup) {
8041
- cleanup();
8042
- }
8043
- return callWithAsyncErrorHandling(
8044
- source,
8045
- instance,
8046
- 3,
8047
- [onCleanup]
8048
- );
8049
- };
8050
- }
8051
- } else {
8052
- getter = NOOP;
8053
- warnInvalidSource(source);
8054
- }
8055
- if (cb && deep) {
8056
- const baseGetter = getter;
8057
- const depth = deep === true ? Infinity : deep;
8058
- getter = () => traverse(baseGetter(), depth);
8059
- }
8060
- let cleanup;
8061
- let onCleanup = (fn) => {
8062
- cleanup = effect.onStop = () => {
8063
- callWithErrorHandling(fn, instance, 4);
8064
- cleanup = effect.onStop = void 0;
8065
8197
  };
8066
- };
8067
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
8068
- const job = (immediateFirstRun) => {
8069
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
8070
- return;
8071
- }
8198
+ }
8199
+ baseWatchOptions.augmentJob = (job) => {
8072
8200
  if (cb) {
8073
- const newValue = effect.run();
8074
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
8075
- if (cleanup) {
8076
- cleanup();
8077
- }
8078
- callWithAsyncErrorHandling(cb, instance, 3, [
8079
- newValue,
8080
- // pass undefined as the old value when it's changed for the first time
8081
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
8082
- onCleanup
8083
- ]);
8084
- oldValue = newValue;
8085
- }
8086
- } else {
8087
- effect.run();
8201
+ job.flags |= 4;
8088
8202
  }
8089
- };
8090
- if (cb) job.flags |= 4;
8091
- const effect = new ReactiveEffect(getter);
8092
- let scheduler;
8093
- if (flush === "sync") {
8094
- effect.flags |= 64;
8095
- scheduler = job;
8096
- } else if (flush === "post") {
8097
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
8098
- } else {
8099
- job.flags |= 2;
8100
- if (instance) job.id = instance.uid;
8101
- scheduler = () => queueJob(job);
8102
- }
8103
- effect.scheduler = scheduler;
8104
- const scope = getCurrentScope();
8105
- const watchHandle = () => {
8106
- effect.stop();
8107
- if (scope) {
8108
- remove(scope.effects, effect);
8203
+ if (isPre) {
8204
+ job.flags |= 2;
8205
+ if (instance) {
8206
+ job.id = instance.uid;
8207
+ job.i = instance;
8208
+ }
8109
8209
  }
8110
8210
  };
8111
- watchHandle.pause = effect.pause.bind(effect);
8112
- watchHandle.resume = effect.resume.bind(effect);
8113
- watchHandle.stop = watchHandle;
8114
- {
8115
- effect.onTrack = onTrack;
8116
- effect.onTrigger = onTrigger;
8117
- }
8118
- if (cb) {
8119
- if (immediate) {
8120
- job(true);
8121
- } else {
8122
- oldValue = effect.run();
8123
- }
8124
- } else if (flush === "post") {
8125
- queuePostRenderEffect(
8126
- effect.run.bind(effect),
8127
- instance && instance.suspense
8128
- );
8129
- } else {
8130
- effect.run();
8131
- }
8211
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
8132
8212
  return watchHandle;
8133
8213
  }
8134
8214
  function instanceWatch(source, value, options) {
@@ -8156,38 +8236,6 @@ If you want to remount the same app, move your app creation logic into a factory
8156
8236
  return cur;
8157
8237
  };
8158
8238
  }
8159
- function traverse(value, depth = Infinity, seen) {
8160
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
8161
- return value;
8162
- }
8163
- seen = seen || /* @__PURE__ */ new Set();
8164
- if (seen.has(value)) {
8165
- return value;
8166
- }
8167
- seen.add(value);
8168
- depth--;
8169
- if (isRef(value)) {
8170
- traverse(value.value, depth, seen);
8171
- } else if (isArray(value)) {
8172
- for (let i = 0; i < value.length; i++) {
8173
- traverse(value[i], depth, seen);
8174
- }
8175
- } else if (isSet(value) || isMap(value)) {
8176
- value.forEach((v) => {
8177
- traverse(v, depth, seen);
8178
- });
8179
- } else if (isPlainObject(value)) {
8180
- for (const key in value) {
8181
- traverse(value[key], depth, seen);
8182
- }
8183
- for (const key of Object.getOwnPropertySymbols(value)) {
8184
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
8185
- traverse(value[key], depth, seen);
8186
- }
8187
- }
8188
- }
8189
- return value;
8190
- }
8191
8239
 
8192
8240
  function useModel(props, name, options = EMPTY_OBJ) {
8193
8241
  const i = getCurrentInstance();
@@ -10321,7 +10369,7 @@ Component that was made reactive: `,
10321
10369
  return true;
10322
10370
  }
10323
10371
 
10324
- const version = "3.5.0-beta.1";
10372
+ const version = "3.5.0-beta.3";
10325
10373
  const warn = warn$1 ;
10326
10374
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10327
10375
  const devtools = devtools$1 ;
@@ -11173,7 +11221,6 @@ Expected function or array of functions, received type ${typeof value}.`
11173
11221
  this._ob = null;
11174
11222
  if (this.shadowRoot && _createApp !== createApp) {
11175
11223
  this._root = this.shadowRoot;
11176
- this._mount(_def);
11177
11224
  } else {
11178
11225
  if (this.shadowRoot) {
11179
11226
  warn(
@@ -11186,9 +11233,9 @@ Expected function or array of functions, received type ${typeof value}.`
11186
11233
  } else {
11187
11234
  this._root = this;
11188
11235
  }
11189
- if (!this._def.__asyncLoader) {
11190
- this._resolveProps(this._def);
11191
- }
11236
+ }
11237
+ if (!this._def.__asyncLoader) {
11238
+ this._resolveProps(this._def);
11192
11239
  }
11193
11240
  }
11194
11241
  connectedCallback() {
@@ -11388,6 +11435,7 @@ Expected function or array of functions, received type ${typeof value}.`
11388
11435
  vnode.ce = (instance) => {
11389
11436
  this._instance = instance;
11390
11437
  instance.ce = this;
11438
+ instance.isCE = true;
11391
11439
  {
11392
11440
  instance.ceReload = (newStyles) => {
11393
11441
  if (this._styles) {
@@ -13271,8 +13319,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13271
13319
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13272
13320
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13273
13321
  const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13274
- const isMemberExpressionBrowser = (path) => {
13275
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
13322
+ const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
13323
+ const isMemberExpressionBrowser = (exp) => {
13324
+ const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
13276
13325
  let state = 0 /* inMemberExp */;
13277
13326
  let stateStack = [];
13278
13327
  let currentOpenBracketCount = 0;
@@ -13334,6 +13383,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13334
13383
  return !currentOpenBracketCount && !currentOpenParensCount;
13335
13384
  };
13336
13385
  const isMemberExpression = isMemberExpressionBrowser ;
13386
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
13387
+ const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
13388
+ const isFnExpression = isFnExpressionBrowser ;
13337
13389
  function assert(condition, msg) {
13338
13390
  if (!condition) {
13339
13391
  throw new Error(msg || `unexpected compiler condition`);
@@ -13770,7 +13822,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13770
13822
  case 17:
13771
13823
  case 18:
13772
13824
  case 19:
13825
+ // "
13773
13826
  case 20:
13827
+ // '
13774
13828
  case 21:
13775
13829
  emitError(9, end);
13776
13830
  break;
@@ -14675,6 +14729,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14675
14729
  context.helper(TO_DISPLAY_STRING);
14676
14730
  }
14677
14731
  break;
14732
+ // for container types, further traverse downwards
14678
14733
  case 9:
14679
14734
  for (let i2 = 0; i2 < node.branches.length; i2++) {
14680
14735
  traverseNode(node.branches[i2], context);
@@ -15022,6 +15077,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15022
15077
  case 21:
15023
15078
  genNodeList(node.body, context, true, false);
15024
15079
  break;
15080
+ // SSR only types
15025
15081
  case 22:
15026
15082
  break;
15027
15083
  case 23:
@@ -15032,6 +15088,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15032
15088
  break;
15033
15089
  case 26:
15034
15090
  break;
15091
+ /* istanbul ignore next */
15035
15092
  case 10:
15036
15093
  break;
15037
15094
  default:
@@ -16691,7 +16748,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16691
16748
  };
16692
16749
  }
16693
16750
 
16694
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16695
16751
  const transformOn$1 = (dir, node, context, augmentor) => {
16696
16752
  const { loc, modifiers, arg } = dir;
16697
16753
  if (!dir.exp && !modifiers.length) {
@@ -16735,8 +16791,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16735
16791
  }
16736
16792
  let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
16737
16793
  if (exp) {
16738
- const isMemberExp = isMemberExpression(exp.content);
16739
- const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
16794
+ const isMemberExp = isMemberExpression(exp);
16795
+ const isInlineStatement = !(isMemberExp || isFnExpression(exp));
16740
16796
  const hasMultipleStatements = exp.content.includes(`;`);
16741
16797
  {
16742
16798
  validateBrowserExpression(
@@ -16884,7 +16940,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16884
16940
  return createTransformProps();
16885
16941
  }
16886
16942
  const maybeRef = false;
16887
- if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
16943
+ if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
16888
16944
  context.onError(
16889
16945
  createCompilerError(42, exp.loc)
16890
16946
  );
@@ -17781,6 +17837,7 @@ ${codeFrame}` : message);
17781
17837
  exports.effectScope = effectScope;
17782
17838
  exports.getCurrentInstance = getCurrentInstance;
17783
17839
  exports.getCurrentScope = getCurrentScope;
17840
+ exports.getCurrentWatcher = getCurrentWatcher;
17784
17841
  exports.getTransitionRawChildren = getTransitionRawChildren;
17785
17842
  exports.guardReactiveProps = guardReactiveProps;
17786
17843
  exports.h = h;
@@ -17823,6 +17880,7 @@ ${codeFrame}` : message);
17823
17880
  exports.onServerPrefetch = onServerPrefetch;
17824
17881
  exports.onUnmounted = onUnmounted;
17825
17882
  exports.onUpdated = onUpdated;
17883
+ exports.onWatcherCleanup = onWatcherCleanup;
17826
17884
  exports.openBlock = openBlock;
17827
17885
  exports.popScopeId = popScopeId;
17828
17886
  exports.provide = provide;