@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
  **/
@@ -129,7 +129,7 @@ var Vue = (function () {
129
129
  [512]: `NEED_PATCH`,
130
130
  [1024]: `DYNAMIC_SLOTS`,
131
131
  [2048]: `DEV_ROOT_FRAGMENT`,
132
- [-1]: `HOISTED`,
132
+ [-1]: `CACHED`,
133
133
  [-2]: `BAIL`
134
134
  };
135
135
 
@@ -387,6 +387,24 @@ var Vue = (function () {
387
387
  );
388
388
  };
389
389
 
390
+ function normalizeCssVarValue(value) {
391
+ if (value == null) {
392
+ return "initial";
393
+ }
394
+ if (typeof value === "string") {
395
+ return value === "" ? " " : value;
396
+ }
397
+ if (typeof value !== "number" || !Number.isFinite(value)) {
398
+ {
399
+ console.warn(
400
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
401
+ value
402
+ );
403
+ }
404
+ }
405
+ return String(value);
406
+ }
407
+
390
408
  function warn$2(msg, ...args) {
391
409
  console.warn(`[Vue warn] ${msg}`, ...args);
392
410
  }
@@ -860,6 +878,7 @@ var Vue = (function () {
860
878
  }
861
879
  }
862
880
  class Dep {
881
+ // TODO isolatedDeclarations "__v_skip"
863
882
  constructor(computed) {
864
883
  this.computed = computed;
865
884
  this.version = 0;
@@ -880,6 +899,10 @@ var Vue = (function () {
880
899
  * Subscriber counter
881
900
  */
882
901
  this.sc = 0;
902
+ /**
903
+ * @internal
904
+ */
905
+ this.__v_skip = true;
883
906
  {
884
907
  this.subsHead = void 0;
885
908
  }
@@ -4980,10 +5003,8 @@ Server rendered element contains fewer child nodes than client vdom.`
4980
5003
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4981
5004
  const cssVars = instance.getCssVars();
4982
5005
  for (const key in cssVars) {
4983
- expectedMap.set(
4984
- `--${getEscapedCssVarName(key)}`,
4985
- String(cssVars[key])
4986
- );
5006
+ const value = normalizeCssVarValue(cssVars[key]);
5007
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4987
5008
  }
4988
5009
  }
4989
5010
  if (vnode === root && instance.parent) {
@@ -5014,7 +5035,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5014
5035
  if (allowedType === 0 /* TEXT */ && list.includes("children")) {
5015
5036
  return true;
5016
5037
  }
5017
- return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
5038
+ return list.includes(MismatchTypeString[allowedType]);
5018
5039
  }
5019
5040
  }
5020
5041
 
@@ -5172,16 +5193,19 @@ Server rendered element contains fewer child nodes than client vdom.`
5172
5193
  __asyncLoader: load,
5173
5194
  __asyncHydrate(el, instance, hydrate) {
5174
5195
  let patched = false;
5175
- const doHydrate = hydrateStrategy ? () => {
5176
- const performHydrate = () => {
5177
- if (patched) {
5196
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5197
+ const performHydrate = () => {
5198
+ if (patched) {
5199
+ {
5178
5200
  warn$1(
5179
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
5201
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5180
5202
  );
5181
- return;
5182
5203
  }
5183
- hydrate();
5184
- };
5204
+ return;
5205
+ }
5206
+ hydrate();
5207
+ };
5208
+ const doHydrate = hydrateStrategy ? () => {
5185
5209
  const teardown = hydrateStrategy(
5186
5210
  performHydrate,
5187
5211
  (cb) => forEachElement(el, cb)
@@ -5189,8 +5213,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5189
5213
  if (teardown) {
5190
5214
  (instance.bum || (instance.bum = [])).push(teardown);
5191
5215
  }
5192
- (instance.u || (instance.u = [])).push(() => patched = true);
5193
- } : hydrate;
5216
+ } : performHydrate;
5194
5217
  if (resolvedComp) {
5195
5218
  doHydrate();
5196
5219
  } else {
@@ -6606,15 +6629,15 @@ If this is a native custom element, make sure to exclude it from component resol
6606
6629
  return null;
6607
6630
  }
6608
6631
  function useSlots() {
6609
- return getContext().slots;
6632
+ return getContext("useSlots").slots;
6610
6633
  }
6611
6634
  function useAttrs() {
6612
- return getContext().attrs;
6635
+ return getContext("useAttrs").attrs;
6613
6636
  }
6614
- function getContext() {
6637
+ function getContext(calledFunctionName) {
6615
6638
  const i = getCurrentInstance();
6616
6639
  if (!i) {
6617
- warn$1(`useContext() called without active instance.`);
6640
+ warn$1(`${calledFunctionName}() called without active instance.`);
6618
6641
  }
6619
6642
  return i.setupContext || (i.setupContext = createSetupContext(i));
6620
6643
  }
@@ -6873,7 +6896,8 @@ If this is a native custom element, make sure to exclude it from component resol
6873
6896
  expose.forEach((key) => {
6874
6897
  Object.defineProperty(exposed, key, {
6875
6898
  get: () => publicThis[key],
6876
- set: (val) => publicThis[key] = val
6899
+ set: (val) => publicThis[key] = val,
6900
+ enumerable: true
6877
6901
  });
6878
6902
  });
6879
6903
  } else if (!instance.exposed) {
@@ -7195,7 +7219,7 @@ If this is a native custom element, make sure to exclude it from component resol
7195
7219
  return vm;
7196
7220
  }
7197
7221
  }
7198
- Vue.version = `2.6.14-compat:${"3.5.16"}`;
7222
+ Vue.version = `2.6.14-compat:${"3.5.18"}`;
7199
7223
  Vue.config = singletonApp.config;
7200
7224
  Vue.use = (plugin, ...options) => {
7201
7225
  if (plugin && isFunction(plugin.install)) {
@@ -7787,7 +7811,7 @@ If you want to remount the same app, move your app creation logic into a factory
7787
7811
  }
7788
7812
  }
7789
7813
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7790
- const instance = currentInstance || currentRenderingInstance;
7814
+ const instance = getCurrentInstance();
7791
7815
  if (instance || currentApp) {
7792
7816
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7793
7817
  if (provides && key in provides) {
@@ -7802,7 +7826,7 @@ If you want to remount the same app, move your app creation logic into a factory
7802
7826
  }
7803
7827
  }
7804
7828
  function hasInjectionContext() {
7805
- return !!(currentInstance || currentRenderingInstance || currentApp);
7829
+ return !!(getCurrentInstance() || currentApp);
7806
7830
  }
7807
7831
 
7808
7832
  function createPropsDefaultThis(instance, rawProps, propKey) {
@@ -8288,7 +8312,7 @@ If you want to remount the same app, move your app creation logic into a factory
8288
8312
  return args.some((elem) => elem.toLowerCase() === "boolean");
8289
8313
  }
8290
8314
 
8291
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8315
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8292
8316
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8293
8317
  const normalizeSlot = (key, rawSlot, ctx) => {
8294
8318
  if (rawSlot._n) {
@@ -8342,6 +8366,8 @@ If you want to remount the same app, move your app creation logic into a factory
8342
8366
  const initSlots = (instance, children, optimized) => {
8343
8367
  const slots = instance.slots = createInternalObject();
8344
8368
  if (instance.vnode.shapeFlag & 32) {
8369
+ const cacheIndexes = children.__;
8370
+ if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8345
8371
  const type = children._;
8346
8372
  if (type) {
8347
8373
  assignSlots(slots, children, optimized);
@@ -8553,6 +8579,8 @@ If you want to remount the same app, move your app creation logic into a factory
8553
8579
  }
8554
8580
  if (ref != null && parentComponent) {
8555
8581
  setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
8582
+ } else if (ref == null && n1 && n1.ref != null) {
8583
+ setRef(n1.ref, null, parentSuspense, n1, true);
8556
8584
  }
8557
8585
  };
8558
8586
  const processText = (n1, n2, container, anchor) => {
@@ -9027,6 +9055,7 @@ If you want to remount the same app, move your app creation logic into a factory
9027
9055
  if (!initialVNode.el) {
9028
9056
  const placeholder = instance.subTree = createVNode(Comment);
9029
9057
  processCommentNode(null, placeholder, container, anchor);
9058
+ initialVNode.placeholder = placeholder.el;
9030
9059
  }
9031
9060
  } else {
9032
9061
  setupRenderEffect(
@@ -9116,7 +9145,8 @@ If you want to remount the same app, move your app creation logic into a factory
9116
9145
  hydrateSubTree();
9117
9146
  }
9118
9147
  } else {
9119
- if (root.ce) {
9148
+ if (root.ce && // @ts-expect-error _def is private
9149
+ root.ce._def.shadowRoot !== false) {
9120
9150
  root.ce._injectChildStyle(type);
9121
9151
  }
9122
9152
  {
@@ -9551,7 +9581,11 @@ If you want to remount the same app, move your app creation logic into a factory
9551
9581
  for (i = toBePatched - 1; i >= 0; i--) {
9552
9582
  const nextIndex = s2 + i;
9553
9583
  const nextChild = c2[nextIndex];
9554
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
9584
+ const anchorVNode = c2[nextIndex + 1];
9585
+ const anchor = nextIndex + 1 < l2 ? (
9586
+ // #13559, fallback to el placeholder for unresolved async component
9587
+ anchorVNode.el || anchorVNode.placeholder
9588
+ ) : parentAnchor;
9555
9589
  if (newIndexToOldIndexMap[i] === 0) {
9556
9590
  patch(
9557
9591
  null,
@@ -10184,8 +10218,9 @@ If you want to remount the same app, move your app creation logic into a factory
10184
10218
  }
10185
10219
  }
10186
10220
  let args = rawArgs;
10187
- const isModelListener = event.startsWith("update:");
10188
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
10221
+ const isCompatModelListener = compatModelEventPrefix + event in props;
10222
+ const isModelListener = isCompatModelListener || event.startsWith("update:");
10223
+ const modifiers = isCompatModelListener ? props.modelModifiers : isModelListener && getModelModifiers(props, event.slice(7));
10189
10224
  if (modifiers) {
10190
10225
  if (modifiers.trim) {
10191
10226
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -11517,6 +11552,7 @@ Component that was made reactive: `,
11517
11552
  suspense: vnode.suspense,
11518
11553
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
11519
11554
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
11555
+ placeholder: vnode.placeholder,
11520
11556
  el: vnode.el,
11521
11557
  anchor: vnode.anchor,
11522
11558
  ctx: vnode.ctx,
@@ -12309,7 +12345,7 @@ Component that was made reactive: `,
12309
12345
  return true;
12310
12346
  }
12311
12347
 
12312
- const version = "3.5.16";
12348
+ const version = "3.5.18";
12313
12349
  const warn = warn$1 ;
12314
12350
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12315
12351
  const devtools = devtools$1 ;
@@ -12847,8 +12883,9 @@ Component that was made reactive: `,
12847
12883
  const style = el.style;
12848
12884
  let cssText = "";
12849
12885
  for (const key in vars) {
12850
- style.setProperty(`--${key}`, vars[key]);
12851
- cssText += `--${key}: ${vars[key]};`;
12886
+ const value = normalizeCssVarValue(vars[key]);
12887
+ style.setProperty(`--${key}`, value);
12888
+ cssText += `--${key}: ${value};`;
12852
12889
  }
12853
12890
  style[CSS_VAR_TEXT] = cssText;
12854
12891
  }
@@ -13381,9 +13418,10 @@ Expected function or array of functions, received type ${typeof value}.`
13381
13418
  };
13382
13419
  const asyncDef = this._def.__asyncLoader;
13383
13420
  if (asyncDef) {
13384
- this._pendingResolve = asyncDef().then(
13385
- (def) => resolve(this._def = def, true)
13386
- );
13421
+ this._pendingResolve = asyncDef().then((def) => {
13422
+ def.configureApp = this._def.configureApp;
13423
+ resolve(this._def = def, true);
13424
+ });
13387
13425
  } else {
13388
13426
  resolve(this._def);
13389
13427
  }
@@ -15353,7 +15391,7 @@ Make sure to use the production build (*.prod.js) when deploying for production.
15353
15391
  this.buffer = input;
15354
15392
  while (this.index < this.buffer.length) {
15355
15393
  const c = this.buffer.charCodeAt(this.index);
15356
- if (c === 10) {
15394
+ if (c === 10 && this.state !== 33) {
15357
15395
  this.newlines.push(this.index);
15358
15396
  }
15359
15397
  switch (this.state) {
@@ -15697,7 +15735,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15697
15735
  return BASE_TRANSITION;
15698
15736
  }
15699
15737
  }
15700
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
15738
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
15701
15739
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
15702
15740
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
15703
15741
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -15809,6 +15847,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15809
15847
  function isText$1(node) {
15810
15848
  return node.type === 5 || node.type === 2;
15811
15849
  }
15850
+ function isVPre(p) {
15851
+ return p.type === 7 && p.name === "pre";
15852
+ }
15812
15853
  function isVSlot(p) {
15813
15854
  return p.type === 7 && p.name === "slot";
15814
15855
  }
@@ -16067,7 +16108,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16067
16108
  ondirarg(start, end) {
16068
16109
  if (start === end) return;
16069
16110
  const arg = getSlice(start, end);
16070
- if (inVPre) {
16111
+ if (inVPre && !isVPre(currentProp)) {
16071
16112
  currentProp.name += arg;
16072
16113
  setLocEnd(currentProp.nameLoc, end);
16073
16114
  } else {
@@ -16082,7 +16123,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16082
16123
  },
16083
16124
  ondirmodifier(start, end) {
16084
16125
  const mod = getSlice(start, end);
16085
- if (inVPre) {
16126
+ if (inVPre && !isVPre(currentProp)) {
16086
16127
  currentProp.name += "." + mod;
16087
16128
  setLocEnd(currentProp.nameLoc, end);
16088
16129
  } else if (currentProp.name === "slot") {
@@ -16508,7 +16549,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16508
16549
  return c > 64 && c < 91;
16509
16550
  }
16510
16551
  const windowsNewlineRE = /\r\n/g;
16511
- function condenseWhitespace(nodes, tag) {
16552
+ function condenseWhitespace(nodes) {
16512
16553
  const shouldCondense = currentOptions.whitespace !== "preserve";
16513
16554
  let removedWhitespace = false;
16514
16555
  for (let i = 0; i < nodes.length; i++) {
@@ -16672,12 +16713,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16672
16713
  context,
16673
16714
  // Root node is unfortunately non-hoistable due to potential parent
16674
16715
  // fallthrough attributes.
16675
- isSingleElementRoot(root, root.children[0])
16716
+ !!getSingleElementRoot(root)
16676
16717
  );
16677
16718
  }
16678
- function isSingleElementRoot(root, child) {
16679
- const { children } = root;
16680
- return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
16719
+ function getSingleElementRoot(root) {
16720
+ const children = root.children.filter((x) => x.type !== 3);
16721
+ return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
16681
16722
  }
16682
16723
  function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16683
16724
  const { children } = node;
@@ -16710,6 +16751,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16710
16751
  } else if (child.type === 12) {
16711
16752
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
16712
16753
  if (constantType >= 2) {
16754
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
16755
+ child.codegenNode.arguments.push(
16756
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
16757
+ );
16758
+ }
16713
16759
  toCache.push(child);
16714
16760
  continue;
16715
16761
  }
@@ -17143,15 +17189,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17143
17189
  const { helper } = context;
17144
17190
  const { children } = root;
17145
17191
  if (children.length === 1) {
17146
- const child = children[0];
17147
- if (isSingleElementRoot(root, child) && child.codegenNode) {
17148
- const codegenNode = child.codegenNode;
17192
+ const singleElementRootChild = getSingleElementRoot(root);
17193
+ if (singleElementRootChild && singleElementRootChild.codegenNode) {
17194
+ const codegenNode = singleElementRootChild.codegenNode;
17149
17195
  if (codegenNode.type === 13) {
17150
17196
  convertToBlock(codegenNode, context);
17151
17197
  }
17152
17198
  root.codegenNode = codegenNode;
17153
17199
  } else {
17154
- root.codegenNode = child;
17200
+ root.codegenNode = children[0];
17155
17201
  }
17156
17202
  } else if (children.length > 1) {
17157
17203
  let patchFlag = 64;
@@ -18159,7 +18205,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18159
18205
  arg.children.unshift(`(`);
18160
18206
  arg.children.push(`) || ""`);
18161
18207
  } else if (!arg.isStatic) {
18162
- arg.content = `${arg.content} || ""`;
18208
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
18163
18209
  }
18164
18210
  if (modifiers.some((mod) => mod.content === "camel")) {
18165
18211
  if (arg.type === 4) {
@@ -18506,7 +18552,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18506
18552
  let prev;
18507
18553
  while (j--) {
18508
18554
  prev = children[j];
18509
- if (prev.type !== 3) {
18555
+ if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
18510
18556
  break;
18511
18557
  }
18512
18558
  }