@vue/compat 3.5.21 → 3.5.23

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.21
2
+ * @vue/compat v3.5.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1218,7 +1218,7 @@ var Vue = (function () {
1218
1218
  iter._next = iter.next;
1219
1219
  iter.next = () => {
1220
1220
  const result = iter._next();
1221
- if (result.value) {
1221
+ if (!result.done) {
1222
1222
  result.value = wrapValue(result.value);
1223
1223
  }
1224
1224
  return result;
@@ -1345,7 +1345,8 @@ var Vue = (function () {
1345
1345
  return res;
1346
1346
  }
1347
1347
  if (isRef(res)) {
1348
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1348
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1349
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1349
1350
  }
1350
1351
  if (isObject(res)) {
1351
1352
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2695,14 +2696,11 @@ var Vue = (function () {
2695
2696
  let isHmrUpdating = false;
2696
2697
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2697
2698
  {
2698
- const g = getGlobalThis();
2699
- if (!g.__VUE_HMR_RUNTIME__) {
2700
- g.__VUE_HMR_RUNTIME__ = {
2701
- createRecord: tryWrap(createRecord),
2702
- rerender: tryWrap(rerender),
2703
- reload: tryWrap(reload)
2704
- };
2705
- }
2699
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
2700
+ createRecord: tryWrap(createRecord),
2701
+ rerender: tryWrap(rerender),
2702
+ reload: tryWrap(reload)
2703
+ };
2706
2704
  }
2707
2705
  const map = /* @__PURE__ */ new Map();
2708
2706
  function registerHMR(instance) {
@@ -3597,9 +3595,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3597
3595
  insert(mainAnchor, container, anchor);
3598
3596
  const mount = (container2, anchor2) => {
3599
3597
  if (shapeFlag & 16) {
3600
- if (parentComponent && parentComponent.isCE) {
3601
- parentComponent.ce._teleportTarget = container2;
3602
- }
3603
3598
  mountChildren(
3604
3599
  children,
3605
3600
  container2,
@@ -3621,6 +3616,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3621
3616
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3622
3617
  namespace = "mathml";
3623
3618
  }
3619
+ if (parentComponent && parentComponent.isCE) {
3620
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3621
+ }
3624
3622
  if (!disabled) {
3625
3623
  mount(target, targetAnchor);
3626
3624
  updateCssVars(n2, false);
@@ -4730,14 +4728,16 @@ Server rendered element contains more child nodes than client vdom.`
4730
4728
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4731
4729
  clientText = clientText.slice(1);
4732
4730
  }
4733
- if (el.textContent !== clientText) {
4731
+ const { textContent } = el;
4732
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4733
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4734
4734
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4735
4735
  warn$1(
4736
4736
  `Hydration text content mismatch on`,
4737
4737
  el,
4738
4738
  `
4739
- - rendered on server: ${el.textContent}
4740
- - expected on client: ${vnode.children}`
4739
+ - rendered on server: ${textContent}
4740
+ - expected on client: ${clientText}`
4741
4741
  );
4742
4742
  logMismatchError();
4743
4743
  }
@@ -5332,7 +5332,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5332
5332
  error: error.value
5333
5333
  });
5334
5334
  } else if (loadingComponent && !delayed.value) {
5335
- return createVNode(loadingComponent);
5335
+ return createInnerComp(
5336
+ loadingComponent,
5337
+ instance
5338
+ );
5336
5339
  }
5337
5340
  };
5338
5341
  }
@@ -6074,12 +6077,13 @@ If this is a native custom element, make sure to exclude it from component resol
6074
6077
 
6075
6078
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6076
6079
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6080
+ const hasProps = Object.keys(props).length > 0;
6077
6081
  if (name !== "default") props.name = name;
6078
6082
  return openBlock(), createBlock(
6079
6083
  Fragment,
6080
6084
  null,
6081
6085
  [createVNode("slot", props, fallback && fallback())],
6082
- 64
6086
+ hasProps ? -2 : 64
6083
6087
  );
6084
6088
  }
6085
6089
  let slot = slots[name];
@@ -7267,7 +7271,7 @@ If this is a native custom element, make sure to exclude it from component resol
7267
7271
  return vm;
7268
7272
  }
7269
7273
  }
7270
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
7274
+ Vue.version = `2.6.14-compat:${"3.5.23"}`;
7271
7275
  Vue.config = singletonApp.config;
7272
7276
  Vue.use = (plugin, ...options) => {
7273
7277
  if (plugin && isFunction(plugin.install)) {
@@ -8713,15 +8717,25 @@ If you want to remount the same app, move your app creation logic into a factory
8713
8717
  optimized
8714
8718
  );
8715
8719
  } else {
8716
- patchElement(
8717
- n1,
8718
- n2,
8719
- parentComponent,
8720
- parentSuspense,
8721
- namespace,
8722
- slotScopeIds,
8723
- optimized
8724
- );
8720
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
8721
+ try {
8722
+ if (customElement) {
8723
+ customElement._beginPatch();
8724
+ }
8725
+ patchElement(
8726
+ n1,
8727
+ n2,
8728
+ parentComponent,
8729
+ parentSuspense,
8730
+ namespace,
8731
+ slotScopeIds,
8732
+ optimized
8733
+ );
8734
+ } finally {
8735
+ if (customElement) {
8736
+ customElement._endPatch();
8737
+ }
8738
+ }
8725
8739
  }
8726
8740
  };
