basalt-ui 1.1.1 → 1.3.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 +46 -0
- package/README.md +64 -8
- package/agent/rules/basalt-app.md +126 -0
- package/agent/rules/basalt-content.md +3 -1
- package/agent/rules/basalt-tokens.md +14 -5
- package/agent/skills/basalt-app/SKILL.md +28 -7
- 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 +29 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +80 -9
- 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 +266 -38
- 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 +22 -11
- package/dist/surfaces.d.ts +21 -11
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +10 -3
- 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 +143 -7
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +322 -48
- 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/tokens.css +248 -0
- 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 +14 -4
- package/package.json +41 -10
- 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 +129 -6
- package/src/cli/tokens-css.test.ts +90 -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 +483 -15
- package/src/guard/index.ts +426 -47
- 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 +22 -11
- package/src/surfaces.ts +24 -10
- 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 +534 -48
- 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
|
@@ -10,7 +10,7 @@ const TOOLTIP_STYLES: CSSProperties = {
|
|
|
10
10
|
pointerEvents: 'none',
|
|
11
11
|
zIndex: 9999,
|
|
12
12
|
backgroundColor: VX.surface.panel,
|
|
13
|
-
borderRadius:
|
|
13
|
+
borderRadius: 'var(--vx-radius-floating)',
|
|
14
14
|
padding: '0',
|
|
15
15
|
fontSize: VX.text.xs,
|
|
16
16
|
lineHeight: '18px',
|
|
@@ -138,7 +138,7 @@ export function TooltipRow({
|
|
|
138
138
|
style={{
|
|
139
139
|
width: 8,
|
|
140
140
|
height: 8,
|
|
141
|
-
borderRadius: 2,
|
|
141
|
+
borderRadius: 2, // theme-allow: sub-scale tooltip micro-corner, below the 4px radius floor
|
|
142
142
|
backgroundColor: color,
|
|
143
143
|
flexShrink: 0,
|
|
144
144
|
}}
|
|
@@ -636,6 +636,24 @@ describe('check-theme roots fail-loud', () => {
|
|
|
636
636
|
})
|
|
637
637
|
})
|
|
638
638
|
|
|
639
|
+
describe('check-theme scans .css', () => {
|
|
640
|
+
it('flags a raw hex in a CSS module the walker collects', () => {
|
|
641
|
+
fixtureAt('theme/controls.module.css', '.input {\n color: #ff0000;\n}\n')
|
|
642
|
+
const { code, err } = run()
|
|
643
|
+
expect(code).toBe(1)
|
|
644
|
+
expect(err).toContain('raw-hex')
|
|
645
|
+
expect(err).toContain('controls.module.css')
|
|
646
|
+
})
|
|
647
|
+
|
|
648
|
+
it('does NOT false-positive a JSX-shaped rule on genuine CSS', () => {
|
|
649
|
+
fixtureAt('theme/controls.module.css', '.foo {\n display: flex;\n border-radius: 8px;\n}\n')
|
|
650
|
+
const { code, err } = run()
|
|
651
|
+
expect(code).toBe(0)
|
|
652
|
+
expect(err).not.toContain('inline-display')
|
|
653
|
+
expect(err).not.toContain('raw-html-layout')
|
|
654
|
+
})
|
|
655
|
+
})
|
|
656
|
+
|
|
639
657
|
describe('check-theme comment skipping', () => {
|
|
640
658
|
it('does NOT flag a banned element mentioned in a pure line comment', () => {
|
|
641
659
|
fixtureAt(
|
package/src/cli/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ import type { Finding, GuardConfig, GuardKind } from '../guard'
|
|
|
37
37
|
import { evaluateGuardHook } from '../guard/guard-hook'
|
|
38
38
|
import { RULE_NAMES, SKILL_NAMES, SURFACES, TOKEN_LAYER_BOUNDARY_SURFACES } from '../surfaces'
|
|
39
39
|
import type { DoctrineSpec, SurfaceSpec } from '../surfaces'
|
|
40
|
+
import { buildPaletteCss } from '../tokens'
|
|
40
41
|
|
|
41
42
|
/** Shape of the optional `"basalt"` key in a consumer's package.json. */
|
|
42
43
|
export type BasaltConfig = {
|
|
@@ -140,6 +141,18 @@ export type BasaltConfig = {
|
|
|
140
141
|
* Default: `<first basalt.root>/lib/series.ts` — see `resolveSeriesModulePath`.
|
|
141
142
|
*/
|
|
142
143
|
seriesModulePath?: string
|
|
144
|
+
/**
|
|
145
|
+
* Per-rule, per-path exemptions — complements whole-file `exempt` (which skips ALL rules for a
|
|
146
|
+
* file) and the hardcoded per-kind `appliesTo` scoping (e.g. `raw-visx-axis` → chart files
|
|
147
|
+
* only). Each value is a list of path-segment patterns matched against a finding's relative
|
|
148
|
+
* path: a pattern matches when the path split on `/` includes it as a WHOLE segment (`'agent'`
|
|
149
|
+
* matches `src/agent/x.tsx` but not `src/agenting.ts`; a trailing `/` is stripped, so `'agent'`
|
|
150
|
+
* and `'agent/'` are equivalent). Default: `{}` (no exemptions).
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* { exemptRules: { 'inline-display': ['agent'] } } // inline-display never fires under src/agent/**
|
|
154
|
+
*/
|
|
155
|
+
exemptRules?: Partial<Record<GuardKind, string[]>>
|
|
143
156
|
}
|
|
144
157
|
|
|
145
158
|
const DEFAULT_ROOT = 'src'
|
|
@@ -205,8 +218,13 @@ function readBasaltConfig(cwd: string): BasaltConfig {
|
|
|
205
218
|
}
|
|
206
219
|
}
|
|
207
220
|
|
|
208
|
-
/**
|
|
209
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Recursively collect .ts/.tsx/.css files under a root, skipping dependency/build dirs.
|
|
223
|
+
* Node+Bun-safe. `.css` is included so the theme guard reaches CSS modules / `styles.css` —
|
|
224
|
+
* `checkSource` is already syntax-aware per extension (`guardSyntaxFor`); the walker was the only
|
|
225
|
+
* gap.
|
|
226
|
+
*/
|
|
227
|
+
function walkSourceFiles(dir: string, out: string[] = []): string[] {
|
|
210
228
|
let entries: string[]
|
|
211
229
|
try {
|
|
212
230
|
entries = readdirSync(dir)
|
|
@@ -222,8 +240,8 @@ function walkTsFiles(dir: string, out: string[] = []): string[] {
|
|
|
222
240
|
} catch {
|
|
223
241
|
continue
|
|
224
242
|
}
|
|
225
|
-
if (isDir)
|
|
226
|
-
else if (/\.tsx
|
|
243
|
+
if (isDir) walkSourceFiles(abs, out)
|
|
244
|
+
else if (/\.(?:tsx?|css)$/.test(name)) out.push(abs)
|
|
227
245
|
}
|
|
228
246
|
return out
|
|
229
247
|
}
|
|
@@ -274,6 +292,9 @@ const GUARD_KIND_EXPLANATIONS: Partial<Record<GuardKind, string>> = {
|
|
|
274
292
|
'sub-16-input-font':
|
|
275
293
|
'sub-16-input-font: fontSize below 16 on a form control is dead code against the `!important` ' +
|
|
276
294
|
'iOS floor in styles.css — drop the override or be honest about 16px.',
|
|
295
|
+
'raw-font-family':
|
|
296
|
+
'raw-font-family: route the font stack through createBasaltTheme(overrides, { fonts }) / the ' +
|
|
297
|
+
'--basalt-font-sans|head|mono vars instead of a hardcoded fontFamily literal.',
|
|
277
298
|
}
|
|
278
299
|
|
|
279
300
|
/**
|
|
@@ -303,12 +324,13 @@ export function checkTheme(cwd: string = process.cwd()): number {
|
|
|
303
324
|
rawFormControl: cfg.rawFormControl ?? DEFAULT_GUARD_CONFIG.rawFormControl,
|
|
304
325
|
sub16InputFont: cfg.sub16InputFont ?? DEFAULT_GUARD_CONFIG.sub16InputFont,
|
|
305
326
|
allowComment: 'theme-allow',
|
|
327
|
+
exemptRules: cfg.exemptRules ?? DEFAULT_GUARD_CONFIG.exemptRules,
|
|
306
328
|
}
|
|
307
329
|
|
|
308
330
|
const findings: Finding[] = []
|
|
309
331
|
let scannedCount = 0
|
|
310
332
|
for (const root of roots) {
|
|
311
|
-
for (const f of
|
|
333
|
+
for (const f of walkSourceFiles(resolve(cwd, root))) {
|
|
312
334
|
// Normalize to forward slashes so path matching (SKIP, exempt, isChartFile) is
|
|
313
335
|
// identical on Windows (where `relative` yields backslashes) and POSIX.
|
|
314
336
|
const rel = relative(cwd, f).replace(/\\/g, '/')
|
|
@@ -1304,6 +1326,8 @@ type DoctorResult = {
|
|
|
1304
1326
|
* stale).
|
|
1305
1327
|
* 3. The running CLI's own version matches the installed basalt-ui (catches a stale
|
|
1306
1328
|
* `bunx basalt-ui` npm fetch; best-effort, skipped if node_modules is absent).
|
|
1329
|
+
* 4. `basaltAppPlugin`'s (basalt-ui/vite) default icon filenames exist under public/ (only when
|
|
1330
|
+
* a public/ dir exists at all — skipped otherwise).
|
|
1307
1331
|
*
|
|
1308
1332
|
* Returns the exit code: 0 = all good, 1 = one or more hard failures.
|
|
1309
1333
|
*/
|
|
@@ -1379,6 +1403,32 @@ export function doctor(cwd: string = process.cwd()): number {
|
|
|
1379
1403
|
}
|
|
1380
1404
|
}
|
|
1381
1405
|
|
|
1406
|
+
// ── Warn check 4: basaltAppPlugin's default icon files exist in public/ ────
|
|
1407
|
+
// basalt-ui/vite's basaltAppPlugin (head/manifest metadata) references these filenames by
|
|
1408
|
+
// default (the realfavicongenerator convention). Only runs when a public/ dir exists at all —
|
|
1409
|
+
// apps that don't use the plugin, or don't use Vite's public-dir convention, get no false
|
|
1410
|
+
// warning. Best-effort: a custom `icons.dir` isn't visible here, so this checks the root only.
|
|
1411
|
+
const publicDir = resolve(cwd, 'public')
|
|
1412
|
+
if (existsSync(publicDir)) {
|
|
1413
|
+
const iconFiles = [
|
|
1414
|
+
'favicon.ico',
|
|
1415
|
+
'favicon.svg',
|
|
1416
|
+
'favicon-96x96.png',
|
|
1417
|
+
'apple-touch-icon.png',
|
|
1418
|
+
'web-app-manifest-192x192.png',
|
|
1419
|
+
'web-app-manifest-512x512.png',
|
|
1420
|
+
]
|
|
1421
|
+
const missingIcons = iconFiles.filter((f) => !existsSync(resolve(publicDir, f)))
|
|
1422
|
+
if (missingIcons.length > 0) {
|
|
1423
|
+
warn(
|
|
1424
|
+
`public/ is missing basaltAppPlugin icon file(s): ${missingIcons.join(', ')} — generate ` +
|
|
1425
|
+
'them (e.g. via realfavicongenerator.net) and place them at the public/ root.',
|
|
1426
|
+
)
|
|
1427
|
+
} else {
|
|
1428
|
+
pass("public/ has all of basaltAppPlugin's default icon files")
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1382
1432
|
// ── Report ──────────────────────────────────────────────────────────────────
|
|
1383
1433
|
lines.push('')
|
|
1384
1434
|
if (result.hardFailures === 0 && result.warnings === 0) {
|
|
@@ -1522,6 +1572,73 @@ export function info(flags: string[]): number {
|
|
|
1522
1572
|
return 0
|
|
1523
1573
|
}
|
|
1524
1574
|
|
|
1575
|
+
/** Read the value that follows a `--flag` in an argv slice; `undefined` when absent or terminal. */
|
|
1576
|
+
function flagValue(flags: string[], name: string): string | undefined {
|
|
1577
|
+
const i = flags.indexOf(name)
|
|
1578
|
+
if (i === -1) return undefined
|
|
1579
|
+
const value = flags[i + 1]
|
|
1580
|
+
return value === undefined || value.startsWith('--') ? undefined : value
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
* tokens:css — emit the `--vx-*` stylesheet, optionally retargeted.
|
|
1585
|
+
*
|
|
1586
|
+
* The escape hatch from installing anything: a static site runs this once (`bunx basalt-ui
|
|
1587
|
+
* tokens:css --selector-attribute data-theme --out src/tokens.css`) and consumes basalt's token
|
|
1588
|
+
* system as plain CSS, with no package in its dependency tree at all. `basalt-ui/tokens.css` is the
|
|
1589
|
+
* same artifact for a consumer that does install; this command exists for the ones that shouldn't
|
|
1590
|
+
* have to just to change a selector.
|
|
1591
|
+
*
|
|
1592
|
+
* It parses flags and calls `buildPaletteCss` — nothing else. No emission logic, no post-processing
|
|
1593
|
+
* of the returned string: the CLI and the API must not be able to disagree about what basalt's
|
|
1594
|
+
* tokens are.
|
|
1595
|
+
*/
|
|
1596
|
+
export function tokensCss(flags: string[], cwd: string = process.cwd()): number {
|
|
1597
|
+
const attribute = flagValue(flags, '--selector-attribute')
|
|
1598
|
+
const darkValue = flagValue(flags, '--dark-value')
|
|
1599
|
+
const lightValue = flagValue(flags, '--light-value')
|
|
1600
|
+
const defaultScheme = flagValue(flags, '--default-scheme')
|
|
1601
|
+
|
|
1602
|
+
const only = flagValue(flags, '--only')
|
|
1603
|
+
|
|
1604
|
+
if (defaultScheme !== undefined && !['dark', 'light', 'none'].includes(defaultScheme)) {
|
|
1605
|
+
console.error(
|
|
1606
|
+
`tokens:css: --default-scheme must be dark, light or none (got '${defaultScheme}')`,
|
|
1607
|
+
)
|
|
1608
|
+
return 1
|
|
1609
|
+
}
|
|
1610
|
+
if (only !== undefined && !['core', 'all'].includes(only)) {
|
|
1611
|
+
console.error(`tokens:css: --only must be core or all (got '${only}')`)
|
|
1612
|
+
return 1
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
const scheme = {
|
|
1616
|
+
...(attribute === undefined ? {} : { attribute }),
|
|
1617
|
+
...(darkValue === undefined ? {} : { darkValue }),
|
|
1618
|
+
...(lightValue === undefined ? {} : { lightValue }),
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
const css = buildPaletteCss({
|
|
1622
|
+
...(Object.keys(scheme).length === 0 ? {} : { scheme }),
|
|
1623
|
+
...(defaultScheme === undefined
|
|
1624
|
+
? {}
|
|
1625
|
+
: { defaultScheme: defaultScheme as 'dark' | 'light' | 'none' }),
|
|
1626
|
+
...(flags.includes('--media-fallback') ? { mediaFallback: true } : {}),
|
|
1627
|
+
...(only === undefined ? {} : { only: only as 'core' | 'all' }),
|
|
1628
|
+
})
|
|
1629
|
+
|
|
1630
|
+
const out = flagValue(flags, '--out')
|
|
1631
|
+
if (out === undefined) {
|
|
1632
|
+
process.stdout.write(`${css}\n`)
|
|
1633
|
+
return 0
|
|
1634
|
+
}
|
|
1635
|
+
const target = isAbsolute(out) ? out : resolve(cwd, out)
|
|
1636
|
+
mkdirSync(dirname(target), { recursive: true })
|
|
1637
|
+
writeFileSync(target, css)
|
|
1638
|
+
console.log(`wrote ${css.split('\n').length} lines → ${relative(cwd, target) || target}`)
|
|
1639
|
+
return 0
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1525
1642
|
/**
|
|
1526
1643
|
* guard-hook — PreToolUse stdin adapter.
|
|
1527
1644
|
*
|
|
@@ -1578,6 +1695,7 @@ export async function guardHook(cwd: string = process.cwd()): Promise<number> {
|
|
|
1578
1695
|
rawFormControl: cfg.rawFormControl ?? DEFAULT_GUARD_CONFIG.rawFormControl,
|
|
1579
1696
|
sub16InputFont: cfg.sub16InputFont ?? DEFAULT_GUARD_CONFIG.sub16InputFont,
|
|
1580
1697
|
allowComment: 'theme-allow',
|
|
1698
|
+
exemptRules: cfg.exemptRules ?? DEFAULT_GUARD_CONFIG.exemptRules,
|
|
1581
1699
|
}
|
|
1582
1700
|
|
|
1583
1701
|
// Honor the consumer's roots / exempt / skip config so the hook never blocks edits to exempted
|
|
@@ -1618,7 +1736,10 @@ export async function guardHook(cwd: string = process.cwd()): Promise<number> {
|
|
|
1618
1736
|
/** The one usage string — printed by `basalt help` / `--help` / `-h` AND the unknown-command fallback. */
|
|
1619
1737
|
const USAGE =
|
|
1620
1738
|
'Usage: basalt-ui <init [--with-router] [--with-query] | sync [--force] [--check] | ' +
|
|
1621
|
-
'check-theme | check-coverage | info [--json] | doctor | guard-hook | help>\n\n' +
|
|
1739
|
+
'check-theme | check-coverage | info [--json] | doctor | guard-hook | tokens:css | help>\n\n' +
|
|
1740
|
+
'tokens:css [--out <path>] [--selector-attribute <attr>] [--dark-value <v>] [--light-value <v>]\n' +
|
|
1741
|
+
' [--default-scheme <dark|light|none>] [--media-fallback] [--only <core|all>]\n' +
|
|
1742
|
+
' Emit the --vx-* stylesheet (stdout unless --out). Defaults reproduce basalt-ui/tokens.css.\n\n' +
|
|
1622
1743
|
'Every subcommand accepts --help / -h to print this message and exit without running.'
|
|
1623
1744
|
|
|
1624
1745
|
/**
|
|
@@ -1662,6 +1783,8 @@ export function run(argv: string[], cwd: string = process.cwd()): number | Promi
|
|
|
1662
1783
|
return doctor(cwd)
|
|
1663
1784
|
case 'guard-hook':
|
|
1664
1785
|
return guardHook(cwd)
|
|
1786
|
+
case 'tokens:css':
|
|
1787
|
+
return tokensCss(flags, cwd)
|
|
1665
1788
|
default:
|
|
1666
1789
|
console.error(USAGE)
|
|
1667
1790
|
return 1
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `basalt-ui tokens:css` — the install-free path to the token system.
|
|
3
|
+
*
|
|
4
|
+
* The contract these tests hold is that the command is a FLAG PARSER, nothing more: whatever it
|
|
5
|
+
* prints must be exactly what `buildPaletteCss` returns for the same options. If the CLI ever grows
|
|
6
|
+
* emission logic of its own, a consumer who ran `bunx basalt-ui tokens:css` and a consumer who
|
|
7
|
+
* imported `basalt-ui/tokens` would be looking at two different design systems.
|
|
8
|
+
*/
|
|
9
|
+
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
|
|
10
|
+
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
11
|
+
import { tmpdir } from 'node:os'
|
|
12
|
+
import { join, resolve } from 'node:path'
|
|
13
|
+
|
|
14
|
+
import { buildPaletteCss } from '../tokens'
|
|
15
|
+
import { run, tokensCss } from './index'
|
|
16
|
+
|
|
17
|
+
const FIXTURE = join(import.meta.dir, '..', '..', 'tests', 'fixtures', 'palette-default.css')
|
|
18
|
+
|
|
19
|
+
let dir: string
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
dir = mkdtempSync(resolve(tmpdir(), 'basalt-tokens-css-'))
|
|
23
|
+
writeFileSync(resolve(dir, 'package.json'), JSON.stringify({ name: 'fixture' }))
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
rmSync(dir, { recursive: true, force: true })
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
/** Run the command with `--out`, returning the written file — stdout is awkward to capture here. */
|
|
31
|
+
function emit(flags: string[], out = 'out.css'): string {
|
|
32
|
+
const code = tokensCss([...flags, '--out', out], dir)
|
|
33
|
+
expect(code).toBe(0)
|
|
34
|
+
return readFileSync(resolve(dir, out), 'utf8')
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('tokens:css', () => {
|
|
38
|
+
it('with no flags emits the shipped default, byte for byte', () => {
|
|
39
|
+
expect(emit([])).toBe(readFileSync(FIXTURE, 'utf8'))
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('forwards the selector flags to buildPaletteCss and adds nothing of its own', () => {
|
|
43
|
+
const flags = ['--selector-attribute', 'data-theme', '--default-scheme', 'light']
|
|
44
|
+
expect(emit(flags)).toBe(
|
|
45
|
+
buildPaletteCss({ scheme: { attribute: 'data-theme' }, defaultScheme: 'light' }),
|
|
46
|
+
)
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('forwards the scheme VALUES and the media fallback', () => {
|
|
50
|
+
const flags = ['--dark-value', 'night', '--light-value', 'day', '--media-fallback']
|
|
51
|
+
expect(emit(flags)).toBe(
|
|
52
|
+
buildPaletteCss({ scheme: { darkValue: 'night', lightValue: 'day' }, mediaFallback: true }),
|
|
53
|
+
)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('forwards --only core', () => {
|
|
57
|
+
expect(emit(['--only', 'core'])).toBe(buildPaletteCss({ only: 'core' }))
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('rejects an unknown --only instead of silently emitting everything', () => {
|
|
61
|
+
expect(tokensCss(['--only', 'spacing', '--out', 'out.css'], dir)).toBe(1)
|
|
62
|
+
expect(existsSync(resolve(dir, 'out.css'))).toBe(false)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('creates the parent directory of --out', () => {
|
|
66
|
+
const css = emit([], 'nested/deep/tokens.css')
|
|
67
|
+
expect(css.startsWith(':root {')).toBe(true)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('rejects an unknown --default-scheme instead of silently defaulting', () => {
|
|
71
|
+
const code = tokensCss(['--default-scheme', 'sepia', '--out', 'out.css'], dir)
|
|
72
|
+
expect(code).toBe(1)
|
|
73
|
+
expect(existsSync(resolve(dir, 'out.css'))).toBe(false)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('`--help` short-circuits before the command runs — no file written', () => {
|
|
77
|
+
const originalLog = console.log
|
|
78
|
+
let log = ''
|
|
79
|
+
console.log = (...args: unknown[]) => {
|
|
80
|
+
log += `${args.join(' ')}\n`
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
expect(run(['tokens:css', '--out', 'out.css', '--help'], dir)).toBe(0)
|
|
84
|
+
} finally {
|
|
85
|
+
console.log = originalLog
|
|
86
|
+
}
|
|
87
|
+
expect(log).toContain('Usage: basalt')
|
|
88
|
+
expect(readdirSync(dir)).toEqual(['package.json'])
|
|
89
|
+
})
|
|
90
|
+
})
|
|
@@ -195,7 +195,13 @@ export function ConnectivityIndicator() {
|
|
|
195
195
|
<ActionIcon
|
|
196
196
|
variant="transparent"
|
|
197
197
|
color={ICON_COLOR[status]}
|
|
198
|
-
size
|
|
198
|
+
// A numeric size, not the named `"md"` — the theme's `ActionIcon.extend` `vars` (see
|
|
199
|
+
// `theme/index.ts`) now re-points a `size="md"` ActionIcon at the density-tracking control-
|
|
200
|
+
// height anchor (for a `size="md"` ActionIcon meant to match a `size="md"` Input/Button), so
|
|
201
|
+
// this plain toolbar icon must opt OUT with an explicit number to keep Mantine's own static
|
|
202
|
+
// `--ai-size-md` (28px at the 16px root) — unaffected by that override (`props.size` is a
|
|
203
|
+
// number here, never the literal string `'md'`) and by the density knob.
|
|
204
|
+
size={28}
|
|
199
205
|
onClick={toggle}
|
|
200
206
|
onMouseEnter={scheduleOpen}
|
|
201
207
|
onMouseLeave={scheduleClose}
|
|
@@ -221,7 +227,6 @@ export function ConnectivityIndicator() {
|
|
|
221
227
|
</Text>
|
|
222
228
|
<Badge
|
|
223
229
|
size="sm"
|
|
224
|
-
radius={6}
|
|
225
230
|
styles={{
|
|
226
231
|
root: {
|
|
227
232
|
backgroundColor: alpha(statusCfg.token, 0.13),
|
|
@@ -229,6 +234,7 @@ export function ConnectivityIndicator() {
|
|
|
229
234
|
fontFamily: 'var(--basalt-font-mono)',
|
|
230
235
|
fontWeight: 600,
|
|
231
236
|
fontSize: VX.text.xs,
|
|
237
|
+
borderRadius: 'var(--vx-radius-ctrl)',
|
|
232
238
|
},
|
|
233
239
|
}}
|
|
234
240
|
>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
.card {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
|
-
gap:
|
|
10
|
+
gap: var(--vx-space-stack-sm);
|
|
11
11
|
text-decoration: none;
|
|
12
12
|
color: inherit;
|
|
13
13
|
}
|
|
@@ -50,6 +50,8 @@
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
.clickable:focus-visible {
|
|
53
|
+
/* Focus-ring width/offset — paired with (and sized off) the outline's own 2px stroke, not a
|
|
54
|
+
* spacing gap; out of scope like a border-shorthand width. */
|
|
53
55
|
outline: 2px solid var(--vx-accent);
|
|
54
56
|
outline-offset: 2px;
|
|
55
57
|
}
|
|
@@ -83,12 +85,12 @@
|
|
|
83
85
|
.tags {
|
|
84
86
|
display: flex;
|
|
85
87
|
flex-wrap: wrap;
|
|
86
|
-
gap:
|
|
88
|
+
gap: var(--vx-space-article-card-tags-gap);
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
.tag {
|
|
90
|
-
padding:
|
|
91
|
-
border-radius:
|
|
92
|
+
padding: var(--vx-space-article-card-tag-inset-y) var(--vx-space-article-card-tag-inset-x);
|
|
93
|
+
border-radius: var(--vx-radius-fine);
|
|
92
94
|
background-color: color-mix(in srgb, var(--vx-ink) 6%, transparent);
|
|
93
95
|
color: var(--vx-muted);
|
|
94
96
|
font-size: var(--vx-text-micro);
|
|
@@ -100,7 +102,7 @@
|
|
|
100
102
|
* meta baseline regardless of how many lines each description clamps to. */
|
|
101
103
|
.meta {
|
|
102
104
|
margin-top: auto;
|
|
103
|
-
padding-top:
|
|
105
|
+
padding-top: var(--vx-space-article-card-meta-gap-top);
|
|
104
106
|
font-family: var(--basalt-font-mono);
|
|
105
107
|
font-size: var(--vx-text-micro);
|
|
106
108
|
letter-spacing: 0.06em;
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
.root {
|
|
10
10
|
display: grid;
|
|
11
|
-
grid-template-columns: minmax(0, var(--vx-prose-measure))
|
|
11
|
+
grid-template-columns: minmax(0, var(--vx-prose-measure)) var(--vx-space-article-toc-rail-width);
|
|
12
12
|
justify-content: center;
|
|
13
|
-
column-gap:
|
|
13
|
+
column-gap: var(--vx-space-article-column-gap);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.root.noToc {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
grid-column: 1;
|
|
32
32
|
display: flex;
|
|
33
33
|
flex-direction: column;
|
|
34
|
-
gap:
|
|
35
|
-
padding-bottom:
|
|
36
|
-
margin-bottom:
|
|
34
|
+
gap: var(--vx-space-article-header-gap);
|
|
35
|
+
padding-bottom: var(--vx-space-article-header-padding-bottom);
|
|
36
|
+
margin-bottom: var(--vx-space-article-header-margin-bottom);
|
|
37
37
|
border-bottom: 1px solid var(--vx-divider);
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
.metaRow {
|
|
57
57
|
display: flex;
|
|
58
58
|
align-items: center;
|
|
59
|
-
gap:
|
|
59
|
+
gap: var(--vx-space-article-meta-row-gap);
|
|
60
60
|
font-family: var(--basalt-font-mono);
|
|
61
61
|
font-size: var(--vx-text-micro);
|
|
62
62
|
letter-spacing: 0.06em;
|
|
@@ -72,7 +72,11 @@
|
|
|
72
72
|
.tocRail {
|
|
73
73
|
grid-column: 2;
|
|
74
74
|
position: sticky;
|
|
75
|
-
|
|
75
|
+
/* DESKTOP-only value on purpose (no `< sm` override needed): the rail is already `display: none`
|
|
76
|
+
* below the 1200px `@media` breakpoint just above, well above the `sm` (48em/768px) breakpoint
|
|
77
|
+
* that switches BasaltShell's header — and, by extension, this clearance — to its mobile value
|
|
78
|
+
* (see `content/prose.module.css` for the responsive split; docs/CONTENT-SPEC.md §5). */
|
|
79
|
+
top: var(--vx-space-sticky-header-clearance);
|
|
76
80
|
align-self: start;
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -80,9 +84,9 @@
|
|
|
80
84
|
grid-column: 1;
|
|
81
85
|
display: grid;
|
|
82
86
|
grid-template-columns: 1fr 1fr;
|
|
83
|
-
gap:
|
|
84
|
-
margin-top:
|
|
85
|
-
padding-top:
|
|
87
|
+
gap: var(--vx-space-article-footer-gap);
|
|
88
|
+
margin-top: var(--vx-space-article-footer-margin-top);
|
|
89
|
+
padding-top: var(--vx-space-article-footer-padding-top);
|
|
86
90
|
border-top: 1px solid var(--vx-divider);
|
|
87
91
|
}
|
|
88
92
|
|
|
@@ -96,7 +100,7 @@
|
|
|
96
100
|
.navCell {
|
|
97
101
|
display: flex;
|
|
98
102
|
flex-direction: column;
|
|
99
|
-
gap:
|
|
103
|
+
gap: var(--vx-space-stack-xs);
|
|
100
104
|
text-decoration: none;
|
|
101
105
|
color: inherit;
|
|
102
106
|
}
|
|
@@ -117,7 +121,7 @@
|
|
|
117
121
|
.navTarget {
|
|
118
122
|
display: flex;
|
|
119
123
|
align-items: center;
|
|
120
|
-
gap:
|
|
124
|
+
gap: var(--vx-space-article-nav-target-gap);
|
|
121
125
|
font-family: var(--basalt-font-head);
|
|
122
126
|
font-stretch: 88%;
|
|
123
127
|
font-weight: 550;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.root {
|
|
8
8
|
border-radius: var(--vx-radius-card);
|
|
9
|
-
padding:
|
|
9
|
+
padding: var(--vx-space-callout-inset-y) var(--vx-space-callout-inset-x);
|
|
10
10
|
border-left: 2px solid var(--callout-ink);
|
|
11
11
|
background: color-mix(in srgb, var(--callout-ink) 8%, transparent);
|
|
12
12
|
}
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
.titleRow {
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: center;
|
|
41
|
-
gap:
|
|
42
|
-
margin-bottom:
|
|
41
|
+
gap: var(--vx-space-callout-title-row-gap);
|
|
42
|
+
margin-bottom: var(--vx-space-stack-xs);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.icon {
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.body p {
|
|
76
|
-
margin: 0 0
|
|
76
|
+
margin: 0 0 var(--vx-space-stack-sm);
|
|
77
77
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.container {
|
|
8
8
|
position: relative;
|
|
9
|
-
border-radius:
|
|
9
|
+
border-radius: var(--vx-radius-floating);
|
|
10
10
|
background-color: color-mix(in srgb, var(--vx-ink) 6%, transparent);
|
|
11
11
|
overflow: hidden;
|
|
12
12
|
}
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
display: flex;
|
|
16
16
|
align-items: center;
|
|
17
17
|
justify-content: space-between;
|
|
18
|
-
gap:
|
|
19
|
-
padding:
|
|
18
|
+
gap: var(--vx-space-code-block-header-gap);
|
|
19
|
+
padding: var(--vx-space-code-block-header-inset-y) var(--vx-space-code-block-header-inset-right)
|
|
20
|
+
var(--vx-space-code-block-header-inset-y) var(--vx-space-code-block-content-inset-x);
|
|
20
21
|
border-bottom: 1px solid var(--vx-divider);
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
.headerRight {
|
|
33
34
|
display: flex;
|
|
34
35
|
align-items: center;
|
|
35
|
-
gap:
|
|
36
|
+
gap: var(--vx-space-code-block-header-right-gap);
|
|
36
37
|
flex-shrink: 0;
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
font-family: var(--basalt-font-mono);
|
|
52
53
|
font-size: var(--vx-text-sm);
|
|
53
54
|
line-height: 1.6;
|
|
54
|
-
padding:
|
|
55
|
+
padding: var(--vx-space-code-block-body-inset-y) var(--vx-space-code-block-content-inset-x);
|
|
55
56
|
overflow-x: auto;
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -74,8 +75,8 @@ html[data-mantine-color-scheme='light'] .body :global(.shiki span) {
|
|
|
74
75
|
/* Floating copy button — shown only when there is no header (no title), revealed on hover/focus. */
|
|
75
76
|
.floatingCopy {
|
|
76
77
|
position: absolute;
|
|
77
|
-
top:
|
|
78
|
-
right:
|
|
78
|
+
top: var(--vx-space-code-block-floating-copy-offset);
|
|
79
|
+
right: var(--vx-space-code-block-floating-copy-offset);
|
|
79
80
|
opacity: 0;
|
|
80
81
|
transition: opacity 120ms ease;
|
|
81
82
|
}
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.body {
|
|
16
|
-
padding-bottom:
|
|
16
|
+
padding-bottom: var(--vx-space-guide-body-gap-bottom);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.footer {
|
|
20
|
-
margin-top:
|
|
21
|
-
padding-top:
|
|
20
|
+
margin-top: var(--vx-space-guide-footer-gap-top);
|
|
21
|
+
padding-top: var(--vx-space-guide-footer-inset-top);
|
|
22
22
|
border-top: 1px solid var(--vx-divider);
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
.container {
|
|
9
9
|
display: flex;
|
|
10
10
|
justify-content: center;
|
|
11
|
-
border-radius:
|
|
11
|
+
border-radius: var(--vx-radius-floating);
|
|
12
12
|
background-color: color-mix(in srgb, var(--vx-ink) 6%, transparent);
|
|
13
|
-
padding:
|
|
13
|
+
padding: var(--vx-space-mermaid-container-inset);
|
|
14
14
|
overflow-x: auto;
|
|
15
15
|
}
|
|
16
16
|
|