Commit 3f1e4b9
authored
feat: Move StartupJS UI theme system to CSSX (#41)
## Summary
- migrate StartupJS UI to the CSSX-first theme model backed by CSS
variables, component tag selectors, and `:part()` overrides
- compose `UiProvider` from CSSX Tailwind tokens, CSSX shadcn semantic
tokens, and `startupjsUiTheme.cssx.css`, with app-provided
`StartupjsProvider style` layered after UI defaults
- replace the old palette/Colors/CssVariables theme runtime with normal
CSSX `:root` variables and semantic `--color-*` tokens
- remove public `useThemeColor()`, `getThemeColor()`,
`getThemeColorVariableName()`, `Colors`, `Palette`, `CssVariables`,
`generateColors`, and `useColors` APIs
- keep `@startupjs-ui/core` as a tiny non-style package for the `UIRole`
type only
- refactor component JS color reads to CSSX `useCssColor()` /
`useCssVariable()` primitives re-exported from `startupjs`
- inline all component, demo, MDX renderer, and docs styles into local
`css` templates; only the package-level `startupjsUiTheme.cssx.css`
theme asset remains
- replace Stylus helpers, `$UI`, `u`, `:export config`, and separate
`.cssx.styl` files with CSS variables, `rem`, `color-mix()`, `oklch()`,
and CSSX custom media
- preserve component customization through `themed(name, Component)`,
component tag selectors, semantic `part` props, and per-instance `style`
/ `*Style` props
- update documentation to present `StartupjsProvider style`, CSSX
tokens, tag overrides, and `:part()` as the customization model
- keep the generic Styling guide as the canonical theming doc while
component pages document only their own parts and variables/defaults
- memoize the UI provider style layer array so provider context does not
churn when `style` is unchanged
- improve generated part reference extraction for conditional part
arrays such as TextInput icon parts
## Why
CSSX now owns provider-scoped `:root` variables, global utility classes,
component tag selectors, `:part()` / `::part()` overrides, subscribed
CSS variable reads, OKLCH evaluation, and `color-mix()`. Keeping palette
generation, theme-color hooks, theme context, component override wiring,
or style helpers inside startupjs-ui would duplicate that model and keep
theming in the wrong layer.
With this change, the StartupJS UI theme is normal CSSX CSS:
```css
:root {
--color-primary: oklch(0.55 0.22 260);
--Button-radius: var(--radius-md);
}
Button {
border-radius: 12px;
}
Button:part(text) {
color: var(--color-primary-foreground);
}
```
Component color props still accept tokens such as `primary`, which map
to `--color-primary`. Raw CSS values and `var(--x)` remain valid where
component props accept raw colors.
## Related PRs
- startupjs/cssx#5 adds the unified CSSX compiler/runtime,
`CssxProvider`, provider-scoped `:root`, component tag selectors, CSS
variable/color hooks, OKLCH/color-mix evaluation, custom media, runtime
CSS support, and source-condition types.
- startupjs/startupjs#1327 wires `StartupjsProvider style` and `theme`
into CSSX so framework users can configure this without importing CSSX
directly.
## Validation
- `node scripts/update-style-reference-docs.mjs` idempotency check
- `yarn generate-package-dts`
- `node scripts/check-startupjs-ui-exports.mjs`
- `yarn build` for the docs app
- `git diff --check`
- CSSX docs/provider smoke with local source links:
- generic `/docs/Styling` theming guide renders and remains the
canonical styling model doc
- `/docs/TextInput` renders and includes conditional `inputIconLeft` /
`inputIconRight` parts
- component docs for Button, Item, Div, and DateTimePicker render their
generated Styling reference sections
- component reference sections list parts and component-specific
variables/defaults and link back to the generic Styling guide
- no unknown CSS color token warnings or page errors observed
- Storybook runtime smoke through `http://localhost:4400/iframe.html`:
- Introduction/Overview
- Actions/Button
- Data/Item
- Display/Badge
- Feedback/Modal
- Overlay/Popover
- System/StartupJS UI
- Inputs/TextInput
- Inputs/DateTimePicker
- Visual screenshots checked for Styling, Button, Item, DateTimePicker,
provider, and popover pages/stories.
- Known during DateTimePicker smoke: Moment Timezone logs its existing
missing timezone-data warning; no CSS token, page, or provider errors
were observed.
- Previous validation in this draft also included `yarn install
--immutable --mode=skip-build`, targeted eslint over migrated
packages/docs slices, and direct CSS-template compile smoke over
`packages/` plus `startupjsUiTheme.cssx.css`.
## Review Focus
- token naming and override surface in `startupjsUiTheme.cssx.css`
- remaining public API compatibility that should intentionally stay or
be removed for the breaking release
- `part` coverage on roots and semantically useful sub-elements
- JS-only color bridge usage where CSS variables could replace code
- docs clarity around `StartupjsProvider style`, CSSX variables,
component tag selectors, and `:part()` overrides1 parent b11b137 commit 3f1e4b9
397 files changed
Lines changed: 7682 additions & 5453 deletions
File tree
- docs
- app
- docs
- migration-guides
- packages
- abstract-popover
- alert
- array-input
- auto-suggest
- avatar
- badge
- breadcrumbs
- br
- button
- card
- carousel
- checkbox
- collapse
- CollapseContent
- CollapseHeader
- color-picker
- content
- core
- helpers
- hooks
- styles
- theming
- date-time-picker
- components
- Calendar
- Days
- Header
- TimeSelect
- dialogs
- divider
- div
- docs
- client
- app/Layout
- Sidebar/Content
- Docs
- Options
- components/Props
- Constructor
- Tr
- TypeCell
- Renderer
- GridVisualizer
- draggable
- Draggable
- Droppable
- drawer-sidebar
- drawer
- dropdown
- components
- Caption
- Item
- file-input
- flat-list
- form
- icon
- input
- item
- layout
- link
- loader
- mdx/client
- Code
- mdxComponents
- modal
- ModalActions
- ModalContent
- ModalHeader
- multi-select
- number-input
- object-input
- pagination
- password-input
- popover
- portal
- progress
- radio
- range-input
- Label
- rank
- rating
- Star
- scroll-view
- select
- Wrapper
- sidebar
- smart-sidebar
- span
- startupjs-ui
- exports
- table
- Table
- Tbody
- Td
- Thead
- Th
- Tr
- tabs
- Bar
- tag
- text-input
- toast
- user
- scripts
- storybook
- stories
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 4 | + | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments