Summary
Upgrade the dataviz-components library from its current custom CSS design system to Tailwind CSS v4, leveraging the new theme syntax and modern CSS features.
Current State Analysis
After analyzing the codebase, the library currently uses:
- Custom CSS design system: Defined in
src/lib/Theme/Theme.svelte using CSS custom properties (CSS variables)
- Design tokens: Comprehensive system with:
- Typography (font families, sizes, weights, line heights)
- Color palette (blue, gray, yellow, magenta, green, red, space-gray with shade variations)
- Spacing scale (1-20, using rem units)
- Layout constraints (body/wide max-widths)
- Global styles: Typography defaults for headings, paragraphs, links, lists with responsive variations
- Theme compilation: Custom build process (
bin/compileTheme.js) that extracts CSS from Svelte component and generates dist/style/theme.css
- No Tailwind dependency: Currently no Tailwind CSS found in package.json or configuration files
Migration Tasks
1. Install and Configure Tailwind v4
2. Convert Design System to Tailwind Theme
3. Update Theme.svelte Component
4. Update Build Process
5. Component Migration Strategy
6. Documentation and Testing
Technical Considerations
- Backward Compatibility: Consider maintaining CSS custom properties alongside Tailwind for gradual migration
- Bundle Size: Evaluate impact on library size and implement PurgeCSS/tree-shaking appropriately
- Performance: Ensure theme compilation performance doesn't regress from current build time
- Design Token Fidelity: Maintain exact color values and spacing scale during migration
- Build Integration: Seamless integration with existing Svelte/SvelteKit + Storybook workflow
Acceptance Criteria
Summary
Upgrade the dataviz-components library from its current custom CSS design system to Tailwind CSS v4, leveraging the new theme syntax and modern CSS features.
Current State Analysis
After analyzing the codebase, the library currently uses:
src/lib/Theme/Theme.svelteusing CSS custom properties (CSS variables)bin/compileTheme.js) that extracts CSS from Svelte component and generatesdist/style/theme.cssMigration Tasks
1. Install and Configure Tailwind v4
npx sv add tailwindcss2. Convert Design System to Tailwind Theme
Theme.svelte:11-147to Tailwind theme configuration3. Update Theme.svelte Component
4. Update Build Process
compile-theme-stylesscript in package.json:8bin/compileTheme.jsto work with Tailwind compilationdist/style/theme.cssoutput maintains same public API./style/themeexport)5. Component Migration Strategy
6. Documentation and Testing
src/lib/Theme/Theme.docs.mdx)Technical Considerations
Acceptance Criteria
theme.cssoutput for consumers