@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.
@@ -533,7 +533,7 @@ var Vue = (function () {
533
533
  let effectTrackDepth = 0;
534
534
  let trackOpBit = 1;
535
535
  /**
536
- * The bitwise track markers support at most 30 levels op recursion.
536
+ * The bitwise track markers support at most 30 levels of recursion.
537
537
  * This value is chosen to enable modern JS engines to use a SMI on all platforms.
538
538
  * When recursion depth is greater, fall back to using a full cleanup.
539
539
  */
@@ -854,7 +854,7 @@ var Vue = (function () {
854
854
  function createSetter(shallow = false) {
855
855
  return function set(target, key, value, receiver) {
856
856
  let oldValue = target[key];
857
- if (!shallow) {
857
+ if (!shallow && !isReadonly(value)) {
858
858
  value = toRaw(value);
859
859
  oldValue = toRaw(oldValue);
860
860
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
@@ -1650,22 +1650,33 @@ var Vue = (function () {
1650
1650
 
1651
1651
  let devtools;
1652
1652
  let buffer = [];
1653
+ let devtoolsNotInstalled = false;
1653
1654
  function emit(event, ...args) {
1654
1655
  if (devtools) {
1655
1656
  devtools.emit(event, ...args);
1656
1657
  }
1657
- else {
1658
+ else if (!devtoolsNotInstalled) {
1658
1659
  buffer.push({ event, args });
1659
1660
  }
1660
1661
  }
1661
1662
  function setDevtoolsHook(hook, target) {
1663
+ var _a, _b;
1662
1664
  devtools = hook;
1663
1665
  if (devtools) {
1664
1666
  devtools.enabled = true;
1665
1667
  buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1666
1668
  buffer = [];
1667
1669
  }
1668
- else {
1670
+ else if (
1671
+ // handle late devtools injection - only do this if we are in an actual
1672
+ // browser environment to avoid the timer handle stalling test runner exit
1673
+ // (#4815)
1674
+ // eslint-disable-next-line no-restricted-globals
1675
+ typeof window !== 'undefined' &&
1676
+ // some envs mock window but not fully
1677
+ window.HTMLElement &&
1678
+ // also exclude jsdom
1679
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
1669
1680
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1670
1681
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1671
1682
  replay.push((newHook) => {
@@ -1674,9 +1685,18 @@ var Vue = (function () {
1674
1685
  // clear buffer after 3s - the user probably doesn't have devtools installed
1675
1686
  // at all, and keeping the buffer will cause memory leaks (#4738)
1676
1687
  setTimeout(() => {
1677
- buffer = [];
1688
+ if (!devtools) {
1689
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1690
+ devtoolsNotInstalled = true;
1691
+ buffer = [];
1692
+ }
1678
1693
  }, 3000);
1679
1694
  }
1695
+ else {
1696
+ // non-browser env, assume not installed
1697
+ devtoolsNotInstalled = true;
1698
+ buffer = [];
1699
+ }
1680
1700
  }
1681
1701
  function devtoolsInitApp(app, version) {
1682
1702
  emit("app:init" /* APP_INIT */, app, version, {
@@ -3290,7 +3310,8 @@ var Vue = (function () {
3290
3310
  const rawProps = toRaw(props);
3291
3311
  const { mode } = rawProps;
3292
3312
  // check mode
3293
- if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
3313
+ if (mode &&
3314
+ mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3294
3315
  warn$1(`invalid <transition> mode: ${mode}`);
3295
3316
  }
3296
3317
  // at this point children has a guaranteed length of 1.
@@ -3936,7 +3957,7 @@ var Vue = (function () {
3936
3957
  }
3937
3958
  current = current.parent;
3938
3959
  }
3939
- hook();
3960
+ return hook();
3940
3961
  });
3941
3962
  injectHook(type, wrappedHook, target);
3942
3963
  // In addition to registering it on the target instance, we walk up the parent
@@ -4714,7 +4735,7 @@ var Vue = (function () {
4714
4735
  continue;
4715
4736
  }
4716
4737
  }
4717
- if (value !== attrs[key]) {
4738
+ if (!(key in attrs) || value !== attrs[key]) {
4718
4739
  attrs[key] = value;
4719
4740
  hasAttrsChanged = true;
4720
4741
  }
@@ -5160,7 +5181,7 @@ var Vue = (function () {
5160
5181
  [bar, this.y]
5161
5182
  ])
5162
5183
  */
5163
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
5184
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
5164
5185
  function validateDirectiveName(name) {
5165
5186
  if (isBuiltInDirective(name)) {
5166
5187
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -5295,7 +5316,7 @@ var Vue = (function () {
5295
5316
  return vm;
5296
5317
  }
5297
5318
  }
5298
- Vue.version = "3.2.20";
5319
+ Vue.version = "3.2.24";
5299
5320
  Vue.config = singletonApp.config;
5300
5321
  Vue.use = (p, ...options) => {
5301
5322
  if (p && isFunction(p.install)) {
@@ -6741,7 +6762,7 @@ var Vue = (function () {
6741
6762
  }
6742
6763
  };
6743
6764
  const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
6744
- // 2.x compat may pre-creaate the component instance before actually
6765
+ // 2.x compat may pre-create the component instance before actually
6745
6766
  // mounting
6746
6767
  const compatMountInstance = initialVNode.isCompatRoot && initialVNode.component;
6747
6768
  const instance = compatMountInstance ||
@@ -7621,8 +7642,8 @@ var Vue = (function () {
7621
7642
  *
7622
7643
  * #2080
7623
7644
  * Inside keyed `template` fragment static children, if a fragment is moved,
7624
- * the children will always moved so that need inherit el form previous nodes
7625
- * to ensure correct moved position.
7645
+ * the children will always be moved. Therefore, in order to ensure correct move
7646
+ * position, el should be inherited from previous nodes.
7626
7647
  */
7627
7648
  function traverseStaticChildren(n1, n2, shallow = false) {
7628
7649
  const ch1 = n1.children;
@@ -8260,6 +8281,7 @@ var Vue = (function () {
8260
8281
  };
8261
8282
  Func.props = comp.props;
8262
8283
  Func.displayName = comp.name;
8284
+ Func.compatConfig = comp.compatConfig;
8263
8285
  // v2 functional components do not inherit attrs
8264
8286
  Func.inheritAttrs = false;
8265
8287
  normalizedFunctionalComponentMap.set(comp, Func);
@@ -8749,7 +8771,8 @@ var Vue = (function () {
8749
8771
  else if (isOn(key)) {
8750
8772
  const existing = ret[key];
8751
8773
  const incoming = toMerge[key];
8752
- if (existing !== incoming) {
8774
+ if (existing !== incoming &&
8775
+ !(isArray(existing) && existing.includes(incoming))) {
8753
8776
  ret[key] = existing
8754
8777
  ? [].concat(existing, incoming)
8755
8778
  : incoming;
@@ -9193,23 +9216,23 @@ var Vue = (function () {
9193
9216
  const n = accessCache[key];
9194
9217
  if (n !== undefined) {
9195
9218
  switch (n) {
9196
- case 0 /* SETUP */:
9219
+ case 1 /* SETUP */:
9197
9220
  return setupState[key];
9198
- case 1 /* DATA */:
9221
+ case 2 /* DATA */:
9199
9222
  return data[key];
9200
- case 3 /* CONTEXT */:
9223
+ case 4 /* CONTEXT */:
9201
9224
  return ctx[key];
9202
- case 2 /* PROPS */:
9225
+ case 3 /* PROPS */:
9203
9226
  return props[key];
9204
9227
  // default: just fallthrough
9205
9228
  }
9206
9229
  }
9207
9230
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
9208
- accessCache[key] = 0 /* SETUP */;
9231
+ accessCache[key] = 1 /* SETUP */;
9209
9232
  return setupState[key];
9210
9233
  }
9211
9234
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
9212
- accessCache[key] = 1 /* DATA */;
9235
+ accessCache[key] = 2 /* DATA */;
9213
9236
  return data[key];
9214
9237
  }
9215
9238
  else if (
@@ -9217,15 +9240,15 @@ var Vue = (function () {
9217
9240
  // props
9218
9241
  (normalizedProps = instance.propsOptions[0]) &&
9219
9242
  hasOwn(normalizedProps, key)) {
9220
- accessCache[key] = 2 /* PROPS */;
9243
+ accessCache[key] = 3 /* PROPS */;
9221
9244
  return props[key];
9222
9245
  }
9223
9246
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9224
- accessCache[key] = 3 /* CONTEXT */;
9247
+ accessCache[key] = 4 /* CONTEXT */;
9225
9248
  return ctx[key];
9226
9249
  }
9227
9250
  else if (shouldCacheAccess) {
9228
- accessCache[key] = 4 /* OTHER */;
9251
+ accessCache[key] = 0 /* OTHER */;
9229
9252
  }
9230
9253
  }
9231
9254
  const publicGetter = publicPropertiesMap[key];
@@ -9246,7 +9269,7 @@ var Vue = (function () {
9246
9269
  }
9247
9270
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9248
9271
  // user may set custom properties to `this` that start with `$`
9249
- accessCache[key] = 3 /* CONTEXT */;
9272
+ accessCache[key] = 4 /* CONTEXT */;
9250
9273
  return ctx[key];
9251
9274
  }
9252
9275
  else if (
@@ -9314,7 +9337,7 @@ var Vue = (function () {
9314
9337
  },
9315
9338
  has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
9316
9339
  let normalizedProps;
9317
- return (accessCache[key] !== undefined ||
9340
+ return (!!accessCache[key] ||
9318
9341
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
9319
9342
  (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
9320
9343
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
@@ -10884,7 +10907,7 @@ var Vue = (function () {
10884
10907
  }
10885
10908
 
10886
10909
  // Core API ------------------------------------------------------------------
10887
- const version = "3.2.20";
10910
+ const version = "3.2.24";
10888
10911
  /**
10889
10912
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10890
10913
  * @internal
@@ -11013,16 +11036,8 @@ var Vue = (function () {
11013
11036
 
11014
11037
  function patchStyle(el, prev, next) {
11015
11038
  const style = el.style;
11016
- const currentDisplay = style.display;
11017
- if (!next) {
11018
- el.removeAttribute('style');
11019
- }
11020
- else if (isString(next)) {
11021
- if (prev !== next) {
11022
- style.cssText = next;
11023
- }
11024
- }
11025
- else {
11039
+ const isCssString = isString(next);
11040
+ if (next && !isCssString) {
11026
11041
  for (const key in next) {
11027
11042
  setStyle(style, key, next[key]);
11028
11043
  }
@@ -11034,11 +11049,22 @@ var Vue = (function () {
11034
11049
  }
11035
11050
  }
11036
11051
  }
11037
- // indicates that the `display` of the element is controlled by `v-show`,
11038
- // so we always keep the current `display` value regardless of the `style` value,
11039
- // thus handing over control to `v-show`.
11040
- if ('_vod' in el) {
11041
- style.display = currentDisplay;
11052
+ else {
11053
+ const currentDisplay = style.display;
11054
+ if (isCssString) {
11055
+ if (prev !== next) {
11056
+ style.cssText = next;
11057
+ }
11058
+ }
11059
+ else if (prev) {
11060
+ el.removeAttribute('style');
11061
+ }
11062
+ // indicates that the `display` of the element is controlled by `v-show`,
11063
+ // so we always keep the current `display` value regardless of the `style`
11064
+ // value, thus handing over control to `v-show`.
11065
+ if ('_vod' in el) {
11066
+ style.display = currentDisplay;
11067
+ }
11042
11068
  }
11043
11069
  }
11044
11070
  const importantRE = /\s*!important$/;
@@ -11148,12 +11174,19 @@ var Vue = (function () {
11148
11174
  el[key] = value == null ? '' : value;
11149
11175
  return;
11150
11176
  }
11151
- if (key === 'value' && el.tagName !== 'PROGRESS') {
11177
+ if (key === 'value' &&
11178
+ el.tagName !== 'PROGRESS' &&
11179
+ // custom elements may use _value internally
11180
+ !el.tagName.includes('-')) {
11152
11181
  // store value as _value as well since
11153
11182
  // non-string values will be stringified.
11154
11183
  el._value = value;
11155
11184
  const newValue = value == null ? '' : value;
11156
- if (el.value !== newValue) {
11185
+ if (el.value !== newValue ||
11186
+ // #4956: always set for OPTION elements because its value falls back to
11187
+ // textContent if no value attribute is present. And setting .value for
11188
+ // OPTION has no side effect
11189
+ el.tagName === 'OPTION') {
11157
11190
  el.value = newValue;
11158
11191
  }
11159
11192
  if (value == null) {
@@ -11421,22 +11454,11 @@ var Vue = (function () {
11421
11454
  }
11422
11455
  this.attachShadow({ mode: 'open' });
11423
11456
  }
11424
- // set initial attrs
11425
- for (let i = 0; i < this.attributes.length; i++) {
11426
- this._setAttr(this.attributes[i].name);
11427
- }
11428
- // watch future attr changes
11429
- new MutationObserver(mutations => {
11430
- for (const m of mutations) {
11431
- this._setAttr(m.attributeName);
11432
- }
11433
- }).observe(this, { attributes: true });
11434
11457
  }
11435
11458
  connectedCallback() {
11436
11459
  this._connected = true;
11437
11460
  if (!this._instance) {
11438
11461
  this._resolveDef();
11439
- this._update();
11440
11462
  }
11441
11463
  }
11442
11464
  disconnectedCallback() {
@@ -11455,8 +11477,18 @@ var Vue = (function () {
11455
11477
  if (this._resolved) {
11456
11478
  return;
11457
11479
  }
11480
+ this._resolved = true;
11481
+ // set initial attrs
11482
+ for (let i = 0; i < this.attributes.length; i++) {
11483
+ this._setAttr(this.attributes[i].name);
11484
+ }
11485
+ // watch future attr changes
11486
+ new MutationObserver(mutations => {
11487
+ for (const m of mutations) {
11488
+ this._setAttr(m.attributeName);
11489
+ }
11490
+ }).observe(this, { attributes: true });
11458
11491
  const resolve = (def) => {
11459
- this._resolved = true;
11460
11492
  const { props, styles } = def;
11461
11493
  const hasOptions = !isArray(props);
11462
11494
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -11471,14 +11503,11 @@ var Vue = (function () {
11471
11503
  }
11472
11504
  }
11473
11505
  }
11474
- if (numberProps) {
11475
- this._numberProps = numberProps;
11476
- this._update();
11477
- }
11506
+ this._numberProps = numberProps;
11478
11507
  // check if there are props set pre-upgrade or connect
11479
11508
  for (const key of Object.keys(this)) {
11480
11509
  if (key[0] !== '_') {
11481
- this._setProp(key, this[key]);
11510
+ this._setProp(key, this[key], true, false);
11482
11511
  }
11483
11512
  }
11484
11513
  // defining getter/setters on prototype
@@ -11492,7 +11521,10 @@ var Vue = (function () {
11492
11521
  }
11493
11522
  });
11494
11523
  }
11524
+ // apply CSS
11495
11525
  this._applyStyles(styles);
11526
+ // initial render
11527
+ this._update();
11496
11528
  };
11497
11529
  const asyncDef = this._def.__asyncLoader;
11498
11530
  if (asyncDef) {
@@ -11518,10 +11550,10 @@ var Vue = (function () {
11518
11550
  /**
11519
11551
  * @internal
11520
11552
  */
11521
- _setProp(key, val, shouldReflect = true) {
11553
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
11522
11554
  if (val !== this._props[key]) {
11523
11555
  this._props[key] = val;
11524
- if (this._instance) {
11556
+ if (shouldUpdate && this._instance) {
11525
11557
  this._update();
11526
11558
  }
11527
11559
  // reflect
@@ -11550,7 +11582,7 @@ var Vue = (function () {
11550
11582
  // HMR
11551
11583
  {
11552
11584
  instance.ceReload = newStyles => {
11553
- // alawys reset styles
11585
+ // always reset styles
11554
11586
  if (this._styles) {
11555
11587
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
11556
11588
  this._styles.length = 0;
@@ -13322,7 +13354,6 @@ var Vue = (function () {
13322
13354
  }
13323
13355
  function injectProp(node, prop, context) {
13324
13356
  let propsWithInjection;
13325
- const originalProps = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
13326
13357
  /**
13327
13358
  * 1. mergeProps(...)
13328
13359
  * 2. toHandlers(...)
@@ -13331,7 +13362,7 @@ var Vue = (function () {
13331
13362
  *
13332
13363
  * we need to get the real props before normalization
13333
13364
  */
13334
- let props = originalProps;
13365
+ let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
13335
13366
  let callPath = [];
13336
13367
  let parentCall;
13337
13368
  if (props &&
@@ -13927,6 +13958,7 @@ var Vue = (function () {
13927
13958
  }
13928
13959
  if (hasIf && hasFor) {
13929
13960
  warnDeprecation$1("COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */, context, getSelection(context, start));
13961
+ break;
13930
13962
  }
13931
13963
  }
13932
13964
  }
@@ -14351,15 +14383,6 @@ var Vue = (function () {
14351
14383
  !isSlotOutlet(child));
14352
14384
  }
14353
14385
  function walk$1(node, context, doNotHoistNode = false) {
14354
- // Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
14355
- // static bindings with expressions. These expressions are guaranteed to be
14356
- // constant so they are still eligible for hoisting, but they are only
14357
- // available at runtime and therefore cannot be evaluated ahead of time.
14358
- // This is only a concern for pre-stringification (via transformHoist by
14359
- // @vue/compiler-dom), but doing it here allows us to perform only one full
14360
- // walk of the AST and allow `stringifyStatic` to stop walking as soon as its
14361
- // stringification threshold is met.
14362
- let canStringify = true;
14363
14386
  const { children } = node;
14364
14387
  const originalCount = children.length;
14365
14388
  let hoistedCount = 0;
@@ -14372,9 +14395,6 @@ var Vue = (function () {
14372
14395
  ? 0 /* NOT_CONSTANT */
14373
14396
  : getConstantType(child, context);
14374
14397
  if (constantType > 0 /* NOT_CONSTANT */) {
14375
- if (constantType < 3 /* CAN_STRINGIFY */) {
14376
- canStringify = false;
14377
- }
14378
14398
  if (constantType >= 2 /* CAN_HOIST */) {
14379
14399
  child.codegenNode.patchFlag =
14380
14400
  -1 /* HOISTED */ + (` /* HOISTED */` );
@@ -14405,17 +14425,10 @@ var Vue = (function () {
14405
14425
  }
14406
14426
  }
14407
14427
  }
14408
- else if (child.type === 12 /* TEXT_CALL */) {
14409
- const contentType = getConstantType(child.content, context);
14410
- if (contentType > 0) {
14411
- if (contentType < 3 /* CAN_STRINGIFY */) {
14412
- canStringify = false;
14413
- }
14414
- if (contentType >= 2 /* CAN_HOIST */) {
14415
- child.codegenNode = context.hoist(child.codegenNode);
14416
- hoistedCount++;
14417
- }
14418
- }
14428
+ else if (child.type === 12 /* TEXT_CALL */ &&
14429
+ getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
14430
+ child.codegenNode = context.hoist(child.codegenNode);
14431
+ hoistedCount++;
14419
14432
  }
14420
14433
  // walk further
14421
14434
  if (child.type === 1 /* ELEMENT */) {
@@ -14439,7 +14452,7 @@ var Vue = (function () {
14439
14452
  }
14440
14453
  }
14441
14454
  }
14442
- if (canStringify && hoistedCount && context.transformHoist) {
14455
+ if (hoistedCount && context.transformHoist) {
14443
14456
  context.transformHoist(children, context, node);
14444
14457
  }
14445
14458
  // all children were hoisted - the entire children array is hoistable.
@@ -16794,7 +16807,7 @@ var Vue = (function () {
16794
16807
  return propsNamesString + `]`;
16795
16808
  }
16796
16809
  function isComponentTag(tag) {
16797
- return tag[0].toLowerCase() + tag.slice(1) === 'component';
16810
+ return tag === 'component' || tag === 'Component';
16798
16811
  }
16799
16812
 
16800
16813
  const transformSlotOutlet = (node, context) => {