@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
  **/
@@ -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) {
@@ -3594,9 +3592,6 @@ const TeleportImpl = {
3594
3592
  insert(mainAnchor, container, anchor);
3595
3593
  const mount = (container2, anchor2) => {
3596
3594
  if (shapeFlag & 16) {
3597
- if (parentComponent && parentComponent.isCE) {
3598
- parentComponent.ce._teleportTarget = container2;
3599
- }
3600
3595
  mountChildren(
3601
3596
  children,
3602
3597
  container2,
@@ -3618,6 +3613,9 @@ const TeleportImpl = {
3618
3613
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3619
3614
  namespace = "mathml";
3620
3615
  }
3616
+ if (parentComponent && parentComponent.isCE) {
3617
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3618
+ }
3621
3619
  if (!disabled) {
3622
3620
  mount(target, targetAnchor);
3623
3621
  updateCssVars(n2, false);
@@ -4727,14 +4725,16 @@ Server rendered element contains more child nodes than client vdom.`
4727
4725
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4728
4726
  clientText = clientText.slice(1);
4729
4727
  }
4730
- if (el.textContent !== clientText) {
4728
+ const { textContent } = el;
4729
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4730
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4731
4731
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4732
4732
  warn$1(
4733
4733
  `Hydration text content mismatch on`,
4734
4734
  el,
4735
4735
  `
4736
- - rendered on server: ${el.textContent}
4737
- - expected on client: ${vnode.children}`
4736
+ - rendered on server: ${textContent}
4737
+ - expected on client: ${clientText}`
4738
4738
  );
4739
4739
  logMismatchError();
4740
4740
  }
@@ -5329,7 +5329,10 @@ function defineAsyncComponent(source) {
5329
5329
  error: error.value
5330
5330
  });
5331
5331
  } else if (loadingComponent && !delayed.value) {
5332
- return createVNode(loadingComponent);
5332
+ return createInnerComp(
5333
+ loadingComponent,
5334
+ instance
5335
+ );
5333
5336
  }
5334
5337
  };
5335
5338
  }
@@ -6077,12 +6080,13 @@ function createSlots(slots, dynamicSlots) {
6077
6080
 
6078
6081
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6079
6082
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6083
+ const hasProps = Object.keys(props).length > 0;
6080
6084
  if (name !== "default") props.name = name;
6081
6085
  return openBlock(), createBlock(
6082
6086
  Fragment,
6083
6087
  null,
6084
6088
  [createVNode("slot", props, fallback && fallback())],
6085
- 64
6089
+ hasProps ? -2 : 64
6086
6090
  );
6087
6091
  }
6088
6092
  let slot = slots[name];
@@ -7273,7 +7277,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7273
7277
  return vm;
7274
7278
  }
7275
7279
  }
7276
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
7280
+ Vue.version = `2.6.14-compat:${"3.5.23"}`;
7277
7281
  Vue.config = singletonApp.config;
7278
7282
  Vue.use = (plugin, ...options) => {
7279
7283
  if (plugin && isFunction(plugin.install)) {
@@ -8719,15 +8723,25 @@ function baseCreateRenderer(options, createHydrationFns) {
8719
8723
  optimized
8720
8724
  );
8721
8725
  } else {
8722
- patchElement(
8723
- n1,
8724
- n2,
8725
- parentComponent,
8726
- parentSuspense,
8727
- namespace,
8728
- slotScopeIds,
8729
- optimized
8730
- );
8726
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
8727
+ try {
8728
+ if (customElement) {
8729
+ customElement._beginPatch();
8730
+ }
8731
+ patchElement(
8732
+ n1,
8733
+ n2,
8734
+ parentComponent,
8735
+ parentSuspense,
8736
+ namespace,
8737
+ slotScopeIds,
8738
+ optimized
8739
+ );
8740
+ } finally {
8741
+ if (customElement) {
8742
+ customElement._endPatch();
8743
+ }
8744
+ }
8731
8745
  }
8732
8746
  };
8733
8747
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -11032,7 +11046,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11032
11046
  pendingId,
