@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
package/dist/theme.d.ts
CHANGED
|
@@ -2,1446 +2,1363 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default, { ReactNode, ErrorInfo, Component } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Design Tokens
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Simple flat structure for design tokens.
|
|
8
|
+
* All tokens match the actual CSS variables used in Atomix.
|
|
9
|
+
* Based on docs/tokes-list.md
|
|
8
10
|
*/
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
* Design tokens interface
|
|
13
|
+
*
|
|
14
|
+
* Flat structure - no nesting complexity.
|
|
15
|
+
* Keys use kebab-case format matching CSS variable names (without --atomix- prefix).
|
|
16
|
+
*/
|
|
17
|
+
interface DesignTokens {
|
|
18
|
+
'primary': string;
|
|
19
|
+
'secondary': string;
|
|
20
|
+
'success': string;
|
|
21
|
+
'info': string;
|
|
22
|
+
'warning': string;
|
|
23
|
+
'error': string;
|
|
24
|
+
'light': string;
|
|
25
|
+
'dark': string;
|
|
26
|
+
'primary-rgb': string;
|
|
27
|
+
'secondary-rgb': string;
|
|
28
|
+
'success-rgb': string;
|
|
29
|
+
'info-rgb': string;
|
|
30
|
+
'warning-rgb': string;
|
|
31
|
+
'error-rgb': string;
|
|
32
|
+
'light-rgb': string;
|
|
33
|
+
'dark-rgb': string;
|
|
34
|
+
'gray-1': string;
|
|
35
|
+
'gray-2': string;
|
|
36
|
+
'gray-3': string;
|
|
37
|
+
'gray-4': string;
|
|
38
|
+
'gray-5': string;
|
|
39
|
+
'gray-6': string;
|
|
40
|
+
'gray-7': string;
|
|
41
|
+
'gray-8': string;
|
|
42
|
+
'gray-9': string;
|
|
43
|
+
'gray-10': string;
|
|
44
|
+
'primary-1': string;
|
|
45
|
+
'primary-2': string;
|
|
46
|
+
'primary-3': string;
|
|
47
|
+
'primary-4': string;
|
|
48
|
+
'primary-5': string;
|
|
49
|
+
'primary-6': string;
|
|
50
|
+
'primary-7': string;
|
|
51
|
+
'primary-8': string;
|
|
52
|
+
'primary-9': string;
|
|
53
|
+
'primary-10': string;
|
|
54
|
+
'red-1': string;
|
|
55
|
+
'red-2': string;
|
|
56
|
+
'red-3': string;
|
|
57
|
+
'red-4': string;
|
|
58
|
+
'red-5': string;
|
|
59
|
+
'red-6': string;
|
|
60
|
+
'red-7': string;
|
|
61
|
+
'red-8': string;
|
|
62
|
+
'red-9': string;
|
|
63
|
+
'red-10': string;
|
|
64
|
+
'green-1': string;
|
|
65
|
+
'green-2': string;
|
|
66
|
+
'green-3': string;
|
|
67
|
+
'green-4': string;
|
|
68
|
+
'green-5': string;
|
|
69
|
+
'green-6': string;
|
|
70
|
+
'green-7': string;
|
|
71
|
+
'green-8': string;
|
|
72
|
+
'green-9': string;
|
|
73
|
+
'green-10': string;
|
|
74
|
+
'blue-1': string;
|
|
75
|
+
'blue-2': string;
|
|
76
|
+
'blue-3': string;
|
|
77
|
+
'blue-4': string;
|
|
78
|
+
'blue-5': string;
|
|
79
|
+
'blue-6': string;
|
|
80
|
+
'blue-7': string;
|
|
81
|
+
'blue-8': string;
|
|
82
|
+
'blue-9': string;
|
|
83
|
+
'blue-10': string;
|
|
84
|
+
'yellow-1': string;
|
|
85
|
+
'yellow-2': string;
|
|
86
|
+
'yellow-3': string;
|
|
87
|
+
'yellow-4': string;
|
|
88
|
+
'yellow-5': string;
|
|
89
|
+
'yellow-6': string;
|
|
90
|
+
'yellow-7': string;
|
|
91
|
+
'yellow-8': string;
|
|
92
|
+
'yellow-9': string;
|
|
93
|
+
'yellow-10': string;
|
|
94
|
+
'primary-text-emphasis': string;
|
|
95
|
+
'secondary-text-emphasis': string;
|
|
96
|
+
'tertiary-text-emphasis': string;
|
|
97
|
+
'disabled-text-emphasis': string;
|
|
98
|
+
'invert-text-emphasis': string;
|
|
99
|
+
'brand-text-emphasis': string;
|
|
100
|
+
'error-text-emphasis': string;
|
|
101
|
+
'success-text-emphasis': string;
|
|
102
|
+
'warning-text-emphasis': string;
|
|
103
|
+
'info-text-emphasis': string;
|
|
104
|
+
'light-text-emphasis': string;
|
|
105
|
+
'dark-text-emphasis': string;
|
|
106
|
+
'primary-bg-subtle': string;
|
|
107
|
+
'secondary-bg-subtle': string;
|
|
108
|
+
'tertiary-bg-subtle': string;
|
|
109
|
+
'invert-bg-subtle': string;
|
|
110
|
+
'brand-bg-subtle': string;
|
|
111
|
+
'error-bg-subtle': string;
|
|
112
|
+
'success-bg-subtle': string;
|
|
113
|
+
'warning-bg-subtle': string;
|
|
114
|
+
'info-bg-subtle': string;
|
|
115
|
+
'light-bg-subtle': string;
|
|
116
|
+
'dark-bg-subtle': string;
|
|
117
|
+
'primary-border-subtle': string;
|
|
118
|
+
'secondary-border-subtle': string;
|
|
119
|
+
'success-border-subtle': string;
|
|
120
|
+
'error-border-subtle': string;
|
|
121
|
+
'warning-border-subtle': string;
|
|
122
|
+
'info-border-subtle': string;
|
|
123
|
+
'brand-border-subtle': string;
|
|
124
|
+
'light-border-subtle': string;
|
|
125
|
+
'dark-border-subtle': string;
|
|
126
|
+
'primary-hover': string;
|
|
127
|
+
'secondary-hover': string;
|
|
128
|
+
'light-hover': string;
|
|
129
|
+
'dark-hover': string;
|
|
130
|
+
'error-hover': string;
|
|
131
|
+
'success-hover': string;
|
|
132
|
+
'warning-hover': string;
|
|
133
|
+
'info-hover': string;
|
|
134
|
+
'primary-gradient': string;
|
|
135
|
+
'secondary-gradient': string;
|
|
136
|
+
'light-gradient': string;
|
|
137
|
+
'dark-gradient': string;
|
|
138
|
+
'success-gradient': string;
|
|
139
|
+
'info-gradient': string;
|
|
140
|
+
'warning-gradient': string;
|
|
141
|
+
'error-gradient': string;
|
|
142
|
+
'gradient': string;
|
|
143
|
+
'font-sans-serif': string;
|
|
144
|
+
'font-monospace': string;
|
|
145
|
+
'body-font-family': string;
|
|
146
|
+
'body-font-size': string;
|
|
147
|
+
'body-font-weight': string;
|
|
148
|
+
'body-line-height': string;
|
|
149
|
+
'body-color': string;
|
|
150
|
+
'body-bg': string;
|
|
151
|
+
'heading-color': string;
|
|
152
|
+
'font-size-xl': string;
|
|
153
|
+
'font-size-2xl': string;
|
|
154
|
+
'display-1': string;
|
|
155
|
+
'font-weight-light': string;
|
|
156
|
+
'font-weight-normal': string;
|
|
157
|
+
'font-weight-medium': string;
|
|
158
|
+
'font-weight-semibold': string;
|
|
159
|
+
'font-weight-bold': string;
|
|
160
|
+
'font-weight-heavy': string;
|
|
161
|
+
'font-weight-black': string;
|
|
162
|
+
'line-height-base': string;
|
|
163
|
+
'line-height-sm': string;
|
|
164
|
+
'line-height-lg': string;
|
|
165
|
+
'letter-spacing-h1': string;
|
|
166
|
+
'letter-spacing-h2': string;
|
|
167
|
+
'letter-spacing-h3': string;
|
|
168
|
+
'letter-spacing-h4': string;
|
|
169
|
+
'letter-spacing-h5': string;
|
|
170
|
+
'letter-spacing-h6': string;
|
|
171
|
+
'link-color': string;
|
|
172
|
+
'link-color-rgb': string;
|
|
173
|
+
'link-decoration': string;
|
|
174
|
+
'link-hover-color': string;
|
|
175
|
+
'link-hover-color-rgb': string;
|
|
176
|
+
'highlight-bg': string;
|
|
177
|
+
'code-color': string;
|
|
178
|
+
'border-width': string;
|
|
179
|
+
'border-style': string;
|
|
180
|
+
'border-color': string;
|
|
181
|
+
'border-color-translucent': string;
|
|
182
|
+
'border-radius': string;
|
|
183
|
+
'border-radius-sm': string;
|
|
184
|
+
'border-radius-lg': string;
|
|
185
|
+
'border-radius-xl': string;
|
|
186
|
+
'border-radius-xxl': string;
|
|
187
|
+
'border-radius-2xl': string;
|
|
188
|
+
'border-radius-3xl': string;
|
|
189
|
+
'border-radius-4xl': string;
|
|
190
|
+
'border-radius-pill': string;
|
|
191
|
+
'box-shadow': string;
|
|
192
|
+
'box-shadow-xs': string;
|
|
193
|
+
'box-shadow-sm': string;
|
|
194
|
+
'box-shadow-lg': string;
|
|
195
|
+
'box-shadow-xl': string;
|
|
196
|
+
'box-shadow-inset': string;
|
|
197
|
+
'focus-border-color': string;
|
|
198
|
+
'focus-ring-width': string;
|
|
199
|
+
'focus-ring-offset': string;
|
|
200
|
+
'focus-ring-opacity': string;
|
|
201
|
+
'form-valid-color': string;
|
|
202
|
+
'form-valid-border-color': string;
|
|
203
|
+
'form-invalid-color': string;
|
|
204
|
+
'form-invalid-border-color': string;
|
|
205
|
+
'spacing-0': string;
|
|
206
|
+
'spacing-1': string;
|
|
207
|
+
'spacing-px-6': string;
|
|
208
|
+
'spacing-2': string;
|
|
209
|
+
'spacing-px-10': string;
|
|
210
|
+
'spacing-3': string;
|
|
211
|
+
'spacing-px-14': string;
|
|
212
|
+
'spacing-4': string;
|
|
213
|
+
'spacing-5': string;
|
|
214
|
+
'spacing-px-22': string;
|
|
215
|
+
'spacing-6': string;
|
|
216
|
+
'spacing-7': string;
|
|
217
|
+
'spacing-px-30': string;
|
|
218
|
+
'spacing-8': string;
|
|
219
|
+
'spacing-9': string;
|
|
220
|
+
'spacing-10': string;
|
|
221
|
+
'spacing-11': string;
|
|
222
|
+
'spacing-12': string;
|
|
223
|
+
'spacing-14': string;
|
|
224
|
+
'spacing-16': string;
|
|
225
|
+
'spacing-20': string;
|
|
226
|
+
'spacing-24': string;
|
|
227
|
+
'spacing-28': string;
|
|
228
|
+
'spacing-32': string;
|
|
229
|
+
'spacing-36': string;
|
|
230
|
+
'spacing-40': string;
|
|
231
|
+
'spacing-44': string;
|
|
232
|
+
'spacing-48': string;
|
|
233
|
+
'spacing-52': string;
|
|
234
|
+
'spacing-56': string;
|
|
235
|
+
'spacing-60': string;
|
|
236
|
+
'spacing-64': string;
|
|
237
|
+
'spacing-72': string;
|
|
238
|
+
'spacing-80': string;
|
|
239
|
+
'spacing-90': string;
|
|
240
|
+
'spacing-200': string;
|
|
241
|
+
'transition-duration-fast': string;
|
|
242
|
+
'transition-duration-base': string;
|
|
243
|
+
'transition-duration-slow': string;
|
|
244
|
+
'transition-duration-slower': string;
|
|
245
|
+
'easing-base': string;
|
|
246
|
+
'easing-ease-in-out': string;
|
|
247
|
+
'easing-ease-out': string;
|
|
248
|
+
'easing-ease-in': string;
|
|
249
|
+
'easing-ease-linear': string;
|
|
250
|
+
'transition-fast': string;
|
|
251
|
+
'transition-base': string;
|
|
252
|
+
'transition-slow': string;
|
|
253
|
+
'z-n1': string;
|
|
254
|
+
'z-0': string;
|
|
255
|
+
'z-1': string;
|
|
256
|
+
'z-2': string;
|
|
257
|
+
'z-3': string;
|
|
258
|
+
'z-4': string;
|
|
259
|
+
'z-5': string;
|
|
260
|
+
'z-dropdown': string;
|
|
261
|
+
'z-sticky': string;
|
|
262
|
+
'z-fixed': string;
|
|
263
|
+
'z-modal': string;
|
|
264
|
+
'z-popover': string;
|
|
265
|
+
'z-tooltip': string;
|
|
266
|
+
'z-drawer': string;
|
|
267
|
+
'breakpoint-xs': string;
|
|
268
|
+
'breakpoint-sm': string;
|
|
269
|
+
'breakpoint-md': string;
|
|
270
|
+
'breakpoint-lg': string;
|
|
271
|
+
'breakpoint-xl': string;
|
|
272
|
+
'breakpoint-xxl': string;
|
|
273
|
+
[key: string]: string | undefined;
|
|
23
274
|
}
|
|
24
275
|
/**
|
|
25
|
-
*
|
|
276
|
+
* Default design tokens
|
|
26
277
|
*
|
|
27
|
-
*
|
|
278
|
+
* Based on Atomix default theme values from docs/tokes-list.md (light mode)
|
|
28
279
|
*/
|
|
29
|
-
declare
|
|
30
|
-
private config;
|
|
31
|
-
private listeners;
|
|
32
|
-
constructor(config?: Partial<RTLConfig>);
|
|
33
|
-
/**
|
|
34
|
-
* Detect locale from browser
|
|
35
|
-
*/
|
|
36
|
-
private detectLocale;
|
|
37
|
-
/**
|
|
38
|
-
* Check if locale is RTL
|
|
39
|
-
*/
|
|
40
|
-
isRTLLocale(locale: string): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Get current direction
|
|
43
|
-
*/
|
|
44
|
-
getDirection(): 'ltr' | 'rtl';
|
|
45
|
-
/**
|
|
46
|
-
* Check if RTL is enabled
|
|
47
|
-
*/
|
|
48
|
-
isEnabled(): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Set direction
|
|
51
|
-
*/
|
|
52
|
-
setDirection(direction: 'ltr' | 'rtl'): void;
|
|
53
|
-
/**
|
|
54
|
-
* Toggle direction
|
|
55
|
-
*/
|
|
56
|
-
toggleDirection(): 'ltr' | 'rtl';
|
|
57
|
-
/**
|
|
58
|
-
* Enable RTL
|
|
59
|
-
*/
|
|
60
|
-
enable(): void;
|
|
61
|
-
/**
|
|
62
|
-
* Disable RTL
|
|
63
|
-
*/
|
|
64
|
-
disable(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Set locale and auto-adjust direction
|
|
67
|
-
*/
|
|
68
|
-
setLocale(locale: string): void;
|
|
69
|
-
/**
|
|
70
|
-
* Get current locale
|
|
71
|
-
*/
|
|
72
|
-
getLocale(): string | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Apply direction to DOM
|
|
75
|
-
*/
|
|
76
|
-
private applyDirection;
|
|
77
|
-
/**
|
|
78
|
-
* Add direction change listener
|
|
79
|
-
*/
|
|
80
|
-
onDirectionChange(callback: (direction: 'ltr' | 'rtl') => void): () => void;
|
|
81
|
-
/**
|
|
82
|
-
* Notify listeners of direction change
|
|
83
|
-
*/
|
|
84
|
-
private notifyListeners;
|
|
85
|
-
/**
|
|
86
|
-
* Get RTL-aware value
|
|
87
|
-
*
|
|
88
|
-
* Returns different values based on direction
|
|
89
|
-
*/
|
|
90
|
-
getValue<T>(ltrValue: T, rtlValue: T): T;
|
|
91
|
-
/**
|
|
92
|
-
* Get RTL-aware CSS property
|
|
93
|
-
*
|
|
94
|
-
* Returns appropriate CSS property based on direction
|
|
95
|
-
*/
|
|
96
|
-
getCSSProperty(property: string): string;
|
|
97
|
-
/**
|
|
98
|
-
* Destroy RTL manager
|
|
99
|
-
*/
|
|
100
|
-
destroy(): void;
|
|
101
|
-
}
|
|
102
|
-
|
|
280
|
+
declare const defaultTokens: DesignTokens;
|
|
103
281
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* Tailwind-like configuration for customizing the Atomix Design System.
|
|
282
|
+
* Create tokens from defaults and overrides
|
|
107
283
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
284
|
+
* @param overrides - Partial tokens to override defaults
|
|
285
|
+
* @returns Complete DesignTokens object
|
|
110
286
|
*
|
|
111
287
|
* @example
|
|
112
288
|
* ```typescript
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* export default defineConfig({
|
|
117
|
-
* theme: {
|
|
118
|
-
* extend: {
|
|
119
|
-
* colors: {
|
|
120
|
-
* primary: { main: '#7AFFD7' },
|
|
121
|
-
* },
|
|
122
|
-
* },
|
|
123
|
-
* },
|
|
289
|
+
* const tokens = createTokens({
|
|
290
|
+
* 'primary': '#7c3aed',
|
|
291
|
+
* 'spacing-4': '1rem',
|
|
124
292
|
* });
|
|
125
293
|
* ```
|
|
126
294
|
*/
|
|
295
|
+
declare function createTokens(overrides?: Partial<DesignTokens>): DesignTokens;
|
|
127
296
|
|
|
128
297
|
/**
|
|
129
|
-
*
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
1?: string;
|
|
133
|
-
2?: string;
|
|
134
|
-
3?: string;
|
|
135
|
-
4?: string;
|
|
136
|
-
5?: string;
|
|
137
|
-
6?: string;
|
|
138
|
-
7?: string;
|
|
139
|
-
8?: string;
|
|
140
|
-
9?: string;
|
|
141
|
-
10?: string;
|
|
142
|
-
[key: string]: string | undefined;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Palette Color Options
|
|
298
|
+
* Theme Manager Type Definitions
|
|
299
|
+
*
|
|
300
|
+
* TypeScript types and interfaces for the Atomix Design System theme management system.
|
|
146
301
|
*/
|
|
147
|
-
interface PaletteColorOptions {
|
|
148
|
-
main: string;
|
|
149
|
-
light?: string;
|
|
150
|
-
dark?: string;
|
|
151
|
-
contrastText?: string;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Design Tokens Schema (Tailwind-like)
|
|
155
|
-
*/
|
|
156
|
-
interface ThemeTokens {
|
|
157
|
-
/** Color palette */
|
|
158
|
-
colors?: Record<string, string | PaletteColorOptions | ColorScale | Record<string, string>>;
|
|
159
|
-
/** Spacing scale */
|
|
160
|
-
spacing?: Record<string, string>;
|
|
161
|
-
/** Border radius scale */
|
|
162
|
-
borderRadius?: Record<string, string>;
|
|
163
|
-
/** Typography scale and settings */
|
|
164
|
-
typography?: {
|
|
165
|
-
fontFamilies?: Record<string, string>;
|
|
166
|
-
fontSizes?: Record<string, string>;
|
|
167
|
-
fontWeights?: Record<string, string | number>;
|
|
168
|
-
lineHeights?: Record<string, string | number>;
|
|
169
|
-
letterSpacings?: Record<string, string>;
|
|
170
|
-
};
|
|
171
|
-
/** Shadow scale */
|
|
172
|
-
shadows?: Record<string, string>;
|
|
173
|
-
/** Z-index scale */
|
|
174
|
-
zIndex?: Record<string, string | number>;
|
|
175
|
-
/** Breakpoints scale */
|
|
176
|
-
breakpoints?: Record<string, string | number>;
|
|
177
|
-
/** Transitions settings */
|
|
178
|
-
transitions?: {
|
|
179
|
-
durations?: Record<string, string>;
|
|
180
|
-
easings?: Record<string, string>;
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
302
|
/**
|
|
184
|
-
*
|
|
303
|
+
* Theme metadata interface matching themes.config.js structure
|
|
185
304
|
*/
|
|
186
|
-
interface
|
|
187
|
-
|
|
305
|
+
interface ThemeMetadata {
|
|
306
|
+
/** Display name of the theme */
|
|
188
307
|
name: string;
|
|
308
|
+
/** Unique identifier/class name for the theme */
|
|
189
309
|
class?: string;
|
|
310
|
+
/** Theme description */
|
|
190
311
|
description?: string;
|
|
312
|
+
/** Theme author */
|
|
191
313
|
author?: string;
|
|
314
|
+
/** Theme version (semver) */
|
|
192
315
|
version?: string;
|
|
316
|
+
/** Theme tags for categorization */
|
|
193
317
|
tags?: string[];
|
|
318
|
+
/** Whether the theme supports dark mode */
|
|
194
319
|
supportsDarkMode?: boolean;
|
|
320
|
+
/** Theme status: stable, beta, experimental, deprecated */
|
|
195
321
|
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
322
|
+
/** Accessibility information */
|
|
196
323
|
a11y?: {
|
|
324
|
+
/** Target contrast ratio */
|
|
197
325
|
contrastTarget?: number;
|
|
326
|
+
/** Supported color modes */
|
|
198
327
|
modes?: string[];
|
|
199
328
|
};
|
|
329
|
+
/** Primary theme color (for UI display) */
|
|
200
330
|
color?: string;
|
|
331
|
+
/** Theme features list */
|
|
201
332
|
features?: string[];
|
|
333
|
+
/** Theme dependencies (other themes required) */
|
|
202
334
|
dependencies?: string[];
|
|
203
|
-
cssPath?: string;
|
|
204
335
|
}
|
|
205
336
|
/**
|
|
206
|
-
*
|
|
337
|
+
* Theme change event payload
|
|
207
338
|
*/
|
|
208
|
-
interface
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
contrastTarget?: number;
|
|
220
|
-
modes?: string[];
|
|
221
|
-
};
|
|
222
|
-
color?: string;
|
|
223
|
-
features?: string[];
|
|
224
|
-
dependencies?: string[];
|
|
225
|
-
createTheme: () => Theme;
|
|
339
|
+
interface ThemeChangeEvent {
|
|
340
|
+
/** Previous theme name */
|
|
341
|
+
previousTheme: string | null;
|
|
342
|
+
/** New theme name */
|
|
343
|
+
currentTheme: string;
|
|
344
|
+
/** Theme object (for JS themes) */
|
|
345
|
+
themeObject?: Theme | null;
|
|
346
|
+
/** Timestamp of the change */
|
|
347
|
+
timestamp: number;
|
|
348
|
+
/** Whether the change was from user action or system */
|
|
349
|
+
source: 'user' | 'system' | 'storage';
|
|
226
350
|
}
|
|
227
351
|
/**
|
|
228
|
-
* Theme
|
|
229
|
-
*/
|
|
230
|
-
type ThemeDefinition = CSSThemeDefinition | JSThemeDefinition;
|
|
231
|
-
/**
|
|
232
|
-
* Build configuration (migrated from theme.config.ts)
|
|
352
|
+
* Theme load options
|
|
233
353
|
*/
|
|
234
|
-
interface
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
loadPaths?: string[];
|
|
246
|
-
};
|
|
354
|
+
interface ThemeLoadOptions {
|
|
355
|
+
/** Force reload even if already loaded */
|
|
356
|
+
force?: boolean;
|
|
357
|
+
/** Preload without applying */
|
|
358
|
+
preload?: boolean;
|
|
359
|
+
/** Remove previous theme CSS */
|
|
360
|
+
removePrevious?: boolean;
|
|
361
|
+
/** Custom CSS path override */
|
|
362
|
+
customPath?: string;
|
|
363
|
+
/** Fallback to default theme on error */
|
|
364
|
+
fallbackOnError?: boolean;
|
|
247
365
|
}
|
|
248
366
|
/**
|
|
249
|
-
*
|
|
367
|
+
* Theme validation result
|
|
250
368
|
*/
|
|
251
|
-
interface
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
dataAttribute?: string;
|
|
259
|
-
enablePersistence?: boolean;
|
|
260
|
-
useMinified?: boolean;
|
|
369
|
+
interface ThemeValidationResult {
|
|
370
|
+
/** Whether the theme is valid */
|
|
371
|
+
valid: boolean;
|
|
372
|
+
/** Validation errors */
|
|
373
|
+
errors: string[];
|
|
374
|
+
/** Validation warnings */
|
|
375
|
+
warnings: string[];
|
|
261
376
|
}
|
|
262
377
|
/**
|
|
263
|
-
*
|
|
378
|
+
* React hook return type for useTheme
|
|
264
379
|
*/
|
|
265
|
-
interface
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
380
|
+
interface UseThemeReturn {
|
|
381
|
+
/** Current theme name */
|
|
382
|
+
theme: string;
|
|
383
|
+
/** Current active theme object (for JS themes) */
|
|
384
|
+
activeTheme: Theme | null;
|
|
385
|
+
/** Function to change theme (supports string, Theme, or DesignTokens) */
|
|
386
|
+
setTheme: (theme: string | Theme | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
|
|
387
|
+
/** Available themes */
|
|
388
|
+
availableThemes: ThemeMetadata[];
|
|
389
|
+
/** Whether a theme is currently loading */
|
|
390
|
+
isLoading: boolean;
|
|
391
|
+
/** Current error, if any */
|
|
392
|
+
error: Error | null;
|
|
393
|
+
/** Whether a specific theme is loaded */
|
|
394
|
+
isThemeLoaded: (themeName: string) => boolean;
|
|
395
|
+
/** Preload a theme */
|
|
396
|
+
preloadTheme: (themeName: string) => Promise<void>;
|
|
271
397
|
}
|
|
272
398
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* Tailwind-like configuration for external developers.
|
|
276
|
-
* Focus on theme customization - build/runtime configs are internal only.
|
|
399
|
+
* Component-level theme override configuration
|
|
277
400
|
*/
|
|
278
|
-
interface
|
|
279
|
-
/**
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
* This is the recommended way to customize Atomix.
|
|
297
|
-
* Your values will override or extend the base tokens.
|
|
298
|
-
*/
|
|
299
|
-
extend?: ThemeTokens;
|
|
300
|
-
/**
|
|
301
|
-
* Override the default tokens entirely (advanced)
|
|
302
|
-
*
|
|
303
|
-
* Use with caution - this replaces the entire token system.
|
|
304
|
-
* Most users should use `extend` instead.
|
|
305
|
-
*/
|
|
306
|
-
tokens?: ThemeTokens;
|
|
307
|
-
/**
|
|
308
|
-
* Register custom themes (optional)
|
|
309
|
-
*
|
|
310
|
-
* Define CSS or JavaScript themes that can be loaded dynamically.
|
|
311
|
-
*/
|
|
312
|
-
themes?: Record<string, ThemeDefinition>;
|
|
313
|
-
};
|
|
314
|
-
/** @internal Build configuration (internal use only) */
|
|
315
|
-
build?: BuildConfig;
|
|
316
|
-
/** @internal Runtime configuration (internal use only) */
|
|
317
|
-
runtime?: RuntimeConfig;
|
|
318
|
-
/** @internal Integration settings (internal use only) */
|
|
319
|
-
integration?: IntegrationConfig;
|
|
320
|
-
/** @internal Theme dependencies mapping (internal use only) */
|
|
321
|
-
dependencies?: Record<string, string[]>;
|
|
322
|
-
}
|
|
323
|
-
|
|
401
|
+
interface ComponentThemeOverride {
|
|
402
|
+
/** CSS variable overrides for the component */
|
|
403
|
+
cssVars?: Record<string, string | number>;
|
|
404
|
+
/** Default prop overrides */
|
|
405
|
+
defaultProps?: Record<string, any>;
|
|
406
|
+
/** Part-specific overrides */
|
|
407
|
+
parts?: Record<string, {
|
|
408
|
+
cssVars?: Record<string, string | number>;
|
|
409
|
+
className?: string;
|
|
410
|
+
}>;
|
|
411
|
+
/** Variant overrides */
|
|
412
|
+
variants?: Record<string, {
|
|
413
|
+
cssVars?: Record<string, string | number>;
|
|
414
|
+
className?: string;
|
|
415
|
+
}>;
|
|
416
|
+
/** Additional className for the component */
|
|
417
|
+
className?: string;
|
|
418
|
+
}
|
|
324
419
|
/**
|
|
325
|
-
* Theme
|
|
326
|
-
*
|
|
327
|
-
* Type definitions for the theme configuration system
|
|
420
|
+
* Theme component overrides for all components
|
|
328
421
|
*/
|
|
329
|
-
|
|
422
|
+
interface ThemeComponentOverrides {
|
|
423
|
+
Button?: ComponentThemeOverride;
|
|
424
|
+
Card?: ComponentThemeOverride;
|
|
425
|
+
Input?: ComponentThemeOverride;
|
|
426
|
+
Modal?: ComponentThemeOverride;
|
|
427
|
+
Dropdown?: ComponentThemeOverride;
|
|
428
|
+
Badge?: ComponentThemeOverride;
|
|
429
|
+
Tabs?: ComponentThemeOverride;
|
|
430
|
+
Progress?: ComponentThemeOverride;
|
|
431
|
+
Tooltip?: ComponentThemeOverride;
|
|
432
|
+
Select?: ComponentThemeOverride;
|
|
433
|
+
Checkbox?: ComponentThemeOverride;
|
|
434
|
+
Radio?: ComponentThemeOverride;
|
|
435
|
+
Textarea?: ComponentThemeOverride;
|
|
436
|
+
FormGroup?: ComponentThemeOverride;
|
|
437
|
+
Navbar?: ComponentThemeOverride;
|
|
438
|
+
Accordion?: ComponentThemeOverride;
|
|
439
|
+
DataTable?: ComponentThemeOverride;
|
|
440
|
+
Avatar?: ComponentThemeOverride;
|
|
441
|
+
List?: ComponentThemeOverride;
|
|
442
|
+
Popover?: ComponentThemeOverride;
|
|
443
|
+
Messages?: ComponentThemeOverride;
|
|
444
|
+
Callout?: ComponentThemeOverride;
|
|
445
|
+
Spinner?: ComponentThemeOverride;
|
|
446
|
+
[key: string]: ComponentThemeOverride | undefined;
|
|
447
|
+
}
|
|
330
448
|
/**
|
|
331
|
-
*
|
|
449
|
+
* Theme provider props
|
|
332
450
|
*/
|
|
333
|
-
interface
|
|
334
|
-
/**
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
|
|
451
|
+
interface ThemeProviderProps {
|
|
452
|
+
/** Child components */
|
|
453
|
+
children: React.ReactNode;
|
|
454
|
+
/** Default theme */
|
|
455
|
+
defaultTheme?: string | Theme;
|
|
456
|
+
/** Available themes */
|
|
457
|
+
themes?: Record<string, ThemeMetadata>;
|
|
458
|
+
/** Base path for theme CSS */
|
|
459
|
+
basePath?: string;
|
|
460
|
+
/** CDN path for theme CSS */
|
|
461
|
+
cdnPath?: string | null;
|
|
462
|
+
/** Themes to preload */
|
|
463
|
+
preload?: string[];
|
|
464
|
+
/** Enable lazy loading */
|
|
465
|
+
lazy?: boolean;
|
|
466
|
+
/** localStorage key */
|
|
467
|
+
storageKey?: string;
|
|
468
|
+
/** Data attribute name */
|
|
469
|
+
dataAttribute?: string;
|
|
470
|
+
/** Enable persistence */
|
|
471
|
+
enablePersistence?: boolean;
|
|
472
|
+
/** Use minified CSS */
|
|
473
|
+
useMinified?: boolean;
|
|
474
|
+
/** Callback when theme changes */
|
|
475
|
+
onThemeChange?: (theme: string | Theme | DesignTokens) => void;
|
|
476
|
+
/** Callback on error */
|
|
477
|
+
onError?: (error: Error, themeName: string) => void;
|
|
354
478
|
}
|
|
355
|
-
|
|
356
479
|
/**
|
|
357
|
-
* Theme
|
|
358
|
-
*
|
|
359
|
-
* Central registry for all themes with discovery and dependency management
|
|
480
|
+
* Theme context value
|
|
360
481
|
*/
|
|
361
|
-
|
|
482
|
+
interface ThemeContextValue {
|
|
483
|
+
/** Current theme name */
|
|
484
|
+
theme: string;
|
|
485
|
+
/** Current active theme object (for JS themes) */
|
|
486
|
+
activeTheme: Theme | null;
|
|
487
|
+
/** Set theme function (supports string, Theme, or DesignTokens) */
|
|
488
|
+
setTheme: (theme: string | Theme | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
|
|
489
|
+
/** Available themes */
|
|
490
|
+
availableThemes: ThemeMetadata[];
|
|
491
|
+
/** Loading state */
|
|
492
|
+
isLoading: boolean;
|
|
493
|
+
/** Error state */
|
|
494
|
+
error: Error | null;
|
|
495
|
+
/** Check if theme is loaded */
|
|
496
|
+
isThemeLoaded: (themeName: string) => boolean;
|
|
497
|
+
/** Preload theme */
|
|
498
|
+
preloadTheme: (themeName: string) => Promise<void>;
|
|
499
|
+
}
|
|
362
500
|
/**
|
|
363
|
-
*
|
|
501
|
+
* Color palette configuration for a single color
|
|
364
502
|
*/
|
|
365
|
-
interface
|
|
366
|
-
/**
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
|
|
374
|
-
/** Loading promise (if currently loading) */
|
|
375
|
-
loading?: Promise<Theme | void>;
|
|
376
|
-
/** Dependencies */
|
|
377
|
-
dependencies: string[];
|
|
378
|
-
/** Dependent themes (themes that depend on this one) */
|
|
379
|
-
dependents: string[];
|
|
503
|
+
interface PaletteColor {
|
|
504
|
+
/** Main color value */
|
|
505
|
+
main: string;
|
|
506
|
+
/** Light variant (auto-generated if not provided) */
|
|
507
|
+
light?: string;
|
|
508
|
+
/** Dark variant (auto-generated if not provided) */
|
|
509
|
+
dark?: string;
|
|
510
|
+
/** Contrast text color (auto-generated if not provided) */
|
|
511
|
+
contrastText?: string;
|
|
380
512
|
}
|
|
381
513
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* Manages theme registration, discovery, and dependency resolution
|
|
514
|
+
* Palette configuration options for createTheme
|
|
385
515
|
*/
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
* Check if theme exists
|
|
404
|
-
*/
|
|
405
|
-
has(themeId: string): boolean;
|
|
406
|
-
/**
|
|
407
|
-
* Get all theme IDs
|
|
408
|
-
*/
|
|
409
|
-
getAllIds(): string[];
|
|
410
|
-
/**
|
|
411
|
-
* Get all theme metadata
|
|
412
|
-
*/
|
|
413
|
-
getAllMetadata(): ThemeMetadata[];
|
|
414
|
-
/**
|
|
415
|
-
* Get theme definition
|
|
416
|
-
*/
|
|
417
|
-
getDefinition(themeId: string): ThemeDefinition | undefined;
|
|
418
|
-
/**
|
|
419
|
-
* Get theme object (for JS themes)
|
|
420
|
-
*/
|
|
421
|
-
getTheme(themeId: string): Theme | undefined;
|
|
422
|
-
/**
|
|
423
|
-
* Set theme object (for JS themes)
|
|
424
|
-
*/
|
|
425
|
-
setTheme(themeId: string, theme: Theme): void;
|
|
426
|
-
/**
|
|
427
|
-
* Get dependencies for a theme
|
|
428
|
-
*/
|
|
429
|
-
getDependencies(themeId: string): string[];
|
|
430
|
-
/**
|
|
431
|
-
* Get dependents for a theme (themes that depend on this one)
|
|
432
|
-
*/
|
|
433
|
-
getDependents(themeId: string): string[];
|
|
434
|
-
/**
|
|
435
|
-
* Resolve all dependencies in correct order
|
|
436
|
-
*/
|
|
437
|
-
resolveDependencyOrder(themeId: string): string[];
|
|
438
|
-
/**
|
|
439
|
-
* Resolve dependencies and build dependency graph
|
|
440
|
-
*/
|
|
441
|
-
private resolveDependencies;
|
|
442
|
-
/**
|
|
443
|
-
* Validate all themes
|
|
444
|
-
*/
|
|
445
|
-
validate(): {
|
|
446
|
-
valid: boolean;
|
|
447
|
-
errors: string[];
|
|
516
|
+
interface PaletteOptions {
|
|
517
|
+
/** Primary color configuration */
|
|
518
|
+
primary?: Partial<PaletteColor> | string;
|
|
519
|
+
/** Secondary color configuration */
|
|
520
|
+
secondary?: Partial<PaletteColor> | string;
|
|
521
|
+
/** Error color configuration */
|
|
522
|
+
error?: Partial<PaletteColor> | string;
|
|
523
|
+
/** Warning color configuration */
|
|
524
|
+
warning?: Partial<PaletteColor> | string;
|
|
525
|
+
/** Info color configuration */
|
|
526
|
+
info?: Partial<PaletteColor> | string;
|
|
527
|
+
/** Success color configuration */
|
|
528
|
+
success?: Partial<PaletteColor> | string;
|
|
529
|
+
/** Background colors */
|
|
530
|
+
background?: {
|
|
531
|
+
default?: string;
|
|
532
|
+
subtle?: string;
|
|
448
533
|
};
|
|
449
|
-
/**
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
534
|
+
/** Text colors */
|
|
535
|
+
text?: {
|
|
536
|
+
primary?: string;
|
|
537
|
+
secondary?: string;
|
|
538
|
+
disabled?: string;
|
|
539
|
+
};
|
|
540
|
+
/** Additional custom colors */
|
|
541
|
+
[key: string]: any;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Typography configuration options for createTheme
|
|
545
|
+
*/
|
|
546
|
+
interface TypographyOptions {
|
|
547
|
+
/** Font family */
|
|
548
|
+
fontFamily?: string;
|
|
549
|
+
/** Base font size in pixels */
|
|
550
|
+
fontSize?: number;
|
|
551
|
+
/** Font weight scale */
|
|
552
|
+
fontWeightLight?: number;
|
|
553
|
+
fontWeightRegular?: number;
|
|
554
|
+
fontWeightMedium?: number;
|
|
555
|
+
fontWeightSemiBold?: number;
|
|
556
|
+
fontWeightBold?: number;
|
|
557
|
+
/** Heading configurations */
|
|
558
|
+
h1?: {
|
|
559
|
+
fontSize?: string | number;
|
|
560
|
+
fontWeight?: number;
|
|
561
|
+
lineHeight?: number | string;
|
|
562
|
+
letterSpacing?: string;
|
|
563
|
+
};
|
|
564
|
+
h2?: {
|
|
565
|
+
fontSize?: string | number;
|
|
566
|
+
fontWeight?: number;
|
|
567
|
+
lineHeight?: number | string;
|
|
568
|
+
letterSpacing?: string;
|
|
569
|
+
};
|
|
570
|
+
h3?: {
|
|
571
|
+
fontSize?: string | number;
|
|
572
|
+
fontWeight?: number;
|
|
573
|
+
lineHeight?: number | string;
|
|
574
|
+
letterSpacing?: string;
|
|
575
|
+
};
|
|
576
|
+
h4?: {
|
|
577
|
+
fontSize?: string | number;
|
|
578
|
+
fontWeight?: number;
|
|
579
|
+
lineHeight?: number | string;
|
|
580
|
+
letterSpacing?: string;
|
|
581
|
+
};
|
|
582
|
+
h5?: {
|
|
583
|
+
fontSize?: string | number;
|
|
584
|
+
fontWeight?: number;
|
|
585
|
+
lineHeight?: number | string;
|
|
586
|
+
letterSpacing?: string;
|
|
587
|
+
};
|
|
588
|
+
h6?: {
|
|
589
|
+
fontSize?: string | number;
|
|
590
|
+
fontWeight?: number;
|
|
591
|
+
lineHeight?: number | string;
|
|
592
|
+
letterSpacing?: string;
|
|
593
|
+
};
|
|
594
|
+
/** Body text configurations */
|
|
595
|
+
body1?: {
|
|
596
|
+
fontSize?: string | number;
|
|
597
|
+
fontWeight?: number;
|
|
598
|
+
lineHeight?: number | string;
|
|
599
|
+
};
|
|
600
|
+
body2?: {
|
|
601
|
+
fontSize?: string | number;
|
|
602
|
+
fontWeight?: number;
|
|
603
|
+
lineHeight?: number | string;
|
|
604
|
+
};
|
|
605
|
+
/** Additional custom typography */
|
|
606
|
+
[key: string]: any;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Spacing function type
|
|
610
|
+
*/
|
|
611
|
+
type SpacingFunction = (...values: number[]) => string;
|
|
612
|
+
/**
|
|
613
|
+
* Spacing configuration options for createTheme
|
|
614
|
+
*/
|
|
615
|
+
type SpacingOptions = number | number[] | SpacingFunction;
|
|
616
|
+
/**
|
|
617
|
+
* Breakpoint values configuration
|
|
618
|
+
*/
|
|
619
|
+
interface BreakpointValues {
|
|
620
|
+
xs?: number;
|
|
621
|
+
sm?: number;
|
|
622
|
+
md?: number;
|
|
623
|
+
lg?: number;
|
|
624
|
+
xl?: number;
|
|
625
|
+
[key: string]: number | undefined;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Breakpoints configuration options for createTheme
|
|
629
|
+
*/
|
|
630
|
+
interface BreakpointsOptions {
|
|
631
|
+
/** Breakpoint values in pixels */
|
|
632
|
+
values?: BreakpointValues;
|
|
633
|
+
/** Unit for breakpoints (default: 'px') */
|
|
634
|
+
unit?: string;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Shadow configuration
|
|
638
|
+
*/
|
|
639
|
+
interface ShadowOptions {
|
|
640
|
+
xs?: string;
|
|
641
|
+
sm?: string;
|
|
642
|
+
md?: string;
|
|
643
|
+
lg?: string;
|
|
644
|
+
xl?: string;
|
|
645
|
+
[key: string]: string | undefined;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Transition configuration
|
|
649
|
+
*/
|
|
650
|
+
interface TransitionOptions {
|
|
651
|
+
/** Transition duration values */
|
|
652
|
+
duration?: {
|
|
653
|
+
shortest?: number;
|
|
654
|
+
shorter?: number;
|
|
655
|
+
short?: number;
|
|
656
|
+
standard?: number;
|
|
657
|
+
complex?: number;
|
|
658
|
+
enteringScreen?: number;
|
|
659
|
+
leavingScreen?: number;
|
|
660
|
+
};
|
|
661
|
+
/** Easing functions */
|
|
662
|
+
easing?: {
|
|
663
|
+
easeInOut?: string;
|
|
664
|
+
easeOut?: string;
|
|
665
|
+
easeIn?: string;
|
|
666
|
+
sharp?: string;
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Z-index configuration
|
|
671
|
+
*/
|
|
672
|
+
interface ZIndexOptions {
|
|
673
|
+
mobileStepper?: number;
|
|
674
|
+
speedDial?: number;
|
|
675
|
+
appBar?: number;
|
|
676
|
+
drawer?: number;
|
|
677
|
+
modal?: number;
|
|
678
|
+
snackbar?: number;
|
|
679
|
+
tooltip?: number;
|
|
680
|
+
[key: string]: number | undefined;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Border radius configuration
|
|
684
|
+
*/
|
|
685
|
+
interface BorderRadiusOptions {
|
|
686
|
+
/** Base border radius */
|
|
687
|
+
base?: string | number;
|
|
688
|
+
/** Small border radius */
|
|
689
|
+
sm?: string | number;
|
|
690
|
+
/** Medium border radius */
|
|
691
|
+
md?: string | number;
|
|
692
|
+
/** Large border radius */
|
|
693
|
+
lg?: string | number;
|
|
694
|
+
/** Extra large border radius */
|
|
695
|
+
xl?: string | number;
|
|
696
|
+
/** 2X large border radius */
|
|
697
|
+
xxl?: string | number;
|
|
698
|
+
/** 3X large border radius */
|
|
699
|
+
'3xl'?: string | number;
|
|
700
|
+
/** 4X large border radius */
|
|
701
|
+
'4xl'?: string | number;
|
|
702
|
+
/** Pill shape (fully rounded) */
|
|
703
|
+
pill?: string | number;
|
|
704
|
+
[key: string]: string | number | undefined;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Custom theme properties for extension
|
|
708
|
+
* Users can augment this interface via module augmentation
|
|
709
|
+
*/
|
|
710
|
+
interface ThemeCustomProperties {
|
|
711
|
+
[key: string]: any;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Theme configuration options for createTheme
|
|
715
|
+
* Extends ThemeMetadata to support both CSS and JS theme properties
|
|
716
|
+
*/
|
|
717
|
+
interface ThemeOptions extends Partial<ThemeMetadata> {
|
|
718
|
+
/** Color palette configuration */
|
|
719
|
+
palette?: PaletteOptions;
|
|
720
|
+
/** Typography configuration */
|
|
721
|
+
typography?: TypographyOptions;
|
|
722
|
+
/** Spacing configuration */
|
|
723
|
+
spacing?: SpacingOptions;
|
|
724
|
+
/** Breakpoints configuration */
|
|
725
|
+
breakpoints?: BreakpointsOptions;
|
|
726
|
+
/** Shadow configuration */
|
|
727
|
+
shadows?: ShadowOptions;
|
|
728
|
+
/** Transition configuration */
|
|
729
|
+
transitions?: TransitionOptions;
|
|
730
|
+
/** Z-index configuration */
|
|
731
|
+
zIndex?: ZIndexOptions;
|
|
732
|
+
/** Border radius configuration */
|
|
733
|
+
borderRadius?: BorderRadiusOptions;
|
|
734
|
+
/** Custom properties */
|
|
735
|
+
custom?: ThemeCustomProperties;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Complete theme object with computed values
|
|
739
|
+
* Generated by createTheme function
|
|
740
|
+
*/
|
|
741
|
+
interface Theme extends ThemeMetadata {
|
|
742
|
+
/** Color palette with computed values */
|
|
743
|
+
palette: {
|
|
744
|
+
primary: PaletteColor;
|
|
745
|
+
secondary: PaletteColor;
|
|
746
|
+
error: PaletteColor;
|
|
747
|
+
warning: PaletteColor;
|
|
748
|
+
info: PaletteColor;
|
|
749
|
+
success: PaletteColor;
|
|
750
|
+
background: {
|
|
751
|
+
default: string;
|
|
752
|
+
paper: string;
|
|
753
|
+
subtle: string;
|
|
754
|
+
};
|
|
755
|
+
text: {
|
|
756
|
+
primary: string;
|
|
757
|
+
secondary: string;
|
|
758
|
+
disabled: string;
|
|
759
|
+
};
|
|
760
|
+
[key: string]: any;
|
|
761
|
+
};
|
|
762
|
+
/** Typography with computed values */
|
|
763
|
+
typography: {
|
|
764
|
+
fontFamily: string;
|
|
765
|
+
fontSize: number;
|
|
766
|
+
fontWeightLight: number;
|
|
767
|
+
fontWeightRegular: number;
|
|
768
|
+
fontWeightMedium: number;
|
|
769
|
+
fontWeightSemiBold: number;
|
|
770
|
+
fontWeightBold: number;
|
|
771
|
+
h1: Required<NonNullable<TypographyOptions['h1']>>;
|
|
772
|
+
h2: Required<NonNullable<TypographyOptions['h2']>>;
|
|
773
|
+
h3: Required<NonNullable<TypographyOptions['h3']>>;
|
|
774
|
+
h4: Required<NonNullable<TypographyOptions['h4']>>;
|
|
775
|
+
h5: Required<NonNullable<TypographyOptions['h5']>>;
|
|
776
|
+
h6: Required<NonNullable<TypographyOptions['h6']>>;
|
|
777
|
+
body1: Required<NonNullable<TypographyOptions['body1']>>;
|
|
778
|
+
body2: Required<NonNullable<TypographyOptions['body2']>>;
|
|
779
|
+
[key: string]: any;
|
|
780
|
+
};
|
|
781
|
+
/** Spacing function */
|
|
782
|
+
spacing: SpacingFunction;
|
|
783
|
+
/** Breakpoints with computed values */
|
|
784
|
+
breakpoints: {
|
|
785
|
+
values: Required<BreakpointValues>;
|
|
786
|
+
unit: string;
|
|
787
|
+
up: (key: keyof BreakpointValues | number) => string;
|
|
788
|
+
down: (key: keyof BreakpointValues | number) => string;
|
|
789
|
+
between: (start: keyof BreakpointValues | number, end: keyof BreakpointValues | number) => string;
|
|
790
|
+
};
|
|
791
|
+
/** Shadows */
|
|
792
|
+
shadows: Required<ShadowOptions>;
|
|
793
|
+
/** Transitions */
|
|
794
|
+
transitions: Required<TransitionOptions>;
|
|
795
|
+
/** Z-index values */
|
|
796
|
+
zIndex: Required<ZIndexOptions>;
|
|
797
|
+
/** Border radius values */
|
|
798
|
+
borderRadius: Required<BorderRadiusOptions>;
|
|
799
|
+
/** Custom properties */
|
|
800
|
+
custom: ThemeCustomProperties;
|
|
801
|
+
/** Global CSS variables to apply */
|
|
802
|
+
cssVars?: Record<string, string | number>;
|
|
803
|
+
/** Indicates this is a JS theme (not CSS-only) */
|
|
804
|
+
__isJSTheme: true;
|
|
453
805
|
}
|
|
454
806
|
|
|
455
807
|
/**
|
|
456
|
-
*
|
|
808
|
+
* CSS Variable Generator
|
|
457
809
|
*
|
|
458
|
-
*
|
|
810
|
+
* Generates CSS custom properties from design tokens.
|
|
459
811
|
*/
|
|
460
812
|
|
|
461
813
|
/**
|
|
462
|
-
*
|
|
463
|
-
*/
|
|
464
|
-
interface CSSCacheEntry {
|
|
465
|
-
type: 'css' | 'js';
|
|
466
|
-
themeId: string;
|
|
467
|
-
cssContent?: string;
|
|
468
|
-
loaded: boolean;
|
|
469
|
-
loading: Promise<void> | null;
|
|
470
|
-
timestamp: number;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Cache entry for JS theme
|
|
814
|
+
* Options for CSS variable generation
|
|
474
815
|
*/
|
|
475
|
-
interface
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
timestamp: number;
|
|
816
|
+
interface GenerateCSSVariablesOptions {
|
|
817
|
+
/** CSS selector for the variables (default: ':root') */
|
|
818
|
+
selector?: string;
|
|
819
|
+
/** Prefix for CSS variables (default: 'atomix') */
|
|
820
|
+
prefix?: string;
|
|
481
821
|
}
|
|
482
822
|
/**
|
|
483
|
-
*
|
|
823
|
+
* Generate CSS variables from tokens
|
|
824
|
+
*
|
|
825
|
+
* Converts flat token object to CSS custom properties.
|
|
826
|
+
*
|
|
827
|
+
* @param tokens - Design tokens object
|
|
828
|
+
* @param options - Generation options
|
|
829
|
+
* @returns CSS string with custom properties
|
|
830
|
+
*
|
|
831
|
+
* @example
|
|
832
|
+
* ```typescript
|
|
833
|
+
* const tokens = {
|
|
834
|
+
* 'primary': '#7c3aed',
|
|
835
|
+
* 'spacing-4': '1rem',
|
|
836
|
+
* };
|
|
837
|
+
*
|
|
838
|
+
* const css = generateCSSVariables(tokens);
|
|
839
|
+
* // Returns: ":root {\n --atomix-primary: #7c3aed;\n --atomix-spacing-4: 1rem;\n}"
|
|
840
|
+
* ```
|
|
484
841
|
*/
|
|
485
|
-
|
|
486
|
-
/** Maximum cache size (number of themes) */
|
|
487
|
-
maxSize?: number;
|
|
488
|
-
/** Cache TTL in milliseconds (0 = no expiration) */
|
|
489
|
-
ttl?: number;
|
|
490
|
-
/** Enable cache */
|
|
491
|
-
enabled?: boolean;
|
|
492
|
-
}
|
|
842
|
+
declare function generateCSSVariables(tokens: DesignTokens, options?: GenerateCSSVariablesOptions): string;
|
|
493
843
|
/**
|
|
494
|
-
*
|
|
844
|
+
* Generate CSS variables with custom selector
|
|
495
845
|
*
|
|
496
|
-
*
|
|
846
|
+
* Useful for theme-specific selectors like `[data-theme="dark"]`
|
|
847
|
+
*
|
|
848
|
+
* @param tokens - Design tokens object
|
|
849
|
+
* @param selector - CSS selector (e.g., '[data-theme="dark"]')
|
|
850
|
+
* @param prefix - CSS variable prefix
|
|
851
|
+
* @returns CSS string
|
|
852
|
+
*
|
|
853
|
+
* @example
|
|
854
|
+
* ```typescript
|
|
855
|
+
* const css = generateCSSVariablesForSelector(
|
|
856
|
+
* tokens,
|
|
857
|
+
* '[data-theme="dark"]',
|
|
858
|
+
* 'atomix'
|
|
859
|
+
* );
|
|
860
|
+
* ```
|
|
497
861
|
*/
|
|
498
|
-
declare
|
|
499
|
-
private cache;
|
|
500
|
-
private config;
|
|
501
|
-
private accessOrder;
|
|
502
|
-
constructor(config?: CacheConfig);
|
|
503
|
-
/**
|
|
504
|
-
* Get cached CSS theme
|
|
505
|
-
*/
|
|
506
|
-
getCSS(themeId: string): CSSCacheEntry | null;
|
|
507
|
-
/**
|
|
508
|
-
* Get cached JS theme
|
|
509
|
-
*/
|
|
510
|
-
getJS(themeId: string): JSCacheEntry | null;
|
|
511
|
-
/**
|
|
512
|
-
* Set CSS theme cache entry
|
|
513
|
-
*/
|
|
514
|
-
setCSS(themeId: string, entry: Partial<CSSCacheEntry>): void;
|
|
515
|
-
/**
|
|
516
|
-
* Set JS theme cache entry
|
|
517
|
-
*/
|
|
518
|
-
setJS(themeId: string, theme: Theme): void;
|
|
519
|
-
/**
|
|
520
|
-
* Check if theme is cached
|
|
521
|
-
*/
|
|
522
|
-
has(themeId: string): boolean;
|
|
523
|
-
/**
|
|
524
|
-
* Remove theme from cache
|
|
525
|
-
*/
|
|
526
|
-
delete(themeId: string): boolean;
|
|
527
|
-
/**
|
|
528
|
-
* Clear all cache
|
|
529
|
-
*/
|
|
530
|
-
clear(): void;
|
|
531
|
-
/**
|
|
532
|
-
* Get cache statistics
|
|
533
|
-
*/
|
|
534
|
-
getStats(): {
|
|
535
|
-
size: number;
|
|
536
|
-
maxSize: number;
|
|
537
|
-
cssThemes: number;
|
|
538
|
-
jsThemes: number;
|
|
539
|
-
};
|
|
540
|
-
/**
|
|
541
|
-
* Update access order for LRU
|
|
542
|
-
*/
|
|
543
|
-
private updateAccessOrder;
|
|
544
|
-
/**
|
|
545
|
-
* Remove from access order
|
|
546
|
-
*/
|
|
547
|
-
private removeFromAccessOrder;
|
|
548
|
-
/**
|
|
549
|
-
* Evict least recently used entries if cache is full
|
|
550
|
-
*/
|
|
551
|
-
private evictIfNeeded;
|
|
552
|
-
}
|
|
862
|
+
declare function generateCSSVariablesForSelector(tokens: DesignTokens, selector: string, prefix?: string): string;
|
|
553
863
|
|
|
554
864
|
/**
|
|
555
|
-
* Theme
|
|
865
|
+
* Core Theme Functions
|
|
556
866
|
*
|
|
557
|
-
*
|
|
867
|
+
* Unified theme system that handles both DesignTokens and Theme objects.
|
|
868
|
+
* Config-first approach: loads from atomix.config.ts when no input is provided.
|
|
869
|
+
* Config file is required for automatic loading.
|
|
558
870
|
*/
|
|
559
871
|
|
|
560
872
|
/**
|
|
561
|
-
* Theme
|
|
873
|
+
* Create theme CSS from tokens or Theme object
|
|
874
|
+
*
|
|
875
|
+
* **Config-First Approach**: If no input is provided, loads from `atomix.config.ts`.
|
|
876
|
+
* Config file is required for automatic loading.
|
|
877
|
+
*
|
|
878
|
+
* @param input - DesignTokens (partial), Theme object, or undefined (loads from config)
|
|
879
|
+
* @param options - CSS generation options (prefix is automatically read from config if not provided)
|
|
880
|
+
* @returns CSS string with custom properties
|
|
881
|
+
* @throws Error if config loading fails when no input is provided
|
|
882
|
+
*
|
|
883
|
+
* @example
|
|
884
|
+
* ```typescript
|
|
885
|
+
* // Loads from atomix.config.ts (config file required)
|
|
886
|
+
* const css = createTheme();
|
|
887
|
+
*
|
|
888
|
+
* // Using DesignTokens
|
|
889
|
+
* const css = createTheme({
|
|
890
|
+
* 'primary': '#7c3aed',
|
|
891
|
+
* 'spacing-4': '1rem',
|
|
892
|
+
* });
|
|
893
|
+
*
|
|
894
|
+
* // Using Theme object
|
|
895
|
+
* const theme = createThemeObject({ palette: { primary: { main: '#7c3aed' } } });
|
|
896
|
+
* const css = createTheme(theme);
|
|
897
|
+
*
|
|
898
|
+
* // With custom options
|
|
899
|
+
* const css = createTheme(undefined, { prefix: 'myapp', selector: ':root' });
|
|
900
|
+
* ```
|
|
562
901
|
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
previousTheme: string | null;
|
|
566
|
-
/** Current theme ID */
|
|
567
|
-
currentTheme: string;
|
|
568
|
-
/** Theme object (for JS themes) */
|
|
569
|
-
themeObject?: Theme | null;
|
|
570
|
-
/** Timestamp */
|
|
571
|
-
timestamp: number;
|
|
572
|
-
/** Source of change */
|
|
573
|
-
source: 'user' | 'system' | 'storage';
|
|
574
|
-
}
|
|
902
|
+
declare function createTheme(input?: Partial<DesignTokens> | Theme, options?: GenerateCSSVariablesOptions): string;
|
|
903
|
+
|
|
575
904
|
/**
|
|
576
|
-
*
|
|
905
|
+
* createThemeObject - Create a theme object with computed values
|
|
906
|
+
*
|
|
907
|
+
* Similar to Material-UI's createTheme, this function accepts theme configuration
|
|
908
|
+
* options and returns a complete theme object with computed values.
|
|
909
|
+
*
|
|
910
|
+
* NOTE: For most use cases, use the simple theme system's `createTheme` instead,
|
|
911
|
+
* which generates CSS from DesignTokens. This function is for advanced use cases
|
|
912
|
+
* that need the full Theme object structure.
|
|
913
|
+
*
|
|
914
|
+
* @example
|
|
915
|
+
* ```typescript
|
|
916
|
+
* const theme = createThemeObject({
|
|
917
|
+
* palette: {
|
|
918
|
+
* primary: { main: '#7AFFD7' },
|
|
919
|
+
* secondary: { main: '#FF5733' },
|
|
920
|
+
* },
|
|
921
|
+
* typography: {
|
|
922
|
+
* fontFamily: 'Inter, sans-serif',
|
|
923
|
+
* },
|
|
924
|
+
* });
|
|
925
|
+
* ```
|
|
577
926
|
*/
|
|
578
|
-
|
|
579
|
-
/** Force reload even if already loaded */
|
|
580
|
-
force?: boolean;
|
|
581
|
-
/** Preload without applying */
|
|
582
|
-
preload?: boolean;
|
|
583
|
-
/** Remove previous theme CSS */
|
|
584
|
-
removePrevious?: boolean;
|
|
585
|
-
/** Custom CSS path override */
|
|
586
|
-
customPath?: string;
|
|
587
|
-
/** Fallback to default theme on error */
|
|
588
|
-
fallbackOnError?: boolean;
|
|
589
|
-
}
|
|
927
|
+
|
|
590
928
|
/**
|
|
591
|
-
*
|
|
929
|
+
* Create a theme object with computed values
|
|
930
|
+
*
|
|
931
|
+
* @param options - Theme configuration options
|
|
932
|
+
* @returns Complete theme object
|
|
592
933
|
*/
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
attemptedTheme: string;
|
|
596
|
-
/** Theme ID that was reverted to (null if no previous theme) */
|
|
597
|
-
revertedToTheme: string | null;
|
|
598
|
-
/** Error that caused the revert */
|
|
599
|
-
error: Error;
|
|
600
|
-
/** Timestamp */
|
|
601
|
-
timestamp: number;
|
|
602
|
-
}
|
|
934
|
+
declare function createThemeObject(...options: ThemeOptions[]): Theme;
|
|
935
|
+
|
|
603
936
|
/**
|
|
604
|
-
*
|
|
937
|
+
* Theme Composition Utilities
|
|
938
|
+
*
|
|
939
|
+
* Utilities for composing, merging, and extending themes.
|
|
605
940
|
*/
|
|
606
|
-
|
|
607
|
-
type ThemeLoadListener = (themeId: string) => void;
|
|
608
|
-
type ThemeErrorListener = (error: Error, themeId: string) => void;
|
|
609
|
-
type ThemeRevertListener = (event: ThemeRevertEvent) => void;
|
|
941
|
+
|
|
610
942
|
/**
|
|
611
|
-
*
|
|
943
|
+
* Deep merge multiple objects
|
|
944
|
+
* Later objects override earlier ones
|
|
612
945
|
*/
|
|
613
|
-
|
|
614
|
-
/** Base path for CSS themes */
|
|
615
|
-
basePath?: string;
|
|
616
|
-
/** CDN path for CSS themes */
|
|
617
|
-
cdnPath?: string | null;
|
|
618
|
-
/** Use minified CSS */
|
|
619
|
-
useMinified?: boolean;
|
|
620
|
-
/** Data attribute name */
|
|
621
|
-
dataAttribute?: string;
|
|
622
|
-
/** Enable caching */
|
|
623
|
-
enableCache?: boolean;
|
|
624
|
-
/** Cache configuration */
|
|
625
|
-
cacheConfig?: {
|
|
626
|
-
maxSize?: number;
|
|
627
|
-
ttl?: number;
|
|
628
|
-
};
|
|
629
|
-
/** Custom style ID for JS theme CSS injection */
|
|
630
|
-
styleId?: string;
|
|
631
|
-
}
|
|
946
|
+
declare function deepMerge<T extends Record<string, any>>(...objects: Partial<T>[]): T;
|
|
632
947
|
/**
|
|
633
|
-
*
|
|
948
|
+
* Merge multiple theme options into a single theme options object
|
|
949
|
+
*
|
|
950
|
+
* @param themes - Theme options to merge
|
|
951
|
+
* @returns Merged theme options
|
|
634
952
|
*
|
|
635
|
-
*
|
|
953
|
+
* @example
|
|
954
|
+
* ```typescript
|
|
955
|
+
* const baseTheme = { palette: { primary: { main: '#000' } } };
|
|
956
|
+
* const customTheme = { palette: { secondary: { main: '#fff' } } };
|
|
957
|
+
* const merged = mergeTheme(baseTheme, customTheme);
|
|
958
|
+
* ```
|
|
636
959
|
*/
|
|
637
|
-
declare
|
|
638
|
-
private registry;
|
|
639
|
-
private cache;
|
|
640
|
-
private validator;
|
|
641
|
-
private config;
|
|
642
|
-
private currentTheme;
|
|
643
|
-
private activeTheme;
|
|
644
|
-
private loadedThemes;
|
|
645
|
-
private loadingThemes;
|
|
646
|
-
private failedThemes;
|
|
647
|
-
private changeListeners;
|
|
648
|
-
private loadListeners;
|
|
649
|
-
private errorListeners;
|
|
650
|
-
private revertListeners;
|
|
651
|
-
private logger;
|
|
652
|
-
constructor(config?: ThemeEngineConfig);
|
|
653
|
-
/**
|
|
654
|
-
* Initialize engine with theme registry
|
|
655
|
-
*/
|
|
656
|
-
initialize(): Promise<void>;
|
|
657
|
-
/**
|
|
658
|
-
* Get current theme ID
|
|
659
|
-
*/
|
|
660
|
-
getCurrentTheme(): string | null;
|
|
661
|
-
/**
|
|
662
|
-
* Get active theme object
|
|
663
|
-
*/
|
|
664
|
-
getActiveTheme(): Theme | null;
|
|
665
|
-
/**
|
|
666
|
-
* Check if theme is loaded
|
|
667
|
-
*/
|
|
668
|
-
isThemeLoaded(themeId: string): boolean;
|
|
669
|
-
/**
|
|
670
|
-
* Load and apply theme
|
|
671
|
-
*/
|
|
672
|
-
setTheme(themeId: string | Theme, options?: ThemeLoadOptions$1): Promise<void>;
|
|
673
|
-
/**
|
|
674
|
-
* Load theme (CSS or JS)
|
|
675
|
-
*/
|
|
676
|
-
private loadTheme;
|
|
677
|
-
/**
|
|
678
|
-
* Load CSS theme
|
|
679
|
-
*/
|
|
680
|
-
private loadCSSTheme;
|
|
681
|
-
/**
|
|
682
|
-
* Load JS theme
|
|
683
|
-
*/
|
|
684
|
-
private loadJSTheme;
|
|
685
|
-
/**
|
|
686
|
-
* Apply theme (set as active)
|
|
687
|
-
*/
|
|
688
|
-
private applyTheme;
|
|
689
|
-
/**
|
|
690
|
-
* Apply CSS theme
|
|
691
|
-
*/
|
|
692
|
-
private applyCSSTheme;
|
|
693
|
-
/**
|
|
694
|
-
* Apply JS theme
|
|
695
|
-
*/
|
|
696
|
-
private applyJSTheme;
|
|
697
|
-
/**
|
|
698
|
-
* Remove theme
|
|
699
|
-
*/
|
|
700
|
-
private removeTheme;
|
|
701
|
-
/**
|
|
702
|
-
* Preload theme
|
|
703
|
-
*/
|
|
704
|
-
preloadTheme(themeId: string): Promise<void>;
|
|
705
|
-
/**
|
|
706
|
-
* Get registry
|
|
707
|
-
*/
|
|
708
|
-
getRegistry(): ThemeRegistry;
|
|
709
|
-
/**
|
|
710
|
-
* Get cache
|
|
711
|
-
*/
|
|
712
|
-
getCache(): ThemeCache;
|
|
713
|
-
/**
|
|
714
|
-
* Clear failed theme tracking (allows retry of previously failed themes)
|
|
715
|
-
*/
|
|
716
|
-
clearFailedThemes(): void;
|
|
717
|
-
/**
|
|
718
|
-
* Clear specific failed theme (allows retry of a specific theme)
|
|
719
|
-
*/
|
|
720
|
-
clearFailedTheme(themeId: string): void;
|
|
721
|
-
/**
|
|
722
|
-
* Check if theme has failed to load
|
|
723
|
-
*/
|
|
724
|
-
hasFailedTheme(themeId: string): boolean;
|
|
725
|
-
/**
|
|
726
|
-
* Add change listener
|
|
727
|
-
*/
|
|
728
|
-
on(event: 'change', listener: ThemeChangeListener): void;
|
|
729
|
-
on(event: 'load', listener: ThemeLoadListener): void;
|
|
730
|
-
on(event: 'error', listener: ThemeErrorListener): void;
|
|
731
|
-
on(event: 'revert', listener: ThemeRevertListener): void;
|
|
732
|
-
/**
|
|
733
|
-
* Remove listener
|
|
734
|
-
*/
|
|
735
|
-
off(event: 'change', listener: ThemeChangeListener): void;
|
|
736
|
-
off(event: 'load', listener: ThemeLoadListener): void;
|
|
737
|
-
off(event: 'error', listener: ThemeErrorListener): void;
|
|
738
|
-
off(event: 'revert', listener: ThemeRevertListener): void;
|
|
739
|
-
/**
|
|
740
|
-
* Emit change event
|
|
741
|
-
*/
|
|
742
|
-
private emitChange;
|
|
743
|
-
/**
|
|
744
|
-
* Emit load event
|
|
745
|
-
*/
|
|
746
|
-
private emitLoad;
|
|
747
|
-
/**
|
|
748
|
-
* Emit error event
|
|
749
|
-
* Emits error to listeners (error emission is controlled at call site)
|
|
750
|
-
*/
|
|
751
|
-
private emitError;
|
|
752
|
-
/**
|
|
753
|
-
* Emit revert event
|
|
754
|
-
*/
|
|
755
|
-
private emitRevert;
|
|
756
|
-
}
|
|
757
|
-
|
|
960
|
+
declare function mergeTheme(...themes: ThemeOptions[]): ThemeOptions;
|
|
758
961
|
/**
|
|
759
|
-
*
|
|
962
|
+
* Extend an existing theme with new options
|
|
760
963
|
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
964
|
+
* @param baseTheme - Base theme to extend (can be Theme or ThemeOptions)
|
|
965
|
+
* @param extension - Theme options to extend with
|
|
966
|
+
* @returns New theme with extended options
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* ```typescript
|
|
970
|
+
* const base = createTheme({ palette: { primary: { main: '#000' } } });
|
|
971
|
+
* const extended = extendTheme(base, {
|
|
972
|
+
* palette: { secondary: { main: '#fff' } }
|
|
973
|
+
* });
|
|
974
|
+
* ```
|
|
765
975
|
*/
|
|
976
|
+
declare function extendTheme(baseTheme: Theme | ThemeOptions, extension: ThemeOptions): Theme;
|
|
766
977
|
|
|
767
978
|
/**
|
|
768
|
-
*
|
|
979
|
+
* Atomix Configuration System
|
|
769
980
|
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
981
|
+
* Tailwind-like configuration for customizing the Atomix Design System.
|
|
982
|
+
*
|
|
983
|
+
* External developers can create `atomix.config.ts` in their project root
|
|
984
|
+
* to customize design tokens, similar to Tailwind's tailwind.config.js
|
|
772
985
|
*
|
|
773
986
|
* @example
|
|
774
987
|
* ```typescript
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
* });
|
|
988
|
+
* // atomix.config.ts (in your project)
|
|
989
|
+
* import { defineConfig } from '@shohojdhara/atomix/config';
|
|
778
990
|
*
|
|
779
|
-
*
|
|
991
|
+
* export default defineConfig({
|
|
992
|
+
* theme: {
|
|
993
|
+
* extend: {
|
|
994
|
+
* colors: {
|
|
995
|
+
* primary: { main: '#7AFFD7' },
|
|
996
|
+
* },
|
|
997
|
+
* },
|
|
998
|
+
* },
|
|
999
|
+
* });
|
|
780
1000
|
* ```
|
|
781
|
-
*/
|
|
782
|
-
declare class ThemeManager {
|
|
783
|
-
private engine;
|
|
784
|
-
private config;
|
|
785
|
-
private currentTheme;
|
|
786
|
-
private activeTheme;
|
|
787
|
-
private eventListeners;
|
|
788
|
-
private storageAdapter;
|
|
789
|
-
private initialized;
|
|
790
|
-
private rtlManager?;
|
|
791
|
-
private logger;
|
|
792
|
-
/**
|
|
793
|
-
* Create a new ThemeManager instance
|
|
794
|
-
*
|
|
795
|
-
* @param config - Theme manager configuration
|
|
796
|
-
*/
|
|
797
|
-
constructor(config: ThemeManagerConfig);
|
|
798
|
-
/**
|
|
799
|
-
* Initialize the theme manager
|
|
800
|
-
*/
|
|
801
|
-
private initialize;
|
|
802
|
-
/**
|
|
803
|
-
* Get default theme
|
|
804
|
-
*/
|
|
805
|
-
private getDefaultTheme;
|
|
806
|
-
/**
|
|
807
|
-
* Set theme
|
|
808
|
-
*/
|
|
809
|
-
setTheme(theme: string | Theme, options?: ThemeLoadOptions): Promise<void>;
|
|
810
|
-
/**
|
|
811
|
-
* Get current theme
|
|
812
|
-
*/
|
|
813
|
-
getTheme(): string;
|
|
814
|
-
/**
|
|
815
|
-
* Get active theme object (for JS themes)
|
|
816
|
-
*/
|
|
817
|
-
getActiveTheme(): Theme | null;
|
|
818
|
-
/**
|
|
819
|
-
* Get available themes
|
|
820
|
-
*/
|
|
821
|
-
getAvailableThemes(): ThemeMetadata[];
|
|
822
|
-
/**
|
|
823
|
-
* Check if theme is loaded
|
|
824
|
-
*/
|
|
825
|
-
isThemeLoaded(themeName: string): boolean;
|
|
826
|
-
/**
|
|
827
|
-
* Preload theme
|
|
828
|
-
*/
|
|
829
|
-
preloadTheme(themeName: string): Promise<void>;
|
|
830
|
-
/**
|
|
831
|
-
* Add event listener
|
|
832
|
-
*/
|
|
833
|
-
on(event: 'themeChange', callback: ThemeChangeCallback): void;
|
|
834
|
-
on(event: 'themeLoad', callback: ThemeLoadCallback): void;
|
|
835
|
-
on(event: 'themeError', callback: ThemeErrorCallback): void;
|
|
836
|
-
/**
|
|
837
|
-
* Remove event listener
|
|
838
|
-
*/
|
|
839
|
-
off(event: 'themeChange', callback: ThemeChangeCallback): void;
|
|
840
|
-
off(event: 'themeLoad', callback: ThemeLoadCallback): void;
|
|
841
|
-
off(event: 'themeError', callback: ThemeErrorCallback): void;
|
|
842
|
-
/**
|
|
843
|
-
* Emit theme change event
|
|
844
|
-
*/
|
|
845
|
-
private emitThemeChange;
|
|
846
|
-
/**
|
|
847
|
-
* Emit theme load event
|
|
848
|
-
*/
|
|
849
|
-
private emitThemeLoad;
|
|
850
|
-
/**
|
|
851
|
-
* Emit theme error event
|
|
852
|
-
*/
|
|
853
|
-
private emitThemeError;
|
|
854
|
-
/**
|
|
855
|
-
* Get engine instance (for advanced usage)
|
|
856
|
-
*/
|
|
857
|
-
getEngine(): ThemeEngine;
|
|
858
|
-
/**
|
|
859
|
-
* Get RTL manager
|
|
860
|
-
*/
|
|
861
|
-
getRTLManager(): RTLManager | undefined;
|
|
862
|
-
/**
|
|
863
|
-
* Set RTL direction
|
|
864
|
-
*/
|
|
865
|
-
setDirection(direction: 'ltr' | 'rtl'): void;
|
|
866
|
-
/**
|
|
867
|
-
* Get current direction
|
|
868
|
-
*/
|
|
869
|
-
getDirection(): 'ltr' | 'rtl';
|
|
870
|
-
/**
|
|
871
|
-
* Destroy theme manager
|
|
872
|
-
*/
|
|
873
|
-
destroy(): void;
|
|
874
|
-
}
|
|
1001
|
+
*/
|
|
875
1002
|
|
|
876
1003
|
/**
|
|
877
|
-
* Theme
|
|
1004
|
+
* CSS Theme Definition
|
|
878
1005
|
*/
|
|
879
|
-
interface
|
|
880
|
-
|
|
1006
|
+
interface CSSThemeDefinition {
|
|
1007
|
+
type: 'css';
|
|
881
1008
|
name: string;
|
|
882
|
-
/** Unique identifier/class name for the theme */
|
|
883
1009
|
class?: string;
|
|
884
|
-
/** Theme description */
|
|
885
1010
|
description?: string;
|
|
886
|
-
/** Theme author */
|
|
887
1011
|
author?: string;
|
|
888
|
-
/** Theme version (semver) */
|
|
889
1012
|
version?: string;
|
|
890
|
-
/** Theme tags for categorization */
|
|
891
1013
|
tags?: string[];
|
|
892
|
-
/** Whether the theme supports dark mode */
|
|
893
1014
|
supportsDarkMode?: boolean;
|
|
894
|
-
/** Theme status: stable, beta, experimental, deprecated */
|
|
895
1015
|
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
896
|
-
/** Accessibility information */
|
|
897
1016
|
a11y?: {
|
|
898
|
-
/** Target contrast ratio */
|
|
899
1017
|
contrastTarget?: number;
|
|
900
|
-
/** Supported color modes */
|
|
901
1018
|
modes?: string[];
|
|
902
1019
|
};
|
|
903
|
-
/** Primary theme color (for UI display) */
|
|
904
1020
|
color?: string;
|
|
905
|
-
/** Theme features list */
|
|
906
1021
|
features?: string[];
|
|
907
|
-
/** Theme dependencies (other themes required) */
|
|
908
1022
|
dependencies?: string[];
|
|
1023
|
+
cssPath?: string;
|
|
909
1024
|
}
|
|
910
1025
|
/**
|
|
911
|
-
* Theme
|
|
912
|
-
*/
|
|
913
|
-
interface ThemeManagerConfig {
|
|
914
|
-
/** Available themes metadata */
|
|
915
|
-
themes: Record<string, ThemeMetadata>;
|
|
916
|
-
/** Default theme to use */
|
|
917
|
-
defaultTheme?: string | Theme;
|
|
918
|
-
/** Base path for theme CSS files */
|
|
919
|
-
basePath?: string;
|
|
920
|
-
/** CDN path for theme CSS files (optional) */
|
|
921
|
-
cdnPath?: string | null;
|
|
922
|
-
/** Themes to preload on initialization */
|
|
923
|
-
preload?: string[];
|
|
924
|
-
/** Enable lazy loading of themes */
|
|
925
|
-
lazy?: boolean;
|
|
926
|
-
/** localStorage key for persistence */
|
|
927
|
-
storageKey?: string;
|
|
928
|
-
/** Data attribute name for theme */
|
|
929
|
-
dataAttribute?: string;
|
|
930
|
-
/** Enable persistence */
|
|
931
|
-
enablePersistence?: boolean;
|
|
932
|
-
/** Custom CSS file extension */
|
|
933
|
-
cssExtension?: string;
|
|
934
|
-
/** Use minified CSS files */
|
|
935
|
-
useMinified?: boolean;
|
|
936
|
-
/** Callback when theme changes */
|
|
937
|
-
onThemeChange?: (theme: string | Theme) => void;
|
|
938
|
-
/** Callback when theme load fails */
|
|
939
|
-
onError?: (error: Error, themeName: string) => void;
|
|
940
|
-
/** RTL configuration */
|
|
941
|
-
rtl?: RTLConfig;
|
|
942
|
-
}
|
|
943
|
-
/**
|
|
944
|
-
* Theme change event payload
|
|
945
|
-
*/
|
|
946
|
-
interface ThemeChangeEvent {
|
|
947
|
-
/** Previous theme name */
|
|
948
|
-
previousTheme: string | null;
|
|
949
|
-
/** New theme name */
|
|
950
|
-
currentTheme: string;
|
|
951
|
-
/** Theme object (for JS themes) */
|
|
952
|
-
themeObject?: Theme | null;
|
|
953
|
-
/** Timestamp of the change */
|
|
954
|
-
timestamp: number;
|
|
955
|
-
/** Whether the change was from user action or system */
|
|
956
|
-
source: 'user' | 'system' | 'storage';
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Theme load options
|
|
960
|
-
*/
|
|
961
|
-
interface ThemeLoadOptions {
|
|
962
|
-
/** Force reload even if already loaded */
|
|
963
|
-
force?: boolean;
|
|
964
|
-
/** Preload without applying */
|
|
965
|
-
preload?: boolean;
|
|
966
|
-
/** Remove previous theme CSS */
|
|
967
|
-
removePrevious?: boolean;
|
|
968
|
-
/** Custom CSS path override */
|
|
969
|
-
customPath?: string;
|
|
970
|
-
/** Fallback to default theme on error */
|
|
971
|
-
fallbackOnError?: boolean;
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Theme validation result
|
|
975
|
-
*/
|
|
976
|
-
interface ThemeValidationResult {
|
|
977
|
-
/** Whether the theme is valid */
|
|
978
|
-
valid: boolean;
|
|
979
|
-
/** Validation errors */
|
|
980
|
-
errors: string[];
|
|
981
|
-
/** Validation warnings */
|
|
982
|
-
warnings: string[];
|
|
983
|
-
}
|
|
984
|
-
/**
|
|
985
|
-
* Theme change callback function
|
|
986
|
-
*/
|
|
987
|
-
type ThemeChangeCallback = (event: ThemeChangeEvent) => void;
|
|
988
|
-
/**
|
|
989
|
-
* Theme load callback function
|
|
990
|
-
*/
|
|
991
|
-
type ThemeLoadCallback = (themeName: string) => void;
|
|
992
|
-
/**
|
|
993
|
-
* Theme error callback function
|
|
994
|
-
*/
|
|
995
|
-
type ThemeErrorCallback = (error: Error, themeName: string) => void;
|
|
996
|
-
/**
|
|
997
|
-
* React hook return type for useTheme
|
|
998
|
-
*/
|
|
999
|
-
interface UseThemeReturn {
|
|
1000
|
-
/** Current theme name */
|
|
1001
|
-
theme: string;
|
|
1002
|
-
/** Current active theme object (for JS themes) */
|
|
1003
|
-
activeTheme: Theme | null;
|
|
1004
|
-
/** Function to change theme */
|
|
1005
|
-
setTheme: (theme: string | Theme, options?: ThemeLoadOptions) => Promise<void>;
|
|
1006
|
-
/** Available themes */
|
|
1007
|
-
availableThemes: ThemeMetadata[];
|
|
1008
|
-
/** Whether a theme is currently loading */
|
|
1009
|
-
isLoading: boolean;
|
|
1010
|
-
/** Current error, if any */
|
|
1011
|
-
error: Error | null;
|
|
1012
|
-
/** Whether a specific theme is loaded */
|
|
1013
|
-
isThemeLoaded: (themeName: string) => boolean;
|
|
1014
|
-
/** Preload a theme */
|
|
1015
|
-
preloadTheme: (themeName: string) => Promise<void>;
|
|
1016
|
-
}
|
|
1017
|
-
/**
|
|
1018
|
-
* Component-level theme override configuration
|
|
1019
|
-
*/
|
|
1020
|
-
interface ComponentThemeOverride {
|
|
1021
|
-
/** CSS variable overrides for the component */
|
|
1022
|
-
cssVars?: Record<string, string | number>;
|
|
1023
|
-
/** Default prop overrides */
|
|
1024
|
-
defaultProps?: Record<string, any>;
|
|
1025
|
-
/** Part-specific overrides */
|
|
1026
|
-
parts?: Record<string, {
|
|
1027
|
-
cssVars?: Record<string, string | number>;
|
|
1028
|
-
className?: string;
|
|
1029
|
-
}>;
|
|
1030
|
-
/** Variant overrides */
|
|
1031
|
-
variants?: Record<string, {
|
|
1032
|
-
cssVars?: Record<string, string | number>;
|
|
1033
|
-
className?: string;
|
|
1034
|
-
}>;
|
|
1035
|
-
/** Additional className for the component */
|
|
1036
|
-
className?: string;
|
|
1037
|
-
}
|
|
1038
|
-
/**
|
|
1039
|
-
* Theme component overrides for all components
|
|
1040
|
-
*/
|
|
1041
|
-
interface ThemeComponentOverrides {
|
|
1042
|
-
Button?: ComponentThemeOverride;
|
|
1043
|
-
Card?: ComponentThemeOverride;
|
|
1044
|
-
Input?: ComponentThemeOverride;
|
|
1045
|
-
Modal?: ComponentThemeOverride;
|
|
1046
|
-
Dropdown?: ComponentThemeOverride;
|
|
1047
|
-
Badge?: ComponentThemeOverride;
|
|
1048
|
-
Tabs?: ComponentThemeOverride;
|
|
1049
|
-
Progress?: ComponentThemeOverride;
|
|
1050
|
-
Tooltip?: ComponentThemeOverride;
|
|
1051
|
-
Select?: ComponentThemeOverride;
|
|
1052
|
-
Checkbox?: ComponentThemeOverride;
|
|
1053
|
-
Radio?: ComponentThemeOverride;
|
|
1054
|
-
Textarea?: ComponentThemeOverride;
|
|
1055
|
-
FormGroup?: ComponentThemeOverride;
|
|
1056
|
-
Navbar?: ComponentThemeOverride;
|
|
1057
|
-
Accordion?: ComponentThemeOverride;
|
|
1058
|
-
DataTable?: ComponentThemeOverride;
|
|
1059
|
-
Avatar?: ComponentThemeOverride;
|
|
1060
|
-
List?: ComponentThemeOverride;
|
|
1061
|
-
Popover?: ComponentThemeOverride;
|
|
1062
|
-
Messages?: ComponentThemeOverride;
|
|
1063
|
-
Callout?: ComponentThemeOverride;
|
|
1064
|
-
Spinner?: ComponentThemeOverride;
|
|
1065
|
-
[key: string]: ComponentThemeOverride | undefined;
|
|
1066
|
-
}
|
|
1067
|
-
/**
|
|
1068
|
-
* Theme provider props
|
|
1069
|
-
*/
|
|
1070
|
-
interface ThemeProviderProps {
|
|
1071
|
-
/** Child components */
|
|
1072
|
-
children: React.ReactNode;
|
|
1073
|
-
/** Default theme */
|
|
1074
|
-
defaultTheme?: string | Theme;
|
|
1075
|
-
/** Available themes */
|
|
1076
|
-
themes?: Record<string, ThemeMetadata>;
|
|
1077
|
-
/** Base path for theme CSS */
|
|
1078
|
-
basePath?: string;
|
|
1079
|
-
/** CDN path for theme CSS */
|
|
1080
|
-
cdnPath?: string | null;
|
|
1081
|
-
/** Themes to preload */
|
|
1082
|
-
preload?: string[];
|
|
1083
|
-
/** Enable lazy loading */
|
|
1084
|
-
lazy?: boolean;
|
|
1085
|
-
/** localStorage key */
|
|
1086
|
-
storageKey?: string;
|
|
1087
|
-
/** Data attribute name */
|
|
1088
|
-
dataAttribute?: string;
|
|
1089
|
-
/** Enable persistence */
|
|
1090
|
-
enablePersistence?: boolean;
|
|
1091
|
-
/** Use minified CSS */
|
|
1092
|
-
useMinified?: boolean;
|
|
1093
|
-
/** Callback when theme changes */
|
|
1094
|
-
onThemeChange?: (theme: string | Theme) => void;
|
|
1095
|
-
/** Callback on error */
|
|
1096
|
-
onError?: (error: Error, themeName: string) => void;
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
* Theme context value
|
|
1026
|
+
* JavaScript Theme Definition
|
|
1100
1027
|
*/
|
|
1101
|
-
interface
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
themeManager: ThemeManager;
|
|
1028
|
+
interface JSThemeDefinition {
|
|
1029
|
+
type: 'js';
|
|
1030
|
+
name: string;
|
|
1031
|
+
class?: string;
|
|
1032
|
+
description?: string;
|
|
1033
|
+
author?: string;
|
|
1034
|
+
version?: string;
|
|
1035
|
+
tags?: string[];
|
|
1036
|
+
supportsDarkMode?: boolean;
|
|
1037
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
1038
|
+
a11y?: {
|
|
1039
|
+
contrastTarget?: number;
|
|
1040
|
+
modes?: string[];
|
|
1041
|
+
};
|
|
1042
|
+
color?: string;
|
|
1043
|
+
features?: string[];
|
|
1044
|
+
dependencies?: string[];
|
|
1045
|
+
createTheme: () => Theme;
|
|
1120
1046
|
}
|
|
1121
1047
|
/**
|
|
1122
|
-
*
|
|
1048
|
+
* Theme Definition (CSS or JS)
|
|
1123
1049
|
*/
|
|
1124
|
-
|
|
1125
|
-
/** Main color value */
|
|
1126
|
-
main: string;
|
|
1127
|
-
/** Light variant (auto-generated if not provided) */
|
|
1128
|
-
light?: string;
|
|
1129
|
-
/** Dark variant (auto-generated if not provided) */
|
|
1130
|
-
dark?: string;
|
|
1131
|
-
/** Contrast text color (auto-generated if not provided) */
|
|
1132
|
-
contrastText?: string;
|
|
1133
|
-
}
|
|
1050
|
+
type ThemeDefinition = CSSThemeDefinition | JSThemeDefinition;
|
|
1134
1051
|
/**
|
|
1135
|
-
*
|
|
1052
|
+
* Build configuration (migrated from theme.config.ts)
|
|
1136
1053
|
*/
|
|
1137
|
-
interface
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
/** Warning color configuration */
|
|
1145
|
-
warning?: Partial<PaletteColor> | string;
|
|
1146
|
-
/** Info color configuration */
|
|
1147
|
-
info?: Partial<PaletteColor> | string;
|
|
1148
|
-
/** Success color configuration */
|
|
1149
|
-
success?: Partial<PaletteColor> | string;
|
|
1150
|
-
/** Background colors */
|
|
1151
|
-
background?: {
|
|
1152
|
-
default?: string;
|
|
1153
|
-
subtle?: string;
|
|
1054
|
+
interface BuildConfig {
|
|
1055
|
+
output?: {
|
|
1056
|
+
directory?: string;
|
|
1057
|
+
formats?: {
|
|
1058
|
+
expanded?: string;
|
|
1059
|
+
compressed?: string;
|
|
1060
|
+
};
|
|
1154
1061
|
};
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
disabled?: string;
|
|
1062
|
+
sass?: {
|
|
1063
|
+
style?: 'expanded' | 'compressed';
|
|
1064
|
+
sourceMap?: boolean;
|
|
1065
|
+
loadPaths?: string[];
|
|
1160
1066
|
};
|
|
1161
|
-
/** Additional custom colors */
|
|
1162
|
-
[key: string]: any;
|
|
1163
1067
|
}
|
|
1164
1068
|
/**
|
|
1165
|
-
*
|
|
1069
|
+
* Runtime configuration (migrated from theme.config.ts)
|
|
1166
1070
|
*/
|
|
1167
|
-
interface
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
fontWeightBold?: number;
|
|
1178
|
-
/** Heading configurations */
|
|
1179
|
-
h1?: {
|
|
1180
|
-
fontSize?: string | number;
|
|
1181
|
-
fontWeight?: number;
|
|
1182
|
-
lineHeight?: number | string;
|
|
1183
|
-
letterSpacing?: string;
|
|
1184
|
-
};
|
|
1185
|
-
h2?: {
|
|
1186
|
-
fontSize?: string | number;
|
|
1187
|
-
fontWeight?: number;
|
|
1188
|
-
lineHeight?: number | string;
|
|
1189
|
-
letterSpacing?: string;
|
|
1190
|
-
};
|
|
1191
|
-
h3?: {
|
|
1192
|
-
fontSize?: string | number;
|
|
1193
|
-
fontWeight?: number;
|
|
1194
|
-
lineHeight?: number | string;
|
|
1195
|
-
letterSpacing?: string;
|
|
1196
|
-
};
|
|
1197
|
-
h4?: {
|
|
1198
|
-
fontSize?: string | number;
|
|
1199
|
-
fontWeight?: number;
|
|
1200
|
-
lineHeight?: number | string;
|
|
1201
|
-
letterSpacing?: string;
|
|
1202
|
-
};
|
|
1203
|
-
h5?: {
|
|
1204
|
-
fontSize?: string | number;
|
|
1205
|
-
fontWeight?: number;
|
|
1206
|
-
lineHeight?: number | string;
|
|
1207
|
-
letterSpacing?: string;
|
|
1208
|
-
};
|
|
1209
|
-
h6?: {
|
|
1210
|
-
fontSize?: string | number;
|
|
1211
|
-
fontWeight?: number;
|
|
1212
|
-
lineHeight?: number | string;
|
|
1213
|
-
letterSpacing?: string;
|
|
1214
|
-
};
|
|
1215
|
-
/** Body text configurations */
|
|
1216
|
-
body1?: {
|
|
1217
|
-
fontSize?: string | number;
|
|
1218
|
-
fontWeight?: number;
|
|
1219
|
-
lineHeight?: number | string;
|
|
1220
|
-
};
|
|
1221
|
-
body2?: {
|
|
1222
|
-
fontSize?: string | number;
|
|
1223
|
-
fontWeight?: number;
|
|
1224
|
-
lineHeight?: number | string;
|
|
1225
|
-
};
|
|
1226
|
-
/** Additional custom typography */
|
|
1227
|
-
[key: string]: any;
|
|
1071
|
+
interface RuntimeConfig {
|
|
1072
|
+
basePath?: string;
|
|
1073
|
+
cdnPath?: string | null;
|
|
1074
|
+
preload?: string[];
|
|
1075
|
+
lazy?: boolean;
|
|
1076
|
+
defaultTheme?: string;
|
|
1077
|
+
storageKey?: string;
|
|
1078
|
+
dataAttribute?: string;
|
|
1079
|
+
enablePersistence?: boolean;
|
|
1080
|
+
useMinified?: boolean;
|
|
1228
1081
|
}
|
|
1229
1082
|
/**
|
|
1230
|
-
*
|
|
1083
|
+
* Integration settings (migrated from theme.config.ts)
|
|
1231
1084
|
*/
|
|
1232
|
-
|
|
1085
|
+
interface IntegrationConfig {
|
|
1086
|
+
cssVariables?: Record<string, string>;
|
|
1087
|
+
classNames?: {
|
|
1088
|
+
theme?: string;
|
|
1089
|
+
colorMode?: string;
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1233
1093
|
/**
|
|
1234
|
-
*
|
|
1094
|
+
* Theme Configuration Types
|
|
1095
|
+
*
|
|
1096
|
+
* Type definitions for the theme configuration system
|
|
1235
1097
|
*/
|
|
1236
|
-
|
|
1098
|
+
|
|
1237
1099
|
/**
|
|
1238
|
-
*
|
|
1100
|
+
* Loaded and validated theme configuration
|
|
1239
1101
|
*/
|
|
1240
|
-
interface
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1102
|
+
interface LoadedThemeConfig {
|
|
1103
|
+
/** Registered themes */
|
|
1104
|
+
themes: Record<string, ThemeDefinition>;
|
|
1105
|
+
/** Build configuration */
|
|
1106
|
+
build: BuildConfig;
|
|
1107
|
+
/** Runtime configuration */
|
|
1108
|
+
runtime: RuntimeConfig;
|
|
1109
|
+
/** Integration settings */
|
|
1110
|
+
integration: IntegrationConfig;
|
|
1111
|
+
/** Theme dependencies mapping */
|
|
1112
|
+
dependencies: Record<string, string[]>;
|
|
1113
|
+
/** Whether config was validated */
|
|
1114
|
+
validated: boolean;
|
|
1115
|
+
/** Validation errors (if any) */
|
|
1116
|
+
errors?: string[];
|
|
1117
|
+
/** Validation warnings (if any) */
|
|
1118
|
+
warnings?: string[];
|
|
1119
|
+
/** Internal tokens (for generator) */
|
|
1120
|
+
__tokens?: any;
|
|
1121
|
+
/** Internal extensions (for generator) */
|
|
1122
|
+
__extend?: any;
|
|
1247
1123
|
}
|
|
1124
|
+
|
|
1248
1125
|
/**
|
|
1249
|
-
*
|
|
1126
|
+
* Theme Registry
|
|
1127
|
+
*
|
|
1128
|
+
* Central registry for all themes with discovery and dependency management
|
|
1250
1129
|
*/
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Registry entry
|
|
1133
|
+
*/
|
|
1134
|
+
interface RegistryEntry {
|
|
1135
|
+
/** Theme ID */
|
|
1136
|
+
id: string;
|
|
1137
|
+
/** Theme definition from config */
|
|
1138
|
+
definition: ThemeDefinition;
|
|
1139
|
+
/** Resolved theme object (for JS themes) */
|
|
1140
|
+
theme?: Theme;
|
|
1141
|
+
/** Whether theme is loaded */
|
|
1142
|
+
loaded: boolean;
|
|
1143
|
+
/** Loading promise (if currently loading) */
|
|
1144
|
+
loading?: Promise<Theme | void>;
|
|
1145
|
+
/** Dependencies */
|
|
1146
|
+
dependencies: string[];
|
|
1147
|
+
/** Dependent themes (themes that depend on this one) */
|
|
1148
|
+
dependents: string[];
|
|
1256
1149
|
}
|
|
1257
1150
|
/**
|
|
1258
|
-
*
|
|
1151
|
+
* Theme Registry
|
|
1152
|
+
*
|
|
1153
|
+
* Manages theme registration, discovery, and dependency resolution
|
|
1259
1154
|
*/
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1155
|
+
declare class ThemeRegistry {
|
|
1156
|
+
private entries;
|
|
1157
|
+
private config;
|
|
1158
|
+
private initialized;
|
|
1159
|
+
/**
|
|
1160
|
+
* Initialize registry from config
|
|
1161
|
+
*/
|
|
1162
|
+
initialize(config?: LoadedThemeConfig): Promise<void>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Register a theme
|
|
1165
|
+
*/
|
|
1166
|
+
register(themeId: string, definition: ThemeDefinition): void;
|
|
1167
|
+
/**
|
|
1168
|
+
* Get theme entry
|
|
1169
|
+
*/
|
|
1170
|
+
get(themeId: string): RegistryEntry | undefined;
|
|
1171
|
+
/**
|
|
1172
|
+
* Check if theme exists
|
|
1173
|
+
*/
|
|
1174
|
+
has(themeId: string): boolean;
|
|
1175
|
+
/**
|
|
1176
|
+
* Get all theme IDs
|
|
1177
|
+
*/
|
|
1178
|
+
getAllIds(): string[];
|
|
1179
|
+
/**
|
|
1180
|
+
* Get all theme metadata
|
|
1181
|
+
*/
|
|
1182
|
+
getAllMetadata(): ThemeMetadata[];
|
|
1183
|
+
/**
|
|
1184
|
+
* Get theme definition
|
|
1185
|
+
*/
|
|
1186
|
+
getDefinition(themeId: string): ThemeDefinition | undefined;
|
|
1187
|
+
/**
|
|
1188
|
+
* Check if a theme is loaded
|
|
1189
|
+
*/
|
|
1190
|
+
isThemeLoaded(themeId: string): boolean;
|
|
1191
|
+
/**
|
|
1192
|
+
* Mark a theme as loaded
|
|
1193
|
+
*/
|
|
1194
|
+
markLoaded(themeId: string, theme?: Theme): void;
|
|
1195
|
+
/**
|
|
1196
|
+
* Get theme object (for JS themes)
|
|
1197
|
+
*/
|
|
1198
|
+
getTheme(themeId: string): Theme | undefined;
|
|
1199
|
+
/**
|
|
1200
|
+
* Get dependencies for a theme
|
|
1201
|
+
*/
|
|
1202
|
+
getDependencies(themeId: string): string[];
|
|
1203
|
+
/**
|
|
1204
|
+
* Get dependents for a theme (themes that depend on this one)
|
|
1205
|
+
*/
|
|
1206
|
+
getDependents(themeId: string): string[];
|
|
1207
|
+
/**
|
|
1208
|
+
* Resolve all dependencies in correct order
|
|
1209
|
+
*/
|
|
1210
|
+
resolveDependencyOrder(themeId: string): string[];
|
|
1211
|
+
/**
|
|
1212
|
+
* Resolve dependencies and build dependency graph
|
|
1213
|
+
*/
|
|
1214
|
+
private resolveDependencies;
|
|
1215
|
+
/**
|
|
1216
|
+
* Validate all themes
|
|
1217
|
+
*/
|
|
1218
|
+
validate(): {
|
|
1219
|
+
valid: boolean;
|
|
1220
|
+
errors: string[];
|
|
1221
|
+
};
|
|
1222
|
+
/**
|
|
1223
|
+
* Clear registry
|
|
1224
|
+
*/
|
|
1225
|
+
clear(): void;
|
|
1267
1226
|
}
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* CSS File Utilities
|
|
1230
|
+
*
|
|
1231
|
+
* Save CSS to file system (Node.js only).
|
|
1232
|
+
*/
|
|
1233
|
+
/**
|
|
1234
|
+
* Save CSS to file
|
|
1235
|
+
*
|
|
1236
|
+
* Writes CSS string to a file. Only works in Node.js environment.
|
|
1237
|
+
*
|
|
1238
|
+
* @param css - CSS string to save
|
|
1239
|
+
* @param filePath - Output file path
|
|
1240
|
+
* @throws Error if called in browser environment
|
|
1241
|
+
*
|
|
1242
|
+
* @example
|
|
1243
|
+
* ```typescript
|
|
1244
|
+
* const css = ':root { --atomix-color-primary: #7AFFD7; }';
|
|
1245
|
+
* await saveCSSFile(css, './themes/custom.css');
|
|
1246
|
+
* ```
|
|
1247
|
+
*/
|
|
1248
|
+
declare function saveCSSFile(css: string, filePath: string): Promise<void>;
|
|
1249
|
+
/**
|
|
1250
|
+
* Save CSS to file (synchronous version)
|
|
1251
|
+
*
|
|
1252
|
+
* Synchronous version of saveCSSFile. Only works in Node.js environment.
|
|
1253
|
+
*
|
|
1254
|
+
* @param css - CSS string to save
|
|
1255
|
+
* @param filePath - Output file path
|
|
1256
|
+
* @throws Error if called in browser environment
|
|
1257
|
+
*/
|
|
1258
|
+
declare function saveCSSFileSync(css: string, filePath: string): void;
|
|
1259
|
+
|
|
1268
1260
|
/**
|
|
1269
|
-
*
|
|
1261
|
+
* CSS Injection Utilities
|
|
1262
|
+
*
|
|
1263
|
+
* Inject CSS into HTML head via <style> element.
|
|
1270
1264
|
*/
|
|
1271
|
-
interface TransitionOptions {
|
|
1272
|
-
/** Transition duration values */
|
|
1273
|
-
duration?: {
|
|
1274
|
-
shortest?: number;
|
|
1275
|
-
shorter?: number;
|
|
1276
|
-
short?: number;
|
|
1277
|
-
standard?: number;
|
|
1278
|
-
complex?: number;
|
|
1279
|
-
enteringScreen?: number;
|
|
1280
|
-
leavingScreen?: number;
|
|
1281
|
-
};
|
|
1282
|
-
/** Easing functions */
|
|
1283
|
-
easing?: {
|
|
1284
|
-
easeInOut?: string;
|
|
1285
|
-
easeOut?: string;
|
|
1286
|
-
easeIn?: string;
|
|
1287
|
-
sharp?: string;
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
1265
|
/**
|
|
1291
|
-
*
|
|
1266
|
+
* Inject CSS into HTML head via <style> element
|
|
1267
|
+
*
|
|
1268
|
+
* Creates or updates a style element in the document head.
|
|
1269
|
+
* If an element with the same ID exists, it will be updated.
|
|
1270
|
+
*
|
|
1271
|
+
* @param css - CSS string to inject
|
|
1272
|
+
* @param id - Style element ID (default: 'atomix-theme')
|
|
1273
|
+
*
|
|
1274
|
+
* @example
|
|
1275
|
+
* ```typescript
|
|
1276
|
+
* const css = ':root { --atomix-color-primary: #7AFFD7; }';
|
|
1277
|
+
* injectCSS(css);
|
|
1278
|
+
*
|
|
1279
|
+
* // With custom ID
|
|
1280
|
+
* injectCSS(css, 'my-custom-theme');
|
|
1281
|
+
* ```
|
|
1292
1282
|
*/
|
|
1293
|
-
|
|
1294
|
-
mobileStepper?: number;
|
|
1295
|
-
speedDial?: number;
|
|
1296
|
-
appBar?: number;
|
|
1297
|
-
drawer?: number;
|
|
1298
|
-
modal?: number;
|
|
1299
|
-
snackbar?: number;
|
|
1300
|
-
tooltip?: number;
|
|
1301
|
-
[key: string]: number | undefined;
|
|
1302
|
-
}
|
|
1283
|
+
declare function injectCSS(css: string, id?: string): void;
|
|
1303
1284
|
/**
|
|
1304
|
-
*
|
|
1285
|
+
* Remove injected CSS from DOM
|
|
1286
|
+
*
|
|
1287
|
+
* Removes the style element with the given ID from the document head.
|
|
1288
|
+
*
|
|
1289
|
+
* @param id - Style element ID to remove (default: 'atomix-theme')
|
|
1290
|
+
*
|
|
1291
|
+
* @example
|
|
1292
|
+
* ```typescript
|
|
1293
|
+
* removeCSS(); // Removes default 'atomix-theme'
|
|
1294
|
+
* removeCSS('my-custom-theme'); // Removes custom ID
|
|
1295
|
+
* ```
|
|
1305
1296
|
*/
|
|
1306
|
-
|
|
1307
|
-
/** Base border radius */
|
|
1308
|
-
base?: string | number;
|
|
1309
|
-
/** Small border radius */
|
|
1310
|
-
sm?: string | number;
|
|
1311
|
-
/** Medium border radius */
|
|
1312
|
-
md?: string | number;
|
|
1313
|
-
/** Large border radius */
|
|
1314
|
-
lg?: string | number;
|
|
1315
|
-
/** Extra large border radius */
|
|
1316
|
-
xl?: string | number;
|
|
1317
|
-
/** 2X large border radius */
|
|
1318
|
-
xxl?: string | number;
|
|
1319
|
-
/** 3X large border radius */
|
|
1320
|
-
'3xl'?: string | number;
|
|
1321
|
-
/** 4X large border radius */
|
|
1322
|
-
'4xl'?: string | number;
|
|
1323
|
-
/** Pill shape (fully rounded) */
|
|
1324
|
-
pill?: string | number;
|
|
1325
|
-
[key: string]: string | number | undefined;
|
|
1326
|
-
}
|
|
1297
|
+
declare function removeCSS(id?: string): void;
|
|
1327
1298
|
/**
|
|
1328
|
-
*
|
|
1329
|
-
*
|
|
1299
|
+
* Check if CSS is already injected
|
|
1300
|
+
*
|
|
1301
|
+
* @param id - Style element ID to check (default: 'atomix-theme')
|
|
1302
|
+
* @returns True if style element exists
|
|
1330
1303
|
*/
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
}
|
|
1304
|
+
declare function isCSSInjected(id?: string): boolean;
|
|
1305
|
+
|
|
1334
1306
|
/**
|
|
1335
|
-
*
|
|
1336
|
-
*
|
|
1307
|
+
* Config Loader
|
|
1308
|
+
*
|
|
1309
|
+
* Load design tokens from atomix.config.ts and convert to flat token format.
|
|
1337
1310
|
*/
|
|
1338
|
-
|
|
1339
|
-
/** Color palette configuration */
|
|
1340
|
-
palette?: PaletteOptions;
|
|
1341
|
-
/** Typography configuration */
|
|
1342
|
-
typography?: TypographyOptions;
|
|
1343
|
-
/** Spacing configuration */
|
|
1344
|
-
spacing?: SpacingOptions;
|
|
1345
|
-
/** Breakpoints configuration */
|
|
1346
|
-
breakpoints?: BreakpointsOptions;
|
|
1347
|
-
/** Shadow configuration */
|
|
1348
|
-
shadows?: ShadowOptions;
|
|
1349
|
-
/** Transition configuration */
|
|
1350
|
-
transitions?: TransitionOptions;
|
|
1351
|
-
/** Z-index configuration */
|
|
1352
|
-
zIndex?: ZIndexOptions;
|
|
1353
|
-
/** Border radius configuration */
|
|
1354
|
-
borderRadius?: BorderRadiusOptions;
|
|
1355
|
-
/** Custom properties */
|
|
1356
|
-
custom?: ThemeCustomProperties;
|
|
1357
|
-
}
|
|
1311
|
+
|
|
1358
1312
|
/**
|
|
1359
|
-
*
|
|
1360
|
-
*
|
|
1313
|
+
* Load theme tokens from atomix.config.ts
|
|
1314
|
+
*
|
|
1315
|
+
* Loads atomix.config.ts and extracts theme tokens.
|
|
1316
|
+
* Config file is required - throws error if not found.
|
|
1317
|
+
*
|
|
1318
|
+
* @param configPath - Optional custom config path (default: 'atomix.config.ts')
|
|
1319
|
+
* @returns Partial DesignTokens from config
|
|
1320
|
+
* @throws Error if config file is not found or cannot be loaded
|
|
1321
|
+
*
|
|
1322
|
+
* @example
|
|
1323
|
+
* ```typescript
|
|
1324
|
+
* const tokens = await loadThemeFromConfig();
|
|
1325
|
+
* const css = createTheme(tokens);
|
|
1326
|
+
* injectTheme(css);
|
|
1327
|
+
* ```
|
|
1361
1328
|
*/
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
};
|
|
1376
|
-
text: {
|
|
1377
|
-
primary: string;
|
|
1378
|
-
secondary: string;
|
|
1379
|
-
disabled: string;
|
|
1380
|
-
};
|
|
1381
|
-
[key: string]: any;
|
|
1382
|
-
};
|
|
1383
|
-
/** Typography with computed values */
|
|
1384
|
-
typography: {
|
|
1385
|
-
fontFamily: string;
|
|
1386
|
-
fontSize: number;
|
|
1387
|
-
fontWeightLight: number;
|
|
1388
|
-
fontWeightRegular: number;
|
|
1389
|
-
fontWeightMedium: number;
|
|
1390
|
-
fontWeightSemiBold: number;
|
|
1391
|
-
fontWeightBold: number;
|
|
1392
|
-
h1: Required<NonNullable<TypographyOptions['h1']>>;
|
|
1393
|
-
h2: Required<NonNullable<TypographyOptions['h2']>>;
|
|
1394
|
-
h3: Required<NonNullable<TypographyOptions['h3']>>;
|
|
1395
|
-
h4: Required<NonNullable<TypographyOptions['h4']>>;
|
|
1396
|
-
h5: Required<NonNullable<TypographyOptions['h5']>>;
|
|
1397
|
-
h6: Required<NonNullable<TypographyOptions['h6']>>;
|
|
1398
|
-
body1: Required<NonNullable<TypographyOptions['body1']>>;
|
|
1399
|
-
body2: Required<NonNullable<TypographyOptions['body2']>>;
|
|
1400
|
-
[key: string]: any;
|
|
1401
|
-
};
|
|
1402
|
-
/** Spacing function */
|
|
1403
|
-
spacing: SpacingFunction;
|
|
1404
|
-
/** Breakpoints with computed values */
|
|
1405
|
-
breakpoints: {
|
|
1406
|
-
values: Required<BreakpointValues>;
|
|
1407
|
-
unit: string;
|
|
1408
|
-
up: (key: keyof BreakpointValues | number) => string;
|
|
1409
|
-
down: (key: keyof BreakpointValues | number) => string;
|
|
1410
|
-
between: (start: keyof BreakpointValues | number, end: keyof BreakpointValues | number) => string;
|
|
1411
|
-
};
|
|
1412
|
-
/** Shadows */
|
|
1413
|
-
shadows: Required<ShadowOptions>;
|
|
1414
|
-
/** Transitions */
|
|
1415
|
-
transitions: Required<TransitionOptions>;
|
|
1416
|
-
/** Z-index values */
|
|
1417
|
-
zIndex: Required<ZIndexOptions>;
|
|
1418
|
-
/** Border radius values */
|
|
1419
|
-
borderRadius: Required<BorderRadiusOptions>;
|
|
1420
|
-
/** Custom properties */
|
|
1421
|
-
custom: ThemeCustomProperties;
|
|
1422
|
-
/** Global CSS variables to apply */
|
|
1423
|
-
cssVars?: Record<string, string | number>;
|
|
1424
|
-
/** Indicates this is a JS theme (not CSS-only) */
|
|
1425
|
-
__isJSTheme: true;
|
|
1426
|
-
}
|
|
1329
|
+
declare function loadThemeFromConfig(configPath?: string): Promise<Partial<DesignTokens>>;
|
|
1330
|
+
/**
|
|
1331
|
+
* Load theme tokens from atomix.config.ts (synchronous version)
|
|
1332
|
+
*
|
|
1333
|
+
* Synchronous version that uses require() instead of dynamic import.
|
|
1334
|
+
* Only works in Node.js environment.
|
|
1335
|
+
* Config file is required - throws error if not found.
|
|
1336
|
+
*
|
|
1337
|
+
* @param configPath - Optional custom config path
|
|
1338
|
+
* @returns Partial DesignTokens from config
|
|
1339
|
+
* @throws Error if config file is not found or cannot be loaded
|
|
1340
|
+
*/
|
|
1341
|
+
declare function loadThemeFromConfigSync(configPath?: string): Partial<DesignTokens>;
|
|
1427
1342
|
|
|
1428
1343
|
/**
|
|
1429
1344
|
* Theme Provider
|
|
1430
1345
|
*
|
|
1431
1346
|
* React context provider for theme management
|
|
1432
|
-
* Updated to use the new ThemeEngine architecture
|
|
1433
1347
|
*/
|
|
1434
1348
|
|
|
1435
1349
|
/**
|
|
1436
1350
|
* ThemeProvider component
|
|
1437
1351
|
*
|
|
1438
1352
|
* Provides theme context to child components and manages theme state.
|
|
1439
|
-
*
|
|
1353
|
+
*
|
|
1354
|
+
* **Config-First Approach**: If `defaultTheme` is not provided, loads from `atomix.config.ts`.
|
|
1355
|
+
* Config file is required when `defaultTheme` is not provided.
|
|
1440
1356
|
*
|
|
1441
1357
|
* @example
|
|
1442
1358
|
* ```tsx
|
|
1443
1359
|
* import { ThemeProvider } from '@shohojdhara/atomix/theme';
|
|
1444
1360
|
*
|
|
1361
|
+
* // Loads from atomix.config.ts (config file required)
|
|
1445
1362
|
* function App() {
|
|
1446
1363
|
* return (
|
|
1447
1364
|
* <ThemeProvider>
|
|
@@ -1449,6 +1366,15 @@ interface Theme extends ThemeMetadata {
|
|
|
1449
1366
|
* </ThemeProvider>
|
|
1450
1367
|
* );
|
|
1451
1368
|
* }
|
|
1369
|
+
*
|
|
1370
|
+
* // Provide explicit theme (bypasses config)
|
|
1371
|
+
* function App() {
|
|
1372
|
+
* return (
|
|
1373
|
+
* <ThemeProvider defaultTheme="dark">
|
|
1374
|
+
* <YourApp />
|
|
1375
|
+
* </ThemeProvider>
|
|
1376
|
+
* );
|
|
1377
|
+
* }
|
|
1452
1378
|
* ```
|
|
1453
1379
|
*/
|
|
1454
1380
|
declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
|
|
@@ -1457,7 +1383,6 @@ declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
|
|
|
1457
1383
|
* useTheme Hook
|
|
1458
1384
|
*
|
|
1459
1385
|
* React hook for accessing theme context
|
|
1460
|
-
* Updated to work with new ThemeEngine architecture
|
|
1461
1386
|
*/
|
|
1462
1387
|
|
|
1463
1388
|
/**
|
|
@@ -1514,185 +1439,103 @@ interface ThemeErrorBoundaryProps {
|
|
|
1514
1439
|
children: ReactNode;
|
|
1515
1440
|
/** Fallback UI to render when error occurs */
|
|
1516
1441
|
fallback?: (error: Error, errorInfo: ErrorInfo) => ReactNode;
|
|
1517
|
-
/** Callback when error occurs */
|
|
1518
|
-
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
1519
|
-
/** Whether to reset error on children change */
|
|
1520
|
-
resetOnPropsChange?: boolean;
|
|
1521
|
-
/** Custom error message */
|
|
1522
|
-
errorMessage?: string;
|
|
1523
|
-
}
|
|
1524
|
-
/**
|
|
1525
|
-
* Theme Error Boundary Component
|
|
1526
|
-
*
|
|
1527
|
-
* Catches errors in the theme system and displays a fallback UI
|
|
1528
|
-
* instead of crashing the entire application.
|
|
1529
|
-
*/
|
|
1530
|
-
declare class ThemeErrorBoundary extends Component<ThemeErrorBoundaryProps, ThemeErrorBoundaryState> {
|
|
1531
|
-
private logger;
|
|
1532
|
-
constructor(props: ThemeErrorBoundaryProps);
|
|
1533
|
-
static getDerivedStateFromError(error: Error): Partial<ThemeErrorBoundaryState>;
|
|
1534
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
1535
|
-
componentDidUpdate(prevProps: ThemeErrorBoundaryProps): void;
|
|
1536
|
-
render(): ReactNode;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
/**
|
|
1540
|
-
* createTheme - Create a theme object with computed values
|
|
1541
|
-
*
|
|
1542
|
-
* Similar to Material-UI's createTheme, this function accepts theme configuration
|
|
1543
|
-
* options and returns a complete theme object with computed values.
|
|
1544
|
-
*
|
|
1545
|
-
* @example
|
|
1546
|
-
* ```typescript
|
|
1547
|
-
* const theme = createTheme({
|
|
1548
|
-
* palette: {
|
|
1549
|
-
* primary: { main: '#7AFFD7' },
|
|
1550
|
-
* secondary: { main: '#FF5733' },
|
|
1551
|
-
* },
|
|
1552
|
-
* typography: {
|
|
1553
|
-
* fontFamily: 'Inter, sans-serif',
|
|
1554
|
-
* },
|
|
1555
|
-
* });
|
|
1556
|
-
* ```
|
|
1557
|
-
*/
|
|
1558
|
-
|
|
1559
|
-
/**
|
|
1560
|
-
* Create a theme object with computed values
|
|
1561
|
-
*
|
|
1562
|
-
* @param options - Theme configuration options
|
|
1563
|
-
* @returns Complete theme object
|
|
1564
|
-
*/
|
|
1565
|
-
declare function createTheme(...options: ThemeOptions[]): Theme;
|
|
1566
|
-
|
|
1567
|
-
/**
|
|
1568
|
-
* Create a theme from Atomix configuration
|
|
1569
|
-
*
|
|
1570
|
-
* This function converts atomix.config.ts format to a theme object
|
|
1571
|
-
* that can be used with ThemeProvider.
|
|
1572
|
-
*
|
|
1573
|
-
* @param config - Atomix configuration object
|
|
1574
|
-
* @returns Theme object ready for use
|
|
1575
|
-
*
|
|
1576
|
-
* @example
|
|
1577
|
-
* ```typescript
|
|
1578
|
-
* import { createThemeFromConfig } from '@shohojdhara/atomix/theme';
|
|
1579
|
-
* import config from './atomix.config';
|
|
1580
|
-
*
|
|
1581
|
-
* const theme = createThemeFromConfig(config);
|
|
1582
|
-
* ```
|
|
1583
|
-
*/
|
|
1584
|
-
declare function createThemeFromConfig(config: AtomixConfig): Theme;
|
|
1585
|
-
|
|
1586
|
-
/**
|
|
1587
|
-
* Theme Tools for Library Users
|
|
1588
|
-
*
|
|
1589
|
-
* Developer-friendly utilities for working with Atomix themes
|
|
1590
|
-
*/
|
|
1591
|
-
|
|
1592
|
-
/**
|
|
1593
|
-
* Quick theme creator with sensible defaults
|
|
1594
|
-
*/
|
|
1595
|
-
declare function quickTheme(name: string, primaryColor: string, secondaryColor?: string): Theme;
|
|
1596
|
-
/**
|
|
1597
|
-
* Create a dark theme variant from a light theme
|
|
1598
|
-
*/
|
|
1599
|
-
declare function createDarkVariant(lightTheme: Theme): Theme;
|
|
1600
|
-
/**
|
|
1601
|
-
* Validate theme structure
|
|
1602
|
-
*/
|
|
1603
|
-
declare function validateTheme(theme: Theme): {
|
|
1604
|
-
valid: boolean;
|
|
1605
|
-
errors: string[];
|
|
1606
|
-
};
|
|
1607
|
-
/**
|
|
1608
|
-
* Generate CSS string from theme
|
|
1609
|
-
*/
|
|
1610
|
-
declare function themeToCSS(theme: Theme, selector?: string): string;
|
|
1611
|
-
/**
|
|
1612
|
-
* Export theme as JSON
|
|
1613
|
-
*/
|
|
1614
|
-
declare function exportTheme(theme: Theme): string;
|
|
1442
|
+
/** Callback when error occurs */
|
|
1443
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
1444
|
+
/** Whether to reset error on children change */
|
|
1445
|
+
resetOnPropsChange?: boolean;
|
|
1446
|
+
/** Custom error message */
|
|
1447
|
+
errorMessage?: string;
|
|
1448
|
+
}
|
|
1615
1449
|
/**
|
|
1616
|
-
*
|
|
1450
|
+
* Theme Error Boundary Component
|
|
1451
|
+
*
|
|
1452
|
+
* Catches errors in the theme system and displays a fallback UI
|
|
1453
|
+
* instead of crashing the entire application.
|
|
1617
1454
|
*/
|
|
1618
|
-
declare
|
|
1455
|
+
declare class ThemeErrorBoundary extends Component<ThemeErrorBoundaryProps, ThemeErrorBoundaryState> {
|
|
1456
|
+
private logger;
|
|
1457
|
+
constructor(props: ThemeErrorBoundaryProps);
|
|
1458
|
+
static getDerivedStateFromError(error: Error): Partial<ThemeErrorBoundaryState>;
|
|
1459
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
1460
|
+
componentDidUpdate(prevProps: ThemeErrorBoundaryProps): void;
|
|
1461
|
+
render(): ReactNode;
|
|
1462
|
+
}
|
|
1619
1463
|
|
|
1620
1464
|
/**
|
|
1621
|
-
* Theme
|
|
1465
|
+
* Theme Applicator
|
|
1622
1466
|
*
|
|
1623
|
-
*
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
*
|
|
1467
|
+
* Applies theme configurations to the DOM, including CSS variables,
|
|
1468
|
+
* component overrides, typography, spacing, and color palettes.
|
|
1469
|
+
*
|
|
1470
|
+
* Uses the unified theme system for CSS generation and injection.
|
|
1627
1471
|
*/
|
|
1628
|
-
|
|
1629
|
-
name: string;
|
|
1630
|
-
description: string;
|
|
1631
|
-
options?: Record<string, string>;
|
|
1632
|
-
handler: (args: string[], options: Record<string, any>) => Promise<void> | void;
|
|
1633
|
-
}
|
|
1472
|
+
|
|
1634
1473
|
/**
|
|
1635
|
-
* Theme
|
|
1474
|
+
* Theme applicator class for runtime theme application
|
|
1636
1475
|
*
|
|
1637
|
-
*
|
|
1476
|
+
* Uses the unified theme system for efficient CSS variable generation and injection.
|
|
1638
1477
|
*/
|
|
1639
|
-
declare class
|
|
1640
|
-
private
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
* Register default commands
|
|
1644
|
-
*/
|
|
1645
|
-
private registerDefaultCommands;
|
|
1478
|
+
declare class ThemeApplicator {
|
|
1479
|
+
private root;
|
|
1480
|
+
private styleId;
|
|
1481
|
+
constructor(root?: HTMLElement);
|
|
1646
1482
|
/**
|
|
1647
|
-
*
|
|
1483
|
+
* Apply a complete theme configuration
|
|
1484
|
+
*
|
|
1485
|
+
* Uses the unified theme system to convert Theme to DesignTokens and inject CSS.
|
|
1486
|
+
* Automatically respects atomix.config.ts when using DesignTokens.
|
|
1648
1487
|
*/
|
|
1649
|
-
|
|
1488
|
+
applyTheme(theme: Theme | DesignTokens): void;
|
|
1650
1489
|
/**
|
|
1651
|
-
*
|
|
1490
|
+
* Apply DesignTokens using unified theme system
|
|
1491
|
+
*
|
|
1492
|
+
* Uses createTheme() which automatically loads from atomix.config.ts
|
|
1493
|
+
* if no tokens are provided, ensuring config is always respected.
|
|
1652
1494
|
*/
|
|
1653
|
-
|
|
1495
|
+
private applyDesignTokens;
|
|
1654
1496
|
/**
|
|
1655
|
-
*
|
|
1497
|
+
* Check if object is DesignTokens
|
|
1656
1498
|
*/
|
|
1657
|
-
private
|
|
1499
|
+
private isDesignTokens;
|
|
1658
1500
|
/**
|
|
1659
|
-
*
|
|
1501
|
+
* Apply global CSS variables (for component overrides)
|
|
1660
1502
|
*/
|
|
1661
|
-
private
|
|
1503
|
+
private applyGlobalCSSVars;
|
|
1662
1504
|
/**
|
|
1663
|
-
*
|
|
1505
|
+
* Apply component-level overrides
|
|
1664
1506
|
*/
|
|
1665
|
-
private
|
|
1507
|
+
private applyComponentOverrides;
|
|
1666
1508
|
/**
|
|
1667
|
-
*
|
|
1509
|
+
* Apply override for a specific component
|
|
1668
1510
|
*/
|
|
1669
|
-
private
|
|
1511
|
+
private applyComponentOverride;
|
|
1670
1512
|
/**
|
|
1671
|
-
*
|
|
1513
|
+
* Clear all applied CSS variables
|
|
1672
1514
|
*/
|
|
1673
|
-
private
|
|
1515
|
+
private clearAppliedVars;
|
|
1674
1516
|
/**
|
|
1675
|
-
*
|
|
1517
|
+
* Remove theme application
|
|
1676
1518
|
*/
|
|
1677
|
-
|
|
1519
|
+
removeTheme(): void;
|
|
1678
1520
|
/**
|
|
1679
|
-
*
|
|
1521
|
+
* Update specific CSS variables without clearing all
|
|
1680
1522
|
*/
|
|
1681
|
-
|
|
1523
|
+
updateCSSVars(vars: Record<string, string | number>): void;
|
|
1682
1524
|
}
|
|
1683
1525
|
/**
|
|
1684
|
-
*
|
|
1526
|
+
* Get or create global theme applicator
|
|
1685
1527
|
*/
|
|
1686
|
-
declare function
|
|
1528
|
+
declare function getThemeApplicator(): ThemeApplicator;
|
|
1687
1529
|
/**
|
|
1688
|
-
*
|
|
1530
|
+
* Apply theme using global applicator
|
|
1689
1531
|
*/
|
|
1690
|
-
declare function
|
|
1532
|
+
declare function applyTheme(theme: Theme): void;
|
|
1691
1533
|
|
|
1692
1534
|
/**
|
|
1693
1535
|
* Theme Preview Component
|
|
1694
1536
|
*
|
|
1695
1537
|
* React component for previewing themes in development
|
|
1538
|
+
* Enhanced with interactive components, viewport controls, and dark mode toggle
|
|
1696
1539
|
*/
|
|
1697
1540
|
|
|
1698
1541
|
/**
|
|
@@ -1727,6 +1570,7 @@ declare const ThemePreview: React__default.FC<ThemePreviewProps>;
|
|
|
1727
1570
|
* Theme Inspector Component
|
|
1728
1571
|
*
|
|
1729
1572
|
* React component for inspecting and debugging themes
|
|
1573
|
+
* Enhanced with search/filter and copy path functionality
|
|
1730
1574
|
*/
|
|
1731
1575
|
|
|
1732
1576
|
/**
|
|
@@ -1757,6 +1601,7 @@ declare const ThemeInspector: React__default.FC<ThemeInspectorProps>;
|
|
|
1757
1601
|
* Theme Comparator Component
|
|
1758
1602
|
*
|
|
1759
1603
|
* React component for comparing two themes side-by-side
|
|
1604
|
+
* Enhanced with search/filter and improved visual diff styling
|
|
1760
1605
|
*/
|
|
1761
1606
|
|
|
1762
1607
|
/**
|
|
@@ -1785,6 +1630,7 @@ declare const ThemeComparator: React__default.FC<ThemeComparatorProps>;
|
|
|
1785
1630
|
* Theme Live Editor Component
|
|
1786
1631
|
*
|
|
1787
1632
|
* React component for live editing themes in development
|
|
1633
|
+
* Enhanced with undo/redo, keyboard shortcuts, resizable layout, and better color pickers
|
|
1788
1634
|
*/
|
|
1789
1635
|
|
|
1790
1636
|
/**
|
|
@@ -1808,76 +1654,185 @@ interface ThemeLiveEditorProps {
|
|
|
1808
1654
|
declare const ThemeLiveEditor: React__default.FC<ThemeLiveEditorProps>;
|
|
1809
1655
|
|
|
1810
1656
|
/**
|
|
1811
|
-
* Theme
|
|
1657
|
+
* Theme Validator
|
|
1812
1658
|
*
|
|
1813
|
-
*
|
|
1814
|
-
* component overrides, typography, spacing, and color palettes.
|
|
1659
|
+
* Runtime theme validation including color contrast and accessibility checks
|
|
1815
1660
|
*/
|
|
1816
1661
|
|
|
1817
1662
|
/**
|
|
1818
|
-
*
|
|
1663
|
+
* Validation result
|
|
1819
1664
|
*/
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1665
|
+
interface ValidationResult {
|
|
1666
|
+
/** Whether theme is valid */
|
|
1667
|
+
valid: boolean;
|
|
1668
|
+
/** Validation errors */
|
|
1669
|
+
errors: string[];
|
|
1670
|
+
/** Validation warnings */
|
|
1671
|
+
warnings: string[];
|
|
1672
|
+
/** Accessibility issues */
|
|
1673
|
+
a11yIssues: A11yIssue[];
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Accessibility issue
|
|
1677
|
+
*/
|
|
1678
|
+
interface A11yIssue {
|
|
1679
|
+
/** Issue type */
|
|
1680
|
+
type: 'contrast' | 'color' | 'missing';
|
|
1681
|
+
/** Severity */
|
|
1682
|
+
severity: 'error' | 'warning';
|
|
1683
|
+
/** Issue message */
|
|
1684
|
+
message: string;
|
|
1685
|
+
/** Affected property */
|
|
1686
|
+
property?: string;
|
|
1687
|
+
/** Current value */
|
|
1688
|
+
value?: string;
|
|
1689
|
+
/** Recommended value */
|
|
1690
|
+
recommended?: string;
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Theme Validator
|
|
1694
|
+
*
|
|
1695
|
+
* Validates themes for correctness and accessibility
|
|
1696
|
+
*/
|
|
1697
|
+
declare class ThemeValidator {
|
|
1824
1698
|
/**
|
|
1825
|
-
*
|
|
1699
|
+
* Validate theme
|
|
1826
1700
|
*/
|
|
1827
|
-
|
|
1701
|
+
validate(theme: Theme, metadata?: ThemeMetadata): ValidationResult;
|
|
1828
1702
|
/**
|
|
1829
|
-
*
|
|
1703
|
+
* Validate palette
|
|
1830
1704
|
*/
|
|
1831
|
-
private
|
|
1705
|
+
private validatePalette;
|
|
1832
1706
|
/**
|
|
1833
|
-
*
|
|
1707
|
+
* Validate typography
|
|
1834
1708
|
*/
|
|
1835
|
-
private
|
|
1709
|
+
private validateTypography;
|
|
1836
1710
|
/**
|
|
1837
|
-
*
|
|
1711
|
+
* Validate spacing
|
|
1838
1712
|
*/
|
|
1839
|
-
private
|
|
1713
|
+
private validateSpacing;
|
|
1840
1714
|
/**
|
|
1841
|
-
*
|
|
1715
|
+
* Validate breakpoints
|
|
1842
1716
|
*/
|
|
1843
|
-
private
|
|
1717
|
+
private validateBreakpoints;
|
|
1844
1718
|
/**
|
|
1845
|
-
*
|
|
1719
|
+
* Check color contrast ratio
|
|
1846
1720
|
*/
|
|
1847
|
-
private
|
|
1721
|
+
private checkContrast;
|
|
1848
1722
|
/**
|
|
1849
|
-
*
|
|
1723
|
+
* Check if color is valid
|
|
1850
1724
|
*/
|
|
1851
|
-
private
|
|
1725
|
+
private isValidColor;
|
|
1852
1726
|
/**
|
|
1853
|
-
*
|
|
1727
|
+
* Validate transitions
|
|
1854
1728
|
*/
|
|
1855
|
-
private
|
|
1729
|
+
private validateTransitions;
|
|
1856
1730
|
/**
|
|
1857
|
-
*
|
|
1731
|
+
* Validate z-index
|
|
1858
1732
|
*/
|
|
1859
|
-
|
|
1733
|
+
private validateZIndex;
|
|
1860
1734
|
/**
|
|
1861
|
-
*
|
|
1735
|
+
* Validate border radius
|
|
1862
1736
|
*/
|
|
1863
|
-
|
|
1737
|
+
private validateBorderRadius;
|
|
1864
1738
|
/**
|
|
1865
|
-
*
|
|
1739
|
+
* Validate custom properties
|
|
1866
1740
|
*/
|
|
1867
|
-
|
|
1741
|
+
private validateCustom;
|
|
1868
1742
|
}
|
|
1743
|
+
|
|
1869
1744
|
/**
|
|
1870
|
-
*
|
|
1745
|
+
* useHistory Hook
|
|
1746
|
+
*
|
|
1747
|
+
* React hook for managing undo/redo history
|
|
1871
1748
|
*/
|
|
1872
|
-
|
|
1749
|
+
interface UseHistoryOptions {
|
|
1750
|
+
/** Maximum number of history entries (default: 50) */
|
|
1751
|
+
maxHistorySize?: number;
|
|
1752
|
+
/** Initial state */
|
|
1753
|
+
initialState?: any;
|
|
1754
|
+
}
|
|
1755
|
+
interface UseHistoryReturn<T> {
|
|
1756
|
+
/** Current state */
|
|
1757
|
+
state: T;
|
|
1758
|
+
/** Update state and add to history */
|
|
1759
|
+
setState: (newState: T) => void;
|
|
1760
|
+
/** Undo last change */
|
|
1761
|
+
undo: () => void;
|
|
1762
|
+
/** Redo last undone change */
|
|
1763
|
+
redo: () => void;
|
|
1764
|
+
/** Check if undo is available */
|
|
1765
|
+
canUndo: boolean;
|
|
1766
|
+
/** Check if redo is available */
|
|
1767
|
+
canRedo: boolean;
|
|
1768
|
+
/** Clear history */
|
|
1769
|
+
clearHistory: () => void;
|
|
1770
|
+
/** Get history statistics */
|
|
1771
|
+
getHistoryStats: () => {
|
|
1772
|
+
currentIndex: number;
|
|
1773
|
+
totalEntries: number;
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1873
1776
|
/**
|
|
1874
|
-
*
|
|
1777
|
+
* useHistory hook
|
|
1778
|
+
*
|
|
1779
|
+
* Provides undo/redo functionality for state management
|
|
1780
|
+
*
|
|
1781
|
+
* @example
|
|
1782
|
+
* ```tsx
|
|
1783
|
+
* const { state, setState, undo, redo, canUndo, canRedo } = useHistory({
|
|
1784
|
+
* initialState: theme,
|
|
1785
|
+
* maxHistorySize: 50
|
|
1786
|
+
* });
|
|
1787
|
+
* ```
|
|
1875
1788
|
*/
|
|
1876
|
-
declare function
|
|
1789
|
+
declare function useHistory<T>(options?: UseHistoryOptions): UseHistoryReturn<T>;
|
|
1790
|
+
|
|
1791
|
+
/**
|
|
1792
|
+
* Theme Adapter
|
|
1793
|
+
*
|
|
1794
|
+
* Converts between Theme objects and DesignTokens.
|
|
1795
|
+
*/
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* Convert Theme object to DesignTokens
|
|
1799
|
+
*
|
|
1800
|
+
* Extracts values from a Theme object and converts them to flat DesignTokens format.
|
|
1801
|
+
*
|
|
1802
|
+
* @param theme - Theme object to convert
|
|
1803
|
+
* @returns Partial DesignTokens object
|
|
1804
|
+
*
|
|
1805
|
+
* @example
|
|
1806
|
+
* ```typescript
|
|
1807
|
+
* const theme = createTheme({ palette: { primary: { main: '#7c3aed' } } });
|
|
1808
|
+
* const tokens = themeToDesignTokens(theme);
|
|
1809
|
+
* // Returns: { 'primary': '#7c3aed', ... }
|
|
1810
|
+
* ```
|
|
1811
|
+
*/
|
|
1812
|
+
declare function themeToDesignTokens(theme: Theme): Partial<DesignTokens>;
|
|
1813
|
+
/**
|
|
1814
|
+
* Convert DesignTokens to Theme-compatible CSS variables
|
|
1815
|
+
*
|
|
1816
|
+
* @param tokens - DesignTokens object
|
|
1817
|
+
* @returns CSS variables object compatible with Theme.cssVars
|
|
1818
|
+
*/
|
|
1819
|
+
declare function designTokensToCSSVars(tokens: Partial<DesignTokens>): Record<string, string>;
|
|
1820
|
+
/**
|
|
1821
|
+
* Create DesignTokens from Theme with defaults
|
|
1822
|
+
*
|
|
1823
|
+
* Converts a Theme to DesignTokens and merges with default tokens.
|
|
1824
|
+
*
|
|
1825
|
+
* @param theme - Theme object to convert
|
|
1826
|
+
* @returns Complete DesignTokens object
|
|
1827
|
+
*/
|
|
1828
|
+
declare function createDesignTokensFromTheme(theme: Theme): DesignTokens;
|
|
1877
1829
|
/**
|
|
1878
|
-
*
|
|
1830
|
+
* Create a minimal Theme object from DesignTokens
|
|
1831
|
+
*
|
|
1832
|
+
* @param tokens - DesignTokens to convert
|
|
1833
|
+
* @returns Minimal Theme object with cssVars populated
|
|
1879
1834
|
*/
|
|
1880
|
-
declare function
|
|
1835
|
+
declare function designTokensToTheme(tokens: Partial<DesignTokens>): Partial<Theme>;
|
|
1881
1836
|
|
|
1882
1837
|
/**
|
|
1883
1838
|
* CSS Variable Mapper
|
|
@@ -1988,5 +1943,180 @@ declare function isValidCSSVariableName(name: string): boolean;
|
|
|
1988
1943
|
*/
|
|
1989
1944
|
declare function extractComponentName(varName: string, prefix?: string): string | null;
|
|
1990
1945
|
|
|
1991
|
-
|
|
1992
|
-
|
|
1946
|
+
/**
|
|
1947
|
+
* Theme Helper Functions
|
|
1948
|
+
*
|
|
1949
|
+
* Utility functions for working with themes and DesignTokens
|
|
1950
|
+
*/
|
|
1951
|
+
|
|
1952
|
+
/**
|
|
1953
|
+
* Get DesignTokens from current theme
|
|
1954
|
+
*
|
|
1955
|
+
* Converts a Theme object to DesignTokens. Useful when you need to
|
|
1956
|
+
* work with DesignTokens but have a Theme object.
|
|
1957
|
+
*
|
|
1958
|
+
* @param theme - Theme object to convert
|
|
1959
|
+
* @returns DesignTokens object
|
|
1960
|
+
*
|
|
1961
|
+
* @example
|
|
1962
|
+
* ```typescript
|
|
1963
|
+
* // If you have a Theme object, convert it to DesignTokens
|
|
1964
|
+
* const tokens = getDesignTokensFromTheme(theme);
|
|
1965
|
+
* // Now you can use tokens with unified theme system
|
|
1966
|
+
* const css = createTheme(tokens);
|
|
1967
|
+
* ```
|
|
1968
|
+
*/
|
|
1969
|
+
declare function getDesignTokensFromTheme(theme: Theme | null): DesignTokens | null;
|
|
1970
|
+
/**
|
|
1971
|
+
* Check if a value is DesignTokens
|
|
1972
|
+
*
|
|
1973
|
+
* Type guard to check if an object is DesignTokens format.
|
|
1974
|
+
*
|
|
1975
|
+
* @param value - Value to check
|
|
1976
|
+
* @returns True if value is DesignTokens
|
|
1977
|
+
*/
|
|
1978
|
+
declare function isDesignTokens(value: unknown): value is DesignTokens;
|
|
1979
|
+
/**
|
|
1980
|
+
* Check if a value is a Theme object
|
|
1981
|
+
*
|
|
1982
|
+
* Type guard to check if an object is a Theme.
|
|
1983
|
+
*
|
|
1984
|
+
* @param value - Value to check
|
|
1985
|
+
* @returns True if value is Theme
|
|
1986
|
+
*/
|
|
1987
|
+
declare function isThemeObject(value: unknown): value is Theme;
|
|
1988
|
+
|
|
1989
|
+
/**
|
|
1990
|
+
* RTL (Right-to-Left) Support Utilities
|
|
1991
|
+
*
|
|
1992
|
+
* Provides utilities for managing RTL text direction in themes
|
|
1993
|
+
*/
|
|
1994
|
+
/**
|
|
1995
|
+
* RTL configuration options
|
|
1996
|
+
*/
|
|
1997
|
+
interface RTLConfig {
|
|
1998
|
+
/** Enable RTL mode */
|
|
1999
|
+
enabled: boolean;
|
|
2000
|
+
/** Current direction ('ltr' | 'rtl') */
|
|
2001
|
+
direction: 'ltr' | 'rtl';
|
|
2002
|
+
/** Data attribute name for direction */
|
|
2003
|
+
dataAttribute?: string;
|
|
2004
|
+
/** Auto-detect from locale */
|
|
2005
|
+
autoDetect?: boolean;
|
|
2006
|
+
/** Locale code (e.g., 'ar', 'he', 'fa') */
|
|
2007
|
+
locale?: string;
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* RTL Manager
|
|
2011
|
+
*
|
|
2012
|
+
* Manages RTL text direction for the theme system
|
|
2013
|
+
*/
|
|
2014
|
+
declare class RTLManager {
|
|
2015
|
+
private config;
|
|
2016
|
+
private listeners;
|
|
2017
|
+
constructor(config?: Partial<RTLConfig>);
|
|
2018
|
+
/**
|
|
2019
|
+
* Detect locale from browser
|
|
2020
|
+
*/
|
|
2021
|
+
private detectLocale;
|
|
2022
|
+
/**
|
|
2023
|
+
* Check if locale is RTL
|
|
2024
|
+
*/
|
|
2025
|
+
isRTLLocale(locale: string): boolean;
|
|
2026
|
+
/**
|
|
2027
|
+
* Get current direction
|
|
2028
|
+
*/
|
|
2029
|
+
getDirection(): 'ltr' | 'rtl';
|
|
2030
|
+
/**
|
|
2031
|
+
* Check if RTL is enabled
|
|
2032
|
+
*/
|
|
2033
|
+
isEnabled(): boolean;
|
|
2034
|
+
/**
|
|
2035
|
+
* Set direction
|
|
2036
|
+
*/
|
|
2037
|
+
setDirection(direction: 'ltr' | 'rtl'): void;
|
|
2038
|
+
/**
|
|
2039
|
+
* Toggle direction
|
|
2040
|
+
*/
|
|
2041
|
+
toggleDirection(): 'ltr' | 'rtl';
|
|
2042
|
+
/**
|
|
2043
|
+
* Enable RTL
|
|
2044
|
+
*/
|
|
2045
|
+
enable(): void;
|
|
2046
|
+
/**
|
|
2047
|
+
* Disable RTL
|
|
2048
|
+
*/
|
|
2049
|
+
disable(): void;
|
|
2050
|
+
/**
|
|
2051
|
+
* Set locale and auto-adjust direction
|
|
2052
|
+
*/
|
|
2053
|
+
setLocale(locale: string): void;
|
|
2054
|
+
/**
|
|
2055
|
+
* Get current locale
|
|
2056
|
+
*/
|
|
2057
|
+
getLocale(): string | undefined;
|
|
2058
|
+
/**
|
|
2059
|
+
* Apply direction to DOM
|
|
2060
|
+
*/
|
|
2061
|
+
private applyDirection;
|
|
2062
|
+
/**
|
|
2063
|
+
* Add direction change listener
|
|
2064
|
+
*/
|
|
2065
|
+
onDirectionChange(callback: (direction: 'ltr' | 'rtl') => void): () => void;
|
|
2066
|
+
/**
|
|
2067
|
+
* Notify listeners of direction change
|
|
2068
|
+
*/
|
|
2069
|
+
private notifyListeners;
|
|
2070
|
+
/**
|
|
2071
|
+
* Get RTL-aware value
|
|
2072
|
+
*
|
|
2073
|
+
* Returns different values based on direction
|
|
2074
|
+
*/
|
|
2075
|
+
getValue<T>(ltrValue: T, rtlValue: T): T;
|
|
2076
|
+
/**
|
|
2077
|
+
* Get RTL-aware CSS property
|
|
2078
|
+
*
|
|
2079
|
+
* Returns appropriate CSS property based on direction
|
|
2080
|
+
*/
|
|
2081
|
+
getCSSProperty(property: string): string;
|
|
2082
|
+
/**
|
|
2083
|
+
* Destroy RTL manager
|
|
2084
|
+
*/
|
|
2085
|
+
destroy(): void;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* Theme System Exports
|
|
2090
|
+
*
|
|
2091
|
+
* Unified theme system - handles both DesignTokens and Theme objects.
|
|
2092
|
+
*
|
|
2093
|
+
* @example
|
|
2094
|
+
* ```typescript
|
|
2095
|
+
* import { createTheme, injectTheme } from '@shohojdhara/atomix/theme';
|
|
2096
|
+
*
|
|
2097
|
+
* // Using DesignTokens (recommended - flat structure)
|
|
2098
|
+
* const css = createTheme({ 'primary': '#7AFFD7', 'spacing-4': '1rem' });
|
|
2099
|
+
* injectTheme(css);
|
|
2100
|
+
*
|
|
2101
|
+
* // Or use with ThemeProvider
|
|
2102
|
+
* import { ThemeProvider } from '@shohojdhara/atomix/theme';
|
|
2103
|
+
* const tokens = { 'primary': '#7c3aed' };
|
|
2104
|
+
* <ThemeProvider defaultTheme={tokens}>...</ThemeProvider>
|
|
2105
|
+
* ```
|
|
2106
|
+
*/
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* Inject theme CSS into DOM
|
|
2110
|
+
*/
|
|
2111
|
+
declare function injectTheme(css: string, id?: string): void;
|
|
2112
|
+
/**
|
|
2113
|
+
* Remove theme from DOM
|
|
2114
|
+
*/
|
|
2115
|
+
declare function removeTheme(id?: string): void;
|
|
2116
|
+
/**
|
|
2117
|
+
* Save theme to CSS file
|
|
2118
|
+
*/
|
|
2119
|
+
declare function saveTheme(css: string, filePath: string): Promise<void>;
|
|
2120
|
+
|
|
2121
|
+
export { RTLManager, ThemeApplicator, ThemeComparator, ThemeContext, ThemeErrorBoundary, ThemeInspector, ThemeLiveEditor, ThemePreview, ThemeProvider, ThemeRegistry, ThemeValidator, applyCSSVariables, applyTheme, createDesignTokensFromTheme, createTheme, createThemeObject, createTokens, cssVarsToStyle, deepMerge, defaultTokens, designTokensToCSSVars, designTokensToTheme, extendTheme, extractComponentName, generateCSSVariableName, generateCSSVariables, generateCSSVariablesForSelector, generateComponentCSSVars, getCSSVariable, getDesignTokensFromTheme, getThemeApplicator, injectCSS, injectTheme, isCSSInjected, isDesignTokens, isThemeObject, isValidCSSVariableName, loadThemeFromConfig, loadThemeFromConfigSync, mapSCSSTokensToCSSVars, mergeCSSVars, mergeTheme, removeCSS, removeCSSVariables, removeTheme, saveCSSFile, saveCSSFileSync, saveTheme, themeToDesignTokens, useHistory, useTheme };
|
|
2122
|
+
export type { A11yIssue, CSSVariableConfig, CSSVariableNamingOptions, ComponentThemeOverride, DesignTokens, GenerateCSSVariablesOptions, RTLConfig, Theme, ThemeChangeEvent, ThemeComparatorProps, ThemeComponentOverrides, ThemeContextValue, ThemeErrorBoundaryProps, ThemeInspectorProps, ThemeLiveEditorProps, ThemeLoadOptions, ThemeMetadata, ThemePreviewProps, ThemeProviderProps, ThemeValidationResult, UseHistoryOptions, UseHistoryReturn, UseThemeReturn, ValidationResult };
|