@shohojdhara/atomix 0.3.7 → 0.3.8

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.
Files changed (53) hide show
  1. package/dist/atomix.css +77 -0
  2. package/dist/atomix.css.map +1 -1
  3. package/dist/atomix.min.css +77 -0
  4. package/dist/atomix.min.css.map +1 -1
  5. package/dist/charts.js.map +1 -1
  6. package/dist/core.d.ts +2 -2
  7. package/dist/core.js.map +1 -1
  8. package/dist/forms.js.map +1 -1
  9. package/dist/heavy.js.map +1 -1
  10. package/dist/index.d.ts +578 -515
  11. package/dist/index.esm.js +3157 -2626
  12. package/dist/index.esm.js.map +1 -1
  13. package/dist/index.js +10496 -9973
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.min.js +1 -1
  16. package/dist/index.min.js.map +1 -1
  17. package/dist/theme.d.ts +237 -420
  18. package/dist/theme.js +1629 -1701
  19. package/dist/theme.js.map +1 -1
  20. package/package.json +1 -1
  21. package/src/components/DataTable/DataTable.stories.tsx +238 -0
  22. package/src/components/DataTable/DataTable.test.tsx +450 -0
  23. package/src/components/DataTable/DataTable.tsx +384 -61
  24. package/src/components/DatePicker/DatePicker.tsx +29 -38
  25. package/src/components/Upload/Upload.tsx +539 -40
  26. package/src/lib/composables/useDataTable.ts +355 -15
  27. package/src/lib/composables/useDatePicker.ts +19 -0
  28. package/src/lib/constants/components.ts +10 -0
  29. package/src/lib/theme/adapters/cssVariableMapper.ts +29 -14
  30. package/src/lib/theme/adapters/index.ts +1 -4
  31. package/src/lib/theme/config/configLoader.ts +53 -35
  32. package/src/lib/theme/core/composeTheme.ts +22 -30
  33. package/src/lib/theme/core/createTheme.ts +49 -26
  34. package/src/lib/theme/core/index.ts +0 -1
  35. package/src/lib/theme/generators/generateCSSNested.ts +4 -3
  36. package/src/lib/theme/generators/generateCSSVariables.ts +24 -16
  37. package/src/lib/theme/index.ts +10 -17
  38. package/src/lib/theme/runtime/ThemeApplicator.ts +6 -109
  39. package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +3 -3
  40. package/src/lib/theme/runtime/ThemeProvider.tsx +186 -44
  41. package/src/lib/theme/runtime/useTheme.ts +1 -1
  42. package/src/lib/theme/runtime/useThemeTokens.ts +7 -16
  43. package/src/lib/theme/test/testTheme.ts +2 -1
  44. package/src/lib/theme/types.ts +14 -14
  45. package/src/lib/theme/utils/componentTheming.ts +35 -27
  46. package/src/lib/theme/utils/domUtils.ts +57 -15
  47. package/src/lib/theme/utils/injectCSS.ts +0 -1
  48. package/src/lib/theme/utils/themeHelpers.ts +1 -39
  49. package/src/lib/theme/utils/themeUtils.ts +1 -170
  50. package/src/lib/types/components.ts +145 -0
  51. package/src/lib/utils/dataTableExport.ts +143 -0
  52. package/src/styles/06-components/_components.data-table.scss +95 -0
  53. package/src/lib/hooks/useThemeTokens.ts +0 -105
package/dist/theme.d.ts CHANGED
@@ -294,6 +294,203 @@ declare const defaultTokens: DesignTokens;
294
294
  */
295
295
  declare function createTokens(overrides?: Partial<DesignTokens>): DesignTokens;
296
296
 
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
+
297
494
  /**
298
495
  * Theme Manager Type Definitions
299
496
  *
@@ -302,7 +499,7 @@ declare function createTokens(overrides?: Partial<DesignTokens>): DesignTokens;
302
499
  /**
303
500
  * Theme metadata interface matching themes.config.js structure
304
501
  */
