vue 3.5.16 → 3.5.18

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.16
2
+ * vue v3.5.18
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.16
2
+ * vue v3.5.18
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -129,7 +129,7 @@ var Vue = (function (exports) {
129
129
  [512]: `NEED_PATCH`,
130
130
  [1024]: `DYNAMIC_SLOTS`,
131
131
  [2048]: `DEV_ROOT_FRAGMENT`,
132
- [-1]: `HOISTED`,
132
+ [-1]: `CACHED`,
133
133
  [-2]: `BAIL`
134
134
  };
135
135
 
@@ -387,6 +387,24 @@ var Vue = (function (exports) {
387
387
  );
388
388
  };
389
389
 
390
+ function normalizeCssVarValue(value) {
391
+ if (value == null) {
392
+ return "initial";
393
+ }
394
+ if (typeof value === "string") {
395
+ return value === "" ? " " : value;
396
+ }
397
+ if (typeof value !== "number" || !Number.isFinite(value)) {
398
+ {
399
+ console.warn(
400
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
401
+ value
402
+ );
403
+ }
404
+ }
405
+ return String(value);
406
+ }
407
+
390
408
  function warn$2(msg, ...args) {
391
409
  console.warn(`[Vue warn] ${msg}`, ...args);
392
410
  }
@@ -860,6 +878,7 @@ var Vue = (function (exports) {
860
878
  }
861
879
  }
862
880
  class Dep {
881
+ // TODO isolatedDeclarations "__v_skip"
863
882
  constructor(computed) {
864
883
  this.computed = computed;
865
884
  this.version = 0;
@@ -880,6 +899,10 @@ var Vue = (function (exports) {
880
899
  * Subscriber counter
881
900
  */
882
901
  this.sc = 0;
902
+ /**
903
+ * @internal
904
+ */
905
+ this.__v_skip = true;
883
906
  {
884
907
  this.subsHead = void 0;
885
908
  }
@@ -4449,10 +4472,8 @@ Server rendered element contains fewer child nodes than client vdom.`
4449
4472
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4450
4473
  const cssVars = instance.getCssVars();
4451
4474
  for (const key in cssVars) {
4452
- expectedMap.set(
4453
- `--${getEscapedCssVarName(key)}`,
4454
- String(cssVars[key])
4455
- );
4475
+ const value = normalizeCssVarValue(cssVars[key]);
4476
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4456
4477
  }
4457
4478
  }
4458
4479
  if (vnode === root && instance.parent) {
@@ -4483,7 +4504,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4483
4504
  if (allowedType === 0 /* TEXT */ && list.includes("children")) {
4484
4505
  return true;
4485
4506
  }
4486
- return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
4507
+ return list.includes(MismatchTypeString[allowedType]);
4487
4508
  }
4488
4509
  }
4489
4510
 
@@ -4641,16 +4662,19 @@ Server rendered element contains fewer child nodes than client vdom.`
4641
4662
  __asyncLoader: load,
4642
4663
  __asyncHydrate(el, instance, hydrate) {
4643
4664
  let patched = false;
4644
- const doHydrate = hydrateStrategy ? () => {
4645
- const performHydrate = () => {
4646
- if (patched) {
4665
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
4666
+ const performHydrate = () => {
4667
+ if (patched) {
4668
+ {
4647
4669
  warn$1(
4648
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
4670
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
4649
4671
  );
4650
- return;
4651
4672
  }
4652
- hydrate();
4653
- };
4673
+ return;
4674
+ }
4675
+ hydrate();
4676
+ };
4677
+ const doHydrate = hydrateStrategy ? () => {
4654
4678
  const teardown = hydrateStrategy(
4655
4679
  performHydrate,
4656
4680
  (cb) => forEachElement(el, cb)
@@ -4658,8 +4682,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4658
4682
  if (teardown) {
4659
4683
  (instance.bum || (instance.bum = [])).push(teardown);
4660
4684
  }
4661
- (instance.u || (instance.u = [])).push(() => patched = true);
4662
- } : hydrate;
4685
+ } : performHydrate;
4663
4686
  if (resolvedComp) {
4664
4687
  doHydrate();
4665
4688
  } else {
@@ -5532,15 +5555,15 @@ If this is a native custom element, make sure to exclude it from component resol
5532
5555
  return null;
5533
5556
  }
5534
5557
  function useSlots() {
5535
- return getContext().slots;
5558
+ return getContext("useSlots").slots;
5536
5559
  }
5537
5560
  function useAttrs() {
5538
- return getContext().attrs;
5561
+ return getContext("useAttrs").attrs;
5539
5562
  }
5540
- function getContext() {
5563
+ function getContext(calledFunctionName) {
5541
5564
  const i = getCurrentInstance();
5542
5565
  if (!i) {
5543
- warn$1(`useContext() called without active instance.`);
5566
+ warn$1(`${calledFunctionName}() called without active instance.`);
5544
5567
  }
5545
5568
  return i.setupContext || (i.setupContext = createSetupContext(i));
5546
5569
  }
@@ -5791,7 +5814,8 @@ If this is a native custom element, make sure to exclude it from component resol
5791
5814
  expose.forEach((key) => {
5792
5815
  Object.defineProperty(exposed, key, {
5793
5816
  get: () => publicThis[key],
5794
- set: (val) => publicThis[key] = val
5817
+ set: (val) => publicThis[key] = val,
5818
+ enumerable: true
5795
5819
  });
5796
5820
  });
5797
5821
  } else if (!instance.exposed) {
@@ -6238,7 +6262,7 @@ If you want to remount the same app, move your app creation logic into a factory
6238
6262
  }
6239
6263
  }
6240
6264
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
6241
- const instance = currentInstance || currentRenderingInstance;
6265
+ const instance = getCurrentInstance();
6242
6266
  if (instance || currentApp) {
6243
6267
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
6244
6268
  if (provides && key in provides) {
@@ -6253,7 +6277,7 @@ If you want to remount the same app, move your app creation logic into a factory
6253
6277
  }
6254
6278
  }
6255
6279
  function hasInjectionContext() {
6256
- return !!(currentInstance || currentRenderingInstance || currentApp);
6280
+ return !!(getCurrentInstance() || currentApp);
6257
6281
  }
6258
6282
 
6259
6283
  const internalObjectProto = {};
@@ -6667,7 +6691,7 @@ If you want to remount the same app, move your app creation logic into a factory
6667
6691
  return args.some((elem) => elem.toLowerCase() === "boolean");
6668
6692
  }
6669
6693
 
6670
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6694
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
6671
6695
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6672
6696
  const normalizeSlot = (key, rawSlot, ctx) => {
6673
6697
  if (rawSlot._n) {
@@ -6721,6 +6745,8 @@ If you want to remount the same app, move your app creation logic into a factory
6721
6745
  const initSlots = (instance, children, optimized) => {
6722
6746
  const slots = instance.slots = createInternalObject();
6723
6747
  if (instance.vnode.shapeFlag & 32) {
6748
+ const cacheIndexes = children.__;
6749
+ if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6724
6750
  const type = children._;
6725
6751
  if (type) {
6726
6752
  assignSlots(slots, children, optimized);
@@ -6932,6 +6958,8 @@ If you want to remount the same app, move your app creation logic into a factory
6932
6958
  }
6933
6959
  if (ref != null && parentComponent) {
6934
6960
  setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
6961
+ } else if (ref == null && n1 && n1.ref != null) {
6962
+ setRef(n1.ref, null, parentSuspense, n1, true);
6935
6963
  }
6936
6964
  };
6937
6965
  const processText = (n1, n2, container, anchor) => {
@@ -7405,6 +7433,7 @@ If you want to remount the same app, move your app creation logic into a factory
7405
7433
  if (!initialVNode.el) {
7406
7434
  const placeholder = instance.subTree = createVNode(Comment);
7407
7435
  processCommentNode(null, placeholder, container, anchor);
7436
+ initialVNode.placeholder = placeholder.el;
7408
7437
  }
7409
7438
  } else {
7410
7439
  setupRenderEffect(
@@ -7491,7 +7520,8 @@ If you want to remount the same app, move your app creation logic into a factory
7491
7520
  hydrateSubTree();
7492
7521
  }
7493
7522
  } else {
7494
- if (root.ce) {
7523
+ if (root.ce && // @ts-expect-error _def is private
7524
+ root.ce._def.shadowRoot !== false) {
7495
7525
  root.ce._injectChildStyle(type);
7496
7526
  }
7497
7527
  {
@@ -7905,7 +7935,11 @@ If you want to remount the same app, move your app creation logic into a factory
7905
7935
  for (i = toBePatched - 1; i >= 0; i--) {
7906
7936
  const nextIndex = s2 + i;
7907
7937
  const nextChild = c2[nextIndex];
7908
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
7938
+ const anchorVNode = c2[nextIndex + 1];
7939
+ const anchor = nextIndex + 1 < l2 ? (
7940
+ // #13559, fallback to el placeholder for unresolved async component
7941
+ anchorVNode.el || anchorVNode.placeholder
7942
+ ) : parentAnchor;
7909
7943
  if (newIndexToOldIndexMap[i] === 0) {
7910
7944
  patch(
7911
7945
  null,
@@ -9770,6 +9804,7 @@ Component that was made reactive: `,
9770
9804
  suspense: vnode.suspense,
9771
9805
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
9772
9806
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
9807
+ placeholder: vnode.placeholder,
9773
9808
  el: vnode.el,
9774
9809
  anchor: vnode.anchor,
9775
9810
  ctx: vnode.ctx,
@@ -10547,7 +10582,7 @@ Component that was made reactive: `,
10547
10582
  return true;
10548
10583
  }
10549
10584
 
10550
- const version = "3.5.16";
10585
+ const version = "3.5.18";
10551
10586
  const warn = warn$1 ;
10552
10587
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10553
10588
  const devtools = devtools$1 ;
@@ -11041,8 +11076,9 @@ Component that was made reactive: `,
11041
11076
  const style = el.style;
11042
11077
  let cssText = "";
11043
11078
  for (const key in vars) {
11044
- style.setProperty(`--${key}`, vars[key]);
11045
- cssText += `--${key}: ${vars[key]};`;
11079
+ const value = normalizeCssVarValue(vars[key]);
11080
+ style.setProperty(`--${key}`, value);
11081
+ cssText += `--${key}: ${value};`;
11046
11082
  }
11047
11083
  style[CSS_VAR_TEXT] = cssText;
11048
11084
  }
@@ -11531,9 +11567,10 @@ Expected function or array of functions, received type ${typeof value}.`
11531
11567
  };
11532
11568
  const asyncDef = this._def.__asyncLoader;
11533
11569
  if (asyncDef) {
11534
- this._pendingResolve = asyncDef().then(
11535
- (def) => resolve(this._def = def, true)
11536
- );
11570
+ this._pendingResolve = asyncDef().then((def) => {
11571
+ def.configureApp = this._def.configureApp;
11572
+ resolve(this._def = def, true);
11573
+ });
11537
11574
  } else {
11538
11575
  resolve(this._def);
11539
11576
  }
@@ -13254,7 +13291,7 @@ Make sure to use the production build (*.prod.js) when deploying for production.
13254
13291
  this.buffer = input;
13255
13292
  while (this.index < this.buffer.length) {
13256
13293
  const c = this.buffer.charCodeAt(this.index);
13257
- if (c === 10) {
13294
+ if (c === 10 && this.state !== 33) {
13258
13295
  this.newlines.push(this.index);
13259
13296
  }
13260
13297
  switch (this.state) {
@@ -13531,7 +13568,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13531
13568
  return BASE_TRANSITION;
13532
13569
  }
13533
13570
  }
13534
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
13571
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
13535
13572
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13536
13573
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13537
13574
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -13643,6 +13680,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13643
13680
  function isText$1(node) {
13644
13681
  return node.type === 5 || node.type === 2;
13645
13682
  }
13683
+ function isVPre(p) {
13684
+ return p.type === 7 && p.name === "pre";
13685
+ }
13646
13686
  function isVSlot(p) {
13647
13687
  return p.type === 7 && p.name === "slot";
13648
13688
  }
@@ -13901,7 +13941,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13901
13941
  ondirarg(start, end) {
13902
13942
  if (start === end) return;
13903
13943
  const arg = getSlice(start, end);
13904
- if (inVPre) {
13944
+ if (inVPre && !isVPre(currentProp)) {
13905
13945
  currentProp.name += arg;
13906
13946
  setLocEnd(currentProp.nameLoc, end);
13907
13947
  } else {
@@ -13916,7 +13956,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13916
13956
  },
13917
13957
  ondirmodifier(start, end) {
13918
13958
  const mod = getSlice(start, end);
13919
- if (inVPre) {
13959
+ if (inVPre && !isVPre(currentProp)) {
13920
13960
  currentProp.name += "." + mod;
13921
13961
  setLocEnd(currentProp.nameLoc, end);
13922
13962
  } else if (currentProp.name === "slot") {
@@ -14259,7 +14299,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14259
14299
  return c > 64 && c < 91;
14260
14300
  }
14261
14301
  const windowsNewlineRE = /\r\n/g;
14262
- function condenseWhitespace(nodes, tag) {
14302
+ function condenseWhitespace(nodes) {
14263
14303
  const shouldCondense = currentOptions.whitespace !== "preserve";
14264
14304
  let removedWhitespace = false;
14265
14305
  for (let i = 0; i < nodes.length; i++) {
@@ -14423,12 +14463,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14423
14463
  context,
14424
14464
  // Root node is unfortunately non-hoistable due to potential parent
14425
14465
  // fallthrough attributes.
14426
- isSingleElementRoot(root, root.children[0])
14466
+ !!getSingleElementRoot(root)
14427
14467
  );
14428
14468
  }
14429
- function isSingleElementRoot(root, child) {
14430
- const { children } = root;
14431
- return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
14469
+ function getSingleElementRoot(root) {
14470
+ const children = root.children.filter((x) => x.type !== 3);
14471
+ return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
14432
14472
  }
14433
14473
  function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14434
14474
  const { children } = node;
@@ -14461,6 +14501,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14461
14501
  } else if (child.type === 12) {
14462
14502
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14463
14503
  if (constantType >= 2) {
14504
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
14505
+ child.codegenNode.arguments.push(
14506
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
14507
+ );
14508
+ }
14464
14509
  toCache.push(child);
14465
14510
  continue;
14466
14511
  }
@@ -14888,15 +14933,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14888
14933
  const { helper } = context;
14889
14934
  const { children } = root;
14890
14935
  if (children.length === 1) {
14891
- const child = children[0];
14892
- if (isSingleElementRoot(root, child) && child.codegenNode) {
14893
- const codegenNode = child.codegenNode;
14936
+ const singleElementRootChild = getSingleElementRoot(root);
14937
+ if (singleElementRootChild && singleElementRootChild.codegenNode) {
14938
+ const codegenNode = singleElementRootChild.codegenNode;
14894
14939
  if (codegenNode.type === 13) {
14895
14940
  convertToBlock(codegenNode, context);
14896
14941
  }
14897
14942
  root.codegenNode = codegenNode;
14898
14943
  } else {
14899
- root.codegenNode = child;
14944
+ root.codegenNode = children[0];
14900
14945
  }
14901
14946
  } else if (children.length > 1) {
14902
14947
  let patchFlag = 64;
@@ -15896,7 +15941,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15896
15941
  arg.children.unshift(`(`);
15897
15942
  arg.children.push(`) || ""`);
15898
15943
  } else if (!arg.isStatic) {
15899
- arg.content = `${arg.content} || ""`;
15944
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
15900
15945
  }
15901
15946
  if (modifiers.some((mod) => mod.content === "camel")) {
15902
15947
  if (arg.type === 4) {
@@ -16243,7 +16288,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16243
16288
  let prev;
16244
16289
  while (j--) {
16245
16290
  prev = children[j];
16246
- if (prev.type !== 3) {
16291
+ if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
16247
16292
  break;
16248
16293
  }
16249
16294
  }