@shohojdhara/atomix 0.3.0 → 0.3.2

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 (144) hide show
  1. package/CHANGELOG.md +0 -1
  2. package/README.md +3 -5
  3. package/dist/atomix.css +753 -643
  4. package/dist/atomix.min.css +3 -5
  5. package/dist/index.d.ts +3075 -247
  6. package/dist/index.esm.js +20412 -16601
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/index.js +20379 -16605
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.min.js +1 -1
  11. package/dist/index.min.js.map +1 -1
  12. package/package.json +1 -11
  13. package/src/components/AtomixGlass/AtomixGlass.test.tsx +21 -32
  14. package/src/components/AtomixGlass/AtomixGlass.tsx +55 -42
  15. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +205 -57
  16. package/src/components/AtomixGlass/GlassFilter.tsx +22 -8
  17. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +221 -0
  18. package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -3
  19. package/src/components/AtomixGlass/shader-utils.ts +8 -0
  20. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +319 -100
  21. package/src/components/AtomixGlass/stories/Examples.stories.tsx +601 -105
  22. package/src/components/AtomixGlass/stories/Modes.stories.tsx +30 -12
  23. package/src/components/AtomixGlass/stories/Playground.stories.tsx +173 -38
  24. package/src/components/AtomixGlass/stories/ShaderVariants.stories.tsx +18 -18
  25. package/src/components/AtomixGlass/stories/shared-components.tsx +27 -5
  26. package/src/components/Button/Button.tsx +62 -17
  27. package/src/components/Callout/Callout.test.tsx +8 -14
  28. package/src/components/Card/Card.tsx +103 -1
  29. package/src/components/Card/index.ts +3 -2
  30. package/src/components/Icon/index.ts +1 -1
  31. package/src/components/Modal/Modal.stories.tsx +29 -38
  32. package/src/components/Modal/Modal.tsx +4 -4
  33. package/src/components/Navigation/SideMenu/SideMenu.tsx +49 -41
  34. package/src/components/Navigation/SideMenu/SideMenuItem.tsx +63 -24
  35. package/src/components/Popover/Popover.tsx +1 -1
  36. package/src/components/VideoPlayer/VideoPlayer.stories.tsx +977 -400
  37. package/src/components/VideoPlayer/VideoPlayer.tsx +1 -6
  38. package/src/lib/composables/shared-mouse-tracker.ts +133 -0
  39. package/src/lib/composables/useAtomixGlass.ts +333 -145
  40. package/src/lib/index.ts +1 -4
  41. package/src/lib/theme/composeTheme.ts +375 -0
  42. package/src/lib/theme/config/index.ts +21 -0
  43. package/src/lib/theme/config/loader.ts +276 -0
  44. package/src/lib/theme/config/types.ts +98 -0
  45. package/src/lib/theme/config/validator.ts +326 -0
  46. package/src/lib/theme/constants.ts +183 -0
  47. package/src/lib/theme/core/ThemeCache.ts +283 -0
  48. package/src/lib/theme/core/ThemeEngine.test.ts +146 -0
  49. package/src/lib/theme/core/ThemeEngine.ts +657 -0
  50. package/src/lib/theme/core/ThemeRegistry.ts +284 -0
  51. package/src/lib/theme/core/ThemeValidator.ts +530 -0
  52. package/src/lib/theme/core/index.ts +24 -0
  53. package/src/lib/theme/createTheme.ts +521 -0
  54. package/src/lib/theme/devtools/CLI.ts +279 -0
  55. package/src/lib/theme/devtools/Inspector.tsx +594 -0
  56. package/src/lib/theme/devtools/Preview.tsx +392 -0
  57. package/src/lib/theme/devtools/index.ts +21 -0
  58. package/src/lib/theme/errors.test.ts +207 -0
  59. package/src/lib/theme/errors.ts +233 -0
  60. package/src/lib/theme/generateCSSVariables.ts +797 -0
  61. package/src/lib/theme/generators/CSSGenerator.ts +311 -0
  62. package/src/lib/theme/generators/ConfigGenerator.ts +287 -0
  63. package/src/lib/theme/generators/TypeGenerator.ts +228 -0
  64. package/src/lib/theme/generators/index.ts +21 -0
  65. package/src/lib/theme/i18n/index.ts +9 -0
  66. package/src/lib/theme/i18n/rtl.ts +325 -0
  67. package/src/lib/theme/index.ts +221 -10
  68. package/src/lib/theme/monitoring/ThemeAnalytics.ts +409 -0
  69. package/src/lib/theme/monitoring/index.ts +17 -0
  70. package/src/lib/theme/overrides/ComponentOverrides.ts +243 -0
  71. package/src/lib/theme/overrides/index.ts +15 -0
  72. package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +233 -0
  73. package/src/lib/theme/runtime/ThemeManager.test.ts +176 -0
  74. package/src/lib/theme/runtime/ThemeManager.ts +442 -0
  75. package/src/lib/theme/runtime/ThemeProvider.tsx +318 -0
  76. package/src/lib/theme/runtime/index.ts +17 -0
  77. package/src/lib/theme/runtime/useTheme.ts +52 -0
  78. package/src/lib/theme/studio/ThemeStudio.tsx +312 -0
  79. package/src/lib/theme/studio/index.ts +8 -0
  80. package/src/lib/theme/themeUtils.ts +333 -0
  81. package/src/lib/theme/types.ts +340 -9
  82. package/src/lib/theme/utils.ts +23 -22
  83. package/src/lib/theme/whitelabel/WhiteLabelManager.ts +364 -0
  84. package/src/lib/theme/whitelabel/index.ts +13 -0
  85. package/src/lib/types/components.ts +148 -59
  86. package/src/styles/01-settings/_index.scss +2 -2
  87. package/src/styles/01-settings/_settings.badge.scss +3 -3
  88. package/src/styles/01-settings/_settings.border-radius.scss +1 -1
  89. package/src/styles/01-settings/_settings.callout.scss +1 -1
  90. package/src/styles/01-settings/_settings.card.scss +1 -1
  91. package/src/styles/01-settings/{_settings.maps.scss → _settings.design-tokens.scss} +163 -49
  92. package/src/styles/01-settings/_settings.input.scss +1 -1
  93. package/src/styles/01-settings/_settings.modal.scss +1 -1
  94. package/src/styles/01-settings/_settings.navbar.scss +1 -1
  95. package/src/styles/01-settings/_settings.spacing.scss +14 -13
  96. package/src/styles/01-settings/_settings.upload.scss +1 -1
  97. package/src/styles/03-generic/_generic.root.scss +131 -50
  98. package/src/styles/05-objects/_objects.block.scss +1 -1
  99. package/src/styles/06-components/_components.atomix-glass.scss +20 -22
  100. package/src/styles/06-components/_components.badge.scss +2 -2
  101. package/src/styles/06-components/_components.button.scss +1 -1
  102. package/src/styles/06-components/_components.callout.scss +1 -1
  103. package/src/styles/06-components/_components.card.scss +74 -2
  104. package/src/styles/06-components/_components.chart.scss +3 -3
  105. package/src/styles/06-components/_components.dropdown.scss +6 -0
  106. package/src/styles/06-components/_components.footer.scss +1 -1
  107. package/src/styles/06-components/_components.list-group.scss +1 -1
  108. package/src/styles/06-components/_components.list.scss +1 -1
  109. package/src/styles/06-components/_components.menu.scss +1 -1
  110. package/src/styles/06-components/_components.messages.scss +1 -1
  111. package/src/styles/06-components/_components.modal.scss +7 -2
  112. package/src/styles/06-components/_components.navbar.scss +1 -1
  113. package/src/styles/06-components/_components.popover.scss +10 -0
  114. package/src/styles/06-components/_components.product-review.scss +1 -1
  115. package/src/styles/06-components/_components.progress.scss +1 -1
  116. package/src/styles/06-components/_components.rating.scss +1 -1
  117. package/src/styles/06-components/_components.spinner.scss +1 -1
  118. package/src/styles/99-utilities/_utilities.background.scss +1 -1
  119. package/src/styles/99-utilities/_utilities.border.scss +28 -59
  120. package/src/styles/99-utilities/_utilities.gradient.scss +12 -0
  121. package/src/styles/99-utilities/_utilities.link.scss +1 -1
  122. package/src/styles/99-utilities/_utilities.position.scss +8 -15
  123. package/src/styles/99-utilities/_utilities.scss +2 -0
  124. package/src/styles/99-utilities/_utilities.spacing.scss +76 -121
  125. package/src/styles/99-utilities/_utilities.text.scss +31 -50
  126. package/dist/themes/applemix.css +0 -15411
  127. package/dist/themes/applemix.min.css +0 -72
  128. package/dist/themes/boomdevs.css +0 -15001
  129. package/dist/themes/boomdevs.min.css +0 -405
  130. package/dist/themes/esrar.css +0 -17195
  131. package/dist/themes/esrar.min.css +0 -189
  132. package/dist/themes/flashtrade.css +0 -16408
  133. package/dist/themes/flashtrade.min.css +0 -192
  134. package/dist/themes/mashroom.css +0 -29900
  135. package/dist/themes/mashroom.min.css +0 -403
  136. package/dist/themes/shaj-default.css +0 -16024
  137. package/dist/themes/shaj-default.min.css +0 -500
  138. package/src/lib/theme/ThemeManager.stories.tsx +0 -472
  139. package/src/lib/theme/ThemeManager.test.ts +0 -186
  140. package/src/lib/theme/ThemeManager.ts +0 -501
  141. package/src/lib/theme/ThemeProvider.tsx +0 -227
  142. package/src/lib/theme/useTheme.test.tsx +0 -66
  143. package/src/lib/theme/useTheme.ts +0 -80
  144. package/src/lib/theme/utils.test.ts +0 -140
