@vuact/runtime-dom 3.5.28-vuact.1 → 3.5.29-vuact.0

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
- * @vuact/runtime-dom v3.5.16
2
+ * @vue/runtime-dom v3.5.29
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -92,7 +92,7 @@ const nodeOps = {
92
92
 
93
93
  const TRANSITION = "transition";
94
94
  const ANIMATION = "animation";
95
- const vtcKey = Symbol("_vtc");
95
+ const vtcKey = /* @__PURE__ */ Symbol("_vtc");
96
96
  const DOMTransitionPropsValidators = {
97
97
  name: String,
98
98
  type: String,
@@ -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) {
@@ -381,9 +382,11 @@ function patchClass(el, value, isSVG) {
381
382
  }
382
383
  }
383
384
 
384
- const vShowOriginalDisplay = Symbol("_vod");
385
- const vShowHidden = Symbol("_vsh");
385
+ const vShowOriginalDisplay = /* @__PURE__ */ Symbol("_vod");
386
+ const vShowHidden = /* @__PURE__ */ Symbol("_vsh");
386
387
  const vShow = {
388
+ // used for prop mismatch check during hydration
389
+ name: "show",
387
390
  beforeMount(el, { value }, { transition }) {
388
391
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
389
392
  if (transition && value) {
@@ -429,12 +432,12 @@ function initVShowForSSR() {
429
432
  };
430
433
  }
431
434
 
432
- const CSS_VAR_TEXT = Symbol("");
435
+ const CSS_VAR_TEXT = /* @__PURE__ */ Symbol("");
433
436
  function useCssVars(getter) {
434
437
  return;
435
438
  }
436
439
 
437
- const displayRE = /(^|;)\s*display\s*:/;
440
+ const displayRE = /(?:^|;)\s*display\s*:/;
438
441
  function patchStyle(el, prev, next) {
439
442
  const style = el.style;
440
443
  const isCssString = shared.isString(next);
@@ -597,7 +600,7 @@ function addEventListener(el, event, handler, options) {
597
600
  function removeEventListener(el, event, handler, options) {
598
601
  el.removeEventListener(event, handler, options);
599
602
  }
600
- const veiKey = Symbol("_vei");
603
+ const veiKey = /* @__PURE__ */ Symbol("_vei");
601
604
  function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
602
605
  const invokers = el[veiKey] || (el[veiKey] = {});
603
606
  const existingInvoker = invokers[rawName];
@@ -711,6 +714,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
711
714
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
712
715
  return false;
713
716
  }
717
+ if (key === "sandbox" && el.tagName === "IFRAME") {
718
+ return false;
719
+ }
714
720
  if (key === "form") {
715
721
  return false;
716
722
  }
@@ -733,11 +739,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
733
739
  }
734
740
 
735
741
  const REMOVAL = {};
736
- /*! #__NO_SIDE_EFFECTS__ */
737
742
  // @__NO_SIDE_EFFECTS__
738
743
  function defineCustomElement(options, extraOptions, _createApp) {
739
- const Comp = runtimeCore.defineComponent(options, extraOptions);
740
- if (shared.isPlainObject(Comp)) shared.extend(Comp, extraOptions);
744
+ let Comp = runtimeCore.defineComponent(options, extraOptions);
745
+ if (shared.isPlainObject(Comp)) Comp = shared.extend({}, Comp, extraOptions);
741
746
  class VueCustomElement extends VueElement {
742
747
  constructor(initialProps) {
743
748
  super(Comp, initialProps, _createApp);
@@ -746,10 +751,9 @@ function defineCustomElement(options, extraOptions, _createApp) {
746
751
  VueCustomElement.def = Comp;
747
752
  return VueCustomElement;
748
753
  }
749
- /*! #__NO_SIDE_EFFECTS__ */
750
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
754
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
751
755
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
752
- };
756
+ });
753
757
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
754
758
  };
755
759
  class VueElement extends BaseClass {
@@ -773,6 +777,8 @@ class VueElement extends BaseClass {
773
777
  this._nonce = this._def.nonce;
774
778
  this._connected = false;
775
779
  this._resolved = false;
780
+ this._patching = false;
781
+ this._dirty = false;
776
782
  this._numberProps = null;
777
783
  this._styleChildren = /* @__PURE__ */ new WeakSet();
778
784
  this._ob = null;
@@ -780,7 +786,11 @@ class VueElement extends BaseClass {
780
786
  this._root = this.shadowRoot;
781
787
  } else {
782
788
  if (_def.shadowRoot !== false) {
783
- this.attachShadow({ mode: "open" });
789
+ this.attachShadow(
790
+ shared.extend({}, _def.shadowRootOptions, {
791
+ mode: "open"
792
+ })
793
+ );
784
794
  this._root = this.shadowRoot;
785
795
  } else {
786
796
  this._root = this;
@@ -840,9 +850,18 @@ class VueElement extends BaseClass {
840
850
  this._app && this._app.unmount();
841
851
  if (this._instance) this._instance.ce = void 0;
842
852
  this._app = this._instance = null;
853
+ if (this._teleportTargets) {
854
+ this._teleportTargets.clear();
855
+ this._teleportTargets = void 0;
856
+ }
843
857
  }
844
858
  });
845
859
  }
860
+ _processMutations(mutations) {
861
+ for (const m of mutations) {
862
+ this._setAttr(m.attributeName);
863
+ }
864
+ }
846
865
  /**
847
866
  * resolve inner component definition (handle possible async component)
848
867
  */
@@ -853,11 +872,7 @@ class VueElement extends BaseClass {
853
872
  for (let i = 0; i < this.attributes.length; i++) {
854
873
  this._setAttr(this.attributes[i].name);
855
874
  }
856
- this._ob = new MutationObserver((mutations) => {
857
- for (const m of mutations) {
858
- this._setAttr(m.attributeName);
859
- }
860
- });
875
+ this._ob = new MutationObserver(this._processMutations.bind(this));
861
876
  this._ob.observe(this, { attributes: true });
862
877
  const resolve = (def, isAsync = false) => {
863
878
  this._resolved = true;
@@ -884,9 +899,10 @@ class VueElement extends BaseClass {
884
899
  };
885
900
  const asyncDef = this._def.__asyncLoader;
886
901
  if (asyncDef) {
887
- this._pendingResolve = asyncDef().then(
888
- (def) => resolve(this._def = def, true)
889
- );
902
+ this._pendingResolve = asyncDef().then((def) => {
903
+ def.configureApp = this._def.configureApp;
904
+ resolve(this._def = def, true);
905
+ });
890
906
  } else {
891
907
  resolve(this._def);
892
908
  }
@@ -924,7 +940,7 @@ class VueElement extends BaseClass {
924
940
  return this._getProp(key);
925
941
  },
926
942
  set(val) {
927
- this._setProp(key, val, true, true);
943
+ this._setProp(key, val, true, !this._patching);
928
944
  }
929
945
  });
930
946
  }
@@ -950,6 +966,7 @@ class VueElement extends BaseClass {
950
966
  */
951
967
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
952
968
  if (val !== this._props[key]) {
969
+ this._dirty = true;
953
970
  if (val === REMOVAL) {
954
971
  delete this._props[key];
955
972
  } else {
@@ -963,7 +980,10 @@ class VueElement extends BaseClass {
963
980
  }
964
981
  if (shouldReflect) {
965
982
  const ob = this._ob;
966
- ob && ob.disconnect();
983
+ if (ob) {
984
+ this._processMutations(ob.takeRecords());
985
+ ob.disconnect();
986
+ }
967
987
  if (val === true) {
968
988
  this.setAttribute(shared.hyphenate(key), "");
969
989
  } else if (typeof val === "string" || typeof val === "number") {
@@ -1042,7 +1062,7 @@ class VueElement extends BaseClass {
1042
1062
  * Only called when shadowRoot is false
1043
1063
  */
1044
1064
  _renderSlots() {
1045
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
1065
+ const outlets = this._getSlots();
1046
1066
  const scopeId = this._instance.type.__scopeId;
1047
1067
  for (let i = 0; i < outlets.length; i++) {
1048
1068
  const o = outlets[i];
@@ -1068,12 +1088,51 @@ class VueElement extends BaseClass {
1068
1088
  parent.removeChild(o);
1069
1089
  }
1070
1090
  }
1091
+ /**
1092
+ * @internal
1093
+ */
1094
+ _getSlots() {
1095
+ const roots = [this];
1096
+ if (this._teleportTargets) {
1097
+ roots.push(...this._teleportTargets);
1098
+ }
1099
+ const slots = /* @__PURE__ */ new Set();
1100
+ for (const root of roots) {
1101
+ const found = root.querySelectorAll("slot");
1102
+ for (let i = 0; i < found.length; i++) {
1103
+ slots.add(found[i]);
1104
+ }
1105
+ }
1106
+ return Array.from(slots);
1107
+ }
1071
1108
  /**
1072
1109
  * @internal
1073
1110
  */
1074
1111
  _injectChildStyle(comp) {
1075
1112
  this._applyStyles(comp.styles, comp);
1076
1113
  }
1114
+ /**
1115
+ * @internal
1116
+ */
1117
+ _beginPatch() {
1118
+ this._patching = true;
1119
+ this._dirty = false;
1120
+ }
1121
+ /**
1122
+ * @internal
1123
+ */
1124
+ _endPatch() {
1125
+ this._patching = false;
1126
+ if (this._dirty && this._instance) {
1127
+ this._update();
1128
+ }
1129
+ }
1130
+ /**
1131
+ * @internal
1132
+ */
1133
+ _hasShadowRoot() {
1134
+ return this._def.shadowRoot !== false;
1135
+ }
1077
1136
  /**
1078
1137
  * @internal
1079
1138
  */
@@ -1113,8 +1172,8 @@ function useCssModule(name = "$style") {
1113
1172
 
1114
1173
  const positionMap = /* @__PURE__ */ new WeakMap();
1115
1174
  const newPositionMap = /* @__PURE__ */ new WeakMap();
1116
- const moveCbKey = Symbol("_moveCb");
1117
- const enterCbKey = Symbol("_enterCb");
1175
+ const moveCbKey = /* @__PURE__ */ Symbol("_moveCb");
1176
+ const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
1118
1177
  const decorate = (t) => {
1119
1178
  delete t.props.mode;
1120
1179
  return t;
@@ -1146,7 +1205,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1146
1205
  prevChildren.forEach(callPendingCbs);
1147
1206
  prevChildren.forEach(recordPosition);
1148
1207
  const movedChildren = prevChildren.filter(applyTranslation);
1149
- forceReflow();
1208
+ forceReflow(instance.vnode.el);
1150
1209
  movedChildren.forEach((c) => {
1151
1210
  const el = c.el;
1152
1211
  const style = el.style;
@@ -1156,7 +1215,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1156
1215
  if (e && e.target !== el) {
1157
1216
  return;
1158
1217
  }
1159
- if (!e || /transform$/.test(e.propertyName)) {
1218
+ if (!e || e.propertyName.endsWith("transform")) {
1160
1219
  el.removeEventListener("transitionend", cb);
1161
1220
  el[moveCbKey] = null;
1162
1221
  removeTransitionClass(el, moveClass);
@@ -1185,10 +1244,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1185
1244
  instance
1186
1245
  )
1187
1246
  );
1188
- positionMap.set(
1189
- child,
1190
- child.el.getBoundingClientRect()
1191
- );
1247
+ positionMap.set(child, getPosition(child.el));
1192
1248
  }
1193
1249
  }
1194
1250
  }
@@ -1217,7 +1273,7 @@ function callPendingCbs(c) {
1217
1273
  }
1218
1274
  }
1219
1275
  function recordPosition(c) {
1220
- newPositionMap.set(c, c.el.getBoundingClientRect());
1276
+ newPositionMap.set(c, getPosition(c.el));
1221
1277
  }
1222
1278
  function applyTranslation(c) {
1223
1279
  const oldPos = positionMap.get(c);
@@ -1225,12 +1281,29 @@ function applyTranslation(c) {
1225
1281
  const dx = oldPos.left - newPos.left;
1226
1282
  const dy = oldPos.top - newPos.top;
1227
1283
  if (dx || dy) {
1228
- const s = c.el.style;
1229
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
1284
+ const el = c.el;
1285
+ const s = el.style;
1286
+ const rect = el.getBoundingClientRect();
1287
+ let scaleX = 1;
1288
+ let scaleY = 1;
1289
+ if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
1290
+ if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
1291
+ if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
1292
+ if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
1293
+ if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
1294
+ if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
1295
+ s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
1230
1296
  s.transitionDuration = "0s";
1231
1297
  return c;
1232
1298
  }
1233
1299
  }
1300
+ function getPosition(el) {
1301
+ const rect = el.getBoundingClientRect();
1302
+ return {
1303
+ left: rect.left,
1304
+ top: rect.top
1305
+ };
1306
+ }
1234
1307
  function hasCSSTransform(el, root, moveClass) {
1235
1308
  const clone = el.cloneNode();
1236
1309
  const _vtc = el[vtcKey];
@@ -1262,25 +1335,23 @@ function onCompositionEnd(e) {
1262
1335
  target.dispatchEvent(new Event("input"));
1263
1336
  }
1264
1337
  }
1265
- const assignKey = Symbol("_assign");
1338
+ const assignKey = /* @__PURE__ */ Symbol("_assign");
1339
+ function castValue(value, trim, number) {
1340
+ if (trim) value = value.trim();
1341
+ if (number) value = shared.looseToNumber(value);
1342
+ return value;
1343
+ }
1266
1344
  const vModelText = {
1267
1345
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
1268
1346
  el[assignKey] = getModelAssigner(vnode);
1269
1347
  const castToNumber = number || vnode.props && vnode.props.type === "number";
1270
1348
  addEventListener(el, lazy ? "change" : "input", (e) => {
1271
1349
  if (e.target.composing) return;
1272
- let domValue = el.value;
1273
- if (trim) {
1274
- domValue = domValue.trim();
1275
- }
1276
- if (castToNumber) {
1277
- domValue = shared.looseToNumber(domValue);
1278
- }
1279
- el[assignKey](domValue);
1350
+ el[assignKey](castValue(el.value, trim, castToNumber));
1280
1351
  });
1281
- if (trim) {
1352
+ if (trim || castToNumber) {
1282
1353
  addEventListener(el, "change", () => {
1283
- el.value = el.value.trim();
1354
+ el.value = castValue(el.value, trim, castToNumber);
1284
1355
  });
1285
1356
  }
1286
1357
  if (!lazy) {
@@ -1540,15 +1611,16 @@ const modifierGuards = {
1540
1611
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
1541
1612
  };
1542
1613
  const withModifiers = (fn, modifiers) => {
1614
+ if (!fn) return fn;
1543
1615
  const cache = fn._withMods || (fn._withMods = {});
1544
1616
  const cacheKey = modifiers.join(".");
1545
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
1617
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
1546
1618
  for (let i = 0; i < modifiers.length; i++) {
1547
1619
  const guard = modifierGuards[modifiers[i]];
1548
1620
  if (guard && guard(event, modifiers)) return;
1549
1621
  }
1550
1622
  return fn(event, ...args);
1551
- });
1623
+ }));
1552
1624
  };
1553
1625
  const keyNames = {
1554
1626
  esc: "escape",
@@ -1562,7 +1634,7 @@ const keyNames = {
1562
1634
  const withKeys = (fn, modifiers) => {
1563
1635
  const cache = fn._withKeys || (fn._withKeys = {});
1564
1636
  const cacheKey = modifiers.join(".");
1565
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
1637
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
1566
1638
  if (!("key" in event)) {
1567
1639
  return;
1568
1640
  }
@@ -1572,7 +1644,7 @@ const withKeys = (fn, modifiers) => {
1572
1644
  )) {
1573
1645
  return fn(event);
1574
1646
  }
1575
- });
1647
+ }));
1576
1648
  };
1577
1649
 
1578
1650
  const rendererOptions = /* @__PURE__ */ shared.extend({ patchProp }, nodeOps);
@@ -1586,13 +1658,13 @@ function ensureHydrationRenderer() {
1586
1658
  enabledHydration = true;
1587
1659
  return renderer;
1588
1660
  }
1589
- const render = (...args) => {
1661
+ const render = ((...args) => {
1590
1662
  ensureRenderer().render(...args);
1591
- };
1592
- const hydrate = (...args) => {
1663
+ });
1664
+ const hydrate = ((...args) => {
1593
1665
  ensureHydrationRenderer().hydrate(...args);
1594
- };
1595
- const createApp = (...args) => {
1666
+ });
1667
+ const createApp = ((...args) => {
1596
1668
  const app = ensureRenderer().createApp(...args);
1597
1669
  const { mount } = app;
1598
1670
  app.mount = (containerOrSelector) => {
@@ -1613,8 +1685,8 @@ const createApp = (...args) => {
1613
1685
  return proxy;
1614
1686
  };
1615
1687
  return app;
1616
- };
1617
- const createSSRApp = (...args) => {
1688
+ });
1689
+ const createSSRApp = ((...args) => {
1618
1690
  const app = ensureHydrationRenderer().createApp(...args);
1619
1691
  const { mount } = app;
1620
1692
  app.mount = (containerOrSelector) => {
@@ -1624,7 +1696,7 @@ const createSSRApp = (...args) => {
1624
1696
  }
1625
1697
  };
1626
1698
  return app;
1627
- };
1699
+ });
1628
1700
  function resolveRootNamespace(container) {
1629
1701
  if (container instanceof SVGElement) {
1630
1702
  return "svg";
@@ -1658,6 +1730,8 @@ exports.defineCustomElement = defineCustomElement;
1658
1730
  exports.defineSSRCustomElement = defineSSRCustomElement;
1659
1731
  exports.hydrate = hydrate;
1660
1732
  exports.initDirectivesForSSR = initDirectivesForSSR;
1733
+ exports.nodeOps = nodeOps;
1734
+ exports.patchProp = patchProp;
1661
1735
  exports.render = render;
1662
1736
  exports.rendererOptions = rendererOptions;
1663
1737
  exports.useCssModule = useCssModule;