@vue/compat 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/compat v3.5.0-beta.2
2
+ * @vue/compat 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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 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);
@@ -1218,7 +1218,12 @@ var Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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++) {
@@ -2989,7 +3183,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2989
3183
  function once(instance, event, fn) {
2990
3184
  const wrapped = (...args) => {
2991
3185
  off(instance, event, wrapped);
2992
- fn.call(instance.proxy, ...args);
3186
+ fn.apply(instance.proxy, args);
2993
3187
  };
2994
3188
  wrapped.fn = fn;
2995
3189
  on(instance, event, wrapped);
@@ -3908,7 +4102,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3908
4102
  // @__NO_SIDE_EFFECTS__
3909
4103
  function defineComponent(options, extraOptions) {
3910
4104
  return isFunction(options) ? (
3911
- // #8326: extend call and options.name access are considered side-effects
4105
+ // #8236: extend call and options.name access are considered side-effects
3912
4106
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3913
4107
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3914
4108
  ) : options;
@@ -5029,6 +5223,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5029
5223
  );
5030
5224
  const { include, exclude, max } = props;
5031
5225
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5226
+ vnode.shapeFlag &= ~256;
5032
5227
  current = vnode;
5033
5228
  return rawVNode;
5034
5229
  }
@@ -6514,23 +6709,43 @@ If this is a native custom element, make sure to exclude it from component resol
6514
6709
  );
6515
6710
  }
6516
6711
  function createWatcher(raw, ctx, publicThis, key) {
6517
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6712
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6713
+ const options = {};
6714
+ {
6715
+ const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
6716
+ const newValue = getter();
6717
+ if (isArray(newValue) && isCompatEnabled("WATCH_ARRAY", instance)) {
6718
+ options.deep = true;
6719
+ }
6720
+ const baseGetter = getter;
6721
+ getter = () => {
6722
+ const val = baseGetter();
6723
+ if (isArray(val) && checkCompatEnabled("WATCH_ARRAY", instance)) {
6724
+ traverse(val);
6725
+ }
6726
+ return val;
6727
+ };
6728
+ }
6518
6729
  if (isString(raw)) {
6519
6730
  const handler = ctx[raw];
6520
6731
  if (isFunction(handler)) {
6521
- watch(getter, handler);
6732
+ {
6733
+ watch(getter, handler, options);
6734
+ }
6522
6735
  } else {
6523
6736
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
6524
6737
  }
6525
6738
  } else if (isFunction(raw)) {
6526
- watch(getter, raw.bind(publicThis));
6739
+ {
6740
+ watch(getter, raw.bind(publicThis), options);
6741
+ }
6527
6742
  } else if (isObject(raw)) {
6528
6743
  if (isArray(raw)) {
6529
6744
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
6530
6745
  } else {
6531
6746
  const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
6532
6747
  if (isFunction(handler)) {
6533
- watch(getter, handler, raw);
6748
+ watch(getter, handler, extend(raw, options) );
6534
6749
  } else {
6535
6750
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
6536
6751
  }
@@ -6754,7 +6969,7 @@ If this is a native custom element, make sure to exclude it from component resol
6754
6969
  return vm;
6755
6970
  }
6756
6971
  }
6757
- Vue.version = `2.6.14-compat:${"3.5.0-beta.2"}`;
6972
+ Vue.version = `2.6.14-compat:${"3.5.0-rc.1"}`;
6758
6973
  Vue.config = singletonApp.config;
6759
6974
  Vue.use = (plugin, ...options) => {
6760
6975
  if (plugin && isFunction(plugin.install)) {
@@ -7086,7 +7301,7 @@ If this is a native custom element, make sure to exclude it from component resol
7086
7301
  if (isArray(val)) {
7087
7302
  methodsToPatch.forEach((m) => {
7088
7303
  val[m] = (...args) => {
7089
- Array.prototype[m].call(reactiveVal, ...args);
7304
+ Array.prototype[m].apply(reactiveVal, args);
7090
7305
  };
7091
7306
  });
7092
7307
  } else {
@@ -8281,7 +8496,7 @@ If you want to remount the same app, move your app creation logic into a factory
8281
8496
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
8282
8497
  subTree = filterSingleRoot(subTree.children) || subTree;
8283
8498
  }
8284
- if (vnode === subTree) {
8499
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
8285
8500
  const parentVNode = parentComponent.vnode;
8286
8501
  setScopeId(
8287
8502
  el,
@@ -8611,7 +8826,6 @@ If you want to remount the same app, move your app creation logic into a factory
8611
8826
  return;
8612
8827
  } else {
8613
8828
  instance.next = n2;
8614
- invalidateJob(instance.update);
8615
8829
  instance.update();
8616
8830
  }
8617
8831
  } else {
@@ -9529,7 +9743,6 @@ If you want to remount the same app, move your app creation logic into a factory
9529
9743
  extend({}, options, { flush: "sync" })
9530
9744
  );
9531
9745
  }
9532
- const INITIAL_WATCHER_VALUE = {};
9533
9746
  function watch(source, cb, options) {
9534
9747
  if (!isFunction(cb)) {
9535
9748
  warn$1(
@@ -9538,21 +9751,8 @@ If you want to remount the same app, move your app creation logic into a factory
9538
9751
  }
9539
9752
  return doWatch(source, cb, options);
9540
9753
  }
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
- }
9754
+ function doWatch(source, cb, options = EMPTY_OBJ) {
9755
+ const { immediate, deep, flush, once } = options;
9556
9756
  if (!cb) {
9557
9757
  if (immediate !== void 0) {
9558
9758
  warn$1(
@@ -9570,149 +9770,38 @@ If you want to remount the same app, move your app creation logic into a factory
9570
9770
  );
9571
9771
  }
9572
9772
  }
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
- };
9773
+ const baseWatchOptions = extend({}, options);
9774
+ baseWatchOptions.onWarn = warn$1;
9580
9775
  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);
9776
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
9777
+ let isPre = false;
9778
+ if (flush === "post") {
9779
+ baseWatchOptions.scheduler = (job) => {
9780
+ queuePostRenderEffect(job, instance && instance.suspense);
9781
+ };
9782
+ } else if (flush !== "sync") {
9783
+ isPre = true;
9784
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
9785
+ if (isFirstRun) {
9786
+ job();
9606
9787
  } 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);
9788
+ queueJob(job);
9636
9789
  }
