@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
  **/
@@ -407,12 +407,13 @@ var Vue = (function () {
407
407
  pause() {
408
408
  if (this._active) {
409
409
  this._isPaused = true;
410
+ let i, l;
410
411
  if (this.scopes) {
411
- for (let i = 0, l = this.scopes.length; i < l; i++) {
412
+ for (i = 0, l = this.scopes.length; i < l; i++) {
412
413
  this.scopes[i].pause();
413
414
  }
414
415
  }
415
- for (let i = 0, l = this.effects.length; i < l; i++) {
416
+ for (i = 0, l = this.effects.length; i < l; i++) {
416
417
  this.effects[i].pause();
417
418
  }
418
419
  }
@@ -424,12 +425,13 @@ var Vue = (function () {
424
425
  if (this._active) {
425
426
  if (this._isPaused) {
426
427
  this._isPaused = false;
428
+ let i, l;
427
429
  if (this.scopes) {
428
- for (let i = 0, l = this.scopes.length; i < l; i++) {
430
+ for (i = 0, l = this.scopes.length; i < l; i++) {
429
431
  this.scopes[i].resume();
430
432
  }
431
433
  }
432
- for (let i = 0, l = this.effects.length; i < l; i++) {
434
+ for (i = 0, l = this.effects.length; i < l; i++) {
433
435
  this.effects[i].resume();
434
436
  }
435
437
  }
@@ -622,11 +624,9 @@ var Vue = (function () {
622
624
  batchDepth++;
623
625
  }
624
626
  function endBatch() {
625
- if (batchDepth > 1) {
626
- batchDepth--;
627
+ if (--batchDepth > 0) {
627
628
  return;
628
629
  }
629
- batchDepth--;
630
630
  let error;
631
631
  while (batchedEffect) {
632
632
  let e = batchedEffect;
@@ -1140,14 +1140,14 @@ var Vue = (function () {
1140
1140
  const arrayProto = Array.prototype;
1141
1141
  function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1142
1142
  const arr = shallowReadArray(self);
1143
- let methodFn;
1144
- if ((methodFn = arr[method]) !== arrayProto[method]) {
1145
- return methodFn.apply(arr, args);
1143
+ const needsWrap = arr !== self && !isShallow(self);
1144
+ const methodFn = arr[method];
1145
+ if (methodFn !== arrayProto[method]) {
1146
+ const result2 = methodFn.apply(arr, args);
1147
+ return needsWrap ? toReactive(result2) : result2;
1146
1148
  }
1147
- let needsWrap = false;
1148
1149
  let wrappedFn = fn;
1149
1150
  if (arr !== self) {
1150
- needsWrap = !isShallow(self);
1151
1151
  if (needsWrap) {
1152
1152
  wrappedFn = function(item, index) {
1153
1153
  return fn.call(this, toReactive(item), index, self);
@@ -1285,7 +1285,12 @@ var Vue = (function () {
1285
1285
  }
1286
1286
  }
1287
1287
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1288
- const result = Reflect.set(target, key, value, receiver);
1288
+ const result = Reflect.set(
1289
+ target,
1290
+ key,
1291
+ value,
1292
+ isRef(target) ? target : receiver
1293
+ );
1289
1294
  if (target === toRaw(receiver)) {
1290
1295
  if (!hadKey) {
1291
1296
  trigger(target, "add", key, value);
@@ -2009,6 +2014,220 @@ var Vue = (function () {
2009
2014
  "CLEAR": "clear"
2010
2015
  };
2011
2016
 
2017
+ const INITIAL_WATCHER_VALUE = {};
2018
+ const cleanupMap = /* @__PURE__ */ new WeakMap();
2019
+ let activeWatcher = void 0;
2020
+ function getCurrentWatcher() {
2021
+ return activeWatcher;
2022
+ }
2023
+ function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
2024
+ if (owner) {
2025
+ let cleanups = cleanupMap.get(owner);
2026
+ if (!cleanups) cleanupMap.set(owner, cleanups = []);
2027
+ cleanups.push(cleanupFn);
2028
+ } else if (!failSilently) {
2029
+ warn$2(
2030
+ `onWatcherCleanup() was called when there was no active watcher to associate with.`
2031
+ );
2032
+ }
2033
+ }
2034
+ function watch$1(source, cb, options = EMPTY_OBJ) {
2035
+ const { immediate, deep, once, scheduler, augmentJob, call } = options;
2036
+ const warnInvalidSource = (s) => {
2037
+ (options.onWarn || warn$2)(
2038
+ `Invalid watch source: `,
2039
+ s,
2040
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2041
+ );
2042
+ };
2043
+ const reactiveGetter = (source2) => {
2044
+ if (deep) return source2;
2045
+ if (isShallow(source2) || deep === false || deep === 0)
2046
+ return traverse(source2, 1);
2047
+ return traverse(source2);
2048
+ };
2049
+ let effect;
2050
+ let getter;
2051
+ let cleanup;
2052
+ let boundCleanup;
2053
+ let forceTrigger = false;
2054
+ let isMultiSource = false;
2055
+ if (isRef(source)) {
2056
+ getter = () => source.value;
2057
+ forceTrigger = isShallow(source);
2058
+ } else if (isReactive(source)) {
2059
+ getter = () => reactiveGetter(source);
2060
+ forceTrigger = true;
2061
+ } else if (isArray(source)) {
2062
+ isMultiSource = true;
2063
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2064
+ getter = () => source.map((s) => {
2065
+ if (isRef(s)) {
2066
+ return s.value;
2067
+ } else if (isReactive(s)) {
2068
+ return reactiveGetter(s);
2069
+ } else if (isFunction(s)) {
2070
+ return call ? call(s, 2) : s();
2071
+ } else {
2072
+ warnInvalidSource(s);
2073
+ }
2074
+ });
2075
+ } else if (isFunction(source)) {
2076
+ if (cb) {
2077
+ getter = call ? () => call(source, 2) : source;
2078
+ } else {
2079
+ getter = () => {
2080
+ if (cleanup) {
2081
+ pauseTracking();
2082
+ try {
2083
+ cleanup();
2084
+ } finally {
2085
+ resetTracking();
2086
+ }
2087
+ }
2088
+ const currentEffect = activeWatcher;
2089
+ activeWatcher = effect;
2090
+ try {
2091
+ return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2092
+ } finally {
2093
+ activeWatcher = currentEffect;
2094
+ }
2095
+ };
2096
+ }
2097
+ } else {
2098
+ getter = NOOP;
2099
+ warnInvalidSource(source);
2100
+ }
2101
+ if (cb && deep) {
2102
+ const baseGetter = getter;
2103
+ const depth = deep === true ? Infinity : deep;
2104
+ getter = () => traverse(baseGetter(), depth);
2105
+ }
2106
+ const scope = getCurrentScope();
2107
+ const watchHandle = () => {
2108
+ effect.stop();
2109
+ if (scope) {
2110
+ remove(scope.effects, effect);
2111
+ }
2112
+ };
2113
+ if (once) {
2114
+ if (cb) {
2115
+ const _cb = cb;
2116
+ cb = (...args) => {
2117
+ _cb(...args);
2118
+ watchHandle();
2119
+ };
2120
+ } else {
2121
+ const _getter = getter;
2122
+ getter = () => {
2123
+ _getter();
2124
+ watchHandle();
2125
+ };
2126
+ }
2127
+ }
2128
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2129
+ const job = (immediateFirstRun) => {
2130
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2131
+ return;
2132
+ }
2133
+ if (cb) {
2134
+ const newValue = effect.run();
2135
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2136
+ if (cleanup) {
2137
+ cleanup();
2138
+ }
2139
+ const currentWatcher = activeWatcher;
2140
+ activeWatcher = effect;
2141
+ try {
2142
+ const args = [
2143
+ newValue,
2144
+ // pass undefined as the old value when it's changed for the first time
2145
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2146
+ boundCleanup
2147
+ ];
2148
+ call ? call(cb, 3, args) : (
2149
+ // @ts-expect-error
2150
+ cb(...args)
2151
+ );
2152
+ oldValue = newValue;
2153
+ } finally {
2154
+ activeWatcher = currentWatcher;
2155
+ }
2156
+ }
2157
+ } else {
2158
+ effect.run();
2159
+ }
2160
+ };
2161
+ if (augmentJob) {
2162
+ augmentJob(job);
2163
+ }
2164
+ effect = new ReactiveEffect(getter);
2165
+ effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2166
+ boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2167
+ cleanup = effect.onStop = () => {
2168
+ const cleanups = cleanupMap.get(effect);
2169
+ if (cleanups) {
2170
+ if (call) {
2171
+ call(cleanups, 4);
2172
+ } else {
2173
+ for (const cleanup2 of cleanups) cleanup2();
2174
+ }
2175
+ cleanupMap.delete(effect);
2176
+ }
2177
+ };
2178
+ {
2179
+ effect.onTrack = options.onTrack;
2180
+ effect.onTrigger = options.onTrigger;
2181
+ }
2182
+ if (cb) {
2183
+ if (immediate) {
2184
+ job(true);
2185
+ } else {
2186
+ oldValue = effect.run();
2187
+ }
2188
+ } else if (scheduler) {
2189
+ scheduler(job.bind(null, true), true);
2190
+ } else {
2191
+ effect.run();
2192
+ }
2193
+ watchHandle.pause = effect.pause.bind(effect);
2194
+ watchHandle.resume = effect.resume.bind(effect);
2195
+ watchHandle.stop = watchHandle;
2196
+ return watchHandle;
2197
+ }
2198
+ function traverse(value, depth = Infinity, seen) {
2199
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2200
+ return value;
2201
+ }
2202
+ seen = seen || /* @__PURE__ */ new Set();
2203
+ if (seen.has(value)) {
2204
+ return value;
2205
+ }
2206
+ seen.add(value);
2207
+ depth--;
2208
+ if (isRef(value)) {
2209
+ traverse(value.value, depth, seen);
2210
+ } else if (isArray(value)) {
2211
+ for (let i = 0; i < value.length; i++) {
2212
+ traverse(value[i], depth, seen);
2213
+ }
2214
+ } else if (isSet(value) || isMap(value)) {
2215
+ value.forEach((v) => {
2216
+ traverse(v, depth, seen);
2217
+ });
2218
+ } else if (isPlainObject(value)) {
2219
+ for (const key in value) {
2220
+ traverse(value[key], depth, seen);
2221
+ }
2222
+ for (const key of Object.getOwnPropertySymbols(value)) {
2223
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2224
+ traverse(value[key], depth, seen);
2225
+ }
2226
+ }
2227
+ }
2228
+ return value;
2229
+ }
2230
+
2012
2231
  const stack$1 = [];
2013
2232
  function pushWarningContext(vnode) {
2014
2233
  stack$1.push(vnode);
@@ -2136,12 +2355,6 @@ var Vue = (function () {
2136
2355
  "0": "SETUP_FUNCTION",
2137
2356
  "RENDER_FUNCTION": 1,
2138
2357
  "1": "RENDER_FUNCTION",
2139
- "WATCH_GETTER": 2,
2140
- "2": "WATCH_GETTER",
2141
- "WATCH_CALLBACK": 3,
2142
- "3": "WATCH_CALLBACK",
2143
- "WATCH_CLEANUP": 4,
2144
- "4": "WATCH_CLEANUP",
2145
2358
  "NATIVE_EVENT_HANDLER": 5,
2146
2359
  "5": "NATIVE_EVENT_HANDLER",
2147
2360
  "COMPONENT_EVENT_HANDLER": 6,
@@ -2293,7 +2506,7 @@ var Vue = (function () {
2293
2506
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2294
2507
  }
2295
2508
  function findInsertionIndex(id) {
2296
- let start = flushIndex + 1;
2509
+ let start = isFlushing ? flushIndex + 1 : 0;
2297
2510
  let end = queue.length;
2298
2511
  while (start < end) {
2299
2512
  const middle = start + end >>> 1;
@@ -2309,15 +2522,13 @@ var Vue = (function () {
2309
2522
  }
2310
2523
  function queueJob(job) {
2311
2524
  if (!(job.flags & 1)) {
2312
- if (job.id == null) {
2313
- queue.push(job);
2314
- } else if (
2315
- // fast path when the job id is larger than the tail
2316
- !(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
2317
- ) {
2525
+ const jobId = getId(job);
2526
+ const lastJob = queue[queue.length - 1];
2527
+ if (!lastJob || // fast path when the job id is larger than the tail
2528
+ !(job.flags & 2) && jobId >= getId(lastJob)) {
2318
2529
  queue.push(job);
2319
2530
  } else {
2320
- queue.splice(findInsertionIndex(job.id), 0, job);
2531
+ queue.splice(findInsertionIndex(jobId), 0, job);
2321
2532
  }
2322
2533
  if (!(job.flags & 4)) {
2323
2534
  job.flags |= 1;
@@ -2331,12 +2542,6 @@ var Vue = (function () {
2331
2542
  currentFlushPromise = resolvedPromise.then(flushJobs);
2332
2543
  }
2333
2544
  }
2334
- function invalidateJob(job) {
2335
- const i = queue.indexOf(job);
2336
- if (i > flushIndex) {
2337
- queue.splice(i, 1);
2338
- }
2339
- }
2340
2545
  function queuePostFlushCb(cb) {
2341
2546
  if (!isArray(cb)) {
2342
2547
  if (activePostFlushCbs && cb.id === -1) {
@@ -2398,24 +2603,13 @@ var Vue = (function () {
2398
2603
  postFlushIndex = 0;
2399
2604
  }
2400
2605
  }
2401
- const getId = (job) => job.id == null ? Infinity : job.id;
2402
- const comparator = (a, b) => {
2403
- const diff = getId(a) - getId(b);
2404
- if (diff === 0) {
2405
- const isAPre = a.flags & 2;
2406
- const isBPre = b.flags & 2;
2407
- if (isAPre && !isBPre) return -1;
2408
- if (isBPre && !isAPre) return 1;
2409
- }
2410
- return diff;
2411
- };
2606
+ const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2412
2607
  function flushJobs(seen) {
2413
2608
  isFlushPending = false;
2414
2609
  isFlushing = true;
2415
2610
  {
2416
2611
  seen = seen || /* @__PURE__ */ new Map();
2417
2612
  }
2418
- queue.sort(comparator);
2419
2613
  const check = (job) => checkRecursiveUpdates(seen, job) ;
2420
2614
  try {
2421
2615
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
@@ -3056,7 +3250,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3056
3250
  function once(instance, event, fn) {
3057
3251
  const wrapped = (...args) => {
3058
3252
  off(instance, event, wrapped);
3059
- fn.call(instance.proxy, ...args);
3253
+ fn.apply(instance.proxy, args);
3060
3254
  };
3061
3255
  wrapped.fn = fn;
3062
3256
  on(instance, event, wrapped);
@@ -3975,7 +4169,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3975
4169
  // @__NO_SIDE_EFFECTS__
3976
4170
  function defineComponent(options, extraOptions) {
3977
4171
  return isFunction(options) ? (
3978
- // #8326: extend call and options.name access are considered side-effects
4172
+ // #8236: extend call and options.name access are considered side-effects
3979
4173
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3980
4174
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3981
4175
  ) : options;
@@ -5096,6 +5290,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5096
5290
  );
5097
5291
  const { include, exclude, max } = props;
5098
5292
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5293
+ vnode.shapeFlag &= ~256;
5099
5294
  current = vnode;
5100
5295
  return rawVNode;
5101
5296
  }
@@ -6581,23 +6776,43 @@ If this is a native custom element, make sure to exclude it from component resol
6581
6776
  );
6582
6777
  }
6583
6778
  function createWatcher(raw, ctx, publicThis, key) {
6584
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6779
+ let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
6780
+ const options = {};
6781
+ {
6782
+ const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
6783
+ const newValue = getter();
6784
+ if (isArray(newValue) && isCompatEnabled$1("WATCH_ARRAY", instance)) {
6785
+ options.deep = true;
6786
+ }
6787
+ const baseGetter = getter;
6788
+ getter = () => {
6789
+ const val = baseGetter();
6790
+ if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
6791
+ traverse(val);
6792
+ }
6793
+ return val;
6794
+ };
6795
+ }
6585
6796
  if (isString(raw)) {
6586
6797
  const handler = ctx[raw];
6587
6798
  if (isFunction(handler)) {
6588
- watch(getter, handler);
6799
+ {
6800
+ watch(getter, handler, options);
6801
+ }
6589
6802
  } else {
6590
6803
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
6591
6804
  }
6592
6805
  } else if (isFunction(raw)) {
6593
- watch(getter, raw.bind(publicThis));
6806
+ {
6807
+ watch(getter, raw.bind(publicThis), options);
6808
+ }
6594
6809
  } else if (isObject(raw)) {
6595
6810
  if (isArray(raw)) {
6596
6811
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
6597
6812
  } else {
6598
6813
  const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
6599
6814
  if (isFunction(handler)) {
6600
- watch(getter, handler, raw);
6815
+ watch(getter, handler, extend(raw, options) );
6601
6816
  } else {
6602
6817
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
6603
6818
  }
@@ -6821,7 +7036,7 @@ If this is a native custom element, make sure to exclude it from component resol
6821
7036
  return vm;
6822
7037
  }
6823
7038
  }
6824
- Vue.version = `2.6.14-compat:${"3.5.0-beta.2"}`;
7039
+ Vue.version = `2.6.14-compat:${"3.5.0-rc.1"}`;
6825
7040
  Vue.config = singletonApp.config;
6826
7041
  Vue.use = (plugin, ...options) => {
6827
7042
  if (plugin && isFunction(plugin.install)) {
@@ -7153,7 +7368,7 @@ If this is a native custom element, make sure to exclude it from component resol
7153
7368
  if (isArray(val)) {
7154
7369
  methodsToPatch.forEach((m) => {
7155
7370
  val[m] = (...args) => {
7156
- Array.prototype[m].call(reactiveVal, ...args);
7371
+ Array.prototype[m].apply(reactiveVal, args);
7157
7372
  };
7158
7373
  });
7159
7374
  } else {
@@ -8348,7 +8563,7 @@ If you want to remount the same app, move your app creation logic into a factory
8348
8563
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
8349
8564
  subTree = filterSingleRoot(subTree.children) || subTree;
8350
8565
  }
8351
- if (vnode === subTree) {
8566
+ if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
8352
8567
  const parentVNode = parentComponent.vnode;
8353
8568
  setScopeId(
8354
8569
  el,
@@ -8678,7 +8893,6 @@ If you want to remount the same app, move your app creation logic into a factory
8678
8893
  return;
8679
8894
  } else {
8680
8895
  instance.next = n2;
8681
- invalidateJob(instance.update);
8682
8896
  instance.update();
8683
8897
  }
8684
8898
  } else {
@@ -9596,7 +9810,6 @@ If you want to remount the same app, move your app creation logic into a factory
9596
9810
  extend({}, options, { flush: "sync" })
9597
9811
  );
9598
9812
  }
9599
- const INITIAL_WATCHER_VALUE = {};
9600
9813
  function watch(source, cb, options) {
9601
9814
  if (!isFunction(cb)) {
9602
9815
  warn$1(
@@ -9605,21 +9818,8 @@ If you want to remount the same app, move your app creation logic into a factory
9605
9818
  }
9606
9819
  return doWatch(source, cb, options);
9607
9820
  }
9608
- function doWatch(source, cb, {
9609
- immediate,
9610
- deep,
9611
- flush,
9612
- once,
9613
- onTrack,
9614
- onTrigger
9615
- } = EMPTY_OBJ) {
9616
- if (cb && once) {
9617
- const _cb = cb;
9618
- cb = (...args) => {
9619
- _cb(...args);
9620
- watchHandle();
9621
- };
9622
- }
9821
+ function doWatch(source, cb, options = EMPTY_OBJ) {
9822
+ const { immediate, deep, flush, once } = options;
9623
9823
  if (!cb) {
9624
9824
  if (immediate !== void 0) {
9625
9825
  warn$1(
@@ -9637,149 +9837,38 @@ If you want to remount the same app, move your app creation logic into a factory
9637
9837
  );
9638
9838
  }
9639
9839
  }
9640
- const warnInvalidSource = (s) => {
9641
- warn$1(
9642
- `Invalid watch source: `,
9643
- s,
9644
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
9645
- );
9646
- };
9840
+ const baseWatchOptions = extend({}, options);
9841
+ baseWatchOptions.onWarn = warn$1;
9647
9842
  const instance = currentInstance;
9648
- const reactiveGetter = (source2) => {
9649
- if (deep) return source2;
9650
- if (isShallow(source2) || deep === false || deep === 0)
9651
- return traverse(source2, 1);
9652
- return traverse(source2);
9653
- };
9654
- let getter;
9655
- let forceTrigger = false;
9656
- let isMultiSource = false;
9657
- if (isRef(source)) {
9658
- getter = () => source.value;
9659
- forceTrigger = isShallow(source);
9660
- } else if (isReactive(source)) {
9661
- getter = () => reactiveGetter(source);
9662
- forceTrigger = true;
9663
- } else if (isArray(source)) {
9664
- isMultiSource = true;
9665
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
9666
- getter = () => source.map((s) => {
9667
- if (isRef(s)) {
9668
- return s.value;
9669
- } else if (isReactive(s)) {
9670
- return reactiveGetter(s);
9671
- } else if (isFunction(s)) {
9672
- return callWithErrorHandling(s, instance, 2);
9843
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
9844
+ let isPre = false;
9845
+ if (flush === "post") {
9846
+ baseWatchOptions.scheduler = (job) => {
9847
+ queuePostRenderEffect(job, instance && instance.suspense);
9848
+ };
9849
+ } else if (flush !== "sync") {
9850
+ isPre = true;
9851
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
9852
+ if (isFirstRun) {
9853
+ job();
9673
9854
  } else {
9674
- warnInvalidSource(s);
9675
- }
9676
- });
9677
- } else if (isFunction(source)) {
9678
- if (cb) {
9679
- getter = () => callWithErrorHandling(source, instance, 2);
9680
- } else {
9681
- getter = () => {
9682
- if (cleanup) {
9683
- cleanup();
9684
- }
9685
- return callWithAsyncErrorHandling(
9686
- source,
9687
- instance,
9688
- 3,
9689
- [onCleanup]
9690
- );
9691
- };
9692
- }
9693
- } else {
9694
- getter = NOOP;
9695
- warnInvalidSource(source);
9696
- }
9697
- if (cb && !deep) {
9698
- const baseGetter = getter;
9699
- getter = () => {
9700
- const val = baseGetter();
9701
- if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
9702
- traverse(val);
9855
+ queueJob(job);
9703
9856
  }
9704
- return val;
9705
9857
  };
9706
9858
  }
9707
- if (cb && deep) {
9708
- const baseGetter = getter;
9709
- const depth = deep === true ? Infinity : deep;
9710
- getter = () => traverse(baseGetter(), depth);
9711
- }
9712
- let cleanup;
9713
- let onCleanup = (fn) => {
9714
- cleanup = effect.onStop = () => {
9715
- callWithErrorHandling(fn, instance, 4);
9716
- cleanup = effect.onStop = void 0;
9717
- };
9718
- };
9719
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
9720
- const job = (immediateFirstRun) => {
9721
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
9722
- return;
9723
- }
9859
+ baseWatchOptions.augmentJob = (job) => {
9724
9860
  if (cb) {
9725
- const newValue = effect.run();
9726
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || isArray(newValue) && isCompatEnabled$1("WATCH_ARRAY", instance)) {
9727
- if (cleanup) {
9728
- cleanup();
9729
- }
9730
- callWithAsyncErrorHandling(cb, instance, 3, [
9731
- newValue,
9732
- // pass undefined as the old value when it's changed for the first time
9733
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
9734
- onCleanup
9735
- ]);
9736
- oldValue = newValue;
9737
- }
9738
- } else {
9739
- effect.run();
9861
+ job.flags |= 4;
9740
9862
  }
9741
- };
9742
- if (cb) job.flags |= 4;
9743
- const effect = new ReactiveEffect(getter);
9744
- let scheduler;
9745
- if (flush === "sync") {
9746
- scheduler = job;
9747
- } else if (flush === "post") {
9748
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
9749
- } else {
9750
- job.flags |= 2;
9751
- if (instance) job.id = instance.uid;
9752
- scheduler = () => queueJob(job);
9753
- }
9754
- effect.scheduler = scheduler;
9755
- const scope = getCurrentScope();
9756
- const watchHandle = () => {
9757
- effect.stop();
9758
- if (scope) {
9759
- remove(scope.effects, effect);
9863
+ if (isPre) {
9864
+ job.flags |= 2;
9865
+ if (instance) {
9866
+ job.id = instance.uid;
9867
+ job.i = instance;
9868
+ }
9760
9869
  }
9761
9870
  };
9762
- watchHandle.pause = effect.pause.bind(effect);
9763
- watchHandle.resume = effect.resume.bind(effect);
9764
- watchHandle.stop = watchHandle;
9765
- {
9766
- effect.onTrack = onTrack;
9767
- effect.onTrigger = onTrigger;
9768
- }
9769
- if (cb) {
9770
- if (immediate) {
9771
- job(true);
9772
- } else {
9773
- oldValue = effect.run();
9774
- }
9775
- } else if (flush === "post") {
9776
- queuePostRenderEffect(
9777
- effect.run.bind(effect),
9778
- instance && instance.suspense
9779
- );
9780
- } else {
9781
- effect.run();
9782
- }
9871
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
9783
9872
  return watchHandle;
9784
9873
  }
9785
9874
  function instanceWatch(source, value, options) {
@@ -9807,38 +9896,6 @@ If you want to remount the same app, move your app creation logic into a factory
9807
9896
  return cur;
9808
9897
  };
9809
9898
  }
9810
- function traverse(value, depth = Infinity, seen) {
9811
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
9812
- return value;
9813
- }
9814
- seen = seen || /* @__PURE__ */ new Set();
9815
- if (seen.has(value)) {
9816
- return value;
9817
- }
9818
- seen.add(value);
9819
- depth--;
9820
- if (isRef(value)) {
9821
- traverse(value.value, depth, seen);
9822
- } else if (isArray(value)) {
9823
- for (let i = 0; i < value.length; i++) {
9824
- traverse(value[i], depth, seen);
9825
- }
9826
- } else if (isSet(value) || isMap(value)) {
9827
- value.forEach((v) => {
9828
- traverse(v, depth, seen);
9829
- });
9830
- } else if (isPlainObject(value)) {
9831
- for (const key in value) {
9832
- traverse(value[key], depth, seen);
9833
- }
9834
- for (const key of Object.getOwnPropertySymbols(value)) {
9835
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
9836
- traverse(value[key], depth, seen);
9837
- }
9838
- }
9839
- }
9840
- return value;
9841
- }
9842
9899
 
9843
9900
  function useModel(props, name, options = EMPTY_OBJ) {
9844
9901
  const i = getCurrentInstance();
@@ -12079,7 +12136,7 @@ Component that was made reactive: `,
12079
12136
  return true;
12080
12137
  }
12081
12138
 
12082
- const version = "3.5.0-beta.2";
12139
+ const version = "3.5.0-rc.1";
12083
12140
  const warn = warn$1 ;
12084
12141
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12085
12142
  const devtools = devtools$1 ;
@@ -12761,8 +12818,9 @@ Component that was made reactive: `,
12761
12818
 
12762
12819
  function patchDOMProp(el, key, value, parentComponent) {
12763
12820
  if (key === "innerHTML" || key === "textContent") {
12764
- if (value == null) return;
12765
- el[key] = value;
12821
+ if (value != null) {
12822
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
12823
+ }
12766
12824
  return;
12767
12825
  }
12768
12826
  const tag = el.tagName;
@@ -13205,6 +13263,9 @@ Expected function or array of functions, received type ${typeof value}.`
13205
13263
  delete this._props[key];
13206
13264
  } else {
13207
13265
  this._props[key] = val;
13266
+ if (key === "key" && this._app) {
13267
+ this._app._ceVNode.key = val;
13268
+ }
13208
13269
  }
13209
13270
  if (shouldUpdate && this._instance) {
13210
13271
  this._update();
@@ -14051,6 +14112,7 @@ Expected function or array of functions, received type ${typeof value}.`
14051
14112
  effectScope: effectScope,
14052
14113
  getCurrentInstance: getCurrentInstance,
14053
14114
  getCurrentScope: getCurrentScope,
14115
+ getCurrentWatcher: getCurrentWatcher,
14054
14116
  getTransitionRawChildren: getTransitionRawChildren,
14055
14117
  guardReactiveProps: guardReactiveProps,
14056
14118
  h: h,
@@ -14093,6 +14155,7 @@ Expected function or array of functions, received type ${typeof value}.`
14093
14155
  onServerPrefetch: onServerPrefetch,
14094
14156
  onUnmounted: onUnmounted,
14095
14157
  onUpdated: onUpdated,
14158
+ onWatcherCleanup: onWatcherCleanup,
14096
14159
  openBlock: openBlock,
14097
14160
  popScopeId: popScopeId,
14098
14161
  provide: provide,
@@ -15944,7 +16007,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15944
16007
  case 17:
15945
16008
  case 18:
15946
16009
  case 19:
16010
+ // "
15947
16011
  case 20:
16012
+ // '
15948
16013
  case 21:
15949
16014
  emitError(9, end);
15950
16015
  break;
@@ -16926,6 +16991,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16926
16991
  context.helper(TO_DISPLAY_STRING);
16927
16992
  }
16928
16993
  break;
16994
+ // for container types, further traverse downwards
16929
16995
  case 9:
16930
16996
  for (let i2 = 0; i2 < node.branches.length; i2++) {
16931
16997
  traverseNode(node.branches[i2], context);
@@ -17278,6 +17344,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17278
17344
  case 21:
17279
17345
  genNodeList(node.body, context, true, false);
17280
17346
  break;
17347
+ // SSR only types
17281
17348
  case 22:
17282
17349
  break;
17283
17350
  case 23:
@@ -17288,6 +17355,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17288
17355
  break;
17289
17356
  case 26:
17290
17357
  break;
17358
+ /* v8 ignore start */
17291
17359
  case 10:
17292
17360
  break;
17293
17361
  default:
@@ -19295,27 +19363,35 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19295
19363
  case 34:
19296
19364
  inDouble = true;
19297
19365
  break;
19366
+ // "
19298
19367
  case 39:
19299
19368
  inSingle = true;
19300
19369
  break;
19370
+ // '
19301
19371
  case 96:
19302
19372
  inTemplateString = true;
19303
19373
  break;
19374
+ // `
19304
19375
  case 40:
19305
19376
  paren++;
19306
19377
  break;
19378
+ // (
19307
19379
  case 41:
19308
19380
  paren--;
19309
19381
  break;
19382
+ // )
19310
19383
  case 91:
19311
19384
  square++;
19312
19385
  break;
19386
+ // [
19313
19387
  case 93:
19314
19388
  square--;
19315
19389
  break;
19390
+ // ]
19316
19391
  case 123:
19317
19392
  curly++;
19318
19393
  break;
19394
+ // {
19319
19395
  case 125:
19320
19396
  curly--;
19321
19397
  break;