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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -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
  **/
@@ -126,7 +126,7 @@ const PatchFlagNames = {
126
126
  [512]: `NEED_PATCH`,
127
127
  [1024]: `DYNAMIC_SLOTS`,
128
128
  [2048]: `DEV_ROOT_FRAGMENT`,
129
- [-1]: `HOISTED`,
129
+ [-1]: `CACHED`,
130
130
  [-2]: `BAIL`
131
131
  };
132
132
 
@@ -384,6 +384,24 @@ const stringifySymbol = (v, i = "") => {
384
384
  );
385
385
  };
386
386
 
387
+ function normalizeCssVarValue(value) {
388
+ if (value == null) {
389
+ return "initial";
390
+ }
391
+ if (typeof value === "string") {
392
+ return value === "" ? " " : value;
393
+ }
394
+ if (typeof value !== "number" || !Number.isFinite(value)) {
395
+ {
396
+ console.warn(
397
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
398
+ value
399
+ );
400
+ }
401
+ }
402
+ return String(value);
403
+ }
404
+
387
405
  function warn$2(msg, ...args) {
388
406
  console.warn(`[Vue warn] ${msg}`, ...args);
389
407
  }
@@ -857,6 +875,7 @@ class Link {
857
875
  }
858
876
  }
859
877
  class Dep {
878
+ // TODO isolatedDeclarations "__v_skip"
860
879
  constructor(computed) {
861
880
  this.computed = computed;
862
881
  this.version = 0;
@@ -877,6 +896,10 @@ class Dep {
877
896
  * Subscriber counter
878
897
  */
879
898
  this.sc = 0;
899
+ /**
900
+ * @internal
901
+ */
902
+ this.__v_skip = true;
880
903
  {
881
904
  this.subsHead = void 0;
882
905
  }
@@ -4446,10 +4469,8 @@ function resolveCssVars(instance, vnode, expectedMap) {
4446
4469
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4447
4470
  const cssVars = instance.getCssVars();
4448
4471
  for (const key in cssVars) {
4449
- expectedMap.set(
4450
- `--${getEscapedCssVarName(key)}`,
4451
- String(cssVars[key])
4452
- );
4472
+ const value = normalizeCssVarValue(cssVars[key]);
4473
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4453
4474
  }
4454
4475
  }
4455
4476
  if (vnode === root && instance.parent) {
@@ -4480,7 +4501,7 @@ function isMismatchAllowed(el, allowedType) {
4480
4501
  if (allowedType === 0 /* TEXT */ && list.includes("children")) {
4481
4502
  return true;
4482
4503
  }
4483
- return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
4504
+ return list.includes(MismatchTypeString[allowedType]);
4484
4505
  }
4485
4506
  }
4486
4507
 
@@ -4638,16 +4659,19 @@ function defineAsyncComponent(source) {
4638
4659
  __asyncLoader: load,
4639
4660
  __asyncHydrate(el, instance, hydrate) {
4640
4661
  let patched = false;
4641
- const doHydrate = hydrateStrategy ? () => {
4642
- const performHydrate = () => {
4643
- if (patched) {
4662
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
4663
+ const performHydrate = () => {
4664
+ if (patched) {
4665
+ {
4644
4666
  warn$1(
4645
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
4667
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
4646
4668
  );
4647
- return;
4648
4669
  }
4649
- hydrate();
4650
- };
4670
+ return;
4671
+ }
4672
+ hydrate();
4673
+ };
4674
+ const doHydrate = hydrateStrategy ? () => {
4651
4675
  const teardown = hydrateStrategy(
4652
4676
  performHydrate,
4653
4677
  (cb) => forEachElement(el, cb)
@@ -4655,8 +4679,7 @@ function defineAsyncComponent(source) {
4655
4679
  if (teardown) {
4656
4680
  (instance.bum || (instance.bum = [])).push(teardown);
4657
4681
  }
4658
- (instance.u || (instance.u = [])).push(() => patched = true);
4659
- } : hydrate;
4682
+ } : performHydrate;
4660
4683
  if (resolvedComp) {
4661
4684
  doHydrate();
4662
4685
  } else {
@@ -5535,15 +5558,15 @@ function withDefaults(props, defaults) {
5535
5558
  return null;
5536
5559
  }
5537
5560
  function useSlots() {
5538
- return getContext().slots;
5561
+ return getContext("useSlots").slots;
5539
5562
  }
5540
5563
  function useAttrs() {
5541
- return getContext().attrs;
5564
+ return getContext("useAttrs").attrs;
5542
5565
  }
5543
- function getContext() {
5566
+ function getContext(calledFunctionName) {
5544
5567
  const i = getCurrentInstance();
5545
5568
  if (!i) {
5546
- warn$1(`useContext() called without active instance.`);
5569
+ warn$1(`${calledFunctionName}() called without active instance.`);
5547
5570
  }
5548
5571
  return i.setupContext || (i.setupContext = createSetupContext(i));
5549
5572
  }
@@ -5794,7 +5817,8 @@ function applyOptions(instance) {
5794
5817
  expose.forEach((key) => {
5795
5818
  Object.defineProperty(exposed, key, {
5796
5819
  get: () => publicThis[key],
5797
- set: (val) => publicThis[key] = val
5820
+ set: (val) => publicThis[key] = val,
5821
+ enumerable: true
5798
5822
  });
5799
5823
  });
5800
5824
  } else if (!instance.exposed) {
@@ -6244,7 +6268,7 @@ function provide(key, value) {
6244
6268
  }
6245
6269
  }
6246
6270
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
6247
- const instance = currentInstance || currentRenderingInstance;
6271
+ const instance = getCurrentInstance();
6248
6272
  if (instance || currentApp) {
6249
6273
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
6250
6274
  if (provides && key in provides) {
@@ -6259,7 +6283,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6259
6283
  }
6260
6284
  }
6261
6285
  function hasInjectionContext() {
6262
- return !!(currentInstance || currentRenderingInstance || currentApp);
6286
+ return !!(getCurrentInstance() || currentApp);
6263
6287
  }
6264
6288
 
6265
6289
  const internalObjectProto = {};
@@ -6673,7 +6697,7 @@ function isBoolean(...args) {
6673
6697
  return args.some((elem) => elem.toLowerCase() === "boolean");
6674
6698
  }
6675
6699
 
6676
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6700
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
6677
6701
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6678
6702
  const normalizeSlot = (key, rawSlot, ctx) => {
6679
6703
  if (rawSlot._n) {
@@ -6727,6 +6751,8 @@ const assignSlots = (slots, children, optimized) => {
6727
6751
  const initSlots = (instance, children, optimized) => {
6728
6752
  const slots = instance.slots = createInternalObject();
6729
6753
  if (instance.vnode.shapeFlag & 32) {
6754
+ const cacheIndexes = children.__;
6755
+ if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6730
6756
  const type = children._;
6731
6757
  if (type) {
6732
6758
  assignSlots(slots, children, optimized);
@@ -6938,6 +6964,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6938
6964
  }
6939
6965
  if (ref != null && parentComponent) {
6940
6966
  setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
6967
+ } else if (ref == null && n1 && n1.ref != null) {
6968
+ setRef(n1.ref, null, parentSuspense, n1, true);
6941
6969
  }
6942
6970
  };
6943
6971
  const processText = (n1, n2, container, anchor) => {
@@ -7411,6 +7439,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7411
7439
  if (!initialVNode.el) {
7412
7440
  const placeholder = instance.subTree = createVNode(Comment);
7413
7441
  processCommentNode(null, placeholder, container, anchor);
7442
+ initialVNode.placeholder = placeholder.el;
7414
7443
  }
7415
7444
  } else {
7416
7445
  setupRenderEffect(
@@ -7497,7 +7526,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7497
7526
  hydrateSubTree();
7498
7527
  }
7499
7528
  } else {
7500
- if (root.ce) {
7529
+ if (root.ce && // @ts-expect-error _def is private
7530
+ root.ce._def.shadowRoot !== false) {
7501
7531
  root.ce._injectChildStyle(type);
7502
7532
  }
7503
7533
  {
@@ -7911,7 +7941,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7911
7941
  for (i = toBePatched - 1; i >= 0; i--) {
7912
7942
  const nextIndex = s2 + i;
7913
7943
  const nextChild = c2[nextIndex];
7914
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
7944
+ const anchorVNode = c2[nextIndex + 1];
7945
+ const anchor = nextIndex + 1 < l2 ? (
7946
+ // #13559, fallback to el placeholder for unresolved async component
7947
+ anchorVNode.el || anchorVNode.placeholder
7948
+ ) : parentAnchor;
7915
7949
  if (newIndexToOldIndexMap[i] === 0) {
7916
7950
  patch(
7917
7951
  null,
@@ -9804,6 +9838,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9804
9838
  suspense: vnode.suspense,
9805
9839
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
9806
9840
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
9841
+ placeholder: vnode.placeholder,
9807
9842
  el: vnode.el,
9808
9843
  anchor: vnode.anchor,
9809
9844
  ctx: vnode.ctx,
@@ -10595,7 +10630,7 @@ function isMemoSame(cached, memo) {
10595
10630
  return true;
10596
10631
  }
10597
10632
 
10598
- const version = "3.5.16";
10633
+ const version = "3.5.18";
10599
10634
  const warn = warn$1 ;
10600
10635
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10601
10636
  const devtools = devtools$1 ;
@@ -11108,8 +11143,9 @@ function setVarsOnNode(el, vars) {
11108
11143
  const style = el.style;
11109
11144
  let cssText = "";
11110
11145
  for (const key in vars) {
11111
- style.setProperty(`--${key}`, vars[key]);
11112
- cssText += `--${key}: ${vars[key]};`;
11146
+ const value = normalizeCssVarValue(vars[key]);
11147
+ style.setProperty(`--${key}`, value);
11148
+ cssText += `--${key}: ${value};`;
11113
11149
  }
11114
11150
  style[CSS_VAR_TEXT] = cssText;
11115
11151
  }
@@ -11598,9 +11634,10 @@ class VueElement extends BaseClass {
11598
11634
  };
11599
11635
  const asyncDef = this._def.__asyncLoader;
11600
11636
  if (asyncDef) {
11601
- this._pendingResolve = asyncDef().then(
11602
- (def) => resolve(this._def = def, true)
11603
- );
11637
+ this._pendingResolve = asyncDef().then((def) => {
11638
+ def.configureApp = this._def.configureApp;
11639
+ resolve(this._def = def, true);
11640
+ });
11604
11641
  } else {
11605
11642
  resolve(this._def);
11606
11643
  }
@@ -13546,7 +13583,7 @@ class Tokenizer {
13546
13583
  this.buffer = input;
13547
13584
  while (this.index < this.buffer.length) {
13548
13585
  const c = this.buffer.charCodeAt(this.index);
13549
- if (c === 10) {
13586
+ if (c === 10 && this.state !== 33) {
13550
13587
  this.newlines.push(this.index);
13551
13588
  }
13552
13589
  switch (this.state) {
@@ -13823,7 +13860,7 @@ function isCoreComponent(tag) {
13823
13860
  return BASE_TRANSITION;
13824
13861
  }
13825
13862
  }
13826
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
13863
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
13827
13864
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13828
13865
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13829
13866
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -13935,6 +13972,9 @@ function hasDynamicKeyVBind(node) {
13935
13972
  function isText$1(node) {
13936
13973
  return node.type === 5 || node.type === 2;
13937
13974
  }
13975
+ function isVPre(p) {
13976
+ return p.type === 7 && p.name === "pre";
13977
+ }
13938
13978
  function isVSlot(p) {
13939
13979
  return p.type === 7 && p.name === "slot";
13940
13980
  }
@@ -14193,7 +14233,7 @@ const tokenizer = new Tokenizer(stack, {
14193
14233
  ondirarg(start, end) {
14194
14234
  if (start === end) return;
14195
14235
  const arg = getSlice(start, end);
14196
- if (inVPre) {
14236
+ if (inVPre && !isVPre(currentProp)) {
14197
14237
  currentProp.name += arg;
14198
14238
  setLocEnd(currentProp.nameLoc, end);
14199
14239
  } else {
@@ -14208,7 +14248,7 @@ const tokenizer = new Tokenizer(stack, {
14208
14248
  },
14209
14249
  ondirmodifier(start, end) {
14210
14250
  const mod = getSlice(start, end);
14211
- if (inVPre) {
14251
+ if (inVPre && !isVPre(currentProp)) {
14212
14252
  currentProp.name += "." + mod;
14213
14253
  setLocEnd(currentProp.nameLoc, end);
14214
14254
  } else if (currentProp.name === "slot") {
@@ -14551,7 +14591,7 @@ function isUpperCase(c) {
14551
14591
  return c > 64 && c < 91;
14552
14592
  }
14553
14593
  const windowsNewlineRE = /\r\n/g;
14554
- function condenseWhitespace(nodes, tag) {
14594
+ function condenseWhitespace(nodes) {
14555
14595
  const shouldCondense = currentOptions.whitespace !== "preserve";
14556
14596
  let removedWhitespace = false;
14557
14597
  for (let i = 0; i < nodes.length; i++) {
@@ -14715,12 +14755,12 @@ function cacheStatic(root, context) {
14715
14755
  context,
14716
14756
  // Root node is unfortunately non-hoistable due to potential parent
14717
14757
  // fallthrough attributes.
14718
- isSingleElementRoot(root, root.children[0])
14758
+ !!getSingleElementRoot(root)
14719
14759
  );
14720
14760
  }
14721
- function isSingleElementRoot(root, child) {
14722
- const { children } = root;
14723
- return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
14761
+ function getSingleElementRoot(root) {
14762
+ const children = root.children.filter((x) => x.type !== 3);
14763
+ return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
14724
14764
  }
14725
14765
  function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14726
14766
  const { children } = node;
@@ -14753,6 +14793,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14753
14793
  } else if (child.type === 12) {
14754
14794
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14755
14795
  if (constantType >= 2) {
14796
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
14797
+ child.codegenNode.arguments.push(
14798
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
14799
+ );
14800
+ }
14756
14801
  toCache.push(child);
14757
14802
  continue;
14758
14803
  }
@@ -15180,15 +15225,15 @@ function createRootCodegen(root, context) {
15180
15225
  const { helper } = context;
15181
15226
  const { children } = root;
15182
15227
  if (children.length === 1) {
15183
- const child = children[0];
15184
- if (isSingleElementRoot(root, child) && child.codegenNode) {
15185
- const codegenNode = child.codegenNode;
15228
+ const singleElementRootChild = getSingleElementRoot(root);
15229
+ if (singleElementRootChild && singleElementRootChild.codegenNode) {
15230
+ const codegenNode = singleElementRootChild.codegenNode;
15186
15231
  if (codegenNode.type === 13) {
15187
15232
  convertToBlock(codegenNode, context);
15188
15233
  }
15189
15234
  root.codegenNode = codegenNode;
15190
15235
  } else {
15191
- root.codegenNode = child;
15236
+ root.codegenNode = children[0];
15192
15237
  }
15193
15238
  } else if (children.length > 1) {
15194
15239
  let patchFlag = 64;
@@ -16188,7 +16233,7 @@ const transformBind = (dir, _node, context) => {
16188
16233
  arg.children.unshift(`(`);
16189
16234
  arg.children.push(`) || ""`);
16190
16235
  } else if (!arg.isStatic) {
16191
- arg.content = `${arg.content} || ""`;
16236
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
16192
16237
  }
16193
16238
  if (modifiers.some((mod) => mod.content === "camel")) {
16194
16239
  if (arg.type === 4) {
@@ -16535,7 +16580,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16535
16580
  let prev;
16536
16581
  while (j--) {
16537
16582
  prev = children[j];
16538
- if (prev.type !== 3) {
16583
+ if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
16539
16584
  break;
16540
16585
  }
16541
16586
  }