monowind 0.2.3 → 0.2.4
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 +3 -2
- package/dist/cdn.js +1188 -21
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/index.js +905 -773
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +5 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/plain-text.d.ts +19 -0
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/sort.js +233 -5
- package/dist/sort.js.map +1 -1
- package/dist/style.d.ts.map +1 -1
- package/dist/types.d.ts +19 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/utilities.css +30 -6
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ function i(e) {
|
|
|
33
33
|
if (!e.contains(a)) continue;
|
|
34
34
|
t.splice(i, 1), r = !0;
|
|
35
35
|
let l = c(getComputedStyle(a), "background-color"), u = f(o), d = f(s);
|
|
36
|
-
|
|
36
|
+
l && u && d && n.set(a, {
|
|
37
37
|
from: u,
|
|
38
38
|
to: d,
|
|
39
39
|
toValue: s,
|
|
@@ -832,29 +832,29 @@ function He(e, t) {
|
|
|
832
832
|
})).filter((e) => e.end > e.start);
|
|
833
833
|
}
|
|
834
834
|
function Ue(e, t, n, r, i, a, o) {
|
|
835
|
-
let s =
|
|
836
|
-
let n =
|
|
835
|
+
let s = H(e.style, "x", t), c = H(e.style, "y", n), l = Qe(e).map((e) => {
|
|
836
|
+
let n = W(e.style.margin, t);
|
|
837
837
|
return {
|
|
838
838
|
node: e,
|
|
839
|
-
base:
|
|
839
|
+
base: Ze(e, t, o),
|
|
840
840
|
grow: e.style.flexGrow,
|
|
841
841
|
shrink: e.style.flexShrink,
|
|
842
|
-
min:
|
|
843
|
-
max:
|
|
842
|
+
min: tt(e, t, o),
|
|
843
|
+
max: G(e.style.maxWidth, t),
|
|
844
844
|
margin: n
|
|
845
845
|
};
|
|
846
846
|
}), u = [];
|
|
847
847
|
if (e.style.flexWrap === "wrap") {
|
|
848
848
|
let n = [], r = 0;
|
|
849
849
|
for (let e of l) {
|
|
850
|
-
let i = Math.max(0,
|
|
850
|
+
let i = Math.max(0, V(e.base, e.min, e.max)) + (e.margin.left ?? 0) + (e.margin.right ?? 0), a = n.length === 0 ? i : r + s + i;
|
|
851
851
|
n.length > 0 && a > t && (u.push(n), n = [], r = 0), n.push(e), r = n.length === 1 ? i : r + s + i;
|
|
852
852
|
}
|
|
853
853
|
n.length > 0 && u.push(n), e.style.wrapReverse && u.reverse();
|
|
854
854
|
} else u.push(l);
|
|
855
855
|
let d = i.left + a.left, f = i.top + a.top, p = u.map((e) => {
|
|
856
|
-
let n = s * Math.max(0, e.length - 1), i = e.reduce((e, t) => e + (t.margin.left ?? 0) + (t.margin.right ?? 0), 0), a = Math.max(0, t - n - i), c = e.some((e) => e.margin.left === null || e.margin.right === null), l = e.reduce((e, t) => e + t.base, 0), u = c && l <= a ? e.map((e) => Math.max(0,
|
|
857
|
-
for (let n = 0; n < e.length; n++)
|
|
856
|
+
let n = s * Math.max(0, e.length - 1), i = e.reduce((e, t) => e + (t.margin.left ?? 0) + (t.margin.right ?? 0), 0), a = Math.max(0, t - n - i), c = e.some((e) => e.margin.left === null || e.margin.right === null), l = e.reduce((e, t) => e + t.base, 0), u = c && l <= a ? e.map((e) => Math.max(0, V(e.base, e.min, e.max))) : Je(e, a);
|
|
857
|
+
for (let n = 0; n < e.length; n++) B(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
858
858
|
return {
|
|
859
859
|
row: e,
|
|
860
860
|
widths: u,
|
|
@@ -864,7 +864,7 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
864
864
|
}), m = p.map((e) => e.height), h = c * Math.max(0, p.length - 1), g;
|
|
865
865
|
if (e.style.flexWrap === "nowrap") r === void 0 ? Number.isFinite(n) && (m[0] = Math.max(n, m[0] ?? 0)) : m[0] = r, g = [0];
|
|
866
866
|
else {
|
|
867
|
-
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i =
|
|
867
|
+
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i = $e(e.style);
|
|
868
868
|
if (i === "stretch" && r > 0) {
|
|
869
869
|
let e = R(Array.from({ length: p.length }, () => 1), r);
|
|
870
870
|
for (let t = 0; t < m.length; t++) m[t] += e[t];
|
|
@@ -876,9 +876,9 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
876
876
|
for (let i = 0; i < a.length; i++) {
|
|
877
877
|
let s = a[i].node, c = Ye(s, e), u = a[i].margin, d = u.top === null || u.bottom === null, f = s.style.height !== void 0 && s.style.height.kind !== "auto";
|
|
878
878
|
if (c === "stretch" && !d && !f && h !== s.localRect.height) {
|
|
879
|
-
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, d =
|
|
879
|
+
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, d = V(Math.max(0, h - e - a), G(s.style.minHeight, c) ?? 0, G(s.style.maxHeight, c));
|
|
880
880
|
if (d === s.localRect.height) continue;
|
|
881
|
-
|
|
881
|
+
B(s, t, r, 0, 0, "fill", o, {
|
|
882
882
|
width: l[i],
|
|
883
883
|
height: d
|
|
884
884
|
});
|
|
@@ -889,7 +889,7 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
889
889
|
let e = R(Array.from({ length: b }, () => 1), y), t = 0;
|
|
890
890
|
for (let n = 0; n < a.length; n++) a[n].margin.left === null && (x[n] = e[t++]), a[n].margin.right === null && (S[n] = e[t++]);
|
|
891
891
|
C = L("start", l, 0);
|
|
892
|
-
} else C = L(
|
|
892
|
+
} else C = L(et(e.style), l, y);
|
|
893
893
|
let w = 0;
|
|
894
894
|
for (let t = 0; t < a.length; t++) {
|
|
895
895
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
@@ -937,7 +937,7 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
937
937
|
return We(e, i, a, t, v), v;
|
|
938
938
|
}
|
|
939
939
|
function We(e, t, n, r, i) {
|
|
940
|
-
for (let a of e.children)
|
|
940
|
+
for (let a of e.children) z(a.style) && (a.staticSlot = {
|
|
941
941
|
kind: "flex",
|
|
942
942
|
direction: e.style.flexDirection,
|
|
943
943
|
originX: t.left + n.left,
|
|
@@ -947,30 +947,30 @@ function We(e, t, n, r, i) {
|
|
|
947
947
|
});
|
|
948
948
|
}
|
|
949
949
|
function Ge(e, t, n, r, i, a, o) {
|
|
950
|
-
let s =
|
|
951
|
-
let a =
|
|
952
|
-
|
|
950
|
+
let s = H(e.style, "y", n), c = Qe(e).map((i) => {
|
|
951
|
+
let a = W(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = Ye(i, e) === "stretch";
|
|
952
|
+
B(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
953
953
|
let l = Number.isFinite(n) ? n : void 0, u = i.style.flexBasis, d = u === void 0 || u.kind === "auto" ? i.unclampedHeight : u.kind === "cells" ? u.value : u.kind === "percent" && l !== void 0 ? we(u.value, l) : i.unclampedHeight, f = i.style.minHeight === "auto" ? i.style.overflow.y === "visible" ? i.localRect.height : 0 : void 0;
|
|
954
954
|
return {
|
|
955
955
|
node: i,
|
|
956
956
|
base: d,
|
|
957
957
|
grow: i.style.flexGrow,
|
|
958
958
|
shrink: i.style.flexShrink,
|
|
959
|
-
min: f ??
|
|
960
|
-
max:
|
|
959
|
+
min: f ?? G(i.style.minHeight, l) ?? 0,
|
|
960
|
+
max: G(i.style.maxHeight, l),
|
|
961
961
|
margin: a
|
|
962
962
|
};
|
|
963
|
-
}), l = s * Math.max(0, c.length - 1), u = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), d = Number.isFinite(n), f = c.reduce((e, t) => e + t.base, 0), p = d ? Math.max(0, n - l - u) : f, m = r ? p : Math.max(p, f), h = c.some((e) => e.margin.top === null || e.margin.bottom === null), g = d && !(d && h && f <= m) ? Je(c, m) : c.map((e) => Math.max(0,
|
|
963
|
+
}), l = s * Math.max(0, c.length - 1), u = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), d = Number.isFinite(n), f = c.reduce((e, t) => e + t.base, 0), p = d ? Math.max(0, n - l - u) : f, m = r ? p : Math.max(p, f), h = c.some((e) => e.margin.top === null || e.margin.bottom === null), g = d && !(d && h && f <= m) ? Je(c, m) : c.map((e) => Math.max(0, V(e.base, e.min, e.max)));
|
|
964
964
|
for (let n = 0; n < c.length; n++) if (g[n] !== c[n].node.localRect.height) {
|
|
965
965
|
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a = Ye(r.node, e) === "stretch";
|
|
966
|
-
|
|
966
|
+
B(r.node, i, g[n], 0, 0, a ? "fill" : "shrink", o, { height: g[n] });
|
|
967
967
|
}
|
|
968
968
|
let _ = g.reduce((e, t) => e + t, 0), v = Math.max(0, m - _), y = c.reduce((e, t) => e + +(t.margin.top === null) + +(t.margin.bottom === null), 0), b = Array.from({ length: c.length }, () => 0), x = Array.from({ length: c.length }, () => 0), C;
|
|
969
969
|
if (y > 0 && v > 0) {
|
|
970
970
|
let e = R(Array.from({ length: y }, () => 1), v), t = 0;
|
|
971
971
|
for (let n = 0; n < c.length; n++) c[n].margin.top === null && (b[n] = e[t++]), c[n].margin.bottom === null && (x[n] = e[t++]);
|
|
972
972
|
C = L("start", g, 0);
|
|
973
|
-
} else C = L(
|
|
973
|
+
} else C = L(et(e.style), g, v);
|
|
974
974
|
let w = i.left + a.left, T = i.top + a.top, E = 0;
|
|
975
975
|
for (let n = 0; n < c.length; n++) {
|
|
976
976
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
@@ -1010,11 +1010,11 @@ function Ge(e, t, n, r, i, a, o) {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
function Ke(e, t, n, r) {
|
|
1012
1012
|
let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.top ?? 0, o = r.bottom ?? 0, s = n - e.localRect.height, c = r.top === null && r.bottom === null, l = r.top === null && r.bottom !== null, u = r.bottom === null && r.top !== null;
|
|
1013
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
1013
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + Xe(i, n, e.localRect.height);
|
|
1014
1014
|
}
|
|
1015
1015
|
function qe(e, t, n, r) {
|
|
1016
1016
|
let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.left ?? 0, o = r.right ?? 0, s = n - e.localRect.width, c = r.left === null && r.right === null, l = r.left === null && r.right !== null, u = r.right === null && r.left !== null;
|
|
1017
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
1017
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + Xe(i, n, e.localRect.width);
|
|
1018
1018
|
}
|
|
1019
1019
|
function L(e, t, n) {
|
|
1020
1020
|
let r = t.length;
|
|
@@ -1035,7 +1035,7 @@ function L(e, t, n) {
|
|
|
1035
1035
|
return i;
|
|
1036
1036
|
}
|
|
1037
1037
|
function Je(e, t) {
|
|
1038
|
-
let n = e.length, r = (t, n) => Math.max(0,
|
|
1038
|
+
let n = e.length, r = (t, n) => Math.max(0, V(t, e[n].min ?? 0, e[n].max)), i = e.map((e) => e.base), a = t >= i.reduce((e, t, n) => e + r(t, n), 0), o = Array.from({ length: n }, () => 0), s = Array.from({ length: n }, () => !1);
|
|
1039
1039
|
for (let t = 0; t < n; t++) {
|
|
1040
1040
|
let n = r(i[t], t);
|
|
1041
1041
|
((a ? e[t].grow : e[t].shrink) === 0 || a && i[t] > n || !a && i[t] < n) && (o[t] = n, s[t] = !0);
|
|
@@ -1072,42 +1072,50 @@ function R(e, t) {
|
|
|
1072
1072
|
function Ye(e, t) {
|
|
1073
1073
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function Xe(e, t, n) {
|
|
1076
1076
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Ze(e, t, n) {
|
|
1079
1079
|
let r = e.style.flexBasis, i = e.style.width;
|
|
1080
|
-
return r !== void 0 && r.kind !== "auto" ?
|
|
1080
|
+
return r !== void 0 && r.kind !== "auto" ? K(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? K(i, t, e, n) : q(e, n);
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1083
|
-
let t = e.children.filter((e) => !
|
|
1082
|
+
function Qe(e) {
|
|
1083
|
+
let t = e.children.filter((e) => !z(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
1084
1084
|
return e.style.flexReverse && t.reverse(), t;
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function $e(e) {
|
|
1087
1087
|
return e.wrapReverse ? e.alignContent === "start" ? "end" : e.alignContent === "end" ? "start" : e.alignContent : e.alignContent;
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function et(e) {
|
|
1090
1090
|
let t = e.justifyContent === "stretch" ? "start" : e.justifyContent;
|
|
1091
1091
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1094
|
-
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ? Y(e, n) : 0 :
|
|
1093
|
+
function tt(e, t, n) {
|
|
1094
|
+
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ? Y(e, n) : 0 : G(e.style.minWidth, t) ?? 0;
|
|
1095
1095
|
}
|
|
1096
1096
|
//#endregion
|
|
1097
1097
|
//#region src/types.ts
|
|
1098
|
-
function
|
|
1098
|
+
function nt(e) {
|
|
1099
1099
|
return e === "auto" || e === "scroll";
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1102
|
-
return
|
|
1101
|
+
function rt(e) {
|
|
1102
|
+
return {
|
|
1103
|
+
right: e.scrollbarSize.y + e.scrollbarInset.x,
|
|
1104
|
+
bottom: e.scrollbarSize.x + e.scrollbarInset.y
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
function it(e) {
|
|
1108
|
+
if (e.scrollbarWidth === "none") return {
|
|
1103
1109
|
right: 0,
|
|
1104
1110
|
bottom: 0
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1111
|
+
};
|
|
1112
|
+
let t = rt(e);
|
|
1113
|
+
return {
|
|
1114
|
+
right: e.overflow.y === "scroll" ? t.right : 0,
|
|
1115
|
+
bottom: e.overflow.x === "scroll" ? t.bottom : 0
|
|
1108
1116
|
};
|
|
1109
1117
|
}
|
|
1110
|
-
function
|
|
1118
|
+
function at() {
|
|
1111
1119
|
return {
|
|
1112
1120
|
display: "block",
|
|
1113
1121
|
flexDirection: "row",
|
|
@@ -1126,8 +1134,8 @@ function rt() {
|
|
|
1126
1134
|
justifySelf: "auto",
|
|
1127
1135
|
gridTemplateColumns: { kind: "none" },
|
|
1128
1136
|
gridTemplateRows: { kind: "none" },
|
|
1129
|
-
gridAutoColumns: [
|
|
1130
|
-
gridAutoRows: [
|
|
1137
|
+
gridAutoColumns: [st()],
|
|
1138
|
+
gridAutoRows: [st()],
|
|
1131
1139
|
gridAutoFlow: {
|
|
1132
1140
|
direction: "row",
|
|
1133
1141
|
dense: !1
|
|
@@ -1143,7 +1151,7 @@ function rt() {
|
|
|
1143
1151
|
minHeight: "auto",
|
|
1144
1152
|
maxWidth: void 0,
|
|
1145
1153
|
maxHeight: void 0,
|
|
1146
|
-
padding:
|
|
1154
|
+
padding: ot(),
|
|
1147
1155
|
margin: {
|
|
1148
1156
|
top: 0,
|
|
1149
1157
|
right: 0,
|
|
@@ -1159,7 +1167,7 @@ function rt() {
|
|
|
1159
1167
|
},
|
|
1160
1168
|
gapX: 0,
|
|
1161
1169
|
gapY: 0,
|
|
1162
|
-
border:
|
|
1170
|
+
border: ot(),
|
|
1163
1171
|
borderStyle: {
|
|
1164
1172
|
top: "solid",
|
|
1165
1173
|
right: "solid",
|
|
@@ -1175,6 +1183,10 @@ function rt() {
|
|
|
1175
1183
|
x: 1,
|
|
1176
1184
|
y: 1
|
|
1177
1185
|
},
|
|
1186
|
+
scrollbarInset: {
|
|
1187
|
+
x: 0,
|
|
1188
|
+
y: 0
|
|
1189
|
+
},
|
|
1178
1190
|
overscroll: {
|
|
1179
1191
|
x: !0,
|
|
1180
1192
|
y: !0
|
|
@@ -1225,7 +1237,7 @@ function rt() {
|
|
|
1225
1237
|
breakInsideAvoid: !1
|
|
1226
1238
|
};
|
|
1227
1239
|
}
|
|
1228
|
-
function
|
|
1240
|
+
function ot() {
|
|
1229
1241
|
return {
|
|
1230
1242
|
top: 0,
|
|
1231
1243
|
right: 0,
|
|
@@ -1233,7 +1245,7 @@ function it() {
|
|
|
1233
1245
|
left: 0
|
|
1234
1246
|
};
|
|
1235
1247
|
}
|
|
1236
|
-
function
|
|
1248
|
+
function st() {
|
|
1237
1249
|
return {
|
|
1238
1250
|
min: { kind: "auto" },
|
|
1239
1251
|
max: { kind: "auto" }
|
|
@@ -1241,15 +1253,15 @@ function at() {
|
|
|
1241
1253
|
}
|
|
1242
1254
|
//#endregion
|
|
1243
1255
|
//#region src/grid.ts
|
|
1244
|
-
function
|
|
1245
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap :
|
|
1256
|
+
function ct(e, t, n, r, i, a) {
|
|
1257
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap : H(o, "x", t), d = l ? l.gap : H(o, "y", s), f = vt(e, t, s, u, d, e.subgrid ? {
|
|
1246
1258
|
col: e.subgrid.colSpan,
|
|
1247
1259
|
row: e.subgrid.rowSpan
|
|
1248
|
-
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) =>
|
|
1260
|
+
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) => W(e.style.margin, t)), C = p.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), w = p.map(lt), T = c ? dt(c) : Nt(_, y, ft(f, w, x, a), t, u, o.justifyContent === "stretch"), E = c ? c.positions : Pt(T, t, o.justifyContent), D = [];
|
|
1249
1261
|
for (let e = 0; e < p.length; e++) {
|
|
1250
|
-
let t = p[e], n = m.items[e], r =
|
|
1262
|
+
let t = p[e], n = m.items[e], r = It(E, T.sizes, n.col.start, n.col.span), i = x[e], o = Math.max(0, r - St(i)), s = w[e];
|
|
1251
1263
|
if (s.cols || s.rows) {
|
|
1252
|
-
let e = s.cols ?
|
|
1264
|
+
let e = s.cols ? ut(E, T, u, n.col.start, n.col.span, mt(t, "cols", i, r)) : void 0;
|
|
1253
1265
|
t.subgrid = {
|
|
1254
1266
|
colSpan: n.col.span,
|
|
1255
1267
|
rowSpan: n.row.span,
|
|
@@ -1258,26 +1270,26 @@ function ot(e, t, n, r, i, a) {
|
|
|
1258
1270
|
};
|
|
1259
1271
|
} else t.subgrid = void 0;
|
|
1260
1272
|
let c = C[e], l = i.left === null || i.right === null, d = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
1261
|
-
s.cols ?
|
|
1273
|
+
s.cols ? B(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !d ? B(t, r, void 0, 0, 0, "fill", a, { width: V(o, t.style.minWidth === "auto" ? t.style.overflow.x === "visible" ? Y(t, a) : 0 : G(t.style.minWidth, r) ?? 0, Kn(t.style.maxWidth, r, t, a)) }) : B(t, o, void 0, 0, 0, "shrink", a), D.push(t.localRect.width);
|
|
1262
1274
|
}
|
|
1263
|
-
let O = l ?
|
|
1275
|
+
let O = l ? dt(l) : Nt(v, b, pt(f, w, x), s ?? "max-content", d, o.alignContent === "stretch"), k = Ft(O), A = l ? l.positions : Pt(O, s ?? k, o.alignContent), j = r.left + i.left, M = r.top + i.top;
|
|
1264
1276
|
for (let t = 0; t < p.length; t++) {
|
|
1265
|
-
let n = p[t], r = m.items[t], i = x[t], o =
|
|
1266
|
-
if (w[t].rows) n.subgrid.rows =
|
|
1277
|
+
let n = p[t], r = m.items[t], i = x[t], o = It(E, T.sizes, r.col.start, r.col.span), s = It(A, O.sizes, r.row.start, r.row.span), c = Math.max(0, s - Ct(i)), l = Ye(n, e), u = i.top === null || i.bottom === null, f = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
1278
|
+
if (w[t].rows) n.subgrid.rows = ut(A, O, d, r.row.start, r.row.span, mt(n, "rows", i, o)), B(n, o, s, 0, 0, "fill", a, {
|
|
1267
1279
|
width: D[t],
|
|
1268
1280
|
height: c
|
|
1269
1281
|
});
|
|
1270
1282
|
else if (l === "stretch" && !u && !f) {
|
|
1271
|
-
let e =
|
|
1272
|
-
e !== n.localRect.height &&
|
|
1283
|
+
let e = V(c, n.style.minHeight === "auto" ? n.style.overflow.y === "visible" ? n.localRect.height : 0 : G(n.style.minHeight, s) ?? 0, G(n.style.maxHeight, s));
|
|
1284
|
+
e !== n.localRect.height && B(n, o, s, 0, 0, "fill", a, {
|
|
1273
1285
|
width: D[t],
|
|
1274
1286
|
height: e
|
|
1275
1287
|
});
|
|
1276
|
-
} else n.style.height?.kind === "percent" &&
|
|
1288
|
+
} else n.style.height?.kind === "percent" && B(n, o, s, 0, 0, "fill", a, { width: D[t] });
|
|
1277
1289
|
n.localRect = {
|
|
1278
1290
|
...n.localRect,
|
|
1279
|
-
x: j + E[r.col.start] +
|
|
1280
|
-
y: M + A[r.row.start] +
|
|
1291
|
+
x: j + E[r.col.start] + Lt(C[t], i.left, i.right, o, n.localRect.width),
|
|
1292
|
+
y: M + A[r.row.start] + Lt(l, i.top, i.bottom, s, n.localRect.height)
|
|
1281
1293
|
};
|
|
1282
1294
|
}
|
|
1283
1295
|
let N = Number.isFinite(n) ? Math.max(n, k) : k;
|
|
@@ -1316,9 +1328,9 @@ function ot(e, t, n, r, i, a) {
|
|
|
1316
1328
|
padding: i
|
|
1317
1329
|
});
|
|
1318
1330
|
}
|
|
1319
|
-
let ee = e.children.filter((e) =>
|
|
1331
|
+
let ee = e.children.filter((e) => z(e.style));
|
|
1320
1332
|
if (ee.length > 0) {
|
|
1321
|
-
let e =
|
|
1333
|
+
let e = z(o) ? {
|
|
1322
1334
|
x: r.left,
|
|
1323
1335
|
y: r.top,
|
|
1324
1336
|
width: i.left + t + i.right,
|
|
@@ -1330,7 +1342,7 @@ function ot(e, t, n, r, i, a) {
|
|
|
1330
1342
|
height: N
|
|
1331
1343
|
};
|
|
1332
1344
|
for (let n of ee) {
|
|
1333
|
-
let r =
|
|
1345
|
+
let r = gt(n.style.gridColumnStart, n.style.gridColumnEnd, h, m.colOrigin, E, T.sizes, -i.left, t + i.right), a = gt(n.style.gridRowStart, n.style.gridRowEnd, g, m.rowOrigin, A, O.sizes, -i.top, N + i.bottom);
|
|
1334
1346
|
n.staticSlot = {
|
|
1335
1347
|
kind: "grid",
|
|
1336
1348
|
area: {
|
|
@@ -1345,14 +1357,14 @@ function ot(e, t, n, r, i, a) {
|
|
|
1345
1357
|
}
|
|
1346
1358
|
return N;
|
|
1347
1359
|
}
|
|
1348
|
-
function
|
|
1360
|
+
function lt(e) {
|
|
1349
1361
|
let t = e.style.display === "grid";
|
|
1350
1362
|
return {
|
|
1351
1363
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
1352
1364
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
1353
1365
|
};
|
|
1354
1366
|
}
|
|
1355
|
-
function
|
|
1367
|
+
function ut(e, t, n, r, i, a) {
|
|
1356
1368
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
1357
1369
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
1358
1370
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -1361,20 +1373,20 @@ function ct(e, t, n, r, i, a) {
|
|
|
1361
1373
|
gap: n
|
|
1362
1374
|
};
|
|
1363
1375
|
}
|
|
1364
|
-
function
|
|
1376
|
+
function dt(e) {
|
|
1365
1377
|
return {
|
|
1366
1378
|
sizes: e.sizes,
|
|
1367
1379
|
gapBefore: e.gapBefore,
|
|
1368
1380
|
limits: e.sizes
|
|
1369
1381
|
};
|
|
1370
1382
|
}
|
|
1371
|
-
function
|
|
1383
|
+
function ft(e, t, n, r) {
|
|
1372
1384
|
let i = [];
|
|
1373
1385
|
return e.children.forEach((a, o) => {
|
|
1374
1386
|
let s = e.placed.items[o], c = n[o];
|
|
1375
1387
|
if (t[o].cols) {
|
|
1376
|
-
let e =
|
|
1377
|
-
for (let t of
|
|
1388
|
+
let e = mt(a, "cols", c, 0);
|
|
1389
|
+
for (let t of ht(a, "cols", s, e, r)) i.push({
|
|
1378
1390
|
...t,
|
|
1379
1391
|
start: t.start + s.col.start
|
|
1380
1392
|
});
|
|
@@ -1383,24 +1395,24 @@ function ut(e, t, n, r) {
|
|
|
1383
1395
|
i.push({
|
|
1384
1396
|
start: s.col.start,
|
|
1385
1397
|
span: s.col.span,
|
|
1386
|
-
min:
|
|
1387
|
-
max:
|
|
1398
|
+
min: J(a, "min", r) + St(c),
|
|
1399
|
+
max: J(a, "max", r) + St(c)
|
|
1388
1400
|
});
|
|
1389
1401
|
}), i;
|
|
1390
1402
|
}
|
|
1391
|
-
function
|
|
1403
|
+
function pt(e, t, n) {
|
|
1392
1404
|
let r = [];
|
|
1393
1405
|
return e.children.forEach((i, a) => {
|
|
1394
1406
|
let o = e.placed.items[a], s = n[a];
|
|
1395
1407
|
if (t[a].rows) {
|
|
1396
|
-
let e =
|
|
1397
|
-
for (let t of
|
|
1408
|
+
let e = mt(i, "rows", s, 0);
|
|
1409
|
+
for (let t of ht(i, "rows", o, e)) r.push({
|
|
1398
1410
|
...t,
|
|
1399
1411
|
start: t.start + o.row.start
|
|
1400
1412
|
});
|
|
1401
1413
|
return;
|
|
1402
1414
|
}
|
|
1403
|
-
let c = i.localRect.height +
|
|
1415
|
+
let c = i.localRect.height + Ct(s), l = i.style.minHeight === "auto" && i.style.overflow.y !== "visible" ? Ct(s) : c;
|
|
1404
1416
|
r.push({
|
|
1405
1417
|
start: o.row.start,
|
|
1406
1418
|
span: o.row.span,
|
|
@@ -1409,25 +1421,25 @@ function dt(e, t, n) {
|
|
|
1409
1421
|
});
|
|
1410
1422
|
}), r;
|
|
1411
1423
|
}
|
|
1412
|
-
function
|
|
1424
|
+
function mt(e, t, n, r) {
|
|
1413
1425
|
let { border: i, padding: a } = e.style;
|
|
1414
1426
|
return t === "cols" ? {
|
|
1415
|
-
start: (n.left ?? 0) + i.left +
|
|
1416
|
-
end: (n.right ?? 0) + i.right +
|
|
1427
|
+
start: (n.left ?? 0) + i.left + U(a.left, r),
|
|
1428
|
+
end: (n.right ?? 0) + i.right + U(a.right, r)
|
|
1417
1429
|
} : {
|
|
1418
|
-
start: (n.top ?? 0) + i.top +
|
|
1419
|
-
end: (n.bottom ?? 0) + i.bottom +
|
|
1430
|
+
start: (n.top ?? 0) + i.top + U(a.top, r),
|
|
1431
|
+
end: (n.bottom ?? 0) + i.bottom + U(a.bottom, r)
|
|
1420
1432
|
};
|
|
1421
1433
|
}
|
|
1422
|
-
function
|
|
1423
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
1434
|
+
function ht(e, t, n, r, i) {
|
|
1435
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = vt(e, void 0, void 0, 0, 0, {
|
|
1424
1436
|
col: n.col.span,
|
|
1425
1437
|
row: n.row.span
|
|
1426
1438
|
}), s = [];
|
|
1427
1439
|
if (o.children.forEach((e, n) => {
|
|
1428
|
-
let c = o.placed.items[n], l = t === "cols" ? c.col : c.row, u = l.start === 0, d = l.start + l.span === a, f = (u ? r.start : 0) + (d ? r.end : 0), p =
|
|
1429
|
-
if (
|
|
1430
|
-
let n =
|
|
1440
|
+
let c = o.placed.items[n], l = t === "cols" ? c.col : c.row, u = l.start === 0, d = l.start + l.span === a, f = (u ? r.start : 0) + (d ? r.end : 0), p = W(e.style.margin, 0);
|
|
1441
|
+
if (lt(e)[t]) {
|
|
1442
|
+
let n = mt(e, t, p, 0), a = ht(e, t, c, {
|
|
1431
1443
|
start: n.start + (u ? r.start : 0),
|
|
1432
1444
|
end: n.end + (d ? r.end : 0)
|
|
1433
1445
|
}, i);
|
|
@@ -1440,11 +1452,11 @@ function pt(e, t, n, r, i) {
|
|
|
1440
1452
|
if (t === "cols") s.push({
|
|
1441
1453
|
start: l.start,
|
|
1442
1454
|
span: l.span,
|
|
1443
|
-
min:
|
|
1444
|
-
max:
|
|
1455
|
+
min: J(e, "min", i) + St(p) + f,
|
|
1456
|
+
max: J(e, "max", i) + St(p) + f
|
|
1445
1457
|
});
|
|
1446
1458
|
else {
|
|
1447
|
-
let t = e.localRect.height +
|
|
1459
|
+
let t = e.localRect.height + Ct(p) + f;
|
|
1448
1460
|
s.push({
|
|
1449
1461
|
start: l.start,
|
|
1450
1462
|
span: l.span,
|
|
@@ -1463,9 +1475,9 @@ function pt(e, t, n, r, i) {
|
|
|
1463
1475
|
}
|
|
1464
1476
|
return s;
|
|
1465
1477
|
}
|
|
1466
|
-
function
|
|
1467
|
-
let c =
|
|
1468
|
-
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l =
|
|
1478
|
+
function gt(e, t, n, r, i, a, o, s) {
|
|
1479
|
+
let c = kt(e, "start", n), l = kt(t, "end", n);
|
|
1480
|
+
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = At(c, t, 1, n) : l !== null && e.kind === "span" && (c = At(l, e, -1, n));
|
|
1469
1481
|
let u = i.length, d = (e) => {
|
|
1470
1482
|
if (e === null) return;
|
|
1471
1483
|
let t = e - r;
|
|
@@ -1476,22 +1488,22 @@ function mt(e, t, n, r, i, a, o, s) {
|
|
|
1476
1488
|
end: h === void 0 ? s : p(h)
|
|
1477
1489
|
};
|
|
1478
1490
|
}
|
|
1479
|
-
function
|
|
1491
|
+
function _t(e, t) {
|
|
1480
1492
|
let n = t.gridIntrinsic.get(e);
|
|
1481
1493
|
if (n !== void 0) return n;
|
|
1482
|
-
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a =
|
|
1494
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = vt(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
1483
1495
|
col: e.subgrid.colSpan,
|
|
1484
1496
|
row: e.subgrid.rowSpan
|
|
1485
|
-
} : void 0), o = a.children.map(
|
|
1497
|
+
} : void 0), o = a.children.map(lt), s = a.children.map((e) => W(e.style.margin, 0)), c = Nt(a.colTracks, a.colCollapsed, ft(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
1486
1498
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
1487
1499
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
1488
1500
|
};
|
|
1489
1501
|
return t.gridIntrinsic.set(e, u), u;
|
|
1490
1502
|
}
|
|
1491
|
-
function
|
|
1492
|
-
let o = e.style, s =
|
|
1503
|
+
function vt(e, t, n, r, i, a) {
|
|
1504
|
+
let o = e.style, s = xt(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? yt(a.col) : wt(o.gridTemplateColumns, t, r), d = l ? yt(a.row) : wt(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
1493
1505
|
if (f) {
|
|
1494
|
-
c ||
|
|
1506
|
+
c || Et(p, u.lineNames, f.columns, o.gridAutoColumns), l || Et(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
1495
1507
|
for (let [e, t] of f.areas) u.lineNames[Math.min(t.colStart, p.length)].push(`${e}-start`), u.lineNames[Math.min(t.colEnd, p.length)].push(`${e}-end`), d.lineNames[Math.min(t.rowStart, m.length)].push(`${e}-start`), d.lineNames[Math.min(t.rowEnd, m.length)].push(`${e}-end`);
|
|
1496
1508
|
}
|
|
1497
1509
|
let h = {
|
|
@@ -1500,28 +1512,28 @@ function gt(e, t, n, r, i, a) {
|
|
|
1500
1512
|
}, g = {
|
|
1501
1513
|
explicitCount: m.length,
|
|
1502
1514
|
names: d.lineNames
|
|
1503
|
-
}, _ =
|
|
1504
|
-
col:
|
|
1505
|
-
row:
|
|
1515
|
+
}, _ = Mt(s.map((e) => ({
|
|
1516
|
+
col: jt(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
1517
|
+
row: jt(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
1506
1518
|
})), p.length, m.length, o.gridAutoFlow);
|
|
1507
|
-
return c &&
|
|
1519
|
+
return c && bt(_, "col", p.length), l && bt(_, "row", m.length), {
|
|
1508
1520
|
children: s,
|
|
1509
1521
|
placed: _,
|
|
1510
1522
|
colLines: h,
|
|
1511
1523
|
rowLines: g,
|
|
1512
|
-
colTracks:
|
|
1513
|
-
rowTracks:
|
|
1514
|
-
colCollapsed:
|
|
1515
|
-
rowCollapsed:
|
|
1524
|
+
colTracks: Dt(p, _.colOrigin, _.colCount, o.gridAutoColumns),
|
|
1525
|
+
rowTracks: Dt(m, _.rowOrigin, _.rowCount, o.gridAutoRows),
|
|
1526
|
+
colCollapsed: Ot(u, _.colOrigin, _.colCount, _.items.map((e) => e.col)),
|
|
1527
|
+
rowCollapsed: Ot(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
1516
1528
|
};
|
|
1517
1529
|
}
|
|
1518
|
-
function
|
|
1530
|
+
function yt(e) {
|
|
1519
1531
|
return {
|
|
1520
|
-
tracks: Array.from({ length: e }, () =>
|
|
1532
|
+
tracks: Array.from({ length: e }, () => st()),
|
|
1521
1533
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
1522
1534
|
};
|
|
1523
1535
|
}
|
|
1524
|
-
function
|
|
1536
|
+
function bt(e, t, n) {
|
|
1525
1537
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
1526
1538
|
for (let i of e.items) {
|
|
1527
1539
|
let e = i[t], a = Math.min(Math.max(e.start + r, 0), n - 1), o = Math.min(Math.max(e.start + r + e.span, a + 1), n);
|
|
@@ -1529,22 +1541,16 @@ function vt(e, t, n) {
|
|
|
1529
1541
|
}
|
|
1530
1542
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
1531
1543
|
}
|
|
1532
|
-
function
|
|
1533
|
-
return e.children.filter((e) => !
|
|
1544
|
+
function xt(e) {
|
|
1545
|
+
return e.children.filter((e) => !z(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1534
1546
|
}
|
|
1535
|
-
function
|
|
1547
|
+
function St(e) {
|
|
1536
1548
|
return (e.left ?? 0) + (e.right ?? 0);
|
|
1537
1549
|
}
|
|
1538
|
-
function
|
|
1550
|
+
function Ct(e) {
|
|
1539
1551
|
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
1540
1552
|
}
|
|
1541
|
-
function
|
|
1542
|
-
let r = e.style, i;
|
|
1543
|
-
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = q(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? Y(e, n) : J(e, n));
|
|
1544
|
-
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1545
|
-
return Math.max(0, H(i, a, o));
|
|
1546
|
-
}
|
|
1547
|
-
function Ct(e, t, n) {
|
|
1553
|
+
function wt(e, t, n) {
|
|
1548
1554
|
if (e.kind !== "tracks") return {
|
|
1549
1555
|
tracks: [],
|
|
1550
1556
|
lineNames: [[]]
|
|
@@ -1557,7 +1563,7 @@ function Ct(e, t, n) {
|
|
|
1557
1563
|
let { index: i, tracks: a, mode: o } = e.autoRepeat, s = 1;
|
|
1558
1564
|
if (t !== void 0) {
|
|
1559
1565
|
let e = a.reduce((e, n) => {
|
|
1560
|
-
let r =
|
|
1566
|
+
let r = Tt(n.min, t) ?? Tt(n.max, t) ?? 1;
|
|
1561
1567
|
return e + Math.max(1, r);
|
|
1562
1568
|
}, 0);
|
|
1563
1569
|
s = Math.max(1, Math.floor((t + n) / (e + n * a.length)));
|
|
@@ -1585,23 +1591,23 @@ function Ct(e, t, n) {
|
|
|
1585
1591
|
lineNames: d
|
|
1586
1592
|
};
|
|
1587
1593
|
}
|
|
1588
|
-
function
|
|
1594
|
+
function Tt(e, t) {
|
|
1589
1595
|
if (e.kind === "cells") return e.value;
|
|
1590
1596
|
if (e.kind === "percent" && t !== void 0) return we(e.value, t);
|
|
1591
1597
|
if (e.kind === "math") {
|
|
1592
1598
|
let n = [];
|
|
1593
1599
|
for (let r of e.args) {
|
|
1594
|
-
let e =
|
|
1600
|
+
let e = Tt(r, t);
|
|
1595
1601
|
if (e === void 0) return;
|
|
1596
1602
|
n.push(e);
|
|
1597
1603
|
}
|
|
1598
1604
|
return e.fn === "min" ? Math.min(...n) : Math.max(...n);
|
|
1599
1605
|
}
|
|
1600
1606
|
}
|
|
1601
|
-
function
|
|
1607
|
+
function Et(e, t, n, r) {
|
|
1602
1608
|
for (let i = e.length; i < n; i++) e.push(r[(i - e.length) % r.length]), t.push([]);
|
|
1603
1609
|
}
|
|
1604
|
-
function
|
|
1610
|
+
function Dt(e, t, n, r) {
|
|
1605
1611
|
let i = [];
|
|
1606
1612
|
for (let a = 0; a < n; a++) {
|
|
1607
1613
|
let n = a + t;
|
|
@@ -1613,7 +1619,7 @@ function Et(e, t, n, r) {
|
|
|
1613
1619
|
}
|
|
1614
1620
|
return i;
|
|
1615
1621
|
}
|
|
1616
|
-
function
|
|
1622
|
+
function Ot(e, t, n, r) {
|
|
1617
1623
|
let i = Array.from({ length: n }, () => !1);
|
|
1618
1624
|
if (!e.autoFit) return i;
|
|
1619
1625
|
for (let a = e.autoFit.start; a < e.autoFit.end; a++) {
|
|
@@ -1622,7 +1628,7 @@ function Dt(e, t, n, r) {
|
|
|
1622
1628
|
}
|
|
1623
1629
|
return i;
|
|
1624
1630
|
}
|
|
1625
|
-
function
|
|
1631
|
+
function kt(e, t, n) {
|
|
1626
1632
|
if (e.kind === "line") return e.value > 0 ? e.value - 1 : n.explicitCount + 1 + e.value;
|
|
1627
1633
|
if (e.kind !== "name") return null;
|
|
1628
1634
|
if (e.nth === void 0) {
|
|
@@ -1637,14 +1643,14 @@ function Ot(e, t, n) {
|
|
|
1637
1643
|
for (let t = i; t >= 0; t--) if (n.names[t].includes(e.name) && ++a === -r) return t;
|
|
1638
1644
|
return -(-r - a);
|
|
1639
1645
|
}
|
|
1640
|
-
function
|
|
1646
|
+
function At(e, t, n, r) {
|
|
1641
1647
|
if (t.name === void 0) return e + n * t.value;
|
|
1642
1648
|
let i = t.value, a = e;
|
|
1643
1649
|
for (; i > 0;) a += n, (!(a >= 0 && a <= r.explicitCount) || r.names[a].includes(t.name)) && i--;
|
|
1644
1650
|
return a;
|
|
1645
1651
|
}
|
|
1646
|
-
function
|
|
1647
|
-
let r =
|
|
1652
|
+
function jt(e, t, n) {
|
|
1653
|
+
let r = kt(e, "start", n), i = kt(t, "end", n);
|
|
1648
1654
|
if (r !== null && i !== null) return r === i ? {
|
|
1649
1655
|
start: r,
|
|
1650
1656
|
span: 1
|
|
@@ -1654,10 +1660,10 @@ function At(e, t, n) {
|
|
|
1654
1660
|
};
|
|
1655
1661
|
if (r !== null) return {
|
|
1656
1662
|
start: r,
|
|
1657
|
-
span: (t.kind === "span" ?
|
|
1663
|
+
span: (t.kind === "span" ? At(r, t, 1, n) : r + 1) - r
|
|
1658
1664
|
};
|
|
1659
1665
|
if (i !== null) {
|
|
1660
|
-
let t = e.kind === "span" ?
|
|
1666
|
+
let t = e.kind === "span" ? At(i, e, -1, n) : i - 1;
|
|
1661
1667
|
return {
|
|
1662
1668
|
start: t,
|
|
1663
1669
|
span: i - t
|
|
@@ -1668,7 +1674,7 @@ function At(e, t, n) {
|
|
|
1668
1674
|
span: e.kind === "span" ? e.value : t.kind === "span" ? t.value : 1
|
|
1669
1675
|
};
|
|
1670
1676
|
}
|
|
1671
|
-
function
|
|
1677
|
+
function Mt(e, t, n, r) {
|
|
1672
1678
|
let i = r.direction === "row", a = e.map((e) => i ? e.row : e.col), o = e.map((e) => i ? e.col : e.row), s = i ? t : n, c = i ? n : t, l = 0, u = Math.max(s, 1);
|
|
1673
1679
|
for (let t = 0; t < e.length; t++) {
|
|
1674
1680
|
let e = o[t];
|
|
@@ -1765,7 +1771,7 @@ function jt(e, t, n, r) {
|
|
|
1765
1771
|
rowCount: S
|
|
1766
1772
|
};
|
|
1767
1773
|
}
|
|
1768
|
-
function
|
|
1774
|
+
function Nt(e, t, n, r, i, a) {
|
|
1769
1775
|
let o = typeof r == "number" ? r : void 0, s = e.map((e, n) => {
|
|
1770
1776
|
if (t[n]) return {
|
|
1771
1777
|
base: 0,
|
|
@@ -1775,7 +1781,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1775
1781
|
frFactor: 0,
|
|
1776
1782
|
collapsed: !0
|
|
1777
1783
|
};
|
|
1778
|
-
let r =
|
|
1784
|
+
let r = Tt(e.min, o), i = r ?? 0, a = r === void 0, s = e.max;
|
|
1779
1785
|
if (s.kind === "fr") return {
|
|
1780
1786
|
base: i,
|
|
1781
1787
|
limit: null,
|
|
@@ -1784,7 +1790,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1784
1790
|
frFactor: s.value,
|
|
1785
1791
|
collapsed: !1
|
|
1786
1792
|
};
|
|
1787
|
-
let c =
|
|
1793
|
+
let c = Tt(s, o);
|
|
1788
1794
|
return c === void 0 ? {
|
|
1789
1795
|
base: i,
|
|
1790
1796
|
limit: null,
|
|
@@ -1909,65 +1915,65 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1909
1915
|
limits: s.map((e) => u(e))
|
|
1910
1916
|
};
|
|
1911
1917
|
}
|
|
1912
|
-
function
|
|
1913
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t -
|
|
1918
|
+
function Pt(e, t, n) {
|
|
1919
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - Ft(e)), o = L(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1914
1920
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1915
1921
|
return s;
|
|
1916
1922
|
}
|
|
1917
|
-
function
|
|
1923
|
+
function Ft(e) {
|
|
1918
1924
|
return e.sizes.reduce((e, t) => e + t, 0) + e.gapBefore.reduce((e, t) => e + t, 0);
|
|
1919
1925
|
}
|
|
1920
|
-
function
|
|
1926
|
+
function It(e, t, n, r) {
|
|
1921
1927
|
let i = n + r - 1;
|
|
1922
1928
|
return e[n] === void 0 || e[i] === void 0 ? 0 : e[i] + t[i] - e[n];
|
|
1923
1929
|
}
|
|
1924
|
-
function
|
|
1930
|
+
function Lt(e, t, n, r, i) {
|
|
1925
1931
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1926
|
-
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a +
|
|
1932
|
+
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + Xe(e, r, i + a + o);
|
|
1927
1933
|
}
|
|
1928
1934
|
//#endregion
|
|
1929
1935
|
//#region src/multicol.ts
|
|
1930
|
-
function
|
|
1936
|
+
function Rt(e, t, n) {
|
|
1931
1937
|
let r = e.columnWidth === null ? null : Math.max(1, Math.floor((t + n) / (e.columnWidth + n)));
|
|
1932
1938
|
return e.columnCount !== null && r !== null ? Math.max(1, Math.min(e.columnCount, r)) : r === null ? Math.max(1, e.columnCount ?? 1) : r;
|
|
1933
1939
|
}
|
|
1934
|
-
function
|
|
1935
|
-
let r =
|
|
1940
|
+
function zt(e, t, n) {
|
|
1941
|
+
let r = Rt(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r)), a = Math.max(0, t - (r * i + (r - 1) * n));
|
|
1936
1942
|
return Array.from({ length: r }, (e, t) => i + +(t < a));
|
|
1937
1943
|
}
|
|
1938
|
-
function
|
|
1944
|
+
function Bt(e, t) {
|
|
1939
1945
|
let n = Math.max(typeof e.gapX == "number" ? e.gapX : 0, e.ruleX?.width ?? 0);
|
|
1940
1946
|
return e.columnCount === null ? Math.max(e.columnWidth ?? 1, t) : e.columnCount * t + (e.columnCount - 1) * n;
|
|
1941
1947
|
}
|
|
1942
|
-
function
|
|
1948
|
+
function Vt(e, t) {
|
|
1943
1949
|
return e === void 0 ? t : t === void 0 ? e : Math.min(e, t);
|
|
1944
1950
|
}
|
|
1945
|
-
function
|
|
1951
|
+
function Ht(e, t, n) {
|
|
1946
1952
|
for (; e < t;) {
|
|
1947
1953
|
let r = e + t >> 1;
|
|
1948
1954
|
n(r) ? t = r : e = r + 1;
|
|
1949
1955
|
}
|
|
1950
1956
|
return e;
|
|
1951
1957
|
}
|
|
1952
|
-
function
|
|
1953
|
-
let r =
|
|
1958
|
+
function Ut(e, t, n) {
|
|
1959
|
+
let r = Rt(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r));
|
|
1954
1960
|
return {
|
|
1955
1961
|
count: r,
|
|
1956
1962
|
width: i,
|
|
1957
1963
|
leftover: Math.max(0, t - (r * i + (r - 1) * n))
|
|
1958
1964
|
};
|
|
1959
1965
|
}
|
|
1960
|
-
function
|
|
1966
|
+
function Wt(e, t, n) {
|
|
1961
1967
|
return e === "all" ? !0 : e === "around" ? t || n : t && n;
|
|
1962
1968
|
}
|
|
1963
|
-
function
|
|
1964
|
-
let i =
|
|
1969
|
+
function Gt(e, t, n, r) {
|
|
1970
|
+
let i = Un(e, Math.max(1, t.width - e.style.tracking)), { heights: a, textOffsets: o } = Wn(e, i), s = e.style.lineGap, c = qt(a.map((e) => e + s)), l;
|
|
1965
1971
|
if (e.style.columnFill === "auto" && r !== void 0) l = Math.max(1, r);
|
|
1966
1972
|
else {
|
|
1967
|
-
let e =
|
|
1973
|
+
let e = Ht(c.reduce((e, t) => Math.max(e, t.rows - s), 1), Math.max(1, c.reduce((e, t) => e + t.rows, 0) - s), (e) => Kt(c, s, e).columns <= t.count);
|
|
1968
1974
|
l = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1969
1975
|
}
|
|
1970
|
-
let u =
|
|
1976
|
+
let u = Kt(c, s, l);
|
|
1971
1977
|
return {
|
|
1972
1978
|
spans: i,
|
|
1973
1979
|
lineY: u.top,
|
|
@@ -1980,7 +1986,7 @@ function Wt(e, t, n, r) {
|
|
|
1980
1986
|
columnsUsed: i.length > 0 ? u.columns : 0
|
|
1981
1987
|
};
|
|
1982
1988
|
}
|
|
1983
|
-
function
|
|
1989
|
+
function Kt(e, t, n, r = "truncate") {
|
|
1984
1990
|
let i = 0, a = 0, o = 0, s = [], c = [];
|
|
1985
1991
|
for (let l = 0; l < e.length; l++) {
|
|
1986
1992
|
let u = e[l], d = r === "glue" || l === 0 || a > 0 ? u.pre : 0;
|
|
@@ -2001,7 +2007,7 @@ function Gt(e, t, n, r = "truncate") {
|
|
|
2001
2007
|
top: c
|
|
2002
2008
|
};
|
|
2003
2009
|
}
|
|
2004
|
-
function
|
|
2010
|
+
function qt(e) {
|
|
2005
2011
|
return e.map((e) => ({
|
|
2006
2012
|
rows: e,
|
|
2007
2013
|
pre: 0,
|
|
@@ -2010,27 +2016,27 @@ function Kt(e) {
|
|
|
2010
2016
|
lines: 1
|
|
2011
2017
|
}));
|
|
2012
2018
|
}
|
|
2013
|
-
var
|
|
2014
|
-
function
|
|
2015
|
-
if (
|
|
2019
|
+
var Jt = null;
|
|
2020
|
+
function Yt() {
|
|
2021
|
+
if (Jt !== null) return Jt;
|
|
2016
2022
|
let e = document.createElement("div");
|
|
2017
2023
|
e.style.cssText = "position:absolute;left:-9999px;visibility:hidden;columns:2;column-gap:0;column-fill:balance;width:200px;font:10px/20px monospace;orphans:1;widows:1", e.innerHTML = "<div style=\"margin:0;padding:0 0 20px 0\">aaaaaa aaaaaa aaaaaa</div><div style=\"margin:0\"><span>bbbbbb</span> bbbbbb</div>", document.body.appendChild(e);
|
|
2018
2024
|
let t = e.getBoundingClientRect().top, n = e.querySelector("span").getBoundingClientRect();
|
|
2019
|
-
return e.remove(),
|
|
2025
|
+
return e.remove(), Jt = !(n.width > 0 && n.top - t >= 10), Jt;
|
|
2020
2026
|
}
|
|
2021
|
-
function
|
|
2027
|
+
function Xt(e, t) {
|
|
2022
2028
|
let { columnWidth: n, columnCount: r, tracking: i = 0, lineGap: a = 0, restrictingHeight: o } = t, s = i > 0 ? Array.from(e, () => 1 + i) : void 0, c = je(e, Math.max(1, n - i), {
|
|
2023
2029
|
advances: s,
|
|
2024
2030
|
tracking: i,
|
|
2025
2031
|
firstLineIndent: t.firstLineIndent
|
|
2026
|
-
}), l =
|
|
2032
|
+
}), l = qt(c.map(() => 1 + a)), u = Kt(l, a, o ?? Ht(1, Math.max(1, c.length * (1 + a) - a), (e) => Kt(l, a, e).columns <= r));
|
|
2027
2033
|
return c.map((t, n) => ({
|
|
2028
2034
|
text: e.slice(t.start, t.end),
|
|
2029
2035
|
column: u.column[n],
|
|
2030
2036
|
top: u.top[n]
|
|
2031
2037
|
}));
|
|
2032
2038
|
}
|
|
2033
|
-
function
|
|
2039
|
+
function Zt(e, t, n, r) {
|
|
2034
2040
|
let i = e.style;
|
|
2035
2041
|
if (!i.ruleX) return;
|
|
2036
2042
|
let a = t.columnCount * t.columnWidth + (t.columnCount - 1) * t.gap, o = t.ruleSegments ?? [{
|
|
@@ -2040,7 +2046,7 @@ function Xt(e, t, n, r) {
|
|
|
2040
2046
|
}], s = [];
|
|
2041
2047
|
for (let e of o) {
|
|
2042
2048
|
let n = Math.min(e.columns, t.columnCount);
|
|
2043
|
-
for (let r = 0; r < t.columnCount - 1; r++)
|
|
2049
|
+
for (let r = 0; r < t.columnCount - 1; r++) Wt(i.ruleVisibilityItems, r < n, r + 1 < n) && s.push({
|
|
2044
2050
|
bandStart: (r + 1) * t.columnWidth + r * t.gap,
|
|
2045
2051
|
bandSize: t.gap,
|
|
2046
2052
|
start: e.start,
|
|
@@ -2061,12 +2067,12 @@ function Xt(e, t, n, r) {
|
|
|
2061
2067
|
padding: r
|
|
2062
2068
|
});
|
|
2063
2069
|
}
|
|
2064
|
-
function
|
|
2070
|
+
function Qt(e, t) {
|
|
2065
2071
|
let n = e.style, r = n.padding;
|
|
2066
2072
|
return e.text !== "" && e.children.length === 0 && n.display === "block" && n.position === "static" && !n.columnSpan && n.whiteSpace === "normal" && n.lineGap === t.lineGap && n.border.top === 0 && n.border.right === 0 && n.border.bottom === 0 && n.border.left === 0 && r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0 && n.backgroundColor === void 0 && !n.backgroundClear && n.overflow.x === "visible" && n.overflow.y === "visible" && (n.width === void 0 || n.width.kind === "auto") && (n.height === void 0 || n.height.kind === "auto") && (n.minWidth === "auto" || n.minWidth === 0 || n.minWidth === void 0) && (n.minHeight === "auto" || n.minHeight === 0 || n.minHeight === void 0) && n.maxWidth === void 0 && n.maxHeight === void 0;
|
|
2067
2073
|
}
|
|
2068
|
-
function
|
|
2069
|
-
let s = e.style, c =
|
|
2074
|
+
function $t(e, t, n, r, i, a, o) {
|
|
2075
|
+
let s = e.style, c = H(s, "x", n), l = Ut(s, n, c);
|
|
2070
2076
|
a.right += l.leftover;
|
|
2071
2077
|
let u = s.lineGap, d = i.left + a.left, f = i.top + a.top, p = n - l.leftover, m = [[]], h = [];
|
|
2072
2078
|
for (let e of t) e.style.columnSpan ? (h[m.length - 1] = e, m.push([])) : m[m.length - 1].push(e);
|
|
@@ -2076,13 +2082,13 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2076
2082
|
if (t.length > 0) {
|
|
2077
2083
|
let i = t.map((e) => ({
|
|
2078
2084
|
node: e,
|
|
2079
|
-
spans:
|
|
2080
|
-
margin:
|
|
2085
|
+
spans: Un(e, Math.max(1, l.width - e.style.tracking)),
|
|
2086
|
+
margin: W(e.style.margin, l.width),
|
|
2081
2087
|
pre: 0,
|
|
2082
2088
|
post: 0
|
|
2083
2089
|
})), a = [], o = null, h = null, x = !1;
|
|
2084
2090
|
for (let e of i) {
|
|
2085
|
-
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 :
|
|
2091
|
+
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 : Yn(o, r.top ?? 0), s = i;
|
|
2086
2092
|
_ === "glue" && h !== null ? (s = 0, h.post = i, a[a.length - 1].post = i) : e.pre = i;
|
|
2087
2093
|
let c = x || t.style.breakBeforeColumn;
|
|
2088
2094
|
if (t.style.breakInsideAvoid && n.length > 0) a.push({
|
|
@@ -2105,10 +2111,10 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2105
2111
|
let S;
|
|
2106
2112
|
if (s.columnFill === "auto" && r !== void 0) S = Math.max(1, r);
|
|
2107
2113
|
else {
|
|
2108
|
-
let e =
|
|
2114
|
+
let e = Ht(1, Math.max(1, Kt(a, u, Infinity, _).maxUsed), (e) => Kt(a, u, e, _).columns <= l.count);
|
|
2109
2115
|
S = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
2110
2116
|
}
|
|
2111
|
-
let C =
|
|
2117
|
+
let C = Kt(a, u, S, _);
|
|
2112
2118
|
for (let e = 0, t = 0; e < i.length; e++) {
|
|
2113
2119
|
let { node: n, spans: r, margin: a, pre: o, post: s } = i[e], u = [], m = [];
|
|
2114
2120
|
for (let e = 0; e < r.length; e++, t++) u.push(y + C.top[t]), m.push(C.column[t] * (l.width + c));
|
|
@@ -2147,9 +2153,9 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2147
2153
|
}
|
|
2148
2154
|
let i = h[e];
|
|
2149
2155
|
if (i) {
|
|
2150
|
-
let e =
|
|
2151
|
-
|
|
2152
|
-
let r =
|
|
2156
|
+
let e = W(i.style.margin, p), t = (e.left ?? 0) + (e.right ?? 0);
|
|
2157
|
+
B(i, Math.max(0, p - t), void 0, 0, 0, "fill", o);
|
|
2158
|
+
let r = Jn(e, p, i.localRect.width), a = (e.top ?? 0) + n;
|
|
2153
2159
|
y += a, i.localRect = {
|
|
2154
2160
|
...i.localRect,
|
|
2155
2161
|
x: d + r,
|
|
@@ -2164,8 +2170,8 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2164
2170
|
}
|
|
2165
2171
|
let x = y;
|
|
2166
2172
|
for (let t of e.children) {
|
|
2167
|
-
if (!
|
|
2168
|
-
let e =
|
|
2173
|
+
if (!z(t.style)) continue;
|
|
2174
|
+
let e = W(t.style.margin, n);
|
|
2169
2175
|
t.staticSlot = {
|
|
2170
2176
|
kind: "block",
|
|
2171
2177
|
x: d + (e.left ?? 0),
|
|
@@ -2188,10 +2194,10 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2188
2194
|
} : {}
|
|
2189
2195
|
}, x;
|
|
2190
2196
|
}
|
|
2191
|
-
function
|
|
2192
|
-
let s = e.style, c =
|
|
2193
|
-
if (u.length > 0 && u.every((e) =>
|
|
2194
|
-
let f =
|
|
2197
|
+
function en(e, t, n, r, i, a, o) {
|
|
2198
|
+
let s = e.style, c = Vt(n, r), l = e.children.filter((e) => !z(e.style)), u = l.filter((e) => !e.style.columnSpan), d = l.reduce((e, t, n) => !t.style.columnSpan && (n === 0 || l[n - 1].style.columnSpan) ? e + 1 : e, 0);
|
|
2199
|
+
if (u.length > 0 && u.every((e) => Qt(e, s)) && (u.length === l.length || s.columnFill === "balance" && c === void 0 && (Yt() || d <= 1 && u.every((e) => (e.style.margin.top === 0 || e.style.margin.top === null) && (e.style.margin.bottom === 0 || e.style.margin.bottom === null))))) return $t(e, l, t, c, i, a, o);
|
|
2200
|
+
let f = H(s, "x", t), p = zt(s, t, f), m = p.length, h = [];
|
|
2195
2201
|
{
|
|
2196
2202
|
let e = 0;
|
|
2197
2203
|
for (let t of p) h.push(e), e += t + f;
|
|
@@ -2200,7 +2206,7 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2200
2206
|
let r = 0, i = 0, a = null, s = 0, c = (e) => {
|
|
2201
2207
|
if (t) for (let t of T) {
|
|
2202
2208
|
if (t.index !== e) continue;
|
|
2203
|
-
let n = a === null ? t.margin.top ?? 0 :
|
|
2209
|
+
let n = a === null ? t.margin.top ?? 0 : Yn(a, t.margin.top ?? 0);
|
|
2204
2210
|
t.child.staticSlot = {
|
|
2205
2211
|
kind: "block",
|
|
2206
2212
|
x: y + g(r) + (t.margin.left ?? 0),
|
|
@@ -2211,16 +2217,16 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2211
2217
|
for (let l = 0; l < w.length; l++) {
|
|
2212
2218
|
let u = w[l];
|
|
2213
2219
|
c(l);
|
|
2214
|
-
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 :
|
|
2220
|
+
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 : Yn(a, u.margin.top ?? 0), f = u.node.localRect.height;
|
|
2215
2221
|
if (a !== null && (u.breakBefore || i + d + f > e) && (r += 1, i = 0, a = null, d = 0), t) {
|
|
2216
2222
|
let e = u.node, t = _(r);
|
|
2217
2223
|
if (t !== v) {
|
|
2218
2224
|
let r = (u.margin.left ?? 0) + (u.margin.right ?? 0);
|
|
2219
|
-
|
|
2225
|
+
B(e, Math.max(0, t - r), n, 0, 0, "fill", o);
|
|
2220
2226
|
}
|
|
2221
2227
|
e.localRect = {
|
|
2222
2228
|
...e.localRect,
|
|
2223
|
-
x: y + g(r) +
|
|
2229
|
+
x: y + g(r) + Jn(u.margin, t, e.localRect.width),
|
|
2224
2230
|
y: b + C + i + d
|
|
2225
2231
|
};
|
|
2226
2232
|
}
|
|
@@ -2243,13 +2249,13 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2243
2249
|
let e = c === void 0 ? void 0 : Math.max(1, c - C), t = s.columnFill === "auto" && e !== void 0, r;
|
|
2244
2250
|
if (t) r = e;
|
|
2245
2251
|
else {
|
|
2246
|
-
let t =
|
|
2252
|
+
let t = Ht(1, D(Infinity, !1).maxUsed, (e) => D(e, !1).columns <= m);
|
|
2247
2253
|
r = e === void 0 ? t : Math.min(t, e);
|
|
2248
2254
|
}
|
|
2249
2255
|
let i = D(r, !0), a = t && n !== void 0 ? Math.max(i.maxUsed, r) : i.maxUsed;
|
|
2250
2256
|
if (s.ruleX) for (let e = 0; e < m - 1; e++) {
|
|
2251
2257
|
let t = Math.min(i.columns, m);
|
|
2252
|
-
|
|
2258
|
+
Wt(s.ruleVisibilityItems, e < t, e + 1 < t) && x.push({
|
|
2253
2259
|
bandStart: h[e] + p[e],
|
|
2254
2260
|
bandSize: f,
|
|
2255
2261
|
start: C,
|
|
@@ -2259,26 +2265,26 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2259
2265
|
C += a, w = [], T = [];
|
|
2260
2266
|
};
|
|
2261
2267
|
for (let r of e.children) {
|
|
2262
|
-
if (
|
|
2268
|
+
if (z(r.style)) {
|
|
2263
2269
|
T.push({
|
|
2264
2270
|
child: r,
|
|
2265
|
-
margin:
|
|
2271
|
+
margin: W(r.style.margin, t),
|
|
2266
2272
|
index: w.length
|
|
2267
2273
|
});
|
|
2268
2274
|
continue;
|
|
2269
2275
|
}
|
|
2270
2276
|
if (r.style.columnSpan) {
|
|
2271
2277
|
O(), E = !1;
|
|
2272
|
-
let e =
|
|
2273
|
-
|
|
2278
|
+
let e = W(r.style.margin, t), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2279
|
+
B(r, Math.max(0, t - i), n, 0, 0, "fill", o), C += e.top ?? 0, r.localRect = {
|
|
2274
2280
|
...r.localRect,
|
|
2275
|
-
x: y +
|
|
2281
|
+
x: y + Jn(e, t, r.localRect.width),
|
|
2276
2282
|
y: b + C
|
|
2277
2283
|
}, C += r.localRect.height + (e.bottom ?? 0);
|
|
2278
2284
|
continue;
|
|
2279
2285
|
}
|
|
2280
|
-
let e =
|
|
2281
|
-
|
|
2286
|
+
let e = W(r.style.margin, v), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2287
|
+
B(r, Math.max(0, v - i), n, 0, 0, "fill", o), w.push({
|
|
2282
2288
|
node: r,
|
|
2283
2289
|
margin: e,
|
|
2284
2290
|
breakBefore: E || r.style.breakBeforeColumn
|
|
@@ -2300,32 +2306,32 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2300
2306
|
}
|
|
2301
2307
|
//#endregion
|
|
2302
2308
|
//#region src/table.ts
|
|
2303
|
-
function
|
|
2309
|
+
function tn(e, t) {
|
|
2304
2310
|
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && N(t.source, "Table content outside the expected structure (rows in tables, cells in rows) can't be laid out and was hidden — no anonymous table boxes (specs/table.md).");
|
|
2305
2311
|
}
|
|
2306
|
-
function
|
|
2312
|
+
function nn(e, t) {
|
|
2307
2313
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
2308
2314
|
return Number.isNaN(n) ? 1 : t === "colspan" ? Math.min(1e3, Math.max(1, n)) : Math.min(65534, Math.max(0, n));
|
|
2309
2315
|
}
|
|
2310
|
-
function
|
|
2316
|
+
function rn(e, t, n) {
|
|
2311
2317
|
let r = (t, r) => {
|
|
2312
|
-
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ?
|
|
2318
|
+
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ? K(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
2313
2319
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
2314
2320
|
};
|
|
2315
2321
|
if (t.style.tableRole === "column") {
|
|
2316
|
-
r(t,
|
|
2322
|
+
r(t, an(t.source));
|
|
2317
2323
|
return;
|
|
2318
2324
|
}
|
|
2319
2325
|
let i = t.children.filter((e) => e.style.tableRole === "column");
|
|
2320
|
-
if (i.length === 0) r(t,
|
|
2321
|
-
else for (let e of i) r(e,
|
|
2322
|
-
for (let n of t.children) n.style.tableRole !== "column" &&
|
|
2326
|
+
if (i.length === 0) r(t, an(t.source));
|
|
2327
|
+
else for (let e of i) r(e, an(e.source));
|
|
2328
|
+
for (let n of t.children) n.style.tableRole !== "column" && tn(e, n);
|
|
2323
2329
|
}
|
|
2324
|
-
function
|
|
2330
|
+
function an(e) {
|
|
2325
2331
|
let t = Number.parseInt(e.getAttribute("span") ?? "", 10);
|
|
2326
2332
|
return Number.isNaN(t) ? 1 : Math.min(1e3, Math.max(1, t));
|
|
2327
2333
|
}
|
|
2328
|
-
function
|
|
2334
|
+
function on(e, t) {
|
|
2329
2335
|
let n = {
|
|
2330
2336
|
caption: null,
|
|
2331
2337
|
rows: [],
|
|
@@ -2338,7 +2344,7 @@ function an(e, t) {
|
|
|
2338
2344
|
hidden: []
|
|
2339
2345
|
}, r = [], i = [], a = [];
|
|
2340
2346
|
for (let o of e.children) {
|
|
2341
|
-
if (
|
|
2347
|
+
if (z(o.style)) continue;
|
|
2342
2348
|
let e = o.style.tableRole;
|
|
2343
2349
|
if (e === "row") i.push({
|
|
2344
2350
|
row: o,
|
|
@@ -2346,11 +2352,11 @@ function an(e, t) {
|
|
|
2346
2352
|
});
|
|
2347
2353
|
else if (e === "header-group" || e === "row-group" || e === "footer-group") {
|
|
2348
2354
|
let t = e === "header-group" ? r : e === "footer-group" ? a : i;
|
|
2349
|
-
for (let e of o.children)
|
|
2355
|
+
for (let e of o.children) z(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
2350
2356
|
row: e,
|
|
2351
2357
|
group: o
|
|
2352
|
-
}) :
|
|
2353
|
-
} else e === "caption" ? n.caption === null ? n.caption = o :
|
|
2358
|
+
}) : tn(n, e));
|
|
2359
|
+
} else e === "caption" ? n.caption === null ? n.caption = o : tn(n, o) : e === "column" || e === "column-group" ? (rn(n, o, t), n.hidden.push(o)) : tn(n, o);
|
|
2354
2360
|
}
|
|
2355
2361
|
let o = [
|
|
2356
2362
|
...r,
|
|
@@ -2365,20 +2371,20 @@ function an(e, t) {
|
|
|
2365
2371
|
s = e + 1;
|
|
2366
2372
|
}
|
|
2367
2373
|
}
|
|
2368
|
-
return
|
|
2374
|
+
return sn(n), n;
|
|
2369
2375
|
}
|
|
2370
|
-
function
|
|
2376
|
+
function sn(e) {
|
|
2371
2377
|
let t = [];
|
|
2372
2378
|
for (let n = 0; n < e.rows.length; n++) {
|
|
2373
2379
|
let r = e.rows[n], i = 0;
|
|
2374
2380
|
for (let a of r.children) {
|
|
2375
|
-
if (
|
|
2381
|
+
if (z(a.style)) continue;
|
|
2376
2382
|
if (a.style.tableRole !== "cell") {
|
|
2377
|
-
|
|
2383
|
+
tn(e, a);
|
|
2378
2384
|
continue;
|
|
2379
2385
|
}
|
|
2380
2386
|
for (; (t[i] ?? 0) > n;) i++;
|
|
2381
|
-
let o =
|
|
2387
|
+
let o = nn(a.source, "colspan"), s = nn(a.source, "rowspan"), c = e.groupEnds[n], l = Math.max(1, Math.min(s === 0 ? c - n : s, c - n));
|
|
2382
2388
|
for (let e = i; e < i + o; e++) t[e] = Math.max(t[e] ?? 0, n + l);
|
|
2383
2389
|
e.cells.push({
|
|
2384
2390
|
node: a,
|
|
@@ -2392,21 +2398,21 @@ function on(e) {
|
|
|
2392
2398
|
}
|
|
2393
2399
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
2394
2400
|
}
|
|
2395
|
-
function
|
|
2401
|
+
function cn(e, t, n) {
|
|
2396
2402
|
let r = e.style, i = Y(e, n), a;
|
|
2397
2403
|
if (t === "min") a = i;
|
|
2398
2404
|
else {
|
|
2399
|
-
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ?
|
|
2400
|
-
a = t === void 0 ?
|
|
2405
|
+
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? K(r.width, 0, e, n) : void 0;
|
|
2406
|
+
a = t === void 0 ? q(e, n) : Math.max(i, t);
|
|
2401
2407
|
}
|
|
2402
2408
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
2403
|
-
return Math.max(0,
|
|
2409
|
+
return Math.max(0, V(a, o, s));
|
|
2404
2410
|
}
|
|
2405
|
-
function
|
|
2411
|
+
function ln(e) {
|
|
2406
2412
|
let t = e.style.width;
|
|
2407
2413
|
return t && t.kind === "percent" ? t.value : void 0;
|
|
2408
2414
|
}
|
|
2409
|
-
function
|
|
2415
|
+
function un(e, t, n) {
|
|
2410
2416
|
let r = e.columnCount, i = Array.from({ length: r }, () => 0), a = Array.from({ length: r }, () => 0), o = Array.from({ length: r }, () => void 0);
|
|
2411
2417
|
for (let t = 0; t < r; t++) e.colFixed[t] !== void 0 && (a[t] = e.colFixed[t]), o[t] = e.colPercent[t];
|
|
2412
2418
|
let s = [];
|
|
@@ -2415,15 +2421,15 @@ function ln(e, t, n) {
|
|
|
2415
2421
|
s.push(t);
|
|
2416
2422
|
continue;
|
|
2417
2423
|
}
|
|
2418
|
-
i[t.col] = Math.max(i[t.col],
|
|
2419
|
-
let e =
|
|
2424
|
+
i[t.col] = Math.max(i[t.col], cn(t.node, "min", n)), a[t.col] = Math.max(a[t.col], cn(t.node, "max", n));
|
|
2425
|
+
let e = ln(t.node);
|
|
2420
2426
|
e !== void 0 && (o[t.col] = Math.max(o[t.col] ?? 0, e));
|
|
2421
2427
|
}
|
|
2422
2428
|
s.sort((e, t) => e.colSpan - t.colSpan);
|
|
2423
2429
|
for (let e of s) {
|
|
2424
|
-
let r = e.col, o = e.col + e.colSpan, s =
|
|
2430
|
+
let r = e.col, o = e.col + e.colSpan, s = _n(t, r, o), c = a.slice(r, o);
|
|
2425
2431
|
for (let t of ["min", "max"]) {
|
|
2426
|
-
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d =
|
|
2432
|
+
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d = cn(e.node, t, n) - u;
|
|
2427
2433
|
if (d <= 0) continue;
|
|
2428
2434
|
let f = R(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
2429
2435
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
@@ -2436,7 +2442,7 @@ function ln(e, t, n) {
|
|
|
2436
2442
|
percent: o
|
|
2437
2443
|
};
|
|
2438
2444
|
}
|
|
2439
|
-
function
|
|
2445
|
+
function dn(e, t) {
|
|
2440
2446
|
let n = e.min.length, r = e.min.slice(), i = [], a = [];
|
|
2441
2447
|
for (let t = 0; t < n; t++) (e.percent[t] === void 0 ? a : i).push(t);
|
|
2442
2448
|
if (i.length > 0) {
|
|
@@ -2465,13 +2471,13 @@ function un(e, t) {
|
|
|
2465
2471
|
}
|
|
2466
2472
|
return r;
|
|
2467
2473
|
}
|
|
2468
|
-
function
|
|
2474
|
+
function fn(e, t, n) {
|
|
2469
2475
|
let r = e.columnCount, i = Array.from({ length: r }, () => void 0);
|
|
2470
2476
|
for (let n = 0; n < r; n++) e.colFixed[n] === void 0 ? e.colPercent[n] !== void 0 && (i[n] = Math.max(0, Math.round(t * e.colPercent[n] / 100))) : i[n] = e.colFixed[n];
|
|
2471
2477
|
for (let r of e.cells) {
|
|
2472
2478
|
if (r.row !== 0) continue;
|
|
2473
2479
|
let e = r.node.style, a;
|
|
2474
|
-
if (e.width && e.width.kind === "percent" ? a = Math.max(0, Math.round(t * e.width.value / 100)) : e.width && e.width.kind !== "auto" && (a =
|
|
2480
|
+
if (e.width && e.width.kind === "percent" ? a = Math.max(0, Math.round(t * e.width.value / 100)) : e.width && e.width.kind !== "auto" && (a = K(e.width, 0, r.node, n)), a === void 0) continue;
|
|
2475
2481
|
let o = R(Array.from({ length: r.colSpan }, () => 1), a);
|
|
2476
2482
|
for (let e = 0; e < r.colSpan; e++) {
|
|
2477
2483
|
let t = r.col + e;
|
|
@@ -2485,13 +2491,13 @@ function dn(e, t, n) {
|
|
|
2485
2491
|
}
|
|
2486
2492
|
return i.map((e) => e ?? 0);
|
|
2487
2493
|
}
|
|
2488
|
-
var
|
|
2494
|
+
var pn = {
|
|
2489
2495
|
double: 3,
|
|
2490
2496
|
solid: 2,
|
|
2491
2497
|
dashed: 1,
|
|
2492
2498
|
dotted: 0
|
|
2493
2499
|
};
|
|
2494
|
-
function
|
|
2500
|
+
function mn(e) {
|
|
2495
2501
|
for (let { border: t, side: n } of e) if (t?.hidden[n]) return null;
|
|
2496
2502
|
let t = null;
|
|
2497
2503
|
for (let { border: n, side: r } of e) {
|
|
@@ -2499,7 +2505,7 @@ function pn(e) {
|
|
|
2499
2505
|
let e = n.width[r];
|
|
2500
2506
|
if (e <= 0) continue;
|
|
2501
2507
|
let i = n.style[r];
|
|
2502
|
-
(t === null || e > t.width || e === t.width &&
|
|
2508
|
+
(t === null || e > t.width || e === t.width && pn[i] > pn[t.style]) && (t = {
|
|
2503
2509
|
width: e,
|
|
2504
2510
|
style: i,
|
|
2505
2511
|
color: n.color[r]
|
|
@@ -2507,7 +2513,7 @@ function pn(e) {
|
|
|
2507
2513
|
}
|
|
2508
2514
|
return t;
|
|
2509
2515
|
}
|
|
2510
|
-
function
|
|
2516
|
+
function hn(e, t) {
|
|
2511
2517
|
let n = t.columnCount, r = t.rows.length, i = e.style.borderCollapse, a = {
|
|
2512
2518
|
collapsed: i,
|
|
2513
2519
|
vLines: Array.from({ length: n + 1 }, () => 0),
|
|
@@ -2552,7 +2558,7 @@ function mn(e, t) {
|
|
|
2552
2558
|
side: u
|
|
2553
2559
|
});
|
|
2554
2560
|
}
|
|
2555
|
-
i.push(
|
|
2561
|
+
i.push(mn(l));
|
|
2556
2562
|
}
|
|
2557
2563
|
a.vSegments.push(i), a.vLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
2558
2564
|
}
|
|
@@ -2591,47 +2597,47 @@ function mn(e, t) {
|
|
|
2591
2597
|
}), e === r && l.push({
|
|
2592
2598
|
border: s,
|
|
2593
2599
|
side: "bottom"
|
|
2594
|
-
}), i.push(
|
|
2600
|
+
}), i.push(mn(l));
|
|
2595
2601
|
}
|
|
2596
2602
|
a.hSegments.push(i), a.hLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
2597
2603
|
}
|
|
2598
2604
|
return a;
|
|
2599
2605
|
}
|
|
2600
|
-
function
|
|
2606
|
+
function gn(e, t) {
|
|
2601
2607
|
return e.collapsed ? e.vLines.reduce((e, t) => e + t, 0) : (t + 1) * e.spacingX;
|
|
2602
2608
|
}
|
|
2603
|
-
function
|
|
2609
|
+
function _n(e, t, n) {
|
|
2604
2610
|
if (!e.collapsed) return e.spacingX * (n - t - 1);
|
|
2605
2611
|
let r = 0;
|
|
2606
2612
|
for (let i = t + 1; i < n; i++) r += e.vLines[i];
|
|
2607
2613
|
return r;
|
|
2608
2614
|
}
|
|
2609
|
-
function
|
|
2615
|
+
function vn(e, t, n) {
|
|
2610
2616
|
if (!e.collapsed) return e.spacingY * (n - t - 1);
|
|
2611
2617
|
let r = 0;
|
|
2612
2618
|
for (let i = t + 1; i < n; i++) r += e.hLines[i];
|
|
2613
2619
|
return r;
|
|
2614
2620
|
}
|
|
2615
|
-
function
|
|
2621
|
+
function yn(e, t) {
|
|
2616
2622
|
let n = t.tableData.get(e);
|
|
2617
2623
|
if (n) return n;
|
|
2618
|
-
let r =
|
|
2624
|
+
let r = on(e, t), i = hn(e, r), a = {
|
|
2619
2625
|
structure: r,
|
|
2620
2626
|
chrome: i,
|
|
2621
|
-
bounds:
|
|
2622
|
-
chromeX:
|
|
2627
|
+
bounds: un(r, i, t),
|
|
2628
|
+
chromeX: gn(i, r.columnCount)
|
|
2623
2629
|
};
|
|
2624
2630
|
return t.tableData.set(e, a), a;
|
|
2625
2631
|
}
|
|
2626
|
-
function
|
|
2627
|
-
let { structure: n, bounds: r, chromeX: i } =
|
|
2628
|
-
return n.caption && (a = Math.max(a, Y(n.caption, t)), o = Math.max(o,
|
|
2632
|
+
function bn(e, t) {
|
|
2633
|
+
let { structure: n, bounds: r, chromeX: i } = yn(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
2634
|
+
return n.caption && (a = Math.max(a, Y(n.caption, t)), o = Math.max(o, q(n.caption, t))), {
|
|
2629
2635
|
min: a,
|
|
2630
2636
|
max: o
|
|
2631
2637
|
};
|
|
2632
2638
|
}
|
|
2633
|
-
function
|
|
2634
|
-
let r = e.style, { bounds: i, chromeX: a } =
|
|
2639
|
+
function xn(e, t, n) {
|
|
2640
|
+
let r = e.style, { bounds: i, chromeX: a } = yn(e, n), { min: o, max: s } = bn(e, n), c = r.border.left + r.border.right + U(r.padding.left, t) + U(r.padding.right, t) + it(r).right, l = i.max.reduce((e, t) => e + t, 0), u = 0, d = 0;
|
|
2635
2641
|
for (let e = 0; e < i.max.length; e++) {
|
|
2636
2642
|
let t = i.percent[e];
|
|
2637
2643
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -2647,8 +2653,8 @@ function bn(e, t, n) {
|
|
|
2647
2653
|
let f = Math.max(l + a, s) + c;
|
|
2648
2654
|
return Math.max(o + c, Math.min(f, t));
|
|
2649
2655
|
}
|
|
2650
|
-
function
|
|
2651
|
-
let { structure: o, chrome: s, bounds: c } =
|
|
2656
|
+
function Sn(e, t, n, r, i, a) {
|
|
2657
|
+
let { structure: o, chrome: s, bounds: c } = yn(e, a), l = o.columnCount, u = o.rows.length, d = r.left + i.left, f = r.top + i.top;
|
|
2652
2658
|
for (let e of o.hidden) e.tableHidden = !0, e.localRect = {
|
|
2653
2659
|
x: 0,
|
|
2654
2660
|
y: 0,
|
|
@@ -2660,14 +2666,14 @@ function xn(e, t, n, r, i, a) {
|
|
|
2660
2666
|
bottom: 0,
|
|
2661
2667
|
left: 0
|
|
2662
2668
|
}, e.unclampedHeight = 0;
|
|
2663
|
-
let p = Math.max(0, t -
|
|
2669
|
+
let p = Math.max(0, t - gn(s, l)), m = e.style, h = m.tableLayout === "fixed" && m.width !== void 0 && m.width.kind !== "auto" ? fn(o, p, a) : dn(c, p), g = [], _ = 0;
|
|
2664
2670
|
for (let e = 0; e < l; e++) _ += s.collapsed ? s.vLines[e] : s.spacingX, g.push(_), _ += h[e];
|
|
2665
2671
|
let v = _ + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), y = 0;
|
|
2666
|
-
o.caption && (
|
|
2672
|
+
o.caption && (B(o.caption, t, void 0, d, f, "fill", a), y = o.caption.localRect.height);
|
|
2667
2673
|
let b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
|
|
2668
2674
|
for (let e of o.cells) {
|
|
2669
|
-
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) +
|
|
2670
|
-
x.set(e, n),
|
|
2675
|
+
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) + _n(s, e.col, t);
|
|
2676
|
+
x.set(e, n), B(e.node, n, void 0, 0, 0, "fill", a, { width: n }), b.set(e, e.node.localRect.height);
|
|
2671
2677
|
}
|
|
2672
2678
|
let C = s.collapsed ? s.hLines.reduce((e, t) => e + t, 0) : (u + 1) * s.spacingY, w = n === void 0 ? void 0 : Math.max(0, n - y - C), T = (e) => e !== void 0 && e.kind === "percent" && w !== void 0 ? we(e.value, w) : 0, E = Array.from({ length: u }, () => 0), D = Array.from({ length: u }, () => !1);
|
|
2673
2679
|
for (let e = 0; e < u; e++) {
|
|
@@ -2682,7 +2688,7 @@ function xn(e, t, n, r, i, a) {
|
|
|
2682
2688
|
}
|
|
2683
2689
|
let O = o.cells.filter((e) => e.rowSpan > 1).sort((e, t) => e.rowSpan - t.rowSpan);
|
|
2684
2690
|
for (let e of O) {
|
|
2685
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2691
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + vn(s, e.row, t), r = b.get(e) - n;
|
|
2686
2692
|
if (r <= 0) continue;
|
|
2687
2693
|
let i = R(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
2688
2694
|
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
@@ -2733,34 +2739,34 @@ function xn(e, t, n, r, i, a) {
|
|
|
2733
2739
|
}, t.unclampedHeight = E[e];
|
|
2734
2740
|
}
|
|
2735
2741
|
for (let e of o.cells) {
|
|
2736
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2737
|
-
e.node.children.some((e) => !
|
|
2742
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + vn(s, e.row, t);
|
|
2743
|
+
e.node.children.some((e) => !z(e.style) && e.style.height?.kind === "percent") && n !== b.get(e) && B(e.node, x.get(e), n, 0, 0, "fill", a, {
|
|
2738
2744
|
width: x.get(e),
|
|
2739
2745
|
height: n
|
|
2740
|
-
}),
|
|
2746
|
+
}), Cn(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
2741
2747
|
x: g[e.col],
|
|
2742
2748
|
y: 0,
|
|
2743
2749
|
width: e.node.localRect.width,
|
|
2744
2750
|
height: n
|
|
2745
2751
|
};
|
|
2746
2752
|
}
|
|
2747
|
-
for (let t of e.children)
|
|
2753
|
+
for (let t of e.children) z(t.style) && (t.staticSlot = {
|
|
2748
2754
|
kind: "block",
|
|
2749
2755
|
x: d,
|
|
2750
2756
|
y: f
|
|
2751
2757
|
});
|
|
2752
|
-
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns =
|
|
2758
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = wn(s, o, h, E, g, A, d, f, S(e.style.glyphSet))), e.style.captionSide === "bottom" ? M + y : M;
|
|
2753
2759
|
}
|
|
2754
|
-
function
|
|
2760
|
+
function Cn(e, t) {
|
|
2755
2761
|
if (t <= 0) return;
|
|
2756
2762
|
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
2757
|
-
if (!e.children.some((e) => !
|
|
2763
|
+
if (!e.children.some((e) => !z(e.style) && !e.inlineBox)) {
|
|
2758
2764
|
e.resolvedPadding.top += r, e.resolvedPadding.bottom += t - r;
|
|
2759
2765
|
return;
|
|
2760
2766
|
}
|
|
2761
|
-
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (
|
|
2767
|
+
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (z(t.style) ? t.staticSlot?.kind === "block" && (t.staticSlot.y += r) : t.localRect.y += r);
|
|
2762
2768
|
}
|
|
2763
|
-
function
|
|
2769
|
+
function wn(e, t, n, r, i, a, o, s, c) {
|
|
2764
2770
|
let l = t.columnCount, u = t.rows.length, d = [], f = (t) => t < l ? i[t] - e.vLines[t] : i[l - 1] + n[l - 1], p = (t) => t < u ? a[t] - e.hLines[t] : a[u - 1] + r[u - 1];
|
|
2765
2771
|
for (let t = 0; t <= l; t++) {
|
|
2766
2772
|
let n = e.vSegments[t];
|
|
@@ -2801,7 +2807,7 @@ function Cn(e, t, n, r, i, a, o, s, c) {
|
|
|
2801
2807
|
m
|
|
2802
2808
|
].filter((e) => e !== null);
|
|
2803
2809
|
if (h.length === 0) continue;
|
|
2804
|
-
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width &&
|
|
2810
|
+
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width && pn[t.style] > pn[e.style] ? t : e), v = he(g, r !== null, i !== null, a !== null, m !== null, c);
|
|
2805
2811
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) d.push({
|
|
2806
2812
|
glyph: v,
|
|
2807
2813
|
x: o + f(t) + r,
|
|
@@ -2814,30 +2820,30 @@ function Cn(e, t, n, r, i, a, o, s, c) {
|
|
|
2814
2820
|
}
|
|
2815
2821
|
//#endregion
|
|
2816
2822
|
//#region src/positioning.ts
|
|
2817
|
-
function
|
|
2823
|
+
function Tn(e) {
|
|
2818
2824
|
return e.position === "absolute" || e.position === "fixed" ? "absolute" : e.position === "relative" || e.position === "sticky" ? "relative" : "static";
|
|
2819
2825
|
}
|
|
2820
|
-
function
|
|
2826
|
+
function En(e, t, n, r, i) {
|
|
2821
2827
|
for (let a of e.children) {
|
|
2822
|
-
let o =
|
|
2828
|
+
let o = Tn(a.style);
|
|
2823
2829
|
if (o === "relative") {
|
|
2824
2830
|
let t = e.localRect.width - e.style.border.left - e.style.border.right - e.resolvedPadding.left - e.resolvedPadding.right, n = e.localRect.height - e.style.border.top - e.style.border.bottom - e.resolvedPadding.top - e.resolvedPadding.bottom;
|
|
2825
|
-
a.localRect.x +=
|
|
2826
|
-
} else o === "absolute" &&
|
|
2827
|
-
|
|
2831
|
+
a.localRect.x += Dn(a.style.insets.left, a.style.insets.right, t), a.localRect.y += Dn(a.style.insets.top, a.style.insets.bottom, n);
|
|
2832
|
+
} else o === "absolute" && kn(a, e, t, n, r, i);
|
|
2833
|
+
En(a, t + a.localRect.x, n + a.localRect.y, [...r, {
|
|
2828
2834
|
node: a,
|
|
2829
2835
|
absX: t + a.localRect.x,
|
|
2830
2836
|
absY: n + a.localRect.y
|
|
2831
2837
|
}], i);
|
|
2832
2838
|
}
|
|
2833
2839
|
}
|
|
2834
|
-
function
|
|
2835
|
-
return e === null ? t === null ? 0 : -
|
|
2840
|
+
function Dn(e, t, n) {
|
|
2841
|
+
return e === null ? t === null ? 0 : -U(t, n) : U(e, n);
|
|
2836
2842
|
}
|
|
2837
|
-
function
|
|
2843
|
+
function On(e, t) {
|
|
2838
2844
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
2839
2845
|
let n = e[t];
|
|
2840
|
-
if (!
|
|
2846
|
+
if (!Ln(n.node.style)) continue;
|
|
2841
2847
|
let r = n.node.style.border;
|
|
2842
2848
|
return {
|
|
2843
2849
|
x: n.absX + r.left,
|
|
@@ -2854,44 +2860,44 @@ function Dn(e, t) {
|
|
|
2854
2860
|
height: n.node.localRect.height
|
|
2855
2861
|
};
|
|
2856
2862
|
}
|
|
2857
|
-
function
|
|
2858
|
-
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s &&
|
|
2863
|
+
function kn(e, t, n, r, i, a) {
|
|
2864
|
+
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s && Ln(t.style) ? {
|
|
2859
2865
|
x: n + c.area.x,
|
|
2860
2866
|
y: r + c.area.y,
|
|
2861
2867
|
width: c.area.width,
|
|
2862
2868
|
height: c.area.height
|
|
2863
|
-
} :
|
|
2864
|
-
if (!y) C.width =
|
|
2865
|
-
else if (u !== null && d !== null) C.width =
|
|
2869
|
+
} : On(i, s), u = o.insets.left === null ? null : U(o.insets.left, l.width), d = o.insets.right === null ? null : U(o.insets.right, l.width), f = o.insets.top === null ? null : U(o.insets.top, l.height), p = o.insets.bottom === null ? null : U(o.insets.bottom, l.height), m = W(o.margin, l.width), h = m.left ?? 0, g = m.right ?? 0, _ = m.top ?? 0, v = m.bottom ?? 0, y = o.width === void 0 || o.width.kind === "auto", b = o.height === void 0 || o.height.kind === "auto", x = Kn(o.minWidth, l.width, e, a) ?? 0, S = Kn(o.maxWidth, l.width, e, a), C = {};
|
|
2870
|
+
if (!y) C.width = V(K(o.width, l.width, e, a), x, S);
|
|
2871
|
+
else if (u !== null && d !== null) C.width = V(Math.max(0, l.width - u - d - h - g), x, S);
|
|
2866
2872
|
else {
|
|
2867
2873
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
2868
|
-
C.width =
|
|
2874
|
+
C.width = V(Math.min(q(e, a), Math.max(Y(e, a), t)), x, S);
|
|
2869
2875
|
}
|
|
2870
|
-
f !== null && p !== null && b && (C.height =
|
|
2876
|
+
f !== null && p !== null && b && (C.height = V(Math.max(0, l.height - f - p - _ - v), G(o.minHeight, l.height) ?? 0, G(o.maxHeight, l.height))), B(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
2871
2877
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
2872
2878
|
if (u !== null && d !== null) {
|
|
2873
2879
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
2874
2880
|
E = l.x + u + h + (t ? Math.floor(e / 2) : m.left === null ? e : 0);
|
|
2875
|
-
} else E = u === null ? d === null ?
|
|
2881
|
+
} else E = u === null ? d === null ? Pn(e, t, n, w) : l.x + l.width - d - w - g : l.x + u + h;
|
|
2876
2882
|
let D;
|
|
2877
2883
|
if (f !== null && p !== null) {
|
|
2878
2884
|
let e = Math.max(0, l.height - f - p - T - _ - v), t = m.top === null && m.bottom === null;
|
|
2879
2885
|
D = l.y + f + _ + (t ? Math.floor(e / 2) : m.top === null ? e : 0);
|
|
2880
|
-
} else D = f === null ? p === null ?
|
|
2886
|
+
} else D = f === null ? p === null ? Fn(e, t, r, T) : l.y + l.height - p - T - v : l.y + f + _;
|
|
2881
2887
|
e.localRect = {
|
|
2882
2888
|
...e.localRect,
|
|
2883
2889
|
x: E - n,
|
|
2884
2890
|
y: D - r
|
|
2885
2891
|
};
|
|
2886
2892
|
}
|
|
2887
|
-
function
|
|
2893
|
+
function An(e, t, n) {
|
|
2888
2894
|
return L(e, [n], Math.max(0, t - n))[0];
|
|
2889
2895
|
}
|
|
2890
|
-
function
|
|
2891
|
-
return
|
|
2896
|
+
function jn(e, t, n, r) {
|
|
2897
|
+
return Xe(Ye(e, t), n, r);
|
|
2892
2898
|
}
|
|
2893
|
-
function
|
|
2894
|
-
let a =
|
|
2899
|
+
function Mn(e, t, n, r, i) {
|
|
2900
|
+
let a = W(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2895
2901
|
a.left ?? 0,
|
|
2896
2902
|
a.right ?? 0,
|
|
2897
2903
|
n.innerWidth,
|
|
@@ -2902,10 +2908,10 @@ function jn(e, t, n, r, i) {
|
|
|
2902
2908
|
n.innerHeight,
|
|
2903
2909
|
n.direction === "column"
|
|
2904
2910
|
], u = i + o + s;
|
|
2905
|
-
return (l ?
|
|
2911
|
+
return (l ? An(et(t.style), c, u) : jn(e, t, c, u)) + o;
|
|
2906
2912
|
}
|
|
2907
|
-
function
|
|
2908
|
-
let a =
|
|
2913
|
+
function Nn(e, t, n, r, i) {
|
|
2914
|
+
let a = W(e.style.margin, n.width), o = e.style.justifySelf === "auto" ? t.style.justifyItems : e.style.justifySelf, [s, c, l, u] = r === "x" ? [
|
|
2909
2915
|
a.left ?? 0,
|
|
2910
2916
|
a.right ?? 0,
|
|
2911
2917
|
n.width,
|
|
@@ -2916,35 +2922,35 @@ function Mn(e, t, n, r, i) {
|
|
|
2916
2922
|
n.height,
|
|
2917
2923
|
Ye(e, t)
|
|
2918
2924
|
];
|
|
2919
|
-
return
|
|
2925
|
+
return Xe(u, l, i + s + c) + s;
|
|
2920
2926
|
}
|
|
2921
|
-
function
|
|
2927
|
+
function Pn(e, t, n, r) {
|
|
2922
2928
|
let i = e.staticSlot;
|
|
2923
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x +
|
|
2929
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x + Nn(e, t, i.staticArea, "x", r) : n + i.originX + Mn(e, t, i, "x", r);
|
|
2924
2930
|
}
|
|
2925
|
-
function
|
|
2931
|
+
function Fn(e, t, n, r) {
|
|
2926
2932
|
let i = e.staticSlot;
|
|
2927
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y +
|
|
2933
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y + Nn(e, t, i.staticArea, "y", r) : n + i.originY + Mn(e, t, i, "y", r);
|
|
2928
2934
|
}
|
|
2929
2935
|
//#endregion
|
|
2930
2936
|
//#region src/layout.ts
|
|
2931
|
-
function
|
|
2932
|
-
let n =
|
|
2933
|
-
|
|
2937
|
+
function In(e, t) {
|
|
2938
|
+
let n = Rn();
|
|
2939
|
+
B(e, t, void 0, 0, 0, "fill", n), En(e, 0, 0, [{
|
|
2934
2940
|
node: e,
|
|
2935
2941
|
absX: 0,
|
|
2936
2942
|
absY: 0
|
|
2937
2943
|
}], n);
|
|
2938
|
-
let r = e.localRect.height, i =
|
|
2944
|
+
let r = e.localRect.height, i = Zn(e);
|
|
2939
2945
|
return e.localRect.width = Math.max(e.localRect.width, i.x), e.localRect.height = Math.max(r, i.y), { height: r };
|
|
2940
2946
|
}
|
|
2941
|
-
function
|
|
2947
|
+
function z(e) {
|
|
2942
2948
|
return e.position === "absolute" || e.position === "fixed";
|
|
2943
2949
|
}
|
|
2944
|
-
function
|
|
2950
|
+
function Ln(e) {
|
|
2945
2951
|
return e.position !== "static";
|
|
2946
2952
|
}
|
|
2947
|
-
function
|
|
2953
|
+
function Rn() {
|
|
2948
2954
|
return {
|
|
2949
2955
|
maxContent: /* @__PURE__ */ new WeakMap(),
|
|
2950
2956
|
minContent: /* @__PURE__ */ new WeakMap(),
|
|
@@ -2952,46 +2958,49 @@ function Ln() {
|
|
|
2952
2958
|
tableData: /* @__PURE__ */ new WeakMap()
|
|
2953
2959
|
};
|
|
2954
2960
|
}
|
|
2955
|
-
function
|
|
2961
|
+
function B(e, t, n, r, i, a, o, s) {
|
|
2956
2962
|
let c = e.style, l = s?.height;
|
|
2957
2963
|
delete e.decorationRuns, delete e.multicolGeometry, delete e.multicolFlow, delete e.multicolFlowSpan, delete e.textExtent;
|
|
2958
|
-
let u =
|
|
2959
|
-
s?.gutter?.right && (m.right =
|
|
2960
|
-
let
|
|
2961
|
-
top:
|
|
2962
|
-
right:
|
|
2963
|
-
bottom:
|
|
2964
|
-
left:
|
|
2964
|
+
let u = Kn(c.minWidth, t, e, o) ?? 0, d = Kn(c.maxWidth, t, e, o), f = G(c.minHeight, n) ?? 0, p = G(c.maxHeight, n), m = it(c), h = rt(c);
|
|
2965
|
+
s?.gutter?.right && (m.right = h.right), s?.gutter?.bottom && (m.bottom = h.bottom);
|
|
2966
|
+
let g = {
|
|
2967
|
+
top: U(c.padding.top, t),
|
|
2968
|
+
right: U(c.padding.right, t) + m.right,
|
|
2969
|
+
bottom: U(c.padding.bottom, t) + m.bottom,
|
|
2970
|
+
left: U(c.padding.left, t)
|
|
2965
2971
|
};
|
|
2966
|
-
e.resolvedPadding =
|
|
2967
|
-
let
|
|
2972
|
+
e.resolvedPadding = g;
|
|
2973
|
+
let _ = s?.width ?? V(Xn(c, t, a, e, o), u, d), v = er(c, n), y = rr(_, l ?? v ?? (f > 0 ? f : void 0) ?? Infinity, c.border, g), b = l !== void 0 || v !== void 0, x = p === void 0 ? void 0 : Math.max(0, p - c.border.top - c.border.bottom - g.top - g.bottom), S = Bn(e), C = (t, n) => {
|
|
2968
2974
|
let r = n && Number.isFinite(t) ? t : void 0;
|
|
2969
|
-
return
|
|
2970
|
-
},
|
|
2971
|
-
!
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2975
|
+
return S ? zn(e, y.width, t, r, x, g, o) : c.display === "flex" && c.flexDirection === "row" ? Ue(e, y.width, t, r, c.border, g, o) : c.display === "flex" ? Ge(e, y.width, t, n, c.border, g, o) : c.display === "grid" ? ct(e, y.width, t, c.border, g, o) : c.display === "table" ? Sn(e, y.width, r, c.border, g, o) : c.display === "multicol" ? en(e, y.width, r, x, c.border, g, o) : qn(e, y.width, r, c.border, g, o);
|
|
2976
|
+
}, w = C(y.height, b);
|
|
2977
|
+
if (!S && (c.display === "flex" || c.display === "grid") && !b && p !== void 0) {
|
|
2978
|
+
let e = c.border.top + c.border.bottom + g.top + g.bottom, t = V(w + e, f, p) - e;
|
|
2979
|
+
t < w && (w = C(Math.max(0, t), !0));
|
|
2980
|
+
}
|
|
2981
|
+
let T = w + c.border.top + c.border.bottom + g.top + g.bottom, E = l ?? v ?? T;
|
|
2982
|
+
e.unclampedHeight = E, e.naturalContentHeight = T;
|
|
2983
|
+
let D = V(E, f, p), O = e.multicolGeometry;
|
|
2984
|
+
if (O) {
|
|
2985
|
+
let t = D - c.border.top - c.border.bottom - g.top - g.bottom;
|
|
2986
|
+
t > O.totalRows && (g.bottom += t - O.totalRows), Zt(e, O, c.border, g);
|
|
2978
2987
|
}
|
|
2979
2988
|
if (e.localRect = {
|
|
2980
2989
|
x: r,
|
|
2981
2990
|
y: i,
|
|
2982
|
-
width:
|
|
2983
|
-
height:
|
|
2984
|
-
},
|
|
2985
|
-
let l =
|
|
2991
|
+
width: _,
|
|
2992
|
+
height: D
|
|
2993
|
+
}, nt(c.overflow.x) || nt(c.overflow.y)) {
|
|
2994
|
+
let l = Zn(e), u = Math.max(0, l.x - c.border.left - g.left), d = Math.max(0, l.y - c.border.top - g.top), f = Math.max(0, _ - c.border.left - c.border.right - g.left - g.right), p = Math.max(0, D - c.border.top - c.border.bottom - g.top - g.bottom);
|
|
2986
2995
|
if (e.scrollRange = {
|
|
2987
2996
|
sizeX: u,
|
|
2988
2997
|
sizeY: d,
|
|
2989
|
-
maxX:
|
|
2990
|
-
maxY:
|
|
2998
|
+
maxX: nt(c.overflow.x) ? Math.max(0, u - f) : 0,
|
|
2999
|
+
maxY: nt(c.overflow.y) ? Math.max(0, d - p) : 0
|
|
2991
3000
|
}, !s?.gutter && c.scrollbarWidth !== "none") {
|
|
2992
3001
|
let l = c.overflow.y === "auto" && e.scrollRange.maxY > 0, u = c.overflow.x === "auto" && e.scrollRange.maxX > 0;
|
|
2993
3002
|
if (l || u) {
|
|
2994
|
-
|
|
3003
|
+
B(e, t, n, r, i, a, o, {
|
|
2995
3004
|
...s,
|
|
2996
3005
|
gutter: {
|
|
2997
3006
|
right: l,
|
|
@@ -3007,25 +3016,25 @@ function V(e, t, n, r, i, a, o, s) {
|
|
|
3007
3016
|
};
|
|
3008
3017
|
} else delete e.scrollRange, delete e.scrollGutterCells;
|
|
3009
3018
|
}
|
|
3010
|
-
function
|
|
3019
|
+
function zn(e, t, n, r, i, a, o) {
|
|
3011
3020
|
let s = e.style, c;
|
|
3012
3021
|
if (e.text) {
|
|
3013
3022
|
let l = e.children.filter((e) => e.inlineBox);
|
|
3014
3023
|
Fe(e.text, (n, r) => {
|
|
3015
3024
|
let i = l[r];
|
|
3016
|
-
|
|
3025
|
+
B(i, t, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
3017
3026
|
});
|
|
3018
3027
|
let u, d;
|
|
3019
3028
|
if (s.display === "multicol") {
|
|
3020
|
-
let n =
|
|
3029
|
+
let n = H(s, "x", t), o = Ut(s, t, n);
|
|
3021
3030
|
a.right += o.leftover;
|
|
3022
|
-
let c =
|
|
3031
|
+
let c = Gt(e, o, n, Vt(r, i));
|
|
3023
3032
|
e.multicolGeometry = c, u = c, d = c.lineX;
|
|
3024
|
-
} else u =
|
|
3033
|
+
} else u = Hn(e, t);
|
|
3025
3034
|
if (c = u.totalRows, e.textExtent = {
|
|
3026
3035
|
width: u.spans.reduce((t, n) => Math.max(t, I(n.start, n.end, e.advances, s.tracking)), 0),
|
|
3027
3036
|
rows: u.totalRows
|
|
3028
|
-
},
|
|
3037
|
+
}, Vn(e, u, t, n, a), l.length > 0) {
|
|
3029
3038
|
let t = (e) => u.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
3030
3039
|
Fe(e.text, (n, r) => {
|
|
3031
3040
|
let i = t(n);
|
|
@@ -3041,7 +3050,7 @@ function Rn(e, t, n, r, i, a, o) {
|
|
|
3041
3050
|
} else c = e.intrinsicHeight;
|
|
3042
3051
|
for (let n of e.children) {
|
|
3043
3052
|
if (n.inlineBox) continue;
|
|
3044
|
-
let e =
|
|
3053
|
+
let e = W(n.style.margin, t);
|
|
3045
3054
|
n.staticSlot = {
|
|
3046
3055
|
kind: "block",
|
|
3047
3056
|
x: s.border.left + a.left + (e.left ?? 0),
|
|
@@ -3050,30 +3059,30 @@ function Rn(e, t, n, r, i, a, o) {
|
|
|
3050
3059
|
}
|
|
3051
3060
|
return c;
|
|
3052
3061
|
}
|
|
3053
|
-
function
|
|
3054
|
-
return e.children.some((e) => !
|
|
3062
|
+
function Bn(e) {
|
|
3063
|
+
return e.children.some((e) => !z(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
3055
3064
|
}
|
|
3056
|
-
function
|
|
3065
|
+
function V(e, t, n) {
|
|
3057
3066
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
3058
3067
|
}
|
|
3059
|
-
function
|
|
3068
|
+
function Vn(e, t, n, r, i) {
|
|
3060
3069
|
let a = e.style;
|
|
3061
3070
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
3062
3071
|
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t, I(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
3063
3072
|
if (c > 0) {
|
|
3064
|
-
let e = a.display === "grid" ?
|
|
3073
|
+
let e = a.display === "grid" ? Xe(a.justifyItems, n, s) : o ? Xe(a.alignItems, n, s) : L(et(a), [s], c)[0];
|
|
3065
3074
|
e > 0 && (i.left += e, i.right += c - e);
|
|
3066
3075
|
}
|
|
3067
3076
|
if (Number.isFinite(r)) {
|
|
3068
3077
|
let e = Math.max(0, r - t.totalRows);
|
|
3069
3078
|
if (e > 0) {
|
|
3070
|
-
let n = a.display === "grid" || !o ?
|
|
3079
|
+
let n = a.display === "grid" || !o ? Xe(a.alignItems, r, t.totalRows) : L(et(a), [t.totalRows], e)[0];
|
|
3071
3080
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
3072
3081
|
}
|
|
3073
3082
|
}
|
|
3074
3083
|
}
|
|
3075
|
-
function
|
|
3076
|
-
let n =
|
|
3084
|
+
function Hn(e, t) {
|
|
3085
|
+
let n = Un(e, t), { heights: r, textOffsets: i } = Wn(e, n), a = [], o = [], s = 0;
|
|
3077
3086
|
for (let t = 0; t < n.length; t++) a.push(s), o.push(s + i[t]), s += r[t] + (t < n.length - 1 ? e.style.lineGap : 0);
|
|
3078
3087
|
return {
|
|
3079
3088
|
spans: n,
|
|
@@ -3082,14 +3091,14 @@ function Vn(e, t) {
|
|
|
3082
3091
|
totalRows: s
|
|
3083
3092
|
};
|
|
3084
3093
|
}
|
|
3085
|
-
function
|
|
3094
|
+
function Un(e, t) {
|
|
3086
3095
|
return e.style.whiteSpace === "normal" ? je(e.text, t, {
|
|
3087
3096
|
advances: e.advances,
|
|
3088
3097
|
tracking: e.style.tracking,
|
|
3089
3098
|
firstLineIndent: e.style.textIndent
|
|
3090
3099
|
}) : Ae(e.text);
|
|
3091
3100
|
}
|
|
3092
|
-
function
|
|
3101
|
+
function Wn(e, t) {
|
|
3093
3102
|
let n = e.children.filter((e) => e.inlineBox), r = [], i = [], a = 0;
|
|
3094
3103
|
for (let o of t) {
|
|
3095
3104
|
let t = 1, s = 0;
|
|
@@ -3105,15 +3114,15 @@ function Un(e, t) {
|
|
|
3105
3114
|
textOffsets: i
|
|
3106
3115
|
};
|
|
3107
3116
|
}
|
|
3108
|
-
function
|
|
3109
|
-
let r =
|
|
3117
|
+
function H(e, t, n) {
|
|
3118
|
+
let r = U(t === "x" ? e.gapX : e.gapY, n), i = t === "x" ? e.ruleX : e.ruleY;
|
|
3110
3119
|
return Math.max(r, i?.width ?? 0);
|
|
3111
3120
|
}
|
|
3112
|
-
function
|
|
3121
|
+
function U(e, t) {
|
|
3113
3122
|
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : we(e.percent, t);
|
|
3114
3123
|
}
|
|
3115
|
-
function
|
|
3116
|
-
let n = (e) => e === null ? null :
|
|
3124
|
+
function W(e, t) {
|
|
3125
|
+
let n = (e) => e === null ? null : U(e, t);
|
|
3117
3126
|
return {
|
|
3118
3127
|
top: n(e.top),
|
|
3119
3128
|
right: n(e.right),
|
|
@@ -3121,30 +3130,30 @@ function G(e, t) {
|
|
|
3121
3130
|
left: n(e.left)
|
|
3122
3131
|
};
|
|
3123
3132
|
}
|
|
3124
|
-
function
|
|
3133
|
+
function Gn(e) {
|
|
3125
3134
|
return typeof e == "number" ? e : 0;
|
|
3126
3135
|
}
|
|
3127
|
-
function
|
|
3136
|
+
function G(e, t) {
|
|
3128
3137
|
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : we(e.percent, t);
|
|
3129
3138
|
}
|
|
3130
|
-
function
|
|
3131
|
-
return e === "min-content" || e === "max-content" || e === "fit-content" ?
|
|
3139
|
+
function Kn(e, t, n, r) {
|
|
3140
|
+
return e === "min-content" || e === "max-content" || e === "fit-content" ? K({ kind: e }, t, n, r) : G(e, t);
|
|
3132
3141
|
}
|
|
3133
|
-
function
|
|
3142
|
+
function qn(e, t, n, r, i, a) {
|
|
3134
3143
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
3135
3144
|
for (let r of e.children) {
|
|
3136
|
-
let e =
|
|
3137
|
-
if (
|
|
3145
|
+
let e = W(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
3146
|
+
if (z(r.style)) {
|
|
3138
3147
|
r.staticSlot = {
|
|
3139
3148
|
kind: "block",
|
|
3140
3149
|
x: o + u,
|
|
3141
|
-
y: c + (l === null ? i :
|
|
3150
|
+
y: c + (l === null ? i : Yn(l, i))
|
|
3142
3151
|
};
|
|
3143
3152
|
continue;
|
|
3144
3153
|
}
|
|
3145
|
-
|
|
3146
|
-
let f =
|
|
3147
|
-
c += l === null ? i :
|
|
3154
|
+
B(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
3155
|
+
let f = Jn(e, t, r.localRect.width);
|
|
3156
|
+
c += l === null ? i : Yn(l, i), r.localRect = {
|
|
3148
3157
|
...r.localRect,
|
|
3149
3158
|
x: o + f,
|
|
3150
3159
|
y: c
|
|
@@ -3152,30 +3161,30 @@ function Kn(e, t, n, r, i, a) {
|
|
|
3152
3161
|
}
|
|
3153
3162
|
return l !== null && (c += l), c - s;
|
|
3154
3163
|
}
|
|
3155
|
-
function
|
|
3164
|
+
function Jn(e, t, n) {
|
|
3156
3165
|
let r = t - n;
|
|
3157
3166
|
return e.left === null && e.right === null ? Math.floor(r / 2) : e.left === null ? r - (e.right ?? 0) : e.left;
|
|
3158
3167
|
}
|
|
3159
|
-
function
|
|
3168
|
+
function Yn(e, t) {
|
|
3160
3169
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
3161
3170
|
}
|
|
3162
|
-
function
|
|
3171
|
+
function Xn(e, t, n, r, i) {
|
|
3163
3172
|
let a = e.width;
|
|
3164
3173
|
if (e.display === "table") {
|
|
3165
|
-
if (!r.children.some((e) => !
|
|
3174
|
+
if (!r.children.some((e) => !z(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? K(a, t, r, i) : Math.min(t, q(r, i));
|
|
3166
3175
|
if (a !== void 0 && a.kind !== "auto") {
|
|
3167
|
-
let e =
|
|
3168
|
-
return Math.max(e,
|
|
3176
|
+
let e = K(a, t, r, i);
|
|
3177
|
+
return Math.max(e, $n(r, t, i));
|
|
3169
3178
|
}
|
|
3170
|
-
return
|
|
3179
|
+
return xn(r, t, i);
|
|
3171
3180
|
}
|
|
3172
|
-
return a !== void 0 && a.kind !== "auto" ?
|
|
3181
|
+
return a !== void 0 && a.kind !== "auto" ? K(a, t, r, i) : n === "shrink" ? Math.min(t, q(r, i)) : t;
|
|
3173
3182
|
}
|
|
3174
|
-
function
|
|
3183
|
+
function Zn(e) {
|
|
3175
3184
|
let t = 0, n = 0;
|
|
3176
3185
|
for (let r of e.children) {
|
|
3177
3186
|
if (r.style.position === "fixed") continue;
|
|
3178
|
-
let e =
|
|
3187
|
+
let e = Qn(r);
|
|
3179
3188
|
t = Math.max(t, r.localRect.x + e.x), n = Math.max(n, r.localRect.y + e.y);
|
|
3180
3189
|
}
|
|
3181
3190
|
if (e.textExtent) {
|
|
@@ -3187,75 +3196,81 @@ function Xn(e) {
|
|
|
3187
3196
|
y: n
|
|
3188
3197
|
};
|
|
3189
3198
|
}
|
|
3190
|
-
function
|
|
3199
|
+
function Qn(e) {
|
|
3191
3200
|
let { width: t, height: n } = e.localRect, r = e.style.overflow.x !== "visible", i = e.style.overflow.y !== "visible";
|
|
3192
3201
|
if (r && i) return {
|
|
3193
3202
|
x: t,
|
|
3194
3203
|
y: n
|
|
3195
3204
|
};
|
|
3196
|
-
let a =
|
|
3205
|
+
let a = Zn(e);
|
|
3197
3206
|
return {
|
|
3198
3207
|
x: r ? t : Math.max(t, a.x),
|
|
3199
3208
|
y: i ? n : Math.max(n, a.y)
|
|
3200
3209
|
};
|
|
3201
3210
|
}
|
|
3202
|
-
function
|
|
3211
|
+
function $n(e, t, n) {
|
|
3203
3212
|
let r = e.style;
|
|
3204
|
-
return
|
|
3213
|
+
return bn(e, n).min + r.border.left + r.border.right + U(r.padding.left, t) + U(r.padding.right, t) + it(r).right;
|
|
3205
3214
|
}
|
|
3206
|
-
function
|
|
3215
|
+
function er(e, t) {
|
|
3207
3216
|
if (e.height?.kind === "cells") return e.height.value;
|
|
3208
3217
|
if (e.height?.kind === "percent" && t != null) return we(e.height.value, t);
|
|
3209
3218
|
}
|
|
3210
|
-
function
|
|
3219
|
+
function K(e, t, n, r) {
|
|
3211
3220
|
switch (e.kind) {
|
|
3212
3221
|
case "cells": return e.value;
|
|
3213
3222
|
case "percent": return we(e.value, t);
|
|
3214
3223
|
case "min-content": return Y(n, r);
|
|
3215
|
-
case "max-content": return
|
|
3216
|
-
case "fit-content": return Math.min(
|
|
3217
|
-
case "auto": return
|
|
3224
|
+
case "max-content": return q(n, r);
|
|
3225
|
+
case "fit-content": return Math.min(q(n, r), Math.max(Y(n, r), t));
|
|
3226
|
+
case "auto": return q(n, r);
|
|
3218
3227
|
}
|
|
3219
3228
|
}
|
|
3220
|
-
function
|
|
3229
|
+
function q(e, t) {
|
|
3221
3230
|
let n = t.maxContent.get(e);
|
|
3222
3231
|
if (n !== void 0) return n;
|
|
3223
|
-
let r = e.style, i =
|
|
3232
|
+
let r = e.style, i = tr(e, t) + r.border.left + r.border.right + Gn(r.padding.left) + Gn(r.padding.right) + it(r).right;
|
|
3224
3233
|
return t.maxContent.set(e, i), i;
|
|
3225
3234
|
}
|
|
3226
|
-
function
|
|
3227
|
-
let n = e.children.filter((e) => !
|
|
3228
|
-
if (n.length === 0) return e.style.display === "multicol" ?
|
|
3229
|
-
if (e.style.display === "grid") return
|
|
3230
|
-
if (e.style.display === "table") return
|
|
3235
|
+
function tr(e, t) {
|
|
3236
|
+
let n = e.children.filter((e) => !z(e.style) && !e.inlineBox);
|
|
3237
|
+
if (n.length === 0) return e.style.display === "multicol" ? Bt(e.style, e.intrinsicWidth) : e.intrinsicWidth;
|
|
3238
|
+
if (e.style.display === "grid") return _t(e, t).max;
|
|
3239
|
+
if (e.style.display === "table") return bn(e, t).max;
|
|
3231
3240
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
3232
|
-
let r = Math.max(
|
|
3233
|
-
return n.reduce((e, n) => e + J(n, t), 0) + r;
|
|
3241
|
+
let r = Math.max(Gn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3242
|
+
return n.reduce((e, n) => e + J(n, "max", t), 0) + r;
|
|
3234
3243
|
}
|
|
3235
|
-
let r = n.reduce((e, n) => Math.max(e, J(n, t)), 0);
|
|
3236
|
-
return e.style.display === "multicol" ?
|
|
3244
|
+
let r = n.reduce((e, n) => Math.max(e, J(n, "max", t)), 0);
|
|
3245
|
+
return e.style.display === "multicol" ? Bt(e.style, r) : r;
|
|
3246
|
+
}
|
|
3247
|
+
function J(e, t, n) {
|
|
3248
|
+
let r = e.style, i;
|
|
3249
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = K(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? Y(e, n) : q(e, n));
|
|
3250
|
+
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
3251
|
+
return Math.max(0, V(i, a, o));
|
|
3237
3252
|
}
|
|
3238
3253
|
function Y(e, t) {
|
|
3239
3254
|
let n = t.minContent.get(e);
|
|
3240
3255
|
if (n !== void 0) return n;
|
|
3241
|
-
let r = e.style, i =
|
|
3256
|
+
let r = e.style, i = nr(e, t) + r.border.left + r.border.right + Gn(r.padding.left) + Gn(r.padding.right) + it(r).right;
|
|
3242
3257
|
return t.minContent.set(e, i), i;
|
|
3243
3258
|
}
|
|
3244
|
-
function
|
|
3245
|
-
let n = e.children.filter((e) => !
|
|
3259
|
+
function nr(e, t) {
|
|
3260
|
+
let n = e.children.filter((e) => !z(e.style) && !e.inlineBox);
|
|
3246
3261
|
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : Pe(e.text, {
|
|
3247
3262
|
advances: e.advances,
|
|
3248
3263
|
tracking: e.style.tracking
|
|
3249
3264
|
});
|
|
3250
|
-
if (e.style.display === "grid") return
|
|
3251
|
-
if (e.style.display === "table") return
|
|
3265
|
+
if (e.style.display === "grid") return _t(e, t).min;
|
|
3266
|
+
if (e.style.display === "table") return bn(e, t).min;
|
|
3252
3267
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
3253
|
-
let r = Math.max(
|
|
3254
|
-
return n.reduce((e, n) => e +
|
|
3268
|
+
let r = Math.max(Gn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3269
|
+
return n.reduce((e, n) => e + J(n, "min", t), 0) + r;
|
|
3255
3270
|
}
|
|
3256
|
-
return n.reduce((e, n) => Math.max(e,
|
|
3271
|
+
return n.reduce((e, n) => Math.max(e, J(n, "min", t)), 0);
|
|
3257
3272
|
}
|
|
3258
|
-
function
|
|
3273
|
+
function rr(e, t, n, r) {
|
|
3259
3274
|
return {
|
|
3260
3275
|
width: Math.max(0, e - n.left - n.right - r.left - r.right),
|
|
3261
3276
|
height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
|
|
@@ -3263,38 +3278,38 @@ function nr(e, t, n, r) {
|
|
|
3263
3278
|
}
|
|
3264
3279
|
//#endregion
|
|
3265
3280
|
//#region src/plain-text.ts
|
|
3266
|
-
function rr(e) {
|
|
3267
|
-
return lr(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
3268
|
-
}
|
|
3269
3281
|
function ir(e) {
|
|
3270
|
-
|
|
3271
|
-
|
|
3282
|
+
return ur(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
3283
|
+
}
|
|
3284
|
+
function ar(e) {
|
|
3285
|
+
let { grid: t, paints: n } = ur(e);
|
|
3286
|
+
return t.map((e, t) => or(e, n[t]));
|
|
3272
3287
|
}
|
|
3273
|
-
function
|
|
3288
|
+
function or(e, t) {
|
|
3274
3289
|
let n = e.length;
|
|
3275
3290
|
for (; n > 0 && e[n - 1] === " " && t[n - 1]?.backgroundColor === void 0;) n--;
|
|
3276
3291
|
let r = [];
|
|
3277
3292
|
for (let i = 0; i < n; i++) {
|
|
3278
3293
|
let n = t[i], a = r[r.length - 1];
|
|
3279
|
-
a &&
|
|
3294
|
+
a && sr(a, n) ? a.text += e[i] : r.push({
|
|
3280
3295
|
text: e[i],
|
|
3281
3296
|
...n
|
|
3282
3297
|
});
|
|
3283
3298
|
}
|
|
3284
3299
|
return r;
|
|
3285
3300
|
}
|
|
3286
|
-
function
|
|
3301
|
+
function sr(e, t) {
|
|
3287
3302
|
return e.color === t?.color && e.backgroundColor === t?.backgroundColor && e.fontWeight === t?.fontWeight && e.fontStyle === t?.fontStyle && e.textDecorationLine === t?.textDecorationLine && e.opacity === t?.opacity;
|
|
3288
3303
|
}
|
|
3289
|
-
function
|
|
3304
|
+
function cr(e, t) {
|
|
3290
3305
|
e.color !== void 0 && (t.color = e.color), e.backgroundColor !== void 0 && (t.backgroundColor = e.backgroundColor), e.fontWeight !== void 0 && (t.fontWeight = e.fontWeight), e.fontStyle !== void 0 && (t.fontStyle = e.fontStyle), e.textDecorationLine !== void 0 && (t.textDecoration = e.textDecorationLine), e.opacity !== void 0 && (t.opacity = e.opacity);
|
|
3291
3306
|
}
|
|
3292
|
-
function
|
|
3307
|
+
function lr(e) {
|
|
3293
3308
|
return e.color === void 0 && e.backgroundColor === void 0 && e.fontWeight === void 0 && e.fontStyle === void 0 && e.textDecorationLine === void 0 && e.opacity === void 0;
|
|
3294
3309
|
}
|
|
3295
|
-
function
|
|
3310
|
+
function ur(e) {
|
|
3296
3311
|
let t = Math.max(0, e.localRect.width), n = Math.max(0, e.localRect.height), r = Array.from({ length: n }, () => Array.from({ length: t }, () => " ")), i = Array.from({ length: n }, () => Array.from({ length: t }, () => void 0));
|
|
3297
|
-
return
|
|
3312
|
+
return fr(e, 0, 0, (e, a, o, s) => {
|
|
3298
3313
|
if (e >= 0 && e < t && a >= 0 && a < n) {
|
|
3299
3314
|
r[a][e] = o;
|
|
3300
3315
|
let t = i[a][e];
|
|
@@ -3308,11 +3323,11 @@ function lr(e) {
|
|
|
3308
3323
|
paints: i
|
|
3309
3324
|
};
|
|
3310
3325
|
}
|
|
3311
|
-
function
|
|
3326
|
+
function dr(e) {
|
|
3312
3327
|
let t = {};
|
|
3313
3328
|
return e.color && (t.color = e.color), e.backgroundColor && (t.backgroundColor = e.backgroundColor), e.fontWeight !== "400" && e.fontWeight !== "normal" && e.fontWeight !== "" && (t.fontWeight = e.fontWeight), e.fontStyle !== "normal" && e.fontStyle !== "" && (t.fontStyle = e.fontStyle), e.textDecorationLine !== "none" && e.textDecorationLine !== "" && (t.textDecorationLine = e.textDecorationLine), t;
|
|
3314
3329
|
}
|
|
3315
|
-
function
|
|
3330
|
+
function fr(e, t, n, r, i = 1) {
|
|
3316
3331
|
if (e.tableHidden) return;
|
|
3317
3332
|
let a = t + e.localRect.x, o = n + e.localRect.y, s = e.style, c = (e) => i >= 1 ? e : {
|
|
3318
3333
|
...e,
|
|
@@ -3345,9 +3360,9 @@ function dr(e, t, n, r, i = 1) {
|
|
|
3345
3360
|
};
|
|
3346
3361
|
}
|
|
3347
3362
|
if (!e.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed") && e.text) {
|
|
3348
|
-
let t = m + s.border.left + u.left, n = h + s.border.top + u.top, r = e.localRect.width - s.border.left - s.border.right - u.left - u.right, i = e.multicolGeometry, { spans: a, textY: o } = i ??
|
|
3363
|
+
let t = m + s.border.left + u.left, n = h + s.border.top + u.top, r = e.localRect.width - s.border.left - s.border.right - u.left - u.right, i = e.multicolGeometry, { spans: a, textY: o } = i ?? Hn(e, r), l = i ? Math.max(1, i.columnWidth - s.tracking) : r, d = c(dr(s)), f = e.inlineElements?.map((e) => c(dr(e)));
|
|
3349
3364
|
for (let r = 0; r < a.length; r++) {
|
|
3350
|
-
let u = a[r], p = n + o[r], m = r === 0 ? s.textIndent : 0, h = s.whiteSpace !== "normal" && s.overflow.x === "clip" ?
|
|
3365
|
+
let u = a[r], p = n + o[r], m = r === 0 ? s.textIndent : 0, h = s.whiteSpace !== "normal" && s.overflow.x === "clip" ? hr(e.text, u, l - m, e.advances, s) : {
|
|
3351
3366
|
end: u.end,
|
|
3352
3367
|
ellipsis: !1
|
|
3353
3368
|
}, _ = I(u.start, u.end, e.advances, s.tracking), v = Math.max(0, l - m - _), y = s.textAlign === "end" ? v : s.textAlign === "center" ? Math.floor(v / 2) : 0, b = t + (i?.lineX[r] ?? 0) + y + m;
|
|
@@ -3361,40 +3376,50 @@ function dr(e, t, n, r, i = 1) {
|
|
|
3361
3376
|
h.ellipsis && g(b, p, "…", d);
|
|
3362
3377
|
}
|
|
3363
3378
|
}
|
|
3364
|
-
for (let t of pe(e))
|
|
3379
|
+
for (let t of pe(e)) fr(t, m, h, g, i * t.style.opacity);
|
|
3365
3380
|
let _ = e.scrollRange;
|
|
3366
3381
|
if (_ && d && (d.right > 0 || d.bottom > 0)) {
|
|
3367
|
-
let { track: t, thumb: n } = j(S(s.glyphSet)), i =
|
|
3368
|
-
if (d.
|
|
3369
|
-
let a
|
|
3370
|
-
for (let e = 0; e <
|
|
3371
|
-
let
|
|
3372
|
-
|
|
3373
|
-
let a = e >= o && e < o + s;
|
|
3374
|
-
r(c, i + e, a ? n : t, a ? h : m);
|
|
3375
|
-
}
|
|
3382
|
+
let { track: t, thumb: n } = j(S(s.glyphSet)), i = (e) => c(e ? { color: e } : void 0), l = i(s.scrollbarColor?.track ?? s.color), u = i(s.scrollbarColor?.thumb ?? s.color), d = pr(e, a, o);
|
|
3383
|
+
if (d.y) {
|
|
3384
|
+
let { col: i, row: a, thick: o, len: s } = d.y, { at: c, len: f } = mr(s, _.sizeY, _.maxY, e.scroll?.y ?? 0);
|
|
3385
|
+
for (let e = 0; e < o; e++) for (let o = 0; o < s; o++) {
|
|
3386
|
+
let s = o >= c && o < c + f;
|
|
3387
|
+
r(i + e, a + o, s ? n : t, s ? u : l);
|
|
3376
3388
|
}
|
|
3377
3389
|
}
|
|
3378
|
-
if (d.
|
|
3379
|
-
let i
|
|
3380
|
-
for (let e = 0; e <
|
|
3381
|
-
let s =
|
|
3382
|
-
|
|
3383
|
-
let i = e >= a && e < a + o;
|
|
3384
|
-
r(l + e, s, i ? n : t, i ? h : m);
|
|
3385
|
-
}
|
|
3390
|
+
if (d.x) {
|
|
3391
|
+
let { col: i, row: a, thick: o, len: s } = d.x, { at: c, len: f } = mr(s, _.sizeX, _.maxX, e.scroll?.x ?? 0);
|
|
3392
|
+
for (let e = 0; e < o; e++) for (let o = 0; o < s; o++) {
|
|
3393
|
+
let s = o >= c && o < c + f;
|
|
3394
|
+
r(i + o, a + e, s ? n : t, s ? u : l);
|
|
3386
3395
|
}
|
|
3387
3396
|
}
|
|
3388
3397
|
}
|
|
3389
3398
|
}
|
|
3390
|
-
function
|
|
3399
|
+
function pr(e, t, n) {
|
|
3400
|
+
let r = e.scrollGutterCells;
|
|
3401
|
+
if (!r) return {};
|
|
3402
|
+
let { border: i, scrollbarSize: a, scrollbarInset: o } = e.style, s = n + i.top, c = t + i.left, l = n + e.localRect.height - i.bottom, u = t + e.localRect.width - i.right, d = r.bottom > 0 ? l - r.bottom : l - o.y, f = r.right > 0 ? u - r.right : u - o.x, p = {};
|
|
3403
|
+
return r.right > 0 && (p.y = {
|
|
3404
|
+
col: u - r.right,
|
|
3405
|
+
row: s + o.y,
|
|
3406
|
+
thick: Math.min(a.y, r.right),
|
|
3407
|
+
len: Math.max(0, d - s - o.y)
|
|
3408
|
+
}), r.bottom > 0 && (p.x = {
|
|
3409
|
+
col: c + o.x,
|
|
3410
|
+
row: l - r.bottom,
|
|
3411
|
+
thick: Math.min(a.x, r.bottom),
|
|
3412
|
+
len: Math.max(0, f - c - o.x)
|
|
3413
|
+
}), p;
|
|
3414
|
+
}
|
|
3415
|
+
function mr(e, t, n, r) {
|
|
3391
3416
|
let i = t > 0 ? Math.min(1, e / t) : 1, a = Math.max(1, Math.round(i * e));
|
|
3392
3417
|
return n > 0 && (a = Math.max(1, Math.min(a, e - n))), {
|
|
3393
3418
|
at: n > 0 ? Math.round(Math.min(r, n) / n * (e - a)) : 0,
|
|
3394
3419
|
len: a
|
|
3395
3420
|
};
|
|
3396
3421
|
}
|
|
3397
|
-
function
|
|
3422
|
+
function hr(e, t, n, r, i) {
|
|
3398
3423
|
let { textOverflow: a, tracking: o } = i;
|
|
3399
3424
|
if (I(t.start, t.end, r, o) <= n) return {
|
|
3400
3425
|
end: t.end,
|
|
@@ -3409,61 +3434,61 @@ function pr(e, t, n, r, i) {
|
|
|
3409
3434
|
}
|
|
3410
3435
|
//#endregion
|
|
3411
3436
|
//#region src/paint.ts
|
|
3412
|
-
var
|
|
3413
|
-
function
|
|
3414
|
-
return
|
|
3415
|
-
}
|
|
3416
|
-
function
|
|
3417
|
-
let r =
|
|
3418
|
-
if (
|
|
3419
|
-
let a =
|
|
3420
|
-
if (a &&
|
|
3421
|
-
|
|
3437
|
+
var gr = /* @__PURE__ */ new WeakMap(), _r = /* @__PURE__ */ new WeakMap();
|
|
3438
|
+
function vr(e) {
|
|
3439
|
+
return xr(e, !0) !== null;
|
|
3440
|
+
}
|
|
3441
|
+
function yr(e, t, n = !1) {
|
|
3442
|
+
let r = ar(e), i = Er(r);
|
|
3443
|
+
if (gr.get(t) === i) return !0;
|
|
3444
|
+
let a = _r.get(t);
|
|
3445
|
+
if (a && br(t, a.nodes, r)) {
|
|
3446
|
+
gr.set(t, i);
|
|
3422
3447
|
for (let e = 0; e < r.length; e++) for (let t = 0; t < r[e].length; t++) {
|
|
3423
3448
|
let n = r[e][t];
|
|
3424
|
-
if (
|
|
3449
|
+
if (lr(n) || sr(n, a.segments[e][t])) continue;
|
|
3425
3450
|
let i = a.nodes[e][t];
|
|
3426
|
-
i.style.cssText = "",
|
|
3451
|
+
i.style.cssText = "", cr(n, i.style);
|
|
3427
3452
|
}
|
|
3428
3453
|
return a.segments = r, !0;
|
|
3429
3454
|
}
|
|
3430
|
-
if (n &&
|
|
3431
|
-
|
|
3455
|
+
if (n && vr(t)) return !1;
|
|
3456
|
+
gr.set(t, i);
|
|
3432
3457
|
let o = document.createDocumentFragment(), s = [];
|
|
3433
3458
|
for (let e = 0; e < r.length; e++) {
|
|
3434
3459
|
e > 0 && o.appendChild(document.createTextNode("\n"));
|
|
3435
3460
|
let t = [];
|
|
3436
3461
|
for (let n of r[e]) {
|
|
3437
|
-
if (
|
|
3462
|
+
if (lr(n)) {
|
|
3438
3463
|
let e = document.createTextNode(n.text);
|
|
3439
3464
|
t.push(e), o.appendChild(e);
|
|
3440
3465
|
continue;
|
|
3441
3466
|
}
|
|
3442
3467
|
let e = document.createElement("span");
|
|
3443
|
-
|
|
3468
|
+
cr(n, e.style), e.textContent = n.text, t.push(e), o.appendChild(e);
|
|
3444
3469
|
}
|
|
3445
3470
|
s.push(t);
|
|
3446
3471
|
}
|
|
3447
|
-
|
|
3472
|
+
_r.set(t, {
|
|
3448
3473
|
nodes: s,
|
|
3449
3474
|
segments: r
|
|
3450
3475
|
});
|
|
3451
|
-
let c =
|
|
3452
|
-
return t.replaceChildren(o), c &&
|
|
3476
|
+
let c = xr(t, !1);
|
|
3477
|
+
return t.replaceChildren(o), c && Sr(t, c), !0;
|
|
3453
3478
|
}
|
|
3454
|
-
function
|
|
3479
|
+
function br(e, t, n) {
|
|
3455
3480
|
if (t.length !== n.length) return !1;
|
|
3456
3481
|
for (let r = 0; r < n.length; r++) {
|
|
3457
3482
|
let i = t[r], a = n[r];
|
|
3458
3483
|
if (i.length !== a.length) return !1;
|
|
3459
3484
|
for (let t = 0; t < a.length; t++) {
|
|
3460
3485
|
let n = i[t];
|
|
3461
|
-
if (
|
|
3486
|
+
if (lr(a[t]) !== (n.nodeType === Node.TEXT_NODE) || n.textContent !== a[t].text || n.parentNode !== e) return !1;
|
|
3462
3487
|
}
|
|
3463
3488
|
}
|
|
3464
3489
|
return !0;
|
|
3465
3490
|
}
|
|
3466
|
-
function
|
|
3491
|
+
function xr(e, t) {
|
|
3467
3492
|
try {
|
|
3468
3493
|
let n = e.ownerDocument.getSelection();
|
|
3469
3494
|
if (!n) return null;
|
|
@@ -3479,7 +3504,7 @@ function yr(e, t) {
|
|
|
3479
3504
|
if (!e || e.rangeCount === 0) return null;
|
|
3480
3505
|
i = e.getRangeAt(0);
|
|
3481
3506
|
}
|
|
3482
|
-
let a =
|
|
3507
|
+
let a = Cr(e, i.startContainer, i.startOffset), o = Cr(e, i.endContainer, i.endOffset);
|
|
3483
3508
|
return a === null || o === null || a === o && !t ? null : {
|
|
3484
3509
|
start: a,
|
|
3485
3510
|
end: o,
|
|
@@ -3489,32 +3514,32 @@ function yr(e, t) {
|
|
|
3489
3514
|
return null;
|
|
3490
3515
|
}
|
|
3491
3516
|
}
|
|
3492
|
-
function
|
|
3517
|
+
function Sr(e, t) {
|
|
3493
3518
|
try {
|
|
3494
|
-
let n =
|
|
3519
|
+
let n = wr(e, t.start), r = wr(e, t.end);
|
|
3495
3520
|
if (!n || !r) return;
|
|
3496
3521
|
let i = e.getRootNode().getSelection?.() ?? e.ownerDocument.getSelection();
|
|
3497
3522
|
t.backward ? i?.setBaseAndExtent(r[0], r[1], n[0], n[1]) : i?.setBaseAndExtent(n[0], n[1], r[0], r[1]);
|
|
3498
3523
|
} catch {}
|
|
3499
3524
|
}
|
|
3500
|
-
function
|
|
3525
|
+
function Cr(e, t, n) {
|
|
3501
3526
|
if (!e.contains(t)) return null;
|
|
3502
3527
|
let r = e.ownerDocument.createRange();
|
|
3503
3528
|
return r.selectNodeContents(e), r.setEnd(t, n), r.toString().length;
|
|
3504
3529
|
}
|
|
3505
|
-
function
|
|
3530
|
+
function wr(e, t) {
|
|
3506
3531
|
let n = t, r = null;
|
|
3507
|
-
for (let t of
|
|
3532
|
+
for (let t of Tr(e)) {
|
|
3508
3533
|
if (n <= t.data.length) return [t, n];
|
|
3509
3534
|
n -= t.data.length, r = [t, t.data.length];
|
|
3510
3535
|
}
|
|
3511
3536
|
return r;
|
|
3512
3537
|
}
|
|
3513
|
-
function*
|
|
3538
|
+
function* Tr(e) {
|
|
3514
3539
|
let t = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT), n = t.nextNode();
|
|
3515
3540
|
for (; n;) yield n, n = t.nextNode();
|
|
3516
3541
|
}
|
|
3517
|
-
function
|
|
3542
|
+
function Er(e) {
|
|
3518
3543
|
let t = [];
|
|
3519
3544
|
for (let n of e) {
|
|
3520
3545
|
for (let e of n) t.push(e.text, e.color ?? "", e.backgroundColor ?? "", e.fontWeight ?? "", e.fontStyle ?? "", e.textDecorationLine ?? "", e.opacity ?? "");
|
|
@@ -3524,9 +3549,9 @@ function wr(e) {
|
|
|
3524
3549
|
}
|
|
3525
3550
|
//#endregion
|
|
3526
3551
|
//#region src/render.ts
|
|
3527
|
-
function
|
|
3552
|
+
function Dr(e) {
|
|
3528
3553
|
let t = /* @__PURE__ */ new Set();
|
|
3529
|
-
|
|
3554
|
+
Or(e, !0, t);
|
|
3530
3555
|
for (let n of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!t.has(n)) {
|
|
3531
3556
|
n.removeAttribute("data-mw-inline-inset");
|
|
3532
3557
|
let e = n.style;
|
|
@@ -3547,33 +3572,33 @@ function Z(e, t) {
|
|
|
3547
3572
|
function Q(e, t, n) {
|
|
3548
3573
|
e.hasAttribute(t) !== n && (n ? e.setAttribute(t, "") : e.removeAttribute(t));
|
|
3549
3574
|
}
|
|
3550
|
-
function
|
|
3575
|
+
function Or(e, t, n) {
|
|
3551
3576
|
if (e.inlineElements) for (let { element: t, tracking: r, padLeft: i, padRight: a, insets: o } of e.inlineElements) {
|
|
3552
3577
|
let e = t;
|
|
3553
|
-
X(e, "--mw-ls", String(r)), i > 0 ? X(e, "--mw-ipl", String(i)) : Z(e, "--mw-ipl"), a > 0 ? X(e, "--mw-ipr", String(a)) : Z(e, "--mw-ipr"), o && (n.add(t),
|
|
3578
|
+
X(e, "--mw-ls", String(r)), i > 0 ? X(e, "--mw-ipl", String(i)) : Z(e, "--mw-ipl"), a > 0 ? X(e, "--mw-ipr", String(a)) : Z(e, "--mw-ipr"), o && (n.add(t), kr(e, o));
|
|
3554
3579
|
}
|
|
3555
|
-
if (t ||
|
|
3580
|
+
if (t || jr(e), !e.tableHidden) for (let t of pe(e)) {
|
|
3556
3581
|
let r = t.source;
|
|
3557
|
-
t.style.zIndex !== null && fe(t, e) && !t.inlineBox ? X(r, "--mw-z", String(t.style.zIndex)) : Z(r, "--mw-z"),
|
|
3582
|
+
t.style.zIndex !== null && fe(t, e) && !t.inlineBox ? X(r, "--mw-z", String(t.style.zIndex)) : Z(r, "--mw-z"), Or(t, !1, n);
|
|
3558
3583
|
}
|
|
3559
3584
|
}
|
|
3560
|
-
function
|
|
3585
|
+
function kr(e, t) {
|
|
3561
3586
|
Q(e, "data-mw-inline-inset", !0);
|
|
3562
3587
|
let n = (t, n) => {
|
|
3563
3588
|
n === null ? Z(e, t) : X(e, t, String(n));
|
|
3564
3589
|
};
|
|
3565
3590
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
3566
3591
|
}
|
|
3567
|
-
function
|
|
3592
|
+
function Ar(e) {
|
|
3568
3593
|
let t = e.style;
|
|
3569
3594
|
if (t.textAlign !== "center" || !e.text || e.inlineBox || e.children.length > 0) return !1;
|
|
3570
|
-
let n = e.multicolGeometry, r = e.resolvedPadding, i = e.localRect.width - t.border.left - t.border.right - r.left - r.right, a = n ? Math.max(1, n.columnWidth - t.tracking) : i, o = n?.spans ??
|
|
3595
|
+
let n = e.multicolGeometry, r = e.resolvedPadding, i = e.localRect.width - t.border.left - t.border.right - r.left - r.right, a = n ? Math.max(1, n.columnWidth - t.tracking) : i, o = n?.spans ?? Un(e, i);
|
|
3571
3596
|
return o.length !== 0 && o.every((n, r) => {
|
|
3572
3597
|
let i = r === 0 ? t.textIndent : 0, o = a - i - I(n.start, n.end, e.advances, t.tracking);
|
|
3573
3598
|
return o > 0 && o % 2 == 1;
|
|
3574
3599
|
});
|
|
3575
3600
|
}
|
|
3576
|
-
function
|
|
3601
|
+
function jr(e) {
|
|
3577
3602
|
let t = e.source, n = e.localRect, r = e.resolvedPadding, { border: i, textAlignBlocked: a, overflow: o, whiteSpace: s, tracking: c, lineGap: l } = e.style, u = e.multicolFlow, d = e.multicolFlowSpan;
|
|
3578
3603
|
Q(t, "data-mw-laid-out", !e.inlineBox && !u && !d), Q(t, "data-mw-inline-box", !!e.inlineBox), Q(t, "data-mw-multicol-flow", !!u), Q(t, "data-mw-multicol-flow-span", !!d);
|
|
3579
3604
|
let f = u ?? d;
|
|
@@ -3583,107 +3608,111 @@ function kr(e) {
|
|
|
3583
3608
|
let { maxX: n, maxY: r } = e.scrollRange;
|
|
3584
3609
|
X(t, "--mw-se-x", String(n > 0 ? n + e.localRect.width : 1)), X(t, "--mw-se-y", String(r > 0 ? r + e.localRect.height : 1));
|
|
3585
3610
|
} else Z(t, "--mw-se-x"), Z(t, "--mw-se-y");
|
|
3586
|
-
X(t, "--mw-pt", String(r.top)), X(t, "--mw-pr", String(r.right)), X(t, "--mw-pb", String(r.bottom)), X(t, "--mw-pl", String(r.left)), X(t, "--mw-bt", String(i.top)), X(t, "--mw-br", String(i.right)), X(t, "--mw-bb", String(i.bottom)), X(t, "--mw-bl", String(i.left)), X(t, "--mw-ti", String(e.style.textIndent)), Q(t, "data-mw-text-align-blocked", a), Q(t, "data-mw-center-nudge",
|
|
3611
|
+
X(t, "--mw-pt", String(r.top)), X(t, "--mw-pr", String(r.right)), X(t, "--mw-pb", String(r.bottom)), X(t, "--mw-pl", String(r.left)), X(t, "--mw-bt", String(i.top)), X(t, "--mw-br", String(i.right)), X(t, "--mw-bb", String(i.bottom)), X(t, "--mw-bl", String(i.left)), X(t, "--mw-ti", String(e.style.textIndent)), Q(t, "data-mw-text-align-blocked", a), Q(t, "data-mw-center-nudge", Ar(e)), Q(t, "data-mw-dropped-text", !!e.droppedText), Q(t, "data-mw-table-hidden", !!e.tableHidden);
|
|
3587
3612
|
}
|
|
3588
3613
|
//#endregion
|
|
3589
3614
|
//#region src/style.ts
|
|
3590
|
-
function
|
|
3591
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
3592
|
-
|
|
3593
|
-
let c = r.display ||
|
|
3615
|
+
function Mr(e, t, n) {
|
|
3616
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = ei(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
3617
|
+
Yr(e, o, s);
|
|
3618
|
+
let c = (e, r, i) => _i(a, e, r, o, i, s, n, t) ?? yi(a, e, r, o, i, s, n, t) ?? ui(r, t), l = r.display || Kr[e.tagName] || "", u = qr[l] ?? "none", d = r.columnCount && r.columnCount !== "auto" ? Math.max(1, Math.floor(Number(r.columnCount) || 1)) : null, f = r.columnWidth && r.columnWidth !== "auto" ? parseFloat(r.columnWidth) : NaN, p = Number.isFinite(f) ? Math.max(1, F(f, t)) : null, m = l === "flex" || l === "inline-flex" ? "flex" : l === "grid" || l === "inline-grid" ? "grid" : l === "table" || l === "inline-table" ? "table" : l === "none" || Gr(e, r) ? "none" : d !== null || p !== null ? "multicol" : "block", h = { kind: "none" }, g = { kind: "none" }, _ = [st()], v = [st()], y = {
|
|
3594
3619
|
direction: "row",
|
|
3595
3620
|
dense: !1
|
|
3596
|
-
},
|
|
3597
|
-
if (
|
|
3598
|
-
if (a)
|
|
3621
|
+
}, b = null;
|
|
3622
|
+
if (m === "grid") {
|
|
3623
|
+
if (a) h = Si(a.get("grid-template-columns")?.toString() ?? "", t), g = Si(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
3599
3624
|
else {
|
|
3600
3625
|
e.setAttribute("data-mw-degrid", "");
|
|
3601
3626
|
try {
|
|
3602
|
-
|
|
3627
|
+
h = Si(r.getPropertyValue("grid-template-columns"), t), g = Si(r.getPropertyValue("grid-template-rows"), t);
|
|
3603
3628
|
} finally {
|
|
3604
3629
|
e.removeAttribute("data-mw-degrid");
|
|
3605
3630
|
}
|
|
3606
3631
|
}
|
|
3607
|
-
|
|
3632
|
+
_ = Ei(r.getPropertyValue("grid-auto-columns"), t), v = Ei(r.getPropertyValue("grid-auto-rows"), t), y = Mi(r.getPropertyValue("grid-auto-flow")), b = Ti(r.getPropertyValue("grid-template-areas"));
|
|
3608
3633
|
}
|
|
3609
|
-
let
|
|
3610
|
-
if (
|
|
3634
|
+
let x = "auto", S = !1, C = 0, w = 0;
|
|
3635
|
+
if (m === "table" && (x = r.tableLayout === "fixed" ? "fixed" : "auto", S = r.borderCollapse === "collapse", !S)) {
|
|
3611
3636
|
let e = r.borderSpacing.split(" ");
|
|
3612
|
-
|
|
3613
|
-
}
|
|
3614
|
-
let
|
|
3615
|
-
display:
|
|
3616
|
-
tableRole:
|
|
3617
|
-
tableLayout:
|
|
3618
|
-
borderCollapse:
|
|
3619
|
-
borderSpacingX:
|
|
3620
|
-
borderSpacingY:
|
|
3637
|
+
C = F(parseFloat(e[0] ?? "") || 0, t), w = F(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
3638
|
+
}
|
|
3639
|
+
let T = {
|
|
3640
|
+
display: m,
|
|
3641
|
+
tableRole: u,
|
|
3642
|
+
tableLayout: x,
|
|
3643
|
+
borderCollapse: S,
|
|
3644
|
+
borderSpacingX: C,
|
|
3645
|
+
borderSpacingY: w,
|
|
3621
3646
|
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
3622
|
-
verticalAlign:
|
|
3647
|
+
verticalAlign: u === "cell" || l.startsWith("inline-") ? Jr(e, r) : "start",
|
|
3623
3648
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
3624
3649
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
3625
3650
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
3626
3651
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
3627
3652
|
flexGrow: Number(r.flexGrow) || 0,
|
|
3628
3653
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
3629
|
-
flexBasis:
|
|
3654
|
+
flexBasis: bi(r.flexBasis, t),
|
|
3630
3655
|
order: Number(r.order) || 0,
|
|
3631
|
-
justifyContent:
|
|
3632
|
-
alignContent:
|
|
3633
|
-
alignItems:
|
|
3634
|
-
alignSelf:
|
|
3635
|
-
justifyItems:
|
|
3636
|
-
justifySelf:
|
|
3637
|
-
gridTemplateColumns:
|
|
3638
|
-
gridTemplateRows:
|
|
3639
|
-
gridAutoColumns:
|
|
3640
|
-
gridAutoRows:
|
|
3641
|
-
gridAutoFlow:
|
|
3642
|
-
gridTemplateAreas:
|
|
3643
|
-
gridColumnStart:
|
|
3644
|
-
gridColumnEnd:
|
|
3645
|
-
gridRowStart:
|
|
3646
|
-
gridRowEnd:
|
|
3647
|
-
width:
|
|
3648
|
-
height:
|
|
3649
|
-
minWidth:
|
|
3650
|
-
minHeight:
|
|
3651
|
-
maxWidth:
|
|
3652
|
-
maxHeight:
|
|
3653
|
-
padding:
|
|
3654
|
-
margin:
|
|
3655
|
-
position:
|
|
3656
|
-
insets:
|
|
3657
|
-
gapX: $(r.columnGap === "normal" || r.columnGap === "" ?
|
|
3656
|
+
justifyContent: ti(r.justifyContent),
|
|
3657
|
+
alignContent: ti(r.alignContent),
|
|
3658
|
+
alignItems: ni(r.alignItems),
|
|
3659
|
+
alignSelf: ri(r.alignSelf),
|
|
3660
|
+
justifyItems: ni(r.justifyItems),
|
|
3661
|
+
justifySelf: ri(r.justifySelf),
|
|
3662
|
+
gridTemplateColumns: h,
|
|
3663
|
+
gridTemplateRows: g,
|
|
3664
|
+
gridAutoColumns: _,
|
|
3665
|
+
gridAutoRows: v,
|
|
3666
|
+
gridAutoFlow: y,
|
|
3667
|
+
gridTemplateAreas: b,
|
|
3668
|
+
gridColumnStart: ji(r.getPropertyValue("grid-column-start")),
|
|
3669
|
+
gridColumnEnd: ji(r.getPropertyValue("grid-column-end")),
|
|
3670
|
+
gridRowStart: ji(r.getPropertyValue("grid-row-start")),
|
|
3671
|
+
gridRowEnd: ji(r.getPropertyValue("grid-row-end")),
|
|
3672
|
+
width: pi(a, r.width, "width", t, o, s, n),
|
|
3673
|
+
height: pi(a, r.height, "height", t, o, s, n),
|
|
3674
|
+
minWidth: c("min-width", r.minWidth, "min-w") ?? "auto",
|
|
3675
|
+
minHeight: c("min-height", r.minHeight, "min-h") ?? "auto",
|
|
3676
|
+
maxWidth: c("max-width", r.maxWidth, "max-w"),
|
|
3677
|
+
maxHeight: c("max-height", r.maxHeight, "max-h"),
|
|
3678
|
+
padding: Pi(r, t),
|
|
3679
|
+
margin: ii(r, a, o, s, t),
|
|
3680
|
+
position: si(r.position),
|
|
3681
|
+
insets: ci(r, a, o, s, t),
|
|
3682
|
+
gapX: $(r.columnGap === "normal" || r.columnGap === "" ? m === "multicol" ? `${i}px` : "0px" : r.columnGap, t),
|
|
3658
3683
|
gapY: $(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
3659
|
-
border:
|
|
3684
|
+
border: Fi(r),
|
|
3660
3685
|
borderStyle: {
|
|
3661
|
-
top:
|
|
3662
|
-
right:
|
|
3663
|
-
bottom:
|
|
3664
|
-
left:
|
|
3686
|
+
top: li(r.borderTopStyle),
|
|
3687
|
+
right: li(r.borderRightStyle),
|
|
3688
|
+
bottom: li(r.borderBottomStyle),
|
|
3689
|
+
left: li(r.borderLeftStyle)
|
|
3665
3690
|
},
|
|
3666
|
-
overflow:
|
|
3667
|
-
scrollbarWidth:
|
|
3668
|
-
scrollbarColor:
|
|
3691
|
+
overflow: Wr(r),
|
|
3692
|
+
scrollbarWidth: Br(e, r),
|
|
3693
|
+
scrollbarColor: Vr(r.scrollbarColor),
|
|
3669
3694
|
overscroll: {
|
|
3670
3695
|
x: (r.overscrollBehaviorX || "auto") === "auto",
|
|
3671
3696
|
y: (r.overscrollBehaviorY || "auto") === "auto"
|
|
3672
3697
|
},
|
|
3673
3698
|
scrollbarSize: {
|
|
3674
|
-
x:
|
|
3675
|
-
y:
|
|
3699
|
+
x: Hr(r.getPropertyValue("--mw-scrollbar-size-x")),
|
|
3700
|
+
y: Hr(r.getPropertyValue("--mw-scrollbar-size-y"))
|
|
3701
|
+
},
|
|
3702
|
+
scrollbarInset: {
|
|
3703
|
+
x: Hr(r.getPropertyValue("--mw-scrollbar-inset-x"), 0),
|
|
3704
|
+
y: Hr(r.getPropertyValue("--mw-scrollbar-inset-y"), 0)
|
|
3676
3705
|
},
|
|
3677
3706
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
3678
3707
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
3679
|
-
lineGap:
|
|
3680
|
-
tracking:
|
|
3708
|
+
lineGap: oi(r.lineHeight, i),
|
|
3709
|
+
tracking: ai(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
3681
3710
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
3682
3711
|
color: r.color,
|
|
3683
3712
|
fontWeight: r.fontWeight,
|
|
3684
3713
|
fontStyle: r.fontStyle,
|
|
3685
3714
|
textDecorationLine: r.textDecorationLine,
|
|
3686
|
-
backgroundColor:
|
|
3715
|
+
backgroundColor: Fr(e, r.backgroundColor, r),
|
|
3687
3716
|
backgroundClear: r.getPropertyValue("--mw-bg-clear").trim() === "1",
|
|
3688
3717
|
borderColor: {
|
|
3689
3718
|
top: r.borderTopColor,
|
|
@@ -3691,33 +3720,33 @@ function Ar(e, t, n) {
|
|
|
3691
3720
|
bottom: r.borderBottomColor,
|
|
3692
3721
|
left: r.borderLeftColor
|
|
3693
3722
|
},
|
|
3694
|
-
textAlignBlocked:
|
|
3695
|
-
textAlign:
|
|
3696
|
-
textIndent:
|
|
3697
|
-
opacity:
|
|
3723
|
+
textAlignBlocked: Qr(e, r),
|
|
3724
|
+
textAlign: $r(e, r),
|
|
3725
|
+
textIndent: fi(r, t),
|
|
3726
|
+
opacity: di(r.opacity),
|
|
3698
3727
|
glyphSet: r.getPropertyValue("--mw-border-glyphs").trim() || null,
|
|
3699
3728
|
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
3700
3729
|
latticeBorder: null,
|
|
3701
|
-
ruleX:
|
|
3702
|
-
ruleY:
|
|
3703
|
-
ruleBreak:
|
|
3730
|
+
ruleX: m === "flex" || m === "grid" || m === "multicol" ? Zr(r, "x") : null,
|
|
3731
|
+
ruleY: m === "flex" || m === "grid" ? Zr(r, "y") : null,
|
|
3732
|
+
ruleBreak: Xr(r, "--mw-rule-break", ["none", "intersection"], "normal"),
|
|
3704
3733
|
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, P(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
3705
|
-
ruleVisibilityItems:
|
|
3734
|
+
ruleVisibilityItems: Xr(r, "--mw-rule-visibility-items", [
|
|
3706
3735
|
"all",
|
|
3707
3736
|
"around",
|
|
3708
3737
|
"between"
|
|
3709
3738
|
], "normal"),
|
|
3710
|
-
columnCount:
|
|
3711
|
-
columnWidth:
|
|
3739
|
+
columnCount: d,
|
|
3740
|
+
columnWidth: p,
|
|
3712
3741
|
columnFill: r.columnFill === "auto" ? "auto" : "balance",
|
|
3713
3742
|
columnSpan: r.columnSpan === "all",
|
|
3714
3743
|
breakBeforeColumn: r.breakBefore === "column",
|
|
3715
3744
|
breakAfterColumn: r.breakAfter === "column",
|
|
3716
3745
|
breakInsideAvoid: r.breakInside === "avoid" || r.breakInside === "avoid-column"
|
|
3717
3746
|
};
|
|
3718
|
-
return
|
|
3747
|
+
return Nr(T, r), T;
|
|
3719
3748
|
}
|
|
3720
|
-
function
|
|
3749
|
+
function Nr(e, t) {
|
|
3721
3750
|
t.borderCollapse === "collapse" && (e.display === "table" || e.tableRole === "cell" || e.tableRole === "row" || e.tableRole === "row-group" || e.tableRole === "header-group" || e.tableRole === "footer-group") && (e.latticeBorder = {
|
|
3722
3751
|
width: e.border,
|
|
3723
3752
|
style: e.borderStyle,
|
|
@@ -3728,37 +3757,37 @@ function jr(e, t) {
|
|
|
3728
3757
|
bottom: t.borderBottomStyle === "hidden",
|
|
3729
3758
|
left: t.borderLeftStyle === "hidden"
|
|
3730
3759
|
}
|
|
3731
|
-
}, e.border =
|
|
3760
|
+
}, e.border = ot(), e.display === "table" && (e.padding = ot()));
|
|
3732
3761
|
}
|
|
3733
|
-
function
|
|
3762
|
+
function Pr(e) {
|
|
3734
3763
|
if (!e) return !0;
|
|
3735
3764
|
let t = e.trim().toLowerCase();
|
|
3736
3765
|
return t === "" || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "currentcolor";
|
|
3737
3766
|
}
|
|
3738
|
-
function
|
|
3739
|
-
let i = r(e,
|
|
3767
|
+
function Fr(e, t, n) {
|
|
3768
|
+
let i = r(e, Pr(t) ? "" : t, n);
|
|
3740
3769
|
return i === "" ? void 0 : i;
|
|
3741
3770
|
}
|
|
3742
|
-
function
|
|
3771
|
+
function Ir(e) {
|
|
3743
3772
|
return e === "hidden" || e === "clip";
|
|
3744
3773
|
}
|
|
3745
|
-
var
|
|
3746
|
-
function
|
|
3747
|
-
if (
|
|
3774
|
+
var Lr = /* @__PURE__ */ new WeakMap(), Rr = null;
|
|
3775
|
+
function zr(e) {
|
|
3776
|
+
if (Rr !== null) return Rr;
|
|
3748
3777
|
if (!e.body) return !0;
|
|
3749
3778
|
let t = e.createElement("div");
|
|
3750
|
-
return t.style.cssText = "position: absolute; width: 0; height: 0; overflow: auto", e.body.appendChild(t),
|
|
3779
|
+
return t.style.cssText = "position: absolute; width: 0; height: 0; overflow: auto", e.body.appendChild(t), Rr = getComputedStyle(t).scrollbarWidth !== "none", t.remove(), Rr;
|
|
3751
3780
|
}
|
|
3752
|
-
function
|
|
3753
|
-
if (!
|
|
3781
|
+
function Br(e, t) {
|
|
3782
|
+
if (!zr(e.ownerDocument)) return "auto";
|
|
3754
3783
|
if (e.hasAttribute("data-mw-scroll")) {
|
|
3755
|
-
let t =
|
|
3784
|
+
let t = Lr.get(e);
|
|
3756
3785
|
if (t !== void 0) return t;
|
|
3757
3786
|
}
|
|
3758
3787
|
let n = t.scrollbarWidth === "none" ? "none" : "auto";
|
|
3759
|
-
return
|
|
3788
|
+
return Lr.set(e, n), n;
|
|
3760
3789
|
}
|
|
3761
|
-
function
|
|
3790
|
+
function Vr(e) {
|
|
3762
3791
|
let t = (e ?? "").trim();
|
|
3763
3792
|
if (!t || t === "auto") return null;
|
|
3764
3793
|
let n = 0;
|
|
@@ -3773,25 +3802,25 @@ function zr(e) {
|
|
|
3773
3802
|
}
|
|
3774
3803
|
return null;
|
|
3775
3804
|
}
|
|
3776
|
-
function
|
|
3777
|
-
return Math.max(
|
|
3805
|
+
function Hr(e, t = 1) {
|
|
3806
|
+
return Math.max(t, Math.floor(Number(e) || t));
|
|
3778
3807
|
}
|
|
3779
|
-
function
|
|
3780
|
-
return
|
|
3808
|
+
function Ur(e) {
|
|
3809
|
+
return Ir(e) ? "clip" : e === "auto" || e === "scroll" ? e : "visible";
|
|
3781
3810
|
}
|
|
3782
|
-
function
|
|
3783
|
-
let t =
|
|
3811
|
+
function Wr(e) {
|
|
3812
|
+
let t = Ur(e.overflowX || e.overflow), n = Ur(e.overflowY || e.overflow);
|
|
3784
3813
|
return t !== "visible" && n === "visible" && (n = "auto"), n !== "visible" && t === "visible" && (t = "auto"), {
|
|
3785
3814
|
x: t,
|
|
3786
3815
|
y: n
|
|
3787
3816
|
};
|
|
3788
3817
|
}
|
|
3789
|
-
function
|
|
3818
|
+
function Gr(e, t) {
|
|
3790
3819
|
if (t.position !== "absolute" && t.position !== "fixed") return !1;
|
|
3791
3820
|
let n = t.clip.replace(/\s/g, "");
|
|
3792
|
-
return n === "rect(0px,0px,0px,0px)" || n === "rect(0,0,0,0)" || !ae(e.tagName) && (
|
|
3821
|
+
return n === "rect(0px,0px,0px,0px)" || n === "rect(0,0,0,0)" || !ae(e.tagName) && (Ir(t.overflow) || Ir(t.overflowX)) && parseFloat(t.width) <= 1 && parseFloat(t.height) <= 1;
|
|
3793
3822
|
}
|
|
3794
|
-
var
|
|
3823
|
+
var Kr = {
|
|
3795
3824
|
TABLE: "table",
|
|
3796
3825
|
THEAD: "table-header-group",
|
|
3797
3826
|
TBODY: "table-row-group",
|
|
@@ -3802,7 +3831,7 @@ var Wr = {
|
|
|
3802
3831
|
CAPTION: "table-caption",
|
|
3803
3832
|
COL: "table-column",
|
|
3804
3833
|
COLGROUP: "table-column-group"
|
|
3805
|
-
},
|
|
3834
|
+
}, qr = {
|
|
3806
3835
|
"table-header-group": "header-group",
|
|
3807
3836
|
"table-row-group": "row-group",
|
|
3808
3837
|
"table-footer-group": "footer-group",
|
|
@@ -3812,38 +3841,38 @@ var Wr = {
|
|
|
3812
3841
|
"table-column": "column",
|
|
3813
3842
|
"table-column-group": "column-group"
|
|
3814
3843
|
};
|
|
3815
|
-
function
|
|
3844
|
+
function Jr(e, t) {
|
|
3816
3845
|
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
3817
3846
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
3818
3847
|
}
|
|
3819
|
-
function
|
|
3848
|
+
function Yr(e, t, n) {
|
|
3820
3849
|
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && N(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
3821
3850
|
}
|
|
3822
|
-
function
|
|
3851
|
+
function Xr(e, t, n, r) {
|
|
3823
3852
|
let i = e.getPropertyValue(t).trim();
|
|
3824
3853
|
return n.includes(i) ? i : r;
|
|
3825
3854
|
}
|
|
3826
|
-
function
|
|
3855
|
+
function Zr(e, t) {
|
|
3827
3856
|
let n = P(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
3828
3857
|
if (n <= 0) return null;
|
|
3829
3858
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
3830
3859
|
return {
|
|
3831
3860
|
width: n,
|
|
3832
|
-
style:
|
|
3861
|
+
style: li(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
3833
3862
|
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
3834
3863
|
};
|
|
3835
3864
|
}
|
|
3836
|
-
function
|
|
3865
|
+
function Qr(e, t) {
|
|
3837
3866
|
return t.textAlign === "justify" || e.getAttribute("align")?.toLowerCase() === "justify";
|
|
3838
3867
|
}
|
|
3839
|
-
function
|
|
3868
|
+
function $r(e, t) {
|
|
3840
3869
|
let n = t.textAlign || e.getAttribute("align")?.toLowerCase() || "";
|
|
3841
3870
|
return n === "right" || n === "end" ? "end" : n === "center" || n.endsWith("-center") ? "center" : "start";
|
|
3842
3871
|
}
|
|
3843
|
-
function
|
|
3872
|
+
function ei(e) {
|
|
3844
3873
|
return typeof e.computedStyleMap == "function";
|
|
3845
3874
|
}
|
|
3846
|
-
function
|
|
3875
|
+
function ti(e) {
|
|
3847
3876
|
switch (e) {
|
|
3848
3877
|
case "center": return "center";
|
|
3849
3878
|
case "flex-end":
|
|
@@ -3858,7 +3887,7 @@ function $r(e) {
|
|
|
3858
3887
|
default: return "start";
|
|
3859
3888
|
}
|
|
3860
3889
|
}
|
|
3861
|
-
function
|
|
3890
|
+
function ni(e) {
|
|
3862
3891
|
switch (e) {
|
|
3863
3892
|
case "center": return "center";
|
|
3864
3893
|
case "flex-end":
|
|
@@ -3869,10 +3898,10 @@ function ei(e) {
|
|
|
3869
3898
|
default: return "start";
|
|
3870
3899
|
}
|
|
3871
3900
|
}
|
|
3872
|
-
function
|
|
3873
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
3901
|
+
function ri(e) {
|
|
3902
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : ni(e);
|
|
3874
3903
|
}
|
|
3875
|
-
function
|
|
3904
|
+
function ii(e, t, n, r, i) {
|
|
3876
3905
|
let a = (a, o, s) => {
|
|
3877
3906
|
if (t) {
|
|
3878
3907
|
let e = t.get(a)?.toString().trim();
|
|
@@ -3896,16 +3925,16 @@ function ni(e, t, n, r, i) {
|
|
|
3896
3925
|
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
3897
3926
|
};
|
|
3898
3927
|
}
|
|
3899
|
-
function
|
|
3928
|
+
function ai(e, t, n) {
|
|
3900
3929
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
3901
3930
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
3902
3931
|
}
|
|
3903
|
-
function
|
|
3932
|
+
function oi(e, t) {
|
|
3904
3933
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
3905
3934
|
let n = parseFloat(e);
|
|
3906
3935
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
3907
3936
|
}
|
|
3908
|
-
function
|
|
3937
|
+
function si(e) {
|
|
3909
3938
|
switch (e) {
|
|
3910
3939
|
case "relative":
|
|
3911
3940
|
case "absolute":
|
|
@@ -3914,7 +3943,7 @@ function ai(e) {
|
|
|
3914
3943
|
default: return "static";
|
|
3915
3944
|
}
|
|
3916
3945
|
}
|
|
3917
|
-
function
|
|
3946
|
+
function ci(e, t, n, r, i) {
|
|
3918
3947
|
let a = (a, o) => {
|
|
3919
3948
|
if (t) {
|
|
3920
3949
|
let e = t.get(a)?.toString().trim();
|
|
@@ -3933,7 +3962,7 @@ function oi(e, t, n, r, i) {
|
|
|
3933
3962
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
3934
3963
|
};
|
|
3935
3964
|
}
|
|
3936
|
-
function
|
|
3965
|
+
function li(e) {
|
|
3937
3966
|
switch (e) {
|
|
3938
3967
|
case "double": return "double";
|
|
3939
3968
|
case "dashed": return "dashed";
|
|
@@ -3941,7 +3970,7 @@ function si(e) {
|
|
|
3941
3970
|
default: return "solid";
|
|
3942
3971
|
}
|
|
3943
3972
|
}
|
|
3944
|
-
function
|
|
3973
|
+
function ui(e, t) {
|
|
3945
3974
|
if (!e || e === "none" || e === "auto") return;
|
|
3946
3975
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
3947
3976
|
if (e.endsWith("%")) {
|
|
@@ -3960,28 +3989,33 @@ function $(e, t) {
|
|
|
3960
3989
|
let n = parseFloat(e);
|
|
3961
3990
|
return Number.isFinite(n) ? F(n, t) : 0;
|
|
3962
3991
|
}
|
|
3963
|
-
function
|
|
3992
|
+
function di(e) {
|
|
3964
3993
|
let t = parseFloat(e);
|
|
3965
3994
|
return Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 1;
|
|
3966
3995
|
}
|
|
3967
|
-
function
|
|
3996
|
+
function fi(e, t) {
|
|
3968
3997
|
let n = e.textIndent;
|
|
3969
3998
|
if (!n || n.endsWith("%")) return 0;
|
|
3970
3999
|
let r = parseFloat(n);
|
|
3971
4000
|
return Number.isFinite(r) ? Math.max(0, F(r, t)) : 0;
|
|
3972
4001
|
}
|
|
3973
|
-
function
|
|
3974
|
-
let s =
|
|
4002
|
+
function pi(e, t, n, r, i, a, o) {
|
|
4003
|
+
let s = mi(n === "width" ? a.width : a.height);
|
|
3975
4004
|
if (s !== null) return {
|
|
3976
4005
|
kind: "cells",
|
|
3977
|
-
value:
|
|
4006
|
+
value: gi(s, n, o, r)
|
|
4007
|
+
};
|
|
4008
|
+
let c = _i(e, n, t, i, n === "width" ? "w" : "h", a, o, r);
|
|
4009
|
+
if (c !== void 0) return {
|
|
4010
|
+
kind: "cells",
|
|
4011
|
+
value: c
|
|
3978
4012
|
};
|
|
3979
|
-
let
|
|
3980
|
-
if (
|
|
3981
|
-
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i -
|
|
4013
|
+
let l = hi(i, n === "width" ? "w" : "h");
|
|
4014
|
+
if (l !== null) {
|
|
4015
|
+
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i - l) <= l * .3;
|
|
3982
4016
|
if (a || !Number.isFinite(i)) return {
|
|
3983
4017
|
kind: "cells",
|
|
3984
|
-
value:
|
|
4018
|
+
value: gi(a ? i : l, n, o, r)
|
|
3985
4019
|
};
|
|
3986
4020
|
}
|
|
3987
4021
|
if (e) {
|
|
@@ -3989,7 +4023,7 @@ function di(e, t, n, r, i, a, o) {
|
|
|
3989
4023
|
if (t == null) return;
|
|
3990
4024
|
let i = t.toString().trim();
|
|
3991
4025
|
if (i === "auto") return { kind: "auto" };
|
|
3992
|
-
let a =
|
|
4026
|
+
let a = xi(i);
|
|
3993
4027
|
if (a) return a;
|
|
3994
4028
|
if (i.endsWith("%")) return {
|
|
3995
4029
|
kind: "percent",
|
|
@@ -4003,62 +4037,62 @@ function di(e, t, n, r, i, a, o) {
|
|
|
4003
4037
|
kind: "cells",
|
|
4004
4038
|
value: P(parseFloat(i) / .25)
|
|
4005
4039
|
};
|
|
4006
|
-
let s =
|
|
4040
|
+
let s = mi(i);
|
|
4007
4041
|
if (s !== null) return {
|
|
4008
4042
|
kind: "cells",
|
|
4009
|
-
value:
|
|
4043
|
+
value: gi(s, n, o, r)
|
|
4010
4044
|
};
|
|
4011
4045
|
}
|
|
4012
|
-
let
|
|
4013
|
-
if (
|
|
4014
|
-
if (
|
|
4015
|
-
let e =
|
|
4046
|
+
let u = n === "width" ? a.width : a.height;
|
|
4047
|
+
if (u) {
|
|
4048
|
+
if (u === "auto") return { kind: "auto" };
|
|
4049
|
+
let e = xi(u);
|
|
4016
4050
|
if (e) return e;
|
|
4017
|
-
if (
|
|
4051
|
+
if (u.endsWith("%")) return {
|
|
4018
4052
|
kind: "percent",
|
|
4019
|
-
value: parseFloat(
|
|
4053
|
+
value: parseFloat(u)
|
|
4020
4054
|
};
|
|
4021
|
-
let t = parseFloat(
|
|
4055
|
+
let t = parseFloat(u);
|
|
4022
4056
|
if (Number.isFinite(t)) return {
|
|
4023
4057
|
kind: "cells",
|
|
4024
4058
|
value: F(t, r)
|
|
4025
4059
|
};
|
|
4026
4060
|
}
|
|
4027
|
-
let
|
|
4028
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4029
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4030
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4031
|
-
let
|
|
4032
|
-
if (
|
|
4061
|
+
let d = n === "width" ? "w" : "h";
|
|
4062
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-min\\b`).test(i)) return { kind: "min-content" };
|
|
4063
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-max\\b`).test(i)) return { kind: "max-content" };
|
|
4064
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-fit\\b`).test(i)) return { kind: "fit-content" };
|
|
4065
|
+
let f = RegExp(`(?:^|[\\s:.[!])${d}-(\\d+)/(\\d+)(?![\\w./])`).exec(i);
|
|
4066
|
+
if (f) return {
|
|
4033
4067
|
kind: "percent",
|
|
4034
|
-
value: 100 * Number(
|
|
4068
|
+
value: 100 * Number(f[1]) / Number(f[2])
|
|
4035
4069
|
};
|
|
4036
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4070
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-full(?![\\w-])`).test(i)) return {
|
|
4037
4071
|
kind: "percent",
|
|
4038
4072
|
value: 100
|
|
4039
4073
|
};
|
|
4040
|
-
let
|
|
4041
|
-
if (
|
|
4074
|
+
let p = RegExp(`(?:^|[\\s:.[!])${d}-\\[(\\d+(?:\\.\\d+)?)%\\]`).exec(i);
|
|
4075
|
+
if (p) return {
|
|
4042
4076
|
kind: "percent",
|
|
4043
|
-
value: Number(
|
|
4077
|
+
value: Number(p[1])
|
|
4044
4078
|
};
|
|
4045
|
-
let
|
|
4046
|
-
if (
|
|
4079
|
+
let m = RegExp(`(?:^|[\\s:.[!])${d}-(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);
|
|
4080
|
+
if (m) return {
|
|
4047
4081
|
kind: "cells",
|
|
4048
|
-
value: P(Number(
|
|
4082
|
+
value: P(Number(m[1]))
|
|
4049
4083
|
};
|
|
4050
|
-
if (!
|
|
4084
|
+
if (!Ni(i, d) || t === "auto") return { kind: "auto" };
|
|
4051
4085
|
if (t.endsWith("%")) return {
|
|
4052
4086
|
kind: "percent",
|
|
4053
4087
|
value: parseFloat(t)
|
|
4054
4088
|
};
|
|
4055
|
-
let
|
|
4056
|
-
if (Number.isFinite(
|
|
4089
|
+
let h = parseFloat(t);
|
|
4090
|
+
if (Number.isFinite(h)) return {
|
|
4057
4091
|
kind: "cells",
|
|
4058
|
-
value: F(
|
|
4092
|
+
value: F(h, r)
|
|
4059
4093
|
};
|
|
4060
4094
|
}
|
|
4061
|
-
function
|
|
4095
|
+
function mi(e) {
|
|
4062
4096
|
let t = /^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());
|
|
4063
4097
|
if (!t || typeof window > "u") return null;
|
|
4064
4098
|
let n = parseFloat(t[1]);
|
|
@@ -4066,7 +4100,7 @@ function fi(e) {
|
|
|
4066
4100
|
let r = t[2], i = window.innerHeight, a = window.innerWidth, o = r.endsWith("h") ? i : r.endsWith("min") ? Math.min(a, i) : r.endsWith("max") ? Math.max(a, i) : r === "vb" ? i : a;
|
|
4067
4101
|
return n / 100 * o;
|
|
4068
4102
|
}
|
|
4069
|
-
function
|
|
4103
|
+
function hi(e, t) {
|
|
4070
4104
|
if (typeof window > "u") return null;
|
|
4071
4105
|
let n = RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);
|
|
4072
4106
|
if (n) {
|
|
@@ -4074,23 +4108,117 @@ function pi(e, t) {
|
|
|
4074
4108
|
return e === "screen" ? t.includes("h") ? window.innerHeight : window.innerWidth : e.endsWith("h") ? window.innerHeight : window.innerWidth;
|
|
4075
4109
|
}
|
|
4076
4110
|
let r = RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);
|
|
4077
|
-
return r ?
|
|
4111
|
+
return r ? mi(r[1]) : null;
|
|
4078
4112
|
}
|
|
4079
|
-
function
|
|
4113
|
+
function gi(e, t, n, r) {
|
|
4080
4114
|
let i = t === "width" ? n?.width : n?.height;
|
|
4081
4115
|
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : F(e, r);
|
|
4082
4116
|
}
|
|
4083
|
-
function
|
|
4084
|
-
let c = t.endsWith("width") ? "width" : "height", l =
|
|
4085
|
-
if (
|
|
4086
|
-
let
|
|
4117
|
+
function _i(e, t, n, r, i, a, o, s) {
|
|
4118
|
+
let c = t.endsWith("width") ? "width" : "height", l = a.getPropertyValue(t).trim(), u = l.startsWith("calc(");
|
|
4119
|
+
if (!u && !r.includes("-[calc(")) return;
|
|
4120
|
+
let d = RegExp(`(?:^|[\\s:.[!])${i}-\\[(calc\\([^\\]]*\\))\\]`).exec(r), f = u ? l : d?.[1]?.replaceAll("_", " ");
|
|
4121
|
+
if (!f) return;
|
|
4122
|
+
let p = vi(f, c, o, s);
|
|
4123
|
+
if (!p || p.unitless) return;
|
|
4124
|
+
let m = Math.max(0, P(p.cells));
|
|
4125
|
+
if (u) return m;
|
|
4126
|
+
let h = (e ? String(e.get(t) ?? "") : n).trim(), g = parseFloat(h);
|
|
4127
|
+
return (Number.isFinite(g) ? Math.abs(g - p.px) <= Math.abs(p.px) * .3 : h === "") ? m : void 0;
|
|
4128
|
+
}
|
|
4129
|
+
function vi(e, t, n, r) {
|
|
4130
|
+
let i = e.match(/--spacing\(\s*-?[\d.]+\s*\)|calc|[\d.]+[a-z%]*|[()+\-*/]/g);
|
|
4131
|
+
if (!i || i.join("").replace(/\s+/g, "") !== e.replace(/\s+/g, "")) return null;
|
|
4132
|
+
let a = 0, o = () => i[a], s = () => i[a++], c = (e, t) => ({
|
|
4133
|
+
cells: e,
|
|
4134
|
+
px: t,
|
|
4135
|
+
unitless: !1
|
|
4136
|
+
}), l = (e) => {
|
|
4137
|
+
let i = /^--spacing\(\s*(-?[\d.]+)\s*\)$/.exec(e);
|
|
4138
|
+
if (i) {
|
|
4139
|
+
let e = parseFloat(i[1]);
|
|
4140
|
+
return c(e, e * r / 4);
|
|
4141
|
+
}
|
|
4142
|
+
let a = /^([\d.]+)([a-z%]*)$/.exec(e);
|
|
4143
|
+
if (!a) return null;
|
|
4144
|
+
let o = parseFloat(a[1]), s = a[2];
|
|
4145
|
+
if (!Number.isFinite(o)) return null;
|
|
4146
|
+
if (s === "") return {
|
|
4147
|
+
cells: o,
|
|
4148
|
+
px: o,
|
|
4149
|
+
unitless: !0
|
|
4150
|
+
};
|
|
4151
|
+
if (s === "px") return c(o / (r / 4), o);
|
|
4152
|
+
if (s === "rem") return c(o * 4, o * r);
|
|
4153
|
+
let l = mi(e);
|
|
4154
|
+
return l === null ? null : c(gi(l, t, n, r), l);
|
|
4155
|
+
}, u = (e, t, n) => {
|
|
4156
|
+
if (e === "+" || e === "-") {
|
|
4157
|
+
if (t.unitless !== n.unitless) return null;
|
|
4158
|
+
let r = e === "+" ? 1 : -1;
|
|
4159
|
+
return {
|
|
4160
|
+
cells: t.cells + r * n.cells,
|
|
4161
|
+
px: t.px + r * n.px,
|
|
4162
|
+
unitless: t.unitless
|
|
4163
|
+
};
|
|
4164
|
+
}
|
|
4165
|
+
if (e === "*") {
|
|
4166
|
+
if (!t.unitless && !n.unitless) return null;
|
|
4167
|
+
let [e, r] = t.unitless ? [t, n] : [n, t];
|
|
4168
|
+
return {
|
|
4169
|
+
cells: r.cells * e.cells,
|
|
4170
|
+
px: r.px * e.px,
|
|
4171
|
+
unitless: r.unitless && e.unitless
|
|
4172
|
+
};
|
|
4173
|
+
}
|
|
4174
|
+
return !n.unitless || n.px === 0 ? null : {
|
|
4175
|
+
cells: t.cells / n.cells,
|
|
4176
|
+
px: t.px / n.px,
|
|
4177
|
+
unitless: t.unitless
|
|
4178
|
+
};
|
|
4179
|
+
}, d = () => {
|
|
4180
|
+
let e = s();
|
|
4181
|
+
if (e === void 0) return null;
|
|
4182
|
+
if (e === "-") {
|
|
4183
|
+
let e = d();
|
|
4184
|
+
return e && {
|
|
4185
|
+
cells: -e.cells,
|
|
4186
|
+
px: -e.px,
|
|
4187
|
+
unitless: e.unitless
|
|
4188
|
+
};
|
|
4189
|
+
}
|
|
4190
|
+
return e === "calc" ? s() === "(" ? f() : null : e === "(" ? f() : l(e);
|
|
4191
|
+
}, f = () => {
|
|
4192
|
+
let e = m();
|
|
4193
|
+
return s() === ")" ? e : null;
|
|
4194
|
+
}, p = () => {
|
|
4195
|
+
let e = d();
|
|
4196
|
+
for (; e && (o() === "*" || o() === "/");) {
|
|
4197
|
+
let t = s(), n = d();
|
|
4198
|
+
e = n ? u(t, e, n) : null;
|
|
4199
|
+
}
|
|
4200
|
+
return e;
|
|
4201
|
+
}, m = () => {
|
|
4202
|
+
let e = p();
|
|
4203
|
+
for (; e && (o() === "+" || o() === "-");) {
|
|
4204
|
+
let t = s(), n = p();
|
|
4205
|
+
e = n ? u(t, e, n) : null;
|
|
4206
|
+
}
|
|
4207
|
+
return e;
|
|
4208
|
+
}, h = m();
|
|
4209
|
+
return a === i.length ? h : null;
|
|
4210
|
+
}
|
|
4211
|
+
function yi(e, t, n, r, i, a, o, s) {
|
|
4212
|
+
let c = t.endsWith("width") ? "width" : "height", l = mi(a.getPropertyValue(t)) ?? mi(e?.get(t)?.toString().trim() ?? "");
|
|
4213
|
+
if (l !== null) return gi(l, c, o, s);
|
|
4214
|
+
let u = hi(r, i);
|
|
4087
4215
|
if (u === null) return;
|
|
4088
|
-
let d =
|
|
4089
|
-
if (
|
|
4216
|
+
let d = (e ? String(e.get(t) ?? "") : n).trim(), f = parseFloat(d), p = Number.isFinite(f) && Math.abs(f - u) <= u * .3;
|
|
4217
|
+
if (p || d === "") return gi(p ? f : u, c, o, s);
|
|
4090
4218
|
}
|
|
4091
|
-
function
|
|
4219
|
+
function bi(e, t) {
|
|
4092
4220
|
if (!e || e === "auto" || e === "content") return;
|
|
4093
|
-
let n =
|
|
4221
|
+
let n = xi(e);
|
|
4094
4222
|
if (n) return n;
|
|
4095
4223
|
if (e.endsWith("%")) {
|
|
4096
4224
|
let t = parseFloat(e);
|
|
@@ -4105,27 +4233,27 @@ function gi(e, t) {
|
|
|
4105
4233
|
value: F(r, t)
|
|
4106
4234
|
} : void 0;
|
|
4107
4235
|
}
|
|
4108
|
-
function
|
|
4236
|
+
function xi(e) {
|
|
4109
4237
|
if (e === "min-content") return { kind: "min-content" };
|
|
4110
4238
|
if (e === "max-content") return { kind: "max-content" };
|
|
4111
4239
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
4112
4240
|
}
|
|
4113
|
-
function
|
|
4241
|
+
function Si(e, t) {
|
|
4114
4242
|
let n = e.trim();
|
|
4115
4243
|
if (!n || n === "none") return { kind: "none" };
|
|
4116
4244
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
4117
4245
|
let r = [], i = [], a = [], o = (e) => {
|
|
4118
4246
|
i.push(a), a = [], r.push(e);
|
|
4119
4247
|
}, s;
|
|
4120
|
-
for (let e of
|
|
4121
|
-
let n =
|
|
4248
|
+
for (let e of Ai(n)) {
|
|
4249
|
+
let n = wi(e);
|
|
4122
4250
|
if (n) {
|
|
4123
4251
|
a.push(...n);
|
|
4124
4252
|
continue;
|
|
4125
4253
|
}
|
|
4126
4254
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
4127
4255
|
if (i) {
|
|
4128
|
-
let e =
|
|
4256
|
+
let e = Ci(i[2].trim(), t);
|
|
4129
4257
|
if (e.tracks.length === 0) continue;
|
|
4130
4258
|
let n = i[1];
|
|
4131
4259
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -4143,7 +4271,7 @@ function vi(e, t) {
|
|
|
4143
4271
|
}
|
|
4144
4272
|
continue;
|
|
4145
4273
|
}
|
|
4146
|
-
o(
|
|
4274
|
+
o(Di(e, t));
|
|
4147
4275
|
}
|
|
4148
4276
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
4149
4277
|
let c = {
|
|
@@ -4152,26 +4280,26 @@ function vi(e, t) {
|
|
|
4152
4280
|
};
|
|
4153
4281
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
4154
4282
|
}
|
|
4155
|
-
function
|
|
4283
|
+
function Ci(e, t) {
|
|
4156
4284
|
let n = [], r = [], i = [];
|
|
4157
|
-
for (let a of
|
|
4158
|
-
let e =
|
|
4285
|
+
for (let a of Ai(e)) {
|
|
4286
|
+
let e = wi(a);
|
|
4159
4287
|
if (e) {
|
|
4160
4288
|
i.push(...e);
|
|
4161
4289
|
continue;
|
|
4162
4290
|
}
|
|
4163
|
-
r.push(i), i = [], n.push(
|
|
4291
|
+
r.push(i), i = [], n.push(Di(a, t));
|
|
4164
4292
|
}
|
|
4165
4293
|
return r.push(i), {
|
|
4166
4294
|
tracks: n,
|
|
4167
4295
|
lineNames: r
|
|
4168
4296
|
};
|
|
4169
4297
|
}
|
|
4170
|
-
function
|
|
4298
|
+
function wi(e) {
|
|
4171
4299
|
let t = e.match(/^\[(.*)\]$/s);
|
|
4172
4300
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
4173
4301
|
}
|
|
4174
|
-
function
|
|
4302
|
+
function Ti(e) {
|
|
4175
4303
|
let t = [];
|
|
4176
4304
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
4177
4305
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -4201,23 +4329,23 @@ function xi(e) {
|
|
|
4201
4329
|
areas: r
|
|
4202
4330
|
};
|
|
4203
4331
|
}
|
|
4204
|
-
function
|
|
4205
|
-
let n =
|
|
4206
|
-
return n.length > 0 ? n : [
|
|
4332
|
+
function Ei(e, t) {
|
|
4333
|
+
let n = Ai(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => Di(e, t));
|
|
4334
|
+
return n.length > 0 ? n : [st()];
|
|
4207
4335
|
}
|
|
4208
|
-
function
|
|
4336
|
+
function Di(e, t) {
|
|
4209
4337
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
4210
4338
|
if (n) {
|
|
4211
|
-
let e =
|
|
4339
|
+
let e = ki(n[1]).map((e) => e.trim());
|
|
4212
4340
|
return e.length === 2 ? {
|
|
4213
|
-
min:
|
|
4214
|
-
max:
|
|
4341
|
+
min: Oi(e[0], t),
|
|
4342
|
+
max: Oi(e[1], t)
|
|
4215
4343
|
} : {
|
|
4216
4344
|
min: { kind: "auto" },
|
|
4217
4345
|
max: { kind: "auto" }
|
|
4218
4346
|
};
|
|
4219
4347
|
}
|
|
4220
|
-
let r =
|
|
4348
|
+
let r = Oi(e, t);
|
|
4221
4349
|
return r.kind === "fr" ? {
|
|
4222
4350
|
min: { kind: "auto" },
|
|
4223
4351
|
max: r
|
|
@@ -4226,13 +4354,13 @@ function Ci(e, t) {
|
|
|
4226
4354
|
max: r
|
|
4227
4355
|
};
|
|
4228
4356
|
}
|
|
4229
|
-
function
|
|
4357
|
+
function Oi(e, t) {
|
|
4230
4358
|
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
4231
4359
|
if (e === "min-content") return { kind: "min-content" };
|
|
4232
4360
|
if (e === "max-content") return { kind: "max-content" };
|
|
4233
4361
|
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
4234
4362
|
if (n) {
|
|
4235
|
-
let e =
|
|
4363
|
+
let e = ki(n[2]).map((e) => Oi(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
4236
4364
|
return e.length > 0 && r ? {
|
|
4237
4365
|
kind: "math",
|
|
4238
4366
|
fn: n[1],
|
|
@@ -4259,7 +4387,7 @@ function wi(e, t) {
|
|
|
4259
4387
|
value: e.endsWith("rem") ? P(r / .25) : F(r, t)
|
|
4260
4388
|
} : { kind: "auto" };
|
|
4261
4389
|
}
|
|
4262
|
-
function
|
|
4390
|
+
function ki(e) {
|
|
4263
4391
|
let t = [], n = 0, r = 0;
|
|
4264
4392
|
for (let i = 0; i < e.length; i++) {
|
|
4265
4393
|
let a = e[i];
|
|
@@ -4267,7 +4395,7 @@ function Ti(e) {
|
|
|
4267
4395
|
}
|
|
4268
4396
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
4269
4397
|
}
|
|
4270
|
-
function
|
|
4398
|
+
function Ai(e) {
|
|
4271
4399
|
let t = [], n = 0, r = -1;
|
|
4272
4400
|
for (let i = 0; i < e.length; i++) {
|
|
4273
4401
|
let a = e[i];
|
|
@@ -4275,7 +4403,7 @@ function Ei(e) {
|
|
|
4275
4403
|
}
|
|
4276
4404
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
4277
4405
|
}
|
|
4278
|
-
function
|
|
4406
|
+
function ji(e) {
|
|
4279
4407
|
let t = e.trim();
|
|
4280
4408
|
if (!t || t === "auto") return { kind: "auto" };
|
|
4281
4409
|
let n = !1, r, i;
|
|
@@ -4303,16 +4431,16 @@ function Di(e) {
|
|
|
4303
4431
|
nth: r
|
|
4304
4432
|
};
|
|
4305
4433
|
}
|
|
4306
|
-
function
|
|
4434
|
+
function Mi(e) {
|
|
4307
4435
|
return {
|
|
4308
4436
|
direction: e.includes("column") ? "column" : "row",
|
|
4309
4437
|
dense: e.includes("dense")
|
|
4310
4438
|
};
|
|
4311
4439
|
}
|
|
4312
|
-
function
|
|
4440
|
+
function Ni(e, t) {
|
|
4313
4441
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
4314
4442
|
}
|
|
4315
|
-
function
|
|
4443
|
+
function Pi(e, t) {
|
|
4316
4444
|
return {
|
|
4317
4445
|
top: $(e.getPropertyValue("padding-top"), t),
|
|
4318
4446
|
right: $(e.getPropertyValue("padding-right"), t),
|
|
@@ -4320,7 +4448,7 @@ function Ai(e, t) {
|
|
|
4320
4448
|
left: $(e.getPropertyValue("padding-left"), t)
|
|
4321
4449
|
};
|
|
4322
4450
|
}
|
|
4323
|
-
function
|
|
4451
|
+
function Fi(e) {
|
|
4324
4452
|
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : P(parseFloat(e.getPropertyValue(t)) || 0);
|
|
4325
4453
|
return {
|
|
4326
4454
|
top: t("border-top-width", "border-top-style"),
|
|
@@ -4331,14 +4459,14 @@ function ji(e) {
|
|
|
4331
4459
|
}
|
|
4332
4460
|
//#endregion
|
|
4333
4461
|
//#region src/tree.ts
|
|
4334
|
-
function
|
|
4335
|
-
let i =
|
|
4462
|
+
function Ii(e, t, n, r) {
|
|
4463
|
+
let i = Mr(e, t, n);
|
|
4336
4464
|
if (i.display === "none") return null;
|
|
4337
4465
|
let a = ae(e.tagName);
|
|
4338
|
-
if (a) return
|
|
4339
|
-
let o = Array.from(e.children), s = o.map(
|
|
4466
|
+
if (a) return Li(e, i, a);
|
|
4467
|
+
let o = Array.from(e.children), s = o.map(Hi), c = e.tagName, l = $i(c);
|
|
4340
4468
|
if (!s.includes("block") || l) {
|
|
4341
|
-
let a =
|
|
4469
|
+
let a = Ui(e, i.tracking, {
|
|
4342
4470
|
rootFontSizePx: t,
|
|
4343
4471
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
4344
4472
|
cellMetrics: n,
|
|
@@ -4347,12 +4475,12 @@ function Mi(e, t, n, r) {
|
|
|
4347
4475
|
tabSize: i.tabSize
|
|
4348
4476
|
}), u = a.chars.join("");
|
|
4349
4477
|
if (a.boxes.length > 0) {
|
|
4350
|
-
let e =
|
|
4478
|
+
let e = Rn();
|
|
4351
4479
|
Fe(a.chars, (t, n) => {
|
|
4352
|
-
a.advances[t] = Math.max(1,
|
|
4480
|
+
a.advances[t] = Math.max(1, q(a.boxes[n], e));
|
|
4353
4481
|
});
|
|
4354
4482
|
}
|
|
4355
|
-
let d =
|
|
4483
|
+
let d = Ji(u, a.advances, i.tracking);
|
|
4356
4484
|
if (l && d === 0) {
|
|
4357
4485
|
if (c === "INPUT") d = Number(e.size) || 20;
|
|
4358
4486
|
else if (c === "TEXTAREA") d = Number(e.cols) || 20;
|
|
@@ -4361,7 +4489,7 @@ function Mi(e, t, n, r) {
|
|
|
4361
4489
|
d = Math.max(1, ...r.map((e) => e.trim().length));
|
|
4362
4490
|
}
|
|
4363
4491
|
}
|
|
4364
|
-
let f = u.length > 0 ?
|
|
4492
|
+
let f = u.length > 0 ? Yi(u) : 0, p;
|
|
4365
4493
|
if (c === "TEXTAREA") {
|
|
4366
4494
|
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ? Oe(n, a) + o : n === "" ? 0 : n.split(/\r\n?|\n/).length, c = getComputedStyle(e).getPropertyValue("field-sizing") === "content" ? 1 : Number(t.rows) || 2, l = Math.max(c, s);
|
|
4367
4495
|
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
@@ -4373,7 +4501,7 @@ function Mi(e, t, n, r) {
|
|
|
4373
4501
|
let i = o[e], a = m.get(i);
|
|
4374
4502
|
if (a) g.push(a);
|
|
4375
4503
|
else if (s[e] === "out-of-flow") {
|
|
4376
|
-
let e =
|
|
4504
|
+
let e = Ii(i, t, n, r);
|
|
4377
4505
|
e && g.push(e);
|
|
4378
4506
|
}
|
|
4379
4507
|
}
|
|
@@ -4392,14 +4520,14 @@ function Mi(e, t, n, r) {
|
|
|
4392
4520
|
height: p
|
|
4393
4521
|
},
|
|
4394
4522
|
unclampedHeight: 0,
|
|
4395
|
-
resolvedPadding:
|
|
4523
|
+
resolvedPadding: ot()
|
|
4396
4524
|
};
|
|
4397
4525
|
return (a.advances.some((e) => e !== 1) || a.boxes.length > 0) && (_.advances = a.advances), a.inlineElements.length > 0 && (_.inlineElements = a.inlineElements, _.charInline = a.chars.map((e, t) => a.inlineIndex[t] ?? -1)), _;
|
|
4398
4526
|
}
|
|
4399
4527
|
let u = [];
|
|
4400
4528
|
for (let e = 0; e < o.length; e++) {
|
|
4401
4529
|
if (s[e] === "none") continue;
|
|
4402
|
-
let i =
|
|
4530
|
+
let i = Ii(o[e], t, n, r);
|
|
4403
4531
|
i && u.push(i);
|
|
4404
4532
|
}
|
|
4405
4533
|
let d = {
|
|
@@ -4416,14 +4544,14 @@ function Mi(e, t, n, r) {
|
|
|
4416
4544
|
height: 0
|
|
4417
4545
|
},
|
|
4418
4546
|
unclampedHeight: 0,
|
|
4419
|
-
resolvedPadding:
|
|
4547
|
+
resolvedPadding: ot()
|
|
4420
4548
|
};
|
|
4421
|
-
return
|
|
4549
|
+
return ea(e, d), d;
|
|
4422
4550
|
}
|
|
4423
|
-
function
|
|
4551
|
+
function Li(e, t, n) {
|
|
4424
4552
|
let r = ce(n, e), i = r?.lines ?? [], a = i.join("\n");
|
|
4425
4553
|
t.whiteSpace = "pre", (t.width === void 0 || t.width.kind === "auto") && (t.width = { kind: "max-content" });
|
|
4426
|
-
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s =
|
|
4554
|
+
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s = Ji(a, o, t.tracking), c = i.length, l = {
|
|
4427
4555
|
source: e,
|
|
4428
4556
|
style: t,
|
|
4429
4557
|
children: [],
|
|
@@ -4437,7 +4565,7 @@ function Ni(e, t, n) {
|
|
|
4437
4565
|
height: c
|
|
4438
4566
|
},
|
|
4439
4567
|
unclampedHeight: 0,
|
|
4440
|
-
resolvedPadding:
|
|
4568
|
+
resolvedPadding: ot()
|
|
4441
4569
|
};
|
|
4442
4570
|
t.tracking > 0 && (l.advances = o);
|
|
4443
4571
|
let u = r?.runs ?? [];
|
|
@@ -4465,23 +4593,23 @@ function Ni(e, t, n) {
|
|
|
4465
4593
|
}
|
|
4466
4594
|
return l;
|
|
4467
4595
|
}
|
|
4468
|
-
var
|
|
4469
|
-
function
|
|
4470
|
-
return t || (
|
|
4596
|
+
var Ri = /* @__PURE__ */ new Set(/* @__PURE__ */ "A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DFN.EM.I.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR".split("."));
|
|
4597
|
+
function zi(e, t) {
|
|
4598
|
+
return t || (Ri.has(e.tagName) ? "inline" : "block");
|
|
4471
4599
|
}
|
|
4472
|
-
function
|
|
4473
|
-
let n =
|
|
4600
|
+
function Bi(e, t) {
|
|
4601
|
+
let n = zi(e, t);
|
|
4474
4602
|
return n === "inline" || n === "contents";
|
|
4475
4603
|
}
|
|
4476
|
-
function
|
|
4477
|
-
let n =
|
|
4604
|
+
function Vi(e, t) {
|
|
4605
|
+
let n = zi(e, t);
|
|
4478
4606
|
return n.startsWith("inline") && n !== "inline";
|
|
4479
4607
|
}
|
|
4480
|
-
function
|
|
4608
|
+
function Hi(e) {
|
|
4481
4609
|
let t = getComputedStyle(e);
|
|
4482
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : ae(e.tagName) ? "block" :
|
|
4610
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : ae(e.tagName) ? "block" : Bi(e, t.display) || Vi(e, t.display) ? "inline" : "block";
|
|
4483
4611
|
}
|
|
4484
|
-
function
|
|
4612
|
+
function Ui(e, t, n) {
|
|
4485
4613
|
let r = {
|
|
4486
4614
|
chars: [],
|
|
4487
4615
|
advances: [],
|
|
@@ -4489,15 +4617,15 @@ function zi(e, t, n) {
|
|
|
4489
4617
|
inlineElements: [],
|
|
4490
4618
|
boxes: []
|
|
4491
4619
|
};
|
|
4492
|
-
return
|
|
4620
|
+
return Wi(e, t, n, r), n.preserve ? r : qi(r);
|
|
4493
4621
|
}
|
|
4494
|
-
function
|
|
4622
|
+
function Wi(e, t, n, r) {
|
|
4495
4623
|
let i = () => {
|
|
4496
4624
|
let e = 0;
|
|
4497
4625
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
4498
4626
|
return e;
|
|
4499
4627
|
};
|
|
4500
|
-
if (
|
|
4628
|
+
if (!$i(e.tagName)) {
|
|
4501
4629
|
for (let a of Array.from(e.childNodes)) if (a.nodeType === Node.TEXT_NODE) {
|
|
4502
4630
|
if (n.preserve) for (let e of (a.textContent ?? "").replace(/\r\n?/g, "\n")) if (e === "\n") r.chars.push("\n"), r.advances.push(0);
|
|
4503
4631
|
else if (e === " ") {
|
|
@@ -4513,24 +4641,24 @@ function Bi(e, t, n, r) {
|
|
|
4513
4641
|
}
|
|
4514
4642
|
let t = getComputedStyle(e);
|
|
4515
4643
|
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
4516
|
-
if (
|
|
4517
|
-
let t =
|
|
4644
|
+
if (Vi(e, t.display)) {
|
|
4645
|
+
let t = Ii(e, n.rootFontSizePx, n.cellMetrics, n.textareaWidths);
|
|
4518
4646
|
t && (t.inlineBox = !0, r.chars.push(""), r.advances.push(1), r.boxes.push(t));
|
|
4519
4647
|
continue;
|
|
4520
4648
|
}
|
|
4521
|
-
if (!
|
|
4522
|
-
|
|
4649
|
+
if (!Bi(e, t.display)) {
|
|
4650
|
+
Xi(e);
|
|
4523
4651
|
continue;
|
|
4524
4652
|
}
|
|
4525
|
-
let i =
|
|
4653
|
+
let i = ai(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = Gi(t.paddingLeft, n.rootFontSizePx), s = Gi(t.paddingRight, n.rootFontSizePx);
|
|
4526
4654
|
r.inlineElements.push({
|
|
4527
4655
|
element: e,
|
|
4528
4656
|
tracking: i,
|
|
4529
4657
|
padLeft: o,
|
|
4530
4658
|
padRight: s,
|
|
4531
|
-
insets: t.position === "static" ? null :
|
|
4659
|
+
insets: t.position === "static" ? null : Ki(t, n.rootFontSizePx),
|
|
4532
4660
|
color: t.color,
|
|
4533
|
-
backgroundColor:
|
|
4661
|
+
backgroundColor: Pr(t.backgroundColor) ? void 0 : t.backgroundColor,
|
|
4534
4662
|
fontWeight: t.fontWeight,
|
|
4535
4663
|
fontStyle: t.fontStyle,
|
|
4536
4664
|
textDecorationLine: t.textDecorationLine
|
|
@@ -4538,18 +4666,18 @@ function Bi(e, t, n, r) {
|
|
|
4538
4666
|
let c = r.inlineElements.length - 1;
|
|
4539
4667
|
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
4540
4668
|
let l = r.chars.length;
|
|
4541
|
-
|
|
4669
|
+
Wi(e, i, n, r);
|
|
4542
4670
|
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
4543
4671
|
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
4544
4672
|
}
|
|
4545
4673
|
}
|
|
4546
4674
|
}
|
|
4547
|
-
function
|
|
4675
|
+
function Gi(e, t) {
|
|
4548
4676
|
if (!e || e.endsWith("%")) return 0;
|
|
4549
4677
|
let n = parseFloat(e);
|
|
4550
4678
|
return Number.isFinite(n) ? Math.max(0, F(n, t)) : 0;
|
|
4551
4679
|
}
|
|
4552
|
-
function
|
|
4680
|
+
function Ki(e, t) {
|
|
4553
4681
|
let n = (e) => {
|
|
4554
4682
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
4555
4683
|
let n = parseFloat(e);
|
|
@@ -4562,7 +4690,7 @@ function Hi(e, t) {
|
|
|
4562
4690
|
left: n(e.left)
|
|
4563
4691
|
};
|
|
4564
4692
|
}
|
|
4565
|
-
function
|
|
4693
|
+
function qi(e) {
|
|
4566
4694
|
let t = [], n = [], r = [], i = () => {
|
|
4567
4695
|
let e = t.length;
|
|
4568
4696
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
@@ -4587,30 +4715,30 @@ function Ui(e) {
|
|
|
4587
4715
|
boxes: e.boxes
|
|
4588
4716
|
};
|
|
4589
4717
|
}
|
|
4590
|
-
function
|
|
4718
|
+
function Ji(e, t, n) {
|
|
4591
4719
|
let r = 0, i = 0;
|
|
4592
4720
|
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r, I(i, a, t, n)), i = a + 1);
|
|
4593
4721
|
return r;
|
|
4594
4722
|
}
|
|
4595
|
-
function
|
|
4723
|
+
function Yi(e) {
|
|
4596
4724
|
return Ae(e).length;
|
|
4597
4725
|
}
|
|
4598
|
-
function
|
|
4726
|
+
function Xi(e) {
|
|
4599
4727
|
N(e, "A block-level element nested inside a text run can't be laid out and was skipped. Give it its own place in the layout instead.");
|
|
4600
4728
|
}
|
|
4601
|
-
function
|
|
4729
|
+
function Zi(e) {
|
|
4602
4730
|
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
4603
4731
|
}
|
|
4604
|
-
var
|
|
4605
|
-
function
|
|
4732
|
+
var Qi = "Direct text next to block-level children can't be laid out and was hidden. Wrap each text segment in its own element (e.g. a <div>).";
|
|
4733
|
+
function $i(e) {
|
|
4606
4734
|
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
4607
4735
|
}
|
|
4608
|
-
function
|
|
4609
|
-
|
|
4736
|
+
function ea(e, t) {
|
|
4737
|
+
Zi(e) && (t.droppedText = !0, N(e, Qi));
|
|
4610
4738
|
}
|
|
4611
4739
|
//#endregion
|
|
4612
4740
|
//#region src/element.ts
|
|
4613
|
-
var
|
|
4741
|
+
var ta = "\n<style>\n :host { display: block; position: relative; contain: layout style; }\n #viewport { position: relative; width: 100%; height: 100%; background: inherit; }\n /* When the host hides its own dropped direct text (visibility, see\n * styles.css), the render layer must not sink with it. Scoped to that\n * state so an authored 'invisible' on the host stays intact. */\n :host([data-mw-dropped-text]) #viewport { visibility: visible; }\n /* The unified grid: one <pre> with same-paint-run spans, cell-precise\n * (one monospace character = one cell). In select=\"grid\" (the\n * default, reflected onto the attribute — see DEFAULT_SELECT) the\n * grid catches drags for native selection of the ASCII; interactive\n * elements opt back into pointer-events via styles.css so clicks\n * still work. In select=\"text\" the grid is inert to events and drag\n * selects the light DOM natively. */\n /* Sized by the engine's ink extent (element.ts), not the host box:\n * visible overflow paints past the host (specs/cell-model.md\n * \"Overflow\"), and the host's background follows it there — the\n * host is the canvas, as the root element's background covers a\n * document's overflow — inherited through #viewport, the shadow\n * parent. (A translucent host background paints repeatedly inside\n * the box.) */\n #grid { position: absolute; top: 0; left: 0; margin: 0; background: inherit; font: inherit; line-height: inherit; letter-spacing: inherit; white-space: pre; pointer-events: none; user-select: none; -webkit-user-select: none; }\n :host([select=\"grid\"]) #grid { pointer-events: auto; user-select: text; -webkit-user-select: text; }\n :host([select=\"grid\"]) slot { pointer-events: none; user-select: none; -webkit-user-select: none; }\n /* Selection invert — mirror of the canonical rule in styles.css\n * (which explains the field choices); update together. */\n ::selection { color: var(--mw-bg, canvas); text-shadow: 0 0 0 var(--mw-bg, canvas); background: var(--mw-fg, canvastext); }\n</style>\n<div id=\"viewport\">\n <pre id=\"grid\" aria-hidden=\"true\"></pre>\n <slot></slot>\n</div>\n", na = "grid", ra = [
|
|
4614
4742
|
"pointerover",
|
|
4615
4743
|
"pointerleave",
|
|
4616
4744
|
"pointerdown",
|
|
@@ -4622,7 +4750,7 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4622
4750
|
"focusout",
|
|
4623
4751
|
"input",
|
|
4624
4752
|
"change"
|
|
4625
|
-
],
|
|
4753
|
+
], ia = /^(color|opacity|border-(top|right|bottom|left)-color|border-color)$/, aa = 3e4, oa = 200, sa = 3, ca = 4, la = 8, ua = 100, da = 160, fa = typeof HTMLElement > "u" ? class {} : HTMLElement, pa = class e extends fa {
|
|
4626
4754
|
static observedAttributes = ["select"];
|
|
4627
4755
|
static #e = /* @__PURE__ */ new Set();
|
|
4628
4756
|
static #t = null;
|
|
@@ -4682,15 +4810,15 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4682
4810
|
});
|
|
4683
4811
|
}
|
|
4684
4812
|
constructor() {
|
|
4685
|
-
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML =
|
|
4813
|
+
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML = ta, this.#s = this.#o.getElementById("grid"), this.#c = document.createElement("span"), this.#c.setAttribute("aria-hidden", "true"), this.#c.setAttribute("data-mw-probe", ""), this.#c.style.cssText = "position:absolute!important;top:0!important;left:0!important;visibility:hidden!important;pointer-events:none!important;user-select:none!important;white-space:pre!important;overflow-wrap:normal!important;padding:0!important;margin:0!important;border:0!important;", this.#c.textContent = "M".repeat(100);
|
|
4686
4814
|
}
|
|
4687
4815
|
connectedCallback() {
|
|
4688
|
-
this.hasAttribute("select") || this.setAttribute("select",
|
|
4816
|
+
this.hasAttribute("select") || this.setAttribute("select", na), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#fe()), this.#l.observe(this), this.#G(), this.#l.observe(this.#c), window.addEventListener("resize", this.#ce), this.#u = new MutationObserver(() => this.#fe()), this.#C(), this.#m = se(() => {
|
|
4689
4817
|
this.#C(), this.#fe();
|
|
4690
4818
|
}), this.#h = C(() => this.#fe()), document.fonts?.ready.then(this.#le).catch((e) => {
|
|
4691
4819
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
4692
4820
|
}), document.fonts?.addEventListener("loadingdone", this.#le);
|
|
4693
|
-
for (let e of
|
|
4821
|
+
for (let e of ra) this.addEventListener(e, this.#se);
|
|
4694
4822
|
this.addEventListener("transitionrun", this.#ie), this.addEventListener("transitionend", this.#ae), this.addEventListener("transitioncancel", this.#ae), this.addEventListener("pointermove", this.#J), this.addEventListener("pointerleave", this.#Y), this.addEventListener("pointerdown", this.#X), this.addEventListener("scroll", this.#B, {
|
|
4695
4823
|
capture: !0,
|
|
4696
4824
|
passive: !0
|
|
@@ -4701,7 +4829,7 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4701
4829
|
}
|
|
4702
4830
|
disconnectedCallback() {
|
|
4703
4831
|
window.removeEventListener("resize", this.#ce), this.#l?.disconnect(), this.#u?.disconnect(), this.#l = null, this.#u = null, this.#m?.(), this.#m = null, this.#h?.(), this.#h = null, document.fonts?.removeEventListener("loadingdone", this.#le);
|
|
4704
|
-
for (let e of
|
|
4832
|
+
for (let e of ra) this.removeEventListener(e, this.#se);
|
|
4705
4833
|
this.removeEventListener("transitionrun", this.#ie), this.removeEventListener("transitionend", this.#ae), this.removeEventListener("transitioncancel", this.#ae), this.#te = 0, this.removeEventListener("pointermove", this.#J), this.removeEventListener("pointerleave", this.#Y), this.removeEventListener("pointerdown", this.#X), this.removeEventListener("scroll", this.#B, { capture: !0 }), this.removeEventListener("scrollend", this.#V, { capture: !0 }), this.removeEventListener("wheel", this.#U);
|
|
4706
4834
|
for (let e of this.#v.values()) clearTimeout(e);
|
|
4707
4835
|
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#Z), window.removeEventListener("pointercancel", this.#Z), document.removeEventListener("scroll", this.#Q, { capture: !0 }), this.#k = null, this.#E = null, this.#D = !1, this.#O = !1, this.#$(), e.#a(this);
|
|
@@ -4723,7 +4851,7 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4723
4851
|
if (e) return;
|
|
4724
4852
|
e = !0, this.#g = !1;
|
|
4725
4853
|
let t = this.#f;
|
|
4726
|
-
|
|
4854
|
+
this.isConnected && this.#p && t && (this.#F(t), this.#O = !yr(this.#p, this.#s, this.#D), this.#$());
|
|
4727
4855
|
};
|
|
4728
4856
|
requestAnimationFrame(t), setTimeout(t, 50);
|
|
4729
4857
|
}
|
|
@@ -4742,8 +4870,8 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4742
4870
|
y: 0
|
|
4743
4871
|
};
|
|
4744
4872
|
return {
|
|
4745
|
-
x:
|
|
4746
|
-
y:
|
|
4873
|
+
x: ha(n, "x", t.width, r, a.x),
|
|
4874
|
+
y: ha(n, "y", t.height, i, a.y)
|
|
4747
4875
|
};
|
|
4748
4876
|
}
|
|
4749
4877
|
#L() {
|
|
@@ -4773,11 +4901,11 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4773
4901
|
}
|
|
4774
4902
|
#B = (e) => {
|
|
4775
4903
|
let t = e.target;
|
|
4776
|
-
|
|
4904
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (this.#P(), !(Date.now() - (this.#y.get(t) ?? 0) < oa) && (clearTimeout(this.#v.get(t)), "onscrollend" in window || this.#z(t, da)));
|
|
4777
4905
|
};
|
|
4778
4906
|
#V = (e) => {
|
|
4779
4907
|
let t = e.target;
|
|
4780
|
-
|
|
4908
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (Date.now() - (this.#y.get(t) ?? 0) < oa || this.#z(t, ua));
|
|
4781
4909
|
};
|
|
4782
4910
|
#H(e) {
|
|
4783
4911
|
if (this.#x?.el === e) return;
|
|
@@ -4805,7 +4933,7 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4805
4933
|
let d = (e) => {
|
|
4806
4934
|
let t = e.scrollRange, n = e.source;
|
|
4807
4935
|
return o !== 0 && t.maxY > 0 && (o > 0 && n.scrollTop < n.scrollHeight - n.clientHeight - .5 || o < 0 && n.scrollTop > .5) || a !== 0 && t.maxX > 0 && (a > 0 && n.scrollLeft < n.scrollWidth - n.clientWidth - .5 || a < 0 && n.scrollLeft > .5);
|
|
4808
|
-
}, f = this.#b, p = Math.abs(a) >= Math.abs(o) ? "x" : "y", m = f !== null && u > f.mag * 1.25 + 1, h = f !== null && (Math.abs(r.clientX - f.x) >
|
|
4936
|
+
}, f = this.#b, p = Math.abs(a) >= Math.abs(o) ? "x" : "y", m = f !== null && u > f.mag * 1.25 + 1, h = f !== null && (Math.abs(r.clientX - f.x) > sa || Math.abs(r.clientY - f.y) > sa), g = f !== null && f.decayed >= la, _ = f !== null && l - f.at < oa && p === f.axis && (h ? u <= f.mag : !(g && m)), v = null;
|
|
4809
4937
|
if (_) {
|
|
4810
4938
|
if (f.decayed = u <= f.mag && u >= f.mag * .5 ? f.decayed + 1 : g ? f.decayed : 0, f.mag = u, f.at = l, !f.el) return;
|
|
4811
4939
|
v = this.#_.find((e) => e.source === f.el) ?? null;
|
|
@@ -4825,7 +4953,7 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4825
4953
|
break;
|
|
4826
4954
|
}
|
|
4827
4955
|
}
|
|
4828
|
-
if (!v && u <
|
|
4956
|
+
if (!v && u < ca) {
|
|
4829
4957
|
r.preventDefault();
|
|
4830
4958
|
return;
|
|
4831
4959
|
}
|
|
@@ -4841,14 +4969,14 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4841
4969
|
}
|
|
4842
4970
|
if (!v || (r.preventDefault(), !d(v))) return;
|
|
4843
4971
|
let y = v.source, b = v.scrollRange, x = { behavior: "instant" };
|
|
4844
|
-
o !== 0 && b.maxY > 0 && (x.top = o), a !== 0 && b.maxX > 0 && (x.left = a), y.scrollBy(x), this.#y.set(y, l), this.#z(y,
|
|
4972
|
+
o !== 0 && b.maxY > 0 && (x.top = o), a !== 0 && b.maxX > 0 && (x.left = a), y.scrollBy(x), this.#y.set(y, l), this.#z(y, oa);
|
|
4845
4973
|
};
|
|
4846
4974
|
#W(e, t) {
|
|
4847
4975
|
return this.#S.some((n) => t > 0 && n.scrollTop < n.scrollHeight - n.clientHeight - .5 || t < 0 && n.scrollTop > .5 || e > 0 && n.scrollLeft < n.scrollWidth - n.clientWidth - .5 || e < 0 && n.scrollLeft > .5);
|
|
4848
4976
|
}
|
|
4849
4977
|
#G() {
|
|
4850
4978
|
let e = this.parentElement;
|
|
4851
|
-
if (
|
|
4979
|
+
if (e && this.#l) {
|
|
4852
4980
|
this.#l.observe(e);
|
|
4853
4981
|
for (let t of e.children) t !== this && this.#l.observe(t);
|
|
4854
4982
|
}
|
|
@@ -4873,33 +5001,32 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4873
5001
|
for (let n = o.length - 1; n >= 0; n--) {
|
|
4874
5002
|
let { node: s, x: c, y: l } = o[n], u = s.scrollRange;
|
|
4875
5003
|
if (!u) continue;
|
|
4876
|
-
let d = s.
|
|
4877
|
-
if (
|
|
4878
|
-
|
|
4879
|
-
if (f.right > 0 && u.maxY > 0 && i >= _ - f.right && i < _ && a >= m && a < g) {
|
|
4880
|
-
let e = g - m - f.bottom, n = fr(e, u.sizeY, u.maxY, 0).len, i = Math.max(1, (e - n) * r.height);
|
|
5004
|
+
let d = s.source, { y: f, x: p } = pr(s, c, l);
|
|
5005
|
+
if (f && u.maxY > 0 && i >= f.col && i < f.col + f.thick && a >= f.row && a < f.row + f.len) {
|
|
5006
|
+
let e = mr(f.len, u.sizeY, u.maxY, 0).len, n = Math.max(1, (f.len - e) * r.height);
|
|
4881
5007
|
return {
|
|
4882
|
-
el:
|
|
5008
|
+
el: d,
|
|
4883
5009
|
axis: "y",
|
|
4884
5010
|
startClient: t,
|
|
4885
|
-
startPx:
|
|
4886
|
-
factor: u.maxY * r.height /
|
|
5011
|
+
startPx: d.scrollTop,
|
|
5012
|
+
factor: u.maxY * r.height / n
|
|
4887
5013
|
};
|
|
4888
5014
|
}
|
|
4889
|
-
if (
|
|
4890
|
-
let t =
|
|
5015
|
+
if (p && u.maxX > 0 && a >= p.row && a < p.row + p.thick && i >= p.col && i < p.col + p.len) {
|
|
5016
|
+
let t = mr(p.len, u.sizeX, u.maxX, 0).len, n = Math.max(1, (p.len - t) * r.width);
|
|
4891
5017
|
return {
|
|
4892
|
-
el:
|
|
5018
|
+
el: d,
|
|
4893
5019
|
axis: "x",
|
|
4894
5020
|
startClient: e,
|
|
4895
|
-
startPx:
|
|
4896
|
-
factor: u.maxX * r.width /
|
|
5021
|
+
startPx: d.scrollLeft,
|
|
5022
|
+
factor: u.maxX * r.width / n
|
|
4897
5023
|
};
|
|
4898
5024
|
}
|
|
4899
5025
|
}
|
|
4900
5026
|
return null;
|
|
4901
5027
|
}
|
|
4902
5028
|
#J = (e) => {
|
|
5029
|
+
if (_a(e)) return;
|
|
4903
5030
|
let { clientX: t, clientY: n } = e, r = this.#x;
|
|
4904
5031
|
if (r) {
|
|
4905
5032
|
let e = (r.axis === "y" ? n : t) - r.startClient, i = r.startPx + e * r.factor;
|
|
@@ -4922,8 +5049,8 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4922
5049
|
};
|
|
4923
5050
|
#X = (e) => {
|
|
4924
5051
|
let t = e;
|
|
4925
|
-
if (!t.isPrimary || t.button !== 0) return;
|
|
4926
|
-
let n =
|
|
5052
|
+
if (!t.isPrimary || t.button !== 0 || _a(t)) return;
|
|
5053
|
+
let n = this.#q(t.clientX, t.clientY);
|
|
4927
5054
|
if (n) {
|
|
4928
5055
|
this.#x = n, t.preventDefault(), t.isTrusted && this.setPointerCapture(t.pointerId);
|
|
4929
5056
|
return;
|
|
@@ -4939,7 +5066,7 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4939
5066
|
this.#H(this.#x.el), this.#x = null;
|
|
4940
5067
|
return;
|
|
4941
5068
|
}
|
|
4942
|
-
|
|
5069
|
+
(this.#D || this.#E) && (this.#D = !1, this.#E = null, this.#$(), this.#O && this.#fe());
|
|
4943
5070
|
}
|
|
4944
5071
|
};
|
|
4945
5072
|
#Q = (e) => {
|
|
@@ -4972,16 +5099,16 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4972
5099
|
#ne = !1;
|
|
4973
5100
|
#re = 0;
|
|
4974
5101
|
#ie = (e) => {
|
|
4975
|
-
|
|
5102
|
+
ia.test(e.propertyName) && (this.#te++, this.#re = performance.now(), this.#oe());
|
|
4976
5103
|
};
|
|
4977
5104
|
#ae = (e) => {
|
|
4978
|
-
|
|
5105
|
+
ia.test(e.propertyName) && (this.#te = Math.max(0, this.#te - 1));
|
|
4979
5106
|
};
|
|
4980
5107
|
#oe() {
|
|
4981
5108
|
if (this.#ne) return;
|
|
4982
5109
|
this.#ne = !0;
|
|
4983
5110
|
let e = () => {
|
|
4984
|
-
if (!this.isConnected || this.#te === 0 && !a() || performance.now() - this.#re >
|
|
5111
|
+
if (!this.isConnected || this.#te === 0 && !a() || performance.now() - this.#re > aa) {
|
|
4985
5112
|
this.#ne = !1, this.#te = 0, this.#fe();
|
|
4986
5113
|
return;
|
|
4987
5114
|
}
|
|
@@ -4990,21 +5117,23 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4990
5117
|
requestAnimationFrame(e);
|
|
4991
5118
|
}
|
|
4992
5119
|
#se = (e) => {
|
|
4993
|
-
if ((e
|
|
4994
|
-
|
|
4995
|
-
|
|
5120
|
+
if (!_a(e)) {
|
|
5121
|
+
if ((e.type === "focusin" || e.type === "focusout") && e.target instanceof HTMLSelectElement) {
|
|
5122
|
+
this.#de();
|
|
5123
|
+
return;
|
|
5124
|
+
}
|
|
5125
|
+
this.#fe();
|
|
4996
5126
|
}
|
|
4997
|
-
this.#fe();
|
|
4998
5127
|
};
|
|
4999
5128
|
attributeChangedCallback(e, t, n) {
|
|
5000
5129
|
if (e === "select" && n !== "text" && n !== "grid") {
|
|
5001
|
-
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, ee(this)), this.setAttribute("select",
|
|
5130
|
+
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, ee(this)), this.setAttribute("select", na);
|
|
5002
5131
|
return;
|
|
5003
5132
|
}
|
|
5004
5133
|
e === "select" && this.#$(), this.#fe();
|
|
5005
5134
|
}
|
|
5006
5135
|
toPlainText() {
|
|
5007
|
-
return this.#d && this.#pe(), this.#p ?
|
|
5136
|
+
return this.#d && this.#pe(), this.#p ? ir(this.#p) : "";
|
|
5008
5137
|
}
|
|
5009
5138
|
#ce = () => {
|
|
5010
5139
|
this.#fe();
|
|
@@ -5054,16 +5183,16 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5054
5183
|
let s = Ee(), c = [];
|
|
5055
5184
|
for (let e of Array.from(this.children)) {
|
|
5056
5185
|
if (e === this.#c) continue;
|
|
5057
|
-
let r =
|
|
5186
|
+
let r = Ii(e, s, n, t);
|
|
5058
5187
|
r && c.push(r);
|
|
5059
5188
|
}
|
|
5060
|
-
if (
|
|
5189
|
+
if (Zi(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${Qi}`, ee(this)), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), c.length === 0) {
|
|
5061
5190
|
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
5062
5191
|
return;
|
|
5063
5192
|
}
|
|
5064
5193
|
let l = {
|
|
5065
5194
|
source: this,
|
|
5066
|
-
style:
|
|
5195
|
+
style: at(),
|
|
5067
5196
|
children: c,
|
|
5068
5197
|
text: "",
|
|
5069
5198
|
intrinsicWidth: 0,
|
|
@@ -5075,9 +5204,9 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5075
5204
|
height: 0
|
|
5076
5205
|
},
|
|
5077
5206
|
unclampedHeight: 0,
|
|
5078
|
-
resolvedPadding:
|
|
5079
|
-
}, { height: u } =
|
|
5080
|
-
|
|
5207
|
+
resolvedPadding: ot()
|
|
5208
|
+
}, { height: u } = In(l, o);
|
|
5209
|
+
Dr(l), this.#_ = va(l), this.#F(n, e), this.#O = !yr(l, this.#s, this.#D), this.#p = l;
|
|
5081
5210
|
let d = `${l.localRect.width * n.width}px`, f = `${l.localRect.height * n.height}px`;
|
|
5082
5211
|
this.#s.style.width !== d && (this.#s.style.width = d), this.#s.style.height !== f && (this.#s.style.height = f);
|
|
5083
5212
|
let p = i.boxSizing === "border-box" ? (parseFloat(i.paddingTop) || 0) + (parseFloat(i.paddingBottom) || 0) + (parseFloat(i.borderTopWidth) || 0) + (parseFloat(i.borderBottomWidth) || 0) : 0, m = `${u * n.height + p}px`;
|
|
@@ -5092,18 +5221,21 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5092
5221
|
}
|
|
5093
5222
|
}
|
|
5094
5223
|
};
|
|
5095
|
-
function
|
|
5096
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
5224
|
+
function ma() {
|
|
5225
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", pa);
|
|
5097
5226
|
}
|
|
5098
|
-
function
|
|
5099
|
-
return
|
|
5227
|
+
function ha(e, t, n, r, i) {
|
|
5228
|
+
return ga(t === "y" ? e.scrollTop : e.scrollLeft, t === "y" ? e.scrollHeight - e.clientHeight : e.scrollWidth - e.clientWidth, n, r, i);
|
|
5100
5229
|
}
|
|
5101
|
-
function
|
|
5230
|
+
function ga(e, t, n, r, i) {
|
|
5102
5231
|
if (r > 0 && e > 0 && e >= t - 1) return r;
|
|
5103
5232
|
let a = e / n - i, o = Math.abs(a) <= .5 ? i : i + Math.sign(a) * Math.round(Math.abs(a));
|
|
5104
5233
|
return Math.min(Math.max(0, o), r);
|
|
5105
5234
|
}
|
|
5106
|
-
function
|
|
5235
|
+
function _a(e) {
|
|
5236
|
+
return e instanceof PointerEvent && e.pointerType === "touch" && e.type !== "pointerup";
|
|
5237
|
+
}
|
|
5238
|
+
function va(e) {
|
|
5107
5239
|
let t = [], n = (e) => {
|
|
5108
5240
|
e.scrollRange && t.push(e);
|
|
5109
5241
|
for (let t of e.children) n(t);
|
|
@@ -5111,6 +5243,6 @@ function pa(e) {
|
|
|
5111
5243
|
return n(e), t;
|
|
5112
5244
|
}
|
|
5113
5245
|
//#endregion
|
|
5114
|
-
export {
|
|
5246
|
+
export { pa as MonoWindElement, ma as defineMonoWind, ie as invalidateLeaves, Xt as multicolLines, x as registerBorderGlyphs, re as registerLeafRenderer, ir as renderPlainText, De as wrapLines };
|
|
5115
5247
|
|
|
5116
5248
|
//# sourceMappingURL=index.js.map
|