9637
- return val;
9638
9790
  };
9639
9791
  }
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
- }
9792
+ baseWatchOptions.augmentJob = (job) => {
9657
9793
  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();
9794
+ job.flags |= 4;
9673
9795
  }
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);
9796
+ if (isPre) {
9797
+ job.flags |= 2;
9798
+ if (instance) {
9799
+ job.id = instance.uid;
9800
+ job.i = instance;
9801
+ }
9693
9802
  }
9694
9803
  };
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
- }
9804
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
9716
9805
  return watchHandle;
9717
9806
  }
9718
9807
  function instanceWatch(source, value, options) {
@@ -9740,38 +9829,6 @@ If you want to remount the same app, move your app creation logic into a factory
9740
9829
  return cur;
9741
9830
  };
9742
9831
  }
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
9832
 
9776
9833
  function useModel(props, name, options = EMPTY_OBJ) {
9777
9834
  const i = getCurrentInstance();
@@ -12012,7 +12069,7 @@ Component that was made reactive: `,
12012
12069
  return true;
12013
12070
  }
12014
12071
 
12015
- const version = "3.5.0-beta.2";
12072
+ const version = "3.5.0-rc.1";
12016
12073
  const warn = warn$1 ;
12017
12074
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12018
12075
  const devtools = devtools$1 ;
@@ -12694,8 +12751,9 @@ Component that was made reactive: `,
12694
12751
 
12695
12752
  function patchDOMProp(el, key, value, parentComponent) {
12696
12753
  if (key === "innerHTML" || key === "textContent") {
12697
- if (value == null) return;
12698
- el[key] = value;
12754
+ if (value != null) {
12755
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
12756
+ }
12699
12757
  return;
12700
12758
  }
12701
12759
  const tag = el.tagName;
@@ -13138,6 +13196,9 @@ Expected function or array of functions, received type ${typeof value}.`
13138
13196
  delete this._props[key];
13139
13197
  } else {
13140
13198
  this._props[key] = val;
13199
+ if (key === "key" && this._app) {
13200
+ this._app._ceVNode.key = val;
13201
+ }
13141
13202
  }
13142
13203
  if (shouldUpdate && this._instance) {
13143
13204
  this._update();
@@ -13984,6 +14045,7 @@ Expected function or array of functions, received type ${typeof value}.`
13984
14045
  effectScope: effectScope,
13985
14046
  getCurrentInstance: getCurrentInstance,
13986
14047
  getCurrentScope: getCurrentScope,
14048
+ getCurrentWatcher: getCurrentWatcher,
13987
14049
  getTransitionRawChildren: getTransitionRawChildren,
13988
14050
  guardReactiveProps: guardReactiveProps,
13989
14051
  h: h,
@@ -14026,6 +14088,7 @@ Expected function or array of functions, received type ${typeof value}.`
14026
14088
  onServerPrefetch: onServerPrefetch,
14027
14089
  onUnmounted: onUnmounted,
14028
14090
  onUpdated: onUpdated,
14091
+ onWatcherCleanup: onWatcherCleanup,
14029
14092
  openBlock: openBlock,
14030
14093
  popScopeId: popScopeId,
14031
14094
  provide: provide,