basalt-ui 2.20.0 → 2.22.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 +72 -0
- package/MIGRATING.md +394 -12
- package/agent/agents/basalt-design-reviewer.md +22 -5
- package/agent/rules/basalt-tokens.md +3 -3
- package/agent/skills/basalt-design/SKILL.md +10 -23
- package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
- package/agent/skills/basalt-design/references/catalogue.md +49 -0
- package/agent/skills/basalt-design/references/concept.md +36 -0
- package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
- package/agent/skills/basalt-design/references/stat-tile.md +24 -0
- package/agent/templates/AGENTS-block.md.tpl +3 -3
- package/configs/oxlint-plugin.js +1 -0
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/BandStrip.js +27 -3
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +5 -0
- package/dist/charts/CartesianChart.d.ts +8 -0
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +8 -5
- package/dist/charts/ChartCard.d.ts +17 -4
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +33 -8
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +5 -8
- package/dist/charts/Heatmap.d.ts +12 -1
- package/dist/charts/Heatmap.d.ts.map +1 -1
- package/dist/charts/Heatmap.js +34 -5
- package/dist/charts/Lines.d.ts +3 -0
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +29 -6
- package/dist/charts/MirroredBars.d.ts.map +1 -1
- package/dist/charts/MirroredBars.js +4 -6
- package/dist/charts/Sparkline.d.ts +7 -1
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +39 -14
- package/dist/charts/StackedArea.d.ts +4 -1
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/StackedArea.js +9 -3
- package/dist/charts/band-fold.d.ts +20 -1
- package/dist/charts/band-fold.d.ts.map +1 -1
- package/dist/charts/band-fold.js +9 -0
- package/dist/charts/chart-box.module.css +19 -0
- package/dist/charts/chart-card.module.css +25 -0
- package/dist/charts/chart-legend.module.css +7 -0
- package/dist/charts/compile.d.ts +17 -6
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +145 -74
- package/dist/charts/labels.d.ts +15 -4
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +34 -10
- package/dist/charts/legend.d.ts +2 -0
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +7 -21
- package/dist/charts/marks.js +1 -1
- package/dist/charts/panel.d.ts +0 -6
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +1 -10
- package/dist/charts/ref-label.d.ts +26 -0
- package/dist/charts/ref-label.d.ts.map +1 -0
- package/dist/charts/ref-label.js +63 -0
- package/dist/charts/scales.d.ts +4 -1
- package/dist/charts/scales.d.ts.map +1 -1
- package/dist/charts/scales.js +14 -3
- package/dist/charts/sparkline.module.css +10 -11
- package/dist/charts/sparkline.module.css.d.ts +1 -2
- package/dist/charts/state.d.ts +7 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +4 -1
- package/dist/charts/types.d.ts +14 -5
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/check-theme.d.ts.map +1 -1
- package/dist/cli/check-theme.js +3 -0
- package/dist/cli/doctor-upgrade.d.ts +1 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +1 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +3 -2
- package/dist/cli/index.d.ts +4 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +27 -15
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +71 -6
- package/dist/cli/shot/capture.d.ts +21 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +200 -33
- package/dist/cli/shot/detect.d.ts +51 -0
- package/dist/cli/shot/detect.d.ts.map +1 -0
- package/dist/cli/shot/detect.js +409 -0
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +7 -4
- package/dist/cli/shot/measure.d.ts +2 -0
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +2 -0
- package/dist/cli/shot/playwright.d.ts +5 -2
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/types.d.ts +6 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/shot/types.js +4 -0
- package/dist/cli/sync.d.ts +2 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -2
- package/dist/common/retry-button.d.ts +12 -0
- package/dist/common/retry-button.d.ts.map +1 -0
- package/dist/common/retry-button.js +22 -0
- package/dist/common/retry-button.module.css +58 -0
- package/dist/common/retry-button.module.css.d.ts +8 -0
- package/dist/controls/controls.module.css +11 -1
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +1 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/controls/sync-button.js +22 -3
- package/dist/controls/sync-button.module.css +34 -2
- package/dist/controls/sync-button.module.css.d.ts +1 -0
- package/dist/dashboard/bar-list.d.ts +5 -2
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +9 -10
- package/dist/dashboard/bar-list.module.css +53 -0
- package/dist/dashboard/bar-list.module.css.d.ts +1 -0
- package/dist/dashboard/index.d.ts +1 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +2 -0
- package/dist/dashboard/meter-model.d.ts +108 -6
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +123 -19
- package/dist/dashboard/meter-parts.d.ts +8 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +345 -146
- package/dist/dashboard/meter.d.ts +50 -63
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +24 -3
- package/dist/dashboard/meter.module.css +79 -65
- package/dist/dashboard/meter.module.css.d.ts +7 -7
- package/dist/dashboard/page-summary.d.ts +20 -0
- package/dist/dashboard/page-summary.d.ts.map +1 -0
- package/dist/dashboard/page-summary.js +28 -0
- package/dist/dashboard/page-summary.module.css +89 -0
- package/dist/dashboard/page-summary.module.css.d.ts +15 -0
- package/dist/dashboard/query-state.d.ts +1 -1
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +3 -2
- package/dist/dashboard/section.d.ts +25 -2
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +10 -5
- package/dist/dashboard/section.module.css +23 -0
- package/dist/dashboard/section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +1 -1
- package/dist/dashboard/stat-card.d.ts +4 -2
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +7 -4
- package/dist/dashboard/stat-card.module.css +17 -0
- package/dist/dashboard/stat-strip.d.ts +24 -1
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +97 -39
- package/dist/dashboard/stat-strip.module.css +147 -17
- package/dist/dashboard/stat-strip.module.css.d.ts +8 -0
- package/dist/dashboard/visual-slot.d.ts +8 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -0
- package/dist/dashboard/visual-slot.js +7 -0
- package/dist/guard/index.d.ts +15 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +14 -0
- package/dist/guard/palette.d.ts +51 -0
- package/dist/guard/palette.d.ts.map +1 -0
- package/dist/guard/palette.js +190 -0
- package/dist/guard/series-file.d.ts +15 -0
- package/dist/guard/series-file.d.ts.map +1 -0
- package/dist/guard/series-file.js +29 -0
- package/dist/guard/types.d.ts +3 -3
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/guard/vx-names.d.ts.map +1 -1
- package/dist/guard/vx-names.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/styles.css +34 -2
- package/dist/surfaces.d.ts +1 -1
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +2 -0
- package/dist/theme/chrome-vars.d.ts +20 -5
- package/dist/theme/chrome-vars.d.ts.map +1 -1
- package/dist/theme/chrome-vars.js +46 -3
- package/dist/theme/controls.module.css +33 -0
- package/dist/theme/controls.module.css.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +11 -5
- package/dist/tokens/core.d.ts +2 -1
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +6 -1
- package/dist/tokens/derive.d.ts +3 -1
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +16 -1
- package/dist/tokens/oklab.d.ts +28 -0
- package/dist/tokens/oklab.d.ts.map +1 -0
- package/dist/tokens/oklab.js +73 -0
- package/dist/tokens/palette.d.ts +4 -0
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +4 -0
- package/dist/tokens/status-text.d.ts.map +1 -1
- package/dist/tokens/status-text.js +3 -1
- package/llms.txt +43 -23
- package/package.json +1 -1
- package/src/charts/BandStrip.tsx +33 -3
- package/src/charts/Bars.tsx +6 -0
- package/src/charts/CartesianChart.tsx +16 -3
- package/src/charts/ChartCard.tsx +43 -7
- package/src/charts/DualPanel.tsx +3 -6
- package/src/charts/Heatmap.tsx +54 -5
- package/src/charts/Lines.tsx +56 -10
- package/src/charts/MirroredBars.tsx +3 -5
- package/src/charts/Sparkline.tsx +50 -13
- package/src/charts/StackedArea.tsx +14 -4
- package/src/charts/band-fold.ts +31 -1
- package/src/charts/chart-box.module.css +19 -0
- package/src/charts/chart-card.module.css +25 -0
- package/src/charts/chart-legend.module.css +7 -0
- package/src/charts/compile.ts +210 -85
- package/src/charts/labels.ts +48 -14
- package/src/charts/legend.tsx +10 -20
- package/src/charts/marks.ts +1 -1
- package/src/charts/panel.tsx +1 -16
- package/src/charts/ref-label.ts +104 -0
- package/src/charts/scales.ts +22 -2
- package/src/charts/sparkline.module.css +10 -11
- package/src/charts/sparkline.module.css.d.ts +1 -2
- package/src/charts/state.tsx +12 -1
- package/src/charts/types.ts +14 -5
- package/src/cli/check-theme.ts +3 -0
- package/src/cli/doctor-upgrade.ts +1 -1
- package/src/cli/help.ts +18 -1
- package/src/cli/index.ts +48 -17
- package/src/cli/init.ts +102 -4
- package/src/cli/shot/capture.ts +266 -34
- package/src/cli/shot/detect.ts +550 -0
- package/src/cli/shot/index.ts +8 -4
- package/src/cli/shot/measure.ts +4 -0
- package/src/cli/shot/playwright.ts +2 -2
- package/src/cli/shot/types.ts +8 -1
- package/src/cli/sync.ts +4 -2
- package/src/common/retry-button.module.css +58 -0
- package/src/common/retry-button.module.css.d.ts +8 -0
- package/src/common/retry-button.tsx +29 -0
- package/src/controls/controls.module.css +11 -1
- package/src/controls/filter-pill.tsx +2 -0
- package/src/controls/sync-button.module.css +34 -2
- package/src/controls/sync-button.module.css.d.ts +1 -0
- package/src/controls/sync-button.tsx +40 -4
- package/src/dashboard/bar-list.module.css +53 -0
- package/src/dashboard/bar-list.module.css.d.ts +1 -0
- package/src/dashboard/bar-list.tsx +88 -76
- package/src/dashboard/index.ts +1 -0
- package/src/dashboard/meter-model.ts +265 -28
- package/src/dashboard/meter-parts.tsx +424 -163
- package/src/dashboard/meter.module.css +79 -65
- package/src/dashboard/meter.module.css.d.ts +7 -7
- package/src/dashboard/meter.tsx +77 -17
- package/src/dashboard/page-summary.module.css +89 -0
- package/src/dashboard/page-summary.module.css.d.ts +15 -0
- package/src/dashboard/page-summary.tsx +95 -0
- package/src/dashboard/query-state.tsx +4 -7
- package/src/dashboard/section.module.css +23 -0
- package/src/dashboard/section.module.css.d.ts +1 -0
- package/src/dashboard/section.tsx +59 -11
- package/src/dashboard/stat-card-parts.tsx +5 -1
- package/src/dashboard/stat-card.module.css +17 -0
- package/src/dashboard/stat-card.tsx +14 -5
- package/src/dashboard/stat-strip.module.css +147 -17
- package/src/dashboard/stat-strip.module.css.d.ts +8 -0
- package/src/dashboard/stat-strip.tsx +182 -56
- package/src/dashboard/visual-slot.ts +17 -0
- package/src/guard/index.ts +16 -4
- package/src/guard/palette.ts +261 -0
- package/src/guard/series-file.ts +51 -0
- package/src/guard/types.ts +3 -2
- package/src/guard/vx-names.ts +2 -0
- package/src/index.ts +2 -0
- package/src/styles.css +34 -2
- package/src/surfaces.ts +2 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +220 -60
- package/src/theme/chrome-vars.ts +77 -8
- package/src/theme/controls.module.css +33 -0
- package/src/theme/controls.module.css.d.ts +1 -0
- package/src/theme/index.ts +18 -5
- package/src/tokens/core.ts +4 -1
- package/src/tokens/derive.ts +32 -3
- package/src/tokens/oklab.ts +97 -0
- package/src/tokens/palette.ts +4 -0
- package/src/tokens/status-text.ts +2 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* StatGroup `variant="strip"`: one joined surface, cells split by 1px hairlines.
|
|
3
3
|
*
|
|
4
|
-
* The hairlines are LEADING
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* coloured edge: the one
|
|
4
|
+
* The hairlines are LEADING edges (inline-start + block-start) drawn as outer box-shadows, so they
|
|
5
|
+
* take no layout space and every cell keeps the same `stack-md` inset. `.clip` hides the ones that
|
|
6
|
+
* lead a row or the strip by pulling the grid 1px up/left inside an `overflow: hidden` box. That is
|
|
7
|
+
* why the rail survives any column count and any wrap with no `nth-child` bookkeeping
|
|
8
|
+
* (`stat-group.module.css` needs it because its cells are not clipped). No coloured edge: the one
|
|
9
|
+
* surface is the Card's.
|
|
9
10
|
*
|
|
10
11
|
* The column law keys on the CONTAINER like `StatGroup`'s own: two columns at < 480px (the `regular` class boundary) with an odd
|
|
11
12
|
* last cell spanning, never one; up to three below 800px; the full `cols` from 800px.
|
|
@@ -26,19 +27,86 @@
|
|
|
26
27
|
margin: -1px 0 0 -1px;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/* The CELL is the row-high column: it owns the hairlines, so they run the whole row however short
|
|
31
|
+
* the cell inside it ends. It paints nothing else — the one surface stays the Card's. */
|
|
29
32
|
.cell {
|
|
30
|
-
display:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
display: grid;
|
|
34
|
+
grid-row: span 6;
|
|
35
|
+
grid-template-rows: subgrid;
|
|
33
36
|
min-width: 0;
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
/* The foot inset lives HERE, on the row-high slot (it lands on the last track of every cell
|
|
38
|
+
* alike). A cell that ends early must not carry it: its padding would inflate the shared track
|
|
39
|
+
* it ends in and push the parts below out of line. */
|
|
40
|
+
padding-block-end: var(--vx-space-stack-md);
|
|
41
|
+
box-shadow:
|
|
42
|
+
-1px 0 0 var(--vx-divider),
|
|
43
|
+
0 -1px 0 var(--vx-divider);
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
/* The
|
|
39
|
-
*
|
|
40
|
-
.
|
|
41
|
-
|
|
46
|
+
/* The CONTENT spans the same six tracks (parts align through the subgrid) but is `align-self: start`,
|
|
47
|
+
* so its own box ends at its content instead of at the row's bottom. */
|
|
48
|
+
.content {
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-row: 1 / span var(--basalt-strip-span, 6);
|
|
51
|
+
grid-template-rows: subgrid;
|
|
52
|
+
align-self: start;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
padding: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Forced colors drop box-shadows, so the hairlines come back as CanvasText borders. Every cell takes
|
|
58
|
+
* both, so they stay level with each other; `.clip` still hides the leading ones. */
|
|
59
|
+
@media (forced-colors: active) {
|
|
60
|
+
.cell {
|
|
61
|
+
border-inline-start: 1px solid CanvasText;
|
|
62
|
+
border-block-start: 1px solid CanvasText;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Cells align by PART. Every cell sits on the same six tracks of `.cells` (caption, hero, hero footer,
|
|
67
|
+
* visual, rows, footer), so a row of cells shares one caption top and one value baseline, and a void opens
|
|
68
|
+
* only where a sibling's same part is taller. A cell SPANS only down to its last part
|
|
69
|
+
* (`--basalt-strip-span`), so its own box ends at its content; the slot around it runs the whole
|
|
70
|
+
* row. A part a cell lacks collapses its track (the spacing is a margin on the part, not a gap).
|
|
71
|
+
* A footer rides with what it captions: under a hero alone it takes the hero-footer track right
|
|
72
|
+
* below the hero, under a visual it rides in the visual track (`.visualStack`); only a rows
|
|
73
|
+
* cell's footer uses the shared footer track. A hero-less cell (rows only) starts its rows in the
|
|
74
|
+
* visual track, so the hero track above them is the one void, and only as tall as a sibling's
|
|
75
|
+
* value. */
|
|
76
|
+
.content > * {
|
|
77
|
+
grid-column: 1;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.content > :not(.captionLine) {
|
|
82
|
+
margin-block-start: var(--vx-space-stack-sm);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.valueRow,
|
|
86
|
+
.skeletonValue,
|
|
87
|
+
.error {
|
|
88
|
+
grid-row: 2;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* A hero's footer has its own track right under the hero track, so it hugs the value however tall a
|
|
92
|
+
* sibling's visual is, and a cell without a footer never spans (or reserves) it. */
|
|
93
|
+
.content > .heroFooter {
|
|
94
|
+
grid-row: 3;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.content > .visualStack,
|
|
98
|
+
.content > .reason,
|
|
99
|
+
.content > .rows {
|
|
100
|
+
grid-row: 4;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.content[data-strip-has-visual] > .rows {
|
|
104
|
+
grid-row: 5;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.content > .footer:not(.heroFooter) {
|
|
108
|
+
grid-row: 6;
|
|
109
|
+
align-self: start;
|
|
42
110
|
}
|
|
43
111
|
|
|
44
112
|
@container basalt-grid (max-width: 479.9px) {
|
|
@@ -58,7 +126,18 @@
|
|
|
58
126
|
}
|
|
59
127
|
|
|
60
128
|
.captionLine {
|
|
129
|
+
grid-row: 1;
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-wrap: nowrap;
|
|
132
|
+
align-items: center;
|
|
133
|
+
column-gap: var(--vx-space-control-gap);
|
|
134
|
+
min-width: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Caption + qualifier wrap among themselves; the `action` beside them never joins the wrap. */
|
|
138
|
+
.captionMain {
|
|
61
139
|
display: flex;
|
|
140
|
+
flex: 1 1 0;
|
|
62
141
|
flex-wrap: wrap;
|
|
63
142
|
align-items: center;
|
|
64
143
|
column-gap: var(--vx-space-control-gap);
|
|
@@ -96,6 +175,14 @@
|
|
|
96
175
|
overflow-wrap: anywhere;
|
|
97
176
|
}
|
|
98
177
|
|
|
178
|
+
/* A control at the end of the caption line: it keeps its size, the caption truncates first. */
|
|
179
|
+
.action {
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
flex: none;
|
|
182
|
+
align-items: center;
|
|
183
|
+
margin-inline-start: auto;
|
|
184
|
+
}
|
|
185
|
+
|
|
99
186
|
.valueRow {
|
|
100
187
|
display: flex;
|
|
101
188
|
flex-wrap: wrap;
|
|
@@ -129,7 +216,7 @@
|
|
|
129
216
|
height: calc(var(--vx-text-kpi) * 1.25);
|
|
130
217
|
}
|
|
131
218
|
|
|
132
|
-
.
|
|
219
|
+
.content[data-stale] {
|
|
133
220
|
/* The package's one dimmed-state value (controls.module.css, panel-row.module.css). */
|
|
134
221
|
opacity: 0.55;
|
|
135
222
|
}
|
|
@@ -143,10 +230,14 @@
|
|
|
143
230
|
min-width: 0;
|
|
144
231
|
}
|
|
145
232
|
|
|
233
|
+
.visualStack > .footer {
|
|
234
|
+
margin-block-start: var(--vx-space-stack-sm);
|
|
235
|
+
}
|
|
236
|
+
|
|
146
237
|
/* A Sparkline's hover readout takes this line above its plot (`charts/sparkline.module.css`). The
|
|
147
238
|
* cell's own stack gap already sits above it; the slot reserves the rest, so the chip never covers
|
|
148
239
|
* the value. */
|
|
149
|
-
.
|
|
240
|
+
.content {
|
|
150
241
|
--basalt-spark-readout-h: 1.125rem;
|
|
151
242
|
}
|
|
152
243
|
|
|
@@ -154,8 +245,36 @@
|
|
|
154
245
|
padding-top: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
|
|
155
246
|
}
|
|
156
247
|
|
|
248
|
+
/* An empty cell's reason and an errored cell's message: one muted `sm` line, wrapping rather than
|
|
249
|
+
* clipping (a 390px two-column cell is ~170px wide). */
|
|
250
|
+
.reason {
|
|
251
|
+
margin: 0;
|
|
252
|
+
min-width: 0;
|
|
253
|
+
font-size: var(--vx-text-sm);
|
|
254
|
+
line-height: 1.3;
|
|
255
|
+
color: var(--vx-muted);
|
|
256
|
+
overflow-wrap: anywhere;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* The compact error anatomy: dot + word, the message, Retry — a left-aligned stack in the cell. */
|
|
260
|
+
.error {
|
|
261
|
+
display: flex;
|
|
262
|
+
flex-direction: column;
|
|
263
|
+
align-items: flex-start;
|
|
264
|
+
gap: var(--vx-space-stack-xs);
|
|
265
|
+
min-width: 0;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.errorHead {
|
|
269
|
+
display: inline-flex;
|
|
270
|
+
align-items: center;
|
|
271
|
+
gap: var(--vx-space-stack-sm);
|
|
272
|
+
font-size: var(--vx-text-sm);
|
|
273
|
+
font-weight: 500;
|
|
274
|
+
color: var(--vx-ink);
|
|
275
|
+
}
|
|
276
|
+
|
|
157
277
|
.footer {
|
|
158
|
-
margin-top: auto;
|
|
159
278
|
font-size: var(--vx-text-sm);
|
|
160
279
|
color: var(--vx-muted);
|
|
161
280
|
}
|
|
@@ -199,6 +318,17 @@
|
|
|
199
318
|
margin-left: -1px;
|
|
200
319
|
}
|
|
201
320
|
|
|
321
|
+
/* A meter's start and end captions read as one phrase (name, then value) however wide the track. */
|
|
322
|
+
.footerCell [data-meter-captions] {
|
|
323
|
+
justify-content: flex-start;
|
|
324
|
+
column-gap: var(--vx-space-stack-md);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.footerCell [data-meter-captions] > * {
|
|
328
|
+
margin-inline-start: 0;
|
|
329
|
+
text-align: start;
|
|
330
|
+
}
|
|
331
|
+
|
|
202
332
|
.footerCell {
|
|
203
333
|
flex: 1 1 14rem;
|
|
204
334
|
min-width: 0;
|
|
@@ -7,16 +7,24 @@ declare const classes: {
|
|
|
7
7
|
readonly clip: string
|
|
8
8
|
readonly cells: string
|
|
9
9
|
readonly cell: string
|
|
10
|
+
readonly content: string
|
|
11
|
+
readonly action: string
|
|
10
12
|
readonly captionLine: string
|
|
13
|
+
readonly captionMain: string
|
|
11
14
|
readonly lead: string
|
|
12
15
|
readonly caption: string
|
|
13
16
|
readonly qualifier: string
|
|
14
17
|
readonly valueRow: string
|
|
18
|
+
readonly heroFooter: string
|
|
15
19
|
readonly value: string
|
|
16
20
|
readonly unit: string
|
|
17
21
|
readonly skeletonValue: string
|
|
18
22
|
readonly skeletonRow: string
|
|
19
23
|
readonly visual: string
|
|
24
|
+
readonly visualStack: string
|
|
25
|
+
readonly reason: string
|
|
26
|
+
readonly error: string
|
|
27
|
+
readonly errorHead: string
|
|
20
28
|
readonly footer: string
|
|
21
29
|
readonly rows: string
|
|
22
30
|
readonly row: string
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Tone } from '../common/props.js';
|
|
2
|
+
export interface VisualSlot {
|
|
3
|
+
readonly tone?: Tone;
|
|
4
|
+
}
|
|
5
|
+
/** A host with no verdict of its own: one shared object, so a provider never re-renders its readers. */
|
|
6
|
+
export declare const HOSTED: VisualSlot;
|
|
7
|
+
export declare const VisualSlotContext: import("react").Context<VisualSlot | null>;
|
|
8
|
+
//# sourceMappingURL=visual-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual-slot.d.ts","sourceRoot":"","sources":["../../src/dashboard/visual-slot.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CACrB;AAED,wGAAwG;AACxG,eAAO,MAAM,MAAM,EAAE,UAAe,CAAA;AAEpC,eAAO,MAAM,iBAAiB,4CAAyC,CAAA"}
|
package/dist/guard/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (`tokens/space-scale`, `common/*`), never `tokens/palette` or `derive` (colour math on every
|
|
4
4
|
* Write/Edit).
|
|
5
5
|
*
|
|
6
|
-
* GUARD_RULES: the closed registry of all
|
|
6
|
+
* GUARD_RULES: the closed registry of all 27 violation kinds.
|
|
7
7
|
* checkSource: pure (text, relPath, cfg) → Finding[]. No FS, no walk, no console.
|
|
8
8
|
*/
|
|
9
9
|
import type { Finding, GuardConfig, GuardKind, GuardSeverity } from './types.js';
|
|
@@ -70,6 +70,13 @@ export type GraceEntry = {
|
|
|
70
70
|
* }
|
|
71
71
|
*/
|
|
72
72
|
export declare const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>>;
|
|
73
|
+
/** A kind's effective severity: consumer override first, then the grace table, then `error`. */
|
|
74
|
+
export declare function severityOf(kind: GuardKind, cfg: GuardConfig): GuardSeverity;
|
|
75
|
+
/**
|
|
76
|
+
* Whether `kind` is exempted at `relPath` via `cfg.exemptRules` — the config-driven, per-rule
|
|
77
|
+
* counterpart to `isChartFile`'s hardcoded path scoping.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isRuleExempt(kind: GuardKind, relPath: string, exemptRules: GuardConfig['exemptRules']): boolean;
|
|
73
80
|
/** One `exemptRules` entry that suppressed nothing, and why — see {@link unmatchedExemptPatterns}. */
|
|
74
81
|
export type UnmatchedExemptPattern = {
|
|
75
82
|
readonly kind: string;
|
|
@@ -143,7 +150,7 @@ export declare const GENERATED_HEADER_LINE = "/* @generated basalt-ui \u2014 do
|
|
|
143
150
|
*/
|
|
144
151
|
export declare const TOKENS_ONLY_DISABLED_KINDS: ReadonlySet<GuardKind>;
|
|
145
152
|
/**
|
|
146
|
-
* The closed registry of all
|
|
153
|
+
* The closed registry of all 27 guard kinds. The triad test asserts
|
|
147
154
|
* `surface.guardKinds ⊆ keyof GUARD_RULES` at runtime.
|
|
148
155
|
*
|
|
149
156
|
* raw-surface, raw-html-layout, and sub-16-input-font are handled inline in checkSource
|
|
@@ -316,6 +323,12 @@ export declare const GUARD_RULES: {
|
|
|
316
323
|
readonly pattern: RegExp;
|
|
317
324
|
readonly message: `var() names a --vx-* token basalt does not emit, so it resolves to its fallback (or to nothing) with no error anywhere. Judged: every name inside a basalt-owned family (${string}), plus any name basalt used to emit in any family \u2014 pick the token from the stylesheet basalt-ui tokens:css emits; your own series belong in a family of their own (groupTokens throws on one inside basalt's, in dev builds). A removed name is reported with its replacement on the finding line (MIGRATING.md has the table). Any other name outside a basalt family is never judged, because groupTokens may declare it in a file this scan cannot see.`;
|
|
318
325
|
};
|
|
326
|
+
readonly 'series-palette': {
|
|
327
|
+
readonly kind: "series-palette";
|
|
328
|
+
readonly pattern: RegExp;
|
|
329
|
+
readonly appliesTo: () => false;
|
|
330
|
+
readonly message: "The series file's palette fails a computed check (OKLCH lightness band, chroma floor, colour-blind separation of neighbours, worst-pair separation, 3:1 contrast against the surface, ≤ 8 series without a repeat) — retune the hex in the series file; it is judged per scheme, light against the light panel and dark against the dark one. A deliberately neutral series is keyed `other`.";
|
|
331
|
+
};
|
|
319
332
|
};
|
|
320
333
|
/**
|
|
321
334
|
* The one-line remedy for `kind`, as a report reads it: `raw-hex: Route color through VX.* / …`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAO7E,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,CAAA;AAgU9D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CA8BpE,CAAA;AA8cD,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,EAAE,WAiBlC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"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"}
|
package/dist/guard/index.js
CHANGED
|
@@ -266,6 +266,11 @@ const GRACE_PERIOD_KINDS = {
|
|
|
266
266
|
since: "2.16.0",
|
|
267
267
|
promote: "2.24.0",
|
|
268
268
|
why: "The scale moved to 8/12/16/20/24 and the CSS micro ceiling dropped 10 \u2192 7 in 2.16.0: a literal 8px/10px in CSS is newly a finding."
|
|
269
|
+
},
|
|
270
|
+
"series-palette": {
|
|
271
|
+
since: "2.21.0",
|
|
272
|
+
promote: "2.23.0",
|
|
273
|
+
why: "New in 2.21.0: the series file is judged by computed lightness, chroma, colour-blind separation and contrast; a palette that was tuned by eye is newly a finding."
|
|
269
274
|
}
|
|
270
275
|
};
|
|
271
276
|
function severityOf(kind, cfg) {
|
|
@@ -950,6 +955,13 @@ const GUARD_RULES = {
|
|
|
950
955
|
pattern: VX_VAR_REF,
|
|
951
956
|
// handled inline (basalt-owned families); entry keeps the registry complete
|
|
952
957
|
message: `var() names a --vx-* token basalt does not emit, so it resolves to its fallback (or to nothing) with no error anywhere. Judged: every name inside a basalt-owned family (${[...BASALT_VX_FAMILY_SET].join(", ")}), plus any name basalt used to emit in any family \u2014 pick the token from the stylesheet basalt-ui tokens:css emits; your own series belong in a family of their own (groupTokens throws on one inside basalt's, in dev builds). A removed name is reported with its replacement on the finding line (MIGRATING.md has the table). Any other name outside a basalt family is never judged, because groupTokens may declare it in a file this scan cannot see.`
|
|
958
|
+
},
|
|
959
|
+
"series-palette": {
|
|
960
|
+
kind: "series-palette",
|
|
961
|
+
pattern: /(?!)/,
|
|
962
|
+
// never matches: judged over the whole series FILE by `series-file.ts`, not per line
|
|
963
|
+
appliesTo: () => false,
|
|
964
|
+
message: "The series file's palette fails a computed check (OKLCH lightness band, chroma floor, colour-blind separation of neighbours, worst-pair separation, 3:1 contrast against the surface, \u2264 8 series without a repeat) \u2014 retune the hex in the series file; it is judged per scheme, light against the light panel and dark against the dark one. A deliberately neutral series is keyed `other`."
|
|
953
965
|
}
|
|
954
966
|
};
|
|
955
967
|
function guardKindRemedy(kind) {
|
|
@@ -1307,6 +1319,8 @@ export {
|
|
|
1307
1319
|
findAllowAnnotations,
|
|
1308
1320
|
guardKindRemedy,
|
|
1309
1321
|
guardWaiverHint,
|
|
1322
|
+
isRuleExempt,
|
|
1310
1323
|
neutralizeAllowAnnotation,
|
|
1324
|
+
severityOf,
|
|
1311
1325
|
unmatchedExemptPatterns
|
|
1312
1326
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type SeriesScheme = 'light' | 'dark';
|
|
2
|
+
/** The surface each scheme's series are judged against. */
|
|
3
|
+
export type SeriesSurfaces = Record<SeriesScheme, string>;
|
|
4
|
+
export type SeriesCheck = 'format' | 'lightness' | 'chroma' | 'cvd' | 'separation' | 'contrast' | 'order';
|
|
5
|
+
export type SeriesEntry = {
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly light: string;
|
|
8
|
+
readonly dark: string;
|
|
9
|
+
/** 1-based line of the entry in the scanned source. */
|
|
10
|
+
readonly line: number;
|
|
11
|
+
};
|
|
12
|
+
export type SeriesGroup = {
|
|
13
|
+
readonly line: number;
|
|
14
|
+
readonly entries: readonly SeriesEntry[];
|
|
15
|
+
};
|
|
16
|
+
export type SeriesIssue = {
|
|
17
|
+
readonly check: SeriesCheck;
|
|
18
|
+
readonly scheme: SeriesScheme;
|
|
19
|
+
readonly keys: readonly string[];
|
|
20
|
+
readonly measured: number;
|
|
21
|
+
readonly threshold: number;
|
|
22
|
+
/** Line of the first named key. */
|
|
23
|
+
readonly line: number;
|
|
24
|
+
readonly message: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* OKLCH lightness bands, per scheme.
|
|
28
|
+
* - light [0.43, 0.77] — the brief's band: below 0.43 a series reads as ink, above 0.77 it washes
|
|
29
|
+
* out on the panel (3:1 bites earlier, near L 0.67, on the default light panel).
|
|
30
|
+
* - dark [0.58, 0.88] — lower bound is where a hue clears 3:1 against the default dark panel
|
|
31
|
+
* (#2b2b2e, L 0.29 → L ≈ 0.56, rounded up for margin); the upper bound keeps a clear step below
|
|
32
|
+
* white so a bright series does not glow against the dark page.
|
|
33
|
+
*/
|
|
34
|
+
export declare const LIGHTNESS_BAND: Record<SeriesScheme, readonly [number, number]>;
|
|
35
|
+
/** Minimum OKLCH chroma of a categorical hue. */
|
|
36
|
+
export declare const CHROMA_FLOOR = 0.1;
|
|
37
|
+
/** Minimum OKLab ΔE×100 between ADJACENT series under protanopia and deuteranopia. */
|
|
38
|
+
export declare const CVD_ADJACENT_MIN = 8;
|
|
39
|
+
/** Minimum OKLab ΔE×100 of the worst pair in a group, normal vision. */
|
|
40
|
+
export declare const SEPARATION_MIN = 15;
|
|
41
|
+
/** Minimum WCAG contrast of a series against its scheme's surface. */
|
|
42
|
+
export declare const CONTRAST_MIN = 3;
|
|
43
|
+
/** More categorical series than this and the next one folds into Other. */
|
|
44
|
+
export declare const MAX_SERIES = 8;
|
|
45
|
+
/** The one escape: a series keyed `other` is deliberately neutral — exempt from the chroma floor only. */
|
|
46
|
+
export declare const NEUTRAL_KEY = "other";
|
|
47
|
+
/** Every `defineSeries(...)` call in `source`, as an ordered group of its literal `{ light, dark }` hex pairs. */
|
|
48
|
+
export declare function parseSeriesGroups(source: string): SeriesGroup[];
|
|
49
|
+
/** Judge every group against the six checks. */
|
|
50
|
+
export declare function auditSeriesGroups(groups: readonly SeriesGroup[], surfaces: SeriesSurfaces): SeriesIssue[];
|
|
51
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/guard/palette.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,CAAA;AAC3C,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAEzD,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,KAAK,GACL,YAAY,GACZ,UAAU,GACV,OAAO,CAAA;AAEX,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB,CAAA;AACD,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAA;CAAE,CAAA;AAE7F,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAG1E,CAAA;AACD,iDAAiD;AACjD,eAAO,MAAM,YAAY,MAAM,CAAA;AAC/B,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,IAAI,CAAA;AACjC,wEAAwE;AACxE,eAAO,MAAM,cAAc,KAAK,CAAA;AAChC,sEAAsE;AACtE,eAAO,MAAM,YAAY,IAAI,CAAA;AAC7B,2EAA2E;AAC3E,eAAO,MAAM,UAAU,IAAI,CAAA;AAC3B,0GAA0G;AAC1G,eAAO,MAAM,WAAW,UAAU,CAAA;AAUlC,kHAAkH;AAClH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CA4B/D;AAID,gDAAgD;AAChD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,QAAQ,EAAE,cAAc,GACvB,WAAW,EAAE,CAgJf"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { contrastRatio } from "../tokens/hct.js";
|
|
2
|
+
import { deltaEOk, deltaEOkCvd, hexToOklch } from "../tokens/oklab.js";
|
|
3
|
+
const LIGHTNESS_BAND = {
|
|
4
|
+
light: [0.43, 0.77],
|
|
5
|
+
dark: [0.58, 0.88]
|
|
6
|
+
};
|
|
7
|
+
const CHROMA_FLOOR = 0.1;
|
|
8
|
+
const CVD_ADJACENT_MIN = 8;
|
|
9
|
+
const SEPARATION_MIN = 15;
|
|
10
|
+
const CONTRAST_MIN = 3;
|
|
11
|
+
const MAX_SERIES = 8;
|
|
12
|
+
const NEUTRAL_KEY = "other";
|
|
13
|
+
const HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
14
|
+
const ENTRY = /([A-Za-z_$][\w$]*|'[^']+'|"[^"]+")\s*:\s*\{\s*(?:light\s*:\s*(['"])(.*?)\2\s*,\s*dark\s*:\s*(['"])(.*?)\4|dark\s*:\s*(['"])(.*?)\6\s*,\s*light\s*:\s*(['"])(.*?)\8)/g;
|
|
15
|
+
const lineOf = (text, at) => text.slice(0, at).split("\n").length;
|
|
16
|
+
function parseSeriesGroups(source) {
|
|
17
|
+
const groups = [];
|
|
18
|
+
for (const call of source.matchAll(/\bdefineSeries\s*\(/g)) {
|
|
19
|
+
const open = (call.index ?? 0) + call[0].length;
|
|
20
|
+
const lineStart = source.lastIndexOf("\n", call.index ?? 0) + 1;
|
|
21
|
+
if (/^\s*(?:\/\/|\*|\/\*)/.test(source.slice(lineStart, call.index))) continue;
|
|
22
|
+
let depth = 1;
|
|
23
|
+
let end = open;
|
|
24
|
+
while (end < source.length && depth > 0) {
|
|
25
|
+
const ch = source[end];
|
|
26
|
+
if (ch === "(") depth += 1;
|
|
27
|
+
else if (ch === ")") depth -= 1;
|
|
28
|
+
end += 1;
|
|
29
|
+
}
|
|
30
|
+
const body = source.slice(open, end);
|
|
31
|
+
const entries = [...body.matchAll(ENTRY)].map((m) => {
|
|
32
|
+
const light = m[3] ?? m[9] ?? "";
|
|
33
|
+
const dark = m[5] ?? m[7] ?? "";
|
|
34
|
+
return {
|
|
35
|
+
key: (m[1] ?? "").replace(/^['"]|['"]$/g, ""),
|
|
36
|
+
light: light.trim(),
|
|
37
|
+
dark: dark.trim(),
|
|
38
|
+
line: lineOf(source, open + (m.index ?? 0))
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
groups.push({ line: lineOf(source, call.index ?? 0), entries });
|
|
42
|
+
}
|
|
43
|
+
return groups;
|
|
44
|
+
}
|
|
45
|
+
const fix = (n, digits = 2) => n.toFixed(digits);
|
|
46
|
+
function auditSeriesGroups(groups, surfaces) {
|
|
47
|
+
const issues = [];
|
|
48
|
+
for (const group of groups) {
|
|
49
|
+
const { entries: allEntries } = group;
|
|
50
|
+
const lineOfKey = (key) => allEntries.find((e) => e.key === key)?.line ?? group.line;
|
|
51
|
+
const categorical = allEntries.filter((e) => e.key !== NEUTRAL_KEY);
|
|
52
|
+
if (categorical.length > MAX_SERIES) {
|
|
53
|
+
const extra = categorical.slice(MAX_SERIES).map((e) => e.key);
|
|
54
|
+
issues.push({
|
|
55
|
+
check: "order",
|
|
56
|
+
scheme: "light",
|
|
57
|
+
keys: extra,
|
|
58
|
+
measured: categorical.length,
|
|
59
|
+
threshold: MAX_SERIES,
|
|
60
|
+
line: lineOfKey(extra[0] ?? ""),
|
|
61
|
+
message: `${categorical.length} series in one group (max ${MAX_SERIES}) \u2014 ${extra.join(", ")} should fold into \`${NEUTRAL_KEY}\``
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
for (const scheme of ["light", "dark"]) {
|
|
65
|
+
const [lo, hi] = LIGHTNESS_BAND[scheme];
|
|
66
|
+
const value = (e) => e[scheme];
|
|
67
|
+
const entries = allEntries.filter((e) => {
|
|
68
|
+
if (HEX.test(value(e))) return true;
|
|
69
|
+
issues.push({
|
|
70
|
+
check: "format",
|
|
71
|
+
scheme,
|
|
72
|
+
keys: [e.key],
|
|
73
|
+
measured: 0,
|
|
74
|
+
threshold: 0,
|
|
75
|
+
line: e.line,
|
|
76
|
+
message: `${e.key} (${scheme}) "${value(e)}" is not a #rgb or #rrggbb hex \u2014 it cannot be checked`
|
|
77
|
+
});
|
|
78
|
+
return false;
|
|
79
|
+
});
|
|
80
|
+
for (const e of entries) {
|
|
81
|
+
const { L, C } = hexToOklch(value(e));
|
|
82
|
+
if (L < lo || L > hi) {
|
|
83
|
+
issues.push({
|
|
84
|
+
check: "lightness",
|
|
85
|
+
scheme,
|
|
86
|
+
keys: [e.key],
|
|
87
|
+
measured: L,
|
|
88
|
+
threshold: L < lo ? lo : hi,
|
|
89
|
+
line: e.line,
|
|
90
|
+
message: `${e.key} (${scheme}) OKLCH lightness ${fix(L)} is outside ${lo}\u2013${hi}`
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (e.key !== NEUTRAL_KEY && C < CHROMA_FLOOR) {
|
|
94
|
+
issues.push({
|
|
95
|
+
check: "chroma",
|
|
96
|
+
scheme,
|
|
97
|
+
keys: [e.key],
|
|
98
|
+
measured: C,
|
|
99
|
+
threshold: CHROMA_FLOOR,
|
|
100
|
+
line: e.line,
|
|
101
|
+
message: `${e.key} (${scheme}) OKLCH chroma ${fix(C, 3)} is below ${CHROMA_FLOOR} \u2014 a categorical hue must read as a hue (key a deliberately neutral series \`${NEUTRAL_KEY}\`)`
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const ratio = contrastRatio(value(e), surfaces[scheme]);
|
|
105
|
+
if (ratio < CONTRAST_MIN) {
|
|
106
|
+
issues.push({
|
|
107
|
+
check: "contrast",
|
|
108
|
+
scheme,
|
|
109
|
+
keys: [e.key],
|
|
110
|
+
measured: ratio,
|
|
111
|
+
threshold: CONTRAST_MIN,
|
|
112
|
+
line: e.line,
|
|
113
|
+
message: `${e.key} (${scheme}) contrast ${fix(ratio)}:1 against the surface is below ${CONTRAST_MIN}:1`
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const seen = /* @__PURE__ */ new Map();
|
|
118
|
+
const duplicated = /* @__PURE__ */ new Set();
|
|
119
|
+
for (const e of entries) {
|
|
120
|
+
const first = seen.get(value(e).toLowerCase());
|
|
121
|
+
if (first === void 0) seen.set(value(e).toLowerCase(), e.key);
|
|
122
|
+
else {
|
|
123
|
+
duplicated.add(`${first}|${e.key}`);
|
|
124
|
+
issues.push({
|
|
125
|
+
check: "order",
|
|
126
|
+
scheme,
|
|
127
|
+
keys: [first, e.key],
|
|
128
|
+
measured: 0,
|
|
129
|
+
threshold: SEPARATION_MIN,
|
|
130
|
+
line: e.line,
|
|
131
|
+
message: `${first} and ${e.key} (${scheme}) are the same colour ${value(e)} \u2014 a group does not cycle`
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (let i = 1; i < entries.length; i += 1) {
|
|
136
|
+
const a = entries[i - 1];
|
|
137
|
+
const b = entries[i];
|
|
138
|
+
if (duplicated.has(`${a.key}|${b.key}`)) continue;
|
|
139
|
+
const sims = ["protan", "deutan"].map(
|
|
140
|
+
(kind2) => [kind2, deltaEOkCvd(value(a), value(b), kind2)]
|
|
141
|
+
);
|
|
142
|
+
const [kind, worst] = sims.reduce((m, s) => s[1] < m[1] ? s : m);
|
|
143
|
+
if (worst < CVD_ADJACENT_MIN) {
|
|
144
|
+
issues.push({
|
|
145
|
+
check: "cvd",
|
|
146
|
+
scheme,
|
|
147
|
+
keys: [a.key, b.key],
|
|
148
|
+
measured: worst,
|
|
149
|
+
threshold: CVD_ADJACENT_MIN,
|
|
150
|
+
line: b.line,
|
|
151
|
+
message: `${a.key} \u2192 ${b.key} (${scheme}) are \u0394E ${fix(worst, 1)} apart under ${kind === "protan" ? "protanopia" : "deuteranopia"}, below ${CVD_ADJACENT_MIN}`
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
let worstPair = null;
|
|
156
|
+
for (let i = 0; i < entries.length; i += 1) {
|
|
157
|
+
for (let j = i + 1; j < entries.length; j += 1) {
|
|
158
|
+
const a = entries[i];
|
|
159
|
+
const b = entries[j];
|
|
160
|
+
if (duplicated.has(`${a.key}|${b.key}`)) continue;
|
|
161
|
+
const de = deltaEOk(value(a), value(b));
|
|
162
|
+
if (worstPair === null || de < worstPair.de) worstPair = { a, b, de };
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (worstPair !== null && worstPair.de < SEPARATION_MIN) {
|
|
166
|
+
issues.push({
|
|
167
|
+
check: "separation",
|
|
168
|
+
scheme,
|
|
169
|
+
keys: [worstPair.a.key, worstPair.b.key],
|
|
170
|
+
measured: worstPair.de,
|
|
171
|
+
threshold: SEPARATION_MIN,
|
|
172
|
+
line: worstPair.b.line,
|
|
173
|
+
message: `${worstPair.a.key} and ${worstPair.b.key} (${scheme}) are only \u0394E ${fix(worstPair.de, 1)} apart, below ${SEPARATION_MIN}`
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return issues;
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
CHROMA_FLOOR,
|
|
182
|
+
CONTRAST_MIN,
|
|
183
|
+
CVD_ADJACENT_MIN,
|
|
184
|
+
LIGHTNESS_BAND,
|
|
185
|
+
MAX_SERIES,
|
|
186
|
+
NEUTRAL_KEY,
|
|
187
|
+
SEPARATION_MIN,
|
|
188
|
+
auditSeriesGroups,
|
|
189
|
+
parseSeriesGroups
|
|
190
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SeriesSurfaces } from './palette.js';
|
|
2
|
+
import type { Finding, GuardConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Judge ONE series file's palette: one finding per failed check, naming the key(s), scheme,
|
|
5
|
+
* measured number and threshold. The series module is exempt from every line-scan kind, so it is
|
|
6
|
+
* judged here instead. Honors `severity` and `exemptRules` like any other kind.
|
|
7
|
+
*/
|
|
8
|
+
export declare function checkSeriesPalette(source: string, relPath: string, cfg: GuardConfig, surfaces: SeriesSurfaces): Finding[];
|
|
9
|
+
/**
|
|
10
|
+
* Findings for the series module at `<cwd>/<rel>`; none if it does not exist. Surfaces are the
|
|
11
|
+
* derive engine's default `surface.panel` (a chart sits on a panel) — a consumer's `derive`
|
|
12
|
+
* overrides are not read.
|
|
13
|
+
*/
|
|
14
|
+
export declare function checkSeriesModule(cwd: string, rel: string, cfg: GuardConfig): Finding[];
|
|
15
|
+
//# sourceMappingURL=series-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"series-file.d.ts","sourceRoot":"","sources":["../../src/guard/series-file.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEnD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,cAAc,GACvB,OAAO,EAAE,CAUX;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,EAAE,CAQvF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { DEFAULT_DERIVE_CONFIG, deriveTokens } from "../tokens/derive.js";
|
|
4
|
+
import { isRuleExempt, severityOf } from "./index.js";
|
|
5
|
+
import { auditSeriesGroups, parseSeriesGroups } from "./palette.js";
|
|
6
|
+
function checkSeriesPalette(source, relPath, cfg, surfaces) {
|
|
7
|
+
if (isRuleExempt("series-palette", relPath, cfg.exemptRules)) return [];
|
|
8
|
+
return auditSeriesGroups(parseSeriesGroups(source), surfaces).map((issue) => ({
|
|
9
|
+
relPath,
|
|
10
|
+
line: issue.line,
|
|
11
|
+
token: issue.keys.join(", "),
|
|
12
|
+
text: issue.message,
|
|
13
|
+
kind: "series-palette",
|
|
14
|
+
severity: severityOf("series-palette", cfg)
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
function checkSeriesModule(cwd, rel, cfg) {
|
|
18
|
+
const file = resolve(cwd, rel);
|
|
19
|
+
if (!existsSync(file)) return [];
|
|
20
|
+
const { panel } = deriveTokens(DEFAULT_DERIVE_CONFIG).surface;
|
|
21
|
+
return checkSeriesPalette(readFileSync(file, "utf8"), rel, cfg, {
|
|
22
|
+
light: panel.light,
|
|
23
|
+
dark: panel.dark
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
checkSeriesModule,
|
|
28
|
+
checkSeriesPalette
|
|
29
|
+
};
|