vue 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.
@@ -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