vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.21
2
+ * vue v3.5.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.21
2
+ * vue v3.5.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.21
2
+ * vue v3.5.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1215,7 +1215,7 @@ function iterator(self, method, wrapValue) {
1215
1215
  iter._next = iter.next;
1216
1216
  iter.next = () => {
1217
1217
  const result = iter._next();
1218
- if (result.value) {
1218
+ if (!result.done) {
1219
1219
  result.value = wrapValue(result.value);
1220
1220
  }
1221
1221
  return result;
@@ -1342,7 +1342,8 @@ class BaseReactiveHandler {
1342
1342
  return res;
1343
1343
  }
1344
1344
  if (isRef(res)) {
1345
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1345
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1346
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1346
1347
  }
1347
1348
  if (isObject(res)) {
1348
1349
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2692,14 +2693,11 @@ function checkRecursiveUpdates(seen, fn) {
2692
2693
  let isHmrUpdating = false;
2693
2694
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2694
2695
  {
2695
- const g = getGlobalThis();
2696
- if (!g.__VUE_HMR_RUNTIME__) {
2697
- g.__VUE_HMR_RUNTIME__ = {
2698
- createRecord: tryWrap(createRecord),
2699
- rerender: tryWrap(rerender),
2700
- reload: tryWrap(reload)
2701
- };
2702
- }
2696
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
2697
+ createRecord: tryWrap(createRecord),
2698
+ rerender: tryWrap(rerender),
2699
+ reload: tryWrap(reload)
2700
+ };
2703
2701
  }
2704
2702
  const map = /* @__PURE__ */ new Map();
2705
2703
  function registerHMR(instance) {
@@ -3066,9 +3064,6 @@ const TeleportImpl = {
3066
3064
  insert(mainAnchor, container, anchor);
3067
3065
  const mount = (container2, anchor2) => {
3068
3066
  if (shapeFlag & 16) {
3069
- if (parentComponent && parentComponent.isCE) {
3070
- parentComponent.ce._teleportTarget = container2;
3071
- }
3072
3067
  mountChildren(
3073
3068
  children,
3074
3069
  container2,
@@ -3090,6 +3085,9 @@ const TeleportImpl = {
3090
3085
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3091
3086
  namespace = "mathml";
3092
3087
  }
3088
+ if (parentComponent && parentComponent.isCE) {
3089
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3090
+ }
3093
3091
  if (!disabled) {
3094
3092
  mount(target, targetAnchor);
3095
3093
  updateCssVars(n2, false);
@@ -4196,14 +4194,16 @@ Server rendered element contains more child nodes than client vdom.`
4196
4194
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4197
4195
  clientText = clientText.slice(1);
4198
4196
  }
4199
- if (el.textContent !== clientText) {
4197
+ const { textContent } = el;
4198
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4199
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4200
4200
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4201
4201
  warn$1(
4202
4202
  `Hydration text content mismatch on`,
4203
4203
  el,
4204
4204
  `
4205
- - rendered on server: ${el.textContent}
4206
- - expected on client: ${vnode.children}`
4205
+ - rendered on server: ${textContent}
4206
+ - expected on client: ${clientText}`
4207
4207
  );
4208
4208
  logMismatchError();
4209
4209
  }
@@ -4798,7 +4798,10 @@ function defineAsyncComponent(source) {
4798
4798
  error: error.value
4799
4799
  });
4800
4800
  } else if (loadingComponent && !delayed.value) {
4801
- return createVNode(loadingComponent);
4801
+ return createInnerComp(
4802
+ loadingComponent,
4803
+ instance
4804
+ );
4802
4805
  }
4803
4806
  };
4804
4807
  }
@@ -5255,12 +5258,13 @@ function createSlots(slots, dynamicSlots) {
5255
5258
 
5256
5259
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5257
5260
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5261
+ const hasProps = Object.keys(props).length > 0;
5258
5262
  if (name !== "default") props.name = name;
5259
5263
  return openBlock(), createBlock(
5260
5264
  Fragment,
5261
5265
  null,
5262
5266
  [createVNode("slot", props, fallback && fallback())],
5263
- 64
5267
+ hasProps ? -2 : 64
5264
5268
  );
5265
5269
  }
5266
5270
  let slot = slots[name];
@@ -7098,15 +7102,25 @@ function baseCreateRenderer(options, createHydrationFns) {
7098
7102
  optimized
7099
7103
  );
7100
7104
  } else {
7101
- patchElement(
7102
- n1,
7103
- n2,
7104
- parentComponent,
7105
- parentSuspense,
7106
- namespace,
7107
- slotScopeIds,
7108
- optimized
7109
- );
7105
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
7106
+ try {
7107
+ if (customElement) {
7108
+ customElement._beginPatch();
7109
+ }
7110
+ patchElement(
7111
+ n1,
7112
+ n2,
7113
+ parentComponent,
7114
+ parentSuspense,
7115
+ namespace,
7116
+ slotScopeIds,
7117
+ optimized
7118
+ );
7119
+ } finally {
7120
+ if (customElement) {
7121
+ customElement._endPatch();
7122
+ }
7123
+ }
7110
7124
  }
7111
7125
  };
7112
7126
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -9348,7 +9362,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9348
9362
  pendingId,
9349
9363
  effects,
9350
9364
  parentComponent: parentComponent2,
9351
- container: container2
9365
+ container: container2,
9366
+ isInFallback
9352
9367
  } = suspense;
9353
9368
  let delayEnter = false;
9354
9369
  if (suspense.isHydrating) {
@@ -9365,6 +9380,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9365
9380
  0
9366
9381
  );
9367
9382
  queuePostFlushCb(effects);
9383
+ if (isInFallback && vnode2.ssFallback) {
9384
+ vnode2.ssFallback.el = null;
9385
+ }
9368
9386
  }
