@vue/runtime-dom 3.5.40 → 3.5.41

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.40
2
+ * @vue/runtime-dom v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -890,7 +890,9 @@ class VueElement extends BaseClass {
890
890
  if (parent && parent._pendingResolve) {
891
891
  this._pendingResolve = parent._pendingResolve.then(() => {
892
892
  this._pendingResolve = void 0;
893
- this._resolveDef();
893
+ if (this.isConnected) {
894
+ return this._resolveDef();
895
+ }
894
896
  });
895
897
  } else {
896
898
  this._resolveDef();
@@ -940,7 +942,7 @@ class VueElement extends BaseClass {
940
942
  */
941
943
  _resolveDef() {
942
944
  if (this._pendingResolve) {
943
- return;
945
+ return this._pendingResolve;
944
946
  }
945
947
  for (let i = 0; i < this.attributes.length; i++) {
946
948
  this._setAttr(this.attributes[i].name);
@@ -980,6 +982,7 @@ class VueElement extends BaseClass {
980
982
  def.configureApp = this._def.configureApp;
981
983
  resolve(this._def = def, true);
982
984
  });
985
+ return this._pendingResolve;
983
986
  } else {
984
987
  resolve(this._def);
985
988
  }
@@ -1017,6 +1020,11 @@ class VueElement extends BaseClass {
1017
1020
  }
1018
1021
  }
1019
1022
  for (const key of declaredPropKeys.map(shared.camelize)) {
1023
+ if (key in Object.getPrototypeOf(this)) {
1024
+ runtimeCore.warn(
1025
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
1026
+ );
1027
+ }
1020
1028
  Object.defineProperty(this, key, {
1021
1029
  get() {
1022
1030
  return this._getProp(key);
@@ -1501,6 +1509,7 @@ function onCompositionEnd(e) {
1501
1509
  }
1502
1510
  }
1503
1511
  const assignKey = /* @__PURE__ */ Symbol("_assign");
1512
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
1504
1513
  function castValue(value, trim, number) {
1505
1514
  if (trim) value = value.trim();
1506
1515
  if (number) value = shared.looseToNumber(value);
@@ -1508,6 +1517,13 @@ function castValue(value, trim, number) {
1508
1517
  }
1509
1518
  const vModelText = {
1510
1519
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
1520
+ if (el.parentNode) {
1521
+ if (el.type === "text") {
1522
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
1523
+ } else if (el.type === "textarea") {
1524
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
1525
+ }
1526
+ }
1511
1527
  el[assignKey] = getModelAssigner(vnode);
1512
1528
  const castToNumber = number || vnode.props && vnode.props.type === "number";
1513
1529
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -1526,8 +1542,15 @@ const vModelText = {
1526
1542
  }
1527
1543
  },
1528
1544
  // set value on mounted so it's after min/max for type="range"
1529
- mounted(el, { value }) {
1530
- el.value = value == null ? "" : value;
1545
+ mounted(el, { value, modifiers: { trim, number } }) {
1546
+ const newValue = value == null ? "" : value;
1547
+ const initialValue = el[initialValueKey];
1548
+ delete el[initialValueKey];
1549
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
1550
+ el[assignKey](castValue(el.value, trim, number));
1551
+ } else {
1552
+ el.value = newValue;
1553
+ }
1531
1554
  },
1532
1555
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
1533
1556
  el[assignKey] = getModelAssigner(vnode);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.40
2
+ * @vue/runtime-dom v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -857,7 +857,9 @@ class VueElement extends BaseClass {
857
857
  if (parent && parent._pendingResolve) {
858
858
  this._pendingResolve = parent._pendingResolve.then(() => {
859
859
  this._pendingResolve = void 0;
860
- this._resolveDef();
860
+ if (this.isConnected) {
861
+ return this._resolveDef();
862
+ }
861
863
  });
862
864
  } else {
863
865
  this._resolveDef();
@@ -907,7 +909,7 @@ class VueElement extends BaseClass {
907
909
  */
908
910
  _resolveDef() {
909
911
  if (this._pendingResolve) {
910
- return;
912
+ return this._pendingResolve;
911
913
  }
912
914
  for (let i = 0; i < this.attributes.length; i++) {
913
915
  this._setAttr(this.attributes[i].name);
@@ -943,6 +945,7 @@ class VueElement extends BaseClass {
943
945
  def.configureApp = this._def.configureApp;
944
946
  resolve(this._def = def, true);
945
947
  });
948
+ return this._pendingResolve;
946
949
  } else {
947
950
  resolve(this._def);
948
951
  }
@@ -1407,6 +1410,7 @@ function onCompositionEnd(e) {
1407
1410
  }
1408
1411
  }
1409
1412
  const assignKey = /* @__PURE__ */ Symbol("_assign");
1413
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
1410
1414
  function castValue(value, trim, number) {
1411
1415
  if (trim) value = value.trim();
1412
1416
  if (number) value = shared.looseToNumber(value);
@@ -1414,6 +1418,13 @@ function castValue(value, trim, number) {
1414
1418
  }
1415
1419
  const vModelText = {
1416
1420
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
1421
+ if (el.parentNode) {
1422
+ if (el.type === "text") {
1423
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
1424
+ } else if (el.type === "textarea") {
1425
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
1426
+ }
1427
+ }
1417
1428
  el[assignKey] = getModelAssigner(vnode);
1418
1429
  const castToNumber = number || vnode.props && vnode.props.type === "number";
1419
1430
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -1432,8 +1443,15 @@ const vModelText = {
1432
1443
  }
1433
1444
  },
1434
1445
  // set value on mounted so it's after min/max for type="range"
1435
- mounted(el, { value }) {
1436
- el.value = value == null ? "" : value;
1446
+ mounted(el, { value, modifiers: { trim, number } }) {
1447
+ const newValue = value == null ? "" : value;
1448
+ const initialValue = el[initialValueKey];
1449
+ delete el[initialValueKey];
1450
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
1451
+ el[assignKey](castValue(el.value, trim, number));
1452
+ } else {
1453
+ el.value = newValue;
1454
+ }
1437
1455
  },
1438
1456
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
1439
1457
  el[assignKey] = getModelAssigner(vnode);
@@ -80,8 +80,10 @@ type VOnDirective = Directive<any, any, VOnModifiers>;
80
80
 
81
81
  type AssignerFn = (value: any) => void;
82
82
  declare const assignKey: unique symbol;
83
+ declare const initialValueKey: unique symbol;
83
84
  type ModelDirective<T, Modifiers extends string = string> = ObjectDirective<T & {
84
85
  [assignKey]: AssignerFn;
86
+ [initialValueKey]?: string;
85
87
  _assigning?: boolean;
86
88
  }, any, Modifiers>;
87
89
  export declare const vModelText: ModelDirective<HTMLInputElement | HTMLTextAreaElement, 'trim' | 'number' | 'lazy'>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.40
2
+ * @vue/runtime-dom v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -194,7 +194,7 @@ const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
194
194
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
195
195
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
196
196
  const isBooleanAttr = /* @__PURE__ */ makeMap(
197
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
197
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
198
198
  );
199
199
  function includeBooleanAttr(value) {
200
200
  return !!value || value === "";
@@ -2597,7 +2597,9 @@ function queuePostFlushCb(cb) {
2597
2597
  cb.flags |= 1;
2598
2598
  }
2599
2599
  } else {
2600
- pendingPostFlushCbs.push(...cb);
2600
+ for (let i = 0; i < cb.length; i++) {
2601
+ pendingPostFlushCbs.push(cb[i]);
2602
+ }
2601
2603
  }
2602
2604
  queueFlush();
2603
2605
  }
@@ -2633,7 +2635,9 @@ function flushPostFlushCbs(seen) {
2633
2635
  );
2634
2636
  pendingPostFlushCbs.length = 0;
2635
2637
  if (activePostFlushCbs) {
2636
- activePostFlushCbs.push(...deduped);
2638
+ for (let i = 0; i < deduped.length; i++) {
2639
+ activePostFlushCbs.push(deduped[i]);
2640
+ }
2637
2641
  return;
2638
2642
  }
2639
2643
  activePostFlushCbs = deduped;
@@ -3922,7 +3926,11 @@ function getInnerChild$1(vnode) {
3922
3926
  function setTransitionHooks(vnode, hooks) {
3923
3927
  if (vnode.shapeFlag & 6 && vnode.component) {
3924
3928
  vnode.transition = hooks;
3925
- setTransitionHooks(vnode.component.subTree, hooks);
3929
+ const subTree = vnode.component.subTree;
3930
+ setTransitionHooks(
3931
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
3932
+ hooks
3933
+ );
3926
3934
  } else if (vnode.shapeFlag & 128) {
3927
3935
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3928
3936
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4462,6 +4470,9 @@ Server rendered element contains more child nodes than client vdom.`
4462
4470
  }
4463
4471
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4464
4472
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4473
+ if (isUnchangedResourceProp(el, key, props[key])) {
4474
+ continue;
4475
+ }
4465
4476
  patchProp(el, key, null, props[key], namespace, parentComponent);
4466
4477
  }
4467
4478
  }
@@ -4644,6 +4655,13 @@ Server rendered element contains fewer child nodes than client vdom.`
4644
4655
  };
4645
4656
  return [hydrate, hydrateNode];
4646
4657
  }
4658
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
4659
+ function isUnchangedResourceProp(el, key, clientValue) {
4660
+ if (!resourceProps.has(key)) {
4661
+ return false;
4662
+ }
4663
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4664
+ }
4647
4665
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4648
4666
  let mismatchType;
4649
4667
  let mismatchKey;
@@ -4681,7 +4699,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4681
4699
  mismatchKey = "style";
4682
4700
  }
4683
4701
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
4684
- if (isBooleanAttr(key)) {
4702
+ if (key === "hidden") {
4703
+ actual = normalizeHiddenValue(el.getAttribute(key));
4704
+ expected = normalizeHiddenValue(clientValue);
4705
+ } else if (isBooleanAttr(key)) {
4685
4706
  actual = el.hasAttribute(key);
4686
4707
  expected = includeBooleanAttr(clientValue);
4687
4708
  } else if (clientValue == null) {
@@ -4717,6 +4738,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4717
4738
  }
4718
4739
  return false;
4719
4740
  }
4741
+ function normalizeHiddenValue(value) {
4742
+ if (!isRenderableAttrValue(value)) {
4743
+ return false;
4744
+ }
4745
+ if (isString(value)) {
4746
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
4747
+ }
4748
+ return includeBooleanAttr(value) ? "" : false;
4749
+ }
4720
4750
  function toClassSet(str) {
4721
4751
  return new Set(str.trim().split(/\s+/));
4722
4752
  }
@@ -5536,7 +5566,8 @@ function createSlots(slots, dynamicSlots) {
5536
5566
  return slots;
5537
5567
  }
5538
5568
 
5539
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5569
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5570
+ if (props == null) props = {};
5540
5571
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5541
5572
  const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5542
5573
  const hasProps = Object.keys(slotProps).length > 0;
@@ -6960,12 +6991,13 @@ function renderComponentRoot(instance) {
6960
6991
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
6961
6992
  }
6962
6993
  if (vnode.transition) {
6963
- if (!isElementRoot(root)) {
6994
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
6995
+ if (!isElementRoot(child)) {
6964
6996
  warn$1(
6965
6997
  `Component inside <Transition> renders non-element root node that cannot be animated.`
6966
6998
  );
6967
6999
  }
6968
- setTransitionHooks(root, vnode.transition);
7000
+ setTransitionHooks(child, vnode.transition);
6969
7001
  }
6970
7002
  if (setRoot) {
6971
7003
  setRoot(root);
@@ -9613,7 +9645,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9613
9645
  let hasUnresolvedAncestor = false;
9614
9646
  while (parent) {
9615
9647
  if (parent.pendingBranch) {
9616
- parent.effects.push(...effects);
9648
+ for (let i = 0; i < effects.length; i++) {
9649
+ parent.effects.push(effects[i]);
9650
+ }
9617
9651
  hasUnresolvedAncestor = true;
9618
9652
  break;
9619
9653
  }
@@ -9978,6 +10012,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
9978
10012
  if (vnode.key !== vnode.key) {
9979
10013
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
9980
10014
  }
10015
+ if (props && vnode.shapeFlag & 1) {
10016
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
10017
+ if (overwritingProp && hasContentChildren(vnode.children)) {
10018
+ warn$1(
10019
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
10020
+ );
10021
+ }
10022
+ }
9981
10023
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
9982
10024
  !isBlockNode && // has current parent block
9983
10025
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -9991,6 +10033,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
9991
10033
  }
9992
10034
  return vnode;
9993
10035
  }
10036
+ function hasContentChildren(children) {
10037
+ if (isString(children)) return children !== "";
10038
+ if (isArray(children)) return children.length > 0;
10039
+ return false;
10040
+ }
9994
10041
  const createVNode = createVNodeWithArgsTransform ;
9995
10042
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
9996
10043
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -10439,7 +10486,12 @@ function setupStatefulComponent(instance, isSSR) {
10439
10486
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10440
10487
  if (isSSR) {
10441
10488
  return setupResult.then((resolvedResult) => {
10442
- handleSetupResult(instance, resolvedResult, isSSR);
10489
+ setInSSRSetupState(true);
10490
+ try {
10491
+ handleSetupResult(instance, resolvedResult, isSSR);
10492
+ } finally {
10493
+ setInSSRSetupState(false);
10494
+ }
10443
10495
  }).catch((e) => {
10444
10496
  handleError(e, instance, 0);
10445
10497
  });
@@ -10905,7 +10957,7 @@ function isMemoSame(cached, memo) {
10905
10957
  return true;
10906
10958
  }
10907
10959
 
10908
- const version = "3.5.40";
10960
+ const version = "3.5.41";
10909
10961
  const warn = warn$1 ;
10910
10962
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10911
10963
  const devtools = devtools$1 ;
@@ -11875,7 +11927,9 @@ class VueElement extends BaseClass {
11875
11927
  if (parent && parent._pendingResolve) {
11876
11928
  this._pendingResolve = parent._pendingResolve.then(() => {
11877
11929
  this._pendingResolve = void 0;
11878
- this._resolveDef();
11930
+ if (this.isConnected) {
11931
+ return this._resolveDef();
11932
+ }
11879
11933
  });
11880
11934
  } else {
11881
11935
  this._resolveDef();
@@ -11925,7 +11979,7 @@ class VueElement extends BaseClass {
11925
11979
  */
11926
11980
  _resolveDef() {
11927
11981
  if (this._pendingResolve) {
11928
- return;
11982
+ return this._pendingResolve;
11929
11983
  }
11930
11984
  for (let i = 0; i < this.attributes.length; i++) {
11931
11985
  this._setAttr(this.attributes[i].name);
@@ -11965,6 +12019,7 @@ class VueElement extends BaseClass {
11965
12019
  def.configureApp = this._def.configureApp;
11966
12020
  resolve(this._def = def, true);
11967
12021
  });
12022
+ return this._pendingResolve;
11968
12023
  } else {
11969
12024
  resolve(this._def);
11970
12025
  }
@@ -12002,6 +12057,11 @@ class VueElement extends BaseClass {
12002
12057
  }
12003
12058
  }
12004
12059
  for (const key of declaredPropKeys.map(camelize)) {
12060
+ if (key in Object.getPrototypeOf(this)) {
12061
+ warn(
12062
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
12063
+ );
12064
+ }
12005
12065
  Object.defineProperty(this, key, {
12006
12066
  get() {
12007
12067
  return this._getProp(key);
@@ -12486,6 +12546,7 @@ function onCompositionEnd(e) {
12486
12546
  }
12487
12547
  }
12488
12548
  const assignKey = /* @__PURE__ */ Symbol("_assign");
12549
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
12489
12550
  function castValue(value, trim, number) {
12490
12551
  if (trim) value = value.trim();
12491
12552
  if (number) value = looseToNumber(value);
@@ -12493,6 +12554,13 @@ function castValue(value, trim, number) {
12493
12554
  }
12494
12555
  const vModelText = {
12495
12556
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
12557
+ if (el.parentNode) {
12558
+ if (el.type === "text") {
12559
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
12560
+ } else if (el.type === "textarea") {
12561
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
12562
+ }
12563
+ }
12496
12564
  el[assignKey] = getModelAssigner(vnode);
12497
12565
  const castToNumber = number || vnode.props && vnode.props.type === "number";
12498
12566
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -12511,8 +12579,15 @@ const vModelText = {
12511
12579
  }
12512
12580
  },
12513
12581
  // set value on mounted so it's after min/max for type="range"
12514
- mounted(el, { value }) {
12515
- el.value = value == null ? "" : value;
12582
+ mounted(el, { value, modifiers: { trim, number } }) {
12583
+ const newValue = value == null ? "" : value;
12584
+ const initialValue = el[initialValueKey];
12585
+ delete el[initialValueKey];
12586
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
12587
+ el[assignKey](castValue(el.value, trim, number));
12588
+ } else {
12589
+ el.value = newValue;
12590
+ }
12516
12591
  },
12517
12592
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
12518
12593
  el[assignKey] = getModelAssigner(vnode);