@shohojdhara/atomix 0.3.5 → 0.3.7

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 (182) hide show
  1. package/README.md +101 -199
  2. package/atomix.config.ts +241 -0
  3. package/dist/atomix.css +260 -179
  4. package/dist/atomix.css.map +1 -1
  5. package/dist/atomix.min.css +250 -179
  6. package/dist/atomix.min.css.map +1 -1
  7. package/dist/charts.js +69 -166
  8. package/dist/charts.js.map +1 -1
  9. package/dist/core.js +184 -263
  10. package/dist/core.js.map +1 -1
  11. package/dist/forms.js +55 -131
  12. package/dist/forms.js.map +1 -1
  13. package/dist/heavy.js +184 -263
  14. package/dist/heavy.js.map +1 -1
  15. package/dist/index.d.ts +1831 -1657
  16. package/dist/index.esm.js +4497 -4318
  17. package/dist/index.esm.js.map +1 -1
  18. package/dist/index.js +4510 -4328
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.min.js +1 -1
  21. package/dist/index.min.js.map +1 -1
  22. package/dist/theme.d.ts +1431 -1472
  23. package/dist/theme.js +4175 -4138
  24. package/dist/theme.js.map +1 -1
  25. package/package.json +6 -20
  26. package/src/components/Accordion/Accordion.stories.tsx +50 -17
  27. package/src/components/AtomixGlass/AtomixGlass.tsx +128 -322
  28. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +12 -5
  29. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
  30. package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
  31. package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
  32. package/src/components/Avatar/Avatar.stories.tsx +7 -0
  33. package/src/components/Badge/Badge.stories.tsx +91 -13
  34. package/src/components/Block/Block.stories.tsx +7 -23
  35. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
  36. package/src/components/Button/Button.stories.tsx +141 -22
  37. package/src/components/Button/Button.tsx +85 -167
  38. package/src/components/Button/ButtonGroup.stories.tsx +315 -0
  39. package/src/components/Button/ButtonGroup.tsx +67 -0
  40. package/src/components/Button/index.ts +2 -0
  41. package/src/components/Callout/Callout.stories.tsx +8 -6
  42. package/src/components/Card/Card.stories.tsx +82 -28
  43. package/src/components/Chart/AnimatedChart.tsx +0 -1
  44. package/src/components/Chart/AreaChart.tsx +0 -1
  45. package/src/components/Chart/BarChart.tsx +0 -1
  46. package/src/components/Chart/BubbleChart.tsx +0 -1
  47. package/src/components/Chart/CandlestickChart.tsx +0 -1
  48. package/src/components/Chart/Chart.stories.tsx +5 -7
  49. package/src/components/Chart/Chart.tsx +0 -16
  50. package/src/components/Chart/ChartRenderer.tsx +1 -1
  51. package/src/components/Chart/DonutChart.tsx +0 -1
  52. package/src/components/Chart/FunnelChart.tsx +0 -1
  53. package/src/components/Chart/GaugeChart.tsx +0 -1
  54. package/src/components/Chart/HeatmapChart.tsx +0 -1
  55. package/src/components/Chart/LineChart.tsx +0 -1
  56. package/src/components/Chart/MultiAxisChart.tsx +0 -1
  57. package/src/components/Chart/PieChart.tsx +0 -1
  58. package/src/components/Chart/RadarChart.tsx +0 -1
  59. package/src/components/Chart/ScatterChart.tsx +0 -1
  60. package/src/components/Chart/WaterfallChart.tsx +0 -1
  61. package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
  62. package/src/components/DataTable/DataTable.stories.tsx +23 -16
  63. package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
  64. package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
  65. package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
  66. package/src/components/Footer/Footer.stories.tsx +8 -6
  67. package/src/components/Footer/FooterLink.tsx +9 -2
  68. package/src/components/Form/Checkbox.stories.tsx +7 -0
  69. package/src/components/Form/Form.stories.tsx +7 -0
  70. package/src/components/Form/FormGroup.stories.tsx +9 -1
  71. package/src/components/Form/Input.stories.tsx +69 -16
  72. package/src/components/Form/Radio.stories.tsx +9 -1
  73. package/src/components/Form/Select.stories.tsx +9 -1
  74. package/src/components/Form/Textarea.stories.tsx +10 -2
  75. package/src/components/Hero/Hero.stories.tsx +7 -0
  76. package/src/components/List/List.stories.tsx +7 -0
  77. package/src/components/Messages/Messages.stories.tsx +8 -7
  78. package/src/components/Modal/Modal.stories.tsx +17 -6
  79. package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
  80. package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
  81. package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
  82. package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
  83. package/src/components/Pagination/Pagination.stories.tsx +188 -111
  84. package/src/components/Pagination/Pagination.tsx +83 -3
  85. package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
  86. package/src/components/Popover/Popover.stories.tsx +191 -115
  87. package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
  88. package/src/components/Progress/Progress.stories.tsx +79 -49
  89. package/src/components/Rating/Rating.stories.tsx +109 -84
  90. package/src/components/River/River.stories.tsx +194 -114
  91. package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
  92. package/src/components/Slider/Slider.stories.tsx +7 -0
  93. package/src/components/Spinner/Spinner.stories.tsx +15 -11
  94. package/src/components/Steps/Steps.stories.tsx +132 -98
  95. package/src/components/Tabs/Tabs.stories.tsx +163 -112
  96. package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
  97. package/src/components/Todo/Todo.stories.tsx +38 -12
  98. package/src/components/Toggle/Toggle.stories.tsx +61 -28
  99. package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
  100. package/src/components/Upload/Upload.stories.tsx +122 -84
  101. package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
  102. package/src/components/index.ts +1 -0
  103. package/src/lib/composables/useAtomixGlass.ts +9 -10
  104. package/src/lib/composables/useNavbar.ts +0 -10
  105. package/src/lib/config/loader.ts +4 -4
  106. package/src/lib/constants/components.ts +17 -0
  107. package/src/lib/hooks/useComponentCustomization.ts +1 -1
  108. package/src/lib/hooks/usePerformanceMonitor.ts +1 -1
  109. package/src/lib/hooks/useThemeTokens.ts +105 -0
  110. package/src/lib/theme/README.md +174 -0
  111. package/src/lib/theme/adapters/index.ts +31 -0
  112. package/src/lib/theme/adapters/themeAdapter.ts +287 -0
  113. package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
  114. package/src/lib/theme/config/configLoader.ts +95 -0
  115. package/src/lib/theme/config/loader.ts +37 -54
  116. package/src/lib/theme/config/types.ts +2 -2
  117. package/src/lib/theme/config/validator.ts +15 -91
  118. package/src/lib/theme/{constants.ts → constants/constants.ts} +1 -19
  119. package/src/lib/theme/constants/index.ts +8 -0
  120. package/src/lib/theme/core/ThemeRegistry.ts +75 -266
  121. package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
  122. package/src/lib/theme/core/composeTheme.ts +105 -0
  123. package/src/lib/theme/core/createTheme.ts +108 -0
  124. package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +12 -8
  125. package/src/lib/theme/core/index.ts +19 -19
  126. package/src/lib/theme/devtools/Comparator.tsx +346 -22
  127. package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
  128. package/src/lib/theme/devtools/Inspector.tsx +335 -51
  129. package/src/lib/theme/devtools/LiveEditor.tsx +478 -107
  130. package/src/lib/theme/devtools/Preview.tsx +471 -221
  131. package/src/lib/theme/{core → devtools}/ThemeValidator.ts +1 -1
  132. package/src/lib/theme/devtools/index.ts +14 -4
  133. package/src/lib/theme/devtools/useHistory.ts +130 -0
  134. package/src/lib/theme/{errors.ts → errors/errors.ts} +1 -1
  135. package/src/lib/theme/errors/index.ts +12 -0
  136. package/src/lib/theme/generators/cssFile.ts +79 -0
  137. package/src/lib/theme/generators/generateCSS.ts +89 -0
  138. package/src/lib/theme/generators/generateCSSNested.ts +130 -0
  139. package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +3 -13
  140. package/src/lib/theme/generators/index.ts +25 -0
  141. package/src/lib/theme/i18n/rtl.ts +5 -6
  142. package/src/lib/theme/index.ts +149 -19
  143. package/src/lib/theme/runtime/ThemeApplicator.ts +53 -112
  144. package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
  145. package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +5 -5
  146. package/src/lib/theme/runtime/ThemeProvider.tsx +266 -282
  147. package/src/lib/theme/runtime/index.ts +2 -2
  148. package/src/lib/theme/runtime/useTheme.ts +1 -2
  149. package/src/lib/theme/runtime/useThemeTokens.ts +131 -0
  150. package/src/lib/theme/test/testTheme.ts +385 -0
  151. package/src/lib/theme/tokens/index.ts +12 -0
  152. package/src/lib/theme/tokens/tokens.ts +721 -0
  153. package/src/lib/theme/types.ts +6 -42
  154. package/src/lib/theme/utils/componentTheming.ts +132 -0
  155. package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
  156. package/src/lib/theme/utils/index.ts +11 -0
  157. package/src/lib/theme/utils/injectCSS.ts +90 -0
  158. package/src/lib/theme/utils/naming.ts +100 -0
  159. package/src/lib/theme/utils/themeHelpers.ts +78 -0
  160. package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +7 -7
  161. package/src/lib/theme-tools.ts +7 -8
  162. package/src/lib/types/components.ts +40 -130
  163. package/src/lib/utils/componentUtils.ts +2 -2
  164. package/src/lib/utils/memoryMonitor.ts +3 -3
  165. package/src/lib/utils/themeNaming.ts +135 -0
  166. package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
  167. package/src/styles/02-tools/_tools.button.scss +66 -79
  168. package/src/styles/06-components/_components.atomix-glass.scss +13 -3
  169. package/src/styles/06-components/_components.pagination.scss +88 -0
  170. package/scripts/sync-theme-config.js +0 -309
  171. package/src/lib/theme/composeTheme.ts +0 -370
  172. package/src/lib/theme/core/ThemeCache.ts +0 -283
  173. package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
  174. package/src/lib/theme/core/ThemeEngine.ts +0 -665
  175. package/src/lib/theme/createThemeFromConfig.ts +0 -132
  176. package/src/lib/theme/devtools/CLI.ts +0 -364
  177. package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
  178. package/src/lib/theme/runtime/ThemeManager.ts +0 -446
  179. package/src/styles/03-generic/_generated-root.css +0 -26
  180. package/src/themes/README.md +0 -442
  181. package/src/themes/themes.config.js +0 -68
  182. /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
