basalt-ui 1.19.0 → 1.20.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 +15 -1
- package/CHANGELOG.md +27 -0
- package/MIGRATING.md +228 -0
- package/README.md +53 -9
- package/agent/rules/basalt-app.md +43 -0
- package/agent/rules/basalt-charts.md +26 -14
- package/agent/rules/basalt-mantine.md +25 -10
- package/agent/rules/basalt-router.md +22 -10
- package/agent/rules/basalt-tokens.md +75 -6
- package/agent/skills/basalt-app/SKILL.md +42 -6
- package/configs/check.yml +11 -4
- package/configs/lefthook.yml +21 -2
- package/configs/oxlint-plugin.js +515 -25
- package/configs/oxlint-plugin.test.ts +383 -10
- package/configs/oxlint.json +10 -1
- package/dist/agent/stick-to-bottom.js +1 -1
- package/dist/agent-chat/thread-detail-panel.js +1 -1
- package/dist/agent-chat/thread-message.js +2 -2
- package/dist/agent-chat/tool-chip.js +1 -1
- package/dist/charts/kinds/Donut.d.ts.map +1 -1
- package/dist/charts/kinds/Donut.js +1 -1
- package/dist/charts/primitives/ChartLegend.js +2 -2
- package/dist/charts/primitives/ChartTooltip.js +1 -1
- package/dist/cli/index.d.ts +107 -15
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +610 -72
- package/dist/cli/toolchain-wiring.test.d.ts +2 -0
- package/dist/cli/toolchain-wiring.test.d.ts.map +1 -0
- package/dist/dashboard/delta-badge.js +2 -2
- package/dist/dashboard/stat-card.js +1 -1
- package/dist/data/virtual-list.js +5 -5
- package/dist/guard/index.d.ts +56 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +326 -59
- package/dist/guard/types.d.ts +25 -5
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/register.d.ts +25 -0
- package/dist/register.d.ts.map +1 -1
- package/dist/shell/app-mobile-nav.d.ts.map +1 -1
- package/dist/shell/app-mobile-nav.js +14 -14
- package/dist/shell/app-mobile-nav.module.css +44 -11
- package/dist/shell/app-mobile-nav.module.css.d.ts +1 -1
- package/dist/surfaces.d.ts +1 -1
- package/dist/surfaces.js +1 -1
- package/dist/tokens/index.d.ts +3 -3
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +2 -0
- package/dist/tokens/palette.d.ts +35 -27
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +24 -18
- package/dist/tokens.css +19 -17
- package/dist/vite-color-mix.js +2 -2
- package/llms.txt +3 -3
- package/package.json +4 -3
- package/src/agent/stick-to-bottom.tsx +1 -1
- package/src/agent-chat/thread-detail-panel.tsx +1 -1
- package/src/agent-chat/thread-message.tsx +3 -3
- package/src/agent-chat/tool-chip.tsx +1 -1
- package/src/charts/kinds/Donut.tsx +2 -1
- package/src/charts/primitives/ChartLegend.tsx +2 -2
- package/src/charts/primitives/ChartTooltip.tsx +1 -1
- package/src/cli/index.ts +1070 -99
- package/src/cli/init-sync.test.ts +19 -3
- package/src/cli/tokens-css.test.ts +27 -14
- package/src/cli/toolchain-wiring.test.ts +694 -0
- package/src/dashboard/delta-badge.tsx +3 -3
- package/src/dashboard/stat-card.tsx +1 -1
- package/src/data/virtual-list.tsx +8 -8
- package/src/guard/check-source.test.ts +663 -11
- package/src/guard/index.ts +727 -94
- package/src/guard/types.ts +29 -4
- package/src/register.ts +32 -0
- package/src/shell/app-mobile-nav.module.css +44 -11
- package/src/shell/app-mobile-nav.module.css.d.ts +1 -1
- package/src/shell/app-mobile-nav.test.tsx +34 -0
- package/src/shell/app-mobile-nav.tsx +16 -5
- package/src/surfaces.ts +1 -1
- package/src/theme/density-relations.test.ts +8 -5
- package/src/theme/spacing.test.ts +2 -0
- package/src/theme-toggle/index.tsx +2 -2
- package/src/tokens/index.ts +5 -3
- package/src/tokens/palette.ts +24 -18
- package/src/vite-color-mix.ts +2 -2
|
@@ -119,6 +119,12 @@ describe('doctor — CLI vs installed basalt-ui version', () => {
|
|
|
119
119
|
).version
|
|
120
120
|
|
|
121
121
|
it('warns when node_modules/basalt-ui version differs from the running CLI', () => {
|
|
122
|
+
// A Mantine dependency puts doctor in the framework profile — without one it reads as a
|
|
123
|
+
// tokens-only consumer, where the missing scaffold is not a failure at all.
|
|
124
|
+
writeFixture(
|
|
125
|
+
'package.json',
|
|
126
|
+
JSON.stringify({ name: 'fixture', dependencies: { '@mantine/core': '^9' } }),
|
|
127
|
+
)
|
|
122
128
|
writeFixture(
|
|
123
129
|
'node_modules/basalt-ui/package.json',
|
|
124
130
|
JSON.stringify({ name: 'basalt-ui', version: '0.4.2' }),
|
|
@@ -132,6 +138,14 @@ describe('doctor — CLI vs installed basalt-ui version', () => {
|
|
|
132
138
|
})
|
|
133
139
|
|
|
134
140
|
it('passes when node_modules/basalt-ui version matches the running CLI', () => {
|
|
141
|
+
// A full fixture, not just the manifest: doctor also asserts the guard scans something and the
|
|
142
|
+
// oxlint preset is wired, and a green exit has to mean all of it.
|
|
143
|
+
writeFixture('package.json', JSON.stringify({ name: 'fixture', basalt: { roots: ['src'] } }))
|
|
144
|
+
writeFixture('src/app.tsx', 'export const App = () => null\n')
|
|
145
|
+
writeFixture(
|
|
146
|
+
'.oxlintrc.json',
|
|
147
|
+
'{ "extends": ["./node_modules/basalt-ui/configs/oxlint.json"] }',
|
|
148
|
+
)
|
|
135
149
|
writeFixture(MANIFEST_PATH, JSON.stringify({ version: 1, files: {} }, null, 2))
|
|
136
150
|
writeFixture(
|
|
137
151
|
'node_modules/basalt-ui/package.json',
|
|
@@ -142,11 +156,13 @@ describe('doctor — CLI vs installed basalt-ui version', () => {
|
|
|
142
156
|
expect(log).toContain('matches the installed basalt-ui')
|
|
143
157
|
})
|
|
144
158
|
|
|
145
|
-
it('
|
|
159
|
+
it('reports the version checks as SKIPPED when the package cannot be resolved', () => {
|
|
146
160
|
writeFixture(MANIFEST_PATH, JSON.stringify({ version: 1, files: {} }, null, 2))
|
|
147
|
-
const { log } = capture(() => doctor(dir))
|
|
148
|
-
expect(log).not.toContain('differs from the installed basalt-ui')
|
|
161
|
+
const { code, log } = capture(() => doctor(dir))
|
|
149
162
|
expect(log).not.toContain('matches the installed basalt-ui')
|
|
163
|
+
// Silence was the bug: two of five checks used to vanish while the footer still read green.
|
|
164
|
+
expect(log).toContain('SKIPPED')
|
|
165
|
+
expect(code).toBe(1)
|
|
150
166
|
})
|
|
151
167
|
})
|
|
152
168
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `basalt-ui tokens:css` — the install-free path to the token system.
|
|
3
3
|
*
|
|
4
|
-
* The contract these tests hold is that the command
|
|
5
|
-
* prints must be exactly what `buildPaletteCss` returns for the same options
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The contract these tests hold is that the command holds no emission logic of its own: the token
|
|
5
|
+
* VALUES it prints must be exactly what `buildPaletteCss` returns for the same options, or a
|
|
6
|
+
* consumer who ran `bunx basalt-ui tokens:css` and one who imported `basalt-ui/tokens` would be
|
|
7
|
+
* looking at two different design systems. What the command DOES add is file framing for an
|
|
8
|
+
* artifact a consumer commits — the `@generated` header, a trailing newline, `rgba()` spacing —
|
|
9
|
+
* which `body()` below strips before every comparison. See `./toolchain-wiring.test.ts` for the
|
|
10
|
+
* framing's own tests.
|
|
8
11
|
*/
|
|
9
12
|
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
|
|
10
13
|
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
@@ -12,7 +15,7 @@ import { tmpdir } from 'node:os'
|
|
|
12
15
|
import { join, resolve } from 'node:path'
|
|
13
16
|
|
|
14
17
|
import { buildPaletteCss } from '../tokens'
|
|
15
|
-
import { run, tokensCss } from './index'
|
|
18
|
+
import { normalizeColorFunctions, run, tokensCss } from './index'
|
|
16
19
|
|
|
17
20
|
const FIXTURE = join(import.meta.dir, '..', '..', 'tests', 'fixtures', 'palette-default.css')
|
|
18
21
|
|
|
@@ -34,27 +37,37 @@ function emit(flags: string[], out = 'out.css'): string {
|
|
|
34
37
|
return readFileSync(resolve(dir, out), 'utf8')
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
/** The emitted file minus the two-line generated header and the trailing newline. */
|
|
41
|
+
function body(flags: string[], out = 'out.css'): string {
|
|
42
|
+
return emit(flags, out).split('\n').slice(2).join('\n').replace(/\n$/, '')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** What `buildPaletteCss` returns, in the CLI's commit-safe formatting. */
|
|
46
|
+
function expected(opts: Parameters<typeof buildPaletteCss>[0]): string {
|
|
47
|
+
return normalizeColorFunctions(buildPaletteCss(opts))
|
|
48
|
+
}
|
|
49
|
+
|
|
37
50
|
describe('tokens:css', () => {
|
|
38
|
-
it('with no flags emits the shipped default, byte for byte', () => {
|
|
39
|
-
expect(
|
|
51
|
+
it('with no flags emits the shipped default, byte for byte under the header', () => {
|
|
52
|
+
expect(body([])).toBe(normalizeColorFunctions(readFileSync(FIXTURE, 'utf8')))
|
|
40
53
|
})
|
|
41
54
|
|
|
42
55
|
it('forwards the selector flags to buildPaletteCss and adds nothing of its own', () => {
|
|
43
56
|
const flags = ['--selector-attribute', 'data-theme', '--default-scheme', 'light']
|
|
44
|
-
expect(
|
|
45
|
-
|
|
57
|
+
expect(body(flags)).toBe(
|
|
58
|
+
expected({ scheme: { attribute: 'data-theme' }, defaultScheme: 'light' }),
|
|
46
59
|
)
|
|
47
60
|
})
|
|
48
61
|
|
|
49
62
|
it('forwards the scheme VALUES and the media fallback', () => {
|
|
50
63
|
const flags = ['--dark-value', 'night', '--light-value', 'day', '--media-fallback']
|
|
51
|
-
expect(
|
|
52
|
-
|
|
64
|
+
expect(body(flags)).toBe(
|
|
65
|
+
expected({ scheme: { darkValue: 'night', lightValue: 'day' }, mediaFallback: true }),
|
|
53
66
|
)
|
|
54
67
|
})
|
|
55
68
|
|
|
56
69
|
it('forwards --only core', () => {
|
|
57
|
-
expect(
|
|
70
|
+
expect(body(['--only', 'core'])).toBe(expected({ only: 'core' }))
|
|
58
71
|
})
|
|
59
72
|
|
|
60
73
|
it('rejects an unknown --only instead of silently emitting everything', () => {
|
|
@@ -64,7 +77,7 @@ describe('tokens:css', () => {
|
|
|
64
77
|
|
|
65
78
|
it('creates the parent directory of --out', () => {
|
|
66
79
|
const css = emit([], 'nested/deep/tokens.css')
|
|
67
|
-
expect(css.
|
|
80
|
+
expect(css).toContain(':root {')
|
|
68
81
|
})
|
|
69
82
|
|
|
70
83
|
it('rejects an unknown --default-scheme instead of silently defaulting', () => {
|
|
@@ -87,7 +100,7 @@ describe('tokens:css', () => {
|
|
|
87
100
|
})
|
|
88
101
|
|
|
89
102
|
it('--no-legacy-aliases output is byte-identical to buildPaletteCss({ legacyAliases: false }) — the CLI holds no emission logic of its own', () => {
|
|
90
|
-
expect(
|
|
103
|
+
expect(body(['--no-legacy-aliases'])).toBe(expected({ legacyAliases: false }))
|
|
91
104
|
})
|
|
92
105
|
|
|
93
106
|
it('`--help` short-circuits before the command runs — no file written', () => {
|