@vue/compat 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 Vue = (function () {
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 Vue = (function () {
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)) {
@@ -1575,22 +1575,33 @@ var Vue = (function () {
1575
1575
 
1576
1576
  let devtools;
1577
1577
  let buffer = [];
1578
+ let devtoolsNotInstalled = false;
1578
1579
  function emit(event, ...args) {
1579
1580
  if (devtools) {
1580
1581
  devtools.emit(event, ...args);
1581
1582
  }
1582
- else {
1583
+ else if (!devtoolsNotInstalled) {
1583
1584
  buffer.push({ event, args });
1584
1585
  }
1585
1586
  }
1586
1587
  function setDevtoolsHook(hook, target) {
1588
+ var _a, _b;
1587
1589
  devtools = hook;
1588
1590
  if (devtools) {
1589
1591
  devtools.enabled = true;
1590
1592
  buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1591
1593
  buffer = [];
1592
1594
  }
1593
- else {
1595
+ else if (
1596
+ // handle late devtools injection - only do this if we are in an actual
1597
+ // browser environment to avoid the timer handle stalling test runner exit
1598
+ // (#4815)
1599
+ // eslint-disable-next-line no-restricted-globals
1600
+ typeof window !== 'undefined' &&
1601
+ // some envs mock window but not fully
1602
+ window.HTMLElement &&
1603
+ // also exclude jsdom
1604
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
1594
1605
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1595
1606
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1596
1607
  replay.push((newHook) => {
@@ -1599,9 +1610,18 @@ var Vue = (function () {
1599
1610
  // clear buffer after 3s - the user probably doesn't have devtools installed
1600
1611
  // at all, and keeping the buffer will cause memory leaks (#4738)
1601
1612
  setTimeout(() => {
1602
- buffer = [];
1613
+ if (!devtools) {
1614
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1615
+ devtoolsNotInstalled = true;
1616
+ buffer = [];
1617
+ }
1603
1618
  }, 3000);
1604
1619
  }
1620
+ else {
1621
+ // non-browser env, assume not installed
1622
+ devtoolsNotInstalled = true;
1623
+ buffer = [];
1624
+ }
1605
1625
  }
1606
1626
  function devtoolsInitApp(app, version) {
1607
1627
  emit("app:init" /* APP_INIT */, app, version, {
@@ -3215,7 +3235,8 @@ var Vue = (function () {
3215
3235
  const rawProps = toRaw(props);
3216
3236
  const { mode } = rawProps;
3217
3237
  // check mode
3218
- if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
3238
+ if (mode &&
3239
+ mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3219
3240
  warn$1(`invalid <transition> mode: ${mode}`);
3220
3241
  }
3221
3242
  // at this point children has a guaranteed length of 1.
@@ -3861,7 +3882,7 @@ var Vue = (function () {
3861
3882
  }
3862
3883
  current = current.parent;
3863
3884
  }
3864
- hook();
3885
+ return hook();
3865
3886
  });
3866
3887
  injectHook(type, wrappedHook, target);
3867
3888
  // In addition to registering it on the target instance, we walk up the parent
@@ -4639,7 +4660,7 @@ var Vue = (function () {
4639
4660
  continue;
4640
4661
  }
4641
4662
  }
4642
- if (value !== attrs[key]) {
4663
+ if (!(key in attrs) || value !== attrs[key]) {
4643
4664
  attrs[key] = value;
4644
4665
  hasAttrsChanged = true;
4645
4666
  }
@@ -5085,7 +5106,7 @@ var Vue = (function () {
5085
5106
  [bar, this.y]
5086
5107
  ])
5087
5108
  */
5088
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
5109
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
5089
5110
  function validateDirectiveName(name) {
5090
5111
  if (isBuiltInDirective(name)) {
5091
5112
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -5220,7 +5241,7 @@ var Vue = (function () {
5220
5241
  return vm;
5221
5242
  }
5222
5243
  }
5223
- Vue.version = "3.2.20";
5244
+ Vue.version = "3.2.24";
5224
5245
  Vue.config = singletonApp.config;
5225
5246
  Vue.use = (p, ...options) => {
5226
5247
  if (p && isFunction(p.install)) {
@@ -6666,7 +6687,7 @@ var Vue = (function () {
6666
6687
  }
6667
6688
  };
6668
6689
  const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
6669
- // 2.x compat may pre-creaate the component instance before actually
6690
+ // 2.x compat may pre-create the component instance before actually
6670
6691
  // mounting
6671
6692
  const compatMountInstance = initialVNode.isCompatRoot && initialVNode.component;
6672
6693
  const instance = compatMountInstance ||
@@ -7546,8 +7567,8 @@ var Vue = (function () {
7546
7567
  *
7547
7568
  * #2080
7548
7569
  * Inside keyed `template` fragment static children, if a fragment is moved,
7549
- * the children will always moved so that need inherit el form previous nodes
7550
- * to ensure correct moved position.
7570
+ * the children will always be moved. Therefore, in order to ensure correct move
7571
+ * position, el should be inherited from previous nodes.
7551
7572
  */
7552
7573
  function traverseStaticChildren(n1, n2, shallow = false) {
7553
7574
  const ch1 = n1.children;
@@ -8185,6 +8206,7 @@ var Vue = (function () {
8185
8206
  };
8186
8207
  Func.props = comp.props;
8187
8208
  Func.displayName = comp.name;
8209
+ Func.compatConfig = comp.compatConfig;
8188
8210
  // v2 functional components do not inherit attrs
8189
8211
  Func.inheritAttrs = false;
8190
8212
  normalizedFunctionalComponentMap.set(comp, Func);
@@ -8674,7 +8696,8 @@ var Vue = (function () {
8674
8696
  else if (isOn(key)) {
8675
8697
  const existing = ret[key];
8676
8698
  const incoming = toMerge[key];
8677
- if (existing !== incoming) {
8699
+ if (existing !== incoming &&
8700
+ !(isArray(existing) && existing.includes(incoming))) {
8678
8701
  ret[key] = existing
8679
8702
  ? [].concat(existing, incoming)
8680
8703
  : incoming;
@@ -9118,23 +9141,23 @@ var Vue = (function () {
9118
9141
  const n = accessCache[key];
9119
9142
  if (n !== undefined) {
9120
9143
  switch (n) {
9121
- case 0 /* SETUP */:
9144
+ case 1 /* SETUP */:
9122
9145
  return setupState[key];
9123
- case 1 /* DATA */:
9146
+ case 2 /* DATA */:
9124
9147
  return data[key];
9125
- case 3 /* CONTEXT */:
9148
+ case 4 /* CONTEXT */:
9126
9149
  return ctx[key];
9127
- case 2 /* PROPS */:
9150
+ case 3 /* PROPS */:
9128
9151
  return props[key];
9129
9152
  // default: just fallthrough
9130
9153
  }
9131
9154
  }
9132
9155
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
9133
- accessCache[key] = 0 /* SETUP */;
9156
+ accessCache[key] = 1 /* SETUP */;
9134
9157
  return setupState[key];
9135
9158
  }
9136
9159
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
9137
- accessCache[key] = 1 /* DATA */;
9160
+ accessCache[key] = 2 /* DATA */;
9138
9161
  return data[key];
9139
9162
  }
9140
9163
  else if (
@@ -9142,15 +9165,15 @@ var Vue = (function () {
9142
9165
  // props
9143
9166
  (normalizedProps = instance.propsOptions[0]) &&
9144
9167
  hasOwn(normalizedProps, key)) {
9145
- accessCache[key] = 2 /* PROPS */;
9168
+ accessCache[key] = 3 /* PROPS */;
9146
9169
  return props[key];
9147
9170
  }
9148
9171
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9149
- accessCache[key] = 3 /* CONTEXT */;
9172
+ accessCache[key] = 4 /* CONTEXT */;
9150
9173
  return ctx[key];
9151
9174
  }
9152
9175
  else if (shouldCacheAccess) {
9153
- accessCache[key] = 4 /* OTHER */;
9176
+ accessCache[key] = 0 /* OTHER */;
9154
9177
  }
9155
9178
  }
9156
9179
  const publicGetter = publicPropertiesMap[key];
@@ -9171,7 +9194,7 @@ var Vue = (function () {
9171
9194
  }
9172
9195
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9173
9196
  // user may set custom properties to `this` that start with `$`
9174
- accessCache[key] = 3 /* CONTEXT */;
9197
+ accessCache[key] = 4 /* CONTEXT */;
9175
9198
  return ctx[key];
9176
9199
  }
9177
9200
  else if (
@@ -9239,7 +9262,7 @@ var Vue = (function () {
9239
9262
  },
9240
9263
  has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
9241
9264
  let normalizedProps;
9242
- return (accessCache[key] !== undefined ||
9265
+ return (!!accessCache[key] ||
9243
9266
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
9244
9267
  (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
9245
9268
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
@@ -10809,7 +10832,7 @@ var Vue = (function () {
10809
10832
  }
10810
10833
 
10811
10834
  // Core API ------------------------------------------------------------------
10812
- const version = "3.2.20";
10835
+ const version = "3.2.24";
10813
10836
  /**
10814
10837
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10815
10838
  * @internal
@@ -10938,16 +10961,8 @@ var Vue = (function () {
10938
10961
 
10939
10962
  function patchStyle(el, prev, next) {
10940
10963
  const style = el.style;
10941
- const currentDisplay = style.display;
10942
- if (!next) {
10943
- el.removeAttribute('style');
10944
- }
10945
- else if (isString(next)) {
10946
- if (prev !== next) {
10947
- style.cssText = next;
10948
- }
10949
- }
10950
- else {
10964
+ const isCssString = isString(next);
10965
+ if (next && !isCssString) {
10951
10966
  for (const key in next) {
10952
10967
  setStyle(style, key, next[key]);
10953
10968
  }
@@ -10959,11 +10974,22 @@ var Vue = (function () {
10959
10974
  }
10960
10975
  }
10961
10976
  }
10962
- // indicates that the `display` of the element is controlled by `v-show`,
10963
- // so we always keep the current `display` value regardless of the `style` value,
10964
- // thus handing over control to `v-show`.
10965
- if ('_vod' in el) {
10966
- style.display = currentDisplay;
10977
+ else {
10978
+ const currentDisplay = style.display;
10979
+ if (isCssString) {
10980
+ if (prev !== next) {
10981
+ style.cssText = next;
10982
+ }
10983
+ }
10984
+ else if (prev) {
10985
+ el.removeAttribute('style');
10986
+ }
10987
+ // indicates that the `display` of the element is controlled by `v-show`,
10988
+ // so we always keep the current `display` value regardless of the `style`
10989
+ // value, thus handing over control to `v-show`.
10990
+ if ('_vod' in el) {
10991
+ style.display = currentDisplay;
10992
+ }
10967
10993
  }
10968
10994
  }
10969
10995
  const importantRE = /\s*!important$/;
@@ -11073,12 +11099,19 @@ var Vue = (function () {
11073
11099
  el[key] = value == null ? '' : value;
11074
11100
  return;
11075
11101
  }
11076
- if (key === 'value' && el.tagName !== 'PROGRESS') {
11102
+ if (key === 'value' &&
11103
+ el.tagName !== 'PROGRESS' &&
11104
+ // custom elements may use _value internally
11105
+ !el.tagName.includes('-')) {
11077
11106
  // store value as _value as well since
11078
11107
  // non-string values will be stringified.
11079
11108
  el._value = value;
11080
11109
  const newValue = value == null ? '' : value;
11081
- if (el.value !== newValue) {
11110
+ if (el.value !== newValue ||
11111
+ // #4956: always set for OPTION elements because its value falls back to
11112
+ // textContent if no value attribute is present. And setting .value for
11113
+ // OPTION has no side effect
11114
+ el.tagName === 'OPTION') {
11082
11115
  el.value = newValue;
11083
11116
  }
11084
11117
  if (value == null) {
@@ -11346,22 +11379,11 @@ var Vue = (function () {
11346
11379
  }
11347
11380
  this.attachShadow({ mode: 'open' });
11348
11381
  }
11349
- // set initial attrs
11350
- for (let i = 0; i < this.attributes.length; i++) {
11351
- this._setAttr(this.attributes[i].name);
11352
- }
11353
- // watch future attr changes
11354
- new MutationObserver(mutations => {
11355
- for (const m of mutations) {
11356
- this._setAttr(m.attributeName);
11357
- }
11358
- }).observe(this, { attributes: true });
11359
11382
  }
11360
11383
  connectedCallback() {
11361
11384
  this._connected = true;
11362
11385
  if (!this._instance) {
11363
11386
  this._resolveDef();
11364
- this._update();
11365
11387
  }
11366
11388
  }
11367
11389
  disconnectedCallback() {
@@ -11380,8 +11402,18 @@ var Vue = (function () {
11380
11402
  if (this._resolved) {
11381
11403
  return;
11382
11404
  }
11405
+ this._resolved = true;
11406
+ // set initial attrs
11407
+ for (let i = 0; i < this.attributes.length; i++) {
11408
+ this._setAttr(this.attributes[i].name);
11409
+ }
11410
+ // watch future attr changes
11411
+ new MutationObserver(mutations => {
11412
+ for (const m of mutations) {
11413
+ this._setAttr(m.attributeName);
11414
+ }
11415
+ }).observe(this, { attributes: true });
11383
11416
  const resolve = (def) => {
11384
- this._resolved = true;
11385
11417
  const { props, styles } = def;
11386
11418
  const hasOptions = !isArray(props);
11387
11419
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -11396,14 +11428,11 @@ var Vue = (function () {
11396
11428
  }
11397
11429
  }
11398
11430
  }
11399
- if (numberProps) {
11400
- this._numberProps = numberProps;
11401
- this._update();
11402
- }
11431
+ this._numberProps = numberProps;
11403
11432
  // check if there are props set pre-upgrade or connect
11404
11433
  for (const key of Object.keys(this)) {
11405
11434
  if (key[0] !== '_') {
11406
- this._setProp(key, this[key]);
11435
+ this._setProp(key, this[key], true, false);
11407
11436
  }
11408
11437
  }
11409
11438
  // defining getter/setters on prototype
@@ -11417,7 +11446,10 @@ var Vue = (function () {
11417
11446
  }
11418
11447
  });
11419
11448
  }
11449
+ // apply CSS
11420
11450
  this._applyStyles(styles);
11451
+ // initial render
11452
+ this._update();
11421
11453
  };
11422
11454
  const asyncDef = this._def.__asyncLoader;
11423
11455
  if (asyncDef) {
@@ -11443,10 +11475,10 @@ var Vue = (function () {
11443
11475
  /**
11444
11476
  * @internal
11445
11477
  */
11446
- _setProp(key, val, shouldReflect = true) {
11478
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
11447
11479
  if (val !== this._props[key]) {
11448
11480
  this._props[key] = val;
11449
- if (this._instance) {
11481
+ if (shouldUpdate && this._instance) {
11450
11482
  this._update();
11451
11483
  }
11452
11484
  // reflect
@@ -11475,7 +11507,7 @@ var Vue = (function () {
11475
11507
  // HMR
11476
11508
  {
11477
11509
  instance.ceReload = newStyles => {
11478
- // alawys reset styles
11510
+ // always reset styles
11479
11511
  if (this._styles) {
11480
11512
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
11481
11513
  this._styles.length = 0;