9369
9387
  };
9370
9388
  }
@@ -9373,6 +9391,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9373
9391
  anchor = next(activeBranch);
9374
9392
  }
9375
9393
  unmount(activeBranch, parentComponent2, suspense, true);
9394
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
9395
+ vnode2.ssFallback.el = null;
9396
+ }
9376
9397
  }
9377
9398
  if (!delayEnter) {
9378
9399
  move(pendingBranch, container2, anchor, 0);
@@ -9491,6 +9512,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9491
9512
  optimized2
9492
9513
  );
9493
9514
  if (placeholder) {
9515
+ vnode2.placeholder = null;
9494
9516
  remove(placeholder);
9495
9517
  }
9496
9518
  updateHOCHostEl(instance, vnode2.el);
@@ -10435,31 +10457,28 @@ const computed = (getterOrOptions, debugOptions) => {
10435
10457
  };
10436
10458
 
10437
10459
  function h(type, propsOrChildren, children) {
10438
- const doCreateVNode = (type2, props, children2) => {
10460
+ try {
10439
10461
  setBlockTracking(-1);
10440
- try {
10441
- return createVNode(type2, props, children2);
10442
- } finally {
10443
- setBlockTracking(1);
10444
- }
10445
- };
10446
- const l = arguments.length;
10447
- if (l === 2) {
10448
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10449
- if (isVNode(propsOrChildren)) {
10450
- return doCreateVNode(type, null, [propsOrChildren]);
10462
+ const l = arguments.length;
10463
+ if (l === 2) {
10464
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10465
+ if (isVNode(propsOrChildren)) {
10466
+ return createVNode(type, null, [propsOrChildren]);
10467
+ }
10468
+ return createVNode(type, propsOrChildren);
10469
+ } else {
10470
+ return createVNode(type, null, propsOrChildren);
10451
10471
  }
10452
- return doCreateVNode(type, propsOrChildren);
10453
10472
  } else {
10454
- return doCreateVNode(type, null, propsOrChildren);
10455
- }
10456
- } else {
10457
- if (l > 3) {
10458
- children = Array.prototype.slice.call(arguments, 2);
10459
- } else if (l === 3 && isVNode(children)) {
10460
- children = [children];
10473
+ if (l > 3) {
10474
+ children = Array.prototype.slice.call(arguments, 2);
10475
+ } else if (l === 3 && isVNode(children)) {
10476
+ children = [children];
10477
+ }
10478
+ return createVNode(type, propsOrChildren, children);
10461
10479
  }
10462
- return doCreateVNode(type, propsOrChildren, children);
10480
+ } finally {
10481
+ setBlockTracking(1);
10463
10482
  }
10464
10483
  }
10465
10484
 
@@ -10669,7 +10688,7 @@ function isMemoSame(cached, memo) {
10669
10688
  return true;
10670
10689
  }
10671
10690
 
10672
- const version = "3.5.21";
10691
+ const version = "3.5.23";
10673
10692
  const warn = warn$1 ;
10674
10693
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10675
10694
  const devtools = devtools$1 ;
@@ -10898,11 +10917,11 @@ function resolveTransitionProps(rawProps) {
10898
10917
  const resolve = () => finishLeave(el, done);
10899
10918
  addTransitionClass(el, leaveFromClass);
10900
10919
  if (!el._enterCancelled) {
10901
- forceReflow();
10920
+ forceReflow(el);
10902
10921
  addTransitionClass(el, leaveActiveClass);
10903
10922
  } else {
10904
10923
  addTransitionClass(el, leaveActiveClass);
10905
- forceReflow();
10924
+ forceReflow(el);
10906
10925
  }
10907
10926
  nextFrame(() => {
10908
10927
  if (!el._isLeaving) {
@@ -11048,8 +11067,9 @@ function toMs(s) {
11048
11067
  if (s === "auto") return 0;
11049
11068
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
11050
11069
  }
11051
- function forceReflow() {
11052
- return document.body.offsetHeight;
11070
+ function forceReflow(el) {
11071
+ const targetDocument = el ? el.ownerDocument : document;
11072
+ return targetDocument.body.offsetHeight;
11053
11073
  }
11054
11074
 
11055
11075
  function patchClass(el, value, isSVG) {
@@ -11490,6 +11510,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
11490
11510
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
11491
11511
  return false;
11492
11512
  }
11513
+ if (key === "sandbox" && el.tagName === "IFRAME") {
11514
+ return false;
11515
+ }
11493
11516
  if (key === "form") {
11494
11517
  return false;
11495
11518
  }
@@ -11550,6 +11573,8 @@ class VueElement extends BaseClass {
11550
11573
  this._nonce = this._def.nonce;
11551
11574
  this._connected = false;
11552
11575
  this._resolved = false;
11576
+ this._patching = false;
11577
+ this._dirty = false;
11553
11578
  this._numberProps = null;
11554
11579
  this._styleChildren = /* @__PURE__ */ new WeakSet();
11555
11580
  this._ob = null;
@@ -11562,7 +11587,11 @@ class VueElement extends BaseClass {
11562
11587
  );
11563
11588
  }
11564
11589
  if (_def.shadowRoot !== false) {
11565
- this.attachShadow({ mode: "open" });
11590
+ this.attachShadow(
11591
+ extend({}, _def.shadowRootOptions, {
11592
+ mode: "open"
11593
+ })
11594
+ );
11566
11595
  this._root = this.shadowRoot;
11567
11596
  } else {
11568
11597
  this._root = this;
@@ -11622,9 +11651,18 @@ class VueElement extends BaseClass {
11622
11651
  this._app && this._app.unmount();
11623
11652
  if (this._instance) this._instance.ce = void 0;
11624
11653
  this._app = this._instance = null;
11654
+ if (this._teleportTargets) {
11655
+ this._teleportTargets.clear();
11656
+ this._teleportTargets = void 0;
11657
+ }
11625
11658
  }
11626
11659
  });
11627
11660
  }
11661
+ _processMutations(mutations) {
11662
+ for (const m of mutations) {
11663
+ this._setAttr(m.attributeName);
11664
+ }
11665
+ }
11628
11666
  /**
11629
11667
  * resolve inner component definition (handle possible async component)
11630
11668
  */
@@ -11635,11 +11673,7 @@ class VueElement extends BaseClass {
11635
11673
  for (let i = 0; i < this.attributes.length; i++) {
11636
11674
  this._setAttr(this.attributes[i].name);
11637
11675
  }
11638
- this._ob = new MutationObserver((mutations) => {
11639
- for (const m of mutations) {
11640
- this._setAttr(m.attributeName);
11641
- }
11642
- });
11676
+ this._ob = new MutationObserver(this._processMutations.bind(this));
11643
11677
  this._ob.observe(this, { attributes: true });
11644
11678
  const resolve = (def, isAsync = false) => {
11645
11679
  this._resolved = true;
@@ -11716,7 +11750,7 @@ class VueElement extends BaseClass {
11716
11750
  return this._getProp(key);
11717
11751
  },
11718
11752
  set(val) {
11719
- this._setProp(key, val, true, true);
11753
+ this._setProp(key, val, true, !this._patching);
11720
11754
  }
11721
11755
  });
11722
11756
  }
@@ -11742,6 +11776,7 @@ class VueElement extends BaseClass {
11742
11776
  */
11743
11777
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
11744
11778
  if (val !== this._props[key]) {
11779
+ this._dirty = true;
11745
11780
  if (val === REMOVAL) {
11746
11781
  delete this._props[key];
11747
11782
  } else {
@@ -11755,7 +11790,10 @@ class VueElement extends BaseClass {
11755
11790
  }
11756
11791
  if (shouldReflect) {
11757
11792
  const ob = this._ob;
11758
- ob && ob.disconnect();
11793
+ if (ob) {
11794
+ this._processMutations(ob.takeRecords());
11795
+ ob.disconnect();
11796
+ }
11759
11797
  if (val === true) {
11760
11798
  this.setAttribute(hyphenate(key), "");
11761
11799
  } else if (typeof val === "string" || typeof val === "number") {
@@ -11859,7 +11897,7 @@ class VueElement extends BaseClass {
11859
11897
  * Only called when shadowRoot is false
11860
11898
  */
11861
11899
  _renderSlots() {
11862
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11900
+ const outlets = this._getSlots();
11863
11901
  const scopeId = this._instance.type.__scopeId;
11864
11902
  for (let i = 0; i < outlets.length; i++) {
11865
11903
  const o = outlets[i];
@@ -11885,12 +11923,45 @@ class VueElement extends BaseClass {
11885
11923
  parent.removeChild(o);
11886
11924
  }
11887
11925
  }
11926
+ /**
11927
+ * @internal
11928
+ */
11929
+ _getSlots() {
11930
+ const roots = [this];
11931
+ if (this._teleportTargets) {
11932
+ roots.push(...this._teleportTargets);
11933
+ }
11934
+ const slots = /* @__PURE__ */ new Set();
11935
+ for (const root of roots) {
11936
+ const found = root.querySelectorAll("slot");
11937
+ for (let i = 0; i < found.length; i++) {
11938
+ slots.add(found[i]);
11939
+ }
11940
+ }
11941
+ return Array.from(slots);
11942
+ }
11888
11943
  /**
11889
11944
  * @internal
11890
11945
  */
11891
11946
  _injectChildStyle(comp) {
11892
11947
  this._applyStyles(comp.styles, comp);
11893
11948
  }
11949
+ /**
11950
+ * @internal
11951
+ */
11952
+ _beginPatch() {
11953
+ this._patching = true;
11954
+ this._dirty = false;
11955
+ }
11956
+ /**
11957
+ * @internal
11958
+ */
11959
+ _endPatch() {
11960
+ this._patching = false;
11961
+ if (this._dirty && this._instance) {
11962
+ this._update();
11963
+ }
11964
+ }
11894
11965
  /**
11895
11966
  * @internal
11896
11967
  */
@@ -11986,7 +12057,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11986
12057
  prevChildren.forEach(callPendingCbs);
11987
12058
  prevChildren.forEach(recordPosition);
11988
12059
  const movedChildren = prevChildren.filter(applyTranslation);
11989
- forceReflow();
12060
+ forceReflow(instance.vnode.el);
11990
12061
  movedChildren.forEach((c) => {
11991
12062
  const el = c.el;
11992
12063
  const style = el.style;
@@ -12025,10 +12096,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
12025
12096
  instance
12026
12097
  )
12027
12098
  );
12028
- positionMap.set(
12029
- child,
12030
- child.el.getBoundingClientRect()
12031
- );
12099
+ positionMap.set(child, {
12100
+ left: child.el.offsetLeft,
12101
+ top: child.el.offsetTop
12102
+ });
12032
12103
  }
12033
12104
  }
12034
12105
  }
@@ -12059,7 +12130,10 @@ function callPendingCbs(c) {
12059
12130
  }
12060
12131
  }
12061
12132
  function recordPosition(c) {
12062
- newPositionMap.set(c, c.el.getBoundingClientRect());
12133
+ newPositionMap.set(c, {
12134
+ left: c.el.offsetLeft,
12135
+ top: c.el.offsetTop
12136
+ });
12063
12137
  }
12064
12138
  function applyTranslation(c) {
12065
12139
  const oldPos = positionMap.get(c);
@@ -12105,24 +12179,22 @@ function onCompositionEnd(e) {
12105
12179
  }
12106
12180
  }
12107
12181
  const assignKey = Symbol("_assign");
12182
+ function castValue(value, trim, number) {
12183
+ if (trim) value = value.trim();
12184
+ if (number) value = looseToNumber(value);
12185
+ return value;
12186
+ }
12108
12187
  const vModelText = {
12109
12188
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
12110
12189
  el[assignKey] = getModelAssigner(vnode);
12111
12190
  const castToNumber = number || vnode.props && vnode.props.type === "number";
12112
12191
  addEventListener(el, lazy ? "change" : "input", (e) => {
12113
12192
  if (e.target.composing) return;
12114
- let domValue = el.value;
12115
- if (trim) {
12116
- domValue = domValue.trim();
12117
- }
12118
- if (castToNumber) {
12119
- domValue = looseToNumber(domValue);
12120
- }
12121
- el[assignKey](domValue);
12193
+ el[assignKey](castValue(el.value, trim, castToNumber));
12122
12194
  });
12123
- if (trim) {
12195
+ if (trim || castToNumber) {
12124
12196
  addEventListener(el, "change", () => {
12125
- el.value = el.value.trim();
12197
+ el.value = castValue(el.value, trim, castToNumber);
12126
12198
  });
12127
12199
  }
12128
12200
  if (!lazy) {
@@ -16225,80 +16297,6 @@ function getParentCondition(node) {
16225
16297
  }
16226
16298
  }
16227
16299
 
16228
- const transformBind = (dir, _node, context) => {
16229
- const { modifiers, loc } = dir;
16230
- const arg = dir.arg;
16231
- let { exp } = dir;
16232
- if (exp && exp.type === 4 && !exp.content.trim()) {
16233
- {
16234
- exp = void 0;
16235
- }
16236
- }
16237
- if (!exp) {
16238
- if (arg.type !== 4 || !arg.isStatic) {
16239
- context.onError(
16240
- createCompilerError(
16241
- 52,
16242
- arg.loc
16243
- )
16244
- );
16245
- return {
16246
- props: [
16247
- createObjectProperty(arg, createSimpleExpression("", true, loc))
16248
- ]
16249
- };
16250
- }
16251
- transformBindShorthand(dir);
16252
- exp = dir.exp;
16253
- }
16254
- if (arg.type !== 4) {
16255
- arg.children.unshift(`(`);
16256
- arg.children.push(`) || ""`);
16257
- } else if (!arg.isStatic) {
16258
- arg.content = arg.content ? `${arg.content} || ""` : `""`;
16259
- }
16260
- if (modifiers.some((mod) => mod.content === "camel")) {
16261
- if (arg.type === 4) {
16262
- if (arg.isStatic) {
16263
- arg.content = camelize(arg.content);
16264
- } else {
16265
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
16266
- }
16267
- } else {
16268
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
16269
- arg.children.push(`)`);
16270
- }
16271
- }
16272
- if (!context.inSSR) {
16273
- if (modifiers.some((mod) => mod.content === "prop")) {
16274
- injectPrefix(arg, ".");
16275
- }
16276
- if (modifiers.some((mod) => mod.content === "attr")) {
16277
- injectPrefix(arg, "^");
16278
- }
16279
- }
16280
- return {
16281
- props: [createObjectProperty(arg, exp)]
16282
- };
16283
- };
16284
- const transformBindShorthand = (dir, context) => {
16285
- const arg = dir.arg;
16286
- const propName = camelize(arg.content);
16287
- dir.exp = createSimpleExpression(propName, false, arg.loc);
16288
- };
16289
- const injectPrefix = (arg, prefix) => {
16290
- if (arg.type === 4) {
16291
- if (arg.isStatic) {
16292
- arg.content = prefix + arg.content;
16293
- } else {
16294
- arg.content = `\`${prefix}\${${arg.content}}\``;
16295
- }
16296
- } else {
16297
- arg.children.unshift(`'${prefix}' + (`);
16298
- arg.children.push(`)`);
16299
- }
16300
- };
16301
-
16302
16300
  const transformFor = createStructuralDirectiveTransform(
16303
16301
  "for",
16304
16302
  (node, dir, context) => {
@@ -16310,10 +16308,7 @@ const transformFor = createStructuralDirectiveTransform(
16310
16308
  const isTemplate = isTemplateNode(node);
16311
16309
  const memo = findDir(node, "memo");
16312
16310
  const keyProp = findProp(node, `key`, false, true);
16313
- const isDirKey = keyProp && keyProp.type === 7;
16314
- if (isDirKey && !keyProp.exp) {
16315
- transformBindShorthand(keyProp);
16316
- }
16311
+ keyProp && keyProp.type === 7;
16317
16312
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16318
16313
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
16319
16314
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
@@ -17423,6 +17418,58 @@ const transformOn$1 = (dir, node, context, augmentor) => {
17423
17418
  return ret;
17424
17419
  };
17425
17420
 
17421
+ const transformBind = (dir, _node, context) => {
17422
+ const { modifiers, loc } = dir;
17423
+ const arg = dir.arg;
17424
+ let { exp } = dir;
17425
+ if (exp && exp.type === 4 && !exp.content.trim()) {
17426
+ {
17427
+ exp = void 0;
17428
+ }
17429
+ }
17430
+ if (arg.type !== 4) {
17431
+ arg.children.unshift(`(`);
17432
+ arg.children.push(`) || ""`);
17433
+ } else if (!arg.isStatic) {
17434
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
17435
+ }
17436
+ if (modifiers.some((mod) => mod.content === "camel")) {
17437
+ if (arg.type === 4) {
17438
+ if (arg.isStatic) {
17439
+ arg.content = camelize(arg.content);
17440
+ } else {
17441
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
17442
+ }
17443
+ } else {
17444
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
17445
+ arg.children.push(`)`);
17446
+ }
17447
+ }
17448
+ if (!context.inSSR) {
17449
+ if (modifiers.some((mod) => mod.content === "prop")) {
17450
+ injectPrefix(arg, ".");
17451
+ }
17452
+ if (modifiers.some((mod) => mod.content === "attr")) {
17453
+ injectPrefix(arg, "^");
17454
+ }
17455
+ }
17456
+ return {
17457
+ props: [createObjectProperty(arg, exp)]
17458
+ };
17459
+ };
17460
+ const injectPrefix = (arg, prefix) => {
17461
+ if (arg.type === 4) {
17462
+ if (arg.isStatic) {
17463
+ arg.content = prefix + arg.content;
17464
+ } else {
17465
+ arg.content = `\`${prefix}\${${arg.content}}\``;
17466
+ }
17467
+ } else {
17468
+ arg.children.unshift(`'${prefix}' + (`);
17469
+ arg.children.push(`)`);
17470
+ }
17471
+ };
17472
+
17426
17473
  const transformText = (node, context) => {
17427
17474
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
17428
17475
  return () => {
@@ -17604,9 +17651,36 @@ const transformMemo = (node, context) => {
17604
17651
  }
17605
17652
  };
17606
17653
 
17654
+ const transformVBindShorthand = (node, context) => {
17655
+ if (node.type === 1) {
17656
+ for (const prop of node.props) {
17657
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
17658
+ prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
17659
+ const arg = prop.arg;
17660
+ if (arg.type !== 4 || !arg.isStatic) {
17661
+ context.onError(
17662
+ createCompilerError(
17663
+ 52,
17664
+ arg.loc
17665
+ )
17666
+ );
17667
+ prop.exp = createSimpleExpression("", true, arg.loc);
17668
+ } else {
17669
+ const propName = camelize(arg.content);
17670
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
17671
+ propName[0] === "-") {
17672
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
17673
+ }
17674
+ }
17675
+ }
17676
+ }
17677
+ }
17678
+ };
17679
+
17607
17680
  function getBaseTransformPreset(prefixIdentifiers) {
17608
17681
  return [
17609
17682
  [
17683
+ transformVBindShorthand,
17610
17684
  transformOnce,
17611
17685
  transformIf,
17612
17686
  transformMemo,