@shohojdhara/atomix 0.3.5 → 0.3.6
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/README.md +101 -199
- package/atomix.config.ts +241 -0
- package/dist/atomix.css +260 -179
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +250 -179
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.js +61 -66
- package/dist/charts.js.map +1 -1
- package/dist/core.js +47 -31
- package/dist/core.js.map +1 -1
- package/dist/forms.js +47 -31
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +47 -31
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1841 -1633
- package/dist/index.esm.js +4975 -4113
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5151 -4290
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.d.ts +1572 -1442
- package/dist/theme.js +4816 -4080
- package/dist/theme.js.map +1 -1
- package/package.json +6 -20
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
- package/src/components/Avatar/Avatar.stories.tsx +7 -0
- package/src/components/Badge/Badge.stories.tsx +91 -13
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/ButtonGroup.stories.tsx +315 -0
- package/src/components/Button/ButtonGroup.tsx +67 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.stories.tsx +8 -6
- package/src/components/Card/Card.stories.tsx +82 -28
- package/src/components/Chart/AnimatedChart.tsx +0 -1
- package/src/components/Chart/AreaChart.tsx +0 -1
- package/src/components/Chart/BarChart.tsx +0 -1
- package/src/components/Chart/BubbleChart.tsx +0 -1
- package/src/components/Chart/CandlestickChart.tsx +0 -1
- package/src/components/Chart/Chart.stories.tsx +5 -7
- package/src/components/Chart/Chart.tsx +0 -16
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +0 -1
- package/src/components/Chart/GaugeChart.tsx +0 -1
- package/src/components/Chart/HeatmapChart.tsx +0 -1
- package/src/components/Chart/LineChart.tsx +0 -1
- package/src/components/Chart/MultiAxisChart.tsx +0 -1
- package/src/components/Chart/PieChart.tsx +0 -1
- package/src/components/Chart/RadarChart.tsx +0 -1
- package/src/components/Chart/ScatterChart.tsx +0 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
- package/src/components/Footer/Footer.stories.tsx +8 -6
- package/src/components/Footer/FooterLink.tsx +9 -2
- package/src/components/Form/Checkbox.stories.tsx +7 -0
- package/src/components/Form/Form.stories.tsx +7 -0
- package/src/components/Form/FormGroup.stories.tsx +9 -1
- package/src/components/Form/Input.stories.tsx +69 -16
- package/src/components/Form/Radio.stories.tsx +9 -1
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +7 -0
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +188 -111
- package/src/components/Pagination/Pagination.tsx +83 -3
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Rating/Rating.stories.tsx +109 -84
- package/src/components/River/River.stories.tsx +194 -114
- package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
- package/src/components/Slider/Slider.stories.tsx +7 -0
- package/src/components/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
- package/src/components/Todo/Todo.stories.tsx +38 -12
- package/src/components/Toggle/Toggle.stories.tsx +61 -28
- package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
- package/src/components/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +1 -0
- package/src/lib/composables/useAtomixGlass.ts +2 -3
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/config/loader.ts +2 -1
- package/src/lib/constants/components.ts +10 -0
- package/src/lib/hooks/useComponentCustomization.ts +1 -1
- package/src/lib/theme/README.md +174 -0
- package/src/lib/theme/adapters/index.ts +31 -0
- package/src/lib/theme/adapters/themeAdapter.ts +287 -0
- package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
- package/src/lib/theme/config/configLoader.ts +254 -0
- package/src/lib/theme/config/loader.ts +37 -48
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +15 -91
- package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +19 -6
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +155 -0
- package/src/lib/theme/core/createTheme.ts +94 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
- package/src/lib/theme/core/index.ts +5 -19
- package/src/lib/theme/devtools/Comparator.tsx +346 -22
- package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
- package/src/lib/theme/devtools/Inspector.tsx +335 -51
- package/src/lib/theme/devtools/LiveEditor.tsx +478 -107
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core → devtools}/ThemeValidator.ts +1 -1
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/errors/index.ts +12 -0
- package/src/lib/theme/generators/cssFile.ts +79 -0
- package/src/lib/theme/generators/generateCSS.ts +89 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +3 -13
- package/src/lib/theme/generators/index.ts +19 -0
- package/src/lib/theme/i18n/rtl.ts +5 -6
- package/src/lib/theme/index.ts +120 -15
- package/src/lib/theme/runtime/ThemeApplicator.ts +52 -111
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +1 -1
- package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
- package/src/lib/theme/runtime/index.ts +1 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/test/testTheme.ts +385 -0
- package/src/lib/theme/tokens/index.ts +12 -0
- package/src/lib/theme/tokens/tokens.ts +721 -0
- package/src/lib/theme/types.ts +6 -42
- package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
- package/src/lib/theme/utils/index.ts +11 -0
- package/src/lib/theme/utils/injectCSS.ts +90 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
- package/src/lib/theme-tools.ts +7 -8
- package/src/lib/types/components.ts +40 -130
- package/src/lib/utils/componentUtils.ts +1 -1
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- package/src/styles/02-tools/_tools.button.scss +66 -79
- package/src/styles/06-components/_components.atomix-glass.scss +13 -3
- package/src/styles/06-components/_components.pagination.scss +88 -0
- package/scripts/sync-theme-config.js +0 -309
- package/src/lib/theme/composeTheme.ts +0 -370
- package/src/lib/theme/core/ThemeCache.ts +0 -283
- package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
- package/src/lib/theme/core/ThemeEngine.ts +0 -665
- package/src/lib/theme/createThemeFromConfig.ts +0 -132
- package/src/lib/theme/devtools/CLI.ts +0 -364
- package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
- package/src/lib/theme/runtime/ThemeManager.ts +0 -446
- package/src/styles/03-generic/_generated-root.css +0 -26
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -68
- /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
- /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
* Runtime components for theme management
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export { ThemeManager } from './ThemeManager';
|
|
8
7
|
export { ThemeProvider } from './ThemeProvider';
|
|
9
8
|
export { ThemeErrorBoundary } from './ThemeErrorBoundary';
|
|
10
9
|
export { useTheme } from './useTheme';
|
|
10
|
+
export { ThemeApplicator, getThemeApplicator, applyTheme } from './ThemeApplicator';
|
|
11
11
|
export type { ThemeErrorBoundaryProps } from './ThemeErrorBoundary';
|
|
12
12
|
|
|
13
13
|
export type {
|
|
14
|
-
ThemeManagerConfig,
|
|
15
14
|
ThemeChangeEvent,
|
|
16
15
|
ThemeLoadOptions,
|
|
17
16
|
} from '../types';
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* useTheme Hook
|
|
3
3
|
*
|
|
4
4
|
* React hook for accessing theme context
|
|
5
|
-
* Updated to work with new ThemeEngine architecture
|
|
6
5
|
*/
|
|
7
6
|
|
|
8
7
|
import { useContext } from 'react';
|
|
9
|
-
import { ThemeContext } from '
|
|
8
|
+
import { ThemeContext } from './ThemeContext';
|
|
10
9
|
import type { UseThemeReturn } from '../types';
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -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
|
+
|