vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.21
2
+ * vue v3.5.22
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.22
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.22
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);
@@ -5255,12 +5253,13 @@ function createSlots(slots, dynamicSlots) {
5255
5253
 
5256
5254
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5257
5255
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5256
+ const hasProps = Object.keys(props).length > 0;
5258
5257
  if (name !== "default") props.name = name;
5259
5258
  return openBlock(), createBlock(
5260
5259
  Fragment,
5261
5260
  null,
5262
5261
  [createVNode("slot", props, fallback && fallback())],
5263
- 64
5262
+ hasProps ? -2 : 64
5264
5263
  );
5265
5264
  }
5266
5265
  let slot = slots[name];
@@ -10435,31 +10434,28 @@ const computed = (getterOrOptions, debugOptions) => {
10435
10434
  };
10436
10435
 
10437
10436
  function h(type, propsOrChildren, children) {
10438
- const doCreateVNode = (type2, props, children2) => {
10437
+ try {
10439
10438
  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]);
10439
+ const l = arguments.length;
10440
+ if (l === 2) {
10441
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10442
+ if (isVNode(propsOrChildren)) {
10443
+ return createVNode(type, null, [propsOrChildren]);
10444
+ }
10445
+ return createVNode(type, propsOrChildren);
10446
+ } else {
10447
+ return createVNode(type, null, propsOrChildren);
10451
10448
  }
10452
- return doCreateVNode(type, propsOrChildren);
10453
10449
  } 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];
10450
+ if (l > 3) {
10451
+ children = Array.prototype.slice.call(arguments, 2);
10452
+ } else if (l === 3 && isVNode(children)) {
10453
+ children = [children];
10454
+ }
10455
+ return createVNode(type, propsOrChildren, children);
10461
10456
  }
10462
- return doCreateVNode(type, propsOrChildren, children);
10457
+ } finally {
10458
+ setBlockTracking(1);
10463
10459
  }
10464
10460
  }
10465
10461
 
@@ -10669,7 +10665,7 @@ function isMemoSame(cached, memo) {
10669
10665
  return true;
10670
10666
  }
10671
10667
 
10672
- const version = "3.5.21";
10668
+ const version = "3.5.22";
10673
10669
  const warn = warn$1 ;
10674
10670
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10675
10671
  const devtools = devtools$1 ;
