shadcn-glass-ui 1.0.10 → 2.0.0

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.
Files changed (216) hide show
  1. package/CHANGELOG.md +259 -16
  2. package/README.md +248 -28
  3. package/context7.json +58 -0
  4. package/dist/cli/index.cjs +470 -0
  5. package/dist/cli/index.cjs.map +1 -0
  6. package/dist/cli/index.d.ts +18 -0
  7. package/dist/cli/index.js +469 -0
  8. package/dist/cli/index.js.map +1 -0
  9. package/dist/components.cjs +4 -4
  10. package/dist/components.d.ts +153 -22
  11. package/dist/components.js +2 -2
  12. package/dist/hooks.cjs +2 -2
  13. package/dist/index.cjs +872 -5
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +0 -2390
  16. package/dist/index.js +844 -3
  17. package/dist/index.js.map +1 -1
  18. package/dist/r/ai-card-glass.json +5 -12
  19. package/dist/r/avatar-glass.json +5 -15
  20. package/dist/r/circular-metric-glass.json +5 -11
  21. package/dist/r/circular-progress-glass.json +5 -12
  22. package/dist/r/combobox-glass.json +5 -13
  23. package/dist/r/flag-alert-glass.json +5 -11
  24. package/dist/r/flags-section-glass.json +5 -12
  25. package/dist/r/insight-card-glass.json +17 -0
  26. package/dist/r/interactive-card.json +5 -12
  27. package/dist/r/language-bar-glass.json +5 -11
  28. package/dist/r/metric-card-glass.json +6 -13
  29. package/dist/r/metrics-grid-glass.json +5 -11
  30. package/dist/r/modal-glass.json +5 -15
  31. package/dist/r/popover-glass.json +1 -1
  32. package/dist/r/progress-glass.json +5 -13
  33. package/dist/r/registry.json +20 -2
  34. package/dist/r/segmented-control-glass.json +5 -11
  35. package/dist/r/sparkline-glass.json +17 -0
  36. package/dist/r/stepper-glass.json +33 -0
  37. package/dist/r/tabs-glass.json +4 -9
  38. package/dist/r/trust-score-card-glass.json +5 -12
  39. package/dist/r/year-card-glass.json +5 -13
  40. package/dist/shadcn-glass-ui.css +1 -1
  41. package/dist/{theme-context-XtasSxRT.cjs → theme-context-CVW50BKW.cjs} +2 -2
  42. package/dist/{theme-context-XtasSxRT.cjs.map → theme-context-CVW50BKW.cjs.map} +1 -1
  43. package/dist/themes.cjs +1 -1
  44. package/dist/trust-score-card-glass-BcZbul0P.js +26895 -0
  45. package/dist/trust-score-card-glass-BcZbul0P.js.map +1 -0
  46. package/dist/trust-score-card-glass-r3qM09Jp.cjs +27689 -0
  47. package/dist/trust-score-card-glass-r3qM09Jp.cjs.map +1 -0
  48. package/dist/{use-focus-BbpE2qGq.cjs → use-focus-ZE8ozmZE.cjs} +2 -2
  49. package/dist/{use-focus-BbpE2qGq.cjs.map → use-focus-ZE8ozmZE.cjs.map} +1 -1
  50. package/dist/{use-wallpaper-tint-CIqtoETa.cjs → use-wallpaper-tint-BuS80tbN.cjs} +2 -2
  51. package/dist/{use-wallpaper-tint-CIqtoETa.cjs.map → use-wallpaper-tint-BuS80tbN.cjs.map} +1 -1
  52. package/dist/{utils-CGCOTvxT.js → utils-CcyeqpKQ.js} +1 -1
  53. package/dist/{utils-CGCOTvxT.js.map → utils-CcyeqpKQ.js.map} +1 -1
  54. package/dist/{utils-CriE74ig.cjs → utils-DLXayspX.cjs} +2 -2
  55. package/dist/{utils-CriE74ig.cjs.map → utils-DLXayspX.cjs.map} +1 -1
  56. package/dist/utils.cjs +1 -1
  57. package/dist/utils.js +1 -1
  58. package/docs/AI_IMPROVEMENTS_COMPLETE.md +574 -0
  59. package/docs/AI_USAGE.md +1328 -0
  60. package/docs/API_PATTERNS_COMPARISON.md +418 -0
  61. package/docs/BEST_PRACTICES.md +800 -0
  62. package/docs/COMPLIANCE_CHECKLIST.md +307 -0
  63. package/docs/COMPLIANCE_TESTING.md +436 -0
  64. package/docs/COMPONENTS_CATALOG.md +1076 -0
  65. package/docs/CSS_VARIABLES_AUDIT.md +306 -0
  66. package/docs/CSS_VARIABLES_REFACTORING_PLAN.md +330 -0
  67. package/docs/EXPORTS_MAP.json +875 -0
  68. package/docs/EXPORTS_STRUCTURE.md +729 -0
  69. package/docs/GETTING_STARTED.md +655 -0
  70. package/docs/METRIC_CARD_API_REDESIGN.md +354 -0
  71. package/docs/PRIMITIVE_MAPPING.md +404 -0
  72. package/docs/PUBLISHING.md +593 -0
  73. package/docs/REGISTRY_SUMMARY.md +96 -0
  74. package/docs/REGISTRY_USAGE.md +339 -0
  75. package/docs/SECURITY.md +117 -0
  76. package/docs/THEME_CREATION_GUIDE.md +455 -0
  77. package/docs/TOKEN_ARCHITECTURE.md +365 -0
  78. package/docs/announcements/v1.0.5-devto.md +363 -0
  79. package/docs/announcements/v1.0.5-reddit.md +115 -0
  80. package/docs/announcements/v1.0.5-twitter.md +70 -0
  81. package/docs/api/README.md +725 -0
  82. package/docs/api/functions/ThemeProvider.md +21 -0
  83. package/docs/api/functions/cn.md +27 -0
  84. package/docs/api/functions/getNextTheme.md +21 -0
  85. package/docs/api/functions/getThemeConfig.md +21 -0
  86. package/docs/api/functions/useFocus.md +53 -0
  87. package/docs/api/functions/useHover.md +47 -0
  88. package/docs/api/functions/useResponsive.md +31 -0
  89. package/docs/api/functions/useTheme.md +15 -0
  90. package/docs/api/functions/useWallpaperTint.md +36 -0
  91. package/docs/api/globals.md +139 -0
  92. package/docs/api/interfaces/AlertGlassProps.md +131 -0
  93. package/docs/api/interfaces/AvatarGlassProps.md +114 -0
  94. package/docs/api/interfaces/BadgeGlassProps.md +118 -0
  95. package/docs/api/interfaces/ButtonGlassProps.md +179 -0
  96. package/docs/api/interfaces/CheckboxGlassProps.md +125 -0
  97. package/docs/api/interfaces/DropdownGlassProps.md +123 -0
  98. package/docs/api/interfaces/DropdownItem.md +53 -0
  99. package/docs/api/interfaces/GlassCardProps.md +151 -0
  100. package/docs/api/interfaces/InputGlassProps.md +169 -0
  101. package/docs/api/interfaces/NotificationGlassProps.md +67 -0
  102. package/docs/api/interfaces/ProgressGlassProps.md +49 -0
  103. package/docs/api/interfaces/SkeletonGlassProps.md +41 -0
  104. package/docs/api/interfaces/SliderGlassProps.md +107 -0
  105. package/docs/api/interfaces/TabItem.md +25 -0
  106. package/docs/api/interfaces/ThemeConfig.md +25 -0
  107. package/docs/api/interfaces/ThemeContextValue.md +47 -0
  108. package/docs/api/interfaces/ToggleGlassProps.md +59 -0
  109. package/docs/api/interfaces/TooltipGlassProps.md +119 -0
  110. package/docs/api/type-aliases/AlertType.md +11 -0
  111. package/docs/api/type-aliases/AlertVariant.md +11 -0
  112. package/docs/api/type-aliases/AvatarSize.md +11 -0
  113. package/docs/api/type-aliases/AvatarStatus.md +13 -0
  114. package/docs/api/type-aliases/BadgeSize.md +11 -0
  115. package/docs/api/type-aliases/BadgeVariant.md +11 -0
  116. package/docs/api/type-aliases/ButtonGlassSize.md +11 -0
  117. package/docs/api/type-aliases/ButtonGlassVariant.md +11 -0
  118. package/docs/api/type-aliases/DropdownAlign.md +11 -0
  119. package/docs/api/type-aliases/GlowType.md +11 -0
  120. package/docs/api/type-aliases/InputGlassSize.md +11 -0
  121. package/docs/api/type-aliases/IntensityType.md +11 -0
  122. package/docs/api/type-aliases/ModalSize.md +11 -0
  123. package/docs/api/type-aliases/NotificationType.md +11 -0
  124. package/docs/api/type-aliases/PaddingType.md +11 -0
  125. package/docs/api/type-aliases/ProgressGradient.md +11 -0
  126. package/docs/api/type-aliases/ProgressSize.md +11 -0
  127. package/docs/api/type-aliases/SkeletonVariant.md +11 -0
  128. package/docs/api/type-aliases/Theme.md +11 -0
  129. package/docs/api/type-aliases/ToggleGlassSize.md +11 -0
  130. package/docs/api/type-aliases/TooltipPosition.md +11 -0
  131. package/docs/api/variables/AICardGlass.md +11 -0
  132. package/docs/api/variables/AlertGlass.md +11 -0
  133. package/docs/api/variables/AvatarGlass.md +11 -0
  134. package/docs/api/variables/BadgeGlass.md +11 -0
  135. package/docs/api/variables/BaseProgressGlass.md +11 -0
  136. package/docs/api/variables/ButtonGlass.md +11 -0
  137. package/docs/api/variables/CareerStatsGlass.md +11 -0
  138. package/docs/api/variables/CareerStatsHeaderGlass.md +11 -0
  139. package/docs/api/variables/CheckboxGlass.md +11 -0
  140. package/docs/api/variables/CircularMetricGlass.md +22 -0
  141. package/docs/api/variables/CircularProgressGlass.md +11 -0
  142. package/docs/api/variables/ComboBoxGlass.md +27 -0
  143. package/docs/api/variables/ContributionMetricsGlass.md +11 -0
  144. package/docs/api/variables/DropdownGlass.md +11 -0
  145. package/docs/api/variables/ExpandableHeaderGlass.md +11 -0
  146. package/docs/api/variables/FlagAlertGlass.md +11 -0
  147. package/docs/api/variables/FlagsSectionGlass.md +11 -0
  148. package/docs/api/variables/FormFieldWrapper.md +44 -0
  149. package/docs/api/variables/GlassCard.md +11 -0
  150. package/docs/api/variables/HeaderBrandingGlass.md +11 -0
  151. package/docs/api/variables/HeaderNavGlass.md +11 -0
  152. package/docs/api/variables/IconButtonGlass.md +11 -0
  153. package/docs/api/variables/InputGlass.md +11 -0
  154. package/docs/api/variables/InteractiveCard.md +45 -0
  155. package/docs/api/variables/LanguageBarGlass.md +11 -0
  156. package/docs/api/variables/MetricCardGlass.md +11 -0
  157. package/docs/api/variables/MetricsGridGlass.md +11 -0
  158. package/docs/api/variables/ModalGlass.md +72 -0
  159. package/docs/api/variables/NotificationGlass.md +11 -0
  160. package/docs/api/variables/PopoverGlass.md +11 -0
  161. package/docs/api/variables/ProfileAvatarGlass.md +11 -0
  162. package/docs/api/variables/ProfileHeaderGlass.md +11 -0
  163. package/docs/api/variables/ProgressGlass.md +11 -0
  164. package/docs/api/variables/ProjectsListGlass.md +11 -0
  165. package/docs/api/variables/RainbowProgressGlass.md +11 -0
  166. package/docs/api/variables/RepositoryCardGlass.md +11 -0
  167. package/docs/api/variables/RepositoryHeaderGlass.md +11 -0
  168. package/docs/api/variables/RepositoryMetadataGlass.md +11 -0
  169. package/docs/api/variables/SearchBoxGlass.md +11 -0
  170. package/docs/api/variables/SegmentedControlGlass.md +11 -0
  171. package/docs/api/variables/SkeletonGlass.md +11 -0
  172. package/docs/api/variables/SliderGlass.md +11 -0
  173. package/docs/api/variables/SortDropdownGlass.md +11 -0
  174. package/docs/api/variables/StatItemGlass.md +11 -0
  175. package/docs/api/variables/StatusIndicatorGlass.md +11 -0
  176. package/docs/api/variables/THEMES.md +11 -0
  177. package/docs/api/variables/THEME_CONFIG.md +11 -0
  178. package/docs/api/variables/TabsGlass.md +52 -0
  179. package/docs/api/variables/ThemeToggleGlass.md +11 -0
  180. package/docs/api/variables/ToggleGlass.md +11 -0
  181. package/docs/api/variables/TooltipGlass.md +11 -0
  182. package/docs/api/variables/TouchTarget.md +35 -0
  183. package/docs/api/variables/TrustScoreCardGlass.md +11 -0
  184. package/docs/api/variables/TrustScoreDisplayGlass.md +11 -0
  185. package/docs/api/variables/UserInfoGlass.md +11 -0
  186. package/docs/api/variables/UserStatsLineGlass.md +11 -0
  187. package/docs/api/variables/YearCardGlass.md +11 -0
  188. package/docs/api/variables/alertVariants.md +21 -0
  189. package/docs/api/variables/avatarSizes.md +21 -0
  190. package/docs/api/variables/badgeVariants.md +21 -0
  191. package/docs/api/variables/buttonGlassVariants.md +21 -0
  192. package/docs/api/variables/cardIntensity.md +21 -0
  193. package/docs/api/variables/dropdownAlign.md +21 -0
  194. package/docs/api/variables/inputVariants.md +21 -0
  195. package/docs/api/variables/modalSizes.md +21 -0
  196. package/docs/api/variables/notificationVariants.md +21 -0
  197. package/docs/api/variables/progressSizes.md +21 -0
  198. package/docs/api/variables/shadcnAlertVariants.md +21 -0
  199. package/docs/api/variables/shadcnBadgeVariants.md +21 -0
  200. package/docs/api/variables/shadcnButtonVariants.md +21 -0
  201. package/docs/api/variables/skeletonVariants.md +21 -0
  202. package/docs/api/variables/statusSizes.md +21 -0
  203. package/docs/api/variables/toggleSizes.md +21 -0
  204. package/docs/api/variables/tooltipPositions.md +21 -0
  205. package/docs/design-system/UI_DESIGN.md +628 -0
  206. package/docs/migration/CSS_VARIABLES_MIGRATION_2.0.md +325 -0
  207. package/docs/migration/modal-glass-compound-api.md +458 -0
  208. package/docs/migration/select-to-combobox.md +386 -0
  209. package/docs/migration/tabs-glass-compound-api.md +579 -0
  210. package/docs/technical/DEPENDENCIES.md +291 -0
  211. package/docs/visual-testing-guide.md +324 -0
  212. package/package.json +16 -3
  213. package/dist/trust-score-card-glass-CNcQveNY.cjs +0 -8231
  214. package/dist/trust-score-card-glass-CNcQveNY.cjs.map +0 -1
  215. package/dist/trust-score-card-glass-CowcDyxH.js +0 -7795
  216. package/dist/trust-score-card-glass-CowcDyxH.js.map +0 -1
