@vue/runtime-dom 3.5.0-beta.2 → 3.5.0-rc.1

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/runtime-dom v3.5.0-beta.2
2
+ * @vue/runtime-dom v3.5.0-rc.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -340,12 +340,13 @@ var VueRuntimeDOM = (function (exports) {
340
340
  pause() {
341
341
  if (this._active) {
342
342
  this._isPaused = true;
343
+ let i, l;
343
344
  if (this.scopes) {
344
- for (let i = 0, l = this.scopes.length; i < l; i++) {
345
+ for (i = 0, l = this.scopes.length; i < l; i++) {
345
346
  this.scopes[i].pause();
346
347
  }
347
348
  }
348
- for (let i = 0, l = this.effects.length; i < l; i++) {
349
+ for (i = 0, l = this.effects.length; i < l; i++) {
349
350
  this.effects[i].pause();
350
351
  }
351
352
  }
@@ -357,12 +358,13 @@ var VueRuntimeDOM = (function (exports) {
357
358
  if (this._active) {
358
359
  if (this._isPaused) {
359
360
  this._isPaused = false;
361
+ let i, l;
360
362
  if (this.scopes) {
361
- for (let i = 0, l = this.scopes.length; i < l; i++) {
363
+ for (i = 0, l = this.scopes.length; i < l; i++) {
362
364
  this.scopes[i].resume();
363
365
  }
364
366
  }
365
- for (let i = 0, l = this.effects.length; i < l; i++) {
367
+ for (i = 0, l = this.effects.length; i < l; i++) {
366
368
  this.effects[i].resume();
367
369
  }
368
370
  }
@@ -555,11 +557,9 @@ var VueRuntimeDOM = (function (exports) {
555
557
  batchDepth++;
556
558
  }
557
559
  function endBatch() {
558
- if (batchDepth > 1) {
559
- batchDepth--;
560
+ if (--batchDepth > 0) {
560
561
  return;
561
562
  }
562
- batchDepth--;
563
563
  let error;
564
564
  while (batchedEffect) {
565
565
  let e = batchedEffect;
@@ -1073,14 +1073,14 @@ var VueRuntimeDOM = (function (exports) {
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);
@@ -1218,7 +1218,12 @@ var VueRuntimeDOM = (function (exports) {
1218
1218
  }
1219
1219
  }
1220
1220
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1221
- const result = Reflect.set(target, key, value, receiver);
1221
+ const result = Reflect.set(
1222
+ target,
1223
+ key,
1224
+ value,
1225
+ isRef(target) ? target : receiver
1226
+ );
1222
1227
  if (target === toRaw(receiver)) {
1223
1228
  if (!hadKey) {
1224
1229
  trigger(target, "add", key, value);
@@ -1942,6 +1947,220 @@ var VueRuntimeDOM = (function (exports) {
1942
1947
  "CLEAR": "clear"
1943
1948
  };
1944
1949
 
1950
+ const INITIAL_WATCHER_VALUE = {};
1951
+ const cleanupMap = /* @__PURE__ */ new WeakMap();
1952
+ let activeWatcher = void 0;
1953
+ function getCurrentWatcher() {
1954
+ return activeWatcher;
1955
+ }
1956
+ function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1957
+ if (owner) {
1958
+ let cleanups = cleanupMap.get(owner);
1959
+ if (!cleanups) cleanupMap.set(owner, cleanups = []);
1960
+ cleanups.push(cleanupFn);
1961
+ } else if (!failSilently) {
1962
+ warn$2(
1963
+ `onWatcherCleanup() was called when there was no active watcher to associate with.`
1964
+ );
1965
+ }
1966
+ }
1967
+ function watch$1(source, cb, options = EMPTY_OBJ) {
1968
+ const { immediate, deep, once, scheduler, augmentJob, call } = options;
1969
+ const warnInvalidSource = (s) => {
1970
+ (options.onWarn || warn$2)(
1971
+ `Invalid watch source: `,
1972
+ s,
1973
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1974
+ );
1975
+ };
1976
+ const reactiveGetter = (source2) => {
1977
+ if (deep) return source2;
1978
+ if (isShallow(source2) || deep === false || deep === 0)
1979
+ return traverse(source2, 1);
1980
+ return traverse(source2);
1981
+ };
1982
+ let effect;
1983
+ let getter;
1984
+ let cleanup;
1985
+ let boundCleanup;
1986
+ let forceTrigger = false;
1987
+ let isMultiSource = false;
1988
+ if (isRef(source)) {
1989
+ getter = () => source.value;
1990
+ forceTrigger = isShallow(source);
1991
+ } else if (isReactive(source)) {
1992
+ getter = () => reactiveGetter(source);
1993
+ forceTrigger = true;
1994
+ } else if (isArray(source)) {
1995
+ isMultiSource = true;
1996
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1997
+ getter = () => source.map((s) => {
1998
+ if (isRef(s)) {
1999
+ return s.value;
2000
+ } else if (isReactive(s)) {
2001
+ return reactiveGetter(s);
2002
+ } else if (isFunction(s)) {
2003
+ return call ? call(s, 2) : s();
2004
+ } else {
2005
+ warnInvalidSource(s);
2006
+ }
2007
+ });
2008
+ } else if (isFunction(source)) {
2009
+ if (cb) {
2010
+ getter = call ? () => call(source, 2) : source;
2011
+ } else {
2012
+ getter = () => {
2013
+ if (cleanup) {
2014
+ pauseTracking();
2015
+ try {
2016
+ cleanup();
2017
+ } finally {
2018
+ resetTracking();
2019
+ }
2020
+ }
2021
+ const currentEffect = activeWatcher;
2022
+ activeWatcher = effect;
2023
+ try {
2024
+ return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2025
+ } finally {
2026
+ activeWatcher = currentEffect;
2027
+ }
2028
+ };
2029
+ }
2030
+ } else {
2031
+ getter = NOOP;
2032
+ warnInvalidSource(source);
2033
+ }
2034
+ if (cb && deep) {
2035
+ const baseGetter = getter;
2036
+ const depth = deep === true ? Infinity : deep;
2037
+ getter = () => traverse(baseGetter(), depth);
2038
+ }
2039
+ const scope = getCurrentScope();
2040
+ const watchHandle = () => {
2041
+ effect.stop();
2042
+ if (scope) {
2043
+ remove(scope.effects, effect);
2044
+ }
2045
+ };
2046
+ if (once) {
2047
+ if (cb) {
2048
+ const _cb = cb;
2049
+ cb = (...args) => {
2050
+ _cb(...args);
2051
+ watchHandle();
2052
+ };
2053
+ } else {
2054
+ const _getter = getter;
2055
+ getter = () => {
2056
+ _getter();
2057
+ watchHandle();
2058
+ };
2059
+ }
2060
+ }
2061
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2062
+ const job = (immediateFirstRun) => {
2063
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2064
+ return;
2065
+ }
2066
+ if (cb) {
2067
+ const newValue = effect.run();
2068
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2069
+ if (cleanup) {
2070
+ cleanup();
2071
+ }
2072
+ const currentWatcher = activeWatcher;
2073
+ activeWatcher = effect;
2074
+ try {
2075
+ const args = [
2076
+ newValue,
2077
+ // pass undefined as the old value when it's changed for the first time
2078
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2079
+ boundCleanup
2080
+ ];
2081
+ call ? call(cb, 3, args) : (
2082
+ // @ts-expect-error
2083
+ cb(...args)
2084
+ );
2085
+ oldValue = newValue;
2086
+ } finally {
2087
+ activeWatcher = currentWatcher;
2088
+ }
2089
+ }
2090
+ } else {
2091
+ effect.run();
2092
+ }
2093
+ };
2094
+ if (augmentJob) {
2095
+ augmentJob(job);
2096
+ }
2097
+ effect = new ReactiveEffect(getter);
2098
+ effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2099
+ boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2100
+ cleanup = effect.onStop = () => {
2101
+ const cleanups = cleanupMap.get(effect);
2102
+ if (cleanups) {
2103
+ if (call) {
2104
+ call(cleanups, 4);
2105
+ } else {
2106
+ for (const cleanup2 of cleanups) cleanup2();
2107
+ }
2108
+ cleanupMap.delete(effect);
2109
+ }
2110
+ };
2111
+ {
2112
+ effect.onTrack = options.onTrack;
2113
+ effect.onTrigger = options.onTrigger;
2114
+ }
2115
+ if (cb) {
2116
+ if (immediate) {
2117
+ job(true);
2118
+ } else {
2119
+ oldValue = effect.run();
2120
+ }
2121
+ } else if (scheduler) {
2122
+ scheduler(job.bind(null, true), true);
2123
+ } else {
2124
+ effect.run();
2125
+ }
2126
+ watchHandle.pause = effect.pause.bind(effect);
2127
+ watchHandle.resume = effect.resume.bind(effect);
2128
+ watchHandle.stop = watchHandle;
2129
+ return watchHandle;
2130
+ }
2131
+ function traverse(value, depth = Infinity, seen) {
2132
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2133
+ return value;
2134
+ }
2135
+ seen = seen || /* @__PURE__ */ new Set();
2136
+ if (seen.has(value)) {
2137
+ return value;
2138
+ }
2139
+ seen.add(value);
2140
+ depth--;
2141
+ if (isRef(value)) {
2142
+ traverse(value.value, depth, seen);
2143
+ } else if (isArray(value)) {
2144
+ for (let i = 0; i < value.length; i++) {
2145
+ traverse(value[i], depth, seen);
2146
+ }
2147
+ } else if (isSet(value) || isMap(value)) {
2148
+ value.forEach((v) => {
2149
+ traverse(v, depth, seen);
2150
+ });
2151
+ } else if (isPlainObject(value)) {
2152
+ for (const key in value) {
2153
+ traverse(value[key], depth, seen);
2154
+ }
2155
+ for (const key of Object.getOwnPropertySymbols(value)) {
2156
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2157
+ traverse(value[key], depth, seen);
2158
+ }
2159
+ }
2160
+ }
2161
+ return value;
2162
+ }
2163
+
1945
2164
  const stack = [];
1946
2165
  function pushWarningContext(vnode) {
1947
2166
  stack.push(vnode);
@@ -2069,12 +2288,6 @@ var VueRuntimeDOM = (function (exports) {
2069
2288
  "0": "SETUP_FUNCTION",
2070
2289
  "RENDER_FUNCTION": 1,
2071
2290
  "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
2291
  "NATIVE_EVENT_HANDLER": 5,
2079
2292
  "5": "NATIVE_EVENT_HANDLER",
2080
2293
  "COMPONENT_EVENT_HANDLER": 6,
@@ -2226,7 +2439,7 @@ var VueRuntimeDOM = (function (exports) {
2226
2439
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2227
2440
  }
2228
2441
  function findInsertionIndex(id) {
2229
- let start = flushIndex + 1;
2442
+ let start = isFlushing ? flushIndex + 1 : 0;
2230
2443
  let end = queue.length;
2231
2444
  while (start < end) {
2232
2445
  const middle = start + end >>> 1;
@@ -2242,15 +2455,13 @@ var VueRuntimeDOM = (function (exports) {
2242
2455
  }
2243
2456
  function queueJob(job) {
2244
2457
  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
- ) {
2458
+ const jobId = getId(job);
2459
+ const lastJob = queue[queue.length - 1];
2460
+ if (!lastJob || // fast path when the job id is larger than the tail
2461
+ !(job.flags & 2) && jobId >= getId(lastJob)) {
2251
2462
  queue.push(job);
2252
2463
  } else {
2253
- queue.splice(findInsertionIndex(job.id), 0, job);
2464
+ queue.splice(findInsertionIndex(jobId), 0, job);
2254
2465
  }
2255
2466
  if (!(job.flags & 4)) {
2256
2467
  job.flags |= 1;
@@ -2264,12 +2475,6 @@ var VueRuntimeDOM = (function (exports) {
2264
2475
  currentFlushPromise = resolvedPromise.then(flushJobs);
2265
2476
  }
2266
2477
  }
2267
- function invalidateJob(job) {
2268
- const i = queue.indexOf(job);
2269
- if (i > flushIndex) {
2270
- queue.splice(i, 1);
2271
- }
2272
- }
2273
2478
  function queuePostFlushCb(cb) {
2274
2479
  if (!isArray(cb)) {
2275
2480
  if (activePostFlushCbs && cb.id === -1) {
@@ -2331,24 +2536,13 @@ var VueRuntimeDOM = (function (exports) {
2331
2536
  postFlushIndex = 0;
2332
2537
  }
2333
2538
  }
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
- };
2539
+ const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2345
2540
  function flushJobs(seen) {
2346
2541
  isFlushPending = false;
2347
2542
  isFlushing = true;
2348
2543
  {
2349
2544
  seen = seen || /* @__PURE__ */ new Map();
2350
2545
  }
2351
- queue.sort(comparator);
2352
2546
  const check = (job) => checkRecursiveUpdates(seen, job) ;
2353
2547
  try {
2354
2548
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
@@ -3377,7 +3571,7 @@ var VueRuntimeDOM = (function (exports) {
3377
3571
  // @__NO_SIDE_EFFECTS__
3378
3572
  function defineComponent(options, extraOptions) {
3379
3573
  return isFunction(options) ? (
3380
- // #8326: extend call and options.name access are considered side-effects
3574
+ // #8236: extend call and options.name access are considered side-effects
3381
3575
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3382
3576
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3383
3577
  ) : options;
@@ -4498,6 +4692,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4498
4692
  );
4499
4693
  const { include, exclude, max } = props;
4500
4694
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4695
+ vnode.shapeFlag &= ~256;
4501
4696
  current = vnode;
4502
4697
  return rawVNode;
4503
4698
  }
@@ -5430,16 +5625,20 @@ If this is a native custom element, make sure to exclude it from component resol
5430
5625
  );
5431
5626
  }
5432
5627
  function createWatcher(raw, ctx, publicThis, key) {
5433
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5628
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5434
5629
  if (isString(raw)) {
5435
5630
  const handler = ctx[raw];
5436
5631
  if (isFunction(handler)) {
5437
- watch(getter, handler);
5632
+ {
5633
+ watch(getter, handler);
5634
+ }
5438
5635
  } else {
5439
5636
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
5440
5637
  }
5441
5638
  } else if (isFunction(raw)) {
5442
- watch(getter, raw.bind(publicThis));
5639
+ {
5640
+ watch(getter, raw.bind(publicThis));
5641
+ }
5443
5642
  } else if (isObject(raw)) {
5444
5643
  if (isArray(raw)) {
5445
5644
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
@@ -6677,7 +6876,7 @@ If you want to remount the same app, move your app creation logic into a factory
6677
6876
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
6678
6877
  subTree = filterSingleRoot(subTree.children) || subTree;
6679
6878
  }
6680
- if (vnode === subTree) {
6879
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
6681
6880
  const parentVNode = parentComponent.vnode;
6682
6881
  setScopeId(
6683
6882
  el,
@@ -7006,7 +7205,6 @@ If you want to remount the same app, move your app creation logic into a factory
7006
7205
  return;
7007
7206
  } else {
7008
7207
  instance.next = n2;
7009
- invalidateJob(instance.update);
7010
7208
  instance.update();
7011
7209
  }
7012
7210
  } else {
@@ -7891,7 +8089,6 @@ If you want to remount the same app, move your app creation logic into a factory
7891
8089
  extend({}, options, { flush: "sync" })
7892
8090
  );
7893
8091
  }
7894
- const INITIAL_WATCHER_VALUE = {};
7895
8092
  function watch(source, cb, options) {
7896
8093
  if (!isFunction(cb)) {
7897
8094
  warn$1(
@@ -7900,21 +8097,8 @@ If you want to remount the same app, move your app creation logic into a factory
7900
8097
  }
7901
8098
  return doWatch(source, cb, options);
7902
8099
  }
7903
- function doWatch(source, cb, {
7904
- immediate,
7905
- deep,
7906
- flush,
7907
- once,
7908
- onTrack,
7909
- onTrigger
7910
- } = EMPTY_OBJ) {
7911
- if (cb && once) {
7912
- const _cb = cb;
7913
- cb = (...args) => {
7914
- _cb(...args);
7915
- watchHandle();
7916
- };
7917
- }
8100
+ function doWatch(source, cb, options = EMPTY_OBJ) {
8101
+ const { immediate, deep, flush, once } = options;
7918
8102
  if (!cb) {
7919
8103
  if (immediate !== void 0) {
7920
8104
  warn$1(
@@ -7932,139 +8116,38 @@ If you want to remount the same app, move your app creation logic into a factory
7932
8116
  );
7933
8117
  }
7934
8118
  }
7935
- const warnInvalidSource = (s) => {
7936
- warn$1(
7937
- `Invalid watch source: `,
7938
- s,
7939
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
7940
- );
7941
- };
8119
+ const baseWatchOptions = extend({}, options);
8120
+ baseWatchOptions.onWarn = warn$1;
7942
8121
  const instance = currentInstance;
7943
- const reactiveGetter = (source2) => {
7944
- if (deep) return source2;
7945
- if (isShallow(source2) || deep === false || deep === 0)
7946
- return traverse(source2, 1);
7947
- return traverse(source2);
7948
- };
7949
- let getter;
7950
- let forceTrigger = false;
7951
- let isMultiSource = false;
7952
- if (isRef(source)) {
7953
- getter = () => source.value;
7954
- forceTrigger = isShallow(source);
7955
- } else if (isReactive(source)) {
7956
- getter = () => reactiveGetter(source);
7957
- forceTrigger = true;
7958
- } else if (isArray(source)) {
7959
- isMultiSource = true;
7960
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
7961
- getter = () => source.map((s) => {
7962
- if (isRef(s)) {
7963
- return s.value;
7964
- } else if (isReactive(s)) {
7965
- return reactiveGetter(s);
7966
- } else if (isFunction(s)) {
7967
- return callWithErrorHandling(s, instance, 2);
8122
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
8123
+ let isPre = false;
8124
+ if (flush === "post") {
8125
+ baseWatchOptions.scheduler = (job) => {
8126
+ queuePostRenderEffect(job, instance && instance.suspense);
8127
+ };
8128
+ } else if (flush !== "sync") {
8129
+ isPre = true;
8130
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
8131
+ if (isFirstRun) {
8132
+ job();
7968
8133
  } else {
7969
- warnInvalidSource(s);
8134
+ queueJob(job);
7970
8135
  }
7971
- });
7972
- } else if (isFunction(source)) {
7973
- if (cb) {
7974
- getter = () => callWithErrorHandling(source, instance, 2);
7975
- } else {
7976
- getter = () => {
7977
- if (cleanup) {
7978
- cleanup();
7979
- }
7980
- return callWithAsyncErrorHandling(
7981
- source,
7982
- instance,
7983
- 3,
7984
- [onCleanup]
7985
- );
7986
- };
7987
- }
7988
- } else {
7989
- getter = NOOP;
7990
- warnInvalidSource(source);
7991
- }
7992
- if (cb && deep) {
7993
- const baseGetter = getter;
7994
- const depth = deep === true ? Infinity : deep;
7995
- getter = () => traverse(baseGetter(), depth);
7996
- }
7997
- let cleanup;
7998
- let onCleanup = (fn) => {
7999
- cleanup = effect.onStop = () => {
8000
- callWithErrorHandling(fn, instance, 4);
8001
- cleanup = effect.onStop = void 0;
8002
8136
  };
8003
- };
8004
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
8005
- const job = (immediateFirstRun) => {
8006
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
8007
- return;
8008
- }
8137
+ }
8138
+ baseWatchOptions.augmentJob = (job) => {
8009
8139
  if (cb) {
8010
- const newValue = effect.run();
8011
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
8012
- if (cleanup) {
8013
- cleanup();
8014
- }
8015
- callWithAsyncErrorHandling(cb, instance, 3, [
8016
- newValue,
8017
- // pass undefined as the old value when it's changed for the first time
8018
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
8019
- onCleanup
8020
- ]);
8021
- oldValue = newValue;
8022
- }
8023
- } else {
8024
- effect.run();
8140
+ job.flags |= 4;
8025
8141
  }
8026
- };
8027
- if (cb) job.flags |= 4;
8028
- const effect = new ReactiveEffect(getter);
8029
- let scheduler;
8030
- if (flush === "sync") {
8031
- scheduler = job;
8032
- } else if (flush === "post") {
8033
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
8034
- } else {
8035
- job.flags |= 2;
8036
- if (instance) job.id = instance.uid;
8037
- scheduler = () => queueJob(job);
8038
- }
8039
- effect.scheduler = scheduler;
8040
- const scope = getCurrentScope();
8041
- const watchHandle = () => {
8042
- effect.stop();
8043
- if (scope) {
8044
- remove(scope.effects, effect);
8142
+ if (isPre) {
8143
+ job.flags |= 2;
8144
+ if (instance) {
8145
+ job.id = instance.uid;
8146
+ job.i = instance;
8147
+ }
8045
8148
  }
8046
8149
  };
8047
- watchHandle.pause = effect.pause.bind(effect);
8048
- watchHandle.resume = effect.resume.bind(effect);
8049
- watchHandle.stop = watchHandle;
8050
- {
8051
- effect.onTrack = onTrack;
8052
- effect.onTrigger = onTrigger;
8053
- }
8054
- if (cb) {
8055
- if (immediate) {
8056
- job(true);
8057
- } else {
8058
- oldValue = effect.run();
8059
- }
8060
- } else if (flush === "post") {
8061
- queuePostRenderEffect(
8062
- effect.run.bind(effect),
8063
- instance && instance.suspense
8064
- );
8065
- } else {
8066
- effect.run();
8067
- }
8150
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
8068
8151
  return watchHandle;
8069
8152
  }
8070
8153
  function instanceWatch(source, value, options) {
@@ -8092,38 +8175,6 @@ If you want to remount the same app, move your app creation logic into a factory
8092
8175
  return cur;
8093
8176
  };
8094
8177
  }
8095
- function traverse(value, depth = Infinity, seen) {
8096
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
8097
- return value;
8098
- }
8099
- seen = seen || /* @__PURE__ */ new Set();
8100
- if (seen.has(value)) {
8101
- return value;
8102
- }
8103
- seen.add(value);
8104
- depth--;
8105
- if (isRef(value)) {
8106
- traverse(value.value, depth, seen);
8107
- } else if (isArray(value)) {
8108
- for (let i = 0; i < value.length; i++) {
8109
- traverse(value[i], depth, seen);
8110
- }
8111
- } else if (isSet(value) || isMap(value)) {
8112
- value.forEach((v) => {
8113
- traverse(v, depth, seen);
8114
- });
8115
- } else if (isPlainObject(value)) {
8116
- for (const key in value) {
8117
- traverse(value[key], depth, seen);
8118
- }
8119
- for (const key of Object.getOwnPropertySymbols(value)) {
8120
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
8121
- traverse(value[key], depth, seen);
8122
- }
8123
- }
8124
- }
8125
- return value;
8126
- }
8127
8178
 
8128
8179
  function useModel(props, name, options = EMPTY_OBJ) {
8129
8180
  const i = getCurrentInstance();
@@ -10257,7 +10308,7 @@ Component that was made reactive: `,
10257
10308
  return true;
10258
10309
  }
10259
10310
 
10260
- const version = "3.5.0-beta.2";
10311
+ const version = "3.5.0-rc.1";
10261
10312
  const warn = warn$1 ;
10262
10313
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10263
10314
  const devtools = devtools$1 ;
@@ -10867,8 +10918,9 @@ Component that was made reactive: `,
10867
10918
 
10868
10919
  function patchDOMProp(el, key, value, parentComponent) {
10869
10920
  if (key === "innerHTML" || key === "textContent") {
10870
- if (value == null) return;
10871
- el[key] = value;
10921
+ if (value != null) {
10922
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
10923
+ }
10872
10924
  return;
10873
10925
  }
10874
10926
  const tag = el.tagName;
@@ -11295,6 +11347,9 @@ Expected function or array of functions, received type ${typeof value}.`
11295
11347
  delete this._props[key];
11296
11348
  } else {
11297
11349
  this._props[key] = val;
11350
+ if (key === "key" && this._app) {
11351
+ this._app._ceVNode.key = val;
11352
+ }
11298
11353
  }
11299
11354
  if (shouldUpdate && this._instance) {
11300
11355
  this._update();
@@ -12082,6 +12137,7 @@ Expected function or array of functions, received type ${typeof value}.`
12082
12137
  exports.effectScope = effectScope;
12083
12138
  exports.getCurrentInstance = getCurrentInstance;
12084
12139
  exports.getCurrentScope = getCurrentScope;
12140
+ exports.getCurrentWatcher = getCurrentWatcher;
12085
12141
  exports.getTransitionRawChildren = getTransitionRawChildren;
12086
12142
  exports.guardReactiveProps = guardReactiveProps;
12087
12143
  exports.h = h;
@@ -12124,6 +12180,7 @@ Expected function or array of functions, received type ${typeof value}.`
12124
12180
  exports.onServerPrefetch = onServerPrefetch;
12125
12181
  exports.onUnmounted = onUnmounted;
12126
12182
  exports.onUpdated = onUpdated;
12183
+ exports.onWatcherCleanup = onWatcherCleanup;
12127
12184
  exports.openBlock = openBlock;
12128
12185
  exports.popScopeId = popScopeId;
12129
12186
  exports.provide = provide;