8727
8741
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -10998,7 +11012,8 @@ If you want to remount the same app, move your app creation logic into a factory
10998
11012
  pendingId,
10999
11013
  effects,
11000
11014
  parentComponent: parentComponent2,
11001
- container: container2
11015
+ container: container2,
11016
+ isInFallback
11002
11017
  } = suspense;
11003
11018
  let delayEnter = false;
11004
11019
  if (suspense.isHydrating) {
@@ -11015,6 +11030,9 @@ If you want to remount the same app, move your app creation logic into a factory
11015
11030
  0
11016
11031
  );
11017
11032
  queuePostFlushCb(effects);
11033
+ if (isInFallback && vnode2.ssFallback) {
11034
+ vnode2.ssFallback.el = null;
11035
+ }
11018
11036
  }
11019
11037
  };
11020
11038
  }
@@ -11023,6 +11041,9 @@ If you want to remount the same app, move your app creation logic into a factory
11023
11041
  anchor = next(activeBranch);
11024
11042
  }
11025
11043
  unmount(activeBranch, parentComponent2, suspense, true);
11044
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11045
+ vnode2.ssFallback.el = null;
11046
+ }
11026
11047
  }
11027
11048
  if (!delayEnter) {
11028
11049
  move(pendingBranch, container2, anchor, 0);
@@ -11141,6 +11162,7 @@ If you want to remount the same app, move your app creation logic into a factory
11141
11162
  optimized2
11142
11163
  );
11143
11164
  if (placeholder) {
11165
+ vnode2.placeholder = null;
11144
11166
  remove(placeholder);
11145
11167
  }
11146
11168
  updateHOCHostEl(instance, vnode2.el);
@@ -12150,31 +12172,28 @@ Component that was made reactive: `,
12150
12172
  };
12151
12173
 
12152
12174
  function h(type, propsOrChildren, children) {
12153
- const doCreateVNode = (type2, props, children2) => {
12175
+ try {
12154
12176
  setBlockTracking(-1);
12155
- try {
12156
- return createVNode(type2, props, children2);
12157
- } finally {
12158
- setBlockTracking(1);
12159
- }
12160
- };
12161
- const l = arguments.length;
12162
- if (l === 2) {
12163
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12164
- if (isVNode(propsOrChildren)) {
12165
- return doCreateVNode(type, null, [propsOrChildren]);
12177
+ const l = arguments.length;
12178
+ if (l === 2) {
12179
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12180
+ if (isVNode(propsOrChildren)) {
12181
+ return createVNode(type, null, [propsOrChildren]);
12182
+ }
12183
+ return createVNode(type, propsOrChildren);
12184
+ } else {
12185
+ return createVNode(type, null, propsOrChildren);
12166
12186
  }
12167
- return doCreateVNode(type, propsOrChildren);
12168
12187
  } else {
12169
- return doCreateVNode(type, null, propsOrChildren);
12170
- }
12171
- } else {
12172
- if (l > 3) {
12173
- children = Array.prototype.slice.call(arguments, 2);
12174
- } else if (l === 3 && isVNode(children)) {
12175
- children = [children];
12188
+ if (l > 3) {
12189
+ children = Array.prototype.slice.call(arguments, 2);
12190
+ } else if (l === 3 && isVNode(children)) {
12191
+ children = [children];
12192
+ }
12193
+ return createVNode(type, propsOrChildren, children);
12176
12194
  }
12177
- return doCreateVNode(type, propsOrChildren, children);
12195
+ } finally {
12196
+ setBlockTracking(1);
12178
12197
  }
12179
12198
  }
12180
12199
 
@@ -12384,7 +12403,7 @@ Component that was made reactive: `,
12384
12403
  return true;
