basalt-ui 1.4.1 → 1.6.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 +22 -0
- package/README.md +27 -2
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-tokens.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/dist/agent/stick-to-bottom.d.ts.map +1 -1
- package/dist/agent/stick-to-bottom.js +2 -1
- package/dist/agent-chat/composer.d.ts.map +1 -1
- package/dist/agent-chat/composer.js +5 -4
- package/dist/charts/kinds/Donut.js +1 -0
- package/dist/charts/theme.js +6 -6
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +8 -3
- package/dist/content/article-card.module.css +1 -1
- package/dist/content/callout.module.css +3 -3
- package/dist/content/prose.module.css +1 -1
- package/dist/content/reading-progress.module.css +2 -2
- package/dist/guard/guard-hook.js +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +22 -4
- package/dist/guard/types.d.ts +6 -0
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/shell/app-sidebar.module.css +4 -6
- package/dist/shell/sidebar-search.module.css +4 -2
- package/dist/theme/controls.module.css +162 -23
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +40 -23
- package/dist/theme/nav-link.module.css +10 -10
- package/dist/theme/timeline.module.css +3 -3
- package/dist/theme-lab/index.js +1 -1
- package/dist/tokens/index.d.ts +26 -16
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +88 -46
- package/dist/tokens/palette.d.ts +31 -0
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +31 -0
- package/dist/tokens.css +104 -51
- package/llms.txt +2 -2
- package/package.json +71 -17
- package/src/agent/stick-to-bottom.tsx +2 -1
- package/src/agent-chat/composer.tsx +6 -5
- package/src/charts/kinds/Donut.tsx +1 -1
- package/src/charts/theme.tsx +6 -6
- package/src/cli/index.ts +10 -2
- package/src/cli/tokens-css.test.ts +17 -0
- package/src/content/article-card.module.css +1 -1
- package/src/content/callout.module.css +3 -3
- package/src/content/prose.module.css +1 -1
- package/src/content/reading-progress.module.css +2 -2
- package/src/guard/check-source.test.ts +77 -0
- package/src/guard/guard-hook.ts +1 -1
- package/src/guard/index.ts +45 -7
- package/src/guard/types.ts +6 -0
- package/src/shell/app-sidebar.module.css +4 -6
- package/src/shell/sidebar-search.module.css +4 -2
- package/src/theme/contrast.test.ts +23 -5
- package/src/theme/controls.module.css +162 -23
- package/src/theme/index.ts +55 -24
- package/src/theme/nav-link.module.css +10 -10
- package/src/theme/shadow-surfaces.test.ts +72 -33
- package/src/theme/timeline.module.css +3 -3
- package/src/theme-lab/index.tsx +2 -2
- package/src/tokens/index.ts +110 -46
- package/src/tokens/palette.ts +33 -2
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Shadow-surface coverage — closes a class of bug `check-theme`'s regex scans cannot see: applying
|
|
3
3
|
* the depth token to the WRONG box.
|
|
4
4
|
*
|
|
5
|
-
* `--vx-shadow-card` (and `--vx-shadow-ctrl`) bakes a 1px ring into the shadow
|
|
5
|
+
* `--vx-shadow-card` (and `--vx-shadow-ctrl`/`--vx-shadow-raised`) bakes a 1px ring into the shadow
|
|
6
|
+
* value itself (see
|
|
6
7
|
* `tokens/palette.ts`'s `SHADOW`). THE INVARIANT: an element applying the token must carry the
|
|
7
8
|
* surface's OWN `border-radius` — the ring is drawn by the shadow's rendering box and follows THAT
|
|
8
9
|
* box's own corners, not any other element's. We shipped a bug where `box-shadow: var(--vx-shadow-
|
|
@@ -16,10 +17,16 @@
|
|
|
16
17
|
* mechanical inventory of every site that APPLIES the token would have caught it: a source-level
|
|
17
18
|
* guard can only flag a bad value, never a bad ELEMENT.
|
|
18
19
|
*
|
|
20
|
+
* `--vx-shadow-raised`'s ring is INSET rather than outset, which changes nothing about the
|
|
21
|
+
* invariant: an inset ring is still drawn by the shadow's rendering box and still follows that
|
|
22
|
+
* box's own corners, so a radius mismatch leaks the same way (nubs on the inside of the corner
|
|
23
|
+
* instead of the outside). It is registered here for exactly the same reason as the other two.
|
|
24
|
+
*
|
|
19
25
|
* This test IS that inventory: it scans basalt-ui's own source for every place that applies
|
|
20
|
-
* `--vx-shadow-card`/`--vx-shadow-ctrl` (a `box-shadow`/CSS-custom-property
|
|
21
|
-
* `*.module.css`, or a `boxShadow` object property — literal, `VX.shadowCard
|
|
22
|
-
* template-literal composite of
|
|
26
|
+
* `--vx-shadow-card`/`--vx-shadow-ctrl`/`--vx-shadow-raised` (a `box-shadow`/CSS-custom-property
|
|
27
|
+
* declaration in `*.module.css`, or a `boxShadow` object property — literal, `VX.shadowCard`/
|
|
28
|
+
* `VX.shadowCtrl`/`VX.shadowRaised`, or a template-literal composite of any — in `*.ts`/`*.tsx`)
|
|
29
|
+
* and asserts every one is registered in
|
|
23
30
|
* `SHADOW_SURFACES` below with a written `roundedBy` reason naming exactly where that box's
|
|
24
31
|
* `border-radius` comes from. Mere mentions in comments/docstrings and the token DEFINITION itself
|
|
25
32
|
* (`tokens/index.ts`, `tokens/palette.ts`) are excluded — this test only cares about APPLICATION.
|
|
@@ -34,8 +41,12 @@
|
|
|
34
41
|
* so plainly; a square ring on a square surface is correct, not a gap.
|
|
35
42
|
*
|
|
36
43
|
* THIS TEST IS DELIBERATELY COUPLED TO OUR OWN SOURCE. Adding a new `box-shadow: var(--vx-shadow-
|
|
37
|
-
* card)` (or `-ctrl`) anywhere SHOULD fail this test until it's registered — that failure
|
|
38
|
-
* point.
|
|
44
|
+
* card)` (or `-ctrl`/`-raised`) anywhere SHOULD fail this test until it's registered — that failure
|
|
45
|
+
* IS the point. A NEW depth token is the one case the scan cannot fail loudly on: the two regexes
|
|
46
|
+
* below name their tokens explicitly, so an unlisted `--vx-shadow-*` slips through silently and
|
|
47
|
+
* vacuously. Adding a token to `SHADOW` therefore means adding it to BOTH regexes in the same
|
|
48
|
+
* commit — `raised` is the precedent.
|
|
49
|
+
* Do NOT "fix" a future failure by loosening the scan or bulk-registering with a placeholder
|
|
39
50
|
* reason; open the file, find the element the shadow is declared on, prove (or fix) that IT carries
|
|
40
51
|
* the surface's own border-radius, and write down where that radius comes from.
|
|
41
52
|
*
|
|
@@ -95,7 +106,7 @@ function stripTsComments(text: string): string {
|
|
|
95
106
|
// bare mention of `--vx-shadow-card` in a comment never matches — comments are stripped first, and
|
|
96
107
|
// this requires an actual `property:` declaration.
|
|
97
108
|
const CSS_SHADOW_TOKEN =
|
|
98
|
-
/(?<![\w-])(?:box-shadow|--[\w-]+)\s*:\s*[^;]*var\(--vx-shadow-(?:card|ctrl)\)/
|
|
109
|
+
/(?<![\w-])(?:box-shadow|--[\w-]+)\s*:\s*[^;]*var\(--vx-shadow-(?:card|ctrl|raised)\)/
|
|
99
110
|
|
|
100
111
|
// A real application in TS/TSX: a `boxShadow` object property whose value is the literal CSS var
|
|
101
112
|
// string, `VX.shadowCard`/`VX.shadowCtrl`, or a template literal compositing either (e.g. the
|
|
@@ -103,7 +114,7 @@ const CSS_SHADOW_TOKEN =
|
|
|
103
114
|
// `--vx-shadow-overlay` (a different, unrelated token) or a `boxShadow` string literal that doesn't
|
|
104
115
|
// reference either token (data-table's scroll-shadow, guard/index.ts's own regex source, etc.).
|
|
105
116
|
const TS_SHADOW_TOKEN =
|
|
106
|
-
/\bboxShadow\s*:\s*(?:'[^']*var\(--vx-shadow-(?:card|ctrl)\)[^']*'|`[^`]*(?:var\(--vx-shadow-(?:card|ctrl)\)|VX\.shadow(?:Card|Ctrl))[^`]*`|VX\.shadow(?:Card|Ctrl))/
|
|
117
|
+
/\bboxShadow\s*:\s*(?:'[^']*var\(--vx-shadow-(?:card|ctrl|raised)\)[^']*'|`[^`]*(?:var\(--vx-shadow-(?:card|ctrl|raised)\)|VX\.shadow(?:Card|Ctrl|Raised))[^`]*`|VX\.shadow(?:Card|Ctrl|Raised))/
|
|
107
118
|
|
|
108
119
|
type ShadowSite = {
|
|
109
120
|
/** Path relative to `src/`, e.g. `theme/controls.module.css`. */
|
|
@@ -116,8 +127,13 @@ type ShadowSite = {
|
|
|
116
127
|
|
|
117
128
|
/** Every rule in a CSS module whose declarations apply the token, keyed by the rule's own selector
|
|
118
129
|
* (multi-line selectors are collapsed to one line). Assumes flat, non-nested CSS (no native
|
|
119
|
-
* nesting)
|
|
120
|
-
*
|
|
130
|
+
* nesting). A rule nested one level inside an at-rule IS still found — the brace-pair regex matches
|
|
131
|
+
* INNERMOST pairs, so `@media (hover: hover) { .x:hover { … } }` resolves as the inner `.x:hover`
|
|
132
|
+
* rule. (No such site exists today — depth is static — but the scan must keep finding one if a
|
|
133
|
+
* future state-scoped depth rule lands inside an at-rule.) What the
|
|
134
|
+
* naive scan does NOT do is carry the at-rule condition into the site label: such a site registers
|
|
135
|
+
* under its bare inner selector, with the `@media` context stated in its `roundedBy` reason
|
|
136
|
+
* instead. That is a labeling limitation, never a coverage one. */
|
|
121
137
|
function cssShadowSites(relPath: string, text: string): ShadowSite[] {
|
|
122
138
|
const clean = stripCssComments(text)
|
|
123
139
|
const sites: ShadowSite[] = []
|
|
@@ -173,7 +189,7 @@ function tsShadowSites(relPath: string, text: string): ShadowSite[] {
|
|
|
173
189
|
return sites
|
|
174
190
|
}
|
|
175
191
|
|
|
176
|
-
/** Every application of `--vx-shadow-card`/`--vx-shadow-ctrl` across `src/**`. */
|
|
192
|
+
/** Every application of `--vx-shadow-card`/`--vx-shadow-ctrl`/`--vx-shadow-raised` across `src/**`. */
|
|
177
193
|
function scanShadowSites(): ShadowSite[] {
|
|
178
194
|
const files: string[] = []
|
|
179
195
|
collectSourceFiles(SRC_DIR, files)
|
|
@@ -221,21 +237,55 @@ export const SHADOW_SURFACES: readonly ShadowSurfaceEntry[] = [
|
|
|
221
237
|
'<input> element itself — the custom property inherits from wrapper to input, landing on the ' +
|
|
222
238
|
'exact element the shadow lands on).',
|
|
223
239
|
},
|
|
240
|
+
// The five Button/ActionIcon entries below all resolve their radius the same way, and all set the
|
|
241
|
+
// token on `--ctrl-depth` rather than on `box-shadow` directly — the single `box-shadow:
|
|
242
|
+
// var(--ctrl-depth)` declaration lives on the shared `.buttonRoot, .actionIconRoot` base rule
|
|
243
|
+
// (which is therefore NOT a token-application site itself and correctly goes unregistered). The
|
|
244
|
+
// indirection changes nothing about this invariant: the variable is consumed on the very same
|
|
245
|
+
// element these selectors target, so the ring is still drawn by a box carrying the control's own
|
|
246
|
+
// `--button-radius`/`--ai-radius`.
|
|
224
247
|
{
|
|
225
248
|
file: 'theme/controls.module.css',
|
|
226
|
-
site:
|
|
249
|
+
site:
|
|
250
|
+
".buttonRoot[data-variant='default'], .buttonRoot[data-variant='filled'], " +
|
|
251
|
+
".buttonRoot[data-variant='light']",
|
|
227
252
|
roundedBy:
|
|
228
253
|
"--button-radius (Mantine's own Button.css declares `border-radius: var(--button-radius, " +
|
|
229
254
|
'var(--mantine-radius-default))` directly on the button root — the same element `.buttonRoot` ' +
|
|
230
|
-
'targets).'
|
|
255
|
+
'targets). This is the raised family on the shared `shadow-raised`, and its ring is INSET — a ' +
|
|
256
|
+
'radius mismatch would leak nubs on the INSIDE of each corner rather than the outside, so the ' +
|
|
257
|
+
'invariant bites exactly as hard here as on an outset ring.',
|
|
231
258
|
},
|
|
232
259
|
{
|
|
233
260
|
file: 'theme/controls.module.css',
|
|
234
|
-
site: ".
|
|
261
|
+
site: ".buttonRoot[data-variant='outline']",
|
|
262
|
+
roundedBy:
|
|
263
|
+
'--button-radius (same chain as the raised-family entry above — Button.css declares ' +
|
|
264
|
+
'`border-radius: var(--button-radius, var(--mantine-radius-default))` on the button root; the ' +
|
|
265
|
+
'variant changes only which depth token lands, never which element carries it). `outline` is ' +
|
|
266
|
+
'the one raised variant on ring-FREE `shadow-ctrl`, because its real 1px accent border already ' +
|
|
267
|
+
'IS its edge and an inset ring tucked just inside a border is muddy — so no ring is at risk ' +
|
|
268
|
+
'here at all, and the registration exists to keep the inventory exhaustive.',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
file: 'theme/controls.module.css',
|
|
272
|
+
site:
|
|
273
|
+
".actionIconRoot[data-variant='default'], .actionIconRoot[data-variant='filled'], " +
|
|
274
|
+
".actionIconRoot[data-variant='light']",
|
|
235
275
|
roundedBy:
|
|
236
276
|
"--ai-radius (Mantine's own ActionIcon.css declares `border-radius: var(--ai-radius, " +
|
|
237
277
|
'var(--mantine-radius-default))` directly on the root — the same element `.actionIconRoot` ' +
|
|
238
|
-
'targets).',
|
|
278
|
+
'targets). Same inset-ring reasoning as the Button raised-family entry above.',
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
file: 'theme/controls.module.css',
|
|
282
|
+
site: ".actionIconRoot[data-variant='outline']",
|
|
283
|
+
roundedBy:
|
|
284
|
+
'--ai-radius (same chain as the entry above — ActionIcon.css declares `border-radius: ' +
|
|
285
|
+
'var(--ai-radius, var(--mantine-radius-default))` on the root). Ring-free `shadow-ctrl`, same ' +
|
|
286
|
+
"reason as Button's `outline`. ActionIcon has no `subtle` counterpart to Button's " +
|
|
287
|
+
"hover-materialized entry by design: its `subtle` IS the spec's separate ghost-icon-button " +
|
|
288
|
+
'idiom (DESIGN-SPEC §5), whose hover state is an ink tint, not a raise.',
|
|
239
289
|
},
|
|
240
290
|
{
|
|
241
291
|
file: 'theme/controls.module.css',
|
|
@@ -251,17 +301,8 @@ export const SHADOW_SURFACES: readonly ShadowSurfaceEntry[] = [
|
|
|
251
301
|
"--chip-radius (Mantine's own Chip.css declares `border-radius: var(--chip-radius, 1000rem)` " +
|
|
252
302
|
'directly on the label part — the same element `.chipLabel` targets).',
|
|
253
303
|
},
|
|
254
|
-
//
|
|
255
|
-
|
|
256
|
-
file: 'theme/nav-link.module.css',
|
|
257
|
-
site: ".root[data-active], .root[aria-current='page']",
|
|
258
|
-
roundedBy:
|
|
259
|
-
"borderRadius: 6 (theme/index.ts's NavLink.extend styles.root — Mantine renders this as an " +
|
|
260
|
-
'inline style on the root part, wired via `classNames: { root: navLinkClasses.root }` to the ' +
|
|
261
|
-
"exact `.root` element this rule's box-shadow lands on). Verified NOT a square surface: " +
|
|
262
|
-
"Mantine's own NavLink.css declares no border-radius at all for .root — the 6px comes only " +
|
|
263
|
-
'from our own theme override.',
|
|
264
|
-
},
|
|
304
|
+
// theme/nav-link.module.css applies no shadow token: the active nav row is a selected row (ink
|
|
305
|
+
// tint), never a raised control — see that file's header comment.
|
|
265
306
|
// ── shell/app-mobile-nav.module.css ──────────────────────────────────────────────────────────
|
|
266
307
|
{
|
|
267
308
|
file: 'shell/app-mobile-nav.module.css',
|
|
@@ -326,11 +367,9 @@ export const SHADOW_SURFACES: readonly ShadowSurfaceEntry[] = [
|
|
|
326
367
|
roundedBy: 'borderRadius: 8 (co-declared in the same TOOLTIP_STYLES object).',
|
|
327
368
|
},
|
|
328
369
|
// ── agent-chat ───────────────────────────────────────────────────────────────────────────────
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
roundedBy: 'borderRadius: 8 (co-declared in the same styles.input object).',
|
|
333
|
-
},
|
|
370
|
+
// agent-chat/composer.tsx applies no shadow token of its own: it takes the themed `.input` depth
|
|
371
|
+
// (theme/controls.module.css) so it also inherits that class's disabled grounding — an inline
|
|
372
|
+
// `boxShadow` in its `styles` object used to beat the class and leave a disabled composer raised.
|
|
334
373
|
{
|
|
335
374
|
file: 'agent-chat/thread-outcome-card.tsx',
|
|
336
375
|
site: 'default',
|
|
@@ -380,7 +419,7 @@ describe('SHADOW_SURFACES is well-formed', () => {
|
|
|
380
419
|
})
|
|
381
420
|
})
|
|
382
421
|
|
|
383
|
-
describe('every applied --vx-shadow-card /
|
|
422
|
+
describe('every applied --vx-shadow-card / -ctrl / -raised site is registered', () => {
|
|
384
423
|
// The coverage assertion below is `expect(gaps).toEqual([])`, which passes VACUOUSLY if the scan
|
|
385
424
|
// finds nothing. That is exactly the failure mode `border-coverage.test.ts` already had to guard
|
|
386
425
|
// against once — this is the same tripwire: fail loudly here if the scan stops resolving real
|
|
@@ -408,7 +447,7 @@ describe('every applied --vx-shadow-card / --vx-shadow-ctrl site is registered',
|
|
|
408
447
|
.filter((site) => !registered.has(siteKey(site)))
|
|
409
448
|
.map(
|
|
410
449
|
(site) =>
|
|
411
|
-
`${site.file} (${site.site}): applies --vx-shadow-card
|
|
450
|
+
`${site.file} (${site.site}): applies --vx-shadow-card/-ctrl/-raised but has no ` +
|
|
412
451
|
'entry in SHADOW_SURFACES (src/theme/shadow-surfaces.test.ts). The ring baked into the ' +
|
|
413
452
|
"token follows THIS box's own border-radius — find where this box's radius comes from " +
|
|
414
453
|
'(a co-declared border-radius, or a Mantine CSS var/prop, verified against the shipped ' +
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* whether the bullet carries child content (Mantine's own `[data-active]` rule only fills solid
|
|
24
24
|
* when a bullet child is present; a plain dot would otherwise render a white fill). */
|
|
25
25
|
.itemBullet[data-active] {
|
|
26
|
-
background-color: var(--vx-
|
|
27
|
-
border-color: var(--vx-
|
|
28
|
-
color: var(--vx-
|
|
26
|
+
background-color: var(--vx-accent-fill);
|
|
27
|
+
border-color: var(--vx-accent-fill);
|
|
28
|
+
color: var(--vx-on-accent);
|
|
29
29
|
}
|
package/src/theme-lab/index.tsx
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* a refresh.
|
|
9
9
|
*
|
|
10
10
|
* The chrome follows because `theme/index.ts` bridges Mantine's surface vars AND its primary-color
|
|
11
|
-
* vars onto these same tokens — retuning `--vx-
|
|
11
|
+
* vars onto these same tokens — retuning `--vx-accent-fill` restyles every Button/Switch/Checkbox
|
|
12
12
|
* live. (It did NOT before: the accent was dual-sourced, so the lab moved the charts and left the
|
|
13
13
|
* chrome alone.) Known limit: only the PRIMARY Mantine color is bridged. A `color="red"` filled
|
|
14
14
|
* badge still reads Mantine's JS ramp and will not follow a lab override.
|
|
@@ -87,7 +87,7 @@ export const COLOR_GROUPS: ColorGroup[] = [
|
|
|
87
87
|
items: [
|
|
88
88
|
{ var: '--vx-line', label: 'Line' },
|
|
89
89
|
{ var: '--vx-line2', label: 'Line 2' },
|
|
90
|
-
{ var: '--vx-
|
|
90
|
+
{ var: '--vx-dot-stroke', label: 'Dot stroke' },
|
|
91
91
|
],
|
|
92
92
|
},
|
|
93
93
|
{
|
package/src/tokens/index.ts
CHANGED
|
@@ -141,17 +141,17 @@ export const VX = {
|
|
|
141
141
|
|
|
142
142
|
// Semantic fills — consistent opacity across all charts
|
|
143
143
|
good: 'var(--vx-good)',
|
|
144
|
-
goodSoft: 'var(--vx-
|
|
144
|
+
goodSoft: 'var(--vx-good-soft)',
|
|
145
145
|
bad: 'var(--vx-bad)',
|
|
146
146
|
warn: 'var(--vx-warn)',
|
|
147
|
-
goodSolid: 'var(--vx-
|
|
148
|
-
badSolid: 'var(--vx-
|
|
149
|
-
warnSolid: 'var(--vx-
|
|
147
|
+
goodSolid: 'var(--vx-good-solid)',
|
|
148
|
+
badSolid: 'var(--vx-bad-solid)',
|
|
149
|
+
warnSolid: 'var(--vx-warn-solid)',
|
|
150
150
|
|
|
151
151
|
// Reference/dashed lines for thresholds
|
|
152
|
-
goodRef: 'var(--vx-
|
|
153
|
-
badRef: 'var(--vx-
|
|
154
|
-
warnRef: 'var(--vx-
|
|
152
|
+
goodRef: 'var(--vx-good-ref)',
|
|
153
|
+
badRef: 'var(--vx-bad-ref)',
|
|
154
|
+
warnRef: 'var(--vx-warn-ref)',
|
|
155
155
|
|
|
156
156
|
// Neutral primary line/text color — the default for single-series, no-signal marks
|
|
157
157
|
// ("white/gray per theme"). Same value as the NEUTRAL.line pair.
|
|
@@ -161,19 +161,19 @@ export const VX = {
|
|
|
161
161
|
// Axis label + axis stroke colors (theme-aware). Exposed as flat refs so a bespoke chart that
|
|
162
162
|
// renders raw <text> labels or axis lines (without the Axis* primitives) needs no hook.
|
|
163
163
|
axis: 'var(--vx-axis)',
|
|
164
|
-
axisStroke: 'var(--vx-
|
|
164
|
+
axisStroke: 'var(--vx-axis-stroke)',
|
|
165
165
|
|
|
166
166
|
// Grid, hover, legend
|
|
167
167
|
grid: 'var(--vx-grid)',
|
|
168
168
|
crosshair: 'var(--vx-crosshair)',
|
|
169
|
-
dotStroke: 'var(--vx-
|
|
170
|
-
legendText: 'var(--vx-
|
|
169
|
+
dotStroke: 'var(--vx-dot-stroke)',
|
|
170
|
+
legendText: 'var(--vx-legend-text)',
|
|
171
171
|
|
|
172
172
|
// Tooltip chrome — muted (secondary) text inside a bespoke tooltip. The other tooltip vars
|
|
173
173
|
// (bg/text/border/shadow) are only exposed via `useVxTheme()` (see `charts/theme.tsx`); this
|
|
174
174
|
// one is flattened onto `VX` too because bespoke-tooltip authors reached for `VX.muted` (the
|
|
175
175
|
// general ink-ramp muted) instead and got the wrong token — same pattern as `VX.muted` below.
|
|
176
|
-
tooltipMuted: 'var(--vx-
|
|
176
|
+
tooltipMuted: 'var(--vx-tooltip-muted)',
|
|
177
177
|
|
|
178
178
|
// Base neutral for hairlines / muted text / overlays — apply opacity via alpha()
|
|
179
179
|
neutral: 'var(--vx-neutral)',
|
|
@@ -187,14 +187,14 @@ export const VX = {
|
|
|
187
187
|
// The accent as INK — primary series, active-nav icon, links, focus rings. Read against the PAGE,
|
|
188
188
|
// so it inverts across schemes (light on dark, deep on light).
|
|
189
189
|
accent: 'var(--vx-accent)',
|
|
190
|
-
accentHover: 'var(--vx-
|
|
190
|
+
accentHover: 'var(--vx-accent-hover)',
|
|
191
191
|
// The accent as SURFACE — a filled control that carries a label. Squeezed between white-text
|
|
192
192
|
// contrast and page contrast, so it is the same hex in both schemes (see ACCENT in palette.ts).
|
|
193
193
|
// Mantine's `--mantine-color-<primary>-filled` is bridged onto this, so it drives ALL filled
|
|
194
194
|
// chrome; a raw `--vx-accent` fill would be unreadable on dark. Fills use THIS, never `accent`.
|
|
195
|
-
accentFill: 'var(--vx-
|
|
196
|
-
accentFillHover: 'var(--vx-
|
|
197
|
-
onAccent: 'var(--vx-
|
|
195
|
+
accentFill: 'var(--vx-accent-fill)',
|
|
196
|
+
accentFillHover: 'var(--vx-accent-fill-hover)',
|
|
197
|
+
onAccent: 'var(--vx-on-accent)',
|
|
198
198
|
|
|
199
199
|
// Layout separators (header bottom rule, sidebar child indent) — distinct from `surface.border`.
|
|
200
200
|
divider: 'var(--vx-divider)',
|
|
@@ -202,6 +202,9 @@ export const VX = {
|
|
|
202
202
|
// Depth shadows — a whisper shadow + a 1px ring baked into the value (never a `border` prop).
|
|
203
203
|
shadowCard: 'var(--vx-shadow-card)',
|
|
204
204
|
shadowCtrl: 'var(--vx-shadow-ctrl)',
|
|
205
|
+
// Raised interactive controls — drop + a 1px INSET edge, the one depth every raised Button/
|
|
206
|
+
// ActionIcon variant shares (works over a fill, a tint or a panel alike; see SHADOW.raised).
|
|
207
|
+
shadowRaised: 'var(--vx-shadow-raised)',
|
|
205
208
|
// Floating-layer elevation (menus, popovers, tooltips, modals, drawers) — a real drop shadow.
|
|
206
209
|
shadowOverlay: 'var(--vx-shadow-overlay)',
|
|
207
210
|
|
|
@@ -209,7 +212,7 @@ export const VX = {
|
|
|
209
212
|
surface: {
|
|
210
213
|
bg: 'var(--vx-surface-bg)',
|
|
211
214
|
panel: 'var(--vx-surface-panel)',
|
|
212
|
-
panelHover: 'var(--vx-surface-
|
|
215
|
+
panelHover: 'var(--vx-surface-panel-hover)',
|
|
213
216
|
elevated: 'var(--vx-surface-elevated)',
|
|
214
217
|
subtle: 'var(--vx-surface-subtle)',
|
|
215
218
|
overlay: 'var(--vx-surface-overlay)', // floating layer (menus, popovers, modals, drawers)
|
|
@@ -262,52 +265,82 @@ const groupSide = (prefix: string, map: SeriesMap, side: Side): string =>
|
|
|
262
265
|
.map(([key, pair]) => decl(`${prefix}${key}`, pair[side]))
|
|
263
266
|
.join('\n')
|
|
264
267
|
|
|
268
|
+
/**
|
|
269
|
+
* The 16 deprecated camelCase aliases for `frameworkPrimitives`' per-scheme canonicals, each
|
|
270
|
+
* defined as `var(--vx-<canonical-kebab-name>)` so it can never drift from the value above it.
|
|
271
|
+
* Emitted as its own commented, trailing group (never interleaved with the canonicals) — gated by
|
|
272
|
+
* {@link BuildPaletteOpts.legacyAliases}, default on. See that option's doc for the migration
|
|
273
|
+
* rationale (1.4.0 kebab-case normalization).
|
|
274
|
+
*/
|
|
275
|
+
function frameworkPrimitivesAliases(): string {
|
|
276
|
+
return [
|
|
277
|
+
' /* Deprecated camelCase aliases — removed in a future minor; migrate to the kebab names above. */',
|
|
278
|
+
decl('goodSolid', 'var(--vx-good-solid)'),
|
|
279
|
+
decl('badSolid', 'var(--vx-bad-solid)'),
|
|
280
|
+
decl('warnSolid', 'var(--vx-warn-solid)'),
|
|
281
|
+
decl('axisStroke', 'var(--vx-axis-stroke)'),
|
|
282
|
+
decl('dotStroke', 'var(--vx-dot-stroke)'),
|
|
283
|
+
decl('tooltipBg', 'var(--vx-tooltip-bg)'),
|
|
284
|
+
decl('tooltipText', 'var(--vx-tooltip-text)'),
|
|
285
|
+
decl('tooltipMuted', 'var(--vx-tooltip-muted)'),
|
|
286
|
+
decl('tooltipBorder', 'var(--vx-tooltip-border)'),
|
|
287
|
+
decl('tooltipShadow', 'var(--vx-tooltip-shadow)'),
|
|
288
|
+
decl('legendText', 'var(--vx-legend-text)'),
|
|
289
|
+
decl('accentHover', 'var(--vx-accent-hover)'),
|
|
290
|
+
decl('accentFill', 'var(--vx-accent-fill)'),
|
|
291
|
+
decl('accentFillHover', 'var(--vx-accent-fill-hover)'),
|
|
292
|
+
decl('onAccent', 'var(--vx-on-accent)'),
|
|
293
|
+
decl('surface-panelHover', 'var(--vx-surface-panel-hover)'),
|
|
294
|
+
].join('\n')
|
|
295
|
+
}
|
|
296
|
+
|
|
265
297
|
/**
|
|
266
298
|
* Built-in framework primitives for a given scheme side — STATUS group, semantic solids,
|
|
267
299
|
* neutral line/axis/grid/tooltip chrome, legend text, and the surface ramp. Domain series
|
|
268
300
|
* (SERIES/ACTIVITY/USAGE) are NOT shipped — apps append them via `opts.groups`.
|
|
269
301
|
*/
|
|
270
|
-
function frameworkPrimitives(side: Side, data: PaletteData): string {
|
|
302
|
+
function frameworkPrimitives(side: Side, data: PaletteData, legacyAliases: boolean): string {
|
|
271
303
|
const n = data.NEUTRAL
|
|
272
304
|
const s = data.SEMANTIC
|
|
273
305
|
const su = data.SURFACE
|
|
274
306
|
const ink = data.INK
|
|
275
307
|
const ac = data.ACCENT
|
|
276
|
-
|
|
308
|
+
const canonical = [
|
|
277
309
|
groupSide('status-', data.STATUS as SeriesMap, side),
|
|
278
|
-
decl('
|
|
279
|
-
decl('
|
|
280
|
-
decl('
|
|
310
|
+
decl('good-solid', s.good[side]),
|
|
311
|
+
decl('bad-solid', s.bad[side]),
|
|
312
|
+
decl('warn-solid', s.warn[side]),
|
|
281
313
|
decl('neutral', n.neutral[side]),
|
|
282
314
|
decl('line', n.line[side]),
|
|
283
315
|
decl('line2', n.line2[side]),
|
|
284
316
|
decl('axis', n.axis[side]),
|
|
285
|
-
decl('
|
|
317
|
+
decl('axis-stroke', n.axisStroke[side]),
|
|
286
318
|
decl('grid', n.grid[side]),
|
|
287
319
|
decl('crosshair', n.crosshair[side]),
|
|
288
|
-
decl('
|
|
289
|
-
decl('
|
|
290
|
-
decl('
|
|
291
|
-
decl('
|
|
292
|
-
decl('
|
|
293
|
-
decl('
|
|
294
|
-
decl('
|
|
320
|
+
decl('dot-stroke', n.dotStroke[side]),
|
|
321
|
+
decl('tooltip-bg', n.tooltipBg[side]),
|
|
322
|
+
decl('tooltip-text', n.tooltipText[side]),
|
|
323
|
+
decl('tooltip-muted', n.tooltipMuted[side]),
|
|
324
|
+
decl('tooltip-border', n.tooltipBorder[side]),
|
|
325
|
+
decl('tooltip-shadow', n.tooltipShadow[side]),
|
|
326
|
+
decl('legend-text', n.legendText[side]),
|
|
295
327
|
decl('ink', ink.ink[side]),
|
|
296
328
|
decl('ink2', ink.ink2[side]),
|
|
297
329
|
decl('muted', ink.muted[side]),
|
|
298
330
|
decl('faint', ink.faint[side]),
|
|
299
331
|
decl('accent', ac.accent[side]),
|
|
300
|
-
decl('
|
|
301
|
-
decl('
|
|
302
|
-
decl('
|
|
303
|
-
decl('
|
|
332
|
+
decl('accent-hover', ac.accentHover[side]),
|
|
333
|
+
decl('accent-fill', ac.accentFill[side]),
|
|
334
|
+
decl('accent-fill-hover', ac.accentFillHover[side]),
|
|
335
|
+
decl('on-accent', ac.onAccent[side]),
|
|
304
336
|
decl('divider', su.divider[side]),
|
|
305
337
|
decl('shadow-card', SHADOW.card[side]),
|
|
306
338
|
decl('shadow-ctrl', SHADOW.ctrl[side]),
|
|
339
|
+
decl('shadow-raised', SHADOW.raised[side]),
|
|
307
340
|
decl('shadow-overlay', SHADOW.overlay[side]),
|
|
308
341
|
decl('surface-bg', su.bg[side]),
|
|
309
342
|
decl('surface-panel', su.panel[side]),
|
|
310
|
-
decl('surface-
|
|
343
|
+
decl('surface-panel-hover', su.panelHover[side]),
|
|
311
344
|
decl('surface-elevated', su.elevated[side]),
|
|
312
345
|
decl('surface-subtle', su.subtle[side]),
|
|
313
346
|
decl('surface-overlay', su.overlay[side]),
|
|
@@ -315,6 +348,7 @@ function frameworkPrimitives(side: Side, data: PaletteData): string {
|
|
|
315
348
|
decl('surface-border', su.border[side]),
|
|
316
349
|
decl('surface-hairline', su.hairline[side]),
|
|
317
350
|
].join('\n')
|
|
351
|
+
return legacyAliases ? `${canonical}\n${frameworkPrimitivesAliases()}` : canonical
|
|
318
352
|
}
|
|
319
353
|
|
|
320
354
|
/**
|
|
@@ -520,15 +554,34 @@ const DEFAULT_SPACE_VALUES: SpaceValues = {
|
|
|
520
554
|
rowLineHeight: ROW_LINE_HEIGHT,
|
|
521
555
|
}
|
|
522
556
|
|
|
557
|
+
/**
|
|
558
|
+
* The 16 deprecated camelCase aliases for `frameworkDerived`'s theme-independent (`:root`)
|
|
559
|
+
* canonicals — the 12 `fill-hover-<family>` fills plus `good-soft`/`good-ref`/`bad-ref`/`warn-ref`.
|
|
560
|
+
* Each is a `var(--vx-<canonical-kebab-name>)` ref so it can never drift. Emitted as its own
|
|
561
|
+
* commented, trailing group — gated by {@link BuildPaletteOpts.legacyAliases}, default on.
|
|
562
|
+
*/
|
|
563
|
+
function frameworkDerivedAliases(data: PaletteData): string {
|
|
564
|
+
return [
|
|
565
|
+
' /* Deprecated camelCase aliases — removed in a future minor; migrate to the kebab names above. */',
|
|
566
|
+
...Object.keys(data.FILL).map((name) =>
|
|
567
|
+
decl(`fillHover-${name}`, `var(--vx-fill-hover-${name})`),
|
|
568
|
+
),
|
|
569
|
+
decl('goodSoft', 'var(--vx-good-soft)'),
|
|
570
|
+
decl('goodRef', 'var(--vx-good-ref)'),
|
|
571
|
+
decl('badRef', 'var(--vx-bad-ref)'),
|
|
572
|
+
decl('warnRef', 'var(--vx-warn-ref)'),
|
|
573
|
+
].join('\n')
|
|
574
|
+
}
|
|
575
|
+
|
|
523
576
|
/**
|
|
524
577
|
* Theme-independent scalars + semantic fills, defined once on `:root`.
|
|
525
578
|
*
|
|
526
579
|
* Area-gradient strength is a global knob (the theme lab overrides these two on `:root`
|
|
527
580
|
* to retune every line-area fill live). 0%/0% disables gradients app-wide.
|
|
528
581
|
*/
|
|
529
|
-
function frameworkDerived(data: PaletteData, only: 'core' | 'all'): string {
|
|
582
|
+
function frameworkDerived(data: PaletteData, only: 'core' | 'all', legacyAliases: boolean): string {
|
|
530
583
|
const space = spaceDecls(DEFAULT_SPACE_VALUES)
|
|
531
|
-
|
|
584
|
+
const canonical = [
|
|
532
585
|
decl('radius-card', `${RADIUS.card}px`),
|
|
533
586
|
decl('radius-ctrl', `${RADIUS.ctrl}px`),
|
|
534
587
|
// The two offset tiers (SegmentedControl indicator/Kbd/Code, Progress/scale-sm) — added so a
|
|
@@ -553,21 +606,22 @@ function frameworkDerived(data: PaletteData, only: 'core' | 'all'): string {
|
|
|
553
606
|
// hover along instead of leaving a stale pair. 88% of the fill over black lands ~0.128 luminance:
|
|
554
607
|
// a visible press-darkening that still clears AA for the white label (~5.9:1).
|
|
555
608
|
...Object.keys(data.FILL).map((name) =>
|
|
556
|
-
decl(`
|
|
609
|
+
decl(`fill-hover-${name}`, `color-mix(in srgb, var(--vx-fill-${name}) 88%, #000)`),
|
|
557
610
|
),
|
|
558
611
|
// The type scale, emitted from the SAME `TEXT` object `VX.text` reads — CSS modules and the
|
|
559
612
|
// Mantine theme consume these; inline styles / visx read the numbers. One ladder, two forms.
|
|
560
613
|
...Object.entries(TEXT).map(([step, px]) => decl(`text-${step}`, `${px}px`)),
|
|
561
614
|
decl('area-top', '22%'),
|
|
562
615
|
decl('area-bottom', '1%'),
|
|
563
|
-
decl('good', 'color-mix(in srgb, var(--vx-
|
|
564
|
-
decl('
|
|
565
|
-
decl('bad', 'color-mix(in srgb, var(--vx-
|
|
566
|
-
decl('warn', 'color-mix(in srgb, var(--vx-
|
|
567
|
-
decl('
|
|
568
|
-
decl('
|
|
569
|
-
decl('
|
|
616
|
+
decl('good', 'color-mix(in srgb, var(--vx-good-solid) 18%, transparent)'),
|
|
617
|
+
decl('good-soft', 'color-mix(in srgb, var(--vx-good-solid) 8%, transparent)'),
|
|
618
|
+
decl('bad', 'color-mix(in srgb, var(--vx-bad-solid) 18%, transparent)'),
|
|
619
|
+
decl('warn', 'color-mix(in srgb, var(--vx-warn-solid) 8%, transparent)'),
|
|
620
|
+
decl('good-ref', 'color-mix(in srgb, var(--vx-good-solid) 30%, transparent)'),
|
|
621
|
+
decl('bad-ref', 'color-mix(in srgb, var(--vx-bad-solid) 30%, transparent)'),
|
|
622
|
+
decl('warn-ref', 'color-mix(in srgb, var(--vx-warn-solid) 20%, transparent)'),
|
|
570
623
|
].join('\n')
|
|
624
|
+
return legacyAliases ? `${canonical}\n${frameworkDerivedAliases(data)}` : canonical
|
|
571
625
|
}
|
|
572
626
|
|
|
573
627
|
/**
|
|
@@ -679,6 +733,15 @@ export type BuildPaletteOpts = {
|
|
|
679
733
|
* — see {@link CORE_SPACE_VARS}.
|
|
680
734
|
*/
|
|
681
735
|
only?: 'core' | 'all'
|
|
736
|
+
/**
|
|
737
|
+
* Whether to also emit the 32 deprecated camelCase aliases (`--vx-accentFill`, `--vx-tooltipBg`,
|
|
738
|
+
* `--vx-fillHover-gray`, …) alongside the canonical kebab-case names the 1.4.0 normalization
|
|
739
|
+
* introduced. Default: `true`, so an existing consumer's hand-written CSS referencing a
|
|
740
|
+
* camelCase name keeps resolving. Each alias is defined as `var(--vx-<canonical>)` — it can
|
|
741
|
+
* never drift from the value it aliases. Pass `false` once every reference in your own code has
|
|
742
|
+
* migrated to the kebab names to drop the extra 32 lines.
|
|
743
|
+
*/
|
|
744
|
+
legacyAliases?: boolean
|
|
682
745
|
}
|
|
683
746
|
|
|
684
747
|
/** Mantine's own color-scheme attribute — the default {@link ColorSchemeSelector.attribute}. */
|
|
@@ -720,14 +783,15 @@ export function buildPaletteCss(
|
|
|
720
783
|
data: PaletteData = buildPaletteData(),
|
|
721
784
|
): string {
|
|
722
785
|
const groups = opts.groups ?? {}
|
|
786
|
+
const legacyAliases = opts.legacyAliases ?? true
|
|
723
787
|
const extraDerived = (opts.derived ?? []).map((d) => ` ${d}`).join('\n')
|
|
724
|
-
const derivedBlock = frameworkDerived(data, opts.only ?? 'all')
|
|
788
|
+
const derivedBlock = frameworkDerived(data, opts.only ?? 'all', legacyAliases)
|
|
725
789
|
const derived = extraDerived ? `${derivedBlock}\n${extraDerived}` : derivedBlock
|
|
726
790
|
const side = (s: Side): string => {
|
|
727
791
|
const extra = Object.entries(groups)
|
|
728
792
|
.map(([prefix, map]) => groupSide(prefix, map, s))
|
|
729
793
|
.join('\n')
|
|
730
|
-
const framework = frameworkPrimitives(s, data)
|
|
794
|
+
const framework = frameworkPrimitives(s, data, legacyAliases)
|
|
731
795
|
return extra ? `${framework}\n${extra}` : framework
|
|
732
796
|
}
|
|
733
797
|
const rootBlock = `:root {\n${derived}\n}`
|
package/src/tokens/palette.ts
CHANGED
|
@@ -104,6 +104,37 @@ export const SHADOW = {
|
|
|
104
104
|
light: '0 1px 2px rgba(28,25,23,0.12)',
|
|
105
105
|
dark: '0 1px 2px rgba(0,0,0,0.35)',
|
|
106
106
|
},
|
|
107
|
+
/**
|
|
108
|
+
* Interactive-control depth — the ONE value every raised Button/ActionIcon/Input variant shares
|
|
109
|
+
* (`docs/DESIGN-SPEC.md` §5's Button idiom). Exists rather than reusing `card` because `card`'s
|
|
110
|
+
* ring is OUTSET, and an outset ring paints in the color of whatever it is drawn over: fine
|
|
111
|
+
* between neutral panels, but on light scheme it resolves to `--vx-surface-hairline` and draws a
|
|
112
|
+
* pale grey outline around a saturated `filled` button, which reads as a rendering defect.
|
|
113
|
+
*
|
|
114
|
+
* THE TWO SCHEMES ARE SHAPED DIFFERENTLY, and the asymmetry is the whole design — do NOT "tidy"
|
|
115
|
+
* them into one shape. Both were arrived at by elimination, on screen:
|
|
116
|
+
*
|
|
117
|
+
* - DARK = drop + a full inset rim. Its edge is a LIGHTENING, so it cannot collide with the
|
|
118
|
+
* dark drop below the box; a uniform lightening on a dark surface reads as rim light wrapping
|
|
119
|
+
* a raised object, which is exactly right.
|
|
120
|
+
*
|
|
121
|
+
* - LIGHT = drop ONLY, no edge at all. A light-mode edge would have to be a DARKENING (there is
|
|
122
|
+
* nothing lighter than a near-white control to lighten with), and every position for one
|
|
123
|
+
* fails: a uniform dark ring does not read as depth, it reads as a BORDER — it made `default`
|
|
124
|
+
* and `light` look like outlined buttons and every form field look boxed. Moving it to the
|
|
125
|
+
* bottom edge alone then put a dark inner line directly above the dark drop, i.e. a visible
|
|
126
|
+
* DOUBLE BOTTOM BORDER. There is no third position, because a light-mode raised object's only
|
|
127
|
+
* honest cue is the shadow it casts. So light casts one and draws nothing.
|
|
128
|
+
*
|
|
129
|
+
* Consequence to know, on light only: a `default` control nested in a Card shares
|
|
130
|
+
* `--vx-surface-panel` with it and has no boundary but the drop. That is accepted — a wrong-
|
|
131
|
+
* looking border on every control in the app is worse than a soft edge in one nesting case. If it
|
|
132
|
+
* ever needs more, raise the DROP. Do not reintroduce an edge; both shapes have been tried.
|
|
133
|
+
*/
|
|
134
|
+
raised: {
|
|
135
|
+
light: '0 1px 2px rgba(28,25,23,0.10)',
|
|
136
|
+
dark: '0 1px 2px rgba(0,0,0,0.35), inset 0 0 0 1px color-mix(in srgb, #ffffff 8%, transparent)',
|
|
137
|
+
},
|
|
107
138
|
// Floating-layer elevation (menus, popovers, tooltips, modals, drawers) — a REAL drop shadow, a
|
|
108
139
|
// step above `card`, so detached surfaces read as lifted off the page (`docs/DESIGN-SPEC.md` §5).
|
|
109
140
|
// Unlike `card`, no embedded ring: floating surfaces carry a real 1px `--vx-surface-border` so
|
|
@@ -1059,8 +1090,8 @@ function buildPaletteDataUncached(config: DeriveConfig) {
|
|
|
1059
1090
|
* that floor holds (a near-black ink otherwise, for a fill brightened past the safety margin).
|
|
1060
1091
|
*
|
|
1061
1092
|
* `onAccent` is THE foreground for any accent fill. `theme/index.ts` bridges Mantine's
|
|
1062
|
-
* `--mantine-color-<primary>-filled` onto `--vx-
|
|
1063
|
-
* `--vx-
|
|
1093
|
+
* `--mantine-color-<primary>-filled` onto `--vx-accent-fill` and every filled foreground onto
|
|
1094
|
+
* `--vx-on-accent`, so ONE token drives the chrome — which is also what makes the theme lab able to
|
|
1064
1095
|
* retune the accent live. Mantine's own `autoContrast` cannot express this (it resolves the
|
|
1065
1096
|
* foreground scheme-blindly, in JS). Regression-locked by `theme/contrast.test.ts`.
|
|
1066
1097
|
*/
|