@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
  **/
@@ -1073,14 +1073,14 @@ var Vue = (function () {
1073
1073
  const arrayProto = Array.prototype;
1074
1074
  function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1075
1075
  const arr = shallowReadArray(self);
1076
- let methodFn;
1077
- if ((methodFn = arr[method]) !== arrayProto[method]) {
1078
- return methodFn.apply(arr, args);
1076
+ const needsWrap = arr !== self && !isShallow(self);
1077
+ const methodFn = arr[method];
1078
+ if (methodFn !== arrayProto[method]) {
1079
+ const result2 = methodFn.apply(arr, args);
1080
+ return needsWrap ? toReactive(result2) : result2;
1079
1081
  }
1080
- let needsWrap = false;
1081
1082
  let wrappedFn = fn;
1082
1083
  if (arr !== self) {
1083
- needsWrap = !isShallow(self);
1084
1084
  if (needsWrap) {
1085
1085
  wrappedFn = function(item, index) {
1086
1086
  return fn.call(this, toReactive(item), index, self);
@@ -1942,6 +1942,220 @@ var Vue = (function () {
1942
1942
  "CLEAR": "clear"
1943
1943
  };
1944
1944
 
1945
+ const INITIAL_WATCHER_VALUE = {};
1946
+ const cleanupMap = /* @__PURE__ */ new WeakMap();
1947
+ let activeWatcher = void 0;
1948
+ function getCurrentWatcher() {
1949
+ return activeWatcher;
1950
+ }
1951
+ function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1952
+ if (owner) {
1953
+ let cleanups = cleanupMap.get(owner);
1954
+ if (!cleanups) cleanupMap.set(owner, cleanups = []);
1955
+ cleanups.push(cleanupFn);
1956
+ } else if (!failSilently) {
1957
+ warn$2(
1958
+ `onWatcherCleanup() was called when there was no active watcher to associate with.`
1959
+ );
1960
+ }
1961
+ }
1962
+ function watch$1(source, cb, options = EMPTY_OBJ) {
1963
+ const { immediate, deep, once, scheduler, augmentJob, call } = options;
1964
+ const warnInvalidSource = (s) => {
1965
+ (options.onWarn || warn$2)(
1966
+ `Invalid watch source: `,
1967
+ s,
1968
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1969
+ );
1970
+ };
1971
+ const reactiveGetter = (source2) => {
1972
+ if (deep) return source2;
1973
+ if (isShallow(source2) || deep === false || deep === 0)
1974
+ return traverse(source2, 1);
1975
+ return traverse(source2);
1976
+ };
1977
+ let effect;
1978
+ let getter;
1979
+ let cleanup;
1980
+ let boundCleanup;
1981
+ let forceTrigger = false;
1982
+ let isMultiSource = false;
1983
+ if (isRef(source)) {
1984
+ getter = () => source.value;
1985
+ forceTrigger = isShallow(source);
1986
+ } else if (isReactive(source)) {
1987
+ getter = () => reactiveGetter(source);
1988
+ forceTrigger = true;
1989
+ } else if (isArray(source)) {
1990
+ isMultiSource = true;
1991
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1992
+ getter = () => source.map((s) => {
1993
+ if (isRef(s)) {
1994
+ return s.value;
1995
+ } else if (isReactive(s)) {
1996
+ return reactiveGetter(s);
1997
+ } else if (isFunction(s)) {
1998
+ return call ? call(s, 2) : s();
1999
+ } else {
2000
+ warnInvalidSource(s);
2001
+ }
2002
+ });
2003
+ } else if (isFunction(source)) {
2004
+ if (cb) {
2005
+ getter = call ? () => call(source, 2) : source;
2006
+ } else {
2007
+ getter = () => {
2008
+ if (cleanup) {
2009
+ pauseTracking();
2010
+ try {
2011
+ cleanup();
2012
+ } finally {
2013
+ resetTracking();
2014
+ }
2015
+ }
2016
+ const currentEffect = activeWatcher;
2017
+ activeWatcher = effect;
2018
+ try {
2019
+ return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2020
+ } finally {
2021
+ activeWatcher = currentEffect;
2022
+ }
2023
+ };
2024
+ }
2025
+ } else {
2026
+ getter = NOOP;
2027
+ warnInvalidSource(source);
2028
+ }
2029
+ if (cb && deep) {
2030
+ const baseGetter = getter;
2031
+ const depth = deep === true ? Infinity : deep;
2032
+ getter = () => traverse(baseGetter(), depth);
2033
+ }
2034
+ if (once) {
2035
+ if (cb) {
2036
+ const _cb = cb;
2037
+ cb = (...args) => {
2038
+ _cb(...args);
2039
+ effect.stop();
2040
+ };
2041
+ } else {
2042
+ const _getter = getter;
2043
+ getter = () => {
2044
+ _getter();
2045
+ effect.stop();
2046
+ };
2047
+ }
2048
+ }
2049
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2050
+ const job = (immediateFirstRun) => {
2051
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2052
+ return;
2053
+ }
2054
+ if (cb) {
2055
+ const newValue = effect.run();
2056
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2057
+ if (cleanup) {
2058
+ cleanup();
2059
+ }
2060
+ const currentWatcher = activeWatcher;
2061
+ activeWatcher = effect;
2062
+ try {
2063
+ const args = [
2064
+ newValue,
2065
+ // pass undefined as the old value when it's changed for the first time
2066
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2067
+ boundCleanup
2068
+ ];
2069
+ call ? call(cb, 3, args) : (
2070
+ // @ts-expect-error
2071
+ cb(...args)
2072
+ );
2073
+ oldValue = newValue;
2074
+ } finally {
2075
+ activeWatcher = currentWatcher;
2076
+ }
2077
+ }
2078
+ } else {
2079
+ effect.run();
2080
+ }
2081
+ };
2082
+ if (augmentJob) {
2083
+ augmentJob(job);
2084
+ }
2085
+ effect = new ReactiveEffect(getter);
2086
+ effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2087
+ boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2088
+ cleanup = effect.onStop = () => {
2089
+ const cleanups = cleanupMap.get(effect);
2090
+ if (cleanups) {
2091
+ if (call) {
2092
+ call(cleanups, 4);
2093
+ } else {
2094
+ for (const cleanup2 of cleanups) cleanup2();
2095
+ }
2096
+ cleanupMap.delete(effect);
2097
+ }
2098
+ };
2099
+ {
2100
+ effect.onTrack = options.onTrack;
2101
+ effect.onTrigger = options.onTrigger;
2102
+ }
2103
+ if (cb) {
2104
+ if (immediate) {
2105
+ job(true);
2106
+ } else {
2107
+ oldValue = effect.run();
2108
+ }
2109
+ } else if (scheduler) {
2110
+ scheduler(job.bind(null, true), true);
2111
+ } else {
2112
+ effect.run();
2113
+ }
2114
+ const scope = getCurrentScope();
2115
+ const watchHandle = () => {
2116
+ effect.stop();
2117
+ if (scope) {
2118
+ remove(scope.effects, effect);
2119
+ }
2120
+ };
2121
+ watchHandle.pause = effect.pause.bind(effect);
2122
+ watchHandle.resume = effect.resume.bind(effect);
2123
+ watchHandle.stop = watchHandle;
2124
+ return watchHandle;
2125
+ }
2126
+ function traverse(value, depth = Infinity, seen) {
2127
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2128
+ return value;
2129
+ }
2130
+ seen = seen || /* @__PURE__ */ new Set();
2131
+ if (seen.has(value)) {
2132
+ return value;
2133
+ }
2134
+ seen.add(value);
2135
+ depth--;
2136
+ if (isRef(value)) {
2137
+ traverse(value.value, depth, seen);
2138
+ } else if (isArray(value)) {
2139
+ for (let i = 0; i < value.length; i++) {
2140
+ traverse(value[i], depth, seen);
2141
+ }
2142
+ } else if (isSet(value) || isMap(value)) {
2143
+ value.forEach((v) => {
2144
+ traverse(v, depth, seen);
2145
+ });
2146
+ } else if (isPlainObject(value)) {
2147
+ for (const key in value) {
2148
+ traverse(value[key], depth, seen);
2149
+ }
2150
+ for (const key of Object.getOwnPropertySymbols(value)) {
2151
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2152
+ traverse(value[key], depth, seen);
2153
+ }
2154
+ }
2155
+ }
2156
+ return value;
2157
+ }
2158
+
1945
2159
  const stack = [];
1946
2160
  function pushWarningContext(vnode) {
1947
2161
  stack.push(vnode);
@@ -2069,12 +2283,6 @@ var Vue = (function () {
2069
2283
  "0": "SETUP_FUNCTION",
2070
2284
  "RENDER_FUNCTION": 1,
2071
2285
  "1": "RENDER_FUNCTION",
2072
- "WATCH_GETTER": 2,
2073
- "2": "WATCH_GETTER",
2074
- "WATCH_CALLBACK": 3,
2075
- "3": "WATCH_CALLBACK",
2076
- "WATCH_CLEANUP": 4,
2077
- "4": "WATCH_CLEANUP",
2078
2286
  "NATIVE_EVENT_HANDLER": 5,
2079
2287
  "5": "NATIVE_EVENT_HANDLER",
2080
2288
  "COMPONENT_EVENT_HANDLER": 6,
@@ -2226,7 +2434,7 @@ var Vue = (function () {
2226
2434
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2227
2435
  }
2228
2436
  function findInsertionIndex(id) {
2229
- let start = flushIndex + 1;
2437
+ let start = isFlushing ? flushIndex + 1 : 0;
2230
2438
  let end = queue.length;
2231
2439
  while (start < end) {
2232
2440
  const middle = start + end >>> 1;
@@ -2242,15 +2450,13 @@ var Vue = (function () {
2242
2450
  }
2243
2451
  function queueJob(job) {
2244
2452
  if (!(job.flags & 1)) {
2245
- if (job.id == null) {
2246
- queue.push(job);
2247
- } else if (
2248
- // fast path when the job id is larger than the tail
2249
- !(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
2250
- ) {
2453
+ const jobId = getId(job);
2454
+ const lastJob = queue[queue.length - 1];
2455
+ if (!lastJob || // fast path when the job id is larger than the tail
2456
+ !(job.flags & 2) && jobId >= getId(lastJob)) {
2251
2457
  queue.push(job);
2252
2458
  } else {
2253
- queue.splice(findInsertionIndex(job.id), 0, job);
2459
+ queue.splice(findInsertionIndex(jobId), 0, job);
2254
2460
  }
2255
2461
  if (!(job.flags & 4)) {
2256
2462
  job.flags |= 1;
@@ -2264,12 +2470,6 @@ var Vue = (function () {
2264
2470
  currentFlushPromise = resolvedPromise.then(flushJobs);
2265
2471
  }
2266
2472
  }
2267
- function invalidateJob(job) {
2268
- const i = queue.indexOf(job);
2269
- if (i > flushIndex) {
2270
- queue.splice(i, 1);
2271
- }
2272
- }
2273
2473
  function queuePostFlushCb(cb) {
2274
2474
  if (!isArray(cb)) {
2275
2475
  if (activePostFlushCbs && cb.id === -1) {
@@ -2331,24 +2531,13 @@ var Vue = (function () {
2331
2531
  postFlushIndex = 0;
2332
2532
  }
2333
2533
  }
2334
- const getId = (job) => job.id == null ? Infinity : job.id;
2335
- const comparator = (a, b) => {
2336
- const diff = getId(a) - getId(b);
2337
- if (diff === 0) {
2338
- const isAPre = a.flags & 2;
2339
- const isBPre = b.flags & 2;
2340
- if (isAPre && !isBPre) return -1;
2341
- if (isBPre && !isAPre) return 1;
2342
- }
2343
- return diff;
2344
- };
2534
+ const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2345
2535
  function flushJobs(seen) {
2346
2536
  isFlushPending = false;
2347
2537
  isFlushing = true;
2348
2538
  {
2349
2539
  seen = seen || /* @__PURE__ */ new Map();
2350
2540
  }
2351
- queue.sort(comparator);
2352
2541
  const check = (job) => checkRecursiveUpdates(seen, job) ;
2353
2542
  try {
2354
2543
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
@@ -2989,7 +3178,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2989
3178
  function once(instance, event, fn) {
2990
3179
  const wrapped = (...args) => {
2991
3180
  off(instance, event, wrapped);
2992
- fn.call(instance.proxy, ...args);
3181
+ fn.apply(instance.proxy, args);
2993
3182
  };
2994
3183
  wrapped.fn = fn;
2995
3184
  on(instance, event, wrapped);
@@ -6514,23 +6703,43 @@ If this is a native custom element, make sure to exclude it from component resol
6514
6703
  );
6515
6704
  }
6516
6705
  function createWatcher(raw, ctx, publicThis, key) {
6517
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6706
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6707
+ const options = {};
6708
+ {
6709
+ const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
6710
+ const newValue = getter();
6711
+ if (isArray(newValue) && isCompatEnabled("WATCH_ARRAY", instance)) {
6712
+ options.deep = true;
6713
+ }
6714
+ const baseGetter = getter;
6715
+ getter = () => {
6716
+ const val = baseGetter();
6717
+ if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
6718
+ traverse(val);
6719
+ }
6720
+ return val;
6721
+ };
6722
+ }
6518
6723
  if (isString(raw)) {
6519
6724
  const handler = ctx[raw];
6520
6725
  if (isFunction(handler)) {
6521
- watch(getter, handler);
6726
+ {
6727
+ watch(getter, handler, options);
6728
+ }
6522
6729
  } else {
6523
6730
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
6524
6731
  }
6525
6732
  } else if (isFunction(raw)) {
6526
- watch(getter, raw.bind(publicThis));
6733
+ {
6734
+ watch(getter, raw.bind(publicThis), options);
6735
+ }
6527
6736
  } else if (isObject(raw)) {
6528
6737
  if (isArray(raw)) {
6529
6738
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
6530
6739
  } else {
6531
6740
  const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
6532
6741
  if (isFunction(handler)) {
6533
- watch(getter, handler, raw);
6742
+ watch(getter, handler, extend(raw, options) );
6534
6743
  } else {
6535
6744
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
6536
6745
  }
@@ -6754,7 +6963,7 @@ If this is a native custom element, make sure to exclude it from component resol
6754
6963
  return vm;
6755
6964
  }
6756
6965
  }
6757
- Vue.version = `2.6.14-compat:${"3.5.0-beta.2"}`;
6966
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
6758
6967
  Vue.config = singletonApp.config;
6759
6968
  Vue.use = (plugin, ...options) => {
6760
6969
  if (plugin && isFunction(plugin.install)) {
@@ -7086,7 +7295,7 @@ If this is a native custom element, make sure to exclude it from component resol
7086
7295
  if (isArray(val)) {
7087
7296
  methodsToPatch.forEach((m) => {
7088
7297
  val[m] = (...args) => {
7089
- Array.prototype[m].call(reactiveVal, ...args);
7298
+ Array.prototype[m].apply(reactiveVal, args);
7090
7299
  };
7091
7300
  });
7092
7301
  } else {
@@ -8281,7 +8490,7 @@ If you want to remount the same app, move your app creation logic into a factory
8281
8490
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
8282
8491
  subTree = filterSingleRoot(subTree.children) || subTree;
8283
8492
  }
8284
- if (vnode === subTree) {
8493
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
8285
8494
  const parentVNode = parentComponent.vnode;
8286
8495
  setScopeId(
8287
8496
  el,
@@ -8611,7 +8820,6 @@ If you want to remount the same app, move your app creation logic into a factory
8611
8820
  return;
8612
8821
  } else {
8613
8822
  instance.next = n2;
8614
- invalidateJob(instance.update);
8615
8823
  instance.update();
8616
8824
  }
8617
8825
  } else {
@@ -9529,7 +9737,6 @@ If you want to remount the same app, move your app creation logic into a factory
9529
9737
  extend({}, options, { flush: "sync" })
9530
9738
  );
9531
9739
  }
9532
- const INITIAL_WATCHER_VALUE = {};
9533
9740
  function watch(source, cb, options) {
9534
9741
  if (!isFunction(cb)) {
9535
9742
  warn$1(
@@ -9538,21 +9745,8 @@ If you want to remount the same app, move your app creation logic into a factory
9538
9745
  }
9539
9746
  return doWatch(source, cb, options);
9540
9747
  }
9541
- function doWatch(source, cb, {
9542
- immediate,
9543
- deep,
9544
- flush,
9545
- once,
9546
- onTrack,
9547
- onTrigger
9548
- } = EMPTY_OBJ) {
9549
- if (cb && once) {
9550
- const _cb = cb;
9551
- cb = (...args) => {
9552
- _cb(...args);
9553
- watchHandle();
9554
- };
9555
- }
9748
+ function doWatch(source, cb, options = EMPTY_OBJ) {
9749
+ const { immediate, deep, flush, once } = options;
9556
9750
  if (!cb) {
9557
9751
  if (immediate !== void 0) {
9558
9752
  warn$1(
@@ -9570,149 +9764,38 @@ If you want to remount the same app, move your app creation logic into a factory
9570
9764
  );
9571
9765
  }
9572
9766
  }
9573
- const warnInvalidSource = (s) => {
9574
- warn$1(
9575
- `Invalid watch source: `,
9576
- s,
9577
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
9578
- );
9579
- };
9767
+ const baseWatchOptions = extend({}, options);
9768
+ baseWatchOptions.onWarn = warn$1;
9580
9769
  const instance = currentInstance;
9581
- const reactiveGetter = (source2) => {
9582
- if (deep) return source2;
9583
- if (isShallow(source2) || deep === false || deep === 0)
9584
- return traverse(source2, 1);
9585
- return traverse(source2);
9586
- };
9587
- let getter;
9588
- let forceTrigger = false;
9589
- let isMultiSource = false;
9590
- if (isRef(source)) {
9591
- getter = () => source.value;
9592
- forceTrigger = isShallow(source);
9593
- } else if (isReactive(source)) {
9594
- getter = () => reactiveGetter(source);
9595
- forceTrigger = true;
9596
- } else if (isArray(source)) {
9597
- isMultiSource = true;
9598
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
9599
- getter = () => source.map((s) => {
9600
- if (isRef(s)) {
9601
- return s.value;
9602
- } else if (isReactive(s)) {
9603
- return reactiveGetter(s);
9604
- } else if (isFunction(s)) {
9605
- return callWithErrorHandling(s, instance, 2);
9770
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
9771
+ let isPre = false;
9772
+ if (flush === "post") {
9773
+ baseWatchOptions.scheduler = (job) => {
9774
+ queuePostRenderEffect(job, instance && instance.suspense);
9775
+ };
9776
+ } else if (flush !== "sync") {
9777
+ isPre = true;
9778
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
9779
+ if (isFirstRun) {
9780
+ job();
9606
9781
  } else {
9607
- warnInvalidSource(s);
9608
- }
9609
- });
9610
- } else if (isFunction(source)) {
9611
- if (cb) {
9612
- getter = () => callWithErrorHandling(source, instance, 2);
9613
- } else {
9614
- getter = () => {
9615
- if (cleanup) {
9616
- cleanup();
9617
- }
9618
- return callWithAsyncErrorHandling(
9619
- source,
9620
- instance,
9621
- 3,
9622
- [onCleanup]
9623
- );
9624
- };
9625
- }
9626
- } else {
9627
- getter = NOOP;
9628
- warnInvalidSource(source);
9629
- }
9630
- if (cb && !deep) {
9631
- const baseGetter = getter;
9632
- getter = () => {
9633
- const val = baseGetter();
9634
- if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
9635
- traverse(val);
9782
+ queueJob(job);
9636
9783
  }
9637
- return val;
9638
9784
  };
9639
9785
  }
9640
- if (cb && deep) {
9641
- const baseGetter = getter;
9642
- const depth = deep === true ? Infinity : deep;
9643
- getter = () => traverse(baseGetter(), depth);
9644
- }
9645
- let cleanup;
9646
- let onCleanup = (fn) => {
9647
- cleanup = effect.onStop = () => {
9648
- callWithErrorHandling(fn, instance, 4);
9649
- cleanup = effect.onStop = void 0;
9650
- };
9651
- };
9652
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
9653
- const job = (immediateFirstRun) => {
9654
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
9655
- return;
9656
- }
9786
+ baseWatchOptions.augmentJob = (job) => {
9657
9787
  if (cb) {
9658
- const newValue = effect.run();
9659
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || isArray(newValue) && isCompatEnabled("WATCH_ARRAY", instance)) {
9660
- if (cleanup) {
9661
- cleanup();
9662
- }
9663
- callWithAsyncErrorHandling(cb, instance, 3, [
9664
- newValue,
9665
- // pass undefined as the old value when it's changed for the first time
9666
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
9667
- onCleanup
9668
- ]);
9669
- oldValue = newValue;
9670
- }
9671
- } else {
9672
- effect.run();
9788
+ job.flags |= 4;
9673
9789
  }
9674
- };
9675
- if (cb) job.flags |= 4;
9676
- const effect = new ReactiveEffect(getter);
9677
- let scheduler;
9678
- if (flush === "sync") {
9679
- scheduler = job;
9680
- } else if (flush === "post") {
9681
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
9682
- } else {
9683
- job.flags |= 2;
9684
- if (instance) job.id = instance.uid;
9685
- scheduler = () => queueJob(job);
9686
- }
9687
- effect.scheduler = scheduler;
9688
- const scope = getCurrentScope();
9689
- const watchHandle = () => {
9690
- effect.stop();
9691
- if (scope) {
9692
- remove(scope.effects, effect);
9790
+ if (isPre) {
9791
+ job.flags |= 2;
9792
+ if (instance) {
9793
+ job.id = instance.uid;
9794
+ job.i = instance;
9795
+ }
9693
9796
  }
9694
9797
  };
9695
- watchHandle.pause = effect.pause.bind(effect);
9696
- watchHandle.resume = effect.resume.bind(effect);
9697
- watchHandle.stop = watchHandle;
9698
- {
9699
- effect.onTrack = onTrack;
9700
- effect.onTrigger = onTrigger;
9701
- }
9702
- if (cb) {
9703
- if (immediate) {
9704
- job(true);
9705
- } else {
9706
- oldValue = effect.run();
9707
- }
9708
- } else if (flush === "post") {
9709
- queuePostRenderEffect(
9710
- effect.run.bind(effect),
9711
- instance && instance.suspense
9712
- );
9713
- } else {
9714
- effect.run();
9715
- }
9798
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
9716
9799
  return watchHandle;
9717
9800
  }
9718
9801
  function instanceWatch(source, value, options) {
@@ -9740,38 +9823,6 @@ If you want to remount the same app, move your app creation logic into a factory
9740
9823
  return cur;
9741
9824
  };
9742
9825
  }
9743
- function traverse(value, depth = Infinity, seen) {
9744
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
9745
- return value;
9746
- }
9747
- seen = seen || /* @__PURE__ */ new Set();
9748
- if (seen.has(value)) {
9749
- return value;
9750
- }
9751
- seen.add(value);
9752
- depth--;
9753
- if (isRef(value)) {
9754
- traverse(value.value, depth, seen);
9755
- } else if (isArray(value)) {
9756
- for (let i = 0; i < value.length; i++) {
9757
- traverse(value[i], depth, seen);
9758
- }
9759
- } else if (isSet(value) || isMap(value)) {
9760
- value.forEach((v) => {
9761
- traverse(v, depth, seen);
9762
- });
9763
- } else if (isPlainObject(value)) {
9764
- for (const key in value) {
9765
- traverse(value[key], depth, seen);
9766
- }
9767
- for (const key of Object.getOwnPropertySymbols(value)) {
9768
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
9769
- traverse(value[key], depth, seen);
9770
- }
9771
- }
9772
- }
9773
- return value;
9774
- }
9775
9826
 
9776
9827
  function useModel(props, name, options = EMPTY_OBJ) {
9777
9828
  const i = getCurrentInstance();
@@ -12012,7 +12063,7 @@ Component that was made reactive: `,
12012
12063
  return true;
12013
12064
  }
12014
12065
 
12015
- const version = "3.5.0-beta.2";
12066
+ const version = "3.5.0-beta.3";
12016
12067
  const warn = warn$1 ;
12017
12068
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12018
12069
  const devtools = devtools$1 ;
@@ -13984,6 +14035,7 @@ Expected function or array of functions, received type ${typeof value}.`
13984
14035
  effectScope: effectScope,
13985
14036
  getCurrentInstance: getCurrentInstance,
13986
14037
  getCurrentScope: getCurrentScope,
14038
+ getCurrentWatcher: getCurrentWatcher,
13987
14039
  getTransitionRawChildren: getTransitionRawChildren,
13988
14040
  guardReactiveProps: guardReactiveProps,
13989
14041
  h: h,
@@ -14026,6 +14078,7 @@ Expected function or array of functions, received type ${typeof value}.`
14026
14078
  onServerPrefetch: onServerPrefetch,
14027
14079
  onUnmounted: onUnmounted,
14028
14080
  onUpdated: onUpdated,
14081
+ onWatcherCleanup: onWatcherCleanup,
14029
14082
  openBlock: openBlock,
14030
14083
  popScopeId: popScopeId,
14031
14084
  provide: provide,