@deskhero/dh_ui 2.58.0 → 2.59.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/.ai/CSS-CLASSES-GUIDE.md +317 -0
- package/bin/ai-init.cjs +44 -0
- package/dist/dh_ui.css +1 -1
- package/dist/dh_ui.es.js +5 -5
- package/dist/dh_ui.umd.js +4 -4
- package/package.json +7 -2
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# CSS utility classes – AI development guide
|
|
2
|
+
|
|
3
|
+
This guide documents the utility classes and **color tokens** from the design system. Use these classes and variables in templates and components instead of writing one-off CSS or hardcoded hex colors. The guide is **exportable**: use it in other codebases that consume the same `colors.scss` (or equivalent `:root` variables).
|
|
4
|
+
|
|
5
|
+
**Source files:**
|
|
6
|
+
- `src/styles/flex.scss` – flexbox layout
|
|
7
|
+
- `src/styles/colorize.scss` – text/background color classes (design tokens)
|
|
8
|
+
- `src/styles/colors.scss` – color palette variables (all `--dh-*` shades and filters)
|
|
9
|
+
- `src/styles/spacing.scss` – margin, padding, gap, width, height
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Flex utilities (`flex.scss`)
|
|
14
|
+
|
|
15
|
+
Tailwind-inspired flexbox classes. Combine with spacing classes (e.g. `gap-spacer-2`, `m-spacer-2`) for layout.
|
|
16
|
+
|
|
17
|
+
### Display
|
|
18
|
+
| Class | Effect |
|
|
19
|
+
|----------------|-------------------|
|
|
20
|
+
| `flex` | `display: flex` |
|
|
21
|
+
| `inline-flex` | `display: inline-flex` |
|
|
22
|
+
|
|
23
|
+
### Direction
|
|
24
|
+
| Class | Effect |
|
|
25
|
+
|----------------------|---------------------------|
|
|
26
|
+
| `flex-row` | `flex-direction: row` |
|
|
27
|
+
| `flex-row-reverse` | `flex-direction: row-reverse` |
|
|
28
|
+
| `flex-column` | `flex-direction: column` |
|
|
29
|
+
| `flex-column-reverse`| `flex-direction: column-reverse` |
|
|
30
|
+
|
|
31
|
+
### Wrap
|
|
32
|
+
| Class | Effect |
|
|
33
|
+
|-------------------|------------------------|
|
|
34
|
+
| `flex-wrap` | `flex-wrap: wrap` |
|
|
35
|
+
| `flex-nowrap` | `flex-wrap: nowrap` |
|
|
36
|
+
| `flex-wrap-reverse` | `flex-wrap: wrap-reverse` |
|
|
37
|
+
|
|
38
|
+
### Flex (grow/shrink/basis)
|
|
39
|
+
| Class | Effect |
|
|
40
|
+
|---------------|------------------|
|
|
41
|
+
| `flex-1` | `flex: 1 1 0%` |
|
|
42
|
+
| `flex-auto` | `flex: 1 1 auto` |
|
|
43
|
+
| `flex-initial`| `flex: 0 1 auto` |
|
|
44
|
+
| `flex-none` | `flex: none` |
|
|
45
|
+
|
|
46
|
+
### Justify content
|
|
47
|
+
| Class | Effect |
|
|
48
|
+
|-----------------|-----------------------------|
|
|
49
|
+
| `justify-start` | `justify-content: flex-start` |
|
|
50
|
+
| `justify-end` | `justify-content: flex-end` |
|
|
51
|
+
| `justify-center`| `justify-content: center` |
|
|
52
|
+
| `justify-between` | `justify-content: space-between` |
|
|
53
|
+
| `justify-around` | `justify-content: space-around` |
|
|
54
|
+
| `justify-evenly` | `justify-content: space-evenly` |
|
|
55
|
+
|
|
56
|
+
### Align items
|
|
57
|
+
| Class | Effect |
|
|
58
|
+
|----------------|--------------------------|
|
|
59
|
+
| `items-start` | `align-items: flex-start` |
|
|
60
|
+
| `items-end` | `align-items: flex-end` |
|
|
61
|
+
| `items-center` | `align-items: center` |
|
|
62
|
+
| `items-baseline` | `align-items: baseline` |
|
|
63
|
+
| `items-stretch` | `align-items: stretch` |
|
|
64
|
+
|
|
65
|
+
### Align self
|
|
66
|
+
| Class | Effect |
|
|
67
|
+
|----------------|-------------------------|
|
|
68
|
+
| `self-auto` | `align-self: auto` |
|
|
69
|
+
| `self-start` | `align-self: flex-start`|
|
|
70
|
+
| `self-end` | `align-self: flex-end` |
|
|
71
|
+
| `self-center` | `align-self: center` |
|
|
72
|
+
| `self-stretch` | `align-self: stretch` |
|
|
73
|
+
| `self-baseline`| `align-self: baseline` |
|
|
74
|
+
|
|
75
|
+
### Order
|
|
76
|
+
| Class | Effect |
|
|
77
|
+
|--------------|-------------|
|
|
78
|
+
| `order-first`| `order: -9999` |
|
|
79
|
+
| `order-last` | `order: 9999` |
|
|
80
|
+
| `order-none` | `order: 0` |
|
|
81
|
+
| `order-1` … `order-12` | `order: 1` … `order: 12` |
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
```html
|
|
85
|
+
<div class="flex flex-row items-center justify-between gap-spacer-2">
|
|
86
|
+
<span>Left</span>
|
|
87
|
+
<span>Right</span>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="flex flex-column flex-wrap gap-spacer-4">
|
|
90
|
+
<!-- stacked, wrapping column -->
|
|
91
|
+
</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 2. Color utilities (`colorize.scss`)
|
|
97
|
+
|
|
98
|
+
Uses design tokens (`--dh-*`). Prefer these over hardcoded colors.
|
|
99
|
+
|
|
100
|
+
### Color attribute (on any element)
|
|
101
|
+
Set the `color` **attribute** (not class) for semantic text color:
|
|
102
|
+
|
|
103
|
+
| Attribute value | Maps to variable |
|
|
104
|
+
|-----------------------|------------------------|
|
|
105
|
+
| `color="primary"` | `--dh-primary` |
|
|
106
|
+
| `color="secondary"` | `--dh-text-secondary` |
|
|
107
|
+
| `color="secondary-lighter"` | `--dh-text-secondary-lighter` |
|
|
108
|
+
| `color="danger"` | `--dh-danger` |
|
|
109
|
+
| `color="success"` | `--dh-success` |
|
|
110
|
+
| `color="warning"` | `--dh-warning` |
|
|
111
|
+
| `color="purple"` | `--dh-purple` |
|
|
112
|
+
|
|
113
|
+
**Example:** `<span color="danger">Error message</span>`
|
|
114
|
+
|
|
115
|
+
### Text color classes (`.text-*`)
|
|
116
|
+
| Class | Maps to variable |
|
|
117
|
+
|------------------------|----------------------------|
|
|
118
|
+
| `text-primary` | `--dh-text-primary` |
|
|
119
|
+
| `text-secondary` | `--dh-text-secondary` |
|
|
120
|
+
| `text-secondary-lighter` | `--dh-text-secondary-lighter` |
|
|
121
|
+
| `text-disabled` | `--dh-text-disabled` |
|
|
122
|
+
| `text-warning` | `--dh-warning` |
|
|
123
|
+
| `text-purple` | `--dh-purple` |
|
|
124
|
+
| `text-success` | `--dh-success` |
|
|
125
|
+
| `text-danger` | `--dh-danger` |
|
|
126
|
+
|
|
127
|
+
### Background color classes (`.bg-color-*`)
|
|
128
|
+
| Class | Maps to variable |
|
|
129
|
+
|-----------------------|-----------------------------|
|
|
130
|
+
| `bg-color-primary` | `--dh-bg-primary` |
|
|
131
|
+
| `bg-color-secondary` | `--dh-text-secondary` |
|
|
132
|
+
| `bg-color-secondary-lighter` | `--dh-text-secondary-lighter` |
|
|
133
|
+
| `bg-color-disabled` | `--dh-text-disabled` |
|
|
134
|
+
| `bg-color-warning` | `--dh-warning-lighter` |
|
|
135
|
+
| `bg-color-purple` | `--dh-purple-lighter` |
|
|
136
|
+
| `bg-color-success` | `--dh-success-lighter` |
|
|
137
|
+
| `bg-color-danger` | `--dh-danger-lighter` |
|
|
138
|
+
|
|
139
|
+
**Example:**
|
|
140
|
+
```html
|
|
141
|
+
<p class="text-secondary">Hint text</p>
|
|
142
|
+
<div class="bg-color-success text-primary">Success state</div>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 3. Color tokens (`colors.scss`) – full reference
|
|
148
|
+
|
|
149
|
+
Base color scales are defined as CSS variables in `src/styles/colors.scss`. Each scale has **10 steps**: **-1** = darkest, **-10** = lightest. Use these variables in any codebase that consumes the design system; do not hardcode hex.
|
|
150
|
+
|
|
151
|
+
**Source:** `src/styles/colors.scss` (ensure this file or its compiled output is loaded so `:root` variables are available.)
|
|
152
|
+
|
|
153
|
+
### 3.1 Palette scales (variable → hex)
|
|
154
|
+
|
|
155
|
+
| Variable | Hex | Variable | Hex | Variable | Hex | Variable | Hex | Variable | Hex |
|
|
156
|
+
|----------|-----|----------|-----|----------|-----|----------|-----|----------|-----|
|
|
157
|
+
| **Burgundy** | | | | | | | | | |
|
|
158
|
+
| `--dh-burgundy-1` | #660033 | `--dh-burgundy-2` | #944c70 | `--dh-burgundy-3` | #c299a9 | `--dh-burgundy-4` | #f0e5eb | `--dh-burgundy-5` | #f9f2f5 |
|
|
159
|
+
| `--dh-burgundy-6` | #fcf5f8 | `--dh-burgundy-7` | #fefafd | `--dh-burgundy-8` | #fff5f9 | `--dh-burgundy-9` | #fffbfe | `--dh-burgundy-10` | #ffffff |
|
|
160
|
+
| **Pink** | | | | | | | | | |
|
|
161
|
+
| `--dh-pink-1` | #ff668f | `--dh-pink-2` | #ff7fa7 | `--dh-pink-3` | #ff95af | `--dh-pink-4` | #ffdbe0 | `--dh-pink-5` | #ffc3d1 |
|
|
162
|
+
| `--dh-pink-6` | #ffeaeb | `--dh-pink-7` | #fff1f2 | `--dh-pink-8` | #f0e5eb | `--dh-pink-9` | #ffffff | `--dh-pink-10` | #ffffff |
|
|
163
|
+
| **Gray** | | | | | | | | | |
|
|
164
|
+
| `--dh-gray-1` | #808080 | `--dh-gray-2` | #999999 | `--dh-gray-3` | #b3b3b3 | `--dh-gray-4` | #cccccc | `--dh-gray-5` | #dddddd |
|
|
165
|
+
| `--dh-gray-6` | #e5e5e5 | `--dh-gray-7` | #f0f0f0 | `--dh-gray-8` | #f2f2f2 | `--dh-gray-9` | #f5f5f5 | `--dh-gray-10` | #ffffff |
|
|
166
|
+
| **Yellow** | | | | | | | | | |
|
|
167
|
+
| `--dh-yellow-1` | #e1a400 | `--dh-yellow-2` | #e6b000 | `--dh-yellow-3` | #ebbc00 | `--dh-yellow-4` | #f0c800 | `--dh-yellow-5` | #f5d300 |
|
|
168
|
+
| `--dh-yellow-6` | #FCDE02 | `--dh-yellow-7` | #ffcf56 | `--dh-yellow-8` | #ffda79 | `--dh-yellow-9` | #ffe59c | `--dh-yellow-10` | #fff1c2 |
|
|
169
|
+
| **Red** | | | | | | | | | |
|
|
170
|
+
| `--dh-red-1` | #c32f27 | `--dh-red-2` | #d9332e | `--dh-red-3` | #ef3835 | `--dh-red-4` | #f53c3b | `--dh-red-5` | #fb4040 |
|
|
171
|
+
| `--dh-red-6` | #ff4444 | `--dh-red-7` | #ff4848 | `--dh-red-8` | #ff4c4c | `--dh-red-9` | #ff5050 | `--dh-red-10` | #ff8e88 |
|
|
172
|
+
| **Blue** | | | | | | | | | |
|
|
173
|
+
| `--dh-blue-1` | #0a4f7f | `--dh-blue-2` | #0f71b4 | `--dh-blue-3` | #177fc2 | `--dh-blue-4` | #1e8bd6 | `--dh-blue-5` | #3497de |
|
|
174
|
+
| `--dh-blue-6` | #5ea9e5 | `--dh-blue-7` | #8cc4f0 | `--dh-blue-8` | #c2e0f7 | `--dh-blue-9` | #e3f0fb | `--dh-blue-10` | #f5f9ff |
|
|
175
|
+
| **Green** | | | | | | | | | |
|
|
176
|
+
| `--dh-green-1` | #146233 | `--dh-green-2` | #18753c | `--dh-green-3` | #1d8245 | `--dh-green-4` | #289b54 | `--dh-green-5` | #37b866 |
|
|
177
|
+
| `--dh-green-6` | #5fd287 | `--dh-green-7` | #9de9b5 | `--dh-green-8` | #dcf5e0 | `--dh-green-9` | #f1fbf3 | `--dh-green-10` | #ffffff |
|
|
178
|
+
| **Orange** | | | | | | | | | |
|
|
179
|
+
| `--dh-orange-1` | #8a5707 | `--dh-orange-2` | #a36508 | `--dh-orange-3` | #cd7f0a | `--dh-orange-4` | #e2910d | `--dh-orange-5` | #f2a836 |
|
|
180
|
+
| `--dh-orange-6` | #f6b75e | `--dh-orange-7` | #f8c887 | `--dh-orange-8` | #f3cca8 | `--dh-orange-9` | #ffe6cf | `--dh-orange-10` | #fff7eb |
|
|
181
|
+
| **Purple** | | | | | | | | | |
|
|
182
|
+
| `--dh-purple-1` | #5f2a9b | `--dh-purple-2` | #7633c0 | `--dh-purple-3` | #8642cf | `--dh-purple-4` | #9b51e0 | `--dh-purple-5` | #a968e4 |
|
|
183
|
+
| `--dh-purple-6` | #bc84ea | `--dh-purple-7` | #d8b6f4 | `--dh-purple-8` | #f0e0fb | `--dh-purple-9` | #fff5f4 | `--dh-purple-10` | #ffffff |
|
|
184
|
+
| **Surface** (dark → light neutrals) | | | | | | | | | |
|
|
185
|
+
| `--dh-surface-1` | #121212 | `--dh-surface-2` | #2b2a2a | `--dh-surface-3` | #333333 | `--dh-surface-4` | #444444 | `--dh-surface-5` | #555555 |
|
|
186
|
+
| `--dh-surface-6` | #666666 | `--dh-surface-7` | #777777 | `--dh-surface-8` | #888888 | `--dh-surface-9` | #999999 | `--dh-surface-10` | #aaaaaa |
|
|
187
|
+
| **Surface contrast** (dark → light; use on dark UIs) | | | | | | | | | |
|
|
188
|
+
| `--dh-surface-contrast-10` | #555555 | `--dh-surface-contrast-9` | #666666 | `--dh-surface-contrast-8` | #777777 | `--dh-surface-contrast-7` | #888888 | `--dh-surface-contrast-6` | #999999 |
|
|
189
|
+
| `--dh-surface-contrast-5` | #aaaaaa | `--dh-surface-contrast-4` | #bbbbbb | `--dh-surface-contrast-3` | #cccccc | `--dh-surface-contrast-2` | #dddddd | `--dh-surface-contrast-1` | #eeeeee |
|
|
190
|
+
|
|
191
|
+
### 3.2 Filter variables (for SVG/icons)
|
|
192
|
+
|
|
193
|
+
Use as `filter: var(--dh-*);` to tint icons or images. Values are CSS `filter()` functions.
|
|
194
|
+
|
|
195
|
+
| Variable | Use case |
|
|
196
|
+
|----------|----------|
|
|
197
|
+
| `--dh-white-filter` | Icon as white (e.g. on dark background) |
|
|
198
|
+
| `--dh-burgundy-filter` | Icon in burgundy |
|
|
199
|
+
| `--dh-filter-blue` | Icon in primary blue |
|
|
200
|
+
| `--dh-filter-red` | Icon in danger/red |
|
|
201
|
+
| `--dh-filter-gray` | Icon in gray |
|
|
202
|
+
| `--dh-filter-yellow` | Icon in yellow |
|
|
203
|
+
| `--dh-filter-pink` | Icon in pink |
|
|
204
|
+
| `--dh-filter-light` | Slightly brighter |
|
|
205
|
+
| `--dh-filter-lighter` | Much brighter |
|
|
206
|
+
| `--dh-filter-white` | Force white |
|
|
207
|
+
|
|
208
|
+
### 3.3 Quick lookup by intent
|
|
209
|
+
|
|
210
|
+
| Intent | Prefer these variables |
|
|
211
|
+
|--------|-------------------------|
|
|
212
|
+
| Primary / links / focus | `--dh-primary` (or `--dh-blue-2`, `--dh-blue-4`, `--dh-blue-6`) |
|
|
213
|
+
| Success / positive | `--dh-success` (or `--dh-green-3`, `--dh-green-8`, `--dh-green-9`) |
|
|
214
|
+
| Danger / error | `--dh-danger` (or `--dh-red-1`, `--dh-red-10`) |
|
|
215
|
+
| Warning | `--dh-warning` (or `--dh-orange-3`, `--dh-orange-8`, `--dh-orange-10`) |
|
|
216
|
+
| Purple accent | `--dh-purple` (or `--dh-purple-4`, `--dh-purple-9`) |
|
|
217
|
+
| Body text | `--dh-text-primary` (or `--dh-surface-5`), `--dh-text-secondary` (or `--dh-gray-1`) |
|
|
218
|
+
| Disabled / borders | `--dh-text-disabled` (or `--dh-gray-6`) |
|
|
219
|
+
| White / light bg | `--dh-white` (or `--dh-gray-10`), `--dh-bg-primary` (or `--dh-blue-10`) |
|
|
220
|
+
| Dark text on light | `--dh-dark`, `--dh-surface-1` … `--dh-surface-5` |
|
|
221
|
+
| Light text on dark | `--dh-surface-contrast-1` … `--dh-surface-contrast-10` |
|
|
222
|
+
|
|
223
|
+
### 3.4 Usage guidelines (AI & other codebases)
|
|
224
|
+
|
|
225
|
+
- **Do not hardcode hex** in components or styles; use `var(--dh-*)` so theming and exports stay consistent.
|
|
226
|
+
- **Semantic tokens** (e.g. `--dh-primary`, `--dh-danger`, `--dh-success`) are defined in theme files (e.g. `variables.css` / `variables.light.css`) and point at the palette above; prefer them when the meaning is “primary”, “danger”, etc.
|
|
227
|
+
- **Palette steps** (`--dh-blue-4`, `--dh-gray-7`, etc.) are for custom UI that needs a specific shade.
|
|
228
|
+
- **Exporting this guide:** Copy this section (and the colorize section) into another repo; ensure the consuming app loads the same `colors.scss` (or equivalent `:root` definitions) so the variable names resolve.
|
|
229
|
+
|
|
230
|
+
```css
|
|
231
|
+
/* Prefer semantic tokens when meaning matches */
|
|
232
|
+
color: var(--dh-primary);
|
|
233
|
+
background-color: var(--dh-success-lighter);
|
|
234
|
+
|
|
235
|
+
/* Use palette steps for custom shades */
|
|
236
|
+
border-color: var(--dh-gray-4);
|
|
237
|
+
background-color: var(--dh-blue-9);
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 4. Spacing utilities (`spacing.scss`)
|
|
243
|
+
|
|
244
|
+
Margin, padding, gap, and size use a shared scale. Values use `!important` by default.
|
|
245
|
+
|
|
246
|
+
### Spacing scale (size names)
|
|
247
|
+
|
|
248
|
+
Use these as the **suffix** for margin, padding, gap, width, and height classes:
|
|
249
|
+
|
|
250
|
+
| Size name | Value | Size name | Value |
|
|
251
|
+
|-------------|---------|-------------|---------|
|
|
252
|
+
| `spacer-0` | 0 | `spacer-12` | 3rem |
|
|
253
|
+
| `spacer-half` | 0.125rem | `spacer-14` | 3.5rem |
|
|
254
|
+
| `spacer-1` | 0.25rem | `spacer-16` | 4rem |
|
|
255
|
+
| `spacer-2` | 0.5rem | `spacer-20` | 5rem |
|
|
256
|
+
| `spacer-3` | 0.75rem | `spacer-24` | 6rem |
|
|
257
|
+
| `spacer-4` | 1rem | … up to `spacer-86` (24rem) |
|
|
258
|
+
| `spacer-5` | 1.25rem | |
|
|
259
|
+
| `spacer-6` | 1.5rem | |
|
|
260
|
+
| `spacer-8` | 2rem | |
|
|
261
|
+
| `spacer-10` | 2.5rem | |
|
|
262
|
+
|
|
263
|
+
Full list of keys: `spacer-0`, `spacer-half`, `spacer-1` … `spacer-10`, `spacer-12`, `spacer-14`, `spacer-16`, `spacer-20`, `spacer-24`, `spacer-28`, `spacer-32`, `spacer-36`, `spacer-40`, `spacer-44`, `spacer-48`, `spacer-52`, `spacer-56`, `spacer-60`, `spacer-64`, `spacer-72`, `spacer-80`, `spacer-86`.
|
|
264
|
+
|
|
265
|
+
### Gap
|
|
266
|
+
- **Class pattern:** `gap-<size>` (size from spacing scale only)
|
|
267
|
+
- **Examples:** `gap-spacer-2`, `gap-spacer-4`, `gap-spacer-0`
|
|
268
|
+
|
|
269
|
+
### Margin
|
|
270
|
+
- **Pattern:** `m-<size>`, `mx-<size>`, `my-<size>`, `mt-<size>`, `mr-<size>`, `mb-<size>`, `ml-<size>`
|
|
271
|
+
- **Examples:** `m-spacer-2`, `mx-spacer-4`, `mt-spacer-1`, `mb-spacer-3`
|
|
272
|
+
- **Special (auto):** `mx-auto`, `ml-auto`, `mr-auto` (no `m-auto` or `my-auto`)
|
|
273
|
+
|
|
274
|
+
### Padding
|
|
275
|
+
- **Pattern:** `p-<size>`, `px-<size>`, `py-<size>`, `pt-<size>`, `pr-<size>`, `pb-<size>`, `pl-<size>`
|
|
276
|
+
- **Examples:** `p-spacer-4`, `px-spacer-2`, `py-spacer-3`
|
|
277
|
+
|
|
278
|
+
### Width and height (rem-based)
|
|
279
|
+
- **Pattern:** `w-<size>`, `h-<size>` with spacing scale
|
|
280
|
+
- **Examples:** `w-spacer-40`, `h-spacer-8`
|
|
281
|
+
- **Special:** `w-auto`, `h-auto`
|
|
282
|
+
|
|
283
|
+
### Width and height (percentage)
|
|
284
|
+
| Class | Effect |
|
|
285
|
+
|---------|----------------|
|
|
286
|
+
| `w-100` | width: 100% |
|
|
287
|
+
| `w-75` | width: 75% |
|
|
288
|
+
| `w-50` | width: 50% |
|
|
289
|
+
| `w-25` | width: 25% |
|
|
290
|
+
| `w-0` | width: 0% |
|
|
291
|
+
| `h-100` | height: 100% |
|
|
292
|
+
| `h-75` | height: 75% |
|
|
293
|
+
| `h-50` | height: 50% |
|
|
294
|
+
| `h-25` | height: 25% |
|
|
295
|
+
| `h-0` | height: 0% |
|
|
296
|
+
|
|
297
|
+
**Examples:**
|
|
298
|
+
```html
|
|
299
|
+
<div class="flex flex-column gap-spacer-4 p-spacer-4">
|
|
300
|
+
<div class="flex flex-row items-center justify-between mb-spacer-2">
|
|
301
|
+
<span class="text-primary">Title</span>
|
|
302
|
+
<button class="ml-auto">Action</button>
|
|
303
|
+
</div>
|
|
304
|
+
<div class="w-100 h-100">Full size content</div>
|
|
305
|
+
</div>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## 5. Quick reference for AI
|
|
311
|
+
|
|
312
|
+
- **Layout:** Prefer `flex` + direction + align/justify + `gap-*` from this guide before adding custom flex CSS.
|
|
313
|
+
- **Colors:** Use `text-*` and `bg-color-*` (or `color="..."` attribute) for semantic colors. For any other color, use **Section 3** variables only: `var(--dh-<scale>-<1-10>)` (e.g. `--dh-blue-4`, `--dh-gray-7`). All available palette variables and hex values are listed in **Section 3.1**; do not invent or hardcode hex.
|
|
314
|
+
- **Spacing:** Use `m-*`, `p-*`, `gap-*` with the `spacer-*` scale; use `mx-auto` for horizontal centering when appropriate.
|
|
315
|
+
- **Sizes:** Use `w-*` / `h-*` with the spacing scale for fixed sizes, or `w-100` / `h-100` for 100%.
|
|
316
|
+
- **Combining:** e.g. `flex flex-row items-center justify-between gap-spacer-2 p-spacer-4` is a valid and preferred pattern.
|
|
317
|
+
- **No new one-off CSS:** If a layout or spacing need is covered by these classes, use the classes instead of new rules in the component.
|
package/bin/ai-init.cjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const PACKAGE_ROOT = path.resolve(__dirname, "..");
|
|
7
|
+
const SOURCE_FILE = path.join(PACKAGE_ROOT, ".ai", "CSS-CLASSES-GUIDE.md");
|
|
8
|
+
const DEST_DIR = path.join(process.cwd(), ".ai");
|
|
9
|
+
const DEST_FILE = path.join(DEST_DIR, "DH-UI-USAGE.MD");
|
|
10
|
+
|
|
11
|
+
function main() {
|
|
12
|
+
try {
|
|
13
|
+
if (!fs.existsSync(SOURCE_FILE)) {
|
|
14
|
+
console.error(
|
|
15
|
+
"[AI-INIT] Source guide '.ai/CSS-CLASSES-GUIDE.md' not found in '@deskhero/dh_ui' package."
|
|
16
|
+
);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!fs.existsSync(DEST_DIR)) {
|
|
21
|
+
fs.mkdirSync(DEST_DIR, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (fs.existsSync(DEST_FILE)) {
|
|
25
|
+
console.log(
|
|
26
|
+
"[AI-INIT] './ai/DH-UI-USAGE.MD' already exists. No changes made."
|
|
27
|
+
);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const contents = fs.readFileSync(SOURCE_FILE, "utf8");
|
|
32
|
+
fs.writeFileSync(DEST_FILE, contents, "utf8");
|
|
33
|
+
|
|
34
|
+
console.log(
|
|
35
|
+
"[AI-INIT] Created './ai/DH-UI-USAGE.MD' from Deskhero UI CSS classes guide."
|
|
36
|
+
);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error("[AI-INIT] Failed to initialize AI guide:", error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
main();
|
|
44
|
+
|