@umoa/saascfm-css 0.1.0 → 0.1.1
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/README.md +29 -10
- package/package.json +1 -1
- package/templates/js/saascfm-css/CHEATSHEET.md +245 -0
- package/templates/js/saascfm-css/RULES.md +129 -0
- package/templates/js/saascfm-css/_component.tokens.js +15 -0
- package/templates/{ts/sectioned/primitives.colors.ts → js/saascfm-css/primitives.js} +6 -7
- package/templates/js/saascfm-css/tokens/border.tokens.js +8 -0
- package/templates/js/saascfm-css/tokens/navigation.tokens.js +32 -0
- package/templates/js/saascfm-css/tokens/status.tokens.js +28 -0
- package/templates/js/saascfm-css/tokens/surface.tokens.js +20 -0
- package/templates/ts/saascfm-css/CHEATSHEET.md +245 -0
- package/templates/ts/saascfm-css/RULES.md +129 -0
- package/templates/ts/saascfm-css/_component.tokens.ts +15 -0
- package/templates/{js/sectioned/primitives.colors.js → ts/saascfm-css/primitives.ts} +6 -7
- package/templates/ts/saascfm-css/tokens/border.tokens.ts +8 -0
- package/templates/ts/saascfm-css/tokens/navigation.tokens.ts +32 -0
- package/templates/ts/saascfm-css/tokens/status.tokens.ts +28 -0
- package/templates/ts/saascfm-css/tokens/surface.tokens.ts +20 -0
- package/templates/js/sectioned/app.colors.js +0 -14
- package/templates/js/sectioned/border.colors.js +0 -7
- package/templates/js/sectioned/navigation.colors.js +0 -9
- package/templates/js/sectioned/status.colors.js +0 -21
- package/templates/js/sectioned/surface.colors.js +0 -17
- package/templates/js/single/app.colors.js +0 -89
- package/templates/ts/sectioned/app.colors.ts +0 -14
- package/templates/ts/sectioned/border.colors.ts +0 -7
- package/templates/ts/sectioned/navigation.colors.ts +0 -9
- package/templates/ts/sectioned/status.colors.ts +0 -21
- package/templates/ts/sectioned/surface.colors.ts +0 -17
- package/templates/ts/single/app.colors.ts +0 -89
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# SaaSCFM Cheat Sheet
|
|
2
|
+
|
|
3
|
+
Every class below is generated only when it appears in your source. Colors come from `primitives.ts` and `tokens/`; everything else is fixed by the package.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Colors — Primitives
|
|
8
|
+
|
|
9
|
+
Each primitive generates three classes: `name` (color), `bg-name` (background), `border-name` (border). Edit `primitives.ts` to change the values or add colors.
|
|
10
|
+
|
|
11
|
+
### Brand
|
|
12
|
+
|
|
13
|
+
| Class | Hex |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| `brand-50` | #EFF4FF |
|
|
16
|
+
| `brand-100` | #DBE6FE |
|
|
17
|
+
| `brand-200` | #BFD3FE |
|
|
18
|
+
| `brand-300` | #93B4FD |
|
|
19
|
+
| `brand-400` | #6090FA |
|
|
20
|
+
| `brand-500` | #3B6FF0 |
|
|
21
|
+
| `brand-600` | #2A55D6 |
|
|
22
|
+
| `brand-700` | #2344AD |
|
|
23
|
+
| `brand-800` | #1F3B8A |
|
|
24
|
+
| `brand-900` | #1B3170 |
|
|
25
|
+
### Neutral
|
|
26
|
+
|
|
27
|
+
| Class | Hex |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `neutral-50` | #FAFAF9 |
|
|
30
|
+
| `neutral-100` | #F4F4F2 |
|
|
31
|
+
| `neutral-200` | #E8E8E5 |
|
|
32
|
+
| `neutral-300` | #D6D6D2 |
|
|
33
|
+
| `neutral-400` | #A8A8A2 |
|
|
34
|
+
| `neutral-500` | #7C7C76 |
|
|
35
|
+
| `neutral-600` | #5C5C57 |
|
|
36
|
+
| `neutral-700` | #44443F |
|
|
37
|
+
| `neutral-800` | #2C2C29 |
|
|
38
|
+
| `neutral-900` | #181816 |
|
|
39
|
+
### White
|
|
40
|
+
|
|
41
|
+
| Class | Hex |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `white` | #FFFFFF |
|
|
44
|
+
### Status hues
|
|
45
|
+
|
|
46
|
+
| Class | Hex |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `red-100` | #FDECEC |
|
|
49
|
+
| `red-500` | #D64545 |
|
|
50
|
+
| `green-100` | #E6F5EC |
|
|
51
|
+
| `green-500` | #2F7A4C |
|
|
52
|
+
| `yellow-100` | #FBF0DC |
|
|
53
|
+
| `yellow-500` | #C9821B |
|
|
54
|
+
| `blue-100` | #DCEAF7 |
|
|
55
|
+
| `blue-500` | #2F6FA8 |
|
|
56
|
+
| `purple-100` | #F3EEF8 |
|
|
57
|
+
| `purple-500` | #8A5FB0 |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Colors — Semantic Tokens
|
|
62
|
+
|
|
63
|
+
Each token is a CSS variable on `:root` (`var(--token-name)`) and, when it starts with `text-`, `bg-` or `border-`, a utility class.
|
|
64
|
+
|
|
65
|
+
### Text
|
|
66
|
+
|
|
67
|
+
| Class | Resolves to | Role |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| `text-primary` | neutral-900 · #181816 | Primary reading text |
|
|
70
|
+
| `text-secondary` | neutral-600 · #5C5C57 | Supporting text, captions, metadata |
|
|
71
|
+
| `text-disabled` | neutral-400 · #A8A8A2 | Disabled UI states |
|
|
72
|
+
| `text-faint` | neutral-500 · #7C7C76 | De-emphasized metadata (not an inactive control) |
|
|
73
|
+
| `text-inverse` | white · #FFFFFF | Text on dark or colored backgrounds |
|
|
74
|
+
| `text-brand` | brand-500 · #3B6FF0 | Brand accent text |
|
|
75
|
+
| `text-link` | brand-600 · #2A55D6 | Links |
|
|
76
|
+
|
|
77
|
+
### Background
|
|
78
|
+
|
|
79
|
+
| Class | Resolves to | Role |
|
|
80
|
+
| --- | --- | --- |
|
|
81
|
+
| `bg-page` | neutral-50 · #FAFAF9 | Page canvas, nav and content |
|
|
82
|
+
| `bg-surface` | white · #FFFFFF | Cards, modals, form containers |
|
|
83
|
+
| `bg-subtle` | neutral-100 · #F4F4F2 | Quiet fills, table stripes, hover |
|
|
84
|
+
| `bg-overlay` | neutral-900 · #181816 | Modal backdrops, drawers |
|
|
85
|
+
| `bg-header` | white · #FFFFFF | Header only |
|
|
86
|
+
| `bg-crumb` | neutral-100 · #F4F4F2 | Breadcrumb strip only |
|
|
87
|
+
| `bg-brand` | brand-500 · #3B6FF0 | Primary buttons, key actions |
|
|
88
|
+
| `bg-brand-subtle` | brand-50 · #EFF4FF | Selected rows, brand tints |
|
|
89
|
+
|
|
90
|
+
### Border
|
|
91
|
+
|
|
92
|
+
| Class | Resolves to | Role |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `border-default` | neutral-200 · #E8E8E5 | Standard borders and dividers (used by hl and vl) |
|
|
95
|
+
| `border-muted` | neutral-100 · #F4F4F2 | Quiet dividers (used by hl-muted) |
|
|
96
|
+
| `border-accent` | brand-200 · #BFD3FE | Accent outlines |
|
|
97
|
+
| `border-focus` | brand-400 · #6090FA | Focus rings |
|
|
98
|
+
|
|
99
|
+
### Status
|
|
100
|
+
|
|
101
|
+
Each status has four tokens: `text-status-X`, `bg-status-X`, `bg-status-X-subtle`, `border-status-X`.
|
|
102
|
+
|
|
103
|
+
| Status (text / bg / border) | Solid | bg-…-subtle |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| `*-status-error` | red-500 · #D64545 | red-100 · #FDECEC |
|
|
106
|
+
| `*-status-success` | green-500 · #2F7A4C | green-100 · #E6F5EC |
|
|
107
|
+
| `*-status-warning` | yellow-500 · #C9821B | yellow-100 · #FBF0DC |
|
|
108
|
+
| `*-status-info` | blue-500 · #2F6FA8 | blue-100 · #DCEAF7 |
|
|
109
|
+
| `*-status-hold` | purple-500 · #8A5FB0 | purple-100 · #F3EEF8 |
|
|
110
|
+
|
|
111
|
+
### Navigation (CSS vars only, no utility class)
|
|
112
|
+
|
|
113
|
+
| CSS var | Resolves to | Role |
|
|
114
|
+
| --- | --- | --- |
|
|
115
|
+
| `--nav-bg` | neutral-50 · #FAFAF9 | Sidebar background |
|
|
116
|
+
| `--nav-item-text` | neutral-600 · #5C5C57 | Nav item text at rest |
|
|
117
|
+
| `--nav-item-active-bg` | brand-50 · #EFF4FF | Active item background |
|
|
118
|
+
| `--nav-item-active-text` | brand-600 · #2A55D6 | Active item text |
|
|
119
|
+
| `--nav-group-label` | neutral-500 · #7C7C76 | Group label |
|
|
120
|
+
| `--nav-parent-dot` | brand-500 · #3B6FF0 | Dot on expandable parents |
|
|
121
|
+
| `--nav-children-border` | neutral-200 · #E8E8E5 | Guide line on nested items |
|
|
122
|
+
| `--nav-children-active-border` | brand-500 · #3B6FF0 | Guide line, active state |
|
|
123
|
+
| `--tabb-num-text` | neutral-500 · #7C7C76 | Step number text |
|
|
124
|
+
| `--tabb-num-bg` | white · #FFFFFF | Step number background |
|
|
125
|
+
| `--tabb-num-border` | neutral-200 · #E8E8E5 | Step number border |
|
|
126
|
+
| `--tabb-num-next-text` | neutral-900 · #181816 | Next step text |
|
|
127
|
+
| `--tabb-num-next-bg` | white · #FFFFFF | Next step background |
|
|
128
|
+
| `--tabb-num-next-border` | neutral-400 · #A8A8A2 | Next step border |
|
|
129
|
+
| `--tabb-num-active-text` | white · #FFFFFF | Active step text |
|
|
130
|
+
| `--tabb-num-active-bg` | brand-500 · #3B6FF0 | Active step background |
|
|
131
|
+
| `--tabb-num-active-border` | brand-500 · #3B6FF0 | Active step border |
|
|
132
|
+
| `--tabb-check-completed-text` | brand-500 · #3B6FF0 | Completed check text |
|
|
133
|
+
| `--tabb-check-completed-bg` | brand-50 · #EFF4FF | Completed check background |
|
|
134
|
+
| `--tabb-check-completed-border` | brand-50 · #EFF4FF | Completed check border |
|
|
135
|
+
| `--tabb-check-active-text` | white · #FFFFFF | Active check text |
|
|
136
|
+
| `--tabb-check-active-bg` | brand-500 · #3B6FF0 | Active check background |
|
|
137
|
+
| `--tabb-check-active-border` | brand-500 · #3B6FF0 | Active check border |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Spacing and sizing: `{prefix}-{n?}{number}{suffix?}`
|
|
142
|
+
|
|
143
|
+
| Prefix | Property |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| `w` `h` | width, height |
|
|
146
|
+
| `mw` `mh` | max-width, max-height |
|
|
147
|
+
| `minw` `minh` | min-width, min-height |
|
|
148
|
+
| `mt` `mr` `mb` `ml` | margin sides |
|
|
149
|
+
| `mtb` `mrl` | margin top+bottom, right+left |
|
|
150
|
+
| `p` | padding, all sides |
|
|
151
|
+
| `pt` `pr` `pb` `pl` | padding sides |
|
|
152
|
+
| `ptb` `prl` | padding top+bottom, right+left |
|
|
153
|
+
| `g` | gap |
|
|
154
|
+
| `gc` `gr` | column-gap, row-gap |
|
|
155
|
+
| `bdrd` | border-radius |
|
|
156
|
+
| `bdw` | border-width (also sets border-style: solid) |
|
|
157
|
+
| `zdex` | z-index (unitless) |
|
|
158
|
+
|
|
159
|
+
Suffixes: `p` percent (`w-10p`), `vw` / `vh` (`w` and `h` only), `n` negative (`mt-n10`, not on gap), `d` decimal point (`mt-12d5` = 12.5px, `mt-12d5p` = 12.5%).
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
mt-20 margin-top: 20px
|
|
163
|
+
mt-10p margin-top: 10%
|
|
164
|
+
w-50vw width: 50vw
|
|
165
|
+
mt-n10 margin-top: -10px
|
|
166
|
+
g-16 gap: 16px
|
|
167
|
+
gc-8 gr-12 column-gap: 8px, row-gap: 12px
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Add `!` to any class to force `!important`: `mt-12!`, `bg-page!`.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Spacing static
|
|
175
|
+
|
|
176
|
+
| Class | Output |
|
|
177
|
+
| --- | --- |
|
|
178
|
+
| `bn` | border: none |
|
|
179
|
+
| `auto` | margin: 0 auto |
|
|
180
|
+
| `hl` | border-bottom 1px, border-default, width 100% |
|
|
181
|
+
| `hl-muted` | border-bottom 1px, border-muted, width 100% |
|
|
182
|
+
| `vl` | border-left 2px, border-default, height 20px |
|
|
183
|
+
| `mcon-480` `640` `768` `1080` `1280` `1440` | max-width container, centered |
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Layout
|
|
188
|
+
|
|
189
|
+
| Class | Output |
|
|
190
|
+
| --- | --- |
|
|
191
|
+
| `flex` | display: flex |
|
|
192
|
+
| `flex-fdr` `fdrr` `fdc` `fdcr` | flex-direction |
|
|
193
|
+
| `flex-wrap` `flex-nowrap` | flex-wrap |
|
|
194
|
+
| `flex-jcfs` `jcfe` `jcc` `jcsb` `jcsa` `jcse` | justify-content |
|
|
195
|
+
| `flex-aifs` `aife` `aic` `aist` `aib` | align-items |
|
|
196
|
+
| `flex-acfs` `acfe` `acc` `acst` `acsb` `acsa` | align-content |
|
|
197
|
+
| `flex-assr` `asc` `ass` `ase` | align-self |
|
|
198
|
+
| `grid-jist` `jie` `jic` `jistr` | justify-items |
|
|
199
|
+
| `grid-aist` `aie` `aic` `aistr` | align-items (grid) |
|
|
200
|
+
| `align-l` `align-c` `align-r` | text-align |
|
|
201
|
+
| `float-l` `float-r` | float |
|
|
202
|
+
| `float-c` | position: fixed; top: 50%; left: 50% |
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Typography
|
|
207
|
+
|
|
208
|
+
| Class | Output |
|
|
209
|
+
| --- | --- |
|
|
210
|
+
| `b` `nb` `bx` | bold, normal, bolder |
|
|
211
|
+
| `b-100` … `b-900` | font-weight 100 to 900 |
|
|
212
|
+
| `light` `lighter` (`b-light` `b-lighter`) | font-weight 300, 100 |
|
|
213
|
+
| `uppercase` `lowercase` `capitalize` `text-none` | text-transform |
|
|
214
|
+
| `i` | font-style: italic |
|
|
215
|
+
| `underline` | text-decoration: underline |
|
|
216
|
+
| `ow` `ww` | overflow-wrap + hyphens |
|
|
217
|
+
| `fs-1em` `fs-1d5em` `fs-d5em` | font-size; `d` is the decimal point |
|
|
218
|
+
| `ls-0d1em` `ls-n0d05em` | letter-spacing; `n` is negative |
|
|
219
|
+
|
|
220
|
+
In `fs-` and `ls-`, `d` is the decimal point (`p` still works there for older apps). In spacing, `p` means percent.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Border style
|
|
225
|
+
|
|
226
|
+
| Class | Output |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| `bds-solid` | border-style: solid |
|
|
229
|
+
| `bds-dashed` | border-style: dashed |
|
|
230
|
+
| `bds-dotted` | border-style: dotted |
|
|
231
|
+
| `bds-double` | border-style: double |
|
|
232
|
+
| `bds-none` | border-style: none |
|
|
233
|
+
|
|
234
|
+
`bdw-*` already sets `border-style: solid`; use `bds-*` only to change it (`bdw-2 bds-dashed`).
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Cursor
|
|
239
|
+
|
|
240
|
+
`cursor-pointer` · `cursor-grab` · `cursor-grabbing` · `cursor-not-allowed`
|
|
241
|
+
`cursor-default` · `cursor-text` · `cursor-move` · `cursor-zoom-in`
|
|
242
|
+
`cursor-zoom-out` · `cursor-crosshair` · `cursor-help` · `cursor-wait`
|
|
243
|
+
`cursor-col-resize` · `cursor-row-resize` · `cursor-copy` · `cursor-none`
|
|
244
|
+
|
|
245
|
+
Every standard CSS cursor value is available with the `cursor-` prefix.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# SaaSCFM Rules Reference
|
|
2
|
+
|
|
3
|
+
How this folder works and how to extend it. For the class list, see `CHEATSHEET.md`.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
saascfm-css/
|
|
7
|
+
primitives.ts raw color scale, one source of truth
|
|
8
|
+
_component.tokens.ts aggregator: exports TOKENS + PRIMITIVES (pass this to the plugin)
|
|
9
|
+
tokens/
|
|
10
|
+
surface.tokens.ts text-*, bg-* roles
|
|
11
|
+
border.tokens.ts border-* roles
|
|
12
|
+
status.tokens.ts error / success / warning / info / hold
|
|
13
|
+
navigation.tokens.ts nav-* and tabb-* (CSS vars only)
|
|
14
|
+
CHEATSHEET.md every class and token
|
|
15
|
+
RULES.md this file
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The folder belongs to your app. The plugin never imports it by path; you pass `_component.tokens` to the plugin as `colorsModule`:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import cssModule from '@umoa/saascfm-css'
|
|
22
|
+
import * as colors from './src/saascfm-css/_component.tokens'
|
|
23
|
+
|
|
24
|
+
plugins: [cssModule({ colorsModule: colors })]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Layer 1: Primitives
|
|
30
|
+
|
|
31
|
+
`primitives.ts` is a flat map of name to color. Every entry generates three classes:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
brand-500 color: #3B6FF0
|
|
35
|
+
bg-brand-500 background-color: #3B6FF0
|
|
36
|
+
border-brand-500 border-color: #3B6FF0
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`rgba()` and `hsla()` values generate the color class only.
|
|
40
|
+
|
|
41
|
+
Use primitives for feature-level work, one-off colors, and when the exact shade matters more than the role. Rename or add colors freely; any name works.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Layer 2: Semantic tokens
|
|
46
|
+
|
|
47
|
+
Tokens are named by role, not value. Each token points at a primitive:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
export const SURFACE_TOKENS = {
|
|
51
|
+
'text-primary': P['neutral-900'],
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Each token becomes a CSS variable on `:root`. The first word of the name decides whether it also gets a class:
|
|
56
|
+
|
|
57
|
+
| Name starts with | Class generated | Property |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `text-` | yes | color |
|
|
60
|
+
| `bg-` | yes | background-color |
|
|
61
|
+
| `border-` | yes | border-color |
|
|
62
|
+
| anything else (`nav-`, `tabb-`, `shadow-`) | no, variable only | |
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<p class="text-primary">Body copy</p>
|
|
66
|
+
|
|
67
|
+
<style scoped>
|
|
68
|
+
.card {
|
|
69
|
+
background: var(--bg-surface);
|
|
70
|
+
color: var(--text-primary);
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
A token value can be a primitive (`P['neutral-900']`), a primitive name as a string (`'neutral-900'`), or any CSS color or value (`'#fff'`, `'rgba(0,0,0,.4)'`, `'56px'`). A string that looks like a primitive name but doesn't exist prints a warning and is skipped.
|
|
76
|
+
|
|
77
|
+
### When to use which
|
|
78
|
+
|
|
79
|
+
| Situation | Use |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| System chrome (nav, headers) | Token via `var()` |
|
|
82
|
+
| Status and feedback | Token class |
|
|
83
|
+
| Cross-app rebrandable color | Token |
|
|
84
|
+
| Feature screen, new component | Primitive class |
|
|
85
|
+
| One-off color | Primitive class |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Adding a token file
|
|
90
|
+
|
|
91
|
+
1. Create `tokens/my-feature.tokens.ts`
|
|
92
|
+
2. `import { PRIMITIVES as P } from '../primitives'`
|
|
93
|
+
3. `export const MY_FEATURE_TOKENS = { 'bg-banner': P['brand-50'] }`
|
|
94
|
+
4. Import it in `_component.tokens.ts` and spread it into `TOKENS`
|
|
95
|
+
|
|
96
|
+
The plugin and `vite.config` never change.
|
|
97
|
+
|
|
98
|
+
Keep `.tokens.` in token file names, and `primitives.` in the primitives file name. The plugin skips files with `.colors.`, `.tokens.` or `primitives.` in their path when it scans for classes. A color file named differently gets scanned, and every color in it generates a class.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Specificity and `!important`
|
|
103
|
+
|
|
104
|
+
Generated classes have normal specificity, so component CSS overrides them. Set `important: true` in the plugin options to make every class win, or add `!` to one class (`mt-12!`).
|
|
105
|
+
|
|
106
|
+
Output order puts general classes before specific ones: `p` before `pt`, `mtb` before `mt`, `mrl` before `ml`. `bds-*` is always last.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Migrating from a hand-written utility file
|
|
111
|
+
|
|
112
|
+
1. **Cursor classes get a `cursor-` prefix.** Bare names like `pointer`, `grab`, `help` become `cursor-pointer`, `cursor-grab`, `cursor-help`. `auto`, `text`, `default` and `none` need a manual pass because they collide with other utilities.
|
|
113
|
+
2. **`vh-N` becomes `h-Nvh`:**
|
|
114
|
+
```bash
|
|
115
|
+
grep -rl 'vh-[0-9]' src/ | xargs sed -i -E 's/\bvh-([0-9]+)\b/h-\1vh/g'
|
|
116
|
+
```
|
|
117
|
+
3. **Lines:** replace `hl-1`, `hl-2`, `vl-1` with `hl`, `hl-muted`, `vl`.
|
|
118
|
+
4. **Color class names:** map your old names onto your token names and replace them. Example:
|
|
119
|
+
|
|
120
|
+
| Old | New |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| `text-default` | `text-primary` |
|
|
123
|
+
| `text-muted` | `text-secondary` |
|
|
124
|
+
| `text-light` | `text-inverse` |
|
|
125
|
+
| `bg-default` | `bg-page` |
|
|
126
|
+
| `.error` | `text-status-error` |
|
|
127
|
+
| `.disabled` | `text-disabled` |
|
|
128
|
+
|
|
129
|
+
5. **Verify:** run the greps again. Zero hits means the old rules can be dropped.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NAVIGATION_TOKENS } from './tokens/navigation.tokens'
|
|
2
|
+
import { STATUS_TOKENS } from './tokens/status.tokens'
|
|
3
|
+
import { SURFACE_TOKENS } from './tokens/surface.tokens'
|
|
4
|
+
import { BORDER_TOKENS } from './tokens/border.tokens'
|
|
5
|
+
|
|
6
|
+
import { PRIMITIVES } from './primitives'
|
|
7
|
+
|
|
8
|
+
export const TOKENS = {
|
|
9
|
+
...NAVIGATION_TOKENS,
|
|
10
|
+
...STATUS_TOKENS,
|
|
11
|
+
...SURFACE_TOKENS,
|
|
12
|
+
...BORDER_TOKENS,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { PRIMITIVES }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const PRIMITIVES = {
|
|
2
|
-
'brand-50':
|
|
2
|
+
'brand-50': '#EFF4FF',
|
|
3
3
|
'brand-100': '#DBE6FE',
|
|
4
4
|
'brand-200': '#BFD3FE',
|
|
5
5
|
'brand-300': '#93B4FD',
|
|
@@ -10,7 +10,7 @@ export const PRIMITIVES = {
|
|
|
10
10
|
'brand-800': '#1F3B8A',
|
|
11
11
|
'brand-900': '#1B3170',
|
|
12
12
|
|
|
13
|
-
'neutral-50':
|
|
13
|
+
'neutral-50': '#FAFAF9',
|
|
14
14
|
'neutral-100': '#F4F4F2',
|
|
15
15
|
'neutral-200': '#E8E8E5',
|
|
16
16
|
'neutral-300': '#D6D6D2',
|
|
@@ -22,11 +22,10 @@ export const PRIMITIVES = {
|
|
|
22
22
|
'neutral-900': '#181816',
|
|
23
23
|
|
|
24
24
|
'white': '#FFFFFF',
|
|
25
|
-
'black': '#000000',
|
|
26
25
|
|
|
27
|
-
'red-100': '#FDECEC',
|
|
26
|
+
'red-100': '#FDECEC', 'red-500': '#D64545',
|
|
28
27
|
'green-100': '#E6F5EC', 'green-500': '#2F7A4C',
|
|
29
|
-
'yellow-100': '#FBF0DC',
|
|
30
|
-
'blue-100': '#DCEAF7',
|
|
31
|
-
'purple-100': '#F3EEF8',
|
|
28
|
+
'yellow-100': '#FBF0DC', 'yellow-500': '#C9821B',
|
|
29
|
+
'blue-100': '#DCEAF7', 'blue-500': '#2F6FA8',
|
|
30
|
+
'purple-100': '#F3EEF8', 'purple-500': '#8A5FB0',
|
|
32
31
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PRIMITIVES as P } from '../primitives'
|
|
2
|
+
|
|
3
|
+
export const NAVIGATION_TOKENS = {
|
|
4
|
+
'nav-bg': P['neutral-50'],
|
|
5
|
+
'nav-item-text': P['neutral-600'],
|
|
6
|
+
'nav-item-active-bg': P['brand-50'],
|
|
7
|
+
'nav-item-active-text': P['brand-600'],
|
|
8
|
+
'nav-group-label': P['neutral-500'],
|
|
9
|
+
'nav-parent-dot': P['brand-500'],
|
|
10
|
+
'nav-children-border': P['neutral-200'],
|
|
11
|
+
'nav-children-active-border': P['brand-500'],
|
|
12
|
+
|
|
13
|
+
'tabb-num-text': P['neutral-500'],
|
|
14
|
+
'tabb-num-bg': P['white'],
|
|
15
|
+
'tabb-num-border': P['neutral-200'],
|
|
16
|
+
|
|
17
|
+
'tabb-num-next-text': P['neutral-900'],
|
|
18
|
+
'tabb-num-next-bg': P['white'],
|
|
19
|
+
'tabb-num-next-border': P['neutral-400'],
|
|
20
|
+
|
|
21
|
+
'tabb-num-active-text': P['white'],
|
|
22
|
+
'tabb-num-active-bg': P['brand-500'],
|
|
23
|
+
'tabb-num-active-border': P['brand-500'],
|
|
24
|
+
|
|
25
|
+
'tabb-check-completed-text': P['brand-500'],
|
|
26
|
+
'tabb-check-completed-bg': P['brand-50'],
|
|
27
|
+
'tabb-check-completed-border': P['brand-50'],
|
|
28
|
+
|
|
29
|
+
'tabb-check-active-text': P['white'],
|
|
30
|
+
'tabb-check-active-bg': P['brand-500'],
|
|
31
|
+
'tabb-check-active-border': P['brand-500'],
|
|
32
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PRIMITIVES as P } from '../primitives'
|
|
2
|
+
|
|
3
|
+
export const STATUS_TOKENS = {
|
|
4
|
+
'text-status-error': P['red-500'],
|
|
5
|
+
'bg-status-error': P['red-500'],
|
|
6
|
+
'bg-status-error-subtle': P['red-100'],
|
|
7
|
+
'border-status-error': P['red-500'],
|
|
8
|
+
|
|
9
|
+
'text-status-success': P['green-500'],
|
|
10
|
+
'bg-status-success': P['green-500'],
|
|
11
|
+
'bg-status-success-subtle': P['green-100'],
|
|
12
|
+
'border-status-success': P['green-500'],
|
|
13
|
+
|
|
14
|
+
'text-status-warning': P['yellow-500'],
|
|
15
|
+
'bg-status-warning': P['yellow-500'],
|
|
16
|
+
'bg-status-warning-subtle': P['yellow-100'],
|
|
17
|
+
'border-status-warning': P['yellow-500'],
|
|
18
|
+
|
|
19
|
+
'text-status-info': P['blue-500'],
|
|
20
|
+
'bg-status-info': P['blue-500'],
|
|
21
|
+
'bg-status-info-subtle': P['blue-100'],
|
|
22
|
+
'border-status-info': P['blue-500'],
|
|
23
|
+
|
|
24
|
+
'text-status-hold': P['purple-500'],
|
|
25
|
+
'bg-status-hold': P['purple-500'],
|
|
26
|
+
'bg-status-hold-subtle': P['purple-100'],
|
|
27
|
+
'border-status-hold': P['purple-500'],
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PRIMITIVES as P } from '../primitives'
|
|
2
|
+
|
|
3
|
+
export const SURFACE_TOKENS = {
|
|
4
|
+
'text-primary': P['neutral-900'],
|
|
5
|
+
'text-secondary': P['neutral-600'],
|
|
6
|
+
'text-disabled': P['neutral-400'],
|
|
7
|
+
'text-faint': P['neutral-500'],
|
|
8
|
+
'text-inverse': P['white'],
|
|
9
|
+
'text-brand': P['brand-500'],
|
|
10
|
+
'text-link': P['brand-600'],
|
|
11
|
+
|
|
12
|
+
'bg-page': P['neutral-50'],
|
|
13
|
+
'bg-surface': P['white'],
|
|
14
|
+
'bg-subtle': P['neutral-100'],
|
|
15
|
+
'bg-overlay': P['neutral-900'],
|
|
16
|
+
'bg-header': P['white'],
|
|
17
|
+
'bg-crumb': P['neutral-100'],
|
|
18
|
+
'bg-brand': P['brand-500'],
|
|
19
|
+
'bg-brand-subtle': P['brand-50'],
|
|
20
|
+
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PRIMITIVES } from './primitives.colors'
|
|
2
|
-
import { SURFACE_TOKENS } from './surface.colors'
|
|
3
|
-
import { BORDER_TOKENS } from './border.colors'
|
|
4
|
-
import { STATUS_TOKENS } from './status.colors'
|
|
5
|
-
import { NAVIGATION_TOKENS } from './navigation.colors'
|
|
6
|
-
|
|
7
|
-
export { PRIMITIVES }
|
|
8
|
-
|
|
9
|
-
export const TOKENS = {
|
|
10
|
-
...SURFACE_TOKENS,
|
|
11
|
-
...BORDER_TOKENS,
|
|
12
|
-
...STATUS_TOKENS,
|
|
13
|
-
...NAVIGATION_TOKENS,
|
|
14
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const NAVIGATION_TOKENS = {
|
|
2
|
-
'nav-bg': 'neutral-50',
|
|
3
|
-
'nav-item-text': 'neutral-600',
|
|
4
|
-
'nav-item-active-bg': 'brand-50',
|
|
5
|
-
'nav-item-active-text': 'brand-600',
|
|
6
|
-
'nav-group-label': 'neutral-500',
|
|
7
|
-
'nav-children-border': 'neutral-200',
|
|
8
|
-
'nav-children-active-border': 'brand-500',
|
|
9
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const STATUS_TOKENS = {
|
|
2
|
-
'text-status-error': 'red-500',
|
|
3
|
-
'bg-status-error': 'red-500',
|
|
4
|
-
'bg-status-error-subtle': 'red-100',
|
|
5
|
-
'border-status-error': 'red-500',
|
|
6
|
-
|
|
7
|
-
'text-status-success': 'green-500',
|
|
8
|
-
'bg-status-success': 'green-500',
|
|
9
|
-
'bg-status-success-subtle': 'green-100',
|
|
10
|
-
'border-status-success': 'green-500',
|
|
11
|
-
|
|
12
|
-
'text-status-warning': 'yellow-500',
|
|
13
|
-
'bg-status-warning': 'yellow-500',
|
|
14
|
-
'bg-status-warning-subtle': 'yellow-100',
|
|
15
|
-
'border-status-warning': 'yellow-500',
|
|
16
|
-
|
|
17
|
-
'text-status-info': 'blue-500',
|
|
18
|
-
'bg-status-info': 'blue-500',
|
|
19
|
-
'bg-status-info-subtle': 'blue-100',
|
|
20
|
-
'border-status-info': 'blue-500',
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const SURFACE_TOKENS = {
|
|
2
|
-
'text-primary': 'neutral-900',
|
|
3
|
-
'text-secondary': 'neutral-600',
|
|
4
|
-
'text-muted': 'neutral-500',
|
|
5
|
-
'text-disabled': 'neutral-400',
|
|
6
|
-
'text-inverse': 'white',
|
|
7
|
-
'text-brand': 'brand-500',
|
|
8
|
-
'text-link': 'brand-600',
|
|
9
|
-
|
|
10
|
-
'bg-page': 'neutral-50',
|
|
11
|
-
'bg-surface': 'white',
|
|
12
|
-
'bg-subtle': 'neutral-100',
|
|
13
|
-
'bg-header': 'white',
|
|
14
|
-
'bg-overlay': 'neutral-900',
|
|
15
|
-
'bg-brand': 'brand-500',
|
|
16
|
-
'bg-brand-subtle': 'brand-50',
|
|
17
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export const PRIMITIVES = {
|
|
2
|
-
'brand-50': '#EFF4FF',
|
|
3
|
-
'brand-100': '#DBE6FE',
|
|
4
|
-
'brand-200': '#BFD3FE',
|
|
5
|
-
'brand-300': '#93B4FD',
|
|
6
|
-
'brand-400': '#6090FA',
|
|
7
|
-
'brand-500': '#3B6FF0',
|
|
8
|
-
'brand-600': '#2A55D6',
|
|
9
|
-
'brand-700': '#2344AD',
|
|
10
|
-
'brand-800': '#1F3B8A',
|
|
11
|
-
'brand-900': '#1B3170',
|
|
12
|
-
|
|
13
|
-
'neutral-50': '#FAFAF9',
|
|
14
|
-
'neutral-100': '#F4F4F2',
|
|
15
|
-
'neutral-200': '#E8E8E5',
|
|
16
|
-
'neutral-300': '#D6D6D2',
|
|
17
|
-
'neutral-400': '#A8A8A2',
|
|
18
|
-
'neutral-500': '#7C7C76',
|
|
19
|
-
'neutral-600': '#5C5C57',
|
|
20
|
-
'neutral-700': '#44443F',
|
|
21
|
-
'neutral-800': '#2C2C29',
|
|
22
|
-
'neutral-900': '#181816',
|
|
23
|
-
|
|
24
|
-
'white': '#FFFFFF',
|
|
25
|
-
'black': '#000000',
|
|
26
|
-
|
|
27
|
-
'red-100': '#FDECEC', 'red-500': '#D64545',
|
|
28
|
-
'green-100': '#E6F5EC', 'green-500': '#2F7A4C',
|
|
29
|
-
'yellow-100': '#FBF0DC', 'yellow-500': '#C9821B',
|
|
30
|
-
'blue-100': '#DCEAF7', 'blue-500': '#2F6FA8',
|
|
31
|
-
'purple-100': '#F3EEF8', 'purple-500': '#8A5FB0',
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const TOKENS = {
|
|
35
|
-
// Text
|
|
36
|
-
'text-primary': 'neutral-900',
|
|
37
|
-
'text-secondary': 'neutral-600',
|
|
38
|
-
'text-muted': 'neutral-500',
|
|
39
|
-
'text-disabled': 'neutral-400',
|
|
40
|
-
'text-inverse': 'white',
|
|
41
|
-
'text-brand': 'brand-500',
|
|
42
|
-
'text-link': 'brand-600',
|
|
43
|
-
|
|
44
|
-
// Background
|
|
45
|
-
'bg-page': 'neutral-50',
|
|
46
|
-
'bg-surface': 'white',
|
|
47
|
-
'bg-subtle': 'neutral-100',
|
|
48
|
-
'bg-header': 'white',
|
|
49
|
-
'bg-overlay': 'neutral-900',
|
|
50
|
-
'bg-brand': 'brand-500',
|
|
51
|
-
'bg-brand-subtle': 'brand-50',
|
|
52
|
-
|
|
53
|
-
// Border
|
|
54
|
-
'border-default': 'neutral-200',
|
|
55
|
-
'border-muted': 'neutral-100',
|
|
56
|
-
'border-strong': 'neutral-300',
|
|
57
|
-
'border-brand': 'brand-500',
|
|
58
|
-
'border-focus': 'brand-400',
|
|
59
|
-
|
|
60
|
-
// Status
|
|
61
|
-
'text-status-error': 'red-500',
|
|
62
|
-
'bg-status-error': 'red-500',
|
|
63
|
-
'bg-status-error-subtle': 'red-100',
|
|
64
|
-
'border-status-error': 'red-500',
|
|
65
|
-
|
|
66
|
-
'text-status-success': 'green-500',
|
|
67
|
-
'bg-status-success': 'green-500',
|
|
68
|
-
'bg-status-success-subtle': 'green-100',
|
|
69
|
-
'border-status-success': 'green-500',
|
|
70
|
-
|
|
71
|
-
'text-status-warning': 'yellow-500',
|
|
72
|
-
'bg-status-warning': 'yellow-500',
|
|
73
|
-
'bg-status-warning-subtle': 'yellow-100',
|
|
74
|
-
'border-status-warning': 'yellow-500',
|
|
75
|
-
|
|
76
|
-
'text-status-info': 'blue-500',
|
|
77
|
-
'bg-status-info': 'blue-500',
|
|
78
|
-
'bg-status-info-subtle': 'blue-100',
|
|
79
|
-
'border-status-info': 'blue-500',
|
|
80
|
-
|
|
81
|
-
// Navigation (CSS vars only)
|
|
82
|
-
'nav-bg': 'neutral-50',
|
|
83
|
-
'nav-item-text': 'neutral-600',
|
|
84
|
-
'nav-item-active-bg': 'brand-50',
|
|
85
|
-
'nav-item-active-text': 'brand-600',
|
|
86
|
-
'nav-group-label': 'neutral-500',
|
|
87
|
-
'nav-children-border': 'neutral-200',
|
|
88
|
-
'nav-children-active-border': 'brand-500',
|
|
89
|
-
}
|