@vue/compat 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.16
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
  }
@@ -784,6 +802,7 @@ class Link {
784
802
  }
785
803
  }
786
804
  class Dep {
805
+ // TODO isolatedDeclarations "__v_skip"
787
806
  constructor(computed) {
788
807
  this.computed = computed;
789
808
  this.version = 0;
@@ -804,6 +823,10 @@ class Dep {
804
823
  * Subscriber counter
805
824
  */
806
825
  this.sc = 0;
826
+ /**
827
+ * @internal
828
+ */
829
+ this.__v_skip = true;
807
830
  {
808
831
  this.subsHead = void 0;
809
832
  }
@@ -4904,10 +4927,8 @@ function resolveCssVars(instance, vnode, expectedMap) {
4904
4927
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4905
4928
  const cssVars = instance.getCssVars();
4906
4929
  for (const key in cssVars) {
4907
- expectedMap.set(
4908
- `--${getEscapedCssVarName(key)}`,
4909
- String(cssVars[key])
4910
- );
4930
+ const value = normalizeCssVarValue(cssVars[key]);
4931
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4911
4932
  }
4912
4933
  }
4913
4934
  if (vnode === root && instance.parent) {
@@ -4938,7 +4959,7 @@ function isMismatchAllowed(el, allowedType) {
4938
4959
  if (allowedType === 0 /* TEXT */ && list.includes("children")) {
4939
4960
  return true;
4940
4961
  }
4941
- return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
4962
+ return list.includes(MismatchTypeString[allowedType]);
4942
4963
  }
4943
4964
  }
4944
4965
 
@@ -5096,16 +5117,19 @@ function defineAsyncComponent(source) {
5096
5117
  __asyncLoader: load,
5097
5118
  __asyncHydrate(el, instance, hydrate) {
5098
5119
  let patched = false;
5099
- const doHydrate = hydrateStrategy ? () => {
5100
- const performHydrate = () => {
5101
- if (patched) {
5120
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5121
+ const performHydrate = () => {
5122
+ if (patched) {
5123
+ {
5102
5124
  warn$1(
5103
- `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.`
5104
5126
  );
5105
- return;
5106
5127
  }
5107
- hydrate();
5108
- };
5128
+ return;
5129
+ }
5130
+ hydrate();
5131
+ };
5132
+ const doHydrate = hydrateStrategy ? () => {
5109
5133
  const teardown = hydrateStrategy(
5110
5134
  performHydrate,
5111
5135
  (cb) => forEachElement(el, cb)
@@ -5113,8 +5137,7 @@ function defineAsyncComponent(source) {
5113
5137
  if (teardown) {
5114
5138
  (instance.bum || (instance.bum = [])).push(teardown);
5115
5139
  }
5116
- (instance.u || (instance.u = [])).push(() => patched = true);
5117
- } : hydrate;
5140
+ } : performHydrate;
5118
5141
  if (resolvedComp) {
5119
5142
  doHydrate();
5120
5143
  } else {
@@ -6536,15 +6559,15 @@ function withDefaults(props, defaults) {
6536
6559
  return null;
6537
6560
  }
6538
6561
  function useSlots() {
6539
- return getContext().slots;
6562
+ return getContext("useSlots").slots;
6540
6563
  }
6541
6564
  function useAttrs() {
6542
- return getContext().attrs;
6565
+ return getContext("useAttrs").attrs;
6543
6566
  }
6544
- function getContext() {
6567
+ function getContext(calledFunctionName) {
6545
6568
  const i = getCurrentInstance();
6546
6569
  if (!i) {
6547
- warn$1(`useContext() called without active instance.`);
6570
+ warn$1(`${calledFunctionName}() called without active instance.`);
6548
6571
  }
6549
6572
  return i.setupContext || (i.setupContext = createSetupContext(i));
6550
6573
  }
@@ -6803,7 +6826,8 @@ function applyOptions(instance) {
6803
6826
  expose.forEach((key) => {
6804
6827
  Object.defineProperty(exposed, key, {
6805
6828
  get: () => publicThis[key],
6806
- set: (val) => publicThis[key] = val
6829
+ set: (val) => publicThis[key] = val,
6830
+ enumerable: true
6807
6831
  });
6808
6832
  });
6809
6833
  } else if (!instance.exposed) {
@@ -7128,7 +7152,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7128
7152
  return vm;
7129
7153
  }
7130
7154
  }
7131
- Vue.version = `2.6.14-compat:${"3.5.16"}`;
7155
+ Vue.version = `2.6.14-compat:${"3.5.18"}`;
7132
7156
  Vue.config = singletonApp.config;
7133
7157
  Vue.use = (plugin, ...options) => {
7134
7158
  if (plugin && isFunction(plugin.install)) {
@@ -7720,7 +7744,7 @@ function provide(key, value) {
7720
7744
  }
7721
7745
  }
7722
7746
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7723
- const instance = currentInstance || currentRenderingInstance;
7747
+ const instance = getCurrentInstance();
7724
7748
  if (instance || currentApp) {
7725
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;
7726
7750
  if (provides && key in provides) {
@@ -7735,7 +7759,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
7735
7759
  }
7736
7760
  }
7737
7761
  function hasInjectionContext() {
7738
- return !!(currentInstance || currentRenderingInstance || currentApp);
7762
+ return !!(getCurrentInstance() || currentApp);
7739
7763
  }
7740
7764
 
7741
7765
  function createPropsDefaultThis(instance, rawProps, propKey) {
@@ -8221,7 +8245,7 @@ function isBoolean(...args) {
8221
8245
  return args.some((elem) => elem.toLowerCase() === "boolean");
8222
8246
  }
8223
8247
 
8224
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8248
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8225
8249
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8226
8250
  const normalizeSlot = (key, rawSlot, ctx) => {
8227
8251
  if (rawSlot._n) {
@@ -8275,6 +8299,8 @@ const assignSlots = (slots, children, optimized) => {
8275
8299
  const initSlots = (instance, children, optimized) => {
8276
8300
  const slots = instance.slots = createInternalObject();
8277
8301
  if (instance.vnode.shapeFlag & 32) {
8302
+ const cacheIndexes = children.__;
8303
+ if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8278
8304
  const type = children._;
8279
8305
  if (type) {
8280
8306
  assignSlots(slots, children, optimized);
@@ -8486,6 +8512,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8486
8512
  }
8487
8513
  if (ref != null && parentComponent) {
8488
8514
  setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
8515
+ } else if (ref == null && n1 && n1.ref != null) {
8516
+ setRef(n1.ref, null, parentSuspense, n1, true);
8489
8517
  }
8490
8518
  };
8491
8519
  const processText = (n1, n2, container, anchor) => {
@@ -8960,6 +8988,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8960
8988
  if (!initialVNode.el) {
8961
8989
  const placeholder = instance.subTree = createVNode(Comment);
8962
8990
  processCommentNode(null, placeholder, container, anchor);
8991
+ initialVNode.placeholder = placeholder.el;
8963
8992
  }
8964
8993
  } else {
8965
8994
  setupRenderEffect(
@@ -9049,7 +9078,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9049
9078
  hydrateSubTree();
9050
9079
  }
9051
9080
  } else {
9052
- if (root.ce) {
9081
+ if (root.ce && // @ts-expect-error _def is private
9082
+ root.ce._def.shadowRoot !== false) {
9053
9083
  root.ce._injectChildStyle(type);
9054
9084
  }
9055
9085
  {
@@ -9484,7 +9514,11 @@ function baseCreateRenderer(options, createHydrationFns) {
9484
9514
  for (i = toBePatched - 1; i >= 0; i--) {
9485
9515
  const nextIndex = s2 + i;
9486
9516
  const nextChild = c2[nextIndex];
9487
- 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;
9488
9522
  if (newIndexToOldIndexMap[i] === 0) {
9489
9523
  patch(
9490
9524
  null,
@@ -10145,8 +10179,9 @@ function emit(instance, event, ...rawArgs) {
10145
10179
  }
10146
10180
  }
10147
10181
  let args = rawArgs;
10148
- const isModelListener = event.startsWith("update:");
10149
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
10182
+ const isCompatModelListener = compatModelEventPrefix + event in props;
10183
+ const isModelListener = isCompatModelListener || event.startsWith("update:");
10184
+ const modifiers = isCompatModelListener ? props.modelModifiers : isModelListener && getModelModifiers(props, event.slice(7));
10150
10185
  if (modifiers) {
10151
10186
  if (modifiers.trim) {
10152
10187
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -11478,6 +11513,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
11478
11513
  suspense: vnode.suspense,
11479
11514
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
11480
11515
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
11516
+ placeholder: vnode.placeholder,
11481
11517
  el: vnode.el,
11482
11518
  anchor: vnode.anchor,
11483
11519
  ctx: vnode.ctx,
@@ -12284,7 +12320,7 @@ function isMemoSame(cached, memo) {
12284
12320
  return true;
12285
12321
  }
12286
12322
 
12287
- const version = "3.5.16";
12323
+ const version = "3.5.18";
12288
12324
  const warn = warn$1 ;
12289
12325
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12290
12326
  const devtools = devtools$1 ;
@@ -12841,8 +12877,9 @@ function setVarsOnNode(el, vars) {
12841
12877
  const style = el.style;
12842
12878
  let cssText = "";
12843
12879
  for (const key in vars) {
12844
- style.setProperty(`--${key}`, vars[key]);
12845
- cssText += `--${key}: ${vars[key]};`;
12880
+ const value = normalizeCssVarValue(vars[key]);
12881
+ style.setProperty(`--${key}`, value);
12882
+ cssText += `--${key}: ${value};`;
12846
12883
  }
12847
12884
  style[CSS_VAR_TEXT] = cssText;
12848
12885
  }
@@ -13375,9 +13412,10 @@ class VueElement extends BaseClass {
13375
13412
  };
13376
13413
  const asyncDef = this._def.__asyncLoader;
13377
13414
  if (asyncDef) {
13378
- this._pendingResolve = asyncDef().then(
13379
- (def) => resolve(this._def = def, true)
13380
- );
13415
+ this._pendingResolve = asyncDef().then((def) => {
13416
+ def.configureApp = this._def.configureApp;
13417
+ resolve(this._def = def, true);
13418
+ });
13381
13419
  } else {
13382
13420
  resolve(this._def);
13383
13421
  }