@stackone/malachite 2.88.1 → 2.88.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Table/Table.js +211 -203
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/theme.js +46 -45
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2096,7 +2096,10 @@ export declare const ForwardArrowIcon: React.FC<IconProps_58>;
|
|
|
2096
2096
|
export declare function getCurrentTheme(): MalachiteTheme;
|
|
2097
2097
|
|
|
2098
2098
|
/**
|
|
2099
|
-
*
|
|
2099
|
+
* The mode this page is painted in. Once anything has painted it, that is read from the document,
|
|
2100
|
+
* not localStorage: every tab shares the stored mode, so a tab painted light would otherwise mount
|
|
2101
|
+
* dark components because another tab saved dark. Before the first paint it is the saved mode, so
|
|
2102
|
+
* a reload keeps the last choice.
|
|
2100
2103
|
*/
|
|
2101
2104
|
export declare function getCurrentThemeMode(): 'light' | 'dark';
|
|
2102
2105
|
|
|
@@ -5413,9 +5416,9 @@ declare type TableProps<T = Record<string, unknown>> = {
|
|
|
5413
5416
|
scrollHeight?: string | number;
|
|
5414
5417
|
type?: TableType;
|
|
5415
5418
|
size?: TableSize;
|
|
5416
|
-
/** Vertical density of body rows. 'compact'
|
|
5417
|
-
*
|
|
5418
|
-
*
|
|
5419
|
+
/** Vertical density of body rows. 'compact' takes the cell padding to 4px and lets a row
|
|
5420
|
+
* shrink to its content, as an antd small table does, so a text row is about 30px;
|
|
5421
|
+
* headers keep their own padding. */
|
|
5419
5422
|
rowDensity?: 'default' | 'compact';
|
|
5420
5423
|
layout?: 'fixed' | 'auto';
|
|
5421
5424
|
headerVariant?: TableHeaderVariant;
|
package/dist/theme.js
CHANGED
|
@@ -1093,7 +1093,7 @@ const A = [
|
|
|
1093
1093
|
surfaceForeground: "rgb(134, 120, 186)"
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
}, O = "malachite-theme-mode", $ = "malachite-custom-theme",
|
|
1096
|
+
}, O = "malachite-theme-mode", $ = "malachite-custom-theme", G = /^--[A-Za-z0-9_-]+$/, L = /[{};]|\/\*|\*\//, _ = /^[A-Za-z0-9_-]+$/;
|
|
1097
1097
|
function T(r, l) {
|
|
1098
1098
|
if (typeof r == "string") {
|
|
1099
1099
|
if (L.test(r)) {
|
|
@@ -1108,7 +1108,7 @@ function T(r, l) {
|
|
|
1108
1108
|
const a = {};
|
|
1109
1109
|
for (const [o, n] of Object.entries(r)) {
|
|
1110
1110
|
const u = l ? `${l}.${o}` : o;
|
|
1111
|
-
if (!
|
|
1111
|
+
if (!_.test(o)) {
|
|
1112
1112
|
console.warn(
|
|
1113
1113
|
`Malachite: ignoring a theme key under ${l || "<root>"} — theme keys may contain only letters, digits, hyphens and underscores.`
|
|
1114
1114
|
);
|
|
@@ -1120,29 +1120,29 @@ function T(r, l) {
|
|
|
1120
1120
|
return a;
|
|
1121
1121
|
}
|
|
1122
1122
|
const x = /* @__PURE__ */ new Set();
|
|
1123
|
-
function
|
|
1123
|
+
function U(r) {
|
|
1124
1124
|
try {
|
|
1125
1125
|
if (x.has(r))
|
|
1126
1126
|
return;
|
|
1127
|
-
x.add(r),
|
|
1127
|
+
x.add(r), N(r);
|
|
1128
1128
|
} catch (l) {
|
|
1129
1129
|
console.error("Error registering shadow root:", l);
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function J(r) {
|
|
1133
1133
|
try {
|
|
1134
1134
|
x.delete(r);
|
|
1135
1135
|
} catch (l) {
|
|
1136
1136
|
console.error("Error unregistering shadow root:", l);
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
|
-
const
|
|
1139
|
+
const D = {
|
|
1140
1140
|
rowVariant: "row-variant",
|
|
1141
1141
|
boxShadow: "box-shadow"
|
|
1142
1142
|
};
|
|
1143
1143
|
function E(r, l, a) {
|
|
1144
1144
|
Object.entries(r).forEach(([o, n]) => {
|
|
1145
|
-
const u =
|
|
1145
|
+
const u = D[o] ?? o;
|
|
1146
1146
|
typeof n == "object" && n !== null ? Object.entries(n).forEach(([b, t]) => {
|
|
1147
1147
|
const d = b.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1148
1148
|
typeof t == "object" && t !== null ? Object.entries(t).forEach(([g, s]) => {
|
|
@@ -1241,10 +1241,10 @@ function p(r, l, a = "light") {
|
|
|
1241
1241
|
typeof c == "object" && c !== null ? Object.entries(c).forEach(([h, m]) => {
|
|
1242
1242
|
const B = h.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1243
1243
|
typeof m == "object" && m !== null ? Object.entries(m).forEach(
|
|
1244
|
-
([
|
|
1245
|
-
const
|
|
1244
|
+
([Z, M]) => {
|
|
1245
|
+
const R = Z.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1246
1246
|
t.push(
|
|
1247
|
-
`--malachite-text-${i}-${B}-${
|
|
1247
|
+
`--malachite-text-${i}-${B}-${R}: ${M}`
|
|
1248
1248
|
);
|
|
1249
1249
|
}
|
|
1250
1250
|
) : t.push(
|
|
@@ -1277,7 +1277,7 @@ function p(r, l, a = "light") {
|
|
|
1277
1277
|
});
|
|
1278
1278
|
const g = t.filter((s) => {
|
|
1279
1279
|
if (!L.test(s)) return !0;
|
|
1280
|
-
const c = s.split(":", 1)[0].trim(), i =
|
|
1280
|
+
const c = s.split(":", 1)[0].trim(), i = G.test(c) ? c : "an unnamed token";
|
|
1281
1281
|
return console.warn(`Malachite: dropped an unsafe theme declaration for ${i}`), !1;
|
|
1282
1282
|
});
|
|
1283
1283
|
b.textContent = `:host { color-scheme: ${a}; ${g.join("; ")} }`;
|
|
@@ -1402,7 +1402,7 @@ function p(r, l, a = "light") {
|
|
|
1402
1402
|
});
|
|
1403
1403
|
}));
|
|
1404
1404
|
}
|
|
1405
|
-
function
|
|
1405
|
+
function N(r) {
|
|
1406
1406
|
try {
|
|
1407
1407
|
const l = P(), a = V(), o = l === "dark" ? k : e, n = a ? w(o, a) : o;
|
|
1408
1408
|
p(n, r, l);
|
|
@@ -1410,8 +1410,9 @@ function D(r) {
|
|
|
1410
1410
|
console.error("Error applying theme to shadow root:", l);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
|
+
let j = !1;
|
|
1413
1414
|
function P() {
|
|
1414
|
-
return typeof window > "u" ? "light" : localStorage.getItem(O) || "light";
|
|
1415
|
+
return typeof window > "u" ? "light" : j ? document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light" : localStorage.getItem(O) || "light";
|
|
1415
1416
|
}
|
|
1416
1417
|
function V() {
|
|
1417
1418
|
if (typeof window > "u") return null;
|
|
@@ -1423,10 +1424,10 @@ function V() {
|
|
|
1423
1424
|
return localStorage.removeItem($), null;
|
|
1424
1425
|
}
|
|
1425
1426
|
}
|
|
1426
|
-
function
|
|
1427
|
+
function H(r) {
|
|
1427
1428
|
typeof window < "u" && localStorage.setItem(O, r);
|
|
1428
1429
|
}
|
|
1429
|
-
function
|
|
1430
|
+
function I(r) {
|
|
1430
1431
|
typeof window < "u" && localStorage.setItem($, JSON.stringify(r));
|
|
1431
1432
|
}
|
|
1432
1433
|
function w(r, l) {
|
|
@@ -1501,45 +1502,45 @@ function w(r, l) {
|
|
|
1501
1502
|
}
|
|
1502
1503
|
return o;
|
|
1503
1504
|
}
|
|
1504
|
-
function
|
|
1505
|
-
|
|
1505
|
+
function W(r) {
|
|
1506
|
+
I(r);
|
|
1506
1507
|
const l = P(), o = w(l === "dark" ? k : e, r);
|
|
1507
1508
|
p(o, document.documentElement), x.forEach((n) => {
|
|
1508
1509
|
p(o, n, l);
|
|
1509
1510
|
}), C(l);
|
|
1510
1511
|
}
|
|
1511
|
-
function
|
|
1512
|
+
function q(r, l) {
|
|
1512
1513
|
const a = l === "dark" ? k : e, o = V(), n = o ? w(a, o) : a;
|
|
1513
1514
|
p(n, r, l);
|
|
1514
1515
|
}
|
|
1515
1516
|
const C = (r) => {
|
|
1516
|
-
r === "dark" ? document.documentElement.setAttribute("data-theme", "dark") : document.documentElement.removeAttribute("data-theme");
|
|
1517
|
+
j = !0, r === "dark" ? document.documentElement.setAttribute("data-theme", "dark") : document.documentElement.removeAttribute("data-theme");
|
|
1517
1518
|
};
|
|
1518
|
-
function
|
|
1519
|
-
|
|
1519
|
+
function K() {
|
|
1520
|
+
H("light"), C("light");
|
|
1520
1521
|
const r = V(), l = r ? w(e, r) : e;
|
|
1521
1522
|
p(l, document.documentElement), x.forEach((a) => {
|
|
1522
1523
|
p(l, a, "light");
|
|
1523
1524
|
});
|
|
1524
1525
|
}
|
|
1525
|
-
function
|
|
1526
|
-
|
|
1526
|
+
function z() {
|
|
1527
|
+
H("dark"), C("dark");
|
|
1527
1528
|
const r = V(), l = r ? w(k, r) : k;
|
|
1528
1529
|
p(l, document.documentElement), x.forEach((a) => {
|
|
1529
1530
|
p(l, a, "dark");
|
|
1530
1531
|
});
|
|
1531
1532
|
}
|
|
1532
|
-
function
|
|
1533
|
-
return P() === "dark" ? (
|
|
1533
|
+
function X() {
|
|
1534
|
+
return P() === "dark" ? (K(), "light") : (z(), "dark");
|
|
1534
1535
|
}
|
|
1535
|
-
function
|
|
1536
|
-
|
|
1536
|
+
function Q(r) {
|
|
1537
|
+
W(r);
|
|
1537
1538
|
}
|
|
1538
|
-
function
|
|
1539
|
+
function rr() {
|
|
1539
1540
|
const r = P();
|
|
1540
|
-
localStorage.removeItem($), r === "dark" ?
|
|
1541
|
+
localStorage.removeItem($), r === "dark" ? z() : K();
|
|
1541
1542
|
}
|
|
1542
|
-
function
|
|
1543
|
+
function Y() {
|
|
1543
1544
|
if (typeof window < "u") {
|
|
1544
1545
|
const r = P(), l = V();
|
|
1545
1546
|
if (r === "dark")
|
|
@@ -1556,7 +1557,7 @@ function W() {
|
|
|
1556
1557
|
C(r);
|
|
1557
1558
|
}
|
|
1558
1559
|
}
|
|
1559
|
-
function
|
|
1560
|
+
function er() {
|
|
1560
1561
|
const r = getComputedStyle(document.documentElement), l = {};
|
|
1561
1562
|
for (const a of A) {
|
|
1562
1563
|
const o = r.getPropertyValue(v(a)).trim();
|
|
@@ -1987,25 +1988,25 @@ function rr() {
|
|
|
1987
1988
|
};
|
|
1988
1989
|
}
|
|
1989
1990
|
let S = !1;
|
|
1990
|
-
const
|
|
1991
|
-
S || (S = !0,
|
|
1991
|
+
const or = () => {
|
|
1992
|
+
S || (S = !0, Y());
|
|
1992
1993
|
};
|
|
1993
1994
|
export {
|
|
1994
1995
|
f as CONTROL_HEIGHT,
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
1996
|
+
Q as applyCustomTheme,
|
|
1997
|
+
z as applyDarkTheme,
|
|
1998
|
+
K as applyLightTheme,
|
|
1999
|
+
W as applyTheme,
|
|
2000
|
+
q as applyThemeVars,
|
|
2000
2001
|
k as darkTheme,
|
|
2001
2002
|
e as defaultTheme,
|
|
2002
|
-
|
|
2003
|
-
|
|
2003
|
+
or as ensureThemeInitialized,
|
|
2004
|
+
er as getCurrentTheme,
|
|
2004
2005
|
P as getCurrentThemeMode,
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2006
|
+
Y as initializeTheme,
|
|
2007
|
+
U as registerShadowRoot,
|
|
2008
|
+
rr as resetTheme,
|
|
2009
|
+
X as toggleTheme,
|
|
2010
|
+
J as unregisterShadowRoot
|
|
2010
2011
|
};
|
|
2011
2012
|
//# sourceMappingURL=theme.js.map
|