@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
  **/
@@ -337,12 +337,13 @@ class EffectScope {
337
337
  pause() {
338
338
  if (this._active) {
339
339
  this._isPaused = true;
340
+ let i, l;
340
341
  if (this.scopes) {
341
- for (let i = 0, l = this.scopes.length; i < l; i++) {
342
+ for (i = 0, l = this.scopes.length; i < l; i++) {
342
343
  this.scopes[i].pause();
343
344
  }
344
345
  }
345
- for (let i = 0, l = this.effects.length; i < l; i++) {
346
+ for (i = 0, l = this.effects.length; i < l; i++) {
346
347
  this.effects[i].pause();
347
348
  }
348
349
  }
@@ -354,12 +355,13 @@ class EffectScope {
354
355
  if (this._active) {
355
356
  if (this._isPaused) {
356
357
  this._isPaused = false;
358
+ let i, l;
357
359
  if (this.scopes) {
358
- for (let i = 0, l = this.scopes.length; i < l; i++) {
360
+ for (i = 0, l = this.scopes.length; i < l; i++) {
359
361
  this.scopes[i].resume();
360
362
  }
361
363
  }
362
- for (let i = 0, l = this.effects.length; i < l; i++) {
364
+ for (i = 0, l = this.effects.length; i < l; i++) {
363
365
  this.effects[i].resume();
364
366
  }
365
367
  }
@@ -552,11 +554,9 @@ function startBatch() {
552
554
  batchDepth++;
553
555
  }
554
556
  function endBatch() {
555
- if (batchDepth > 1) {
556
- batchDepth--;
557
+ if (--batchDepth > 0) {
557
558
  return;
558
559
  }
559
- batchDepth--;
560
560
  let error;
561
561
  while (batchedEffect) {
562
562
  let e = batchedEffect;
@@ -1070,14 +1070,14 @@ function iterator(self, method, wrapValue) {
1070
1070
  const arrayProto = Array.prototype;
1071
1071
  function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1072
1072
  const arr = shallowReadArray(self);
1073
- let methodFn;
1074
- if ((methodFn = arr[method]) !== arrayProto[method]) {
1075
- return methodFn.apply(arr, args);
1073
+ const needsWrap = arr !== self && !isShallow(self);
1074
+ const methodFn = arr[method];
1075
+ if (methodFn !== arrayProto[method]) {
1076
+ const result2 = methodFn.apply(arr, args);
1077
+ return needsWrap ? toReactive(result2) : result2;
1076
1078
  }
1077
- let needsWrap = false;
1078
1079
  let wrappedFn = fn;
1079
1080
  if (arr !== self) {
1080
- needsWrap = !isShallow(self);
1081
1081
  if (needsWrap) {
1082
1082
  wrappedFn = function(item, index) {
1083
1083
  return fn.call(this, toReactive(item), index, self);
@@ -1215,7 +1215,12 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1215
1215
  }
1216
1216
  }
1217
1217
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1218
- const result = Reflect.set(target, key, value, receiver);
1218
+ const result = Reflect.set(
1219
+ target,
1220
+ key,
1221
+ value,
1222
+ isRef(target) ? target : receiver
1223
+ );
1219
1224
  if (target === toRaw(receiver)) {
1220
1225
  if (!hadKey) {
1221
1226
  trigger(target, "add", key, value);
@@ -1939,6 +1944,220 @@ const TriggerOpTypes = {
1939
1944
  "CLEAR": "clear"
1940
1945
  };
1941
1946
 
1947
+ const INITIAL_WATCHER_VALUE = {};
1948
+ const cleanupMap = /* @__PURE__ */ new WeakMap();
1949
+ let activeWatcher = void 0;
1950
+ function getCurrentWatcher() {
1951
+ return activeWatcher;
1952
+ }
1953
+ function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1954
+ if (owner) {
1955
+ let cleanups = cleanupMap.get(owner);
1956
+ if (!cleanups) cleanupMap.set(owner, cleanups = []);
1957
+ cleanups.push(cleanupFn);
1958
+ } else if (!failSilently) {
1959
+ warn$2(
1960
+ `onWatcherCleanup() was called when there was no active watcher to associate with.`
1961
+ );
1962
+ }
1963
+ }
1964
+ function watch$1(source, cb, options = EMPTY_OBJ) {
1965
+ const { immediate, deep, once, scheduler, augmentJob, call } = options;
1966
+ const warnInvalidSource = (s) => {
1967
+ (options.onWarn || warn$2)(
1968
+ `Invalid watch source: `,
1969
+ s,
1970
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1971
+ );
1972
+ };
1973
+ const reactiveGetter = (source2) => {
1974
+ if (deep) return source2;
1975
+ if (isShallow(source2) || deep === false || deep === 0)
1976
+ return traverse(source2, 1);
1977
+ return traverse(source2);
1978
+ };
1979
+ let effect;
1980
+ let getter;
1981
+ let cleanup;
1982
+ let boundCleanup;
1983
+ let forceTrigger = false;
1984
+ let isMultiSource = false;
1985
+ if (isRef(source)) {
1986
+ getter = () => source.value;
1987
+ forceTrigger = isShallow(source);
1988
+ } else if (isReactive(source)) {
1989
+ getter = () => reactiveGetter(source);
1990
+ forceTrigger = true;
1991
+ } else if (isArray(source)) {
1992
+ isMultiSource = true;
1993
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1994
+ getter = () => source.map((s) => {
1995
+ if (isRef(s)) {
1996
+ return s.value;
1997
+ } else if (isReactive(s)) {
1998
+ return reactiveGetter(s);
1999
+ } else if (isFunction(s)) {
2000
+ return call ? call(s, 2) : s();
2001
+ } else {
2002
+ warnInvalidSource(s);
2003
+ }
2004
+ });
2005
+ } else if (isFunction(source)) {
2006
+ if (cb) {
2007
+ getter = call ? () => call(source, 2) : source;
2008
+ } else {
2009
+ getter = () => {
2010
+ if (cleanup) {
2011
+ pauseTracking();
2012
+ try {
2013
+ cleanup();
2014
+ } finally {
2015
+ resetTracking();
2016
+ }
2017
+ }
2018
+ const currentEffect = activeWatcher;
2019
+ activeWatcher = effect;
2020
+ try {
2021
+ return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2022
+ } finally {
2023
+ activeWatcher = currentEffect;
2024
+ }
2025
+ };
2026
+ }
2027
+ } else {
2028
+ getter = NOOP;
2029
+ warnInvalidSource(source);
2030
+ }
2031
+ if (cb && deep) {
2032
+ const baseGetter = getter;
2033
+ const depth = deep === true ? Infinity : deep;
2034
+ getter = () => traverse(baseGetter(), depth);
2035
+ }
2036
+ const scope = getCurrentScope();
2037
+ const watchHandle = () => {
2038
+ effect.stop();
2039
+ if (scope) {
2040
+ remove(scope.effects, effect);
2041
+ }
2042
+ };
2043
+ if (once) {
2044
+ if (cb) {
2045
+ const _cb = cb;
2046
+ cb = (...args) => {
2047
+ _cb(...args);
2048
+ watchHandle();
2049
+ };
2050
+ } else {
2051
+ const _getter = getter;
2052
+ getter = () => {
2053
+ _getter();
2054
+ watchHandle();
2055
+ };
2056
+ }
2057
+ }
2058
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2059
+ const job = (immediateFirstRun) => {
2060
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2061
+ return;
2062
+ }
2063
+ if (cb) {
2064
+ const newValue = effect.run();
2065
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2066
+ if (cleanup) {
2067
+ cleanup();
2068
+ }
2069
+ const currentWatcher = activeWatcher;
2070
+ activeWatcher = effect;
2071
+ try {
2072
+ const args = [
2073
+ newValue,
2074
+ // pass undefined as the old value when it's changed for the first time
2075
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2076
+ boundCleanup
2077
+ ];
2078
+ call ? call(cb, 3, args) : (
2079
+ // @ts-expect-error
2080
+ cb(...args)
2081
+ );
2082
+ oldValue = newValue;
2083
+ } finally {
2084
+ activeWatcher = currentWatcher;
2085
+ }
2086
+ }
2087
+ } else {
2088
+ effect.run();
2089
+ }
2090
+ };
2091
+ if (augmentJob) {
2092
+ augmentJob(job);
2093
+ }
2094
+ effect = new ReactiveEffect(getter);
2095
+ effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2096
+ boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2097
+ cleanup = effect.onStop = () => {
2098
+ const cleanups = cleanupMap.get(effect);
2099
+ if (cleanups) {
2100
+ if (call) {
2101
+ call(cleanups, 4);
2102
+ } else {
2103
+ for (const cleanup2 of cleanups) cleanup2();
2104
+ }
2105
+ cleanupMap.delete(effect);
2106
+ }
2107
+ };
2108
+ {
2109
+ effect.onTrack = options.onTrack;
2110
+ effect.onTrigger = options.onTrigger;
2111
+ }
2112
+ if (cb) {
2113
+ if (immediate) {
2114
+ job(true);
2115
+ } else {
2116
+ oldValue = effect.run();
2117
+ }
2118
+ } else if (scheduler) {
2119
+ scheduler(job.bind(null, true), true);
2120
+ } else {
2121
+ effect.run();
2122
+ }
2123
+ watchHandle.pause = effect.pause.bind(effect);
2124
+ watchHandle.resume = effect.resume.bind(effect);
2125
+ watchHandle.stop = watchHandle;
2126
+ return watchHandle;
2127
+ }
2128
+ function traverse(value, depth = Infinity, seen) {
2129
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2130
+ return value;
2131
+ }
2132
+ seen = seen || /* @__PURE__ */ new Set();
2133
+ if (seen.has(value)) {
2134
+ return value;
2135
+ }
2136
+ seen.add(value);
2137
+ depth--;
2138
+ if (isRef(value)) {
2139
+ traverse(value.value, depth, seen);
2140
+ } else if (isArray(value)) {
2141
+ for (let i = 0; i < value.length; i++) {
2142
+ traverse(value[i], depth, seen);
2143
+ }
2144
+ } else if (isSet(value) || isMap(value)) {
2145
+ value.forEach((v) => {
2146
+ traverse(v, depth, seen);
2147
+ });
2148
+ } else if (isPlainObject(value)) {
2149
+ for (const key in value) {
2150
+ traverse(value[key], depth, seen);
2151
+ }
2152
+ for (const key of Object.getOwnPropertySymbols(value)) {
2153
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2154
+ traverse(value[key], depth, seen);
2155
+ }
2156
+ }
2157
+ }
2158
+ return value;
2159
+ }
2160
+
1942
2161
  const stack = [];
1943
2162
  function pushWarningContext(vnode) {
1944
2163
  stack.push(vnode);
@@ -2066,12 +2285,6 @@ const ErrorCodes = {
2066
2285
  "0": "SETUP_FUNCTION",
2067
2286
  "RENDER_FUNCTION": 1,
2068
2287
  "1": "RENDER_FUNCTION",
2069
- "WATCH_GETTER": 2,
2070
- "2": "WATCH_GETTER",
2071
- "WATCH_CALLBACK": 3,
2072
- "3": "WATCH_CALLBACK",
2073
- "WATCH_CLEANUP": 4,
2074
- "4": "WATCH_CLEANUP",
2075
2288
  "NATIVE_EVENT_HANDLER": 5,
2076
2289
  "5": "NATIVE_EVENT_HANDLER",
2077
2290
  "COMPONENT_EVENT_HANDLER": 6,
@@ -2223,7 +2436,7 @@ function nextTick(fn) {
2223
2436
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2224
2437
  }
2225
2438
  function findInsertionIndex(id) {
2226
- let start = flushIndex + 1;
2439
+ let start = isFlushing ? flushIndex + 1 : 0;
2227
2440
  let end = queue.length;
2228
2441
  while (start < end) {
2229
2442
  const middle = start + end >>> 1;
@@ -2239,15 +2452,13 @@ function findInsertionIndex(id) {
2239
2452
  }
2240
2453
  function queueJob(job) {
2241
2454
  if (!(job.flags & 1)) {
2242
- if (job.id == null) {
2243
- queue.push(job);
2244
- } else if (
2245
- // fast path when the job id is larger than the tail
2246
- !(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
2247
- ) {
2455
+ const jobId = getId(job);
2456
+ const lastJob = queue[queue.length - 1];
2457
+ if (!lastJob || // fast path when the job id is larger than the tail
2458
+ !(job.flags & 2) && jobId >= getId(lastJob)) {
2248
2459
  queue.push(job);
2249
2460
  } else {
2250
- queue.splice(findInsertionIndex(job.id), 0, job);
2461
+ queue.splice(findInsertionIndex(jobId), 0, job);
2251
2462
  }
2252
2463
  if (!(job.flags & 4)) {
2253
2464
  job.flags |= 1;
@@ -2261,12 +2472,6 @@ function queueFlush() {
2261
2472
  currentFlushPromise = resolvedPromise.then(flushJobs);
2262
2473
  }
2263
2474
  }
2264
- function invalidateJob(job) {
2265
- const i = queue.indexOf(job);
2266
- if (i > flushIndex) {
2267
- queue.splice(i, 1);
2268
- }
2269
- }
2270
2475
  function queuePostFlushCb(cb) {
2271
2476
  if (!isArray(cb)) {
2272
2477
  if (activePostFlushCbs && cb.id === -1) {
@@ -2328,24 +2533,13 @@ function flushPostFlushCbs(seen) {
2328
2533
  postFlushIndex = 0;
2329
2534
  }
2330
2535
  }
2331
- const getId = (job) => job.id == null ? Infinity : job.id;
2332
- const comparator = (a, b) => {
2333
- const diff = getId(a) - getId(b);
2334
- if (diff === 0) {
2335
- const isAPre = a.flags & 2;
2336
- const isBPre = b.flags & 2;
2337
- if (isAPre && !isBPre) return -1;
2338
- if (isBPre && !isAPre) return 1;
2339
- }
2340
- return diff;
2341
- };
2536
+ const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2342
2537
  function flushJobs(seen) {
2343
2538
  isFlushPending = false;
2344
2539
  isFlushing = true;
2345
2540
  {
2346
2541
  seen = seen || /* @__PURE__ */ new Map();
2347
2542
  }
2348
- queue.sort(comparator);
2349
2543
  const check = (job) => checkRecursiveUpdates(seen, job) ;
2350
2544
  try {
2351
2545
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
@@ -3374,7 +3568,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3374
3568
  // @__NO_SIDE_EFFECTS__
3375
3569
  function defineComponent(options, extraOptions) {
3376
3570
  return isFunction(options) ? (
3377
- // #8326: extend call and options.name access are considered side-effects
3571
+ // #8236: extend call and options.name access are considered side-effects
3378
3572
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3379
3573
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3380
3574
  ) : options;
@@ -4501,6 +4695,7 @@ const KeepAliveImpl = {
4501
4695
  );
4502
4696
  const { include, exclude, max } = props;
4503
4697
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4698
+ vnode.shapeFlag &= ~256;
4504
4699
  current = vnode;
4505
4700
  return rawVNode;
4506
4701
  }
@@ -5436,16 +5631,20 @@ function callHook$1(hook, instance, type) {
5436
5631
  );
5437
5632
  }
5438
5633
  function createWatcher(raw, ctx, publicThis, key) {
5439
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5634
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5440
5635
  if (isString(raw)) {
5441
5636
  const handler = ctx[raw];
5442
5637
  if (isFunction(handler)) {
5443
- watch(getter, handler);
5638
+ {
5639
+ watch(getter, handler);
5640
+ }
5444
5641
  } else {
5445
5642
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
5446
5643
  }
5447
5644
  } else if (isFunction(raw)) {
5448
- watch(getter, raw.bind(publicThis));
5645
+ {
5646
+ watch(getter, raw.bind(publicThis));
5647
+ }
5449
5648
  } else if (isObject(raw)) {
5450
5649
  if (isArray(raw)) {
5451
5650
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
@@ -6683,7 +6882,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6683
6882
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
6684
6883
  subTree = filterSingleRoot(subTree.children) || subTree;
6685
6884
  }
6686
- if (vnode === subTree) {
6885
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
6687
6886
  const parentVNode = parentComponent.vnode;
6688
6887
  setScopeId(
6689
6888
  el,
@@ -7012,7 +7211,6 @@ function baseCreateRenderer(options, createHydrationFns) {
7012
7211
  return;
7013
7212
  } else {
7014
7213
  instance.next = n2;
7015
- invalidateJob(instance.update);
7016
7214
  instance.update();
7017
7215
  }
7018
7216
  } else {
@@ -7903,7 +8101,6 @@ function watchSyncEffect(effect, options) {
7903
8101
  extend({}, options, { flush: "sync" })
7904
8102
  );
7905
8103
  }
7906
- const INITIAL_WATCHER_VALUE = {};
7907
8104
  function watch(source, cb, options) {
7908
8105
  if (!isFunction(cb)) {
7909
8106
  warn$1(
@@ -7912,21 +8109,8 @@ function watch(source, cb, options) {
7912
8109
  }
7913
8110
  return doWatch(source, cb, options);
7914
8111
  }
7915
- function doWatch(source, cb, {
7916
- immediate,
7917
- deep,
7918
- flush,
7919
- once,
7920
- onTrack,
7921
- onTrigger
7922
- } = EMPTY_OBJ) {
7923
- if (cb && once) {
7924
- const _cb = cb;
7925
- cb = (...args) => {
7926
- _cb(...args);
7927
- watchHandle();
7928
- };
7929
- }
8112
+ function doWatch(source, cb, options = EMPTY_OBJ) {
8113
+ const { immediate, deep, flush, once } = options;
7930
8114
  if (!cb) {
7931
8115
  if (immediate !== void 0) {
7932
8116
  warn$1(
@@ -7944,163 +8128,53 @@ function doWatch(source, cb, {
7944
8128
  );
7945
8129
  }
7946
8130
  }
7947
- const warnInvalidSource = (s) => {
7948
- warn$1(
7949
- `Invalid watch source: `,
7950
- s,
7951
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
7952
- );
7953
- };
7954
- const instance = currentInstance;
7955
- const reactiveGetter = (source2) => {
7956
- if (deep) return source2;
7957
- if (isShallow(source2) || deep === false || deep === 0)
7958
- return traverse(source2, 1);
7959
- return traverse(source2);
7960
- };
7961
- let getter;
7962
- let forceTrigger = false;
7963
- let isMultiSource = false;
7964
- if (isRef(source)) {
7965
- getter = () => source.value;
7966
- forceTrigger = isShallow(source);
7967
- } else if (isReactive(source)) {
7968
- getter = () => reactiveGetter(source);
7969
- forceTrigger = true;
7970
- } else if (isArray(source)) {
7971
- isMultiSource = true;
7972
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
7973
- getter = () => source.map((s) => {
7974
- if (isRef(s)) {
7975
- return s.value;
7976
- } else if (isReactive(s)) {
7977
- return reactiveGetter(s);
7978
- } else if (isFunction(s)) {
7979
- return callWithErrorHandling(s, instance, 2);
7980
- } else {
7981
- warnInvalidSource(s);
7982
- }
7983
- });
7984
- } else if (isFunction(source)) {
7985
- if (cb) {
7986
- getter = () => callWithErrorHandling(source, instance, 2);
7987
- } else {
7988
- getter = () => {
7989
- if (cleanup) {
7990
- cleanup();
7991
- }
7992
- return callWithAsyncErrorHandling(
7993
- source,
7994
- instance,
7995
- 3,
7996
- [onCleanup]
7997
- );
7998
- };
7999
- }
8000
- } else {
8001
- getter = NOOP;
8002
- warnInvalidSource(source);
8003
- }
8004
- if (cb && deep) {
8005
- const baseGetter = getter;
8006
- const depth = deep === true ? Infinity : deep;
8007
- getter = () => traverse(baseGetter(), depth);
8008
- }
8009
- let cleanup;
8010
- let onCleanup = (fn) => {
8011
- cleanup = effect.onStop = () => {
8012
- callWithErrorHandling(fn, instance, 4);
8013
- cleanup = effect.onStop = void 0;
8014
- };
8015
- };
8131
+ const baseWatchOptions = extend({}, options);
8132
+ baseWatchOptions.onWarn = warn$1;
8016
8133
  let ssrCleanup;
8017
8134
  if (isInSSRComponentSetup) {
8018
- onCleanup = NOOP;
8019
- if (!cb) {
8020
- getter();
8021
- } else if (immediate) {
8022
- callWithAsyncErrorHandling(cb, instance, 3, [
8023
- getter(),
8024
- isMultiSource ? [] : void 0,
8025
- onCleanup
8026
- ]);
8027
- }
8028
8135
  if (flush === "sync") {
8029
8136
  const ctx = useSSRContext();
8030
8137
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
8138
+ } else if (!cb || immediate) {
8139
+ baseWatchOptions.once = true;
8031
8140
  } else {
8032
- const watchHandle2 = () => {
8141
+ return {
8142
+ stop: NOOP,
8143
+ resume: NOOP,
8144
+ pause: NOOP
8033
8145
  };
8034
- watchHandle2.stop = NOOP;
8035
- watchHandle2.resume = NOOP;
8036
- watchHandle2.pause = NOOP;
8037
- return watchHandle2;
8038
8146
  }
8039
8147
  }
8040
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
8041
- const job = (immediateFirstRun) => {
8042
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
8043
- return;
8044
- }
8045
- if (cb) {
8046
- const newValue = effect.run();
8047
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
8048
- if (cleanup) {
8049
- cleanup();
8050
- }
8051
- callWithAsyncErrorHandling(cb, instance, 3, [
8052
- newValue,
8053
- // pass undefined as the old value when it's changed for the first time
8054
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
8055
- onCleanup
8056
- ]);
8057
- oldValue = newValue;
8148
+ const instance = currentInstance;
8149
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
8150
+ let isPre = false;
8151
+ if (flush === "post") {
8152
+ baseWatchOptions.scheduler = (job) => {
8153
+ queuePostRenderEffect(job, instance && instance.suspense);
8154
+ };
8155
+ } else if (flush !== "sync") {
8156
+ isPre = true;
8157
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
8158
+ if (isFirstRun) {
8159
+ job();
8160
+ } else {
8161
+ queueJob(job);
8058
8162
  }
8059
- } else {
8060
- effect.run();
8061
- }
8062
- };
8063
- if (cb) job.flags |= 4;
8064
- const effect = new ReactiveEffect(getter);
8065
- let scheduler;
8066
- if (flush === "sync") {
8067
- scheduler = job;
8068
- } else if (flush === "post") {
8069
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
8070
- } else {
8071
- job.flags |= 2;
8072
- if (instance) job.id = instance.uid;
8073
- scheduler = () => queueJob(job);
8163
+ };
8074
8164
  }
8075
- effect.scheduler = scheduler;
8076
- const scope = getCurrentScope();
8077
- const watchHandle = () => {
8078
- effect.stop();
8079
- if (scope) {
8080
- remove(scope.effects, effect);
8165
+ baseWatchOptions.augmentJob = (job) => {
8166
+ if (cb) {
8167
+ job.flags |= 4;
8081
8168
  }
8082
- };
8083
- watchHandle.pause = effect.pause.bind(effect);
8084
- watchHandle.resume = effect.resume.bind(effect);
8085
- watchHandle.stop = watchHandle;
8086
- {
8087
- effect.onTrack = onTrack;
8088
- effect.onTrigger = onTrigger;
8089
- }
8090
- if (cb) {
8091
- if (immediate) {
8092
- job(true);
8093
- } else {
8094
- oldValue = effect.run();
8169
+ if (isPre) {
8170
+ job.flags |= 2;
8171
+ if (instance) {
8172
+ job.id = instance.uid;
8173
+ job.i = instance;
8174
+ }
8095
8175
  }
8096
- } else if (flush === "post") {
8097
- queuePostRenderEffect(
8098
- effect.run.bind(effect),
8099
- instance && instance.suspense
8100
- );
8101
- } else {
8102
- effect.run();
8103
- }
8176
+ };
8177
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
8104
8178
  if (ssrCleanup) ssrCleanup.push(watchHandle);
8105
8179
  return watchHandle;
8106
8180
  }
@@ -8129,38 +8203,6 @@ function createPathGetter(ctx, path) {
8129
8203
  return cur;
8130
8204
  };
8131
8205
  }
8132
- function traverse(value, depth = Infinity, seen) {
8133
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
8134
- return value;
8135
- }
8136
- seen = seen || /* @__PURE__ */ new Set();
8137
- if (seen.has(value)) {
8138
- return value;
8139
- }
8140
- seen.add(value);
8141
- depth--;
8142
- if (isRef(value)) {
8143
- traverse(value.value, depth, seen);
8144
- } else if (isArray(value)) {
8145
- for (let i = 0; i < value.length; i++) {
8146
- traverse(value[i], depth, seen);
8147
- }
8148
- } else if (isSet(value) || isMap(value)) {
8149
- value.forEach((v) => {
8150
- traverse(v, depth, seen);
8151
- });
8152
- } else if (isPlainObject(value)) {
8153
- for (const key in value) {
8154
- traverse(value[key], depth, seen);
8155
- }
8156
- for (const key of Object.getOwnPropertySymbols(value)) {
8157
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
8158
- traverse(value[key], depth, seen);
8159
- }
8160
- }
8161
- }
8162
- return value;
8163
- }
8164
8206
 
8165
8207
  function useModel(props, name, options = EMPTY_OBJ) {
8166
8208
  const i = getCurrentInstance();
@@ -10308,7 +10350,7 @@ function isMemoSame(cached, memo) {
10308
10350
  return true;
10309
10351
  }
10310
10352
 
10311
- const version = "3.5.0-beta.2";
10353
+ const version = "3.5.0-rc.1";
10312
10354
  const warn = warn$1 ;
10313
10355
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10314
10356
  const devtools = devtools$1 ;
@@ -10935,8 +10977,9 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
10935
10977
 
10936
10978
  function patchDOMProp(el, key, value, parentComponent) {
10937
10979
  if (key === "innerHTML" || key === "textContent") {
10938
- if (value == null) return;
10939
- el[key] = value;
10980
+ if (value != null) {
10981
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
10982
+ }
10940
10983
  return;
10941
10984
  }
10942
10985
  const tag = el.tagName;
@@ -11363,6 +11406,9 @@ class VueElement extends BaseClass {
11363
11406
  delete this._props[key];
11364
11407
  } else {
11365
11408
  this._props[key] = val;
11409
+ if (key === "key" && this._app) {
11410
+ this._app._ceVNode.key = val;
11411
+ }
11366
11412
  }
11367
11413
  if (shouldUpdate && this._instance) {
11368
11414
  this._update();
@@ -12147,4 +12193,4 @@ const initDirectivesForSSR = () => {
12147
12193
  }
12148
12194
  } ;
12149
12195
 
12150
- export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
12196
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };