@vue/runtime-dom 3.5.20 → 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/runtime-dom v3.5.20
2
+ * @vue/runtime-dom v3.5.22
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -217,11 +217,11 @@ function resolveTransitionProps(rawProps) {
217
217
  const resolve = () => finishLeave(el, done);
218
218
  addTransitionClass(el, leaveFromClass);
219
219
  if (!el._enterCancelled) {
220
- forceReflow();
220
+ forceReflow(el);
221
221
  addTransitionClass(el, leaveActiveClass);
222
222
  } else {
223
223
  addTransitionClass(el, leaveActiveClass);
224
- forceReflow();
224
+ forceReflow(el);
225
225
  }
226
226
  nextFrame(() => {
227
227
  if (!el._isLeaving) {
@@ -347,7 +347,7 @@ function getTransitionInfo(el, expectedType) {
347
347
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
348
348
  propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
349
349
  }
350
- const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
350
+ const hasTransform = type === TRANSITION && /\b(?:transform|all)(?:,|$)/.test(
351
351
  getStyleProperties(`${TRANSITION}Property`).toString()
352
352
  );
353
353
  return {
@@ -367,8 +367,9 @@ function toMs(s) {
367
367
  if (s === "auto") return 0;
368
368
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
369
369
  }
370
- function forceReflow() {
371
- return document.body.offsetHeight;
370
+ function forceReflow(el) {
371
+ const targetDocument = el ? el.ownerDocument : document;
372
+ return targetDocument.body.offsetHeight;
372
373
  }
373
374
 
374
375
  function patchClass(el, value, isSVG) {
@@ -440,7 +441,7 @@ function useCssVars(getter) {
440
441
  return;
441
442
  }
442
443
 
443
- const displayRE = /(^|;)\s*display\s*:/;
444
+ const displayRE = /(?:^|;)\s*display\s*:/;
444
445
  function patchStyle(el, prev, next) {
445
446
  const style = el.style;
446
447
  const isCssString = shared.isString(next);
@@ -763,11 +764,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
763
764
  }
764
765
 
765
766
  const REMOVAL = {};
766
- /*! #__NO_SIDE_EFFECTS__ */
767
767
  // @__NO_SIDE_EFFECTS__
768
768
  function defineCustomElement(options, extraOptions, _createApp) {
769
- const Comp = runtimeCore.defineComponent(options, extraOptions);
770
- if (shared.isPlainObject(Comp)) shared.extend(Comp, extraOptions);
769
+ let Comp = runtimeCore.defineComponent(options, extraOptions);
770
+ if (shared.isPlainObject(Comp)) Comp = shared.extend({}, Comp, extraOptions);
771
771
  class VueCustomElement extends VueElement {
772
772
  constructor(initialProps) {
773
773
  super(Comp, initialProps, _createApp);
@@ -776,7 +776,6 @@ function defineCustomElement(options, extraOptions, _createApp) {
776
776
  VueCustomElement.def = Comp;
777
777
  return VueCustomElement;
778
778
  }
779
-
780
779
  const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
781
780
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
782
781
  });
@@ -815,7 +814,11 @@ class VueElement extends BaseClass {
815
814
  );
816
815
  }
817
816
  if (_def.shadowRoot !== false) {
818
- this.attachShadow({ mode: "open" });
817
+ this.attachShadow(
818
+ shared.extend({}, _def.shadowRootOptions, {
819
+ mode: "open"
820
+ })
821
+ );
819
822
  this._root = this.shadowRoot;
820
823
  } else {
821
824
  this._root = this;
@@ -875,9 +878,18 @@ class VueElement extends BaseClass {
875
878
  this._app && this._app.unmount();
876
879
  if (this._instance) this._instance.ce = void 0;
877
880
  this._app = this._instance = null;
881
+ if (this._teleportTargets) {
882
+ this._teleportTargets.clear();
883
+ this._teleportTargets = void 0;
884
+ }
878
885
  }
879
886
  });
880
887
  }
888
+ _processMutations(mutations) {
889
+ for (const m of mutations) {
890
+ this._setAttr(m.attributeName);
891
+ }
892
+ }
881
893
  /**
882
894
  * resolve inner component definition (handle possible async component)
883
895
  */
@@ -888,11 +900,7 @@ class VueElement extends BaseClass {
888
900
  for (let i = 0; i < this.attributes.length; i++) {
889
901
  this._setAttr(this.attributes[i].name);
890
902
  }
891
- this._ob = new MutationObserver((mutations) => {
892
- for (const m of mutations) {
893
- this._setAttr(m.attributeName);
894
- }
895
- });
903
+ this._ob = new MutationObserver(this._processMutations.bind(this));
896
904
  this._ob.observe(this, { attributes: true });
897
905
  const resolve = (def, isAsync = false) => {
898
906
  this._resolved = true;
@@ -1008,7 +1016,10 @@ class VueElement extends BaseClass {
1008
1016
  }
1009
1017
  if (shouldReflect) {
1010
1018
  const ob = this._ob;
1011
- ob && ob.disconnect();
1019
+ if (ob) {
1020
+ this._processMutations(ob.takeRecords());
1021
+ ob.disconnect();
1022
+ }
1012
1023
  if (val === true) {
1013
1024
  this.setAttribute(shared.hyphenate(key), "");
1014
1025
  } else if (typeof val === "string" || typeof val === "number") {
@@ -1112,7 +1123,7 @@ class VueElement extends BaseClass {
1112
1123
  * Only called when shadowRoot is false
1113
1124
  */
1114
1125
  _renderSlots() {
1115
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
1126
+ const outlets = this._getSlots();
1116
1127
  const scopeId = this._instance.type.__scopeId;
1117
1128
  for (let i = 0; i < outlets.length; i++) {
1118
1129
  const o = outlets[i];
@@ -1138,6 +1149,19 @@ class VueElement extends BaseClass {
1138
1149
  parent.removeChild(o);
1139
1150
  }
1140
1151
  }
1152
+ /**
1153
+ * @internal
1154
+ */
1155
+ _getSlots() {
1156
+ const roots = [this];
1157
+ if (this._teleportTargets) {
1158
+ roots.push(...this._teleportTargets);
1159
+ }
1160
+ return roots.reduce((res, i) => {
1161
+ res.push(...Array.from(i.querySelectorAll("slot")));
1162
+ return res;
1163
+ }, []);
1164
+ }
1141
1165
  /**
1142
1166
  * @internal
1143
1167
  */
@@ -1239,7 +1263,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1239
1263
  prevChildren.forEach(callPendingCbs);
1240
1264
  prevChildren.forEach(recordPosition);
1241
1265
  const movedChildren = prevChildren.filter(applyTranslation);
1242
- forceReflow();
1266
+ forceReflow(instance.vnode.el);
1243
1267
  movedChildren.forEach((c) => {
1244
1268
  const el = c.el;
1245
1269
  const style = el.style;
@@ -1249,7 +1273,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1249
1273
  if (e && e.target !== el) {
1250
1274
  return;
1251
1275
  }
1252
- if (!e || /transform$/.test(e.propertyName)) {
1276
+ if (!e || e.propertyName.endsWith("transform")) {
1253
1277
  el.removeEventListener("transitionend", cb);
1254
1278
  el[moveCbKey] = null;
1255
1279
  removeTransitionClass(el, moveClass);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.20
2
+ * @vue/runtime-dom v3.5.22
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -216,11 +216,11 @@ function resolveTransitionProps(rawProps) {
216
216
  const resolve = () => finishLeave(el, done);
217
217
  addTransitionClass(el, leaveFromClass);
218
218
  if (!el._enterCancelled) {
219
- forceReflow();
219
+ forceReflow(el);
220
220
  addTransitionClass(el, leaveActiveClass);
221
221
  } else {
222
222
  addTransitionClass(el, leaveActiveClass);
223
- forceReflow();
223
+ forceReflow(el);
224
224
  }
225
225
  nextFrame(() => {
226
226
  if (!el._isLeaving) {
@@ -343,7 +343,7 @@ function getTransitionInfo(el, expectedType) {
343
343
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
344
344
  propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
345
345
  }
346
- const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
346
+ const hasTransform = type === TRANSITION && /\b(?:transform|all)(?:,|$)/.test(
347
347
  getStyleProperties(`${TRANSITION}Property`).toString()
348
348
  );
349
349
  return {
@@ -363,8 +363,9 @@ function toMs(s) {
363
363
  if (s === "auto") return 0;
364
364
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
365
365
  }
366
- function forceReflow() {
367
- return document.body.offsetHeight;
366
+ function forceReflow(el) {
367
+ const targetDocument = el ? el.ownerDocument : document;
368
+ return targetDocument.body.offsetHeight;
368
369
  }
369
370
 
370
371
  function patchClass(el, value, isSVG) {
@@ -436,7 +437,7 @@ function useCssVars(getter) {
436
437
  return;
437
438
  }
438
439
 
439
- const displayRE = /(^|;)\s*display\s*:/;
440
+ const displayRE = /(?:^|;)\s*display\s*:/;
440
441
  function patchStyle(el, prev, next) {
441
442
  const style = el.style;
442
443
  const isCssString = shared.isString(next);
@@ -735,11 +736,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
735
736
  }
736
737
 
737
738
  const REMOVAL = {};
738
- /*! #__NO_SIDE_EFFECTS__ */
739
739
  // @__NO_SIDE_EFFECTS__
740
740
  function defineCustomElement(options, extraOptions, _createApp) {
741
- const Comp = runtimeCore.defineComponent(options, extraOptions);
742
- if (shared.isPlainObject(Comp)) shared.extend(Comp, extraOptions);
741
+ let Comp = runtimeCore.defineComponent(options, extraOptions);
742
+ if (shared.isPlainObject(Comp)) Comp = shared.extend({}, Comp, extraOptions);
743
743
  class VueCustomElement extends VueElement {
744
744
  constructor(initialProps) {
745
745
  super(Comp, initialProps, _createApp);
@@ -748,7 +748,6 @@ function defineCustomElement(options, extraOptions, _createApp) {
748
748
  VueCustomElement.def = Comp;
749
749
  return VueCustomElement;
750
750
  }
751
-
752
751
  const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
753
752
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
754
753
  });
@@ -782,7 +781,11 @@ class VueElement extends BaseClass {
782
781
  this._root = this.shadowRoot;
783
782
  } else {
784
783
  if (_def.shadowRoot !== false) {
785
- this.attachShadow({ mode: "open" });
784
+ this.attachShadow(
785
+ shared.extend({}, _def.shadowRootOptions, {
786
+ mode: "open"
787
+ })
788
+ );
786
789
  this._root = this.shadowRoot;
787
790
  } else {
788
791
  this._root = this;
@@ -842,9 +845,18 @@ class VueElement extends BaseClass {
842
845
  this._app && this._app.unmount();
843
846
  if (this._instance) this._instance.ce = void 0;
844
847
  this._app = this._instance = null;
848
+ if (this._teleportTargets) {
849
+ this._teleportTargets.clear();
850
+ this._teleportTargets = void 0;
851
+ }
845
852
  }
846
853
  });
847
854
  }
855
+ _processMutations(mutations) {
856
+ for (const m of mutations) {
857
+ this._setAttr(m.attributeName);
858
+ }
859
+ }
848
860
  /**
849
861
  * resolve inner component definition (handle possible async component)
850
862
  */
@@ -855,11 +867,7 @@ class VueElement extends BaseClass {
855
867
  for (let i = 0; i < this.attributes.length; i++) {
856
868
  this._setAttr(this.attributes[i].name);
857
869
  }
858
- this._ob = new MutationObserver((mutations) => {
859
- for (const m of mutations) {
860
- this._setAttr(m.attributeName);
861
- }
862
- });
870
+ this._ob = new MutationObserver(this._processMutations.bind(this));
863
871
  this._ob.observe(this, { attributes: true });
864
872
  const resolve = (def, isAsync = false) => {
865
873
  this._resolved = true;
@@ -966,7 +974,10 @@ class VueElement extends BaseClass {
966
974
  }
967
975
  if (shouldReflect) {
968
976
  const ob = this._ob;
969
- ob && ob.disconnect();
977
+ if (ob) {
978
+ this._processMutations(ob.takeRecords());
979
+ ob.disconnect();
980
+ }
970
981
  if (val === true) {
971
982
  this.setAttribute(shared.hyphenate(key), "");
972
983
  } else if (typeof val === "string" || typeof val === "number") {
@@ -1045,7 +1056,7 @@ class VueElement extends BaseClass {
1045
1056
  * Only called when shadowRoot is false
1046
1057
  */
1047
1058
  _renderSlots() {
1048
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
1059
+ const outlets = this._getSlots();
1049
1060
  const scopeId = this._instance.type.__scopeId;
1050
1061
  for (let i = 0; i < outlets.length; i++) {
1051
1062
  const o = outlets[i];
@@ -1071,6 +1082,19 @@ class VueElement extends BaseClass {
1071
1082
  parent.removeChild(o);
1072
1083
  }
1073
1084
  }
1085
+ /**
1086
+ * @internal
1087
+ */
1088
+ _getSlots() {
1089
+ const roots = [this];
1090
+ if (this._teleportTargets) {
1091
+ roots.push(...this._teleportTargets);
1092
+ }
1093
+ return roots.reduce((res, i) => {
1094
+ res.push(...Array.from(i.querySelectorAll("slot")));
1095
+ return res;
1096
+ }, []);
1097
+ }
1074
1098
  /**
1075
1099
  * @internal
1076
1100
  */
@@ -1149,7 +1173,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1149
1173
  prevChildren.forEach(callPendingCbs);
1150
1174
  prevChildren.forEach(recordPosition);
1151
1175
  const movedChildren = prevChildren.filter(applyTranslation);
1152
- forceReflow();
1176
+ forceReflow(instance.vnode.el);
1153
1177
  movedChildren.forEach((c) => {
1154
1178
  const el = c.el;
1155
1179
  const style = el.style;
@@ -1159,7 +1183,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1159
1183
  if (e && e.target !== el) {
1160
1184
  return;
1161
1185
  }
1162
- if (!e || /transform$/.test(e.propertyName)) {
1186
+ if (!e || e.propertyName.endsWith("transform")) {
1163
1187
  el.removeEventListener("transitionend", cb);
1164
1188
  el[moveCbKey] = null;
1165
1189
  removeTransitionClass(el, moveClass);