@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.
@@ -1574,11 +1574,12 @@ var VueRuntimeDOM = (function (exports) {
1574
1574
  }
1575
1575
 
1576
1576
  let buffer = [];
1577
+ let devtoolsNotInstalled = false;
1577
1578
  function emit(event, ...args) {
1578
1579
  if (exports.devtools) {
1579
1580
  exports.devtools.emit(event, ...args);
1580
1581
  }
1581
- else {
1582
+ else if (!devtoolsNotInstalled) {
1582
1583
  buffer.push({ event, args });
1583
1584
  }
1584
1585
  }
@@ -1589,7 +1590,13 @@ var VueRuntimeDOM = (function (exports) {
1589
1590
  buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
1590
1591
  buffer = [];
1591
1592
  }
1592
- else {
1593
+ else if (
1594
+ // handle late devtools injection - only do this if we are in an actual
1595
+ // browser environment to avoid the timer handle stalling test runner exit
1596
+ // (#4815)
1597
+ // eslint-disable-next-line no-restricted-globals
1598
+ typeof window !== 'undefined' &&
1599
+ !navigator.userAgent.includes('jsdom')) {
1593
1600
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1594
1601
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1595
1602
  replay.push((newHook) => {
@@ -1598,9 +1605,18 @@ var VueRuntimeDOM = (function (exports) {
1598
1605
  // clear buffer after 3s - the user probably doesn't have devtools installed
1599
1606
  // at all, and keeping the buffer will cause memory leaks (#4738)
1600
1607
  setTimeout(() => {
1601
- buffer = [];
1608
+ if (!exports.devtools) {
1609
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1610
+ devtoolsNotInstalled = true;
1611
+ buffer = [];
1612
+ }
1602
1613
  }, 3000);
1603
1614
  }
1615
+ else {
1616
+ // non-browser env, assume not installed
1617
+ devtoolsNotInstalled = true;
1618
+ buffer = [];
1619
+ }
1604
1620
  }
1605
1621
  function devtoolsInitApp(app, version) {
1606
1622
  emit("app:init" /* APP_INIT */, app, version, {
@@ -4388,7 +4404,7 @@ var VueRuntimeDOM = (function (exports) {
4388
4404
  [bar, this.y]
4389
4405
  ])
4390
4406
  */
4391
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
4407
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
4392
4408
  function validateDirectiveName(name) {
4393
4409
  if (isBuiltInDirective(name)) {
4394
4410
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -8945,7 +8961,7 @@ var VueRuntimeDOM = (function (exports) {
8945
8961
  }
8946
8962
 
8947
8963
  // Core API ------------------------------------------------------------------
8948
- const version = "3.2.20";
8964
+ const version = "3.2.21";
8949
8965
  /**
8950
8966
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8951
8967
  * @internal
@@ -9067,16 +9083,8 @@ var VueRuntimeDOM = (function (exports) {
9067
9083
 
9068
9084
  function patchStyle(el, prev, next) {
9069
9085
  const style = el.style;
9070
- const currentDisplay = style.display;
9071
- if (!next) {
9072
- el.removeAttribute('style');
9073
- }
9074
- else if (isString(next)) {
9075
- if (prev !== next) {
9076
- style.cssText = next;
9077
- }
9078
- }
9079
- else {
9086
+ const isCssString = isString(next);
9087
+ if (next && !isCssString) {
9080
9088
  for (const key in next) {
9081
9089
  setStyle(style, key, next[key]);
9082
9090
  }
@@ -9088,11 +9096,22 @@ var VueRuntimeDOM = (function (exports) {
9088
9096
  }
9089
9097
  }
9090
9098
  }
9091
- // indicates that the `display` of the element is controlled by `v-show`,
9092
- // so we always keep the current `display` value regardless of the `style` value,
9093
- // thus handing over control to `v-show`.
9094
- if ('_vod' in el) {
9095
- style.display = currentDisplay;
9099
+ else {
9100
+ const currentDisplay = style.display;
9101
+ if (isCssString) {
9102
+ if (prev !== next) {
9103
+ style.cssText = next;
9104
+ }
9105
+ }
9106
+ else if (prev) {
9107
+ el.removeAttribute('style');
9108
+ }
9109
+ // indicates that the `display` of the element is controlled by `v-show`,
9110
+ // so we always keep the current `display` value regardless of the `style`
9111
+ // value, thus handing over control to `v-show`.
9112
+ if ('_vod' in el) {
9113
+ style.display = currentDisplay;
9114
+ }
9096
9115
  }
9097
9116
  }
9098
9117
  const importantRE = /\s*!important$/;
@@ -9438,22 +9457,11 @@ var VueRuntimeDOM = (function (exports) {
9438
9457
  }
9439
9458
  this.attachShadow({ mode: 'open' });
9440
9459
  }
9441
- // set initial attrs
9442
- for (let i = 0; i < this.attributes.length; i++) {
9443
- this._setAttr(this.attributes[i].name);
9444
- }
9445
- // watch future attr changes
9446
- new MutationObserver(mutations => {
9447
- for (const m of mutations) {
9448
- this._setAttr(m.attributeName);
9449
- }
9450
- }).observe(this, { attributes: true });
9451
9460
  }
9452
9461
  connectedCallback() {
9453
9462
  this._connected = true;
9454
9463
  if (!this._instance) {
9455
9464
  this._resolveDef();
9456
- this._update();
9457
9465
  }
9458
9466
  }
9459
9467
  disconnectedCallback() {
@@ -9472,8 +9480,18 @@ var VueRuntimeDOM = (function (exports) {
9472
9480
  if (this._resolved) {
9473
9481
  return;
9474
9482
  }
9483
+ this._resolved = true;
9484
+ // set initial attrs
9485
+ for (let i = 0; i < this.attributes.length; i++) {
9486
+ this._setAttr(this.attributes[i].name);
9487
+ }
9488
+ // watch future attr changes
9489
+ new MutationObserver(mutations => {
9490
+ for (const m of mutations) {
9491
+ this._setAttr(m.attributeName);
9492
+ }
9493
+ }).observe(this, { attributes: true });
9475
9494
  const resolve = (def) => {
9476
- this._resolved = true;
9477
9495
  const { props, styles } = def;
9478
9496
  const hasOptions = !isArray(props);
9479
9497
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -9488,14 +9506,11 @@ var VueRuntimeDOM = (function (exports) {
9488
9506
  }
9489
9507
  }
9490
9508
  }
9491
- if (numberProps) {
9492
- this._numberProps = numberProps;
9493
- this._update();
9494
- }
9509
+ this._numberProps = numberProps;
9495
9510
  // check if there are props set pre-upgrade or connect
9496
9511
  for (const key of Object.keys(this)) {
9497
9512
  if (key[0] !== '_') {
9498
- this._setProp(key, this[key]);
9513
+ this._setProp(key, this[key], true, false);
9499
9514
  }
9500
9515
  }
9501
9516
  // defining getter/setters on prototype
@@ -9509,7 +9524,10 @@ var VueRuntimeDOM = (function (exports) {
9509
9524
  }
9510
9525
  });
9511
9526
  }
9527
+ // apply CSS
9512
9528
  this._applyStyles(styles);
9529
+ // initial render
9530
+ this._update();
9513
9531
  };
9514
9532
  const asyncDef = this._def.__asyncLoader;
9515
9533
  if (asyncDef) {
@@ -9535,10 +9553,10 @@ var VueRuntimeDOM = (function (exports) {
9535
9553
  /**
9536
9554
  * @internal
9537
9555
  */
9538
- _setProp(key, val, shouldReflect = true) {
9556
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
9539
9557
  if (val !== this._props[key]) {
9540
9558
  this._props[key] = val;
9541
- if (this._instance) {
9559
+ if (shouldUpdate && this._instance) {
9542
9560
  this._update();
9543
9561
  }
9544
9562
  // reflect