@vue/compat 3.5.38 → 3.5.40

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.38
2
+ * @vue/compat v3.5.40
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -452,8 +452,9 @@ var Vue = (function () {
452
452
  this._isPaused = true;
453
453
  let i, l;
454
454
  if (this.scopes) {
455
- for (i = 0, l = this.scopes.length; i < l; i++) {
456
- this.scopes[i].pause();
455
+ const scopes = this.scopes.slice();
456
+ for (i = 0, l = scopes.length; i < l; i++) {
457
+ scopes[i].pause();
457
458
  }
458
459
  }
459
460
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -470,12 +471,14 @@ var Vue = (function () {
470
471
  this._isPaused = false;
471
472
  let i, l;
472
473
  if (this.scopes) {
473
- for (i = 0, l = this.scopes.length; i < l; i++) {
474
- this.scopes[i].resume();
474
+ const scopes = this.scopes.slice();
475
+ for (i = 0, l = scopes.length; i < l; i++) {
476
+ scopes[i].resume();
475
477
  }
476
478
  }
477
- for (i = 0, l = this.effects.length; i < l; i++) {
478
- this.effects[i].resume();
479
+ const effects = this.effects.slice();
480
+ for (i = 0, l = effects.length; i < l; i++) {
481
+ effects[i].resume();
479
482
  }
480
483
  }
481
484
  }
@@ -537,8 +540,9 @@ var Vue = (function () {
537
540
  }
538
541
  this.cleanups.length = 0;
539
542
  if (this.scopes) {
540
- for (i = 0, l = this.scopes.length; i < l; i++) {
541
- this.scopes[i].stop(true);
543
+ const scopes = this.scopes.slice();
544
+ for (i = 0, l = scopes.length; i < l; i++) {
545
+ scopes[i].stop(true);
542
546
  }
543
547
  this.scopes.length = 0;
544
548
  }
@@ -1447,7 +1451,7 @@ var Vue = (function () {
1447
1451
  value,
1448
1452
  isRef(target) ? target : receiver
1449
1453
  );
1450
- if (target === toRaw(receiver)) {
1454
+ if (target === toRaw(receiver) && result) {
1451
1455
  if (!hadKey) {
1452
1456
  trigger(target, "add", key, value);
1453
1457
  } else if (hasChanged(value, oldValue)) {
@@ -3460,10 +3464,12 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3460
3464
  setBlockTracking(-1);
3461
3465
  }
3462
3466
  const prevInstance = setCurrentRenderingInstance(ctx);
3467
+ const prevStackSize = blockStack.length;
3463
3468
  let res;
3464
3469
  try {
3465
3470
  res = fn(...args);
3466
3471
  } finally {
3472
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3467
3473
  setCurrentRenderingInstance(prevInstance);
3468
3474
  if (renderFnWithContext._d) {
3469
3475
  setBlockTracking(1);
@@ -3898,11 +3904,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3898
3904
  }
3899
3905
  } else {
3900
3906
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3901
- const nextTarget = n2.target = resolveTarget(
3902
- n2.props,
3903
- querySelector
3904
- );
3907
+ const nextTarget = resolveTarget(n2.props, querySelector);
3905
3908
  if (nextTarget) {
3909
+ n2.target = nextTarget;
3906
3910
  moveTeleport(
3907
3911
  n2,
3908
3912
  nextTarget,
@@ -3940,7 +3944,8 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3940
3944
  target,
3941
3945
  props
3942
3946
  } = vnode;
3943
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3947
+ const disabled = isTeleportDisabled(props);
3948
+ const shouldRemove = doRemove || !disabled;
3944
3949
  const pendingMount = pendingMounts.get(vnode);
3945
3950
  if (pendingMount) {
3946
3951
  pendingMount.flags |= 8;
@@ -3951,7 +3956,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3951
3956
  hostRemove(targetAnchor);
3952
3957
  }
3953
3958
  doRemove && hostRemove(anchor);
3954
- if (!pendingMount && shapeFlag & 16) {
3959
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3955
3960
  for (let i = 0; i < children.length; i++) {
3956
3961
  const child = children[i];
3957
3962
  unmount(
@@ -4889,7 +4894,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4889
4894
  };
4890
4895
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4891
4896
  optimized = optimized || !!vnode.dynamicChildren;
4892
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4897
+ const {
4898
+ type,
4899
+ dynamicProps,
4900
+ props,
4901
+ patchFlag,
4902
+ shapeFlag,
4903
+ dirs,
4904
+ transition
4905
+ } = vnode;
4893
4906
  const forcePatch = type === "input" || type === "option";
4894
4907
  {
4895
4908
  if (dirs) {
@@ -4960,6 +4973,7 @@ Server rendered element contains more child nodes than client vdom.`
4960
4973
  if (props) {
4961
4974
  {
4962
4975
  const isCustomElement = el.tagName.includes("-");
4976
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4963
4977
  for (const key in props) {
4964
4978
  if (// #11189 skip if this node has directives that have created hooks
4965
4979
  // as it could have mutated the DOM in any possible way
@@ -4967,8 +4981,8 @@ Server rendered element contains more child nodes than client vdom.`
4967
4981
  logMismatchError();
4968
4982
  }
4969
4983
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4970
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4971
- patchProp(el, key, null, props[key], void 0, parentComponent);
4984
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4985
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4972
4986
  }
4973
4987
  }
4974
4988
  }
@@ -5072,7 +5086,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5072
5086
  }
5073
5087
  };
5074
5088
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5075
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5089
+ if (!isNodeMismatchAllowed(node, vnode)) {
5076
5090
  warn$1(
5077
5091
  `Hydration node mismatch:
5078
5092
  - rendered on server:`,
@@ -5287,7 +5301,12 @@ Server rendered element contains fewer child nodes than client vdom.`
5287
5301
  el = el.parentElement;
5288
5302
  }
5289
5303
  }
5290
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
5304
+ return isMismatchAllowedByAttr(
5305
+ el && el.getAttribute(allowMismatchAttr),
5306
+ allowedType
5307
+ );
5308
+ }
5309
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
5291
5310
  if (allowedAttr == null) {
5292
5311
  return false;
5293
5312
  } else if (allowedAttr === "") {
@@ -5300,6 +5319,19 @@ Server rendered element contains fewer child nodes than client vdom.`
5300
5319
  return list.includes(MismatchTypeString[allowedType]);
5301
5320
  }
5302
5321
  }
5322
+ function isNodeMismatchAllowed(node, vnode) {
5323
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
5324
+ }
5325
+ function isMismatchAllowedByNode(node) {
5326
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
5327
+ node.getAttribute(allowMismatchAttr),
5328
+ 1 /* CHILDREN */
5329
+ );
5330
+ }
5331
+ function isMismatchAllowedByVNode({ props }) {
5332
+ const allowedAttr = props && props[allowMismatchAttr];
5333
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
5334
+ }
5303
5335
 
5304
5336
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
5305
5337
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -5453,6 +5485,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5453
5485
  name: "AsyncComponentWrapper",
5454
5486
  __asyncLoader: load,
5455
5487
  __asyncHydrate(el, instance, hydrate) {
5488
+ const wasConnected = el.isConnected;
5456
5489
  let patched = false;
5457
5490
  (instance.bu || (instance.bu = [])).push(() => patched = true);
5458
5491
  const performHydrate = () => {
@@ -5464,6 +5497,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5464
5497
  }
5465
5498
  return;
5466
5499
  }
5500
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
5467
5501
  hydrate();
5468
5502
  };
5469
5503
  const doHydrate = hydrateStrategy ? () => {
@@ -6307,14 +6341,15 @@ If this is a native custom element, make sure to exclude it from component resol
6307
6341
  return slots;
6308
6342
  }
6309
6343
 
6310
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6344
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
6311
6345
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6312
- const hasProps = Object.keys(props).length > 0;
6313
- if (name !== "default") props.name = name;
6346
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
6347
+ const hasProps = Object.keys(slotProps).length > 0;
6348
+ if (name !== "default") slotProps.name = name;
6314
6349
  return openBlock(), createBlock(
6315
6350
  Fragment,
6316
6351
  null,
6317
- [createVNode("slot", props, fallback && fallback())],
6352
+ [createVNode("slot", slotProps, fallback && fallback())],
6318
6353
  hasProps ? -2 : 64
6319
6354
  );
6320
6355
  }
@@ -6328,26 +6363,34 @@ If this is a native custom element, make sure to exclude it from component resol
6328
6363
  if (slot && slot._c) {
6329
6364
  slot._d = false;
6330
6365
  }
6366
+ const prevStackSize = blockStack.length;
6331
6367
  openBlock();
6332
- const validSlotContent = slot && ensureValidVNode(slot(props));
6333
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
6334
- // key attached in the `createSlots` helper, respect that
6335
- validSlotContent && validSlotContent.key;
6336
- const rendered = createBlock(
6337
- Fragment,
6338
- {
6339
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6340
- (!validSlotContent && fallback ? "_fb" : "")
6341
- },
6342
- validSlotContent || (fallback ? fallback() : []),
6343
- validSlotContent && slots._ === 1 ? 64 : -2
6344
- );
6368
+ let rendered;
6369
+ try {
6370
+ const validSlotContent = slot && ensureValidVNode(slot(props));
6371
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
6372
+ // key attached in the `createSlots` helper, respect that
6373
+ validSlotContent && validSlotContent.key;
6374
+ rendered = createBlock(
6375
+ Fragment,
6376
+ {
6377
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6378
+ (!validSlotContent && fallback ? "_fb" : "")
6379
+ },
6380
+ validSlotContent || (fallback ? fallback() : []),
6381
+ validSlotContent && slots._ === 1 ? 64 : -2
6382
+ );
6383
+ } catch (err) {
6384
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
6385
+ throw err;
6386
+ } finally {
6387
+ if (slot && slot._c) {
6388
+ slot._d = true;
6389
+ }
6390
+ }
6345
6391
  if (!noSlotted && rendered.scopeId) {
6346
6392
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
6347
6393
  }
6348
- if (slot && slot._c) {
6349
- slot._d = true;
6350
- }
6351
6394
  return rendered;
6352
6395
  }
6353
6396
  function ensureValidVNode(vnodes) {
@@ -7522,7 +7565,7 @@ If this is a native custom element, make sure to exclude it from component resol
7522
7565
  return vm;
7523
7566
  }
7524
7567
  }
7525
- Vue.version = `2.6.14-compat:${"3.5.38"}`;
7568
+ Vue.version = `2.6.14-compat:${"3.5.40"}`;
7526
7569
  Vue.config = singletonApp.config;
7527
7570
  Vue.use = (plugin, ...options) => {
7528
7571
  if (plugin && isFunction(plugin.install)) {
@@ -8383,7 +8426,8 @@ If you want to remount the same app, move your app creation logic into a factory
8383
8426
  if (key.startsWith(compatModelEventPrefix)) {
8384
8427
  return true;
8385
8428
  }
8386
- key = key.slice(2).replace(/Once$/, "");
8429
+ key = key.slice(2);
8430
+ key = key === "Once" ? key : key.replace(/Once$/, "");
8387
8431
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8388
8432
  }
8389
8433
 
@@ -9700,7 +9744,12 @@ If you want to remount the same app, move your app creation logic into a factory
9700
9744
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
9701
9745
  }
9702
9746
  parentComponent && toggleRecurse(parentComponent, true);
9703
- if (isHmrUpdating) {
9747
+ if (
9748
+ // HMR updated, force full diff
9749
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
9750
+ // Force full diff when block metadata is unstable.
9751
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
9752
+ ) {
9704
9753
  patchFlag = 0;
9705
9754
  optimized = false;
9706
9755
  dynamicChildren = null;
@@ -11934,6 +11983,10 @@ Component that was made reactive: `,
11934
11983
  }
11935
11984
  }
11936
11985
  } else if (isFunction(children)) {
11986
+ if (shapeFlag & (1 | 64)) {
11987
+ normalizeChildren(vnode, { default: children });
11988
+ return;
11989
+ }
11937
11990
  children = { default: children, _ctx: currentRenderingInstance };
11938
11991
  type = 32;
11939
11992
  } else {
@@ -12650,7 +12703,7 @@ Component that was made reactive: `,
12650
12703
  return true;
12651
12704
  }
12652
12705
 
12653
- const version = "3.5.38";
12706
+ const version = "3.5.40";
12654
12707
  const warn = warn$1 ;
12655
12708
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12656
12709
  const devtools = devtools$1 ;
@@ -13452,16 +13505,15 @@ Component that was made reactive: `,
13452
13505
  }
13453
13506
  }
13454
13507
  }
13455
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
13508
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
13509
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
13456
13510
  function parseName(name) {
13457
13511
  let options;
13458
- if (optionsModifierRE.test(name)) {
13459
- options = {};
13460
- let m;
13461
- while (m = name.match(optionsModifierRE)) {
13462
- name = name.slice(0, name.length - m[0].length);
13463
- options[m[0].toLowerCase()] = true;
13464
- }
13512
+ let m;
13513
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
13514
+ if (!options) options = {};
13515
+ name = name.slice(0, name.length - m[1].length);
13516
+ options[m[1].toLowerCase()] = true;
13465
13517
  }
13466
13518
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
13467
13519
  return [event, options];
@@ -14420,13 +14472,13 @@ Expected function or array of functions, received type ${typeof value}.`
14420
14472
  // <select multiple> value need to be deep traversed
14421
14473
  deep: true,
14422
14474
  created(el, { value, modifiers: { number } }, vnode) {
14423
- const isSetModel = isSet(value);
14475
+ el._modelValue = value;
14424
14476
  addEventListener(el, "change", () => {
14425
14477
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14426
14478
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14427
14479
  );
14428
14480
  el[assignKey](
14429
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
14481
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14430
14482
  );
14431
14483
  el._assigning = true;
14432
14484
  nextTick(() => {
@@ -14440,7 +14492,8 @@ Expected function or array of functions, received type ${typeof value}.`
14440
14492
  mounted(el, { value }) {
14441
14493
  setSelected(el, value);
14442
14494
  },
14443
- beforeUpdate(el, _binding, vnode) {
14495
+ beforeUpdate(el, { value }, vnode) {
14496
+ el._modelValue = value;
14444
14497
  el[assignKey] = getModelAssigner(vnode);
14445
14498
  },
14446
14499
  updated(el, { value }) {
@@ -16338,6 +16391,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16338
16391
  return [props, callPath];
16339
16392
  }
16340
16393
  function injectProp(node, prop, context) {
16394
+ if (node.type !== 13 && injectSlotKey(node, prop)) {
16395
+ return;
16396
+ }
16341
16397
  let propsWithInjection;
16342
16398
  let props = node.type === 13 ? node.props : node.arguments[2];
16343
16399
  let callPath = [];
@@ -16395,6 +16451,24 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16395
16451
  }
16396
16452
  }
16397
16453
  }
16454
+ function injectSlotKey(node, prop) {
16455
+ var _a, _b, _c;
16456
+ if (prop.key.type !== 4 || prop.key.content !== "key") {
16457
+ return false;
16458
+ }
16459
+ const props = node.arguments[2];
16460
+ if (props && !isString(props)) {
16461
+ const [unnormalizedProps] = getUnnormalizedProps(props);
16462
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
16463
+ return true;
16464
+ }
16465
+ }
16466
+ (_a = node.arguments)[2] || (_a[2] = "{}");
16467
+ (_b = node.arguments)[3] || (_b[3] = "undefined");
16468
+ (_c = node.arguments)[4] || (_c[4] = "undefined");
16469
+ node.arguments[5] = prop.value;
16470
+ return true;
16471
+ }
16398
16472
  function hasProp(prop, props) {
16399
16473
  let result = false;
16400
16474
  if (prop.key.type === 4) {
@@ -20026,7 +20100,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
20026
20100
  if (child.type === 4) {
20027
20101
  parseFilter(child, context);
20028
20102
  } else if (child.type === 8) {
20029
- rewriteFilter(node, context);
20103
+ rewriteFilter(child, context);
20030
20104
  } else if (child.type === 5) {
20031
20105
  rewriteFilter(child.content, context);
20032
20106
  }