vue 3.5.17 → 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.17
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.17
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.17
2
+ * vue v3.5.18
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -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
  }
@@ -4451,10 +4469,8 @@ function resolveCssVars(instance, vnode, expectedMap) {
4451
4469
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4452
4470
  const cssVars = instance.getCssVars();
4453
4471
  for (const key in cssVars) {
4454
- expectedMap.set(
4455
- `--${getEscapedCssVarName(key)}`,
4456
- String(cssVars[key])
4457
- );
4472
+ const value = normalizeCssVarValue(cssVars[key]);
4473
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4458
4474
  }
4459
4475
  }
4460
4476
  if (vnode === root && instance.parent) {
@@ -4643,16 +4659,19 @@ function defineAsyncComponent(source) {
4643
4659
  __asyncLoader: load,
4644
4660
  __asyncHydrate(el, instance, hydrate) {
4645
4661
  let patched = false;
4646
- const doHydrate = hydrateStrategy ? () => {
4647
- const performHydrate = () => {
4648
- if (patched) {
4662
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
4663
+ const performHydrate = () => {
4664
+ if (patched) {
4665
+ {
4649
4666
  warn$1(
4650
- `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.`
4651
4668
  );
4652
- return;
4653
4669
  }
4654
- hydrate();
4655
- };
4670
+ return;
4671
+ }
4672
+ hydrate();
4673
+ };
4674
+ const doHydrate = hydrateStrategy ? () => {
4656
4675
  const teardown = hydrateStrategy(
4657
4676
  performHydrate,
4658
4677
  (cb) => forEachElement(el, cb)
@@ -4660,8 +4679,7 @@ function defineAsyncComponent(source) {
4660
4679
  if (teardown) {
4661
4680
  (instance.bum || (instance.bum = [])).push(teardown);
4662
4681
  }
4663
- (instance.u || (instance.u = [])).push(() => patched = true);
4664
- } : hydrate;
4682
+ } : performHydrate;
4665
4683
  if (resolvedComp) {
4666
4684
  doHydrate();
4667
4685
  } else {
@@ -5540,15 +5558,15 @@ function withDefaults(props, defaults) {
5540
5558
  return null;
5541
5559
  }
5542
5560
  function useSlots() {
5543
- return getContext().slots;
5561
+ return getContext("useSlots").slots;
5544
5562
  }
5545
5563
  function useAttrs() {
5546
- return getContext().attrs;
5564
+ return getContext("useAttrs").attrs;
5547
5565
  }
5548
- function getContext() {
5566
+ function getContext(calledFunctionName) {
5549
5567
  const i = getCurrentInstance();
5550
5568
  if (!i) {
5551
- warn$1(`useContext() called without active instance.`);
5569
+ warn$1(`${calledFunctionName}() called without active instance.`);
5552
5570
  }
5553
5571
  return i.setupContext || (i.setupContext = createSetupContext(i));
5554
5572
  }
@@ -5799,7 +5817,8 @@ function applyOptions(instance) {
5799
5817
  expose.forEach((key) => {
5800
5818
  Object.defineProperty(exposed, key, {
5801
5819
  get: () => publicThis[key],
5802
- set: (val) => publicThis[key] = val
5820
+ set: (val) => publicThis[key] = val,
5821
+ enumerable: true
5803
5822
  });
5804
5823
  });
5805
5824
  } else if (!instance.exposed) {
@@ -6249,7 +6268,7 @@ function provide(key, value) {
6249
6268
  }
6250
6269
  }
6251
6270
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
6252
- const instance = currentInstance || currentRenderingInstance;
6271
+ const instance = getCurrentInstance();
6253
6272
  if (instance || currentApp) {
6254
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;
6255
6274
  if (provides && key in provides) {
@@ -6264,7 +6283,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6264
6283
  }
6265
6284
  }
6266
6285
  function hasInjectionContext() {
6267
- return !!(currentInstance || currentRenderingInstance || currentApp);
6286
+ return !!(getCurrentInstance() || currentApp);
6268
6287
  }
6269
6288
 
6270
6289
  const internalObjectProto = {};
@@ -6678,7 +6697,7 @@ function isBoolean(...args) {
6678
6697
  return args.some((elem) => elem.toLowerCase() === "boolean");
6679
6698
  }
6680
6699
 
6681
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6700
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
6682
6701
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6683
6702
  const normalizeSlot = (key, rawSlot, ctx) => {
6684
6703
  if (rawSlot._n) {
@@ -7420,6 +7439,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7420
7439
  if (!initialVNode.el) {
7421
7440
  const placeholder = instance.subTree = createVNode(Comment);
7422
7441
  processCommentNode(null, placeholder, container, anchor);
7442
+ initialVNode.placeholder = placeholder.el;
7423
7443
  }
7424
7444
  } else {
7425
7445
  setupRenderEffect(
@@ -7921,7 +7941,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7921
7941
  for (i = toBePatched - 1; i >= 0; i--) {
7922
7942
  const nextIndex = s2 + i;
7923
7943
  const nextChild = c2[nextIndex];
7924
- 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;
7925
7949
  if (newIndexToOldIndexMap[i] === 0) {
7926
7950
  patch(
7927
7951
  null,
@@ -9814,6 +9838,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9814
9838
  suspense: vnode.suspense,
9815
9839
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
9816
9840
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
9841
+ placeholder: vnode.placeholder,
9817
9842
  el: vnode.el,
9818
9843
  anchor: vnode.anchor,
9819
9844
  ctx: vnode.ctx,
@@ -10605,7 +10630,7 @@ function isMemoSame(cached, memo) {
10605
10630
  return true;
10606
10631
  }
10607
10632
 
10608
- const version = "3.5.17";
10633
+ const version = "3.5.18";
10609
10634
  const warn = warn$1 ;
10610
10635
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10611
10636
  const devtools = devtools$1 ;
@@ -11118,8 +11143,9 @@ function setVarsOnNode(el, vars) {
11118
11143
  const style = el.style;
11119
11144
  let cssText = "";
11120
11145
  for (const key in vars) {
11121
- style.setProperty(`--${key}`, vars[key]);
11122
- cssText += `--${key}: ${vars[key]};`;
11146
+ const value = normalizeCssVarValue(vars[key]);
11147
+ style.setProperty(`--${key}`, value);
11148
+ cssText += `--${key}: ${value};`;
11123
11149
  }
11124
11150
  style[CSS_VAR_TEXT] = cssText;
11125
11151
  }
@@ -13834,7 +13860,7 @@ function isCoreComponent(tag) {
13834
13860
  return BASE_TRANSITION;
13835
13861
  }
13836
13862
  }
13837
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
13863
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
13838
13864
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13839
13865
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13840
13866
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -13946,6 +13972,9 @@ function hasDynamicKeyVBind(node) {
13946
13972
  function isText$1(node) {
13947
13973
  return node.type === 5 || node.type === 2;
13948
13974
  }
13975
+ function isVPre(p) {
13976
+ return p.type === 7 && p.name === "pre";
13977
+ }
13949
13978
  function isVSlot(p) {
13950
13979
  return p.type === 7 && p.name === "slot";
13951
13980
  }
@@ -14204,7 +14233,7 @@ const tokenizer = new Tokenizer(stack, {
14204
14233
  ondirarg(start, end) {
14205
14234
  if (start === end) return;
14206
14235
  const arg = getSlice(start, end);
14207
- if (inVPre) {
14236
+ if (inVPre && !isVPre(currentProp)) {
14208
14237
  currentProp.name += arg;
14209
14238
  setLocEnd(currentProp.nameLoc, end);
14210
14239
  } else {
@@ -14219,7 +14248,7 @@ const tokenizer = new Tokenizer(stack, {
14219
14248
  },
14220
14249
  ondirmodifier(start, end) {
14221
14250
  const mod = getSlice(start, end);
14222
- if (inVPre) {
14251
+ if (inVPre && !isVPre(currentProp)) {
14223
14252
  currentProp.name += "." + mod;
14224
14253
  setLocEnd(currentProp.nameLoc, end);
14225
14254
  } else if (currentProp.name === "slot") {
@@ -14764,6 +14793,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14764
14793
  } else if (child.type === 12) {
14765
14794
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14766
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
+ }
14767
14801
  toCache.push(child);
14768
14802
  continue;
14769
14803
  }
@@ -16199,7 +16233,7 @@ const transformBind = (dir, _node, context) => {
16199
16233
  arg.children.unshift(`(`);
16200
16234
  arg.children.push(`) || ""`);
16201
16235
  } else if (!arg.isStatic) {
16202
- arg.content = `${arg.content} || ""`;
16236
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
16203
16237
  }
16204
16238
  if (modifiers.some((mod) => mod.content === "camel")) {
16205
16239
  if (arg.type === 4) {