@vue/runtime-dom 3.2.20 → 3.2.21

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.
@@ -112,16 +112,8 @@ function patchClass(el, value, isSVG) {
112
112
 
113
113
  function patchStyle(el, prev, next) {
114
114
  const style = el.style;
115
- const currentDisplay = style.display;
116
- if (!next) {
117
- el.removeAttribute('style');
118
- }
119
- else if (shared.isString(next)) {
120
- if (prev !== next) {
121
- style.cssText = next;
122
- }
123
- }
124
- else {
115
+ const isCssString = shared.isString(next);
116
+ if (next && !isCssString) {
125
117
  for (const key in next) {
126
118
  setStyle(style, key, next[key]);
127
119
  }
@@ -133,11 +125,22 @@ function patchStyle(el, prev, next) {
133
125
  }
134
126
  }
135
127
  }
136
- // indicates that the `display` of the element is controlled by `v-show`,
137
- // so we always keep the current `display` value regardless of the `style` value,
138
- // thus handing over control to `v-show`.
139
- if ('_vod' in el) {
140
- style.display = currentDisplay;
128
+ else {
129
+ const currentDisplay = style.display;
130
+ if (isCssString) {
131
+ if (prev !== next) {
132
+ style.cssText = next;
133
+ }
134
+ }
135
+ else if (prev) {
136
+ el.removeAttribute('style');
137
+ }
138
+ // indicates that the `display` of the element is controlled by `v-show`,
139
+ // so we always keep the current `display` value regardless of the `style`
140
+ // value, thus handing over control to `v-show`.
141
+ if ('_vod' in el) {
142
+ style.display = currentDisplay;
143
+ }
141
144
  }
142
145
  }
143
146
  const importantRE = /\s*!important$/;
@@ -483,22 +486,11 @@ class VueElement extends BaseClass {
483
486
  }
484
487
  this.attachShadow({ mode: 'open' });
485
488
  }
486
- // set initial attrs
487
- for (let i = 0; i < this.attributes.length; i++) {
488
- this._setAttr(this.attributes[i].name);
489
- }
490
- // watch future attr changes
491
- new MutationObserver(mutations => {
492
- for (const m of mutations) {
493
- this._setAttr(m.attributeName);
494
- }
495
- }).observe(this, { attributes: true });
496
489
  }
497
490
  connectedCallback() {
498
491
  this._connected = true;
499
492
  if (!this._instance) {
500
493
  this._resolveDef();
501
- this._update();
502
494
  }
503
495
  }
504
496
  disconnectedCallback() {
@@ -517,8 +509,18 @@ class VueElement extends BaseClass {
517
509
  if (this._resolved) {
518
510
  return;
519
511
  }
512
+ this._resolved = true;
513
+ // set initial attrs
514
+ for (let i = 0; i < this.attributes.length; i++) {
515
+ this._setAttr(this.attributes[i].name);
516
+ }
517
+ // watch future attr changes
518
+ new MutationObserver(mutations => {
519
+ for (const m of mutations) {
520
+ this._setAttr(m.attributeName);
521
+ }
522
+ }).observe(this, { attributes: true });
520
523
  const resolve = (def) => {
521
- this._resolved = true;
522
524
  const { props, styles } = def;
523
525
  const hasOptions = !shared.isArray(props);
524
526
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -533,14 +535,11 @@ class VueElement extends BaseClass {
533
535
  }
534
536
  }
535
537
  }
536
- if (numberProps) {
537
- this._numberProps = numberProps;
538
- this._update();
539
- }
538
+ this._numberProps = numberProps;
540
539
  // check if there are props set pre-upgrade or connect
541
540
  for (const key of Object.keys(this)) {
542
541
  if (key[0] !== '_') {
543
- this._setProp(key, this[key]);
542
+ this._setProp(key, this[key], true, false);
544
543
  }
545
544
  }
546
545
  // defining getter/setters on prototype
@@ -554,7 +553,10 @@ class VueElement extends BaseClass {
554
553
  }
555
554
  });
556
555
  }
556
+ // apply CSS
557
557
  this._applyStyles(styles);
558
+ // initial render
559
+ this._update();
558
560
  };
559
561
  const asyncDef = this._def.__asyncLoader;
