@shohojdhara/atomix 0.5.1 → 0.5.4
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/atomix.config.ts +45 -33
- package/build-tools/webpack-loader.js +5 -4
- package/dist/atomix.css +138 -17
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/webpack-loader.js +5 -4
- package/dist/charts.d.ts +23 -23
- package/dist/charts.js +40 -37
- package/dist/charts.js.map +1 -1
- package/dist/config.d.ts +699 -0
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -0
- package/dist/core.d.ts +2 -2
- package/dist/core.js +111 -50
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +3 -6
- package/dist/forms.js +2 -2
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +173 -111
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1881 -790
- package/dist/index.esm.js +2713 -816
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2693 -780
- 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.js +59 -60
- package/dist/layout.js.map +1 -1
- package/dist/theme.d.ts +1390 -276
- package/dist/theme.js +2133 -625
- package/dist/theme.js.map +1 -1
- package/package.json +14 -9
- package/scripts/atomix-cli.js +15 -1
- package/scripts/cli/__tests__/complexity-utils.test.js +24 -0
- package/scripts/cli/__tests__/detector.test.js +50 -0
- package/scripts/cli/__tests__/template-engine.test.js +23 -0
- package/scripts/cli/__tests__/test-setup.js +3 -0
- package/scripts/cli/commands/doctor.js +15 -3
- package/scripts/cli/commands/generate.js +113 -51
- package/scripts/cli/internal/ai-engine.js +30 -10
- package/scripts/cli/internal/complexity-utils.js +60 -0
- package/scripts/cli/internal/component-validator.js +49 -16
- package/scripts/cli/internal/config-loader.js +30 -20
- package/scripts/cli/internal/generator.js +89 -36
- package/scripts/cli/internal/hook-generator.js +5 -2
- package/scripts/cli/internal/itcss-generator.js +16 -12
- package/scripts/cli/templates/next-templates.js +81 -30
- package/scripts/cli/templates/storybook-templates.js +12 -2
- package/scripts/cli/utils/detector.js +45 -7
- package/scripts/cli/utils/diagnostics.js +78 -0
- package/scripts/cli/utils/telemetry.js +13 -0
- package/src/components/Accordion/Accordion.stories.tsx +4 -0
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +1 -1
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +219 -0
- package/src/components/AtomixGlass/glass-utils.ts +1 -1
- package/src/components/Button/Button.tsx +114 -57
- package/src/components/Callout/Callout.tsx +4 -4
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/DonutChart.tsx +11 -8
- package/src/components/EdgePanel/EdgePanel.tsx +119 -115
- package/src/components/Form/Select.tsx +4 -4
- package/src/components/List/List.tsx +4 -4
- package/src/components/Navigation/SideMenu/SideMenu.tsx +6 -6
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +1 -1
- package/src/components/ProductReview/ProductReview.tsx +4 -2
- package/src/components/Rating/Rating.tsx +4 -2
- package/src/components/SectionIntro/SectionIntro.tsx +4 -2
- package/src/components/Steps/Steps.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +5 -5
- package/src/components/Testimonial/Testimonial.tsx +4 -2
- package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
- package/src/layouts/CssGrid/CssGrid.stories.tsx +464 -0
- package/src/layouts/CssGrid/CssGrid.tsx +215 -0
- package/src/layouts/CssGrid/index.ts +8 -0
- package/src/layouts/CssGrid/scripts/CssGrid.js +284 -0
- package/src/layouts/CssGrid/scripts/index.js +43 -0
- package/src/layouts/Grid/scripts/Container.js +139 -0
- package/src/layouts/Grid/scripts/Grid.js +184 -0
- package/src/layouts/Grid/scripts/GridCol.js +273 -0
- package/src/layouts/Grid/scripts/Row.js +154 -0
- package/src/layouts/Grid/scripts/index.js +48 -0
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +71 -59
- package/src/lib/composables/atomix-glass/useGlassSize.ts +1 -1
- package/src/lib/composables/useAccordion.ts +5 -5
- package/src/lib/composables/useAtomixGlass.ts +3 -3
- package/src/lib/composables/useBarChart.ts +2 -2
- package/src/lib/composables/useChart.ts +3 -2
- package/src/lib/composables/useChartToolbar.ts +48 -66
- package/src/lib/composables/useDataTable.ts +1 -1
- package/src/lib/composables/useDatePicker.ts +2 -2
- package/src/lib/composables/useEdgePanel.ts +45 -54
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -5
- package/src/lib/composables/usePhotoViewer.ts +2 -3
- package/src/lib/composables/usePieChart.ts +1 -1
- package/src/lib/composables/usePopover.ts +151 -139
- package/src/lib/composables/useSideMenu.ts +28 -41
- package/src/lib/composables/useSlider.ts +2 -6
- package/src/lib/composables/useTooltip.ts +2 -2
- package/src/lib/config/index.ts +38 -323
- package/src/lib/config/loader.ts +419 -0
- package/src/lib/config/public-api.ts +43 -0
- package/src/lib/config/types.ts +389 -0
- package/src/lib/config/validator.ts +305 -0
- package/src/lib/theme/adapters/index.ts +1 -1
- package/src/lib/theme/adapters/themeAdapter.ts +358 -229
- package/src/lib/theme/components/ThemeToggle.tsx +276 -0
- package/src/lib/theme/config/configLoader.ts +351 -0
- package/src/lib/theme/config/loader.ts +221 -0
- package/src/lib/theme/core/createTheme.ts +126 -50
- package/src/lib/theme/core/createThemeObject.ts +7 -4
- package/src/lib/theme/devtools/Comparator.tsx +1 -1
- package/src/lib/theme/devtools/Inspector.tsx +1 -1
- package/src/lib/theme/devtools/LiveEditor.tsx +1 -1
- package/src/lib/theme/hooks/useThemeSwitcher.ts +164 -0
- package/src/lib/theme/index.ts +322 -38
- package/src/lib/theme/runtime/ThemeProvider.tsx +45 -11
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +44 -393
- package/src/lib/theme/runtime/useTheme.ts +1 -0
- package/src/lib/theme/tokens/tokens.ts +101 -1
- package/src/lib/theme/types.ts +91 -0
- package/src/lib/theme/utils/performanceMonitor.ts +315 -0
- package/src/lib/theme/utils/responsive.ts +280 -0
- package/src/lib/theme/utils/themeUtils.ts +531 -117
- package/src/styles/01-settings/_index.scss +1 -0
- package/src/styles/01-settings/_settings.atomix-glass.scss +174 -0
- package/src/styles/01-settings/_settings.masonry-grid.scss +42 -6
- package/src/styles/02-tools/_tools.glass.scss +6 -0
- package/src/styles/05-objects/_objects.masonry-grid.scss +162 -24
- package/src/styles/06-components/_components.atomix-glass.scss +4 -4
- package/src/lib/composables/useBreadcrumb.ts +0 -81
- package/src/lib/composables/useChartInteractions.ts +0 -123
- package/src/lib/composables/useChartPerformance.ts +0 -347
- package/src/lib/composables/useDropdown.ts +0 -338
- package/src/lib/composables/useModal.ts +0 -110
- package/src/lib/hooks/usePerformanceMonitor.ts +0 -148
- package/src/lib/utils/displacement-generator.ts +0 -92
- package/src/lib/utils/memoryMonitor.ts +0 -191
- package/src/styles/01-settings/_settings.testtypecheck.scss +0 -53
- package/src/styles/01-settings/_settings.typedbutton.scss +0 -53
- package/src/styles/06-components/_components.testbutton.scss +0 -212
- package/src/styles/06-components/_components.testtypecheck.scss +0 -212
- package/src/styles/06-components/_components.typedbutton.scss +0 -212
package/dist/theme.d.ts
CHANGED
|
@@ -270,6 +270,47 @@ interface DesignTokens {
|
|
|
270
270
|
'breakpoint-lg': string;
|
|
271
271
|
'breakpoint-xl': string;
|
|
272
272
|
'breakpoint-xxl': string;
|
|
273
|
+
'interactive-vortex-enabled': string;
|
|
274
|
+
'interactive-vortex-strength': string;
|
|
275
|
+
'interactive-vortex-radius': string;
|
|
276
|
+
'interactive-vortex-decay': string;
|
|
277
|
+
'interactive-chromatic-enabled': string;
|
|
278
|
+
'interactive-chromatic-mode': string;
|
|
279
|
+
'interactive-chromatic-red-shift': string;
|
|
280
|
+
'interactive-chromatic-green-shift': string;
|
|
281
|
+
'interactive-chromatic-blue-shift': string;
|
|
282
|
+
'interactive-chromatic-edge-only': string;
|
|
283
|
+
'interactive-chromatic-edge-threshold': string;
|
|
284
|
+
'interactive-mouse-sensitivity': string;
|
|
285
|
+
'interactive-mouse-trail-effect': string;
|
|
286
|
+
'interactive-animation-speed-base': string;
|
|
287
|
+
'interactive-animation-speed-multiplier': string;
|
|
288
|
+
'optimization-breakpoint-mobile': string;
|
|
289
|
+
'optimization-breakpoint-tablet': string;
|
|
290
|
+
'optimization-breakpoint-desktop': string;
|
|
291
|
+
'optimization-breakpoint-wide': string;
|
|
292
|
+
'optimization-device-scaling-mobile': string;
|
|
293
|
+
'optimization-device-scaling-tablet': string;
|
|
294
|
+
'optimization-device-scaling-desktop': string;
|
|
295
|
+
'optimization-performance-fps-target': string;
|
|
296
|
+
'optimization-auto-scaling-enabled': string;
|
|
297
|
+
'optimization-auto-scaling-low-end': string;
|
|
298
|
+
'optimization-auto-scaling-mid-range': string;
|
|
299
|
+
'optimization-auto-scaling-high-end': string;
|
|
300
|
+
'visual-polish-border-iridescent-glow': string;
|
|
301
|
+
'visual-polish-border-shimmer-effect': string;
|
|
302
|
+
'visual-polish-border-beveled-edges': string;
|
|
303
|
+
'visual-polish-border-pulsing-glow': string;
|
|
304
|
+
'visual-polish-content-aware-blur-enabled': string;
|
|
305
|
+
'visual-polish-content-aware-depth-detection': string;
|
|
306
|
+
'visual-polish-content-aware-edge-preservation': string;
|
|
307
|
+
'visual-polish-content-aware-variable-radius': string;
|
|
308
|
+
'visual-polish-holographic-enabled': string;
|
|
309
|
+
'visual-polish-holographic-rainbow-diffraction': string;
|
|
310
|
+
'visual-polish-holographic-scanline-animation': string;
|
|
311
|
+
'visual-polish-holographic-grid-overlay': string;
|
|
312
|
+
'visual-polish-holographic-data-stream': string;
|
|
313
|
+
'visual-polish-holographic-pulse-rings': string;
|
|
273
314
|
[key: string]: string | undefined;
|
|
274
315
|
}
|
|
275
316
|
/**
|
|
@@ -294,203 +335,6 @@ declare const defaultTokens: DesignTokens;
|
|
|
294
335
|
*/
|
|
295
336
|
declare function createTokens(overrides?: Partial<DesignTokens>): DesignTokens;
|
|
296
337
|
|
|
297
|
-
/**
|
|
298
|
-
* CSS Variable Generator
|
|
299
|
-
*
|
|
300
|
-
* Generates CSS custom properties from design tokens.
|
|
301
|
-
*/
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Options for CSS variable generation
|
|
305
|
-
*/
|
|
306
|
-
interface GenerateCSSVariablesOptions {
|
|
307
|
-
/** CSS selector for the variables (default: ':root') */
|
|
308
|
-
selector?: string;
|
|
309
|
-
/** Prefix for CSS variables (default: 'atomix') */
|
|
310
|
-
prefix?: string;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Generate CSS variables from tokens
|
|
314
|
-
*
|
|
315
|
-
* Converts flat token object to CSS custom properties.
|
|
316
|
-
*
|
|
317
|
-
* @param tokens - Design tokens object
|
|
318
|
-
* @param options - Generation options
|
|
319
|
-
* @returns CSS string with custom properties
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* ```typescript
|
|
323
|
-
* const tokens = {
|
|
324
|
-
* 'primary': '#7c3aed',
|
|
325
|
-
* 'spacing-4': '1rem',
|
|
326
|
-
* };
|
|
327
|
-
*
|
|
328
|
-
* const css = generateCSSVariables(tokens);
|
|
329
|
-
* // Returns: ":root {\n --atomix-primary: #7c3aed;\n --atomix-spacing-4: 1rem;\n}"
|
|
330
|
-
* ```
|
|
331
|
-
*/
|
|
332
|
-
declare function generateCSSVariables(tokens: DesignTokens, options?: GenerateCSSVariablesOptions): string;
|
|
333
|
-
/**
|
|
334
|
-
* Generate CSS variables with custom selector
|
|
335
|
-
*
|
|
336
|
-
* Useful for theme-specific selectors like `[data-theme="dark"]`
|
|
337
|
-
*
|
|
338
|
-
* @param tokens - Design tokens object
|
|
339
|
-
* @param selector - CSS selector (e.g., '[data-theme="dark"]')
|
|
340
|
-
* @param prefix - CSS variable prefix
|
|
341
|
-
* @returns CSS string
|
|
342
|
-
*
|
|
343
|
-
* @example
|
|
344
|
-
* ```typescript
|
|
345
|
-
* const css = generateCSSVariablesForSelector(
|
|
346
|
-
* tokens,
|
|
347
|
-
* '[data-theme="dark"]',
|
|
348
|
-
* 'atomix'
|
|
349
|
-
* );
|
|
350
|
-
* ```
|
|
351
|
-
*/
|
|
352
|
-
declare function generateCSSVariablesForSelector(tokens: DesignTokens, selector: string, prefix?: string): string;
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Core Theme Functions
|
|
356
|
-
*
|
|
357
|
-
* Simplified theme system using DesignTokens only.
|
|
358
|
-
* Config-first approach: loads from atomix.config.ts when no input is provided.
|
|
359
|
-
*/
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Create theme CSS from DesignTokens
|
|
363
|
-
*
|
|
364
|
-
* **Config-First Approach**: If no input is provided, loads from `atomix.config.ts`.
|
|
365
|
-
*
|
|
366
|
-
* @param input - DesignTokens (partial) or undefined (loads from config)
|
|
367
|
-
* @param options - CSS generation options (prefix is automatically read from config if not provided)
|
|
368
|
-
* @returns CSS string with custom properties
|
|
369
|
-
* @throws Error if config loading fails when no input is provided
|
|
370
|
-
*
|
|
371
|
-
* @example
|
|
372
|
-
* ```typescript
|
|
373
|
-
* // Loads from atomix.config.ts
|
|
374
|
-
* const css = createTheme();
|
|
375
|
-
*
|
|
376
|
-
* // Using DesignTokens
|
|
377
|
-
* const css = createTheme({
|
|
378
|
-
* 'primary': '#7c3aed',
|
|
379
|
-
* 'spacing-4': '1rem',
|
|
380
|
-
* });
|
|
381
|
-
*
|
|
382
|
-
* // With custom options
|
|
383
|
-
* const css = createTheme(undefined, { prefix: 'myapp', selector: ':root' });
|
|
384
|
-
* ```
|
|
385
|
-
*/
|
|
386
|
-
declare function createTheme(input?: Partial<DesignTokens>, options?: GenerateCSSVariablesOptions): string;
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Theme Composition Utilities
|
|
390
|
-
*
|
|
391
|
-
* Simplified utilities for composing and merging DesignTokens.
|
|
392
|
-
*/
|
|
393
|
-
/**
|
|
394
|
-
* Deep merge multiple objects
|
|
395
|
-
* Later objects override earlier ones
|
|
396
|
-
*/
|
|
397
|
-
declare function deepMerge<T extends Record<string, unknown>>(...objects: Partial<T>[]): T;
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Merge multiple DesignTokens objects into a single DesignTokens object
|
|
401
|
-
*
|
|
402
|
-
* @param tokens - DesignTokens objects to merge
|
|
403
|
-
* @returns Merged DesignTokens object
|
|
404
|
-
*
|
|
405
|
-
* @example
|
|
406
|
-
* ```typescript
|
|
407
|
-
* const baseTokens = { 'primary': '#000', 'spacing-4': '1rem' };
|
|
408
|
-
* const customTokens = { 'secondary': '#fff', 'spacing-4': '1.5rem' };
|
|
409
|
-
* const merged = mergeTheme(baseTokens, customTokens);
|
|
410
|
-
* // Returns: { 'primary': '#000', 'secondary': '#fff', 'spacing-4': '1.5rem' }
|
|
411
|
-
* ```
|
|
412
|
-
*/
|
|
413
|
-
declare function mergeTheme(...tokens: Partial<DesignTokens>[]): Partial<DesignTokens>;
|
|
414
|
-
/**
|
|
415
|
-
* Extend DesignTokens with additional tokens
|
|
416
|
-
*
|
|
417
|
-
* @param baseTokens - Base DesignTokens to extend
|
|
418
|
-
* @param extension - Additional DesignTokens to merge
|
|
419
|
-
* @returns Extended DesignTokens object
|
|
420
|
-
*
|
|
421
|
-
* @example
|
|
422
|
-
* ```typescript
|
|
423
|
-
* const base = { 'primary': '#000' };
|
|
424
|
-
* const extended = extendTheme(base, { 'secondary': '#fff' });
|
|
425
|
-
* // Returns: { 'primary': '#000', 'secondary': '#fff' }
|
|
426
|
-
* ```
|
|
427
|
-
*/
|
|
428
|
-
declare function extendTheme(baseTokens: Partial<DesignTokens>, extension: Partial<DesignTokens>): Partial<DesignTokens>;
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Theme Metadata interface
|
|
432
|
-
*/
|
|
433
|
-
interface ThemeMetadata$1 {
|
|
434
|
-
name: string;
|
|
435
|
-
class: string;
|
|
436
|
-
description?: string;
|
|
437
|
-
version?: string;
|
|
438
|
-
[key: string]: any;
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Theme Registry type - a record of theme IDs to metadata
|
|
442
|
-
*/
|
|
443
|
-
type ThemeRegistry = Record<string, ThemeMetadata$1>;
|
|
444
|
-
/**
|
|
445
|
-
* Create a new theme registry
|
|
446
|
-
*/
|
|
447
|
-
declare function createThemeRegistry(): ThemeRegistry;
|
|
448
|
-
/**
|
|
449
|
-
* Register a theme
|
|
450
|
-
* @param registry - Theme registry object
|
|
451
|
-
* @param id - Theme identifier
|
|
452
|
-
* @param metadata - Theme metadata
|
|
453
|
-
*/
|
|
454
|
-
declare function registerTheme(registry: ThemeRegistry, id: string, metadata: ThemeMetadata$1): void;
|
|
455
|
-
/**
|
|
456
|
-
* Unregister a theme
|
|
457
|
-
* @param registry - Theme registry object
|
|
458
|
-
* @param id - Theme identifier
|
|
459
|
-
*/
|
|
460
|
-
declare function unregisterTheme(registry: ThemeRegistry, id: string): boolean;
|
|
461
|
-
/**
|
|
462
|
-
* Check if a theme is registered
|
|
463
|
-
* @param registry - Theme registry object
|
|
464
|
-
* @param id - Theme identifier
|
|
465
|
-
*/
|
|
466
|
-
declare function hasTheme(registry: ThemeRegistry, id: string): boolean;
|
|
467
|
-
/**
|
|
468
|
-
* Get theme metadata
|
|
469
|
-
* @param registry - Theme registry object
|
|
470
|
-
* @param id - Theme identifier
|
|
471
|
-
*/
|
|
472
|
-
declare function getTheme(registry: ThemeRegistry, id: string): ThemeMetadata$1 | undefined;
|
|
473
|
-
/**
|
|
474
|
-
* Get all registered theme metadata
|
|
475
|
-
* @param registry - Theme registry object
|
|
476
|
-
*/
|
|
477
|
-
declare function getAllThemes(registry: ThemeRegistry): ThemeMetadata$1[];
|
|
478
|
-
/**
|
|
479
|
-
* Get all registered theme IDs
|
|
480
|
-
* @param registry - Theme registry object
|
|
481
|
-
*/
|
|
482
|
-
declare function getThemeIds(registry: ThemeRegistry): string[];
|
|
483
|
-
/**
|
|
484
|
-
* Clear all registered themes
|
|
485
|
-
* @param registry - Theme registry object
|
|
486
|
-
*/
|
|
487
|
-
declare function clearThemes(registry: ThemeRegistry): void;
|
|
488
|
-
/**
|
|
489
|
-
* Get the number of registered themes
|
|
490
|
-
* @param registry - Theme registry object
|
|
491
|
-
*/
|
|
492
|
-
declare function getThemeCount(registry: ThemeRegistry): number;
|
|
493
|
-
|
|
494
338
|
/**
|
|
495
339
|
* Theme Manager Type Definitions
|
|
496
340
|
*
|
|
@@ -499,7 +343,7 @@ declare function getThemeCount(registry: ThemeRegistry): number;
|
|
|
499
343
|
/**
|
|
500
344
|
* Theme metadata interface matching themes.config.js structure
|
|
501
345
|
*/
|
|
502
|
-
interface ThemeMetadata {
|
|
346
|
+
interface ThemeMetadata$1 {
|
|
503
347
|
/** Display name of the theme */
|
|
504
348
|
name: string;
|
|
505
349
|
/** Unique identifier/class name for the theme */
|
|
@@ -581,8 +425,10 @@ interface UseThemeReturn {
|
|
|
581
425
|
activeTokens: DesignTokens | null;
|
|
582
426
|
/** Function to change theme (supports string or DesignTokens) */
|
|
583
427
|
setTheme: (theme: string | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
|
|
428
|
+
/** Update a specific theme section */
|
|
429
|
+
updateTheme: (section: ThemeSection, values: any) => Promise<void>;
|
|
584
430
|
/** Available themes */
|
|
585
|
-
availableThemes: ThemeMetadata[];
|
|
431
|
+
availableThemes: ThemeMetadata$1[];
|
|
586
432
|
/** Whether a theme is currently loading */
|
|
587
433
|
isLoading: boolean;
|
|
588
434
|
/** Current error, if any */
|
|
@@ -651,7 +497,7 @@ interface ThemeProviderProps {
|
|
|
651
497
|
/** Default theme (string name or DesignTokens) */
|
|
652
498
|
defaultTheme?: string | DesignTokens | Partial<DesignTokens>;
|
|
653
499
|
/** Available themes */
|
|
654
|
-
themes?: Record<string, ThemeMetadata>;
|
|
500
|
+
themes?: Record<string, ThemeMetadata$1>;
|
|
655
501
|
/** Base path for theme CSS */
|
|
656
502
|
basePath?: string;
|
|
657
503
|
/** CDN path for theme CSS */
|
|
@@ -673,6 +519,10 @@ interface ThemeProviderProps {
|
|
|
673
519
|
/** Callback on error */
|
|
674
520
|
onError?: (error: Error, themeName: string) => void;
|
|
675
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* Theme section name
|
|
524
|
+
*/
|
|
525
|
+
type ThemeSection = keyof DesignTokens;
|
|
676
526
|
/**
|
|
677
527
|
* Theme context value
|
|
678
528
|
*/
|
|
@@ -683,8 +533,10 @@ interface ThemeContextValue {
|
|
|
683
533
|
activeTokens: DesignTokens | null;
|
|
684
534
|
/** Set theme function (supports string or DesignTokens) */
|
|
685
535
|
setTheme: (theme: string | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
|
|
536
|
+
/** Update a specific theme section */
|
|
537
|
+
updateTheme: (section: ThemeSection, values: any) => Promise<void>;
|
|
686
538
|
/** Available themes */
|
|
687
|
-
availableThemes: ThemeMetadata[];
|
|
539
|
+
availableThemes: ThemeMetadata$1[];
|
|
688
540
|
/** Loading state */
|
|
689
541
|
isLoading: boolean;
|
|
690
542
|
/** Error state */
|
|
@@ -776,6 +628,10 @@ interface TypographyOptions {
|
|
|
776
628
|
* Spacing function type
|
|
777
629
|
*/
|
|
778
630
|
type SpacingFunction = (...values: number[]) => string;
|
|
631
|
+
/**
|
|
632
|
+
* Spacing configuration options for createTheme
|
|
633
|
+
*/
|
|
634
|
+
type SpacingOptions = number | number[] | SpacingFunction;
|
|
779
635
|
/**
|
|
780
636
|
* Breakpoint values configuration
|
|
781
637
|
*/
|
|
@@ -862,13 +718,87 @@ interface BorderRadiusOptions {
|
|
|
862
718
|
* Users can augment this interface via module augmentation
|
|
863
719
|
*/
|
|
864
720
|
interface ThemeCustomProperties {
|
|
721
|
+
interactiveEffects?: {
|
|
722
|
+
vortex?: {
|
|
723
|
+
enabled?: boolean;
|
|
724
|
+
strength?: number;
|
|
725
|
+
radius?: number;
|
|
726
|
+
decay?: number;
|
|
727
|
+
};
|
|
728
|
+
chromaticAberration?: {
|
|
729
|
+
enabled?: boolean;
|
|
730
|
+
mode?: 'longitudinal' | 'lateral' | 'hybrid';
|
|
731
|
+
redShift?: number;
|
|
732
|
+
greenShift?: number;
|
|
733
|
+
blueShift?: number;
|
|
734
|
+
edgeOnly?: boolean;
|
|
735
|
+
edgeThreshold?: number;
|
|
736
|
+
};
|
|
737
|
+
mouseInteraction?: {
|
|
738
|
+
sensitivity?: number;
|
|
739
|
+
trailEffect?: boolean;
|
|
740
|
+
};
|
|
741
|
+
animationSpeed?: {
|
|
742
|
+
base?: number;
|
|
743
|
+
timeMultiplier?: number;
|
|
744
|
+
};
|
|
745
|
+
};
|
|
746
|
+
optimization?: {
|
|
747
|
+
responsive?: {
|
|
748
|
+
breakpoints?: {
|
|
749
|
+
mobile?: string;
|
|
750
|
+
tablet?: string;
|
|
751
|
+
desktop?: string;
|
|
752
|
+
wide?: string;
|
|
753
|
+
};
|
|
754
|
+
deviceScaling?: {
|
|
755
|
+
mobile?: number;
|
|
756
|
+
tablet?: number;
|
|
757
|
+
desktop?: number;
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
performance?: {
|
|
761
|
+
fpsTarget?: number;
|
|
762
|
+
autoScaling?: boolean;
|
|
763
|
+
};
|
|
764
|
+
autoScaling?: {
|
|
765
|
+
enabled?: boolean;
|
|
766
|
+
qualityThresholds?: {
|
|
767
|
+
lowEnd?: number;
|
|
768
|
+
midRange?: number;
|
|
769
|
+
highEnd?: number;
|
|
770
|
+
};
|
|
771
|
+
};
|
|
772
|
+
};
|
|
773
|
+
visualPolish?: {
|
|
774
|
+
borders?: {
|
|
775
|
+
iridescentGlow?: boolean;
|
|
776
|
+
shimmerEffect?: boolean;
|
|
777
|
+
beveledEdges?: boolean;
|
|
778
|
+
pulsingGlow?: boolean;
|
|
779
|
+
};
|
|
780
|
+
contentAwareBlur?: {
|
|
781
|
+
enabled?: boolean;
|
|
782
|
+
depthDetection?: boolean;
|
|
783
|
+
edgePreservation?: boolean;
|
|
784
|
+
variableRadius?: boolean;
|
|
785
|
+
};
|
|
786
|
+
holographicEffects?: {
|
|
787
|
+
enabled?: boolean;
|
|
788
|
+
rainbowDiffraction?: boolean;
|
|
789
|
+
scanlineAnimation?: boolean;
|
|
790
|
+
gridOverlay?: boolean;
|
|
791
|
+
dataStream?: boolean;
|
|
792
|
+
pulseRings?: boolean;
|
|
793
|
+
};
|
|
794
|
+
};
|
|
865
795
|
[key: string]: any;
|
|
866
796
|
}
|
|
867
797
|
/**
|
|
868
798
|
* Complete theme object with computed values
|
|
869
799
|
* Generated by createTheme function
|
|
870
800
|
*/
|
|
871
|
-
interface Theme extends ThemeMetadata {
|
|
801
|
+
interface Theme extends ThemeMetadata$1 {
|
|
872
802
|
/** Color palette with computed values */
|
|
873
803
|
palette: {
|
|
874
804
|
primary: PaletteColor;
|
|
@@ -935,67 +865,207 @@ interface Theme extends ThemeMetadata {
|
|
|
935
865
|
}
|
|
936
866
|
|
|
937
867
|
/**
|
|
938
|
-
*
|
|
868
|
+
* CSS Variable Generator
|
|
939
869
|
*
|
|
940
|
-
*
|
|
941
|
-
*/
|
|
942
|
-
interface NamingOptions {
|
|
943
|
-
prefix?: string;
|
|
944
|
-
component?: string;
|
|
945
|
-
variant?: string;
|
|
946
|
-
state?: string;
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* Generate consistent CSS class names following BEM methodology
|
|
950
|
-
*/
|
|
951
|
-
declare function generateClassName(block: string, element?: string, modifiers?: Record<string, boolean | string>): string;
|
|
952
|
-
/**
|
|
953
|
-
* Generate consistent CSS variable names
|
|
954
|
-
*/
|
|
955
|
-
declare function generateCSSVariableName(property: string, options?: NamingOptions): string;
|
|
956
|
-
/**
|
|
957
|
-
* Normalize theme tokens to consistent naming convention
|
|
958
|
-
*/
|
|
959
|
-
declare function normalizeThemeTokens(tokens: Record<string, any>): Record<string, any>;
|
|
960
|
-
/**
|
|
961
|
-
* Convert camelCase to kebab-case for CSS custom properties
|
|
962
|
-
*/
|
|
963
|
-
declare function camelToKebab(str: string): string;
|
|
964
|
-
/**
|
|
965
|
-
* Convert theme property to CSS variable name
|
|
870
|
+
* Generates CSS custom properties from design tokens.
|
|
966
871
|
*/
|
|
967
|
-
declare function themePropertyToCSSVar(propertyPath: string, prefix?: string): string;
|
|
968
872
|
|
|
969
873
|
/**
|
|
970
|
-
*
|
|
971
|
-
*
|
|
972
|
-
* Provides consistent patterns for applying theme values to components
|
|
973
|
-
* using DesignTokens and CSS variables
|
|
874
|
+
* Options for CSS variable generation
|
|
974
875
|
*/
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
tokens?: Partial<DesignTokens>;
|
|
876
|
+
interface GenerateCSSVariablesOptions {
|
|
877
|
+
/** CSS selector for the variables (default: ':root') */
|
|
878
|
+
selector?: string;
|
|
879
|
+
/** Prefix for CSS variables (default: 'atomix') */
|
|
880
|
+
prefix?: string;
|
|
981
881
|
}
|
|
982
882
|
/**
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
|
|
986
|
-
|
|
883
|
+
* Generate CSS variables from tokens
|
|
884
|
+
*
|
|
885
|
+
* Converts flat token object to CSS custom properties.
|
|
886
|
+
*
|
|
887
|
+
* @param tokens - Design tokens object
|
|
888
|
+
* @param options - Generation options
|
|
889
|
+
* @returns CSS string with custom properties
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```typescript
|
|
893
|
+
* const tokens = {
|
|
894
|
+
* 'primary': '#7c3aed',
|
|
895
|
+
* 'spacing-4': '1rem',
|
|
896
|
+
* };
|
|
897
|
+
*
|
|
898
|
+
* const css = generateCSSVariables(tokens);
|
|
899
|
+
* // Returns: ":root {\n --atomix-primary: #7c3aed;\n --atomix-spacing-4: 1rem;\n}"
|
|
900
|
+
* ```
|
|
901
|
+
*/
|
|
902
|
+
declare function generateCSSVariables(tokens: DesignTokens, options?: GenerateCSSVariablesOptions): string;
|
|
987
903
|
/**
|
|
988
|
-
* Generate
|
|
904
|
+
* Generate CSS variables with custom selector
|
|
905
|
+
*
|
|
906
|
+
* Useful for theme-specific selectors like `[data-theme="dark"]`
|
|
907
|
+
*
|
|
908
|
+
* @param tokens - Design tokens object
|
|
909
|
+
* @param selector - CSS selector (e.g., '[data-theme="dark"]')
|
|
910
|
+
* @param prefix - CSS variable prefix
|
|
911
|
+
* @returns CSS string
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* ```typescript
|
|
915
|
+
* const css = generateCSSVariablesForSelector(
|
|
916
|
+
* tokens,
|
|
917
|
+
* '[data-theme="dark"]',
|
|
918
|
+
* 'atomix'
|
|
919
|
+
* );
|
|
920
|
+
* ```
|
|
989
921
|
*/
|
|
990
|
-
declare function
|
|
922
|
+
declare function generateCSSVariablesForSelector(tokens: DesignTokens, selector: string, prefix?: string): string;
|
|
923
|
+
|
|
991
924
|
/**
|
|
992
|
-
*
|
|
925
|
+
* Core Theme Functions
|
|
926
|
+
*
|
|
927
|
+
* Unified theme system that handles both DesignTokens and Theme objects.
|
|
928
|
+
* Config-first approach: loads from atomix.config.ts when no input is provided.
|
|
929
|
+
* Config-first approach: loads advanced features from config when available.
|
|
993
930
|
*/
|
|
994
|
-
|
|
931
|
+
|
|
995
932
|
/**
|
|
996
|
-
* Create
|
|
933
|
+
* Create theme CSS from tokens or Theme object
|
|
934
|
+
*
|
|
935
|
+
* **Config-First Approach**: If no input is provided, loads from `atomix.config.ts`.
|
|
936
|
+
* Config file is required for automatic loading.
|
|
937
|
+
*
|
|
938
|
+
* @param input - DesignTokens (partial), Theme object, or undefined (loads from config)
|
|
939
|
+
* @param options - CSS generation options (prefix is automatically read from config if not provided)
|
|
940
|
+
* @returns CSS string with custom properties
|
|
941
|
+
* @throws Error if config loading fails when no input is provided
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```typescript
|
|
945
|
+
* // Loads from atomix.config.ts (config file required)
|
|
946
|
+
* const css = createTheme();
|
|
947
|
+
*
|
|
948
|
+
* // Using DesignTokens
|
|
949
|
+
* const css = createTheme({
|
|
950
|
+
* 'primary': '#7c3aed',
|
|
951
|
+
* 'spacing-4': '1rem',
|
|
952
|
+
* });
|
|
953
|
+
*
|
|
954
|
+
* // Using Theme object
|
|
955
|
+
* const theme = createThemeObject({ palette: { primary: { main: '#7c3aed' } } });
|
|
956
|
+
* const css = createTheme(theme);
|
|
957
|
+
*
|
|
958
|
+
* // With custom options
|
|
959
|
+
* const css = createTheme(undefined, { prefix: 'myapp', selector: ':root' });
|
|
960
|
+
* ```
|
|
997
961
|
*/
|
|
998
|
-
declare function
|
|
962
|
+
declare function createTheme(input?: Partial<DesignTokens> | Theme, options?: GenerateCSSVariablesOptions): string;
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Theme Composition Utilities
|
|
966
|
+
*
|
|
967
|
+
* Simplified utilities for composing and merging DesignTokens.
|
|
968
|
+
*/
|
|
969
|
+
/**
|
|
970
|
+
* Deep merge multiple objects
|
|
971
|
+
* Later objects override earlier ones
|
|
972
|
+
*/
|
|
973
|
+
declare function deepMerge<T extends Record<string, unknown>>(...objects: Partial<T>[]): T;
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* Merge multiple DesignTokens objects into a single DesignTokens object
|
|
977
|
+
*
|
|
978
|
+
* @param tokens - DesignTokens objects to merge
|
|
979
|
+
* @returns Merged DesignTokens object
|
|
980
|
+
*
|
|
981
|
+
* @example
|
|
982
|
+
* ```typescript
|
|
983
|
+
* const baseTokens = { 'primary': '#000', 'spacing-4': '1rem' };
|
|
984
|
+
* const customTokens = { 'secondary': '#fff', 'spacing-4': '1.5rem' };
|
|
985
|
+
* const merged = mergeTheme(baseTokens, customTokens);
|
|
986
|
+
* // Returns: { 'primary': '#000', 'secondary': '#fff', 'spacing-4': '1.5rem' }
|
|
987
|
+
* ```
|
|
988
|
+
*/
|
|
989
|
+
declare function mergeTheme(...tokens: Partial<DesignTokens>[]): Partial<DesignTokens>;
|
|
990
|
+
/**
|
|
991
|
+
* Extend DesignTokens with additional tokens
|
|
992
|
+
*
|
|
993
|
+
* @param baseTokens - Base DesignTokens to extend
|
|
994
|
+
* @param extension - Additional DesignTokens to merge
|
|
995
|
+
* @returns Extended DesignTokens object
|
|
996
|
+
*
|
|
997
|
+
* @example
|
|
998
|
+
* ```typescript
|
|
999
|
+
* const base = { 'primary': '#000' };
|
|
1000
|
+
* const extended = extendTheme(base, { 'secondary': '#fff' });
|
|
1001
|
+
* // Returns: { 'primary': '#000', 'secondary': '#fff' }
|
|
1002
|
+
* ```
|
|
1003
|
+
*/
|
|
1004
|
+
declare function extendTheme(baseTokens: Partial<DesignTokens>, extension: Partial<DesignTokens>): Partial<DesignTokens>;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Theme Metadata interface
|
|
1008
|
+
*/
|
|
1009
|
+
interface ThemeMetadata {
|
|
1010
|
+
name: string;
|
|
1011
|
+
class: string;
|
|
1012
|
+
description?: string;
|
|
1013
|
+
version?: string;
|
|
1014
|
+
[key: string]: any;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Theme Registry type - a record of theme IDs to metadata
|
|
1018
|
+
*/
|
|
1019
|
+
type ThemeRegistry = Record<string, ThemeMetadata>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Create a new theme registry
|
|
1022
|
+
*/
|
|
1023
|
+
declare function createThemeRegistry(): ThemeRegistry;
|
|
1024
|
+
/**
|
|
1025
|
+
* Register a theme
|
|
1026
|
+
* @param registry - Theme registry object
|
|
1027
|
+
* @param id - Theme identifier
|
|
1028
|
+
* @param metadata - Theme metadata
|
|
1029
|
+
*/
|
|
1030
|
+
declare function registerTheme(registry: ThemeRegistry, id: string, metadata: ThemeMetadata): void;
|
|
1031
|
+
/**
|
|
1032
|
+
* Unregister a theme
|
|
1033
|
+
* @param registry - Theme registry object
|
|
1034
|
+
* @param id - Theme identifier
|
|
1035
|
+
*/
|
|
1036
|
+
declare function unregisterTheme(registry: ThemeRegistry, id: string): boolean;
|
|
1037
|
+
/**
|
|
1038
|
+
* Check if a theme is registered
|
|
1039
|
+
* @param registry - Theme registry object
|
|
1040
|
+
* @param id - Theme identifier
|
|
1041
|
+
*/
|
|
1042
|
+
declare function hasTheme(registry: ThemeRegistry, id: string): boolean;
|
|
1043
|
+
/**
|
|
1044
|
+
* Get theme metadata
|
|
1045
|
+
* @param registry - Theme registry object
|
|
1046
|
+
* @param id - Theme identifier
|
|
1047
|
+
*/
|
|
1048
|
+
declare function getTheme(registry: ThemeRegistry, id: string): ThemeMetadata | undefined;
|
|
1049
|
+
/**
|
|
1050
|
+
* Get all registered theme metadata
|
|
1051
|
+
* @param registry - Theme registry object
|
|
1052
|
+
*/
|
|
1053
|
+
declare function getAllThemes(registry: ThemeRegistry): ThemeMetadata[];
|
|
1054
|
+
/**
|
|
1055
|
+
* Get all registered theme IDs
|
|
1056
|
+
* @param registry - Theme registry object
|
|
1057
|
+
*/
|
|
1058
|
+
declare function getThemeIds(registry: ThemeRegistry): string[];
|
|
1059
|
+
/**
|
|
1060
|
+
* Clear all registered themes
|
|
1061
|
+
* @param registry - Theme registry object
|
|
1062
|
+
*/
|
|
1063
|
+
declare function clearThemes(registry: ThemeRegistry): void;
|
|
1064
|
+
/**
|
|
1065
|
+
* Get the number of registered themes
|
|
1066
|
+
* @param registry - Theme registry object
|
|
1067
|
+
*/
|
|
1068
|
+
declare function getThemeCount(registry: ThemeRegistry): number;
|
|
999
1069
|
|
|
1000
1070
|
/**
|
|
1001
1071
|
* CSS Injection Utilities
|
|
@@ -1043,6 +1113,353 @@ declare function removeCSS(id?: string): void;
|
|
|
1043
1113
|
*/
|
|
1044
1114
|
declare function isCSSInjected(id?: string): boolean;
|
|
1045
1115
|
|
|
1116
|
+
/**
|
|
1117
|
+
* Naming Utilities
|
|
1118
|
+
*
|
|
1119
|
+
* Provides consistent naming conventions across the theme system
|
|
1120
|
+
*/
|
|
1121
|
+
interface NamingOptions {
|
|
1122
|
+
prefix?: string;
|
|
1123
|
+
component?: string;
|
|
1124
|
+
variant?: string;
|
|
1125
|
+
state?: string;
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Generate consistent CSS class names following BEM methodology
|
|
1129
|
+
*/
|
|
1130
|
+
declare function generateClassName(block: string, element?: string, modifiers?: Record<string, boolean | string>): string;
|
|
1131
|
+
/**
|
|
1132
|
+
* Generate consistent CSS variable names
|
|
1133
|
+
*/
|
|
1134
|
+
declare function generateCSSVariableName(property: string, options?: NamingOptions): string;
|
|
1135
|
+
/**
|
|
1136
|
+
* Normalize theme tokens to consistent naming convention
|
|
1137
|
+
*/
|
|
1138
|
+
declare function normalizeThemeTokens(tokens: Record<string, any>): Record<string, any>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Convert camelCase to kebab-case for CSS custom properties
|
|
1141
|
+
*/
|
|
1142
|
+
declare function camelToKebab(str: string): string;
|
|
1143
|
+
/**
|
|
1144
|
+
* Convert theme property to CSS variable name
|
|
1145
|
+
*/
|
|
1146
|
+
declare function themePropertyToCSSVar(propertyPath: string, prefix?: string): string;
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Component Theming Utilities
|
|
1150
|
+
*
|
|
1151
|
+
* Provides consistent patterns for applying theme values to components
|
|
1152
|
+
* using DesignTokens and CSS variables
|
|
1153
|
+
*/
|
|
1154
|
+
|
|
1155
|
+
interface ComponentThemeOptions {
|
|
1156
|
+
component: string;
|
|
1157
|
+
variant?: string;
|
|
1158
|
+
size?: string;
|
|
1159
|
+
tokens?: Partial<DesignTokens>;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Get a theme value for a specific component using CSS variables
|
|
1163
|
+
* This ensures all components access theme values consistently
|
|
1164
|
+
*/
|
|
1165
|
+
declare function getComponentThemeValue(component: string, property: string, variant?: string, size?: string): string;
|
|
1166
|
+
/**
|
|
1167
|
+
* Generate component-specific CSS variables from DesignTokens
|
|
1168
|
+
*/
|
|
1169
|
+
declare function generateComponentCSSVars(component: string, tokens?: Partial<DesignTokens>, variant?: string, size?: string): Record<string, string>;
|
|
1170
|
+
/**
|
|
1171
|
+
* Apply consistent theme to component style object using DesignTokens
|
|
1172
|
+
*/
|
|
1173
|
+
declare function applyComponentTheme(component: string, style?: React.CSSProperties, variant?: string, size?: string, tokens?: Partial<DesignTokens>): React.CSSProperties;
|
|
1174
|
+
/**
|
|
1175
|
+
* Create a hook for consistent component theming
|
|
1176
|
+
*/
|
|
1177
|
+
declare function useComponentTheme(component: string, variant?: string, size?: string, tokens?: Partial<DesignTokens>): (property: string) => string;
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Theme Utilities
|
|
1181
|
+
*
|
|
1182
|
+
* Helper functions for common theme operations including:
|
|
1183
|
+
* - Theme switching (dark/light mode)
|
|
1184
|
+
* - Theme persistence (localStorage)
|
|
1185
|
+
* - System preference detection
|
|
1186
|
+
* - Smooth transitions
|
|
1187
|
+
* - Color manipulation
|
|
1188
|
+
*/
|
|
1189
|
+
|
|
1190
|
+
type ThemeMode = 'light' | 'dark' | 'system';
|
|
1191
|
+
interface ThemeSwitcherOptions {
|
|
1192
|
+
/** CSS selector for root element (default: ':root') */
|
|
1193
|
+
selector?: string;
|
|
1194
|
+
/** Storage key for theme persistence (default: 'atomix-theme') */
|
|
1195
|
+
storageKey?: string;
|
|
1196
|
+
/** Enable smooth transitions (default: true) */
|
|
1197
|
+
enableTransition?: boolean;
|
|
1198
|
+
/** Transition duration in ms (default: 300) */
|
|
1199
|
+
transitionDuration?: number;
|
|
1200
|
+
}
|
|
1201
|
+
interface ThemePersistenceOptions {
|
|
1202
|
+
/** Storage key (default: 'atomix-theme') */
|
|
1203
|
+
storageKey?: string;
|
|
1204
|
+
/** Storage type (default: 'localStorage') */
|
|
1205
|
+
storageType?: 'localStorage' | 'sessionStorage';
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Switch between light and dark themes
|
|
1209
|
+
*
|
|
1210
|
+
* Automatically toggles a class on the root element and persists the choice.
|
|
1211
|
+
*
|
|
1212
|
+
* @param mode - Theme mode ('light', 'dark', or 'system')
|
|
1213
|
+
* @param options - Configuration options
|
|
1214
|
+
*
|
|
1215
|
+
* @example
|
|
1216
|
+
* ```typescript
|
|
1217
|
+
* import { switchTheme } from '@shohojdhara/atomix/theme/utils';
|
|
1218
|
+
*
|
|
1219
|
+
* // Switch to dark mode
|
|
1220
|
+
* switchTheme('dark');
|
|
1221
|
+
*
|
|
1222
|
+
* // Toggle between light/dark
|
|
1223
|
+
* const current = getCurrentTheme();
|
|
1224
|
+
* switchTheme(current === 'dark' ? 'light' : 'dark');
|
|
1225
|
+
* ```
|
|
1226
|
+
*/
|
|
1227
|
+
declare function switchTheme(mode: ThemeMode, options?: ThemeSwitcherOptions): void;
|
|
1228
|
+
/**
|
|
1229
|
+
* Toggle between light and dark themes
|
|
1230
|
+
*
|
|
1231
|
+
* @param options - Configuration options
|
|
1232
|
+
* @returns The new theme mode
|
|
1233
|
+
*
|
|
1234
|
+
* @example
|
|
1235
|
+
* ```typescript
|
|
1236
|
+
* const newMode = toggleTheme();
|
|
1237
|
+
* console.log('Switched to:', newMode);
|
|
1238
|
+
* ```
|
|
1239
|
+
*/
|
|
1240
|
+
declare function toggleTheme(options?: ThemeSwitcherOptions): ThemeMode;
|
|
1241
|
+
/**
|
|
1242
|
+
* Get current theme mode
|
|
1243
|
+
*
|
|
1244
|
+
* @param storageKey - Storage key (default: 'atomix-theme')
|
|
1245
|
+
* @returns Current theme mode or 'light' if not set
|
|
1246
|
+
*/
|
|
1247
|
+
declare function getCurrentTheme(storageKey?: string): ThemeMode;
|
|
1248
|
+
/**
|
|
1249
|
+
* Get system theme preference
|
|
1250
|
+
*
|
|
1251
|
+
* @returns 'dark' if system prefers dark mode, 'light' otherwise
|
|
1252
|
+
*/
|
|
1253
|
+
declare function getSystemTheme(): ThemeMode;
|
|
1254
|
+
/**
|
|
1255
|
+
* Initialize theme based on saved preference or system preference
|
|
1256
|
+
*
|
|
1257
|
+
* Call this once at app startup.
|
|
1258
|
+
*
|
|
1259
|
+
* @param options - Configuration options
|
|
1260
|
+
* @returns The initialized theme mode
|
|
1261
|
+
*
|
|
1262
|
+
* @example
|
|
1263
|
+
* ```typescript
|
|
1264
|
+
* // In your app entry point
|
|
1265
|
+
* import { initializeTheme } from '@shohojdhara/atomix/theme/utils';
|
|
1266
|
+
*
|
|
1267
|
+
* const theme = initializeTheme();
|
|
1268
|
+
* console.log('Theme initialized:', theme);
|
|
1269
|
+
* ```
|
|
1270
|
+
*/
|
|
1271
|
+
declare function initializeTheme(options?: ThemeSwitcherOptions): ThemeMode;
|
|
1272
|
+
/**
|
|
1273
|
+
* Listen for system theme changes
|
|
1274
|
+
*
|
|
1275
|
+
* @param callback - Function to call when system theme changes
|
|
1276
|
+
* @returns Cleanup function to stop listening
|
|
1277
|
+
*
|
|
1278
|
+
* @example
|
|
1279
|
+
* ```typescript
|
|
1280
|
+
* const cleanup = listenToSystemTheme((mode) => {
|
|
1281
|
+
* console.log('System theme changed to:', mode);
|
|
1282
|
+
* switchTheme(mode);
|
|
1283
|
+
* });
|
|
1284
|
+
*
|
|
1285
|
+
* // Later, when component unmounts
|
|
1286
|
+
* cleanup();
|
|
1287
|
+
* ```
|
|
1288
|
+
*/
|
|
1289
|
+
declare function listenToSystemTheme(callback: (mode: ThemeMode) => void): () => void;
|
|
1290
|
+
/**
|
|
1291
|
+
* Save theme preference to storage
|
|
1292
|
+
*
|
|
1293
|
+
* @param mode - Theme mode to save
|
|
1294
|
+
* @param options - Persistence options
|
|
1295
|
+
*/
|
|
1296
|
+
declare function persistTheme(mode: ThemeMode, options?: ThemePersistenceOptions): void;
|
|
1297
|
+
/**
|
|
1298
|
+
* Clear saved theme preference
|
|
1299
|
+
*
|
|
1300
|
+
* @param options - Persistence options
|
|
1301
|
+
*/
|
|
1302
|
+
declare function clearThemePreference(options?: ThemePersistenceOptions): void;
|
|
1303
|
+
/**
|
|
1304
|
+
* Merge multiple token sets
|
|
1305
|
+
*
|
|
1306
|
+
* Deep merges token objects, with later tokens overriding earlier ones.
|
|
1307
|
+
*
|
|
1308
|
+
* @param tokens - Token objects to merge
|
|
1309
|
+
* @returns Merged tokens
|
|
1310
|
+
*
|
|
1311
|
+
* @example
|
|
1312
|
+
* ```typescript
|
|
1313
|
+
* const merged = mergeTokens(
|
|
1314
|
+
* baseTokens,
|
|
1315
|
+
* { colors: { primary: { main: '#custom' } } }
|
|
1316
|
+
* );
|
|
1317
|
+
* ```
|
|
1318
|
+
*/
|
|
1319
|
+
declare function mergeTokens(...tokens: Array<Partial<DesignTokens>>): Partial<DesignTokens>;
|
|
1320
|
+
/**
|
|
1321
|
+
* Override specific tokens
|
|
1322
|
+
*
|
|
1323
|
+
* Creates a new token object with specific overrides.
|
|
1324
|
+
*
|
|
1325
|
+
* @param base - Base tokens
|
|
1326
|
+
* @param overrides - Tokens to override
|
|
1327
|
+
* @returns New tokens with overrides applied
|
|
1328
|
+
*
|
|
1329
|
+
* @example
|
|
1330
|
+
* ```typescript
|
|
1331
|
+
* const customized = overrideTokens(defaultTokens, {
|
|
1332
|
+
* colors: {
|
|
1333
|
+
* primary: { main: '#ff0000' }
|
|
1334
|
+
* }
|
|
1335
|
+
* });
|
|
1336
|
+
* ```
|
|
1337
|
+
*/
|
|
1338
|
+
declare function overrideTokens(base: Partial<DesignTokens>, overrides: Partial<DesignTokens>): Partial<DesignTokens>;
|
|
1339
|
+
/**
|
|
1340
|
+
* Pick specific token categories
|
|
1341
|
+
*
|
|
1342
|
+
* Extracts only the specified categories from tokens.
|
|
1343
|
+
*
|
|
1344
|
+
* @param tokens - Source tokens
|
|
1345
|
+
* @param categories - Categories to pick
|
|
1346
|
+
* @returns Tokens with only selected categories
|
|
1347
|
+
*
|
|
1348
|
+
* @example
|
|
1349
|
+
* ```typescript
|
|
1350
|
+
* const colorTokens = pickTokens(allTokens, ['colors']);
|
|
1351
|
+
* ```
|
|
1352
|
+
*/
|
|
1353
|
+
declare function pickTokens(tokens: Partial<DesignTokens>, categories: Array<keyof DesignTokens>): Partial<DesignTokens>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Omit specific token categories
|
|
1356
|
+
*
|
|
1357
|
+
* Removes specified categories from tokens.
|
|
1358
|
+
*
|
|
1359
|
+
* @param tokens - Source tokens
|
|
1360
|
+
* @param categories - Categories to omit
|
|
1361
|
+
* @returns Tokens without omitted categories
|
|
1362
|
+
*
|
|
1363
|
+
* @example
|
|
1364
|
+
* ```typescript
|
|
1365
|
+
* const withoutColors = omitTokens(allTokens, ['colors']);
|
|
1366
|
+
* ```
|
|
1367
|
+
*/
|
|
1368
|
+
declare function omitTokens(tokens: Partial<DesignTokens>, categories: Array<keyof DesignTokens>): Partial<DesignTokens>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Convert hex color to RGB
|
|
1371
|
+
*
|
|
1372
|
+
* @param hex - Hex color (with or without #)
|
|
1373
|
+
* @returns RGB object { r, g, b }
|
|
1374
|
+
*/
|
|
1375
|
+
declare function hexToRgb(hex: string): {
|
|
1376
|
+
r: number;
|
|
1377
|
+
g: number;
|
|
1378
|
+
b: number;
|
|
1379
|
+
} | null;
|
|
1380
|
+
/**
|
|
1381
|
+
* Convert RGB to hex
|
|
1382
|
+
*
|
|
1383
|
+
* @param r - Red (0-255)
|
|
1384
|
+
* @param g - Green (0-255)
|
|
1385
|
+
* @param b - Blue (0-255)
|
|
1386
|
+
* @returns Hex color with #
|
|
1387
|
+
*/
|
|
1388
|
+
declare function rgbToHex(r: number, g: number, b: number): string;
|
|
1389
|
+
/**
|
|
1390
|
+
* Calculate luminance of a color
|
|
1391
|
+
*
|
|
1392
|
+
* Used for determining contrast ratios.
|
|
1393
|
+
*
|
|
1394
|
+
* @param hex - Hex color
|
|
1395
|
+
* @returns Luminance value (0-1)
|
|
1396
|
+
*/
|
|
1397
|
+
declare function getLuminance(hex: string): number;
|
|
1398
|
+
/**
|
|
1399
|
+
* Calculate contrast ratio between two colors
|
|
1400
|
+
*
|
|
1401
|
+
* @param hex1 - First hex color
|
|
1402
|
+
* @param hex2 - Second hex color
|
|
1403
|
+
* @returns Contrast ratio (1-21)
|
|
1404
|
+
*/
|
|
1405
|
+
declare function getContrastRatio(hex1: string, hex2: string): number;
|
|
1406
|
+
/**
|
|
1407
|
+
* Check if text color passes WCAG AA standard
|
|
1408
|
+
*
|
|
1409
|
+
* @param textColor - Text color hex
|
|
1410
|
+
* @param backgroundColor - Background color hex
|
|
1411
|
+
* @param size - Font size ('small' or 'large')
|
|
1412
|
+
* @returns true if passes WCAG AA
|
|
1413
|
+
*/
|
|
1414
|
+
declare function isAccessible(textColor: string, backgroundColor: string, size?: 'small' | 'large'): boolean;
|
|
1415
|
+
/**
|
|
1416
|
+
* Get appropriate text color (black or white) for a background
|
|
1417
|
+
*
|
|
1418
|
+
* @param backgroundColor - Background hex color
|
|
1419
|
+
* @param threshold - Contrast threshold (default: 3)
|
|
1420
|
+
* @returns '#000000' or '#FFFFFF'
|
|
1421
|
+
*/
|
|
1422
|
+
declare function getContrastText(backgroundColor: string, threshold?: number): string;
|
|
1423
|
+
/**
|
|
1424
|
+
* Lighten a color
|
|
1425
|
+
*
|
|
1426
|
+
* @param hex - Base hex color
|
|
1427
|
+
* @param amount - Amount to lighten (0-1)
|
|
1428
|
+
* @returns Lightened hex color
|
|
1429
|
+
*/
|
|
1430
|
+
declare function lighten(hex: string, amount?: number): string;
|
|
1431
|
+
/**
|
|
1432
|
+
* Darken a color
|
|
1433
|
+
*
|
|
1434
|
+
* @param hex - Base hex color
|
|
1435
|
+
* @param amount - Amount to darken (0-1)
|
|
1436
|
+
* @returns Darkened hex color
|
|
1437
|
+
*/
|
|
1438
|
+
declare function darken(hex: string, amount?: number): string;
|
|
1439
|
+
/**
|
|
1440
|
+
* Add alpha to a color
|
|
1441
|
+
*
|
|
1442
|
+
* @param hex - Hex color
|
|
1443
|
+
* @param opacity - Opacity value (0-1)
|
|
1444
|
+
* @returns RGBA color string
|
|
1445
|
+
*/
|
|
1446
|
+
declare function alpha(hex: string, opacity: number): string;
|
|
1447
|
+
/**
|
|
1448
|
+
* Emphasize a color (lighten if dark, darken if light)
|
|
1449
|
+
*
|
|
1450
|
+
* @param hex - Hex color
|
|
1451
|
+
* @param amount - Amount to emphasize (0-1)
|
|
1452
|
+
* @returns Emphasized hex color
|
|
1453
|
+
*/
|
|
1454
|
+
declare function emphasize(hex: string, amount?: number): string;
|
|
1455
|
+
/**
|
|
1456
|
+
* Create a spacing utility
|
|
1457
|
+
*
|
|
1458
|
+
* @param spacingInput - Spacing configuration
|
|
1459
|
+
* @returns Spacing function
|
|
1460
|
+
*/
|
|
1461
|
+
declare function createSpacing(spacingInput?: SpacingOptions): SpacingFunction;
|
|
1462
|
+
|
|
1046
1463
|
/**
|
|
1047
1464
|
* Theme Provider
|
|
1048
1465
|
*
|
|
@@ -1098,7 +1515,7 @@ declare function useTheme(): UseThemeReturn;
|
|
|
1098
1515
|
* Provides consistent access to theme values using CSS custom properties
|
|
1099
1516
|
* and DesignTokens.
|
|
1100
1517
|
*/
|
|
1101
|
-
type ThemeTokens = {
|
|
1518
|
+
type ThemeTokens$1 = {
|
|
1102
1519
|
theme: string;
|
|
1103
1520
|
activeTokens: DesignTokens | null;
|
|
1104
1521
|
getToken: (tokenName: string, fallback?: string) => string;
|
|
@@ -1122,7 +1539,7 @@ type ThemeTokens = {
|
|
|
1122
1539
|
shadows: Record<string, string>;
|
|
1123
1540
|
transitions: Record<string, string>;
|
|
1124
1541
|
};
|
|
1125
|
-
declare function useThemeTokens(): ThemeTokens;
|
|
1542
|
+
declare function useThemeTokens(): ThemeTokens$1;
|
|
1126
1543
|
|
|
1127
1544
|
/**
|
|
1128
1545
|
* Theme context with default values
|
|
@@ -1177,6 +1594,85 @@ declare class ThemeErrorBoundary extends Component<ThemeErrorBoundaryProps, Them
|
|
|
1177
1594
|
render(): ReactNode;
|
|
1178
1595
|
}
|
|
1179
1596
|
|
|
1597
|
+
/**
|
|
1598
|
+
* useThemeSwitcher Hook
|
|
1599
|
+
*
|
|
1600
|
+
* React hook for managing theme switching with persistence and system preference detection.
|
|
1601
|
+
* Provides an easy-to-use API for dark/light mode toggling.
|
|
1602
|
+
*
|
|
1603
|
+
* @example
|
|
1604
|
+
* ```tsx
|
|
1605
|
+
* import { useThemeSwitcher } from '@shohojdhara/atomix/theme';
|
|
1606
|
+
*
|
|
1607
|
+
* function ThemeToggle() {
|
|
1608
|
+
* const { mode, toggle, setMode, isDark } = useThemeSwitcher();
|
|
1609
|
+
*
|
|
1610
|
+
* return (
|
|
1611
|
+
* <button onClick={toggle}>
|
|
1612
|
+
* {isDark ? '☀️ Light' : '🌙 Dark'}
|
|
1613
|
+
* </button>
|
|
1614
|
+
* );
|
|
1615
|
+
* }
|
|
1616
|
+
* ```
|
|
1617
|
+
*/
|
|
1618
|
+
|
|
1619
|
+
interface UseThemeSwitcherOptions extends ThemeSwitcherOptions {
|
|
1620
|
+
/** Initial theme mode (default: 'system') */
|
|
1621
|
+
initialMode?: ThemeMode;
|
|
1622
|
+
/** Automatically sync with system preference (default: false) */
|
|
1623
|
+
syncWithSystem?: boolean;
|
|
1624
|
+
}
|
|
1625
|
+
interface UseThemeSwitcherReturn {
|
|
1626
|
+
/** Current theme mode */
|
|
1627
|
+
mode: ThemeMode;
|
|
1628
|
+
/** Whether current theme is dark */
|
|
1629
|
+
isDark: boolean;
|
|
1630
|
+
/** Whether current theme is light */
|
|
1631
|
+
isLight: boolean;
|
|
1632
|
+
/** Toggle between light and dark */
|
|
1633
|
+
toggle: () => ThemeMode;
|
|
1634
|
+
/** Set specific theme mode */
|
|
1635
|
+
setMode: (mode: ThemeMode) => void;
|
|
1636
|
+
/** Reset to system preference */
|
|
1637
|
+
resetToSystem: () => void;
|
|
1638
|
+
/** Clear saved preference */
|
|
1639
|
+
clearPreference: () => void;
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Hook for managing theme switching
|
|
1643
|
+
*
|
|
1644
|
+
* @param options - Configuration options
|
|
1645
|
+
* @returns Theme switcher controls
|
|
1646
|
+
*/
|
|
1647
|
+
declare function useThemeSwitcher(options?: UseThemeSwitcherOptions): UseThemeSwitcherReturn;
|
|
1648
|
+
|
|
1649
|
+
interface ThemeToggleProps extends Omit<UseThemeSwitcherOptions, 'initialMode'> {
|
|
1650
|
+
/** Custom class name */
|
|
1651
|
+
className?: string;
|
|
1652
|
+
/** Show text label (default: false) */
|
|
1653
|
+
showLabel?: boolean;
|
|
1654
|
+
/** Label for light mode (default: 'Light') */
|
|
1655
|
+
lightLabel?: string;
|
|
1656
|
+
/** Label for dark mode (default: 'Dark') */
|
|
1657
|
+
darkLabel?: string;
|
|
1658
|
+
/** Icon size in pixels (default: 20) */
|
|
1659
|
+
iconSize?: number;
|
|
1660
|
+
/** Button variant (default: 'icon') */
|
|
1661
|
+
variant?: 'icon' | 'button' | 'switch';
|
|
1662
|
+
/** Custom render function */
|
|
1663
|
+
render?: (props: {
|
|
1664
|
+
isDark: boolean;
|
|
1665
|
+
toggle: () => void;
|
|
1666
|
+
mode: ThemeMode;
|
|
1667
|
+
}) => React__default.ReactNode;
|
|
1668
|
+
/** Aria label (default: 'Toggle theme') */
|
|
1669
|
+
ariaLabel?: string;
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* ThemeToggle component with multiple variants
|
|
1673
|
+
*/
|
|
1674
|
+
declare const ThemeToggle: React__default.FC<ThemeToggleProps>;
|
|
1675
|
+
|
|
1180
1676
|
/**
|
|
1181
1677
|
* Theme Applicator
|
|
1182
1678
|
*
|
|
@@ -1420,7 +1916,7 @@ declare class ThemeValidator {
|
|
|
1420
1916
|
/**
|
|
1421
1917
|
* Validate theme
|
|
1422
1918
|
*/
|
|
1423
|
-
validate(theme: Theme, metadata?: ThemeMetadata): ValidationResult;
|
|
1919
|
+
validate(theme: Theme, metadata?: ThemeMetadata$1): ValidationResult;
|
|
1424
1920
|
/**
|
|
1425
1921
|
* Validate palette
|
|
1426
1922
|
*/
|
|
@@ -1510,17 +2006,378 @@ interface UseHistoryReturn<T> {
|
|
|
1510
2006
|
*/
|
|
1511
2007
|
declare function useHistory<T>(options?: UseHistoryOptions): UseHistoryReturn<T>;
|
|
1512
2008
|
|
|
2009
|
+
/**
|
|
2010
|
+
* Configuration Types
|
|
2011
|
+
*
|
|
2012
|
+
* Type definitions for the Atomix configuration system.
|
|
2013
|
+
*/
|
|
2014
|
+
|
|
2015
|
+
/**
|
|
2016
|
+
* Color Scale (1-10)
|
|
2017
|
+
*/
|
|
2018
|
+
interface ColorScale {
|
|
2019
|
+
1?: string;
|
|
2020
|
+
2?: string;
|
|
2021
|
+
3?: string;
|
|
2022
|
+
4?: string;
|
|
2023
|
+
5?: string;
|
|
2024
|
+
6?: string;
|
|
2025
|
+
7?: string;
|
|
2026
|
+
8?: string;
|
|
2027
|
+
9?: string;
|
|
2028
|
+
10?: string;
|
|
2029
|
+
[key: string]: string | undefined;
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Palette Color Options
|
|
2033
|
+
*/
|
|
2034
|
+
interface PaletteColorOptions {
|
|
2035
|
+
main: string;
|
|
2036
|
+
light?: string;
|
|
2037
|
+
dark?: string;
|
|
2038
|
+
contrastText?: string;
|
|
2039
|
+
}
|
|
2040
|
+
/**
|
|
2041
|
+
* Interactive Effect Configuration
|
|
2042
|
+
*/
|
|
2043
|
+
interface InteractiveEffectsConfig {
|
|
2044
|
+
/** Vortex & flow field effects */
|
|
2045
|
+
vortex?: {
|
|
2046
|
+
enabled?: boolean;
|
|
2047
|
+
strength?: number;
|
|
2048
|
+
radius?: number;
|
|
2049
|
+
decay?: number;
|
|
2050
|
+
curlNoise?: boolean;
|
|
2051
|
+
velocityTracking?: boolean;
|
|
2052
|
+
};
|
|
2053
|
+
/** Chromatic aberration effects */
|
|
2054
|
+
chromaticAberration?: {
|
|
2055
|
+
enabled?: boolean;
|
|
2056
|
+
mode?: 'longitudinal' | 'lateral' | 'hybrid';
|
|
2057
|
+
redShift?: number;
|
|
2058
|
+
greenShift?: number;
|
|
2059
|
+
blueShift?: number;
|
|
2060
|
+
edgeOnly?: boolean;
|
|
2061
|
+
edgeThreshold?: number;
|
|
2062
|
+
};
|
|
2063
|
+
/** Mouse interaction settings */
|
|
2064
|
+
mouseInteraction?: {
|
|
2065
|
+
sensitivity?: number;
|
|
2066
|
+
trailEffect?: boolean;
|
|
2067
|
+
pressureSensitivity?: boolean;
|
|
2068
|
+
};
|
|
2069
|
+
/** Animation speed controls */
|
|
2070
|
+
animationSpeed?: {
|
|
2071
|
+
base?: number;
|
|
2072
|
+
timeMultiplier?: number;
|
|
2073
|
+
};
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* Optimization Configuration
|
|
2077
|
+
*/
|
|
2078
|
+
interface OptimizationConfig {
|
|
2079
|
+
/** Responsive breakpoint system */
|
|
2080
|
+
responsive?: {
|
|
2081
|
+
breakpoints?: {
|
|
2082
|
+
mobile?: string;
|
|
2083
|
+
tablet?: string;
|
|
2084
|
+
desktop?: string;
|
|
2085
|
+
wide?: string;
|
|
2086
|
+
};
|
|
2087
|
+
/** Device-aware parameter scaling */
|
|
2088
|
+
deviceScaling?: {
|
|
2089
|
+
mobile?: number;
|
|
2090
|
+
tablet?: number;
|
|
2091
|
+
desktop?: number;
|
|
2092
|
+
};
|
|
2093
|
+
};
|
|
2094
|
+
/** Performance monitoring */
|
|
2095
|
+
performance?: {
|
|
2096
|
+
enabled?: boolean;
|
|
2097
|
+
fpsTarget?: number;
|
|
2098
|
+
autoScaling?: boolean;
|
|
2099
|
+
monitorDashboard?: boolean;
|
|
2100
|
+
};
|
|
2101
|
+
/** Auto-scaling logic based on device capabilities */
|
|
2102
|
+
autoScaling?: {
|
|
2103
|
+
enabled?: boolean;
|
|
2104
|
+
qualityThresholds?: {
|
|
2105
|
+
lowEnd?: number;
|
|
2106
|
+
midRange?: number;
|
|
2107
|
+
highEnd?: number;
|
|
2108
|
+
};
|
|
2109
|
+
};
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Visual Polish Configuration
|
|
2113
|
+
*/
|
|
2114
|
+
interface VisualPolishConfig {
|
|
2115
|
+
/** Advanced border effects */
|
|
2116
|
+
borders?: {
|
|
2117
|
+
iridescentGlow?: boolean;
|
|
2118
|
+
shimmerEffect?: boolean;
|
|
2119
|
+
beveledEdges?: boolean;
|
|
2120
|
+
pulsingGlow?: boolean;
|
|
2121
|
+
};
|
|
2122
|
+
/** Content-aware blur */
|
|
2123
|
+
contentAwareBlur?: {
|
|
2124
|
+
enabled?: boolean;
|
|
2125
|
+
depthDetection?: boolean;
|
|
2126
|
+
edgePreservation?: boolean;
|
|
2127
|
+
variableRadius?: boolean;
|
|
2128
|
+
};
|
|
2129
|
+
/** Holographic effect modes */
|
|
2130
|
+
holographicEffects?: {
|
|
2131
|
+
enabled?: boolean;
|
|
2132
|
+
rainbowDiffraction?: boolean;
|
|
2133
|
+
scanlineAnimation?: boolean;
|
|
2134
|
+
gridOverlay?: boolean;
|
|
2135
|
+
dataStream?: boolean;
|
|
2136
|
+
pulseRings?: boolean;
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
/**
|
|
2140
|
+
* Design Tokens Schema (Tailwind-like)
|
|
2141
|
+
*/
|
|
2142
|
+
interface ThemeTokens {
|
|
2143
|
+
/** Color palette */
|
|
2144
|
+
colors?: Record<string, string | PaletteColorOptions | ColorScale | Record<string, string>>;
|
|
2145
|
+
/** Spacing scale */
|
|
2146
|
+
spacing?: Record<string, string>;
|
|
2147
|
+
/** Border radius scale */
|
|
2148
|
+
borderRadius?: Record<string, string>;
|
|
2149
|
+
/** Typography scale and settings */
|
|
2150
|
+
typography?: {
|
|
2151
|
+
fontFamilies?: Record<string, string>;
|
|
2152
|
+
fontSizes?: Record<string, string>;
|
|
2153
|
+
fontWeights?: Record<string, string | number>;
|
|
2154
|
+
lineHeights?: Record<string, string | number>;
|
|
2155
|
+
letterSpacings?: Record<string, string>;
|
|
2156
|
+
};
|
|
2157
|
+
/** Shadow scale */
|
|
2158
|
+
shadows?: Record<string, string>;
|
|
2159
|
+
/** Z-index scale */
|
|
2160
|
+
zIndex?: Record<string, string | number>;
|
|
2161
|
+
/** Breakpoints scale */
|
|
2162
|
+
breakpoints?: Record<string, string | number>;
|
|
2163
|
+
/** Transitions settings */
|
|
2164
|
+
transitions?: {
|
|
2165
|
+
durations?: Record<string, string>;
|
|
2166
|
+
easings?: Record<string, string>;
|
|
2167
|
+
};
|
|
2168
|
+
}
|
|
2169
|
+
/**
|
|
2170
|
+
* CSS Theme Definition
|
|
2171
|
+
*/
|
|
2172
|
+
interface CSSThemeDefinition {
|
|
2173
|
+
type: 'css';
|
|
2174
|
+
name: string;
|
|
2175
|
+
class?: string;
|
|
2176
|
+
description?: string;
|
|
2177
|
+
author?: string;
|
|
2178
|
+
version?: string;
|
|
2179
|
+
tags?: string[];
|
|
2180
|
+
supportsDarkMode?: boolean;
|
|
2181
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
2182
|
+
a11y?: {
|
|
2183
|
+
contrastTarget?: number;
|
|
2184
|
+
modes?: string[];
|
|
2185
|
+
};
|
|
2186
|
+
color?: string;
|
|
2187
|
+
features?: string[];
|
|
2188
|
+
dependencies?: string[];
|
|
2189
|
+
cssPath?: string;
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* JavaScript Theme Definition
|
|
2193
|
+
*/
|
|
2194
|
+
interface JSThemeDefinition {
|
|
2195
|
+
type: 'js';
|
|
2196
|
+
name: string;
|
|
2197
|
+
class?: string;
|
|
2198
|
+
description?: string;
|
|
2199
|
+
author?: string;
|
|
2200
|
+
version?: string;
|
|
2201
|
+
tags?: string[];
|
|
2202
|
+
supportsDarkMode?: boolean;
|
|
2203
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
2204
|
+
a11y?: {
|
|
2205
|
+
contrastTarget?: number;
|
|
2206
|
+
modes?: string[];
|
|
2207
|
+
};
|
|
2208
|
+
color?: string;
|
|
2209
|
+
features?: string[];
|
|
2210
|
+
dependencies?: string[];
|
|
2211
|
+
createTheme: () => Theme;
|
|
2212
|
+
}
|
|
2213
|
+
/**
|
|
2214
|
+
* Theme Definition (CSS or JS)
|
|
2215
|
+
*/
|
|
2216
|
+
type ThemeDefinition = CSSThemeDefinition | JSThemeDefinition;
|
|
2217
|
+
/**
|
|
2218
|
+
* Build configuration
|
|
2219
|
+
*/
|
|
2220
|
+
interface BuildConfig {
|
|
2221
|
+
output?: {
|
|
2222
|
+
directory?: string;
|
|
2223
|
+
formats?: {
|
|
2224
|
+
expanded?: string;
|
|
2225
|
+
compressed?: string;
|
|
2226
|
+
};
|
|
2227
|
+
};
|
|
2228
|
+
sass?: {
|
|
2229
|
+
style?: 'expanded' | 'compressed';
|
|
2230
|
+
sourceMap?: boolean;
|
|
2231
|
+
loadPaths?: string[];
|
|
2232
|
+
};
|
|
2233
|
+
}
|
|
2234
|
+
/**
|
|
2235
|
+
* Runtime configuration
|
|
2236
|
+
*/
|
|
2237
|
+
interface RuntimeConfig {
|
|
2238
|
+
basePath?: string;
|
|
2239
|
+
cdnPath?: string | null;
|
|
2240
|
+
preload?: string[];
|
|
2241
|
+
lazy?: boolean;
|
|
2242
|
+
defaultTheme?: string;
|
|
2243
|
+
storageKey?: string;
|
|
2244
|
+
dataAttribute?: string;
|
|
2245
|
+
enablePersistence?: boolean;
|
|
2246
|
+
useMinified?: boolean;
|
|
2247
|
+
}
|
|
2248
|
+
/**
|
|
2249
|
+
* Integration settings
|
|
2250
|
+
*/
|
|
2251
|
+
interface IntegrationConfig {
|
|
2252
|
+
cssVariables?: Record<string, string>;
|
|
2253
|
+
classNames?: {
|
|
2254
|
+
theme?: string;
|
|
2255
|
+
colorMode?: string;
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Plugin Configuration
|
|
2260
|
+
*/
|
|
2261
|
+
interface PluginConfig {
|
|
2262
|
+
name: string;
|
|
2263
|
+
options?: Record<string, any>;
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Token Provider Configuration
|
|
2267
|
+
*/
|
|
2268
|
+
interface TokenProviderConfig {
|
|
2269
|
+
type: 'figma' | 'style-dictionary' | 'w3c' | string;
|
|
2270
|
+
options?: Record<string, any>;
|
|
2271
|
+
}
|
|
2272
|
+
/**
|
|
2273
|
+
* Token Engine Configuration
|
|
2274
|
+
*/
|
|
2275
|
+
interface TokenEngineConfig {
|
|
2276
|
+
providers?: Record<string, TokenProviderConfig>;
|
|
2277
|
+
sync?: {
|
|
2278
|
+
pull?: boolean;
|
|
2279
|
+
push?: boolean;
|
|
2280
|
+
onBuild?: boolean;
|
|
2281
|
+
};
|
|
2282
|
+
}
|
|
2283
|
+
/**
|
|
2284
|
+
* CLI component generator defaults
|
|
2285
|
+
*/
|
|
2286
|
+
interface GeneratorConfig {
|
|
2287
|
+
/** Default output directory for generated components */
|
|
2288
|
+
outputPath?: string;
|
|
2289
|
+
/** Override detected framework */
|
|
2290
|
+
framework?: 'react' | 'next' | 'vanilla';
|
|
2291
|
+
/** Per-feature defaults */
|
|
2292
|
+
features?: {
|
|
2293
|
+
storybook?: boolean;
|
|
2294
|
+
hook?: boolean;
|
|
2295
|
+
styles?: boolean;
|
|
2296
|
+
tests?: boolean;
|
|
2297
|
+
};
|
|
2298
|
+
/** Composable hooks directory relative to project root */
|
|
2299
|
+
hookOutputDir?: string;
|
|
2300
|
+
/** Story file: side-effect import for global Atomix styles */
|
|
2301
|
+
storybookCssImport?: string;
|
|
2302
|
+
/** Barrel file strategy for new components */
|
|
2303
|
+
barrel?: 'index' | 'none';
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Atomix Configuration Interface
|
|
2307
|
+
*
|
|
2308
|
+
* Tailwind-like configuration for external developers.
|
|
2309
|
+
*/
|
|
2310
|
+
interface AtomixConfig {
|
|
2311
|
+
prefix?: string;
|
|
2312
|
+
plugins?: (string | PluginConfig)[];
|
|
2313
|
+
tokenEngine?: TokenEngineConfig;
|
|
2314
|
+
ai?: {
|
|
2315
|
+
provider?: 'openai' | 'anthropic';
|
|
2316
|
+
model?: string;
|
|
2317
|
+
apiKey?: string;
|
|
2318
|
+
temperature?: number;
|
|
2319
|
+
maxTokens?: number;
|
|
2320
|
+
rateLimit?: {
|
|
2321
|
+
requests: number;
|
|
2322
|
+
windowMs: number;
|
|
2323
|
+
};
|
|
2324
|
+
};
|
|
2325
|
+
telemetry?: {
|
|
2326
|
+
enabled?: boolean;
|
|
2327
|
+
path?: string;
|
|
2328
|
+
anonymize?: boolean;
|
|
2329
|
+
};
|
|
2330
|
+
generator?: GeneratorConfig;
|
|
2331
|
+
interactiveEffects?: InteractiveEffectsConfig;
|
|
2332
|
+
optimization?: OptimizationConfig;
|
|
2333
|
+
visualPolish?: VisualPolishConfig;
|
|
2334
|
+
theme?: {
|
|
2335
|
+
extend?: ThemeTokens;
|
|
2336
|
+
tokens?: ThemeTokens;
|
|
2337
|
+
themes?: Record<string, ThemeDefinition>;
|
|
2338
|
+
};
|
|
2339
|
+
/** @internal Build configuration */
|
|
2340
|
+
build?: BuildConfig;
|
|
2341
|
+
/** @internal Runtime configuration */
|
|
2342
|
+
runtime?: RuntimeConfig;
|
|
2343
|
+
/** @internal Integration settings */
|
|
2344
|
+
integration?: IntegrationConfig;
|
|
2345
|
+
/** @internal Theme dependencies mapping */
|
|
2346
|
+
dependencies?: Record<string, string[]>;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
1513
2349
|
/**
|
|
1514
2350
|
* Theme Adapter
|
|
1515
2351
|
*
|
|
1516
|
-
* Converts between Theme objects and DesignTokens
|
|
2352
|
+
* Converts between Theme objects and DesignTokens
|
|
1517
2353
|
*/
|
|
1518
2354
|
|
|
1519
2355
|
/**
|
|
1520
|
-
*
|
|
2356
|
+
* Converts an AtomixConfig to DesignTokens
|
|
1521
2357
|
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
2358
|
+
* This function maps the configuration from the user-facing format
|
|
2359
|
+
* to the internal DesignTokens format used by the theme system.
|
|
2360
|
+
*
|
|
2361
|
+
* @param config - The configuration object to convert
|
|
2362
|
+
* @returns DesignTokens object ready for theme generation
|
|
2363
|
+
*
|
|
2364
|
+
* @example
|
|
2365
|
+
* ```typescript
|
|
2366
|
+
* import { configToTokens } from '@shohojdhara/atomix/theme';
|
|
2367
|
+
*
|
|
2368
|
+
* const config = {
|
|
2369
|
+
* prefix: 'myapp',
|
|
2370
|
+
* theme: { extend: { colors: { primary: { main: '#7AFFD7' } } } }
|
|
2371
|
+
* };
|
|
2372
|
+
* const tokens = configToTokens(config);
|
|
2373
|
+
* ```
|
|
2374
|
+
*/
|
|
2375
|
+
declare function configToTokens(config: AtomixConfig): DesignTokens;
|
|
2376
|
+
/**
|
|
2377
|
+
* Converts DesignTokens to CSS variables
|
|
2378
|
+
*
|
|
2379
|
+
* @param tokens - The tokens to convert
|
|
2380
|
+
* @returns A record of CSS variable names and values
|
|
1524
2381
|
*/
|
|
1525
2382
|
declare function designTokensToCSSVars(tokens: Partial<DesignTokens>): Record<string, string>;
|
|
1526
2383
|
|
|
@@ -1630,6 +2487,265 @@ declare function extractComponentName(varName: string, prefix?: string): string
|
|
|
1630
2487
|
*/
|
|
1631
2488
|
declare function isDesignTokens(value: unknown): value is DesignTokens;
|
|
1632
2489
|
|
|
2490
|
+
/**
|
|
2491
|
+
* Performance Monitor Utility
|
|
2492
|
+
*
|
|
2493
|
+
* Provides performance monitoring and metrics collection for the Atomix theme system.
|
|
2494
|
+
* Used to measure and optimize performance of advanced visual effects.
|
|
2495
|
+
*/
|
|
2496
|
+
/**
|
|
2497
|
+
* Performance metrics collected by the monitor
|
|
2498
|
+
*/
|
|
2499
|
+
interface PerformanceMetrics {
|
|
2500
|
+
/** Frames per second */
|
|
2501
|
+
fps: number;
|
|
2502
|
+
/** Average frame render time in ms */
|
|
2503
|
+
frameTime: number;
|
|
2504
|
+
/** Peak frame render time in ms */
|
|
2505
|
+
peakFrameTime: number;
|
|
2506
|
+
/** Memory usage statistics */
|
|
2507
|
+
memory?: {
|
|
2508
|
+
usedJSHeapSize: number;
|
|
2509
|
+
totalJSHeapSize: number;
|
|
2510
|
+
jsHeapSizeLimit: number;
|
|
2511
|
+
};
|
|
2512
|
+
/** Timestamp of measurement */
|
|
2513
|
+
timestamp: number;
|
|
2514
|
+
/** Whether performance is degrading */
|
|
2515
|
+
isDegraded: boolean;
|
|
2516
|
+
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Performance monitor configuration
|
|
2519
|
+
*/
|
|
2520
|
+
interface PerformanceMonitorConfig {
|
|
2521
|
+
/** Target FPS threshold (default: 60) */
|
|
2522
|
+
fpsTarget?: number;
|
|
2523
|
+
/** How frequently to sample (default: 500ms) */
|
|
2524
|
+
sampleInterval?: number;
|
|
2525
|
+
/** Callback for performance updates */
|
|
2526
|
+
onUpdate?: (metrics: PerformanceMetrics) => void;
|
|
2527
|
+
/** Callback when performance degrades */
|
|
2528
|
+
onDegraded?: (metrics: PerformanceMetrics) => void;
|
|
2529
|
+
/** Enable/disable memory monitoring */
|
|
2530
|
+
enableMemoryMonitoring?: boolean;
|
|
2531
|
+
}
|
|
2532
|
+
/**
|
|
2533
|
+
* Performance monitor class
|
|
2534
|
+
*/
|
|
2535
|
+
declare class PerformanceMonitor {
|
|
2536
|
+
config: Required<PerformanceMonitorConfig>;
|
|
2537
|
+
private frameCount;
|
|
2538
|
+
private lastSampleTime;
|
|
2539
|
+
private lastFpsUpdate;
|
|
2540
|
+
private frameTimes;
|
|
2541
|
+
private animationFrameId;
|
|
2542
|
+
private isActive;
|
|
2543
|
+
private startTime;
|
|
2544
|
+
/**
|
|
2545
|
+
* Create a new performance monitor
|
|
2546
|
+
*
|
|
2547
|
+
* @param config Configuration options
|
|
2548
|
+
*/
|
|
2549
|
+
constructor(config?: PerformanceMonitorConfig);
|
|
2550
|
+
/**
|
|
2551
|
+
* Start monitoring performance
|
|
2552
|
+
*/
|
|
2553
|
+
start(): void;
|
|
2554
|
+
/**
|
|
2555
|
+
* Stop monitoring performance
|
|
2556
|
+
*/
|
|
2557
|
+
stop(): void;
|
|
2558
|
+
/**
|
|
2559
|
+
* Get current performance metrics
|
|
2560
|
+
*/
|
|
2561
|
+
getMetrics(): PerformanceMetrics;
|
|
2562
|
+
/**
|
|
2563
|
+
* Get the current FPS
|
|
2564
|
+
*/
|
|
2565
|
+
getFps(): number;
|
|
2566
|
+
/**
|
|
2567
|
+
* Check if performance is degraded
|
|
2568
|
+
*/
|
|
2569
|
+
isPerformanceDegraded(): boolean;
|
|
2570
|
+
/**
|
|
2571
|
+
* Private method called on each animation frame
|
|
2572
|
+
*/
|
|
2573
|
+
private onFrame;
|
|
2574
|
+
/**
|
|
2575
|
+
* Run a performance test for a specific function
|
|
2576
|
+
*
|
|
2577
|
+
* @param fn Function to test
|
|
2578
|
+
* @param iterations Number of iterations (default: 100)
|
|
2579
|
+
* @returns Average execution time in ms
|
|
2580
|
+
*/
|
|
2581
|
+
testFunctionPerformance(fn: () => void, iterations?: number): Promise<number>;
|
|
2582
|
+
}
|
|
2583
|
+
/**
|
|
2584
|
+
* Create a performance monitor instance
|
|
2585
|
+
*
|
|
2586
|
+
* @param config Configuration options
|
|
2587
|
+
* @returns PerformanceMonitor instance
|
|
2588
|
+
*
|
|
2589
|
+
* @example
|
|
2590
|
+
* ```typescript
|
|
2591
|
+
* import { createPerformanceMonitor } from '@shohojdhara/atomix/theme';
|
|
2592
|
+
*
|
|
2593
|
+
* const monitor = createPerformanceMonitor({
|
|
2594
|
+
* fpsTarget: 60,
|
|
2595
|
+
* onUpdate: (metrics) => console.log('FPS:', metrics.fps),
|
|
2596
|
+
* onDegraded: (metrics) => console.warn('Performance degraded!', metrics),
|
|
2597
|
+
* });
|
|
2598
|
+
*
|
|
2599
|
+
* monitor.start();
|
|
2600
|
+
*
|
|
2601
|
+
* // Later...
|
|
2602
|
+
* monitor.stop();
|
|
2603
|
+
* ```
|
|
2604
|
+
*/
|
|
2605
|
+
declare function createPerformanceMonitor(config?: PerformanceMonitorConfig): PerformanceMonitor;
|
|
2606
|
+
/**
|
|
2607
|
+
* Hook for React components to monitor performance
|
|
2608
|
+
*
|
|
2609
|
+
* @param config Configuration options
|
|
2610
|
+
* @returns Performance metrics and monitor controls
|
|
2611
|
+
*
|
|
2612
|
+
* @example
|
|
2613
|
+
* ```typescript
|
|
2614
|
+
* import { usePerformanceMonitor } from '@shohojdhara/atomix/theme';
|
|
2615
|
+
*
|
|
2616
|
+
* function MyComponent() {
|
|
2617
|
+
* const { metrics, start, stop } = usePerformanceMonitor({ fpsTarget: 60 });
|
|
2618
|
+
*
|
|
2619
|
+
* useEffect(() => {
|
|
2620
|
+
* start();
|
|
2621
|
+
* return () => stop();
|
|
2622
|
+
* }, []);
|
|
2623
|
+
*
|
|
2624
|
+
* return <div>FPS: {metrics.fps}</div>;
|
|
2625
|
+
* }
|
|
2626
|
+
* ```
|
|
2627
|
+
*/
|
|
2628
|
+
declare function usePerformanceMonitor(config?: PerformanceMonitorConfig): {
|
|
2629
|
+
metrics: PerformanceMetrics;
|
|
2630
|
+
start: () => void;
|
|
2631
|
+
stop: () => void;
|
|
2632
|
+
};
|
|
2633
|
+
|
|
2634
|
+
/**
|
|
2635
|
+
* Responsive Utility for Atomix Theme System
|
|
2636
|
+
*
|
|
2637
|
+
* Provides responsive breakpoint detection and device-aware parameter scaling
|
|
2638
|
+
* based on configuration from the advanced optimization features.
|
|
2639
|
+
*/
|
|
2640
|
+
/**
|
|
2641
|
+
* Breakpoint definitions
|
|
2642
|
+
*/
|
|
2643
|
+
interface Breakpoints {
|
|
2644
|
+
mobile: string;
|
|
2645
|
+
tablet: string;
|
|
2646
|
+
desktop: string;
|
|
2647
|
+
wide: string;
|
|
2648
|
+
}
|
|
2649
|
+
/**
|
|
2650
|
+
* Device scaling factors
|
|
2651
|
+
*/
|
|
2652
|
+
interface DeviceScaling {
|
|
2653
|
+
mobile: number;
|
|
2654
|
+
tablet: number;
|
|
2655
|
+
desktop: number;
|
|
2656
|
+
}
|
|
2657
|
+
/**
|
|
2658
|
+
* Responsive configuration
|
|
2659
|
+
*/
|
|
2660
|
+
interface ResponsiveConfig {
|
|
2661
|
+
breakpoints: Breakpoints;
|
|
2662
|
+
deviceScaling: DeviceScaling;
|
|
2663
|
+
}
|
|
2664
|
+
/**
|
|
2665
|
+
* Current device type
|
|
2666
|
+
*/
|
|
2667
|
+
type DeviceType = 'mobile' | 'tablet' | 'desktop' | 'wide';
|
|
2668
|
+
/**
|
|
2669
|
+
* Responsive utility class
|
|
2670
|
+
*/
|
|
2671
|
+
declare class ResponsiveUtil {
|
|
2672
|
+
private config;
|
|
2673
|
+
private currentDevice;
|
|
2674
|
+
private resizeHandler;
|
|
2675
|
+
private observer;
|
|
2676
|
+
constructor(config: ResponsiveConfig);
|
|
2677
|
+
/**
|
|
2678
|
+
* Get the current device type based on viewport width
|
|
2679
|
+
*/
|
|
2680
|
+
getCurrentDeviceType(): DeviceType;
|
|
2681
|
+
/**
|
|
2682
|
+
* Get the scaling factor for the current device
|
|
2683
|
+
*/
|
|
2684
|
+
getCurrentScalingFactor(): number;
|
|
2685
|
+
/**
|
|
2686
|
+
* Scale a value based on the current device's scaling factor
|
|
2687
|
+
*/
|
|
2688
|
+
scaleValue(value: number): number;
|
|
2689
|
+
/**
|
|
2690
|
+
* Check if the current device matches a specific type
|
|
2691
|
+
*/
|
|
2692
|
+
isDevice(device: DeviceType): boolean;
|
|
2693
|
+
/**
|
|
2694
|
+
* Check if the current device is mobile or smaller
|
|
2695
|
+
*/
|
|
2696
|
+
isMobileOrSmaller(): boolean;
|
|
2697
|
+
/**
|
|
2698
|
+
* Check if the current device is tablet or smaller
|
|
2699
|
+
*/
|
|
2700
|
+
isTabletOrSmaller(): boolean;
|
|
2701
|
+
/**
|
|
2702
|
+
* Check if the current device is desktop or larger
|
|
2703
|
+
*/
|
|
2704
|
+
isDesktopOrLarger(): boolean;
|
|
2705
|
+
/**
|
|
2706
|
+
* Update the responsive configuration
|
|
2707
|
+
*/
|
|
2708
|
+
updateConfig(config: ResponsiveConfig): void;
|
|
2709
|
+
/**
|
|
2710
|
+
* Destroy the responsive utility and clean up listeners
|
|
2711
|
+
*/
|
|
2712
|
+
destroy(): void;
|
|
2713
|
+
/**
|
|
2714
|
+
* Parse a CSS value to pixels
|
|
2715
|
+
*/
|
|
2716
|
+
private parsePxValue;
|
|
2717
|
+
/**
|
|
2718
|
+
* Set up the resize listener
|
|
2719
|
+
*/
|
|
2720
|
+
private setupResizeListener;
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Create a responsive utility instance
|
|
2724
|
+
*
|
|
2725
|
+
* @param config Responsive configuration
|
|
2726
|
+
* @returns ResponsiveUtil instance
|
|
2727
|
+
*/
|
|
2728
|
+
declare function createResponsiveUtil(config: ResponsiveConfig): ResponsiveUtil;
|
|
2729
|
+
/**
|
|
2730
|
+
* Hook for React components to use responsive features
|
|
2731
|
+
*
|
|
2732
|
+
* @param config Responsive configuration
|
|
2733
|
+
* @returns Current device type and utility functions
|
|
2734
|
+
*/
|
|
2735
|
+
declare function useResponsive(config: ResponsiveConfig): {
|
|
2736
|
+
deviceType: DeviceType;
|
|
2737
|
+
isMobile: boolean;
|
|
2738
|
+
isTablet: boolean;
|
|
2739
|
+
isDesktop: boolean;
|
|
2740
|
+
isWide: boolean;
|
|
2741
|
+
scaleValue: (value: number) => number;
|
|
2742
|
+
getCurrentDeviceType: () => DeviceType;
|
|
2743
|
+
getCurrentScalingFactor: () => number;
|
|
2744
|
+
isMobileOrSmaller: () => boolean;
|
|
2745
|
+
isTabletOrSmaller: () => boolean;
|
|
2746
|
+
isDesktopOrLarger: () => boolean;
|
|
2747
|
+
};
|
|
2748
|
+
|
|
1633
2749
|
/**
|
|
1634
2750
|
* RTL (Right-to-Left) Support Utilities
|
|
1635
2751
|
*
|
|
@@ -1728,26 +2844,24 @@ declare class RTLManager {
|
|
|
1728
2844
|
*/
|
|
1729
2845
|
destroy(): void;
|
|
1730
2846
|
}
|
|
1731
|
-
|
|
1732
2847
|
/**
|
|
1733
|
-
*
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
*
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
*
|
|
1742
|
-
|
|
1743
|
-
|
|
2848
|
+
* Create RTL manager instance
|
|
2849
|
+
*/
|
|
2850
|
+
declare function createRTLManager(config?: RTLConfig): RTLManager;
|
|
2851
|
+
/**
|
|
2852
|
+
* Check if locale is RTL
|
|
2853
|
+
*/
|
|
2854
|
+
declare function isRTLLocale(locale: string): boolean;
|
|
2855
|
+
/**
|
|
2856
|
+
* Get direction from locale
|
|
2857
|
+
*/
|
|
2858
|
+
declare function getDirectionFromLocale(locale: string): 'ltr' | 'rtl';
|
|
2859
|
+
/**
|
|
2860
|
+
* RTL-aware CSS helper
|
|
1744
2861
|
*
|
|
1745
|
-
*
|
|
1746
|
-
* import { ThemeProvider } from '@shohojdhara/atomix/theme';
|
|
1747
|
-
* const tokens = { 'primary': '#7c3aed' };
|
|
1748
|
-
* <ThemeProvider defaultTheme={tokens}>...</ThemeProvider>
|
|
1749
|
-
* ```
|
|
2862
|
+
* Returns appropriate CSS based on direction
|
|
1750
2863
|
*/
|
|
2864
|
+
declare function rtlCSS(ltrCSS: string, rtlCSS: string, direction?: 'ltr' | 'rtl'): string;
|
|
1751
2865
|
|
|
1752
2866
|
/**
|
|
1753
2867
|
* Inject theme CSS into DOM
|
|
@@ -1758,5 +2872,5 @@ declare function injectTheme(css: string, id?: string): void;
|
|
|
1758
2872
|
*/
|
|
1759
2873
|
declare function removeTheme(id?: string): void;
|
|
1760
2874
|
|
|
1761
|
-
export { DesignTokensCustomizer, RTLManager, ThemeApplicator, ThemeComparator, ThemeContext, ThemeErrorBoundary, ThemeInspector, ThemeLiveEditor, ThemePreview, ThemeProvider, ThemeValidator, applyCSSVariables, applyComponentTheme, applyTheme, camelToKebab, clearThemes, createTheme, createThemeRegistry, createTokens, cssVarsToStyle, deepMerge, defaultTokens, designTokensToCSSVars, extendTheme, extractComponentName, generateCSSVariableName, generateCSSVariables, generateCSSVariablesForSelector, generateClassName, generateComponentCSSVars, getAllThemes, getCSSVariable, getComponentThemeValue, getTheme, getThemeApplicator, getThemeCount, getThemeIds, hasTheme, injectCSS, injectTheme, isCSSInjected, isDesignTokens, isValidCSSVariableName, mapSCSSTokensToCSSVars, mergeCSSVars, mergeTheme, normalizeThemeTokens, registerTheme, removeCSS, removeCSSVariables, removeTheme, themePropertyToCSSVar, unregisterTheme, useComponentTheme, useHistory, useTheme, useThemeTokens };
|
|
1762
|
-
export type { A11yIssue, CSSVariableConfig, CSSVariableNamingOptions, ComponentThemeOptions, ComponentThemeOverride, DesignTokens, DesignTokensCustomizerProps, GenerateCSSVariablesOptions, NamingOptions, RTLConfig, Theme, ThemeChangeEvent, ThemeComparatorProps, ThemeComponentOverrides, ThemeContextValue, ThemeErrorBoundaryProps, ThemeInspectorProps, ThemeLiveEditorProps, ThemeLoadOptions, ThemePreviewProps, ThemeProviderProps, ThemeValidationResult, UseHistoryOptions, UseHistoryReturn, UseThemeReturn, ValidationResult };
|
|
2875
|
+
export { DesignTokensCustomizer, RTLManager, ThemeApplicator, ThemeComparator, ThemeContext, ThemeErrorBoundary, ThemeInspector, ThemeLiveEditor, ThemePreview, ThemeProvider, ThemeToggle, ThemeValidator, alpha, applyCSSVariables, applyComponentTheme, applyTheme, camelToKebab, clearThemePreference, clearThemes, configToTokens, createPerformanceMonitor, createRTLManager, createResponsiveUtil, createSpacing, createTheme, createThemeRegistry, createTokens, cssVarsToStyle, darken, deepMerge, defaultTokens, designTokensToCSSVars, emphasize, extendTheme, extractComponentName, generateCSSVariableName, generateCSSVariables, generateCSSVariablesForSelector, generateClassName, generateComponentCSSVars, getAllThemes, getCSSVariable, getComponentThemeValue, getContrastRatio, getContrastText, getCurrentTheme, getDirectionFromLocale, getLuminance, getSystemTheme, getTheme, getThemeApplicator, getThemeCount, getThemeIds, hasTheme, hexToRgb, initializeTheme, injectCSS, injectTheme, isAccessible, isCSSInjected, isDesignTokens, isRTLLocale, isValidCSSVariableName, lighten, listenToSystemTheme, mapSCSSTokensToCSSVars, mergeCSSVars, mergeTheme, mergeTokens, normalizeThemeTokens, omitTokens, overrideTokens, persistTheme, pickTokens, registerTheme, removeCSS, removeCSSVariables, removeTheme, rgbToHex, rtlCSS, switchTheme, themePropertyToCSSVar, toggleTheme, unregisterTheme, useComponentTheme, useHistory, usePerformanceMonitor, useResponsive, useTheme, useThemeSwitcher, useThemeTokens };
|
|
2876
|
+
export type { A11yIssue, CSSVariableConfig, CSSVariableNamingOptions, ComponentThemeOptions, ComponentThemeOverride, DesignTokens, DesignTokensCustomizerProps, GenerateCSSVariablesOptions, NamingOptions, PerformanceMetrics, RTLConfig, Theme, ThemeChangeEvent, ThemeComparatorProps, ThemeComponentOverrides, ThemeContextValue, ThemeErrorBoundaryProps, ThemeInspectorProps, ThemeLiveEditorProps, ThemeLoadOptions, ThemeMode, ThemePersistenceOptions, ThemePreviewProps, ThemeProviderProps, ThemeSwitcherOptions, ThemeToggleProps, ThemeValidationResult, UseHistoryOptions, UseHistoryReturn, UseThemeReturn, UseThemeSwitcherOptions, UseThemeSwitcherReturn, ValidationResult };
|