@vue/compat 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.17
2
+ * @vue/compat 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
  }
@@ -4982,10 +5000,8 @@ function resolveCssVars(instance, vnode, expectedMap) {
4982
5000
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4983
5001
  const cssVars = instance.getCssVars();
4984
5002
  for (const key in cssVars) {
4985
- expectedMap.set(
4986
- `--${getEscapedCssVarName(key)}`,
4987
- String(cssVars[key])
4988
- );
5003
+ const value = normalizeCssVarValue(cssVars[key]);
5004
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4989
5005
  }
4990
5006
  }
4991
5007
  if (vnode === root && instance.parent) {
@@ -5174,16 +5190,19 @@ function defineAsyncComponent(source) {
5174
5190
  __asyncLoader: load,
5175
5191
  __asyncHydrate(el, instance, hydrate) {
5176
5192
  let patched = false;
5177
- const doHydrate = hydrateStrategy ? () => {
5178
- const performHydrate = () => {
5179
- if (patched) {
5193
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5194
+ const performHydrate = () => {
5195
+ if (patched) {
5196
+ {
5180
5197
  warn$1(
5181
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
5198
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5182
5199
  );
5183
- return;
5184
5200
  }
5185
- hydrate();
5186
- };
5201
+ return;
5202
+ }
5203
+ hydrate();
5204
+ };
5205
+ const doHydrate = hydrateStrategy ? () => {
5187
5206
  const teardown = hydrateStrategy(
5188
5207
  performHydrate,
5189
5208
  (cb) => forEachElement(el, cb)
@@ -5191,8 +5210,7 @@ function defineAsyncComponent(source) {
5191
5210
  if (teardown) {
5192
5211
  (instance.bum || (instance.bum = [])).push(teardown);
5193
5212
  }
5194
- (instance.u || (instance.u = [])).push(() => patched = true);
5195
- } : hydrate;
5213
+ } : performHydrate;
5196
5214
  if (resolvedComp) {
5197
5215
  doHydrate();
5198
5216
  } else {
@@ -6614,15 +6632,15 @@ function withDefaults(props, defaults) {
6614
6632
  return null;
6615
6633
  }
6616
6634
  function useSlots() {
6617
- return getContext().slots;
6635
+ return getContext("useSlots").slots;
6618
6636
  }
6619
6637
  function useAttrs() {
6620
- return getContext().attrs;
6638
+ return getContext("useAttrs").attrs;
6621
6639
  }
6622
- function getContext() {
6640
+ function getContext(calledFunctionName) {
6623
6641
  const i = getCurrentInstance();
6624
6642
  if (!i) {
6625
- warn$1(`useContext() called without active instance.`);
6643
+ warn$1(`${calledFunctionName}() called without active instance.`);
6626
6644
  }
6627
6645
  return i.setupContext || (i.setupContext = createSetupContext(i));
6628
6646
  }
@@ -6881,7 +6899,8 @@ function applyOptions(instance) {
6881
6899
  expose.forEach((key) => {
6882
6900
  Object.defineProperty(exposed, key, {
6883
6901
  get: () => publicThis[key],
6884
- set: (val) => publicThis[key] = val
6902
+ set: (val) => publicThis[key] = val,
6903
+ enumerable: true
6885
6904
  });
6886
6905
  });
6887
6906
  } else if (!instance.exposed) {
@@ -7206,7 +7225,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7206
7225
  return vm;
7207
7226
  }
7208
7227
  }
7209
- Vue.version = `2.6.14-compat:${"3.5.17"}`;
7228
+ Vue.version = `2.6.14-compat:${"3.5.18"}`;
7210
7229
  Vue.config = singletonApp.config;
7211
7230
  Vue.use = (plugin, ...options) => {
7212
7231
  if (plugin && isFunction(plugin.install)) {
@@ -7798,7 +7817,7 @@ function provide(key, value) {
7798
7817
  }
7799
7818
  }
7800
7819
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7801
- const instance = currentInstance || currentRenderingInstance;
7820
+ const instance = getCurrentInstance();
7802
7821
  if (instance || currentApp) {
7803
7822
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7804
7823
  if (provides && key in provides) {
@@ -7813,7 +7832,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
7813
7832
  }
7814
7833
  }
7815
7834
  function hasInjectionContext() {
7816
- return !!(currentInstance || currentRenderingInstance || currentApp);
7835
+ return !!(getCurrentInstance() || currentApp);
7817
7836
  }
7818
7837
 
7819
7838
  function createPropsDefaultThis(instance, rawProps, propKey) {
@@ -8299,7 +8318,7 @@ function isBoolean(...args) {
8299
8318
  return args.some((elem) => elem.toLowerCase() === "boolean");
8300
8319
  }
8301
8320
 
8302
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8321
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8303
8322
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8304
8323
  const normalizeSlot = (key, rawSlot, ctx) => {
8305
8324
  if (rawSlot._n) {
@@ -9042,6 +9061,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9042
9061
  if (!initialVNode.el) {
9043
9062
  const placeholder = instance.subTree = createVNode(Comment);
9044
9063
  processCommentNode(null, placeholder, container, anchor);
9064
+ initialVNode.placeholder = placeholder.el;
9045
9065
  }
9046
9066
  } else {
9047
9067
  setupRenderEffect(
@@ -9567,7 +9587,11 @@ function baseCreateRenderer(options, createHydrationFns) {
9567
9587
  for (i = toBePatched - 1; i >= 0; i--) {
9568
9588
  const nextIndex = s2 + i;
9569
9589
  const nextChild = c2[nextIndex];
9570
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
9590
+ const anchorVNode = c2[nextIndex + 1];
9591
+ const anchor = nextIndex + 1 < l2 ? (
9592
+ // #13559, fallback to el placeholder for unresolved async component
9593
+ anchorVNode.el || anchorVNode.placeholder
9594
+ ) : parentAnchor;
9571
9595
  if (newIndexToOldIndexMap[i] === 0) {
9572
9596
  patch(
9573
9597
  null,
@@ -11562,6 +11586,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
11562
11586
  suspense: vnode.suspense,
11563
11587
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
11564
11588
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
11589
+ placeholder: vnode.placeholder,
11565
11590
  el: vnode.el,
11566
11591
  anchor: vnode.anchor,
11567
11592
  ctx: vnode.ctx,
@@ -12368,7 +12393,7 @@ function isMemoSame(cached, memo) {
12368
12393
  return true;
12369
12394
  }
12370
12395
 
12371
- const version = "3.5.17";
12396
+ const version = "3.5.18";
12372
12397
  const warn = warn$1 ;
12373
12398
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12374
12399
  const devtools = devtools$1 ;
@@ -12925,8 +12950,9 @@ function setVarsOnNode(el, vars) {
12925
12950
  const style = el.style;
12926
12951
  let cssText = "";
12927
12952
  for (const key in vars) {
12928
- style.setProperty(`--${key}`, vars[key]);
12929
- cssText += `--${key}: ${vars[key]};`;
12953
+ const value = normalizeCssVarValue(vars[key]);
12954
+ style.setProperty(`--${key}`, value);
12955
+ cssText += `--${key}: ${value};`;
12930
12956
  }
12931
12957
  style[CSS_VAR_TEXT] = cssText;
12932
12958
  }
@@ -15829,7 +15855,7 @@ function isCoreComponent(tag) {
15829
15855
  return BASE_TRANSITION;
15830
15856
  }
15831
15857
  }
15832
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
15858
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
15833
15859
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
15834
15860
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
15835
15861
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -15941,6 +15967,9 @@ function hasDynamicKeyVBind(node) {
15941
15967
  function isText$1(node) {
15942
15968
  return node.type === 5 || node.type === 2;
15943
15969
  }
15970
+ function isVPre(p) {
15971
+ return p.type === 7 && p.name === "pre";
15972
+ }
15944
15973
  function isVSlot(p) {
15945
15974
  return p.type === 7 && p.name === "slot";
15946
15975
  }
@@ -16199,7 +16228,7 @@ const tokenizer = new Tokenizer(stack, {
16199
16228
  ondirarg(start, end) {
16200
16229
  if (start === end) return;
16201
16230
  const arg = getSlice(start, end);
16202
- if (inVPre) {
16231
+ if (inVPre && !isVPre(currentProp)) {
16203
16232
  currentProp.name += arg;
16204
16233
  setLocEnd(currentProp.nameLoc, end);
16205
16234
  } else {
@@ -16214,7 +16243,7 @@ const tokenizer = new Tokenizer(stack, {
16214
16243
  },
16215
16244
  ondirmodifier(start, end) {
16216
16245
  const mod = getSlice(start, end);
16217
- if (inVPre) {
16246
+ if (inVPre && !isVPre(currentProp)) {
16218
16247
  currentProp.name += "." + mod;
16219
16248
  setLocEnd(currentProp.nameLoc, end);
16220
16249
  } else if (currentProp.name === "slot") {
@@ -16842,6 +16871,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16842
16871
  } else if (child.type === 12) {
16843
16872
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
16844
16873
  if (constantType >= 2) {
16874
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
16875
+ child.codegenNode.arguments.push(
16876
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
16877
+ );
16878
+ }
16845
16879
  toCache.push(child);
16846
16880
  continue;
16847
16881
  }
@@ -18291,7 +18325,7 @@ const transformBind = (dir, _node, context) => {
18291
18325
  arg.children.unshift(`(`);
18292
18326
  arg.children.push(`) || ""`);
18293
18327
  } else if (!arg.isStatic) {
18294
- arg.content = `${arg.content} || ""`;
18328
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
18295
18329
  }
18296
18330
  if (modifiers.some((mod) => mod.content === "camel")) {
18297
18331
  if (arg.type === 4) {