|
3 | 3 | *******************************/ |
4 | 4 |
|
5 | 5 | /* |
6 | | - Three semantic scales for negative space: |
| 6 | + Semantic scales for negative space: |
7 | 7 |
|
8 | 8 | SPACING (rem) - layout rhythm, between components |
9 | 9 | GAP (em) - between elements within components |
10 | 10 | PADDING (em) - edge to content within components |
| 11 | + MARGIN (rem) - document flow (aliases spacing) |
11 | 12 |
|
12 | 13 | Same progression (0.125 → 4), different units: |
13 | 14 | - rem = fixed to root (layout consistency) |
14 | 15 | - em = scales with component (proportional sizing) |
| 16 | + - round(value, 1px) used for subpixel values (3xs, 2xs, s) |
| 17 | +
|
| 18 | + Numeric grid for manual tweaking: |
| 19 | +
|
| 20 | + SPACE (em) - 2px base unit, --space-1 through --space-40 |
| 21 | + More precision than Tailwind's 4px grid. |
15 | 22 | */ |
16 | 23 |
|
17 | 24 | :root { |
|
25 | 32 | Use for: section breaks, space between components, page layout. |
26 | 33 | */ |
27 | 34 |
|
28 | | - --spacing-3xs: 0.125rem; |
29 | | - --spacing-2xs: 0.25rem; |
| 35 | + --spacing-3xs: round(0.125rem, 1px); |
| 36 | + --spacing-2xs: round(0.25rem, 1px); |
30 | 37 | --spacing-xs: 0.5rem; |
31 | | - --spacing-s: 0.75rem; |
| 38 | + --spacing-s: round(0.75rem, 1px); |
32 | 39 | --spacing-m: 1rem; |
33 | 40 | --spacing-l: 1.5rem; |
34 | 41 | --spacing-xl: 2rem; |
|
61 | 68 | Use for: space between elements within a component (icon+label, button groups). |
62 | 69 | */ |
63 | 70 |
|
64 | | - --gap-3xs: 0.125em; |
65 | | - --gap-2xs: 0.25em; |
| 71 | + --gap-3xs: round(0.125em, 1px); |
| 72 | + --gap-2xs: round(0.25em, 1px); |
66 | 73 | --gap-xs: 0.5em; |
67 | | - --gap-s: 0.75em; |
| 74 | + --gap-s: round(0.75em, 1px); |
68 | 75 | --gap-m: 1em; |
69 | 76 | --gap-l: 1.5em; |
70 | 77 | --gap-xl: 2em; |
|
84 | 91 | --gap-huge: var(--gap-2xl); |
85 | 92 | --gap-massive: var(--gap-3xl); |
86 | 93 |
|
| 94 | + /* Numeric scale (1em increments) */ |
| 95 | + --gap-1: 1em; |
| 96 | + --gap-2: 2em; |
| 97 | + --gap-3: 3em; |
| 98 | + --gap-4: 4em; |
| 99 | + --gap-5: 5em; |
| 100 | + --gap-6: 6em; |
| 101 | + --gap-7: 7em; |
| 102 | + --gap-8: 8em; |
| 103 | + --gap-9: 9em; |
| 104 | + --gap-10: 10em; |
| 105 | + --gap-11: 11em; |
| 106 | + --gap-12: 12em; |
| 107 | + --gap-13: 13em; |
| 108 | + --gap-14: 14em; |
| 109 | + --gap-15: 15em; |
| 110 | + --gap-16: 16em; |
| 111 | + |
87 | 112 | /* ------------------- |
88 | 113 | Padding |
89 | 114 | -------------------- */ |
|
93 | 118 | Use for: internal spacing from edge/border to content. |
94 | 119 | */ |
95 | 120 |
|
96 | | - --padding-3xs: 0.125em; |
97 | | - --padding-2xs: 0.25em; |
| 121 | + --padding-3xs: round(0.125em, 1px); |
| 122 | + --padding-2xs: round(0.25em, 1px); |
98 | 123 | --padding-xs: 0.5em; |
99 | | - --padding-s: 0.75em; |
| 124 | + --padding-s: round(0.75em, 1px); |
100 | 125 | --padding-m: 1em; |
101 | 126 | --padding-l: 1.5em; |
102 | 127 | --padding-xl: 2em; |
|
120 | 145 | --horizontally-padded: 0 var(--padding); |
121 | 146 | --vertically-padded: var(--padding) 0; |
122 | 147 |
|
| 148 | + /* Asymmetric padding (shape emphasis) */ |
| 149 | + --padding-wide: 0.5em 1em; |
| 150 | + --padding-tall: 1em 0.5em; |
| 151 | + |
123 | 152 | /* ------------------- |
124 | 153 | Margin |
125 | 154 | -------------------- */ |
|
157 | 186 | --horizontally-spaced: 0 var(--margin); |
158 | 187 | --centered: var(--margin) auto; |
159 | 188 |
|
| 189 | + /* ------------------- |
| 190 | + Numeric Grid |
| 191 | + -------------------- */ |
| 192 | + |
| 193 | + /* |
| 194 | + 2px base unit for fine-grained manual tweaking. |
| 195 | + More precision than Tailwind's 4px grid. |
| 196 | + Use for: pixel-perfect adjustments, design fine-tuning. |
| 197 | + */ |
| 198 | + |
| 199 | + --space-unit: var(--relative-2px); |
| 200 | + |
| 201 | + --space-1: var(--space-unit); |
| 202 | + --space-2: calc(var(--space-unit) * 2); |
| 203 | + --space-3: calc(var(--space-unit) * 3); |
| 204 | + --space-4: calc(var(--space-unit) * 4); |
| 205 | + --space-5: calc(var(--space-unit) * 5); |
| 206 | + --space-6: calc(var(--space-unit) * 6); |
| 207 | + --space-7: calc(var(--space-unit) * 7); |
| 208 | + --space-8: calc(var(--space-unit) * 8); |
| 209 | + --space-9: calc(var(--space-unit) * 9); |
| 210 | + --space-10: calc(var(--space-unit) * 10); |
| 211 | + --space-11: calc(var(--space-unit) * 11); |
| 212 | + --space-12: calc(var(--space-unit) * 12); |
| 213 | + --space-13: calc(var(--space-unit) * 13); |
| 214 | + --space-14: calc(var(--space-unit) * 14); |
| 215 | + --space-15: calc(var(--space-unit) * 15); |
| 216 | + --space-16: calc(var(--space-unit) * 16); |
| 217 | + --space-17: calc(var(--space-unit) * 17); |
| 218 | + --space-18: calc(var(--space-unit) * 18); |
| 219 | + --space-19: calc(var(--space-unit) * 19); |
| 220 | + --space-20: calc(var(--space-unit) * 20); |
| 221 | + --space-21: calc(var(--space-unit) * 21); |
| 222 | + --space-22: calc(var(--space-unit) * 22); |
| 223 | + --space-23: calc(var(--space-unit) * 23); |
| 224 | + --space-24: calc(var(--space-unit) * 24); |
| 225 | + --space-25: calc(var(--space-unit) * 25); |
| 226 | + --space-26: calc(var(--space-unit) * 26); |
| 227 | + --space-27: calc(var(--space-unit) * 27); |
| 228 | + --space-28: calc(var(--space-unit) * 28); |
| 229 | + --space-29: calc(var(--space-unit) * 29); |
| 230 | + --space-30: calc(var(--space-unit) * 30); |
| 231 | + --space-31: calc(var(--space-unit) * 31); |
| 232 | + --space-32: calc(var(--space-unit) * 32); |
| 233 | + |
160 | 234 | } |
0 commit comments