12385
12404
  }
12386
12405
 
12387
- const version = "3.5.21";
12406
+ const version = "3.5.23";
12388
12407
  const warn = warn$1 ;
12389
12408
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12390
12409
  const devtools = devtools$1 ;
@@ -12642,11 +12661,11 @@ Component that was made reactive: `,
12642
12661
  addTransitionClass(el, legacyLeaveFromClass);
12643
12662
  }
12644
12663
  if (!el._enterCancelled) {
12645
- forceReflow();
12664
+ forceReflow(el);
12646
12665
  addTransitionClass(el, leaveActiveClass);
12647
12666
  } else {
12648
12667
  addTransitionClass(el, leaveActiveClass);
12649
- forceReflow();
12668
+ forceReflow(el);
12650
12669
  }
12651
12670
  nextFrame(() => {
12652
12671
  if (!el._isLeaving) {
@@ -12795,8 +12814,9 @@ Component that was made reactive: `,
12795
12814
  if (s === "auto") return 0;
12796
12815
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12797
12816
  }
12798
- function forceReflow() {
12799
- return document.body.offsetHeight;
12817
+ function forceReflow(el) {
12818
+ const targetDocument = el ? el.ownerDocument : document;
12819
+ return targetDocument.body.offsetHeight;
12800
12820
  }
12801
12821
 
12802
12822
  function patchClass(el, value, isSVG) {
@@ -13274,6 +13294,9 @@ Expected function or array of functions, received type ${typeof value}.`
13274
13294
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13275
13295
  return false;
13276
13296
  }
13297
+ if (key === "sandbox" && el.tagName === "IFRAME") {
13298
+ return false;
13299
+ }
13277
13300
  if (key === "form") {
13278
13301
  return false;
13279
13302
  }
@@ -13334,6 +13357,8 @@ Expected function or array of functions, received type ${typeof value}.`
13334
13357
  this._nonce = this._def.nonce;
13335
13358
  this._connected = false;
13336
13359
  this._resolved = false;
13360
+ this._patching = false;
13361
+ this._dirty = false;
13337
13362
  this._numberProps = null;
13338
13363
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13339
13364
  this._ob = null;
@@ -13346,7 +13371,11 @@ Expected function or array of functions, received type ${typeof value}.`
13346
13371
  );
13347
13372
  }
13348
13373
  if (_def.shadowRoot !== false) {
13349
- this.attachShadow({ mode: "open" });
13374
+ this.attachShadow(
13375
+ extend({}, _def.shadowRootOptions, {
13376
+ mode: "open"
13377
+ })
13378
+ );
13350
13379
  this._root = this.shadowRoot;
13351
13380
  } else {
13352
13381
  this._root = this;
@@ -13406,9 +13435,18 @@ Expected function or array of functions, received type ${typeof value}.`
13406
13435
  this._app && this._app.unmount();
13407
13436
  if (this._instance) this._instance.ce = void 0;
13408
13437
  this._app = this._instance = null;
13438
+ if (this._teleportTargets) {
13439
+ this._teleportTargets.clear();
13440
+ this._teleportTargets = void 0;
13441
+ }
13409
13442
  }
13410
13443
  });
13411
13444
  }
13445
+ _processMutations(mutations) {
13446
+ for (const m of mutations) {
13447
+ this._setAttr(m.attributeName);
13448
+ }
13449
+ }
13412
13450
  /**
13413
13451
  * resolve inner component definition (handle possible async component)
13414
13452
  */
@@ -13419,11 +13457,7 @@ Expected function or array of functions, received type ${typeof value}.`
13419
13457
  for (let i = 0; i < this.attributes.length; i++) {
13420
13458
  this._setAttr(this.attributes[i].name);
13421
13459
  }
13422
- this._ob = new MutationObserver((mutations) => {
13423
- for (const m of mutations) {
13424
- this._setAttr(m.attributeName);
13425
- }
13426
- });
13460
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13427
13461
  this._ob.observe(this, { attributes: true });
13428
13462
  const resolve = (def, isAsync = false) => {
13429
13463
  this._resolved = true;
@@ -13500,7 +13534,7 @@ Expected function or array of functions, received type ${typeof value}.`
13500
13534
  return this._getProp(key);
