@vue/compat 3.5.21 → 3.5.22

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.22
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);
@@ -6074,12 +6072,13 @@ If this is a native custom element, make sure to exclude it from component resol
6074
6072
 
6075
6073
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6076
6074
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6075
+ const hasProps = Object.keys(props).length > 0;
6077
6076
  if (name !== "default") props.name = name;
6078
6077
  return openBlock(), createBlock(
6079
6078
  Fragment,
6080
6079
  null,
6081
6080
  [createVNode("slot", props, fallback && fallback())],
6082
- 64
6081
+ hasProps ? -2 : 64
6083
6082
  );
6084
6083
  }
6085
6084
  let slot = slots[name];
@@ -7267,7 +7266,7 @@ If this is a native custom element, make sure to exclude it from component resol
7267
7266
  return vm;
7268
7267
  }
7269
7268
  }
7270
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
7269
+ Vue.version = `2.6.14-compat:${"3.5.22"}`;
7271
7270
  Vue.config = singletonApp.config;
7272
7271
  Vue.use = (plugin, ...options) => {
7273
7272
  if (plugin && isFunction(plugin.install)) {
@@ -12150,31 +12149,28 @@ Component that was made reactive: `,
12150
12149
  };
12151
12150
 
12152
12151
  function h(type, propsOrChildren, children) {
12153
- const doCreateVNode = (type2, props, children2) => {
12152
+ try {
12154
12153
  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]);
12154
+ const l = arguments.length;
12155
+ if (l === 2) {
12156
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12157
+ if (isVNode(propsOrChildren)) {
12158
+ return createVNode(type, null, [propsOrChildren]);
12159
+ }
12160
+ return createVNode(type, propsOrChildren);
12161
+ } else {
12162
+ return createVNode(type, null, propsOrChildren);
12166
12163
  }
12167
- return doCreateVNode(type, propsOrChildren);
12168
12164
  } 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];
12165
+ if (l > 3) {
12166
+ children = Array.prototype.slice.call(arguments, 2);
12167
+ } else if (l === 3 && isVNode(children)) {
12168
+ children = [children];
12169
+ }
12170
+ return createVNode(type, propsOrChildren, children);
12176
12171
  }
12177
- return doCreateVNode(type, propsOrChildren, children);
12172
+ } finally {
12173
+ setBlockTracking(1);
12178
12174
  }
12179
12175
  }
12180
12176
 
@@ -12384,7 +12380,7 @@ Component that was made reactive: `,
12384
12380
  return true;
12385
12381
  }
12386
12382
 
12387
- const version = "3.5.21";
12383
+ const version = "3.5.22";
12388
12384
  const warn = warn$1 ;
12389
12385
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12390
12386
  const devtools = devtools$1 ;
@@ -12642,11 +12638,11 @@ Component that was made reactive: `,
12642
12638
  addTransitionClass(el, legacyLeaveFromClass);
12643
12639
  }
12644
12640
  if (!el._enterCancelled) {
12645
- forceReflow();
12641
+ forceReflow(el);
12646
12642
  addTransitionClass(el, leaveActiveClass);
12647
12643
  } else {
12648
12644
  addTransitionClass(el, leaveActiveClass);
12649
- forceReflow();
12645
+ forceReflow(el);
12650
12646
  }
12651
12647
  nextFrame(() => {
12652
12648
  if (!el._isLeaving) {
@@ -12795,8 +12791,9 @@ Component that was made reactive: `,
12795
12791
  if (s === "auto") return 0;
12796
12792
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12797
12793
  }
