@vue/runtime-dom 3.4.27 → 3.4.29

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.4.27
2
+ * @vue/runtime-dom v3.4.29
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -25,7 +25,7 @@ const nodeOps = {
25
25
  }
26
26
  },
27
27
  createElement: (tag, namespace, is, props) => {
28
- const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
28
+ const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
29
29
  if (tag === "select" && props && props.multiple != null) {
30
30
  el.setAttribute("multiple", props.multiple);
31
31
  }
@@ -54,8 +54,7 @@ const nodeOps = {
54
54
  if (start && (start === end || start.nextSibling)) {
55
55
  while (true) {
56
56
  parent.insertBefore(start.cloneNode(true), anchor);
57
- if (start === end || !(start = start.nextSibling))
58
- break;
57
+ if (start === end || !(start = start.nextSibling)) break;
59
58
  }
60
59
  } else {
61
60
  templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
@@ -339,8 +338,7 @@ function getTimeout(delays, durations) {
339
338
  return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
340
339
  }
341
340
  function toMs(s) {
342
- if (s === "auto")
343
- return 0;
341
+ if (s === "auto") return 0;
344
342
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
345
343
  }
346
344
  function forceReflow() {
@@ -378,8 +376,7 @@ const vShow = {
378
376
  }
379
377
  },
380
378
  updated(el, { value, oldValue }, { transition }) {
381
- if (!value === !oldValue)
382
- return;
379
+ if (!value === !oldValue) return;
383
380
  if (transition) {
384
381
  if (value) {
385
382
  transition.beforeEnter(el);
@@ -473,8 +470,7 @@ function setStyle(style, name, val) {
473
470
  if (shared.isArray(val)) {
474
471
  val.forEach((v) => setStyle(style, name, v));
475
472
  } else {
476
- if (val == null)
477
- val = "";
473
+ if (val == null) val = "";
478
474
  {
479
475
  if (semicolonRE.test(val)) {
480
476
  runtimeCore.warn(
@@ -520,7 +516,7 @@ function autoPrefix(style, rawName) {
520
516
  }
521
517
 
522
518
  const xlinkNS = "http://www.w3.org/1999/xlink";
523
- function patchAttr(el, key, value, isSVG, instance) {
519
+ function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) {
524
520
  if (isSVG && key.startsWith("xlink:")) {
525
521
  if (value == null) {
526
522
  el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
@@ -528,11 +524,10 @@ function patchAttr(el, key, value, isSVG, instance) {
528
524
  el.setAttributeNS(xlinkNS, key, value);
529
525
  }
530
526
  } else {
531
- const isBoolean = shared.isSpecialBooleanAttr(key);
532
527
  if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
533
528
  el.removeAttribute(key);
534
529
  } else {
535
- el.setAttribute(key, isBoolean ? "" : value);
530
+ el.setAttribute(key, isBoolean ? "" : String(value));
536
531
  }
537
532
  }
538
533
  }
@@ -549,7 +544,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
549
544
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
550
545
  !tag.includes("-")) {
551
546
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
552
- const newValue = value == null ? "" : value;
547
+ const newValue = value == null ? "" : String(value);
553
548
  if (oldValue !== newValue || !("_value" in el)) {
554
549
  el.value = newValue;
555
550
  }
@@ -693,6 +688,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
693
688
  parentSuspense,
694
689
  unmountChildren
695
690
  );
691
+ if (key === "value" || key === "checked" || key === "selected") {
692
+ patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
693
+ }
696
694
  } else {
697
695
  if (key === "true-value") {
698
696
  el._trueValue = nextValue;
@@ -738,8 +736,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
738
736
 
739
737
  /*! #__NO_SIDE_EFFECTS__ */
740
738
  // @__NO_SIDE_EFFECTS__
741
- function defineCustomElement(options, hydrate2) {
742
- const Comp = runtimeCore.defineComponent(options);
739
+ function defineCustomElement(options, extraOptions, hydrate2) {
740
+ const Comp = runtimeCore.defineComponent(options, extraOptions);
743
741
  class VueCustomElement extends VueElement {
744
742
  constructor(initialProps) {
745
743
  super(Comp, initialProps, hydrate2);
@@ -749,8 +747,8 @@ function defineCustomElement(options, hydrate2) {
749
747
  return VueCustomElement;
750
748
  }
751
749
  /*! #__NO_SIDE_EFFECTS__ */
752
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
753
- return /* @__PURE__ */ defineCustomElement(options, hydrate);
750
+ const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
751
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
754
752
  };
755
753
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
756
754
  };
@@ -793,12 +791,12 @@ class VueElement extends BaseClass {
793
791
  }
794
792
  disconnectedCallback() {
795
793
  this._connected = false;
796
- if (this._ob) {
797
- this._ob.disconnect();
798
- this._ob = null;
799
- }
800
794
  runtimeCore.nextTick(() => {
801
795
  if (!this._connected) {
796
+ if (this._ob) {
797
+ this._ob.disconnect();
798
+ this._ob = null;
799
+ }
802
800
  render(null, this.shadowRoot);
803
801
  this._instance = null;
804
802
  }
@@ -1134,8 +1132,7 @@ const vModelText = {
1134
1132
  el[assignKey] = getModelAssigner(vnode);
1135
1133
  const castToNumber = number || vnode.props && vnode.props.type === "number";
1136
1134
  addEventListener(el, lazy ? "change" : "input", (e) => {
1137
- if (e.target.composing)
1138
- return;
1135
+ if (e.target.composing) return;
1139
1136
  let domValue = el.value;
1140
1137
  if (trim) {
1141
1138
  domValue = domValue.trim();
@@ -1160,17 +1157,16 @@ const vModelText = {
1160
1157
  mounted(el, { value }) {
1161
1158
  el.value = value == null ? "" : value;
1162
1159
  },
1163
- beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
1160
+ beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
1164
1161
  el[assignKey] = getModelAssigner(vnode);
1165
- if (el.composing)
1166
- return;
1162
+ if (el.composing) return;
1167
1163
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
1168
1164
  const newValue = value == null ? "" : value;
1169
1165
  if (elValue === newValue) {
1170
1166
  return;
1171
1167
  }
1172
1168
  if (document.activeElement === el && el.type !== "range") {
1173
- if (lazy) {
1169
+ if (lazy && value === oldValue) {
1174
1170
  return;
1175
1171
  }
1176
1172
  if (trim && el.value.trim() === newValue) {
@@ -1302,8 +1298,7 @@ function setSelected(el, value, number) {
1302
1298
  option.selected = value.has(optionValue);
1303
1299
  }
1304
1300
  } else if (shared.looseEqual(getValue(option), value)) {
1305
- if (el.selectedIndex !== i)
1306
- el.selectedIndex = i;
1301
+ if (el.selectedIndex !== i) el.selectedIndex = i;
1307
1302
  return;
1308
1303
  }
1309
1304
  }
@@ -1412,8 +1407,7 @@ const withModifiers = (fn, modifiers) => {
1412
1407
  return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
1413
1408
  for (let i = 0; i < modifiers.length; i++) {
1414
1409
  const guard = modifierGuards[modifiers[i]];
1415
- if (guard && guard(event, modifiers))
1416
- return;
1410
+ if (guard && guard(event, modifiers)) return;
1417
1411
  }
1418
1412
  return fn(event, ...args);
1419
1413
  });
@@ -1467,8 +1461,7 @@ const createApp = (...args) => {
1467
1461
  const { mount } = app;
1468
1462
  app.mount = (containerOrSelector) => {
1469
1463
  const container = normalizeContainer(containerOrSelector);
1470
- if (!container)
1471
- return;
1464
+ if (!container) return;
1472
1465
  const component = app._component;
1473
1466
  if (!shared.isFunction(component) && !component.render && !component.template) {
1474
1467
  component.template = container.innerHTML;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.4.27
2
+ * @vue/runtime-dom v3.4.29
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -25,7 +25,7 @@ const nodeOps = {
25
25
  }
26
26
  },
27
27
  createElement: (tag, namespace, is, props) => {
28
- const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
28
+ const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
29
29
  if (tag === "select" && props && props.multiple != null) {
30
30
  el.setAttribute("multiple", props.multiple);
31
31
  }
@@ -54,8 +54,7 @@ const nodeOps = {
54
54
  if (start && (start === end || start.nextSibling)) {
55
55
  while (true) {
56
56
  parent.insertBefore(start.cloneNode(true), anchor);
57
- if (start === end || !(start = start.nextSibling))
58
- break;
57
+ if (start === end || !(start = start.nextSibling)) break;
59
58
  }
60
59
  } else {
61
60
  templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
@@ -336,8 +335,7 @@ function getTimeout(delays, durations) {
336
335
  return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
337
336
  }
338
337
  function toMs(s) {
339
- if (s === "auto")
340
- return 0;
338
+ if (s === "auto") return 0;
341
339
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
342
340
  }
343
341
  function forceReflow() {
@@ -375,8 +373,7 @@ const vShow = {
375
373
  }
376
374
  },
377
375
  updated(el, { value, oldValue }, { transition }) {
378
- if (!value === !oldValue)
379
- return;
376
+ if (!value === !oldValue) return;
380
377
  if (transition) {
381
378
  if (value) {
382
379
  transition.beforeEnter(el);
@@ -466,8 +463,7 @@ function setStyle(style, name, val) {
466
463
  if (shared.isArray(val)) {
467
464
  val.forEach((v) => setStyle(style, name, v));
468
465
  } else {
469
- if (val == null)
470
- val = "";
466
+ if (val == null) val = "";
471
467
  if (name.startsWith("--")) {
472
468
  style.setProperty(name, val);
473
469
  } else {
@@ -506,7 +502,7 @@ function autoPrefix(style, rawName) {
506
502
  }
507
503
 
508
504
  const xlinkNS = "http://www.w3.org/1999/xlink";
509
- function patchAttr(el, key, value, isSVG, instance) {
505
+ function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) {
510
506
  if (isSVG && key.startsWith("xlink:")) {
511
507
  if (value == null) {
512
508
  el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
@@ -514,11 +510,10 @@ function patchAttr(el, key, value, isSVG, instance) {
514
510
  el.setAttributeNS(xlinkNS, key, value);
515
511
  }
516
512
  } else {
517
- const isBoolean = shared.isSpecialBooleanAttr(key);
518
513
  if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
519
514
  el.removeAttribute(key);
520
515
  } else {
521
- el.setAttribute(key, isBoolean ? "" : value);
516
+ el.setAttribute(key, isBoolean ? "" : String(value));
522
517
  }
523
518
  }
524
519
  }
@@ -535,7 +530,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
535
530
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
536
531
  !tag.includes("-")) {
537
532
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
538
- const newValue = value == null ? "" : value;
533
+ const newValue = value == null ? "" : String(value);
539
534
  if (oldValue !== newValue || !("_value" in el)) {
540
535
  el.value = newValue;
541
536
  }
@@ -663,6 +658,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
663
658
  parentSuspense,
664
659
  unmountChildren
665
660
  );
661
+ if (key === "value" || key === "checked" || key === "selected") {
662
+ patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
663
+ }
666
664
  } else {
667
665
  if (key === "true-value") {
668
666
  el._trueValue = nextValue;
@@ -708,8 +706,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
708
706
 
709
707
  /*! #__NO_SIDE_EFFECTS__ */
710
708
  // @__NO_SIDE_EFFECTS__
711
- function defineCustomElement(options, hydrate2) {
712
- const Comp = runtimeCore.defineComponent(options);
709
+ function defineCustomElement(options, extraOptions, hydrate2) {
710
+ const Comp = runtimeCore.defineComponent(options, extraOptions);
713
711
  class VueCustomElement extends VueElement {
714
712
  constructor(initialProps) {
715
713
  super(Comp, initialProps, hydrate2);
@@ -719,8 +717,8 @@ function defineCustomElement(options, hydrate2) {
719
717
  return VueCustomElement;
720
718
  }
721
719
  /*! #__NO_SIDE_EFFECTS__ */
722
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
723
- return /* @__PURE__ */ defineCustomElement(options, hydrate);
720
+ const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
721
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
724
722
  };
725
723
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
726
724
  };
@@ -758,12 +756,12 @@ class VueElement extends BaseClass {
758
756
  }
759
757
  disconnectedCallback() {
760
758
  this._connected = false;
761
- if (this._ob) {
762
- this._ob.disconnect();
763
- this._ob = null;
764
- }
765
759
  runtimeCore.nextTick(() => {
766
760
  if (!this._connected) {
761
+ if (this._ob) {
762
+ this._ob.disconnect();
763
+ this._ob = null;
764
+ }
767
765
  render(null, this.shadowRoot);
768
766
  this._instance = null;
769
767
  }
@@ -1080,8 +1078,7 @@ const vModelText = {
1080
1078
  el[assignKey] = getModelAssigner(vnode);
1081
1079
  const castToNumber = number || vnode.props && vnode.props.type === "number";
1082
1080
  addEventListener(el, lazy ? "change" : "input", (e) => {
1083
- if (e.target.composing)
1084
- return;
1081
+ if (e.target.composing) return;
1085
1082
  let domValue = el.value;
1086
1083
  if (trim) {
1087
1084
  domValue = domValue.trim();
@@ -1106,17 +1103,16 @@ const vModelText = {
1106
1103
  mounted(el, { value }) {
1107
1104
  el.value = value == null ? "" : value;
1108
1105
  },
1109
- beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
1106
+ beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
1110
1107
  el[assignKey] = getModelAssigner(vnode);
1111
- if (el.composing)
1112
- return;
1108
+ if (el.composing) return;
1113
1109
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
1114
1110
  const newValue = value == null ? "" : value;
1115
1111
  if (elValue === newValue) {
1116
1112
  return;
1117
1113
  }
1118
1114
  if (document.activeElement === el && el.type !== "range") {
1119
- if (lazy) {
1115
+ if (lazy && value === oldValue) {
1120
1116
  return;
1121
1117
  }
1122
1118
  if (trim && el.value.trim() === newValue) {
@@ -1245,8 +1241,7 @@ function setSelected(el, value, number) {
1245
1241
  option.selected = value.has(optionValue);
1246
1242
  }
1247
1243
  } else if (shared.looseEqual(getValue(option), value)) {
1248
- if (el.selectedIndex !== i)
1249
- el.selectedIndex = i;
1244
+ if (el.selectedIndex !== i) el.selectedIndex = i;
1250
1245
  return;
1251
1246
  }
1252
1247
  }
@@ -1355,8 +1350,7 @@ const withModifiers = (fn, modifiers) => {
1355
1350
  return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
1356
1351
  for (let i = 0; i < modifiers.length; i++) {
1357
1352
  const guard = modifierGuards[modifiers[i]];
1358
- if (guard && guard(event, modifiers))
1359
- return;
1353
+ if (guard && guard(event, modifiers)) return;
1360
1354
  }
1361
1355
  return fn(event, ...args);
1362
1356
  });
@@ -1406,8 +1400,7 @@ const createApp = (...args) => {
1406
1400
  const { mount } = app;
1407
1401
  app.mount = (containerOrSelector) => {
1408
1402
  const container = normalizeContainer(containerOrSelector);
1409
- if (!container)
1410
- return;
1403
+ if (!container) return;
1411
1404
  const component = app._component;
1412
1405
  if (!shared.isFunction(component) && !component.render && !component.template) {
1413
1406
  component.template = container.innerHTML;
@@ -1,11 +1,16 @@
1
- import { SetupContext, RenderFunction, ComputedOptions, MethodOptions, ComponentOptionsMixin, EmitsOptions, ComponentInjectOptions, SlotsType, ComponentOptionsWithoutProps, ComponentOptionsWithArrayProps, ComponentPropsOptions, ComponentOptionsWithObjectProps, ExtractPropTypes, DefineComponent, RootHydrateFunction, ConcreteComponent, BaseTransitionProps, FunctionalComponent, ObjectDirective, VNodeRef, RootRenderFunction, CreateAppFunction } from '@vue/runtime-core';
1
+ import { SetupContext, RenderFunction, ComponentOptions, ComponentObjectPropsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, EmitsOptions, ComponentInjectOptions, SlotsType, ComponentOptionsWithoutProps, ComponentOptionsWithArrayProps, ComponentPropsOptions, ComponentOptionsWithObjectProps, ExtractPropTypes, DefineComponent, RootHydrateFunction, ConcreteComponent, BaseTransitionProps, FunctionalComponent, ObjectDirective, VNodeRef, RootRenderFunction, CreateAppFunction } from '@vue/runtime-core';
2
2
  export * from '@vue/runtime-core';
3
3
  import * as CSS from 'csstype';
4
4
 
5
5
  export type VueElementConstructor<P = {}> = {
6
6
  new (initialProps?: Record<string, any>): VueElement & P;
7
7
  };
8
- export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Readonly<Props>, ctx: SetupContext) => RawBindings | RenderFunction): VueElementConstructor<Props>;
8
+ export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & {
9
+ props?: (keyof Props)[];
10
+ }): VueElementConstructor<Props>;
11
+ export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & {
12
+ props?: ComponentObjectPropsOptions<Props>;
13
+ }): VueElementConstructor<Props>;
9
14
  export declare function defineCustomElement<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S> & {
10
15
  styles?: string[];
11
16
  }): VueElementConstructor<Props>;
@@ -441,7 +446,7 @@ export interface DataHTMLAttributes extends HTMLAttributes {
441
446
  }
442
447
  export interface DetailsHTMLAttributes extends HTMLAttributes {
443
448
  open?: Booleanish;
444
- onToggle?: Event;
449
+ onToggle?: (payload: ToggleEvent) => void;
445
450
  }
446
451
  export interface DelHTMLAttributes extends HTMLAttributes {
447
452
  cite?: string;
@@ -1294,7 +1299,7 @@ type EventHandlers<E> = {
1294
1299
  };
1295
1300
 
1296
1301
  export type ReservedProps = {
1297
- key?: string | number | symbol;
1302
+ key?: PropertyKey;
1298
1303
  ref?: VNodeRef;
1299
1304
  ref_for?: boolean;
1300
1305
  ref_key?: string;