vue 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 v3.5.38
2
+ * vue v3.5.40
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.38
2
+ * vue 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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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)) {
@@ -3035,10 +3039,12 @@ var Vue = (function (exports) {
3035
3039
  setBlockTracking(-1);
3036
3040
  }
3037
3041
  const prevInstance = setCurrentRenderingInstance(ctx);
3042
+ const prevStackSize = blockStack.length;
3038
3043
  let res;
3039
3044
  try {
3040
3045
  res = fn(...args);
3041
3046
  } finally {
3047
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3042
3048
  setCurrentRenderingInstance(prevInstance);
3043
3049
  if (renderFnWithContext._d) {
3044
3050
  setBlockTracking(1);
@@ -3429,11 +3435,9 @@ var Vue = (function (exports) {
3429
3435
  }
3430
3436
  } else {
3431
3437
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3432
- const nextTarget = n2.target = resolveTarget(
3433
- n2.props,
3434
- querySelector
3435
- );
3438
+ const nextTarget = resolveTarget(n2.props, querySelector);
3436
3439
  if (nextTarget) {
3440
+ n2.target = nextTarget;
3437
3441
  moveTeleport(
3438
3442
  n2,
3439
3443
  nextTarget,
@@ -3471,7 +3475,8 @@ var Vue = (function (exports) {
3471
3475
  target,
3472
3476
  props
3473
3477
  } = vnode;
3474
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3478
+ const disabled = isTeleportDisabled(props);
3479
+ const shouldRemove = doRemove || !disabled;
3475
3480
  const pendingMount = pendingMounts.get(vnode);
3476
3481
  if (pendingMount) {
3477
3482
  pendingMount.flags |= 8;
@@ -3482,7 +3487,7 @@ var Vue = (function (exports) {
3482
3487
  hostRemove(targetAnchor);
3483
3488
  }
3484
3489
  doRemove && hostRemove(anchor);
3485
- if (!pendingMount && shapeFlag & 16) {
3490
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3486
3491
  for (let i = 0; i < children.length; i++) {
3487
3492
  const child = children[i];
3488
3493
  unmount(
@@ -4417,7 +4422,15 @@ var Vue = (function (exports) {
4417
4422
  };
4418
4423
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4419
4424
  optimized = optimized || !!vnode.dynamicChildren;
4420
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4425
+ const {
4426
+ type,
4427
+ dynamicProps,
4428
+ props,
4429
+ patchFlag,
4430
+ shapeFlag,
4431
+ dirs,
4432
+ transition
4433
+ } = vnode;
4421
4434
  const forcePatch = type === "input" || type === "option";
4422
4435
  {
4423
4436
  if (dirs) {
@@ -4488,6 +4501,7 @@ Server rendered element contains more child nodes than client vdom.`
4488
4501
  if (props) {
4489
4502
  {
4490
4503
  const isCustomElement = el.tagName.includes("-");
4504
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4491
4505
  for (const key in props) {
4492
4506
  if (// #11189 skip if this node has directives that have created hooks
4493
4507
  // as it could have mutated the DOM in any possible way
@@ -4495,8 +4509,8 @@ Server rendered element contains more child nodes than client vdom.`
4495
4509
  logMismatchError();
4496
4510
  }
4497
4511
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4498
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4499
- patchProp(el, key, null, props[key], void 0, parentComponent);
4512
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4513
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4500
4514
  }
4501
4515
  }
4502
4516
  }
@@ -4600,7 +4614,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4600
4614
  }
4601
4615
  };
4602
4616
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4603
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4617
+ if (!isNodeMismatchAllowed(node, vnode)) {
4604
4618
  warn$1(
4605
4619
  `Hydration node mismatch:
4606
4620
  - rendered on server:`,
@@ -4815,7 +4829,12 @@ Server rendered element contains fewer child nodes than client vdom.`
4815
4829
  el = el.parentElement;
4816
4830
  }
4817
4831
  }
4818
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4832
+ return isMismatchAllowedByAttr(
4833
+ el && el.getAttribute(allowMismatchAttr),
4834
+ allowedType
4835
+ );
4836
+ }
4837
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
4819
4838
  if (allowedAttr == null) {
4820
4839
  return false;
4821
4840
  } else if (allowedAttr === "") {
@@ -4828,6 +4847,19 @@ Server rendered element contains fewer child nodes than client vdom.`
4828
4847
  return list.includes(MismatchTypeString[allowedType]);
4829
4848
  }
4830
4849
  }
4850
+ function isNodeMismatchAllowed(node, vnode) {
4851
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
4852
+ }
4853
+ function isMismatchAllowedByNode(node) {
4854
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
4855
+ node.getAttribute(allowMismatchAttr),
4856
+ 1 /* CHILDREN */
4857
+ );
4858
+ }
4859
+ function isMismatchAllowedByVNode({ props }) {
4860
+ const allowedAttr = props && props[allowMismatchAttr];
4861
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
4862
+ }
4831
4863
 
4832
4864
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
4833
4865
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -4981,6 +5013,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4981
5013
  name: "AsyncComponentWrapper",
4982
5014
  __asyncLoader: load,
4983
5015
  __asyncHydrate(el, instance, hydrate) {
5016
+ const wasConnected = el.isConnected;
4984
5017
  let patched = false;
4985
5018
  (instance.bu || (instance.bu = [])).push(() => patched = true);
4986
5019
  const performHydrate = () => {
@@ -4992,6 +5025,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4992
5025
  }
4993
5026
  return;
4994
5027
  }
5028
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
4995
5029
  hydrate();
4996
5030
  };
4997
5031
  const doHydrate = hydrateStrategy ? () => {
@@ -5544,14 +5578,15 @@ If this is a native custom element, make sure to exclude it from component resol
5544
5578
  return slots;
5545
5579
  }
5546
5580
 
5547
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5581
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5548
5582
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5549
- const hasProps = Object.keys(props).length > 0;
5550
- if (name !== "default") props.name = name;
5583
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5584
+ const hasProps = Object.keys(slotProps).length > 0;
5585
+ if (name !== "default") slotProps.name = name;
5551
5586
  return openBlock(), createBlock(
5552
5587
  Fragment,
5553
5588
  null,
5554
- [createVNode("slot", props, fallback && fallback())],
5589
+ [createVNode("slot", slotProps, fallback && fallback())],
5555
5590
  hasProps ? -2 : 64
5556
5591
  );
5557
5592
  }
@@ -5565,26 +5600,34 @@ If this is a native custom element, make sure to exclude it from component resol
5565
5600
  if (slot && slot._c) {
5566
5601
  slot._d = false;
5567
5602
  }
5603
+ const prevStackSize = blockStack.length;
5568
5604
  openBlock();
5569
- const validSlotContent = slot && ensureValidVNode(slot(props));
5570
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5571
- // key attached in the `createSlots` helper, respect that
5572
- validSlotContent && validSlotContent.key;
5573
- const rendered = createBlock(
5574
- Fragment,
5575
- {
5576
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5577
- (!validSlotContent && fallback ? "_fb" : "")
5578
- },
5579
- validSlotContent || (fallback ? fallback() : []),
5580
- validSlotContent && slots._ === 1 ? 64 : -2
5581
- );
5605
+ let rendered;
5606
+ try {
5607
+ const validSlotContent = slot && ensureValidVNode(slot(props));
5608
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
5609
+ // key attached in the `createSlots` helper, respect that
5610
+ validSlotContent && validSlotContent.key;
5611
+ rendered = createBlock(
5612
+ Fragment,
5613
+ {
5614
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5615
+ (!validSlotContent && fallback ? "_fb" : "")
5616
+ },
5617
+ validSlotContent || (fallback ? fallback() : []),
5618
+ validSlotContent && slots._ === 1 ? 64 : -2
5619
+ );
5620
+ } catch (err) {
5621
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
5622
+ throw err;
5623
+ } finally {
5624
+ if (slot && slot._c) {
5625
+ slot._d = true;
5626
+ }
5627
+ }
5582
5628
  if (!noSlotted && rendered.scopeId) {
5583
5629
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
5584
5630
  }
5585
- if (slot && slot._c) {
5586
- slot._d = true;
5587
- }
5588
5631
  return rendered;
5589
5632
  }
5590
5633
  function ensureValidVNode(vnodes) {
@@ -6816,7 +6859,8 @@ If you want to remount the same app, move your app creation logic into a factory
6816
6859
  if (!options || !isOn(key)) {
6817
6860
  return false;
6818
6861
  }
6819
- key = key.slice(2).replace(/Once$/, "");
6862
+ key = key.slice(2);
6863
+ key = key === "Once" ? key : key.replace(/Once$/, "");
6820
6864
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
6821
6865
  }
6822
6866
 
@@ -8040,7 +8084,12 @@ If you want to remount the same app, move your app creation logic into a factory
8040
8084
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
8041
8085
  }
8042
8086
  parentComponent && toggleRecurse(parentComponent, true);
8043
- if (isHmrUpdating) {
8087
+ if (
8088
+ // HMR updated, force full diff
8089
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
8090
+ // Force full diff when block metadata is unstable.
8091
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
8092
+ ) {
8044
8093
  patchFlag = 0;
8045
8094
  optimized = false;
8046
8095
  dynamicChildren = null;
@@ -10173,6 +10222,10 @@ Component that was made reactive: `,
10173
10222
  }
10174
10223
  }
10175
10224
  } else if (isFunction(children)) {
10225
+ if (shapeFlag & (1 | 64)) {
10226
+ normalizeChildren(vnode, { default: children });
10227
+ return;
10228
+ }
10176
10229
  children = { default: children, _ctx: currentRenderingInstance };
10177
10230
  type = 32;
10178
10231
  } else {
@@ -10877,7 +10930,7 @@ Component that was made reactive: `,
10877
10930
  return true;
10878
10931
  }
10879
10932
 
10880
- const version = "3.5.38";
10933
+ const version = "3.5.40";
10881
10934
  const warn = warn$1 ;
10882
10935
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10883
10936
  const devtools = devtools$1 ;
@@ -11591,16 +11644,15 @@ Component that was made reactive: `,
11591
11644
  }
11592
11645
  }
11593
11646
  }
11594
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
11647
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
11648
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
11595
11649
  function parseName(name) {
11596
11650
  let options;
11597
- if (optionsModifierRE.test(name)) {
11598
- options = {};
11599
- let m;
11600
- while (m = name.match(optionsModifierRE)) {
11601
- name = name.slice(0, name.length - m[0].length);
11602
- options[m[0].toLowerCase()] = true;
11603
- }
11651
+ let m;
11652
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
11653
+ if (!options) options = {};
11654
+ name = name.slice(0, name.length - m[1].length);
11655
+ options[m[1].toLowerCase()] = true;
11604
11656
  }
11605
11657
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
11606
11658
  return [event, options];
@@ -12550,13 +12602,13 @@ Expected function or array of functions, received type ${typeof value}.`
12550
12602
  // <select multiple> value need to be deep traversed
12551
12603
  deep: true,
12552
12604
  created(el, { value, modifiers: { number } }, vnode) {
12553
- const isSetModel = isSet(value);
12605
+ el._modelValue = value;
12554
12606
  addEventListener(el, "change", () => {
12555
12607
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12556
12608
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12557
12609
  );
12558
12610
  el[assignKey](
12559
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12611
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12560
12612
  );
12561
12613
  el._assigning = true;
12562
12614
  nextTick(() => {
@@ -12570,7 +12622,8 @@ Expected function or array of functions, received type ${typeof value}.`
12570
12622
  mounted(el, { value }) {
12571
12623
  setSelected(el, value);
12572
12624
  },
12573
- beforeUpdate(el, _binding, vnode) {
12625
+ beforeUpdate(el, { value }, vnode) {
12626
+ el._modelValue = value;
12574
12627
  el[assignKey] = getModelAssigner(vnode);
12575
12628
  },
12576
12629
  updated(el, { value }) {
@@ -14159,6 +14212,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14159
14212
  return [props, callPath];
14160
14213
  }
14161
14214
  function injectProp(node, prop, context) {
14215
+ if (node.type !== 13 && injectSlotKey(node, prop)) {
14216
+ return;
14217
+ }
14162
14218
  let propsWithInjection;
14163
14219
  let props = node.type === 13 ? node.props : node.arguments[2];
14164
14220
  let callPath = [];
@@ -14216,6 +14272,24 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14216
14272
  }
14217
14273
  }
14218
14274
  }
14275
+ function injectSlotKey(node, prop) {
14276
+ var _a, _b, _c;
14277
+ if (prop.key.type !== 4 || prop.key.content !== "key") {
14278
+ return false;
14279
+ }
14280
+ const props = node.arguments[2];
14281
+ if (props && !isString(props)) {
14282
+ const [unnormalizedProps] = getUnnormalizedProps(props);
14283
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
14284
+ return true;
14285
+ }
14286
+ }
14287
+ (_a = node.arguments)[2] || (_a[2] = "{}");
14288
+ (_b = node.arguments)[3] || (_b[3] = "undefined");
14289
+ (_c = node.arguments)[4] || (_c[4] = "undefined");
14290
+ node.arguments[5] = prop.value;
14291
+ return true;
14292
+ }
14219
14293
  function hasProp(prop, props) {
14220
14294
  let result = false;
14221
14295
  if (prop.key.type === 4) {