12798
- function forceReflow() {
12799
- return document.body.offsetHeight;
12794
+ function forceReflow(el) {
12795
+ const targetDocument = el ? el.ownerDocument : document;
12796
+ return targetDocument.body.offsetHeight;
12800
12797
  }
12801
12798
 
12802
12799
  function patchClass(el, value, isSVG) {
@@ -13346,7 +13343,11 @@ Expected function or array of functions, received type ${typeof value}.`
13346
13343
  );
13347
13344
  }
13348
13345
  if (_def.shadowRoot !== false) {
13349
- this.attachShadow({ mode: "open" });
13346
+ this.attachShadow(
13347
+ extend({}, _def.shadowRootOptions, {
13348
+ mode: "open"
13349
+ })
13350
+ );
13350
13351
  this._root = this.shadowRoot;
13351
13352
  } else {
13352
13353
  this._root = this;
@@ -13406,9 +13407,18 @@ Expected function or array of functions, received type ${typeof value}.`
13406
13407
  this._app && this._app.unmount();
13407
13408
  if (this._instance) this._instance.ce = void 0;
13408
13409
  this._app = this._instance = null;
13410
+ if (this._teleportTargets) {
13411
+ this._teleportTargets.clear();
13412
+ this._teleportTargets = void 0;
13413
+ }
13409
13414
  }
13410
13415
  });
13411
13416
  }
13417
+ _processMutations(mutations) {
13418
+ for (const m of mutations) {
13419
+ this._setAttr(m.attributeName);
13420
+ }
13421
+ }
13412
13422
  /**
13413
13423
  * resolve inner component definition (handle possible async component)
13414
13424
  */
@@ -13419,11 +13429,7 @@ Expected function or array of functions, received type ${typeof value}.`
13419
13429
  for (let i = 0; i < this.attributes.length; i++) {
13420
13430
  this._setAttr(this.attributes[i].name);
13421
13431
  }
13422
- this._ob = new MutationObserver((mutations) => {
13423
- for (const m of mutations) {
13424
- this._setAttr(m.attributeName);
13425
- }
13426
- });
13432
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13427
13433
  this._ob.observe(this, { attributes: true });
13428
13434
  const resolve = (def, isAsync = false) => {
13429
13435
  this._resolved = true;
@@ -13539,7 +13545,10 @@ Expected function or array of functions, received type ${typeof value}.`
13539
13545
  }
13540
13546
  if (shouldReflect) {
13541
13547
  const ob = this._ob;
13542
- ob && ob.disconnect();
13548
+ if (ob) {
13549
+ this._processMutations(ob.takeRecords());
13550
+ ob.disconnect();
13551
+ }
13543
13552
  if (val === true) {
13544
13553
  this.setAttribute(hyphenate(key), "");
13545
13554
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13643,7 +13652,7 @@ Expected function or array of functions, received type ${typeof value}.`
13643
13652
  * Only called when shadowRoot is false
13644
13653
  */
13645
13654
  _renderSlots() {
13646
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13655
+ const outlets = this._getSlots();
13647
13656
  const scopeId = this._instance.type.__scopeId;
13648
13657
  for (let i = 0; i < outlets.length; i++) {
13649
13658
  const o = outlets[i];
@@ -13669,6 +13678,19 @@ Expected function or array of functions, received type ${typeof value}.`
13669
13678
  parent.removeChild(o);
13670
13679
  }
13671
13680
  }
13681
+ /**
13682
+ * @internal
13683
+ */
13684
+ _getSlots() {
13685
+ const roots = [this];
13686
+ if (this._teleportTargets) {
13687
+ roots.push(...this._teleportTargets);
13688
+ }
13689
+ return roots.reduce((res, i) => {
13690
+ res.push(...Array.from(i.querySelectorAll("slot")));
13691
+ return res;
13692
+ }, []);
13693
+ }
13672
13694
  /**
13673
13695
  * @internal
13674
13696
  */
