basalt-ui 1.4.0 → 1.5.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 +16 -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/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 +24 -5
- package/dist/guard/types.d.ts +6 -0
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/theme/index.js +4 -4
- package/dist/theme/timeline.module.css +3 -3
- package/dist/theme-lab/index.js +1 -1
- package/dist/tokens/index.d.ts +25 -16
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +84 -46
- package/dist/tokens.css +102 -51
- package/llms.txt +2 -2
- package/package.json +71 -17
- package/src/agent-chat/composer.tsx +1 -1
- 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 +98 -0
- package/src/guard/guard-hook.ts +1 -1
- package/src/guard/index.ts +60 -13
- package/src/guard/types.ts +6 -0
- package/src/theme/contrast.test.ts +23 -5
- package/src/theme/index.ts +5 -5
- package/src/theme/timeline.module.css +3 -3
- package/src/theme-lab/index.tsx +2 -2
- package/src/tokens/index.ts +106 -46
- package/src/tokens/palette.ts +2 -2
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)',
|
|
@@ -209,7 +209,7 @@ export const VX = {
|
|
|
209
209
|
surface: {
|
|
210
210
|
bg: 'var(--vx-surface-bg)',
|
|
211
211
|
panel: 'var(--vx-surface-panel)',
|
|
212
|
-
panelHover: 'var(--vx-surface-
|
|
212
|
+
panelHover: 'var(--vx-surface-panel-hover)',
|
|
213
213
|
elevated: 'var(--vx-surface-elevated)',
|
|
214
214
|
subtle: 'var(--vx-surface-subtle)',
|
|
215
215
|
overlay: 'var(--vx-surface-overlay)', // floating layer (menus, popovers, modals, drawers)
|
|
@@ -262,52 +262,81 @@ const groupSide = (prefix: string, map: SeriesMap, side: Side): string =>
|
|
|
262
262
|
.map(([key, pair]) => decl(`${prefix}${key}`, pair[side]))
|
|
263
263
|
.join('\n')
|
|
264
264
|
|
|
265
|
+
/**
|
|
266
|
+
* The 16 deprecated camelCase aliases for `frameworkPrimitives`' per-scheme canonicals, each
|
|
267
|
+
* defined as `var(--vx-<canonical-kebab-name>)` so it can never drift from the value above it.
|
|
268
|
+
* Emitted as its own commented, trailing group (never interleaved with the canonicals) — gated by
|
|
269
|
+
* {@link BuildPaletteOpts.legacyAliases}, default on. See that option's doc for the migration
|
|
270
|
+
* rationale (1.4.0 kebab-case normalization).
|
|
271
|
+
*/
|
|
272
|
+
function frameworkPrimitivesAliases(): string {
|
|
273
|
+
return [
|
|
274
|
+
' /* Deprecated camelCase aliases — removed in a future minor; migrate to the kebab names above. */',
|
|
275
|
+
decl('goodSolid', 'var(--vx-good-solid)'),
|
|
276
|
+
decl('badSolid', 'var(--vx-bad-solid)'),
|
|
277
|
+
decl('warnSolid', 'var(--vx-warn-solid)'),
|
|
278
|
+
decl('axisStroke', 'var(--vx-axis-stroke)'),
|
|
279
|
+
decl('dotStroke', 'var(--vx-dot-stroke)'),
|
|
280
|
+
decl('tooltipBg', 'var(--vx-tooltip-bg)'),
|
|
281
|
+
decl('tooltipText', 'var(--vx-tooltip-text)'),
|
|
282
|
+
decl('tooltipMuted', 'var(--vx-tooltip-muted)'),
|
|
283
|
+
decl('tooltipBorder', 'var(--vx-tooltip-border)'),
|
|
284
|
+
decl('tooltipShadow', 'var(--vx-tooltip-shadow)'),
|
|
285
|
+
decl('legendText', 'var(--vx-legend-text)'),
|
|
286
|
+
decl('accentHover', 'var(--vx-accent-hover)'),
|
|
287
|
+
decl('accentFill', 'var(--vx-accent-fill)'),
|
|
288
|
+
decl('accentFillHover', 'var(--vx-accent-fill-hover)'),
|
|
289
|
+
decl('onAccent', 'var(--vx-on-accent)'),
|
|
290
|
+
decl('surface-panelHover', 'var(--vx-surface-panel-hover)'),
|
|
291
|
+
].join('\n')
|
|
292
|
+
}
|
|
293
|
+
|
|
265
294
|
/**
|
|
266
295
|
* Built-in framework primitives for a given scheme side — STATUS group, semantic solids,
|
|
267
296
|
* neutral line/axis/grid/tooltip chrome, legend text, and the surface ramp. Domain series
|
|
268
297
|
* (SERIES/ACTIVITY/USAGE) are NOT shipped — apps append them via `opts.groups`.
|
|
269
298
|
*/
|
|
270
|
-
function frameworkPrimitives(side: Side, data: PaletteData): string {
|
|
299
|
+
function frameworkPrimitives(side: Side, data: PaletteData, legacyAliases: boolean): string {
|
|
271
300
|
const n = data.NEUTRAL
|
|
272
301
|
const s = data.SEMANTIC
|
|
273
302
|
const su = data.SURFACE
|
|
274
303
|
const ink = data.INK
|
|
275
304
|
const ac = data.ACCENT
|
|
276
|
-
|
|
305
|
+
const canonical = [
|
|
277
306
|
groupSide('status-', data.STATUS as SeriesMap, side),
|
|
278
|
-
decl('
|
|
279
|
-
decl('
|
|
280
|
-
decl('
|
|
307
|
+
decl('good-solid', s.good[side]),
|
|
308
|
+
decl('bad-solid', s.bad[side]),
|
|
309
|
+
decl('warn-solid', s.warn[side]),
|
|
281
310
|
decl('neutral', n.neutral[side]),
|
|
282
311
|
decl('line', n.line[side]),
|
|
283
312
|
decl('line2', n.line2[side]),
|
|
284
313
|
decl('axis', n.axis[side]),
|
|
285
|
-
decl('
|
|
314
|
+
decl('axis-stroke', n.axisStroke[side]),
|
|
286
315
|
decl('grid', n.grid[side]),
|
|
287
316
|
decl('crosshair', n.crosshair[side]),
|
|
288
|
-
decl('
|
|
289
|
-
decl('
|
|
290
|
-
decl('
|
|
291
|
-
decl('
|
|
292
|
-
decl('
|
|
293
|
-
decl('
|
|
294
|
-
decl('
|
|
317
|
+
decl('dot-stroke', n.dotStroke[side]),
|
|
318
|
+
decl('tooltip-bg', n.tooltipBg[side]),
|
|
319
|
+
decl('tooltip-text', n.tooltipText[side]),
|
|
320
|
+
decl('tooltip-muted', n.tooltipMuted[side]),
|
|
321
|
+
decl('tooltip-border', n.tooltipBorder[side]),
|
|
322
|
+
decl('tooltip-shadow', n.tooltipShadow[side]),
|
|
323
|
+
decl('legend-text', n.legendText[side]),
|
|
295
324
|
decl('ink', ink.ink[side]),
|
|
296
325
|
decl('ink2', ink.ink2[side]),
|
|
297
326
|
decl('muted', ink.muted[side]),
|
|
298
327
|
decl('faint', ink.faint[side]),
|
|
299
328
|
decl('accent', ac.accent[side]),
|
|
300
|
-
decl('
|
|
301
|
-
decl('
|
|
302
|
-
decl('
|
|
303
|
-
decl('
|
|
329
|
+
decl('accent-hover', ac.accentHover[side]),
|
|
330
|
+
decl('accent-fill', ac.accentFill[side]),
|
|
331
|
+
decl('accent-fill-hover', ac.accentFillHover[side]),
|
|
332
|
+
decl('on-accent', ac.onAccent[side]),
|
|
304
333
|
decl('divider', su.divider[side]),
|
|
305
334
|
decl('shadow-card', SHADOW.card[side]),
|
|
306
335
|
decl('shadow-ctrl', SHADOW.ctrl[side]),
|
|
307
336
|
decl('shadow-overlay', SHADOW.overlay[side]),
|
|
308
337
|
decl('surface-bg', su.bg[side]),
|
|
309
338
|
decl('surface-panel', su.panel[side]),
|
|
310
|
-
decl('surface-
|
|
339
|
+
decl('surface-panel-hover', su.panelHover[side]),
|
|
311
340
|
decl('surface-elevated', su.elevated[side]),
|
|
312
341
|
decl('surface-subtle', su.subtle[side]),
|
|
313
342
|
decl('surface-overlay', su.overlay[side]),
|
|
@@ -315,6 +344,7 @@ function frameworkPrimitives(side: Side, data: PaletteData): string {
|
|
|
315
344
|
decl('surface-border', su.border[side]),
|
|
316
345
|
decl('surface-hairline', su.hairline[side]),
|
|
317
346
|
].join('\n')
|
|
347
|
+
return legacyAliases ? `${canonical}\n${frameworkPrimitivesAliases()}` : canonical
|
|
318
348
|
}
|
|
319
349
|
|
|
320
350
|
/**
|
|
@@ -520,15 +550,34 @@ const DEFAULT_SPACE_VALUES: SpaceValues = {
|
|
|
520
550
|
rowLineHeight: ROW_LINE_HEIGHT,
|
|
521
551
|
}
|
|
522
552
|
|
|
553
|
+
/**
|
|
554
|
+
* The 16 deprecated camelCase aliases for `frameworkDerived`'s theme-independent (`:root`)
|
|
555
|
+
* canonicals — the 12 `fill-hover-<family>` fills plus `good-soft`/`good-ref`/`bad-ref`/`warn-ref`.
|
|
556
|
+
* Each is a `var(--vx-<canonical-kebab-name>)` ref so it can never drift. Emitted as its own
|
|
557
|
+
* commented, trailing group — gated by {@link BuildPaletteOpts.legacyAliases}, default on.
|
|
558
|
+
*/
|
|
559
|
+
function frameworkDerivedAliases(data: PaletteData): string {
|
|
560
|
+
return [
|
|
561
|
+
' /* Deprecated camelCase aliases — removed in a future minor; migrate to the kebab names above. */',
|
|
562
|
+
...Object.keys(data.FILL).map((name) =>
|
|
563
|
+
decl(`fillHover-${name}`, `var(--vx-fill-hover-${name})`),
|
|
564
|
+
),
|
|
565
|
+
decl('goodSoft', 'var(--vx-good-soft)'),
|
|
566
|
+
decl('goodRef', 'var(--vx-good-ref)'),
|
|
567
|
+
decl('badRef', 'var(--vx-bad-ref)'),
|
|
568
|
+
decl('warnRef', 'var(--vx-warn-ref)'),
|
|
569
|
+
].join('\n')
|
|
570
|
+
}
|
|
571
|
+
|
|
523
572
|
/**
|
|
524
573
|
* Theme-independent scalars + semantic fills, defined once on `:root`.
|
|
525
574
|
*
|
|
526
575
|
* Area-gradient strength is a global knob (the theme lab overrides these two on `:root`
|
|
527
576
|
* to retune every line-area fill live). 0%/0% disables gradients app-wide.
|
|
528
577
|
*/
|
|
529
|
-
function frameworkDerived(data: PaletteData, only: 'core' | 'all'): string {
|
|
578
|
+
function frameworkDerived(data: PaletteData, only: 'core' | 'all', legacyAliases: boolean): string {
|
|
530
579
|
const space = spaceDecls(DEFAULT_SPACE_VALUES)
|
|
531
|
-
|
|
580
|
+
const canonical = [
|
|
532
581
|
decl('radius-card', `${RADIUS.card}px`),
|
|
533
582
|
decl('radius-ctrl', `${RADIUS.ctrl}px`),
|
|
534
583
|
// The two offset tiers (SegmentedControl indicator/Kbd/Code, Progress/scale-sm) — added so a
|
|
@@ -553,21 +602,22 @@ function frameworkDerived(data: PaletteData, only: 'core' | 'all'): string {
|
|
|
553
602
|
// hover along instead of leaving a stale pair. 88% of the fill over black lands ~0.128 luminance:
|
|
554
603
|
// a visible press-darkening that still clears AA for the white label (~5.9:1).
|
|
555
604
|
...Object.keys(data.FILL).map((name) =>
|
|
556
|
-
decl(`
|
|
605
|
+
decl(`fill-hover-${name}`, `color-mix(in srgb, var(--vx-fill-${name}) 88%, #000)`),
|
|
557
606
|
),
|
|
558
607
|
// The type scale, emitted from the SAME `TEXT` object `VX.text` reads — CSS modules and the
|
|
559
608
|
// Mantine theme consume these; inline styles / visx read the numbers. One ladder, two forms.
|
|
560
609
|
...Object.entries(TEXT).map(([step, px]) => decl(`text-${step}`, `${px}px`)),
|
|
561
610
|
decl('area-top', '22%'),
|
|
562
611
|
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('
|
|
612
|
+
decl('good', 'color-mix(in srgb, var(--vx-good-solid) 18%, transparent)'),
|
|
613
|
+
decl('good-soft', 'color-mix(in srgb, var(--vx-good-solid) 8%, transparent)'),
|
|
614
|
+
decl('bad', 'color-mix(in srgb, var(--vx-bad-solid) 18%, transparent)'),
|
|
615
|
+
decl('warn', 'color-mix(in srgb, var(--vx-warn-solid) 8%, transparent)'),
|
|
616
|
+
decl('good-ref', 'color-mix(in srgb, var(--vx-good-solid) 30%, transparent)'),
|
|
617
|
+
decl('bad-ref', 'color-mix(in srgb, var(--vx-bad-solid) 30%, transparent)'),
|
|
618
|
+
decl('warn-ref', 'color-mix(in srgb, var(--vx-warn-solid) 20%, transparent)'),
|
|
570
619
|
].join('\n')
|
|
620
|
+
return legacyAliases ? `${canonical}\n${frameworkDerivedAliases(data)}` : canonical
|
|
571
621
|
}
|
|
572
622
|
|
|
573
623
|
/**
|
|
@@ -679,6 +729,15 @@ export type BuildPaletteOpts = {
|
|
|
679
729
|
* — see {@link CORE_SPACE_VARS}.
|
|
680
730
|
*/
|
|
681
731
|
only?: 'core' | 'all'
|
|
732
|
+
/**
|
|
733
|
+
* Whether to also emit the 32 deprecated camelCase aliases (`--vx-accentFill`, `--vx-tooltipBg`,
|
|
734
|
+
* `--vx-fillHover-gray`, …) alongside the canonical kebab-case names the 1.4.0 normalization
|
|
735
|
+
* introduced. Default: `true`, so an existing consumer's hand-written CSS referencing a
|
|
736
|
+
* camelCase name keeps resolving. Each alias is defined as `var(--vx-<canonical>)` — it can
|
|
737
|
+
* never drift from the value it aliases. Pass `false` once every reference in your own code has
|
|
738
|
+
* migrated to the kebab names to drop the extra 32 lines.
|
|
739
|
+
*/
|
|
740
|
+
legacyAliases?: boolean
|
|
682
741
|
}
|
|
683
742
|
|
|
684
743
|
/** Mantine's own color-scheme attribute — the default {@link ColorSchemeSelector.attribute}. */
|
|
@@ -720,14 +779,15 @@ export function buildPaletteCss(
|
|
|
720
779
|
data: PaletteData = buildPaletteData(),
|
|
721
780
|
): string {
|
|
722
781
|
const groups = opts.groups ?? {}
|
|
782
|
+
const legacyAliases = opts.legacyAliases ?? true
|
|
723
783
|
const extraDerived = (opts.derived ?? []).map((d) => ` ${d}`).join('\n')
|
|
724
|
-
const derivedBlock = frameworkDerived(data, opts.only ?? 'all')
|
|
784
|
+
const derivedBlock = frameworkDerived(data, opts.only ?? 'all', legacyAliases)
|
|
725
785
|
const derived = extraDerived ? `${derivedBlock}\n${extraDerived}` : derivedBlock
|
|
726
786
|
const side = (s: Side): string => {
|
|
727
787
|
const extra = Object.entries(groups)
|
|
728
788
|
.map(([prefix, map]) => groupSide(prefix, map, s))
|
|
729
789
|
.join('\n')
|
|
730
|
-
const framework = frameworkPrimitives(s, data)
|
|
790
|
+
const framework = frameworkPrimitives(s, data, legacyAliases)
|
|
731
791
|
return extra ? `${framework}\n${extra}` : framework
|
|
732
792
|
}
|
|
733
793
|
const rootBlock = `:root {\n${derived}\n}`
|
package/src/tokens/palette.ts
CHANGED
|
@@ -1059,8 +1059,8 @@ function buildPaletteDataUncached(config: DeriveConfig) {
|
|
|
1059
1059
|
* that floor holds (a near-black ink otherwise, for a fill brightened past the safety margin).
|
|
1060
1060
|
*
|
|
1061
1061
|
* `onAccent` is THE foreground for any accent fill. `theme/index.ts` bridges Mantine's
|
|
1062
|
-
* `--mantine-color-<primary>-filled` onto `--vx-
|
|
1063
|
-
* `--vx-
|
|
1062
|
+
* `--mantine-color-<primary>-filled` onto `--vx-accent-fill` and every filled foreground onto
|
|
1063
|
+
* `--vx-on-accent`, so ONE token drives the chrome — which is also what makes the theme lab able to
|
|
1064
1064
|
* retune the accent live. Mantine's own `autoContrast` cannot express this (it resolves the
|
|
1065
1065
|
* foreground scheme-blindly, in JS). Regression-locked by `theme/contrast.test.ts`.
|
|
1066
1066
|
*/
|