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.
@@ -1647,11 +1647,12 @@ function tryWrap(fn) {
1647
1647
 
1648
1648
  let devtools;
1649
1649
  let buffer = [];
1650
+ let devtoolsNotInstalled = false;
1650
1651
  function emit(event, ...args) {
1651
1652
  if (devtools) {
1652
1653
  devtools.emit(event, ...args);
1653
1654
  }
1654
- else {
1655
+ else if (!devtoolsNotInstalled) {
1655
1656
  buffer.push({ event, args });
1656
1657
  }
1657
1658
  }
@@ -1662,7 +1663,13 @@ function setDevtoolsHook(hook, target) {
1662
1663
  buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1663
1664
  buffer = [];
1664
1665
  }
1665
- else {
1666
+ else if (
1667
+ // handle late devtools injection - only do this if we are in an actual
1668
+ // browser environment to avoid the timer handle stalling test runner exit
1669
+ // (#4815)
1670
+ // eslint-disable-next-line no-restricted-globals
1671
+ typeof window !== 'undefined' &&
1672
+ !navigator.userAgent.includes('jsdom')) {
1666
1673
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1667
1674
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1668
1675
  replay.push((newHook) => {
@@ -1671,9 +1678,18 @@ function setDevtoolsHook(hook, target) {
1671
1678
  // clear buffer after 3s - the user probably doesn't have devtools installed
1672
1679
  // at all, and keeping the buffer will cause memory leaks (#4738)
1673
1680
  setTimeout(() => {
1674
- buffer = [];
1681
+ if (!devtools) {
1682
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1683
+ devtoolsNotInstalled = true;
1684
+ buffer = [];
1685
+ }
1675
1686
  }, 3000);
1676
1687
  }
1688
+ else {
1689
+ // non-browser env, assume not installed
1690
+ devtoolsNotInstalled = true;
1691
+ buffer = [];
1692
+ }
1677
1693
  }
1678
1694
  function devtoolsInitApp(app, version) {
1679
1695
  emit("app:init" /* APP_INIT */, app, version, {
@@ -4461,7 +4477,7 @@ return withDirectives(h(comp), [
4461
4477
  [bar, this.y]
4462
4478
  ])
4463
4479
  */
4464
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
4480
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
4465
4481
  function validateDirectiveName(name) {
4466
4482
  if (isBuiltInDirective(name)) {
4467
4483
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -9023,7 +9039,7 @@ function isMemoSame(cached, memo) {
9023
9039
  }
9024
9040
 
9025
9041
  // Core API ------------------------------------------------------------------
9026
- const version = "3.2.20";
9042
+ const version = "3.2.21";
9027
9043
  /**
9028
9044
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9029
9045
  * @internal
@@ -9145,16 +9161,8 @@ function patchClass(el, value, isSVG) {
9145
9161
 
9146
9162
  function patchStyle(el, prev, next) {
9147
9163
  const style = el.style;
9148
- const currentDisplay = style.display;
9149
- if (!next) {
9150
- el.removeAttribute('style');
9151
- }
9152
- else if (isString(next)) {
9153
- if (prev !== next) {
9154
- style.cssText = next;
9155
- }
9156
- }
9157
- else {
9164
+ const isCssString = isString(next);
9165
+ if (next && !isCssString) {
9158
9166
  for (const key in next) {
9159
9167
  setStyle(style, key, next[key]);
9160
9168
  }
@@ -9166,11 +9174,22 @@ function patchStyle(el, prev, next) {
9166
9174
  }
9167
9175
  }
9168
9176
  }
9169
- // indicates that the `display` of the element is controlled by `v-show`,
9170
- // so we always keep the current `display` value regardless of the `style` value,
9171
- // thus handing over control to `v-show`.
9172
- if ('_vod' in el) {
9173
- style.display = currentDisplay;
9177
+ else {
9178
+ const currentDisplay = style.display;
9179
+ if (isCssString) {
9180
+ if (prev !== next) {
9181
+ style.cssText = next;
9182
+ }
9183
+ }
9184
+ else if (prev) {
9185
+ el.removeAttribute('style');
9186
+ }
9187
+ // indicates that the `display` of the element is controlled by `v-show`,
9188
+ // so we always keep the current `display` value regardless of the `style`
9189
+ // value, thus handing over control to `v-show`.
9190
+ if ('_vod' in el) {
9191
+ style.display = currentDisplay;
9192
+ }
9174
9193
  }
9175
9194
  }
9176
9195
  const importantRE = /\s*!important$/;
@@ -9516,22 +9535,11 @@ class VueElement extends BaseClass {
9516
9535
  }
9517
9536
  this.attachShadow({ mode: 'open' });
9518
9537
  }
9519
- // set initial attrs
9520
- for (let i = 0; i < this.attributes.length; i++) {
9521
- this._setAttr(this.attributes[i].name);
9522
- }
9523
- // watch future attr changes
9524
- new MutationObserver(mutations => {
9525
- for (const m of mutations) {
9526
- this._setAttr(m.attributeName);
9527
- }
9528
- }).observe(this, { attributes: true });
9529
9538
  }
9530
9539
  connectedCallback() {
9531
9540
  this._connected = true;
9532
9541
  if (!this._instance) {
9533
9542
  this._resolveDef();
9534
- this._update();
9535
9543
  }
9536
9544
  }
9537
9545
  disconnectedCallback() {
@@ -9550,8 +9558,18 @@ class VueElement extends BaseClass {
9550
9558
  if (this._resolved) {
9551
9559
  return;
9552
9560
  }
9561
+ this._resolved = true;
9562
+ // set initial attrs
9563
+ for (let i = 0; i < this.attributes.length; i++) {
9564
+ this._setAttr(this.attributes[i].name);
9565
+ }
9566
+ // watch future attr changes
9567
+ new MutationObserver(mutations => {
9568
+ for (const m of mutations) {
9569
+ this._setAttr(m.attributeName);
9570
+ }
9571
+ }).observe(this, { attributes: true });
9553
9572
  const resolve = (def) => {
9554
- this._resolved = true;
9555
9573
  const { props, styles } = def;
9556
9574
  const hasOptions = !isArray(props);
9557
9575
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -9566,14 +9584,11 @@ class VueElement extends BaseClass {
9566
9584
  }
9567
9585
  }
9568
9586
  }
9569
- if (numberProps) {
9570
- this._numberProps = numberProps;
9571
- this._update();
9572
- }
9587
+ this._numberProps = numberProps;
9573
9588
  // check if there are props set pre-upgrade or connect
9574
9589
  for (const key of Object.keys(this)) {
9575
9590
  if (key[0] !== '_') {
9576
- this._setProp(key, this[key]);
9591
+ this._setProp(key, this[key], true, false);
9577
9592
  }
9578
9593
  }
9579
9594
  // defining getter/setters on prototype
@@ -9587,7 +9602,10 @@ class VueElement extends BaseClass {
9587
9602
  }
9588
9603
  });
9589
9604
  }
9605
+ // apply CSS
9590
9606
  this._applyStyles(styles);
9607
+ // initial render
9608
+ this._update();
9591
9609
  };
9592
9610
  const asyncDef = this._def.__asyncLoader;
9593
9611
  if (asyncDef) {
@@ -9613,10 +9631,10 @@ class VueElement extends BaseClass {
9613
9631
  /**
9614
9632
  * @internal
9615
9633
  */
9616
- _setProp(key, val, shouldReflect = true) {
9634
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
9617
9635
  if (val !== this._props[key]) {
9618
9636
  this._props[key] = val;
9619
- if (this._instance) {
9637
+ if (shouldUpdate && this._instance) {
9620
9638
  this._update();
9621
9639
  }
9622
9640
  // reflect