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
|
@@ -194,29 +194,47 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
|
|
|
194
194
|
"vars": {
|
|
195
195
|
"fn":
|
|
196
196
|
"(_theme, props) => {
|
|
197
|
-
const ink =
|
|
197
|
+
const ink = inkVars(props);
|
|
198
198
|
return {
|
|
199
199
|
root: {
|
|
200
200
|
"--ai-size": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
201
201
|
"--ai-color": ink.color,
|
|
202
|
-
"--ai-hover": ink.hover
|
|
202
|
+
"--ai-hover": ink.hover,
|
|
203
|
+
"--ai-bg": ink.bg,
|
|
204
|
+
"--ai-bd": ink.border
|
|
203
205
|
}
|
|
204
206
|
};
|
|
205
207
|
}"
|
|
206
208
|
,
|
|
207
209
|
"outputs": [
|
|
208
210
|
{
|
|
209
|
-
"probes":
|
|
211
|
+
"probes": 1892,
|
|
210
212
|
"result": "{"root":{}}",
|
|
211
213
|
},
|
|
214
|
+
{
|
|
215
|
+
"probes": 42,
|
|
216
|
+
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--ai-bg":"var(--vx-surface-subtle)"}}",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"probes": 42,
|
|
220
|
+
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"var(--vx-surface-subtle)","--ai-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
221
|
+
},
|
|
212
222
|
{
|
|
213
223
|
"probes": 42,
|
|
214
224
|
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
215
225
|
},
|
|
216
226
|
{
|
|
217
|
-
"probes":
|
|
227
|
+
"probes": 272,
|
|
218
228
|
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))"}}",
|
|
219
229
|
},
|
|
230
|
+
{
|
|
231
|
+
"probes": 6,
|
|
232
|
+
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--ai-bg":"var(--vx-surface-subtle)"}}",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"probes": 6,
|
|
236
|
+
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"var(--vx-surface-subtle)","--ai-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
237
|
+
},
|
|
220
238
|
{
|
|
221
239
|
"probes": 6,
|
|
222
240
|
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
@@ -271,29 +289,47 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
|
|
|
271
289
|
"vars": {
|
|
272
290
|
"fn":
|
|
273
291
|
"(_theme, props) => {
|
|
274
|
-
const ink =
|
|
292
|
+
const ink = inkVars(props);
|
|
275
293
|
return {
|
|
276
294
|
root: {
|
|
277
295
|
"--button-height": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
278
296
|
"--button-color": ink.color,
|
|
279
|
-
"--button-hover": ink.hover
|
|
297
|
+
"--button-hover": ink.hover,
|
|
298
|
+
"--button-bg": ink.bg,
|
|
299
|
+
"--button-bd": ink.border
|
|
280
300
|
}
|
|
281
301
|
};
|
|
282
302
|
}"
|
|
283
303
|
,
|
|
284
304
|
"outputs": [
|
|
285
305
|
{
|
|
286
|
-
"probes":
|
|
306
|
+
"probes": 1892,
|
|
287
307
|
"result": "{"root":{}}",
|
|
288
308
|
},
|
|
309
|
+
{
|
|
310
|
+
"probes": 42,
|
|
311
|
+
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--button-bg":"var(--vx-surface-subtle)"}}",
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"probes": 42,
|
|
315
|
+
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"var(--vx-surface-subtle)","--button-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
316
|
+
},
|
|
289
317
|
{
|
|
290
318
|
"probes": 42,
|
|
291
319
|
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
292
320
|
},
|
|
293
321
|
{
|
|
294
|
-
"probes":
|
|
322
|
+
"probes": 272,
|
|
295
323
|
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))"}}",
|
|
296
324
|
},
|
|
325
|
+
{
|
|
326
|
+
"probes": 6,
|
|
327
|
+
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--button-bg":"var(--vx-surface-subtle)"}}",
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"probes": 6,
|
|
331
|
+
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"var(--vx-surface-subtle)","--button-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
332
|
+
},
|
|
297
333
|
{
|
|
298
334
|
"probes": 6,
|
|
299
335
|
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
@@ -1336,29 +1372,47 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
|
|
|
1336
1372
|
"vars": {
|
|
1337
1373
|
"fn":
|
|
1338
1374
|
"(_theme, props) => {
|
|
1339
|
-
const ink =
|
|
1375
|
+
const ink = inkVars(props);
|
|
1340
1376
|
return {
|
|
1341
1377
|
root: {
|
|
1342
1378
|
"--ai-size": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
1343
1379
|
"--ai-color": ink.color,
|
|
1344
|
-
"--ai-hover": ink.hover
|
|
1380
|
+
"--ai-hover": ink.hover,
|
|
1381
|
+
"--ai-bg": ink.bg,
|
|
1382
|
+
"--ai-bd": ink.border
|
|
1345
1383
|
}
|
|
1346
1384
|
};
|
|
1347
1385
|
}"
|
|
1348
1386
|
,
|
|
1349
1387
|
"outputs": [
|
|
1350
1388
|
{
|
|
1351
|
-
"probes":
|
|
1389
|
+
"probes": 1892,
|
|
1352
1390
|
"result": "{"root":{}}",
|
|
1353
1391
|
},
|
|
1392
|
+
{
|
|
1393
|
+
"probes": 42,
|
|
1394
|
+
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--ai-bg":"var(--vx-surface-subtle)"}}",
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
"probes": 42,
|
|
1398
|
+
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"var(--vx-surface-subtle)","--ai-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
1399
|
+
},
|
|
1354
1400
|
{
|
|
1355
1401
|
"probes": 42,
|
|
1356
1402
|
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
1357
1403
|
},
|
|
1358
1404
|
{
|
|
1359
|
-
"probes":
|
|
1405
|
+
"probes": 272,
|
|
1360
1406
|
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))"}}",
|
|
1361
1407
|
},
|
|
1408
|
+
{
|
|
1409
|
+
"probes": 6,
|
|
1410
|
+
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--ai-bg":"var(--vx-surface-subtle)"}}",
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
"probes": 6,
|
|
1414
|
+
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"var(--vx-surface-subtle)","--ai-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
1415
|
+
},
|
|
1362
1416
|
{
|
|
1363
1417
|
"probes": 6,
|
|
1364
1418
|
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
@@ -1413,29 +1467,47 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
|
|
|
1413
1467
|
"vars": {
|
|
1414
1468
|
"fn":
|
|
1415
1469
|
"(_theme, props) => {
|
|
1416
|
-
const ink =
|
|
1470
|
+
const ink = inkVars(props);
|
|
1417
1471
|
return {
|
|
1418
1472
|
root: {
|
|
1419
1473
|
"--button-height": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
1420
1474
|
"--button-color": ink.color,
|
|
1421
|
-
"--button-hover": ink.hover
|
|
1475
|
+
"--button-hover": ink.hover,
|
|
1476
|
+
"--button-bg": ink.bg,
|
|
1477
|
+
"--button-bd": ink.border
|
|
1422
1478
|
}
|
|
1423
1479
|
};
|
|
1424
1480
|
}"
|
|
1425
1481
|
,
|
|
1426
1482
|
"outputs": [
|
|
1427
1483
|
{
|
|
1428
|
-
"probes":
|
|
1484
|
+
"probes": 1892,
|
|
1429
1485
|
"result": "{"root":{}}",
|
|
1430
1486
|
},
|
|
1487
|
+
{
|
|
1488
|
+
"probes": 42,
|
|
1489
|
+
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--button-bg":"var(--vx-surface-subtle)"}}",
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
"probes": 42,
|
|
1493
|
+
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"var(--vx-surface-subtle)","--button-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
1494
|
+
},
|
|
1431
1495
|
{
|
|
1432
1496
|
"probes": 42,
|
|
1433
1497
|
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
1434
1498
|
},
|
|
1435
1499
|
{
|
|
1436
|
-
"probes":
|
|
1500
|
+
"probes": 272,
|
|
1437
1501
|
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))"}}",
|
|
1438
1502
|
},
|
|
1503
|
+
{
|
|
1504
|
+
"probes": 6,
|
|
1505
|
+
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--button-bg":"var(--vx-surface-subtle)"}}",
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
"probes": 6,
|
|
1509
|
+
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"var(--vx-surface-subtle)","--button-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
1510
|
+
},
|
|
1439
1511
|
{
|
|
1440
1512
|
"probes": 6,
|
|
1441
1513
|
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
package/src/theme/chrome-vars.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -40,7 +40,7 @@ import type { MantineTheme } from '@mantine/core'
|
|
|
40
40
|
* Stepper / Indicator / Timeline all call Mantine's `getContrastColor` directly) are re-pointed at
|
|
41
41
|
* it too, in `components` below. Regression-locked by `contrast.test.ts`.
|
|
42
42
|
*/
|
|
43
|
-
export function onColor(theme: MantineTheme, color: string | undefined): string | undefined {
|
|
43
|
+
export function onColor(theme: MantineTheme, color: string | null | undefined): string | undefined {
|
|
44
44
|
const name = color ?? theme.primaryColor
|
|
45
45
|
if (!Object.prototype.hasOwnProperty.call(theme.colors, name)) return undefined // hex / `blue.5`
|
|
46
46
|
return `var(--vx-on-${name})`
|
|
@@ -53,36 +53,61 @@ export function onColor(theme: MantineTheme, color: string | undefined): string
|
|
|
53
53
|
*/
|
|
54
54
|
export function onColorFor(
|
|
55
55
|
theme: MantineTheme,
|
|
56
|
-
props: { color?: string | undefined; autoContrast?: boolean | undefined },
|
|
56
|
+
props: { color?: string | null | undefined; autoContrast?: boolean | undefined },
|
|
57
57
|
): string | undefined {
|
|
58
58
|
const autoContrast = props.autoContrast ?? theme.autoContrast
|
|
59
59
|
return autoContrast ? onColor(theme, props.color) : undefined
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
/**
|
|
63
|
+
* The chrome opt-out: a call site that names a colour (even the primary one) keeps its hue. An
|
|
64
|
+
* empty string and `null` name nothing — Mantine reads `color || primaryColor`, so they fall back to
|
|
65
|
+
* the primary colour too.
|
|
66
|
+
*/
|
|
67
|
+
export function hasExplicitColor(color: string | null | undefined): boolean {
|
|
68
|
+
return typeof color === 'string' && color !== ''
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type InkVars = {
|
|
72
|
+
color?: string
|
|
73
|
+
hover?: string
|
|
74
|
+
bg?: string
|
|
75
|
+
border?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const INK = 'var(--vx-ink)'
|
|
79
|
+
const SUBTLE = 'var(--vx-surface-subtle)'
|
|
80
|
+
|
|
81
|
+
/** Per variant: what an unnamed-colour Button / ActionIcon paints instead of the accent. */
|
|
82
|
+
const INK_BY_VARIANT: Partial<Record<'subtle' | 'light' | 'outline', InkVars>> = {
|
|
83
|
+
subtle: { color: INK, hover: 'color-mix(in srgb, var(--vx-ink) 6%, transparent)' },
|
|
84
|
+
light: { color: INK, bg: SUBTLE, hover: `color-mix(in srgb, var(--vx-ink) 6%, ${SUBTLE})` },
|
|
85
|
+
outline: {
|
|
86
|
+
color: INK,
|
|
87
|
+
border: 'calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)',
|
|
88
|
+
hover: SUBTLE,
|
|
89
|
+
},
|
|
65
90
|
}
|
|
66
91
|
|
|
67
92
|
/**
|
|
68
|
-
* A `subtle` Button / ActionIcon that names no colour
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
93
|
+
* A `subtle`, `light` or `outline` Button / ActionIcon that names no colour is ink, not the accent
|
|
94
|
+
* (`MIGRATING.md` § Light and outline Buttons are ink, D27). `subtle`: ink label, ink-6% hover
|
|
95
|
+
* (`docs/DESIGN-SPEC.md` §5 ghost idiom). `light`: the subtle surface with an ink label, hover one
|
|
96
|
+
* ink step on top (Mantine's gray-light roles collapse bg and hover to one colour in light). `outline`:
|
|
97
|
+
* the surface border, ink label, subtle-surface hover. An explicit `color=` — the primary one
|
|
98
|
+
* included — keeps Mantine's tinted vars: `color="red"` on a destructive action carries its hue as
|
|
99
|
+
* the whole signal. Mantine hands the variant resolver `color || primaryColor`, so only the
|
|
100
|
+
* component props can tell "unnamed" from "primary" — hence vars, not the resolver. Disabled needs no
|
|
101
|
+
* gate: Mantine's disabled rule sets colour, background and border directly, not through these vars.
|
|
73
102
|
*/
|
|
74
|
-
export function
|
|
75
|
-
color?: string | undefined
|
|
103
|
+
export function inkVars(props: {
|
|
104
|
+
color?: string | null | undefined
|
|
76
105
|
variant?: string | undefined
|
|
77
|
-
}): {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
color: ink ? 'var(--vx-ink)' : undefined,
|
|
84
|
-
hover: ink ? 'color-mix(in srgb, var(--vx-ink) 6%, transparent)' : undefined,
|
|
85
|
-
}
|
|
106
|
+
}): InkVars {
|
|
107
|
+
const { variant } = props
|
|
108
|
+
if (hasExplicitColor(props.color) || variant === undefined) return {}
|
|
109
|
+
if (!Object.hasOwn(INK_BY_VARIANT, variant)) return {}
|
|
110
|
+
return INK_BY_VARIANT[variant as keyof typeof INK_BY_VARIANT] ?? {}
|
|
86
111
|
}
|
|
87
112
|
|
|
88
113
|
/**
|
|
@@ -95,7 +120,7 @@ export function subtleInkVars(props: {
|
|
|
95
120
|
export function tabsVars(
|
|
96
121
|
theme: MantineTheme,
|
|
97
122
|
props: {
|
|
98
|
-
color?: string | undefined
|
|
123
|
+
color?: string | null | undefined
|
|
99
124
|
variant?: string | undefined
|
|
100
125
|
autoContrast?: boolean | undefined
|
|
101
126
|
},
|
package/src/theme/index.ts
CHANGED
|
@@ -86,7 +86,7 @@ import { CTL_HEIGHT_VARS } from '../tokens/ctl-vars'
|
|
|
86
86
|
import type { CtlHeightVar } from '../tokens/ctl-vars'
|
|
87
87
|
import { SIZE_CLASS_BREAKPOINTS } from '../tokens/size-classes'
|
|
88
88
|
import type { BasaltFontsConfig } from '../tokens/core'
|
|
89
|
-
import { onColor, onColorFor,
|
|
89
|
+
import { onColor, onColorFor, inkVars, tabsVars } from './chrome-vars'
|
|
90
90
|
import controlsClasses from './controls.module.css'
|
|
91
91
|
import floatingClasses from './floating.module.css'
|
|
92
92
|
import navLinkClasses from './nav-link.module.css'
|
|
@@ -314,9 +314,9 @@ const basaltVariantColorResolver: VariantColorsResolver = (input) => {
|
|
|
314
314
|
return autoContrast ? { ...resolved, color: on } : resolved
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
// `subtle`
|
|
318
|
-
// (the resolver is always handed `color || primaryColor`, so it cannot
|
|
319
|
-
// explicit primary colour — only the component props can).
|
|
317
|
+
// `subtle`, `light` and `outline` stay Mantine's: a Button or ActionIcon that names no colour gets
|
|
318
|
+
// ink for them in `inkVars` (the resolver is always handed `color || primaryColor`, so it cannot
|
|
319
|
+
// tell "unnamed" from an explicit primary colour — only the component props can).
|
|
320
320
|
// `outline`: the tone's own text colour, pulled toward ink so the label keeps its hue at AA
|
|
321
321
|
// (grey outline badges measured 3.9:1 on the light page).
|
|
322
322
|
if (input.variant === 'outline') {
|
|
@@ -676,7 +676,7 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
676
676
|
Button: ext<typeof Button>({
|
|
677
677
|
classNames: { root: controlsClasses.buttonRoot },
|
|
678
678
|
vars: (_theme, props) => {
|
|
679
|
-
const ink =
|
|
679
|
+
const ink = inkVars(props)
|
|
680
680
|
return {
|
|
681
681
|
root: {
|
|
682
682
|
'--button-height':
|
|
@@ -685,6 +685,8 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
685
685
|
: undefined,
|
|
686
686
|
'--button-color': ink.color,
|
|
687
687
|
'--button-hover': ink.hover,
|
|
688
|
+
'--button-bg': ink.bg,
|
|
689
|
+
'--button-bd': ink.border,
|
|
688
690
|
},
|
|
689
691
|
}
|
|
690
692
|
},
|
|
@@ -692,7 +694,7 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
692
694
|
ActionIcon: ext<typeof ActionIcon>({
|
|
693
695
|
classNames: { root: controlsClasses.actionIconRoot },
|
|
694
696
|
vars: (_theme, props) => {
|
|
695
|
-
const ink =
|
|
697
|
+
const ink = inkVars(props)
|
|
696
698
|
return {
|
|
697
699
|
root: {
|
|
698
700
|
'--ai-size':
|
|
@@ -701,6 +703,8 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
701
703
|
: undefined,
|
|
702
704
|
'--ai-color': ink.color,
|
|
703
705
|
'--ai-hover': ink.hover,
|
|
706
|
+
'--ai-bg': ink.bg,
|
|
707
|
+
'--ai-bd': ink.border,
|
|
704
708
|
},
|
|
705
709
|
}
|
|
706
710
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `StatusDot` — the one status mark: a 6px round dot that carries a colour and nothing else. It is
|
|
3
|
+
* decoration (`aria-hidden`); the meaning always travels as a word beside it (`StatusVerdict`), so a
|
|
4
|
+
* verdict is never colour alone. INTERNAL: not on any barrel.
|
|
5
|
+
*/
|
|
6
|
+
import type { CSSProperties } from 'react'
|
|
7
|
+
import classes from './status-dot.module.css'
|
|
8
|
+
|
|
9
|
+
export type StatusDotProps = {
|
|
10
|
+
/** Any CSS colour; callers pass a `VX.status.*` token so it re-resolves per scheme. */
|
|
11
|
+
color: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type DotStyle = CSSProperties & { '--basalt-status-dot': string }
|
|
15
|
+
|
|
16
|
+
export function StatusDot({ color }: StatusDotProps) {
|
|
17
|
+
const style: DotStyle = { '--basalt-status-dot': color }
|
|
18
|
+
return <span className={classes.dot} data-basalt-status-dot="" aria-hidden="true" style={style} />
|
|
19
|
+
}
|
|
@@ -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
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `StatusVerdict` — a `StatusDot` plus its word in muted ink. With `phrase`, the visible word is
|
|
3
|
+
* hidden from assistive tech and the full phrase is read instead, so a screen reader never hears a
|
|
4
|
+
* bare "Over". INTERNAL: not on any barrel; `StatCard` and the notification centre compose it.
|
|
5
|
+
*/
|
|
6
|
+
import { StatusDot } from './status-dot'
|
|
7
|
+
import classes from './status-verdict.module.css'
|
|
8
|
+
|
|
9
|
+
export type StatusVerdictProps = {
|
|
10
|
+
color: string
|
|
11
|
+
/** The short visible word ("Over", "Error"). */
|
|
12
|
+
word: string
|
|
13
|
+
/** A longer phrase for assistive tech, read in place of the word. */
|
|
14
|
+
phrase?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function StatusVerdict({ color, word, phrase }: StatusVerdictProps) {
|
|
18
|
+
return (
|
|
19
|
+
<span className={classes.verdict}>
|
|
20
|
+
<StatusDot color={color} />
|
|
21
|
+
<span data-verdict-word="" {...(phrase !== undefined && { 'aria-hidden': true })}>
|
|
22
|
+
{word}
|
|
23
|
+
</span>
|
|
24
|
+
{phrase !== undefined && <span className={classes.hidden}>{phrase}</span>}
|
|
25
|
+
</span>
|
|
26
|
+
)
|
|
27
|
+
}
|
package/src/tokens/derive.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* constants below, never hand-editing a hex in `palette.ts`.
|
|
11
11
|
*/
|
|
12
12
|
import { contrastRatio, hctToHex, hexToHct, yToTone } from './hct'
|
|
13
|
+
import { deriveStatusHexes } from './status-text'
|
|
13
14
|
import type { ColorPair } from './core'
|
|
14
15
|
|
|
15
16
|
export type DeriveConfig = {
|
|
@@ -316,18 +317,6 @@ const INK_TONE: Record<Side, Record<InkKey, number>> = {
|
|
|
316
317
|
// ── Status/semantic — three baked hues, each with its own calibrated tone+chroma stop per scheme.
|
|
317
318
|
export type StatusKey = 'good' | 'warn' | 'bad'
|
|
318
319
|
|
|
319
|
-
const STATUS_HUE: Record<StatusKey, number> = { good: 151.975, warn: 76.64, bad: 29.905 }
|
|
320
|
-
// Every stop is read as TEXT somewhere (`DeltaBadge`, a toned breakdown row), so each clears WCAG AA
|
|
321
|
-
// (4.5:1) on every text surface (bg / panel / panelHover / elevated / subtle / field) at the default
|
|
322
|
-
// derive config only (default seed, every level knob 0) — pinned in `derive.test.ts`; a retuned
|
|
323
|
-
// `lightLevel` / `darkLevel` / `neutral` is not covered. `warn` light sat at tone 54.64 (3.64:1 on the panel) and `bad`
|
|
324
|
-
// dark at 58.58 (4.22:1); both moved along their lightness axis only, hue and chroma untouched.
|
|
325
|
-
const STATUS_STOP: Record<StatusKey, Record<Side, { tone: number; chroma: number }>> = {
|
|
326
|
-
good: { light: { tone: 45.75, chroma: 37.75 }, dark: { tone: 70.23, chroma: 53.23 } },
|
|
327
|
-
warn: { light: { tone: 46, chroma: 61.12 }, dark: { tone: 72.34, chroma: 62.55 } },
|
|
328
|
-
bad: { light: { tone: 43.86, chroma: 54.46 }, dark: { tone: 66.5, chroma: 53.79 } },
|
|
329
|
-
}
|
|
330
|
-
|
|
331
320
|
/**
|
|
332
321
|
* Continuous derivation parameters — the derivation CORE's inputs, decoupled from the -5..5
|
|
333
322
|
* slider levels. `deriveTokens` maps levels onto these (with the re-centered baselines baked in).
|
|
@@ -357,16 +346,30 @@ export type DerivedPalette = {
|
|
|
357
346
|
status: Record<StatusKey, ColorPair>
|
|
358
347
|
}
|
|
359
348
|
|
|
349
|
+
/** The accepted `lightLevel` / `darkLevel` range; `deriveTokens` clamps to it. */
|
|
350
|
+
export const DERIVE_LEVEL_RANGE = { min: -5, max: 5 } as const
|
|
351
|
+
|
|
352
|
+
function clampLevel(level: number): number {
|
|
353
|
+
return Number.isFinite(level) ? clamp(level, DERIVE_LEVEL_RANGE.min, DERIVE_LEVEL_RANGE.max) : 0
|
|
354
|
+
}
|
|
355
|
+
|
|
360
356
|
/** Derive the full palette from a seed accent + neutral family + surface levels.
|
|
361
357
|
* Public level-based entry: maps the -5..5 sliders onto `DeriveParams` (vibrancy x0.72 center,
|
|
362
|
-
* surface +2 baseline) and delegates to `deriveTokensRaw`.
|
|
358
|
+
* surface +2 baseline) and delegates to `deriveTokensRaw`.
|
|
359
|
+
*
|
|
360
|
+
* `lightLevel` / `darkLevel` are clamped to {@link DERIVE_LEVEL_RANGE} (non-finite → 0).
|
|
361
|
+
* @throws Error when no status tone clears 4.5:1 on every text surface — unreachable for clamped
|
|
362
|
+
* levels (the test grid proves it); only a raw shift outside the slider range gets there.
|
|
363
|
+
*/
|
|
363
364
|
export function deriveTokens(config: DeriveConfig): DerivedPalette {
|
|
364
365
|
assertValidAccentHex(config.accent)
|
|
365
366
|
return deriveTokensRaw(config, {
|
|
366
367
|
chromaMult: vibrancyChromaMult(config.vibrancy),
|
|
367
368
|
accentToneShift: config.accentBrightness * ACCENT_BRIGHTNESS_TONE_STEP,
|
|
368
|
-
lightSurfaceShift:
|
|
369
|
-
|
|
369
|
+
lightSurfaceShift:
|
|
370
|
+
SURFACE_LEVEL_TONE_STEP * clampLevel(config.lightLevel) + SURFACE_BASELINE_TONE_SHIFT,
|
|
371
|
+
darkSurfaceShift:
|
|
372
|
+
SURFACE_LEVEL_TONE_STEP * clampLevel(config.darkLevel) + SURFACE_BASELINE_TONE_SHIFT,
|
|
370
373
|
})
|
|
371
374
|
}
|
|
372
375
|
|
|
@@ -457,22 +460,7 @@ export function deriveTokensRaw(
|
|
|
457
460
|
}
|
|
458
461
|
}
|
|
459
462
|
|
|
460
|
-
const status =
|
|
461
|
-
for (const key of Object.keys(STATUS_HUE) as StatusKey[]) {
|
|
462
|
-
const hue = STATUS_HUE[key]
|
|
463
|
-
status[key] = {
|
|
464
|
-
light: hctToHex({
|
|
465
|
-
hue,
|
|
466
|
-
chroma: STATUS_STOP[key].light.chroma,
|
|
467
|
-
tone: STATUS_STOP[key].light.tone,
|
|
468
|
-
}),
|
|
469
|
-
dark: hctToHex({
|
|
470
|
-
hue,
|
|
471
|
-
chroma: STATUS_STOP[key].dark.chroma,
|
|
472
|
-
tone: STATUS_STOP[key].dark.tone,
|
|
473
|
-
}),
|
|
474
|
-
}
|
|
475
|
-
}
|
|
463
|
+
const status = deriveStatusHexes(surface)
|
|
476
464
|
|
|
477
465
|
return {
|
|
478
466
|
accent: { light: accentFill, dark: accentInkDark },
|
|
@@ -0,0 +1,85 @@
|
|
|
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'
|
|
9
|
+
import type { StatusKey, SurfaceKey } from './derive'
|
|
10
|
+
import { contrastRatio, hctToHex } from './hct'
|
|
11
|
+
|
|
12
|
+
type Side = 'light' | 'dark'
|
|
13
|
+
type Stop = { readonly tone: number; readonly chroma: number }
|
|
14
|
+
|
|
15
|
+
export const STATUS_HUE: Readonly<Record<StatusKey, number>> = {
|
|
16
|
+
good: 151.975,
|
|
17
|
+
warn: 76.64,
|
|
18
|
+
bad: 29.905,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const STATUS_STOP: Readonly<Record<StatusKey, Readonly<Record<Side, Stop>>>> = {
|
|
22
|
+
good: { light: { tone: 45.75, chroma: 37.75 }, dark: { tone: 70.23, chroma: 53.23 } },
|
|
23
|
+
warn: { light: { tone: 46, chroma: 61.12 }, dark: { tone: 72.34, chroma: 62.55 } },
|
|
24
|
+
bad: { light: { tone: 43.86, chroma: 54.46 }, dark: { tone: 66.5, chroma: 53.79 } },
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The surfaces status text is painted on — exhaustive, so a new `SurfaceKey` must pick a side. */
|
|
28
|
+
export const STATUS_TEXT_SURFACES: Readonly<Record<SurfaceKey, boolean>> = {
|
|
29
|
+
bg: true,
|
|
30
|
+
panel: true,
|
|
31
|
+
panelHover: true,
|
|
32
|
+
elevated: true,
|
|
33
|
+
subtle: true,
|
|
34
|
+
field: true,
|
|
35
|
+
border: false,
|
|
36
|
+
hairline: false,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const STATUS_TEXT_CONTRAST_MIN = 4.5
|
|
40
|
+
export const STATUS_TONE_STEP = 0.25
|
|
41
|
+
|
|
42
|
+
const TEXT_SURFACE_KEYS = (Object.keys(STATUS_TEXT_SURFACES) as SurfaceKey[]).filter(
|
|
43
|
+
(key) => STATUS_TEXT_SURFACES[key],
|
|
44
|
+
)
|
|
45
|
+
const STATUS_KEYS = Object.keys(STATUS_HUE) as StatusKey[]
|
|
46
|
+
|
|
47
|
+
/** The hex at the `step`-th tone from `stop` along the side's lightness axis (0 = the stop). */
|
|
48
|
+
export function statusHexAtStep(key: StatusKey, side: Side, step: number): string {
|
|
49
|
+
const stop = STATUS_STOP[key][side]
|
|
50
|
+
const direction = side === 'light' ? -1 : 1
|
|
51
|
+
return hctToHex({
|
|
52
|
+
hue: STATUS_HUE[key],
|
|
53
|
+
chroma: stop.chroma,
|
|
54
|
+
tone: stop.tone + direction * step * STATUS_TONE_STEP,
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function clearsEverySurface(hex: string, side: Side, surfaces: Record<SurfaceKey, ColorPair>) {
|
|
59
|
+
return TEXT_SURFACE_KEYS.every(
|
|
60
|
+
(key) => contrastRatio(hex, surfaces[key][side]) >= STATUS_TEXT_CONTRAST_MIN,
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function solve(key: StatusKey, side: Side, surfaces: Record<SurfaceKey, ColorPair>): string {
|
|
65
|
+
const { tone } = STATUS_STOP[key][side]
|
|
66
|
+
const maxSteps = Math.floor((side === 'light' ? tone : 100 - tone) / STATUS_TONE_STEP)
|
|
67
|
+
for (let step = 0; step <= maxSteps; step++) {
|
|
68
|
+
const hex = statusHexAtStep(key, side, step)
|
|
69
|
+
if (clearsEverySurface(hex, side, surfaces)) return hex
|
|
70
|
+
}
|
|
71
|
+
throw new Error(
|
|
72
|
+
`status text: no ${side} ${key} tone reaches ${STATUS_TEXT_CONTRAST_MIN}:1 on every surface`,
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The three status solids for a derived palette's surfaces. */
|
|
77
|
+
export function deriveStatusHexes(
|
|
78
|
+
surfaces: Record<SurfaceKey, ColorPair>,
|
|
79
|
+
): Record<StatusKey, ColorPair> {
|
|
80
|
+
const status = {} as Record<StatusKey, ColorPair>
|
|
81
|
+
for (const key of STATUS_KEYS) {
|
|
82
|
+
status[key] = { light: solve(key, 'light', surfaces), dark: solve(key, 'dark', surfaces) }
|
|
83
|
+
}
|
|
84
|
+
return status
|
|
85
|
+
}
|