@vue/runtime-dom 3.2.20 → 3.2.24

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.
@@ -458,7 +458,7 @@ var VueRuntimeDOM = (function (exports) {
458
458
  let effectTrackDepth = 0;
459
459
  let trackOpBit = 1;
460
460
  /**
461
- * The bitwise track markers support at most 30 levels op recursion.
461
+ * The bitwise track markers support at most 30 levels of recursion.
462
462
  * This value is chosen to enable modern JS engines to use a SMI on all platforms.
463
463
  * When recursion depth is greater, fall back to using a full cleanup.
464
464
  */
@@ -779,7 +779,7 @@ var VueRuntimeDOM = (function (exports) {
779
779
  function createSetter(shallow = false) {
780
780
  return function set(target, key, value, receiver) {
781
781
  let oldValue = target[key];
782
- if (!shallow) {
782
+ if (!shallow && !isReadonly(value)) {
783
783
  value = toRaw(value);
784
784
  oldValue = toRaw(oldValue);
785
785
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
@@ -1574,22 +1574,33 @@ 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
  }
1585
1586
  function setDevtoolsHook(hook, target) {
1587
+ var _a, _b;
1586
1588
  exports.devtools = hook;
1587
1589
  if (exports.devtools) {
1588
1590
  exports.devtools.enabled = true;
1589
1591
  buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
1590
1592
  buffer = [];
1591
1593
  }
1592
- else {
1594
+ else if (
1595
+ // handle late devtools injection - only do this if we are in an actual
1596
+ // browser environment to avoid the timer handle stalling test runner exit
1597
+ // (#4815)
1598
+ // eslint-disable-next-line no-restricted-globals
1599
+ typeof window !== 'undefined' &&
1600
+ // some envs mock window but not fully
1601
+ window.HTMLElement &&
1602
+ // also exclude jsdom
1603
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
1593
1604
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1594
1605
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1595
1606
  replay.push((newHook) => {
@@ -1598,9 +1609,18 @@ var VueRuntimeDOM = (function (exports) {
1598
1609
  // clear buffer after 3s - the user probably doesn't have devtools installed
1599
1610
  // at all, and keeping the buffer will cause memory leaks (#4738)
1600
1611
  setTimeout(() => {
1601
- buffer = [];
1612
+ if (!exports.devtools) {
1613
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1614
+ devtoolsNotInstalled = true;
1615
+ buffer = [];
1616
+ }
1602
1617
  }, 3000);
1603
1618
  }
1619
+ else {
1620
+ // non-browser env, assume not installed
1621
+ devtoolsNotInstalled = true;
1622
+ buffer = [];
1623
+ }
1604
1624
  }
1605
1625
  function devtoolsInitApp(app, version) {
1606
1626
  emit("app:init" /* APP_INIT */, app, version, {
@@ -2674,7 +2694,8 @@ var VueRuntimeDOM = (function (exports) {
2674
2694
  const rawProps = toRaw(props);
2675
2695
  const { mode } = rawProps;
2676
2696
  // check mode
2677
- if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
2697
+ if (mode &&
2698
+ mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
2678
2699
  warn$1(`invalid <transition> mode: ${mode}`);
2679
2700
  }
2680
2701
  // at this point children has a guaranteed length of 1.
@@ -3314,7 +3335,7 @@ var VueRuntimeDOM = (function (exports) {
3314
3335
  }
3315
3336
  current = current.parent;
3316
3337
  }
3317
- hook();
3338
+ return hook();
3318
3339
  });
3319
3340
  injectHook(type, wrappedHook, target);
3320
3341
  // In addition to registering it on the target instance, we walk up the parent
@@ -3976,7 +3997,7 @@ var VueRuntimeDOM = (function (exports) {
3976
3997
  }
3977
3998
  }
3978
3999
  else if (!isEmitListener(instance.emitsOptions, key)) {
3979
- if (value !== attrs[key]) {
4000
+ if (!(key in attrs) || value !== attrs[key]) {
3980
4001
  attrs[key] = value;
3981
4002
  hasAttrsChanged = true;
3982
4003
  }
@@ -4388,7 +4409,7 @@ var VueRuntimeDOM = (function (exports) {
4388
4409
  [bar, this.y]
4389
4410
  ])
4390
4411
  */
4391
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
4412
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
4392
4413
  function validateDirectiveName(name) {
4393
4414
  if (isBuiltInDirective(name)) {
4394
4415
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -6305,8 +6326,8 @@ var VueRuntimeDOM = (function (exports) {
6305
6326
  *
6306
6327
  * #2080
6307
6328
  * Inside keyed `template` fragment static children, if a fragment is moved,
6308
- * the children will always moved so that need inherit el form previous nodes
6309
- * to ensure correct moved position.
6329
+ * the children will always be moved. Therefore, in order to ensure correct move
6330
+ * position, el should be inherited from previous nodes.
6310
6331
  */
6311
6332
  function traverseStaticChildren(n1, n2, shallow = false) {
6312
6333
  const ch1 = n1.children;
@@ -7086,7 +7107,8 @@ var VueRuntimeDOM = (function (exports) {
7086
7107
  else if (isOn(key)) {
7087
7108
  const existing = ret[key];
7088
7109
  const incoming = toMerge[key];
7089
- if (existing !== incoming) {
7110
+ if (existing !== incoming &&
7111
+ !(isArray(existing) && existing.includes(incoming))) {
7090
7112
  ret[key] = existing
7091
7113
  ? [].concat(existing, incoming)
7092
7114
  : incoming;
@@ -7289,23 +7311,23 @@ var VueRuntimeDOM = (function (exports) {
7289
7311
  const n = accessCache[key];
7290
7312
  if (n !== undefined) {
7291
7313
  switch (n) {
7292
- case 0 /* SETUP */:
7314
+ case 1 /* SETUP */:
7293
7315
  return setupState[key];
7294
- case 1 /* DATA */:
7316
+ case 2 /* DATA */:
7295
7317
  return data[key];
7296
- case 3 /* CONTEXT */:
7318
+ case 4 /* CONTEXT */:
7297
7319
  return ctx[key];
7298
- case 2 /* PROPS */:
7320
+ case 3 /* PROPS */:
7299
7321
  return props[key];
7300
7322
  // default: just fallthrough
7301
7323
  }
7302
7324
  }
7303
7325
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
7304
- accessCache[key] = 0 /* SETUP */;
7326
+ accessCache[key] = 1 /* SETUP */;
7305
7327
  return setupState[key];
7306
7328
  }
7307
7329
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
7308
- accessCache[key] = 1 /* DATA */;
7330
+ accessCache[key] = 2 /* DATA */;
7309
7331
  return data[key];
7310
7332
  }
7311
7333
  else if (
@@ -7313,15 +7335,15 @@ var VueRuntimeDOM = (function (exports) {
7313
7335
  // props
7314
7336
  (normalizedProps = instance.propsOptions[0]) &&
7315
7337
  hasOwn(normalizedProps, key)) {
7316
- accessCache[key] = 2 /* PROPS */;
7338
+ accessCache[key] = 3 /* PROPS */;
7317
7339
  return props[key];
7318
7340
  }
7319
7341
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
7320
- accessCache[key] = 3 /* CONTEXT */;
7342
+ accessCache[key] = 4 /* CONTEXT */;
7321
7343
  return ctx[key];
7322
7344
  }
7323
7345
  else if (shouldCacheAccess) {
7324
- accessCache[key] = 4 /* OTHER */;
7346
+ accessCache[key] = 0 /* OTHER */;
7325
7347
  }
7326
7348
  }
7327
7349
  const publicGetter = publicPropertiesMap[key];
@@ -7342,7 +7364,7 @@ var VueRuntimeDOM = (function (exports) {
7342
7364
  }
7343
7365
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
7344
7366
  // user may set custom properties to `this` that start with `$`
7345
- accessCache[key] = 3 /* CONTEXT */;
7367
+ accessCache[key] = 4 /* CONTEXT */;
7346
7368
  return ctx[key];
7347
7369
  }
7348
7370
  else if (
@@ -7403,7 +7425,7 @@ var VueRuntimeDOM = (function (exports) {
7403
7425
  },
7404
7426
  has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
7405
7427
  let normalizedProps;
7406
- return (accessCache[key] !== undefined ||
7428
+ return (!!accessCache[key] ||
7407
7429
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
7408
7430
  (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
7409
7431
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
@@ -8945,7 +8967,7 @@ var VueRuntimeDOM = (function (exports) {
8945
8967
  }
8946
8968
 
8947
8969
  // Core API ------------------------------------------------------------------
8948
- const version = "3.2.20";
8970
+ const version = "3.2.24";
8949
8971
  /**
8950
8972
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8951
8973
  * @internal
@@ -9067,16 +9089,8 @@ var VueRuntimeDOM = (function (exports) {
9067
9089
 
9068
9090
  function patchStyle(el, prev, next) {
9069
9091
  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 {
9092
+ const isCssString = isString(next);
9093
+ if (next && !isCssString) {
9080
9094
  for (const key in next) {
9081
9095
  setStyle(style, key, next[key]);
9082
9096
  }
@@ -9088,11 +9102,22 @@ var VueRuntimeDOM = (function (exports) {
9088
9102
  }
9089
9103
  }
9090
9104
  }
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;
9105
+ else {
9106
+ const currentDisplay = style.display;
9107
+ if (isCssString) {
9108
+ if (prev !== next) {
9109
+ style.cssText = next;
9110
+ }
9111
+ }
9112
+ else if (prev) {
9113
+ el.removeAttribute('style');
9114
+ }
9115
+ // indicates that the `display` of the element is controlled by `v-show`,
9116
+ // so we always keep the current `display` value regardless of the `style`
9117
+ // value, thus handing over control to `v-show`.
9118
+ if ('_vod' in el) {
9119
+ style.display = currentDisplay;
9120
+ }
9096
9121
  }
9097
9122
  }
9098
9123
  const importantRE = /\s*!important$/;
@@ -9175,12 +9200,19 @@ var VueRuntimeDOM = (function (exports) {
9175
9200
  el[key] = value == null ? '' : value;
9176
9201
  return;
9177
9202
  }
9178
- if (key === 'value' && el.tagName !== 'PROGRESS') {
9203
+ if (key === 'value' &&
9204
+ el.tagName !== 'PROGRESS' &&
9205
+ // custom elements may use _value internally
9206
+ !el.tagName.includes('-')) {
9179
9207
  // store value as _value as well since
9180
9208
  // non-string values will be stringified.
9181
9209
  el._value = value;
9182
9210
  const newValue = value == null ? '' : value;
9183
- if (el.value !== newValue) {
9211
+ if (el.value !== newValue ||
9212
+ // #4956: always set for OPTION elements because its value falls back to
9213
+ // textContent if no value attribute is present. And setting .value for
9214
+ // OPTION has no side effect
9215
+ el.tagName === 'OPTION') {
9184
9216
  el.value = newValue;
9185
9217
  }
9186
9218
  if (value == null) {
@@ -9438,22 +9470,11 @@ var VueRuntimeDOM = (function (exports) {
9438
9470
  }
9439
9471
  this.attachShadow({ mode: 'open' });
9440
9472
  }
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
9473
  }
9452
9474
  connectedCallback() {
9453
9475
  this._connected = true;
9454
9476
  if (!this._instance) {
9455
9477
  this._resolveDef();
9456
- this._update();
9457
9478
  }
9458
9479
  }
9459
9480
  disconnectedCallback() {
@@ -9472,8 +9493,18 @@ var VueRuntimeDOM = (function (exports) {
9472
9493
  if (this._resolved) {
9473
9494
  return;
9474
9495
  }
9496
+ this._resolved = true;
9497
+ // set initial attrs
9498
+ for (let i = 0; i < this.attributes.length; i++) {
9499
+ this._setAttr(this.attributes[i].name);
9500
+ }
9501
+ // watch future attr changes
9502
+ new MutationObserver(mutations => {
9503
+ for (const m of mutations) {
9504
+ this._setAttr(m.attributeName);
9505
+ }
9506
+ }).observe(this, { attributes: true });
9475
9507
  const resolve = (def) => {
9476
- this._resolved = true;
9477
9508
  const { props, styles } = def;
9478
9509
  const hasOptions = !isArray(props);
9479
9510
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -9488,14 +9519,11 @@ var VueRuntimeDOM = (function (exports) {
9488
9519
  }
9489
9520
  }
9490
9521
  }
9491
- if (numberProps) {
9492
- this._numberProps = numberProps;
9493
- this._update();
9494
- }
9522
+ this._numberProps = numberProps;
9495
9523
  // check if there are props set pre-upgrade or connect
9496
9524
  for (const key of Object.keys(this)) {
9497
9525
  if (key[0] !== '_') {
9498
- this._setProp(key, this[key]);
9526
+ this._setProp(key, this[key], true, false);
9499
9527
  }
9500
9528
  }
9501
9529
  // defining getter/setters on prototype
@@ -9509,7 +9537,10 @@ var VueRuntimeDOM = (function (exports) {
9509
9537
  }
9510
9538
  });
9511
9539
  }
9540
+ // apply CSS
9512
9541
  this._applyStyles(styles);
9542
+ // initial render
9543
+ this._update();
9513
9544
  };
9514
9545
  const asyncDef = this._def.__asyncLoader;
9515
9546
  if (asyncDef) {
@@ -9535,10 +9566,10 @@ var VueRuntimeDOM = (function (exports) {
9535
9566
  /**
9536
9567
  * @internal
9537
9568
  */
9538
- _setProp(key, val, shouldReflect = true) {
9569
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
9539
9570
  if (val !== this._props[key]) {
9540
9571
  this._props[key] = val;
9541
- if (this._instance) {
9572
+ if (shouldUpdate && this._instance) {
9542
9573
  this._update();
9543
9574
  }
9544
9575
  // reflect
@@ -9567,7 +9598,7 @@ var VueRuntimeDOM = (function (exports) {
9567
9598
  // HMR
9568
9599
  {
9569
9600
  instance.ceReload = newStyles => {
9570
- // alawys reset styles
9601
+ // always reset styles
9571
9602
  if (this._styles) {
9572
9603
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
9573
9604
  this._styles.length = 0;