@shohojdhara/atomix 0.3.6 → 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.
- package/README.md +3 -3
- package/dist/atomix.css +77 -0
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +77 -0
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.js +50 -142
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +2 -2
- package/dist/core.js +179 -274
- package/dist/core.js.map +1 -1
- package/dist/forms.js +50 -142
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +179 -274
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1255 -1226
- package/dist/index.esm.js +2806 -2958
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3113 -3269
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.d.ts +313 -667
- package/dist/theme.js +1818 -2589
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +128 -356
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +1 -1
- package/src/components/Button/Button.tsx +85 -167
- package/src/components/DataTable/DataTable.stories.tsx +238 -0
- package/src/components/DataTable/DataTable.test.tsx +450 -0
- package/src/components/DataTable/DataTable.tsx +384 -61
- package/src/components/DatePicker/DatePicker.tsx +29 -38
- package/src/components/Upload/Upload.tsx +539 -40
- package/src/lib/composables/useAtomixGlass.ts +7 -7
- package/src/lib/composables/useDataTable.ts +355 -15
- package/src/lib/composables/useDatePicker.ts +19 -0
- package/src/lib/config/loader.ts +2 -3
- package/src/lib/constants/components.ts +17 -0
- package/src/lib/hooks/usePerformanceMonitor.ts +1 -1
- package/src/lib/theme/adapters/cssVariableMapper.ts +29 -14
- package/src/lib/theme/adapters/index.ts +1 -4
- package/src/lib/theme/config/configLoader.ts +82 -223
- package/src/lib/theme/config/loader.ts +15 -21
- package/src/lib/theme/constants/constants.ts +1 -1
- package/src/lib/theme/core/ThemeRegistry.ts +75 -279
- package/src/lib/theme/core/composeTheme.ts +30 -88
- package/src/lib/theme/core/createTheme.ts +88 -51
- package/src/lib/theme/core/createThemeObject.ts +2 -2
- package/src/lib/theme/core/index.ts +15 -2
- package/src/lib/theme/errors/errors.ts +1 -1
- package/src/lib/theme/generators/generateCSSNested.ts +131 -0
- package/src/lib/theme/generators/generateCSSVariables.ts +24 -16
- package/src/lib/theme/generators/index.ts +6 -0
- package/src/lib/theme/index.ts +45 -27
- package/src/lib/theme/runtime/ThemeApplicator.ts +6 -109
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +1 -1
- package/src/lib/theme/runtime/ThemeProvider.tsx +393 -544
- package/src/lib/theme/runtime/index.ts +1 -0
- package/src/lib/theme/runtime/useTheme.ts +1 -1
- package/src/lib/theme/runtime/useThemeTokens.ts +122 -0
- package/src/lib/theme/test/testTheme.ts +2 -1
- package/src/lib/theme/types.ts +14 -14
- package/src/lib/theme/utils/componentTheming.ts +140 -0
- package/src/lib/theme/utils/domUtils.ts +57 -15
- package/src/lib/theme/utils/injectCSS.ts +0 -1
- package/src/lib/theme/utils/naming.ts +100 -0
- package/src/lib/theme/utils/themeHelpers.ts +1 -39
- package/src/lib/theme/utils/themeUtils.ts +1 -170
- package/src/lib/types/components.ts +145 -0
- package/src/lib/utils/componentUtils.ts +1 -1
- package/src/lib/utils/dataTableExport.ts +143 -0
- package/src/lib/utils/memoryMonitor.ts +3 -3
- package/src/lib/utils/themeNaming.ts +135 -0
- package/src/styles/06-components/_components.data-table.scss +95 -0
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* Uses the unified theme system for CSS generation and injection.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { Theme, ThemeComponentOverrides, ComponentThemeOverride } from '../types';
|
|
11
10
|
import type { DesignTokens } from '../tokens/tokens';
|
|
12
11
|
import { createTheme } from '../core/createTheme';
|
|
13
12
|
import { injectCSS, removeCSS } from '../utils/injectCSS';
|
|
@@ -26,42 +25,15 @@ export class ThemeApplicator {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
|
-
* Apply a complete theme configuration
|
|
28
|
+
* Apply a complete theme configuration using DesignTokens
|
|
30
29
|
*
|
|
31
|
-
* Uses the unified theme system to
|
|
30
|
+
* Uses the unified theme system to generate and inject CSS.
|
|
32
31
|
* Automatically respects atomix.config.ts when using DesignTokens.
|
|
33
32
|
*/
|
|
34
|
-
applyTheme(
|
|
33
|
+
applyTheme(tokens: Partial<DesignTokens>): void {
|
|
35
34
|
// Clear previously applied variables
|
|
36
35
|
this.clearAppliedVars();
|
|
37
36
|
|
|
38
|
-
// Check if it's DesignTokens
|
|
39
|
-
if (this.isDesignTokens(theme)) {
|
|
40
|
-
// Direct DesignTokens - use unified theme system (with config support)
|
|
41
|
-
this.applyDesignTokens(theme);
|
|
42
|
-
} else {
|
|
43
|
-
// Theme object - use createTheme which handles Theme objects
|
|
44
|
-
// createTheme automatically converts Theme to DesignTokens internally
|
|
45
|
-
const css = createTheme(theme, {
|
|
46
|
-
selector: ':root',
|
|
47
|
-
prefix: 'atomix',
|
|
48
|
-
});
|
|
49
|
-
injectCSS(css, this.styleId);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Apply component overrides (only for Theme objects)
|
|
53
|
-
if (!this.isDesignTokens(theme) && (theme as any).components) {
|
|
54
|
-
this.applyComponentOverrides((theme as any).components);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Apply DesignTokens using unified theme system
|
|
60
|
-
*
|
|
61
|
-
* Uses createTheme() which automatically loads from atomix.config.ts
|
|
62
|
-
* if no tokens are provided, ensuring config is always respected.
|
|
63
|
-
*/
|
|
64
|
-
private applyDesignTokens(tokens: Partial<DesignTokens>): void {
|
|
65
37
|
// Use createTheme() which handles config loading automatically
|
|
66
38
|
// If tokens is empty, it will load from config
|
|
67
39
|
const css = createTheme(tokens, {
|
|
@@ -74,19 +46,7 @@ export class ThemeApplicator {
|
|
|
74
46
|
}
|
|
75
47
|
|
|
76
48
|
/**
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
|
-
private isDesignTokens(obj: Theme | DesignTokens): obj is DesignTokens {
|
|
80
|
-
// DesignTokens is a flat object with string keys, no nested structures
|
|
81
|
-
return obj !== null &&
|
|
82
|
-
typeof obj === 'object' &&
|
|
83
|
-
!('palette' in obj) &&
|
|
84
|
-
!('typography' in obj) &&
|
|
85
|
-
!('__isJSTheme' in obj);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Apply global CSS variables (for component overrides)
|
|
49
|
+
* Apply global CSS variables
|
|
90
50
|
*/
|
|
91
51
|
private applyGlobalCSSVars(vars: Record<string, string | number>): void {
|
|
92
52
|
Object.entries(vars).forEach(([key, value]) => {
|
|
@@ -94,69 +54,6 @@ export class ThemeApplicator {
|
|
|
94
54
|
});
|
|
95
55
|
}
|
|
96
56
|
|
|
97
|
-
/**
|
|
98
|
-
* Apply component-level overrides
|
|
99
|
-
*/
|
|
100
|
-
private applyComponentOverrides(overrides: ThemeComponentOverrides): void {
|
|
101
|
-
Object.entries(overrides).forEach(([componentName, override]) => {
|
|
102
|
-
if (override) {
|
|
103
|
-
this.applyComponentOverride(componentName, override);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Apply override for a specific component
|
|
110
|
-
*/
|
|
111
|
-
private applyComponentOverride(
|
|
112
|
-
componentName: string,
|
|
113
|
-
override: ComponentThemeOverride
|
|
114
|
-
): void {
|
|
115
|
-
const vars: Record<string, string | number> = {};
|
|
116
|
-
const componentKey = componentName.toLowerCase();
|
|
117
|
-
|
|
118
|
-
// Apply component-level CSS variables
|
|
119
|
-
if (override.cssVars) {
|
|
120
|
-
Object.entries(override.cssVars).forEach(([key, value]) => {
|
|
121
|
-
// If key doesn't start with --, add component prefix
|
|
122
|
-
const varKey = key.startsWith('--')
|
|
123
|
-
? key
|
|
124
|
-
: `--atomix-${componentKey}-${key}`;
|
|
125
|
-
vars[varKey] = value;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Apply part-specific CSS variables
|
|
130
|
-
if (override.parts) {
|
|
131
|
-
Object.entries(override.parts).forEach(([partName, partOverride]) => {
|
|
132
|
-
if (partOverride.cssVars) {
|
|
133
|
-
Object.entries(partOverride.cssVars).forEach(([key, value]) => {
|
|
134
|
-
const varKey = key.startsWith('--')
|
|
135
|
-
? key
|
|
136
|
-
: `--atomix-${componentKey}-${partName}-${key}`;
|
|
137
|
-
vars[varKey] = value;
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Apply variant-specific CSS variables
|
|
144
|
-
if (override.variants) {
|
|
145
|
-
Object.entries(override.variants).forEach(([variantName, variantOverride]) => {
|
|
146
|
-
if (variantOverride.cssVars) {
|
|
147
|
-
Object.entries(variantOverride.cssVars).forEach(([key, value]) => {
|
|
148
|
-
const varKey = key.startsWith('--')
|
|
149
|
-
? key
|
|
150
|
-
: `--atomix-${componentKey}-${variantName}-${key}`;
|
|
151
|
-
vars[varKey] = value;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
this.applyGlobalCSSVars(vars);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
57
|
/**
|
|
161
58
|
* Clear all applied CSS variables
|
|
162
59
|
*/
|
|
@@ -198,8 +95,8 @@ export function getThemeApplicator(): ThemeApplicator {
|
|
|
198
95
|
/**
|
|
199
96
|
* Apply theme using global applicator
|
|
200
97
|
*/
|
|
201
|
-
export function applyTheme(
|
|
202
|
-
getThemeApplicator().applyTheme(
|
|
98
|
+
export function applyTheme(tokens: Partial<DesignTokens>): void {
|
|
99
|
+
getThemeApplicator().applyTheme(tokens);
|
|
203
100
|
}
|
|
204
101
|
|
|
205
102
|
/**
|
|
@@ -83,7 +83,7 @@ const DefaultFallback: React.FC<{ error: Error; errorInfo: ErrorInfo }> = ({ err
|
|
|
83
83
|
</pre>
|
|
84
84
|
</details>
|
|
85
85
|
)}
|
|
86
|
-
{process.env
|
|
86
|
+
{(typeof process === 'undefined' || process.env?.NODE_ENV === 'development') && errorInfo && (
|
|
87
87
|
<details style={{ marginTop: '1rem' }}>
|
|
88
88
|
<summary style={{ cursor: 'pointer', fontWeight: 'bold' }}>
|
|
89
89
|
Stack Trace (Development Only)
|