@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
  **/
@@ -311,6 +311,24 @@ const stringifySymbol = (v, i = "") => {
311
311
  );
312
312
  };
313
313
 
314
+ function normalizeCssVarValue(value) {
315
+ if (value == null) {
316
+ return "initial";
317
+ }
318
+ if (typeof value === "string") {
319
+ return value === "" ? " " : value;
320
+ }
321
+ if (typeof value !== "number" || !Number.isFinite(value)) {
322
+ {
323
+ console.warn(
324
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
325
+ value
326
+ );
327
+ }
328
+ }
329
+ return String(value);
330
+ }
331
+
314
332
  function warn$2(msg, ...args) {
315
333
  console.warn(`[Vue warn] ${msg}`, ...args);
316
334
  }
@@ -4909,10 +4927,8 @@ function resolveCssVars(instance, vnode, expectedMap) {
4909
4927
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4910
4928
  const cssVars = instance.getCssVars();
4911
4929
  for (const key in cssVars) {
4912
- expectedMap.set(
4913
- `--${getEscapedCssVarName(key)}`,
4914
- String(cssVars[key])
4915
- );
4930
+ const value = normalizeCssVarValue(cssVars[key]);
4931
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4916
4932
  }
4917
4933
  }
4918
4934
  if (vnode === root && instance.parent) {
@@ -5101,16 +5117,19 @@ function defineAsyncComponent(source) {
5101
5117
  __asyncLoader: load,
5102
5118
  __asyncHydrate(el, instance, hydrate) {
5103
5119
  let patched = false;
5104
- const doHydrate = hydrateStrategy ? () => {
5105
- const performHydrate = () => {
5106
- if (patched) {
5120
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5121
+ const performHydrate = () => {
5122
+ if (patched) {
5123
+ {
5107
5124
  warn$1(
5108
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
5125
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5109
5126
  );
5110
- return;
5111
5127
  }
5112
- hydrate();
5113
- };
5128
+ return;
5129
+ }
5130
+ hydrate();
5131
+ };
5132
+ const doHydrate = hydrateStrategy ? () => {
5114
5133
  const teardown = hydrateStrategy(
5115
5134
  performHydrate,
5116
5135
  (cb) => forEachElement(el, cb)
@@ -5118,8 +5137,7 @@ function defineAsyncComponent(source) {
5118
5137
  if (teardown) {
5119
5138
  (instance.bum || (instance.bum = [])).push(teardown);
5120
5139
  }
5121
- (instance.u || (instance.u = [])).push(() => patched = true);
5122
- } : hydrate;
5140
+ } : performHydrate;
5123
5141
  if (resolvedComp) {
5124
5142
  doHydrate();
5125
5143
  } else {
@@ -6541,15 +6559,15 @@ function withDefaults(props, defaults) {
6541
6559
  return null;
6542
6560
  }
6543
6561
  function useSlots() {
6544
- return getContext().slots;
6562
+ return getContext("useSlots").slots;
6545
6563
  }
6546
6564
  function useAttrs() {
6547
- return getContext().attrs;
6565
+ return getContext("useAttrs").attrs;
6548
6566
  }
6549
- function getContext() {
6567
+ function getContext(calledFunctionName) {
6550
6568
  const i = getCurrentInstance();
6551
6569
  if (!i) {
6552
- warn$1(`useContext() called without active instance.`);
6570
+ warn$1(`${calledFunctionName}() called without active instance.`);
6553
6571
  }
6554
6572
  return i.setupContext || (i.setupContext = createSetupContext(i));
6555
6573
  }
@@ -6808,7 +6826,8 @@ function applyOptions(instance) {
6808
6826
  expose.forEach((key) => {
6809
6827
  Object.defineProperty(exposed, key, {
6810
6828
  get: () => publicThis[key],
6811
- set: (val) => publicThis[key] = val
6829
+ set: (val) => publicThis[key] = val,
6830
+ enumerable: true
6812
6831
  });
6813
6832
  });
6814
6833
  } else if (!instance.exposed) {
@@ -7133,7 +7152,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7133
7152
  return vm;
7134
7153
  }
7135
7154
  }
7136
- Vue.version = `2.6.14-compat:${"3.5.17"}`;
7155
+ Vue.version = `2.6.14-compat:${"3.5.18"}`;
7137
7156
  Vue.config = singletonApp.config;
7138
7157
  Vue.use = (plugin, ...options) => {
7139
7158
  if (plugin && isFunction(plugin.install)) {
@@ -7725,7 +7744,7 @@ function provide(key, value) {
7725
7744
  }
7726
7745
  }
7727
7746
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7728
- const instance = currentInstance || currentRenderingInstance;
7747
+ const instance = getCurrentInstance();
7729
7748
  if (instance || currentApp) {
7730
7749
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7731
7750
  if (provides && key in provides) {
@@ -7740,7 +7759,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
7740
7759
  }
7741
7760
  }
7742
7761
  function hasInjectionContext() {
7743
- return !!(currentInstance || currentRenderingInstance || currentApp);
7762
+ return !!(getCurrentInstance() || currentApp);
7744
7763
  }
7745
7764
 
7746
7765
  function createPropsDefaultThis(instance, rawProps, propKey) {
@@ -8226,7 +8245,7 @@ function isBoolean(...args) {
8226
8245
  return args.some((elem) => elem.toLowerCase() === "boolean");
8227
8246
  }
8228
8247
 
8229
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8248
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8230
8249
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8231
8250
  const normalizeSlot = (key, rawSlot, ctx) => {
8232
8251
  if (rawSlot._n) {
@@ -8969,6 +8988,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8969
8988
  if (!initialVNode.el) {
8970
8989
  const placeholder = instance.subTree = createVNode(Comment);
8971
8990
  processCommentNode(null, placeholder, container, anchor);
8991
+ initialVNode.placeholder = placeholder.el;
8972
8992
  }
8973
8993
  } else {
8974
8994
  setupRenderEffect(
@@ -9494,7 +9514,11 @@ function baseCreateRenderer(options, createHydrationFns) {
9494
9514
  for (i = toBePatched - 1; i >= 0; i--) {
9495
9515
  const nextIndex = s2 + i;
9496
9516
  const nextChild = c2[nextIndex];
9497
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
9517
+ const anchorVNode = c2[nextIndex + 1];
9518
+ const anchor = nextIndex + 1 < l2 ? (
9519
+ // #13559, fallback to el placeholder for unresolved async component
9520
+ anchorVNode.el || anchorVNode.placeholder
9521
+ ) : parentAnchor;
9498
9522
  if (newIndexToOldIndexMap[i] === 0) {
9499
9523
  patch(
9500
9524
  null,
@@ -11489,6 +11513,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
11489
11513
  suspense: vnode.suspense,
11490
11514
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
11491
11515
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
11516
+ placeholder: vnode.placeholder,
11492
11517
  el: vnode.el,
11493
11518
  anchor: vnode.anchor,
11494
11519
  ctx: vnode.ctx,
@@ -12295,7 +12320,7 @@ function isMemoSame(cached, memo) {
12295
12320
  return true;
12296
12321
  }
12297
12322
 
12298
- const version = "3.5.17";
12323
+ const version = "3.5.18";
12299
12324
  const warn = warn$1 ;
12300
12325
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12301
12326
  const devtools = devtools$1 ;
@@ -12852,8 +12877,9 @@ function setVarsOnNode(el, vars) {
12852
12877
  const style = el.style;
12853
12878
  let cssText = "";
12854
12879
  for (const key in vars) {
12855
- style.setProperty(`--${key}`, vars[key]);
12856
- cssText += `--${key}: ${vars[key]};`;
12880
+ const value = normalizeCssVarValue(vars[key]);
12881
+ style.setProperty(`--${key}`, value);
12882
+ cssText += `--${key}: ${value};`;
12857
12883
  }
12858
12884
  style[CSS_VAR_TEXT] = cssText;
12859
12885
  }