305
- interface ThemeMetadata$1 {
502
+ interface ThemeMetadata {
306
503
  /** Display name of the theme */
307
504
  name: string;
308
505
  /** Unique identifier/class name for the theme */
@@ -341,8 +538,8 @@ interface ThemeChangeEvent {
341
538
  previousTheme: string | null;
342
539
  /** New theme name */
343
540
  currentTheme: string;
344
- /** Theme object (for JS themes) */
345
- themeObject?: Theme | null;
541
+ /** DesignTokens if using tokens-based theme */
542
+ tokens?: DesignTokens | null;
346
543
  /** Timestamp of the change */
347
544
  timestamp: number;
348
545
  /** Whether the change was from user action or system */
@@ -380,12 +577,12 @@ interface ThemeValidationResult {
380
577
  interface UseThemeReturn {
381
578
  /** Current theme name */
382
579
  theme: string;
383
- /** Current active theme object (for JS themes) */
384
- activeTheme: Theme | null;
385
- /** Function to change theme (supports string, Theme, or DesignTokens) */
386
- setTheme: (theme: string | Theme | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
580
+ /** Current active DesignTokens (if using tokens-based theme) */
581
+ activeTokens: DesignTokens | null;
582
+ /** Function to change theme (supports string or DesignTokens) */
583
+ setTheme: (theme: string | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
387
584
  /** Available themes */
388
- availableThemes: ThemeMetadata$1[];
585
+ availableThemes: ThemeMetadata[];
389
586
  /** Whether a theme is currently loading */
390
587
  isLoading: boolean;
391
588
  /** Current error, if any */
@@ -451,10 +648,10 @@ interface ThemeComponentOverrides {
451
648
  interface ThemeProviderProps {
452
649
  /** Child components */
453
650
  children: React.ReactNode;
454
- /** Default theme */
455
- defaultTheme?: string | Theme;
651
+ /** Default theme (string name or DesignTokens) */
652
+ defaultTheme?: string | DesignTokens | Partial<DesignTokens>;
456
653
  /** Available themes */
457
- themes?: Record<string, ThemeMetadata$1>;
654
+ themes?: Record<string, ThemeMetadata>;
458
655
  /** Base path for theme CSS */
459
656
  basePath?: string;
460
657
  /** CDN path for theme CSS */
@@ -472,7 +669,7 @@ interface ThemeProviderProps {
472
669
  /** Use minified CSS */
473
670
  useMinified?: boolean;
474
671
  /** Callback when theme changes */
475
- onThemeChange?: (theme: string | Theme | DesignTokens) => void;
672
+ onThemeChange?: (theme: string | DesignTokens) => void;
476
673
  /** Callback on error */
477
674
  onError?: (error: Error, themeName: string) => void;
478
675
  }
@@ -482,12 +679,12 @@ interface ThemeProviderProps {
482
679
  interface ThemeContextValue {
483
680
  /** Current theme name */
484
681
  theme: string;
485
- /** Current active theme object (for JS themes) */
486
- activeTheme: Theme | null;
487
- /** Set theme function (supports string, Theme, or DesignTokens) */
488
- setTheme: (theme: string | Theme | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
682
+ /** Current active DesignTokens (if using tokens-based theme) */
683
+ activeTokens: DesignTokens | null;
684
+ /** Set theme function (supports string or DesignTokens) */
685
+ setTheme: (theme: string | DesignTokens | Partial<DesignTokens>, options?: ThemeLoadOptions) => Promise<void>;
489
686
  /** Available themes */
490
- availableThemes: ThemeMetadata$1[];
687
+ availableThemes: ThemeMetadata[];
491
688
  /** Loading state */
492
689
  isLoading: boolean;
493
690
  /** Error state */
@@ -510,36 +707,6 @@ interface PaletteColor {
510
707
  /** Contrast text color (auto-generated if not provided) */
511
708
  contrastText?: string;
512
709
  }
513
- /**
514
- * Palette configuration options for createTheme
515
- */
516
- interface PaletteOptions {
517
- /** Primary color configuration */
518
- primary?: Partial<PaletteColor> | string;
519
- /** Secondary color configuration */
520
- secondary?: Partial<PaletteColor> | string;
521
- /** Error color configuration */
522
- error?: Partial<PaletteColor> | string;
523
- /** Warning color configuration */
524
- warning?: Partial<PaletteColor> | string;
525
- /** Info color configuration */
526
- info?: Partial<PaletteColor> | string;
527
- /** Success color configuration */
528
- success?: Partial<PaletteColor> | string;
529
- /** Background colors */
530
- background?: {
531
- default?: string;
532
- subtle?: string;
533
- };
534
- /** Text colors */
535
- text?: {
536
- primary?: string;
537
- secondary?: string;
538
- disabled?: string;
539
- };
540
- /** Additional custom colors */
541
- [key: string]: any;
542
- }
543
710
  /**
544
711
  * Typography configuration options for createTheme
545
712
  */
@@ -609,10 +776,6 @@ interface TypographyOptions {
609
776
  * Spacing function type
610
777
  */
611
778
  type SpacingFunction = (...values: number[]) => string;
612
- /**
613
- * Spacing configuration options for createTheme
614
- */
615
- type SpacingOptions = number | number[] | SpacingFunction;
616
779
  /**
617
780
  * Breakpoint values configuration
618
781
  */
@@ -624,15 +787,6 @@ interface BreakpointValues {
624
787
  xl?: number;
625
788
  [key: string]: number | undefined;
626
789
  }
627
- /**
628
- * Breakpoints configuration options for createTheme
629
- */
630
- interface BreakpointsOptions {
631
- /** Breakpoint values in pixels */
632
- values?: BreakpointValues;
633
- /** Unit for breakpoints (default: 'px') */
634
- unit?: string;
635
- }
636
790
  /**
637
791
  * Shadow configuration
638
792
  */
@@ -710,35 +864,11 @@ interface BorderRadiusOptions {
710
864
  interface ThemeCustomProperties {
711
865
  [key: string]: any;
712
866
  }
713
- /**
714
- * Theme configuration options for createTheme
715
- * Extends ThemeMetadata to support both CSS and JS theme properties
716
- */
717
- interface ThemeOptions extends Partial<ThemeMetadata$1> {
718
- /** Color palette configuration */
719
- palette?: PaletteOptions;
720
- /** Typography configuration */
721
- typography?: TypographyOptions;
722
- /** Spacing configuration */
723
- spacing?: SpacingOptions;
724
- /** Breakpoints configuration */
725
- breakpoints?: BreakpointsOptions;
726
- /** Shadow configuration */
727
- shadows?: ShadowOptions;
728
- /** Transition configuration */
729
- transitions?: TransitionOptions;
730
- /** Z-index configuration */
731
- zIndex?: ZIndexOptions;
732
- /** Border radius configuration */
733
- borderRadius?: BorderRadiusOptions;
734
- /** Custom properties */
735
- custom?: ThemeCustomProperties;
736
- }
737
867
  /**
738
868
  * Complete theme object with computed values
739
869
  * Generated by createTheme function
740
870
  */
741
- interface Theme extends ThemeMetadata$1 {
871
+ interface Theme extends ThemeMetadata {
742
872
  /** Color palette with computed values */
743
873
  palette: {
744
874
  primary: PaletteColor;
@@ -804,241 +934,6 @@ interface Theme extends ThemeMetadata$1 {
804
934
  __isJSTheme: true;
805
935
  }
806
936
 
807
- /**
808
- * CSS Variable Generator
809
- *
810
- * Generates CSS custom properties from design tokens.
811
- */
812
-
813
- /**
814
- * Options for CSS variable generation
815
- */
816
- interface GenerateCSSVariablesOptions {
817
- /** CSS selector for the variables (default: ':root') */
818
- selector?: string;
819
- /** Prefix for CSS variables (default: 'atomix') */
820
- prefix?: string;
821
- }
822
- /**
823
- * Generate CSS variables from tokens
824
- *
825
- * Converts flat token object to CSS custom properties.
826
- *
827
- * @param tokens - Design tokens object
828
- * @param options - Generation options
829
- * @returns CSS string with custom properties
830
- *
831
- * @example
832
- * ```typescript
833
- * const tokens = {
834
- * 'primary': '#7c3aed',
835
- * 'spacing-4': '1rem',
836
- * };
837
- *
838
- * const css = generateCSSVariables(tokens);
839
- * // Returns: ":root {\n --atomix-primary: #7c3aed;\n --atomix-spacing-4: 1rem;\n}"
840
- * ```
841
- */
842
- declare function generateCSSVariables(tokens: DesignTokens, options?: GenerateCSSVariablesOptions): string;
843
- /**
844
- * Generate CSS variables with custom selector
845
- *
846
- * Useful for theme-specific selectors like `[data-theme="dark"]`
847
- *
848
- * @param tokens - Design tokens object
849
- * @param selector - CSS selector (e.g., '[data-theme="dark"]')
850
- * @param prefix - CSS variable prefix
851
- * @returns CSS string
852
- *
853
- * @example
854
- * ```typescript
855
- * const css = generateCSSVariablesForSelector(
856
- * tokens,
857
- * '[data-theme="dark"]',
858
- * 'atomix'
859
- * );
860
- * ```
861
- */
862
- declare function generateCSSVariablesForSelector(tokens: DesignTokens, selector: string, prefix?: string): string;
863
-
864
- /**
865
- * Core Theme Functions
866
- *
867
- * Simplified theme system that handles both DesignTokens and Theme objects.
868
- * Config-first approach: loads from atomix.config.ts when no input is provided.
869
- * Config file is required for automatic loading.
870
- */
871
-
872
- /**
873
- * Create theme CSS from tokens or Theme object
874
- *
875
- * **Config-First Approach**: If no input is provided, loads from `atomix.config.ts`.
876
- * Config file is required for automatic loading.
877
- *
878
- * @param input - DesignTokens (partial), Theme object, or undefined (loads from config)
879
- * @param options - CSS generation options (prefix is automatically read from config if not provided)
880
- * @returns CSS string with custom properties
881
- * @throws Error if config loading fails when no input is provided
882
- *
883
- * @example
884
- * ```typescript
885
- * // Loads from atomix.config.ts (config file required)
886
- * const css = createTheme();
887
- *
888
- * // Using DesignTokens
889
- * const css = createTheme({
890
- * 'primary': '#7c3aed',
891
- * 'spacing-4': '1rem',
892
- * });
893
- *
894
- * // Using Theme object
895
- * const theme = createThemeObject({ palette: { primary: { main: '#7c3aed' } } });
896
- * const css = createTheme(theme);
897
- *
898
- * // With custom options
899
- * const css = createTheme(undefined, { prefix: 'myapp', selector: ':root' });
900
- * ```
901
- */
902
- declare function createTheme(input?: Partial<DesignTokens> | Theme, options?: GenerateCSSVariablesOptions): string;
903
-
904
- /**
905
- * createThemeObject - Create a theme object with computed values
906
- *
907
- * Similar to Material-UI's createTheme, this function accepts theme configuration
908
- * options and returns a complete theme object with computed values.
909
- *
910
- * NOTE: For most use cases, use the simple theme system's `createTheme` instead,
911
- * which generates CSS from DesignTokens. This function is for advanced use cases
912
- * that need the full Theme object structure.
913
- *
914
- * @example
915
- * ```typescript
916
- * const theme = createThemeObject({
917
- * palette: {
918
- * primary: { main: '#7AFFD7' },
919
- * secondary: { main: '#FF5733' },
920
- * },
921
- * typography: {
922
- * fontFamily: 'Inter, sans-serif',
923
- * },
924
- * });
925
- * ```
926
- */
927
-
928
- /**
929
- * Create a theme object with computed values
930
- *
931
- * @param options - Theme configuration options
932
- * @returns Complete theme object
933
- */
934
- declare function createThemeObject(...options: ThemeOptions[]): Theme;
935
-
936
- /**
937
- * Theme Composition Utilities
938
- *
939
- * Simplified utilities for composing, merging, and extending themes.
940
- */
941
-
942
- /**
943
- * Deep merge multiple objects
944
- * Later objects override earlier ones
945
- */
946
- declare function deepMerge<T extends Record<string, unknown>>(...objects: Partial<T>[]): T;
947
- /**
948
- * Merge multiple theme options into a single theme options object
949
- *
950
- * @param themes - Theme options to merge
951
- * @returns Merged theme options
952
- *
953
- * @example
954
- * ```typescript
955
- * const baseTheme = { palette: { primary: { main: '#000' } } };
956
- * const customTheme = { palette: { secondary: { main: '#fff' } } };
957
- * const merged = mergeTheme(baseTheme, customTheme);
958
- * ```
959
- */
960
- declare function mergeTheme(...themes: ThemeOptions[]): ThemeOptions;
961
- /**
962
- * Extend an existing theme with new options
963
- *
964
- * @param baseTheme - Base theme to extend (can be Theme or ThemeOptions)
965
- * @param extension - Theme options to extend with
966
- * @returns New theme with extended options
967
- *
968
- * @example
969
- * ```typescript
970
- * const base = createTheme({ palette: { primary: { main: '#000' } } });
971
- * const extended = extendTheme(base, {
972
- * palette: { secondary: { main: '#fff' } }
973
- * });
974
- * ```
975
- */
976
- declare function extendTheme(baseTheme: Theme | ThemeOptions, extension: ThemeOptions): Theme;
977
-
978
- /**
979
- * Theme Metadata interface
980
- */
981
- interface ThemeMetadata {
982
- name: string;
983
- class: string;
984
- description?: string;
985
- version?: string;
986
- [key: string]: any;
987
- }
988
- /**
989
- * Theme Registry type - a record of theme IDs to metadata
990
- */
991
- type ThemeRegistry = Record<string, ThemeMetadata>;
992
- /**
993
- * Create a new theme registry
994
- */
995
- declare function createThemeRegistry(): ThemeRegistry;
996
- /**
997
- * Register a theme
998
- * @param registry - Theme registry object
999
- * @param id - Theme identifier
1000
- * @param metadata - Theme metadata
1001
- */
1002
- declare function registerTheme(registry: ThemeRegistry, id: string, metadata: ThemeMetadata): void;
1003
- /**
1004
- * Unregister a theme
1005
- * @param registry - Theme registry object
1006
- * @param id - Theme identifier
1007
- */
1008
- declare function unregisterTheme(registry: ThemeRegistry, id: string): boolean;
1009
- /**
1010
- * Check if a theme is registered
1011
- * @param registry - Theme registry object
1012
- * @param id - Theme identifier
1013
- */
1014
- declare function hasTheme(registry: ThemeRegistry, id: string): boolean;
1015
- /**
1016
- * Get theme metadata
1017
- * @param registry - Theme registry object
1018
- * @param id - Theme identifier
1019
- */
1020
- declare function getTheme(registry: ThemeRegistry, id: string): ThemeMetadata | undefined;
1021
- /**
1022
- * Get all registered theme metadata
1023
- * @param registry - Theme registry object
1024
- */
1025
- declare function getAllThemes(registry: ThemeRegistry): ThemeMetadata[];
1026
- /**
1027
- * Get all registered theme IDs
1028
- * @param registry - Theme registry object
1029
- */
1030
- declare function getThemeIds(registry: ThemeRegistry): string[];
1031
- /**
1032
- * Clear all registered themes
1033
- * @param registry - Theme registry object
1034
- */
1035
- declare function clearThemes(registry: ThemeRegistry): void;
1036
- /**
1037
- * Get the number of registered themes
1038
- * @param registry - Theme registry object
1039
- */
1040
- declare function getThemeCount(registry: ThemeRegistry): number;
1041
-
1042
937
  /**
1043
938
  * Naming Utilities
1044
939
  *
@@ -1075,13 +970,14 @@ declare function themePropertyToCSSVar(propertyPath: string, prefix?: string): s
1075
970
  * Component Theming Utilities
1076
971
  *
1077
972
  * Provides consistent patterns for applying theme values to components
973
+ * using DesignTokens and CSS variables
1078
974
  */
1079
975
 
1080
976
  interface ComponentThemeOptions {
1081
977
  component: string;
1082
978
  variant?: string;
1083
979
  size?: string;
1084
- theme: Theme;
980
+ tokens?: Partial<DesignTokens>;
1085
981
  }
1086
982
  /**
1087
983
  * Get a theme value for a specific component using CSS variables
@@ -1089,17 +985,17 @@ interface ComponentThemeOptions {
1089
985
  */
1090
986
  declare function getComponentThemeValue(component: string, property: string, variant?: string, size?: string): string;
1091
987
  /**
1092
- * Generate component-specific CSS variables from theme
988
+ * Generate component-specific CSS variables from DesignTokens
1093
989
  */
1094
- declare function generateComponentCSSVars(component: string, theme: Theme, variant?: string, size?: string): Record<string, string>;
990
+ declare function generateComponentCSSVars(component: string, tokens?: Partial<DesignTokens>, variant?: string, size?: string): Record<string, string>;
1095
991
  /**
1096
- * Apply consistent theme to component style object
992
+ * Apply consistent theme to component style object using DesignTokens
1097
993
  */
1098
- declare function applyComponentTheme(component: string, style?: React.CSSProperties, variant?: string, size?: string, theme?: Theme): React.CSSProperties;
994
+ declare function applyComponentTheme(component: string, style?: React.CSSProperties, variant?: string, size?: string, tokens?: Partial<DesignTokens>): React.CSSProperties;
1099
995
  /**
1100
996
  * Create a hook for consistent component theming
1101
997
  */
1102
- declare function useComponentTheme(component: string, variant?: string, size?: string, theme?: Theme): (property: string) => string;
998
+ declare function useComponentTheme(component: string, variant?: string, size?: string, tokens?: Partial<DesignTokens>): (property: string) => string;
1103
999
 
1104
1000
  /**
1105
1001
  * CSS Injection Utilities
@@ -1187,7 +1083,7 @@ declare function loadThemeFromConfig(options?: {
1187
1083
  * React context provider for theme management with separated concerns.
1188
1084
  * Simplified version focusing on core functionality:
1189
1085
  * - String-based themes (CSS files)
1190
- * - JS Theme objects
1086
+ * - DesignTokens (dynamic themes)
1191
1087
  * - Persistence via localStorage
1192
1088
  *
1193
1089
  * Falls back to 'default' theme if no configuration is found.
@@ -1226,14 +1122,13 @@ declare function useTheme(): UseThemeReturn;
1226
1122
  /**
1227
1123
  * Standardized hook for accessing theme tokens in components
1228
1124
  *
1229
- * Provides consistent access to theme values across all components
1230
- * using either CSS custom properties or theme object values.
1125
+ * Provides consistent access to theme values using CSS custom properties
1126
+ * and DesignTokens.
1231
1127
  */
1232
1128
  type ThemeTokens = {
1233
1129
  theme: string;
1234
- activeTheme: Theme | null;
1130
+ activeTokens: DesignTokens | null;
1235
1131
  getToken: (tokenName: string, fallback?: string) => string;
1236
- getThemeValue: (path: string, fallback?: any) => any;
1237
1132
  colors: {
1238
1133
  primary: string;
1239
1134
  secondary: string;
@@ -1328,35 +1223,16 @@ declare class ThemeApplicator {
1328
1223
  private styleId;
1329
1224
  constructor(root?: HTMLElement);
1330
1225
  /**
1331
- * Apply a complete theme configuration
1226
+ * Apply a complete theme configuration using DesignTokens
1332
1227
  *
1333
- * Uses the unified theme system to convert Theme to DesignTokens and inject CSS.
1228
+ * Uses the unified theme system to generate and inject CSS.
1334
1229
  * Automatically respects atomix.config.ts when using DesignTokens.
1335
1230
  */
1336
- applyTheme(theme: Theme | DesignTokens): void;
1337
- /**
1338
- * Apply DesignTokens using unified theme system
1339
- *
1340
- * Uses createTheme() which automatically loads from atomix.config.ts
1341
- * if no tokens are provided, ensuring config is always respected.
1342
- */
1343
- private applyDesignTokens;
1231
+ applyTheme(tokens: Partial<DesignTokens>): void;
1344
1232
  /**
1345
- * Check if object is DesignTokens
1346
- */
1347
- private isDesignTokens;
1348
- /**
1349
- * Apply global CSS variables (for component overrides)
1233
+ * Apply global CSS variables
1350
1234
  */
1351
1235
  private applyGlobalCSSVars;
1352
- /**
1353
- * Apply component-level overrides
1354
- */
1355
- private applyComponentOverrides;
1356
- /**
1357
- * Apply override for a specific component
1358
- */
1359
- private applyComponentOverride;
1360
1236
  /**
1361
1237
  * Clear all applied CSS variables
1362
1238
  */
@@ -1377,7 +1253,7 @@ declare function getThemeApplicator(): ThemeApplicator;
1377
1253
  /**
1378
1254
  * Apply theme using global applicator
1379
1255
  */
1380
- declare function applyTheme(theme: Theme | DesignTokens): void;
1256
+ declare function applyTheme(tokens: Partial<DesignTokens>): void;
1381
1257
 
1382
1258
  /**
1383
1259
  * Theme Preview Component
@@ -1546,7 +1422,7 @@ declare class ThemeValidator {
1546
1422
  /**
1547
1423
  * Validate theme
1548
1424
  */
1549
- validate(theme: Theme, metadata?: ThemeMetadata$1): ValidationResult;
1425
+ validate(theme: Theme, metadata?: ThemeMetadata): ValidationResult;
1550
1426
  /**
1551
1427
  * Validate palette
1552
1428
  */
@@ -1642,22 +1518,6 @@ declare function useHistory<T>(options?: UseHistoryOptions): UseHistoryReturn<T>
1642
1518
  * Converts between Theme objects and DesignTokens.
1643
1519
  */
1644
1520
 
1645
- /**
1646
- * Convert Theme object to DesignTokens
1647
- *
1648
- * Extracts values from a Theme object and converts them to flat DesignTokens format.
1649
- *
1650
- * @param theme - Theme object to convert
1651
- * @returns Partial DesignTokens object
1652
- *
1653
- * @example
1654
- * ```typescript
1655
- * const theme = createTheme({ palette: { primary: { main: '#7c3aed' } } });
1656
- * const tokens = themeToDesignTokens(theme);
1657
- * // Returns: { 'primary': '#7c3aed', ... }
1658
- * ```
1659
- */
1660
- declare function themeToDesignTokens(theme: Theme): Partial<DesignTokens>;
1661
1521
  /**
1662
1522
  * Convert DesignTokens to Theme-compatible CSS variables
1663
1523
  *
@@ -1665,22 +1525,6 @@ declare function themeToDesignTokens(theme: Theme): Partial<DesignTokens>;
1665
1525
  * @returns CSS variables object compatible with Theme.cssVars
1666
1526
  */
1667
1527
  declare function designTokensToCSSVars(tokens: Partial<DesignTokens>): Record<string, string>;
1668
- /**
1669
- * Create DesignTokens from Theme with defaults
1670
- *
1671
- * Converts a Theme to DesignTokens and merges with default tokens.
1672
- *
1673
- * @param theme - Theme object to convert
1674
- * @returns Complete DesignTokens object
1675
- */
1676
- declare function createDesignTokensFromTheme(theme: Theme): DesignTokens;
1677
- /**
1678
- * Create a minimal Theme object from DesignTokens
1679
- *
1680
- * @param tokens - DesignTokens to convert
1681
- * @returns Minimal Theme object with cssVars populated
1682
- */
1683
- declare function designTokensToTheme(tokens: Partial<DesignTokens>): Partial<Theme>;
1684
1528
 
1685
1529
  /**
1686
1530
  * CSS Variable Mapper
@@ -1726,8 +1570,8 @@ declare function mapSCSSTokensToCSSVars(tokens: Record<string, any>, options?: C
1726
1570
  /**
1727
1571
  * Apply CSS variables to an element
1728
1572
  *
1729
- * @param element - Target element (defaults to document.documentElement)
1730
1573
  * @param vars - CSS variables to apply
1574
+ * @param element - Target element (defaults to document.documentElement)
1731
1575
  */
1732
1576
  declare function applyCSSVariables(vars: Record<string, string | number>, element?: HTMLElement): void;
1733
1577
  /**
@@ -1775,27 +1619,9 @@ declare function extractComponentName(varName: string, prefix?: string): string
1775
1619
  /**
1776
1620
  * Theme Helper Functions
1777
1621
  *
1778
- * Utility functions for working with themes and DesignTokens
1622
+ * Utility functions for working with DesignTokens
1779
1623
  */
1780
1624
 
1781
- /**
1782
- * Get DesignTokens from current theme
1783
- *
1784
- * Converts a Theme object to DesignTokens. Useful when you need to
1785
- * work with DesignTokens but have a Theme object.
1786
- *
1787
- * @param theme - Theme object to convert
1788
- * @returns DesignTokens object
1789
- *
1790
- * @example
1791
- * ```typescript
1792
- * // If you have a Theme object, convert it to DesignTokens
1793
- * const tokens = getDesignTokensFromTheme(theme);
1794
- * // Now you can use tokens with unified theme system
1795
- * const css = createTheme(tokens);
1796
- * ```
1797
- */
1798
- declare function getDesignTokensFromTheme(theme: Theme | null): DesignTokens | null;
1799
1625
  /**
1800
1626
  * Check if a value is DesignTokens
1801
1627
  *
@@ -1805,15 +1631,6 @@ declare function getDesignTokensFromTheme(theme: Theme | null): DesignTokens | n
1805
1631
  * @returns True if value is DesignTokens
1806
1632
  */
1807
1633
  declare function isDesignTokens(value: unknown): value is DesignTokens;
1808
- /**
1809
- * Check if a value is a Theme object
1810
- *
1811
- * Type guard to check if an object is a Theme.
1812
- *
1813
- * @param value - Value to check
1814
- * @returns True if value is Theme
1815
- */
1816
- declare function isThemeObject(value: unknown): value is Theme;
1817
1634
 
1818
1635
  /**
1819
1636
  * RTL (Right-to-Left) Support Utilities
@@ -1917,13 +1734,13 @@ declare class RTLManager {
1917
1734
  /**
1918
1735
  * Theme System Exports
1919
1736
  *
1920
- * Unified theme system - handles both DesignTokens and Theme objects.
1737
+ * Simplified theme system using DesignTokens only.
1921
1738
  *
1922
1739
  * @example
1923
1740
  * ```typescript
1924
1741
  * import { createTheme, injectTheme } from '@shohojdhara/atomix/theme';
1925
1742
  *
1926
- * // Using DesignTokens (recommended - flat structure)
1743
+ * // Using DesignTokens
1927
1744
  * const css = createTheme({ 'primary': '#7AFFD7', 'spacing-4': '1rem' });
1928
1745
  * injectTheme(css);
1929
1746
  *
@@ -1947,5 +1764,5 @@ declare function removeTheme(id?: string): void;
1947
1764
  */
1948
1765
  declare function saveTheme(css: string, filePath: string): Promise<void>;
1949
1766
 
1950
- export { RTLManager, ThemeApplicator, ThemeComparator, ThemeContext, ThemeErrorBoundary, ThemeInspector, ThemeLiveEditor, ThemePreview, ThemeProvider, ThemeValidator, applyCSSVariables, applyComponentTheme, applyTheme, camelToKebab, clearThemes, createDesignTokensFromTheme, createTheme, createThemeObject, createThemeRegistry, createTokens, cssVarsToStyle, deepMerge, defaultTokens, designTokensToCSSVars, designTokensToTheme, extendTheme, extractComponentName, generateCSSVariableName, generateCSSVariables, generateCSSVariablesForSelector, generateClassName, generateComponentCSSVars, getAllThemes, getCSSVariable, getComponentThemeValue, getDesignTokensFromTheme, getTheme, getThemeApplicator, getThemeCount, getThemeIds, hasTheme, injectCSS, injectTheme, isCSSInjected, isDesignTokens, isThemeObject, isValidCSSVariableName, loadThemeFromConfig, loadThemeFromConfigSync, mapSCSSTokensToCSSVars, mergeCSSVars, mergeTheme, normalizeThemeTokens, registerTheme, removeCSS, removeCSSVariables, removeTheme, saveTheme, themePropertyToCSSVar, themeToDesignTokens, unregisterTheme, useComponentTheme, useHistory, useTheme, useThemeTokens };
1767
+ export { 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, loadThemeFromConfig, loadThemeFromConfigSync, mapSCSSTokensToCSSVars, mergeCSSVars, mergeTheme, normalizeThemeTokens, registerTheme, removeCSS, removeCSSVariables, removeTheme, saveTheme, themePropertyToCSSVar, unregisterTheme, useComponentTheme, useHistory, useTheme, useThemeTokens };
1951
1768
  export type { A11yIssue, CSSVariableConfig, CSSVariableNamingOptions, ComponentThemeOptions, ComponentThemeOverride, DesignTokens, GenerateCSSVariablesOptions, NamingOptions, RTLConfig, Theme, ThemeChangeEvent, ThemeComparatorProps, ThemeComponentOverrides, ThemeContextValue, ThemeErrorBoundaryProps, ThemeInspectorProps, ThemeLiveEditorProps, ThemeLoadOptions, ThemePreviewProps, ThemeProviderProps, ThemeValidationResult, UseHistoryOptions, UseHistoryReturn, UseThemeReturn, ValidationResult };