@tesouro/embedded-components-react 0.9.29 → 0.9.31
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 +9 -0
- package/dist/index.css +788 -24
- package/dist/index.d.ts +15 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/index.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/color.js +104 -59
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/createTheme.js +61 -48
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/index.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/themeTokens.js +43 -1
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/toneColors.js +70 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1403,10 +1403,25 @@ type ThemeIssue = {
|
|
|
1403
1403
|
text: ThemeTokenName;
|
|
1404
1404
|
ratio: number;
|
|
1405
1405
|
minimum: number;
|
|
1406
|
+
} | {
|
|
1407
|
+
/** Readable under the current formula, but not under the color-mix() fallback. */
|
|
1408
|
+
kind: 'fallback-contrast';
|
|
1409
|
+
fill: ThemeTokenName;
|
|
1410
|
+
text: ThemeTokenName;
|
|
1411
|
+
ratio: number;
|
|
1412
|
+
minimum: number;
|
|
1406
1413
|
} | {
|
|
1407
1414
|
kind: 'radius';
|
|
1408
1415
|
value: string;
|
|
1409
1416
|
};
|
|
1417
|
+
/**
|
|
1418
|
+
* Checks a theme against what the widgets render. A derived status tone is
|
|
1419
|
+
* checked against the relative-colour formula, and then against the older
|
|
1420
|
+
* `color-mix()` tint a browser that fails the `@supports` test keeps instead
|
|
1421
|
+
* (ADR-0011, "Browser support"). A pale tone such as `#fde68a` passes the
|
|
1422
|
+
* first and falls below 4.5:1 in the second, which is a `fallback-contrast`
|
|
1423
|
+
* issue rather than a `contrast` one.
|
|
1424
|
+
*/
|
|
1410
1425
|
declare function themeIssues(input: Readonly<Record<string, string | undefined>>): ThemeIssue[];
|
|
1411
1426
|
declare function createTheme(input: ThemeInput): ThemeTokens;
|
|
1412
1427
|
declare function themeToCss(tokens: Readonly<ThemeTokens>, selector?: string): string;
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.9.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.9.31", n = "74c76b47fd5394fb613cdb24d32220cc07285e4b", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|
|
@@ -26,6 +26,7 @@ import { buildReceivableAuditHistory as O } from "./lib/auditHistory/buildReceiv
|
|
|
26
26
|
import { buildPayableAuditHistory as k, hasUnattributedAuditRows as A } from "./lib/auditHistory/buildPayableAuditHistory.js";
|
|
27
27
|
import "./lib/theme/color.js";
|
|
28
28
|
import { THEME_TOKEN_NAMES as j } from "./lib/theme/themeTokens.js";
|
|
29
|
+
import "./lib/theme/toneColors.js";
|
|
29
30
|
import { createTheme as M, isThemeDevelopmentBuild as N, readThemeTokens as P, reportThemeIssues as F, themeIssues as I, themeToCss as L } from "./lib/theme/createTheme.js";
|
|
30
31
|
import "./lib/theme/index.js";
|
|
31
32
|
export { C as TESOURO_NEW_EMBEDDED_BANK_ACCOUNT_CREATED_SUCCESS_EVENT, w as TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT, j as THEME_TOKEN_NAMES, n as amountOutputToMajorUnits, k as buildPayableAuditHistory, O as buildReceivableAuditHistory, e as coerceAmountValueToMinorUnits, t as createCurrencyFormatter, M as createTheme, S as createWidgetTokenManager, s as currencySymbolForCode, T as emitWidgetDomEvent, E as extractApiErrorMessage, i as formatCalendarDate, c as formatMoneyExact, l as formatPhoneDisplay, o as formatRejectionDate, a as formatTimestampDate, u as getInitials, _ as getRelativeCalendarDay, b as getStateOptions, A as hasUnattributedAuditRows, x as isStateValid, N as isThemeDevelopmentBuild, d as isValidAchAccountNumber, f as mergeLabelTree, r as minorExponentForCurrency, p as normalizeAmountOutputCurrencyCode, m as parseAmountOutputMajorUnits, D as parseApiValidationErrors, h as parseCalendarDate, g as parseDateOrTimestamp, v as parseDecimalAmountToMinorUnits, P as readThemeTokens, F as reportThemeIssues, y as sumAmountOutputsMajorUnits, I as themeIssues, L as themeToCss };
|
|
@@ -51,29 +51,33 @@ function i(e) {
|
|
|
51
51
|
alpha: r
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
function a({ l:
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
function a({ l: e, a: t, b: n }) {
|
|
55
|
+
let r = (e + .3963377774 * t + .2158037573 * n) ** 3, i = (e - .1055613458 * t - .0638541728 * n) ** 3, a = (e - .0894841775 * t - 1.291485548 * n) ** 3;
|
|
56
|
+
return [
|
|
57
|
+
4.0767416621 * r - 3.3077115913 * i + .2309699292 * a,
|
|
58
|
+
-1.2684380046 * r + 2.6097574011 * i - .3413193965 * a,
|
|
59
|
+
-.0041960863 * r - .7034186147 * i + 1.707614701 * a
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
function o(t) {
|
|
63
|
+
let { alpha: n } = t, r = a(t).map((t) => {
|
|
60
64
|
let n = e(t);
|
|
61
65
|
return n <= .0031308 ? 12.92 * n : 1.055 * n ** (1 / 2.4) - .055;
|
|
62
66
|
});
|
|
63
67
|
return {
|
|
64
|
-
r:
|
|
65
|
-
g:
|
|
66
|
-
b:
|
|
67
|
-
alpha:
|
|
68
|
+
r: r[0],
|
|
69
|
+
g: r[1],
|
|
70
|
+
b: r[2],
|
|
71
|
+
alpha: n
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
|
-
var
|
|
71
|
-
function
|
|
72
|
-
let [i, a,
|
|
74
|
+
var s = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
75
|
+
function c({ r: e, g: t, b: n, alpha: r }) {
|
|
76
|
+
let [i, a, o] = [
|
|
73
77
|
e,
|
|
74
78
|
t,
|
|
75
79
|
n
|
|
76
|
-
].map(
|
|
80
|
+
].map(s), c = Math.cbrt(.4122214708 * i + .5363325363 * a + .0514459929 * o), l = Math.cbrt(.2119034982 * i + .6806995451 * a + .1073969566 * o), u = Math.cbrt(.0883024619 * i + .2817188376 * a + .6299787005 * o);
|
|
77
81
|
return {
|
|
78
82
|
l: .2104542553 * c + .793617785 * l - .0040720468 * u,
|
|
79
83
|
a: 1.9779984951 * c - 2.428592205 * l + .4505937099 * u,
|
|
@@ -81,7 +85,7 @@ function s({ r: e, g: t, b: n, alpha: r }) {
|
|
|
81
85
|
alpha: r
|
|
82
86
|
};
|
|
83
87
|
}
|
|
84
|
-
function
|
|
88
|
+
function l(e, t, n, r) {
|
|
85
89
|
let i = (t) => (t + e / 30) % 12, a = t * Math.min(n, 1 - n), o = (e) => n - a * Math.max(-1, Math.min(i(e) - 3, Math.min(9 - i(e), 1)));
|
|
86
90
|
return {
|
|
87
91
|
r: o(0),
|
|
@@ -90,22 +94,45 @@ function c(e, t, n, r) {
|
|
|
90
94
|
alpha: r
|
|
91
95
|
};
|
|
92
96
|
}
|
|
93
|
-
function
|
|
94
|
-
let s =
|
|
97
|
+
function u(t, n, i) {
|
|
98
|
+
let [a, o, s] = n, c = r(a, 1);
|
|
99
|
+
if (c === null) return null;
|
|
100
|
+
let l = e(c);
|
|
101
|
+
if (t === "oklab") {
|
|
102
|
+
let e = r(o, .4), t = r(s, .4);
|
|
103
|
+
return e === null || t === null ? null : {
|
|
104
|
+
l,
|
|
105
|
+
a: e,
|
|
106
|
+
b: t,
|
|
107
|
+
alpha: i
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
let u = r(o, .4), d = r(s);
|
|
111
|
+
if (u === null || d === null) return null;
|
|
112
|
+
let f = Math.max(0, u), p = d * Math.PI / 180;
|
|
113
|
+
return {
|
|
114
|
+
l,
|
|
115
|
+
a: f * Math.cos(p),
|
|
116
|
+
b: f * Math.sin(p),
|
|
117
|
+
alpha: i
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function d(a) {
|
|
121
|
+
let s = a.trim().toLowerCase();
|
|
95
122
|
if (s in t) return t[s];
|
|
96
123
|
if (s.startsWith("#")) return n(s);
|
|
97
|
-
let
|
|
98
|
-
if (!
|
|
99
|
-
let
|
|
100
|
-
if (
|
|
101
|
-
let [
|
|
102
|
-
switch (
|
|
124
|
+
let c = i(s);
|
|
125
|
+
if (!c || c.args.length !== 3) return null;
|
|
126
|
+
let d = c.alpha === void 0 ? 1 : r(c.alpha, 1);
|
|
127
|
+
if (d === null) return null;
|
|
128
|
+
let [f, p, m] = c.args;
|
|
129
|
+
switch (c.name) {
|
|
103
130
|
case "rgb":
|
|
104
131
|
case "rgba": {
|
|
105
132
|
let t = [
|
|
106
|
-
d,
|
|
107
133
|
f,
|
|
108
|
-
p
|
|
134
|
+
p,
|
|
135
|
+
m
|
|
109
136
|
].map((e) => r(e, 255));
|
|
110
137
|
if (t.some((e) => e === null)) return null;
|
|
111
138
|
let [n, i, a] = t;
|
|
@@ -113,56 +140,74 @@ function l(o) {
|
|
|
113
140
|
r: e(n / 255),
|
|
114
141
|
g: e(i / 255),
|
|
115
142
|
b: e(a / 255),
|
|
116
|
-
alpha:
|
|
143
|
+
alpha: d
|
|
117
144
|
};
|
|
118
145
|
}
|
|
119
146
|
case "hsl":
|
|
120
147
|
case "hsla": {
|
|
121
|
-
let e = r(
|
|
148
|
+
let e = r(f), t = r(p, 1), n = r(m, 1);
|
|
122
149
|
if (e === null || t === null || n === null) return null;
|
|
123
150
|
let i = (e, t) => t.endsWith("%") ? e : e / 100;
|
|
124
|
-
return
|
|
125
|
-
}
|
|
126
|
-
case "oklch": {
|
|
127
|
-
let e = r(d, 1), t = r(f, .4), n = r(p);
|
|
128
|
-
if (e === null || t === null || n === null) return null;
|
|
129
|
-
let i = n * Math.PI / 180;
|
|
130
|
-
return a({
|
|
131
|
-
l: e,
|
|
132
|
-
a: t * Math.cos(i),
|
|
133
|
-
b: t * Math.sin(i),
|
|
134
|
-
alpha: u
|
|
135
|
-
});
|
|
151
|
+
return l((e % 360 + 360) % 360, i(t, p), i(n, m), d);
|
|
136
152
|
}
|
|
153
|
+
case "oklch":
|
|
137
154
|
case "oklab": {
|
|
138
|
-
let e =
|
|
139
|
-
return e
|
|
140
|
-
l: e,
|
|
141
|
-
a: t,
|
|
142
|
-
b: n,
|
|
143
|
-
alpha: u
|
|
144
|
-
});
|
|
155
|
+
let e = u(c.name, c.args, d);
|
|
156
|
+
return e ? o(e) : null;
|
|
145
157
|
}
|
|
146
158
|
default: return null;
|
|
147
159
|
}
|
|
148
160
|
}
|
|
149
|
-
function
|
|
150
|
-
let i =
|
|
161
|
+
function f(t, n, r) {
|
|
162
|
+
let i = c(t), a = c(n), s = e(r), l = i.alpha * s + a.alpha * (1 - s);
|
|
151
163
|
if (l === 0) return {
|
|
152
164
|
r: 0,
|
|
153
165
|
g: 0,
|
|
154
166
|
b: 0,
|
|
155
167
|
alpha: 0
|
|
156
168
|
};
|
|
157
|
-
let u = (e, t) => (e * i.alpha *
|
|
158
|
-
return
|
|
159
|
-
l: u(i.l,
|
|
160
|
-
a: u(i.a,
|
|
161
|
-
b: u(i.b,
|
|
169
|
+
let u = (e, t) => (e * i.alpha * s + t * a.alpha * (1 - s)) / l;
|
|
170
|
+
return o({
|
|
171
|
+
l: u(i.l, a.l),
|
|
172
|
+
a: u(i.a, a.a),
|
|
173
|
+
b: u(i.b, a.b),
|
|
162
174
|
alpha: l
|
|
163
175
|
});
|
|
164
176
|
}
|
|
165
|
-
|
|
177
|
+
var p = ({ l: e, a: t, b: n, alpha: r }) => {
|
|
178
|
+
let i = Math.hypot(t, n);
|
|
179
|
+
return {
|
|
180
|
+
l: e,
|
|
181
|
+
c: i,
|
|
182
|
+
h: i < 1e-9 ? 0 : (Math.atan2(n, t) * 180 / Math.PI + 360) % 360,
|
|
183
|
+
alpha: r
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
function m(e) {
|
|
187
|
+
return p(c(e));
|
|
188
|
+
}
|
|
189
|
+
function h(e) {
|
|
190
|
+
let t = e.trim().toLowerCase(), n = i(t);
|
|
191
|
+
if (n?.args.length === 3 && ["oklch", "oklab"].includes(n.name)) {
|
|
192
|
+
let e = n.alpha === void 0 ? 1 : r(n.alpha, 1), t = e === null ? null : u(n.name, n.args, e);
|
|
193
|
+
return t ? p(t) : null;
|
|
194
|
+
}
|
|
195
|
+
let a = d(t);
|
|
196
|
+
return a ? m(a) : null;
|
|
197
|
+
}
|
|
198
|
+
var g = ({ l: e, c: t, h: n, alpha: r }) => {
|
|
199
|
+
let i = n * Math.PI / 180;
|
|
200
|
+
return {
|
|
201
|
+
l: e,
|
|
202
|
+
a: t * Math.cos(i),
|
|
203
|
+
b: t * Math.sin(i),
|
|
204
|
+
alpha: r
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
function _(e) {
|
|
208
|
+
return o(g(e));
|
|
209
|
+
}
|
|
210
|
+
function v(e, t) {
|
|
166
211
|
let n = (t, n) => t * e.alpha + n * (1 - e.alpha);
|
|
167
212
|
return {
|
|
168
213
|
r: n(e.r, t.r),
|
|
@@ -171,12 +216,12 @@ function d(e, t) {
|
|
|
171
216
|
alpha: 1
|
|
172
217
|
};
|
|
173
218
|
}
|
|
174
|
-
function
|
|
175
|
-
return .2126 *
|
|
219
|
+
function y({ r: e, g: t, b: n }) {
|
|
220
|
+
return .2126 * s(e) + .7152 * s(t) + .0722 * s(n);
|
|
176
221
|
}
|
|
177
|
-
function
|
|
178
|
-
let n = Math.max(
|
|
222
|
+
function b(e, t) {
|
|
223
|
+
let n = Math.max(y(e), y(t)), r = Math.min(y(e), y(t));
|
|
179
224
|
return (n + .05) / (r + .05);
|
|
180
225
|
}
|
|
181
226
|
//#endregion
|
|
182
|
-
export {
|
|
227
|
+
export { v as composite, b as contrastRatio, _ as fromOklch, f as mixOklab, d as parseCssColor, h as parseCssOklch, m as toOklch };
|
package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/createTheme.js
CHANGED
|
@@ -1,85 +1,98 @@
|
|
|
1
|
-
import { composite as e, contrastRatio as t,
|
|
1
|
+
import { composite as e, contrastRatio as t, parseCssColor as n, parseCssOklch as r } from "./color.js";
|
|
2
2
|
import { DEFAULT_THEME_TOKENS as i, MIN_TEXT_CONTRAST as a, THEME_CONTRAST_PAIRS as o, THEME_RADIUS_RANGE_REM as s, THEME_TOKEN_FALLBACKS as c, THEME_TOKEN_NAMES as l, THEME_TONES as u } from "./themeTokens.js";
|
|
3
|
+
import { legacyToneSubtle as d, legacyToneText as f, toneSubtle as p, toneText as m } from "./toneColors.js";
|
|
3
4
|
//#region ../../libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/createTheme.js
|
|
4
|
-
var
|
|
5
|
-
function
|
|
5
|
+
var h = new Map(Object.entries(l).map(([e, t]) => [t, e])), g = new Set(Object.values(l));
|
|
6
|
+
function _(e) {
|
|
6
7
|
let t = /^(-?[\d.]+)(rem|px|em)?$/i.exec(e.trim());
|
|
7
8
|
if (!t) return null;
|
|
8
9
|
let n = Number.parseFloat(t[1]);
|
|
9
10
|
return Number.isNaN(n) ? null : t[2] ? t[2].toLowerCase() === "px" ? n / 16 : n : n === 0 ? 0 : null;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function v(t, n) {
|
|
12
13
|
return t.alpha >= 1 ? t : n ? e(t, n) : null;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
let l = [],
|
|
16
|
-
for (let [t, n] of Object.entries(e)) n?.trim() && (
|
|
17
|
-
let
|
|
18
|
-
let t =
|
|
19
|
-
return t ?
|
|
20
|
-
},
|
|
15
|
+
function y(e) {
|
|
16
|
+
let l = [], h = { ...i };
|
|
17
|
+
for (let [t, n] of Object.entries(e)) n?.trim() && (h[t] = n);
|
|
18
|
+
let g = (e) => {
|
|
19
|
+
let t = h[e]?.trim();
|
|
20
|
+
return t ? n(t) : null;
|
|
21
|
+
}, y = (e) => {
|
|
21
22
|
let t = c[e];
|
|
22
|
-
return
|
|
23
|
-
},
|
|
24
|
-
if (!r || !i) return;
|
|
25
|
-
let
|
|
26
|
-
if (!
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
kind:
|
|
23
|
+
return g(e) ?? (t ? g(t) : null);
|
|
24
|
+
}, b = y("--ttw-background"), x = b && b.alpha >= 1 ? b : null, S = (e, n, r, i, o = a, s = "contrast") => {
|
|
25
|
+
if (!r || !i) return !0;
|
|
26
|
+
let c = v(r, x), u = c ? v(i, c) : null;
|
|
27
|
+
if (!c || !u) return !0;
|
|
28
|
+
let d = t(c, u);
|
|
29
|
+
return d >= o || (l.push({
|
|
30
|
+
kind: s,
|
|
30
31
|
fill: e,
|
|
31
32
|
text: n,
|
|
32
|
-
ratio: Math.round(
|
|
33
|
+
ratio: Math.round(d * 100) / 100,
|
|
33
34
|
minimum: o
|
|
34
|
-
});
|
|
35
|
+
}), !1);
|
|
35
36
|
};
|
|
36
|
-
for (let { fill: e, text: t, minimum: n } of o) (c[e] === void 0 || c[t] === void 0 ||
|
|
37
|
-
let
|
|
37
|
+
for (let { fill: e, text: t, minimum: n } of o) (c[e] === void 0 || c[t] === void 0 || g(e) || g(t)) && S(e, t, y(e), y(t), n);
|
|
38
|
+
let C = (e) => {
|
|
39
|
+
let t = (e) => {
|
|
40
|
+
let t = h[e]?.trim();
|
|
41
|
+
return t ? r(t) : null;
|
|
42
|
+
}, n = c[e];
|
|
43
|
+
return t(e) ?? (n ? t(n) : null);
|
|
44
|
+
}, w = C("--ttw-background"), T = C("--ttw-foreground"), E = y("--ttw-background"), D = y("--ttw-foreground");
|
|
38
45
|
for (let e of u) {
|
|
39
|
-
let t =
|
|
40
|
-
|
|
46
|
+
let t = C(e.hue), n = y(e.subtle), r = y(e.text), i = n ?? (t && w ? p(t, w) : null), a = r ?? (t && T ? m(t, T) : null);
|
|
47
|
+
if (!S(e.subtle, e.text, i, a)) continue;
|
|
48
|
+
let o = y(e.hue);
|
|
49
|
+
o && S(e.subtle, e.text, n ?? (E ? d(o, E) : null), r ?? (D ? f(o, D) : null), 4.5, "fallback-contrast");
|
|
41
50
|
}
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
44
|
-
let e =
|
|
51
|
+
let O = h["--ttw-radius"]?.trim();
|
|
52
|
+
if (O) {
|
|
53
|
+
let e = _(O);
|
|
45
54
|
e !== null && (e < s.min || e > s.max) && l.push({
|
|
46
55
|
kind: "radius",
|
|
47
|
-
value:
|
|
56
|
+
value: O
|
|
48
57
|
});
|
|
49
58
|
}
|
|
50
59
|
return l;
|
|
51
60
|
}
|
|
52
|
-
var
|
|
53
|
-
function
|
|
61
|
+
var b = "[@tesouro/embedded-components-react]";
|
|
62
|
+
function x(e) {
|
|
54
63
|
switch (e.kind) {
|
|
55
|
-
case "unknown-key": return `${
|
|
64
|
+
case "unknown-key": return `${b} createTheme: "${e.key}" is not a theme token, so it does nothing. Known keys: ${Object.keys(l).join(", ")}.`;
|
|
56
65
|
case "contrast": {
|
|
57
|
-
let t = (e) =>
|
|
58
|
-
return `${
|
|
66
|
+
let t = (e) => h.get(e) ?? e;
|
|
67
|
+
return `${b} Theme contrast: ${t(e.text)} (${e.text}) on ${t(e.fill)} (${e.fill}) is ${e.ratio}:1. Text needs at least ${e.minimum}:1 to stay readable.`;
|
|
68
|
+
}
|
|
69
|
+
case "fallback-contrast": {
|
|
70
|
+
let t = (e) => h.get(e) ?? e;
|
|
71
|
+
return `${b} Theme contrast in older browsers: ${t(e.text)} (${e.text}) on ${t(e.fill)} (${e.fill}) is readable in current browsers, but ${e.ratio}:1 in browsers without CSS relative colours, which keep the older tint. Text needs at least ${e.minimum}:1 there too. Set ${t(e.text)} explicitly to fix both.`;
|
|
59
72
|
}
|
|
60
|
-
case "radius": return `${
|
|
73
|
+
case "radius": return `${b} Theme radius "${e.value}" is outside ${s.min}–${s.max}rem, the range components are designed for.`;
|
|
61
74
|
}
|
|
62
75
|
}
|
|
63
|
-
function
|
|
76
|
+
function S() {
|
|
64
77
|
try {
|
|
65
78
|
return process.env.NODE_ENV !== "production";
|
|
66
79
|
} catch {
|
|
67
80
|
return !1;
|
|
68
81
|
}
|
|
69
82
|
}
|
|
70
|
-
var
|
|
71
|
-
function
|
|
72
|
-
if (
|
|
73
|
-
let e =
|
|
74
|
-
if (!
|
|
75
|
-
|
|
83
|
+
var C = /* @__PURE__ */ new Set();
|
|
84
|
+
function w(e) {
|
|
85
|
+
if (S()) for (let t of e) {
|
|
86
|
+
let e = x(t);
|
|
87
|
+
if (!C.has(e)) {
|
|
88
|
+
C.add(e);
|
|
76
89
|
try {
|
|
77
90
|
console.warn(e);
|
|
78
91
|
} catch {}
|
|
79
92
|
}
|
|
80
93
|
}
|
|
81
94
|
}
|
|
82
|
-
function
|
|
95
|
+
function T(e) {
|
|
83
96
|
let t = {}, n = [];
|
|
84
97
|
for (let [r, i] of Object.entries(e ?? {})) {
|
|
85
98
|
let e = l[r];
|
|
@@ -92,12 +105,12 @@ function x(e) {
|
|
|
92
105
|
}
|
|
93
106
|
typeof i == "string" && i.trim() !== "" && (t[e] = i.trim());
|
|
94
107
|
}
|
|
95
|
-
return
|
|
108
|
+
return S() && (n.push(...y(t)), w(n)), t;
|
|
96
109
|
}
|
|
97
|
-
function
|
|
98
|
-
return `${t} {\n${Object.entries(e).filter((e) =>
|
|
110
|
+
function E(e, t = ":root") {
|
|
111
|
+
return `${t} {\n${Object.entries(e).filter((e) => g.has(e[0]) && typeof e[1] == "string").map(([e, t]) => ` ${e}: ${t};`).join("\n")}\n}`;
|
|
99
112
|
}
|
|
100
|
-
function
|
|
113
|
+
function D(e) {
|
|
101
114
|
let t = {};
|
|
102
115
|
for (let n of Object.values(l)) {
|
|
103
116
|
let r = e(n)?.trim();
|
|
@@ -106,4 +119,4 @@ function C(e) {
|
|
|
106
119
|
return t;
|
|
107
120
|
}
|
|
108
121
|
//#endregion
|
|
109
|
-
export {
|
|
122
|
+
export { T as createTheme, x as describeThemeIssue, S as isThemeDevelopmentBuild, D as readThemeTokens, w as reportThemeIssues, y as themeIssues, E as themeToCss };
|
package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/themeTokens.js
CHANGED
|
@@ -163,8 +163,50 @@ var e = {
|
|
|
163
163
|
text: "--ttw-cyan-foreground"
|
|
164
164
|
}
|
|
165
165
|
], o = {
|
|
166
|
+
mixWeight: .16,
|
|
167
|
+
lightness: .56,
|
|
168
|
+
chromaScale: 2.5
|
|
169
|
+
}, s = {
|
|
170
|
+
mixWeight: .6,
|
|
171
|
+
lightness: .55
|
|
172
|
+
}, c = {
|
|
173
|
+
hueStep: 30,
|
|
174
|
+
light: [
|
|
175
|
+
.498,
|
|
176
|
+
.47,
|
|
177
|
+
.557,
|
|
178
|
+
1.055,
|
|
179
|
+
1.308,
|
|
180
|
+
1.421,
|
|
181
|
+
.936,
|
|
182
|
+
.796,
|
|
183
|
+
.48,
|
|
184
|
+
.449,
|
|
185
|
+
.532,
|
|
186
|
+
.753,
|
|
187
|
+
.498
|
|
188
|
+
],
|
|
189
|
+
dark: [
|
|
190
|
+
.396,
|
|
191
|
+
.355,
|
|
192
|
+
.209,
|
|
193
|
+
.193,
|
|
194
|
+
.225,
|
|
195
|
+
.25,
|
|
196
|
+
.164,
|
|
197
|
+
.16,
|
|
198
|
+
.161,
|
|
199
|
+
.489,
|
|
200
|
+
.525,
|
|
201
|
+
.444,
|
|
202
|
+
.396
|
|
203
|
+
]
|
|
204
|
+
}, l = {
|
|
205
|
+
subtle: .12,
|
|
206
|
+
text: .6
|
|
207
|
+
}, u = {
|
|
166
208
|
min: 0,
|
|
167
209
|
max: 1.25
|
|
168
210
|
};
|
|
169
211
|
//#endregion
|
|
170
|
-
export { t as DEFAULT_THEME_TOKENS, r as MIN_TEXT_CONTRAST, i as THEME_CONTRAST_PAIRS,
|
|
212
|
+
export { t as DEFAULT_THEME_TOKENS, r as MIN_TEXT_CONTRAST, i as THEME_CONTRAST_PAIRS, u as THEME_RADIUS_RANGE_REM, n as THEME_TOKEN_FALLBACKS, e as THEME_TOKEN_NAMES, a as THEME_TONES, o as TONE_FILL, c as TONE_FILL_GAMUT, l as TONE_LEGACY_MIX, s as TONE_TEXT };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { fromOklch as e, mixOklab as t, toOklch as n } from "./color.js";
|
|
2
|
+
import { TONE_FILL as r, TONE_FILL_GAMUT as i, TONE_LEGACY_MIX as a, TONE_TEXT as o } from "./themeTokens.js";
|
|
3
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/toneColors.js
|
|
4
|
+
var s = (e) => Math.round(e * 1e3) / 1e3;
|
|
5
|
+
function c(e) {
|
|
6
|
+
return e.slice(1).map((t, n) => s(t - e[n]));
|
|
7
|
+
}
|
|
8
|
+
function l(e, t) {
|
|
9
|
+
let n = i.hueStep, r = c(e).reduce((e, r, i) => e + r * Math.min(Math.max(t - i * n, 0), n), 0);
|
|
10
|
+
return e[0] + r / n;
|
|
11
|
+
}
|
|
12
|
+
function u(e, t) {
|
|
13
|
+
return Math.max(0, Math.min((1 - e) * l(i.light, t), e * l(i.dark, t)));
|
|
14
|
+
}
|
|
15
|
+
var d = (e, t, n) => e * t + (1 - e) * n;
|
|
16
|
+
function f(e, t, n) {
|
|
17
|
+
let r = d(e, t.alpha, n.alpha);
|
|
18
|
+
return r === 0 ? d(e, t.value, n.value) : d(e, t.value * t.alpha, n.value * n.alpha) / r;
|
|
19
|
+
}
|
|
20
|
+
var p = (e) => "c" in e ? e : n(e);
|
|
21
|
+
function m(t, n) {
|
|
22
|
+
let i = p(t), a = p(n), o = r.mixWeight, s = f(o, {
|
|
23
|
+
value: r.lightness,
|
|
24
|
+
alpha: i.alpha
|
|
25
|
+
}, {
|
|
26
|
+
value: a.l,
|
|
27
|
+
alpha: a.alpha
|
|
28
|
+
}), c = f(o, {
|
|
29
|
+
value: i.c,
|
|
30
|
+
alpha: i.alpha
|
|
31
|
+
}, {
|
|
32
|
+
value: 0,
|
|
33
|
+
alpha: a.alpha
|
|
34
|
+
}), l = Math.min(c * r.chromaScale, u(s, i.h));
|
|
35
|
+
return e({
|
|
36
|
+
l: s,
|
|
37
|
+
c: l,
|
|
38
|
+
h: i.h,
|
|
39
|
+
alpha: d(r.mixWeight, i.alpha, a.alpha)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function h(t, n) {
|
|
43
|
+
let r = p(t), i = p(n), a = o.mixWeight;
|
|
44
|
+
return e({
|
|
45
|
+
l: f(a, {
|
|
46
|
+
value: o.lightness,
|
|
47
|
+
alpha: r.alpha
|
|
48
|
+
}, {
|
|
49
|
+
value: i.l,
|
|
50
|
+
alpha: i.alpha
|
|
51
|
+
}),
|
|
52
|
+
c: f(a, {
|
|
53
|
+
value: r.c,
|
|
54
|
+
alpha: r.alpha
|
|
55
|
+
}, {
|
|
56
|
+
value: 0,
|
|
57
|
+
alpha: i.alpha
|
|
58
|
+
}),
|
|
59
|
+
h: r.h,
|
|
60
|
+
alpha: d(o.mixWeight, r.alpha, i.alpha)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function g(e, n) {
|
|
64
|
+
return t(e, n, a.subtle);
|
|
65
|
+
}
|
|
66
|
+
function _(e, n) {
|
|
67
|
+
return t(e, n, a.text);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { g as legacyToneSubtle, _ as legacyToneText, u as toneFillChromaLimit, m as toneSubtle, h as toneText };
|