@@ -0,0 +1,131 @@
1
+ import { useCallback } from 'react';
2
+ import { useTheme } from './useTheme';
3
+ import type { Theme } from '../types';
4
+
5
+ /**
6
+ * Standardized hook for accessing theme tokens in components
7
+ *
8
+ * Provides consistent access to theme values across all components
9
+ * using either CSS custom properties or theme object values.
10
+ */
11
+ type ThemeTokens = {
12
+ theme: string;
13
+ activeTheme: Theme | null;
14
+ getToken: (tokenName: string, fallback?: string) => string;
15
+ getThemeValue: (path: string, fallback?: any) => any;
16
+ colors: {
17
+ primary: string;
18
+ secondary: string;
19
+ error: string;
20
+ success: string;
21
+ warning: string;
22
+ info: string;
23
+ light: string;
24
+ dark: string;
25
+ };
26
+ spacing: Record<string, string>;
27
+ borderRadius: Record<string, string>;
28
+ typography: {
29
+ fontFamily: Record<string, string>;
30
+ fontSize: Record<string, string>;
31
+ fontWeight: Record<string, string>;
32
+ };
33
+ shadows: Record<string, string>;
34
+ transitions: Record<string, string>;
35
+ };
36
+
37
+ export function useThemeTokens(): ThemeTokens {
38
+ const { theme, activeTheme } = useTheme();
39
+
40
+ // Helper function to get CSS variable value
41
+ const getToken = useCallback((tokenName: string, fallback?: string) => {
42
+ if (typeof window === 'undefined') return fallback || '';
43
+
44
+ const cssVarName = `--atomix-${tokenName}`;
45
+ const computedStyle = getComputedStyle(document.documentElement);
46
+ return computedStyle.getPropertyValue(cssVarName).trim() || fallback || '';
47
+ }, []);
48
+
49
+ // Helper function to get theme object value
50
+ const getThemeValue = useCallback((path: string, fallback?: any) => {
51
+ if (!activeTheme) return fallback;
52
+
53
+ // Navigate through nested theme object using dot notation
54
+ return path.split('.').reduce((obj, key) => obj?.[key], activeTheme) || fallback;
55
+ }, [activeTheme]);
56
+
57
+ // Return unified API for accessing theme values
58
+ return <ThemeTokens>{
59
+ theme,
60
+ activeTheme,
61
+ getToken,
62
+ getThemeValue,
63
+ // Commonly used tokens with fallbacks
64
+ colors: {
65
+ primary: getToken('primary', '#3b82f6'),
66
+ secondary: getToken('secondary', '#10b981'),
67
+ error: getToken('error', '#ef4444'),
68
+ success: getToken('success', '#22c55e'),
69
+ warning: getToken('warning', '#eab308'),
70
+ info: getToken('info', '#3b82f6'),
71
+ light: getToken('light', '#f9fafb'),
72
+ dark: getToken('dark', '#111827'),
73
+ },
74
+ spacing: {
75
+ 1: getToken('spacing-1', '0.25rem'),
76
+ 2: getToken('spacing-2', '0.5rem'),
77
+ 3: getToken('spacing-3', '0.75rem'),
78
+ 4: getToken('spacing-4', '1rem'),
79
+ 5: getToken('spacing-5', '1.25rem'),
80
+ 6: getToken('spacing-6', '1.5rem'),
81
+ 8: getToken('spacing-8', '2rem'),
82
+ 10: getToken('spacing-10', '2.5rem'),
83
+ 12: getToken('spacing-12', '3rem'),
84
+ 16: getToken('spacing-16', '4rem'),
85
+ 20: getToken('spacing-20', '5rem'),
86
+ },
87
+ borderRadius: {
88
+ sm: getToken('border-radius-sm', '0.25rem'),
89
+ md: getToken('border-radius-md', '0.5rem'),
90
+ lg: getToken('border-radius-lg', '0.75rem'),
91
+ xl: getToken('border-radius-xl', '1rem'),
92
+ full: getToken('border-radius-full', '9999px'),
93
+ },
94
+ typography: {
95
+ fontFamily: {
96
+ sans: getToken('font-sans-serif', 'Inter, system-ui, sans-serif'),
97
+ serif: getToken('font-serif', 'Georgia, serif'),
98
+ mono: getToken('font-monospace', 'Fira Code, monospace'),
99
+ },
100
+ fontSize: {
101
+ xs: getToken('font-size-xs', '0.75rem'),
102
+ sm: getToken('font-size-sm', '0.875rem'),
103
+ md: getToken('font-size-md', '1rem'),
104
+ lg: getToken('font-size-lg', '1.125rem'),
105
+ xl: getToken('font-size-xl', '1.25rem'),
106
+ '2xl': getToken('font-size-2xl', '1.5rem'),
107
+ '3xl': getToken('font-size-3xl', '1.875rem'),
108
+ '4xl': getToken('font-size-4xl', '2.25rem'),
109
+ },
110
+ fontWeight: {
111
+ light: getToken('font-weight-light', '300'),
112
+ normal: getToken('font-weight-normal', '400'),
113
+ medium: getToken('font-weight-medium', '500'),
114
+ semibold: getToken('font-weight-semibold', '600'),
115
+ bold: getToken('font-weight-bold', '700'),
116
+ },
117
+ },
118
+ shadows: {
119
+ sm: getToken('box-shadow-sm', '0 1px 2px 0 rgba(0, 0, 0, 0.05)'),
120
+ md: getToken('box-shadow-md', '0 4px 6px -1px rgba(0, 0, 0, 0.1)'),
121
+ lg: getToken('box-shadow-lg', '0 10px 15px -3px rgba(0, 0, 0, 0.1)'),
122
+ xl: getToken('box-shadow-xl', '0 20px 25px -5px rgba(0, 0, 0, 0.1)'),
123
+ inset: getToken('box-shadow-inset', 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)'),
124
+ },
125
+ transitions: {
126
+ fast: getToken('transition-fast', '150ms'),
127
+ base: getToken('transition-base', '200ms'),
128
+ slow: getToken('transition-slow', '300ms'),
129
+ },
130
+ };
131
+ }
@@ -0,0 +1,385 @@
1
+ /**
2
+ * Test Theme
3
+ *
4
+ * Comprehensive test theme demonstrating both DesignTokens and Theme object approaches.
5
+ * This file can be used for testing the theme system, adapters, and generators.
6
+ */
7
+
8
+ import type { DesignTokens } from '../tokens/tokens';
9
+ import type { Theme, ThemeOptions } from '../types';
10
+ import { createTheme } from '../core/createTheme';
11
+ import { createThemeObject } from '../core/createThemeObject';
12
+ import { themeToDesignTokens, createDesignTokensFromTheme } from '../adapters/themeAdapter';
13
+
14
+ // ============================================================================
15
+ // Test Theme 1: Using DesignTokens (Recommended - Flat Structure)
16
+ // ============================================================================
17
+
18
+ /**
19
+ * Test theme using DesignTokens (flat structure)
20
+ *
21
+ * This is the recommended approach for most use cases.
22
+ * DesignTokens directly map to CSS variables.
23
+ */
24
+ export const testThemeTokens: Partial<DesignTokens> = {
25
+ // Primary colors
26
+ 'primary': '#7AFFD7',
27
+ 'primary-3': '#B3FFE9',
28
+ 'primary-6': '#7AFFD7',
29
+ 'primary-9': '#00E6C3',
30
+ 'primary-rgb': '122, 255, 215',
31
+
32
+ // Secondary colors
33
+ 'secondary': '#FF6B9D',
34
+ 'secondary-rgb': '255, 107, 157',
35
+
36
+ // Semantic colors
37
+ 'success': '#1AFF85',
38
+ 'success-rgb': '26, 255, 133',
39
+ 'error': '#FF1A1A',
40
+ 'error-rgb': '255, 26, 26',
41
+ 'warning': '#FFB800',
42
+ 'warning-rgb': '255, 184, 0',
43
+ 'info': '#1A9FFF',
44
+ 'info-rgb': '26, 159, 255',
45
+
46
+ // Background colors
47
+ 'body-bg': '#000000',
48
+ 'primary-bg-subtle': '#0A0A0A',
49
+ 'secondary-bg-subtle': '#1A1A1A',
50
+ 'tertiary-bg-subtle': '#2A2A2A',
51
+
52
+ // Text colors
53
+ 'body-color': '#FFFFFF',
54
+ 'heading-color': '#FFFFFF',
55
+ 'primary-text-emphasis': '#FFFFFF',
56
+ 'secondary-text-emphasis': 'rgba(255, 255, 255, 0.8)',
57
+ 'disabled-text-emphasis': 'rgba(255, 255, 255, 0.5)',
58
+
59
+ // Typography
60
+ 'body-font-family': '"Inter", "Roboto", sans-serif',
61
+ 'font-sans-serif': '"Inter", "Roboto", sans-serif',
62
+ 'body-font-size': '16px',
63
+ 'body-font-weight': '400',
64
+ 'font-weight-light': '300',
65
+ 'font-weight-normal': '400',
66
+ 'font-weight-medium': '500',
67
+ 'font-weight-semibold': '600',
68
+ 'font-weight-bold': '700',
69
+ 'line-height-base': '1.5',
70
+
71
+ // Spacing
72
+ 'spacing-1': '4px',
73
+ 'spacing-2': '8px',
74
+ 'spacing-3': '12px',
75
+ 'spacing-4': '16px',
76
+ 'spacing-5': '20px',
77
+ 'spacing-6': '24px',
78
+ 'spacing-8': '32px',
79
+
80
+ // Border radius
81
+ 'border-radius-sm': '4px',
82
+ 'border-radius': '6px',
83
+ 'border-radius-lg': '8px',
84
+ 'border-radius-xl': '12px',
85
+
86
+ // Shadows
87
+ 'box-shadow-xs': '0 1px 2px rgba(0, 0, 0, 0.05)',
88
+ 'box-shadow-sm': '0 1px 3px rgba(0, 0, 0, 0.1)',
89
+ 'box-shadow': '0 4px 6px rgba(0, 0, 0, 0.1)',
90
+ 'box-shadow-lg': '0 10px 15px rgba(0, 0, 0, 0.1)',
91
+ 'box-shadow-xl': '0 20px 25px rgba(0, 0, 0, 0.15)',
92
+
93
+ // Z-index
94
+ 'z-dropdown': '1000',
95
+ 'z-sticky': '1020',
96
+ 'z-fixed': '1030',
97
+ 'z-modal-backdrop': '1040',
98
+ 'z-modal': '1050',
99
+ 'z-popover': '1060',
100
+ 'z-tooltip': '1070',
101
+
102
+ // Transitions
103
+ 'transition-duration-fast': '150ms',
104
+ 'transition-duration-base': '200ms',
105
+ 'transition-duration-slow': '300ms',
106
+ 'easing-ease-in-out': 'cubic-bezier(0.4, 0, 0.2, 1)',
107
+ 'easing-ease-out': 'cubic-bezier(0, 0, 0.2, 1)',
108
+ 'easing-ease-in': 'cubic-bezier(0.4, 0, 1, 1)',
109
+
110
+ // Breakpoints
111
+ 'breakpoint-xs': '0',
112
+ 'breakpoint-sm': '576px',
113
+ 'breakpoint-md': '768px',
114
+ 'breakpoint-lg': '992px',
115
+ 'breakpoint-xl': '1200px',
116
+ 'breakpoint-xxl': '1400px',
117
+ };
118
+
119
+ /**
120
+ * Generate CSS from DesignTokens
121
+ */
122
+ export function generateTestThemeCSS(): string {
123
+ return createTheme(testThemeTokens);
124
+ }
125
+
126
+ // ============================================================================
127
+ // Test Theme 2: Using Theme Object (Advanced - Nested Structure)
128
+ // ============================================================================
129
+
130
+ /**
131
+ * Test theme using Theme object (nested structure)
132
+ *
133
+ * This approach provides more structure and computed values.
134
+ * Useful for advanced use cases that need theme composition.
135
+ */
136
+ export const testThemeOptions: ThemeOptions = {
137
+ name: 'Test Theme',
138
+ description: 'A comprehensive test theme for the Atomix theme system',
139
+ version: '1.0.0',
140
+ status: 'experimental',
141
+ supportsDarkMode: true,
142
+
143
+ palette: {
144
+ primary: {
145
+ main: '#7AFFD7',
146
+ light: '#B3FFE9',
147
+ dark: '#00E6C3',
148
+ },
149
+ secondary: {
150
+ main: '#FF6B9D',
151
+ light: '#FFB3D1',
152
+ dark: '#FF1A5C',
153
+ },
154
+ success: {
155
+ main: '#1AFF85',
156
+ light: '#4DFF9F',
157
+ dark: '#00E66B',
158
+ },
159
+ error: {
160
+ main: '#FF1A1A',
161
+ light: '#FF6666',
162
+ dark: '#E60000',
163
+ },
164
+ warning: {
165
+ main: '#FFB800',
166
+ light: '#FFD966',
167
+ dark: '#E6A600',
168
+ },
169
+ info: {
170
+ main: '#1A9FFF',
171
+ light: '#66C2FF',
172
+ dark: '#0080E6',
173
+ },
174
+ background: {
175
+ default: '#000000',
176
+ subtle: '#1A1A1A',
177
+ },
178
+ text: {
179
+ primary: '#FFFFFF',
180
+ secondary: 'rgba(255, 255, 255, 0.8)',
181
+ disabled: 'rgba(255, 255, 255, 0.5)',
182
+ },
183
+ },
184
+
185
+ typography: {
186
+ fontFamily: '"Inter", "Roboto", sans-serif',
187
+ fontSize: 16,
188
+ fontWeightLight: 300,
189
+ fontWeightRegular: 400,
190
+ fontWeightMedium: 500,
191
+ fontWeightSemiBold: 600,
192
+ fontWeightBold: 700,
193
+ h1: {
194
+ fontSize: '2.5rem',
195
+ fontWeight: 700,
196
+ lineHeight: 1.2,
197
+ letterSpacing: '-0.02em',
198
+ },
199
+ h2: {
200
+ fontSize: '2rem',
201
+ fontWeight: 600,
202
+ lineHeight: 1.3,
203
+ letterSpacing: '-0.01em',
204
+ },
205
+ },
206
+
207
+ spacing: 4, // Base spacing unit in pixels (multiplier)
208
+
209
+ borderRadius: {
210
+ sm: '4px',
211
+ md: '6px',
212
+ lg: '8px',
213
+ xl: '12px',
214
+ },
215
+
216
+ shadows: {
217
+ xs: '0 1px 2px rgba(0, 0, 0, 0.05)',
218
+ sm: '0 1px 3px rgba(0, 0, 0, 0.1)',
219
+ md: '0 4px 6px rgba(0, 0, 0, 0.1)',
220
+ lg: '0 10px 15px rgba(0, 0, 0, 0.1)',
221
+ xl: '0 20px 25px rgba(0, 0, 0, 0.15)',
222
+ },
223
+
224
+ zIndex: {
225
+ dropdown: 1000,
226
+ sticky: 1020,
227
+ fixed: 1030,
228
+ modalBackdrop: 1040,
229
+ modal: 1050,
230
+ popover: 1060,
231
+ tooltip: 1070,
232
+ },
233
+
234
+ transitions: {
235
+ duration: {
236
+ shortest: 150,
237
+ shorter: 200,
238
+ short: 200,
239
+ standard: 300,
240
+ complex: 300,
241
+ },
242
+ easing: {
243
+ easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
244
+ easeOut: 'cubic-bezier(0, 0, 0.2, 1)',
245
+ easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
246
+ },
247
+ },
248
+
249
+ breakpoints: {
250
+ values: {
251
+ xs: 0,
252
+ sm: 576,
253
+ md: 768,
254
+ lg: 992,
255
+ xl: 1200,
256
+ xxl: 1400,
257
+ },
258
+ },
259
+ };
260
+
261
+ /**
262
+ * Create Theme object from options
263
+ */
264
+ export function createTestThemeObject(): Theme {
265
+ return createThemeObject(testThemeOptions);
266
+ }
267
+
268
+ /**
269
+ * Generate CSS from Theme object (uses adapter internally)
270
+ */
271
+ export function generateTestThemeCSSFromObject(): string {
272
+ const theme = createTestThemeObject();
273
+ return createTheme(theme); // createTheme accepts both formats
274
+ }
275
+
276
+ // ============================================================================
277
+ // Test Theme 3: Minimal Test Theme
278
+ // ============================================================================
279
+
280
+ /**
281
+ * Minimal test theme for quick testing
282
+ */
283
+ export const minimalTestTheme: Partial<DesignTokens> = {
284
+ 'primary': '#7AFFD7',
285
+ 'body-bg': '#000000',
286
+ 'body-color': '#FFFFFF',
287
+ 'body-font-family': '"Inter", sans-serif',
288
+ };
289
+
290
+ /**
291
+ * Generate minimal CSS
292
+ */
293
+ export function generateMinimalTestThemeCSS(): string {
294
+ return createTheme(minimalTestTheme);
295
+ }
296
+
297
+ // ============================================================================
298
+ // Test Utilities
299
+ // ============================================================================
300
+
301
+ /**
302
+ * Test theme adapter conversion
303
+ *
304
+ * Converts Theme object to DesignTokens and back to verify adapter works correctly.
305
+ */
306
+ export function testThemeAdapter(): {
307
+ theme: Theme;
308
+ tokens: Partial<DesignTokens>;
309
+ fullTokens: DesignTokens;
310
+ } {
311
+ const theme = createTestThemeObject();
312
+ const tokens = themeToDesignTokens(theme);
313
+ const fullTokens = createDesignTokensFromTheme(theme);
314
+
315
+ return {
316
+ theme,
317
+ tokens,
318
+ fullTokens,
319
+ };
320
+ }
321
+
322
+ /**
323
+ * Compare CSS output from both approaches
324
+ *
325
+ * Verifies that DesignTokens and Theme object produce similar CSS output.
326
+ */
327
+ export function compareThemeOutputs(): {
328
+ fromTokens: string;
329
+ fromTheme: string;
330
+ tokens: Partial<DesignTokens>;
331
+ themeTokens: Partial<DesignTokens>;
332
+ } {
333
+ const fromTokens = generateTestThemeCSS();
334
+ const fromTheme = generateTestThemeCSSFromObject();
335
+
336
+ const theme = createTestThemeObject();
337
+ const themeTokens = themeToDesignTokens(theme);
338
+
339
+ return {
340
+ fromTokens,
341
+ fromTheme,
342
+ tokens: testThemeTokens,
343
+ themeTokens,
344
+ };
345
+ }
346
+
347
+ /**
348
+ * Test theme composition
349
+ *
350
+ * Tests extending a base theme with customizations.
351
+ */
352
+ export function testThemeComposition(): Theme {
353
+ const baseTheme = createTestThemeObject();
354
+
355
+ // Extend with custom options
356
+ const extendedTheme = createThemeObject(
357
+ {
358
+ palette: {
359
+ primary: {
360
+ main: '#FF00FF', // Override primary color
361
+ },
362
+ },
363
+ },
364
+ testThemeOptions // Base theme
365
+ );
366
+
367
+ return extendedTheme;
368
+ }
369
+
370
+ // ============================================================================
371
+ // Export all test themes
372
+ // ============================================================================
373
+
374
+ export const testThemes = {
375
+ tokens: testThemeTokens,
376
+ options: testThemeOptions,
377
+ minimal: minimalTestTheme,
378
+ generateCSS: generateTestThemeCSS,
379
+ generateCSSFromObject: generateTestThemeCSSFromObject,
380
+ generateMinimalCSS: generateMinimalTestThemeCSS,
381
+ testAdapter: testThemeAdapter,
382
+ compareOutputs: compareThemeOutputs,
383
+ testComposition: testThemeComposition,
384
+ };
385
+
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Design Tokens
3
+ *
4
+ * Design token definitions and utilities
5
+ */
6
+
7
+ export {
8
+ createTokens,
9
+ defaultTokens,
10
+ type DesignTokens,
11
+ } from './tokens';
12
+