shru-design-system 0.0.1

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.
@@ -0,0 +1,118 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import * as src from 'src';
4
+
5
+ interface ThemeToggleProps {
6
+ className?: string;
7
+ position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
8
+ }
9
+ declare function ThemeToggle({ className, position }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
10
+
11
+ type ThemeSelection = {
12
+ color?: string;
13
+ typography?: string;
14
+ shape?: string;
15
+ density?: string;
16
+ animation?: string;
17
+ custom?: string;
18
+ };
19
+ type ThemeMetadata = {
20
+ name: string;
21
+ file: string;
22
+ icon: string;
23
+ description: string;
24
+ };
25
+ /**
26
+ * Hook for managing design system theme switching
27
+ */
28
+ declare function useTheme(): {
29
+ selectedThemes: ThemeSelection;
30
+ updateTheme: (category: keyof ThemeSelection, themeId: string | undefined) => Promise<void>;
31
+ resetToDefaults: () => Promise<void>;
32
+ isLoading: boolean;
33
+ error: string | null;
34
+ getAvailableThemes: (category: string) => Promise<Record<string, ThemeMetadata>>;
35
+ };
36
+
37
+ declare function useThemeToggle(): {
38
+ selectedThemes: ThemeSelection;
39
+ isLoading: boolean;
40
+ getAvailableThemes: (category: string) => Promise<Record<string, src.ThemeMetadata>>;
41
+ isOpen: boolean;
42
+ selectedCategory: string | null;
43
+ themeCategories: any;
44
+ categories: [string, {
45
+ name: string;
46
+ themes: Record<string, any>;
47
+ order?: number;
48
+ }][];
49
+ menuRef: react.RefObject<HTMLDivElement | null>;
50
+ handleCategoryClick: (categoryKey: string) => void;
51
+ handleThemeSelect: (category: keyof ThemeSelection, themeId: string) => Promise<void>;
52
+ handleBack: () => void;
53
+ toggleMenu: () => void;
54
+ };
55
+
56
+ /**
57
+ * Register a custom theme dynamically
58
+ * Allows users to add themes without modifying the base config
59
+ * @param {string} category - Theme category (e.g., 'color', 'custom')
60
+ * @param {string} themeId - Unique theme identifier
61
+ * @param {Object} metadata - Theme metadata
62
+ * @param {string} metadata.name - Display name
63
+ * @param {string} metadata.file - File path relative to themes/ (e.g., 'color/blue.json')
64
+ * @param {string} [metadata.icon] - Icon emoji or character
65
+ * @param {string} [metadata.description] - Theme description
66
+ */
67
+ declare function registerTheme(category: string, themeId: string, metadata: {
68
+ name: string;
69
+ file: string;
70
+ icon?: string | undefined;
71
+ description?: string | undefined;
72
+ }): any;
73
+ /**
74
+ * Get merged theme categories (base + discovered)
75
+ */
76
+ declare function getThemeCategories(): Promise<any>;
77
+ /**
78
+ * Get theme file path
79
+ */
80
+ declare function getThemeFilePath(category: any, themeId: any): string | null;
81
+ /**
82
+ * Get all themes for a category
83
+ */
84
+ declare function getThemesForCategory(category: any): Promise<any>;
85
+ /**
86
+ * Get theme by ID
87
+ */
88
+ declare function getTheme(category: any, themeId: any): Promise<any>;
89
+
90
+ /**
91
+ * Discover themes by attempting to load token files
92
+ * Scans common theme patterns and registers them if found
93
+ */
94
+ declare function discoverTokenFiles(): Promise<{
95
+ category: string;
96
+ themeName: any;
97
+ path: string;
98
+ }[]>;
99
+ /**
100
+ * Scan a specific category directory for theme files
101
+ * Useful for discovering user-added themes
102
+ */
103
+ declare function scanCategory(category: any): Promise<{
104
+ category: any;
105
+ name: string;
106
+ path: string;
107
+ }[]>;
108
+ /**
109
+ * Register a theme from a token file
110
+ * Call this when you add a new token file to make it appear in ThemeToggle
111
+ */
112
+ declare function registerThemeFromFile(category: any, themeId: any, filePath: any): Promise<{
113
+ success: boolean;
114
+ themeId: any;
115
+ category: any;
116
+ }>;
117
+
118
+ export { type ThemeMetadata, type ThemeSelection, ThemeToggle, type ThemeToggleProps, discoverTokenFiles, getTheme, getThemeCategories, getThemeFilePath, getThemesForCategory, registerTheme, registerThemeFromFile, scanCategory, useTheme, useThemeToggle };
@@ -0,0 +1,118 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import * as src from 'src';
4
+
5
+ interface ThemeToggleProps {
6
+ className?: string;
7
+ position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
8
+ }
9
+ declare function ThemeToggle({ className, position }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
10
+
11
+ type ThemeSelection = {
12
+ color?: string;
13
+ typography?: string;
14
+ shape?: string;
15
+ density?: string;
16
+ animation?: string;
17
+ custom?: string;
18
+ };
19
+ type ThemeMetadata = {
20
+ name: string;
21
+ file: string;
22
+ icon: string;
23
+ description: string;
24
+ };
25
+ /**
26
+ * Hook for managing design system theme switching
27
+ */
28
+ declare function useTheme(): {
29
+ selectedThemes: ThemeSelection;
30
+ updateTheme: (category: keyof ThemeSelection, themeId: string | undefined) => Promise<void>;
31
+ resetToDefaults: () => Promise<void>;
32
+ isLoading: boolean;
33
+ error: string | null;
34
+ getAvailableThemes: (category: string) => Promise<Record<string, ThemeMetadata>>;
35
+ };
36
+
37
+ declare function useThemeToggle(): {
38
+ selectedThemes: ThemeSelection;
39
+ isLoading: boolean;
40
+ getAvailableThemes: (category: string) => Promise<Record<string, src.ThemeMetadata>>;
41
+ isOpen: boolean;
42
+ selectedCategory: string | null;
43
+ themeCategories: any;
44
+ categories: [string, {
45
+ name: string;
46
+ themes: Record<string, any>;
47
+ order?: number;
48
+ }][];
49
+ menuRef: react.RefObject<HTMLDivElement | null>;
50
+ handleCategoryClick: (categoryKey: string) => void;
51
+ handleThemeSelect: (category: keyof ThemeSelection, themeId: string) => Promise<void>;
52
+ handleBack: () => void;
53
+ toggleMenu: () => void;
54
+ };
55
+
56
+ /**
57
+ * Register a custom theme dynamically
58
+ * Allows users to add themes without modifying the base config
59
+ * @param {string} category - Theme category (e.g., 'color', 'custom')
60
+ * @param {string} themeId - Unique theme identifier
61
+ * @param {Object} metadata - Theme metadata
62
+ * @param {string} metadata.name - Display name
63
+ * @param {string} metadata.file - File path relative to themes/ (e.g., 'color/blue.json')
64
+ * @param {string} [metadata.icon] - Icon emoji or character
65
+ * @param {string} [metadata.description] - Theme description
66
+ */
67
+ declare function registerTheme(category: string, themeId: string, metadata: {
68
+ name: string;
69
+ file: string;
70
+ icon?: string | undefined;
71
+ description?: string | undefined;
72
+ }): any;
73
+ /**
74
+ * Get merged theme categories (base + discovered)
75
+ */
76
+ declare function getThemeCategories(): Promise<any>;
77
+ /**
78
+ * Get theme file path
79
+ */
80
+ declare function getThemeFilePath(category: any, themeId: any): string | null;
81
+ /**
82
+ * Get all themes for a category
83
+ */
84
+ declare function getThemesForCategory(category: any): Promise<any>;
85
+ /**
86
+ * Get theme by ID
87
+ */
88
+ declare function getTheme(category: any, themeId: any): Promise<any>;
89
+
90
+ /**
91
+ * Discover themes by attempting to load token files
92
+ * Scans common theme patterns and registers them if found
93
+ */
94
+ declare function discoverTokenFiles(): Promise<{
95
+ category: string;
96
+ themeName: any;
97
+ path: string;
98
+ }[]>;
99
+ /**
100
+ * Scan a specific category directory for theme files
101
+ * Useful for discovering user-added themes
102
+ */
103
+ declare function scanCategory(category: any): Promise<{
104
+ category: any;
105
+ name: string;
106
+ path: string;
107
+ }[]>;
108
+ /**
109
+ * Register a theme from a token file
110
+ * Call this when you add a new token file to make it appear in ThemeToggle
111
+ */
112
+ declare function registerThemeFromFile(category: any, themeId: any, filePath: any): Promise<{
113
+ success: boolean;
114
+ themeId: any;
115
+ category: any;
116
+ }>;
117
+
118
+ export { type ThemeMetadata, type ThemeSelection, ThemeToggle, type ThemeToggleProps, discoverTokenFiles, getTheme, getThemeCategories, getThemeFilePath, getThemesForCategory, registerTheme, registerThemeFromFile, scanCategory, useTheme, useThemeToggle };