Token pipeline (Style Dictionary v4, DTCG format): - Primitive tokens: colour palettes (brand, sage, neutral, feedback), typography (3 font families, 21-variant type scale), spacing (4px grid), border radius, shadows, opacity - Semantic tokens: text, surface, border, interactive, feedback colours; typography roles; layout spacing - Component tokens: Button (4 sizes), Input (2 sizes) - Generated outputs: CSS custom properties, JS ES6 module, flat JSON Atoms (3 components): - Button: contained/soft/outlined/text × primary/secondary, 4 sizes, loading state, underline for text variant - Typography: 21 variants across display/heading/body/label/caption/overline, maxLines truncation - Input: external label, helper text, error/success validation, start/end icons, required indicator, 2 sizes, multiline support Infrastructure: - MUI v5 theme with full token mapping - Storybook 8 with autodocs - Claude Code agents and skills for token/component workflows - Design system documentation and cross-session memory Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
/**
|
|
* Style Dictionary configuration for FA Design System (v4)
|
|
*
|
|
* Transforms W3C DTCG token JSON into:
|
|
* - CSS custom properties (for runtime theming)
|
|
* - JavaScript ES6 module (for MUI theme consumption)
|
|
* - JSON (for Penpot import)
|
|
*/
|
|
|
|
import StyleDictionary from 'style-dictionary';
|
|
|
|
const sd = new StyleDictionary({
|
|
source: ['tokens/**/*.json'],
|
|
usesDtcg: true,
|
|
|
|
platforms: {
|
|
// CSS custom properties
|
|
css: {
|
|
transformGroup: 'css',
|
|
prefix: 'fa',
|
|
buildPath: 'src/theme/generated/',
|
|
files: [{
|
|
destination: 'tokens.css',
|
|
format: 'css/variables',
|
|
options: {
|
|
outputReferences: true,
|
|
},
|
|
}],
|
|
},
|
|
|
|
// JavaScript ES6 module for MUI theme
|
|
js: {
|
|
transformGroup: 'js',
|
|
buildPath: 'src/theme/generated/',
|
|
files: [{
|
|
destination: 'tokens.js',
|
|
format: 'javascript/es6',
|
|
}],
|
|
},
|
|
|
|
// Flat JSON for Penpot import and other tools
|
|
json: {
|
|
transformGroup: 'js',
|
|
buildPath: 'tokens/export/',
|
|
files: [{
|
|
destination: 'tokens-flat.json',
|
|
format: 'json/flat',
|
|
}],
|
|
},
|
|
},
|
|
});
|
|
|
|
await sd.buildAllPlatforms();
|