@vue/compat 3.5.0-beta.2 → 3.5.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.0-beta.2
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
  **/
@@ -1140,14 +1140,14 @@ var Vue = (function () {
1140
1140
  const arrayProto = Array.prototype;
1141
1141
  function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1142
1142
  const arr = shallowReadArray(self);
1143
- let methodFn;
1144
- if ((methodFn = arr[method]) !== arrayProto[method]) {
1145
- return methodFn.apply(arr, args);
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;
1146
1148
  }
1147
- let needsWrap = false;
1148
1149
  let wrappedFn = fn;
1149
1150
  if (arr !== self) {
1150
- needsWrap = !isShallow(self);
1151
1151
  if (needsWrap) {
1152
1152
  wrappedFn = function(item, index) {
1153
1153
  return fn.call(this, toReactive(item), index, self);
@@ -2009,6 +2009,220 @@ var Vue = (function () {
2009
2009
  "CLEAR": "clear"
2010
2010
  };
2011
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
+
2012
2226
  const stack$1 = [];
2013
2227
  function pushWarningContext(vnode) {
2014
2228
  stack$1.push(vnode);
@@ -2136,12 +2350,6 @@ var Vue = (function () {
2136
2350
  "0": "SETUP_FUNCTION",
2137
2351
  "RENDER_FUNCTION": 1,
2138
2352
  "1": "RENDER_FUNCTION",
2139
- "WATCH_GETTER": 2,
2140
- "2": "WATCH_GETTER",
2141
- "WATCH_CALLBACK": 3,
2142
- "3": "WATCH_CALLBACK",
2143
- "WATCH_CLEANUP": 4,
2144
- "4": "WATCH_CLEANUP",
2145
2353
  "NATIVE_EVENT_HANDLER": 5,
2146
2354
  "5": "NATIVE_EVENT_HANDLER",
2147
2355
  "COMPONENT_EVENT_HANDLER": 6,
@@ -2293,7 +2501,7 @@ var Vue = (function () {
2293
2501
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2294
2502
  }
2295
2503
  function findInsertionIndex(id) {
2296
- let start = flushIndex + 1;
2504
+ let start = isFlushing ? flushIndex + 1 : 0;
2297
2505
  let end = queue.length;
2298
2506
  while (start < end) {
2299
2507
  const middle = start + end >>> 1;
@@ -2309,15 +2517,13 @@ var Vue = (function () {
2309
2517
  }
2310
2518
  function queueJob(job) {
2311
2519
  if (!(job.flags & 1)) {
2312
- if (job.id == null) {
2313
- queue.push(job);
2314
- } else if (
2315
- // fast path when the job id is larger than the tail
2316
- !(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
2317
- ) {
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)) {
2318
2524
  queue.push(job);
2319
2525
  } else {
2320
- queue.splice(findInsertionIndex(job.id), 0, job);
2526
+ queue.splice(findInsertionIndex(jobId), 0, job);
2321
2527
  }
2322
2528
  if (!(job.flags & 4)) {
2323
2529
  job.flags |= 1;
@@ -2331,12 +2537,6 @@ var Vue = (function () {
2331
2537
  currentFlushPromise = resolvedPromise.then(flushJobs);
2332
2538
  }
2333
2539
  }
2334
- function invalidateJob(job) {
2335
- const i = queue.indexOf(job);
2336
- if (i > flushIndex) {
2337
- queue.splice(i, 1);
2338
- }
2339
- }
2340
2540
  function queuePostFlushCb(cb) {
2341
2541
  if (!isArray(cb)) {
2342
2542
  if (activePostFlushCbs && cb.id === -1) {
@@ -2398,24 +2598,13 @@ var Vue = (function () {
2398
2598
  postFlushIndex = 0;
2399
2599
  }
2400
2600
  }
2401
- const getId = (job) => job.id == null ? Infinity : job.id;
2402
- const comparator = (a, b) => {
2403
- const diff = getId(a) - getId(b);
2404
- if (diff === 0) {
2405
- const isAPre = a.flags & 2;
2406
- const isBPre = b.flags & 2;
2407
- if (isAPre && !isBPre) return -1;
2408
- if (isBPre && !isAPre) return 1;
2409
- }
2410
- return diff;
2411
- };
2601
+ const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2412
2602
  function flushJobs(seen) {
2413
2603
  isFlushPending = false;
2414
2604
  isFlushing = true;
2415
2605
  {
2416
2606
  seen = seen || /* @__PURE__ */ new Map();
2417
2607
  }
2418
- queue.sort(comparator);
2419
2608
  const check = (job) => checkRecursiveUpdates(seen, job) ;
2420
2609
  try {
2421
2610
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
@@ -3056,7 +3245,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3056
3245
  function once(instance, event, fn) {
3057
3246
  const wrapped = (...args) => {
3058
3247
  off(instance, event, wrapped);
3059
- fn.call(instance.proxy, ...args);
3248
+ fn.apply(instance.proxy, args);
3060
3249
  };
3061
3250
  wrapped.fn = fn;
3062
3251
  on(instance, event, wrapped);
@@ -6581,23 +6770,43 @@ If this is a native custom element, make sure to exclude it from component resol
6581
6770
  );
6582
6771
  }
6583
6772
  function createWatcher(raw, ctx, publicThis, key) {
6584
- 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
+ }
6585
6790
  if (isString(raw)) {
6586
6791
  const handler = ctx[raw];
6587
6792
  if (isFunction(handler)) {
6588
- watch(getter, handler);
6793
+ {
6794
+ watch(getter, handler, options);
6795
+ }
6589
6796
  } else {
6590
6797
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
6591
6798
  }
6592
6799
  } else if (isFunction(raw)) {
6593
- watch(getter, raw.bind(publicThis));
6800
+ {
6801
+ watch(getter, raw.bind(publicThis), options);
6802
+ }
6594
6803
  } else if (isObject(raw)) {
6595
6804
  if (isArray(raw)) {
6596
6805
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
6597
6806
  } else {
6598
6807
  const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
6599
6808
  if (isFunction(handler)) {
6600
- watch(getter, handler, raw);
6809
+ watch(getter, handler, extend(raw, options) );
6601
6810
  } else {
6602
6811
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
6603
6812
  }
@@ -6821,7 +7030,7 @@ If this is a native custom element, make sure to exclude it from component resol
6821
7030
  return vm;
6822
7031
  }
6823
7032
  }
6824
- Vue.version = `2.6.14-compat:${"3.5.0-beta.2"}`;
7033
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
6825
7034
  Vue.config = singletonApp.config;
6826
7035
  Vue.use = (plugin, ...options) => {
6827
7036
  if (plugin && isFunction(plugin.install)) {
@@ -7153,7 +7362,7 @@ If this is a native custom element, make sure to exclude it from component resol
7153
7362
  if (isArray(val)) {
7154
7363
  methodsToPatch.forEach((m) => {
7155
7364
  val[m] = (...args) => {
7156
- Array.prototype[m].call(reactiveVal, ...args);
7365
+ Array.prototype[m].apply(reactiveVal, args);
7157
7366
  };
7158
7367
  });
7159
7368
  } else {
@@ -8348,7 +8557,7 @@ If you want to remount the same app, move your app creation logic into a factory
8348
8557
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
8349
8558
  subTree = filterSingleRoot(subTree.children) || subTree;
8350
8559
  }
8351
- if (vnode === subTree) {
8560
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
8352
8561
  const parentVNode = parentComponent.vnode;
8353
8562
  setScopeId(
8354
8563
  el,
@@ -8678,7 +8887,6 @@ If you want to remount the same app, move your app creation logic into a factory
8678
8887
  return;
8679
8888
  } else {
8680
8889
  instance.next = n2;
8681
- invalidateJob(instance.update);
8682
8890
  instance.update();
8683
8891
  }
8684
8892
  } else {
@@ -9596,7 +9804,6 @@ If you want to remount the same app, move your app creation logic into a factory
9596
9804
  extend({}, options, { flush: "sync" })
9597
9805
  );
9598
9806
  }
9599
- const INITIAL_WATCHER_VALUE = {};
9600
9807
  function watch(source, cb, options) {
9601
9808
  if (!isFunction(cb)) {
9602
9809
  warn$1(
@@ -9605,21 +9812,8 @@ If you want to remount the same app, move your app creation logic into a factory
9605
9812
  }
9606
9813
  return doWatch(source, cb, options);
9607
9814
  }
9608
- function doWatch(source, cb, {
9609
- immediate,
9610
- deep,
9611
- flush,
9612
- once,
9613
- onTrack,
9614
- onTrigger
9615
- } = EMPTY_OBJ) {
9616
- if (cb && once) {
9617
- const _cb = cb;
9618
- cb = (...args) => {
9619
- _cb(...args);
9620
- watchHandle();
9621
- };
9622
- }
9815
+ function doWatch(source, cb, options = EMPTY_OBJ) {
9816
+ const { immediate, deep, flush, once } = options;
9623
9817
  if (!cb) {
9624
9818
  if (immediate !== void 0) {
9625
9819
  warn$1(
@@ -9637,149 +9831,38 @@ If you want to remount the same app, move your app creation logic into a factory
9637
9831
  );
9638
9832
  }
9639
9833
  }
9640
- const warnInvalidSource = (s) => {
9641
- warn$1(
9642
- `Invalid watch source: `,
9643
- s,
9644
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
9645
- );
9646
- };
9834
+ const baseWatchOptions = extend({}, options);
9835
+ baseWatchOptions.onWarn = warn$1;
9647
9836
  const instance = currentInstance;
9648
- const reactiveGetter = (source2) => {
9649
- if (deep) return source2;
9650
- if (isShallow(source2) || deep === false || deep === 0)
9651
- return traverse(source2, 1);
9652
- return traverse(source2);
9653
- };
9654
- let getter;
9655
- let forceTrigger = false;
9656
- let isMultiSource = false;
9657
- if (isRef(source)) {
9658
- getter = () => source.value;
9659
- forceTrigger = isShallow(source);
9660
- } else if (isReactive(source)) {
9661
- getter = () => reactiveGetter(source);
9662
- forceTrigger = true;
9663
- } else if (isArray(source)) {
9664
- isMultiSource = true;
9665
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
9666
- getter = () => source.map((s) => {
9667
- if (isRef(s)) {
9668
- return s.value;
9669
- } else if (isReactive(s)) {
9670
- return reactiveGetter(s);
9671
- } else if (isFunction(s)) {
9672
- 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();
9673
9848
  } else {
9674
- warnInvalidSource(s);
9675
- }
9676
- });
9677
- } else if (isFunction(source)) {
9678
- if (cb) {
9679
- getter = () => callWithErrorHandling(source, instance, 2);
9680
- } else {
9681
- getter = () => {
9682
- if (cleanup) {
9683
- cleanup();
9684
- }
9685
- return callWithAsyncErrorHandling(
9686
- source,
9687
- instance,
9688
- 3,
9689
- [onCleanup]
9690
- );
9691
- };
9692
- }
9693
- } else {
9694
- getter = NOOP;
9695
- warnInvalidSource(source);
9696
- }
9697
- if (cb && !deep) {
9698
- const baseGetter = getter;
9699
- getter = () => {
9700
- const val = baseGetter();
9701
- if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
9702
- traverse(val);
9849
+ queueJob(job);
9703
9850
  }
9704
- return val;
9705
9851
  };
9706
9852
  }
9707
- if (cb && deep) {
9708
- const baseGetter = getter;
9709
- const depth = deep === true ? Infinity : deep;
9710
- getter = () => traverse(baseGetter(), depth);
9711
- }
9712
- let cleanup;
9713
- let onCleanup = (fn) => {
9714
- cleanup = effect.onStop = () => {
9715
- callWithErrorHandling(fn, instance, 4);
9716
- cleanup = effect.onStop = void 0;
9717
- };
9718
- };
9719
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
9720
- const job = (immediateFirstRun) => {
9721
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
9722
- return;
9723
- }
9853
+ baseWatchOptions.augmentJob = (job) => {
9724
9854
  if (cb) {
9725
- const newValue = effect.run();
9726
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || isArray(newValue) && isCompatEnabled$1("WATCH_ARRAY", instance)) {
9727
- if (cleanup) {
9728
- cleanup();
9729
- }
9730
- callWithAsyncErrorHandling(cb, instance, 3, [
9731
- newValue,
9732
- // pass undefined as the old value when it's changed for the first time
9733
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
9734
- onCleanup
9735
- ]);
9736
- oldValue = newValue;
9737
- }
9738
- } else {
9739
- effect.run();
9855
+ job.flags |= 4;
9740
9856
  }
9741
- };
9742
- if (cb) job.flags |= 4;
9743
- const effect = new ReactiveEffect(getter);
9744
- let scheduler;
9745
- if (flush === "sync") {
9746
- scheduler = job;
9747
- } else if (flush === "post") {
9748
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
9749
- } else {
9750
- job.flags |= 2;
9751
- if (instance) job.id = instance.uid;
9752
- scheduler = () => queueJob(job);
9753
- }
9754
- effect.scheduler = scheduler;
9755
- const scope = getCurrentScope();
9756
- const watchHandle = () => {
9757
- effect.stop();
9758
- if (scope) {
9759
- remove(scope.effects, effect);
9857
+ if (isPre) {
9858
+ job.flags |= 2;
9859
+ if (instance) {
9860
+ job.id = instance.uid;
9861
+ job.i = instance;
9862
+ }
9760
9863
  }
9761
9864
  };
9762
- watchHandle.pause = effect.pause.bind(effect);
9763
- watchHandle.resume = effect.resume.bind(effect);
9764
- watchHandle.stop = watchHandle;
9765
- {
9766
- effect.onTrack = onTrack;
9767
- effect.onTrigger = onTrigger;
9768
- }
9769
- if (cb) {
9770
- if (immediate) {
9771
- job(true);
9772
- } else {
9773
- oldValue = effect.run();
9774
- }
9775
- } else if (flush === "post") {
9776
- queuePostRenderEffect(
9777
- effect.run.bind(effect),
9778
- instance && instance.suspense
9779
- );
9780
- } else {
9781
- effect.run();
9782
- }
9865
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
9783
9866
  return watchHandle;
9784
9867
  }
9785
9868
  function instanceWatch(source, value, options) {
@@ -9807,38 +9890,6 @@ If you want to remount the same app, move your app creation logic into a factory
9807
9890
  return cur;
9808
9891
  };
9809
9892
  }
9810
- function traverse(value, depth = Infinity, seen) {
9811
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
9812
- return value;
9813
- }
9814
- seen = seen || /* @__PURE__ */ new Set();
9815
- if (seen.has(value)) {
9816
- return value;
9817
- }
9818
- seen.add(value);
9819
- depth--;
9820
- if (isRef(value)) {
9821
- traverse(value.value, depth, seen);
9822
- } else if (isArray(value)) {
9823
- for (let i = 0; i < value.length; i++) {
9824
- traverse(value[i], depth, seen);
9825
- }
9826
- } else if (isSet(value) || isMap(value)) {
9827
- value.forEach((v) => {
9828
- traverse(v, depth, seen);
9829
- });
9830
- } else if (isPlainObject(value)) {
9831
- for (const key in value) {
9832
- traverse(value[key], depth, seen);
9833
- }
9834
- for (const key of Object.getOwnPropertySymbols(value)) {
9835
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
9836
- traverse(value[key], depth, seen);
9837
- }
9838
- }
9839
- }
9840
- return value;
9841
- }
9842
9893
 
9843
9894
  function useModel(props, name, options = EMPTY_OBJ) {
9844
9895
  const i = getCurrentInstance();
@@ -12079,7 +12130,7 @@ Component that was made reactive: `,
12079
12130
  return true;
12080
12131
  }
12081
12132
 
12082
- const version = "3.5.0-beta.2";
12133
+ const version = "3.5.0-beta.3";
12083
12134
  const warn = warn$1 ;
12084
12135
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12085
12136
  const devtools = devtools$1 ;
@@ -14051,6 +14102,7 @@ Expected function or array of functions, received type ${typeof value}.`
14051
14102
  effectScope: effectScope,
14052
14103
  getCurrentInstance: getCurrentInstance,
14053
14104
  getCurrentScope: getCurrentScope,
14105
+ getCurrentWatcher: getCurrentWatcher,
14054
14106
  getTransitionRawChildren: getTransitionRawChildren,
14055
14107
  guardReactiveProps: guardReactiveProps,
14056
14108
  h: h,
@@ -14093,6 +14145,7 @@ Expected function or array of functions, received type ${typeof value}.`
14093
14145
  onServerPrefetch: onServerPrefetch,
14094
14146
  onUnmounted: onUnmounted,
14095
14147
  onUpdated: onUpdated,
14148
+ onWatcherCleanup: onWatcherCleanup,
14096
14149
  openBlock: openBlock,
14097
14150
  popScopeId: popScopeId,
14098
14151
  provide: provide,
@@ -15944,7 +15997,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15944
15997
  case 17:
15945
15998
  case 18:
15946
15999
  case 19:
16000
+ // "
15947
16001
  case 20:
16002
+ // '
15948
16003
  case 21:
15949
16004
  emitError(9, end);
15950
16005
  break;
@@ -16926,6 +16981,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16926
16981
  context.helper(TO_DISPLAY_STRING);
16927
16982
  }
16928
16983
  break;
16984
+ // for container types, further traverse downwards
16929
16985
  case 9:
16930
16986
  for (let i2 = 0; i2 < node.branches.length; i2++) {
16931
16987
  traverseNode(node.branches[i2], context);
@@ -17278,6 +17334,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17278
17334
  case 21:
17279
17335
  genNodeList(node.body, context, true, false);
17280
17336
  break;
17337
+ // SSR only types
17281
17338
  case 22:
17282
17339
  break;
17283
17340
  case 23:
@@ -17288,6 +17345,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17288
17345
  break;
17289
17346
  case 26:
17290
17347
  break;
17348
+ /* istanbul ignore next */
17291
17349
  case 10:
17292
17350
  break;
17293
17351
  default:
@@ -19295,27 +19353,35 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19295
19353
  case 34:
19296
19354
  inDouble = true;
19297
19355
  break;
19356
+ // "
19298
19357
  case 39:
19299
19358
  inSingle = true;
19300
19359
  break;
19360
+ // '
19301
19361
  case 96:
19302
19362
  inTemplateString = true;
19303
19363
  break;
19364
+ // `
19304
19365
  case 40:
19305
19366
  paren++;
19306
19367
  break;
19368
+ // (
19307
19369
  case 41:
19308
19370
  paren--;
19309
19371
  break;
19372
+ // )
19310
19373
  case 91:
19311
19374
  square++;
19312
19375
  break;
19376
+ // [
19313
19377
  case 93:
19314
19378
  square--;
19315
19379
  break;
19380
+ // ]
19316
19381
  case 123:
19317
19382
  curly++;
19318
19383
  break;
19384
+ // {
19319
19385
  case 125:
19320
19386
  curly--;
19321
19387
  break;