@@ -10898,11 +10894,11 @@ function resolveTransitionProps(rawProps) {
10898
10894
  const resolve = () => finishLeave(el, done);
10899
10895
  addTransitionClass(el, leaveFromClass);
10900
10896
  if (!el._enterCancelled) {
10901
- forceReflow();
10897
+ forceReflow(el);
10902
10898
  addTransitionClass(el, leaveActiveClass);
10903
10899
  } else {
10904
10900
  addTransitionClass(el, leaveActiveClass);
10905
- forceReflow();
10901
+ forceReflow(el);
10906
10902
  }
10907
10903
  nextFrame(() => {
10908
10904
  if (!el._isLeaving) {
@@ -11048,8 +11044,9 @@ function toMs(s) {
11048
11044
  if (s === "auto") return 0;
11049
11045
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
11050
11046
  }
11051
- function forceReflow() {
11052
- return document.body.offsetHeight;
11047
+ function forceReflow(el) {
11048
+ const targetDocument = el ? el.ownerDocument : document;
11049
+ return targetDocument.body.offsetHeight;
11053
11050
  }
11054
11051
 
11055
11052
  function patchClass(el, value, isSVG) {
@@ -11562,7 +11559,11 @@ class VueElement extends BaseClass {
11562
11559
  );
11563
11560
  }
11564
11561
  if (_def.shadowRoot !== false) {
11565
- this.attachShadow({ mode: "open" });
11562
+ this.attachShadow(
11563
+ extend({}, _def.shadowRootOptions, {
11564
+ mode: "open"
11565
+ })
11566
+ );
11566
11567
  this._root = this.shadowRoot;
11567
11568
  } else {
11568
11569
  this._root = this;
@@ -11622,9 +11623,18 @@ class VueElement extends BaseClass {
11622
11623
  this._app && this._app.unmount();
11623
11624
  if (this._instance) this._instance.ce = void 0;
11624
11625
  this._app = this._instance = null;
11626
+ if (this._teleportTargets) {
11627
+ this._teleportTargets.clear();
11628
+ this._teleportTargets = void 0;
11629
+ }
11625
11630
  }
11626
11631
  });
11627
11632
  }
11633
+ _processMutations(mutations) {
11634
+ for (const m of mutations) {
11635
+ this._setAttr(m.attributeName);
11636
+ }
11637
+ }
11628
11638
  /**
11629
11639
  * resolve inner component definition (handle possible async component)
11630
11640
  */
@@ -11635,11 +11645,7 @@ class VueElement extends BaseClass {
11635
11645
  for (let i = 0; i < this.attributes.length; i++) {
11636
11646
  this._setAttr(this.attributes[i].name);
11637
11647
  }
11638
- this._ob = new MutationObserver((mutations) => {
11639
- for (const m of mutations) {
11640
- this._setAttr(m.attributeName);
11641
- }
11642
- });
11648
+ this._ob = new MutationObserver(this._processMutations.bind(this));
11643
11649
  this._ob.observe(this, { attributes: true });
11644
11650
  const resolve = (def, isAsync = false) => {
11645
11651
  this._resolved = true;
@@ -11755,7 +11761,10 @@ class VueElement extends BaseClass {
11755
11761
  }
11756
11762
  if (shouldReflect) {
11757
11763
  const ob = this._ob;
11758
- ob && ob.disconnect();
11764
+ if (ob) {
11765
+ this._processMutations(ob.takeRecords());
11766
+ ob.disconnect();
11767
+ }
11759
11768
  if (val === true) {
11760
11769
  this.setAttribute(hyphenate(key), "");
11761
11770
  } else if (typeof val === "string" || typeof val === "number") {
@@ -11859,7 +11868,7 @@ class VueElement extends BaseClass {
11859
11868
  * Only called when shadowRoot is false
11860
11869
  */
11861
11870
  _renderSlots() {
11862
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11871
+ const outlets = this._getSlots();
11863
11872
  const scopeId = this._instance.type.__scopeId;
11864
11873
  for (let i = 0; i < outlets.length; i++) {
11865
11874
  const o = outlets[i];
@@ -11885,6 +11894,19 @@ class VueElement extends BaseClass {
11885
11894
  parent.removeChild(o);
11886
11895
  }
11887
11896
  }
11897
+ /**
11898
+ * @internal
11899
+ */
11900
+ _getSlots() {
11901
+ const roots = [this];
11902
+ if (this._teleportTargets) {
11903
+ roots.push(...this._teleportTargets);
11904
+ }
11905
+ return roots.reduce((res, i) => {
11906
+ res.push(...Array.from(i.querySelectorAll("slot")));
11907
+ return res;
11908
+ }, []);
11909
+ }
11888
11910
  /**
11889
11911
  * @internal
11890
11912
  */
@@ -11986,7 +12008,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11986
12008
  prevChildren.forEach(callPendingCbs);
11987
12009
  prevChildren.forEach(recordPosition);
11988
12010
  const movedChildren = prevChildren.filter(applyTranslation);
11989
- forceReflow();
12011
+ forceReflow(instance.vnode.el);
11990
12012
  movedChildren.forEach((c) => {
11991
12013
  const el = c.el;
11992
12014
  const style = el.style;
@@ -16225,80 +16247,6 @@ function getParentCondition(node) {
16225
16247
  }
16226
16248
  }
16227
16249
 
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
16250
  const transformFor = createStructuralDirectiveTransform(
16303
16251
  "for",
16304
16252
  (node, dir, context) => {
@@ -16310,10 +16258,7 @@ const transformFor = createStructuralDirectiveTransform(
16310
16258
  const isTemplate = isTemplateNode(node);
16311
16259
  const memo = findDir(node, "memo");
16312
16260
  const keyProp = findProp(node, `key`, false, true);
16313
- const isDirKey = keyProp && keyProp.type === 7;
16314
- if (isDirKey && !keyProp.exp) {
16315
- transformBindShorthand(keyProp);
16316
- }
16261
+ keyProp && keyProp.type === 7;
16317
16262
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16318
16263
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
16319
16264
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
@@ -17423,6 +17368,58 @@ const transformOn$1 = (dir, node, context, augmentor) => {
17423
17368
  return ret;
17424
17369
  };
17425
17370
 
17371
+ const transformBind = (dir, _node, context) => {
17372
+ const { modifiers, loc } = dir;
17373
+ const arg = dir.arg;
17374
+ let { exp } = dir;
17375
+ if (exp && exp.type === 4 && !exp.content.trim()) {
17376
+ {
17377
+ exp = void 0;
17378
+ }
17379
+ }
17380
+ if (arg.type !== 4) {
17381
+ arg.children.unshift(`(`);
17382
+ arg.children.push(`) || ""`);
17383
+ } else if (!arg.isStatic) {
17384
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
17385
+ }
17386
+ if (modifiers.some((mod) => mod.content === "camel")) {
17387
+ if (arg.type === 4) {
17388
+ if (arg.isStatic) {
17389
+ arg.content = camelize(arg.content);
17390
+ } else {
17391
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
17392
+ }
17393
+ } else {
17394
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
17395
+ arg.children.push(`)`);
17396
+ }
17397
+ }
17398
+ if (!context.inSSR) {
17399
+ if (modifiers.some((mod) => mod.content === "prop")) {
17400
+ injectPrefix(arg, ".");
17401
+ }
17402
+ if (modifiers.some((mod) => mod.content === "attr")) {
17403
+ injectPrefix(arg, "^");
17404
+ }
17405
+ }
17406
+ return {
17407
+ props: [createObjectProperty(arg, exp)]
17408
+ };
17409
+ };
17410
+ const injectPrefix = (arg, prefix) => {
17411
+ if (arg.type === 4) {
17412
+ if (arg.isStatic) {
17413
+ arg.content = prefix + arg.content;
17414
+ } else {
17415
+ arg.content = `\`${prefix}\${${arg.content}}\``;
17416
+ }
17417
+ } else {
17418
+ arg.children.unshift(`'${prefix}' + (`);
17419
+ arg.children.push(`)`);
17420
+ }
17421
+ };
17422
+
17426
17423
  const transformText = (node, context) => {
17427
17424
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
17428
17425
  return () => {
@@ -17604,9 +17601,35 @@ const transformMemo = (node, context) => {
17604
17601
  }
17605
17602
  };
17606
17603
 
17604
+ const transformVBindShorthand = (node, context) => {
17605
+ if (node.type === 1) {
17606
+ for (const prop of node.props) {
17607
+ if (prop.type === 7 && prop.name === "bind" && !prop.exp) {
17608
+ const arg = prop.arg;
17609
+ if (arg.type !== 4 || !arg.isStatic) {
17610
+ context.onError(
17611
+ createCompilerError(
17612
+ 52,
17613
+ arg.loc
17614
+ )
17615
+ );
17616
+ prop.exp = createSimpleExpression("", true, arg.loc);
17617
+ } else {
17618
+ const propName = camelize(arg.content);
17619
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
17620
+ propName[0] === "-") {
17621
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
17622
+ }
17623
+ }
17624
+ }
17625
+ }
17626
+ }
17627
+ };
17628
+
17607
17629
  function getBaseTransformPreset(prefixIdentifiers) {
17608
17630
  return [
17609
17631
  [
17632
+ transformVBindShorthand,
17610
17633
  transformOnce,
17611
17634
  transformIf,
17612
17635
  transformMemo,