basalt-ui 2.17.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/MIGRATING.md +108 -12
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -2
- package/dist/cli/shot/capture.d.ts +12 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +72 -10
- package/dist/cli/shot/index.d.ts +10 -1
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +40 -5
- package/dist/cli/shot/real-data.d.ts +35 -0
- package/dist/cli/shot/real-data.d.ts.map +1 -0
- package/dist/cli/shot/real-data.js +120 -0
- package/dist/cli/shot/serve.d.ts +2 -2
- package/dist/cli/shot/serve.d.ts.map +1 -1
- package/dist/cli/shot/serve.js +16 -2
- package/dist/commands/notifications/center.d.ts.map +1 -1
- package/dist/commands/notifications/center.js +18 -26
- package/dist/content/callout.d.ts +1 -1
- package/dist/content/callout.d.ts.map +1 -1
- package/dist/content/callout.js +10 -1
- package/dist/content/callout.module.css +15 -3
- package/dist/content/callout.module.css.d.ts +1 -0
- package/dist/dashboard/bar-list.d.ts +29 -0
- package/dist/dashboard/bar-list.d.ts.map +1 -0
- package/dist/dashboard/bar-list.js +65 -0
- package/dist/dashboard/bar-list.module.css +91 -0
- package/dist/dashboard/bar-list.module.css.d.ts +17 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -0
- package/dist/dashboard/meter-model.d.ts +126 -0
- package/dist/dashboard/meter-model.d.ts.map +1 -0
- package/dist/dashboard/meter-model.js +135 -0
- package/dist/dashboard/meter-parts.d.ts +42 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -0
- package/dist/dashboard/meter-parts.js +297 -0
- package/dist/dashboard/meter.d.ts +123 -0
- package/dist/dashboard/meter.d.ts.map +1 -0
- package/dist/dashboard/meter.js +43 -0
- package/dist/dashboard/meter.module.css +268 -0
- package/dist/dashboard/meter.module.css.d.ts +39 -0
- package/dist/dashboard/scale.d.ts +9 -0
- package/dist/dashboard/scale.d.ts.map +1 -0
- package/dist/dashboard/scale.js +10 -0
- package/dist/dashboard/stat-card-parts.d.ts +3 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +18 -3
- package/dist/dashboard/stat-card.d.ts +6 -5
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +48 -77
- package/dist/dashboard/stat-card.module.css +27 -7
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +2 -1
- package/dist/dashboard/widget-header.module.css +28 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/theme/chrome-vars.d.ts +29 -17
- package/dist/theme/chrome-vars.d.ts.map +1 -1
- package/dist/theme/chrome-vars.js +18 -8
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +9 -5
- package/dist/theme/status-dot.d.ts +6 -0
- package/dist/theme/status-dot.d.ts.map +1 -0
- package/dist/theme/status-dot.js +9 -0
- package/dist/theme/status-dot.module.css +9 -0
- package/dist/theme/status-dot.module.css.d.ts +8 -0
- package/dist/theme/status-verdict.d.ts +9 -0
- package/dist/theme/status-verdict.d.ts.map +1 -0
- package/dist/theme/status-verdict.js +13 -0
- package/dist/theme/status-verdict.module.css +23 -0
- package/dist/theme/status-verdict.module.css.d.ts +9 -0
- package/dist/tokens/derive.d.ts +11 -1
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +9 -24
- package/dist/tokens/status-text.d.ts +26 -0
- package/dist/tokens/status-text.d.ts.map +1 -0
- package/dist/tokens/status-text.js +68 -0
- package/llms.txt +32 -3
- package/package.json +1 -1
- package/src/cli/help.ts +22 -2
- package/src/cli/shot/capture.ts +98 -9
- package/src/cli/shot/index.ts +50 -4
- package/src/cli/shot/real-data.ts +165 -0
- package/src/cli/shot/serve.ts +28 -3
- package/src/commands/notifications/center.tsx +29 -32
- package/src/content/callout.module.css +15 -3
- package/src/content/callout.module.css.d.ts +1 -0
- package/src/content/callout.tsx +15 -2
- package/src/dashboard/bar-list.module.css +91 -0
- package/src/dashboard/bar-list.module.css.d.ts +17 -0
- package/src/dashboard/bar-list.tsx +125 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +254 -0
- package/src/dashboard/meter-parts.tsx +407 -0
- package/src/dashboard/meter.module.css +268 -0
- package/src/dashboard/meter.module.css.d.ts +39 -0
- package/src/dashboard/meter.tsx +173 -0
- package/src/dashboard/scale.ts +13 -0
- package/src/dashboard/stat-card-parts.tsx +22 -2
- package/src/dashboard/stat-card.module.css +27 -7
- package/src/dashboard/stat-card.tsx +18 -52
- package/src/dashboard/widget-header.module.css +28 -1
- package/src/dashboard/widget-header.tsx +4 -1
- package/src/index.ts +4 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +88 -16
- package/src/theme/chrome-vars.ts +48 -23
- package/src/theme/index.ts +10 -6
- package/src/theme/status-dot.module.css +9 -0
- package/src/theme/status-dot.module.css.d.ts +8 -0
- package/src/theme/status-dot.tsx +19 -0
- package/src/theme/status-verdict.module.css +23 -0
- package/src/theme/status-verdict.module.css.d.ts +9 -0
- package/src/theme/status-verdict.tsx +27 -0
- package/src/tokens/derive.ts +19 -31
- package/src/tokens/status-text.ts +85 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-header.d.ts","sourceRoot":"","sources":["../../src/dashboard/widget-header.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAGjD,OAAO,KAAK,EA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Z,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;2DAGuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA2EA;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,iBAAiB,+BAmEnB"}
|
|
@@ -77,6 +77,7 @@ function InfoGlyph({
|
|
|
77
77
|
ref: triggerRef,
|
|
78
78
|
type: "button",
|
|
79
79
|
"data-basalt-hit": true,
|
|
80
|
+
"data-info-trigger": true,
|
|
80
81
|
className: classes.infoTrigger,
|
|
81
82
|
"aria-label": ariaLabel,
|
|
82
83
|
"aria-describedby": open ? tipId : void 0,
|
|
@@ -145,7 +146,7 @@ function WidgetHeader({
|
|
|
145
146
|
/* @__PURE__ */ jsxs("div", { className: classes.titleRow, children: [
|
|
146
147
|
/* @__PURE__ */ jsxs(Heading, { className: cx(classes.heading, classNames?.title), children: [
|
|
147
148
|
icon !== void 0 && /* @__PURE__ */ jsx(IconSlot, { className: cx(classes.icon, classNames?.icon), children: icon }),
|
|
148
|
-
/* @__PURE__ */ jsx("span", { className: classes.titleText, children: title })
|
|
149
|
+
/* @__PURE__ */ jsx("span", { className: classes.titleText, "data-widget-title": true, children: title })
|
|
149
150
|
] }),
|
|
150
151
|
info !== void 0 && /* @__PURE__ */ jsx(InfoGlyph, { text: info, ...subtitle !== void 0 && { note: subtitle } }),
|
|
151
152
|
info === void 0 && subtitle !== void 0 && /* @__PURE__ */ jsx(
|
|
@@ -247,12 +247,16 @@
|
|
|
247
247
|
* overlay — axe and assistive tech measure the element. The negative margin hands the extra
|
|
248
248
|
* (24 - 11) / 2 back on every side, so the glyph and the row around it keep their drawn size. */
|
|
249
249
|
.infoTrigger {
|
|
250
|
+
--basalt-info-glyph: 11px;
|
|
251
|
+
--basalt-info-ring-offset: 2px;
|
|
252
|
+
--basalt-info-ring-width: 2px;
|
|
250
253
|
display: inline-flex;
|
|
251
254
|
align-items: center;
|
|
252
255
|
justify-content: center;
|
|
253
256
|
min-width: 24px;
|
|
254
257
|
min-height: 24px;
|
|
255
|
-
margin: calc((
|
|
258
|
+
margin: calc((var(--basalt-info-glyph) - 24px) / 2);
|
|
259
|
+
position: relative;
|
|
256
260
|
appearance: none;
|
|
257
261
|
padding: 0;
|
|
258
262
|
border: none;
|
|
@@ -261,6 +265,29 @@
|
|
|
261
265
|
cursor: help;
|
|
262
266
|
}
|
|
263
267
|
|
|
268
|
+
/* The keyboard ring hugs the glyph, not the 24px hit box: drawn on the box it reached 6.5px past
|
|
269
|
+
* the glyph and painted over the title's last letter and a neighbouring status dot. The `::before`
|
|
270
|
+
* is the glyph + the offset on each side, outlined by the ring width, so the ring ends 4px from the
|
|
271
|
+
* glyph — inside the 6px control gap. (`::after` is the hit overlay's.)
|
|
272
|
+
* Forced colors: the ring is an `outline`, which the UA keeps and recolours to a system colour, so
|
|
273
|
+
* it stays visible without a `forced-colors` override. */
|
|
274
|
+
.infoTrigger:focus-visible {
|
|
275
|
+
outline: none;
|
|
276
|
+
|
|
277
|
+
&::before {
|
|
278
|
+
content: '';
|
|
279
|
+
position: absolute;
|
|
280
|
+
top: 50%;
|
|
281
|
+
left: 50%;
|
|
282
|
+
translate: -50% -50%;
|
|
283
|
+
width: calc(var(--basalt-info-glyph) + 2 * var(--basalt-info-ring-offset));
|
|
284
|
+
height: calc(var(--basalt-info-glyph) + 2 * var(--basalt-info-ring-offset));
|
|
285
|
+
border-radius: var(--vx-radius-fine);
|
|
286
|
+
outline: var(--basalt-info-ring-width) solid var(--vx-accent);
|
|
287
|
+
pointer-events: none;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
264
291
|
.infoTrigger:hover,
|
|
265
292
|
.infoTrigger:focus-visible,
|
|
266
293
|
.infoTrigger[data-open='true'] {
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { scrollParentOf, useCoarsePointer, type Tone } from './common/index.js';
|
|
|
13
13
|
export { createBasaltTheme } from './theme/index.js';
|
|
14
14
|
export { ThemeToggle } from './theme/theme-toggle.js';
|
|
15
15
|
export { BasaltShell, PageBar, PageAside, useSizeClass, PageTitle, type ShellBaseProps, type SidebarBlock, type SettingsMenuItem, } from './shell/index.js';
|
|
16
|
-
export { WidgetHeader, DeltaBadge, Section, StatCard, type StatCardBreakdownRow, type StatCardSparklineSize, StatGroup, EmptyState, SettingsSection, SettingsRow, DangerZone, } from './dashboard/index.js';
|
|
16
|
+
export { WidgetHeader, DeltaBadge, Section, StatCard, type StatCardBreakdownRow, type StatCardSparklineSize, StatGroup, EmptyState, SettingsSection, SettingsRow, DangerZone, Meter, type MeterProps, BarList, type BarListProps, } from './dashboard/index.js';
|
|
17
17
|
export { unwrap } from './unwrap.js';
|
|
18
18
|
export type { BasaltRegister, SeriesKey } from './register.js';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,E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AAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,YAAY,EACZ,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,OAAO,EACP,QAAQ,EACR,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,UAAU,EACV,KAAK,EACL,KAAK,UAAU,EACf,OAAO,EACP,KAAK,YAAY,GAClB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAMjC,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -29,15 +29,19 @@ import {
|
|
|
29
29
|
EmptyState,
|
|
30
30
|
SettingsSection,
|
|
31
31
|
SettingsRow,
|
|
32
|
-
DangerZone
|
|
32
|
+
DangerZone,
|
|
33
|
+
Meter,
|
|
34
|
+
BarList
|
|
33
35
|
} from "./dashboard/index.js";
|
|
34
36
|
import { unwrap } from "./unwrap.js";
|
|
35
37
|
export {
|
|
38
|
+
BarList,
|
|
36
39
|
BasaltProvider,
|
|
37
40
|
BasaltShell,
|
|
38
41
|
DangerZone,
|
|
39
42
|
DeltaBadge,
|
|
40
43
|
EmptyState,
|
|
44
|
+
Meter,
|
|
41
45
|
PageAside,
|
|
42
46
|
PageBar,
|
|
43
47
|
PageTitle,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Component `vars` that carry the Wave 33 chrome (`
|
|
2
|
+
* Component `vars` that carry the Wave 33 chrome (`MIGRATING.md` § Light and outline Buttons are ink, D27) and the
|
|
3
3
|
* ON-COLOR re-point they sit beside. Pure functions of theme + props, kept out of `theme/index.ts`
|
|
4
4
|
* so the tests can call them directly.
|
|
5
5
|
*/
|
|
@@ -39,32 +39,43 @@ import type { MantineTheme } from '@mantine/core';
|
|
|
39
39
|
* Stepper / Indicator / Timeline all call Mantine's `getContrastColor` directly) are re-pointed at
|
|
40
40
|
* it too, in `components` below. Regression-locked by `contrast.test.ts`.
|
|
41
41
|
*/
|
|
42
|
-
export declare function onColor(theme: MantineTheme, color: string | undefined): string | undefined;
|
|
42
|
+
export declare function onColor(theme: MantineTheme, color: string | null | undefined): string | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* The on-color for a component that bypasses the variant resolver and calls Mantine's
|
|
45
45
|
* `getContrastColor` directly. `undefined` (autoContrast off, or a hex / indexed color) leaves
|
|
46
46
|
* Mantine's own value in place — `mergeVars` strips undefined before merging.
|
|
47
47
|
*/
|
|
48
48
|
export declare function onColorFor(theme: MantineTheme, props: {
|
|
49
|
-
color?: string | undefined;
|
|
49
|
+
color?: string | null | undefined;
|
|
50
50
|
autoContrast?: boolean | undefined;
|
|
51
51
|
}): string | undefined;
|
|
52
|
-
/** The chrome opt-out: a call site that names a colour (even the primary one) keeps its hue. */
|
|
53
|
-
export declare function hasExplicitColor(color: string | undefined): boolean;
|
|
54
52
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* carries its hue as the whole signal. Mantine hands the variant resolver `color || primaryColor`,
|
|
59
|
-
* so only the component props can tell "unnamed" from "primary" — hence vars, not the resolver.
|
|
53
|
+
* The chrome opt-out: a call site that names a colour (even the primary one) keeps its hue. An
|
|
54
|
+
* empty string and `null` name nothing — Mantine reads `color || primaryColor`, so they fall back to
|
|
55
|
+
* the primary colour too.
|
|
60
56
|
*/
|
|
61
|
-
export declare function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
export declare function hasExplicitColor(color: string | null | undefined): boolean;
|
|
58
|
+
type InkVars = {
|
|
59
|
+
color?: string;
|
|
60
|
+
hover?: string;
|
|
61
|
+
bg?: string;
|
|
62
|
+
border?: string;
|
|
67
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* A `subtle`, `light` or `outline` Button / ActionIcon that names no colour is ink, not the accent
|
|
66
|
+
* (`MIGRATING.md` § Light and outline Buttons are ink, D27). `subtle`: ink label, ink-6% hover
|
|
67
|
+
* (`docs/DESIGN-SPEC.md` §5 ghost idiom). `light`: the subtle surface with an ink label, hover one
|
|
68
|
+
* ink step on top (Mantine's gray-light roles collapse bg and hover to one colour in light). `outline`:
|
|
69
|
+
* the surface border, ink label, subtle-surface hover. An explicit `color=` — the primary one
|
|
70
|
+
* included — keeps Mantine's tinted vars: `color="red"` on a destructive action carries its hue as
|
|
71
|
+
* the whole signal. Mantine hands the variant resolver `color || primaryColor`, so only the
|
|
72
|
+
* component props can tell "unnamed" from "primary" — hence vars, not the resolver. Disabled needs no
|
|
73
|
+
* gate: Mantine's disabled rule sets colour, background and border directly, not through these vars.
|
|
74
|
+
*/
|
|
75
|
+
export declare function inkVars(props: {
|
|
76
|
+
color?: string | null | undefined;
|
|
77
|
+
variant?: string | undefined;
|
|
78
|
+
}): InkVars;
|
|
68
79
|
/**
|
|
69
80
|
* Tabs vars: the on-color re-point plus the active underline in ink (SPEC § 6.12). Only the
|
|
70
81
|
* underline `default` variant takes ink (`pills` fills with the colour); an explicit `color=` opts
|
|
@@ -73,10 +84,11 @@ export declare function subtleInkVars(props: {
|
|
|
73
84
|
* varsResolver writes `--tabs-text-color` (an upstream type gap).
|
|
74
85
|
*/
|
|
75
86
|
export declare function tabsVars(theme: MantineTheme, props: {
|
|
76
|
-
color?: string | undefined;
|
|
87
|
+
color?: string | null | undefined;
|
|
77
88
|
variant?: string | undefined;
|
|
78
89
|
autoContrast?: boolean | undefined;
|
|
79
90
|
}): {
|
|
80
91
|
root: Record<'--tabs-color' | '--tabs-radius' | '--tabs-text-color', string | undefined>;
|
|
81
92
|
};
|
|
93
|
+
export {};
|
|
82
94
|
//# sourceMappingURL=chrome-vars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome-vars.d.ts","sourceRoot":"","sources":["../../src/theme/chrome-vars.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"chrome-vars.d.ts","sourceRoot":"","sources":["../../src/theme/chrome-vars.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAIjG;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,GAC/E,MAAM,GAAG,SAAS,CAGpB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE1E;AAED,KAAK,OAAO,GAAG;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAgBD;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,GAAG,OAAO,CAKV;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE;IACL,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACnC,GACA;IAAE,IAAI,EAAE,MAAM,CAAC,cAAc,GAAG,eAAe,GAAG,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CAAE,CAS9F"}
|
|
@@ -8,14 +8,24 @@ function onColorFor(theme, props) {
|
|
|
8
8
|
return autoContrast ? onColor(theme, props.color) : void 0;
|
|
9
9
|
}
|
|
10
10
|
function hasExplicitColor(color) {
|
|
11
|
-
return color !==
|
|
11
|
+
return typeof color === "string" && color !== "";
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const INK = "var(--vx-ink)";
|
|
14
|
+
const SUBTLE = "var(--vx-surface-subtle)";
|
|
15
|
+
const INK_BY_VARIANT = {
|
|
16
|
+
subtle: { color: INK, hover: "color-mix(in srgb, var(--vx-ink) 6%, transparent)" },
|
|
17
|
+
light: { color: INK, bg: SUBTLE, hover: `color-mix(in srgb, var(--vx-ink) 6%, ${SUBTLE})` },
|
|
18
|
+
outline: {
|
|
19
|
+
color: INK,
|
|
20
|
+
border: "calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)",
|
|
21
|
+
hover: SUBTLE
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
function inkVars(props) {
|
|
25
|
+
const { variant } = props;
|
|
26
|
+
if (hasExplicitColor(props.color) || variant === void 0) return {};
|
|
27
|
+
if (!Object.hasOwn(INK_BY_VARIANT, variant)) return {};
|
|
28
|
+
return INK_BY_VARIANT[variant] ?? {};
|
|
19
29
|
}
|
|
20
30
|
function tabsVars(theme, props) {
|
|
21
31
|
const underline = !hasExplicitColor(props.color) && (props.variant ?? "default") === "default";
|
|
@@ -29,8 +39,8 @@ function tabsVars(theme, props) {
|
|
|
29
39
|
}
|
|
30
40
|
export {
|
|
31
41
|
hasExplicitColor,
|
|
42
|
+
inkVars,
|
|
32
43
|
onColor,
|
|
33
44
|
onColorFor,
|
|
34
|
-
subtleInkVars,
|
|
35
45
|
tabsVars
|
|
36
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EA0CV,oBAAoB,EAGpB,oBAAoB,EAErB,MAAM,eAAe,CAAA;AAStB,OAAO,KAAK,EAAe,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAKpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAUvD;;;;;GAKG;AACH,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAIvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAMvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAenE,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,iBAAiB;QACzB,YAAY,CAAC,EAAE,YAAY,CAAA;QAC3B,WAAW,CAAC,EAAE,iBAAiB,CAAA;QAC/B,YAAY,CAAC,EAAE,YAAY,CAAA;QAC3B,aAAa,CAAC,EAAE,WAAW,CAAA;KAC5B;CACF;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[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;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAE9B;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAA;IAEzB;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAE1B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAA;CAC7B,CAAA;AAYD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,EACrD,OAAO,CAAC,EAAE,wBAAwB,GACjC,oBAAoB,CAiCtB"}
|
package/dist/theme/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { DEFAULT_DERIVE_CONFIG, isDefaultDeriveConfig, resolveDeriveConfig } fro
|
|
|
17
17
|
import { pxRem, TEXT_LINE, VX } from "../tokens/core.js";
|
|
18
18
|
import { CTL_HEIGHT_VARS } from "../tokens/ctl-vars.js";
|
|
19
19
|
import { SIZE_CLASS_BREAKPOINTS } from "../tokens/size-classes.js";
|
|
20
|
-
import { onColor, onColorFor,
|
|
20
|
+
import { onColor, onColorFor, inkVars, tabsVars } from "./chrome-vars.js";
|
|
21
21
|
import controlsClasses from "./controls.module.css";
|
|
22
22
|
import floatingClasses from "./floating.module.css";
|
|
23
23
|
import navLinkClasses from "./nav-link.module.css";
|
|
@@ -416,12 +416,14 @@ function buildTheme(data, options = {}) {
|
|
|
416
416
|
Button: ext({
|
|
417
417
|
classNames: { root: controlsClasses.buttonRoot },
|
|
418
418
|
vars: (_theme, props) => {
|
|
419
|
-
const ink =
|
|
419
|
+
const ink = inkVars(props);
|
|
420
420
|
return {
|
|
421
421
|
root: {
|
|
422
422
|
"--button-height": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
423
423
|
"--button-color": ink.color,
|
|
424
|
-
"--button-hover": ink.hover
|
|
424
|
+
"--button-hover": ink.hover,
|
|
425
|
+
"--button-bg": ink.bg,
|
|
426
|
+
"--button-bd": ink.border
|
|
425
427
|
}
|
|
426
428
|
};
|
|
427
429
|
}
|
|
@@ -429,12 +431,14 @@ function buildTheme(data, options = {}) {
|
|
|
429
431
|
ActionIcon: ext({
|
|
430
432
|
classNames: { root: controlsClasses.actionIconRoot },
|
|
431
433
|
vars: (_theme, props) => {
|
|
432
|
-
const ink =
|
|
434
|
+
const ink = inkVars(props);
|
|
433
435
|
return {
|
|
434
436
|
root: {
|
|
435
437
|
"--ai-size": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
436
438
|
"--ai-color": ink.color,
|
|
437
|
-
"--ai-hover": ink.hover
|
|
439
|
+
"--ai-hover": ink.hover,
|
|
440
|
+
"--ai-bg": ink.bg,
|
|
441
|
+
"--ai-bd": ink.border
|
|
438
442
|
}
|
|
439
443
|
};
|
|
440
444
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type StatusDotProps = {
|
|
2
|
+
/** Any CSS colour; callers pass a `VX.status.*` token so it re-resolves per scheme. */
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function StatusDot({ color }: StatusDotProps): import("react").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=status-dot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-dot.d.ts","sourceRoot":"","sources":["../../src/theme/status-dot.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,cAAc,GAAG;IAC3B,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAID,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,cAAc,+BAGlD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classes from "./status-dot.module.css";
|
|
3
|
+
function StatusDot({ color }) {
|
|
4
|
+
const style = { "--basalt-status-dot": color };
|
|
5
|
+
return /* @__PURE__ */ jsx("span", { className: classes.dot, "data-basalt-status-dot": "", "aria-hidden": "true", style });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
StatusDot
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type StatusVerdictProps = {
|
|
2
|
+
color: string;
|
|
3
|
+
/** The short visible word ("Over", "Error"). */
|
|
4
|
+
word: string;
|
|
5
|
+
/** A longer phrase for assistive tech, read in place of the word. */
|
|
6
|
+
phrase?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function StatusVerdict({ color, word, phrase }: StatusVerdictProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=status-verdict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-verdict.d.ts","sourceRoot":"","sources":["../../src/theme/status-verdict.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,kBAAkB,+BAUxE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { StatusDot } from "./status-dot.js";
|
|
3
|
+
import classes from "./status-verdict.module.css";
|
|
4
|
+
function StatusVerdict({ color, word, phrase }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs("span", { className: classes.verdict, children: [
|
|
6
|
+
/* @__PURE__ */ jsx(StatusDot, { color }),
|
|
7
|
+
/* @__PURE__ */ jsx("span", { "data-verdict-word": "", ...phrase !== void 0 && { "aria-hidden": true }, children: word }),
|
|
8
|
+
phrase !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.hidden, children: phrase })
|
|
9
|
+
] });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
StatusVerdict
|
|
13
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* A status dot plus its word: the dot carries the colour, the word is muted ink. `flex: none` keeps
|
|
2
|
+
* it whole when a neighbouring caption or title truncates. */
|
|
3
|
+
.verdict {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
flex: none;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 5px;
|
|
8
|
+
font-family: var(--basalt-font-mono);
|
|
9
|
+
font-size: var(--vx-text-micro);
|
|
10
|
+
color: var(--vx-muted);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Visually hidden, still read by assistive tech. */
|
|
14
|
+
.hidden {
|
|
15
|
+
position: absolute;
|
|
16
|
+
width: 1px;
|
|
17
|
+
height: 1px;
|
|
18
|
+
margin: -1px;
|
|
19
|
+
padding: 0;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
clip-path: inset(50%);
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
|
|
3
|
+
* signature — so dot access stays verbatim under the package's strict flags.
|
|
4
|
+
*/
|
|
5
|
+
declare const classes: {
|
|
6
|
+
readonly verdict: string
|
|
7
|
+
readonly hidden: string
|
|
8
|
+
}
|
|
9
|
+
export default classes
|
package/dist/tokens/derive.d.ts
CHANGED
|
@@ -80,9 +80,19 @@ export type DerivedPalette = {
|
|
|
80
80
|
ink: Record<InkKey, ColorPair>;
|
|
81
81
|
status: Record<StatusKey, ColorPair>;
|
|
82
82
|
};
|
|
83
|
+
/** The accepted `lightLevel` / `darkLevel` range; `deriveTokens` clamps to it. */
|
|
84
|
+
export declare const DERIVE_LEVEL_RANGE: {
|
|
85
|
+
readonly min: -5;
|
|
86
|
+
readonly max: 5;
|
|
87
|
+
};
|
|
83
88
|
/** Derive the full palette from a seed accent + neutral family + surface levels.
|
|
84
89
|
* Public level-based entry: maps the -5..5 sliders onto `DeriveParams` (vibrancy x0.72 center,
|
|
85
|
-
* surface +2 baseline) and delegates to `deriveTokensRaw`.
|
|
90
|
+
* surface +2 baseline) and delegates to `deriveTokensRaw`.
|
|
91
|
+
*
|
|
92
|
+
* `lightLevel` / `darkLevel` are clamped to {@link DERIVE_LEVEL_RANGE} (non-finite → 0).
|
|
93
|
+
* @throws Error when no status tone clears 4.5:1 on every text surface — unreachable for clamped
|
|
94
|
+
* levels (the test grid proves it); only a raw shift outside the slider range gets there.
|
|
95
|
+
*/
|
|
86
96
|
export declare function deriveTokens(config: DeriveConfig): DerivedPalette;
|
|
87
97
|
/** Derivation core over continuous params — see `DeriveParams` for the calibration contract. */
|
|
88
98
|
export declare function deriveTokensRaw(config: Pick<DeriveConfig, 'accent' | 'neutral'>, params: DeriveParams): DerivedPalette;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/tokens/derive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/tokens/derive.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;;;OAQG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;IAC/C;kGAC8F;IAC9F,UAAU,EAAE,MAAM,CAAA;IAClB;mDAC+C;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;;OAMG;IACH,gBAAgB,EA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MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;IACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;CACrC,CAAA;AAED,kFAAkF;AAClF,eAAO,MAAM,kBAAkB;;;CAA+B,CAAA;AAM9D;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CAUjE;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAC7B,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,SAAS,CAAC,EAChD,MAAM,EAAE,YAAY,GACnB,cAAc,CAgGhB"}
|
package/dist/tokens/derive.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { contrastRatio, hctToHex, hexToHct, yToTone } from "./hct.js";
|
|
2
|
+
import { deriveStatusHexes } from "./status-text.js";
|
|
2
3
|
const DEFAULT_DERIVE_CONFIG = {
|
|
3
4
|
accent: "#0077bd",
|
|
4
5
|
neutral: "zinc",
|
|
@@ -132,19 +133,17 @@ const INK_TONE = {
|
|
|
132
133
|
light: { ink: 15.16, ink2: 27.09, muted: 34.88, faint: 44.5 },
|
|
133
134
|
dark: { ink: 90.94, ink2: 88.12, muted: 84.91, faint: 66.24 }
|
|
134
135
|
};
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
bad: { light: { tone: 43.86, chroma: 54.46 }, dark: { tone: 66.5, chroma: 53.79 } }
|
|
140
|
-
};
|
|
136
|
+
const DERIVE_LEVEL_RANGE = { min: -5, max: 5 };
|
|
137
|
+
function clampLevel(level) {
|
|
138
|
+
return Number.isFinite(level) ? clamp(level, DERIVE_LEVEL_RANGE.min, DERIVE_LEVEL_RANGE.max) : 0;
|
|
139
|
+
}
|
|
141
140
|
function deriveTokens(config) {
|
|
142
141
|
assertValidAccentHex(config.accent);
|
|
143
142
|
return deriveTokensRaw(config, {
|
|
144
143
|
chromaMult: vibrancyChromaMult(config.vibrancy),
|
|
145
144
|
accentToneShift: config.accentBrightness * ACCENT_BRIGHTNESS_TONE_STEP,
|
|
146
|
-
lightSurfaceShift: SURFACE_LEVEL_TONE_STEP * config.lightLevel + SURFACE_BASELINE_TONE_SHIFT,
|
|
147
|
-
darkSurfaceShift: SURFACE_LEVEL_TONE_STEP * config.darkLevel + SURFACE_BASELINE_TONE_SHIFT
|
|
145
|
+
lightSurfaceShift: SURFACE_LEVEL_TONE_STEP * clampLevel(config.lightLevel) + SURFACE_BASELINE_TONE_SHIFT,
|
|
146
|
+
darkSurfaceShift: SURFACE_LEVEL_TONE_STEP * clampLevel(config.darkLevel) + SURFACE_BASELINE_TONE_SHIFT
|
|
148
147
|
});
|
|
149
148
|
}
|
|
150
149
|
function deriveTokensRaw(config, params) {
|
|
@@ -215,22 +214,7 @@ function deriveTokensRaw(config, params) {
|
|
|
215
214
|
dark: hctToHex({ hue: neutral.hue, chroma: neutral.chroma, tone: INK_TONE.dark[key] })
|
|
216
215
|
};
|
|
217
216
|
}
|
|
218
|
-
const status =
|
|
219
|
-
for (const key of Object.keys(STATUS_HUE)) {
|
|
220
|
-
const hue = STATUS_HUE[key];
|
|
221
|
-
status[key] = {
|
|
222
|
-
light: hctToHex({
|
|
223
|
-
hue,
|
|
224
|
-
chroma: STATUS_STOP[key].light.chroma,
|
|
225
|
-
tone: STATUS_STOP[key].light.tone
|
|
226
|
-
}),
|
|
227
|
-
dark: hctToHex({
|
|
228
|
-
hue,
|
|
229
|
-
chroma: STATUS_STOP[key].dark.chroma,
|
|
230
|
-
tone: STATUS_STOP[key].dark.tone
|
|
231
|
-
})
|
|
232
|
-
};
|
|
233
|
-
}
|
|
217
|
+
const status = deriveStatusHexes(surface);
|
|
234
218
|
return {
|
|
235
219
|
accent: { light: accentFill, dark: accentInkDark },
|
|
236
220
|
accentHover: { light: accentFillHover, dark: accentHoverDark },
|
|
@@ -245,6 +229,7 @@ function deriveTokensRaw(config, params) {
|
|
|
245
229
|
}
|
|
246
230
|
export {
|
|
247
231
|
DEFAULT_DERIVE_CONFIG,
|
|
232
|
+
DERIVE_LEVEL_RANGE,
|
|
248
233
|
deriveTokens,
|
|
249
234
|
deriveTokensRaw,
|
|
250
235
|
isDefaultDeriveConfig,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status text solver — the `--vx-status-good|warn|bad` solids are painted as TEXT (`DeltaBadge`,
|
|
3
|
+
* a toned breakdown row), so each must clear WCAG AA on every text surface of the palette it ships
|
|
4
|
+
* in. The calibrated stops below are kept unchanged when they already clear every surface (the
|
|
5
|
+
* default config); otherwise each walks along its lightness axis only — light darkens, dark
|
|
6
|
+
* lightens, hue preserved (chroma may clip at the gamut edge) — to the first tone that does.
|
|
7
|
+
*/
|
|
8
|
+
import type { ColorPair } from './core.js';
|
|
9
|
+
import type { StatusKey, SurfaceKey } from './derive.js';
|
|
10
|
+
type Side = 'light' | 'dark';
|
|
11
|
+
type Stop = {
|
|
12
|
+
readonly tone: number;
|
|
13
|
+
readonly chroma: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const STATUS_HUE: Readonly<Record<StatusKey, number>>;
|
|
16
|
+
export declare const STATUS_STOP: Readonly<Record<StatusKey, Readonly<Record<Side, Stop>>>>;
|
|
17
|
+
/** The surfaces status text is painted on — exhaustive, so a new `SurfaceKey` must pick a side. */
|
|
18
|
+
export declare const STATUS_TEXT_SURFACES: Readonly<Record<SurfaceKey, boolean>>;
|
|
19
|
+
export declare const STATUS_TEXT_CONTRAST_MIN = 4.5;
|
|
20
|
+
export declare const STATUS_TONE_STEP = 0.25;
|
|
21
|
+
/** The hex at the `step`-th tone from `stop` along the side's lightness axis (0 = the stop). */
|
|
22
|
+
export declare function statusHexAtStep(key: StatusKey, side: Side, step: number): string;
|
|
23
|
+
/** The three status solids for a derived palette's surfaces. */
|
|
24
|
+
export declare function deriveStatusHexes(surfaces: Record<SurfaceKey, ColorPair>): Record<StatusKey, ColorPair>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=status-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-text.d.ts","sourceRoot":"","sources":["../../src/tokens/status-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAGrD,KAAK,IAAI,GAAG,OAAO,GAAG,MAAM,CAAA;AAC5B,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9D,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAI1D,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAIjF,CAAA;AAED,mGAAmG;AACnG,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAStE,CAAA;AAED,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAC3C,eAAO,MAAM,gBAAgB,OAAO,CAAA;AAOpC,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQhF;AAoBD,gEAAgE;AAChE,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,GACtC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAM9B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { contrastRatio, hctToHex } from "./hct.js";
|
|
2
|
+
const STATUS_HUE = {
|
|
3
|
+
good: 151.975,
|
|
4
|
+
warn: 76.64,
|
|
5
|
+
bad: 29.905
|
|
6
|
+
};
|
|
7
|
+
const STATUS_STOP = {
|
|
8
|
+
good: { light: { tone: 45.75, chroma: 37.75 }, dark: { tone: 70.23, chroma: 53.23 } },
|
|
9
|
+
warn: { light: { tone: 46, chroma: 61.12 }, dark: { tone: 72.34, chroma: 62.55 } },
|
|
10
|
+
bad: { light: { tone: 43.86, chroma: 54.46 }, dark: { tone: 66.5, chroma: 53.79 } }
|
|
11
|
+
};
|
|
12
|
+
const STATUS_TEXT_SURFACES = {
|
|
13
|
+
bg: true,
|
|
14
|
+
panel: true,
|
|
15
|
+
panelHover: true,
|
|
16
|
+
elevated: true,
|
|
17
|
+
subtle: true,
|
|
18
|
+
field: true,
|
|
19
|
+
border: false,
|
|
20
|
+
hairline: false
|
|
21
|
+
};
|
|
22
|
+
const STATUS_TEXT_CONTRAST_MIN = 4.5;
|
|
23
|
+
const STATUS_TONE_STEP = 0.25;
|
|
24
|
+
const TEXT_SURFACE_KEYS = Object.keys(STATUS_TEXT_SURFACES).filter(
|
|
25
|
+
(key) => STATUS_TEXT_SURFACES[key]
|
|
26
|
+
);
|
|
27
|
+
const STATUS_KEYS = Object.keys(STATUS_HUE);
|
|
28
|
+
function statusHexAtStep(key, side, step) {
|
|
29
|
+
const stop = STATUS_STOP[key][side];
|
|
30
|
+
const direction = side === "light" ? -1 : 1;
|
|
31
|
+
return hctToHex({
|
|
32
|
+
hue: STATUS_HUE[key],
|
|
33
|
+
chroma: stop.chroma,
|
|
34
|
+
tone: stop.tone + direction * step * STATUS_TONE_STEP
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function clearsEverySurface(hex, side, surfaces) {
|
|
38
|
+
return TEXT_SURFACE_KEYS.every(
|
|
39
|
+
(key) => contrastRatio(hex, surfaces[key][side]) >= STATUS_TEXT_CONTRAST_MIN
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function solve(key, side, surfaces) {
|
|
43
|
+
const { tone } = STATUS_STOP[key][side];
|
|
44
|
+
const maxSteps = Math.floor((side === "light" ? tone : 100 - tone) / STATUS_TONE_STEP);
|
|
45
|
+
for (let step = 0; step <= maxSteps; step++) {
|
|
46
|
+
const hex = statusHexAtStep(key, side, step);
|
|
47
|
+
if (clearsEverySurface(hex, side, surfaces)) return hex;
|
|
48
|
+
}
|
|
49
|
+
throw new Error(
|
|
50
|
+
`status text: no ${side} ${key} tone reaches ${STATUS_TEXT_CONTRAST_MIN}:1 on every surface`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function deriveStatusHexes(surfaces) {
|
|
54
|
+
const status = {};
|
|
55
|
+
for (const key of STATUS_KEYS) {
|
|
56
|
+
status[key] = { light: solve(key, "light", surfaces), dark: solve(key, "dark", surfaces) };
|
|
57
|
+
}
|
|
58
|
+
return status;
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
STATUS_HUE,
|
|
62
|
+
STATUS_STOP,
|
|
63
|
+
STATUS_TEXT_CONTRAST_MIN,
|
|
64
|
+
STATUS_TEXT_SURFACES,
|
|
65
|
+
STATUS_TONE_STEP,
|
|
66
|
+
deriveStatusHexes,
|
|
67
|
+
statusHexAtStep
|
|
68
|
+
};
|