@idealyst/theme 1.0.83 → 1.0.84

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 (68) hide show
  1. package/package.json +2 -1
  2. package/src/components/CLAUDE.md +468 -0
  3. package/src/components/accordion.ts +34 -0
  4. package/src/components/activity-indicator.ts +28 -0
  5. package/src/components/alert.ts +32 -0
  6. package/src/components/avatar.ts +27 -0
  7. package/src/components/badge.ts +28 -0
  8. package/src/components/breadcrumb.ts +36 -0
  9. package/src/components/button.ts +32 -0
  10. package/src/components/card.ts +31 -0
  11. package/src/components/checkbox.ts +37 -0
  12. package/src/components/chip.ts +34 -0
  13. package/src/components/dialog.ts +31 -0
  14. package/src/components/divider.ts +36 -0
  15. package/src/components/icon.ts +26 -0
  16. package/src/components/image.ts +22 -0
  17. package/src/components/index.ts +37 -0
  18. package/src/components/input.ts +35 -0
  19. package/src/components/list.ts +40 -0
  20. package/src/components/menu-item.ts +29 -0
  21. package/src/components/menu.ts +32 -0
  22. package/src/components/popover.ts +25 -0
  23. package/src/components/pressable.ts +20 -0
  24. package/src/components/progress.ts +35 -0
  25. package/src/components/radio-button.ts +38 -0
  26. package/src/components/screen.ts +25 -0
  27. package/src/components/select.ts +62 -0
  28. package/src/components/skeleton.ts +26 -0
  29. package/src/components/slider.ts +62 -0
  30. package/src/components/svg-image.ts +24 -0
  31. package/src/components/switch.ts +54 -0
  32. package/src/components/tab-bar.ts +54 -0
  33. package/src/components/table.ts +57 -0
  34. package/src/components/text.ts +29 -0
  35. package/src/components/textarea.ts +53 -0
  36. package/src/components/tooltip.ts +29 -0
  37. package/src/components/video.ts +18 -0
  38. package/src/components/view.ts +31 -0
  39. package/src/darkTheme.ts +890 -0
  40. package/src/index.ts +7 -166
  41. package/src/lightTheme.ts +873 -0
  42. package/src/styles.ts +14 -0
  43. package/src/theme/color.ts +15 -0
  44. package/src/theme/index.ts +16 -0
  45. package/src/theme/intent.ts +8 -0
  46. package/src/theme/shadow.ts +18 -0
  47. package/src/theme/size.ts +182 -0
  48. package/src/theme/surface.ts +3 -0
  49. package/src/unistyles.ts +6 -14
  50. package/src/variants/color.ts +9 -0
  51. package/src/variants/index.ts +2 -0
  52. package/src/variants/intent.ts +16 -0
  53. package/src/variants/size.ts +0 -0
  54. package/CLAUDE.md +0 -447
  55. package/LLM-ACCESS-GUIDE.md +0 -208
  56. package/README.md +0 -633
  57. package/src/README.md +0 -138
  58. package/src/breakpoints.ts +0 -8
  59. package/src/colorResolver.ts +0 -218
  60. package/src/colors.md +0 -353
  61. package/src/colors.ts +0 -315
  62. package/src/common.ts +0 -92
  63. package/src/defaultThemes.md +0 -407
  64. package/src/defaultThemes.ts +0 -238
  65. package/src/themeBuilder.md +0 -400
  66. package/src/themeBuilder.ts +0 -602
  67. package/src/variantHelpers.ts +0 -584
  68. package/src/variants.ts +0 -56
