vue 3.5.28 → 3.5.30

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  - **`vue(.runtime).global(.prod).js`**:
8
8
  - For direct use via `<script src="...">` in the browser. Exposes the `Vue` global.
9
- - Note that global builds are not [UMD](https://github.com/umdjs/umd) builds. They are built as [IIFEs](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) and is only meant for direct use via `<script src="...">`.
9
+ - Note that global builds are not [UMD](https://github.com/umdjs/umd) builds. They are built as [IIFEs](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) and are only meant for direct use via `<script src="...">`.
10
10
  - In-browser template compilation:
11
11
  - **`vue.global.js`** is the "full" build that includes both the compiler and the runtime so it supports compiling templates on the fly.
12
12
  - **`vue.runtime.global.js`** contains only the runtime and requires templates to be pre-compiled during a build step.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.28
2
+ * vue v3.5.30
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.28
2
+ * vue v3.5.30
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.28
2
+ * vue v3.5.30
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1278,10 +1278,17 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1278
1278
  }
1279
1279
  function reduce(self, method, fn, args) {
1280
1280
  const arr = shallowReadArray(self);
1281
+ const needsWrap = arr !== self && !isShallow(self);
1281
1282
  let wrappedFn = fn;
1283
+ let wrapInitialAccumulator = false;
1282
1284
  if (arr !== self) {
1283
- if (!isShallow(self)) {
1285
+ if (needsWrap) {
1286
+ wrapInitialAccumulator = args.length === 0;
1284
1287
  wrappedFn = function(acc, item, index) {
1288
+ if (wrapInitialAccumulator) {
1289
+ wrapInitialAccumulator = false;
1290
+ acc = toWrapped(self, acc);
1291
+ }
1285
1292
  return fn.call(this, acc, toWrapped(self, item), index, self);
1286
1293
  };
1287
1294
  } else if (fn.length > 3) {
@@ -1290,7 +1297,8 @@ function reduce(self, method, fn, args) {
1290
1297
  };
1291
1298
  }
1292
1299
  }
1293
- return arr[method](wrappedFn, ...args);
1300
+ const result = arr[method](wrappedFn, ...args);
1301
+ return wrapInitialAccumulator ? toWrapped(self, result) : result;
1294
1302
  }
1295
1303
  function searchProxy(self, method, args) {
1296
1304
  const arr = toRaw(self);
@@ -1580,15 +1588,14 @@ function createInstrumentations(readonly, shallow) {
1580
1588
  clear: createReadonlyMethod("clear")
1581
1589
  } : {
1582
1590
  add(value) {
1583
- if (!shallow && !isShallow(value) && !isReadonly(value)) {
1584
- value = toRaw(value);
1585
- }
1586
1591
  const target = toRaw(this);
1587
1592
  const proto = getProto(target);
1588
- const hadKey = proto.has.call(target, value);
1593
+ const rawValue = toRaw(value);
1594
+ const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
1595
+ const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
1589
1596
  if (!hadKey) {
1590
- target.add(value);
1591
- trigger(target, "add", value, value);
1597
+ target.add(valueToAdd);
1598
+ trigger(target, "add", valueToAdd, valueToAdd);
1592
1599
  }
1593
1600
  return this;
1594
1601
  },
@@ -3834,6 +3841,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3834
3841
  callHook(hook, [el]);
3835
3842
  },
3836
3843
  enter(el) {
3844
+ if (leavingVNodesCache[key] === vnode) return;
3837
3845
  let hook = onEnter;
3838
3846
  let afterHook = onAfterEnter;
3839
3847
  let cancelHook = onEnterCancelled;
@@ -5470,12 +5478,16 @@ function renderList(source, renderItem, cache, index) {
5470
5478
  );
5471
5479
  }
5472
5480
  } else if (typeof source === "number") {
5473
- if (!Number.isInteger(source)) {
5474
- warn$1(`The v-for range expect an integer value but got ${source}.`);
5475
- }
5476
- ret = new Array(source);
5477
- for (let i = 0; i < source; i++) {
5478
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
5481
+ if (!Number.isInteger(source) || source < 0) {
5482
+ warn$1(
5483
+ `The v-for range expects a positive integer value but got ${source}.`
5484
+ );
5485
+ ret = [];
5486
+ } else {
5487
+ ret = new Array(source);
5488
+ for (let i = 0; i < source; i++) {
5489
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
5490
+ }
5479
5491
  }
5480
5492
  } else if (isObject(source)) {
5481
5493
  if (source[Symbol.iterator]) {
@@ -5926,6 +5938,7 @@ function createPropsRestProxy(props, excludedKeys) {
5926
5938
  }
5927
5939
  function withAsyncContext(getAwaitable) {
5928
5940
  const ctx = getCurrentInstance();
5941
+ const inSSRSetup = isInSSRComponentSetup;
5929
5942
  if (!ctx) {
5930
5943
  warn$1(
5931
5944
  `withAsyncContext called without active current instance. This is likely a bug.`
@@ -5933,13 +5946,36 @@ function withAsyncContext(getAwaitable) {
5933
5946
  }
5934
5947
  let awaitable = getAwaitable();
5935
5948
  unsetCurrentInstance();
5949
+ if (inSSRSetup) {
5950
+ setInSSRSetupState(false);
5951
+ }
5952
+ const restore = () => {
5953
+ setCurrentInstance(ctx);
5954
+ if (inSSRSetup) {
5955
+ setInSSRSetupState(true);
5956
+ }
5957
+ };
5958
+ const cleanup = () => {
5959
+ if (getCurrentInstance() !== ctx) ctx.scope.off();
5960
+ unsetCurrentInstance();
5961
+ if (inSSRSetup) {
5962
+ setInSSRSetupState(false);
5963
+ }
5964
+ };
5936
5965
  if (isPromise(awaitable)) {
5937
5966
  awaitable = awaitable.catch((e) => {
5938
- setCurrentInstance(ctx);
5967
+ restore();
5968
+ Promise.resolve().then(() => Promise.resolve().then(cleanup));
5939
5969
  throw e;
5940
5970
  });
5941
5971
  }
5942
- return [awaitable, () => setCurrentInstance(ctx)];
5972
+ return [
5973
+ awaitable,
5974
+ () => {
5975
+ restore();
5976
+ Promise.resolve().then(cleanup);
5977
+ }
5978
+ ];
5943
5979
  }
5944
5980
 
5945
5981
  function createDuplicateChecker() {
@@ -8311,7 +8347,10 @@ function baseCreateRenderer(options, createHydrationFns) {
8311
8347
  }
8312
8348
  } else {
8313
8349
  if (root.ce && root.ce._hasShadowRoot()) {
8314
- root.ce._injectChildStyle(type);
8350
+ root.ce._injectChildStyle(
8351
+ type,
8352
+ instance.parent ? instance.parent.type : void 0
8353
+ );
8315
8354
  }
8316
8355
  {
8317
8356
  startMeasure(instance, `render`);
@@ -10793,7 +10832,7 @@ function isMemoSame(cached, memo) {
10793
10832
  return true;
10794
10833
  }
10795
10834
 
10796
- const version = "3.5.28";
10835
+ const version = "3.5.30";
10797
10836
  const warn = warn$1 ;
10798
10837
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10799
10838
  const devtools = devtools$1 ;
@@ -11590,7 +11629,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
11590
11629
  }
11591
11630
  } else if (
11592
11631
  // #11081 force set props for possible async custom element
11593
- el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
11632
+ el._isVueCE && // #12408 check if it's declared prop or it's async custom element
11633
+ (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
11634
+ el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))
11594
11635
  ) {
11595
11636
  patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
11596
11637
  } else {
@@ -11638,6 +11679,17 @@ function shouldSetAsProp(el, key, value, isSVG) {
11638
11679
  }
11639
11680
  return key in el;
11640
11681
  }
11682
+ function shouldSetAsPropForVueCE(el, key) {
11683
+ const props = (
11684
+ // @ts-expect-error _def is private
11685
+ el._def.props
11686
+ );
11687
+ if (!props) {
11688
+ return false;
11689
+ }
11690
+ const camelKey = camelize(key);
11691
+ return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
11692
+ }
11641
11693
 
11642
11694
  const REMOVAL = {};
11643
11695
  // @__NO_SIDE_EFFECTS__
@@ -11682,6 +11734,7 @@ class VueElement extends BaseClass {
11682
11734
  this._dirty = false;
11683
11735
  this._numberProps = null;
11684
11736
  this._styleChildren = /* @__PURE__ */ new WeakSet();
11737
+ this._styleAnchors = /* @__PURE__ */ new WeakMap();
11685
11738
  this._ob = null;
11686
11739
  if (this.shadowRoot && _createApp !== createApp) {
11687
11740
  this._root = this.shadowRoot;
@@ -11710,7 +11763,8 @@ class VueElement extends BaseClass {
11710
11763
  }
11711
11764
  this._connected = true;
11712
11765
  let parent = this;
11713
- while (parent = parent && (parent.parentNode || parent.host)) {
11766
+ while (parent = parent && // #12479 should check assignedSlot first to get correct parent
11767
+ (parent.assignedSlot || parent.parentNode || parent.host)) {
11714
11768
  if (parent instanceof VueElement) {
11715
11769
  this._parent = parent;
11716
11770
  break;
@@ -11932,6 +11986,7 @@ class VueElement extends BaseClass {
11932
11986
  this._styles.forEach((s) => this._root.removeChild(s));
11933
11987
  this._styles.length = 0;
11934
11988
  }
11989
+ this._styleAnchors.delete(this._def);
11935
11990
  this._applyStyles(newStyles);
11936
11991
  this._instance = null;
11937
11992
  this._update();
@@ -11956,7 +12011,7 @@ class VueElement extends BaseClass {
11956
12011
  }
11957
12012
  return vnode;
11958
12013
  }
11959
- _applyStyles(styles, owner) {
12014
+ _applyStyles(styles, owner, parentComp) {
11960
12015
  if (!styles) return;
11961
12016
  if (owner) {
11962
12017
  if (owner === this._def || this._styleChildren.has(owner)) {
@@ -11965,11 +12020,19 @@ class VueElement extends BaseClass {
11965
12020
  this._styleChildren.add(owner);
11966
12021
  }
11967
12022
  const nonce = this._nonce;
12023
+ const root = this.shadowRoot;
12024
+ const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
12025
+ let last = null;
11968
12026
  for (let i = styles.length - 1; i >= 0; i--) {
11969
12027
  const s = document.createElement("style");
11970
12028
  if (nonce) s.setAttribute("nonce", nonce);
11971
12029
  s.textContent = styles[i];
11972
- this.shadowRoot.prepend(s);
12030
+ root.insertBefore(s, last || insertionAnchor);
12031
+ last = s;
12032
+ if (i === 0) {
12033
+ if (!parentComp) this._styleAnchors.set(this._def, s);
12034
+ if (owner) this._styleAnchors.set(owner, s);
12035
+ }
11973
12036
  {
11974
12037
  if (owner) {
11975
12038
  if (owner.__hmrId) {
@@ -11986,6 +12049,28 @@ class VueElement extends BaseClass {
11986
12049
  }
11987
12050
  }
11988
12051
  }
12052
+ _getStyleAnchor(comp) {
12053
+ if (!comp) {
12054
+ return null;
12055
+ }
12056
+ const anchor = this._styleAnchors.get(comp);
12057
+ if (anchor && anchor.parentNode === this.shadowRoot) {
12058
+ return anchor;
12059
+ }
12060
+ if (anchor) {
12061
+ this._styleAnchors.delete(comp);
12062
+ }
12063
+ return null;
12064
+ }
12065
+ _getRootStyleInsertionAnchor(root) {
12066
+ for (let i = 0; i < root.childNodes.length; i++) {
12067
+ const node = root.childNodes[i];
12068
+ if (!(node instanceof HTMLStyleElement)) {
12069
+ return node;
12070
+ }
12071
+ }
12072
+ return null;
12073
+ }
11989
12074
  /**
11990
12075
  * Only called when shadowRoot is false
11991
12076
  */
@@ -12048,8 +12133,8 @@ class VueElement extends BaseClass {
12048
12133
  /**
12049
12134
  * @internal
12050
12135
  */
12051
- _injectChildStyle(comp) {
12052
- this._applyStyles(comp.styles, comp);
12136
+ _injectChildStyle(comp, parentComp) {
12137
+ this._applyStyles(comp.styles, comp, parentComp);
12053
12138
  }
12054
12139
  /**
12055
12140
  * @internal
@@ -12079,6 +12164,7 @@ class VueElement extends BaseClass {
12079
12164
  _removeChildStyle(comp) {
12080
12165
  {
12081
12166
  this._styleChildren.delete(comp);
12167
+ this._styleAnchors.delete(comp);
12082
12168
  if (this._childStyles && comp.__hmrId) {
12083
12169
  const oldStyles = this._childStyles.get(comp.__hmrId);
12084
12170
  if (oldStyles) {