vue 3.5.0-beta.3 → 3.5.0

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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.0-beta.3
2
+ * vue v3.5.0
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.0-beta.3
2
+ * vue v3.5.0
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.0-beta.3
2
+ * vue v3.5.0
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -281,6 +281,14 @@ function isRenderableAttrValue(value) {
281
281
  return type === "string" || type === "number" || type === "boolean";
282
282
  }
283
283
 
284
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
285
+ function getEscapedCssVarName(key, doubleEscape) {
286
+ return key.replace(
287
+ cssVarNameEscapeSymbolsRE,
288
+ (s) => `\\${s}`
289
+ );
290
+ }
291
+
284
292
  function looseCompareArrays(a, b) {
285
293
  if (a.length !== b.length) return false;
286
294
  let equal = true;
@@ -404,12 +412,13 @@ class EffectScope {
404
412
  pause() {
405
413
  if (this._active) {
406
414
  this._isPaused = true;
415
+ let i, l;
407
416
  if (this.scopes) {
408
- for (let i = 0, l = this.scopes.length; i < l; i++) {
417
+ for (i = 0, l = this.scopes.length; i < l; i++) {
409
418
  this.scopes[i].pause();
410
419
  }
411
420
  }
412
- for (let i = 0, l = this.effects.length; i < l; i++) {
421
+ for (i = 0, l = this.effects.length; i < l; i++) {
413
422
  this.effects[i].pause();
414
423
  }
415
424
  }
@@ -421,12 +430,13 @@ class EffectScope {
421
430
  if (this._active) {
422
431
  if (this._isPaused) {
423
432
  this._isPaused = false;
433
+ let i, l;
424
434
  if (this.scopes) {
425
- for (let i = 0, l = this.scopes.length; i < l; i++) {
435
+ for (i = 0, l = this.scopes.length; i < l; i++) {
426
436
  this.scopes[i].resume();
427
437
  }
428
438
  }
429
- for (let i = 0, l = this.effects.length; i < l; i++) {
439
+ for (i = 0, l = this.effects.length; i < l; i++) {
430
440
  this.effects[i].resume();
431
441
  }
432
442
  }
@@ -619,11 +629,9 @@ function startBatch() {
619
629
  batchDepth++;
620
630
  }
621
631
  function endBatch() {
622
- if (batchDepth > 1) {
623
- batchDepth--;
632
+ if (--batchDepth > 0) {
624
633
  return;
625
634
  }
626
- batchDepth--;
627
635
  let error;
628
636
  while (batchedEffect) {
629
637
  let e = batchedEffect;
@@ -1140,7 +1148,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1140
1148
  const needsWrap = arr !== self && !isShallow(self);
1141
1149
  const methodFn = arr[method];
1142
1150
  if (methodFn !== arrayProto[method]) {
1143
- const result2 = methodFn.apply(arr, args);
1151
+ const result2 = methodFn.apply(self, args);
1144
1152
  return needsWrap ? toReactive(result2) : result2;
1145
1153
  }
1146
1154
  let wrappedFn = fn;
@@ -1282,7 +1290,12 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1282
1290
  }
1283
1291
  }
1284
1292
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1285
- const result = Reflect.set(target, key, value, receiver);
1293
+ const result = Reflect.set(
1294
+ target,
1295
+ key,
1296
+ value,
1297
+ isRef(target) ? target : receiver
1298
+ );
1286
1299
  if (target === toRaw(receiver)) {
1287
1300
  if (!hadKey) {
1288
1301
  trigger(target, "add", key, value);
@@ -2095,18 +2108,25 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2095
2108
  const depth = deep === true ? Infinity : deep;
2096
2109
  getter = () => traverse(baseGetter(), depth);
2097
2110
  }
2111
+ const scope = getCurrentScope();
2112
+ const watchHandle = () => {
2113
+ effect.stop();
2114
+ if (scope) {
2115
+ remove(scope.effects, effect);
2116
+ }
2117
+ };
2098
2118
  if (once) {
2099
2119
  if (cb) {
2100
2120
  const _cb = cb;
2101
2121
  cb = (...args) => {
2102
2122
  _cb(...args);
2103
- effect.stop();
2123
+ watchHandle();
2104
2124
  };
2105
2125
  } else {
2106
2126
  const _getter = getter;
2107
2127
  getter = () => {
2108
2128
  _getter();
2109
- effect.stop();
2129
+ watchHandle();
2110
2130
  };
2111
2131
  }
2112
2132
  }
@@ -2175,13 +2195,6 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2175
2195
  } else {
2176
2196
  effect.run();
2177
2197
  }
2178
- const scope = getCurrentScope();
2179
- const watchHandle = () => {
2180
- effect.stop();
2181
- if (scope) {
2182
- remove(scope.effects, effect);
2183
- }
2184
- };
2185
2198
  watchHandle.pause = effect.pause.bind(effect);
2186
2199
  watchHandle.resume = effect.resume.bind(effect);
2187
2200
  watchHandle.stop = watchHandle;
@@ -3630,7 +3643,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3630
3643
  // @__NO_SIDE_EFFECTS__
3631
3644
  function defineComponent(options, extraOptions) {
3632
3645
  return isFunction(options) ? (
3633
- // #8326: extend call and options.name access are considered side-effects
3646
+ // #8236: extend call and options.name access are considered side-effects
3634
3647
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3635
3648
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3636
3649
  ) : options;
@@ -4066,8 +4079,7 @@ Server rendered element contains more child nodes than client vdom.`
4066
4079
  const isText = vnode.type === Text;
4067
4080
  if (node) {
4068
4081
  if (isText && !optimized) {
4069
- let next = children[i + 1];
4070
- if (next && (next = normalizeVNode(next)).type === Text) {
4082
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4071
4083
  insert(
4072
4084
  createText(
4073
4085
  node.data.slice(vnode.children.length)
@@ -4323,7 +4335,10 @@ function resolveCssVars(instance, vnode, expectedMap) {
4323
4335
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4324
4336
  const cssVars = instance.getCssVars();
4325
4337
  for (const key in cssVars) {
4326
- expectedMap.set(`--${key}`, String(cssVars[key]));
4338
+ expectedMap.set(
4339
+ `--${getEscapedCssVarName(key)}`,
4340
+ String(cssVars[key])
4341
+ );
4327
4342
  }
4328
4343
  }
4329
4344
  if (vnode === root && instance.parent) {
@@ -4757,6 +4772,7 @@ const KeepAliveImpl = {
4757
4772
  );
4758
4773
  const { include, exclude, max } = props;
4759
4774
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4775
+ vnode.shapeFlag &= ~256;
4760
4776
  current = vnode;
4761
4777
  return rawVNode;
4762
4778
  }
@@ -10411,7 +10427,7 @@ function isMemoSame(cached, memo) {
10411
10427
  return true;
10412
10428
  }
10413
10429
 
10414
- const version = "3.5.0-beta.3";
10430
+ const version = "3.5.0";
10415
10431
  const warn = warn$1 ;
10416
10432
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10417
10433
  const devtools = devtools$1 ;
@@ -11038,15 +11054,20 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
11038
11054
 
11039
11055
  function patchDOMProp(el, key, value, parentComponent) {
11040
11056
  if (key === "innerHTML" || key === "textContent") {
11041
- if (value == null) return;
11042
- el[key] = value;
11057
+ if (value != null) {
11058
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
11059
+ }
11043
11060
  return;
11044
11061
  }
11045
11062
  const tag = el.tagName;
11046
11063
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11047
11064
  !tag.includes("-")) {
11048
11065
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11049
- const newValue = value == null ? "" : String(value);
11066
+ const newValue = value == null ? (
11067
+ // #11647: value should be set as empty string for null and undefined,
11068
+ // but <input type="checkbox"> should be set as 'on'.
11069
+ el.type === "checkbox" ? "on" : ""
11070
+ ) : String(value);
11050
11071
  if (oldValue !== newValue || !("_value" in el)) {
11051
11072
  el.value = newValue;
11052
11073
  }
@@ -11466,6 +11487,9 @@ class VueElement extends BaseClass {
11466
11487
  delete this._props[key];
11467
11488
  } else {
11468
11489
  this._props[key] = val;
11490
+ if (key === "key" && this._app) {
11491
+ this._app._ceVNode.key = val;
11492
+ }
11469
11493
  }
11470
11494
  if (shouldUpdate && this._instance) {
11471
11495
  this._update();
@@ -11904,12 +11928,16 @@ const vModelCheckbox = {
11904
11928
  };
11905
11929
  function setChecked(el, { value, oldValue }, vnode) {
11906
11930
  el._modelValue = value;
11931
+ let checked;
11907
11932
  if (isArray(value)) {
11908
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
11933
+ checked = looseIndexOf(value, vnode.props.value) > -1;
11909
11934
  } else if (isSet(value)) {
11910
- el.checked = value.has(vnode.props.value);
11911
- } else if (value !== oldValue) {
11912
- el.checked = looseEqual(value, getCheckboxValue(el, true));
11935
+ checked = value.has(vnode.props.value);
11936
+ } else {
11937
+ checked = looseEqual(value, getCheckboxValue(el, true));
11938
+ }
11939
+ if (el.checked !== checked) {
11940
+ el.checked = checked;
11913
11941
  }
11914
11942
  }
11915
11943
  const vModelRadio = {
@@ -15372,7 +15400,7 @@ function genNode(node, context) {
15372
15400
  break;
15373
15401
  case 26:
15374
15402
  break;
15375
- /* istanbul ignore next */
15403
+ /* v8 ignore start */
15376
15404
  case 10:
15377
15405
  break;
15378
15406
  default: