@shohojdhara/atomix 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +69 -166
- package/dist/charts.js.map +1 -1
- package/dist/core.js +184 -263
- package/dist/core.js.map +1 -1
- package/dist/forms.js +55 -131
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +184 -263
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1831 -1657
- package/dist/index.esm.js +4497 -4318
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4510 -4328
- 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 +1431 -1472
- package/dist/theme.js +4175 -4138
- 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 +128 -322
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +12 -5
- 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/Button.tsx +85 -167
- 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 +9 -10
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/config/loader.ts +4 -4
- package/src/lib/constants/components.ts +17 -0
- package/src/lib/hooks/useComponentCustomization.ts +1 -1
- package/src/lib/hooks/usePerformanceMonitor.ts +1 -1
- package/src/lib/hooks/useThemeTokens.ts +105 -0
- 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 +95 -0
- package/src/lib/theme/config/loader.ts +37 -54
- 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} +1 -19
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +75 -266
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +105 -0
- package/src/lib/theme/core/createTheme.ts +108 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +12 -8
- package/src/lib/theme/core/index.ts +19 -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.ts → errors/errors.ts} +1 -1
- 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/generators/generateCSSNested.ts +130 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +3 -13
- package/src/lib/theme/generators/index.ts +25 -0
- package/src/lib/theme/i18n/rtl.ts +5 -6
- package/src/lib/theme/index.ts +149 -19
- package/src/lib/theme/runtime/ThemeApplicator.ts +53 -112
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +5 -5
- package/src/lib/theme/runtime/ThemeProvider.tsx +266 -282
- package/src/lib/theme/runtime/index.ts +2 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/runtime/useThemeTokens.ts +131 -0
- 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/componentTheming.ts +132 -0
- 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/naming.ts +100 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +7 -7
- package/src/lib/theme-tools.ts +7 -8
- package/src/lib/types/components.ts +40 -130
- package/src/lib/utils/componentUtils.ts +2 -2
- package/src/lib/utils/memoryMonitor.ts +3 -3
- package/src/lib/utils/themeNaming.ts +135 -0
- 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/dist/theme.d.ts
CHANGED
|
@@ -2,1462 +2,1202 @@ 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
302
|
/**
|
|
154
|
-
*
|
|
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
|
-
/**
|
|
184
|
-
* CSS Theme Definition
|
|
303
|
+
* Theme metadata interface matching themes.config.js structure
|
|
185
304
|
*/
|
|
186
|
-
interface
|
|
187
|
-
|
|
305
|
+
interface ThemeMetadata$1 {
|
|
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
|
|
352
|
+
* Theme load options
|
|
229
353
|
*/
|
|
230
|
-
|
|
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;
|
|
365
|
+
}
|
|
231
366
|
/**
|
|
232
|
-
*
|
|
367
|
+
* Theme validation result
|
|
233
368
|
*/
|
|
234
|
-
interface
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
};
|
|
242
|
-
sass?: {
|
|
243
|
-
style?: 'expanded' | 'compressed';
|
|
244
|
-
sourceMap?: boolean;
|
|
245
|
-
loadPaths?: string[];
|
|
246
|
-
};
|
|
369
|
+
interface ThemeValidationResult {
|
|
370
|
+
/** Whether the theme is valid */
|
|
371
|
+
valid: boolean;
|
|
372
|
+
/** Validation errors */
|
|
373
|
+
errors: string[];
|
|
374
|
+
/** Validation warnings */
|
|
375
|
+
warnings: string[];
|
|
247
376
|
}
|
|
248
377
|
/**
|
|
249
|
-
*
|
|
378
|
+
* React hook return type for useTheme
|
|
250
379
|
*/
|
|
251
|
-
interface
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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$1[];
|
|
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>;
|
|
261
397
|
}
|
|
262
398
|
/**
|
|
263
|
-
*
|
|
399
|
+
* Component-level theme override configuration
|
|
264
400
|
*/
|
|
265
|
-
interface
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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;
|
|
271
418
|
}
|
|
272
419
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* Tailwind-like configuration for external developers.
|
|
276
|
-
* Focus on theme customization - build/runtime configs are internal only.
|
|
420
|
+
* Theme component overrides for all components
|
|
277
421
|
*/
|
|
278
|
-
interface
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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[]>;
|
|
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;
|
|
322
447
|
}
|
|
323
|
-
|
|
324
448
|
/**
|
|
325
|
-
* Theme
|
|
326
|
-
*
|
|
327
|
-
* Type definitions for the theme configuration system
|
|
449
|
+
* Theme provider props
|
|
328
450
|
*/
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
|
|
332
|
-
*/
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
themes
|
|
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$1>;
|
|
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$1[];
|
|
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
|
-
*
|
|
364
|
-
*/
|
|
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[];
|
|
501
|
+
* Color palette configuration for a single color
|
|
502
|
+
*/
|
|
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;
|
|
453
542
|
}
|
|
454
|
-
|
|
455
543
|
/**
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
* Performance caching layer for loaded themes (CSS and JS)
|
|
544
|
+
* Typography configuration options for createTheme
|
|
459
545
|
*/
|
|
460
|
-
|
|
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
|
+
}
|
|
461
608
|
/**
|
|
462
|
-
*
|
|
609
|
+
* Spacing function type
|
|
463
610
|
*/
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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;
|
|
471
626
|
}
|
|
472
627
|
/**
|
|
473
|
-
*
|
|
628
|
+
* Breakpoints configuration options for createTheme
|
|
474
629
|
*/
|
|
475
|
-
interface
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
timestamp: number;
|
|
630
|
+
interface BreakpointsOptions {
|
|
631
|
+
/** Breakpoint values in pixels */
|
|
632
|
+
values?: BreakpointValues;
|
|
633
|
+
/** Unit for breakpoints (default: 'px') */
|
|
634
|
+
unit?: string;
|
|
481
635
|
}
|
|
482
636
|
/**
|
|
483
|
-
*
|
|
637
|
+
* Shadow configuration
|
|
484
638
|
*/
|
|
485
|
-
interface
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
639
|
+
interface ShadowOptions {
|
|
640
|
+
xs?: string;
|
|
641
|
+
sm?: string;
|
|
642
|
+
md?: string;
|
|
643
|
+
lg?: string;
|
|
644
|
+
xl?: string;
|
|
645
|
+
[key: string]: string | undefined;
|
|
492
646
|
}
|
|
493
647
|
/**
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
* Manages caching of loaded themes for performance optimization
|
|
648
|
+
* Transition configuration
|
|
497
649
|
*/
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
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;
|
|
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;
|
|
539
667
|
};
|
|
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
668
|
}
|
|
553
|
-
|
|
554
669
|
/**
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
* Core engine for unified CSS and JS theme support
|
|
670
|
+
* Z-index configuration
|
|
558
671
|
*/
|
|
559
|
-
|
|
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
|
+
}
|
|
560
682
|
/**
|
|
561
|
-
*
|
|
683
|
+
* Border radius configuration
|
|
562
684
|
*/
|
|
563
|
-
interface
|
|
564
|
-
/**
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
|
|
570
|
-
/**
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
|
|
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;
|
|
574
705
|
}
|
|
575
706
|
/**
|
|
576
|
-
*
|
|
707
|
+
* Custom theme properties for extension
|
|
708
|
+
* Users can augment this interface via module augmentation
|
|
577
709
|
*/
|
|
578
|
-
interface
|
|
579
|
-
|
|
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;
|
|
710
|
+
interface ThemeCustomProperties {
|
|
711
|
+
[key: string]: any;
|
|
589
712
|
}
|
|
590
713
|
/**
|
|
591
|
-
* Theme
|
|
714
|
+
* Theme configuration options for createTheme
|
|
715
|
+
* Extends ThemeMetadata to support both CSS and JS theme properties
|
|
592
716
|
*/
|
|
593
|
-
interface
|
|
594
|
-
/**
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
|
|
717
|
+
interface ThemeOptions extends Partial<ThemeMetadata$1> {
|
|
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;
|
|
602
736
|
}
|
|
603
737
|
/**
|
|
604
|
-
*
|
|
738
|
+
* Complete theme object with computed values
|
|
739
|
+
* Generated by createTheme function
|
|
740
|
+
*/
|
|
741
|
+
interface Theme extends ThemeMetadata$1 {
|
|
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;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* CSS Variable Generator
|
|
809
|
+
*
|
|
810
|
+
* Generates CSS custom properties from design tokens.
|
|
811
|
+
*/
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Options for CSS variable generation
|
|
605
815
|
*/
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
816
|
+
interface GenerateCSSVariablesOptions {
|
|
817
|
+
/** CSS selector for the variables (default: ':root') */
|
|
818
|
+
selector?: string;
|
|
819
|
+
/** Prefix for CSS variables (default: 'atomix') */
|
|
820
|
+
prefix?: string;
|
|
821
|
+
}
|
|
610
822
|
/**
|
|
611
|
-
*
|
|
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
|
+
* ```
|
|
612
841
|
*/
|
|
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
|
-
}
|
|
842
|
+
declare function generateCSSVariables(tokens: DesignTokens, options?: GenerateCSSVariablesOptions): string;
|
|
632
843
|
/**
|
|
633
|
-
*
|
|
844
|
+
* Generate CSS variables with custom selector
|
|
845
|
+
*
|
|
846
|
+
* Useful for theme-specific selectors like `[data-theme="dark"]`
|
|
634
847
|
*
|
|
635
|
-
*
|
|
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
|
+
* ```
|
|
636
861
|
*/
|
|
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
|
-
}
|
|
862
|
+
declare function generateCSSVariablesForSelector(tokens: DesignTokens, selector: string, prefix?: string): string;
|
|
757
863
|
|
|
758
864
|
/**
|
|
759
|
-
* Theme
|
|
865
|
+
* Core Theme Functions
|
|
760
866
|
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
763
|
-
*
|
|
764
|
-
* Supports both CSS-based themes and JavaScript-based themes.
|
|
867
|
+
* Simplified 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.
|
|
765
870
|
*/
|
|
766
871
|
|
|
767
872
|
/**
|
|
768
|
-
*
|
|
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.
|
|
769
877
|
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
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
|
|
772
882
|
*
|
|
773
883
|
* @example
|
|
774
884
|
* ```typescript
|
|
775
|
-
*
|
|
776
|
-
*
|
|
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',
|
|
777
892
|
* });
|
|
778
893
|
*
|
|
779
|
-
*
|
|
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' });
|
|
780
900
|
* ```
|
|
781
901
|
*/
|
|
782
|
-
declare
|
|
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
|
-
}
|
|
902
|
+
declare function createTheme(input?: Partial<DesignTokens> | Theme, options?: GenerateCSSVariablesOptions): string;
|
|
875
903
|
|
|
876
904
|
/**
|
|
877
|
-
*
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
/** Target contrast ratio */
|
|
899
|
-
contrastTarget?: number;
|
|
900
|
-
/** Supported color modes */
|
|
901
|
-
modes?: string[];
|
|
902
|
-
};
|
|
903
|
-
/** Primary theme color (for UI display) */
|
|
904
|
-
color?: string;
|
|
905
|
-
/** Theme features list */
|
|
906
|
-
features?: string[];
|
|
907
|
-
/** Theme dependencies (other themes required) */
|
|
908
|
-
dependencies?: string[];
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* Theme manager configuration options
|
|
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
|
|
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
|
+
* ```
|
|
975
926
|
*/
|
|
976
|
-
|
|
977
|
-
/** Whether the theme is valid */
|
|
978
|
-
valid: boolean;
|
|
979
|
-
/** Validation errors */
|
|
980
|
-
errors: string[];
|
|
981
|
-
/** Validation warnings */
|
|
982
|
-
warnings: string[];
|
|
983
|
-
}
|
|
927
|
+
|
|
984
928
|
/**
|
|
985
|
-
*
|
|
929
|
+
* Create a theme object with computed values
|
|
930
|
+
*
|
|
931
|
+
* @param options - Theme configuration options
|
|
932
|
+
* @returns Complete theme object
|
|
986
933
|
*/
|
|
987
|
-
|
|
934
|
+
declare function createThemeObject(...options: ThemeOptions[]): Theme;
|
|
935
|
+
|
|
988
936
|
/**
|
|
989
|
-
* Theme
|
|
937
|
+
* Theme Composition Utilities
|
|
938
|
+
*
|
|
939
|
+
* Simplified utilities for composing, merging, and extending themes.
|
|
990
940
|
*/
|
|
991
|
-
|
|
941
|
+
|
|
992
942
|
/**
|
|
993
|
-
*
|
|
943
|
+
* Deep merge multiple objects
|
|
944
|
+
* Later objects override earlier ones
|
|
994
945
|
*/
|
|
995
|
-
|
|
946
|
+
declare function deepMerge<T extends Record<string, unknown>>(...objects: Partial<T>[]): T;
|
|
996
947
|
/**
|
|
997
|
-
*
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
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
|
-
}
|
|
948
|
+
* Merge multiple theme options into a single theme options object
|
|
949
|
+
*
|
|
950
|
+
* @param themes - Theme options to merge
|
|
951
|
+
* @returns Merged theme options
|
|
952
|
+
*
|
|
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
|
+
* ```
|
|
959
|
+
*/
|
|
960
|
+
declare function mergeTheme(...themes: ThemeOptions[]): ThemeOptions;
|
|
1017
961
|
/**
|
|
1018
|
-
*
|
|
962
|
+
* Extend an existing theme with new options
|
|
963
|
+
*
|
|
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
|
+
* ```
|
|
1019
975
|
*/
|
|
1020
|
-
|
|
1021
|
-
|
|
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
|
-
}
|
|
976
|
+
declare function extendTheme(baseTheme: Theme | ThemeOptions, extension: ThemeOptions): Theme;
|
|
977
|
+
|
|
1038
978
|
/**
|
|
1039
|
-
* Theme
|
|
979
|
+
* Theme Metadata interface
|
|
1040
980
|
*/
|
|
1041
|
-
interface
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
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;
|
|
981
|
+
interface ThemeMetadata {
|
|
982
|
+
name: string;
|
|
983
|
+
class: string;
|
|
984
|
+
description?: string;
|
|
985
|
+
version?: string;
|
|
986
|
+
[key: string]: any;
|
|
1066
987
|
}
|
|
1067
988
|
/**
|
|
1068
|
-
* Theme
|
|
989
|
+
* Theme Registry type - a record of theme IDs to metadata
|
|
1069
990
|
*/
|
|
1070
|
-
|
|
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
|
-
}
|
|
991
|
+
type ThemeRegistry = Record<string, ThemeMetadata>;
|
|
1098
992
|
/**
|
|
1099
|
-
*
|
|
993
|
+
* Create a new theme registry
|
|
1100
994
|
*/
|
|
1101
|
-
|
|
1102
|
-
/** Current theme name */
|
|
1103
|
-
theme: string;
|
|
1104
|
-
/** Current active theme object (for JS themes) */
|
|
1105
|
-
activeTheme: Theme | null;
|
|
1106
|
-
/** Set theme function */
|
|
1107
|
-
setTheme: (theme: string | Theme, options?: ThemeLoadOptions) => Promise<void>;
|
|
1108
|
-
/** Available themes */
|
|
1109
|
-
availableThemes: ThemeMetadata[];
|
|
1110
|
-
/** Loading state */
|
|
1111
|
-
isLoading: boolean;
|
|
1112
|
-
/** Error state */
|
|
1113
|
-
error: Error | null;
|
|
1114
|
-
/** Check if theme is loaded */
|
|
1115
|
-
isThemeLoaded: (themeName: string) => boolean;
|
|
1116
|
-
/** Preload theme */
|
|
1117
|
-
preloadTheme: (themeName: string) => Promise<void>;
|
|
1118
|
-
/** Theme manager instance */
|
|
1119
|
-
themeManager: ThemeManager;
|
|
1120
|
-
}
|
|
995
|
+
declare function createThemeRegistry(): ThemeRegistry;
|
|
1121
996
|
/**
|
|
1122
|
-
*
|
|
997
|
+
* Register a theme
|
|
998
|
+
* @param registry - Theme registry object
|
|
999
|
+
* @param id - Theme identifier
|
|
1000
|
+
* @param metadata - Theme metadata
|
|
1123
1001
|
*/
|
|
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
|
-
}
|
|
1002
|
+
declare function registerTheme(registry: ThemeRegistry, id: string, metadata: ThemeMetadata): void;
|
|
1134
1003
|
/**
|
|
1135
|
-
*
|
|
1004
|
+
* Unregister a theme
|
|
1005
|
+
* @param registry - Theme registry object
|
|
1006
|
+
* @param id - Theme identifier
|
|
1136
1007
|
*/
|
|
1137
|
-
|
|
1138
|
-
/** Primary color configuration */
|
|
1139
|
-
primary?: Partial<PaletteColor> | string;
|
|
1140
|
-
/** Secondary color configuration */
|
|
1141
|
-
secondary?: Partial<PaletteColor> | string;
|
|
1142
|
-
/** Error color configuration */
|
|
1143
|
-
error?: Partial<PaletteColor> | string;
|
|
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;
|
|
1154
|
-
};
|
|
1155
|
-
/** Text colors */
|
|
1156
|
-
text?: {
|
|
1157
|
-
primary?: string;
|
|
1158
|
-
secondary?: string;
|
|
1159
|
-
disabled?: string;
|
|
1160
|
-
};
|
|
1161
|
-
/** Additional custom colors */
|
|
1162
|
-
[key: string]: any;
|
|
1163
|
-
}
|
|
1008
|
+
declare function unregisterTheme(registry: ThemeRegistry, id: string): boolean;
|
|
1164
1009
|
/**
|
|
1165
|
-
*
|
|
1010
|
+
* Check if a theme is registered
|
|
1011
|
+
* @param registry - Theme registry object
|
|
1012
|
+
* @param id - Theme identifier
|
|
1166
1013
|
*/
|
|
1167
|
-
|
|
1168
|
-
/** Font family */
|
|
1169
|
-
fontFamily?: string;
|
|
1170
|
-
/** Base font size in pixels */
|
|
1171
|
-
fontSize?: number;
|
|
1172
|
-
/** Font weight scale */
|
|
1173
|
-
fontWeightLight?: number;
|
|
1174
|
-
fontWeightRegular?: number;
|
|
1175
|
-
fontWeightMedium?: number;
|
|
1176
|
-
fontWeightSemiBold?: number;
|
|
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;
|
|
1228
|
-
}
|
|
1014
|
+
declare function hasTheme(registry: ThemeRegistry, id: string): boolean;
|
|
1229
1015
|
/**
|
|
1230
|
-
*
|
|
1016
|
+
* Get theme metadata
|
|
1017
|
+
* @param registry - Theme registry object
|
|
1018
|
+
* @param id - Theme identifier
|
|
1231
1019
|
*/
|
|
1232
|
-
|
|
1020
|
+
declare function getTheme(registry: ThemeRegistry, id: string): ThemeMetadata | undefined;
|
|
1233
1021
|
/**
|
|
1234
|
-
*
|
|
1022
|
+
* Get all registered theme metadata
|
|
1023
|
+
* @param registry - Theme registry object
|
|
1235
1024
|
*/
|
|
1236
|
-
|
|
1025
|
+
declare function getAllThemes(registry: ThemeRegistry): ThemeMetadata[];
|
|
1237
1026
|
/**
|
|
1238
|
-
*
|
|
1027
|
+
* Get all registered theme IDs
|
|
1028
|
+
* @param registry - Theme registry object
|
|
1239
1029
|
*/
|
|
1240
|
-
|
|
1241
|
-
xs?: number;
|
|
1242
|
-
sm?: number;
|
|
1243
|
-
md?: number;
|
|
1244
|
-
lg?: number;
|
|
1245
|
-
xl?: number;
|
|
1246
|
-
[key: string]: number | undefined;
|
|
1247
|
-
}
|
|
1030
|
+
declare function getThemeIds(registry: ThemeRegistry): string[];
|
|
1248
1031
|
/**
|
|
1249
|
-
*
|
|
1032
|
+
* Clear all registered themes
|
|
1033
|
+
* @param registry - Theme registry object
|
|
1250
1034
|
*/
|
|
1251
|
-
|
|
1252
|
-
/** Breakpoint values in pixels */
|
|
1253
|
-
values?: BreakpointValues;
|
|
1254
|
-
/** Unit for breakpoints (default: 'px') */
|
|
1255
|
-
unit?: string;
|
|
1256
|
-
}
|
|
1035
|
+
declare function clearThemes(registry: ThemeRegistry): void;
|
|
1257
1036
|
/**
|
|
1258
|
-
*
|
|
1037
|
+
* Get the number of registered themes
|
|
1038
|
+
* @param registry - Theme registry object
|
|
1259
1039
|
*/
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
sm?: string;
|
|
1263
|
-
md?: string;
|
|
1264
|
-
lg?: string;
|
|
1265
|
-
xl?: string;
|
|
1266
|
-
[key: string]: string | undefined;
|
|
1267
|
-
}
|
|
1040
|
+
declare function getThemeCount(registry: ThemeRegistry): number;
|
|
1041
|
+
|
|
1268
1042
|
/**
|
|
1269
|
-
*
|
|
1043
|
+
* Naming Utilities
|
|
1044
|
+
*
|
|
1045
|
+
* Provides consistent naming conventions across the theme system
|
|
1270
1046
|
*/
|
|
1271
|
-
interface
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
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
|
-
};
|
|
1047
|
+
interface NamingOptions {
|
|
1048
|
+
prefix?: string;
|
|
1049
|
+
component?: string;
|
|
1050
|
+
variant?: string;
|
|
1051
|
+
state?: string;
|
|
1289
1052
|
}
|
|
1290
1053
|
/**
|
|
1291
|
-
*
|
|
1054
|
+
* Generate consistent CSS class names following BEM methodology
|
|
1055
|
+
*/
|
|
1056
|
+
declare function generateClassName(block: string, element?: string, modifiers?: Record<string, boolean | string>): string;
|
|
1057
|
+
/**
|
|
1058
|
+
* Generate consistent CSS variable names
|
|
1292
1059
|
*/
|
|
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
|
-
}
|
|
1060
|
+
declare function generateCSSVariableName(property: string, options?: NamingOptions): string;
|
|
1303
1061
|
/**
|
|
1304
|
-
*
|
|
1062
|
+
* Normalize theme tokens to consistent naming convention
|
|
1305
1063
|
*/
|
|
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
|
-
}
|
|
1064
|
+
declare function normalizeThemeTokens(tokens: Record<string, any>): Record<string, any>;
|
|
1327
1065
|
/**
|
|
1328
|
-
*
|
|
1329
|
-
* Users can augment this interface via module augmentation
|
|
1066
|
+
* Convert camelCase to kebab-case for CSS custom properties
|
|
1330
1067
|
*/
|
|
1331
|
-
|
|
1332
|
-
[key: string]: any;
|
|
1333
|
-
}
|
|
1068
|
+
declare function camelToKebab(str: string): string;
|
|
1334
1069
|
/**
|
|
1335
|
-
*
|
|
1336
|
-
* Extends ThemeMetadata to support both CSS and JS theme properties
|
|
1070
|
+
* Convert theme property to CSS variable name
|
|
1337
1071
|
*/
|
|
1338
|
-
|
|
1339
|
-
|
|
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
|
-
}
|
|
1072
|
+
declare function themePropertyToCSSVar(propertyPath: string, prefix?: string): string;
|
|
1073
|
+
|
|
1358
1074
|
/**
|
|
1359
|
-
*
|
|
1360
|
-
*
|
|
1075
|
+
* Component Theming Utilities
|
|
1076
|
+
*
|
|
1077
|
+
* Provides consistent patterns for applying theme values to components
|
|
1361
1078
|
*/
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
warning: PaletteColor;
|
|
1369
|
-
info: PaletteColor;
|
|
1370
|
-
success: PaletteColor;
|
|
1371
|
-
background: {
|
|
1372
|
-
default: string;
|
|
1373
|
-
paper: string;
|
|
1374
|
-
subtle: string;
|
|
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;
|
|
1079
|
+
|
|
1080
|
+
interface ComponentThemeOptions {
|
|
1081
|
+
component: string;
|
|
1082
|
+
variant?: string;
|
|
1083
|
+
size?: string;
|
|
1084
|
+
theme: Theme;
|
|
1426
1085
|
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Get a theme value for a specific component using CSS variables
|
|
1088
|
+
* This ensures all components access theme values consistently
|
|
1089
|
+
*/
|
|
1090
|
+
declare function getComponentThemeValue(component: string, property: string, variant?: string, size?: string): string;
|
|
1091
|
+
/**
|
|
1092
|
+
* Generate component-specific CSS variables from theme
|
|
1093
|
+
*/
|
|
1094
|
+
declare function generateComponentCSSVars(component: string, theme: Theme, variant?: string, size?: string): Record<string, string>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Apply consistent theme to component style object
|
|
1097
|
+
*/
|
|
1098
|
+
declare function applyComponentTheme(component: string, style?: React.CSSProperties, variant?: string, size?: string, theme?: Theme): React.CSSProperties;
|
|
1099
|
+
/**
|
|
1100
|
+
* Create a hook for consistent component theming
|
|
1101
|
+
*/
|
|
1102
|
+
declare function useComponentTheme(component: string, variant?: string, size?: string, theme?: Theme): (property: string) => string;
|
|
1427
1103
|
|
|
1428
1104
|
/**
|
|
1429
|
-
*
|
|
1105
|
+
* CSS Injection Utilities
|
|
1430
1106
|
*
|
|
1431
|
-
*
|
|
1432
|
-
* Updated to use the new ThemeEngine architecture
|
|
1107
|
+
* Inject CSS into HTML head via <style> element.
|
|
1433
1108
|
*/
|
|
1434
|
-
|
|
1435
1109
|
/**
|
|
1436
|
-
*
|
|
1110
|
+
* Inject CSS into HTML head via <style> element
|
|
1437
1111
|
*
|
|
1438
|
-
*
|
|
1439
|
-
*
|
|
1112
|
+
* Creates or updates a style element in the document head.
|
|
1113
|
+
* If an element with the same ID exists, it will be updated.
|
|
1114
|
+
*
|
|
1115
|
+
* @param css - CSS string to inject
|
|
1116
|
+
* @param id - Style element ID (default: 'atomix-theme')
|
|
1440
1117
|
*
|
|
1441
1118
|
* @example
|
|
1442
|
-
* ```
|
|
1443
|
-
*
|
|
1119
|
+
* ```typescript
|
|
1120
|
+
* const css = ':root { --atomix-color-primary: #7AFFD7; }';
|
|
1121
|
+
* injectCSS(css);
|
|
1444
1122
|
*
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1447
|
-
*
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
*
|
|
1123
|
+
* // With custom ID
|
|
1124
|
+
* injectCSS(css, 'my-custom-theme');
|
|
1125
|
+
* ```
|
|
1126
|
+
*/
|
|
1127
|
+
declare function injectCSS(css: string, id?: string): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Remove injected CSS from DOM
|
|
1130
|
+
*
|
|
1131
|
+
* Removes the style element with the given ID from the document head.
|
|
1132
|
+
*
|
|
1133
|
+
* @param id - Style element ID to remove (default: 'atomix-theme')
|
|
1134
|
+
*
|
|
1135
|
+
* @example
|
|
1136
|
+
* ```typescript
|
|
1137
|
+
* removeCSS(); // Removes default 'atomix-theme'
|
|
1138
|
+
* removeCSS('my-custom-theme'); // Removes custom ID
|
|
1452
1139
|
* ```
|
|
1453
1140
|
*/
|
|
1141
|
+
declare function removeCSS(id?: string): void;
|
|
1142
|
+
/**
|
|
1143
|
+
* Check if CSS is already injected
|
|
1144
|
+
*
|
|
1145
|
+
* @param id - Style element ID to check (default: 'atomix-theme')
|
|
1146
|
+
* @returns True if style element exists
|
|
1147
|
+
*/
|
|
1148
|
+
declare function isCSSInjected(id?: string): boolean;
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Theme Configuration Loader
|
|
1152
|
+
*
|
|
1153
|
+
* Provides functions to load theme configurations from atomix.config.ts
|
|
1154
|
+
* Includes both sync and async versions, with automatic fallbacks
|
|
1155
|
+
*/
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Load theme from config file (synchronous, Node.js only)
|
|
1159
|
+
* @param configPath - Path to config file (default: atomix.config.ts)
|
|
1160
|
+
* @returns DesignTokens from theme configuration
|
|
1161
|
+
* @throws Error if config loading is not available in browser environment
|
|
1162
|
+
*/
|
|
1163
|
+
declare function loadThemeFromConfigSync(options?: {
|
|
1164
|
+
configPath?: string;
|
|
1165
|
+
required?: boolean;
|
|
1166
|
+
}): DesignTokens;
|
|
1167
|
+
/**
|
|
1168
|
+
* Load theme from config file (asynchronous)
|
|
1169
|
+
* @param configPath - Path to config file (default: atomix.config.ts)
|
|
1170
|
+
* @returns Promise resolving to DesignTokens from theme configuration
|
|
1171
|
+
*/
|
|
1172
|
+
declare function loadThemeFromConfig(options?: {
|
|
1173
|
+
configPath?: string;
|
|
1174
|
+
required?: boolean;
|
|
1175
|
+
}): Promise<DesignTokens>;
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Theme Provider
|
|
1179
|
+
*
|
|
1180
|
+
* React context provider for theme management with separated concerns
|
|
1181
|
+
* Updated to use the new simplified theme system
|
|
1182
|
+
*/
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Theme Provider
|
|
1186
|
+
*
|
|
1187
|
+
* React context provider for theme management with separated concerns.
|
|
1188
|
+
* Simplified version focusing on core functionality:
|
|
1189
|
+
* - String-based themes (CSS files)
|
|
1190
|
+
* - JS Theme objects
|
|
1191
|
+
* - Persistence via localStorage
|
|
1192
|
+
*
|
|
1193
|
+
* Falls back to 'default' theme if no configuration is found.
|
|
1194
|
+
*/
|
|
1454
1195
|
declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
|
|
1455
1196
|
|
|
1456
1197
|
/**
|
|
1457
1198
|
* useTheme Hook
|
|
1458
1199
|
*
|
|
1459
1200
|
* React hook for accessing theme context
|
|
1460
|
-
* Updated to work with new ThemeEngine architecture
|
|
1461
1201
|
*/
|
|
1462
1202
|
|
|
1463
1203
|
/**
|
|
@@ -1483,6 +1223,39 @@ declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
|
|
|
1483
1223
|
*/
|
|
1484
1224
|
declare function useTheme(): UseThemeReturn;
|
|
1485
1225
|
|
|
1226
|
+
/**
|
|
1227
|
+
* Standardized hook for accessing theme tokens in components
|
|
1228
|
+
*
|
|
1229
|
+
* Provides consistent access to theme values across all components
|
|
1230
|
+
* using either CSS custom properties or theme object values.
|
|
1231
|
+
*/
|
|
1232
|
+
type ThemeTokens = {
|
|
1233
|
+
theme: string;
|
|
1234
|
+
activeTheme: Theme | null;
|
|
1235
|
+
getToken: (tokenName: string, fallback?: string) => string;
|
|
1236
|
+
getThemeValue: (path: string, fallback?: any) => any;
|
|
1237
|
+
colors: {
|
|
1238
|
+
primary: string;
|
|
1239
|
+
secondary: string;
|
|
1240
|
+
error: string;
|
|
1241
|
+
success: string;
|
|
1242
|
+
warning: string;
|
|
1243
|
+
info: string;
|
|
1244
|
+
light: string;
|
|
1245
|
+
dark: string;
|
|
1246
|
+
};
|
|
1247
|
+
spacing: Record<string, string>;
|
|
1248
|
+
borderRadius: Record<string, string>;
|
|
1249
|
+
typography: {
|
|
1250
|
+
fontFamily: Record<string, string>;
|
|
1251
|
+
fontSize: Record<string, string>;
|
|
1252
|
+
fontWeight: Record<string, string>;
|
|
1253
|
+
};
|
|
1254
|
+
shadows: Record<string, string>;
|
|
1255
|
+
transitions: Record<string, string>;
|
|
1256
|
+
};
|
|
1257
|
+
declare function useThemeTokens(): ThemeTokens;
|
|
1258
|
+
|
|
1486
1259
|
/**
|
|
1487
1260
|
* Theme context with default values
|
|
1488
1261
|
*/
|
|
@@ -1520,179 +1293,97 @@ interface ThemeErrorBoundaryProps {
|
|
|
1520
1293
|
resetOnPropsChange?: boolean;
|
|
1521
1294
|
/** Custom error message */
|
|
1522
1295
|
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;
|
|
1296
|
+
}
|
|
1615
1297
|
/**
|
|
1616
|
-
*
|
|
1298
|
+
* Theme Error Boundary Component
|
|
1299
|
+
*
|
|
1300
|
+
* Catches errors in the theme system and displays a fallback UI
|
|
1301
|
+
* instead of crashing the entire application.
|
|
1617
1302
|
*/
|
|
1618
|
-
declare
|
|
1303
|
+
declare class ThemeErrorBoundary extends Component<ThemeErrorBoundaryProps, ThemeErrorBoundaryState> {
|
|
1304
|
+
private logger;
|
|
1305
|
+
constructor(props: ThemeErrorBoundaryProps);
|
|
1306
|
+
static getDerivedStateFromError(error: Error): Partial<ThemeErrorBoundaryState>;
|
|
1307
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
1308
|
+
componentDidUpdate(prevProps: ThemeErrorBoundaryProps): void;
|
|
1309
|
+
render(): ReactNode;
|
|
1310
|
+
}
|
|
1619
1311
|
|
|
1620
1312
|
/**
|
|
1621
|
-
* Theme
|
|
1313
|
+
* Theme Applicator
|
|
1622
1314
|
*
|
|
1623
|
-
*
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
*
|
|
1315
|
+
* Applies theme configurations to the DOM, including CSS variables,
|
|
1316
|
+
* component overrides, typography, spacing, and color palettes.
|
|
1317
|
+
*
|
|
1318
|
+
* Uses the unified theme system for CSS generation and injection.
|
|
1627
1319
|
*/
|
|
1628
|
-
|
|
1629
|
-
name: string;
|
|
1630
|
-
description: string;
|
|
1631
|
-
options?: Record<string, string>;
|
|
1632
|
-
handler: (args: string[], options: Record<string, any>) => Promise<void> | void;
|
|
1633
|
-
}
|
|
1320
|
+
|
|
1634
1321
|
/**
|
|
1635
|
-
* Theme
|
|
1322
|
+
* Theme applicator class for runtime theme application
|
|
1636
1323
|
*
|
|
1637
|
-
*
|
|
1324
|
+
* Uses the unified theme system for efficient CSS variable generation and injection.
|
|
1638
1325
|
*/
|
|
1639
|
-
declare class
|
|
1640
|
-
private
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
* Register default commands
|
|
1644
|
-
*/
|
|
1645
|
-
private registerDefaultCommands;
|
|
1326
|
+
declare class ThemeApplicator {
|
|
1327
|
+
private root;
|
|
1328
|
+
private styleId;
|
|
1329
|
+
constructor(root?: HTMLElement);
|
|
1646
1330
|
/**
|
|
1647
|
-
*
|
|
1331
|
+
* Apply a complete theme configuration
|
|
1332
|
+
*
|
|
1333
|
+
* Uses the unified theme system to convert Theme to DesignTokens and inject CSS.
|
|
1334
|
+
* Automatically respects atomix.config.ts when using DesignTokens.
|
|
1648
1335
|
*/
|
|
1649
|
-
|
|
1336
|
+
applyTheme(theme: Theme | DesignTokens): void;
|
|
1650
1337
|
/**
|
|
1651
|
-
*
|
|
1338
|
+
* Apply DesignTokens using unified theme system
|
|
1339
|
+
*
|
|
1340
|
+
* Uses createTheme() which automatically loads from atomix.config.ts
|
|
1341
|
+
* if no tokens are provided, ensuring config is always respected.
|
|
1652
1342
|
*/
|
|
1653
|
-
|
|
1343
|
+
private applyDesignTokens;
|
|
1654
1344
|
/**
|
|
1655
|
-
*
|
|
1345
|
+
* Check if object is DesignTokens
|
|
1656
1346
|
*/
|
|
1657
|
-
private
|
|
1347
|
+
private isDesignTokens;
|
|
1658
1348
|
/**
|
|
1659
|
-
*
|
|
1349
|
+
* Apply global CSS variables (for component overrides)
|
|
1660
1350
|
*/
|
|
1661
|
-
private
|
|
1351
|
+
private applyGlobalCSSVars;
|
|
1662
1352
|
/**
|
|
1663
|
-
*
|
|
1353
|
+
* Apply component-level overrides
|
|
1664
1354
|
*/
|
|
1665
|
-
private
|
|
1355
|
+
private applyComponentOverrides;
|
|
1666
1356
|
/**
|
|
1667
|
-
*
|
|
1357
|
+
* Apply override for a specific component
|
|
1668
1358
|
*/
|
|
1669
|
-
private
|
|
1359
|
+
private applyComponentOverride;
|
|
1670
1360
|
/**
|
|
1671
|
-
*
|
|
1361
|
+
* Clear all applied CSS variables
|
|
1672
1362
|
*/
|
|
1673
|
-
private
|
|
1363
|
+
private clearAppliedVars;
|
|
1674
1364
|
/**
|
|
1675
|
-
*
|
|
1365
|
+
* Remove theme application
|
|
1676
1366
|
*/
|
|
1677
|
-
|
|
1367
|
+
removeTheme(): void;
|
|
1678
1368
|
/**
|
|
1679
|
-
*
|
|
1369
|
+
* Update specific CSS variables without clearing all
|
|
1680
1370
|
*/
|
|
1681
|
-
|
|
1371
|
+
updateCSSVars(vars: Record<string, string | number>): void;
|
|
1682
1372
|
}
|
|
1683
1373
|
/**
|
|
1684
|
-
*
|
|
1374
|
+
* Get or create global theme applicator
|
|
1685
1375
|
*/
|
|
1686
|
-
declare function
|
|
1376
|
+
declare function getThemeApplicator(): ThemeApplicator;
|
|
1687
1377
|
/**
|
|
1688
|
-
*
|
|
1378
|
+
* Apply theme using global applicator
|
|
1689
1379
|
*/
|
|
1690
|
-
declare function
|
|
1380
|
+
declare function applyTheme(theme: Theme | DesignTokens): void;
|
|
1691
1381
|
|
|
1692
1382
|
/**
|
|
1693
1383
|
* Theme Preview Component
|
|
1694
1384
|
*
|
|
1695
1385
|
* React component for previewing themes in development
|
|
1386
|
+
* Enhanced with interactive components, viewport controls, and dark mode toggle
|
|
1696
1387
|
*/
|
|
1697
1388
|
|
|
1698
1389
|
/**
|
|
@@ -1727,6 +1418,7 @@ declare const ThemePreview: React__default.FC<ThemePreviewProps>;
|
|
|
1727
1418
|
* Theme Inspector Component
|
|
1728
1419
|
*
|
|
1729
1420
|
* React component for inspecting and debugging themes
|
|
1421
|
+
* Enhanced with search/filter and copy path functionality
|
|
1730
1422
|
*/
|
|
1731
1423
|
|
|
1732
1424
|
/**
|
|
@@ -1757,6 +1449,7 @@ declare const ThemeInspector: React__default.FC<ThemeInspectorProps>;
|
|
|
1757
1449
|
* Theme Comparator Component
|
|
1758
1450
|
*
|
|
1759
1451
|
* React component for comparing two themes side-by-side
|
|
1452
|
+
* Enhanced with search/filter and improved visual diff styling
|
|
1760
1453
|
*/
|
|
1761
1454
|
|
|
1762
1455
|
/**
|
|
@@ -1785,6 +1478,7 @@ declare const ThemeComparator: React__default.FC<ThemeComparatorProps>;
|
|
|
1785
1478
|
* Theme Live Editor Component
|
|
1786
1479
|
*
|
|
1787
1480
|
* React component for live editing themes in development
|
|
1481
|
+
* Enhanced with undo/redo, keyboard shortcuts, resizable layout, and better color pickers
|
|
1788
1482
|
*/
|
|
1789
1483
|
|
|
1790
1484
|
/**
|
|
@@ -1808,76 +1502,185 @@ interface ThemeLiveEditorProps {
|
|
|
1808
1502
|
declare const ThemeLiveEditor: React__default.FC<ThemeLiveEditorProps>;
|
|
1809
1503
|
|
|
1810
1504
|
/**
|
|
1811
|
-
* Theme
|
|
1505
|
+
* Theme Validator
|
|
1812
1506
|
*
|
|
1813
|
-
*
|
|
1814
|
-
* component overrides, typography, spacing, and color palettes.
|
|
1507
|
+
* Runtime theme validation including color contrast and accessibility checks
|
|
1815
1508
|
*/
|
|
1816
1509
|
|
|
1817
1510
|
/**
|
|
1818
|
-
*
|
|
1511
|
+
* Validation result
|
|
1819
1512
|
*/
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1513
|
+
interface ValidationResult {
|
|
1514
|
+
/** Whether theme is valid */
|
|
1515
|
+
valid: boolean;
|
|
1516
|
+
/** Validation errors */
|
|
1517
|
+
errors: string[];
|
|
1518
|
+
/** Validation warnings */
|
|
1519
|
+
warnings: string[];
|
|
1520
|
+
/** Accessibility issues */
|
|
1521
|
+
a11yIssues: A11yIssue[];
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Accessibility issue
|
|
1525
|
+
*/
|
|
1526
|
+
interface A11yIssue {
|
|
1527
|
+
/** Issue type */
|
|
1528
|
+
type: 'contrast' | 'color' | 'missing';
|
|
1529
|
+
/** Severity */
|
|
1530
|
+
severity: 'error' | 'warning';
|
|
1531
|
+
/** Issue message */
|
|
1532
|
+
message: string;
|
|
1533
|
+
/** Affected property */
|
|
1534
|
+
property?: string;
|
|
1535
|
+
/** Current value */
|
|
1536
|
+
value?: string;
|
|
1537
|
+
/** Recommended value */
|
|
1538
|
+
recommended?: string;
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Theme Validator
|
|
1542
|
+
*
|
|
1543
|
+
* Validates themes for correctness and accessibility
|
|
1544
|
+
*/
|
|
1545
|
+
declare class ThemeValidator {
|
|
1824
1546
|
/**
|
|
1825
|
-
*
|
|
1547
|
+
* Validate theme
|
|
1826
1548
|
*/
|
|
1827
|
-
|
|
1549
|
+
validate(theme: Theme, metadata?: ThemeMetadata$1): ValidationResult;
|
|
1828
1550
|
/**
|
|
1829
|
-
*
|
|
1551
|
+
* Validate palette
|
|
1830
1552
|
*/
|
|
1831
|
-
private
|
|
1553
|
+
private validatePalette;
|
|
1832
1554
|
/**
|
|
1833
|
-
*
|
|
1555
|
+
* Validate typography
|
|
1834
1556
|
*/
|
|
1835
|
-
private
|
|
1557
|
+
private validateTypography;
|
|
1836
1558
|
/**
|
|
1837
|
-
*
|
|
1559
|
+
* Validate spacing
|
|
1838
1560
|
*/
|
|
1839
|
-
private
|
|
1561
|
+
private validateSpacing;
|
|
1840
1562
|
/**
|
|
1841
|
-
*
|
|
1563
|
+
* Validate breakpoints
|
|
1842
1564
|
*/
|
|
1843
|
-
private
|
|
1565
|
+
private validateBreakpoints;
|
|
1844
1566
|
/**
|
|
1845
|
-
*
|
|
1567
|
+
* Check color contrast ratio
|
|
1846
1568
|
*/
|
|
1847
|
-
private
|
|
1569
|
+
private checkContrast;
|
|
1848
1570
|
/**
|
|
1849
|
-
*
|
|
1571
|
+
* Check if color is valid
|
|
1850
1572
|
*/
|
|
1851
|
-
private
|
|
1573
|
+
private isValidColor;
|
|
1852
1574
|
/**
|
|
1853
|
-
*
|
|
1575
|
+
* Validate transitions
|
|
1854
1576
|
*/
|
|
1855
|
-
private
|
|
1577
|
+
private validateTransitions;
|
|
1856
1578
|
/**
|
|
1857
|
-
*
|
|
1579
|
+
* Validate z-index
|
|
1858
1580
|
*/
|
|
1859
|
-
|
|
1581
|
+
private validateZIndex;
|
|
1860
1582
|
/**
|
|
1861
|
-
*
|
|
1583
|
+
* Validate border radius
|
|
1862
1584
|
*/
|
|
1863
|
-
|
|
1585
|
+
private validateBorderRadius;
|
|
1864
1586
|
/**
|
|
1865
|
-
*
|
|
1587
|
+
* Validate custom properties
|
|
1866
1588
|
*/
|
|
1867
|
-
|
|
1589
|
+
private validateCustom;
|
|
1868
1590
|
}
|
|
1591
|
+
|
|
1869
1592
|
/**
|
|
1870
|
-
*
|
|
1593
|
+
* useHistory Hook
|
|
1594
|
+
*
|
|
1595
|
+
* React hook for managing undo/redo history
|
|
1871
1596
|
*/
|
|
1872
|
-
|
|
1597
|
+
interface UseHistoryOptions {
|
|
1598
|
+
/** Maximum number of history entries (default: 50) */
|
|
1599
|
+
maxHistorySize?: number;
|
|
1600
|
+
/** Initial state */
|
|
1601
|
+
initialState?: any;
|
|
1602
|
+
}
|
|
1603
|
+
interface UseHistoryReturn<T> {
|
|
1604
|
+
/** Current state */
|
|
1605
|
+
state: T;
|
|
1606
|
+
/** Update state and add to history */
|
|
1607
|
+
setState: (newState: T) => void;
|
|
1608
|
+
/** Undo last change */
|
|
1609
|
+
undo: () => void;
|
|
1610
|
+
/** Redo last undone change */
|
|
1611
|
+
redo: () => void;
|
|
1612
|
+
/** Check if undo is available */
|
|
1613
|
+
canUndo: boolean;
|
|
1614
|
+
/** Check if redo is available */
|
|
1615
|
+
canRedo: boolean;
|
|
1616
|
+
/** Clear history */
|
|
1617
|
+
clearHistory: () => void;
|
|
1618
|
+
/** Get history statistics */
|
|
1619
|
+
getHistoryStats: () => {
|
|
1620
|
+
currentIndex: number;
|
|
1621
|
+
totalEntries: number;
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1873
1624
|
/**
|
|
1874
|
-
*
|
|
1625
|
+
* useHistory hook
|
|
1626
|
+
*
|
|
1627
|
+
* Provides undo/redo functionality for state management
|
|
1628
|
+
*
|
|
1629
|
+
* @example
|
|
1630
|
+
* ```tsx
|
|
1631
|
+
* const { state, setState, undo, redo, canUndo, canRedo } = useHistory({
|
|
1632
|
+
* initialState: theme,
|
|
1633
|
+
* maxHistorySize: 50
|
|
1634
|
+
* });
|
|
1635
|
+
* ```
|
|
1636
|
+
*/
|
|
1637
|
+
declare function useHistory<T>(options?: UseHistoryOptions): UseHistoryReturn<T>;
|
|
1638
|
+
|
|
1639
|
+
/**
|
|
1640
|
+
* Theme Adapter
|
|
1641
|
+
*
|
|
1642
|
+
* Converts between Theme objects and DesignTokens.
|
|
1643
|
+
*/
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* Convert Theme object to DesignTokens
|
|
1647
|
+
*
|
|
1648
|
+
* Extracts values from a Theme object and converts them to flat DesignTokens format.
|
|
1649
|
+
*
|
|
1650
|
+
* @param theme - Theme object to convert
|
|
1651
|
+
* @returns Partial DesignTokens object
|
|
1652
|
+
*
|
|
1653
|
+
* @example
|
|
1654
|
+
* ```typescript
|
|
1655
|
+
* const theme = createTheme({ palette: { primary: { main: '#7c3aed' } } });
|
|
1656
|
+
* const tokens = themeToDesignTokens(theme);
|
|
1657
|
+
* // Returns: { 'primary': '#7c3aed', ... }
|
|
1658
|
+
* ```
|
|
1659
|
+
*/
|
|
1660
|
+
declare function themeToDesignTokens(theme: Theme): Partial<DesignTokens>;
|
|
1661
|
+
/**
|
|
1662
|
+
* Convert DesignTokens to Theme-compatible CSS variables
|
|
1663
|
+
*
|
|
1664
|
+
* @param tokens - DesignTokens object
|
|
1665
|
+
* @returns CSS variables object compatible with Theme.cssVars
|
|
1666
|
+
*/
|
|
1667
|
+
declare function designTokensToCSSVars(tokens: Partial<DesignTokens>): Record<string, string>;
|
|
1668
|
+
/**
|
|
1669
|
+
* Create DesignTokens from Theme with defaults
|
|
1670
|
+
*
|
|
1671
|
+
* Converts a Theme to DesignTokens and merges with default tokens.
|
|
1672
|
+
*
|
|
1673
|
+
* @param theme - Theme object to convert
|
|
1674
|
+
* @returns Complete DesignTokens object
|
|
1875
1675
|
*/
|
|
1876
|
-
declare function
|
|
1676
|
+
declare function createDesignTokensFromTheme(theme: Theme): DesignTokens;
|
|
1877
1677
|
/**
|
|
1878
|
-
*
|
|
1678
|
+
* Create a minimal Theme object from DesignTokens
|
|
1679
|
+
*
|
|
1680
|
+
* @param tokens - DesignTokens to convert
|
|
1681
|
+
* @returns Minimal Theme object with cssVars populated
|
|
1879
1682
|
*/
|
|
1880
|
-
declare function
|
|
1683
|
+
declare function designTokensToTheme(tokens: Partial<DesignTokens>): Partial<Theme>;
|
|
1881
1684
|
|
|
1882
1685
|
/**
|
|
1883
1686
|
* CSS Variable Mapper
|
|
@@ -1911,25 +1714,6 @@ interface CSSVariableNamingOptions {
|
|
|
1911
1714
|
/** Whether to include component name in variable (default: true) */
|
|
1912
1715
|
includeComponent?: boolean;
|
|
1913
1716
|
}
|
|
1914
|
-
/**
|
|
1915
|
-
* Generate CSS variable name from parts
|
|
1916
|
-
*
|
|
1917
|
-
* @example
|
|
1918
|
-
* generateCSSVariableName('button', 'bg', { prefix: 'atomix' })
|
|
1919
|
-
* // Returns: '--atomix-button-bg'
|
|
1920
|
-
*/
|
|
1921
|
-
declare function generateCSSVariableName(component: string, property: string, options?: CSSVariableNamingOptions): string;
|
|
1922
|
-
/**
|
|
1923
|
-
* Generate CSS variables object from configuration
|
|
1924
|
-
*
|
|
1925
|
-
* @example
|
|
1926
|
-
* const vars = generateComponentCSSVars({
|
|
1927
|
-
* component: 'button',
|
|
1928
|
-
* properties: { bg: '#000', color: '#fff' }
|
|
1929
|
-
* })
|
|
1930
|
-
* // Returns: { '--atomix-button-bg': '#000', '--atomix-button-color': '#fff' }
|
|
1931
|
-
*/
|
|
1932
|
-
declare function generateComponentCSSVars(config: CSSVariableConfig, options?: CSSVariableNamingOptions): Record<string, string>;
|
|
1933
1717
|
/**
|
|
1934
1718
|
* Map SCSS tokens to CSS custom properties
|
|
1935
1719
|
*
|
|
@@ -1988,5 +1772,180 @@ declare function isValidCSSVariableName(name: string): boolean;
|
|
|
1988
1772
|
*/
|
|
1989
1773
|
declare function extractComponentName(varName: string, prefix?: string): string | null;
|
|
1990
1774
|
|
|
1991
|
-
|
|
1992
|
-
|
|
1775
|
+
/**
|
|
1776
|
+
* Theme Helper Functions
|
|
1777
|
+
*
|
|
1778
|
+
* Utility functions for working with themes and DesignTokens
|
|
1779
|
+
*/
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* Get DesignTokens from current theme
|
|
1783
|
+
*
|
|
1784
|
+
* Converts a Theme object to DesignTokens. Useful when you need to
|
|
1785
|
+
* work with DesignTokens but have a Theme object.
|
|
1786
|
+
*
|
|
1787
|
+
* @param theme - Theme object to convert
|
|
1788
|
+
* @returns DesignTokens object
|
|
1789
|
+
*
|
|
1790
|
+
* @example
|
|
1791
|
+
* ```typescript
|
|
1792
|
+
* // If you have a Theme object, convert it to DesignTokens
|
|
1793
|
+
* const tokens = getDesignTokensFromTheme(theme);
|
|
1794
|
+
* // Now you can use tokens with unified theme system
|
|
1795
|
+
* const css = createTheme(tokens);
|
|
1796
|
+
* ```
|
|
1797
|
+
*/
|
|
1798
|
+
declare function getDesignTokensFromTheme(theme: Theme | null): DesignTokens | null;
|
|
1799
|
+
/**
|
|
1800
|
+
* Check if a value is DesignTokens
|
|
1801
|
+
*
|
|
1802
|
+
* Type guard to check if an object is DesignTokens format.
|
|
1803
|
+
*
|
|
1804
|
+
* @param value - Value to check
|
|
1805
|
+
* @returns True if value is DesignTokens
|
|
1806
|
+
*/
|
|
1807
|
+
declare function isDesignTokens(value: unknown): value is DesignTokens;
|
|
1808
|
+
/**
|
|
1809
|
+
* Check if a value is a Theme object
|
|
1810
|
+
*
|
|
1811
|
+
* Type guard to check if an object is a Theme.
|
|
1812
|
+
*
|
|
1813
|
+
* @param value - Value to check
|
|
1814
|
+
* @returns True if value is Theme
|
|
1815
|
+
*/
|
|
1816
|
+
declare function isThemeObject(value: unknown): value is Theme;
|
|
1817
|
+
|
|
1818
|
+
/**
|
|
1819
|
+
* RTL (Right-to-Left) Support Utilities
|
|
1820
|
+
*
|
|
1821
|
+
* Provides utilities for managing RTL text direction in themes
|
|
1822
|
+
*/
|
|
1823
|
+
/**
|
|
1824
|
+
* RTL configuration options
|
|
1825
|
+
*/
|
|
1826
|
+
interface RTLConfig {
|
|
1827
|
+
/** Enable RTL mode */
|
|
1828
|
+
enabled: boolean;
|
|
1829
|
+
/** Current direction ('ltr' | 'rtl') */
|
|
1830
|
+
direction: 'ltr' | 'rtl';
|
|
1831
|
+
/** Data attribute name for direction */
|
|
1832
|
+
dataAttribute?: string;
|
|
1833
|
+
/** Auto-detect from locale */
|
|
1834
|
+
autoDetect?: boolean;
|
|
1835
|
+
/** Locale code (e.g., 'ar', 'he', 'fa') */
|
|
1836
|
+
locale?: string;
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* RTL Manager
|
|
1840
|
+
*
|
|
1841
|
+
* Manages RTL text direction for the theme system
|
|
1842
|
+
*/
|
|
1843
|
+
declare class RTLManager {
|
|
1844
|
+
private config;
|
|
1845
|
+
private listeners;
|
|
1846
|
+
constructor(config?: Partial<RTLConfig>);
|
|
1847
|
+
/**
|
|
1848
|
+
* Detect locale from browser
|
|
1849
|
+
*/
|
|
1850
|
+
private detectLocale;
|
|
1851
|
+
/**
|
|
1852
|
+
* Check if locale is RTL
|
|
1853
|
+
*/
|
|
1854
|
+
isRTLLocale(locale: string): boolean;
|
|
1855
|
+
/**
|
|
1856
|
+
* Get current direction
|
|
1857
|
+
*/
|
|
1858
|
+
getDirection(): 'ltr' | 'rtl';
|
|
1859
|
+
/**
|
|
1860
|
+
* Check if RTL is enabled
|
|
1861
|
+
*/
|
|
1862
|
+
isEnabled(): boolean;
|
|
1863
|
+
/**
|
|
1864
|
+
* Set direction
|
|
1865
|
+
*/
|
|
1866
|
+
setDirection(direction: 'ltr' | 'rtl'): void;
|
|
1867
|
+
/**
|
|
1868
|
+
* Toggle direction
|
|
1869
|
+
*/
|
|
1870
|
+
toggleDirection(): 'ltr' | 'rtl';
|
|
1871
|
+
/**
|
|
1872
|
+
* Enable RTL
|
|
1873
|
+
*/
|
|
1874
|
+
enable(): void;
|
|
1875
|
+
/**
|
|
1876
|
+
* Disable RTL
|
|
1877
|
+
*/
|
|
1878
|
+
disable(): void;
|
|
1879
|
+
/**
|
|
1880
|
+
* Set locale and auto-adjust direction
|
|
1881
|
+
*/
|
|
1882
|
+
setLocale(locale: string): void;
|
|
1883
|
+
/**
|
|
1884
|
+
* Get current locale
|
|
1885
|
+
*/
|
|
1886
|
+
getLocale(): string | undefined;
|
|
1887
|
+
/**
|
|
1888
|
+
* Apply direction to DOM
|
|
1889
|
+
*/
|
|
1890
|
+
private applyDirection;
|
|
1891
|
+
/**
|
|
1892
|
+
* Add direction change listener
|
|
1893
|
+
*/
|
|
1894
|
+
onDirectionChange(callback: (direction: 'ltr' | 'rtl') => void): () => void;
|
|
1895
|
+
/**
|
|
1896
|
+
* Notify listeners of direction change
|
|
1897
|
+
*/
|
|
1898
|
+
private notifyListeners;
|
|
1899
|
+
/**
|
|
1900
|
+
* Get RTL-aware value
|
|
1901
|
+
*
|
|
1902
|
+
* Returns different values based on direction
|
|
1903
|
+
*/
|
|
1904
|
+
getValue<T>(ltrValue: T, rtlValue: T): T;
|
|
1905
|
+
/**
|
|
1906
|
+
* Get RTL-aware CSS property
|
|
1907
|
+
*
|
|
1908
|
+
* Returns appropriate CSS property based on direction
|
|
1909
|
+
*/
|
|
1910
|
+
getCSSProperty(property: string): string;
|
|
1911
|
+
/**
|
|
1912
|
+
* Destroy RTL manager
|
|
1913
|
+
*/
|
|
1914
|
+
destroy(): void;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
/**
|
|
1918
|
+
* Theme System Exports
|
|
1919
|
+
*
|
|
1920
|
+
* Unified theme system - handles both DesignTokens and Theme objects.
|
|
1921
|
+
*
|
|
1922
|
+
* @example
|
|
1923
|
+
* ```typescript
|
|
1924
|
+
* import { createTheme, injectTheme } from '@shohojdhara/atomix/theme';
|
|
1925
|
+
*
|
|
1926
|
+
* // Using DesignTokens (recommended - flat structure)
|
|
1927
|
+
* const css = createTheme({ 'primary': '#7AFFD7', 'spacing-4': '1rem' });
|
|
1928
|
+
* injectTheme(css);
|
|
1929
|
+
*
|
|
1930
|
+
* // Or use with ThemeProvider
|
|
1931
|
+
* import { ThemeProvider } from '@shohojdhara/atomix/theme';
|
|
1932
|
+
* const tokens = { 'primary': '#7c3aed' };
|
|
1933
|
+
* <ThemeProvider defaultTheme={tokens}>...</ThemeProvider>
|
|
1934
|
+
* ```
|
|
1935
|
+
*/
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* Inject theme CSS into DOM
|
|
1939
|
+
*/
|
|
1940
|
+
declare function injectTheme(css: string, id?: string): void;
|
|
1941
|
+
/**
|
|
1942
|
+
* Remove theme from DOM
|
|
1943
|
+
*/
|
|
1944
|
+
declare function removeTheme(id?: string): void;
|
|
1945
|
+
/**
|
|
1946
|
+
* Save theme to CSS file
|
|
1947
|
+
*/
|
|
1948
|
+
declare function saveTheme(css: string, filePath: string): Promise<void>;
|
|
1949
|
+
|
|
1950
|
+
export { RTLManager, ThemeApplicator, ThemeComparator, ThemeContext, ThemeErrorBoundary, ThemeInspector, ThemeLiveEditor, ThemePreview, ThemeProvider, ThemeValidator, applyCSSVariables, applyComponentTheme, applyTheme, camelToKebab, clearThemes, createDesignTokensFromTheme, createTheme, createThemeObject, createThemeRegistry, createTokens, cssVarsToStyle, deepMerge, defaultTokens, designTokensToCSSVars, designTokensToTheme, extendTheme, extractComponentName, generateCSSVariableName, generateCSSVariables, generateCSSVariablesForSelector, generateClassName, generateComponentCSSVars, getAllThemes, getCSSVariable, getComponentThemeValue, getDesignTokensFromTheme, getTheme, getThemeApplicator, getThemeCount, getThemeIds, hasTheme, injectCSS, injectTheme, isCSSInjected, isDesignTokens, isThemeObject, isValidCSSVariableName, loadThemeFromConfig, loadThemeFromConfigSync, mapSCSSTokensToCSSVars, mergeCSSVars, mergeTheme, normalizeThemeTokens, registerTheme, removeCSS, removeCSSVariables, removeTheme, saveTheme, themePropertyToCSSVar, themeToDesignTokens, unregisterTheme, useComponentTheme, useHistory, useTheme, useThemeTokens };
|
|
1951
|
+
export type { A11yIssue, CSSVariableConfig, CSSVariableNamingOptions, ComponentThemeOptions, ComponentThemeOverride, DesignTokens, GenerateCSSVariablesOptions, NamingOptions, RTLConfig, Theme, ThemeChangeEvent, ThemeComparatorProps, ThemeComponentOverrides, ThemeContextValue, ThemeErrorBoundaryProps, ThemeInspectorProps, ThemeLiveEditorProps, ThemeLoadOptions, ThemePreviewProps, ThemeProviderProps, ThemeValidationResult, UseHistoryOptions, UseHistoryReturn, UseThemeReturn, ValidationResult };
|