@@ -13761,7 +13783,7 @@ Expected function or array of functions, received type ${typeof value}.`
13761
13783
  prevChildren.forEach(callPendingCbs);
13762
13784
  prevChildren.forEach(recordPosition);
13763
13785
  const movedChildren = prevChildren.filter(applyTranslation);
13764
- forceReflow();
13786
+ forceReflow(instance.vnode.el);
13765
13787
  movedChildren.forEach((c) => {
13766
13788
  const el = c.el;
13767
13789
  const style = el.style;
@@ -18197,80 +18219,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18197
18219
  }
18198
18220
  }
18199
18221
 
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
18222
  const transformFor = createStructuralDirectiveTransform(
18275
18223
  "for",
18276
18224
  (node, dir, context) => {
@@ -18282,10 +18230,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18282
18230
  const isTemplate = isTemplateNode(node);
18283
18231
  const memo = findDir(node, "memo");
18284
18232
  const keyProp = findProp(node, `key`, false, true);
18285
- const isDirKey = keyProp && keyProp.type === 7;
18286
- if (isDirKey && !keyProp.exp) {
18287
- transformBindShorthand(keyProp);
18288
- }
18233
+ keyProp && keyProp.type === 7;
18289
18234
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18290
18235
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18291
18236
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
@@ -19438,6 +19383,58 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19438
19383
  return ret;
19439
19384
  };
19440
19385
 
19386
+ const transformBind = (dir, _node, context) => {
19387
+ const { modifiers, loc } = dir;
19388
+ const arg = dir.arg;
19389
+ let { exp } = dir;
19390
+ if (exp && exp.type === 4 && !exp.content.trim()) {
19391
+ {
19392
+ exp = void 0;
19393
+ }
19394
+ }
19395
+ if (arg.type !== 4) {
19396
+ arg.children.unshift(`(`);
19397
+ arg.children.push(`) || ""`);
19398
+ } else if (!arg.isStatic) {
19399
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
19400
+ }
19401
+ if (modifiers.some((mod) => mod.content === "camel")) {
19402
+ if (arg.type === 4) {
19403
+ if (arg.isStatic) {
19404
+ arg.content = camelize(arg.content);
19405
+ } else {
19406
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
19407
+ }
19408
+ } else {
19409
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
19410
+ arg.children.push(`)`);
19411
+ }
19412
+ }
19413
+ if (!context.inSSR) {
19414
+ if (modifiers.some((mod) => mod.content === "prop")) {
19415
+ injectPrefix(arg, ".");
19416
+ }
19417
+ if (modifiers.some((mod) => mod.content === "attr")) {
19418
+ injectPrefix(arg, "^");
19419
+ }
19420
+ }
19421
+ return {
19422
+ props: [createObjectProperty(arg, exp)]
19423
+ };
19424
+ };
19425
+ const injectPrefix = (arg, prefix) => {
19426
+ if (arg.type === 4) {
19427
+ if (arg.isStatic) {
19428
+ arg.content = prefix + arg.content;
19429
+ } else {
19430
+ arg.content = `\`${prefix}\${${arg.content}}\``;
19431
+ }
19432
+ } else {
19433
+ arg.children.unshift(`'${prefix}' + (`);
19434
+ arg.children.push(`)`);
19435
+ }
19436
+ };
19437
+
19441
19438
  const transformText = (node, context) => {
19442
19439
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
19443
19440
  return () => {
@@ -19768,9 +19765,35 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19768
19765
  }
19769
19766
  };
19770
19767
 
19768
+ const transformVBindShorthand = (node, context) => {
19769
+ if (node.type === 1) {
19770
+ for (const prop of node.props) {
19771
+ if (prop.type === 7 && prop.name === "bind" && !prop.exp) {
19772
+ const arg = prop.arg;
19773
+ if (arg.type !== 4 || !arg.isStatic) {
19774
+ context.onError(
19775
+ createCompilerError(
19776
+ 52,
19777
+ arg.loc
19778
+ )
19779
+ );
19780
+ prop.exp = createSimpleExpression("", true, arg.loc);
19781
+ } else {
19782
+ const propName = camelize(arg.content);
19783
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
19784
+ propName[0] === "-") {
19785
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
19786
+ }
19787
+ }
19788
+ }
19789
+ }
19790
+ }
19791
+ };
19792
+
19771
19793
  function getBaseTransformPreset(prefixIdentifiers) {
19772
19794
  return [
19773
19795
  [
19796
+ transformVBindShorthand,
19774
19797
  transformOnce,
19775
19798
  transformIf,
19776
19799
  transformMemo,