basalt-ui 1.1.0 → 1.2.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/AGENTS.md +2 -2
- package/CHANGELOG.md +37 -0
- package/README.md +47 -5
- package/agent/rules/basalt-app.md +126 -0
- package/agent/rules/basalt-content.md +3 -1
- package/agent/skills/basalt-app/SKILL.md +32 -10
- package/configs/check.yml +3 -1
- package/configs/oxlint.json +1 -1
- package/dist/agent/part-list.d.ts.map +1 -1
- package/dist/agent/part-list.js +17 -7
- package/dist/agent/stick-to-bottom.js +2 -2
- package/dist/agent-chat/thread-detail-panel.d.ts.map +1 -1
- package/dist/agent-chat/thread-detail-panel.js +37 -33
- package/dist/agent-chat/thread-message.d.ts.map +1 -1
- package/dist/agent-chat/thread-message.js +8 -5
- package/dist/agent-chat/thread-outcome-card.js +3 -3
- package/dist/agent-chat/thread-workspace.js +1 -1
- package/dist/charts/primitives/ChartLegend.js +2 -0
- package/dist/charts/primitives/ChartTooltip.js +2 -1
- package/dist/cli/index.d.ts +21 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +50 -12
- package/dist/connectivity/connectivity-indicator.d.ts.map +1 -1
- package/dist/connectivity/connectivity-indicator.js +3 -3
- package/dist/content/article-card.module.css +7 -5
- package/dist/content/article-layout.module.css +16 -12
- package/dist/content/callout.module.css +4 -4
- package/dist/content/code-block.module.css +8 -7
- package/dist/content/guide.module.css +3 -3
- package/dist/content/mermaid.module.css +2 -2
- package/dist/content/prose.module.css +59 -29
- package/dist/content/reading-progress.module.css +2 -0
- package/dist/content/toc.module.css +6 -3
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +10 -2
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +3 -16
- package/dist/dashboard/settings-section.js +2 -2
- package/dist/dashboard/settings-section.module.css +2 -2
- package/dist/dashboard/stat-card.js +2 -1
- package/dist/data/virtual-list.d.ts.map +1 -1
- package/dist/data/virtual-list.js +12 -2
- package/dist/forms/FormErrorSummary.js +2 -2
- package/dist/guard/index.d.ts +20 -4
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +250 -37
- package/dist/guard/types.d.ts +24 -3
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/provider/index.d.ts +30 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +32 -7
- package/dist/provider/lab-theme.d.ts +39 -0
- package/dist/provider/lab-theme.d.ts.map +1 -0
- package/dist/provider/lab-theme.js +52 -0
- package/dist/shell/app-header.module.css +2 -2
- package/dist/shell/app-mobile-nav.module.css +1 -1
- package/dist/shell/app-sidebar-account.d.ts.map +1 -1
- package/dist/shell/app-sidebar-account.js +4 -2
- package/dist/shell/app-sidebar.d.ts.map +1 -1
- package/dist/shell/app-sidebar.js +4 -2
- package/dist/shell/app-sidebar.module.css +36 -26
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +11 -4
- package/dist/shell/sidebar-search.module.css +16 -4
- package/dist/styles.css +1 -1
- package/dist/surfaces.d.ts +16 -12
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +12 -4
- package/dist/theme/controls.module.css +1 -1
- package/dist/theme/floating.module.css +1 -1
- package/dist/theme/index.d.ts +116 -11
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +703 -566
- package/dist/theme/nav-link.module.css +1 -1
- package/dist/theme/use-basalt-spacing.d.ts +3 -0
- package/dist/theme/use-basalt-spacing.d.ts.map +1 -0
- package/dist/theme/use-basalt-spacing.js +8 -0
- package/dist/theme-lab/derive-controls.d.ts +13 -0
- package/dist/theme-lab/derive-controls.d.ts.map +1 -0
- package/dist/theme-lab/derive-controls.js +137 -0
- package/dist/theme-lab/derive-state.d.ts +55 -0
- package/dist/theme-lab/derive-state.d.ts.map +1 -0
- package/dist/theme-lab/derive-state.js +81 -0
- package/dist/theme-lab/index.d.ts +12 -2
- package/dist/theme-lab/index.d.ts.map +1 -1
- package/dist/theme-lab/index.js +13 -62
- package/dist/theme-toggle/index.d.ts.map +1 -1
- package/dist/theme-toggle/index.js +3 -2
- package/dist/tokens/derive.d.ts +89 -0
- package/dist/tokens/derive.d.ts.map +1 -0
- package/dist/tokens/derive.js +250 -0
- package/dist/tokens/hct.d.ts +34 -0
- package/dist/tokens/hct.d.ts.map +1 -0
- package/dist/tokens/hct.js +159 -0
- package/dist/tokens/index.d.ts +71 -7
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +284 -46
- package/dist/tokens/palette.d.ts +984 -167
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +617 -119
- package/dist/vite-color-mix.d.ts +30 -0
- package/dist/vite-color-mix.d.ts.map +1 -0
- package/dist/vite-color-mix.js +80 -0
- package/dist/vite.d.ts +82 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +312 -0
- package/llms.txt +5 -4
- package/package.json +24 -9
- package/src/agent/part-list.tsx +13 -7
- package/src/agent/stick-to-bottom.tsx +2 -2
- package/src/agent-chat/thread-detail-panel.tsx +13 -10
- package/src/agent-chat/thread-message.tsx +8 -5
- package/src/agent-chat/thread-outcome-card.tsx +2 -2
- package/src/agent-chat/thread-workspace.tsx +2 -2
- package/src/charts/primitives/ChartLegend.tsx +2 -2
- package/src/charts/primitives/ChartTooltip.tsx +2 -2
- package/src/cli/check-theme.test.ts +18 -0
- package/src/cli/index.ts +112 -20
- package/src/cli/init-sync.test.ts +68 -0
- package/src/connectivity/connectivity-indicator.tsx +8 -2
- package/src/content/article-card.module.css +7 -5
- package/src/content/article-layout.module.css +16 -12
- package/src/content/callout.module.css +4 -4
- package/src/content/code-block.module.css +8 -7
- package/src/content/guide.module.css +3 -3
- package/src/content/mermaid.module.css +2 -2
- package/src/content/prose.module.css +59 -29
- package/src/content/prose.module.css.test.ts +55 -0
- package/src/content/reading-progress.module.css +2 -0
- package/src/content/toc.module.css +6 -3
- package/src/dashboard/delta-badge.tsx +10 -4
- package/src/dashboard/empty-state.tsx +3 -16
- package/src/dashboard/settings-section.module.css +2 -2
- package/src/dashboard/settings-section.tsx +2 -2
- package/src/dashboard/stat-card.tsx +2 -2
- package/src/data/virtual-list.tsx +12 -2
- package/src/forms/FormErrorSummary.tsx +1 -1
- package/src/guard/check-source.test.ts +416 -5
- package/src/guard/index.ts +367 -45
- package/src/guard/types.ts +24 -2
- package/src/index.ts +1 -0
- package/src/provider/index.test.tsx +100 -0
- package/src/provider/index.tsx +79 -7
- package/src/provider/lab-theme.test.ts +147 -0
- package/src/provider/lab-theme.ts +166 -0
- package/src/shell/app-header.module.css +2 -2
- package/src/shell/app-mobile-nav.module.css +1 -1
- package/src/shell/app-sidebar-account.tsx +9 -2
- package/src/shell/app-sidebar.module.css +36 -26
- package/src/shell/app-sidebar.tsx +12 -2
- package/src/shell/index.tsx +14 -3
- package/src/shell/sidebar-search.module.css +16 -4
- package/src/styles.css +1 -1
- package/src/surfaces.ts +25 -11
- package/src/theme/contrast.test.ts +19 -3
- package/src/theme/controls.module.css +1 -1
- package/src/theme/density-option.test.ts +96 -0
- package/src/theme/density-relations.test.ts +428 -0
- package/src/theme/derive-theme.test.ts +101 -0
- package/src/theme/floating.module.css +1 -1
- package/src/theme/fonts-option.test.ts +69 -0
- package/src/theme/index.ts +930 -563
- package/src/theme/nav-link.module.css +1 -1
- package/src/theme/radius-option.test.ts +86 -0
- package/src/theme/radius.test.ts +132 -0
- package/src/theme/spacing.test.ts +432 -0
- package/src/theme/use-basalt-spacing.test.tsx +51 -0
- package/src/theme/use-basalt-spacing.ts +38 -0
- package/src/theme-lab/derive-controls.test.ts +94 -0
- package/src/theme-lab/derive-controls.tsx +227 -0
- package/src/theme-lab/derive-state.test.ts +71 -0
- package/src/theme-lab/derive-state.ts +163 -0
- package/src/theme-lab/index.tsx +29 -68
- package/src/theme-lab/theme-lab.test.ts +4 -18
- package/src/theme-toggle/index.tsx +9 -4
- package/src/tokens/build-fonts-css.test.ts +51 -0
- package/src/tokens/build-radius-css.test.ts +25 -0
- package/src/tokens/density.test.ts +274 -0
- package/src/tokens/derive-radius.test.ts +62 -0
- package/src/tokens/derive.test.ts +30 -0
- package/src/tokens/derive.ts +481 -0
- package/src/tokens/hct.ts +231 -0
- package/src/tokens/index.ts +395 -45
- package/src/tokens/palette.test.ts +114 -0
- package/src/tokens/palette.ts +1118 -180
- package/src/vite-color-mix.test.ts +46 -0
- package/src/vite-color-mix.ts +137 -0
- package/src/vite.test.ts +192 -0
- package/src/vite.ts +502 -1
package/dist/tokens/index.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
buildPaletteData,
|
|
3
|
+
RADIUS,
|
|
4
|
+
RADIUS_STEP,
|
|
5
|
+
ROW_LINE_HEIGHT,
|
|
6
|
+
SHADOW,
|
|
7
|
+
SPACE,
|
|
8
|
+
SPACE_SCALE,
|
|
9
|
+
SPACE_STEP
|
|
10
|
+
} from "./palette.js";
|
|
2
11
|
import { BP, p } from "./palette.js";
|
|
12
|
+
import { DEFAULT_DERIVE_CONFIG, deriveTokens, resolveDeriveConfig } from "./derive.js";
|
|
13
|
+
import { deriveRadius } from "./palette.js";
|
|
14
|
+
import { deriveSpacing } from "./palette.js";
|
|
3
15
|
const alpha = (token, a) => `color-mix(in srgb, ${token} ${Math.round(a * 100)}%, transparent)`;
|
|
4
16
|
const TEXT = {
|
|
5
17
|
micro: 11,
|
|
@@ -23,14 +35,23 @@ const TEXT = {
|
|
|
23
35
|
};
|
|
24
36
|
const VX = {
|
|
25
37
|
// Non-color sizing constants
|
|
38
|
+
// Stroke WEIGHTS, not spacing — deliberately fixed, never density-tracking (see
|
|
39
|
+
// `SPACE_STEP_BASE`'s "charts" group doc in tokens/palette.ts).
|
|
26
40
|
lineWidth: 2.5,
|
|
27
41
|
line2Width: 2,
|
|
28
42
|
axisFont: TEXT.micro,
|
|
29
|
-
|
|
43
|
+
// A discrete visual footprint (not a stroke weight), so — unlike `lineWidth`/`line2Width` above —
|
|
44
|
+
// it DOES track density; single-sourced from `SPACE_STEP.chartDotR` (see that constant's doc).
|
|
45
|
+
dotR: SPACE_STEP.chartDotR,
|
|
30
46
|
// The ONE dashed pattern — plotted stroke, legend swatch, tooltip swatch all read this.
|
|
31
47
|
dashArray: "6 4",
|
|
32
|
-
// Legend layout —
|
|
33
|
-
|
|
48
|
+
// Legend layout — single-sourced from `SPACE_STEP.chartLegendGap` (density-tracking; see that
|
|
49
|
+
// constant's doc). Still a raw number here (not `var()`) — ChartLegend applies it via inline
|
|
50
|
+
// `style`, and this is the one static (level-0) value; `createBasaltTheme({ density })` has no
|
|
51
|
+
// wiring into chart render props yet, so this number does NOT move live with the knob (same
|
|
52
|
+
// "dev slider/production JS defaultProps" gap as Timeline's `bulletSize` — see `deriveSpacing`'s
|
|
53
|
+
// doc in tokens/palette.ts).
|
|
54
|
+
legendGap: SPACE_STEP.chartLegendGap,
|
|
34
55
|
legendFontSize: TEXT.sm,
|
|
35
56
|
// The type scale (px numbers — see TEXT above). Use in inline styles and visx SVG props;
|
|
36
57
|
// use `var(--vx-text-*)` in CSS modules.
|
|
@@ -40,6 +61,9 @@ const VX = {
|
|
|
40
61
|
radiusCard: "var(--vx-radius-card)",
|
|
41
62
|
// Single source for the control corner radius (inputs, search, buttons, segmented track).
|
|
42
63
|
radiusCtrl: "var(--vx-radius-ctrl)",
|
|
64
|
+
// Fully-rounded pill affordance (scroll-to-bottom button, chips) — fixed, does not track the
|
|
65
|
+
// radius knob (see `RADIUS_STEP.pill`'s doc in `tokens/palette.ts`).
|
|
66
|
+
radiusPill: "var(--vx-radius-pill)",
|
|
43
67
|
// Secondary-line color (back-compat alias; now theme-aware via --vx-line2)
|
|
44
68
|
line2Dark: "var(--vx-line2)",
|
|
45
69
|
// Semantic fills — consistent opacity across all charts
|
|
@@ -121,20 +145,29 @@ const VX = {
|
|
|
121
145
|
bad: "var(--vx-status-bad)",
|
|
122
146
|
neutral: "var(--vx-status-neutral)"
|
|
123
147
|
},
|
|
124
|
-
// Shared sizing
|
|
125
|
-
|
|
148
|
+
// Shared sizing — single-sourced from `SPACE_STEP.chartMargin*` (density-tracking; same
|
|
149
|
+
// static-value/no-live-wiring note as `legendGap` above).
|
|
150
|
+
margin: {
|
|
151
|
+
top: SPACE_STEP.chartMarginTop,
|
|
152
|
+
right: SPACE_STEP.chartMarginRight,
|
|
153
|
+
bottom: SPACE_STEP.chartMarginBottom,
|
|
154
|
+
left: SPACE_STEP.chartMarginLeft
|
|
155
|
+
},
|
|
126
156
|
minPxPerTick: 55
|
|
127
157
|
};
|
|
128
158
|
const decl = (name, value) => ` --vx-${name}: ${value};`;
|
|
159
|
+
function pxRem(px) {
|
|
160
|
+
return `${px / 16}rem`;
|
|
161
|
+
}
|
|
129
162
|
const groupSide = (prefix, map, side) => Object.entries(map).map(([key, pair]) => decl(`${prefix}${key}`, pair[side])).join("\n");
|
|
130
|
-
function frameworkPrimitives(side) {
|
|
131
|
-
const n = NEUTRAL;
|
|
132
|
-
const s = SEMANTIC;
|
|
133
|
-
const su = SURFACE;
|
|
134
|
-
const ink = INK;
|
|
135
|
-
const ac = ACCENT;
|
|
163
|
+
function frameworkPrimitives(side, data) {
|
|
164
|
+
const n = data.NEUTRAL;
|
|
165
|
+
const s = data.SEMANTIC;
|
|
166
|
+
const su = data.SURFACE;
|
|
167
|
+
const ink = data.INK;
|
|
168
|
+
const ac = data.ACCENT;
|
|
136
169
|
return [
|
|
137
|
-
groupSide("status-", STATUS, side),
|
|
170
|
+
groupSide("status-", data.STATUS, side),
|
|
138
171
|
decl("goodSolid", s.good[side]),
|
|
139
172
|
decl("badSolid", s.bad[side]),
|
|
140
173
|
decl("warnSolid", s.warn[side]),
|
|
@@ -151,7 +184,7 @@ function frameworkPrimitives(side) {
|
|
|
151
184
|
decl("tooltipMuted", n.tooltipMuted[side]),
|
|
152
185
|
decl("tooltipBorder", n.tooltipBorder[side]),
|
|
153
186
|
decl("tooltipShadow", n.tooltipShadow[side]),
|
|
154
|
-
decl("legendText", side
|
|
187
|
+
decl("legendText", n.legendText[side]),
|
|
155
188
|
decl("ink", ink.ink[side]),
|
|
156
189
|
decl("ink2", ink.ink2[side]),
|
|
157
190
|
decl("muted", ink.muted[side]),
|
|
@@ -176,34 +209,192 @@ function frameworkPrimitives(side) {
|
|
|
176
209
|
decl("surface-hairline", su.hairline[side])
|
|
177
210
|
].join("\n");
|
|
178
211
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
212
|
+
function spaceDecls(space) {
|
|
213
|
+
return [
|
|
214
|
+
decl("space-row-inset-x", `${space.anchors.rowInsetX}px`),
|
|
215
|
+
decl("space-row-inset-y", `${space.anchors.rowInsetY}px`),
|
|
216
|
+
// Additive law, not the multiplier — see `deriveSpacing`'s doc in `tokens/palette.ts`. No unit:
|
|
217
|
+
// `line-height` is a unitless CSS value.
|
|
218
|
+
decl("space-row-line-height", `${space.rowLineHeight}`),
|
|
219
|
+
// A `size: 'md'` Input's resolved height. Mantine's own `--input-height-md` is
|
|
220
|
+
// `calc(2.625rem * var(--mantine-scale))` (BOTH `styles.css` and `styles.layer.css`, verified
|
|
221
|
+
// in the installed package) — REM-relative to the root font size AND scale-aware, not a flat
|
|
222
|
+
// px. Emitting this in REM (via `pxRem`, not a bare `${…}px`) preserves the rem half; the
|
|
223
|
+
// `* var(--mantine-scale))` half is reconstructed at the Mantine-coupled call site
|
|
224
|
+
// (`theme/index.ts`'s `Input.extend` `vars`, which wraps this var in the matching `calc(...)`)
|
|
225
|
+
// — this module stays Mantine-free, so it cannot reference `--mantine-scale` itself. Flattening
|
|
226
|
+
// either half into a flat px would desync input height from the user's root font size (an
|
|
227
|
+
// accessibility regression) and from Mantine's global `--mantine-scale` knob.
|
|
228
|
+
decl("space-input-height", pxRem(space.anchors.inputHeight)),
|
|
229
|
+
// A `size: 'md'` Button's/ActionIcon's resolved height — SAME rem-plus-scale reasoning and
|
|
230
|
+
// reconstruction as `space-input-height` above (`theme/index.ts`'s `Button.extend`/
|
|
231
|
+
// `ActionIcon.extend` `vars`), single-sourced from the SAME `controlHeight` anchor
|
|
232
|
+
// `space-input-height` reads from (`SPACE_ANCHORS_BASE`'s doc in `tokens/palette.ts`).
|
|
233
|
+
decl("space-control-height", pxRem(space.anchors.controlHeight)),
|
|
234
|
+
decl("space-stack-xs", `${space.anchors.stackXs}px`),
|
|
235
|
+
decl("space-stack-sm", `${space.anchors.stackSm}px`),
|
|
236
|
+
decl("space-stack-md", `${space.anchors.stackMd}px`),
|
|
237
|
+
decl("space-stack-lg", `${space.anchors.stackLg}px`),
|
|
238
|
+
decl("space-stack-xl", `${space.anchors.stackXl}px`),
|
|
239
|
+
// The CSS-module spacing sweep's one-offs (docs/STATUS.md) — same single-source reasoning,
|
|
240
|
+
// grouped to match `SPACE_STEP_BASE`'s own grouping in tokens/palette.ts.
|
|
241
|
+
// Responsive pair (Decision 3) — `stickyHeaderClearance` is the desktop (`>= sm`) value,
|
|
242
|
+
// `stickyHeaderClearanceMobile` the mobile (`< sm`) override; a consumer CSS module picks
|
|
243
|
+
// whichever matches its own breakpoint (see `content/prose.module.css`).
|
|
244
|
+
decl("space-sticky-header-clearance", `${space.step.stickyHeaderClearance}px`),
|
|
245
|
+
decl("space-sticky-header-clearance-mobile", `${space.step.stickyHeaderClearanceMobile}px`),
|
|
246
|
+
decl("space-nav-icon-gap", `${space.step.navIconGap}px`),
|
|
247
|
+
decl("space-sidebar-region-gap", `${space.step.sidebarRegionGap}px`),
|
|
248
|
+
decl("space-prose-quote-inset-y", `${space.step.proseQuoteInsetY}px`),
|
|
249
|
+
decl("space-prose-quote-indent", `${space.step.proseQuoteIndent}px`),
|
|
250
|
+
decl("space-prose-inline-code-inset-y", `${space.step.proseInlineCodeInsetY}px`),
|
|
251
|
+
decl("space-prose-inline-code-inset-x", `${space.step.proseInlineCodeInsetX}px`),
|
|
252
|
+
decl("space-prose-code-block-inset-y", `${space.step.proseCodeBlockInsetY}px`),
|
|
253
|
+
decl("space-prose-code-block-inset-x", `${space.step.proseCodeBlockInsetX}px`),
|
|
254
|
+
decl("space-prose-heading-anchor-gap", `${space.step.proseHeadingAnchorGap}px`),
|
|
255
|
+
decl("space-prose-table-cell-inset-y", `${space.step.proseTableCellInsetY}px`),
|
|
256
|
+
decl("space-prose-table-cell-inset-x", `${space.step.proseTableCellInsetX}px`),
|
|
257
|
+
decl("space-prose-chat-list-gap-bottom", `${space.step.proseChatListGapBottom}px`),
|
|
258
|
+
decl("space-prose-chat-list-indent", `${space.step.proseChatListIndent}px`),
|
|
259
|
+
decl("space-prose-chat-list-item-gap", `${space.step.proseChatListItemGap}px`),
|
|
260
|
+
decl("space-prose-chat-nested-list-gap", `${space.step.proseChatNestedListGap}px`),
|
|
261
|
+
decl("space-prose-chat-heading-gap-top", `${space.step.proseChatHeadingGapTop}px`),
|
|
262
|
+
decl("space-prose-chat-heading-gap-bottom", `${space.step.proseChatHeadingGapBottom}px`),
|
|
263
|
+
decl("space-prose-article-paragraph-gap", `${space.step.proseArticleParagraphGap}px`),
|
|
264
|
+
decl("space-prose-article-list-gap-top", `${space.step.proseArticleListGapTop}px`),
|
|
265
|
+
decl("space-prose-article-list-gap-bottom", `${space.step.proseArticleListGapBottom}px`),
|
|
266
|
+
decl("space-prose-article-list-indent", `${space.step.proseArticleListIndent}px`),
|
|
267
|
+
decl("space-prose-article-h1-gap-top", `${space.step.proseArticleH1GapTop}px`),
|
|
268
|
+
decl("space-prose-article-h1-gap-bottom", `${space.step.proseArticleH1GapBottom}px`),
|
|
269
|
+
decl("space-prose-article-heading-gap-top", `${space.step.proseArticleHeadingGapTop}px`),
|
|
270
|
+
decl("space-prose-article-heading-gap-bottom", `${space.step.proseArticleHeadingGapBottom}px`),
|
|
271
|
+
decl("space-prose-article-h2-rule-gap", `${space.step.proseArticleH2RuleGap}px`),
|
|
272
|
+
decl("space-prose-article-block-gap", `${space.step.proseArticleBlockGap}px`),
|
|
273
|
+
decl("space-article-column-gap", `${space.step.articleColumnGap}px`),
|
|
274
|
+
decl("space-article-toc-rail-width", `${space.step.articleTocRailWidth}px`),
|
|
275
|
+
decl("space-article-header-gap", `${space.step.articleHeaderGap}px`),
|
|
276
|
+
decl("space-article-header-padding-bottom", `${space.step.articleHeaderPaddingBottom}px`),
|
|
277
|
+
decl("space-article-header-margin-bottom", `${space.step.articleHeaderMarginBottom}px`),
|
|
278
|
+
decl("space-article-meta-row-gap", `${space.step.articleMetaRowGap}px`),
|
|
279
|
+
decl("space-article-footer-gap", `${space.step.articleFooterGap}px`),
|
|
280
|
+
decl("space-article-footer-margin-top", `${space.step.articleFooterMarginTop}px`),
|
|
281
|
+
decl("space-article-footer-padding-top", `${space.step.articleFooterPaddingTop}px`),
|
|
282
|
+
decl("space-article-nav-target-gap", `${space.step.articleNavTargetGap}px`),
|
|
283
|
+
decl("space-code-block-header-gap", `${space.step.codeBlockHeaderGap}px`),
|
|
284
|
+
decl("space-code-block-header-inset-y", `${space.step.codeBlockHeaderInsetY}px`),
|
|
285
|
+
decl("space-code-block-header-inset-right", `${space.step.codeBlockHeaderInsetRight}px`),
|
|
286
|
+
decl("space-code-block-content-inset-x", `${space.step.codeBlockContentInsetX}px`),
|
|
287
|
+
decl("space-code-block-header-right-gap", `${space.step.codeBlockHeaderRightGap}px`),
|
|
288
|
+
decl("space-code-block-body-inset-y", `${space.step.codeBlockBodyInsetY}px`),
|
|
289
|
+
decl("space-code-block-floating-copy-offset", `${space.step.codeBlockFloatingCopyOffset}px`),
|
|
290
|
+
decl("space-callout-inset-y", `${space.step.calloutInsetY}px`),
|
|
291
|
+
decl("space-callout-inset-x", `${space.step.calloutInsetX}px`),
|
|
292
|
+
decl("space-callout-title-row-gap", `${space.step.calloutTitleRowGap}px`),
|
|
293
|
+
decl("space-toc-root-gap", `${space.step.tocRootGap}px`),
|
|
294
|
+
decl("space-toc-link-inset-y", `${space.step.tocLinkInsetY}px`),
|
|
295
|
+
decl("space-toc-link-indent", `${space.step.tocLinkIndent}px`),
|
|
296
|
+
decl("space-toc-sub-indent", `${space.step.tocSubIndent}px`),
|
|
297
|
+
decl("space-article-card-tags-gap", `${space.step.articleCardTagsGap}px`),
|
|
298
|
+
decl("space-article-card-tag-inset-y", `${space.step.articleCardTagInsetY}px`),
|
|
299
|
+
decl("space-article-card-tag-inset-x", `${space.step.articleCardTagInsetX}px`),
|
|
300
|
+
decl("space-article-card-meta-gap-top", `${space.step.articleCardMetaGapTop}px`),
|
|
301
|
+
decl("space-guide-body-gap-bottom", `${space.step.guideBodyGapBottom}px`),
|
|
302
|
+
decl("space-guide-footer-gap-top", `${space.step.guideFooterGapTop}px`),
|
|
303
|
+
decl("space-guide-footer-inset-top", `${space.step.guideFooterInsetTop}px`),
|
|
304
|
+
decl("space-sidebar-search-gap", `${space.step.sidebarSearchGap}px`),
|
|
305
|
+
decl("space-sidebar-search-trigger-height", `${space.step.sidebarSearchTriggerHeight}px`),
|
|
306
|
+
decl("space-settings-row-inset-y", `${space.step.settingsRowInsetY}px`),
|
|
307
|
+
decl("space-settings-row-gap", `${space.step.settingsRowGap}px`),
|
|
308
|
+
decl("space-mermaid-container-inset", `${space.step.mermaidContainerInset}px`),
|
|
309
|
+
decl("space-sidebar-brand-inset-top", `${space.step.sidebarBrandInsetTop}px`),
|
|
310
|
+
decl("space-sidebar-brand-inset-x", `${space.step.sidebarBrandInsetX}px`),
|
|
311
|
+
decl("space-sidebar-section-gap", `${space.step.sidebarSectionGap}px`),
|
|
312
|
+
decl("space-sidebar-account-inset-top", `${space.step.sidebarAccountInsetTop}px`),
|
|
313
|
+
decl("space-sidebar-account-inset-x", `${space.step.sidebarAccountInsetX}px`),
|
|
314
|
+
decl("space-sidebar-account-inset-bottom", `${space.step.sidebarAccountInsetBottom}px`),
|
|
315
|
+
decl("space-sidebar-avatar-size", `${space.step.sidebarAvatarSize}px`),
|
|
316
|
+
decl("space-sidebar-section-label-gap", `${space.step.sidebarSectionLabelGap}px`),
|
|
317
|
+
decl("space-sidebar-child-list-gap-top", `${space.step.sidebarChildListGapTop}px`),
|
|
318
|
+
decl("space-sidebar-child-list-gap-bottom", `${space.step.sidebarChildListGapBottom}px`),
|
|
319
|
+
decl("space-sidebar-child-list-indent", `${space.step.sidebarChildListIndent}px`),
|
|
320
|
+
decl("space-sidebar-child-row-inset-y", `${space.step.sidebarChildRowInsetY}px`),
|
|
321
|
+
decl("space-sidebar-child-row-indent", `${space.step.sidebarChildRowIndent}px`),
|
|
322
|
+
decl("space-app-header-mobile-actions-height", `${space.step.appHeaderMobileActionsHeight}px`),
|
|
323
|
+
decl("space-mobile-nav-tab-gap", `${space.step.mobileNavTabGap}px`),
|
|
324
|
+
decl("space-agent-rail-inset-x", `${space.step.agentRailInsetX}px`),
|
|
325
|
+
decl("space-agent-part-gap-top", `${space.step.agentPartGapTop}px`),
|
|
326
|
+
decl("space-agent-code-inset", `${space.step.agentCodeInset}px`),
|
|
327
|
+
decl("space-agent-error-inset-y", `${space.step.agentErrorInsetY}px`),
|
|
328
|
+
decl("space-agent-error-inset-x", `${space.step.agentErrorInsetX}px`),
|
|
329
|
+
decl("space-agent-scroll-button-gap-top", `${space.step.agentScrollButtonGapTop}px`),
|
|
330
|
+
decl("space-agent-message-inset-y", `${space.step.agentMessageInsetY}px`),
|
|
331
|
+
decl("space-agent-message-inset-x", `${space.step.agentMessageInsetX}px`),
|
|
332
|
+
decl("space-agent-transcript-inset", `${space.step.agentTranscriptInset}px`),
|
|
333
|
+
decl("space-badge-inset-y", `${space.step.badgeInsetY}px`),
|
|
334
|
+
decl("space-badge-inset-x", `${space.step.badgeInsetX}px`),
|
|
335
|
+
decl("space-stat-card-gap", `${space.step.statCardGap}px`),
|
|
336
|
+
decl("space-virtual-row-inset-y", `${space.step.virtualRowInsetY}px`),
|
|
337
|
+
decl("space-virtual-row-inset-x", `${space.step.virtualRowInsetX}px`)
|
|
338
|
+
// `chartLegendGap`/`chartMarginTop`/`chartMarginRight`/`chartMarginBottom`/`chartMarginLeft`/
|
|
339
|
+
// `chartDotR`/`progressBarSize`/`timelineBullet` are DELIBERATELY absent — see this function's
|
|
340
|
+
// doc for why (JS-number-only consumers, zero `var()` reads). `appShellHeaderHeight`/
|
|
341
|
+
// `appShellHeaderMobileHeight`/`appShellNavbarWidth`/`appShellNavbarRailWidth` join that list —
|
|
342
|
+
// `shell/index.tsx` reads all four as JS numbers via `useBasaltSpacing()` (Mantine's `AppShell`
|
|
343
|
+
// `header`/`navbar` props take numbers, not `var()` strings), so a `--vx-space-app-shell-*` decl
|
|
344
|
+
// here would have had zero consumers, framework-wide, the same dead-weight shape this function's
|
|
345
|
+
// doc already calls out for the chart/Progress/Timeline group. `sidebarAccountMenuWidth`/
|
|
346
|
+
// `sidebarSettingsMenuWidth` join it too — `app-sidebar-account.tsx`/`app-sidebar.tsx` read both
|
|
347
|
+
// as JS numbers via `useBasaltSpacing()` (Mantine's `<Menu width={…}>` also takes a number).
|
|
348
|
+
];
|
|
349
|
+
}
|
|
350
|
+
const DEFAULT_SPACE_VALUES = {
|
|
351
|
+
anchors: SPACE,
|
|
352
|
+
scale: SPACE_SCALE,
|
|
353
|
+
step: SPACE_STEP,
|
|
354
|
+
rowLineHeight: ROW_LINE_HEIGHT
|
|
355
|
+
};
|
|
356
|
+
function frameworkDerived(data) {
|
|
357
|
+
return [
|
|
358
|
+
decl("radius-card", `${RADIUS.card}px`),
|
|
359
|
+
decl("radius-ctrl", `${RADIUS.ctrl}px`),
|
|
360
|
+
// The two offset tiers (SegmentedControl indicator/Kbd/Code, Progress/scale-sm) — added so a
|
|
361
|
+
// component's inline `styles`/`style` can read the SAME source as `RADIUS_STEP.tight`/`.fine`
|
|
362
|
+
// instead of a hand-typed literal (see `theme/index.ts`'s component sweep).
|
|
363
|
+
decl("radius-tight", `${RADIUS_STEP.tight}px`),
|
|
364
|
+
decl("radius-fine", `${RADIUS_STEP.fine}px`),
|
|
365
|
+
// The floating tier (Modal/Tooltip/Popover/Notification, content code/mermaid blocks).
|
|
366
|
+
decl("radius-floating", `${RADIUS_STEP.floating}px`),
|
|
367
|
+
// The pill affordance (scroll-to-bottom button, chips) — fixed, level-invariant, so it lives
|
|
368
|
+
// only in this static block, never in `buildRadiusCss`'s dynamic override (see
|
|
369
|
+
// `RADIUS_STEP.pill`'s doc).
|
|
370
|
+
decl("radius-pill", `${RADIUS_STEP.pill}px`),
|
|
371
|
+
...spaceDecls(DEFAULT_SPACE_VALUES),
|
|
372
|
+
// Article-density Prose measure (docs/CONTENT-SPEC.md §5) — theme-independent, like the radii.
|
|
373
|
+
decl("prose-measure", "72ch"),
|
|
374
|
+
// The fill band (see FILL in palette.ts). Emitted on `:root`, NOT per scheme — a filled surface
|
|
375
|
+
// is the same hex in both, which is the whole point: it is squeezed between its white label and
|
|
376
|
+
// the page behind it, and only one luminance band satisfies both on both pages.
|
|
377
|
+
...Object.entries(data.FILL).map(([name, hex]) => decl(`fill-${name}`, hex)),
|
|
378
|
+
// Hover is DERIVED from the fill, so retuning a fill (in the theme lab, or here) carries its
|
|
379
|
+
// hover along instead of leaving a stale pair. 88% of the fill over black lands ~0.128 luminance:
|
|
380
|
+
// a visible press-darkening that still clears AA for the white label (~5.9:1).
|
|
381
|
+
...Object.keys(data.FILL).map(
|
|
382
|
+
(name) => decl(`fillHover-${name}`, `color-mix(in srgb, var(--vx-fill-${name}) 88%, #000)`)
|
|
383
|
+
),
|
|
384
|
+
// The type scale, emitted from the SAME `TEXT` object `VX.text` reads — CSS modules and the
|
|
385
|
+
// Mantine theme consume these; inline styles / visx read the numbers. One ladder, two forms.
|
|
386
|
+
...Object.entries(TEXT).map(([step, px]) => decl(`text-${step}`, `${px}px`)),
|
|
387
|
+
decl("area-top", "22%"),
|
|
388
|
+
decl("area-bottom", "1%"),
|
|
389
|
+
decl("good", "color-mix(in srgb, var(--vx-goodSolid) 18%, transparent)"),
|
|
390
|
+
decl("goodSoft", "color-mix(in srgb, var(--vx-goodSolid) 8%, transparent)"),
|
|
391
|
+
decl("bad", "color-mix(in srgb, var(--vx-badSolid) 18%, transparent)"),
|
|
392
|
+
decl("warn", "color-mix(in srgb, var(--vx-warnSolid) 8%, transparent)"),
|
|
393
|
+
decl("goodRef", "color-mix(in srgb, var(--vx-goodSolid) 30%, transparent)"),
|
|
394
|
+
decl("badRef", "color-mix(in srgb, var(--vx-badSolid) 30%, transparent)"),
|
|
395
|
+
decl("warnRef", "color-mix(in srgb, var(--vx-warnSolid) 20%, transparent)")
|
|
396
|
+
].join("\n");
|
|
397
|
+
}
|
|
207
398
|
function seriesTokens(map, prefix = "") {
|
|
208
399
|
const out = {};
|
|
209
400
|
for (const key of Object.keys(map)) out[key] = `var(--vx-${prefix}${String(key)})`;
|
|
@@ -215,14 +406,15 @@ function defineSeries(map) {
|
|
|
215
406
|
function groupTokens(name, map) {
|
|
216
407
|
return seriesTokens(map, `${name}-`);
|
|
217
408
|
}
|
|
218
|
-
function buildPaletteCss(opts = {}) {
|
|
409
|
+
function buildPaletteCss(opts = {}, data = buildPaletteData()) {
|
|
219
410
|
const groups = opts.groups ?? {};
|
|
220
411
|
const extraDerived = (opts.derived ?? []).map((d) => ` ${d}`).join("\n");
|
|
221
|
-
const
|
|
222
|
-
|
|
412
|
+
const derivedBlock = frameworkDerived(data);
|
|
413
|
+
const derived = extraDerived ? `${derivedBlock}
|
|
414
|
+
${extraDerived}` : derivedBlock;
|
|
223
415
|
const side = (s) => {
|
|
224
416
|
const extra = Object.entries(groups).map(([prefix, map]) => groupSide(prefix, map, s)).join("\n");
|
|
225
|
-
const framework = frameworkPrimitives(s);
|
|
417
|
+
const framework = frameworkPrimitives(s, data);
|
|
226
418
|
return extra ? `${framework}
|
|
227
419
|
${extra}` : framework;
|
|
228
420
|
};
|
|
@@ -237,13 +429,59 @@ html[data-mantine-color-scheme='light'] {
|
|
|
237
429
|
${side("light")}
|
|
238
430
|
}`;
|
|
239
431
|
}
|
|
432
|
+
const FONT_VAR_NAMES = {
|
|
433
|
+
sans: "--basalt-font-sans",
|
|
434
|
+
head: "--basalt-font-head",
|
|
435
|
+
mono: "--basalt-font-mono"
|
|
436
|
+
};
|
|
437
|
+
function buildFontsCss(fonts) {
|
|
438
|
+
if (!fonts) return "";
|
|
439
|
+
const decls = Object.keys(FONT_VAR_NAMES).filter((key) => fonts[key] !== void 0).map((key) => {
|
|
440
|
+
const value = fonts[key];
|
|
441
|
+
if (/[{};]|\/\*/.test(value)) {
|
|
442
|
+
throw new Error(
|
|
443
|
+
`Invalid fonts.${key}: a font-family stack must not contain "{", "}", ";" or "/*" \u2014 got ${JSON.stringify(value)}`
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
return ` ${FONT_VAR_NAMES[key]}: ${value};`;
|
|
447
|
+
});
|
|
448
|
+
if (decls.length === 0) return "";
|
|
449
|
+
return `:root {
|
|
450
|
+
${decls.join("\n")}
|
|
451
|
+
}`;
|
|
452
|
+
}
|
|
453
|
+
function buildRadiusCss(radius) {
|
|
454
|
+
if (!radius) return "";
|
|
455
|
+
return `:root {
|
|
456
|
+
--vx-radius-card: ${radius.card}px;
|
|
457
|
+
--vx-radius-ctrl: ${radius.ctrl}px;
|
|
458
|
+
--vx-radius-tight: ${radius.tight}px;
|
|
459
|
+
--vx-radius-fine: ${radius.fine}px;
|
|
460
|
+
--vx-radius-floating: ${radius.floating}px;
|
|
461
|
+
}`;
|
|
462
|
+
}
|
|
463
|
+
function buildDensityCss(space) {
|
|
464
|
+
if (!space) return "";
|
|
465
|
+
return `:root {
|
|
466
|
+
${spaceDecls(space).join("\n")}
|
|
467
|
+
}`;
|
|
468
|
+
}
|
|
240
469
|
export {
|
|
241
470
|
BP,
|
|
471
|
+
DEFAULT_DERIVE_CONFIG,
|
|
242
472
|
VX,
|
|
243
473
|
alpha,
|
|
474
|
+
buildDensityCss,
|
|
475
|
+
buildFontsCss,
|
|
244
476
|
buildPaletteCss,
|
|
477
|
+
buildRadiusCss,
|
|
245
478
|
defineSeries,
|
|
479
|
+
deriveRadius,
|
|
480
|
+
deriveSpacing,
|
|
481
|
+
deriveTokens,
|
|
246
482
|
groupTokens,
|
|
247
483
|
p,
|
|
484
|
+
pxRem,
|
|
485
|
+
resolveDeriveConfig,
|
|
248
486
|
seriesTokens
|
|
249
487
|
};
|