13501
13535
  },
13502
13536
  set(val) {
13503
- this._setProp(key, val, true, true);
13537
+ this._setProp(key, val, true, !this._patching);
13504
13538
  }
13505
13539
  });
13506
13540
  }
@@ -13526,6 +13560,7 @@ Expected function or array of functions, received type ${typeof value}.`
13526
13560
  */
13527
13561
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13528
13562
  if (val !== this._props[key]) {
13563
+ this._dirty = true;
13529
13564
  if (val === REMOVAL) {
13530
13565
  delete this._props[key];
13531
13566
  } else {
@@ -13539,7 +13574,10 @@ Expected function or array of functions, received type ${typeof value}.`
13539
13574
  }
13540
13575
  if (shouldReflect) {
13541
13576
  const ob = this._ob;
13542
- ob && ob.disconnect();
13577
+ if (ob) {
13578
+ this._processMutations(ob.takeRecords());
13579
+ ob.disconnect();
13580
+ }
13543
13581
  if (val === true) {
13544
13582
  this.setAttribute(hyphenate(key), "");
13545
13583
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13643,7 +13681,7 @@ Expected function or array of functions, received type ${typeof value}.`
13643
13681
  * Only called when shadowRoot is false
13644
13682
  */
13645
13683
  _renderSlots() {
13646
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13684
+ const outlets = this._getSlots();
13647
13685
  const scopeId = this._instance.type.__scopeId;
13648
13686
  for (let i = 0; i < outlets.length; i++) {
13649
13687
  const o = outlets[i];
@@ -13669,12 +13707,45 @@ Expected function or array of functions, received type ${typeof value}.`
13669
13707
  parent.removeChild(o);
13670
13708
  }
13671
13709
  }
13710
+ /**
13711
+ * @internal
13712
+ */
13713
+ _getSlots() {
13714
+ const roots = [this];
13715
+ if (this._teleportTargets) {
13716
+ roots.push(...this._teleportTargets);
13717
+ }
13718
+ const slots = /* @__PURE__ */ new Set();
13719
+ for (const root of roots) {
13720
+ const found = root.querySelectorAll("slot");
13721
+ for (let i = 0; i < found.length; i++) {
13722
+ slots.add(found[i]);
13723
+ }
13724
+ }
13725
+ return Array.from(slots);
13726
+ }
13672
13727
  /**
13673
13728
  * @internal
13674
13729
  */
13675
13730
  _injectChildStyle(comp) {
13676
13731
  this._applyStyles(comp.styles, comp);
13677
13732
  }
13733
+ /**
13734
+ * @internal
13735
+ */
13736
+ _beginPatch() {
13737
+ this._patching = true;
13738
+ this._dirty = false;
13739
+ }
13740
+ /**
13741
+ * @internal
13742
+ */
13743
+ _endPatch() {
13744
+ this._patching = false;
13745
+ if (this._dirty && this._instance) {
13746
+ this._update();
13747
+ }
13748
+ }
13678
13749
  /**
13679
13750
  * @internal
13680
13751
  */
@@ -13761,7 +13832,7 @@ Expected function or array of functions, received type ${typeof value}.`
13761
13832
  prevChildren.forEach(callPendingCbs);
13762
13833
  prevChildren.forEach(recordPosition);
13763
13834
  const movedChildren = prevChildren.filter(applyTranslation);
13764
- forceReflow();
13835
+ forceReflow(instance.vnode.el);
13765
13836
  movedChildren.forEach((c) => {
13766
13837
  const el = c.el;
13767
13838
  const style = el.style;
@@ -13806,10 +13877,10 @@ Expected function or array of functions, received type ${typeof value}.`
13806
13877
  instance
13807
13878
  )
13808
13879
  );
13809
- positionMap.set(
13810
- child,
13811
- child.el.getBoundingClientRect()
13812
- );
13880
+ positionMap.set(child, {
13881
+ left: child.el.offsetLeft,
13882
+ top: child.el.offsetTop
13883
+ });
13813
13884
  }
