@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
  **/
@@ -1219,7 +1219,7 @@ function iterator(self, method, wrapValue) {
1219
1219
  iter._next = iter.next;
1220
1220
  iter.next = () => {
1221
1221
  const result = iter._next();
1222
- if (result.value) {
1222
+ if (!result.done) {
1223
1223
  result.value = wrapValue(result.value);
1224
1224
  }
1225
1225
  return result;
@@ -1346,7 +1346,8 @@ class BaseReactiveHandler {
1346
1346
  return res;
1347
1347
  }
1348
1348
  if (isRef(res)) {
1349
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1349
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1350
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1350
1351
  }
1351
1352
  if (isObject(res)) {
1352
1353
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2707,14 +2708,11 @@ function checkRecursiveUpdates(seen, fn) {
2707
2708
  let isHmrUpdating = false;
2708
2709
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2709
2710
  if (!!(process.env.NODE_ENV !== "production")) {
2710
- const g = getGlobalThis();
2711
- if (!g.__VUE_HMR_RUNTIME__) {
2712
- g.__VUE_HMR_RUNTIME__ = {
2713
- createRecord: tryWrap(createRecord),
2714
- rerender: tryWrap(rerender),
2715
- reload: tryWrap(reload)
2716
- };
2717
- }
2711
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
2712
+ createRecord: tryWrap(createRecord),
2713
+ rerender: tryWrap(rerender),
2714
+ reload: tryWrap(reload)
2715
+ };
2718
2716
  }
2719
2717
  const map = /* @__PURE__ */ new Map();
2720
2718
  function registerHMR(instance) {
@@ -3612,9 +3610,6 @@ const TeleportImpl = {
3612
3610
  insert(mainAnchor, container, anchor);
3613
3611
  const mount = (container2, anchor2) => {
3614
3612
  if (shapeFlag & 16) {
3615
- if (parentComponent && parentComponent.isCE) {
3616
- parentComponent.ce._teleportTarget = container2;
3617
- }
3618
3613
  mountChildren(
3619
3614
  children,
3620
3615
  container2,
@@ -3636,6 +3631,9 @@ const TeleportImpl = {
3636
3631
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3637
3632
  namespace = "mathml";
3638
3633
  }
3634
+ if (parentComponent && parentComponent.isCE) {
3635
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3636
+ }
3639
3637
  if (!disabled) {
3640
3638
  mount(target, targetAnchor);
3641
3639
  updateCssVars(n2, false);
@@ -6107,12 +6105,13 @@ function createSlots(slots, dynamicSlots) {
6107
6105
 
6108
6106
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6109
6107
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6108
+ const hasProps = Object.keys(props).length > 0;
6110
6109
  if (name !== "default") props.name = name;
6111
6110
  return openBlock(), createBlock(
6112
6111
  Fragment,
6113
6112
  null,
6114
6113
  [createVNode("slot", props, fallback && fallback())],
6115
- 64
6114
+ hasProps ? -2 : 64
6116
6115
  );
6117
6116
  }
6118
6117
  let slot = slots[name];
@@ -7305,7 +7304,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7305
7304
  return vm;
7306
7305
  }
7307
7306
  }
7308
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
7307
+ Vue.version = `2.6.14-compat:${"3.5.22"}`;
7309
7308
  Vue.config = singletonApp.config;
7310
7309
  Vue.use = (plugin, ...options) => {
7311
7310
  if (plugin && isFunction(plugin.install)) {
@@ -12284,31 +12283,28 @@ const computed = (getterOrOptions, debugOptions) => {
12284
12283
  };
12285
12284
 
12286
12285
  function h(type, propsOrChildren, children) {
12287
- const doCreateVNode = (type2, props, children2) => {
12286
+ try {
12288
12287
  setBlockTracking(-1);
12289
- try {
12290
- return createVNode(type2, props, children2);
12291
- } finally {
12292
- setBlockTracking(1);
12293
- }
12294
- };
12295
- const l = arguments.length;
12296
- if (l === 2) {
12297
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12298
- if (isVNode(propsOrChildren)) {
12299
- return doCreateVNode(type, null, [propsOrChildren]);
12288
+ const l = arguments.length;
12289
+ if (l === 2) {
12290
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12291
+ if (isVNode(propsOrChildren)) {
12292
+ return createVNode(type, null, [propsOrChildren]);
12293
+ }
12294
+ return createVNode(type, propsOrChildren);
12295
+ } else {
12296
+ return createVNode(type, null, propsOrChildren);
12300
12297
  }
12301
- return doCreateVNode(type, propsOrChildren);
12302
12298
  } else {
12303
- return doCreateVNode(type, null, propsOrChildren);
12304
- }
12305
- } else {
12306
- if (l > 3) {
12307
- children = Array.prototype.slice.call(arguments, 2);
12308
- } else if (l === 3 && isVNode(children)) {
12309
- children = [children];
12299
+ if (l > 3) {
12300
+ children = Array.prototype.slice.call(arguments, 2);
12301
+ } else if (l === 3 && isVNode(children)) {
12302
+ children = [children];
12303
+ }
12304
+ return createVNode(type, propsOrChildren, children);
12310
12305
  }
12311
- return doCreateVNode(type, propsOrChildren, children);
12306
+ } finally {
12307
+ setBlockTracking(1);
12312
12308
  }
12313
12309
  }
12314
12310
 
@@ -12518,7 +12514,7 @@ function isMemoSame(cached, memo) {
12518
12514
  return true;
12519
12515
  }
12520
12516
 
12521
- const version = "3.5.21";
12517
+ const version = "3.5.22";
12522
12518
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12523
12519
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12524
12520
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12788,11 +12784,11 @@ function resolveTransitionProps(rawProps) {
12788
12784
  addTransitionClass(el, legacyLeaveFromClass);
12789
12785
  }
12790
12786
  if (!el._enterCancelled) {
12791
- forceReflow();
12787
+ forceReflow(el);
12792
12788
  addTransitionClass(el, leaveActiveClass);
12793
12789
  } else {
12794
12790
  addTransitionClass(el, leaveActiveClass);
12795
- forceReflow();
12791
+ forceReflow(el);
12796
12792
  }
12797
12793
  nextFrame(() => {
12798
12794
  if (!el._isLeaving) {
@@ -12941,8 +12937,9 @@ function toMs(s) {
12941
12937
  if (s === "auto") return 0;
12942
12938
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12943
12939
  }
12944
- function forceReflow() {
12945
- return document.body.offsetHeight;
12940
+ function forceReflow(el) {
12941
+ const targetDocument = el ? el.ownerDocument : document;
12942
+ return targetDocument.body.offsetHeight;
12946
12943
  }
12947
12944
 
12948
12945
  function patchClass(el, value, isSVG) {
@@ -13499,7 +13496,11 @@ class VueElement extends BaseClass {
13499
13496
  );
13500
13497
  }
13501
13498
  if (_def.shadowRoot !== false) {
13502
- this.attachShadow({ mode: "open" });
13499
+ this.attachShadow(
13500
+ extend({}, _def.shadowRootOptions, {
13501
+ mode: "open"
13502
+ })
13503
+ );
13503
13504
  this._root = this.shadowRoot;
13504
13505
  } else {
13505
13506
  this._root = this;
@@ -13559,9 +13560,18 @@ class VueElement extends BaseClass {
13559
13560
  this._app && this._app.unmount();
13560
13561
  if (this._instance) this._instance.ce = void 0;
13561
13562
  this._app = this._instance = null;
13563
+ if (this._teleportTargets) {
13564
+ this._teleportTargets.clear();
13565
+ this._teleportTargets = void 0;
13566
+ }
13562
13567
  }
13563
13568
  });
13564
13569
  }
13570
+ _processMutations(mutations) {
13571
+ for (const m of mutations) {
13572
+ this._setAttr(m.attributeName);
13573
+ }
13574
+ }
13565
13575
  /**
13566
13576
  * resolve inner component definition (handle possible async component)
13567
13577
  */
@@ -13572,11 +13582,7 @@ class VueElement extends BaseClass {
13572
13582
  for (let i = 0; i < this.attributes.length; i++) {
13573
13583
  this._setAttr(this.attributes[i].name);
13574
13584
  }
13575
- this._ob = new MutationObserver((mutations) => {
13576
- for (const m of mutations) {
13577
- this._setAttr(m.attributeName);
13578
- }
13579
- });
13585
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13580
13586
  this._ob.observe(this, { attributes: true });
13581
13587
  const resolve = (def, isAsync = false) => {
13582
13588
  this._resolved = true;
@@ -13692,7 +13698,10 @@ class VueElement extends BaseClass {
13692
13698
  }
13693
13699
  if (shouldReflect) {
13694
13700
  const ob = this._ob;
13695
- ob && ob.disconnect();
13701
+ if (ob) {
13702
+ this._processMutations(ob.takeRecords());
13703
+ ob.disconnect();
13704
+ }
13696
13705
  if (val === true) {
13697
13706
  this.setAttribute(hyphenate(key), "");
13698
13707
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13796,7 +13805,7 @@ class VueElement extends BaseClass {
13796
13805
  * Only called when shadowRoot is false
13797
13806
  */
13798
13807
  _renderSlots() {
13799
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13808
+ const outlets = this._getSlots();
13800
13809
  const scopeId = this._instance.type.__scopeId;
13801
13810
  for (let i = 0; i < outlets.length; i++) {
13802
13811
  const o = outlets[i];
@@ -13822,6 +13831,19 @@ class VueElement extends BaseClass {
13822
13831
  parent.removeChild(o);
13823
13832
  }
13824
13833
  }
13834
+ /**
13835
+ * @internal
13836
+ */
13837
+ _getSlots() {
13838
+ const roots = [this];
13839
+ if (this._teleportTargets) {
13840
+ roots.push(...this._teleportTargets);
13841
+ }
13842
+ return roots.reduce((res, i) => {
13843
+ res.push(...Array.from(i.querySelectorAll("slot")));
13844
+ return res;
13845
+ }, []);
13846
+ }
13825
13847
  /**
13826
13848
  * @internal
13827
13849
  */
@@ -13926,7 +13948,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13926
13948
  prevChildren.forEach(callPendingCbs);
13927
13949
  prevChildren.forEach(recordPosition);
13928
13950
  const movedChildren = prevChildren.filter(applyTranslation);
13929
- forceReflow();
13951
+ forceReflow(instance.vnode.el);
13930
13952
  movedChildren.forEach((c) => {
13931
13953
  const el = c.el;
13932
13954
  const style = el.style;
@@ -18400,80 +18422,6 @@ function getParentCondition(node) {
18400
18422
  }
18401
18423
  }
18402
18424
 
18403
- const transformBind = (dir, _node, context) => {
18404
- const { modifiers, loc } = dir;
18405
- const arg = dir.arg;
18406
- let { exp } = dir;
18407
- if (exp && exp.type === 4 && !exp.content.trim()) {
18408
- {
18409
- exp = void 0;
18410
- }
18411
- }
18412
- if (!exp) {
18413
- if (arg.type !== 4 || !arg.isStatic) {
18414
- context.onError(
18415
- createCompilerError(
18416
- 52,
18417
- arg.loc
18418
- )
18419
- );
18420
- return {
18421
- props: [
18422
- createObjectProperty(arg, createSimpleExpression("", true, loc))
18423
- ]
18424
- };
18425
- }
18426
- transformBindShorthand(dir);
18427
- exp = dir.exp;
18428
- }
18429
- if (arg.type !== 4) {
18430
- arg.children.unshift(`(`);
18431
- arg.children.push(`) || ""`);
18432
- } else if (!arg.isStatic) {
18433
- arg.content = arg.content ? `${arg.content} || ""` : `""`;
18434
- }
18435
- if (modifiers.some((mod) => mod.content === "camel")) {
18436
- if (arg.type === 4) {
18437
- if (arg.isStatic) {
18438
- arg.content = camelize(arg.content);
18439
- } else {
18440
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
18441
- }
18442
- } else {
18443
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
18444
- arg.children.push(`)`);
18445
- }
18446
- }
18447
- if (!context.inSSR) {
18448
- if (modifiers.some((mod) => mod.content === "prop")) {
18449
- injectPrefix(arg, ".");
18450
- }
18451
- if (modifiers.some((mod) => mod.content === "attr")) {
18452
- injectPrefix(arg, "^");
18453
- }
18454
- }
18455
- return {
18456
- props: [createObjectProperty(arg, exp)]
18457
- };
18458
- };
18459
- const transformBindShorthand = (dir, context) => {
18460
- const arg = dir.arg;
18461
- const propName = camelize(arg.content);
18462
- dir.exp = createSimpleExpression(propName, false, arg.loc);
18463
- };
18464
- const injectPrefix = (arg, prefix) => {
18465
- if (arg.type === 4) {
18466
- if (arg.isStatic) {
18467
- arg.content = prefix + arg.content;
18468
- } else {
18469
- arg.content = `\`${prefix}\${${arg.content}}\``;
18470
- }
18471
- } else {
18472
- arg.children.unshift(`'${prefix}' + (`);
18473
- arg.children.push(`)`);
18474
- }
18475
- };
18476
-
18477
18425
  const transformFor = createStructuralDirectiveTransform(
18478
18426
  "for",
18479
18427
  (node, dir, context) => {
@@ -18485,10 +18433,7 @@ const transformFor = createStructuralDirectiveTransform(
18485
18433
  const isTemplate = isTemplateNode(node);
18486
18434
  const memo = findDir(node, "memo");
18487
18435
  const keyProp = findProp(node, `key`, false, true);
18488
- const isDirKey = keyProp && keyProp.type === 7;
18489
- if (isDirKey && !keyProp.exp) {
18490
- transformBindShorthand(keyProp);
18491
- }
18436
+ keyProp && keyProp.type === 7;
18492
18437
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18493
18438
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18494
18439
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
@@ -19641,6 +19586,58 @@ const transformOn$1 = (dir, node, context, augmentor) => {
19641
19586
  return ret;
19642
19587
  };
19643
19588
 
19589
+ const transformBind = (dir, _node, context) => {
19590
+ const { modifiers, loc } = dir;
19591
+ const arg = dir.arg;
19592
+ let { exp } = dir;
19593
+ if (exp && exp.type === 4 && !exp.content.trim()) {
19594
+ {
19595
+ exp = void 0;
19596
+ }
19597
+ }
19598
+ if (arg.type !== 4) {
19599
+ arg.children.unshift(`(`);
19600
+ arg.children.push(`) || ""`);
19601
+ } else if (!arg.isStatic) {
19602
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
19603
+ }
19604
+ if (modifiers.some((mod) => mod.content === "camel")) {
19605
+ if (arg.type === 4) {
19606
+ if (arg.isStatic) {
19607
+ arg.content = camelize(arg.content);
19608
+ } else {
19609
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
19610
+ }
19611
+ } else {
19612
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
19613
+ arg.children.push(`)`);
19614
+ }
19615
+ }
19616
+ if (!context.inSSR) {
19617
+ if (modifiers.some((mod) => mod.content === "prop")) {
19618
+ injectPrefix(arg, ".");
19619
+ }
19620
+ if (modifiers.some((mod) => mod.content === "attr")) {
19621
+ injectPrefix(arg, "^");
19622
+ }
19623
+ }
19624
+ return {
19625
+ props: [createObjectProperty(arg, exp)]
19626
+ };
19627
+ };
19628
+ const injectPrefix = (arg, prefix) => {
19629
+ if (arg.type === 4) {
19630
+ if (arg.isStatic) {
19631
+ arg.content = prefix + arg.content;
19632
+ } else {
19633
+ arg.content = `\`${prefix}\${${arg.content}}\``;
19634
+ }
19635
+ } else {
19636
+ arg.children.unshift(`'${prefix}' + (`);
19637
+ arg.children.push(`)`);
19638
+ }
19639
+ };
19640
+
19644
19641
  const transformText = (node, context) => {
19645
19642
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
19646
19643
  return () => {
@@ -19971,9 +19968,35 @@ const transformMemo = (node, context) => {
19971
19968
  }
19972
19969
  };
19973
19970
 
19971
+ const transformVBindShorthand = (node, context) => {
19972
+ if (node.type === 1) {
19973
+ for (const prop of node.props) {
19974
+ if (prop.type === 7 && prop.name === "bind" && !prop.exp) {
19975
+ const arg = prop.arg;
19976
+ if (arg.type !== 4 || !arg.isStatic) {
19977
+ context.onError(
19978
+ createCompilerError(
19979
+ 52,
19980
+ arg.loc
19981
+ )
19982
+ );
19983
+ prop.exp = createSimpleExpression("", true, arg.loc);
19984
+ } else {
19985
+ const propName = camelize(arg.content);
19986
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
19987
+ propName[0] === "-") {
19988
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
19989
+ }
19990
+ }
19991
+ }
19992
+ }
19993
+ }
19994
+ };
19995
+
19974
19996
  function getBaseTransformPreset(prefixIdentifiers) {
19975
19997
  return [
19976
19998
  [
19999
+ transformVBindShorthand,
19977
20000
  transformOnce,
19978
20001
  transformIf,
19979
20002
  transformMemo,