mirror of
https://github.com/hunvreus/basecoat.git
synced 2026-11-12 13:18:22 +00:00
4.5 KiB
4.5 KiB
Basecoat Multi-Style + Theme Refactor Plan
Goals
- Support the current shadcn/ui visual packs:
vega,nova,maia,lyra,mira,luma,sera,rhea. - Keep current CDN and Tailwind/NPM usage working.
- Keep Basecoat's own class API (
btn,dialog,popover, etc.). - Split CSS into base tokens/utilities, component structure, style-pack visuals, and aggregate outputs.
- Make custom token themes, including TweakCN-style themes, predictable by loading them after Basecoat CSS.
Current Upstream Reference
- Local repo:
../_sandbox/shadcn-ui - Style registry:
../_sandbox/shadcn-ui/apps/v4/registry/styles.tsx - Style files:
../_sandbox/shadcn-ui/apps/v4/registry/styles/style-{vega,nova,maia,lyra,mira,luma,sera,rhea}.css - Base components:
../_sandbox/shadcn-ui/apps/v4/registry/bases/base/ui/<component>.tsx
Target CSS Architecture
src/css/base/base.css- base layer, default token fallbacks, and semantic utilities needed by CDN users
src/css/components/*.css- Basecoat component selectors and shared structural behavior
src/css/styles/style-*.css- one file per style pack:
vega,nova,maia,lyra,mira,luma,sera,rhea - component visuals: size, spacing, radius, typography, shadows, focus rings, variant colors when style-owned
- one file per style pack:
- Aggregates
src/css/basecoat.css: backward-compatible default aggregate, includes Vegasrc/css/basecoat.all.css: explicit all-in-one Tailwind sourcesrc/css/basecoat.cdn.css: CDN build entry
No .style-* wrapper is part of the Basecoat public contract for style selection. Users choose a style by importing a style file or using a style-specific generated asset. Docs may switch by swapping stylesheet URLs.
Per-Component File Checklist
For every component, check these files before editing:
- Basecoat component CSS:
src/css/components/<component>.css - Basecoat templates/macros if relevant:
src/nunjucks/*.njk,src/jinja/*.html.jinja - Basecoat docs examples:
docs/src/components/<component>.njk - Upstream base component:
../_sandbox/shadcn-ui/apps/v4/registry/bases/base/ui/<component>.tsx - Upstream style packs:
../_sandbox/shadcn-ui/apps/v4/registry/styles/style-{vega,nova,maia,lyra,mira,luma,sera,rhea}.css - Basecoat style packs:
src/css/styles/style-{vega,nova,maia,lyra,mira,luma,sera,rhea}.css
Component Migration Workflow
- Review current Basecoat CSS, markup, templates, and docs for the component.
- Review the upstream base component and all eight upstream style files.
- Decide what is shared structure versus style-pack-owned visual rules.
- Remove outdated visual rules from shared component CSS when they are now style-owned.
- Map upstream style intent onto Basecoat selectors. Do not port
cn-*selectors. - Update the component section in all eight Basecoat style files.
- Document non-trivial deltas as
intentional,drift fixed, ordeferred. - Update
migration-tracker.md. - Run
npm run build. - Run
npm run docs:buildwhen docs or docs style assets change. - Manually verify the docs page in light/dark and all eight styles.
Do not mark a component done because CSS compiles. It needs a visual/state check.
Packaging Contract
- Keep
@import "basecoat-css";as the default Vega-compatible import. - Keep existing CDN files and JS bundle paths.
- Export split style files from
packages/cssasbasecoat-css/styles/<style>. - Keep the default CDN output equivalent to Vega unless a separate style-specific CDN asset is explicitly added.
- Custom themes should load after Basecoat styles so their
:rootand.darktokens override defaults.
Component Migration Order
buttonbutton-groupinputtextareanative-selectselectcheckboxradioswitchrangelabelfieldcardalertbadgetabletabspopoverdropdown-menudialogcommandsidebartoasttooltipcollapsiblekbd
Current Status
- CSS split exists.
- Docs style switcher exists.
- Button is started and style sections exist for all eight styles.
- Button still needs a strict browser audit across all eight styles and light/dark.
- No other component should be considered migrated.
Risks
- Selector drift between Basecoat markup and upstream shadcn/ui assumptions.
- Incorrectly leaving visual rules in shared component CSS.
- Bundle growth from style-specific assets.
- Docs style assets need base semantic utilities available during Tailwind compilation.