@vue/runtime-dom 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.0-beta.3
2
+ * @vue/runtime-dom v3.5.0
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -217,6 +217,14 @@ var VueRuntimeDOM = (function (exports) {
217
217
  return type === "string" || type === "number" || type === "boolean";
218
218
  }
219
219
 
220
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
221
+ function getEscapedCssVarName(key, doubleEscape) {
222
+ return key.replace(
223
+ cssVarNameEscapeSymbolsRE,
224
+ (s) => `\\${s}`
225
+ );
226
+ }
227
+
220
228
  function looseCompareArrays(a, b) {
221
229
  if (a.length !== b.length) return false;
222
230
  let equal = true;
@@ -340,12 +348,13 @@ var VueRuntimeDOM = (function (exports) {
340
348
  pause() {
341
349
  if (this._active) {
342
350
  this._isPaused = true;
351
+ let i, l;
343
352
  if (this.scopes) {
344
- for (let i = 0, l = this.scopes.length; i < l; i++) {
353
+ for (i = 0, l = this.scopes.length; i < l; i++) {
345
354
  this.scopes[i].pause();
346
355
  }
347
356
  }
348
- for (let i = 0, l = this.effects.length; i < l; i++) {
357
+ for (i = 0, l = this.effects.length; i < l; i++) {
349
358
  this.effects[i].pause();
350
359
  }
351
360
  }
@@ -357,12 +366,13 @@ var VueRuntimeDOM = (function (exports) {
357
366
  if (this._active) {
358
367
  if (this._isPaused) {
359
368
  this._isPaused = false;
369
+ let i, l;
360
370
  if (this.scopes) {
361
- for (let i = 0, l = this.scopes.length; i < l; i++) {
371
+ for (i = 0, l = this.scopes.length; i < l; i++) {
362
372
  this.scopes[i].resume();
363
373
  }
364
374
  }
365
- for (let i = 0, l = this.effects.length; i < l; i++) {
375
+ for (i = 0, l = this.effects.length; i < l; i++) {
366
376
  this.effects[i].resume();
367
377
  }
368
378
  }
@@ -555,11 +565,9 @@ var VueRuntimeDOM = (function (exports) {
555
565
  batchDepth++;
556
566
  }
557
567
  function endBatch() {
558
- if (batchDepth > 1) {
559
- batchDepth--;
568
+ if (--batchDepth > 0) {
560
569
  return;
561
570
  }
562
- batchDepth--;
563
571
  let error;
564
572
  while (batchedEffect) {
565
573
  let e = batchedEffect;
@@ -1076,7 +1084,7 @@ var VueRuntimeDOM = (function (exports) {
1076
1084
  const needsWrap = arr !== self && !isShallow(self);
1077
1085
  const methodFn = arr[method];
1078
1086
  if (methodFn !== arrayProto[method]) {
1079
- const result2 = methodFn.apply(arr, args);
1087
+ const result2 = methodFn.apply(self, args);
1080
1088
  return needsWrap ? toReactive(result2) : result2;
1081
1089
  }
1082
1090
  let wrappedFn = fn;
@@ -1218,7 +1226,12 @@ var VueRuntimeDOM = (function (exports) {
1218
1226
  }
1219
1227
  }
1220
1228
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1221
- const result = Reflect.set(target, key, value, receiver);
1229
+ const result = Reflect.set(
1230
+ target,
1231
+ key,
1232
+ value,
1233
+ isRef(target) ? target : receiver
1234
+ );
1222
1235
  if (target === toRaw(receiver)) {
1223
1236
  if (!hadKey) {
1224
1237
  trigger(target, "add", key, value);
@@ -2031,18 +2044,25 @@ var VueRuntimeDOM = (function (exports) {
2031
2044
  const depth = deep === true ? Infinity : deep;
2032
2045
  getter = () => traverse(baseGetter(), depth);
2033
2046
  }
2047
+ const scope = getCurrentScope();
2048
+ const watchHandle = () => {
2049
+ effect.stop();
2050
+ if (scope) {
2051
+ remove(scope.effects, effect);
2052
+ }
2053
+ };
2034
2054
  if (once) {
2035
2055
  if (cb) {
2036
2056
  const _cb = cb;
2037
2057
  cb = (...args) => {
2038
2058
  _cb(...args);
2039
- effect.stop();
2059
+ watchHandle();
2040
2060
  };
2041
2061
  } else {
2042
2062
  const _getter = getter;
2043
2063
  getter = () => {
2044
2064
  _getter();
2045
- effect.stop();
2065
+ watchHandle();
2046
2066
  };
2047
2067
  }
2048
2068
  }
@@ -2111,13 +2131,6 @@ var VueRuntimeDOM = (function (exports) {
2111
2131
  } else {
2112
2132
  effect.run();
2113
2133
  }
2114
- const scope = getCurrentScope();
2115
- const watchHandle = () => {
2116
- effect.stop();
2117
- if (scope) {
2118
- remove(scope.effects, effect);
2119
- }
2120
- };
2121
2134
  watchHandle.pause = effect.pause.bind(effect);
2122
2135
  watchHandle.resume = effect.resume.bind(effect);
2123
2136
  watchHandle.stop = watchHandle;
@@ -3566,7 +3579,7 @@ var VueRuntimeDOM = (function (exports) {
3566
3579
  // @__NO_SIDE_EFFECTS__
3567
3580
  function defineComponent(options, extraOptions) {
3568
3581
  return isFunction(options) ? (
3569
- // #8326: extend call and options.name access are considered side-effects
3582
+ // #8236: extend call and options.name access are considered side-effects
3570
3583
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3571
3584
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3572
3585
  ) : options;
@@ -4002,8 +4015,7 @@ Server rendered element contains more child nodes than client vdom.`
4002
4015
  const isText = vnode.type === Text;
4003
4016
  if (node) {
4004
4017
  if (isText && !optimized) {
4005
- let next = children[i + 1];
4006
- if (next && (next = normalizeVNode(next)).type === Text) {
4018
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4007
4019
  insert(
4008
4020
  createText(
4009
4021
  node.data.slice(vnode.children.length)
@@ -4259,7 +4271,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4259
4271
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4260
4272
  const cssVars = instance.getCssVars();
4261
4273
  for (const key in cssVars) {
4262
- expectedMap.set(`--${key}`, String(cssVars[key]));
4274
+ expectedMap.set(
4275
+ `--${getEscapedCssVarName(key)}`,
4276
+ String(cssVars[key])
4277
+ );
4263
4278
  }
4264
4279
  }
4265
4280
  if (vnode === root && instance.parent) {
@@ -4687,6 +4702,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4687
4702
  );
4688
4703
  const { include, exclude, max } = props;
4689
4704
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4705
+ vnode.shapeFlag &= ~256;
4690
4706
  current = vnode;
4691
4707
  return rawVNode;
4692
4708
  }
@@ -10302,7 +10318,7 @@ Component that was made reactive: `,
10302
10318
  return true;
10303
10319
  }
10304
10320
 
10305
- const version = "3.5.0-beta.3";
10321
+ const version = "3.5.0";
10306
10322
  const warn = warn$1 ;
10307
10323
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10308
10324
  const devtools = devtools$1 ;
@@ -10912,15 +10928,20 @@ Component that was made reactive: `,
10912
10928
 
10913
10929
  function patchDOMProp(el, key, value, parentComponent) {
10914
10930
  if (key === "innerHTML" || key === "textContent") {
10915
- if (value == null) return;
10916
- el[key] = value;
10931
+ if (value != null) {
10932
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
10933
+ }
10917
10934
  return;
10918
10935
  }
10919
10936
  const tag = el.tagName;
10920
10937
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10921
10938
  !tag.includes("-")) {
10922
10939
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10923
- const newValue = value == null ? "" : String(value);
10940
+ const newValue = value == null ? (
10941
+ // #11647: value should be set as empty string for null and undefined,
10942
+ // but <input type="checkbox"> should be set as 'on'.
10943
+ el.type === "checkbox" ? "on" : ""
10944
+ ) : String(value);
10924
10945
  if (oldValue !== newValue || !("_value" in el)) {
10925
10946
  el.value = newValue;
10926
10947
  }
@@ -11340,6 +11361,9 @@ Expected function or array of functions, received type ${typeof value}.`
11340
11361
  delete this._props[key];
11341
11362
  } else {
11342
11363
  this._props[key] = val;
11364
+ if (key === "key" && this._app) {
11365
+ this._app._ceVNode.key = val;
11366
+ }
11343
11367
  }
11344
11368
  if (shouldUpdate && this._instance) {
11345
11369
  this._update();
@@ -11766,12 +11790,16 @@ Expected function or array of functions, received type ${typeof value}.`
11766
11790
  };
11767
11791
  function setChecked(el, { value, oldValue }, vnode) {
11768
11792
  el._modelValue = value;
11793
+ let checked;
11769
11794
  if (isArray(value)) {
11770
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
11795
+ checked = looseIndexOf(value, vnode.props.value) > -1;
11771
11796
  } else if (isSet(value)) {
11772
- el.checked = value.has(vnode.props.value);
11773
- } else if (value !== oldValue) {
11774
- el.checked = looseEqual(value, getCheckboxValue(el, true));
11797
+ checked = value.has(vnode.props.value);
11798
+ } else {
11799
+ checked = looseEqual(value, getCheckboxValue(el, true));
11800
+ }
11801
+ if (el.checked !== checked) {
11802
+ el.checked = checked;
11775
11803
  }
11776
11804
  }
11777
11805
  const vModelRadio = {