@shohojdhara/atomix 0.3.4 → 0.3.5
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/dist/atomix.css +9 -10
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15108 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6482 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3357 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2450 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4550 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5161 -4990
- package/dist/index.esm.js +1457 -784
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1473 -790
- 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 +1992 -0
- package/dist/theme.js +5348 -0
- package/dist/theme.js.map +1 -0
- package/package.json +66 -20
- 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.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -17
- package/src/components/Chart/AreaChart.tsx +5 -1
- package/src/components/Chart/BarChart.tsx +1 -0
- package/src/components/Chart/BubbleChart.tsx +6 -5
- package/src/components/Chart/ChartToolbar.tsx +1 -0
- package/src/components/Chart/FunnelChart.tsx +1 -1
- package/src/components/Chart/RadarChart.tsx +19 -12
- package/src/components/Chart/ScatterChart.tsx +3 -3
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- package/src/components/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.tsx +3 -3
- package/src/components/Form/Input.tsx +4 -2
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/List/List.stories.tsx +3 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- package/src/components/Pagination/Pagination.tsx +6 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.tsx +5 -2
- package/src/components/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/index.ts +5 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- 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/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/loader.ts +55 -13
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +10 -14
- 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/composeTheme.ts +1 -1
- package/src/lib/theme/core/ThemeEngine.ts +8 -0
- package/src/lib/theme/core/ThemeValidator.ts +5 -2
- package/src/lib/theme/devtools/Inspector.tsx +1 -1
- package/src/lib/theme/devtools/LiveEditor.tsx +11 -5
- package/src/lib/theme/generateCSSVariables.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +2 -1
- package/src/lib/theme/runtime/ThemeApplicator.ts +28 -11
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +3 -3
- package/src/lib/theme/runtime/ThemeManager.ts +4 -0
- package/src/lib/theme-tools.ts +1 -1
- package/src/lib/types/components.ts +183 -34
- package/src/lib/types/partProps.ts +0 -16
- 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.fonts.scss +2 -5
- package/src/styles/03-generic/_generated-root.css +22 -1
- package/src/styles/06-components/_components.navbar.scss +0 -6
- package/src/themes/themes.config.js +37 -4
- package/scripts/build-themes.js +0 -208
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,1992 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default, { ReactNode, ErrorInfo, Component } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* RTL (Right-to-Left) Support Utilities
|
|
6
|
+
*
|
|
7
|
+
* Provides utilities for managing RTL text direction in themes
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* RTL configuration options
|
|
11
|
+
*/
|
|
12
|
+
interface RTLConfig {
|
|
13
|
+
/** Enable RTL mode */
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
/** Current direction ('ltr' | 'rtl') */
|
|
16
|
+
direction: 'ltr' | 'rtl';
|
|
17
|
+
/** Data attribute name for direction */
|
|
18
|
+
dataAttribute?: string;
|
|
19
|
+
/** Auto-detect from locale */
|
|
20
|
+
autoDetect?: boolean;
|
|
21
|
+
/** Locale code (e.g., 'ar', 'he', 'fa') */
|
|
22
|
+
locale?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* RTL Manager
|
|
26
|
+
*
|
|
27
|
+
* Manages RTL text direction for the theme system
|
|
28
|
+
*/
|
|
29
|
+
declare class RTLManager {
|
|
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
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Atomix Configuration System
|
|
105
|
+
*
|
|
106
|
+
* Tailwind-like configuration for customizing the Atomix Design System.
|
|
107
|
+
*
|
|
108
|
+
* External developers can create `atomix.config.ts` in their project root
|
|
109
|
+
* to customize design tokens, similar to Tailwind's tailwind.config.js
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* // atomix.config.ts (in your project)
|
|
114
|
+
* import { defineConfig } from '@shohojdhara/atomix/config';
|
|
115
|
+
*
|
|
116
|
+
* export default defineConfig({
|
|
117
|
+
* theme: {
|
|
118
|
+
* extend: {
|
|
119
|
+
* colors: {
|
|
120
|
+
* primary: { main: '#7AFFD7' },
|
|
121
|
+
* },
|
|
122
|
+
* },
|
|
123
|
+
* },
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Color Scale (1-10)
|
|
130
|
+
*/
|
|
131
|
+
interface ColorScale {
|
|
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
|
|
146
|
+
*/
|
|
147
|
+
interface PaletteColorOptions {
|
|
148
|
+
main: string;
|
|
149
|
+
light?: string;
|
|
150
|
+
dark?: string;
|
|
151
|
+
contrastText?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Design Tokens Schema (Tailwind-like)
|
|
155
|
+
*/
|
|
156
|
+
interface ThemeTokens {
|
|
157
|
+
/** Color palette */
|
|
158
|
+
colors?: Record<string, string | PaletteColorOptions | ColorScale | Record<string, string>>;
|
|
159
|
+
/** Spacing scale */
|
|
160
|
+
spacing?: Record<string, string>;
|
|
161
|
+
/** Border radius scale */
|
|
162
|
+
borderRadius?: Record<string, string>;
|
|
163
|
+
/** Typography scale and settings */
|
|
164
|
+
typography?: {
|
|
165
|
+
fontFamilies?: Record<string, string>;
|
|
166
|
+
fontSizes?: Record<string, string>;
|
|
167
|
+
fontWeights?: Record<string, string | number>;
|
|
168
|
+
lineHeights?: Record<string, string | number>;
|
|
169
|
+
letterSpacings?: Record<string, string>;
|
|
170
|
+
};
|
|
171
|
+
/** Shadow scale */
|
|
172
|
+
shadows?: Record<string, string>;
|
|
173
|
+
/** Z-index scale */
|
|
174
|
+
zIndex?: Record<string, string | number>;
|
|
175
|
+
/** Breakpoints scale */
|
|
176
|
+
breakpoints?: Record<string, string | number>;
|
|
177
|
+
/** Transitions settings */
|
|
178
|
+
transitions?: {
|
|
179
|
+
durations?: Record<string, string>;
|
|
180
|
+
easings?: Record<string, string>;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* CSS Theme Definition
|
|
185
|
+
*/
|
|
186
|
+
interface CSSThemeDefinition {
|
|
187
|
+
type: 'css';
|
|
188
|
+
name: string;
|
|
189
|
+
class?: string;
|
|
190
|
+
description?: string;
|
|
191
|
+
author?: string;
|
|
192
|
+
version?: string;
|
|
193
|
+
tags?: string[];
|
|
194
|
+
supportsDarkMode?: boolean;
|
|
195
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
196
|
+
a11y?: {
|
|
197
|
+
contrastTarget?: number;
|
|
198
|
+
modes?: string[];
|
|
199
|
+
};
|
|
200
|
+
color?: string;
|
|
201
|
+
features?: string[];
|
|
202
|
+
dependencies?: string[];
|
|
203
|
+
cssPath?: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* JavaScript Theme Definition
|
|
207
|
+
*/
|
|
208
|
+
interface JSThemeDefinition {
|
|
209
|
+
type: 'js';
|
|
210
|
+
name: string;
|
|
211
|
+
class?: string;
|
|
212
|
+
description?: string;
|
|
213
|
+
author?: string;
|
|
214
|
+
version?: string;
|
|
215
|
+
tags?: string[];
|
|
216
|
+
supportsDarkMode?: boolean;
|
|
217
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
218
|
+
a11y?: {
|
|
219
|
+
contrastTarget?: number;
|
|
220
|
+
modes?: string[];
|
|
221
|
+
};
|
|
222
|
+
color?: string;
|
|
223
|
+
features?: string[];
|
|
224
|
+
dependencies?: string[];
|
|
225
|
+
createTheme: () => Theme;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Theme Definition (CSS or JS)
|
|
229
|
+
*/
|
|
230
|
+
type ThemeDefinition = CSSThemeDefinition | JSThemeDefinition;
|
|
231
|
+
/**
|
|
232
|
+
* Build configuration (migrated from theme.config.ts)
|
|
233
|
+
*/
|
|
234
|
+
interface BuildConfig {
|
|
235
|
+
output?: {
|
|
236
|
+
directory?: string;
|
|
237
|
+
formats?: {
|
|
238
|
+
expanded?: string;
|
|
239
|
+
compressed?: string;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
sass?: {
|
|
243
|
+
style?: 'expanded' | 'compressed';
|
|
244
|
+
sourceMap?: boolean;
|
|
245
|
+
loadPaths?: string[];
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Runtime configuration (migrated from theme.config.ts)
|
|
250
|
+
*/
|
|
251
|
+
interface RuntimeConfig {
|
|
252
|
+
basePath?: string;
|
|
253
|
+
cdnPath?: string | null;
|
|
254
|
+
preload?: string[];
|
|
255
|
+
lazy?: boolean;
|
|
256
|
+
defaultTheme?: string;
|
|
257
|
+
storageKey?: string;
|
|
258
|
+
dataAttribute?: string;
|
|
259
|
+
enablePersistence?: boolean;
|
|
260
|
+
useMinified?: boolean;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Integration settings (migrated from theme.config.ts)
|
|
264
|
+
*/
|
|
265
|
+
interface IntegrationConfig {
|
|
266
|
+
cssVariables?: Record<string, string>;
|
|
267
|
+
classNames?: {
|
|
268
|
+
theme?: string;
|
|
269
|
+
colorMode?: string;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Atomix Configuration Interface
|
|
274
|
+
*
|
|
275
|
+
* Tailwind-like configuration for external developers.
|
|
276
|
+
* Focus on theme customization - build/runtime configs are internal only.
|
|
277
|
+
*/
|
|
278
|
+
interface AtomixConfig {
|
|
279
|
+
/**
|
|
280
|
+
* CSS variable prefix (default: 'atomix')
|
|
281
|
+
*
|
|
282
|
+
* Change this to customize all CSS variable names.
|
|
283
|
+
* Example: prefix: 'myapp' → --myapp-primary instead of --atomix-primary
|
|
284
|
+
*/
|
|
285
|
+
prefix?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Theme customization (Tailwind-like)
|
|
288
|
+
*
|
|
289
|
+
* Use `extend` to add or override design tokens.
|
|
290
|
+
* Use `tokens` to completely replace the default token system (advanced).
|
|
291
|
+
*/
|
|
292
|
+
theme?: {
|
|
293
|
+
/**
|
|
294
|
+
* Extend the default design tokens
|
|
295
|
+
*
|
|
296
|
+
* This is the recommended way to customize Atomix.
|
|
297
|
+
* Your values will override or extend the base tokens.
|
|
298
|
+
*/
|
|
299
|
+
extend?: ThemeTokens;
|
|
300
|
+
/**
|
|
301
|
+
* Override the default tokens entirely (advanced)
|
|
302
|
+
*
|
|
303
|
+
* Use with caution - this replaces the entire token system.
|
|
304
|
+
* Most users should use `extend` instead.
|
|
305
|
+
*/
|
|
306
|
+
tokens?: ThemeTokens;
|
|
307
|
+
/**
|
|
308
|
+
* Register custom themes (optional)
|
|
309
|
+
*
|
|
310
|
+
* Define CSS or JavaScript themes that can be loaded dynamically.
|
|
311
|
+
*/
|
|
312
|
+
themes?: Record<string, ThemeDefinition>;
|
|
313
|
+
};
|
|
314
|
+
/** @internal Build configuration (internal use only) */
|
|
315
|
+
build?: BuildConfig;
|
|
316
|
+
/** @internal Runtime configuration (internal use only) */
|
|
317
|
+
runtime?: RuntimeConfig;
|
|
318
|
+
/** @internal Integration settings (internal use only) */
|
|
319
|
+
integration?: IntegrationConfig;
|
|
320
|
+
/** @internal Theme dependencies mapping (internal use only) */
|
|
321
|
+
dependencies?: Record<string, string[]>;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Theme Configuration Types
|
|
326
|
+
*
|
|
327
|
+
* Type definitions for the theme configuration system
|
|
328
|
+
*/
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Loaded and validated theme configuration
|
|
332
|
+
*/
|
|
333
|
+
interface LoadedThemeConfig {
|
|
334
|
+
/** Registered themes */
|
|
335
|
+
themes: Record<string, ThemeDefinition>;
|
|
336
|
+
/** Build configuration */
|
|
337
|
+
build: BuildConfig;
|
|
338
|
+
/** Runtime configuration */
|
|
339
|
+
runtime: RuntimeConfig;
|
|
340
|
+
/** Integration settings */
|
|
341
|
+
integration: IntegrationConfig;
|
|
342
|
+
/** Theme dependencies mapping */
|
|
343
|
+
dependencies: Record<string, string[]>;
|
|
344
|
+
/** Whether config was validated */
|
|
345
|
+
validated: boolean;
|
|
346
|
+
/** Validation errors (if any) */
|
|
347
|
+
errors?: string[];
|
|
348
|
+
/** Validation warnings (if any) */
|
|
349
|
+
warnings?: string[];
|
|
350
|
+
/** Internal tokens (for generator) */
|
|
351
|
+
__tokens?: any;
|
|
352
|
+
/** Internal extensions (for generator) */
|
|
353
|
+
__extend?: any;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Theme Registry
|
|
358
|
+
*
|
|
359
|
+
* Central registry for all themes with discovery and dependency management
|
|
360
|
+
*/
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Registry entry
|
|
364
|
+
*/
|
|
365
|
+
interface RegistryEntry {
|
|
366
|
+
/** Theme ID */
|
|
367
|
+
id: string;
|
|
368
|
+
/** Theme definition from config */
|
|
369
|
+
definition: ThemeDefinition;
|
|
370
|
+
/** Resolved theme object (for JS themes) */
|
|
371
|
+
theme?: Theme;
|
|
372
|
+
/** Whether theme is loaded */
|
|
373
|
+
loaded: boolean;
|
|
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[];
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Theme Registry
|
|
383
|
+
*
|
|
384
|
+
* Manages theme registration, discovery, and dependency resolution
|
|
385
|
+
*/
|
|
386
|
+
declare class ThemeRegistry {
|
|
387
|
+
private entries;
|
|
388
|
+
private config;
|
|
389
|
+
private initialized;
|
|
390
|
+
/**
|
|
391
|
+
* Initialize registry from config
|
|
392
|
+
*/
|
|
393
|
+
initialize(config?: LoadedThemeConfig): Promise<void>;
|
|
394
|
+
/**
|
|
395
|
+
* Register a theme
|
|
396
|
+
*/
|
|
397
|
+
register(themeId: string, definition: ThemeDefinition): void;
|
|
398
|
+
/**
|
|
399
|
+
* Get theme entry
|
|
400
|
+
*/
|
|
401
|
+
get(themeId: string): RegistryEntry | undefined;
|
|
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[];
|
|
448
|
+
};
|
|
449
|
+
/**
|
|
450
|
+
* Clear registry
|
|
451
|
+
*/
|
|
452
|
+
clear(): void;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Theme Cache
|
|
457
|
+
*
|
|
458
|
+
* Performance caching layer for loaded themes (CSS and JS)
|
|
459
|
+
*/
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Cache entry for CSS theme
|
|
463
|
+
*/
|
|
464
|
+
interface CSSCacheEntry {
|
|
465
|
+
type: 'css' | 'js';
|
|
466
|
+
themeId: string;
|
|
467
|
+
cssContent?: string;
|
|
468
|
+
loaded: boolean;
|
|
469
|
+
loading: Promise<void> | null;
|
|
470
|
+
timestamp: number;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Cache entry for JS theme
|
|
474
|
+
*/
|
|
475
|
+
interface JSCacheEntry {
|
|
476
|
+
type: 'js';
|
|
477
|
+
themeId: string;
|
|
478
|
+
theme: Theme;
|
|
479
|
+
loaded: boolean;
|
|
480
|
+
timestamp: number;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Theme cache configuration
|
|
484
|
+
*/
|
|
485
|
+
interface CacheConfig {
|
|
486
|
+
/** Maximum cache size (number of themes) */
|
|
487
|
+
maxSize?: number;
|
|
488
|
+
/** Cache TTL in milliseconds (0 = no expiration) */
|
|
489
|
+
ttl?: number;
|
|
490
|
+
/** Enable cache */
|
|
491
|
+
enabled?: boolean;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Theme Cache
|
|
495
|
+
*
|
|
496
|
+
* Manages caching of loaded themes for performance optimization
|
|
497
|
+
*/
|
|
498
|
+
declare class ThemeCache {
|
|
499
|
+
private cache;
|
|
500
|
+
private config;
|
|
501
|
+
private accessOrder;
|
|
502
|
+
constructor(config?: CacheConfig);
|
|
503
|
+
/**
|
|
504
|
+
* Get cached CSS theme
|
|
505
|
+
*/
|
|
506
|
+
getCSS(themeId: string): CSSCacheEntry | null;
|
|
507
|
+
/**
|
|
508
|
+
* Get cached JS theme
|
|
509
|
+
*/
|
|
510
|
+
getJS(themeId: string): JSCacheEntry | null;
|
|
511
|
+
/**
|
|
512
|
+
* Set CSS theme cache entry
|
|
513
|
+
*/
|
|
514
|
+
setCSS(themeId: string, entry: Partial<CSSCacheEntry>): void;
|
|
515
|
+
/**
|
|
516
|
+
* Set JS theme cache entry
|
|
517
|
+
*/
|
|
518
|
+
setJS(themeId: string, theme: Theme): void;
|
|
519
|
+
/**
|
|
520
|
+
* Check if theme is cached
|
|
521
|
+
*/
|
|
522
|
+
has(themeId: string): boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Remove theme from cache
|
|
525
|
+
*/
|
|
526
|
+
delete(themeId: string): boolean;
|
|
527
|
+
/**
|
|
528
|
+
* Clear all cache
|
|
529
|
+
*/
|
|
530
|
+
clear(): void;
|
|
531
|
+
/**
|
|
532
|
+
* Get cache statistics
|
|
533
|
+
*/
|
|
534
|
+
getStats(): {
|
|
535
|
+
size: number;
|
|
536
|
+
maxSize: number;
|
|
537
|
+
cssThemes: number;
|
|
538
|
+
jsThemes: number;
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* Update access order for LRU
|
|
542
|
+
*/
|
|
543
|
+
private updateAccessOrder;
|
|
544
|
+
/**
|
|
545
|
+
* Remove from access order
|
|
546
|
+
*/
|
|
547
|
+
private removeFromAccessOrder;
|
|
548
|
+
/**
|
|
549
|
+
* Evict least recently used entries if cache is full
|
|
550
|
+
*/
|
|
551
|
+
private evictIfNeeded;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Theme Engine
|
|
556
|
+
*
|
|
557
|
+
* Core engine for unified CSS and JS theme support
|
|
558
|
+
*/
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Theme change event
|
|
562
|
+
*/
|
|
563
|
+
interface ThemeChangeEvent$1 {
|
|
564
|
+
/** Previous theme ID */
|
|
565
|
+
previousTheme: string | null;
|
|
566
|
+
/** Current theme ID */
|
|
567
|
+
currentTheme: string;
|
|
568
|
+
/** Theme object (for JS themes) */
|
|
569
|
+
themeObject?: Theme | null;
|
|
570
|
+
/** Timestamp */
|
|
571
|
+
timestamp: number;
|
|
572
|
+
/** Source of change */
|
|
573
|
+
source: 'user' | 'system' | 'storage';
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Theme load options
|
|
577
|
+
*/
|
|
578
|
+
interface ThemeLoadOptions$1 {
|
|
579
|
+
/** Force reload even if already loaded */
|
|
580
|
+
force?: boolean;
|
|
581
|
+
/** Preload without applying */
|
|
582
|
+
preload?: boolean;
|
|
583
|
+
/** Remove previous theme CSS */
|
|
584
|
+
removePrevious?: boolean;
|
|
585
|
+
/** Custom CSS path override */
|
|
586
|
+
customPath?: string;
|
|
587
|
+
/** Fallback to default theme on error */
|
|
588
|
+
fallbackOnError?: boolean;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Theme revert event
|
|
592
|
+
*/
|
|
593
|
+
interface ThemeRevertEvent {
|
|
594
|
+
/** Theme ID that was attempted */
|
|
595
|
+
attemptedTheme: string;
|
|
596
|
+
/** Theme ID that was reverted to (null if no previous theme) */
|
|
597
|
+
revertedToTheme: string | null;
|
|
598
|
+
/** Error that caused the revert */
|
|
599
|
+
error: Error;
|
|
600
|
+
/** Timestamp */
|
|
601
|
+
timestamp: number;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Event listener types
|
|
605
|
+
*/
|
|
606
|
+
type ThemeChangeListener = (event: ThemeChangeEvent$1) => void;
|
|
607
|
+
type ThemeLoadListener = (themeId: string) => void;
|
|
608
|
+
type ThemeErrorListener = (error: Error, themeId: string) => void;
|
|
609
|
+
type ThemeRevertListener = (event: ThemeRevertEvent) => void;
|
|
610
|
+
/**
|
|
611
|
+
* Theme Engine Configuration
|
|
612
|
+
*/
|
|
613
|
+
interface ThemeEngineConfig {
|
|
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
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Theme Engine
|
|
634
|
+
*
|
|
635
|
+
* Unified engine for managing CSS and JS themes
|
|
636
|
+
*/
|
|
637
|
+
declare class ThemeEngine {
|
|
638
|
+
private registry;
|
|
639
|
+
private cache;
|
|
640
|
+
private validator;
|
|
641
|
+
private config;
|
|
642
|
+
private currentTheme;
|
|
643
|
+
private activeTheme;
|
|
644
|
+
private loadedThemes;
|
|
645
|
+
private loadingThemes;
|
|
646
|
+
private failedThemes;
|
|
647
|
+
private changeListeners;
|
|
648
|
+
private loadListeners;
|
|
649
|
+
private errorListeners;
|
|
650
|
+
private revertListeners;
|
|
651
|
+
private logger;
|
|
652
|
+
constructor(config?: ThemeEngineConfig);
|
|
653
|
+
/**
|
|
654
|
+
* Initialize engine with theme registry
|
|
655
|
+
*/
|
|
656
|
+
initialize(): Promise<void>;
|
|
657
|
+
/**
|
|
658
|
+
* Get current theme ID
|
|
659
|
+
*/
|
|
660
|
+
getCurrentTheme(): string | null;
|
|
661
|
+
/**
|
|
662
|
+
* Get active theme object
|
|
663
|
+
*/
|
|
664
|
+
getActiveTheme(): Theme | null;
|
|
665
|
+
/**
|
|
666
|
+
* Check if theme is loaded
|
|
667
|
+
*/
|
|
668
|
+
isThemeLoaded(themeId: string): boolean;
|
|
669
|
+
/**
|
|
670
|
+
* Load and apply theme
|
|
671
|
+
*/
|
|
672
|
+
setTheme(themeId: string | Theme, options?: ThemeLoadOptions$1): Promise<void>;
|
|
673
|
+
/**
|
|
674
|
+
* Load theme (CSS or JS)
|
|
675
|
+
*/
|
|
676
|
+
private loadTheme;
|
|
677
|
+
/**
|
|
678
|
+
* Load CSS theme
|
|
679
|
+
*/
|
|
680
|
+
private loadCSSTheme;
|
|
681
|
+
/**
|
|
682
|
+
* Load JS theme
|
|
683
|
+
*/
|
|
684
|
+
private loadJSTheme;
|
|
685
|
+
/**
|
|
686
|
+
* Apply theme (set as active)
|
|
687
|
+
*/
|
|
688
|
+
private applyTheme;
|
|
689
|
+
/**
|
|
690
|
+
* Apply CSS theme
|
|
691
|
+
*/
|
|
692
|
+
private applyCSSTheme;
|
|
693
|
+
/**
|
|
694
|
+
* Apply JS theme
|
|
695
|
+
*/
|
|
696
|
+
private applyJSTheme;
|
|
697
|
+
/**
|
|
698
|
+
* Remove theme
|
|
699
|
+
*/
|
|
700
|
+
private removeTheme;
|
|
701
|
+
/**
|
|
702
|
+
* Preload theme
|
|
703
|
+
*/
|
|
704
|
+
preloadTheme(themeId: string): Promise<void>;
|
|
705
|
+
/**
|
|
706
|
+
* Get registry
|
|
707
|
+
*/
|
|
708
|
+
getRegistry(): ThemeRegistry;
|
|
709
|
+
/**
|
|
710
|
+
* Get cache
|
|
711
|
+
*/
|
|
712
|
+
getCache(): ThemeCache;
|
|
713
|
+
/**
|
|
714
|
+
* Clear failed theme tracking (allows retry of previously failed themes)
|
|
715
|
+
*/
|
|
716
|
+
clearFailedThemes(): void;
|
|
717
|
+
/**
|
|
718
|
+
* Clear specific failed theme (allows retry of a specific theme)
|
|
719
|
+
*/
|
|
720
|
+
clearFailedTheme(themeId: string): void;
|
|
721
|
+
/**
|
|
722
|
+
* Check if theme has failed to load
|
|
723
|
+
*/
|
|
724
|
+
hasFailedTheme(themeId: string): boolean;
|
|
725
|
+
/**
|
|
726
|
+
* Add change listener
|
|
727
|
+
*/
|
|
728
|
+
on(event: 'change', listener: ThemeChangeListener): void;
|
|
729
|
+
on(event: 'load', listener: ThemeLoadListener): void;
|
|
730
|
+
on(event: 'error', listener: ThemeErrorListener): void;
|
|
731
|
+
on(event: 'revert', listener: ThemeRevertListener): void;
|
|
732
|
+
/**
|
|
733
|
+
* Remove listener
|
|
734
|
+
*/
|
|
735
|
+
off(event: 'change', listener: ThemeChangeListener): void;
|
|
736
|
+
off(event: 'load', listener: ThemeLoadListener): void;
|
|
737
|
+
off(event: 'error', listener: ThemeErrorListener): void;
|
|
738
|
+
off(event: 'revert', listener: ThemeRevertListener): void;
|
|
739
|
+
/**
|
|
740
|
+
* Emit change event
|
|
741
|
+
*/
|
|
742
|
+
private emitChange;
|
|
743
|
+
/**
|
|
744
|
+
* Emit load event
|
|
745
|
+
*/
|
|
746
|
+
private emitLoad;
|
|
747
|
+
/**
|
|
748
|
+
* Emit error event
|
|
749
|
+
* Emits error to listeners (error emission is controlled at call site)
|
|
750
|
+
*/
|
|
751
|
+
private emitError;
|
|
752
|
+
/**
|
|
753
|
+
* Emit revert event
|
|
754
|
+
*/
|
|
755
|
+
private emitRevert;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Theme Manager
|
|
760
|
+
*
|
|
761
|
+
* Core theme management class for the Atomix Design System.
|
|
762
|
+
* Rewritten to use the new ThemeEngine architecture.
|
|
763
|
+
* Handles theme loading, switching, persistence, and events.
|
|
764
|
+
* Supports both CSS-based themes and JavaScript-based themes.
|
|
765
|
+
*/
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* ThemeManager class
|
|
769
|
+
*
|
|
770
|
+
* Manages theme loading, switching, and persistence for Atomix Design System.
|
|
771
|
+
* Uses the new ThemeEngine architecture for unified CSS/JS theme support.
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```typescript
|
|
775
|
+
* const themeManager = new ThemeManager({
|
|
776
|
+
* // No defaultTheme - uses built-in styles
|
|
777
|
+
* });
|
|
778
|
+
*
|
|
779
|
+
* await themeManager.setTheme('my-custom-theme');
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
782
|
+
declare class ThemeManager {
|
|
783
|
+
private engine;
|
|
784
|
+
private config;
|
|
785
|
+
private currentTheme;
|
|
786
|
+
private activeTheme;
|
|
787
|
+
private eventListeners;
|
|
788
|
+
private storageAdapter;
|
|
789
|
+
private initialized;
|
|
790
|
+
private rtlManager?;
|
|
791
|
+
private logger;
|
|
792
|
+
/**
|
|
793
|
+
* Create a new ThemeManager instance
|
|
794
|
+
*
|
|
795
|
+
* @param config - Theme manager configuration
|
|
796
|
+
*/
|
|
797
|
+
constructor(config: ThemeManagerConfig);
|
|
798
|
+
/**
|
|
799
|
+
* Initialize the theme manager
|
|
800
|
+
*/
|
|
801
|
+
private initialize;
|
|
802
|
+
/**
|
|
803
|
+
* Get default theme
|
|
804
|
+
*/
|
|
805
|
+
private getDefaultTheme;
|
|
806
|
+
/**
|
|
807
|
+
* Set theme
|
|
808
|
+
*/
|
|
809
|
+
setTheme(theme: string | Theme, options?: ThemeLoadOptions): Promise<void>;
|
|
810
|
+
/**
|
|
811
|
+
* Get current theme
|
|
812
|
+
*/
|
|
813
|
+
getTheme(): string;
|
|
814
|
+
/**
|
|
815
|
+
* Get active theme object (for JS themes)
|
|
816
|
+
*/
|
|
817
|
+
getActiveTheme(): Theme | null;
|
|
818
|
+
/**
|
|
819
|
+
* Get available themes
|
|
820
|
+
*/
|
|
821
|
+
getAvailableThemes(): ThemeMetadata[];
|
|
822
|
+
/**
|
|
823
|
+
* Check if theme is loaded
|
|
824
|
+
*/
|
|
825
|
+
isThemeLoaded(themeName: string): boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Preload theme
|
|
828
|
+
*/
|
|
829
|
+
preloadTheme(themeName: string): Promise<void>;
|
|
830
|
+
/**
|
|
831
|
+
* Add event listener
|
|
832
|
+
*/
|
|
833
|
+
on(event: 'themeChange', callback: ThemeChangeCallback): void;
|
|
834
|
+
on(event: 'themeLoad', callback: ThemeLoadCallback): void;
|
|
835
|
+
on(event: 'themeError', callback: ThemeErrorCallback): void;
|
|
836
|
+
/**
|
|
837
|
+
* Remove event listener
|
|
838
|
+
*/
|
|
839
|
+
off(event: 'themeChange', callback: ThemeChangeCallback): void;
|
|
840
|
+
off(event: 'themeLoad', callback: ThemeLoadCallback): void;
|
|
841
|
+
off(event: 'themeError', callback: ThemeErrorCallback): void;
|
|
842
|
+
/**
|
|
843
|
+
* Emit theme change event
|
|
844
|
+
*/
|
|
845
|
+
private emitThemeChange;
|
|
846
|
+
/**
|
|
847
|
+
* Emit theme load event
|
|
848
|
+
*/
|
|
849
|
+
private emitThemeLoad;
|
|
850
|
+
/**
|
|
851
|
+
* Emit theme error event
|
|
852
|
+
*/
|
|
853
|
+
private emitThemeError;
|
|
854
|
+
/**
|
|
855
|
+
* Get engine instance (for advanced usage)
|
|
856
|
+
*/
|
|
857
|
+
getEngine(): ThemeEngine;
|
|
858
|
+
/**
|
|
859
|
+
* Get RTL manager
|
|
860
|
+
*/
|
|
861
|
+
getRTLManager(): RTLManager | undefined;
|
|
862
|
+
/**
|
|
863
|
+
* Set RTL direction
|
|
864
|
+
*/
|
|
865
|
+
setDirection(direction: 'ltr' | 'rtl'): void;
|
|
866
|
+
/**
|
|
867
|
+
* Get current direction
|
|
868
|
+
*/
|
|
869
|
+
getDirection(): 'ltr' | 'rtl';
|
|
870
|
+
/**
|
|
871
|
+
* Destroy theme manager
|
|
872
|
+
*/
|
|
873
|
+
destroy(): void;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Theme metadata interface matching themes.config.js structure
|
|
878
|
+
*/
|
|
879
|
+
interface ThemeMetadata {
|
|
880
|
+
/** Display name of the theme */
|
|
881
|
+
name: string;
|
|
882
|
+
/** Unique identifier/class name for the theme */
|
|
883
|
+
class?: string;
|
|
884
|
+
/** Theme description */
|
|
885
|
+
description?: string;
|
|
886
|
+
/** Theme author */
|
|
887
|
+
author?: string;
|
|
888
|
+
/** Theme version (semver) */
|
|
889
|
+
version?: string;
|
|
890
|
+
/** Theme tags for categorization */
|
|
891
|
+
tags?: string[];
|
|
892
|
+
/** Whether the theme supports dark mode */
|
|
893
|
+
supportsDarkMode?: boolean;
|
|
894
|
+
/** Theme status: stable, beta, experimental, deprecated */
|
|
895
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
896
|
+
/** Accessibility information */
|
|
897
|
+
a11y?: {
|
|
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
|
|
975
|
+
*/
|
|
976
|
+
interface ThemeValidationResult {
|
|
977
|
+
/** Whether the theme is valid */
|
|
978
|
+
valid: boolean;
|
|
979
|
+
/** Validation errors */
|
|
980
|
+
errors: string[];
|
|
981
|
+
/** Validation warnings */
|
|
982
|
+
warnings: string[];
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Theme change callback function
|
|
986
|
+
*/
|
|
987
|
+
type ThemeChangeCallback = (event: ThemeChangeEvent) => void;
|
|
988
|
+
/**
|
|
989
|
+
* Theme load callback function
|
|
990
|
+
*/
|
|
991
|
+
type ThemeLoadCallback = (themeName: string) => void;
|
|
992
|
+
/**
|
|
993
|
+
* Theme error callback function
|
|
994
|
+
*/
|
|
995
|
+
type ThemeErrorCallback = (error: Error, themeName: string) => void;
|
|
996
|
+
/**
|
|
997
|
+
* React hook return type for useTheme
|
|
998
|
+
*/
|
|
999
|
+
interface UseThemeReturn {
|
|
1000
|
+
/** Current theme name */
|
|
1001
|
+
theme: string;
|
|
1002
|
+
/** Current active theme object (for JS themes) */
|
|
1003
|
+
activeTheme: Theme | null;
|
|
1004
|
+
/** Function to change theme */
|
|
1005
|
+
setTheme: (theme: string | Theme, options?: ThemeLoadOptions) => Promise<void>;
|
|
1006
|
+
/** Available themes */
|
|
1007
|
+
availableThemes: ThemeMetadata[];
|
|
1008
|
+
/** Whether a theme is currently loading */
|
|
1009
|
+
isLoading: boolean;
|
|
1010
|
+
/** Current error, if any */
|
|
1011
|
+
error: Error | null;
|
|
1012
|
+
/** Whether a specific theme is loaded */
|
|
1013
|
+
isThemeLoaded: (themeName: string) => boolean;
|
|
1014
|
+
/** Preload a theme */
|
|
1015
|
+
preloadTheme: (themeName: string) => Promise<void>;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Component-level theme override configuration
|
|
1019
|
+
*/
|
|
1020
|
+
interface ComponentThemeOverride {
|
|
1021
|
+
/** CSS variable overrides for the component */
|
|
1022
|
+
cssVars?: Record<string, string | number>;
|
|
1023
|
+
/** Default prop overrides */
|
|
1024
|
+
defaultProps?: Record<string, any>;
|
|
1025
|
+
/** Part-specific overrides */
|
|
1026
|
+
parts?: Record<string, {
|
|
1027
|
+
cssVars?: Record<string, string | number>;
|
|
1028
|
+
className?: string;
|
|
1029
|
+
}>;
|
|
1030
|
+
/** Variant overrides */
|
|
1031
|
+
variants?: Record<string, {
|
|
1032
|
+
cssVars?: Record<string, string | number>;
|
|
1033
|
+
className?: string;
|
|
1034
|
+
}>;
|
|
1035
|
+
/** Additional className for the component */
|
|
1036
|
+
className?: string;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Theme component overrides for all components
|
|
1040
|
+
*/
|
|
1041
|
+
interface ThemeComponentOverrides {
|
|
1042
|
+
Button?: ComponentThemeOverride;
|
|
1043
|
+
Card?: ComponentThemeOverride;
|
|
1044
|
+
Input?: ComponentThemeOverride;
|
|
1045
|
+
Modal?: ComponentThemeOverride;
|
|
1046
|
+
Dropdown?: ComponentThemeOverride;
|
|
1047
|
+
Badge?: ComponentThemeOverride;
|
|
1048
|
+
Tabs?: ComponentThemeOverride;
|
|
1049
|
+
Progress?: ComponentThemeOverride;
|
|
1050
|
+
Tooltip?: ComponentThemeOverride;
|
|
1051
|
+
Select?: ComponentThemeOverride;
|
|
1052
|
+
Checkbox?: ComponentThemeOverride;
|
|
1053
|
+
Radio?: ComponentThemeOverride;
|
|
1054
|
+
Textarea?: ComponentThemeOverride;
|
|
1055
|
+
FormGroup?: ComponentThemeOverride;
|
|
1056
|
+
Navbar?: ComponentThemeOverride;
|
|
1057
|
+
Accordion?: ComponentThemeOverride;
|
|
1058
|
+
DataTable?: ComponentThemeOverride;
|
|
1059
|
+
Avatar?: ComponentThemeOverride;
|
|
1060
|
+
List?: ComponentThemeOverride;
|
|
1061
|
+
Popover?: ComponentThemeOverride;
|
|
1062
|
+
Messages?: ComponentThemeOverride;
|
|
1063
|
+
Callout?: ComponentThemeOverride;
|
|
1064
|
+
Spinner?: ComponentThemeOverride;
|
|
1065
|
+
[key: string]: ComponentThemeOverride | undefined;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Theme provider props
|
|
1069
|
+
*/
|
|
1070
|
+
interface ThemeProviderProps {
|
|
1071
|
+
/** Child components */
|
|
1072
|
+
children: React.ReactNode;
|
|
1073
|
+
/** Default theme */
|
|
1074
|
+
defaultTheme?: string | Theme;
|
|
1075
|
+
/** Available themes */
|
|
1076
|
+
themes?: Record<string, ThemeMetadata>;
|
|
1077
|
+
/** Base path for theme CSS */
|
|
1078
|
+
basePath?: string;
|
|
1079
|
+
/** CDN path for theme CSS */
|
|
1080
|
+
cdnPath?: string | null;
|
|
1081
|
+
/** Themes to preload */
|
|
1082
|
+
preload?: string[];
|
|
1083
|
+
/** Enable lazy loading */
|
|
1084
|
+
lazy?: boolean;
|
|
1085
|
+
/** localStorage key */
|
|
1086
|
+
storageKey?: string;
|
|
1087
|
+
/** Data attribute name */
|
|
1088
|
+
dataAttribute?: string;
|
|
1089
|
+
/** Enable persistence */
|
|
1090
|
+
enablePersistence?: boolean;
|
|
1091
|
+
/** Use minified CSS */
|
|
1092
|
+
useMinified?: boolean;
|
|
1093
|
+
/** Callback when theme changes */
|
|
1094
|
+
onThemeChange?: (theme: string | Theme) => void;
|
|
1095
|
+
/** Callback on error */
|
|
1096
|
+
onError?: (error: Error, themeName: string) => void;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Theme context value
|
|
1100
|
+
*/
|
|
1101
|
+
interface ThemeContextValue {
|
|
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
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Color palette configuration for a single color
|
|
1123
|
+
*/
|
|
1124
|
+
interface PaletteColor {
|
|
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
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Palette configuration options for createTheme
|
|
1136
|
+
*/
|
|
1137
|
+
interface PaletteOptions {
|
|
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
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Typography configuration options for createTheme
|
|
1166
|
+
*/
|
|
1167
|
+
interface TypographyOptions {
|
|
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
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Spacing function type
|
|
1231
|
+
*/
|
|
1232
|
+
type SpacingFunction = (...values: number[]) => string;
|
|
1233
|
+
/**
|
|
1234
|
+
* Spacing configuration options for createTheme
|
|
1235
|
+
*/
|
|
1236
|
+
type SpacingOptions = number | number[] | SpacingFunction;
|
|
1237
|
+
/**
|
|
1238
|
+
* Breakpoint values configuration
|
|
1239
|
+
*/
|
|
1240
|
+
interface BreakpointValues {
|
|
1241
|
+
xs?: number;
|
|
1242
|
+
sm?: number;
|
|
1243
|
+
md?: number;
|
|
1244
|
+
lg?: number;
|
|
1245
|
+
xl?: number;
|
|
1246
|
+
[key: string]: number | undefined;
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Breakpoints configuration options for createTheme
|
|
1250
|
+
*/
|
|
1251
|
+
interface BreakpointsOptions {
|
|
1252
|
+
/** Breakpoint values in pixels */
|
|
1253
|
+
values?: BreakpointValues;
|
|
1254
|
+
/** Unit for breakpoints (default: 'px') */
|
|
1255
|
+
unit?: string;
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Shadow configuration
|
|
1259
|
+
*/
|
|
1260
|
+
interface ShadowOptions {
|
|
1261
|
+
xs?: string;
|
|
1262
|
+
sm?: string;
|
|
1263
|
+
md?: string;
|
|
1264
|
+
lg?: string;
|
|
1265
|
+
xl?: string;
|
|
1266
|
+
[key: string]: string | undefined;
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Transition configuration
|
|
1270
|
+
*/
|
|
1271
|
+
interface TransitionOptions {
|
|
1272
|
+
/** Transition duration values */
|
|
1273
|
+
duration?: {
|
|
1274
|
+
shortest?: number;
|
|
1275
|
+
shorter?: number;
|
|
1276
|
+
short?: number;
|
|
1277
|
+
standard?: number;
|
|
1278
|
+
complex?: number;
|
|
1279
|
+
enteringScreen?: number;
|
|
1280
|
+
leavingScreen?: number;
|
|
1281
|
+
};
|
|
1282
|
+
/** Easing functions */
|
|
1283
|
+
easing?: {
|
|
1284
|
+
easeInOut?: string;
|
|
1285
|
+
easeOut?: string;
|
|
1286
|
+
easeIn?: string;
|
|
1287
|
+
sharp?: string;
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Z-index configuration
|
|
1292
|
+
*/
|
|
1293
|
+
interface ZIndexOptions {
|
|
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
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Border radius configuration
|
|
1305
|
+
*/
|
|
1306
|
+
interface BorderRadiusOptions {
|
|
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
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Custom theme properties for extension
|
|
1329
|
+
* Users can augment this interface via module augmentation
|
|
1330
|
+
*/
|
|
1331
|
+
interface ThemeCustomProperties {
|
|
1332
|
+
[key: string]: any;
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* Theme configuration options for createTheme
|
|
1336
|
+
* Extends ThemeMetadata to support both CSS and JS theme properties
|
|
1337
|
+
*/
|
|
1338
|
+
interface ThemeOptions extends Partial<ThemeMetadata> {
|
|
1339
|
+
/** Color palette configuration */
|
|
1340
|
+
palette?: PaletteOptions;
|
|
1341
|
+
/** Typography configuration */
|
|
1342
|
+
typography?: TypographyOptions;
|
|
1343
|
+
/** Spacing configuration */
|
|
1344
|
+
spacing?: SpacingOptions;
|
|
1345
|
+
/** Breakpoints configuration */
|
|
1346
|
+
breakpoints?: BreakpointsOptions;
|
|
1347
|
+
/** Shadow configuration */
|
|
1348
|
+
shadows?: ShadowOptions;
|
|
1349
|
+
/** Transition configuration */
|
|
1350
|
+
transitions?: TransitionOptions;
|
|
1351
|
+
/** Z-index configuration */
|
|
1352
|
+
zIndex?: ZIndexOptions;
|
|
1353
|
+
/** Border radius configuration */
|
|
1354
|
+
borderRadius?: BorderRadiusOptions;
|
|
1355
|
+
/** Custom properties */
|
|
1356
|
+
custom?: ThemeCustomProperties;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Complete theme object with computed values
|
|
1360
|
+
* Generated by createTheme function
|
|
1361
|
+
*/
|
|
1362
|
+
interface Theme extends ThemeMetadata {
|
|
1363
|
+
/** Color palette with computed values */
|
|
1364
|
+
palette: {
|
|
1365
|
+
primary: PaletteColor;
|
|
1366
|
+
secondary: PaletteColor;
|
|
1367
|
+
error: PaletteColor;
|
|
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;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Theme Provider
|
|
1430
|
+
*
|
|
1431
|
+
* React context provider for theme management
|
|
1432
|
+
* Updated to use the new ThemeEngine architecture
|
|
1433
|
+
*/
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* ThemeProvider component
|
|
1437
|
+
*
|
|
1438
|
+
* Provides theme context to child components and manages theme state.
|
|
1439
|
+
* Uses the new ThemeEngine-based ThemeManager.
|
|
1440
|
+
*
|
|
1441
|
+
* @example
|
|
1442
|
+
* ```tsx
|
|
1443
|
+
* import { ThemeProvider } from '@shohojdhara/atomix/theme';
|
|
1444
|
+
*
|
|
1445
|
+
* function App() {
|
|
1446
|
+
* return (
|
|
1447
|
+
* <ThemeProvider>
|
|
1448
|
+
* <YourApp />
|
|
1449
|
+
* </ThemeProvider>
|
|
1450
|
+
* );
|
|
1451
|
+
* }
|
|
1452
|
+
* ```
|
|
1453
|
+
*/
|
|
1454
|
+
declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
|
|
1455
|
+
|
|
1456
|
+
/**
|
|
1457
|
+
* useTheme Hook
|
|
1458
|
+
*
|
|
1459
|
+
* React hook for accessing theme context
|
|
1460
|
+
* Updated to work with new ThemeEngine architecture
|
|
1461
|
+
*/
|
|
1462
|
+
|
|
1463
|
+
/**
|
|
1464
|
+
* useTheme hook
|
|
1465
|
+
*
|
|
1466
|
+
* Access theme context and theme management functions
|
|
1467
|
+
*
|
|
1468
|
+
* @example
|
|
1469
|
+
* ```tsx
|
|
1470
|
+
* function MyComponent() {
|
|
1471
|
+
* const { theme, setTheme, availableThemes } = useTheme();
|
|
1472
|
+
*
|
|
1473
|
+
* return (
|
|
1474
|
+
* <div>
|
|
1475
|
+
* <p>Current theme: {theme}</p>
|
|
1476
|
+
* <button onClick={() => setTheme('dark-theme')}>
|
|
1477
|
+
* Switch to Dark
|
|
1478
|
+
* </button>
|
|
1479
|
+
* </div>
|
|
1480
|
+
* );
|
|
1481
|
+
* }
|
|
1482
|
+
* ```
|
|
1483
|
+
*/
|
|
1484
|
+
declare function useTheme(): UseThemeReturn;
|
|
1485
|
+
|
|
1486
|
+
/**
|
|
1487
|
+
* Theme context with default values
|
|
1488
|
+
*/
|
|
1489
|
+
declare const ThemeContext: React$1.Context<ThemeContextValue | null>;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* Theme Error Boundary
|
|
1493
|
+
*
|
|
1494
|
+
* React error boundary for catching and handling theme-related errors.
|
|
1495
|
+
* Prevents the entire app from crashing when theme errors occur.
|
|
1496
|
+
*/
|
|
1497
|
+
|
|
1498
|
+
/**
|
|
1499
|
+
* Error boundary state
|
|
1500
|
+
*/
|
|
1501
|
+
interface ThemeErrorBoundaryState {
|
|
1502
|
+
/** Whether an error has occurred */
|
|
1503
|
+
hasError: boolean;
|
|
1504
|
+
/** The error that occurred */
|
|
1505
|
+
error: Error | null;
|
|
1506
|
+
/** Error information */
|
|
1507
|
+
errorInfo: ErrorInfo | null;
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Error boundary props
|
|
1511
|
+
*/
|
|
1512
|
+
interface ThemeErrorBoundaryProps {
|
|
1513
|
+
/** Child components */
|
|
1514
|
+
children: ReactNode;
|
|
1515
|
+
/** Fallback UI to render when error occurs */
|
|
1516
|
+
fallback?: (error: Error, errorInfo: ErrorInfo) => ReactNode;
|
|
1517
|
+
/** Callback when error occurs */
|
|
1518
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
1519
|
+
/** Whether to reset error on children change */
|
|
1520
|
+
resetOnPropsChange?: boolean;
|
|
1521
|
+
/** Custom error message */
|
|
1522
|
+
errorMessage?: string;
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Theme Error Boundary Component
|
|
1526
|
+
*
|
|
1527
|
+
* Catches errors in the theme system and displays a fallback UI
|
|
1528
|
+
* instead of crashing the entire application.
|
|
1529
|
+
*/
|
|
1530
|
+
declare class ThemeErrorBoundary extends Component<ThemeErrorBoundaryProps, ThemeErrorBoundaryState> {
|
|
1531
|
+
private logger;
|
|
1532
|
+
constructor(props: ThemeErrorBoundaryProps);
|
|
1533
|
+
static getDerivedStateFromError(error: Error): Partial<ThemeErrorBoundaryState>;
|
|
1534
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
1535
|
+
componentDidUpdate(prevProps: ThemeErrorBoundaryProps): void;
|
|
1536
|
+
render(): ReactNode;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* createTheme - Create a theme object with computed values
|
|
1541
|
+
*
|
|
1542
|
+
* Similar to Material-UI's createTheme, this function accepts theme configuration
|
|
1543
|
+
* options and returns a complete theme object with computed values.
|
|
1544
|
+
*
|
|
1545
|
+
* @example
|
|
1546
|
+
* ```typescript
|
|
1547
|
+
* const theme = createTheme({
|
|
1548
|
+
* palette: {
|
|
1549
|
+
* primary: { main: '#7AFFD7' },
|
|
1550
|
+
* secondary: { main: '#FF5733' },
|
|
1551
|
+
* },
|
|
1552
|
+
* typography: {
|
|
1553
|
+
* fontFamily: 'Inter, sans-serif',
|
|
1554
|
+
* },
|
|
1555
|
+
* });
|
|
1556
|
+
* ```
|
|
1557
|
+
*/
|
|
1558
|
+
|
|
1559
|
+
/**
|
|
1560
|
+
* Create a theme object with computed values
|
|
1561
|
+
*
|
|
1562
|
+
* @param options - Theme configuration options
|
|
1563
|
+
* @returns Complete theme object
|
|
1564
|
+
*/
|
|
1565
|
+
declare function createTheme(...options: ThemeOptions[]): Theme;
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* Create a theme from Atomix configuration
|
|
1569
|
+
*
|
|
1570
|
+
* This function converts atomix.config.ts format to a theme object
|
|
1571
|
+
* that can be used with ThemeProvider.
|
|
1572
|
+
*
|
|
1573
|
+
* @param config - Atomix configuration object
|
|
1574
|
+
* @returns Theme object ready for use
|
|
1575
|
+
*
|
|
1576
|
+
* @example
|
|
1577
|
+
* ```typescript
|
|
1578
|
+
* import { createThemeFromConfig } from '@shohojdhara/atomix/theme';
|
|
1579
|
+
* import config from './atomix.config';
|
|
1580
|
+
*
|
|
1581
|
+
* const theme = createThemeFromConfig(config);
|
|
1582
|
+
* ```
|
|
1583
|
+
*/
|
|
1584
|
+
declare function createThemeFromConfig(config: AtomixConfig): Theme;
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* Theme Tools for Library Users
|
|
1588
|
+
*
|
|
1589
|
+
* Developer-friendly utilities for working with Atomix themes
|
|
1590
|
+
*/
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Quick theme creator with sensible defaults
|
|
1594
|
+
*/
|
|
1595
|
+
declare function quickTheme(name: string, primaryColor: string, secondaryColor?: string): Theme;
|
|
1596
|
+
/**
|
|
1597
|
+
* Create a dark theme variant from a light theme
|
|
1598
|
+
*/
|
|
1599
|
+
declare function createDarkVariant(lightTheme: Theme): Theme;
|
|
1600
|
+
/**
|
|
1601
|
+
* Validate theme structure
|
|
1602
|
+
*/
|
|
1603
|
+
declare function validateTheme(theme: Theme): {
|
|
1604
|
+
valid: boolean;
|
|
1605
|
+
errors: string[];
|
|
1606
|
+
};
|
|
1607
|
+
/**
|
|
1608
|
+
* Generate CSS string from theme
|
|
1609
|
+
*/
|
|
1610
|
+
declare function themeToCSS(theme: Theme, selector?: string): string;
|
|
1611
|
+
/**
|
|
1612
|
+
* Export theme as JSON
|
|
1613
|
+
*/
|
|
1614
|
+
declare function exportTheme(theme: Theme): string;
|
|
1615
|
+
/**
|
|
1616
|
+
* Import theme from JSON
|
|
1617
|
+
*/
|
|
1618
|
+
declare function importTheme(json: string): Theme;
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Theme CLI
|
|
1622
|
+
*
|
|
1623
|
+
* Command-line interface for theme management
|
|
1624
|
+
*/
|
|
1625
|
+
/**
|
|
1626
|
+
* CLI command interface
|
|
1627
|
+
*/
|
|
1628
|
+
interface CLICommand {
|
|
1629
|
+
name: string;
|
|
1630
|
+
description: string;
|
|
1631
|
+
options?: Record<string, string>;
|
|
1632
|
+
handler: (args: string[], options: Record<string, any>) => Promise<void> | void;
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Theme CLI
|
|
1636
|
+
*
|
|
1637
|
+
* Command-line interface for theme operations
|
|
1638
|
+
*/
|
|
1639
|
+
declare class ThemeCLI {
|
|
1640
|
+
private commands;
|
|
1641
|
+
constructor();
|
|
1642
|
+
/**
|
|
1643
|
+
* Register default commands
|
|
1644
|
+
*/
|
|
1645
|
+
private registerDefaultCommands;
|
|
1646
|
+
/**
|
|
1647
|
+
* Register a command
|
|
1648
|
+
*/
|
|
1649
|
+
register(command: CLICommand): void;
|
|
1650
|
+
/**
|
|
1651
|
+
* Run CLI with arguments
|
|
1652
|
+
*/
|
|
1653
|
+
run(args: string[]): Promise<void>;
|
|
1654
|
+
/**
|
|
1655
|
+
* Parse command arguments
|
|
1656
|
+
*/
|
|
1657
|
+
private parseArgs;
|
|
1658
|
+
/**
|
|
1659
|
+
* Handle validate command
|
|
1660
|
+
*/
|
|
1661
|
+
private handleValidate;
|
|
1662
|
+
/**
|
|
1663
|
+
* Handle list command
|
|
1664
|
+
*/
|
|
1665
|
+
private handleList;
|
|
1666
|
+
/**
|
|
1667
|
+
* Handle inspect command
|
|
1668
|
+
*/
|
|
1669
|
+
private handleInspect;
|
|
1670
|
+
/**
|
|
1671
|
+
* Handle compare command
|
|
1672
|
+
*/
|
|
1673
|
+
private handleCompare;
|
|
1674
|
+
/**
|
|
1675
|
+
* Handle export command
|
|
1676
|
+
*/
|
|
1677
|
+
private handleExport;
|
|
1678
|
+
/**
|
|
1679
|
+
* Handle help command
|
|
1680
|
+
*/
|
|
1681
|
+
private handleHelp;
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* Create CLI instance
|
|
1685
|
+
*/
|
|
1686
|
+
declare function createCLI(): ThemeCLI;
|
|
1687
|
+
/**
|
|
1688
|
+
* Run CLI with process arguments
|
|
1689
|
+
*/
|
|
1690
|
+
declare function runCLI(): void;
|
|
1691
|
+
|
|
1692
|
+
/**
|
|
1693
|
+
* Theme Preview Component
|
|
1694
|
+
*
|
|
1695
|
+
* React component for previewing themes in development
|
|
1696
|
+
*/
|
|
1697
|
+
|
|
1698
|
+
/**
|
|
1699
|
+
* Theme preview props
|
|
1700
|
+
*/
|
|
1701
|
+
interface ThemePreviewProps {
|
|
1702
|
+
/** Theme to preview */
|
|
1703
|
+
theme: Theme;
|
|
1704
|
+
/** Show theme details */
|
|
1705
|
+
showDetails?: boolean;
|
|
1706
|
+
/** Show color palette */
|
|
1707
|
+
showPalette?: boolean;
|
|
1708
|
+
/** Show typography */
|
|
1709
|
+
showTypography?: boolean;
|
|
1710
|
+
/** Show spacing */
|
|
1711
|
+
showSpacing?: boolean;
|
|
1712
|
+
/** Custom components to render */
|
|
1713
|
+
children?: React__default.ReactNode;
|
|
1714
|
+
/** CSS class name */
|
|
1715
|
+
className?: string;
|
|
1716
|
+
/** Inline styles */
|
|
1717
|
+
style?: React__default.CSSProperties;
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Theme Preview Component
|
|
1721
|
+
*
|
|
1722
|
+
* Renders a preview of a theme with sample components
|
|
1723
|
+
*/
|
|
1724
|
+
declare const ThemePreview: React__default.FC<ThemePreviewProps>;
|
|
1725
|
+
|
|
1726
|
+
/**
|
|
1727
|
+
* Theme Inspector Component
|
|
1728
|
+
*
|
|
1729
|
+
* React component for inspecting and debugging themes
|
|
1730
|
+
*/
|
|
1731
|
+
|
|
1732
|
+
/**
|
|
1733
|
+
* Theme inspector props
|
|
1734
|
+
*/
|
|
1735
|
+
interface ThemeInspectorProps {
|
|
1736
|
+
/** Theme to inspect */
|
|
1737
|
+
theme: Theme;
|
|
1738
|
+
/** Show validation results */
|
|
1739
|
+
showValidation?: boolean;
|
|
1740
|
+
/** Show CSS variables */
|
|
1741
|
+
showCSSVariables?: boolean;
|
|
1742
|
+
/** Show theme structure */
|
|
1743
|
+
showStructure?: boolean;
|
|
1744
|
+
/** CSS class name */
|
|
1745
|
+
className?: string;
|
|
1746
|
+
/** Inline styles */
|
|
1747
|
+
style?: React__default.CSSProperties;
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Theme Inspector Component
|
|
1751
|
+
*
|
|
1752
|
+
* Provides detailed inspection and debugging information for themes
|
|
1753
|
+
*/
|
|
1754
|
+
declare const ThemeInspector: React__default.FC<ThemeInspectorProps>;
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* Theme Comparator Component
|
|
1758
|
+
*
|
|
1759
|
+
* React component for comparing two themes side-by-side
|
|
1760
|
+
*/
|
|
1761
|
+
|
|
1762
|
+
/**
|
|
1763
|
+
* Theme comparator props
|
|
1764
|
+
*/
|
|
1765
|
+
interface ThemeComparatorProps {
|
|
1766
|
+
/** First theme to compare */
|
|
1767
|
+
themeA: Theme;
|
|
1768
|
+
/** Second theme to compare */
|
|
1769
|
+
themeB: Theme;
|
|
1770
|
+
/** Show only differences */
|
|
1771
|
+
showOnlyDifferences?: boolean;
|
|
1772
|
+
/** CSS class name */
|
|
1773
|
+
className?: string;
|
|
1774
|
+
/** Inline styles */
|
|
1775
|
+
style?: React__default.CSSProperties;
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Theme Comparator Component
|
|
1779
|
+
*
|
|
1780
|
+
* Compares two themes and highlights differences
|
|
1781
|
+
*/
|
|
1782
|
+
declare const ThemeComparator: React__default.FC<ThemeComparatorProps>;
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* Theme Live Editor Component
|
|
1786
|
+
*
|
|
1787
|
+
* React component for live editing themes in development
|
|
1788
|
+
*/
|
|
1789
|
+
|
|
1790
|
+
/**
|
|
1791
|
+
* Live editor props
|
|
1792
|
+
*/
|
|
1793
|
+
interface ThemeLiveEditorProps {
|
|
1794
|
+
/** Initial theme */
|
|
1795
|
+
initialTheme: Theme;
|
|
1796
|
+
/** Callback when theme changes */
|
|
1797
|
+
onChange?: (theme: Theme) => void;
|
|
1798
|
+
/** CSS class name */
|
|
1799
|
+
className?: string;
|
|
1800
|
+
/** Inline styles */
|
|
1801
|
+
style?: React__default.CSSProperties;
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* Theme Live Editor Component
|
|
1805
|
+
*
|
|
1806
|
+
* Allows live editing of theme properties with instant preview
|
|
1807
|
+
*/
|
|
1808
|
+
declare const ThemeLiveEditor: React__default.FC<ThemeLiveEditorProps>;
|
|
1809
|
+
|
|
1810
|
+
/**
|
|
1811
|
+
* Theme Applicator
|
|
1812
|
+
*
|
|
1813
|
+
* Applies theme configurations to the DOM, including CSS variables,
|
|
1814
|
+
* component overrides, typography, spacing, and color palettes.
|
|
1815
|
+
*/
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* Theme applicator class for runtime theme application
|
|
1819
|
+
*/
|
|
1820
|
+
declare class ThemeApplicator {
|
|
1821
|
+
private appliedVars;
|
|
1822
|
+
private root;
|
|
1823
|
+
constructor(root?: HTMLElement);
|
|
1824
|
+
/**
|
|
1825
|
+
* Apply a complete theme configuration
|
|
1826
|
+
*/
|
|
1827
|
+
applyTheme(theme: Theme): void;
|
|
1828
|
+
/**
|
|
1829
|
+
* Apply global CSS variables
|
|
1830
|
+
*/
|
|
1831
|
+
private applyGlobalCSSVars;
|
|
1832
|
+
/**
|
|
1833
|
+
* Apply typography system
|
|
1834
|
+
*/
|
|
1835
|
+
private applyTypography;
|
|
1836
|
+
/**
|
|
1837
|
+
* Apply spacing system
|
|
1838
|
+
*/
|
|
1839
|
+
private applySpacing;
|
|
1840
|
+
/**
|
|
1841
|
+
* Apply color palette
|
|
1842
|
+
*/
|
|
1843
|
+
private applyPalette;
|
|
1844
|
+
/**
|
|
1845
|
+
* Apply component-level overrides
|
|
1846
|
+
*/
|
|
1847
|
+
private applyComponentOverrides;
|
|
1848
|
+
/**
|
|
1849
|
+
* Apply override for a specific component
|
|
1850
|
+
*/
|
|
1851
|
+
private applyComponentOverride;
|
|
1852
|
+
/**
|
|
1853
|
+
* Clear all applied CSS variables
|
|
1854
|
+
*/
|
|
1855
|
+
private clearAppliedVars;
|
|
1856
|
+
/**
|
|
1857
|
+
* Get all currently applied variables
|
|
1858
|
+
*/
|
|
1859
|
+
getAppliedVars(): string[];
|
|
1860
|
+
/**
|
|
1861
|
+
* Remove theme application
|
|
1862
|
+
*/
|
|
1863
|
+
removeTheme(): void;
|
|
1864
|
+
/**
|
|
1865
|
+
* Update specific CSS variables without clearing all
|
|
1866
|
+
*/
|
|
1867
|
+
updateCSSVars(vars: Record<string, string | number>): void;
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* Get or create global theme applicator
|
|
1871
|
+
*/
|
|
1872
|
+
declare function getThemeApplicator(): ThemeApplicator;
|
|
1873
|
+
/**
|
|
1874
|
+
* Apply theme using global applicator
|
|
1875
|
+
*/
|
|
1876
|
+
declare function applyTheme(theme: Theme): void;
|
|
1877
|
+
/**
|
|
1878
|
+
* Remove theme using global applicator
|
|
1879
|
+
*/
|
|
1880
|
+
declare function removeTheme(): void;
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* CSS Variable Mapper
|
|
1884
|
+
*
|
|
1885
|
+
* Utilities for generating and managing CSS custom properties from SCSS tokens
|
|
1886
|
+
* and component configurations.
|
|
1887
|
+
*/
|
|
1888
|
+
/**
|
|
1889
|
+
* Configuration for generating CSS variables for a component
|
|
1890
|
+
*/
|
|
1891
|
+
interface CSSVariableConfig {
|
|
1892
|
+
/** Component name (e.g., 'button', 'card') */
|
|
1893
|
+
component: string;
|
|
1894
|
+
/** Base properties for the component */
|
|
1895
|
+
properties: Record<string, string | number>;
|
|
1896
|
+
/** Part-specific properties (e.g., icon, label) */
|
|
1897
|
+
parts?: Record<string, Record<string, string | number>>;
|
|
1898
|
+
/** State-specific properties (e.g., hover, active, disabled) */
|
|
1899
|
+
states?: Record<string, Record<string, string | number>>;
|
|
1900
|
+
/** Variant-specific properties (e.g., primary, secondary) */
|
|
1901
|
+
variants?: Record<string, Record<string, string | number>>;
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* CSS variable naming options
|
|
1905
|
+
*/
|
|
1906
|
+
interface CSSVariableNamingOptions {
|
|
1907
|
+
/** Prefix for all variables (default: 'atomix') */
|
|
1908
|
+
prefix?: string;
|
|
1909
|
+
/** Separator between parts (default: '-') */
|
|
1910
|
+
separator?: string;
|
|
1911
|
+
/** Whether to include component name in variable (default: true) */
|
|
1912
|
+
includeComponent?: boolean;
|
|
1913
|
+
}
|
|
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
|
+
/**
|
|
1934
|
+
* Map SCSS tokens to CSS custom properties
|
|
1935
|
+
*
|
|
1936
|
+
* @example
|
|
1937
|
+
* const tokens = { '$primary-color': '#7AFFD7', '$spacing-md': '16px' }
|
|
1938
|
+
* const vars = mapSCSSTokensToCSSVars(tokens)
|
|
1939
|
+
* // Returns: { '--primary-color': '#7AFFD7', '--spacing-md': '16px' }
|
|
1940
|
+
*/
|
|
1941
|
+
declare function mapSCSSTokensToCSSVars(tokens: Record<string, any>, options?: CSSVariableNamingOptions): Record<string, string>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Apply CSS variables to an element
|
|
1944
|
+
*
|
|
1945
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
1946
|
+
* @param vars - CSS variables to apply
|
|
1947
|
+
*/
|
|
1948
|
+
declare function applyCSSVariables(vars: Record<string, string | number>, element?: HTMLElement): void;
|
|
1949
|
+
/**
|
|
1950
|
+
* Remove CSS variables from an element
|
|
1951
|
+
*
|
|
1952
|
+
* @param varNames - Variable names to remove
|
|
1953
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
1954
|
+
*/
|
|
1955
|
+
declare function removeCSSVariables(varNames: string[], element?: HTMLElement): void;
|
|
1956
|
+
/**
|
|
1957
|
+
* Get CSS variable value from an element
|
|
1958
|
+
*
|
|
1959
|
+
* @param varName - Variable name to get
|
|
1960
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
1961
|
+
* @returns Variable value or null if not found
|
|
1962
|
+
*/
|
|
1963
|
+
declare function getCSSVariable(varName: string, element?: HTMLElement): string | null;
|
|
1964
|
+
/**
|
|
1965
|
+
* Convert CSS variable object to inline style object
|
|
1966
|
+
*
|
|
1967
|
+
* @example
|
|
1968
|
+
* const vars = { '--atomix-button-bg': '#000' }
|
|
1969
|
+
* const style = cssVarsToStyle(vars)
|
|
1970
|
+
* // Returns: { '--atomix-button-bg': '#000' } as React.CSSProperties
|
|
1971
|
+
*/
|
|
1972
|
+
declare function cssVarsToStyle(vars: Record<string, string | number>): React.CSSProperties;
|
|
1973
|
+
/**
|
|
1974
|
+
* Merge multiple CSS variable objects
|
|
1975
|
+
* Later objects override earlier ones
|
|
1976
|
+
*/
|
|
1977
|
+
declare function mergeCSSVars(...varObjects: Array<Record<string, string | number> | undefined>): Record<string, string | number>;
|
|
1978
|
+
/**
|
|
1979
|
+
* Validate CSS variable name format
|
|
1980
|
+
*/
|
|
1981
|
+
declare function isValidCSSVariableName(name: string): boolean;
|
|
1982
|
+
/**
|
|
1983
|
+
* Extract component name from CSS variable name
|
|
1984
|
+
*
|
|
1985
|
+
* @example
|
|
1986
|
+
* extractComponentName('--atomix-button-bg')
|
|
1987
|
+
* // Returns: 'button'
|
|
1988
|
+
*/
|
|
1989
|
+
declare function extractComponentName(varName: string, prefix?: string): string | null;
|
|
1990
|
+
|
|
1991
|
+
export { RTLManager, ThemeApplicator, ThemeCLI, ThemeComparator, ThemeContext, ThemeErrorBoundary, ThemeInspector, ThemeLiveEditor, ThemeManager, ThemePreview, ThemeProvider, applyCSSVariables, applyTheme, createCLI, createDarkVariant, createTheme, createThemeFromConfig, cssVarsToStyle, exportTheme, extractComponentName, generateCSSVariableName, generateComponentCSSVars, getCSSVariable, getThemeApplicator, importTheme, isValidCSSVariableName, mapSCSSTokensToCSSVars, mergeCSSVars, quickTheme, removeCSSVariables, removeTheme, runCLI, themeToCSS, useTheme, validateTheme };
|
|
1992
|
+
export type { CLICommand, CSSVariableConfig, CSSVariableNamingOptions, ComponentThemeOverride, RTLConfig, Theme, ThemeChangeEvent, ThemeComparatorProps, ThemeComponentOverrides, ThemeContextValue, ThemeErrorBoundaryProps, ThemeInspectorProps, ThemeLiveEditorProps, ThemeLoadOptions, ThemeManagerConfig, ThemeMetadata, ThemePreviewProps, ThemeProviderProps, ThemeValidationResult, UseThemeReturn };
|