@@ -0,0 +1,365 @@
1
+ # Token Architecture Guide
2
+
3
+ ## 3-Layer CSS Token System
4
+
5
+ The Glass UI library uses a **3-layer token architecture** to eliminate color duplication and enable
6
+ rapid theme creation.
7
+
8
+ ---
9
+
10
+ ## Architecture Overview
11
+
12
+ ```
13
+ ┌─────────────────────────────────────────────┐
14
+ │ Layer 3: Component Tokens │
15
+ │ --btn-primary-bg, --input-border, etc. │
16
+ │ Purpose: Component-specific styling │
17
+ └─────────────────────────────────────────────┘
18
+ ↓ references
19
+ ┌─────────────────────────────────────────────┐
20
+ │ Layer 2: Semantic Tokens │
21
+ │ --semantic-primary, --semantic-surface │
22
+ │ Purpose: Role-based, theme-specific │
23
+ └─────────────────────────────────────────────┘
24
+ ↓ references
25
+ ┌─────────────────────────────────────────────┐
26
+ │ Layer 1: Primitive Tokens │
27
+ │ --oklch-purple-500, --oklch-white-8 │
28
+ │ Purpose: Single source of truth for colors │
29
+ └─────────────────────────────────────────────┘
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Layer 1: Primitive Tokens
35
+
36
+ **File:** `src/styles/tokens/oklch-primitives.css`
37
+
38
+ **Purpose:** Define raw OKLCH color values once, shared across all themes.
39
+
40
+ **Naming Convention:** `--oklch-{family}-{scale}[-{alpha}]`
41
+
42
+ **Examples:**
43
+
44
+ ```css
45
+ --oklch-purple-500: oklch(66.6% 0.159 303);
46
+ --oklch-purple-500-30: oklch(66.6% 0.159 303 / 0.3);
47
+ --oklch-white-8: oklch(100% 0 0 / 0.08);
48
+ --oklch-emerald-400: oklch(76.5% 0.147 163);
49
+ ```
50
+
51
+ **Total Primitives:** 207 tokens
52
+
53
+ - Base colors: ~50 (color families at various scales)
54
+ - Alpha variants: ~157 (commonly-used opacity levels)
55
+
56
+ **Key Color Families:**
57
+
58
+ - **Achromatic:** white, black (with 15+ alpha variants each)
59
+ - **Primary:** purple-500 (glass), violet-600 (light), violet-500 (aurora)
60
+ - **Neutral:** slate-100 through slate-950
61
+ - **Status:** emerald (success), amber (warning), rose/red (error), blue (info)
62
+ - **Accent:** cyan, pink
63
+
64
+ **DO NOT** use primitive tokens directly in components. Use semantic tokens instead.
65
+
66
+ ---
67
+
68
+ ## Layer 2: Semantic Tokens
69
+
70
+ **File:** Each theme file (glass.css, light.css, aurora.css)
71
+
72
+ **Purpose:** Map primitive tokens to semantic roles that describe color usage, not appearance.
73
+
74
+ **Naming Convention:** `--semantic-{role}[-{modifier}]`
75
+
76
+ **Examples:**
77
+
78
+ ```css
79
+ /* Glass theme */
80
+ --semantic-primary: var(--oklch-purple-500);
81
+ --semantic-surface: var(--oklch-white-8);
82
+ --semantic-text: var(--oklch-white-90);
83
+
84
+ /* Light theme */
85
+ --semantic-primary: var(--oklch-violet-600);
86
+ --semantic-surface: var(--oklch-slate-100-80);
87
+ --semantic-text: var(--oklch-slate-800);
88
+ ```
89
+
90
+ **Semantic Roles:**
91
+
92
+ | Role | Purpose | Example Values |
93
+ | ---------------------- | ------------------------ | ---------------------- |
94
+ | `--semantic-primary` | Main accent color | purple-500, violet-600 |
95
+ | `--semantic-secondary` | Secondary accent | violet-500 |
96
+ | `--semantic-surface` | Card/surface backgrounds | white-8, slate-100-80 |
97
+ | `--semantic-border` | Standard borders | white-15, slate-200 |
98
+ | `--semantic-text` | Primary text color | white-90, slate-800 |
99
+ | `--semantic-success` | Success states | emerald-400 |
100
+ | `--semantic-warning` | Warning states | amber-400 |
101
+ | `--semantic-error` | Error states | rose-400, red-500 |
102
+ | `--semantic-info` | Info states | blue-400 |
103
+
104
+ **Modifiers:**
105
+
106
+ - `-muted`: Reduced opacity (e.g., `--semantic-primary-muted`)
107
+ - `-subtle`: Very light background (e.g., `--semantic-surface-subtle`)
108
+ - `-elevated`: Higher z-index surfaces (e.g., `--semantic-surface-elevated`)
109
+ - `-text`: Text color variant (e.g., `--semantic-success-text`)
110
+
111
+ ---
112
+
113
+ ## Layer 3: Component Tokens
114
+
115
+ **File:** Each theme file (glass.css, light.css, aurora.css)
116
+
117
+ **Purpose:** Component-specific styling variables that reference semantic tokens.
118
+
119
+ **Naming Convention:** `--{component}-{variant}-{property}`
120
+
121
+ **Examples:**
122
+
123
+ ```css
124
+ --btn-primary-bg: linear-gradient(135deg, var(--semantic-primary), var(--semantic-secondary));
125
+ --btn-primary-text: var(--semantic-text-inverse);
126
+ --badge-success-bg: var(--semantic-success-subtle);
127
+ --input-border: var(--semantic-border);
128
+ --card-hover-glow: 0 0 20px var(--oklch-purple-500-25);
129
+ ```
130
+
131
+ **Component Groups:**
132
+
133
+ - Buttons (primary, secondary, ghost, destructive, success)
134
+ - Badges (default, secondary, destructive, success, warning, info)
135
+ - Alerts (default, destructive, success, warning)
136
+ - Inputs (text, focus states)
137
+ - Cards (subtle, medium, strong variants)
138
+ - Status (online, offline, busy, away)
139
+ - Notifications, Tooltips, Modals, Dropdowns, etc.
140
+
141
+ ---
142
+
143
+ ## Benefits of This Architecture
144
+
145
+ ### 1. Single Source of Truth
146
+
147
+ Change a color once in primitives, affects all themes that use it:
148
+
149
+ ```css
150
+ /* Change primary purple across entire library */
151
+ --oklch-purple-500: oklch(70% 0.16 305); /* Lighter purple */
152
+ ```
153
+
154
+ ### 2. Rapid Theme Creation
155
+
156
+ Create a new theme in ~50 lines by only defining semantic mappings:
157
+
158
+ ```css
159
+ [data-theme='neon'] {
160
+ --semantic-primary: var(--oklch-cyan-400);
161
+ --semantic-surface: var(--oklch-black-90);
162
+ /* ... 15 more semantic tokens */
163
+ /* Component tokens inherited automatically! */
164
+ }
165
+ ```
166
+
167
+ ### 3. Type Safety
168
+
169
+ Semantic names prevent confusion:
170
+
171
+ ```css
172
+ /* ❌ Bad: What does this represent? */
173
+ --btn-bg: oklch(66.6% 0.159 303);
174
+
175
+ /* ✅ Good: Clear semantic meaning */
176
+ --btn-primary-bg: var(--semantic-primary);
177
+ ```
178
+
179
+ ### 4. Maintainability
180
+
181
+ - **Before:** 98 hardcoded OKLCH values in glass.css
182
+ - **After:** 0 hardcoded values, all use tokens
183
+ - **Result:** Change theme colors in seconds, not hours
184
+
185
+ ### 5. Consistency
186
+
187
+ All components using `--semantic-primary` automatically stay in sync when theme changes.
188
+
189
+ ---
190
+
191
+ ## Migration Results
192
+
193
+ | Metric | Before | After | Improvement |
194
+ | -------------------------- | --------- | ------------------------- | ---------------------------- |
195
+ | Unique color values | ~120 | 207 primitives (reusable) | 75% reduction in duplication |
196
+ | Glass.css hardcoded OKLCH | 98 | 0 | 100% elimination |
197
+ | Light.css hardcoded OKLCH | ~100 | 0 | 100% elimination |
198
+ | Aurora.css hardcoded OKLCH | ~80 | 0 | 100% elimination |
199
+ | Theme creation time | 2-3 hours | 10-15 minutes | **90% faster** |
200
+
201
+ ---
202
+
203
+ ## Usage Examples
204
+
205
+ ### Example 1: Using Semantic Tokens in Components
206
+
207
+ ```tsx
208
+ // In component styles (CSS/Tailwind)
209
+ .my-card {
210
+ background: var(--semantic-surface);
211
+ border: 1px solid var(--semantic-border);
212
+ color: var(--semantic-text);
213
+ }
214
+
215
+ .my-card:hover {
216
+ background: var(--semantic-surface-elevated);
217
+ border-color: var(--semantic-primary);
218
+ }
219
+ ```
220
+
221
+ ### Example 2: Creating a New Component Token
222
+
223
+ ```css
224
+ /* Add to theme file (glass.css, light.css, etc.) */
225
+ --my-widget-bg: var(--semantic-surface);
226
+ --my-widget-border: var(--semantic-border-strong);
227
+ --my-widget-accent: var(--semantic-primary);
228
+ --my-widget-hover-glow: 0 0 20px var(--oklch-purple-500-30);
229
+ ```
230
+
231
+ ### Example 3: Override for Specific Theme
232
+
233
+ ```css
234
+ /* glass.css */
235
+ --metric-card-glow: 0 0 12px var(--oklch-purple-500-40);
236
+
237
+ /* light.css */
238
+ --metric-card-glow: none; /* No glow in light theme */
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Best Practices
244
+
245
+ ### DO ✅
246
+
247
+ 1. **Always use semantic tokens in component tokens:**
248
+
249
+ ```css
250
+ --btn-primary-bg: var(--semantic-primary);
251
+ ```
252
+
253
+ 2. **Use primitive tokens for specific effects:**
254
+
255
+ ```css
256
+ --btn-primary-glow: 0 0 30px var(--oklch-purple-500-60);
257
+ ```
258
+
259
+ 3. **Create semantic tokens for new color roles:**
260
+
261
+ ```css
262
+ --semantic-accent-secondary: var(--oklch-cyan-500);
263
+ ```
264
+
265
+ 4. **Document new semantic tokens:**
266
+ ```css
267
+ /* Accent for promotional badges */
268
+ --semantic-promo: var(--oklch-pink-500);
269
+ ```
270
+
271
+ ### DON'T ❌
272
+
273
+ 1. **Don't hardcode OKLCH values:**
274
+
275
+ ```css
276
+ /* ❌ Bad */
277
+ --btn-bg: oklch(66.6% 0.159 303);
278
+
279
+ /* ✅ Good */
280
+ --btn-bg: var(--semantic-primary);
281
+ ```
282
+
283
+ 2. **Don't use primitive tokens in component styles:**
284
+
285
+ ```css
286
+ /* ❌ Bad */
287
+ .card {
288
+ background: var(--oklch-white-8);
289
+ }
290
+
291
+ /* ✅ Good */
292
+ .card {
293
+ background: var(--semantic-surface);
294
+ }
295
+ ```
296
+
297
+ 3. **Don't skip semantic layer:**
298
+
299
+ ```css
300
+ /* ❌ Bad (skips semantic layer) */
301
+ --btn-primary-bg: var(--oklch-purple-500);
302
+
303
+ /* ✅ Good (uses semantic layer) */
304
+ --btn-primary-bg: var(--semantic-primary);
305
+ ```
306
+
307
+ 4. **Don't create semantic tokens without documenting them:**
308
+
309
+ ```css
310
+ /* ❌ Bad: What is this for? */
311
+ --semantic-special: var(--oklch-pink-500);
312
+
313
+ /* ✅ Good: Clear purpose */
314
+ /* Premium badge accent color */
315
+ --semantic-premium: var(--oklch-pink-500);
316
+ ```
317
+
318
+ ---
319
+
320
+ ## File Locations
321
+
322
+ ```
323
+ src/styles/
324
+ ├── tokens/
325
+ │ └── oklch-primitives.css # Layer 1: Primitive tokens (207 tokens)
326
+ └── themes/
327
+ ├── glass.css # Layer 2 + 3: Semantic + Component (glass theme)
328
+ ├── light.css # Layer 2 + 3: Semantic + Component (light theme)
329
+ └── aurora.css # Layer 2 + 3: Semantic + Component (aurora theme)
330
+ ```
331
+
332
+ ---
333
+
334
+ ## Related Documentation
335
+
336
+ - [THEME_CREATION_GUIDE.md](./THEME_CREATION_GUIDE.md) - Step-by-step guide to creating new themes
337
+ - [PRIMITIVE_MAPPING.md](./PRIMITIVE_MAPPING.md) - Complete mapping of OKLCH values to primitives
338
+ - [CSS_VARIABLES_REFACTORING_PLAN.md](./CSS_VARIABLES_REFACTORING_PLAN.md) - Original refactoring
339
+ plan
340
+
341
+ ---
342
+
343
+ ## Browser Compatibility
344
+
345
+ **Primitive Tokens:** Universal support (CSS custom properties)
346
+
347
+ **OKLCH Colors:** Modern browsers only
348
+
349
+ - Chrome 111+ (March 2023)
350
+ - Safari 15.4+ (March 2022)
351
+ - Firefox 113+ (May 2023)
352
+
353
+ **Fallback Strategy:** Explicit OKLCH values defined (no `oklch(from ...)` relative colors used)
354
+
355
+ ---
356
+
357
+ ## Contributing
358
+
359
+ When adding new colors or components:
360
+
361
+ 1. Check if needed primitive exists in `oklch-primitives.css`
362
+ 2. If not, add to appropriate color family section
363
+ 3. Create semantic mapping in theme files
364
+ 4. Document new semantic tokens with comments
365
+ 5. Test across all 3 themes (glass, light, aurora)