@@ -0,0 +1,284 @@
1
+ /**
2
+ * Theme Registry
3
+ *
4
+ * Central registry for all themes with discovery and dependency management
5
+ */
6
+
7
+ import type { Theme, ThemeMetadata } from '../types';
8
+ import type { ThemeDefinition, LoadedThemeConfig } from '../config/types';
9
+ import { loadThemeConfig } from '../config/loader';
10
+
11
+ /**
12
+ * Registry entry
13
+ */
14
+ interface RegistryEntry {
15
+ /** Theme ID */
16
+ id: string;
17
+ /** Theme definition from config */
18
+ definition: ThemeDefinition;
19
+ /** Resolved theme object (for JS themes) */
20
+ theme?: Theme;
21
+ /** Whether theme is loaded */
22
+ loaded: boolean;
23
+ /** Loading promise (if currently loading) */
24
+ loading?: Promise<Theme | void>;
25
+ /** Dependencies */
26
+ dependencies: string[];
27
+ /** Dependent themes (themes that depend on this one) */
28
+ dependents: string[];
29
+ }
30
+
31
+ /**
32
+ * Theme Registry
33
+ *
34
+ * Manages theme registration, discovery, and dependency resolution
35
+ */
36
+ export class ThemeRegistry {
37
+ private entries: Map<string, RegistryEntry> = new Map();
38
+ private config: LoadedThemeConfig | null = null;
39
+ private initialized: boolean = false;
40
+
41
+ /**
42
+ * Initialize registry from config
43
+ */
44
+ async initialize(config?: LoadedThemeConfig): Promise<void> {
45
+ if (this.initialized) {
46
+ return;
47
+ }
48
+
49
+ // Load config if not provided
50
+ if (!config) {
51
+ try {
52
+ this.config = loadThemeConfig();
53
+ } catch (error) {
54
+ // In browser environments, config loading will fail
55
+ // Use empty config as fallback
56
+ this.config = {
57
+ themes: {},
58
+ build: {
59
+ output: { directory: 'themes', formats: { expanded: '.css', compressed: '.min.css' } },
60
+ sass: { style: 'expanded', sourceMap: true, loadPaths: ['src'] },
61
+ },
62
+ runtime: {
63
+ basePath: '',
64
+ defaultTheme: undefined, // No default - use built-in styles
65
+ },
66
+ integration: {
67
+ cssVariables: { colorMode: '--color-mode' },
68
+ classNames: { theme: 'data-theme', colorMode: 'data-color-mode' },
69
+ },
70
+ dependencies: {},
71
+ validated: false,
72
+ errors: [],
73
+ warnings: [],
74
+ };
75
+ }
76
+ } else {
77
+ this.config = config;
78
+ }
79
+
80
+ // Register all themes from config
81
+ for (const [themeId, definition] of Object.entries(this.config.themes)) {
82
+ this.register(themeId, definition);
83
+ }
84
+
85
+ // Resolve dependencies
86
+ this.resolveDependencies();
87
+
88
+ this.initialized = true;
89
+ }
90
+
91
+ /**
92
+ * Register a theme
93
+ */
94
+ register(themeId: string, definition: ThemeDefinition): void {
95
+ // Get dependencies from config or definition
96
+ const dependencies =
97
+ this.config?.dependencies?.[themeId] ||
98
+ definition.dependencies ||
99
+ [];
100
+
101
+ const entry: RegistryEntry = {
102
+ id: themeId,
103
+ definition,
104
+ loaded: false,
105
+ dependencies: [...dependencies],
106
+ dependents: [],
107
+ };
108
+
109
+ this.entries.set(themeId, entry);
110
+ }
111
+
112
+ /**
113
+ * Get theme entry
114
+ */
115
+ get(themeId: string): RegistryEntry | undefined {
116
+ return this.entries.get(themeId);
117
+ }
118
+
119
+ /**
120
+ * Check if theme exists
121
+ */
122
+ has(themeId: string): boolean {
123
+ return this.entries.has(themeId);
124
+ }
125
+
126
+ /**
127
+ * Get all theme IDs
128
+ */
129
+ getAllIds(): string[] {
130
+ return Array.from(this.entries.keys());
131
+ }
132
+
133
+ /**
134
+ * Get all theme metadata
135
+ */
136
+ getAllMetadata(): ThemeMetadata[] {
137
+ return Array.from(this.entries.values()).map(entry => ({
138
+ id: entry.id,
139
+ name: entry.definition.name,
140
+ type: entry.definition.type,
141
+ class: entry.definition.class,
142
+ description: entry.definition.description,
143
+ author: entry.definition.author,
144
+ version: entry.definition.version,
145
+ tags: entry.definition.tags,
146
+ supportsDarkMode: entry.definition.supportsDarkMode,
147
+ status: entry.definition.status,
148
+ a11y: entry.definition.a11y,
149
+ color: entry.definition.color,
150
+ features: entry.definition.features,
151
+ dependencies: entry.dependencies,
152
+ }));
153
+ }
154
+
155
+ /**
156
+ * Get theme definition
157
+ */
158
+ getDefinition(themeId: string): ThemeDefinition | undefined {
159
+ return this.entries.get(themeId)?.definition;
160
+ }
161
+
162
+ /**
163
+ * Get theme object (for JS themes)
164
+ */
165
+ getTheme(themeId: string): Theme | undefined {
166
+ return this.entries.get(themeId)?.theme;
167
+ }
168
+
169
+ /**
170
+ * Set theme object (for JS themes)
171
+ */
172
+ setTheme(themeId: string, theme: Theme): void {
173
+ const entry = this.entries.get(themeId);
174
+ if (entry) {
175
+ entry.theme = theme;
176
+ entry.loaded = true;
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Get dependencies for a theme
182
+ */
183
+ getDependencies(themeId: string): string[] {
184
+ return this.entries.get(themeId)?.dependencies || [];
185
+ }
186
+
187
+ /**
188
+ * Get dependents for a theme (themes that depend on this one)
189
+ */
190
+ getDependents(themeId: string): string[] {
191
+ return this.entries.get(themeId)?.dependents || [];
192
+ }
193
+
194
+ /**
195
+ * Resolve all dependencies in correct order
196
+ */
197
+ resolveDependencyOrder(themeId: string): string[] {
198
+ const resolved: string[] = [];
199
+ const visited = new Set<string>();
200
+ const visiting = new Set<string>();
201
+
202
+ const visit = (id: string): void => {
203
+ if (visiting.has(id)) {
204
+ throw new Error(`Circular dependency detected involving theme: ${id}`);
205
+ }
206
+ if (visited.has(id)) {
207
+ return;
208
+ }
209
+
210
+ visiting.add(id);
211
+ const entry = this.entries.get(id);
212
+ if (entry) {
213
+ for (const dep of entry.dependencies) {
214
+ if (!this.has(dep)) {
215
+ throw new Error(`Theme "${id}" depends on non-existent theme: ${dep}`);
216
+ }
217
+ visit(dep);
218
+ }
219
+ }
220
+ visiting.delete(id);
221
+ visited.add(id);
222
+ resolved.push(id);
223
+ };
224
+
225
+ visit(themeId);
226
+ return resolved;
227
+ }
228
+
229
+ /**
230
+ * Resolve dependencies and build dependency graph
231
+ */
232
+ private resolveDependencies(): void {
233
+ // Build dependents map
234
+ for (const entry of this.entries.values()) {
235
+ for (const dep of entry.dependencies) {
236
+ const depEntry = this.entries.get(dep);
237
+ if (depEntry) {
238
+ if (!depEntry.dependents.includes(entry.id)) {
239
+ depEntry.dependents.push(entry.id);
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+
246
+ /**
247
+ * Validate all themes
248
+ */
249
+ validate(): { valid: boolean; errors: string[] } {
250
+ const errors: string[] = [];
251
+
252
+ // Check for circular dependencies
253
+ for (const themeId of this.entries.keys()) {
254
+ try {
255
+ this.resolveDependencyOrder(themeId);
256
+ } catch (error) {
257
+ errors.push(error instanceof Error ? error.message : String(error));
258
+ }
259
+ }
260
+
261
+ // Check for missing dependencies
262
+ for (const [themeId, entry] of this.entries.entries()) {
263
+ for (const dep of entry.dependencies) {
264
+ if (!this.has(dep)) {
265
+ errors.push(`Theme "${themeId}" depends on non-existent theme: ${dep}`);
266
+ }
267
+ }
268
+ }
269
+
270
+ return {
271
+ valid: errors.length === 0,
272
+ errors,
273
+ };
274
+ }
275
+
276
+ /**
277
+ * Clear registry
278
+ */
279
+ clear(): void {
280
+ this.entries.clear();
281
+ this.config = null;
282
+ this.initialized = false;
283
+ }
284
+ }