560
562
  if (asyncDef) {
@@ -580,10 +582,10 @@ class VueElement extends BaseClass {
580
582
  /**
581
583
  * @internal
582
584
  */
583
- _setProp(key, val, shouldReflect = true) {
585
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
584
586
  if (val !== this._props[key]) {
585
587
  this._props[key] = val;
586
- if (this._instance) {
588
+ if (shouldUpdate && this._instance) {
587
589
  this._update();
588
590
  }
589
591
  // reflect
@@ -112,16 +112,8 @@ function patchClass(el, value, isSVG) {
112
112
 
113
113
  function patchStyle(el, prev, next) {
114
114
  const style = el.style;
115
- const currentDisplay = style.display;
116
- if (!next) {
117
- el.removeAttribute('style');
118
- }
119
- else if (shared.isString(next)) {
120
- if (prev !== next) {
121
- style.cssText = next;
122
- }
123
- }
124
- else {
115
+ const isCssString = shared.isString(next);
116
+ if (next && !isCssString) {
125
117
  for (const key in next) {
126
118
  setStyle(style, key, next[key]);
127
119
  }
@@ -133,11 +125,22 @@ function patchStyle(el, prev, next) {
133
125
  }
134
126
  }
135
127
  }
136
- // indicates that the `display` of the element is controlled by `v-show`,
137
- // so we always keep the current `display` value regardless of the `style` value,
138
- // thus handing over control to `v-show`.
139
- if ('_vod' in el) {
140
- style.display = currentDisplay;
128
+ else {
129
+ const currentDisplay = style.display;
130
+ if (isCssString) {
131
+ if (prev !== next) {
132
+ style.cssText = next;
133
+ }
134
+ }
135
+ else if (prev) {
136
+ el.removeAttribute('style');
137
+ }
138
+ // indicates that the `display` of the element is controlled by `v-show`,
139
+ // so we always keep the current `display` value regardless of the `style`
140
+ // value, thus handing over control to `v-show`.
141
+ if ('_vod' in el) {
142
+ style.display = currentDisplay;
143
+ }
141
144
  }
142
145
  }
143
146
  const importantRE = /\s*!important$/;
@@ -475,22 +478,11 @@ class VueElement extends BaseClass {
475
478
  else {
476
479
  this.attachShadow({ mode: 'open' });
477
480
  }
478
- // set initial attrs
479
- for (let i = 0; i < this.attributes.length; i++) {
480
- this._setAttr(this.attributes[i].name);
481
- }
482
- // watch future attr changes
483
- new MutationObserver(mutations => {
484
- for (const m of mutations) {
485
- this._setAttr(m.attributeName);
486
- }
487
- }).observe(this, { attributes: true });
488
481
  }
489
482
  connectedCallback() {
490
483
  this._connected = true;
491
484
  if (!this._instance) {
492
485
  this._resolveDef();
493
- this._update();
494
486
  }
495
487
  }
496
488
  disconnectedCallback() {
@@ -509,8 +501,18 @@ class VueElement extends BaseClass {
509
501
  if (this._resolved) {
510
502
  return;
511
503
  }
504
+ this._resolved = true;
505
+ // set initial attrs
506
+ for (let i = 0; i < this.attributes.length; i++) {
507
+ this._setAttr(this.attributes[i].name);
508
+ }
509
+ // watch future attr changes
510
+ new MutationObserver(mutations => {
511
+ for (const m of mutations) {
512
+ this._setAttr(m.attributeName);
513
+ }
514
+ }).observe(this, { attributes: true });
512
515
  const resolve = (def) => {
513
- this._resolved = true;
514
516
  const { props, styles } = def;
515
517
  const hasOptions = !shared.isArray(props);
516
518
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -525,14 +527,11 @@ class VueElement extends BaseClass {
525
527
  }
526
528
  }
527
529
  }
528
- if (numberProps) {
529
- this._numberProps = numberProps;
530
- this._update();
531
- }
530
+ this._numberProps = numberProps;
532
531
  // check if there are props set pre-upgrade or connect
533
532
  for (const key of Object.keys(this)) {
534
533
  if (key[0] !== '_') {
535
- this._setProp(key, this[key]);
534
+ this._setProp(key, this[key], true, false);
536
535
  }
537
536
  }
538
537
  // defining getter/setters on prototype
@@ -546,7 +545,10 @@ class VueElement extends BaseClass {
546
545
  }
547
546
  });
548
547
  }
548
+ // apply CSS
549
549
  this._applyStyles(styles);
550
+ // initial render
551
+ this._update();
550
552
  };
551
553
  const asyncDef = this._def.__asyncLoader;
552
554
  if (asyncDef) {
@@ -572,10 +574,10 @@ class VueElement extends BaseClass {
572
574
  /**
573
575
  * @internal
574
576
  */
575
- _setProp(key, val, shouldReflect = true) {
577
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
576
578
  if (val !== this._props[key]) {
577
579
  this._props[key] = val;
578
- if (this._instance) {
580
+ if (shouldUpdate && this._instance) {
579
581
  this._update();
580
582
  }
581
583
  // reflect
@@ -1572,11 +1572,12 @@ function tryWrap(fn) {
1572
1572
 
1573
1573
  let devtools;
1574
1574
  let buffer = [];
1575
+ let devtoolsNotInstalled = false;
1575
1576
  function emit(event, ...args) {
1576
1577
  if (devtools) {
1577
1578
  devtools.emit(event, ...args);
1578
1579
  }
1579
- else {
1580
+ else if (!devtoolsNotInstalled) {
1580
1581
  buffer.push({ event, args });
1581
1582
  }
1582
1583
  }
@@ -1587,7 +1588,13 @@ function setDevtoolsHook(hook, target) {
1587
1588
  buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1588
1589
  buffer = [];
1589
1590
  }
1590
- else {
1591
+ else if (
1592
+ // handle late devtools injection - only do this if we are in an actual
1593
+ // browser environment to avoid the timer handle stalling test runner exit
1594
+ // (#4815)
1595
+ // eslint-disable-next-line no-restricted-globals
1596
+ typeof window !== 'undefined' &&
1597
+ !navigator.userAgent.includes('jsdom')) {
1591
1598
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1592
1599
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1593
1600
  replay.push((newHook) => {
@@ -1596,9 +1603,18 @@ function setDevtoolsHook(hook, target) {
1596
1603
  // clear buffer after 3s - the user probably doesn't have devtools installed
1597
1604
  // at all, and keeping the buffer will cause memory leaks (#4738)
1598
1605
  setTimeout(() => {
1599
- buffer = [];
1606
+ if (!devtools) {
1607
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1608
+ devtoolsNotInstalled = true;
1609
+ buffer = [];
1610
+ }
1600
1611
  }, 3000);
1601
1612
  }
1613
+ else {
1614
+ // non-browser env, assume not installed
1615
+ devtoolsNotInstalled = true;
1616
+ buffer = [];
1617
+ }
1602
1618
  }
1603
1619
  function devtoolsInitApp(app, version) {
1604
1620
  emit("app:init" /* APP_INIT */, app, version, {
@@ -4386,7 +4402,7 @@ return withDirectives(h(comp), [
4386
4402
  [bar, this.y]
4387
4403
  ])
4388
4404
  */
4389
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
4405
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
4390
4406
  function validateDirectiveName(name) {
4391
4407
  if (isBuiltInDirective(name)) {
4392
4408
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -8948,7 +8964,7 @@ function isMemoSame(cached, memo) {
8948
8964
  }
8949
8965
 
8950
8966
  // Core API ------------------------------------------------------------------
8951
- const version = "3.2.20";
8967
+ const version = "3.2.21";
8952
8968
  /**
8953
8969
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8954
8970
  * @internal
@@ -9070,16 +9086,8 @@ function patchClass(el, value, isSVG) {
9070
9086
 
9071
9087
  function patchStyle(el, prev, next) {
9072
9088
  const style = el.style;
9073
- const currentDisplay = style.display;
9074
- if (!next) {
9075
- el.removeAttribute('style');
9076
- }
9077
- else if (isString(next)) {
9078
- if (prev !== next) {
9079
- style.cssText = next;
9080
- }
9081
- }
9082
- else {
9089
+ const isCssString = isString(next);
9090
+ if (next && !isCssString) {
9083
9091
  for (const key in next) {
9084
9092
  setStyle(style, key, next[key]);
9085
9093
  }
@@ -9091,11 +9099,22 @@ function patchStyle(el, prev, next) {
9091
9099
  }
9092
9100
  }
9093
9101
  }
9094
- // indicates that the `display` of the element is controlled by `v-show`,
9095
- // so we always keep the current `display` value regardless of the `style` value,
9096
- // thus handing over control to `v-show`.
9097
- if ('_vod' in el) {
9098
- style.display = currentDisplay;
9102
+ else {
9103
+ const currentDisplay = style.display;
9104
+ if (isCssString) {
9105
+ if (prev !== next) {
9106
+ style.cssText = next;
9107
+ }
9108
+ }
9109
+ else if (prev) {
9110
+ el.removeAttribute('style');
9111
+ }
9112
+ // indicates that the `display` of the element is controlled by `v-show`,
9113
+ // so we always keep the current `display` value regardless of the `style`
9114
+ // value, thus handing over control to `v-show`.
9115
+ if ('_vod' in el) {
9116
+ style.display = currentDisplay;
9117
+ }
9099
9118
  }
9100
9119
  }
9101
9120
  const importantRE = /\s*!important$/;
@@ -9441,22 +9460,11 @@ class VueElement extends BaseClass {
9441
9460
  }
9442
9461
  this.attachShadow({ mode: 'open' });
9443
9462
  }
9444
- // set initial attrs
9445
- for (let i = 0; i < this.attributes.length; i++) {
9446
- this._setAttr(this.attributes[i].name);
9447
- }
9448
- // watch future attr changes
9449
- new MutationObserver(mutations => {
9450
- for (const m of mutations) {
9451
- this._setAttr(m.attributeName);
9452
- }
9453
- }).observe(this, { attributes: true });
9454
9463
  }
9455
9464
  connectedCallback() {
9456
9465
  this._connected = true;
9457
9466
  if (!this._instance) {
9458
9467
  this._resolveDef();
9459
- this._update();
9460
9468
  }
9461
9469
  }
9462
9470
  disconnectedCallback() {
@@ -9475,8 +9483,18 @@ class VueElement extends BaseClass {
9475
9483
  if (this._resolved) {
9476
9484
  return;
9477
9485
  }
9486
+ this._resolved = true;
9487
+ // set initial attrs
9488
+ for (let i = 0; i < this.attributes.length; i++) {
9489
+ this._setAttr(this.attributes[i].name);
9490
+ }
9491
+ // watch future attr changes
9492
+ new MutationObserver(mutations => {
9493
+ for (const m of mutations) {
9494
+ this._setAttr(m.attributeName);
9495
+ }
9496
+ }).observe(this, { attributes: true });
9478
9497
  const resolve = (def) => {
9479
- this._resolved = true;
9480
9498
  const { props, styles } = def;
9481
9499
  const hasOptions = !isArray(props);
9482
9500
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -9491,14 +9509,11 @@ class VueElement extends BaseClass {
9491
9509
  }
9492
9510
  }
9493
9511
  }
9494
- if (numberProps) {
9495
- this._numberProps = numberProps;
9496
- this._update();
9497
- }
9512
+ this._numberProps = numberProps;
9498
9513
  // check if there are props set pre-upgrade or connect
9499
9514
  for (const key of Object.keys(this)) {
9500
9515
  if (key[0] !== '_') {
9501
- this._setProp(key, this[key]);
9516
+ this._setProp(key, this[key], true, false);
9502
9517
  }
9503
9518
  }
9504
9519
  // defining getter/setters on prototype
@@ -9512,7 +9527,10 @@ class VueElement extends BaseClass {
9512
9527
  }
9513
9528
  });
9514
9529
  }
9530
+ // apply CSS
9515
9531
  this._applyStyles(styles);
9532
+ // initial render
9533
+ this._update();
9516
9534
  };
9517
9535
  const asyncDef = this._def.__asyncLoader;
9518
9536
  if (asyncDef) {
@@ -9538,10 +9556,10 @@ class VueElement extends BaseClass {
9538
9556
  /**
9539
9557
  * @internal
9540
9558
  */
9541
- _setProp(key, val, shouldReflect = true) {
9559
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
9542
9560
  if (val !== this._props[key]) {
9543
9561
  this._props[key] = val;
9544
- if (this._instance) {
9562
+ if (shouldUpdate && this._instance) {
9545
9563
  this._update();
9546
9564
  }
9547
9565
  // reflect