@shohojdhara/atomix 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -199
- package/atomix.config.ts +241 -0
- package/dist/atomix.css +269 -189
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15179 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6477 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3373 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2466 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4566 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5171 -4792
- package/dist/index.esm.js +6098 -4563
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6291 -4747
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.d.ts +300 -0
- package/dist/layout.js +336 -0
- package/dist/layout.js.map +1 -0
- package/dist/theme.d.ts +2122 -0
- package/dist/theme.js +6084 -0
- package/dist/theme.js.map +1 -0
- package/package.json +59 -27
- package/scripts/atomix-cli.js +544 -16
- package/scripts/cli/__tests__/cli-commands.test.js +204 -0
- package/scripts/cli/__tests__/utils.test.js +201 -0
- package/scripts/cli/__tests__/vitest.config.js +26 -0
- package/scripts/cli/interactive-init.js +1 -1
- package/scripts/cli/token-manager.js +32 -7
- package/scripts/cli/utils.js +347 -0
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/Accordion/Accordion.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
- package/src/components/Avatar/Avatar.stories.tsx +7 -0
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +91 -13
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/ButtonGroup.stories.tsx +315 -0
- package/src/components/Button/ButtonGroup.tsx +67 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.stories.tsx +8 -6
- package/src/components/Card/Card.stories.tsx +82 -28
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -18
- package/src/components/Chart/AreaChart.tsx +5 -2
- package/src/components/Chart/BarChart.tsx +1 -1
- package/src/components/Chart/BubbleChart.tsx +6 -6
- 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/ChartToolbar.tsx +1 -0
- package/src/components/Chart/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +1 -2
- 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 +19 -13
- package/src/components/Chart/ScatterChart.tsx +3 -4
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -2
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- 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/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.stories.tsx +7 -0
- package/src/components/Form/Checkbox.tsx +3 -3
- 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/Input.tsx +4 -2
- package/src/components/Form/Radio.stories.tsx +9 -1
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +10 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- 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 +88 -7
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.stories.tsx +109 -84
- package/src/components/Rating/Rating.tsx +5 -2
- 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/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- package/src/components/Tabs/Tabs.tsx +3 -3
- 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/Tooltip/Tooltip.tsx +3 -3
- package/src/components/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +6 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- package/src/lib/composables/useAtomixGlass.ts +2 -3
- package/src/lib/composables/useChartPerformance.ts +102 -78
- package/src/lib/composables/useChartScale.ts +10 -0
- package/src/lib/composables/useHero.ts +9 -2
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -3
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/composables/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/loader.ts +57 -14
- package/src/lib/constants/components.ts +10 -0
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -15
- package/src/lib/hooks/usePerformanceMonitor.ts +149 -0
- package/src/lib/patterns/index.ts +2 -2
- package/src/lib/patterns/slots.tsx +2 -2
- package/src/lib/theme/README.md +174 -0
- package/src/lib/theme/adapters/index.ts +31 -0
- package/src/lib/theme/adapters/themeAdapter.ts +287 -0
- package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
- package/src/lib/theme/config/configLoader.ts +254 -0
- package/src/lib/theme/config/loader.ts +37 -48
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +15 -91
- package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +19 -6
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +155 -0
- package/src/lib/theme/core/createTheme.ts +94 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
- package/src/lib/theme/core/index.ts +5 -19
- package/src/lib/theme/devtools/Comparator.tsx +346 -22
- package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
- package/src/lib/theme/devtools/Inspector.tsx +335 -51
- package/src/lib/theme/devtools/LiveEditor.tsx +489 -112
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core → devtools}/ThemeValidator.ts +6 -3
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/errors/index.ts +12 -0
- package/src/lib/theme/generators/cssFile.ts +79 -0
- package/src/lib/theme/generators/generateCSS.ts +89 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +4 -14
- package/src/lib/theme/generators/index.ts +19 -0
- package/src/lib/theme/i18n/rtl.ts +7 -7
- package/src/lib/theme/index.ts +120 -15
- package/src/lib/theme/runtime/ThemeApplicator.ts +53 -95
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +4 -4
- package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
- package/src/lib/theme/runtime/index.ts +1 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/test/testTheme.ts +385 -0
- package/src/lib/theme/tokens/index.ts +12 -0
- package/src/lib/theme/tokens/tokens.ts +721 -0
- package/src/lib/theme/types.ts +6 -42
- package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
- package/src/lib/theme/utils/index.ts +11 -0
- package/src/lib/theme/utils/injectCSS.ts +90 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
- package/src/lib/theme-tools.ts +8 -9
- package/src/lib/types/components.ts +93 -34
- package/src/lib/types/partProps.ts +0 -16
- package/src/lib/utils/componentUtils.ts +1 -1
- package/src/lib/utils/fontPreloader.ts +148 -0
- package/src/lib/utils/index.ts +11 -0
- package/src/lib/utils/memoryMonitor.ts +189 -0
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- package/src/styles/01-settings/_settings.fonts.scss +2 -5
- 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.navbar.scss +0 -6
- package/src/styles/06-components/_components.pagination.scss +88 -0
- package/scripts/build-themes.js +0 -208
- package/scripts/sync-theme-config.js +0 -309
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
- 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 -657
- 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 -442
- package/src/styles/03-generic/_generated-root.css +0 -5
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -35
- /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
- /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,2122 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default, { ReactNode, ErrorInfo, Component } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Design Tokens
|
|
6
|
+
*
|
|
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
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
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;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Default design tokens
|
|
277
|
+
*
|
|
278
|
+
* Based on Atomix default theme values from docs/tokes-list.md (light mode)
|
|
279
|
+
*/
|
|
280
|
+
declare const defaultTokens: DesignTokens;
|
|
281
|
+
/**
|
|
282
|
+
* Create tokens from defaults and overrides
|
|
283
|
+
*
|
|
284
|
+
* @param overrides - Partial tokens to override defaults
|
|
285
|
+
* @returns Complete DesignTokens object
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* const tokens = createTokens({
|
|
290
|
+
* 'primary': '#7c3aed',
|
|
291
|
+
* 'spacing-4': '1rem',
|
|
292
|
+
* });
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
declare function createTokens(overrides?: Partial<DesignTokens>): DesignTokens;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Theme Manager Type Definitions
|
|
299
|
+
*
|
|
300
|
+
* TypeScript types and interfaces for the Atomix Design System theme management system.
|
|
301
|
+
*/
|
|
302
|
+
/**
|
|
303
|
+
* Theme metadata interface matching themes.config.js structure
|
|
304
|
+
*/
|
|
305
|
+
interface ThemeMetadata {
|
|
306
|
+
/** Display name of the theme */
|
|
307
|
+
name: string;
|
|
308
|
+
/** Unique identifier/class name for the theme */
|
|
309
|
+
class?: string;
|
|
310
|
+
/** Theme description */
|
|
311
|
+
description?: string;
|
|
312
|
+
/** Theme author */
|
|
313
|
+
author?: string;
|
|
314
|
+
/** Theme version (semver) */
|
|
315
|
+
version?: string;
|
|
316
|
+
/** Theme tags for categorization */
|
|
317
|
+
tags?: string[];
|
|
318
|
+
/** Whether the theme supports dark mode */
|
|
319
|
+
supportsDarkMode?: boolean;
|
|
320
|
+
/** Theme status: stable, beta, experimental, deprecated */
|
|
321
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
322
|
+
/** Accessibility information */
|
|
323
|
+
a11y?: {
|
|
324
|
+
/** Target contrast ratio */
|
|
325
|
+
contrastTarget?: number;
|
|
326
|
+
/** Supported color modes */
|
|
327
|
+
modes?: string[];
|
|
328
|
+
};
|
|
329
|
+
/** Primary theme color (for UI display) */
|
|
330
|
+
color?: string;
|
|
331
|
+
/** Theme features list */
|
|
332
|
+
features?: string[];
|
|
333
|
+
/** Theme dependencies (other themes required) */
|
|
334
|
+
dependencies?: string[];
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Theme change event payload
|
|
338
|
+
*/
|
|
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';
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Theme load options
|
|
353
|
+
*/
|
|
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
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Theme validation result
|
|
368
|
+
*/
|
|
369
|
+
interface ThemeValidationResult {
|
|
370
|
+
/** Whether the theme is valid */
|
|
371
|
+
valid: boolean;
|
|
372
|
+
/** Validation errors */
|
|
373
|
+
errors: string[];
|
|
374
|
+
/** Validation warnings */
|
|
375
|
+
warnings: string[];
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* React hook return type for useTheme
|
|
379
|
+
*/
|
|
380
|
+
interface UseThemeReturn {
|
|
381
|
+
/** Current theme name */
|
|
382
|
+
theme: string;
|
|
383
|
+
/** Current active theme object (for JS themes) */
|
|
384
|
+
activeTheme: Theme | null;
|
|
385
|
+
/** Function to change theme (supports string, Theme, or DesignTokens) */
|
|
386
|
+
setTheme: (theme: string | Theme | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
|
|
387
|
+
/** Available themes */
|
|
388
|
+
availableThemes: ThemeMetadata[];
|
|
389
|
+
/** Whether a theme is currently loading */
|
|
390
|
+
isLoading: boolean;
|
|
391
|
+
/** Current error, if any */
|
|
392
|
+
error: Error | null;
|
|
393
|
+
/** Whether a specific theme is loaded */
|
|
394
|
+
isThemeLoaded: (themeName: string) => boolean;
|
|
395
|
+
/** Preload a theme */
|
|
396
|
+
preloadTheme: (themeName: string) => Promise<void>;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Component-level theme override configuration
|
|
400
|
+
*/
|
|
401
|
+
interface ComponentThemeOverride {
|
|
402
|
+
/** CSS variable overrides for the component */
|
|
403
|
+
cssVars?: Record<string, string | number>;
|
|
404
|
+
/** Default prop overrides */
|
|
405
|
+
defaultProps?: Record<string, any>;
|
|
406
|
+
/** Part-specific overrides */
|
|
407
|
+
parts?: Record<string, {
|
|
408
|
+
cssVars?: Record<string, string | number>;
|
|
409
|
+
className?: string;
|
|
410
|
+
}>;
|
|
411
|
+
/** Variant overrides */
|
|
412
|
+
variants?: Record<string, {
|
|
413
|
+
cssVars?: Record<string, string | number>;
|
|
414
|
+
className?: string;
|
|
415
|
+
}>;
|
|
416
|
+
/** Additional className for the component */
|
|
417
|
+
className?: string;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Theme component overrides for all components
|
|
421
|
+
*/
|
|
422
|
+
interface ThemeComponentOverrides {
|
|
423
|
+
Button?: ComponentThemeOverride;
|
|
424
|
+
Card?: ComponentThemeOverride;
|
|
425
|
+
Input?: ComponentThemeOverride;
|
|
426
|
+
Modal?: ComponentThemeOverride;
|
|
427
|
+
Dropdown?: ComponentThemeOverride;
|
|
428
|
+
Badge?: ComponentThemeOverride;
|
|
429
|
+
Tabs?: ComponentThemeOverride;
|
|
430
|
+
Progress?: ComponentThemeOverride;
|
|
431
|
+
Tooltip?: ComponentThemeOverride;
|
|
432
|
+
Select?: ComponentThemeOverride;
|
|
433
|
+
Checkbox?: ComponentThemeOverride;
|
|
434
|
+
Radio?: ComponentThemeOverride;
|
|
435
|
+
Textarea?: ComponentThemeOverride;
|
|
436
|
+
FormGroup?: ComponentThemeOverride;
|
|
437
|
+
Navbar?: ComponentThemeOverride;
|
|
438
|
+
Accordion?: ComponentThemeOverride;
|
|
439
|
+
DataTable?: ComponentThemeOverride;
|
|
440
|
+
Avatar?: ComponentThemeOverride;
|
|
441
|
+
List?: ComponentThemeOverride;
|
|
442
|
+
Popover?: ComponentThemeOverride;
|
|
443
|
+
Messages?: ComponentThemeOverride;
|
|
444
|
+
Callout?: ComponentThemeOverride;
|
|
445
|
+
Spinner?: ComponentThemeOverride;
|
|
446
|
+
[key: string]: ComponentThemeOverride | undefined;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Theme provider props
|
|
450
|
+
*/
|
|
451
|
+
interface ThemeProviderProps {
|
|
452
|
+
/** Child components */
|
|
453
|
+
children: React.ReactNode;
|
|
454
|
+
/** Default theme */
|
|
455
|
+
defaultTheme?: string | Theme;
|
|
456
|
+
/** Available themes */
|
|
457
|
+
themes?: Record<string, ThemeMetadata>;
|
|
458
|
+
/** Base path for theme CSS */
|
|
459
|
+
basePath?: string;
|
|
460
|
+
/** CDN path for theme CSS */
|
|
461
|
+
cdnPath?: string | null;
|
|
462
|
+
/** Themes to preload */
|
|
463
|
+
preload?: string[];
|
|
464
|
+
/** Enable lazy loading */
|
|
465
|
+
lazy?: boolean;
|
|
466
|
+
/** localStorage key */
|
|
467
|
+
storageKey?: string;
|
|
468
|
+
/** Data attribute name */
|
|
469
|
+
dataAttribute?: string;
|
|
470
|
+
/** Enable persistence */
|
|
471
|
+
enablePersistence?: boolean;
|
|
472
|
+
/** Use minified CSS */
|
|
473
|
+
useMinified?: boolean;
|
|
474
|
+
/** Callback when theme changes */
|
|
475
|
+
onThemeChange?: (theme: string | Theme | DesignTokens) => void;
|
|
476
|
+
/** Callback on error */
|
|
477
|
+
onError?: (error: Error, themeName: string) => void;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Theme context value
|
|
481
|
+
*/
|
|
482
|
+
interface ThemeContextValue {
|
|
483
|
+
/** Current theme name */
|
|
484
|
+
theme: string;
|
|
485
|
+
/** Current active theme object (for JS themes) */
|
|
486
|
+
activeTheme: Theme | null;
|
|
487
|
+
/** Set theme function (supports string, Theme, or DesignTokens) */
|
|
488
|
+
setTheme: (theme: string | Theme | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
|
|
489
|
+
/** Available themes */
|
|
490
|
+
availableThemes: ThemeMetadata[];
|
|
491
|
+
/** Loading state */
|
|
492
|
+
isLoading: boolean;
|
|
493
|
+
/** Error state */
|
|
494
|
+
error: Error | null;
|
|
495
|
+
/** Check if theme is loaded */
|
|
496
|
+
isThemeLoaded: (themeName: string) => boolean;
|
|
497
|
+
/** Preload theme */
|
|
498
|
+
preloadTheme: (themeName: string) => Promise<void>;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
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;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Palette configuration options for createTheme
|
|
515
|
+
*/
|
|
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;
|
|
533
|
+
};
|
|
534
|
+
/** Text colors */
|
|
535
|
+
text?: {
|
|
536
|
+
primary?: string;
|
|
537
|
+
secondary?: string;
|
|
538
|
+
disabled?: string;
|
|
539
|
+
};
|
|
540
|
+
/** Additional custom colors */
|
|
541
|
+
[key: string]: any;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Typography configuration options for createTheme
|
|
545
|
+
*/
|
|
546
|
+
interface TypographyOptions {
|
|
547
|
+
/** Font family */
|
|
548
|
+
fontFamily?: string;
|
|
549
|
+
/** Base font size in pixels */
|
|
550
|
+
fontSize?: number;
|
|
551
|
+
/** Font weight scale */
|
|
552
|
+
fontWeightLight?: number;
|
|
553
|
+
fontWeightRegular?: number;
|
|
554
|
+
fontWeightMedium?: number;
|
|
555
|
+
fontWeightSemiBold?: number;
|
|
556
|
+
fontWeightBold?: number;
|
|
557
|
+
/** Heading configurations */
|
|
558
|
+
h1?: {
|
|
559
|
+
fontSize?: string | number;
|
|
560
|
+
fontWeight?: number;
|
|
561
|
+
lineHeight?: number | string;
|
|
562
|
+
letterSpacing?: string;
|
|
563
|
+
};
|
|
564
|
+
h2?: {
|
|
565
|
+
fontSize?: string | number;
|
|
566
|
+
fontWeight?: number;
|
|
567
|
+
lineHeight?: number | string;
|
|
568
|
+
letterSpacing?: string;
|
|
569
|
+
};
|
|
570
|
+
h3?: {
|
|
571
|
+
fontSize?: string | number;
|
|
572
|
+
fontWeight?: number;
|
|
573
|
+
lineHeight?: number | string;
|
|
574
|
+
letterSpacing?: string;
|
|
575
|
+
};
|
|
576
|
+
h4?: {
|
|
577
|
+
fontSize?: string | number;
|
|
578
|
+
fontWeight?: number;
|
|
579
|
+
lineHeight?: number | string;
|
|
580
|
+
letterSpacing?: string;
|
|
581
|
+
};
|
|
582
|
+
h5?: {
|
|
583
|
+
fontSize?: string | number;
|
|
584
|
+
fontWeight?: number;
|
|
585
|
+
lineHeight?: number | string;
|
|
586
|
+
letterSpacing?: string;
|
|
587
|
+
};
|
|
588
|
+
h6?: {
|
|
589
|
+
fontSize?: string | number;
|
|
590
|
+
fontWeight?: number;
|
|
591
|
+
lineHeight?: number | string;
|
|
592
|
+
letterSpacing?: string;
|
|
593
|
+
};
|
|
594
|
+
/** Body text configurations */
|
|
595
|
+
body1?: {
|
|
596
|
+
fontSize?: string | number;
|
|
597
|
+
fontWeight?: number;
|
|
598
|
+
lineHeight?: number | string;
|
|
599
|
+
};
|
|
600
|
+
body2?: {
|
|
601
|
+
fontSize?: string | number;
|
|
602
|
+
fontWeight?: number;
|
|
603
|
+
lineHeight?: number | string;
|
|
604
|
+
};
|
|
605
|
+
/** Additional custom typography */
|
|
606
|
+
[key: string]: any;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Spacing function type
|
|
610
|
+
*/
|
|
611
|
+
type SpacingFunction = (...values: number[]) => string;
|
|
612
|
+
/**
|
|
613
|
+
* Spacing configuration options for createTheme
|
|
614
|
+
*/
|
|
615
|
+
type SpacingOptions = number | number[] | SpacingFunction;
|
|
616
|
+
/**
|
|
617
|
+
* Breakpoint values configuration
|
|
618
|
+
*/
|
|
619
|
+
interface BreakpointValues {
|
|
620
|
+
xs?: number;
|
|
621
|
+
sm?: number;
|
|
622
|
+
md?: number;
|
|
623
|
+
lg?: number;
|
|
624
|
+
xl?: number;
|
|
625
|
+
[key: string]: number | undefined;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Breakpoints configuration options for createTheme
|
|
629
|
+
*/
|
|
630
|
+
interface BreakpointsOptions {
|
|
631
|
+
/** Breakpoint values in pixels */
|
|
632
|
+
values?: BreakpointValues;
|
|
633
|
+
/** Unit for breakpoints (default: 'px') */
|
|
634
|
+
unit?: string;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Shadow configuration
|
|
638
|
+
*/
|
|
639
|
+
interface ShadowOptions {
|
|
640
|
+
xs?: string;
|
|
641
|
+
sm?: string;
|
|
642
|
+
md?: string;
|
|
643
|
+
lg?: string;
|
|
644
|
+
xl?: string;
|
|
645
|
+
[key: string]: string | undefined;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Transition configuration
|
|
649
|
+
*/
|
|
650
|
+
interface TransitionOptions {
|
|
651
|
+
/** Transition duration values */
|
|
652
|
+
duration?: {
|
|
653
|
+
shortest?: number;
|
|
654
|
+
shorter?: number;
|
|
655
|
+
short?: number;
|
|
656
|
+
standard?: number;
|
|
657
|
+
complex?: number;
|
|
658
|
+
enteringScreen?: number;
|
|
659
|
+
leavingScreen?: number;
|
|
660
|
+
};
|
|
661
|
+
/** Easing functions */
|
|
662
|
+
easing?: {
|
|
663
|
+
easeInOut?: string;
|
|
664
|
+
easeOut?: string;
|
|
665
|
+
easeIn?: string;
|
|
666
|
+
sharp?: string;
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Z-index configuration
|
|
671
|
+
*/
|
|
672
|
+
interface ZIndexOptions {
|
|
673
|
+
mobileStepper?: number;
|
|
674
|
+
speedDial?: number;
|
|
675
|
+
appBar?: number;
|
|
676
|
+
drawer?: number;
|
|
677
|
+
modal?: number;
|
|
678
|
+
snackbar?: number;
|
|
679
|
+
tooltip?: number;
|
|
680
|
+
[key: string]: number | undefined;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Border radius configuration
|
|
684
|
+
*/
|
|
685
|
+
interface BorderRadiusOptions {
|
|
686
|
+
/** Base border radius */
|
|
687
|
+
base?: string | number;
|
|
688
|
+
/** Small border radius */
|
|
689
|
+
sm?: string | number;
|
|
690
|
+
/** Medium border radius */
|
|
691
|
+
md?: string | number;
|
|
692
|
+
/** Large border radius */
|
|
693
|
+
lg?: string | number;
|
|
694
|
+
/** Extra large border radius */
|
|
695
|
+
xl?: string | number;
|
|
696
|
+
/** 2X large border radius */
|
|
697
|
+
xxl?: string | number;
|
|
698
|
+
/** 3X large border radius */
|
|
699
|
+
'3xl'?: string | number;
|
|
700
|
+
/** 4X large border radius */
|
|
701
|
+
'4xl'?: string | number;
|
|
702
|
+
/** Pill shape (fully rounded) */
|
|
703
|
+
pill?: string | number;
|
|
704
|
+
[key: string]: string | number | undefined;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Custom theme properties for extension
|
|
708
|
+
* Users can augment this interface via module augmentation
|
|
709
|
+
*/
|
|
710
|
+
interface ThemeCustomProperties {
|
|
711
|
+
[key: string]: any;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Theme configuration options for createTheme
|
|
715
|
+
* Extends ThemeMetadata to support both CSS and JS theme properties
|
|
716
|
+
*/
|
|
717
|
+
interface ThemeOptions extends Partial<ThemeMetadata> {
|
|
718
|
+
/** Color palette configuration */
|
|
719
|
+
palette?: PaletteOptions;
|
|
720
|
+
/** Typography configuration */
|
|
721
|
+
typography?: TypographyOptions;
|
|
722
|
+
/** Spacing configuration */
|
|
723
|
+
spacing?: SpacingOptions;
|
|
724
|
+
/** Breakpoints configuration */
|
|
725
|
+
breakpoints?: BreakpointsOptions;
|
|
726
|
+
/** Shadow configuration */
|
|
727
|
+
shadows?: ShadowOptions;
|
|
728
|
+
/** Transition configuration */
|
|
729
|
+
transitions?: TransitionOptions;
|
|
730
|
+
/** Z-index configuration */
|
|
731
|
+
zIndex?: ZIndexOptions;
|
|
732
|
+
/** Border radius configuration */
|
|
733
|
+
borderRadius?: BorderRadiusOptions;
|
|
734
|
+
/** Custom properties */
|
|
735
|
+
custom?: ThemeCustomProperties;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Complete theme object with computed values
|
|
739
|
+
* Generated by createTheme function
|
|
740
|
+
*/
|
|
741
|
+
interface Theme extends ThemeMetadata {
|
|
742
|
+
/** Color palette with computed values */
|
|
743
|
+
palette: {
|
|
744
|
+
primary: PaletteColor;
|
|
745
|
+
secondary: PaletteColor;
|
|
746
|
+
error: PaletteColor;
|
|
747
|
+
warning: PaletteColor;
|
|
748
|
+
info: PaletteColor;
|
|
749
|
+
success: PaletteColor;
|
|
750
|
+
background: {
|
|
751
|
+
default: string;
|
|
752
|
+
paper: string;
|
|
753
|
+
subtle: string;
|
|
754
|
+
};
|
|
755
|
+
text: {
|
|
756
|
+
primary: string;
|
|
757
|
+
secondary: string;
|
|
758
|
+
disabled: string;
|
|
759
|
+
};
|
|
760
|
+
[key: string]: any;
|
|
761
|
+
};
|
|
762
|
+
/** Typography with computed values */
|
|
763
|
+
typography: {
|
|
764
|
+
fontFamily: string;
|
|
765
|
+
fontSize: number;
|
|
766
|
+
fontWeightLight: number;
|
|
767
|
+
fontWeightRegular: number;
|
|
768
|
+
fontWeightMedium: number;
|
|
769
|
+
fontWeightSemiBold: number;
|
|
770
|
+
fontWeightBold: number;
|
|
771
|
+
h1: Required<NonNullable<TypographyOptions['h1']>>;
|
|
772
|
+
h2: Required<NonNullable<TypographyOptions['h2']>>;
|
|
773
|
+
h3: Required<NonNullable<TypographyOptions['h3']>>;
|
|
774
|
+
h4: Required<NonNullable<TypographyOptions['h4']>>;
|
|
775
|
+
h5: Required<NonNullable<TypographyOptions['h5']>>;
|
|
776
|
+
h6: Required<NonNullable<TypographyOptions['h6']>>;
|
|
777
|
+
body1: Required<NonNullable<TypographyOptions['body1']>>;
|
|
778
|
+
body2: Required<NonNullable<TypographyOptions['body2']>>;
|
|
779
|
+
[key: string]: any;
|
|
780
|
+
};
|
|
781
|
+
/** Spacing function */
|
|
782
|
+
spacing: SpacingFunction;
|
|
783
|
+
/** Breakpoints with computed values */
|
|
784
|
+
breakpoints: {
|
|
785
|
+
values: Required<BreakpointValues>;
|
|
786
|
+
unit: string;
|
|
787
|
+
up: (key: keyof BreakpointValues | number) => string;
|
|
788
|
+
down: (key: keyof BreakpointValues | number) => string;
|
|
789
|
+
between: (start: keyof BreakpointValues | number, end: keyof BreakpointValues | number) => string;
|
|
790
|
+
};
|
|
791
|
+
/** Shadows */
|
|
792
|
+
shadows: Required<ShadowOptions>;
|
|
793
|
+
/** Transitions */
|
|
794
|
+
transitions: Required<TransitionOptions>;
|
|
795
|
+
/** Z-index values */
|
|
796
|
+
zIndex: Required<ZIndexOptions>;
|
|
797
|
+
/** Border radius values */
|
|
798
|
+
borderRadius: Required<BorderRadiusOptions>;
|
|
799
|
+
/** Custom properties */
|
|
800
|
+
custom: ThemeCustomProperties;
|
|
801
|
+
/** Global CSS variables to apply */
|
|
802
|
+
cssVars?: Record<string, string | number>;
|
|
803
|
+
/** Indicates this is a JS theme (not CSS-only) */
|
|
804
|
+
__isJSTheme: true;
|
|
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
|
|
815
|
+
*/
|
|
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
|
+
}
|
|
822
|
+
/**
|
|
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
|
+
* ```
|
|
841
|
+
*/
|
|
842
|
+
declare function generateCSSVariables(tokens: DesignTokens, options?: GenerateCSSVariablesOptions): string;
|
|
843
|
+
/**
|
|
844
|
+
* Generate CSS variables with custom selector
|
|
845
|
+
*
|
|
846
|
+
* Useful for theme-specific selectors like `[data-theme="dark"]`
|
|
847
|
+
*
|
|
848
|
+
* @param tokens - Design tokens object
|
|
849
|
+
* @param selector - CSS selector (e.g., '[data-theme="dark"]')
|
|
850
|
+
* @param prefix - CSS variable prefix
|
|
851
|
+
* @returns CSS string
|
|
852
|
+
*
|
|
853
|
+
* @example
|
|
854
|
+
* ```typescript
|
|
855
|
+
* const css = generateCSSVariablesForSelector(
|
|
856
|
+
* tokens,
|
|
857
|
+
* '[data-theme="dark"]',
|
|
858
|
+
* 'atomix'
|
|
859
|
+
* );
|
|
860
|
+
* ```
|
|
861
|
+
*/
|
|
862
|
+
declare function generateCSSVariablesForSelector(tokens: DesignTokens, selector: string, prefix?: string): string;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Core Theme Functions
|
|
866
|
+
*
|
|
867
|
+
* Unified theme system that handles both DesignTokens and Theme objects.
|
|
868
|
+
* Config-first approach: loads from atomix.config.ts when no input is provided.
|
|
869
|
+
* Config file is required for automatic loading.
|
|
870
|
+
*/
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Create theme CSS from tokens or Theme object
|
|
874
|
+
*
|
|
875
|
+
* **Config-First Approach**: If no input is provided, loads from `atomix.config.ts`.
|
|
876
|
+
* Config file is required for automatic loading.
|
|
877
|
+
*
|
|
878
|
+
* @param input - DesignTokens (partial), Theme object, or undefined (loads from config)
|
|
879
|
+
* @param options - CSS generation options (prefix is automatically read from config if not provided)
|
|
880
|
+
* @returns CSS string with custom properties
|
|
881
|
+
* @throws Error if config loading fails when no input is provided
|
|
882
|
+
*
|
|
883
|
+
* @example
|
|
884
|
+
* ```typescript
|
|
885
|
+
* // Loads from atomix.config.ts (config file required)
|
|
886
|
+
* const css = createTheme();
|
|
887
|
+
*
|
|
888
|
+
* // Using DesignTokens
|
|
889
|
+
* const css = createTheme({
|
|
890
|
+
* 'primary': '#7c3aed',
|
|
891
|
+
* 'spacing-4': '1rem',
|
|
892
|
+
* });
|
|
893
|
+
*
|
|
894
|
+
* // Using Theme object
|
|
895
|
+
* const theme = createThemeObject({ palette: { primary: { main: '#7c3aed' } } });
|
|
896
|
+
* const css = createTheme(theme);
|
|
897
|
+
*
|
|
898
|
+
* // With custom options
|
|
899
|
+
* const css = createTheme(undefined, { prefix: 'myapp', selector: ':root' });
|
|
900
|
+
* ```
|
|
901
|
+
*/
|
|
902
|
+
declare function createTheme(input?: Partial<DesignTokens> | Theme, options?: GenerateCSSVariablesOptions): string;
|
|
903
|
+
|
|
904
|
+
/**
|
|
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
|
+
* ```
|
|
926
|
+
*/
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Create a theme object with computed values
|
|
930
|
+
*
|
|
931
|
+
* @param options - Theme configuration options
|
|
932
|
+
* @returns Complete theme object
|
|
933
|
+
*/
|
|
934
|
+
declare function createThemeObject(...options: ThemeOptions[]): Theme;
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Theme Composition Utilities
|
|
938
|
+
*
|
|
939
|
+
* Utilities for composing, merging, and extending themes.
|
|
940
|
+
*/
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Deep merge multiple objects
|
|
944
|
+
* Later objects override earlier ones
|
|
945
|
+
*/
|
|
946
|
+
declare function deepMerge<T extends Record<string, any>>(...objects: Partial<T>[]): T;
|
|
947
|
+
/**
|
|
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;
|
|
961
|
+
/**
|
|
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
|
+
* ```
|
|
975
|
+
*/
|
|
976
|
+
declare function extendTheme(baseTheme: Theme | ThemeOptions, extension: ThemeOptions): Theme;
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Atomix Configuration System
|
|
980
|
+
*
|
|
981
|
+
* Tailwind-like configuration for customizing the Atomix Design System.
|
|
982
|
+
*
|
|
983
|
+
* External developers can create `atomix.config.ts` in their project root
|
|
984
|
+
* to customize design tokens, similar to Tailwind's tailwind.config.js
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```typescript
|
|
988
|
+
* // atomix.config.ts (in your project)
|
|
989
|
+
* import { defineConfig } from '@shohojdhara/atomix/config';
|
|
990
|
+
*
|
|
991
|
+
* export default defineConfig({
|
|
992
|
+
* theme: {
|
|
993
|
+
* extend: {
|
|
994
|
+
* colors: {
|
|
995
|
+
* primary: { main: '#7AFFD7' },
|
|
996
|
+
* },
|
|
997
|
+
* },
|
|
998
|
+
* },
|
|
999
|
+
* });
|
|
1000
|
+
* ```
|
|
1001
|
+
*/
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* CSS Theme Definition
|
|
1005
|
+
*/
|
|
1006
|
+
interface CSSThemeDefinition {
|
|
1007
|
+
type: 'css';
|
|
1008
|
+
name: string;
|
|
1009
|
+
class?: string;
|
|
1010
|
+
description?: string;
|
|
1011
|
+
author?: string;
|
|
1012
|
+
version?: string;
|
|
1013
|
+
tags?: string[];
|
|
1014
|
+
supportsDarkMode?: boolean;
|
|
1015
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
1016
|
+
a11y?: {
|
|
1017
|
+
contrastTarget?: number;
|
|
1018
|
+
modes?: string[];
|
|
1019
|
+
};
|
|
1020
|
+
color?: string;
|
|
1021
|
+
features?: string[];
|
|
1022
|
+
dependencies?: string[];
|
|
1023
|
+
cssPath?: string;
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* JavaScript Theme Definition
|
|
1027
|
+
*/
|
|
1028
|
+
interface JSThemeDefinition {
|
|
1029
|
+
type: 'js';
|
|
1030
|
+
name: string;
|
|
1031
|
+
class?: string;
|
|
1032
|
+
description?: string;
|
|
1033
|
+
author?: string;
|
|
1034
|
+
version?: string;
|
|
1035
|
+
tags?: string[];
|
|
1036
|
+
supportsDarkMode?: boolean;
|
|
1037
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
1038
|
+
a11y?: {
|
|
1039
|
+
contrastTarget?: number;
|
|
1040
|
+
modes?: string[];
|
|
1041
|
+
};
|
|
1042
|
+
color?: string;
|
|
1043
|
+
features?: string[];
|
|
1044
|
+
dependencies?: string[];
|
|
1045
|
+
createTheme: () => Theme;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Theme Definition (CSS or JS)
|
|
1049
|
+
*/
|
|
1050
|
+
type ThemeDefinition = CSSThemeDefinition | JSThemeDefinition;
|
|
1051
|
+
/**
|
|
1052
|
+
* Build configuration (migrated from theme.config.ts)
|
|
1053
|
+
*/
|
|
1054
|
+
interface BuildConfig {
|
|
1055
|
+
output?: {
|
|
1056
|
+
directory?: string;
|
|
1057
|
+
formats?: {
|
|
1058
|
+
expanded?: string;
|
|
1059
|
+
compressed?: string;
|
|
1060
|
+
};
|
|
1061
|
+
};
|
|
1062
|
+
sass?: {
|
|
1063
|
+
style?: 'expanded' | 'compressed';
|
|
1064
|
+
sourceMap?: boolean;
|
|
1065
|
+
loadPaths?: string[];
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Runtime configuration (migrated from theme.config.ts)
|
|
1070
|
+
*/
|
|
1071
|
+
interface RuntimeConfig {
|
|
1072
|
+
basePath?: string;
|
|
1073
|
+
cdnPath?: string | null;
|
|
1074
|
+
preload?: string[];
|
|
1075
|
+
lazy?: boolean;
|
|
1076
|
+
defaultTheme?: string;
|
|
1077
|
+
storageKey?: string;
|
|
1078
|
+
dataAttribute?: string;
|
|
1079
|
+
enablePersistence?: boolean;
|
|
1080
|
+
useMinified?: boolean;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Integration settings (migrated from theme.config.ts)
|
|
1084
|
+
*/
|
|
1085
|
+
interface IntegrationConfig {
|
|
1086
|
+
cssVariables?: Record<string, string>;
|
|
1087
|
+
classNames?: {
|
|
1088
|
+
theme?: string;
|
|
1089
|
+
colorMode?: string;
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Theme Configuration Types
|
|
1095
|
+
*
|
|
1096
|
+
* Type definitions for the theme configuration system
|
|
1097
|
+
*/
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Loaded and validated theme configuration
|
|
1101
|
+
*/
|
|
1102
|
+
interface LoadedThemeConfig {
|
|
1103
|
+
/** Registered themes */
|
|
1104
|
+
themes: Record<string, ThemeDefinition>;
|
|
1105
|
+
/** Build configuration */
|
|
1106
|
+
build: BuildConfig;
|
|
1107
|
+
/** Runtime configuration */
|
|
1108
|
+
runtime: RuntimeConfig;
|
|
1109
|
+
/** Integration settings */
|
|
1110
|
+
integration: IntegrationConfig;
|
|
1111
|
+
/** Theme dependencies mapping */
|
|
1112
|
+
dependencies: Record<string, string[]>;
|
|
1113
|
+
/** Whether config was validated */
|
|
1114
|
+
validated: boolean;
|
|
1115
|
+
/** Validation errors (if any) */
|
|
1116
|
+
errors?: string[];
|
|
1117
|
+
/** Validation warnings (if any) */
|
|
1118
|
+
warnings?: string[];
|
|
1119
|
+
/** Internal tokens (for generator) */
|
|
1120
|
+
__tokens?: any;
|
|
1121
|
+
/** Internal extensions (for generator) */
|
|
1122
|
+
__extend?: any;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Theme Registry
|
|
1127
|
+
*
|
|
1128
|
+
* Central registry for all themes with discovery and dependency management
|
|
1129
|
+
*/
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Registry entry
|
|
1133
|
+
*/
|
|
1134
|
+
interface RegistryEntry {
|
|
1135
|
+
/** Theme ID */
|
|
1136
|
+
id: string;
|
|
1137
|
+
/** Theme definition from config */
|
|
1138
|
+
definition: ThemeDefinition;
|
|
1139
|
+
/** Resolved theme object (for JS themes) */
|
|
1140
|
+
theme?: Theme;
|
|
1141
|
+
/** Whether theme is loaded */
|
|
1142
|
+
loaded: boolean;
|
|
1143
|
+
/** Loading promise (if currently loading) */
|
|
1144
|
+
loading?: Promise<Theme | void>;
|
|
1145
|
+
/** Dependencies */
|
|
1146
|
+
dependencies: string[];
|
|
1147
|
+
/** Dependent themes (themes that depend on this one) */
|
|
1148
|
+
dependents: string[];
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Theme Registry
|
|
1152
|
+
*
|
|
1153
|
+
* Manages theme registration, discovery, and dependency resolution
|
|
1154
|
+
*/
|
|
1155
|
+
declare class ThemeRegistry {
|
|
1156
|
+
private entries;
|
|
1157
|
+
private config;
|
|
1158
|
+
private initialized;
|
|
1159
|
+
/**
|
|
1160
|
+
* Initialize registry from config
|
|
1161
|
+
*/
|
|
1162
|
+
initialize(config?: LoadedThemeConfig): Promise<void>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Register a theme
|
|
1165
|
+
*/
|
|
1166
|
+
register(themeId: string, definition: ThemeDefinition): void;
|
|
1167
|
+
/**
|
|
1168
|
+
* Get theme entry
|
|
1169
|
+
*/
|
|
1170
|
+
get(themeId: string): RegistryEntry | undefined;
|
|
1171
|
+
/**
|
|
1172
|
+
* Check if theme exists
|
|
1173
|
+
*/
|
|
1174
|
+
has(themeId: string): boolean;
|
|
1175
|
+
/**
|
|
1176
|
+
* Get all theme IDs
|
|
1177
|
+
*/
|
|
1178
|
+
getAllIds(): string[];
|
|
1179
|
+
/**
|
|
1180
|
+
* Get all theme metadata
|
|
1181
|
+
*/
|
|
1182
|
+
getAllMetadata(): ThemeMetadata[];
|
|
1183
|
+
/**
|
|
1184
|
+
* Get theme definition
|
|
1185
|
+
*/
|
|
1186
|
+
getDefinition(themeId: string): ThemeDefinition | undefined;
|
|
1187
|
+
/**
|
|
1188
|
+
* Check if a theme is loaded
|
|
1189
|
+
*/
|
|
1190
|
+
isThemeLoaded(themeId: string): boolean;
|
|
1191
|
+
/**
|
|
1192
|
+
* Mark a theme as loaded
|
|
1193
|
+
*/
|
|
1194
|
+
markLoaded(themeId: string, theme?: Theme): void;
|
|
1195
|
+
/**
|
|
1196
|
+
* Get theme object (for JS themes)
|
|
1197
|
+
*/
|
|
1198
|
+
getTheme(themeId: string): Theme | undefined;
|
|
1199
|
+
/**
|
|
1200
|
+
* Get dependencies for a theme
|
|
1201
|
+
*/
|
|
1202
|
+
getDependencies(themeId: string): string[];
|
|
1203
|
+
/**
|
|
1204
|
+
* Get dependents for a theme (themes that depend on this one)
|
|
1205
|
+
*/
|
|
1206
|
+
getDependents(themeId: string): string[];
|
|
1207
|
+
/**
|
|
1208
|
+
* Resolve all dependencies in correct order
|
|
1209
|
+
*/
|
|
1210
|
+
resolveDependencyOrder(themeId: string): string[];
|
|
1211
|
+
/**
|
|
1212
|
+
* Resolve dependencies and build dependency graph
|
|
1213
|
+
*/
|
|
1214
|
+
private resolveDependencies;
|
|
1215
|
+
/**
|
|
1216
|
+
* Validate all themes
|
|
1217
|
+
*/
|
|
1218
|
+
validate(): {
|
|
1219
|
+
valid: boolean;
|
|
1220
|
+
errors: string[];
|
|
1221
|
+
};
|
|
1222
|
+
/**
|
|
1223
|
+
* Clear registry
|
|
1224
|
+
*/
|
|
1225
|
+
clear(): void;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* CSS File Utilities
|
|
1230
|
+
*
|
|
1231
|
+
* Save CSS to file system (Node.js only).
|
|
1232
|
+
*/
|
|
1233
|
+
/**
|
|
1234
|
+
* Save CSS to file
|
|
1235
|
+
*
|
|
1236
|
+
* Writes CSS string to a file. Only works in Node.js environment.
|
|
1237
|
+
*
|
|
1238
|
+
* @param css - CSS string to save
|
|
1239
|
+
* @param filePath - Output file path
|
|
1240
|
+
* @throws Error if called in browser environment
|
|
1241
|
+
*
|
|
1242
|
+
* @example
|
|
1243
|
+
* ```typescript
|
|
1244
|
+
* const css = ':root { --atomix-color-primary: #7AFFD7; }';
|
|
1245
|
+
* await saveCSSFile(css, './themes/custom.css');
|
|
1246
|
+
* ```
|
|
1247
|
+
*/
|
|
1248
|
+
declare function saveCSSFile(css: string, filePath: string): Promise<void>;
|
|
1249
|
+
/**
|
|
1250
|
+
* Save CSS to file (synchronous version)
|
|
1251
|
+
*
|
|
1252
|
+
* Synchronous version of saveCSSFile. Only works in Node.js environment.
|
|
1253
|
+
*
|
|
1254
|
+
* @param css - CSS string to save
|
|
1255
|
+
* @param filePath - Output file path
|
|
1256
|
+
* @throws Error if called in browser environment
|
|
1257
|
+
*/
|
|
1258
|
+
declare function saveCSSFileSync(css: string, filePath: string): void;
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* CSS Injection Utilities
|
|
1262
|
+
*
|
|
1263
|
+
* Inject CSS into HTML head via <style> element.
|
|
1264
|
+
*/
|
|
1265
|
+
/**
|
|
1266
|
+
* Inject CSS into HTML head via <style> element
|
|
1267
|
+
*
|
|
1268
|
+
* Creates or updates a style element in the document head.
|
|
1269
|
+
* If an element with the same ID exists, it will be updated.
|
|
1270
|
+
*
|
|
1271
|
+
* @param css - CSS string to inject
|
|
1272
|
+
* @param id - Style element ID (default: 'atomix-theme')
|
|
1273
|
+
*
|
|
1274
|
+
* @example
|
|
1275
|
+
* ```typescript
|
|
1276
|
+
* const css = ':root { --atomix-color-primary: #7AFFD7; }';
|
|
1277
|
+
* injectCSS(css);
|
|
1278
|
+
*
|
|
1279
|
+
* // With custom ID
|
|
1280
|
+
* injectCSS(css, 'my-custom-theme');
|
|
1281
|
+
* ```
|
|
1282
|
+
*/
|
|
1283
|
+
declare function injectCSS(css: string, id?: string): void;
|
|
1284
|
+
/**
|
|
1285
|
+
* Remove injected CSS from DOM
|
|
1286
|
+
*
|
|
1287
|
+
* Removes the style element with the given ID from the document head.
|
|
1288
|
+
*
|
|
1289
|
+
* @param id - Style element ID to remove (default: 'atomix-theme')
|
|
1290
|
+
*
|
|
1291
|
+
* @example
|
|
1292
|
+
* ```typescript
|
|
1293
|
+
* removeCSS(); // Removes default 'atomix-theme'
|
|
1294
|
+
* removeCSS('my-custom-theme'); // Removes custom ID
|
|
1295
|
+
* ```
|
|
1296
|
+
*/
|
|
1297
|
+
declare function removeCSS(id?: string): void;
|
|
1298
|
+
/**
|
|
1299
|
+
* Check if CSS is already injected
|
|
1300
|
+
*
|
|
1301
|
+
* @param id - Style element ID to check (default: 'atomix-theme')
|
|
1302
|
+
* @returns True if style element exists
|
|
1303
|
+
*/
|
|
1304
|
+
declare function isCSSInjected(id?: string): boolean;
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* Config Loader
|
|
1308
|
+
*
|
|
1309
|
+
* Load design tokens from atomix.config.ts and convert to flat token format.
|
|
1310
|
+
*/
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* Load theme tokens from atomix.config.ts
|
|
1314
|
+
*
|
|
1315
|
+
* Loads atomix.config.ts and extracts theme tokens.
|
|
1316
|
+
* Config file is required - throws error if not found.
|
|
1317
|
+
*
|
|
1318
|
+
* @param configPath - Optional custom config path (default: 'atomix.config.ts')
|
|
1319
|
+
* @returns Partial DesignTokens from config
|
|
1320
|
+
* @throws Error if config file is not found or cannot be loaded
|
|
1321
|
+
*
|
|
1322
|
+
* @example
|
|
1323
|
+
* ```typescript
|
|
1324
|
+
* const tokens = await loadThemeFromConfig();
|
|
1325
|
+
* const css = createTheme(tokens);
|
|
1326
|
+
* injectTheme(css);
|
|
1327
|
+
* ```
|
|
1328
|
+
*/
|
|
1329
|
+
declare function loadThemeFromConfig(configPath?: string): Promise<Partial<DesignTokens>>;
|
|
1330
|
+
/**
|
|
1331
|
+
* Load theme tokens from atomix.config.ts (synchronous version)
|
|
1332
|
+
*
|
|
1333
|
+
* Synchronous version that uses require() instead of dynamic import.
|
|
1334
|
+
* Only works in Node.js environment.
|
|
1335
|
+
* Config file is required - throws error if not found.
|
|
1336
|
+
*
|
|
1337
|
+
* @param configPath - Optional custom config path
|
|
1338
|
+
* @returns Partial DesignTokens from config
|
|
1339
|
+
* @throws Error if config file is not found or cannot be loaded
|
|
1340
|
+
*/
|
|
1341
|
+
declare function loadThemeFromConfigSync(configPath?: string): Partial<DesignTokens>;
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Theme Provider
|
|
1345
|
+
*
|
|
1346
|
+
* React context provider for theme management
|
|
1347
|
+
*/
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* ThemeProvider component
|
|
1351
|
+
*
|
|
1352
|
+
* Provides theme context to child components and manages theme state.
|
|
1353
|
+
*
|
|
1354
|
+
* **Config-First Approach**: If `defaultTheme` is not provided, loads from `atomix.config.ts`.
|
|
1355
|
+
* Config file is required when `defaultTheme` is not provided.
|
|
1356
|
+
*
|
|
1357
|
+
* @example
|
|
1358
|
+
* ```tsx
|
|
1359
|
+
* import { ThemeProvider } from '@shohojdhara/atomix/theme';
|
|
1360
|
+
*
|
|
1361
|
+
* // Loads from atomix.config.ts (config file required)
|
|
1362
|
+
* function App() {
|
|
1363
|
+
* return (
|
|
1364
|
+
* <ThemeProvider>
|
|
1365
|
+
* <YourApp />
|
|
1366
|
+
* </ThemeProvider>
|
|
1367
|
+
* );
|
|
1368
|
+
* }
|
|
1369
|
+
*
|
|
1370
|
+
* // Provide explicit theme (bypasses config)
|
|
1371
|
+
* function App() {
|
|
1372
|
+
* return (
|
|
1373
|
+
* <ThemeProvider defaultTheme="dark">
|
|
1374
|
+
* <YourApp />
|
|
1375
|
+
* </ThemeProvider>
|
|
1376
|
+
* );
|
|
1377
|
+
* }
|
|
1378
|
+
* ```
|
|
1379
|
+
*/
|
|
1380
|
+
declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* useTheme Hook
|
|
1384
|
+
*
|
|
1385
|
+
* React hook for accessing theme context
|
|
1386
|
+
*/
|
|
1387
|
+
|
|
1388
|
+
/**
|
|
1389
|
+
* useTheme hook
|
|
1390
|
+
*
|
|
1391
|
+
* Access theme context and theme management functions
|
|
1392
|
+
*
|
|
1393
|
+
* @example
|
|
1394
|
+
* ```tsx
|
|
1395
|
+
* function MyComponent() {
|
|
1396
|
+
* const { theme, setTheme, availableThemes } = useTheme();
|
|
1397
|
+
*
|
|
1398
|
+
* return (
|
|
1399
|
+
* <div>
|
|
1400
|
+
* <p>Current theme: {theme}</p>
|
|
1401
|
+
* <button onClick={() => setTheme('dark-theme')}>
|
|
1402
|
+
* Switch to Dark
|
|
1403
|
+
* </button>
|
|
1404
|
+
* </div>
|
|
1405
|
+
* );
|
|
1406
|
+
* }
|
|
1407
|
+
* ```
|
|
1408
|
+
*/
|
|
1409
|
+
declare function useTheme(): UseThemeReturn;
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* Theme context with default values
|
|
1413
|
+
*/
|
|
1414
|
+
declare const ThemeContext: React$1.Context<ThemeContextValue | null>;
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Theme Error Boundary
|
|
1418
|
+
*
|
|
1419
|
+
* React error boundary for catching and handling theme-related errors.
|
|
1420
|
+
* Prevents the entire app from crashing when theme errors occur.
|
|
1421
|
+
*/
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* Error boundary state
|
|
1425
|
+
*/
|
|
1426
|
+
interface ThemeErrorBoundaryState {
|
|
1427
|
+
/** Whether an error has occurred */
|
|
1428
|
+
hasError: boolean;
|
|
1429
|
+
/** The error that occurred */
|
|
1430
|
+
error: Error | null;
|
|
1431
|
+
/** Error information */
|
|
1432
|
+
errorInfo: ErrorInfo | null;
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Error boundary props
|
|
1436
|
+
*/
|
|
1437
|
+
interface ThemeErrorBoundaryProps {
|
|
1438
|
+
/** Child components */
|
|
1439
|
+
children: ReactNode;
|
|
1440
|
+
/** Fallback UI to render when error occurs */
|
|
1441
|
+
fallback?: (error: Error, errorInfo: ErrorInfo) => ReactNode;
|
|
1442
|
+
/** Callback when error occurs */
|
|
1443
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
1444
|
+
/** Whether to reset error on children change */
|
|
1445
|
+
resetOnPropsChange?: boolean;
|
|
1446
|
+
/** Custom error message */
|
|
1447
|
+
errorMessage?: string;
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Theme Error Boundary Component
|
|
1451
|
+
*
|
|
1452
|
+
* Catches errors in the theme system and displays a fallback UI
|
|
1453
|
+
* instead of crashing the entire application.
|
|
1454
|
+
*/
|
|
1455
|
+
declare class ThemeErrorBoundary extends Component<ThemeErrorBoundaryProps, ThemeErrorBoundaryState> {
|
|
1456
|
+
private logger;
|
|
1457
|
+
constructor(props: ThemeErrorBoundaryProps);
|
|
1458
|
+
static getDerivedStateFromError(error: Error): Partial<ThemeErrorBoundaryState>;
|
|
1459
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
1460
|
+
componentDidUpdate(prevProps: ThemeErrorBoundaryProps): void;
|
|
1461
|
+
render(): ReactNode;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
/**
|
|
1465
|
+
* Theme Applicator
|
|
1466
|
+
*
|
|
1467
|
+
* Applies theme configurations to the DOM, including CSS variables,
|
|
1468
|
+
* component overrides, typography, spacing, and color palettes.
|
|
1469
|
+
*
|
|
1470
|
+
* Uses the unified theme system for CSS generation and injection.
|
|
1471
|
+
*/
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* Theme applicator class for runtime theme application
|
|
1475
|
+
*
|
|
1476
|
+
* Uses the unified theme system for efficient CSS variable generation and injection.
|
|
1477
|
+
*/
|
|
1478
|
+
declare class ThemeApplicator {
|
|
1479
|
+
private root;
|
|
1480
|
+
private styleId;
|
|
1481
|
+
constructor(root?: HTMLElement);
|
|
1482
|
+
/**
|
|
1483
|
+
* Apply a complete theme configuration
|
|
1484
|
+
*
|
|
1485
|
+
* Uses the unified theme system to convert Theme to DesignTokens and inject CSS.
|
|
1486
|
+
* Automatically respects atomix.config.ts when using DesignTokens.
|
|
1487
|
+
*/
|
|
1488
|
+
applyTheme(theme: Theme | DesignTokens): void;
|
|
1489
|
+
/**
|
|
1490
|
+
* Apply DesignTokens using unified theme system
|
|
1491
|
+
*
|
|
1492
|
+
* Uses createTheme() which automatically loads from atomix.config.ts
|
|
1493
|
+
* if no tokens are provided, ensuring config is always respected.
|
|
1494
|
+
*/
|
|
1495
|
+
private applyDesignTokens;
|
|
1496
|
+
/**
|
|
1497
|
+
* Check if object is DesignTokens
|
|
1498
|
+
*/
|
|
1499
|
+
private isDesignTokens;
|
|
1500
|
+
/**
|
|
1501
|
+
* Apply global CSS variables (for component overrides)
|
|
1502
|
+
*/
|
|
1503
|
+
private applyGlobalCSSVars;
|
|
1504
|
+
/**
|
|
1505
|
+
* Apply component-level overrides
|
|
1506
|
+
*/
|
|
1507
|
+
private applyComponentOverrides;
|
|
1508
|
+
/**
|
|
1509
|
+
* Apply override for a specific component
|
|
1510
|
+
*/
|
|
1511
|
+
private applyComponentOverride;
|
|
1512
|
+
/**
|
|
1513
|
+
* Clear all applied CSS variables
|
|
1514
|
+
*/
|
|
1515
|
+
private clearAppliedVars;
|
|
1516
|
+
/**
|
|
1517
|
+
* Remove theme application
|
|
1518
|
+
*/
|
|
1519
|
+
removeTheme(): void;
|
|
1520
|
+
/**
|
|
1521
|
+
* Update specific CSS variables without clearing all
|
|
1522
|
+
*/
|
|
1523
|
+
updateCSSVars(vars: Record<string, string | number>): void;
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Get or create global theme applicator
|
|
1527
|
+
*/
|
|
1528
|
+
declare function getThemeApplicator(): ThemeApplicator;
|
|
1529
|
+
/**
|
|
1530
|
+
* Apply theme using global applicator
|
|
1531
|
+
*/
|
|
1532
|
+
declare function applyTheme(theme: Theme): void;
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Theme Preview Component
|
|
1536
|
+
*
|
|
1537
|
+
* React component for previewing themes in development
|
|
1538
|
+
* Enhanced with interactive components, viewport controls, and dark mode toggle
|
|
1539
|
+
*/
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* Theme preview props
|
|
1543
|
+
*/
|
|
1544
|
+
interface ThemePreviewProps {
|
|
1545
|
+
/** Theme to preview */
|
|
1546
|
+
theme: Theme;
|
|
1547
|
+
/** Show theme details */
|
|
1548
|
+
showDetails?: boolean;
|
|
1549
|
+
/** Show color palette */
|
|
1550
|
+
showPalette?: boolean;
|
|
1551
|
+
/** Show typography */
|
|
1552
|
+
showTypography?: boolean;
|
|
1553
|
+
/** Show spacing */
|
|
1554
|
+
showSpacing?: boolean;
|
|
1555
|
+
/** Custom components to render */
|
|
1556
|
+
children?: React__default.ReactNode;
|
|
1557
|
+
/** CSS class name */
|
|
1558
|
+
className?: string;
|
|
1559
|
+
/** Inline styles */
|
|
1560
|
+
style?: React__default.CSSProperties;
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Theme Preview Component
|
|
1564
|
+
*
|
|
1565
|
+
* Renders a preview of a theme with sample components
|
|
1566
|
+
*/
|
|
1567
|
+
declare const ThemePreview: React__default.FC<ThemePreviewProps>;
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* Theme Inspector Component
|
|
1571
|
+
*
|
|
1572
|
+
* React component for inspecting and debugging themes
|
|
1573
|
+
* Enhanced with search/filter and copy path functionality
|
|
1574
|
+
*/
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* Theme inspector props
|
|
1578
|
+
*/
|
|
1579
|
+
interface ThemeInspectorProps {
|
|
1580
|
+
/** Theme to inspect */
|
|
1581
|
+
theme: Theme;
|
|
1582
|
+
/** Show validation results */
|
|
1583
|
+
showValidation?: boolean;
|
|
1584
|
+
/** Show CSS variables */
|
|
1585
|
+
showCSSVariables?: boolean;
|
|
1586
|
+
/** Show theme structure */
|
|
1587
|
+
showStructure?: boolean;
|
|
1588
|
+
/** CSS class name */
|
|
1589
|
+
className?: string;
|
|
1590
|
+
/** Inline styles */
|
|
1591
|
+
style?: React__default.CSSProperties;
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Theme Inspector Component
|
|
1595
|
+
*
|
|
1596
|
+
* Provides detailed inspection and debugging information for themes
|
|
1597
|
+
*/
|
|
1598
|
+
declare const ThemeInspector: React__default.FC<ThemeInspectorProps>;
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* Theme Comparator Component
|
|
1602
|
+
*
|
|
1603
|
+
* React component for comparing two themes side-by-side
|
|
1604
|
+
* Enhanced with search/filter and improved visual diff styling
|
|
1605
|
+
*/
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* Theme comparator props
|
|
1609
|
+
*/
|
|
1610
|
+
interface ThemeComparatorProps {
|
|
1611
|
+
/** First theme to compare */
|
|
1612
|
+
themeA: Theme;
|
|
1613
|
+
/** Second theme to compare */
|
|
1614
|
+
themeB: Theme;
|
|
1615
|
+
/** Show only differences */
|
|
1616
|
+
showOnlyDifferences?: boolean;
|
|
1617
|
+
/** CSS class name */
|
|
1618
|
+
className?: string;
|
|
1619
|
+
/** Inline styles */
|
|
1620
|
+
style?: React__default.CSSProperties;
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Theme Comparator Component
|
|
1624
|
+
*
|
|
1625
|
+
* Compares two themes and highlights differences
|
|
1626
|
+
*/
|
|
1627
|
+
declare const ThemeComparator: React__default.FC<ThemeComparatorProps>;
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* Theme Live Editor Component
|
|
1631
|
+
*
|
|
1632
|
+
* React component for live editing themes in development
|
|
1633
|
+
* Enhanced with undo/redo, keyboard shortcuts, resizable layout, and better color pickers
|
|
1634
|
+
*/
|
|
1635
|
+
|
|
1636
|
+
/**
|
|
1637
|
+
* Live editor props
|
|
1638
|
+
*/
|
|
1639
|
+
interface ThemeLiveEditorProps {
|
|
1640
|
+
/** Initial theme */
|
|
1641
|
+
initialTheme: Theme;
|
|
1642
|
+
/** Callback when theme changes */
|
|
1643
|
+
onChange?: (theme: Theme) => void;
|
|
1644
|
+
/** CSS class name */
|
|
1645
|
+
className?: string;
|
|
1646
|
+
/** Inline styles */
|
|
1647
|
+
style?: React__default.CSSProperties;
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Theme Live Editor Component
|
|
1651
|
+
*
|
|
1652
|
+
* Allows live editing of theme properties with instant preview
|
|
1653
|
+
*/
|
|
1654
|
+
declare const ThemeLiveEditor: React__default.FC<ThemeLiveEditorProps>;
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Theme Validator
|
|
1658
|
+
*
|
|
1659
|
+
* Runtime theme validation including color contrast and accessibility checks
|
|
1660
|
+
*/
|
|
1661
|
+
|
|
1662
|
+
/**
|
|
1663
|
+
* Validation result
|
|
1664
|
+
*/
|
|
1665
|
+
interface ValidationResult {
|
|
1666
|
+
/** Whether theme is valid */
|
|
1667
|
+
valid: boolean;
|
|
1668
|
+
/** Validation errors */
|
|
1669
|
+
errors: string[];
|
|
1670
|
+
/** Validation warnings */
|
|
1671
|
+
warnings: string[];
|
|
1672
|
+
/** Accessibility issues */
|
|
1673
|
+
a11yIssues: A11yIssue[];
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Accessibility issue
|
|
1677
|
+
*/
|
|
1678
|
+
interface A11yIssue {
|
|
1679
|
+
/** Issue type */
|
|
1680
|
+
type: 'contrast' | 'color' | 'missing';
|
|
1681
|
+
/** Severity */
|
|
1682
|
+
severity: 'error' | 'warning';
|
|
1683
|
+
/** Issue message */
|
|
1684
|
+
message: string;
|
|
1685
|
+
/** Affected property */
|
|
1686
|
+
property?: string;
|
|
1687
|
+
/** Current value */
|
|
1688
|
+
value?: string;
|
|
1689
|
+
/** Recommended value */
|
|
1690
|
+
recommended?: string;
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Theme Validator
|
|
1694
|
+
*
|
|
1695
|
+
* Validates themes for correctness and accessibility
|
|
1696
|
+
*/
|
|
1697
|
+
declare class ThemeValidator {
|
|
1698
|
+
/**
|
|
1699
|
+
* Validate theme
|
|
1700
|
+
*/
|
|
1701
|
+
validate(theme: Theme, metadata?: ThemeMetadata): ValidationResult;
|
|
1702
|
+
/**
|
|
1703
|
+
* Validate palette
|
|
1704
|
+
*/
|
|
1705
|
+
private validatePalette;
|
|
1706
|
+
/**
|
|
1707
|
+
* Validate typography
|
|
1708
|
+
*/
|
|
1709
|
+
private validateTypography;
|
|
1710
|
+
/**
|
|
1711
|
+
* Validate spacing
|
|
1712
|
+
*/
|
|
1713
|
+
private validateSpacing;
|
|
1714
|
+
/**
|
|
1715
|
+
* Validate breakpoints
|
|
1716
|
+
*/
|
|
1717
|
+
private validateBreakpoints;
|
|
1718
|
+
/**
|
|
1719
|
+
* Check color contrast ratio
|
|
1720
|
+
*/
|
|
1721
|
+
private checkContrast;
|
|
1722
|
+
/**
|
|
1723
|
+
* Check if color is valid
|
|
1724
|
+
*/
|
|
1725
|
+
private isValidColor;
|
|
1726
|
+
/**
|
|
1727
|
+
* Validate transitions
|
|
1728
|
+
*/
|
|
1729
|
+
private validateTransitions;
|
|
1730
|
+
/**
|
|
1731
|
+
* Validate z-index
|
|
1732
|
+
*/
|
|
1733
|
+
private validateZIndex;
|
|
1734
|
+
/**
|
|
1735
|
+
* Validate border radius
|
|
1736
|
+
*/
|
|
1737
|
+
private validateBorderRadius;
|
|
1738
|
+
/**
|
|
1739
|
+
* Validate custom properties
|
|
1740
|
+
*/
|
|
1741
|
+
private validateCustom;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* useHistory Hook
|
|
1746
|
+
*
|
|
1747
|
+
* React hook for managing undo/redo history
|
|
1748
|
+
*/
|
|
1749
|
+
interface UseHistoryOptions {
|
|
1750
|
+
/** Maximum number of history entries (default: 50) */
|
|
1751
|
+
maxHistorySize?: number;
|
|
1752
|
+
/** Initial state */
|
|
1753
|
+
initialState?: any;
|
|
1754
|
+
}
|
|
1755
|
+
interface UseHistoryReturn<T> {
|
|
1756
|
+
/** Current state */
|
|
1757
|
+
state: T;
|
|
1758
|
+
/** Update state and add to history */
|
|
1759
|
+
setState: (newState: T) => void;
|
|
1760
|
+
/** Undo last change */
|
|
1761
|
+
undo: () => void;
|
|
1762
|
+
/** Redo last undone change */
|
|
1763
|
+
redo: () => void;
|
|
1764
|
+
/** Check if undo is available */
|
|
1765
|
+
canUndo: boolean;
|
|
1766
|
+
/** Check if redo is available */
|
|
1767
|
+
canRedo: boolean;
|
|
1768
|
+
/** Clear history */
|
|
1769
|
+
clearHistory: () => void;
|
|
1770
|
+
/** Get history statistics */
|
|
1771
|
+
getHistoryStats: () => {
|
|
1772
|
+
currentIndex: number;
|
|
1773
|
+
totalEntries: number;
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* useHistory hook
|
|
1778
|
+
*
|
|
1779
|
+
* Provides undo/redo functionality for state management
|
|
1780
|
+
*
|
|
1781
|
+
* @example
|
|
1782
|
+
* ```tsx
|
|
1783
|
+
* const { state, setState, undo, redo, canUndo, canRedo } = useHistory({
|
|
1784
|
+
* initialState: theme,
|
|
1785
|
+
* maxHistorySize: 50
|
|
1786
|
+
* });
|
|
1787
|
+
* ```
|
|
1788
|
+
*/
|
|
1789
|
+
declare function useHistory<T>(options?: UseHistoryOptions): UseHistoryReturn<T>;
|
|
1790
|
+
|
|
1791
|
+
/**
|
|
1792
|
+
* Theme Adapter
|
|
1793
|
+
*
|
|
1794
|
+
* Converts between Theme objects and DesignTokens.
|
|
1795
|
+
*/
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* Convert Theme object to DesignTokens
|
|
1799
|
+
*
|
|
1800
|
+
* Extracts values from a Theme object and converts them to flat DesignTokens format.
|
|
1801
|
+
*
|
|
1802
|
+
* @param theme - Theme object to convert
|
|
1803
|
+
* @returns Partial DesignTokens object
|
|
1804
|
+
*
|
|
1805
|
+
* @example
|
|
1806
|
+
* ```typescript
|
|
1807
|
+
* const theme = createTheme({ palette: { primary: { main: '#7c3aed' } } });
|
|
1808
|
+
* const tokens = themeToDesignTokens(theme);
|
|
1809
|
+
* // Returns: { 'primary': '#7c3aed', ... }
|
|
1810
|
+
* ```
|
|
1811
|
+
*/
|
|
1812
|
+
declare function themeToDesignTokens(theme: Theme): Partial<DesignTokens>;
|
|
1813
|
+
/**
|
|
1814
|
+
* Convert DesignTokens to Theme-compatible CSS variables
|
|
1815
|
+
*
|
|
1816
|
+
* @param tokens - DesignTokens object
|
|
1817
|
+
* @returns CSS variables object compatible with Theme.cssVars
|
|
1818
|
+
*/
|
|
1819
|
+
declare function designTokensToCSSVars(tokens: Partial<DesignTokens>): Record<string, string>;
|
|
1820
|
+
/**
|
|
1821
|
+
* Create DesignTokens from Theme with defaults
|
|
1822
|
+
*
|
|
1823
|
+
* Converts a Theme to DesignTokens and merges with default tokens.
|
|
1824
|
+
*
|
|
1825
|
+
* @param theme - Theme object to convert
|
|
1826
|
+
* @returns Complete DesignTokens object
|
|
1827
|
+
*/
|
|
1828
|
+
declare function createDesignTokensFromTheme(theme: Theme): DesignTokens;
|
|
1829
|
+
/**
|
|
1830
|
+
* Create a minimal Theme object from DesignTokens
|
|
1831
|
+
*
|
|
1832
|
+
* @param tokens - DesignTokens to convert
|
|
1833
|
+
* @returns Minimal Theme object with cssVars populated
|
|
1834
|
+
*/
|
|
1835
|
+
declare function designTokensToTheme(tokens: Partial<DesignTokens>): Partial<Theme>;
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* CSS Variable Mapper
|
|
1839
|
+
*
|
|
1840
|
+
* Utilities for generating and managing CSS custom properties from SCSS tokens
|
|
1841
|
+
* and component configurations.
|
|
1842
|
+
*/
|
|
1843
|
+
/**
|
|
1844
|
+
* Configuration for generating CSS variables for a component
|
|
1845
|
+
*/
|
|
1846
|
+
interface CSSVariableConfig {
|
|
1847
|
+
/** Component name (e.g., 'button', 'card') */
|
|
1848
|
+
component: string;
|
|
1849
|
+
/** Base properties for the component */
|
|
1850
|
+
properties: Record<string, string | number>;
|
|
1851
|
+
/** Part-specific properties (e.g., icon, label) */
|
|
1852
|
+
parts?: Record<string, Record<string, string | number>>;
|
|
1853
|
+
/** State-specific properties (e.g., hover, active, disabled) */
|
|
1854
|
+
states?: Record<string, Record<string, string | number>>;
|
|
1855
|
+
/** Variant-specific properties (e.g., primary, secondary) */
|
|
1856
|
+
variants?: Record<string, Record<string, string | number>>;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* CSS variable naming options
|
|
1860
|
+
*/
|
|
1861
|
+
interface CSSVariableNamingOptions {
|
|
1862
|
+
/** Prefix for all variables (default: 'atomix') */
|
|
1863
|
+
prefix?: string;
|
|
1864
|
+
/** Separator between parts (default: '-') */
|
|
1865
|
+
separator?: string;
|
|
1866
|
+
/** Whether to include component name in variable (default: true) */
|
|
1867
|
+
includeComponent?: boolean;
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* Generate CSS variable name from parts
|
|
1871
|
+
*
|
|
1872
|
+
* @example
|
|
1873
|
+
* generateCSSVariableName('button', 'bg', { prefix: 'atomix' })
|
|
1874
|
+
* // Returns: '--atomix-button-bg'
|
|
1875
|
+
*/
|
|
1876
|
+
declare function generateCSSVariableName(component: string, property: string, options?: CSSVariableNamingOptions): string;
|
|
1877
|
+
/**
|
|
1878
|
+
* Generate CSS variables object from configuration
|
|
1879
|
+
*
|
|
1880
|
+
* @example
|
|
1881
|
+
* const vars = generateComponentCSSVars({
|
|
1882
|
+
* component: 'button',
|
|
1883
|
+
* properties: { bg: '#000', color: '#fff' }
|
|
1884
|
+
* })
|
|
1885
|
+
* // Returns: { '--atomix-button-bg': '#000', '--atomix-button-color': '#fff' }
|
|
1886
|
+
*/
|
|
1887
|
+
declare function generateComponentCSSVars(config: CSSVariableConfig, options?: CSSVariableNamingOptions): Record<string, string>;
|
|
1888
|
+
/**
|
|
1889
|
+
* Map SCSS tokens to CSS custom properties
|
|
1890
|
+
*
|
|
1891
|
+
* @example
|
|
1892
|
+
* const tokens = { '$primary-color': '#7AFFD7', '$spacing-md': '16px' }
|
|
1893
|
+
* const vars = mapSCSSTokensToCSSVars(tokens)
|
|
1894
|
+
* // Returns: { '--primary-color': '#7AFFD7', '--spacing-md': '16px' }
|
|
1895
|
+
*/
|
|
1896
|
+
declare function mapSCSSTokensToCSSVars(tokens: Record<string, any>, options?: CSSVariableNamingOptions): Record<string, string>;
|
|
1897
|
+
/**
|
|
1898
|
+
* Apply CSS variables to an element
|
|
1899
|
+
*
|
|
1900
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
1901
|
+
* @param vars - CSS variables to apply
|
|
1902
|
+
*/
|
|
1903
|
+
declare function applyCSSVariables(vars: Record<string, string | number>, element?: HTMLElement): void;
|
|
1904
|
+
/**
|
|
1905
|
+
* Remove CSS variables from an element
|
|
1906
|
+
*
|
|
1907
|
+
* @param varNames - Variable names to remove
|
|
1908
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
1909
|
+
*/
|
|
1910
|
+
declare function removeCSSVariables(varNames: string[], element?: HTMLElement): void;
|
|
1911
|
+
/**
|
|
1912
|
+
* Get CSS variable value from an element
|
|
1913
|
+
*
|
|
1914
|
+
* @param varName - Variable name to get
|
|
1915
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
1916
|
+
* @returns Variable value or null if not found
|
|
1917
|
+
*/
|
|
1918
|
+
declare function getCSSVariable(varName: string, element?: HTMLElement): string | null;
|
|
1919
|
+
/**
|
|
1920
|
+
* Convert CSS variable object to inline style object
|
|
1921
|
+
*
|
|
1922
|
+
* @example
|
|
1923
|
+
* const vars = { '--atomix-button-bg': '#000' }
|
|
1924
|
+
* const style = cssVarsToStyle(vars)
|
|
1925
|
+
* // Returns: { '--atomix-button-bg': '#000' } as React.CSSProperties
|
|
1926
|
+
*/
|
|
1927
|
+
declare function cssVarsToStyle(vars: Record<string, string | number>): React.CSSProperties;
|
|
1928
|
+
/**
|
|
1929
|
+
* Merge multiple CSS variable objects
|
|
1930
|
+
* Later objects override earlier ones
|
|
1931
|
+
*/
|
|
1932
|
+
declare function mergeCSSVars(...varObjects: Array<Record<string, string | number> | undefined>): Record<string, string | number>;
|
|
1933
|
+
/**
|
|
1934
|
+
* Validate CSS variable name format
|
|
1935
|
+
*/
|
|
1936
|
+
declare function isValidCSSVariableName(name: string): boolean;
|
|
1937
|
+
/**
|
|
1938
|
+
* Extract component name from CSS variable name
|
|
1939
|
+
*
|
|
1940
|
+
* @example
|
|
1941
|
+
* extractComponentName('--atomix-button-bg')
|
|
1942
|
+
* // Returns: 'button'
|
|
1943
|
+
*/
|
|
1944
|
+
declare function extractComponentName(varName: string, prefix?: string): string | null;
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* Theme Helper Functions
|
|
1948
|
+
*
|
|
1949
|
+
* Utility functions for working with themes and DesignTokens
|
|
1950
|
+
*/
|
|
1951
|
+
|
|
1952
|
+
/**
|
|
1953
|
+
* Get DesignTokens from current theme
|
|
1954
|
+
*
|
|
1955
|
+
* Converts a Theme object to DesignTokens. Useful when you need to
|
|
1956
|
+
* work with DesignTokens but have a Theme object.
|
|
1957
|
+
*
|
|
1958
|
+
* @param theme - Theme object to convert
|
|
1959
|
+
* @returns DesignTokens object
|
|
1960
|
+
*
|
|
1961
|
+
* @example
|
|
1962
|
+
* ```typescript
|
|
1963
|
+
* // If you have a Theme object, convert it to DesignTokens
|
|
1964
|
+
* const tokens = getDesignTokensFromTheme(theme);
|
|
1965
|
+
* // Now you can use tokens with unified theme system
|
|
1966
|
+
* const css = createTheme(tokens);
|
|
1967
|
+
* ```
|
|
1968
|
+
*/
|
|
1969
|
+
declare function getDesignTokensFromTheme(theme: Theme | null): DesignTokens | null;
|
|
1970
|
+
/**
|
|
1971
|
+
* Check if a value is DesignTokens
|
|
1972
|
+
*
|
|
1973
|
+
* Type guard to check if an object is DesignTokens format.
|
|
1974
|
+
*
|
|
1975
|
+
* @param value - Value to check
|
|
1976
|
+
* @returns True if value is DesignTokens
|
|
1977
|
+
*/
|
|
1978
|
+
declare function isDesignTokens(value: unknown): value is DesignTokens;
|
|
1979
|
+
/**
|
|
1980
|
+
* Check if a value is a Theme object
|
|
1981
|
+
*
|
|
1982
|
+
* Type guard to check if an object is a Theme.
|
|
1983
|
+
*
|
|
1984
|
+
* @param value - Value to check
|
|
1985
|
+
* @returns True if value is Theme
|
|
1986
|
+
*/
|
|
1987
|
+
declare function isThemeObject(value: unknown): value is Theme;
|
|
1988
|
+
|
|
1989
|
+
/**
|
|
1990
|
+
* RTL (Right-to-Left) Support Utilities
|
|
1991
|
+
*
|
|
1992
|
+
* Provides utilities for managing RTL text direction in themes
|
|
1993
|
+
*/
|
|
1994
|
+
/**
|
|
1995
|
+
* RTL configuration options
|
|
1996
|
+
*/
|
|
1997
|
+
interface RTLConfig {
|
|
1998
|
+
/** Enable RTL mode */
|
|
1999
|
+
enabled: boolean;
|
|
2000
|
+
/** Current direction ('ltr' | 'rtl') */
|
|
2001
|
+
direction: 'ltr' | 'rtl';
|
|
2002
|
+
/** Data attribute name for direction */
|
|
2003
|
+
dataAttribute?: string;
|
|
2004
|
+
/** Auto-detect from locale */
|
|
2005
|
+
autoDetect?: boolean;
|
|
2006
|
+
/** Locale code (e.g., 'ar', 'he', 'fa') */
|
|
2007
|
+
locale?: string;
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* RTL Manager
|
|
2011
|
+
*
|
|
2012
|
+
* Manages RTL text direction for the theme system
|
|
2013
|
+
*/
|
|
2014
|
+
declare class RTLManager {
|
|
2015
|
+
private config;
|
|
2016
|
+
private listeners;
|
|
2017
|
+
constructor(config?: Partial<RTLConfig>);
|
|
2018
|
+
/**
|
|
2019
|
+
* Detect locale from browser
|
|
2020
|
+
*/
|
|
2021
|
+
private detectLocale;
|
|
2022
|
+
/**
|
|
2023
|
+
* Check if locale is RTL
|
|
2024
|
+
*/
|
|
2025
|
+
isRTLLocale(locale: string): boolean;
|
|
2026
|
+
/**
|
|
2027
|
+
* Get current direction
|
|
2028
|
+
*/
|
|
2029
|
+
getDirection(): 'ltr' | 'rtl';
|
|
2030
|
+
/**
|
|
2031
|
+
* Check if RTL is enabled
|
|
2032
|
+
*/
|
|
2033
|
+
isEnabled(): boolean;
|
|
2034
|
+
/**
|
|
2035
|
+
* Set direction
|
|
2036
|
+
*/
|
|
2037
|
+
setDirection(direction: 'ltr' | 'rtl'): void;
|
|
2038
|
+
/**
|
|
2039
|
+
* Toggle direction
|
|
2040
|
+
*/
|
|
2041
|
+
toggleDirection(): 'ltr' | 'rtl';
|
|
2042
|
+
/**
|
|
2043
|
+
* Enable RTL
|
|
2044
|
+
*/
|
|
2045
|
+
enable(): void;
|
|
2046
|
+
/**
|
|
2047
|
+
* Disable RTL
|
|
2048
|
+
*/
|
|
2049
|
+
disable(): void;
|
|
2050
|
+
/**
|
|
2051
|
+
* Set locale and auto-adjust direction
|
|
2052
|
+
*/
|
|
2053
|
+
setLocale(locale: string): void;
|
|
2054
|
+
/**
|
|
2055
|
+
* Get current locale
|
|
2056
|
+
*/
|
|
2057
|
+
getLocale(): string | undefined;
|
|
2058
|
+
/**
|
|
2059
|
+
* Apply direction to DOM
|
|
2060
|
+
*/
|
|
2061
|
+
private applyDirection;
|
|
2062
|
+
/**
|
|
2063
|
+
* Add direction change listener
|
|
2064
|
+
*/
|
|
2065
|
+
onDirectionChange(callback: (direction: 'ltr' | 'rtl') => void): () => void;
|
|
2066
|
+
/**
|
|
2067
|
+
* Notify listeners of direction change
|
|
2068
|
+
*/
|
|
2069
|
+
private notifyListeners;
|
|
2070
|
+
/**
|
|
2071
|
+
* Get RTL-aware value
|
|
2072
|
+
*
|
|
2073
|
+
* Returns different values based on direction
|
|
2074
|
+
*/
|
|
2075
|
+
getValue<T>(ltrValue: T, rtlValue: T): T;
|
|
2076
|
+
/**
|
|
2077
|
+
* Get RTL-aware CSS property
|
|
2078
|
+
*
|
|
2079
|
+
* Returns appropriate CSS property based on direction
|
|
2080
|
+
*/
|
|
2081
|
+
getCSSProperty(property: string): string;
|
|
2082
|
+
/**
|
|
2083
|
+
* Destroy RTL manager
|
|
2084
|
+
*/
|
|
2085
|
+
destroy(): void;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* Theme System Exports
|
|
2090
|
+
*
|
|
2091
|
+
* Unified theme system - handles both DesignTokens and Theme objects.
|
|
2092
|
+
*
|
|
2093
|
+
* @example
|
|
2094
|
+
* ```typescript
|
|
2095
|
+
* import { createTheme, injectTheme } from '@shohojdhara/atomix/theme';
|
|
2096
|
+
*
|
|
2097
|
+
* // Using DesignTokens (recommended - flat structure)
|
|
2098
|
+
* const css = createTheme({ 'primary': '#7AFFD7', 'spacing-4': '1rem' });
|
|
2099
|
+
* injectTheme(css);
|
|
2100
|
+
*
|
|
2101
|
+
* // Or use with ThemeProvider
|
|
2102
|
+
* import { ThemeProvider } from '@shohojdhara/atomix/theme';
|
|
2103
|
+
* const tokens = { 'primary': '#7c3aed' };
|
|
2104
|
+
* <ThemeProvider defaultTheme={tokens}>...</ThemeProvider>
|
|
2105
|
+
* ```
|
|
2106
|
+
*/
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* Inject theme CSS into DOM
|
|
2110
|
+
*/
|
|
2111
|
+
declare function injectTheme(css: string, id?: string): void;
|
|
2112
|
+
/**
|
|
2113
|
+
* Remove theme from DOM
|
|
2114
|
+
*/
|
|
2115
|
+
declare function removeTheme(id?: string): void;
|
|
2116
|
+
/**
|
|
2117
|
+
* Save theme to CSS file
|
|
2118
|
+
*/
|
|
2119
|
+
declare function saveTheme(css: string, filePath: string): Promise<void>;
|
|
2120
|
+
|
|
2121
|
+
export { RTLManager, ThemeApplicator, ThemeComparator, ThemeContext, ThemeErrorBoundary, ThemeInspector, ThemeLiveEditor, ThemePreview, ThemeProvider, ThemeRegistry, ThemeValidator, applyCSSVariables, applyTheme, createDesignTokensFromTheme, createTheme, createThemeObject, createTokens, cssVarsToStyle, deepMerge, defaultTokens, designTokensToCSSVars, designTokensToTheme, extendTheme, extractComponentName, generateCSSVariableName, generateCSSVariables, generateCSSVariablesForSelector, generateComponentCSSVars, getCSSVariable, getDesignTokensFromTheme, getThemeApplicator, injectCSS, injectTheme, isCSSInjected, isDesignTokens, isThemeObject, isValidCSSVariableName, loadThemeFromConfig, loadThemeFromConfigSync, mapSCSSTokensToCSSVars, mergeCSSVars, mergeTheme, removeCSS, removeCSSVariables, removeTheme, saveCSSFile, saveCSSFileSync, saveTheme, themeToDesignTokens, useHistory, useTheme };
|
|
2122
|
+
export type { A11yIssue, CSSVariableConfig, CSSVariableNamingOptions, ComponentThemeOverride, DesignTokens, GenerateCSSVariablesOptions, RTLConfig, Theme, ThemeChangeEvent, ThemeComparatorProps, ThemeComponentOverrides, ThemeContextValue, ThemeErrorBoundaryProps, ThemeInspectorProps, ThemeLiveEditorProps, ThemeLoadOptions, ThemeMetadata, ThemePreviewProps, ThemeProviderProps, ThemeValidationResult, UseHistoryOptions, UseHistoryReturn, UseThemeReturn, ValidationResult };
|