13814
13885
  }
13815
13886
  }
@@ -13840,7 +13911,10 @@ Expected function or array of functions, received type ${typeof value}.`
13840
13911
  }
13841
13912
  }
13842
13913
  function recordPosition(c) {
13843
- newPositionMap.set(c, c.el.getBoundingClientRect());
13914
+ newPositionMap.set(c, {
13915
+ left: c.el.offsetLeft,
13916
+ top: c.el.offsetTop
13917
+ });
13844
13918
  }
13845
13919
  function applyTranslation(c) {
13846
13920
  const oldPos = positionMap.get(c);
@@ -13886,24 +13960,22 @@ Expected function or array of functions, received type ${typeof value}.`
13886
13960
  }
13887
13961
  }
13888
13962
  const assignKey = Symbol("_assign");
13963
+ function castValue(value, trim, number) {
13964
+ if (trim) value = value.trim();
13965
+ if (number) value = looseToNumber(value);
13966
+ return value;
13967
+ }
13889
13968
  const vModelText = {
13890
13969
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
13891
13970
  el[assignKey] = getModelAssigner(vnode);
13892
13971
  const castToNumber = number || vnode.props && vnode.props.type === "number";
13893
13972
  addEventListener(el, lazy ? "change" : "input", (e) => {
13894
13973
  if (e.target.composing) return;
13895
- let domValue = el.value;
13896
- if (trim) {
13897
- domValue = domValue.trim();
13898
- }
13899
- if (castToNumber) {
13900
- domValue = looseToNumber(domValue);
13901
- }
13902
- el[assignKey](domValue);
13974
+ el[assignKey](castValue(el.value, trim, castToNumber));
13903
13975
  });
13904
- if (trim) {
13976
+ if (trim || castToNumber) {
13905
13977
  addEventListener(el, "change", () => {
13906
- el.value = el.value.trim();
13978
+ el.value = castValue(el.value, trim, castToNumber);
13907
13979
  });
13908
13980
  }
13909
13981
  if (!lazy) {
@@ -18197,80 +18269,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18197
18269
  }
18198
18270
  }
18199
18271
 
18200
- const transformBind = (dir, _node, context) => {
18201
- const { modifiers, loc } = dir;
18202
- const arg = dir.arg;
18203
- let { exp } = dir;
18204
- if (exp && exp.type === 4 && !exp.content.trim()) {
18205
- {
18206
- exp = void 0;
18207
- }
18208
- }
18209
- if (!exp) {
18210
- if (arg.type !== 4 || !arg.isStatic) {
18211
- context.onError(
18212
- createCompilerError(
18213
- 52,
18214
- arg.loc
18215
- )
18216
- );
18217
- return {
18218
- props: [
18219
- createObjectProperty(arg, createSimpleExpression("", true, loc))
18220
- ]
18221
- };
18222
- }
18223
- transformBindShorthand(dir);
18224
- exp = dir.exp;
18225
- }
18226
- if (arg.type !== 4) {
18227
- arg.children.unshift(`(`);
18228
- arg.children.push(`) || ""`);
18229
- } else if (!arg.isStatic) {
18230
- arg.content = arg.content ? `${arg.content} || ""` : `""`;
18231
- }
18232
- if (modifiers.some((mod) => mod.content === "camel")) {
18233
- if (arg.type === 4) {
18234
- if (arg.isStatic) {
18235
- arg.content = camelize(arg.content);
18236
- } else {
18237
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
18238
- }
18239
- } else {
18240
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
18241
- arg.children.push(`)`);
18242
- }
18243
- }
18244
- if (!context.inSSR) {
18245
- if (modifiers.some((mod) => mod.content === "prop")) {
18246
- injectPrefix(arg, ".");
18247
- }
18248
- if (modifiers.some((mod) => mod.content === "attr")) {
18249
- injectPrefix(arg, "^");
18250
- }
18251
- }
18252
- return {
18253
- props: [createObjectProperty(arg, exp)]
18254
- };
18255
- };
18256
- const transformBindShorthand = (dir, context) => {
18257
- const arg = dir.arg;
18258
- const propName = camelize(arg.content);
18259
- dir.exp = createSimpleExpression(propName, false, arg.loc);
18260
- };
18261
- const injectPrefix = (arg, prefix) => {
18262
- if (arg.type === 4) {
18263
- if (arg.isStatic) {
18264
- arg.content = prefix + arg.content;
18265
- } else {
18266
- arg.content = `\`${prefix}\${${arg.content}}\``;
18267
- }
18268
- } else {
18269
- arg.children.unshift(`'${prefix}' + (`);
18270
- arg.children.push(`)`);
18271
- }
18272
- };
18273
-
18274
18272
  const transformFor = createStructuralDirectiveTransform(
18275
18273
  "for",
18276
18274
  (node, dir, context) => {
@@ -18282,10 +18280,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18282
18280
  const isTemplate = isTemplateNode(node);
18283
18281
  const memo = findDir(node, "memo");
18284
18282
  const keyProp = findProp(node, `key`, false, true);
18285
- const isDirKey = keyProp && keyProp.type === 7;
18286
- if (isDirKey && !keyProp.exp) {
18287
- transformBindShorthand(keyProp);
18288
- }
18283
+ keyProp && keyProp.type === 7;
18289
18284
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18290
18285
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18291
18286
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
@@ -19438,6 +19433,58 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19438
19433
  return ret;
19439
19434
  };
19440
19435
 
19436
+ const transformBind = (dir, _node, context) => {
19437
+ const { modifiers, loc } = dir;
19438
+ const arg = dir.arg;
19439
+ let { exp } = dir;
19440
+ if (exp && exp.type === 4 && !exp.content.trim()) {
19441
+ {
19442
+ exp = void 0;
19443
+ }
19444
+ }
19445
+ if (arg.type !== 4) {
19446
+ arg.children.unshift(`(`);
19447
+ arg.children.push(`) || ""`);
19448
+ } else if (!arg.isStatic) {
19449
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
19450
+ }
19451
+ if (modifiers.some((mod) => mod.content === "camel")) {
19452
+ if (arg.type === 4) {
19453
+ if (arg.isStatic) {
19454
+ arg.content = camelize(arg.content);
19455
+ } else {
19456
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
19457
+ }
19458
+ } else {
19459
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
19460
+ arg.children.push(`)`);
19461
+ }
19462
+ }
19463
+ if (!context.inSSR) {
19464
+ if (modifiers.some((mod) => mod.content === "prop")) {
19465
+ injectPrefix(arg, ".");
19466
+ }
19467
+ if (modifiers.some((mod) => mod.content === "attr")) {
19468
+ injectPrefix(arg, "^");
19469
+ }
19470
+ }
19471
+ return {
19472
+ props: [createObjectProperty(arg, exp)]
19473
+ };
19474
+ };
19475
+ const injectPrefix = (arg, prefix) => {
19476
+ if (arg.type === 4) {
19477
+ if (arg.isStatic) {
19478
+ arg.content = prefix + arg.content;
19479
+ } else {
19480
+ arg.content = `\`${prefix}\${${arg.content}}\``;
19481
+ }
19482
+ } else {
19483
+ arg.children.unshift(`'${prefix}' + (`);
19484
+ arg.children.push(`)`);
19485
+ }
19486
+ };
19487
+
19441
19488
  const transformText = (node, context) => {
19442
19489
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
19443
19490
  return () => {
@@ -19768,9 +19815,36 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19768
19815
  }
19769
19816
  };
19770
19817
 
19818
+ const transformVBindShorthand = (node, context) => {
19819
+ if (node.type === 1) {
19820
+ for (const prop of node.props) {
19821
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
19822
+ prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
19823
+ const arg = prop.arg;
19824
+ if (arg.type !== 4 || !arg.isStatic) {
19825
+ context.onError(
19826
+ createCompilerError(
19827
+ 52,
19828
+ arg.loc
19829
+ )
19830
+ );
19831
+ prop.exp = createSimpleExpression("", true, arg.loc);
19832
+ } else {
19833
+ const propName = camelize(arg.content);
19834
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
19835
+ propName[0] === "-") {
19836
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
19837
+ }
19838
+ }
19839
+ }
19840
+ }
19841
+ }
19842
+ };
19843
+
19771
19844
  function getBaseTransformPreset(prefixIdentifiers) {
19772
19845
  return [
19773
19846
  [
19847
+ transformVBindShorthand,
19774
19848
  transformOnce,
19775
19849
  transformIf,
19776
19850
  transformMemo,