@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
+ if (!!(process.env.NODE_ENV !== "production")) {
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
  }
@@ -4939,10 +4957,8 @@ function resolveCssVars(instance, vnode, expectedMap) {
4939
4957
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4940
4958
  const cssVars = instance.getCssVars();
4941
4959
  for (const key in cssVars) {
4942
- expectedMap.set(
4943
- `--${getEscapedCssVarName(key)}`,
4944
- String(cssVars[key])
4945
- );
4960
+ const value = normalizeCssVarValue(cssVars[key]);
4961
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4946
4962
  }
4947
4963
  }
4948
4964
  if (vnode === root && instance.parent) {
@@ -5131,16 +5147,19 @@ function defineAsyncComponent(source) {
5131
5147
  __asyncLoader: load,
5132
5148
  __asyncHydrate(el, instance, hydrate) {
5133
5149
  let patched = false;
5134
- const doHydrate = hydrateStrategy ? () => {
5135
- const performHydrate = () => {
5136
- if (!!(process.env.NODE_ENV !== "production") && patched) {
5150
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5151
+ const performHydrate = () => {
5152
+ if (patched) {
5153
+ if (!!(process.env.NODE_ENV !== "production")) {
5137
5154
  warn$1(
5138
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
5155
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5139
5156
  );
5140
- return;
5141
5157
  }
5142
- hydrate();
5143
- };
5158
+ return;
5159
+ }
5160
+ hydrate();
5161
+ };
5162
+ const doHydrate = hydrateStrategy ? () => {
5144
5163
  const teardown = hydrateStrategy(
5145
5164
  performHydrate,
5146
5165
  (cb) => forEachElement(el, cb)
@@ -5148,8 +5167,7 @@ function defineAsyncComponent(source) {
5148
5167
  if (teardown) {
5149
5168
  (instance.bum || (instance.bum = [])).push(teardown);
5150
5169
  }
5151
- (instance.u || (instance.u = [])).push(() => patched = true);
5152
- } : hydrate;
5170
+ } : performHydrate;
5153
5171
  if (resolvedComp) {
5154
5172
  doHydrate();
5155
5173
  } else {
@@ -6571,15 +6589,15 @@ function withDefaults(props, defaults) {
6571
6589
  return null;
6572
6590
  }
6573
6591
  function useSlots() {
6574
- return getContext().slots;
6592
+ return getContext("useSlots").slots;
6575
6593
  }
6576
6594
  function useAttrs() {
6577
- return getContext().attrs;
6595
+ return getContext("useAttrs").attrs;
6578
6596
  }
6579
- function getContext() {
6597
+ function getContext(calledFunctionName) {
6580
6598
  const i = getCurrentInstance();
6581
6599
  if (!!(process.env.NODE_ENV !== "production") && !i) {
6582
- warn$1(`useContext() called without active instance.`);
6600
+ warn$1(`${calledFunctionName}() called without active instance.`);
6583
6601
  }
6584
6602
  return i.setupContext || (i.setupContext = createSetupContext(i));
6585
6603
  }
@@ -6840,7 +6858,8 @@ function applyOptions(instance) {
6840
6858
  expose.forEach((key) => {
6841
6859
  Object.defineProperty(exposed, key, {
6842
6860
  get: () => publicThis[key],
6843
- set: (val) => publicThis[key] = val
6861
+ set: (val) => publicThis[key] = val,
6862
+ enumerable: true
6844
6863
  });
6845
6864
  });
6846
6865
  } else if (!instance.exposed) {
@@ -7165,7 +7184,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7165
7184
  return vm;
7166
7185
  }
7167
7186
  }
7168
- Vue.version = `2.6.14-compat:${"3.5.17"}`;
7187
+ Vue.version = `2.6.14-compat:${"3.5.18"}`;
7169
7188
  Vue.config = singletonApp.config;
7170
7189
  Vue.use = (plugin, ...options) => {
7171
7190
  if (plugin && isFunction(plugin.install)) {
@@ -7759,7 +7778,7 @@ function provide(key, value) {
7759
7778
  }
7760
7779
  }
7761
7780
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7762
- const instance = currentInstance || currentRenderingInstance;
7781
+ const instance = getCurrentInstance();
7763
7782
  if (instance || currentApp) {
7764
7783
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7765
7784
  if (provides && key in provides) {
@@ -7774,7 +7793,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
7774
7793
  }
7775
7794
  }
7776
7795
  function hasInjectionContext() {
7777
- return !!(currentInstance || currentRenderingInstance || currentApp);
7796
+ return !!(getCurrentInstance() || currentApp);
7778
7797
  }
7779
7798
 
7780
7799
  function createPropsDefaultThis(instance, rawProps, propKey) {
@@ -8260,7 +8279,7 @@ function isBoolean(...args) {
8260
8279
  return args.some((elem) => elem.toLowerCase() === "boolean");
8261
8280
  }
8262
8281
 
8263
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8282
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8264
8283
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8265
8284
  const normalizeSlot = (key, rawSlot, ctx) => {
8266
8285
  if (rawSlot._n) {
@@ -9041,6 +9060,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9041
9060
  if (!initialVNode.el) {
9042
9061
  const placeholder = instance.subTree = createVNode(Comment);
9043
9062
  processCommentNode(null, placeholder, container, anchor);
9063
+ initialVNode.placeholder = placeholder.el;
9044
9064
  }
9045
9065
  } else {
9046
9066
  setupRenderEffect(
@@ -9566,7 +9586,11 @@ function baseCreateRenderer(options, createHydrationFns) {
9566
9586
  for (i = toBePatched - 1; i >= 0; i--) {
9567
9587
  const nextIndex = s2 + i;
9568
9588
  const nextChild = c2[nextIndex];
9569
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
9589
+ const anchorVNode = c2[nextIndex + 1];
9590
+ const anchor = nextIndex + 1 < l2 ? (
9591
+ // #13559, fallback to el placeholder for unresolved async component
9592
+ anchorVNode.el || anchorVNode.placeholder
9593
+ ) : parentAnchor;
9570
9594
  if (newIndexToOldIndexMap[i] === 0) {
9571
9595
  patch(
9572
9596
  null,
@@ -11561,6 +11585,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
11561
11585
  suspense: vnode.suspense,
11562
11586
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
11563
11587
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
11588
+ placeholder: vnode.placeholder,
11564
11589
  el: vnode.el,
11565
11590
  anchor: vnode.anchor,
11566
11591
  ctx: vnode.ctx,
@@ -12381,7 +12406,7 @@ function isMemoSame(cached, memo) {
12381
12406
  return true;
12382
12407
  }
12383
12408
 
12384
- const version = "3.5.17";
12409
+ const version = "3.5.18";
12385
12410
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12386
12411
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12387
12412
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12938,8 +12963,9 @@ function setVarsOnNode(el, vars) {
12938
12963
  const style = el.style;
12939
12964
  let cssText = "";
12940
12965
  for (const key in vars) {
12941
- style.setProperty(`--${key}`, vars[key]);
12942
- cssText += `--${key}: ${vars[key]};`;
12966
+ const value = normalizeCssVarValue(vars[key]);
12967
+ style.setProperty(`--${key}`, value);
12968
+ cssText += `--${key}: ${value};`;
12943
12969
  }
12944
12970
  style[CSS_VAR_TEXT] = cssText;
12945
12971
  }
@@ -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
  **/
@@ -314,6 +314,24 @@ var Vue = (function () {
314
314
  );
315
315
  };
316
316
 
317
+ function normalizeCssVarValue(value) {
318
+ if (value == null) {
319
+ return "initial";
320
+ }
321
+ if (typeof value === "string") {
322
+ return value === "" ? " " : value;
323
+ }
324
+ if (typeof value !== "number" || !Number.isFinite(value)) {
325
+ {
326
+ console.warn(
327
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
328
+ value
329
+ );
330
+ }
331
+ }
332
+ return String(value);
333
+ }
334
+
317
335
  function warn$2(msg, ...args) {
318
336
  console.warn(`[Vue warn] ${msg}`, ...args);
319
337
  }
@@ -4912,10 +4930,8 @@ Server rendered element contains fewer child nodes than client vdom.`
4912
4930
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4913
4931
  const cssVars = instance.getCssVars();
4914
4932
  for (const key in cssVars) {
4915
- expectedMap.set(
4916
- `--${getEscapedCssVarName(key)}`,
4917
- String(cssVars[key])
4918
- );
4933
+ const value = normalizeCssVarValue(cssVars[key]);
4934
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4919
4935
  }
4920
4936
  }
4921
4937
  if (vnode === root && instance.parent) {
@@ -5104,16 +5120,19 @@ Server rendered element contains fewer child nodes than client vdom.`
5104
5120
  __asyncLoader: load,
5105
5121
  __asyncHydrate(el, instance, hydrate) {
5106
5122
  let patched = false;
5107
- const doHydrate = hydrateStrategy ? () => {
5108
- const performHydrate = () => {
5109
- if (patched) {
5123
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5124
+ const performHydrate = () => {
5125
+ if (patched) {
5126
+ {
5110
5127
  warn$1(
5111
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
5128
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5112
5129
  );
5113
- return;
5114
5130
  }
5115
- hydrate();
5116
- };
5131
+ return;
5132
+ }
5133
+ hydrate();
5134
+ };
5135
+ const doHydrate = hydrateStrategy ? () => {
5117
5136
  const teardown = hydrateStrategy(
5118
5137
  performHydrate,
5119
5138
  (cb) => forEachElement(el, cb)
@@ -5121,8 +5140,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5121
5140
  if (teardown) {
5122
5141
  (instance.bum || (instance.bum = [])).push(teardown);
5123
5142
  }
5124
- (instance.u || (instance.u = [])).push(() => patched = true);
5125
- } : hydrate;
5143
+ } : performHydrate;
5126
5144
  if (resolvedComp) {
5127
5145
  doHydrate();
5128
5146
  } else {
@@ -6538,15 +6556,15 @@ If this is a native custom element, make sure to exclude it from component resol
6538
6556
  return null;
6539
6557
  }
6540
6558
  function useSlots() {
6541
- return getContext().slots;
6559
+ return getContext("useSlots").slots;
6542
6560
  }
6543
6561
  function useAttrs() {
6544
- return getContext().attrs;
6562
+ return getContext("useAttrs").attrs;
6545
6563
  }
6546
- function getContext() {
6564
+ function getContext(calledFunctionName) {
6547
6565
  const i = getCurrentInstance();
6548
6566
  if (!i) {
6549
- warn$1(`useContext() called without active instance.`);
6567
+ warn$1(`${calledFunctionName}() called without active instance.`);
6550
6568
  }
6551
6569
  return i.setupContext || (i.setupContext = createSetupContext(i));
6552
6570
  }
@@ -6805,7 +6823,8 @@ If this is a native custom element, make sure to exclude it from component resol
6805
6823
  expose.forEach((key) => {
6806
6824
  Object.defineProperty(exposed, key, {
6807
6825
  get: () => publicThis[key],
6808
- set: (val) => publicThis[key] = val
6826
+ set: (val) => publicThis[key] = val,
6827
+ enumerable: true
6809
6828
  });
6810
6829
  });
6811
6830
  } else if (!instance.exposed) {
@@ -7127,7 +7146,7 @@ If this is a native custom element, make sure to exclude it from component resol
7127
7146
  return vm;
7128
7147
  }
7129
7148
  }
7130
- Vue.version = `2.6.14-compat:${"3.5.17"}`;
7149
+ Vue.version = `2.6.14-compat:${"3.5.18"}`;
7131
7150
  Vue.config = singletonApp.config;
7132
7151
  Vue.use = (plugin, ...options) => {
7133
7152
  if (plugin && isFunction(plugin.install)) {
@@ -7719,7 +7738,7 @@ If you want to remount the same app, move your app creation logic into a factory
7719
7738
  }
7720
7739
  }
7721
7740
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7722
- const instance = currentInstance || currentRenderingInstance;
7741
+ const instance = getCurrentInstance();
7723
7742
  if (instance || currentApp) {
7724
7743
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7725
7744
  if (provides && key in provides) {
@@ -7734,7 +7753,7 @@ If you want to remount the same app, move your app creation logic into a factory
7734
7753
  }
7735
7754
  }
7736
7755
  function hasInjectionContext() {
7737
- return !!(currentInstance || currentRenderingInstance || currentApp);
7756
+ return !!(getCurrentInstance() || currentApp);
7738
7757
  }
7739
7758
 
7740
7759
  function createPropsDefaultThis(instance, rawProps, propKey) {
@@ -8220,7 +8239,7 @@ If you want to remount the same app, move your app creation logic into a factory
8220
8239
  return args.some((elem) => elem.toLowerCase() === "boolean");
8221
8240
  }
8222
8241
 
8223
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8242
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8224
8243
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8225
8244
  const normalizeSlot = (key, rawSlot, ctx) => {
8226
8245
  if (rawSlot._n) {
@@ -8963,6 +8982,7 @@ If you want to remount the same app, move your app creation logic into a factory
8963
8982
  if (!initialVNode.el) {
8964
8983
  const placeholder = instance.subTree = createVNode(Comment);
8965
8984
  processCommentNode(null, placeholder, container, anchor);
8985
+ initialVNode.placeholder = placeholder.el;
8966
8986
  }
8967
8987
  } else {
8968
8988
  setupRenderEffect(
@@ -9488,7 +9508,11 @@ If you want to remount the same app, move your app creation logic into a factory
9488
9508
  for (i = toBePatched - 1; i >= 0; i--) {
9489
9509
  const nextIndex = s2 + i;
9490
9510
  const nextChild = c2[nextIndex];
9491
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
9511
+ const anchorVNode = c2[nextIndex + 1];
9512
+ const anchor = nextIndex + 1 < l2 ? (
9513
+ // #13559, fallback to el placeholder for unresolved async component
9514
+ anchorVNode.el || anchorVNode.placeholder
9515
+ ) : parentAnchor;
9492
9516
  if (newIndexToOldIndexMap[i] === 0) {
9493
9517
  patch(
9494
9518
  null,
@@ -11455,6 +11479,7 @@ Component that was made reactive: `,
11455
11479
  suspense: vnode.suspense,
11456
11480
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
11457
11481
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
11482
+ placeholder: vnode.placeholder,
11458
11483
  el: vnode.el,
11459
11484
  anchor: vnode.anchor,
11460
11485
  ctx: vnode.ctx,
@@ -12247,7 +12272,7 @@ Component that was made reactive: `,
12247
12272
  return true;
12248
12273
  }
12249
12274
 
12250
- const version = "3.5.17";
12275
+ const version = "3.5.18";
12251
12276
  const warn = warn$1 ;
12252
12277
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12253
12278
  const devtools = devtools$1 ;
@@ -12785,8 +12810,9 @@ Component that was made reactive: `,
12785
12810
  const style = el.style;
12786
12811
  let cssText = "";
12787
12812
  for (const key in vars) {
12788
- style.setProperty(`--${key}`, vars[key]);
12789
- cssText += `--${key}: ${vars[key]};`;
12813
+ const value = normalizeCssVarValue(vars[key]);
12814
+ style.setProperty(`--${key}`, value);
12815
+ cssText += `--${key}: ${value};`;
12790
12816
  }
12791
12817
  style[CSS_VAR_TEXT] = cssText;
12792
12818
  }