@vue/runtime-dom 3.5.0-rc.1 → 3.5.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,9 +1,9 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.0-rc.1
2
+ * @vue/runtime-dom v3.5.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { warn, h, BaseTransition, BaseTransitionPropsValidators, assertNumber, getCurrentInstance, onBeforeMount, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
6
+ import { warn, h, BaseTransition, assertNumber, BaseTransitionPropsValidators, getCurrentInstance, onBeforeMount, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
7
7
  export * from '@vue/runtime-core';
8
8
  import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, includeBooleanAttr, isSymbol, isSpecialBooleanAttr, isFunction, NOOP, isOn, isModelListener, isPlainObject, hasOwn, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
9
9
 
@@ -91,8 +91,6 @@ const nodeOps = {
91
91
  const TRANSITION = "transition";
92
92
  const ANIMATION = "animation";
93
93
  const vtcKey = Symbol("_vtc");
94
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
95
- Transition.displayName = "Transition";
96
94
  const DOMTransitionPropsValidators = {
97
95
  name: String,
98
96
  type: String,
@@ -111,11 +109,19 @@ const DOMTransitionPropsValidators = {
111
109
  leaveActiveClass: String,
112
110
  leaveToClass: String
113
111
  };
114
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
112
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
115
113
  {},
116
114
  BaseTransitionPropsValidators,
117
115
  DOMTransitionPropsValidators
118
116
  );
117
+ const decorate$1 = (t) => {
118
+ t.displayName = "Transition";
119
+ t.props = TransitionPropsValidators;
120
+ return t;
121
+ };
122
+ const Transition = /* @__PURE__ */ decorate$1(
123
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
124
+ );
119
125
  const callHook = (hook, args = []) => {
120
126
  if (isArray(hook)) {
121
127
  hook.forEach((h2) => h2(...args));
@@ -623,7 +629,11 @@ function patchDOMProp(el, key, value, parentComponent) {
623
629
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
624
630
  !tag.includes("-")) {
625
631
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
626
- const newValue = value == null ? "" : String(value);
632
+ const newValue = value == null ? (
633
+ // #11647: value should be set as empty string for null and undefined,
634
+ // but <input type="checkbox"> should be set as 'on'.
635
+ el.type === "checkbox" ? "on" : ""
636
+ ) : String(value);
627
637
  if (oldValue !== newValue || !("_value" in el)) {
628
638
  el.value = newValue;
629
639
  }
@@ -1247,7 +1257,11 @@ const positionMap = /* @__PURE__ */ new WeakMap();
1247
1257
  const newPositionMap = /* @__PURE__ */ new WeakMap();
1248
1258
  const moveCbKey = Symbol("_moveCb");
1249
1259
  const enterCbKey = Symbol("_enterCb");
1250
- const TransitionGroupImpl = {
1260
+ const decorate = (t) => {
1261
+ delete t.props.mode;
1262
+ return t;
1263
+ };
1264
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1251
1265
  name: "TransitionGroup",
1252
1266
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
1253
1267
  tag: String,
@@ -1333,9 +1347,7 @@ const TransitionGroupImpl = {
1333
1347
  return createVNode(tag, null, children);
1334
1348
  };
1335
1349
  }
1336
- };
1337
- const removeMode = (props) => delete props.mode;
1338
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
1350
+ });
1339
1351
  const TransitionGroup = TransitionGroupImpl;
1340
1352
  function callPendingCbs(c) {
1341
1353
  const el = c.el;
@@ -1484,12 +1496,16 @@ const vModelCheckbox = {
1484
1496
  };
1485
1497
  function setChecked(el, { value, oldValue }, vnode) {
1486
1498
  el._modelValue = value;
1499
+ let checked;
1487
1500
  if (isArray(value)) {
1488
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
1501
+ checked = looseIndexOf(value, vnode.props.value) > -1;
1489
1502
  } else if (isSet(value)) {
1490
- el.checked = value.has(vnode.props.value);
1491
- } else if (value !== oldValue) {
1492
- el.checked = looseEqual(value, getCheckboxValue(el, true));
1503
+ checked = value.has(vnode.props.value);
1504
+ } else {
1505
+ checked = looseEqual(value, getCheckboxValue(el, true));
1506
+ }
1507
+ if (el.checked !== checked) {
1508
+ el.checked = checked;
1493
1509
  }
1494
1510
  }
1495
1511
  const vModelRadio = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.0-rc.1
2
+ * @vue/runtime-dom v3.5.1
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;
@@ -970,7 +978,7 @@ var VueRuntimeDOM = (function (exports) {
970
978
  },
971
979
  concat(...args) {
972
980
  return reactiveReadArray(this).concat(
973
- ...args.map((x) => reactiveReadArray(x))
981
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
974
982
  );
975
983
  },
976
984
  entries() {
@@ -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;
@@ -3296,7 +3304,9 @@ var VueRuntimeDOM = (function (exports) {
3296
3304
  // #11061, ensure enterHooks is fresh after clone
3297
3305
  (hooks) => enterHooks = hooks
3298
3306
  );
3299
- setTransitionHooks(innerChild, enterHooks);
3307
+ if (innerChild.type !== Comment) {
3308
+ setTransitionHooks(innerChild, enterHooks);
3309
+ }
3300
3310
  const oldChild = instance.subTree;
3301
3311
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3302
3312
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3619,10 +3629,11 @@ var VueRuntimeDOM = (function (exports) {
3619
3629
  const oldRef = oldRawRef && oldRawRef.r;
3620
3630
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3621
3631
  const setupState = owner.setupState;
3632
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
3622
3633
  if (oldRef != null && oldRef !== ref) {
3623
3634
  if (isString(oldRef)) {
3624
3635
  refs[oldRef] = null;
3625
- if (hasOwn(setupState, oldRef)) {
3636
+ if (canSetSetupRef(oldRef)) {
3626
3637
  setupState[oldRef] = null;
3627
3638
  }
3628
3639
  } else if (isRef(oldRef)) {
@@ -3637,14 +3648,14 @@ var VueRuntimeDOM = (function (exports) {
3637
3648
  if (_isString || _isRef) {
3638
3649
  const doSet = () => {
3639
3650
  if (rawRef.f) {
3640
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
3651
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3641
3652
  if (isUnmount) {
3642
3653
  isArray(existing) && remove(existing, refValue);
3643
3654
  } else {
3644
3655
  if (!isArray(existing)) {
3645
3656
  if (_isString) {
3646
3657
  refs[ref] = [refValue];
3647
- if (hasOwn(setupState, ref)) {
3658
+ if (canSetSetupRef(ref)) {
3648
3659
  setupState[ref] = refs[ref];
3649
3660
  }
3650
3661
  } else {
@@ -3657,7 +3668,7 @@ var VueRuntimeDOM = (function (exports) {
3657
3668
  }
3658
3669
  } else if (_isString) {
3659
3670
  refs[ref] = value;
3660
- if (hasOwn(setupState, ref)) {
3671
+ if (canSetSetupRef(ref)) {
3661
3672
  setupState[ref] = value;
3662
3673
  }
3663
3674
  } else if (_isRef) {
@@ -4007,8 +4018,7 @@ Server rendered element contains more child nodes than client vdom.`
4007
4018
  const isText = vnode.type === Text;
4008
4019
  if (node) {
4009
4020
  if (isText && !optimized) {
4010
- let next = children[i + 1];
4011
- if (next && (next = normalizeVNode(next)).type === Text) {
4021
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4012
4022
  insert(
4013
4023
  createText(
4014
4024
  node.data.slice(vnode.children.length)
@@ -4264,7 +4274,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4264
4274
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4265
4275
  const cssVars = instance.getCssVars();
4266
4276
  for (const key in cssVars) {
4267
- expectedMap.set(`--${key}`, String(cssVars[key]));
4277
+ expectedMap.set(
4278
+ `--${getEscapedCssVarName(key)}`,
4279
+ String(cssVars[key])
4280
+ );
4268
4281
  }
4269
4282
  }
4270
4283
  if (vnode === root && instance.parent) {
@@ -10308,7 +10321,7 @@ Component that was made reactive: `,
10308
10321
  return true;
10309
10322
  }
10310
10323
 
10311
- const version = "3.5.0-rc.1";
10324
+ const version = "3.5.1";
10312
10325
  const warn = warn$1 ;
10313
10326
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10314
10327
  const devtools = devtools$1 ;
@@ -10402,8 +10415,6 @@ Component that was made reactive: `,
10402
10415
  const TRANSITION = "transition";
10403
10416
  const ANIMATION = "animation";
10404
10417
  const vtcKey = Symbol("_vtc");
10405
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
10406
- Transition.displayName = "Transition";
10407
10418
  const DOMTransitionPropsValidators = {
10408
10419
  name: String,
10409
10420
  type: String,
@@ -10422,11 +10433,19 @@ Component that was made reactive: `,
10422
10433
  leaveActiveClass: String,
10423
10434
  leaveToClass: String
10424
10435
  };
10425
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
10436
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
10426
10437
  {},
10427
10438
  BaseTransitionPropsValidators,
10428
10439
  DOMTransitionPropsValidators
10429
10440
  );
10441
+ const decorate$1 = (t) => {
10442
+ t.displayName = "Transition";
10443
+ t.props = TransitionPropsValidators;
10444
+ return t;
10445
+ };
10446
+ const Transition = /* @__PURE__ */ decorate$1(
10447
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
10448
+ );
10430
10449
  const callHook = (hook, args = []) => {
10431
10450
  if (isArray(hook)) {
10432
10451
  hook.forEach((h2) => h2(...args));
@@ -10927,7 +10946,11 @@ Component that was made reactive: `,
10927
10946
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10928
10947
  !tag.includes("-")) {
10929
10948
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10930
- const newValue = value == null ? "" : String(value);
10949
+ const newValue = value == null ? (
10950
+ // #11647: value should be set as empty string for null and undefined,
10951
+ // but <input type="checkbox"> should be set as 'on'.
10952
+ el.type === "checkbox" ? "on" : ""
10953
+ ) : String(value);
10931
10954
  if (oldValue !== newValue || !("_value" in el)) {
10932
10955
  el.value = newValue;
10933
10956
  }
@@ -11539,7 +11562,11 @@ Expected function or array of functions, received type ${typeof value}.`
11539
11562
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11540
11563
  const moveCbKey = Symbol("_moveCb");
11541
11564
  const enterCbKey = Symbol("_enterCb");
11542
- const TransitionGroupImpl = {
11565
+ const decorate = (t) => {
11566
+ delete t.props.mode;
11567
+ return t;
11568
+ };
11569
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11543
11570
  name: "TransitionGroup",
11544
11571
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
11545
11572
  tag: String,
@@ -11625,9 +11652,7 @@ Expected function or array of functions, received type ${typeof value}.`
11625
11652
  return createVNode(tag, null, children);
11626
11653
  };
11627
11654
  }
11628
- };
11629
- const removeMode = (props) => delete props.mode;
11630
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
11655
+ });
11631
11656
  const TransitionGroup = TransitionGroupImpl;
11632
11657
  function callPendingCbs(c) {
11633
11658
  const el = c.el;
@@ -11776,12 +11801,16 @@ Expected function or array of functions, received type ${typeof value}.`
11776
11801
  };
11777
11802
  function setChecked(el, { value, oldValue }, vnode) {
11778
11803
  el._modelValue = value;
11804
+ let checked;
11779
11805
  if (isArray(value)) {
11780
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
11806
+ checked = looseIndexOf(value, vnode.props.value) > -1;
11781
11807
  } else if (isSet(value)) {
11782
- el.checked = value.has(vnode.props.value);
11783
- } else if (value !== oldValue) {
11784
- el.checked = looseEqual(value, getCheckboxValue(el, true));
11808
+ checked = value.has(vnode.props.value);
11809
+ } else {
11810
+ checked = looseEqual(value, getCheckboxValue(el, true));
11811
+ }
11812
+ if (el.checked !== checked) {
11813
+ el.checked = checked;
11785
11814
  }
11786
11815
  }
11787
11816
  const vModelRadio = {