11033
11047
  effects,
11034
11048
  parentComponent: parentComponent2,
11035
- container: container2
11049
+ container: container2,
11050
+ isInFallback
11036
11051
  } = suspense;
11037
11052
  let delayEnter = false;
11038
11053
  if (suspense.isHydrating) {
@@ -11049,6 +11064,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11049
11064
  0
11050
11065
  );
11051
11066
  queuePostFlushCb(effects);
11067
+ if (isInFallback && vnode2.ssFallback) {
11068
+ vnode2.ssFallback.el = null;
11069
+ }
11052
11070
  }
11053
11071
  };
11054
11072
  }
@@ -11057,6 +11075,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11057
11075
  anchor = next(activeBranch);
11058
11076
  }
11059
11077
  unmount(activeBranch, parentComponent2, suspense, true);
11078
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11079
+ vnode2.ssFallback.el = null;
11080
+ }
11060
11081
  }
11061
11082
  if (!delayEnter) {
11062
11083
  move(pendingBranch, container2, anchor, 0);
@@ -11175,6 +11196,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11175
11196
  optimized2
11176
11197
  );
11177
11198
  if (placeholder) {
11199
+ vnode2.placeholder = null;
11178
11200
  remove(placeholder);
11179
11201
  }
11180
11202
  updateHOCHostEl(instance, vnode2.el);
@@ -12198,31 +12220,28 @@ const computed = (getterOrOptions, debugOptions) => {
12198
12220
  };
12199
12221
 
