vue 3.5.39 → 3.5.41

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.39
2
+ * vue v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -197,7 +197,7 @@ var Vue = (function (exports) {
197
197
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
198
198
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
199
199
  const isBooleanAttr = /* @__PURE__ */ makeMap(
200
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
200
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
201
201
  );
202
202
  function includeBooleanAttr(value) {
203
203
  return !!value || value === "";
@@ -379,8 +379,9 @@ var Vue = (function (exports) {
379
379
  this._isPaused = true;
380
380
  let i, l;
381
381
  if (this.scopes) {
382
- for (i = 0, l = this.scopes.length; i < l; i++) {
383
- this.scopes[i].pause();
382
+ const scopes = this.scopes.slice();
383
+ for (i = 0, l = scopes.length; i < l; i++) {
384
+ scopes[i].pause();
384
385
  }
385
386
  }
386
387
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -397,12 +398,14 @@ var Vue = (function (exports) {
397
398
  this._isPaused = false;
398
399
  let i, l;
399
400
  if (this.scopes) {
400
- for (i = 0, l = this.scopes.length; i < l; i++) {
401
- this.scopes[i].resume();
401
+ const scopes = this.scopes.slice();
402
+ for (i = 0, l = scopes.length; i < l; i++) {
403
+ scopes[i].resume();
402
404
  }
403
405
  }
404
- for (i = 0, l = this.effects.length; i < l; i++) {
405
- this.effects[i].resume();
406
+ const effects = this.effects.slice();
407
+ for (i = 0, l = effects.length; i < l; i++) {
408
+ effects[i].resume();
406
409
  }
407
410
  }
408
411
  }
@@ -464,8 +467,9 @@ var Vue = (function (exports) {
464
467
  }
465
468
  this.cleanups.length = 0;
466
469
  if (this.scopes) {
467
- for (i = 0, l = this.scopes.length; i < l; i++) {
468
- this.scopes[i].stop(true);
470
+ const scopes = this.scopes.slice();
471
+ for (i = 0, l = scopes.length; i < l; i++) {
472
+ scopes[i].stop(true);
469
473
  }
470
474
  this.scopes.length = 0;
471
475
  }
@@ -2596,7 +2600,9 @@ var Vue = (function (exports) {
2596
2600
  cb.flags |= 1;
2597
2601
  }
2598
2602
  } else {
2599
- pendingPostFlushCbs.push(...cb);
2603
+ for (let i = 0; i < cb.length; i++) {
2604
+ pendingPostFlushCbs.push(cb[i]);
2605
+ }
2600
2606
  }
2601
2607
  queueFlush();
2602
2608
  }
@@ -2632,7 +2638,9 @@ var Vue = (function (exports) {
2632
2638
  );
2633
2639
  pendingPostFlushCbs.length = 0;
2634
2640
  if (activePostFlushCbs) {
2635
- activePostFlushCbs.push(...deduped);
2641
+ for (let i = 0; i < deduped.length; i++) {
2642
+ activePostFlushCbs.push(deduped[i]);
2643
+ }
2636
2644
  return;
2637
2645
  }
2638
2646
  activePostFlushCbs = deduped;
@@ -2962,10 +2970,12 @@ var Vue = (function (exports) {
2962
2970
  setBlockTracking(-1);
2963
2971
  }
2964
2972
  const prevInstance = setCurrentRenderingInstance(ctx);
2973
+ const prevStackSize = blockStack.length;
2965
2974
  let res;
2966
2975
  try {
2967
2976
  res = fn(...args);
2968
2977
  } finally {
2978
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
2969
2979
  setCurrentRenderingInstance(prevInstance);
2970
2980
  if (renderFnWithContext._d) {
2971
2981
  setBlockTracking(1);
@@ -3891,7 +3901,11 @@ var Vue = (function (exports) {
3891
3901
  function setTransitionHooks(vnode, hooks) {
3892
3902
  if (vnode.shapeFlag & 6 && vnode.component) {
3893
3903
  vnode.transition = hooks;
3894
- setTransitionHooks(vnode.component.subTree, hooks);
3904
+ const subTree = vnode.component.subTree;
3905
+ setTransitionHooks(
3906
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
3907
+ hooks
3908
+ );
3895
3909
  } else if (vnode.shapeFlag & 128) {
3896
3910
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3897
3911
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4051,12 +4065,7 @@ var Vue = (function (exports) {
4051
4065
  }
4052
4066
  }
4053
4067
  if (isFunction(ref)) {
4054
- pauseTracking();
4055
- try {
4056
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4057
- } finally {
4058
- resetTracking();
4059
- }
4068
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4060
4069
  } else {
4061
4070
  const _isString = isString(ref);
4062
4071
  const _isRef = isRef(ref);
@@ -4427,6 +4436,7 @@ Server rendered element contains more child nodes than client vdom.`
4427
4436
  if (props) {
4428
4437
  {
4429
4438
  const isCustomElement = el.tagName.includes("-");
4439
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4430
4440
  for (const key in props) {
4431
4441
  if (// #11189 skip if this node has directives that have created hooks
4432
4442
  // as it could have mutated the DOM in any possible way
@@ -4435,7 +4445,10 @@ Server rendered element contains more child nodes than client vdom.`
4435
4445
  }
4436
4446
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4437
4447
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4438
- patchProp(el, key, null, props[key], void 0, parentComponent);
4448
+ if (isUnchangedResourceProp(el, key, props[key])) {
4449
+ continue;
4450
+ }
4451
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4439
4452
  }
4440
4453
  }
4441
4454
  }
@@ -4617,6 +4630,13 @@ Server rendered element contains fewer child nodes than client vdom.`
4617
4630
  };
4618
4631
  return [hydrate, hydrateNode];
4619
4632
  }
4633
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
4634
+ function isUnchangedResourceProp(el, key, clientValue) {
4635
+ if (!resourceProps.has(key)) {
4636
+ return false;
4637
+ }
4638
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4639
+ }
4620
4640
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4621
4641
  let mismatchType;
4622
4642
  let mismatchKey;
@@ -4654,7 +4674,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4654
4674
  mismatchKey = "style";
4655
4675
  }
4656
4676
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
4657
- if (isBooleanAttr(key)) {
4677
+ if (key === "hidden") {
4678
+ actual = normalizeHiddenValue(el.getAttribute(key));
4679
+ expected = normalizeHiddenValue(clientValue);
4680
+ } else if (isBooleanAttr(key)) {
4658
4681
  actual = el.hasAttribute(key);
4659
4682
  expected = includeBooleanAttr(clientValue);
4660
4683
  } else if (clientValue == null) {
@@ -4690,6 +4713,15 @@ Server rendered element contains fewer child nodes than client vdom.`
4690
4713
  }
4691
4714
  return false;
4692
4715
  }
4716
+ function normalizeHiddenValue(value) {
4717
+ if (!isRenderableAttrValue(value)) {
4718
+ return false;
4719
+ }
4720
+ if (isString(value)) {
4721
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
4722
+ }
4723
+ return includeBooleanAttr(value) ? "" : false;
4724
+ }
4693
4725
  function toClassSet(str) {
4694
4726
  return new Set(str.trim().split(/\s+/));
4695
4727
  }
@@ -4938,6 +4970,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4938
4970
  name: "AsyncComponentWrapper",
4939
4971
  __asyncLoader: load,
4940
4972
  __asyncHydrate(el, instance, hydrate) {
4973
+ const wasConnected = el.isConnected;
4941
4974
  let patched = false;
4942
4975
  (instance.bu || (instance.bu = [])).push(() => patched = true);
4943
4976
  const performHydrate = () => {
@@ -4949,6 +4982,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4949
4982
  }
4950
4983
  return;
4951
4984
  }
4985
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
4952
4986
  hydrate();
4953
4987
  };
4954
4988
  const doHydrate = hydrateStrategy ? () => {
@@ -5501,14 +5535,16 @@ If this is a native custom element, make sure to exclude it from component resol
5501
5535
  return slots;
5502
5536
  }
5503
5537
 
5504
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5538
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5539
+ if (props == null) props = {};
5505
5540
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5506
- const hasProps = Object.keys(props).length > 0;
5507
- if (name !== "default") props.name = name;
5541
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5542
+ const hasProps = Object.keys(slotProps).length > 0;
5543
+ if (name !== "default") slotProps.name = name;
5508
5544
  return openBlock(), createBlock(
5509
5545
  Fragment,
5510
5546
  null,
5511
- [createVNode("slot", props, fallback && fallback())],
5547
+ [createVNode("slot", slotProps, fallback && fallback())],
5512
5548
  hasProps ? -2 : 64
5513
5549
  );
5514
5550
  }
@@ -5522,26 +5558,34 @@ If this is a native custom element, make sure to exclude it from component resol
5522
5558
  if (slot && slot._c) {
5523
5559
  slot._d = false;
5524
5560
  }
5561
+ const prevStackSize = blockStack.length;
5525
5562
  openBlock();
5526
- const validSlotContent = slot && ensureValidVNode(slot(props));
5527
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5528
- // key attached in the `createSlots` helper, respect that
5529
- validSlotContent && validSlotContent.key;
5530
- const rendered = createBlock(
5531
- Fragment,
5532
- {
5533
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5534
- (!validSlotContent && fallback ? "_fb" : "")
5535
- },
5536
- validSlotContent || (fallback ? fallback() : []),
5537
- validSlotContent && slots._ === 1 ? 64 : -2
5538
- );
5563
+ let rendered;
5564
+ try {
5565
+ const validSlotContent = slot && ensureValidVNode(slot(props));
5566
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
5567
+ // key attached in the `createSlots` helper, respect that
5568
+ validSlotContent && validSlotContent.key;
5569
+ rendered = createBlock(
5570
+ Fragment,
5571
+ {
5572
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5573
+ (!validSlotContent && fallback ? "_fb" : "")
5574
+ },
5575
+ validSlotContent || (fallback ? fallback() : []),
5576
+ validSlotContent && slots._ === 1 ? 64 : -2
5577
+ );
5578
+ } catch (err) {
5579
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
5580
+ throw err;
5581
+ } finally {
5582
+ if (slot && slot._c) {
5583
+ slot._d = true;
5584
+ }
5585
+ }
5539
5586
  if (!noSlotted && rendered.scopeId) {
5540
5587
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
5541
5588
  }
5542
- if (slot && slot._c) {
5543
- slot._d = true;
5544
- }
5545
5589
  return rendered;
5546
5590
  }
5547
5591
  function ensureValidVNode(vnodes) {
@@ -6913,12 +6957,13 @@ If you want to remount the same app, move your app creation logic into a factory
6913
6957
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
6914
6958
  }
6915
6959
  if (vnode.transition) {
6916
- if (!isElementRoot(root)) {
6960
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
6961
+ if (!isElementRoot(child)) {
6917
6962
  warn$1(
6918
6963
  `Component inside <Transition> renders non-element root node that cannot be animated.`
6919
6964
  );
6920
6965
  }
6921
- setTransitionHooks(root, vnode.transition);
6966
+ setTransitionHooks(child, vnode.transition);
6922
6967
  }
6923
6968
  if (setRoot) {
6924
6969
  setRoot(root);
@@ -9566,7 +9611,9 @@ If you want to remount the same app, move your app creation logic into a factory
9566
9611
  let hasUnresolvedAncestor = false;
9567
9612
  while (parent) {
9568
9613
  if (parent.pendingBranch) {
9569
- parent.effects.push(...effects);
9614
+ for (let i = 0; i < effects.length; i++) {
9615
+ parent.effects.push(effects[i]);
9616
+ }
9570
9617
  hasUnresolvedAncestor = true;
9571
9618
  break;
9572
9619
  }
@@ -9931,6 +9978,14 @@ If you want to remount the same app, move your app creation logic into a factory
9931
9978
  if (vnode.key !== vnode.key) {
9932
9979
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
9933
9980
  }
9981
+ if (props && vnode.shapeFlag & 1) {
9982
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
9983
+ if (overwritingProp && hasContentChildren(vnode.children)) {
9984
+ warn$1(
9985
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
9986
+ );
9987
+ }
9988
+ }
9934
9989
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
9935
9990
  !isBlockNode && // has current parent block
9936
9991
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -9944,6 +9999,11 @@ If you want to remount the same app, move your app creation logic into a factory
9944
9999
  }
9945
10000
  return vnode;
9946
10001
  }
10002
+ function hasContentChildren(children) {
10003
+ if (isString(children)) return children !== "";
10004
+ if (isArray(children)) return children.length > 0;
10005
+ return false;
10006
+ }
9947
10007
  const createVNode = createVNodeWithArgsTransform ;
9948
10008
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
9949
10009
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -10380,7 +10440,12 @@ Component that was made reactive: `,
10380
10440
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10381
10441
  if (isSSR) {
10382
10442
  return setupResult.then((resolvedResult) => {
10383
- handleSetupResult(instance, resolvedResult, isSSR);
10443
+ setInSSRSetupState(true);
10444
+ try {
10445
+ handleSetupResult(instance, resolvedResult, isSSR);
10446
+ } finally {
10447
+ setInSSRSetupState(false);
10448
+ }
10384
10449
  }).catch((e) => {
10385
10450
  handleError(e, instance, 0);
10386
10451
  });
@@ -10844,7 +10909,7 @@ Component that was made reactive: `,
10844
10909
  return true;
10845
10910
  }
10846
10911
 
10847
- const version = "3.5.39";
10912
+ const version = "3.5.41";
10848
10913
  const warn = warn$1 ;
10849
10914
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10850
10915
  const devtools = devtools$1 ;
@@ -11795,7 +11860,9 @@ Expected function or array of functions, received type ${typeof value}.`
11795
11860
  if (parent && parent._pendingResolve) {
11796
11861
  this._pendingResolve = parent._pendingResolve.then(() => {
11797
11862
  this._pendingResolve = void 0;
11798
- this._resolveDef();
11863
+ if (this.isConnected) {
11864
+ return this._resolveDef();
11865
+ }
11799
11866
  });
11800
11867
  } else {
11801
11868
  this._resolveDef();
@@ -11845,7 +11912,7 @@ Expected function or array of functions, received type ${typeof value}.`
11845
11912
  */
11846
11913
  _resolveDef() {
11847
11914
  if (this._pendingResolve) {
11848
- return;
11915
+ return this._pendingResolve;
11849
11916
  }
11850
11917
  for (let i = 0; i < this.attributes.length; i++) {
11851
11918
  this._setAttr(this.attributes[i].name);
@@ -11885,6 +11952,7 @@ Expected function or array of functions, received type ${typeof value}.`
11885
11952
  def.configureApp = this._def.configureApp;
11886
11953
  resolve(this._def = def, true);
11887
11954
  });
11955
+ return this._pendingResolve;
11888
11956
  } else {
11889
11957
  resolve(this._def);
11890
11958
  }
@@ -11922,6 +11990,11 @@ Expected function or array of functions, received type ${typeof value}.`
11922
11990
  }
11923
11991
  }
11924
11992
  for (const key of declaredPropKeys.map(camelize)) {
11993
+ if (key in Object.getPrototypeOf(this)) {
11994
+ warn(
11995
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
11996
+ );
11997
+ }
11925
11998
  Object.defineProperty(this, key, {
11926
11999
  get() {
11927
12000
  return this._getProp(key);
@@ -12394,6 +12467,7 @@ Expected function or array of functions, received type ${typeof value}.`
12394
12467
  }
12395
12468
  }
12396
12469
  const assignKey = /* @__PURE__ */ Symbol("_assign");
12470
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
12397
12471
  function castValue(value, trim, number) {
12398
12472
  if (trim) value = value.trim();
12399
12473
  if (number) value = looseToNumber(value);
@@ -12401,6 +12475,13 @@ Expected function or array of functions, received type ${typeof value}.`
12401
12475
  }
12402
12476
  const vModelText = {
12403
12477
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
12478
+ if (el.parentNode) {
12479
+ if (el.type === "text") {
12480
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
12481
+ } else if (el.type === "textarea") {
12482
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
12483
+ }
12484
+ }
12404
12485
  el[assignKey] = getModelAssigner(vnode);
12405
12486
  const castToNumber = number || vnode.props && vnode.props.type === "number";
12406
12487
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -12419,8 +12500,15 @@ Expected function or array of functions, received type ${typeof value}.`
12419
12500
  }
12420
12501
  },
12421
12502
  // set value on mounted so it's after min/max for type="range"
12422
- mounted(el, { value }) {
12423
- el.value = value == null ? "" : value;
12503
+ mounted(el, { value, modifiers: { trim, number } }) {
12504
+ const newValue = value == null ? "" : value;
12505
+ const initialValue = el[initialValueKey];
12506
+ delete el[initialValueKey];
12507
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
12508
+ el[assignKey](castValue(el.value, trim, number));
12509
+ } else {
12510
+ el.value = newValue;
12511
+ }
12424
12512
  },
12425
12513
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
12426
12514
  el[assignKey] = getModelAssigner(vnode);
@@ -12516,13 +12604,13 @@ Expected function or array of functions, received type ${typeof value}.`
12516
12604
  // <select multiple> value need to be deep traversed
12517
12605
  deep: true,
12518
12606
  created(el, { value, modifiers: { number } }, vnode) {
12519
- const isSetModel = isSet(value);
12607
+ el._modelValue = value;
12520
12608
  addEventListener(el, "change", () => {
12521
12609
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12522
12610
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12523
12611
  );
12524
12612
  el[assignKey](
12525
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12613
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12526
12614
  );
12527
12615
  el._assigning = true;
12528
12616
  nextTick(() => {
@@ -12536,7 +12624,8 @@ Expected function or array of functions, received type ${typeof value}.`
12536
12624
  mounted(el, { value }) {
12537
12625
  setSelected(el, value);
12538
12626
  },
12539
- beforeUpdate(el, _binding, vnode) {
12627
+ beforeUpdate(el, { value }, vnode) {
12628
+ el._modelValue = value;
12540
12629
  el[assignKey] = getModelAssigner(vnode);
12541
12630
  },
12542
12631
  updated(el, { value }) {