@@ -1,238 +0,0 @@
1
- import {
2
- createTheme,
3
- generateColorPalette,
4
- createLightResolvedIntents,
5
- createDarkResolvedIntents,
6
- createLightResolvedColors,
7
- createDarkResolvedColors,
8
- type ThemeConfig
9
- } from './themeBuilder';
10
- import { commonThemeProperties } from './common';
11
-
12
- // =============================================================================
13
- // DEFAULT PALETTES
14
- // =============================================================================
15
-
16
- /**
17
- * Helper function to create standard color palettes
18
- */
19
- export function createStandardPalettes(): ThemeConfig['palettes'] {
20
- return {
21
- red: generateColorPalette('#ef4444'),
22
- orange: generateColorPalette('#f97316'),
23
- yellow: generateColorPalette('#eab308'),
24
- green: generateColorPalette('#22c55e'),
25
- blue: generateColorPalette('#3b82f6'),
26
- purple: generateColorPalette('#a855f7'),
27
- black: generateColorPalette('#000000'),
28
- gray: generateColorPalette('#6b7280'),
29
- white: generateColorPalette('#ffffff'),
30
- };
31
- }
32
-
33
- /**
34
- * Helper function to create dark theme palettes with proper dark mode colors
35
- */
36
- export function createDarkPalettes(): ThemeConfig['palettes'] {
37
- const basePalettes = createStandardPalettes();
38
-
39
- return {
40
- ...basePalettes,
41
- // Adjusted gray palette for dark theme
42
- gray: {
43
- 50: '#18181b', // Very dark background
44
- 100: '#27272a', // Dark surface
45
- 200: '#3f3f46', // Medium dark
46
- 300: '#52525b', // Medium
47
- 400: '#71717a', // Medium light
48
- 500: '#a1a1aa', // Light gray
49
- 600: '#d4d4d8', // Lighter gray
50
- 700: '#e4e4e7', // Very light gray
51
- 800: '#f4f4f5', // Nearly white
52
- 900: '#fafafa', // White
53
- },
54
- // Adjusted black palette for dark theme
55
- black: {
56
- 50: '#000000', // Pure black
57
- 100: '#0a0a0a', // Very dark
58
- 200: '#141414', // Dark
59
- 300: '#1f1f1f', // Medium dark
60
- 400: '#2a2a2a', // Medium
61
- 500: '#3c3c3c', // Medium light
62
- 600: '#525252', // Light
63
- 700: '#737373', // Lighter
64
- 800: '#a3a3a3', // Very light
65
- 900: '#d4d4d4', // Nearly white
66
- },
67
- // Adjusted white palette for dark theme
68
- white: {
69
- 50: '#0c0c0c', // Very dark (inverted)
70
- 100: '#171717', // Dark
71
- 200: '#262626', // Medium dark
72
- 300: '#404040', // Medium
73
- 400: '#525252', // Medium light
74
- 500: '#737373', // Light
75
- 600: '#a3a3a3', // Lighter
76
- 700: '#d4d4d4', // Very light
77
- 800: '#f5f5f5', // Nearly white
78
- 900: '#ffffff', // Pure white
79
- },
80
- };
81
- }
82
-
83
- // Convenience functions for complete theme creation
84
- export function createLightIntentMappings(): ThemeConfig['intents'] {
85
- const palettes = createStandardPalettes();
86
- return createLightResolvedIntents(palettes);
87
- }
88
-
89
- export function createDarkIntentMappings(): ThemeConfig['intents'] {
90
- const palettes = createDarkPalettes();
91
- return createDarkResolvedIntents(palettes);
92
- }
93
-
94
- export function createLightColorMappings(): ThemeConfig['colors'] {
95
- const palettes = createStandardPalettes();
96
- return createLightResolvedColors(palettes);
97
- }
98
-
99
- export function createDarkColorMappings(): ThemeConfig['colors'] {
100
- const palettes = createDarkPalettes();
101
- return createDarkResolvedColors(palettes);
102
- }
103
-
104
- // Create default light theme using the explicit theme builder
105
- export function createDefaultLightTheme() {
106
- return createTheme({
107
- name: 'DefaultLight',
108
- mode: 'light',
109
- palettes: createStandardPalettes(),
110
- intents: createLightIntentMappings(),
111
- colors: createLightColorMappings(),
112
-
113
- typography: {
114
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
115
- },
116
-
117
- borderRadius: {
118
- sm: 4,
119
- md: 8,
120
- lg: 12,
121
- xl: 16,
122
- xxl: 20,
123
- },
124
-
125
- spacing: {
126
- xs: 4,
127
- sm: 8,
128
- md: 16,
129
- lg: 24,
130
- xl: 32,
131
- xxl: 40,
132
- xxxl: 48,
133
- },
134
-
135
- shadows: {
136
- sm: {
137
- shadowColor: '#000',
138
- shadowOffset: { width: 0, height: 1 },
139
- shadowOpacity: 0.05,
140
- shadowRadius: 2,
141
- elevation: 1,
142
- },
143
- md: {
144
- shadowColor: '#000',
145
- shadowOffset: { width: 0, height: 4 },
146
- shadowOpacity: 0.1,
147
- shadowRadius: 8,
148
- elevation: 4,
149
- },
150
- lg: {
151
- shadowColor: '#000',
152
- shadowOffset: { width: 0, height: 8 },
153
- shadowOpacity: 0.15,
154
- shadowRadius: 16,
155
- elevation: 8,
156
- },
157
- },
158
-
159
- transitions: {
160
- fast: '0.15s ease',
161
- base: '0.2s ease',
162
- slow: '0.3s ease',
163
- button: 'all 0.2s ease',
164
- fade: 'opacity 0.2s ease',
165
- slide: 'transform 0.3s ease',
166
- },
167
- });
168
- }
169
-
170
- // Create default dark theme using the explicit theme builder
171
- export function createDefaultDarkTheme() {
172
- return createTheme({
173
- name: 'DefaultDark',
174
- mode: 'dark',
175
- palettes: createDarkPalettes(),
176
- intents: createDarkIntentMappings(),
177
- colors: createDarkColorMappings(),
178
-
179
- typography: {
180
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
181
- },
182
-
183
- borderRadius: {
184
- sm: 4,
185
- md: 8,
186
- lg: 12,
187
- xl: 16,
188
- xxl: 20,
189
- },
190
-
191
- spacing: {
192
- xs: 4,
193
- sm: 8,
194
- md: 16,
195
- lg: 24,
196
- xl: 32,
197
- xxl: 40,
198
- xxxl: 48,
199
- },
200
-
201
- shadows: {
202
- sm: {
203
- shadowColor: '#000',
204
- shadowOffset: { width: 0, height: 1 },
205
- shadowOpacity: 0.2,
206
- shadowRadius: 2,
207
- elevation: 1,
208
- },
209
- md: {
210
- shadowColor: '#000',
211
- shadowOffset: { width: 0, height: 4 },
212
- shadowOpacity: 0.3,
213
- shadowRadius: 8,
214
- elevation: 4,
215
- },
216
- lg: {
217
- shadowColor: '#000',
218
- shadowOffset: { width: 0, height: 8 },
219
- shadowOpacity: 0.4,
220
- shadowRadius: 16,
221
- elevation: 8,
222
- },
223
- },
224
-
225
- transitions: {
226
- fast: '0.15s ease',
227
- base: '0.2s ease',
228
- slow: '0.3s ease',
229
- button: 'all 0.2s ease',
230
- fade: 'opacity 0.2s ease',
231
- slide: 'transform 0.3s ease',
232
- },
233
- });
234
- }
235
-
236
- // Export the created themes
237
- export const defaultLightTheme = createDefaultLightTheme();
238
- export const defaultDarkTheme = createDefaultDarkTheme();
@@ -1,400 +0,0 @@
1
- # Theme Builder
2
-
3
- The core theme creation and extension utilities for building comprehensive theme objects.
4
-
5
- ## Overview
6
-
7
- The theme builder provides the fundamental functions for creating, extending, and customizing themes. It handles color resolution, intent mapping, and theme structure generation.
8
-
9
- ## Key Functions
10
-
11
- ### createTheme
12
-
13
- Creates a complete theme from a configuration object.
14
-
15
- ```tsx
16
- import { createTheme, generateColorPalette } from './themeBuilder';
17
-
18
- const theme = createTheme({
19
- palettes: {
20
- blue: generateColorPalette('#3b82f6'),
21
- green: generateColorPalette('#22c55e'),
22
- red: generateColorPalette('#ef4444'),
23
- gray: generateColorPalette('#6b7280'),
24
- },
25
- intents: {
26
- primary: 'blue',
27
- success: 'green',
28
- error: 'red',
29
- neutral: 'gray',
30
- },
31
- // Optional: custom typography, spacing, etc.
32
- });
33
- ```
34
-
35
- **Parameters:**
36
- - `config: ThemeConfig` - Theme configuration object
37
-
38
- **Returns:**
39
- - Complete `AppTheme` object with all theme properties
40
-
41
- ### extendTheme
42
-
43
- Extends an existing theme with new or modified properties.
44
-
45
- ```tsx
46
- import { extendTheme, defaultLightTheme } from './themeBuilder';
47
-
48
- const customTheme = extendTheme(defaultLightTheme, {
49
- palettes: {
50
- brand: generateColorPalette('#8b5cf6'), // Add brand color
51
- },
52
- intents: {
53
- primary: 'brand', // Override primary intent
54
- },
55
- typography: {
56
- fontFamily: {
57
- sans: 'Helvetica, Arial, sans-serif', // Custom font
58
- },
59
- },
60
- });
61
- ```
62
-
63
- **Parameters:**
64
- - `baseTheme: AppTheme` - Base theme to extend
65
- - `overrides: Partial<ThemeConfig>` - Properties to override
66
-
67
- **Returns:**
68
- - Extended `AppTheme` with merged properties
69
-
70
- ### generateColorPalette
71
-
72
- Generates a complete 10-shade color palette from a single base color.
73
-
74
- ```tsx
75
- import { generateColorPalette } from './themeBuilder';
76
-
77
- const brandPalette = generateColorPalette('#8b5cf6');
78
- // Returns:
79
- // {
80
- // 50: '#faf7ff', // Lightest
81
- // 100: '#f3e8ff',
82
- // 200: '#e9d5ff',
83
- // 300: '#d8b4fe',
84
- // 400: '#c084fc',
85
- // 500: '#8b5cf6', // Base color (input)
86
- // 600: '#7c3aed',
87
- // 700: '#6d28d9',
88
- // 800: '#5b21b6',
89
- // 900: '#581c87', // Darkest
90
- // }
91
- ```
92
-
93
- **Parameters:**
94
- - `baseColor: string` - Hex color string (e.g., '#8b5cf6')
95
-
96
- **Returns:**
97
- - `ThemeColorPalette` object with shades 50-900
98
-
99
- ## Color Resolution Functions
100
-
101
- ### createLightResolvedIntents
102
-
103
- Creates intent color mappings optimized for light themes.
104
-
105
- ```tsx
106
- import { createLightResolvedIntents } from './themeBuilder';
107
-
108
- const lightIntents = createLightResolvedIntents({
109
- blue: generateColorPalette('#3b82f6'),
110
- green: generateColorPalette('#22c55e'),
111
- red: generateColorPalette('#ef4444'),
112
- amber: generateColorPalette('#f59e0b'),
113
- gray: generateColorPalette('#6b7280'),
114
- });
115
- ```
116
-
117
- ### createDarkResolvedIntents
118
-
119
- Creates intent color mappings optimized for dark themes.
120
-
121
- ```tsx
122
- import { createDarkResolvedIntents } from './themeBuilder';
123
-
124
- const darkIntents = createDarkResolvedIntents({
125
- blue: generateColorPalette('#3b82f6'),
126
- green: generateColorPalette('#22c55e'),
127
- red: generateColorPalette('#ef4444'),
128
- amber: generateColorPalette('#f59e0b'),
129
- gray: generateColorPalette('#374151'), // Darker gray for dark theme
130
- });
131
- ```
132
-
133
- ### createLightResolvedColors
134
-
135
- Creates component color system for light themes.
136
-
137
- ```tsx
138
- const lightColors = createLightResolvedColors(palettes, intents);
139
- // Returns structured color system for text, surface, border, interactive
140
- ```
141
-
142
- ### createDarkResolvedColors
143
-
144
- Creates component color system for dark themes.
145
-
146
- ```tsx
147
- const darkColors = createDarkResolvedColors(palettes, intents);
148
- // Returns structured color system optimized for dark backgrounds
149
- ```
150
-
151
- ## Theme Configuration Types
152
-
153
- ### ThemeConfig
154
-
155
- Configuration object for creating themes:
156
-
157
- ```tsx
158
- interface ThemeConfig {
159
- palettes: Record<string, ThemeColorPalette>;
160
- intents: Record<string, string>; // Maps intent names to palette names
161
-
162
- // Optional overrides
163
- typography?: Partial<TypographySystem>;
164
- spacing?: Partial<SpacingSystem>;
165
- borderRadius?: Partial<BorderRadiusSystem>;
166
- shadows?: Partial<ShadowSystem>;
167
- transitions?: Partial<TransitionSystem>;
168
- }
169
- ```
170
-
171
- ### ThemeColorPalette
172
-
173
- 10-shade color palette structure:
174
-
175
- ```tsx
176
- interface ThemeColorPalette {
177
- 50: string; // Lightest shade
178
- 100: string;
179
- 200: string;
180
- 300: string;
181
- 400: string;
182
- 500: string; // Base color
183
- 600: string;
184
- 700: string;
185
- 800: string;
186
- 900: string; // Darkest shade
187
- }
188
- ```
189
-
190
- ### ResolvedIntent
191
-
192
- Complete intent color mapping:
193
-
194
- ```tsx
195
- interface ResolvedIntent {
196
- main: string; // Primary color
197
- on: string; // Text color on main
198
- container: string; // Container background
199
- onContainer: string; // Text on container
200
- light: string; // Light variant
201
- dark: string; // Dark variant
202
- border: string; // Border color
203
- }
204
- ```
205
-
206
- ## Advanced Usage
207
-
208
- ### Custom Theme with Brand Colors
209
-
210
- ```tsx
211
- const brandTheme = createTheme({
212
- palettes: {
213
- brand: generateColorPalette('#ff6b6b'), // Coral brand
214
- accent: generateColorPalette('#4ecdc4'), // Teal accent
215
- neutral: generateColorPalette('#95a5a6'), // Cool gray
216
- success: generateColorPalette('#2ecc71'), // Green
217
- error: generateColorPalette('#e74c3c'), // Red
218
- warning: generateColorPalette('#f39c12'), // Orange
219
- },
220
- intents: {
221
- primary: 'brand',
222
- secondary: 'accent',
223
- neutral: 'neutral',
224
- success: 'success',
225
- error: 'error',
226
- warning: 'warning',
227
- },
228
- typography: {
229
- fontFamily: {
230
- sans: 'Inter, system-ui, sans-serif',
231
- mono: 'JetBrains Mono, monospace',
232
- },
233
- fontSize: {
234
- xs: 11,
235
- sm: 13,
236
- md: 15,
237
- lg: 17,
238
- xl: 19,
239
- xxl: 23,
240
- },
241
- },
242
- spacing: {
243
- xs: 2,
244
- sm: 6,
245
- md: 12,
246
- lg: 20,
247
- xl: 32,
248
- xxl: 52,
249
- },
250
- });
251
- ```
252
-
253
- ### Theme Variants
254
-
255
- ```tsx
256
- // Create base theme
257
- const baseTheme = createTheme(baseConfig);
258
-
259
- // Create high contrast variant
260
- const highContrastTheme = extendTheme(baseTheme, {
261
- colors: {
262
- text: {
263
- primary: '#000000', // Pure black
264
- secondary: '#1a1a1a', // Near black
265
- },
266
- border: {
267
- primary: '#000000', // Black borders
268
- focus: '#0066cc', // High contrast blue
269
- },
270
- },
271
- });
272
-
273
- // Create compact variant
274
- const compactTheme = extendTheme(baseTheme, {
275
- spacing: {
276
- xs: 2,
277
- sm: 4,
278
- md: 8,
279
- lg: 12,
280
- xl: 16,
281
- xxl: 24,
282
- },
283
- typography: {
284
- fontSize: {
285
- xs: 10,
286
- sm: 12,
287
- md: 14,
288
- lg: 16,
289
- xl: 18,
290
- xxl: 20,
291
- },
292
- },
293
- });
294
- ```
295
-
296
- ### Dynamic Theme Generation
297
-
298
- ```tsx
299
- function createBrandTheme(brandColor: string, accentColor: string) {
300
- return createTheme({
301
- palettes: {
302
- brand: generateColorPalette(brandColor),
303
- accent: generateColorPalette(accentColor),
304
- neutral: generateColorPalette('#6b7280'),
305
- success: generateColorPalette('#22c55e'),
306
- error: generateColorPalette('#ef4444'),
307
- warning: generateColorPalette('#f59e0b'),
308
- },
309
- intents: {
310
- primary: 'brand',
311
- secondary: 'accent',
312
- neutral: 'neutral',
313
- success: 'success',
314
- error: 'error',
315
- warning: 'warning',
316
- },
317
- });
318
- }
319
-
320
- // Generate themes dynamically
321
- const redTheme = createBrandTheme('#e53e3e', '#4299e1');
322
- const purpleTheme = createBrandTheme('#8b5cf6', '#06b6d4');
323
- ```
324
-
325
- ## Color Utility Functions
326
-
327
- ### lighten
328
-
329
- Lightens a color by a specified percentage:
330
-
331
- ```tsx
332
- import { lighten } from './colorResolver';
333
-
334
- const lightBlue = lighten('#3b82f6', 0.2); // 20% lighter
335
- ```
336
-
337
- ### darken
338
-
339
- Darkens a color by a specified percentage:
340
-
341
- ```tsx
342
- import { darken } from './colorResolver';
343
-
344
- const darkBlue = darken('#3b82f6', 0.2); // 20% darker
345
- ```
346
-
347
- ## Best Practices
348
-
349
- 1. **Use generateColorPalette**: Always generate complete palettes for consistency
350
- 2. **Start with defaults**: Extend default themes rather than creating from scratch
351
- 3. **Intent mapping**: Use semantic intent names (primary, success, error, etc.)
352
- 4. **Type safety**: Leverage TypeScript for theme validation
353
- 5. **Performance**: Create themes once and reuse them
354
- 6. **Accessibility**: Ensure sufficient contrast in custom color combinations
355
-
356
- ## Common Patterns
357
-
358
- ### Corporate Branding
359
-
360
- ```tsx
361
- const corporateTheme = extendTheme(defaultLightTheme, {
362
- palettes: {
363
- corporate: generateColorPalette('#1a365d'), // Navy corporate color
364
- },
365
- intents: {
366
- primary: 'corporate',
367
- },
368
- typography: {
369
- fontFamily: {
370
- sans: 'Helvetica Neue, Arial, sans-serif',
371
- },
372
- },
373
- });
374
- ```
375
-
376
- ### Accessibility-First Theme
377
-
378
- ```tsx
379
- const accessibleTheme = extendTheme(defaultLightTheme, {
380
- colors: {
381
- text: {
382
- primary: '#000000', // Pure black for maximum contrast
383
- secondary: '#4a4a4a', // Dark gray with good contrast
384
- },
385
- border: {
386
- focus: '#005fcc', // High contrast focus indicator
387
- },
388
- },
389
- typography: {
390
- fontSize: {
391
- xs: 14, // Minimum 14px for readability
392
- sm: 16,
393
- md: 18,
394
- lg: 20,
395
- xl: 24,
396
- xxl: 28,
397
- },
398
- },
399
- });
400
- ```