12200
12222
  function h(type, propsOrChildren, children) {
12201
- const doCreateVNode = (type2, props, children2) => {
12223
+ try {
12202
12224
  setBlockTracking(-1);
12203
- try {
12204
- return createVNode(type2, props, children2);
12205
- } finally {
12206
- setBlockTracking(1);
12207
- }
12208
- };
12209
- const l = arguments.length;
12210
- if (l === 2) {
12211
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12212
- if (isVNode(propsOrChildren)) {
12213
- return doCreateVNode(type, null, [propsOrChildren]);
12225
+ const l = arguments.length;
12226
+ if (l === 2) {
12227
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12228
+ if (isVNode(propsOrChildren)) {
12229
+ return createVNode(type, null, [propsOrChildren]);
12230
+ }
12231
+ return createVNode(type, propsOrChildren);
12232
+ } else {
12233
+ return createVNode(type, null, propsOrChildren);
12214
12234
  }
12215
- return doCreateVNode(type, propsOrChildren);
12216
12235
  } else {
12217
- return doCreateVNode(type, null, propsOrChildren);
12218
- }
12219
- } else {
12220
- if (l > 3) {
12221
- children = Array.prototype.slice.call(arguments, 2);
12222
- } else if (l === 3 && isVNode(children)) {
12223
- children = [children];
12236
+ if (l > 3) {
12237
+ children = Array.prototype.slice.call(arguments, 2);
12238
+ } else if (l === 3 && isVNode(children)) {
12239
+ children = [children];
12240
+ }
12241
+ return createVNode(type, propsOrChildren, children);
12224
12242
  }
12225
- return doCreateVNode(type, propsOrChildren, children);
12243
+ } finally {
12244
+ setBlockTracking(1);
12226
12245
  }
12227
12246
  }
12228
12247
 
@@ -12432,7 +12451,7 @@ function isMemoSame(cached, memo) {
12432
12451
  return true;
12433
12452
  }
12434
12453
 
12435
- const version = "3.5.21";
12454
+ const version = "3.5.23";
12436
12455
  const warn = warn$1 ;
12437
12456
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12438
12457
  const devtools = devtools$1 ;
@@ -12702,11 +12721,11 @@ function resolveTransitionProps(rawProps) {
12702
12721
  addTransitionClass(el, legacyLeaveFromClass);
12703
12722
  }
12704
12723
  if (!el._enterCancelled) {
12705
- forceReflow();
12724
+ forceReflow(el);
12706
12725
  addTransitionClass(el, leaveActiveClass);
12707
12726
  } else {
12708
12727
  addTransitionClass(el, leaveActiveClass);
12709
- forceReflow();
12728
+ forceReflow(el);
12710
12729
  }
12711
12730
  nextFrame(() => {
12712
12731
  if (!el._isLeaving) {
@@ -12855,8 +12874,9 @@ function toMs(s) {
12855
12874
  if (s === "auto") return 0;
12856
12875
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12857
12876
  }
12858
- function forceReflow() {
12859
- return document.body.offsetHeight;
12877
+ function forceReflow(el) {
12878
+ const targetDocument = el ? el.ownerDocument : document;
12879
+ return targetDocument.body.offsetHeight;
12860
12880
  }
12861
12881
 
12862
12882
  function patchClass(el, value, isSVG) {
@@ -13341,6 +13361,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
13341
13361
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13342
13362
  return false;
13343
13363
  }
13364
+ if (key === "sandbox" && el.tagName === "IFRAME") {
13365
+ return false;
13366
+ }
13344
13367
  if (key === "form") {
13345
13368
  return false;
13346
13369
  }
@@ -13401,6 +13424,8 @@ class VueElement extends BaseClass {
13401
13424
  this._nonce = this._def.nonce;
13402
13425
  this._connected = false;
13403
13426
  this._resolved = false;
13427
+ this._patching = false;
13428
+ this._dirty = false;
13404
13429
  this._numberProps = null;
13405
13430
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13406
13431
  this._ob = null;
@@ -13413,7 +13438,11 @@ class VueElement extends BaseClass {
13413
13438
  );
13414
13439
  }
13415
13440
  if (_def.shadowRoot !== false) {
13416
- this.attachShadow({ mode: "open" });
13441
+ this.attachShadow(
13442
+ extend({}, _def.shadowRootOptions, {
13443
+ mode: "open"
13444
+ })
13445
+ );
13417
13446
  this._root = this.shadowRoot;
13418
13447
  } else {
13419
13448
  this._root = this;
@@ -13473,9 +13502,18 @@ class VueElement extends BaseClass {
13473
13502
  this._app && this._app.unmount();
13474
13503
  if (this._instance) this._instance.ce = void 0;
13475
13504
  this._app = this._instance = null;
13505
+ if (this._teleportTargets) {
13506
+ this._teleportTargets.clear();
13507
+ this._teleportTargets = void 0;
13508
+ }
13476
13509
  }
13477
13510
  });
13478
13511
  }
13512
+ _processMutations(mutations) {
13513
+ for (const m of mutations) {
13514
+ this._setAttr(m.attributeName);
13515
+ }
13516
+ }
13479
13517
  /**
13480
13518
  * resolve inner component definition (handle possible async component)
13481
13519
  */
@@ -13486,11 +13524,7 @@ class VueElement extends BaseClass {
13486
13524
  for (let i = 0; i < this.attributes.length; i++) {
13487
13525
  this._setAttr(this.attributes[i].name);
13488
13526
  }
13489
- this._ob = new MutationObserver((mutations) => {
13490
- for (const m of mutations) {
13491
- this._setAttr(m.attributeName);
13492
- }
13493
- });
13527
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13494
13528
  this._ob.observe(this, { attributes: true });
13495
13529
  const resolve = (def, isAsync = false) => {
13496
13530
  this._resolved = true;
@@ -13567,7 +13601,7 @@ class VueElement extends BaseClass {
13567
13601
  return this._getProp(key);
13568
13602
  },
13569
13603
  set(val) {
13570
- this._setProp(key, val, true, true);
13604
+ this._setProp(key, val, true, !this._patching);
13571
13605
  }
13572
13606
  });
13573
13607
  }
@@ -13593,6 +13627,7 @@ class VueElement extends BaseClass {
13593
13627
  */
13594
13628
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13595
13629
  if (val !== this._props[key]) {
13630
+ this._dirty = true;
13596
13631
  if (val === REMOVAL) {
13597
13632
  delete this._props[key];
13598
13633
  } else {
@@ -13606,7 +13641,10 @@ class VueElement extends BaseClass {
13606
13641
  }
13607
13642
  if (shouldReflect) {
13608
13643
  const ob = this._ob;
13609
- ob && ob.disconnect();
13644
+ if (ob) {
13645
+ this._processMutations(ob.takeRecords());
13646
+ ob.disconnect();
13647
+ }
13610
13648
  if (val === true) {
13611
13649
  this.setAttribute(hyphenate(key), "");
13612
13650
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13710,7 +13748,7 @@ class VueElement extends BaseClass {
13710
13748
  * Only called when shadowRoot is false
13711
13749
  */
13712
13750
  _renderSlots() {
13713
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13751
+ const outlets = this._getSlots();
13714
13752
  const scopeId = this._instance.type.__scopeId;
13715
13753
  for (let i = 0; i < outlets.length; i++) {
13716
13754
  const o = outlets[i];
@@ -13736,12 +13774,45 @@ class VueElement extends BaseClass {
13736
13774
  parent.removeChild(o);
13737
13775
  }
13738
13776
  }
13777
+ /**
13778
+ * @internal
13779
+ */
13780
+ _getSlots() {
13781
+ const roots = [this];
13782
+ if (this._teleportTargets) {
13783
+ roots.push(...this._teleportTargets);
13784
+ }
13785
+ const slots = /* @__PURE__ */ new Set();
13786
+ for (const root of roots) {
13787
+ const found = root.querySelectorAll("slot");
13788
+ for (let i = 0; i < found.length; i++) {
13789
+ slots.add(found[i]);
13790
+ }
13791
+ }
13792
+ return Array.from(slots);
13793
+ }
13739
13794
  /**
13740
13795
  * @internal
13741
13796
  */
13742
13797
  _injectChildStyle(comp) {
13743
13798
  this._applyStyles(comp.styles, comp);
13744
13799
  }
13800
+ /**
13801
+ * @internal
13802
+ */
13803
+ _beginPatch() {
13804
+ this._patching = true;
13805
+ this._dirty = false;
13806
+ }
13807
+ /**
13808
+ * @internal
13809
+ */
13810
+ _endPatch() {
13811
+ this._patching = false;
13812
+ if (this._dirty && this._instance) {
13813
+ this._update();
13814
+ }
13815
+ }
13745
13816
  /**
13746
13817
  * @internal
13747
13818
  */
@@ -13840,7 +13911,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13840
13911
  prevChildren.forEach(callPendingCbs);
13841
13912
  prevChildren.forEach(recordPosition);
13842
13913
  const movedChildren = prevChildren.filter(applyTranslation);
13843
- forceReflow();
13914
+ forceReflow(instance.vnode.el);
13844
13915
  movedChildren.forEach((c) => {
13845
13916
  const el = c.el;
13846
13917
  const style = el.style;
@@ -13885,10 +13956,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13885
13956
  instance
13886
13957
  )
13887
13958
  );
13888
- positionMap.set(
13889
- child,
13890
- child.el.getBoundingClientRect()
13891
- );
13959
+ positionMap.set(child, {
13960
+ left: child.el.offsetLeft,
13961
+ top: child.el.offsetTop
13962
+ });
13892
13963
  }
13893
13964
  }
13894
13965
  }
@@ -13919,7 +13990,10 @@ function callPendingCbs(c) {
13919
13990
  }
13920
13991
  }
13921
13992
  function recordPosition(c) {
13922
- newPositionMap.set(c, c.el.getBoundingClientRect());
13993
+ newPositionMap.set(c, {
13994
+ left: c.el.offsetLeft,
13995
+ top: c.el.offsetTop
13996
+ });
13923
13997
  }
13924
13998
  function applyTranslation(c) {
13925
13999
  const oldPos = positionMap.get(c);
@@ -13965,24 +14039,22 @@ function onCompositionEnd(e) {
13965
14039
  }
13966
14040
  }
13967
14041
  const assignKey = Symbol("_assign");
14042
+ function castValue(value, trim, number) {
14043
+ if (trim) value = value.trim();
14044
+ if (number) value = looseToNumber(value);
14045
+ return value;
14046
+ }
13968
14047
  const vModelText = {
13969
14048
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
13970
14049
  el[assignKey] = getModelAssigner(vnode);
13971
14050
  const castToNumber = number || vnode.props && vnode.props.type === "number";
13972
14051
  addEventListener(el, lazy ? "change" : "input", (e) => {
13973
14052
  if (e.target.composing) return;
13974
- let domValue = el.value;
13975
- if (trim) {
13976
- domValue = domValue.trim();
13977
- }
13978
- if (castToNumber) {
13979
- domValue = looseToNumber(domValue);
13980
- }
13981
- el[assignKey](domValue);
14053
+ el[assignKey](castValue(el.value, trim, castToNumber));
13982
14054
  });
13983
- if (trim) {
14055
+ if (trim || castToNumber) {
13984
14056
  addEventListener(el, "change", () => {
13985
- el.value = el.value.trim();
14057
+ el.value = castValue(el.value, trim, castToNumber);
13986
14058
  });
13987
14059
  }
13988
14060
  if (!lazy) {
@@ -18317,80 +18389,6 @@ function getParentCondition(node) {
18317
18389
  }
18318
18390
  }
18319
18391
 
18320
- const transformBind = (dir, _node, context) => {
18321
- const { modifiers, loc } = dir;
18322
- const arg = dir.arg;
18323
- let { exp } = dir;
18324
- if (exp && exp.type === 4 && !exp.content.trim()) {
18325
- {
18326
- exp = void 0;
18327
- }
18328
- }
18329
- if (!exp) {
18330
- if (arg.type !== 4 || !arg.isStatic) {
18331
- context.onError(
18332
- createCompilerError(
18333
- 52,
18334
- arg.loc
18335
- )
18336
- );
18337
- return {
18338
- props: [
18339
- createObjectProperty(arg, createSimpleExpression("", true, loc))
18340
- ]
18341
- };
18342
- }
18343
- transformBindShorthand(dir);
18344
- exp = dir.exp;
18345
- }
18346
- if (arg.type !== 4) {
18347
- arg.children.unshift(`(`);
18348
- arg.children.push(`) || ""`);
18349
- } else if (!arg.isStatic) {
18350
- arg.content = arg.content ? `${arg.content} || ""` : `""`;
18351
- }
18352
- if (modifiers.some((mod) => mod.content === "camel")) {
18353
- if (arg.type === 4) {
18354
- if (arg.isStatic) {
18355
- arg.content = camelize(arg.content);
18356
- } else {
18357
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
18358
- }
18359
- } else {
18360
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
18361
- arg.children.push(`)`);
18362
- }
18363
- }
18364
- if (!context.inSSR) {
18365
- if (modifiers.some((mod) => mod.content === "prop")) {
18366
- injectPrefix(arg, ".");
18367
- }
18368
- if (modifiers.some((mod) => mod.content === "attr")) {
18369
- injectPrefix(arg, "^");
18370
- }
18371
- }
18372
- return {
18373
- props: [createObjectProperty(arg, exp)]
18374
- };
18375
- };
18376
- const transformBindShorthand = (dir, context) => {
18377
- const arg = dir.arg;
18378
- const propName = camelize(arg.content);
18379
- dir.exp = createSimpleExpression(propName, false, arg.loc);
18380
- };
18381
- const injectPrefix = (arg, prefix) => {
18382
- if (arg.type === 4) {
18383
- if (arg.isStatic) {
18384
- arg.content = prefix + arg.content;
18385
- } else {
18386
- arg.content = `\`${prefix}\${${arg.content}}\``;
18387
- }
18388
- } else {
18389
- arg.children.unshift(`'${prefix}' + (`);
18390
- arg.children.push(`)`);
18391
- }
18392
- };
18393
-
18394
18392
  const transformFor = createStructuralDirectiveTransform(
18395
18393
  "for",
18396
18394
  (node, dir, context) => {
@@ -18402,10 +18400,7 @@ const transformFor = createStructuralDirectiveTransform(
18402
18400
  const isTemplate = isTemplateNode(node);
18403
18401
  const memo = findDir(node, "memo");
18404
18402
  const keyProp = findProp(node, `key`, false, true);
18405
- const isDirKey = keyProp && keyProp.type === 7;
18406
- if (isDirKey && !keyProp.exp) {
18407
- transformBindShorthand(keyProp);
18408
- }
18403
+ keyProp && keyProp.type === 7;
18409
18404
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18410
18405
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18411
18406
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
@@ -19558,6 +19553,58 @@ const transformOn$1 = (dir, node, context, augmentor) => {
19558
19553
  return ret;
19559
19554
  };
19560
19555
 
19556
+ const transformBind = (dir, _node, context) => {
19557
+ const { modifiers, loc } = dir;
19558
+ const arg = dir.arg;
19559
+ let { exp } = dir;
19560
+ if (exp && exp.type === 4 && !exp.content.trim()) {
19561
+ {
19562
+ exp = void 0;
19563
+ }
19564
+ }
19565
+ if (arg.type !== 4) {
19566
+ arg.children.unshift(`(`);
19567
+ arg.children.push(`) || ""`);
19568
+ } else if (!arg.isStatic) {
19569
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
19570
+ }
19571
+ if (modifiers.some((mod) => mod.content === "camel")) {
19572
+ if (arg.type === 4) {
19573
+ if (arg.isStatic) {
19574
+ arg.content = camelize(arg.content);
19575
+ } else {
19576
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
19577
+ }
19578
+ } else {
19579
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
19580
+ arg.children.push(`)`);
19581
+ }
19582
+ }
19583
+ if (!context.inSSR) {
19584
+ if (modifiers.some((mod) => mod.content === "prop")) {
19585
+ injectPrefix(arg, ".");
19586
+ }
19587
+ if (modifiers.some((mod) => mod.content === "attr")) {
19588
+ injectPrefix(arg, "^");
19589
+ }
19590
+ }
19591
+ return {
19592
+ props: [createObjectProperty(arg, exp)]
19593
+ };
19594
+ };
19595
+ const injectPrefix = (arg, prefix) => {
19596
+ if (arg.type === 4) {
19597
+ if (arg.isStatic) {
19598
+ arg.content = prefix + arg.content;
19599
+ } else {
19600
+ arg.content = `\`${prefix}\${${arg.content}}\``;
19601
+ }
19602
+ } else {
19603
+ arg.children.unshift(`'${prefix}' + (`);
19604
+ arg.children.push(`)`);
19605
+ }
19606
+ };
19607
+
19561
19608
  const transformText = (node, context) => {
19562
19609
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
19563
19610
  return () => {
@@ -19888,9 +19935,36 @@ const transformMemo = (node, context) => {
19888
19935
  }
19889
19936
  };
19890
19937
 
19938
+ const transformVBindShorthand = (node, context) => {
19939
+ if (node.type === 1) {
19940
+ for (const prop of node.props) {
19941
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
19942
+ prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
19943
+ const arg = prop.arg;
19944
+ if (arg.type !== 4 || !arg.isStatic) {
19945
+ context.onError(
19946
+ createCompilerError(
19947
+ 52,
19948
+ arg.loc
19949
+ )
19950
+ );
19951
+ prop.exp = createSimpleExpression("", true, arg.loc);
19952
+ } else {
19953
+ const propName = camelize(arg.content);
19954
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
19955
+ propName[0] === "-") {
19956
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
19957
+ }
19958
+ }
19959
+ }
19960
+ }
19961
+ }
19962
+ };
19963
+
19891
19964
  function getBaseTransformPreset(prefixIdentifiers) {
19892
19965
  return [
19893
19966
  [
19967
+ transformVBindShorthand,
19894
19968
  transformOnce,
19895
19969
  transformIf,
19896
19970
  transformMemo,