@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
  **/
@@ -551,15 +551,20 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecial
551
551
 
552
552
  function patchDOMProp(el, key, value, parentComponent) {
553
553
  if (key === "innerHTML" || key === "textContent") {
554
- if (value == null) return;
555
- el[key] = value;
554
+ if (value != null) {
555
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
556
+ }
556
557
  return;
557
558
  }
558
559
  const tag = el.tagName;
559
560
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
560
561
  !tag.includes("-")) {
561
562
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
562
- const newValue = value == null ? "" : String(value);
563
+ const newValue = value == null ? (
564
+ // #11647: value should be set as empty string for null and undefined,
565
+ // but <input type="checkbox"> should be set as 'on'.
566
+ el.type === "checkbox" ? "on" : ""
567
+ ) : String(value);
563
568
  if (oldValue !== newValue || !("_value" in el)) {
564
569
  el.value = newValue;
565
570
  }
@@ -979,6 +984,9 @@ class VueElement extends BaseClass {
979
984
  delete this._props[key];
980
985
  } else {
981
986
  this._props[key] = val;
987
+ if (key === "key" && this._app) {
988
+ this._app._ceVNode.key = val;
989
+ }
982
990
  }
983
991
  if (shouldUpdate && this._instance) {
984
992
  this._update();
@@ -1417,12 +1425,16 @@ const vModelCheckbox = {
1417
1425
  };
1418
1426
  function setChecked(el, { value, oldValue }, vnode) {
1419
1427
  el._modelValue = value;
1428
+ let checked;
1420
1429
  if (shared.isArray(value)) {
1421
- el.checked = shared.looseIndexOf(value, vnode.props.value) > -1;
1430
+ checked = shared.looseIndexOf(value, vnode.props.value) > -1;
1422
1431
  } else if (shared.isSet(value)) {
1423
- el.checked = value.has(vnode.props.value);
1424
- } else if (value !== oldValue) {
1425
- el.checked = shared.looseEqual(value, getCheckboxValue(el, true));
1432
+ checked = value.has(vnode.props.value);
1433
+ } else {
1434
+ checked = shared.looseEqual(value, getCheckboxValue(el, true));
1435
+ }
1436
+ if (el.checked !== checked) {
1437
+ el.checked = checked;
1426
1438
  }
1427
1439
  }
1428
1440
  const vModelRadio = {
@@ -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
  **/
@@ -536,15 +536,20 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecial
536
536
 
537
537
  function patchDOMProp(el, key, value, parentComponent) {
538
538
  if (key === "innerHTML" || key === "textContent") {
539
- if (value == null) return;
540
- el[key] = value;
539
+ if (value != null) {
540
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
541
+ }
541
542
  return;
542
543
  }
543
544
  const tag = el.tagName;
544
545
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
545
546
  !tag.includes("-")) {
546
547
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
547
- const newValue = value == null ? "" : String(value);
548
+ const newValue = value == null ? (
549
+ // #11647: value should be set as empty string for null and undefined,
550
+ // but <input type="checkbox"> should be set as 'on'.
551
+ el.type === "checkbox" ? "on" : ""
552
+ ) : String(value);
548
553
  if (oldValue !== newValue || !("_value" in el)) {
549
554
  el.value = newValue;
550
555
  }
@@ -934,6 +939,9 @@ class VueElement extends BaseClass {
934
939
  delete this._props[key];
935
940
  } else {
936
941
  this._props[key] = val;
942
+ if (key === "key" && this._app) {
943
+ this._app._ceVNode.key = val;
944
+ }
937
945
  }
938
946
  if (shouldUpdate && this._instance) {
939
947
  this._update();
@@ -1322,12 +1330,16 @@ const vModelCheckbox = {
1322
1330
  };
1323
1331
  function setChecked(el, { value, oldValue }, vnode) {
1324
1332
  el._modelValue = value;
1333
+ let checked;
1325
1334
  if (shared.isArray(value)) {
1326
- el.checked = shared.looseIndexOf(value, vnode.props.value) > -1;
1335
+ checked = shared.looseIndexOf(value, vnode.props.value) > -1;
1327
1336
  } else if (shared.isSet(value)) {
1328
- el.checked = value.has(vnode.props.value);
1329
- } else if (value !== oldValue) {
1330
- el.checked = shared.looseEqual(value, getCheckboxValue(el, true));
1337
+ checked = value.has(vnode.props.value);
1338
+ } else {
1339
+ checked = shared.looseEqual(value, getCheckboxValue(el, true));
1340
+ }
1341
+ if (el.checked !== checked) {
1342
+ el.checked = checked;
1331
1343
  }
1332
1344
  }
1333
1345
  const vModelRadio = {
@@ -531,6 +531,7 @@ export interface IframeHTMLAttributes extends HTMLAttributes {
531
531
  /** @deprecated */
532
532
  frameborder?: Numberish;
533
533
  height?: Numberish;
534
+ loading?: 'eager' | 'lazy';
534
535
  /** @deprecated */
535
536
  marginheight?: Numberish;
536
537
  /** @deprecated */
@@ -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
  **/
@@ -214,6 +214,14 @@ function isRenderableAttrValue(value) {
214
214
  return type === "string" || type === "number" || type === "boolean";
215
215
  }
216
216
 
217
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
218
+ function getEscapedCssVarName(key, doubleEscape) {
219
+ return key.replace(
220
+ cssVarNameEscapeSymbolsRE,
221
+ (s) => `\\${s}`
222
+ );
223
+ }
224
+
217
225
  function looseCompareArrays(a, b) {
218
226
  if (a.length !== b.length) return false;
219
227
  let equal = true;
@@ -337,12 +345,13 @@ class EffectScope {
337
345
  pause() {
338
346
  if (this._active) {
339
347
  this._isPaused = true;
348
+ let i, l;
340
349
  if (this.scopes) {
341
- for (let i = 0, l = this.scopes.length; i < l; i++) {
350
+ for (i = 0, l = this.scopes.length; i < l; i++) {
342
351
  this.scopes[i].pause();
343
352
  }
344
353
  }
345
- for (let i = 0, l = this.effects.length; i < l; i++) {
354
+ for (i = 0, l = this.effects.length; i < l; i++) {
346
355
  this.effects[i].pause();
347
356
  }
348
357
  }
@@ -354,12 +363,13 @@ class EffectScope {
354
363
  if (this._active) {
355
364
  if (this._isPaused) {
356
365
  this._isPaused = false;
366
+ let i, l;
357
367
  if (this.scopes) {
358
- for (let i = 0, l = this.scopes.length; i < l; i++) {
368
+ for (i = 0, l = this.scopes.length; i < l; i++) {
359
369
  this.scopes[i].resume();
360
370
  }
361
371
  }
362
- for (let i = 0, l = this.effects.length; i < l; i++) {
372
+ for (i = 0, l = this.effects.length; i < l; i++) {
363
373
  this.effects[i].resume();
364
374
  }
365
375
  }
@@ -552,11 +562,9 @@ function startBatch() {
552
562
  batchDepth++;
553
563
  }
554
564
  function endBatch() {
555
- if (batchDepth > 1) {
556
- batchDepth--;
565
+ if (--batchDepth > 0) {
557
566
  return;
558
567
  }
559
- batchDepth--;
560
568
  let error;
561
569
  while (batchedEffect) {
562
570
  let e = batchedEffect;
@@ -1073,7 +1081,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1073
1081
  const needsWrap = arr !== self && !isShallow(self);
1074
1082
  const methodFn = arr[method];
1075
1083
  if (methodFn !== arrayProto[method]) {
1076
- const result2 = methodFn.apply(arr, args);
1084
+ const result2 = methodFn.apply(self, args);
1077
1085
  return needsWrap ? toReactive(result2) : result2;
1078
1086
  }
1079
1087
  let wrappedFn = fn;
@@ -1215,7 +1223,12 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1215
1223
  }
1216
1224
  }
1217
1225
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1218
- const result = Reflect.set(target, key, value, receiver);
1226
+ const result = Reflect.set(
1227
+ target,
1228
+ key,
1229
+ value,
1230
+ isRef(target) ? target : receiver
1231
+ );
1219
1232
  if (target === toRaw(receiver)) {
1220
1233
  if (!hadKey) {
1221
1234
  trigger(target, "add", key, value);
@@ -2028,18 +2041,25 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2028
2041
  const depth = deep === true ? Infinity : deep;
2029
2042
  getter = () => traverse(baseGetter(), depth);
2030
2043
  }
2044
+ const scope = getCurrentScope();
2045
+ const watchHandle = () => {
2046
+ effect.stop();
2047
+ if (scope) {
2048
+ remove(scope.effects, effect);
2049
+ }
2050
+ };
2031
2051
  if (once) {
2032
2052
  if (cb) {
2033
2053
  const _cb = cb;
2034
2054
  cb = (...args) => {
2035
2055
  _cb(...args);
2036
- effect.stop();
2056
+ watchHandle();
2037
2057
  };
2038
2058
  } else {
2039
2059
  const _getter = getter;
2040
2060
  getter = () => {
2041
2061
  _getter();
2042
- effect.stop();
2062
+ watchHandle();
2043
2063
  };
2044
2064
  }
2045
2065
  }
@@ -2108,13 +2128,6 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2108
2128
  } else {
2109
2129
  effect.run();
2110
2130
  }
2111
- const scope = getCurrentScope();
2112
- const watchHandle = () => {
2113
- effect.stop();
2114
- if (scope) {
2115
- remove(scope.effects, effect);
2116
- }
2117
- };
2118
2131
  watchHandle.pause = effect.pause.bind(effect);
2119
2132
  watchHandle.resume = effect.resume.bind(effect);
2120
2133
  watchHandle.stop = watchHandle;
@@ -3563,7 +3576,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3563
3576
  // @__NO_SIDE_EFFECTS__
3564
3577
  function defineComponent(options, extraOptions) {
3565
3578
  return isFunction(options) ? (
3566
- // #8326: extend call and options.name access are considered side-effects
3579
+ // #8236: extend call and options.name access are considered side-effects
3567
3580
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3568
3581
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3569
3582
  ) : options;
@@ -3999,8 +4012,7 @@ Server rendered element contains more child nodes than client vdom.`
3999
4012
  const isText = vnode.type === Text;
4000
4013
  if (node) {
4001
4014
  if (isText && !optimized) {
4002
- let next = children[i + 1];
4003
- if (next && (next = normalizeVNode(next)).type === Text) {
4015
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4004
4016
  insert(
4005
4017
  createText(
4006
4018
  node.data.slice(vnode.children.length)
@@ -4256,7 +4268,10 @@ function resolveCssVars(instance, vnode, expectedMap) {
4256
4268
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4257
4269
  const cssVars = instance.getCssVars();
4258
4270
  for (const key in cssVars) {
4259
- expectedMap.set(`--${key}`, String(cssVars[key]));
4271
+ expectedMap.set(
4272
+ `--${getEscapedCssVarName(key)}`,
4273
+ String(cssVars[key])
4274
+ );
4260
4275
  }
4261
4276
  }
4262
4277
  if (vnode === root && instance.parent) {
@@ -4690,6 +4705,7 @@ const KeepAliveImpl = {
4690
4705
  );
4691
4706
  const { include, exclude, max } = props;
4692
4707
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4708
+ vnode.shapeFlag &= ~256;
4693
4709
  current = vnode;
4694
4710
  return rawVNode;
4695
4711
  }
@@ -10344,7 +10360,7 @@ function isMemoSame(cached, memo) {
10344
10360
  return true;
10345
10361
  }
10346
10362
 
10347
- const version = "3.5.0-beta.3";
10363
+ const version = "3.5.0";
10348
10364
  const warn = warn$1 ;
10349
10365
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10350
10366
  const devtools = devtools$1 ;
@@ -10971,15 +10987,20 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
10971
10987
 
10972
10988
  function patchDOMProp(el, key, value, parentComponent) {
10973
10989
  if (key === "innerHTML" || key === "textContent") {
10974
- if (value == null) return;
10975
- el[key] = value;
10990
+ if (value != null) {
10991
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
10992
+ }
10976
10993
  return;
10977
10994
  }
10978
10995
  const tag = el.tagName;
10979
10996
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10980
10997
  !tag.includes("-")) {
10981
10998
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10982
- const newValue = value == null ? "" : String(value);
10999
+ const newValue = value == null ? (
11000
+ // #11647: value should be set as empty string for null and undefined,
11001
+ // but <input type="checkbox"> should be set as 'on'.
11002
+ el.type === "checkbox" ? "on" : ""
11003
+ ) : String(value);
10983
11004
  if (oldValue !== newValue || !("_value" in el)) {
10984
11005
  el.value = newValue;
10985
11006
  }
@@ -11399,6 +11420,9 @@ class VueElement extends BaseClass {
11399
11420
  delete this._props[key];
11400
11421
  } else {
11401
11422
  this._props[key] = val;
11423
+ if (key === "key" && this._app) {
11424
+ this._app._ceVNode.key = val;
11425
+ }
11402
11426
  }
11403
11427
  if (shouldUpdate && this._instance) {
11404
11428
  this._update();
@@ -11837,12 +11861,16 @@ const vModelCheckbox = {
11837
11861
  };
11838
11862
  function setChecked(el, { value, oldValue }, vnode) {
11839
11863
  el._modelValue = value;
11864
+ let checked;
11840
11865
  if (isArray(value)) {
11841
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
11866
+ checked = looseIndexOf(value, vnode.props.value) > -1;
11842
11867
  } else if (isSet(value)) {
11843
- el.checked = value.has(vnode.props.value);
11844
- } else if (value !== oldValue) {
11845
- el.checked = looseEqual(value, getCheckboxValue(el, true));
11868
+ checked = value.has(vnode.props.value);
11869
+ } else {
11870
+ checked = looseEqual(value, getCheckboxValue(el, true));
11871
+ }
11872
+ if (el.checked !== checked) {
11873
+ el.checked = checked;
11846
11874
  }
11847
11875
  }
11848
11876
  const vModelRadio = {