@shohojdhara/atomix 0.4.7 → 0.4.9

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 (176) hide show
  1. package/atomix.config.ts +58 -1
  2. package/dist/atomix.css +172 -157
  3. package/dist/atomix.css.map +1 -1
  4. package/dist/atomix.min.css +4 -4
  5. package/dist/atomix.min.css.map +1 -1
  6. package/dist/charts.d.ts +33 -0
  7. package/dist/charts.js +1274 -164
  8. package/dist/charts.js.map +1 -1
  9. package/dist/core.d.ts +33 -10
  10. package/dist/core.js +1099 -83
  11. package/dist/core.js.map +1 -1
  12. package/dist/forms.d.ts +33 -0
  13. package/dist/forms.js +2106 -1050
  14. package/dist/forms.js.map +1 -1
  15. package/dist/heavy.d.ts +42 -1
  16. package/dist/heavy.js +1663 -638
  17. package/dist/heavy.js.map +1 -1
  18. package/dist/index.d.ts +442 -270
  19. package/dist/index.esm.js +1947 -680
  20. package/dist/index.esm.js.map +1 -1
  21. package/dist/index.js +1982 -712
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.min.js +1 -1
  24. package/dist/index.min.js.map +1 -1
  25. package/package.json +6 -3
  26. package/scripts/atomix-cli.js +136 -1827
  27. package/scripts/cli/__tests__/basic.test.js +3 -2
  28. package/scripts/cli/__tests__/clean.test.js +278 -0
  29. package/scripts/cli/__tests__/component-validator.test.js +433 -0
  30. package/scripts/cli/__tests__/generator.test.js +613 -0
  31. package/scripts/cli/__tests__/glass-motion.test.js +256 -0
  32. package/scripts/cli/__tests__/integration.test.js +719 -108
  33. package/scripts/cli/__tests__/migrate.test.js +74 -0
  34. package/scripts/cli/__tests__/security.test.js +206 -0
  35. package/scripts/cli/__tests__/test-setup.js +3 -1
  36. package/scripts/cli/__tests__/theme-bridge.test.js +507 -0
  37. package/scripts/cli/__tests__/token-provider.test.js +361 -0
  38. package/scripts/cli/__tests__/utils.test.js +5 -5
  39. package/scripts/cli/commands/benchmark.js +105 -0
  40. package/scripts/cli/commands/build-theme.js +115 -0
  41. package/scripts/cli/commands/clean.js +109 -0
  42. package/scripts/cli/commands/doctor.js +88 -0
  43. package/scripts/cli/commands/generate.js +218 -0
  44. package/scripts/cli/commands/init.js +73 -0
  45. package/scripts/cli/commands/migrate.js +106 -0
  46. package/scripts/cli/commands/sync-tokens.js +206 -0
  47. package/scripts/cli/commands/theme-bridge.js +248 -0
  48. package/scripts/cli/commands/tokens.js +157 -0
  49. package/scripts/cli/commands/validate.js +194 -0
  50. package/scripts/cli/internal/ai-engine.js +156 -0
  51. package/scripts/cli/internal/compiler.js +114 -0
  52. package/scripts/cli/internal/component-validator.js +443 -0
  53. package/scripts/cli/internal/config-loader.js +162 -0
  54. package/scripts/cli/internal/filesystem.js +158 -0
  55. package/scripts/cli/internal/generator.js +430 -0
  56. package/scripts/cli/internal/glass-generator.js +398 -0
  57. package/scripts/cli/internal/hook-generator.js +369 -0
  58. package/scripts/cli/internal/hooks.js +61 -0
  59. package/scripts/cli/internal/itcss-generator.js +565 -0
  60. package/scripts/cli/internal/motion-generator.js +679 -0
  61. package/scripts/cli/internal/template-engine.js +301 -0
  62. package/scripts/cli/internal/theme-bridge.js +664 -0
  63. package/scripts/cli/internal/tokens/engine.js +122 -0
  64. package/scripts/cli/internal/tokens/provider.js +34 -0
  65. package/scripts/cli/internal/tokens/providers/figma.js +50 -0
  66. package/scripts/cli/internal/tokens/providers/style-dictionary.js +48 -0
  67. package/scripts/cli/internal/tokens/providers/w3c.js +48 -0
  68. package/scripts/cli/internal/tokens/token-provider.js +443 -0
  69. package/scripts/cli/internal/tokens/token-validator.js +513 -0
  70. package/scripts/cli/internal/validator.js +276 -0
  71. package/scripts/cli/internal/wizard.js +115 -0
  72. package/scripts/cli/mappings.js +23 -0
  73. package/scripts/cli/migration-tools.js +164 -94
  74. package/scripts/cli/plugins/style-dictionary.js +46 -0
  75. package/scripts/cli/templates/README.md +525 -95
  76. package/scripts/cli/templates/common-templates.js +40 -14
  77. package/scripts/cli/templates/components/react-component.ts +282 -0
  78. package/scripts/cli/templates/config/project-config.ts +112 -0
  79. package/scripts/cli/templates/hooks/use-component.ts +477 -0
  80. package/scripts/cli/templates/index.js +19 -4
  81. package/scripts/cli/templates/index.ts +171 -0
  82. package/scripts/cli/templates/next-templates.js +72 -0
  83. package/scripts/cli/templates/react-templates.js +70 -126
  84. package/scripts/cli/templates/scss-templates.js +35 -35
  85. package/scripts/cli/templates/stories/storybook-story.ts +241 -0
  86. package/scripts/cli/templates/styles/scss-component.ts +255 -0
  87. package/scripts/cli/templates/tests/vitest-test.ts +229 -0
  88. package/scripts/cli/templates/token-templates.js +337 -1
  89. package/scripts/cli/templates/tokens/token-generators.ts +1088 -0
  90. package/scripts/cli/templates/types/component-types.ts +145 -0
  91. package/scripts/cli/templates/utils/testing-utils.ts +144 -0
  92. package/scripts/cli/templates/vanilla-templates.js +39 -0
  93. package/scripts/cli/token-manager.js +8 -2
  94. package/scripts/cli/utils/cache-manager.js +240 -0
  95. package/scripts/cli/utils/detector.js +46 -0
  96. package/scripts/cli/utils/diagnostics.js +289 -0
  97. package/scripts/cli/utils/error.js +89 -0
  98. package/scripts/cli/utils/helpers.js +67 -0
  99. package/scripts/cli/utils/logger.js +75 -0
  100. package/scripts/cli/utils/security.js +302 -0
  101. package/scripts/cli/utils/telemetry.js +115 -0
  102. package/scripts/cli/utils/validation.js +37 -0
  103. package/scripts/cli/utils.js +28 -341
  104. package/src/components/Accordion/Accordion.stories.tsx +0 -18
  105. package/src/components/Accordion/Accordion.test.tsx +0 -17
  106. package/src/components/Accordion/Accordion.tsx +0 -4
  107. package/src/components/AtomixGlass/AtomixGlass.test.tsx +37 -3
  108. package/src/components/AtomixGlass/AtomixGlass.tsx +143 -31
  109. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +129 -31
  110. package/src/components/AtomixGlass/PerformanceDashboard.tsx +219 -0
  111. package/src/components/AtomixGlass/README.md +25 -10
  112. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +216 -0
  113. package/src/components/AtomixGlass/animation-system.ts +578 -0
  114. package/src/components/AtomixGlass/shader-utils.ts +4 -1
  115. package/src/components/AtomixGlass/stories/Overview.stories.tsx +157 -6
  116. package/src/components/AtomixGlass/stories/Phase1-Animation.stories.tsx +653 -0
  117. package/src/components/AtomixGlass/stories/Phase1-Test.stories.tsx +95 -0
  118. package/src/components/AtomixGlass/stories/Playground.stories.tsx +51 -51
  119. package/src/components/AtomixGlass/stories/shared-components.tsx +6 -0
  120. package/src/components/Avatar/Avatar.tsx +1 -1
  121. package/src/components/Button/Button.stories.disabled-link.tsx +10 -0
  122. package/src/components/Button/Button.stories.tsx +10 -0
  123. package/src/components/Button/Button.test.tsx +16 -11
  124. package/src/components/Button/Button.tsx +4 -4
  125. package/src/components/Card/Card.tsx +1 -1
  126. package/src/components/Dropdown/Dropdown.tsx +12 -12
  127. package/src/components/Form/Select.tsx +62 -3
  128. package/src/components/Modal/Modal.tsx +14 -3
  129. package/src/components/Navigation/Navbar/Navbar.tsx +44 -0
  130. package/src/components/Slider/Slider.stories.tsx +3 -3
  131. package/src/components/Slider/Slider.tsx +38 -0
  132. package/src/components/Steps/Steps.tsx +3 -3
  133. package/src/components/Tabs/Tabs.tsx +77 -8
  134. package/src/components/Testimonial/Testimonial.tsx +1 -1
  135. package/src/components/TypedButton/TypedButton.stories.tsx +59 -0
  136. package/src/components/TypedButton/TypedButton.tsx +39 -0
  137. package/src/components/TypedButton/index.ts +2 -0
  138. package/src/components/VideoPlayer/VideoPlayer.tsx +11 -4
  139. package/src/lib/composables/index.ts +4 -7
  140. package/src/lib/composables/types.ts +45 -0
  141. package/src/lib/composables/useAccordion.ts +0 -7
  142. package/src/lib/composables/useAtomixGlass.ts +148 -6
  143. package/src/lib/composables/useAtomixGlassStyles.ts +9 -7
  144. package/src/lib/composables/useChartExport.ts +3 -13
  145. package/src/lib/composables/useDropdown.ts +66 -0
  146. package/src/lib/composables/useFocusTrap.ts +80 -0
  147. package/src/lib/composables/usePerformanceMonitor.ts +448 -0
  148. package/src/lib/composables/useResponsiveGlass.presets.ts +192 -0
  149. package/src/lib/composables/useResponsiveGlass.ts +441 -0
  150. package/src/lib/composables/useTooltip.ts +16 -0
  151. package/src/lib/composables/useTypedButton.ts +66 -0
  152. package/src/lib/config/index.ts +62 -5
  153. package/src/lib/constants/components.ts +62 -7
  154. package/src/lib/theme/devtools/__tests__/useHistory.test.tsx +150 -0
  155. package/src/lib/theme/tokens/centralized-tokens.ts +120 -0
  156. package/src/lib/theme/utils/__tests__/domUtils.test.ts +101 -0
  157. package/src/lib/types/components.ts +37 -11
  158. package/src/lib/types/glass.ts +35 -0
  159. package/src/lib/types/index.ts +1 -0
  160. package/src/lib/utils/displacement-generator.ts +1 -1
  161. package/src/styles/01-settings/_settings.testtypecheck.scss +53 -0
  162. package/src/styles/01-settings/_settings.typedbutton.scss +53 -0
  163. package/src/styles/06-components/_components.atomix-glass.scss +17 -21
  164. package/src/styles/06-components/_components.edge-panel.scss +1 -5
  165. package/src/styles/06-components/_components.modal.scss +1 -4
  166. package/src/styles/06-components/_components.navbar.scss +1 -1
  167. package/src/styles/06-components/_components.testbutton.scss +212 -0
  168. package/src/styles/06-components/_components.testtypecheck.scss +212 -0
  169. package/src/styles/06-components/_components.tooltip.scss +9 -5
  170. package/src/styles/06-components/_components.typedbutton.scss +212 -0
  171. package/src/styles/99-utilities/_index.scss +1 -0
  172. package/src/styles/99-utilities/_utilities.text.scss +1 -1
  173. package/src/styles/99-utilities/_utilities.touch-target.scss +36 -0
  174. package/scripts/cli/component-generator.js +0 -564
  175. package/scripts/cli/interactive-init.js +0 -357
  176. package/src/styles/06-components/old.chart.styles.scss +0 -2788
@@ -0,0 +1,441 @@
1
+ import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
2
+ import type { GlassParams, ResponsiveBreakpoint } from '../types/glass';
3
+
4
+ /**
5
+ * Default responsive breakpoints configuration
6
+ *
7
+ * These breakpoints are optimized for glass effect performance across device classes:
8
+ * - Mobile: Reduced complexity for 60 FPS target
9
+ * - Tablet: Balanced quality and performance
10
+ * - Desktop: Full fidelity effects
11
+ */
12
+ export const DEFAULT_BREAKPOINTS: Record<string, ResponsiveBreakpoint> = {
13
+ mobile: {
14
+ maxWidth: 640,
15
+ params: {
16
+ distortionOctaves: 3,
17
+ displacementScale: 0.7,
18
+ blurAmount: 0.8,
19
+ animationSpeed: 0.8,
20
+ chromaticIntensity: 0.5,
21
+ },
22
+ },
23
+ tablet: {
24
+ minWidth: 641,
25
+ maxWidth: 1024,
26
+ params: {
27
+ distortionOctaves: 4,
28
+ displacementScale: 0.85,
29
+ blurAmount: 0.9,
30
+ animationSpeed: 0.9,
31
+ chromaticIntensity: 0.75,
32
+ },
33
+ },
34
+ desktop: {
35
+ minWidth: 1025,
36
+ params: {
37
+ distortionOctaves: 5,
38
+ displacementScale: 1.0,
39
+ blurAmount: 1.0,
40
+ animationSpeed: 1.0,
41
+ chromaticIntensity: 1.0,
42
+ },
43
+ },
44
+ };
45
+
46
+ /**
47
+ * Device performance tier detection
48
+ *
49
+ * Uses Device Memory API and Hardware Concurrency API to classify devices
50
+ * into performance tiers for automatic quality adjustment.
51
+ *
52
+ * @returns Performance tier classification
53
+ */
54
+ const detectDevicePerformanceTier = (): 'low' | 'medium' | 'high' => {
55
+ // Check if we're in a browser environment
56
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
57
+ return 'high'; // Default to high for SSR
58
+ }
59
+
60
+ // Device Memory API (Chrome, Edge, Opera)
61
+ // Returns RAM in GB: 0.25, 0.5, 1, 2, 4, 8
62
+ const deviceMemory = (navigator as any).deviceMemory || 4;
63
+
64
+ // Hardware Concurrency API (logical CPU cores)
65
+ const hardwareConcurrency = navigator.hardwareConcurrency || 4;
66
+
67
+ // Low-end: ≤2GB RAM OR ≤2 CPU cores
68
+ if (deviceMemory <= 2 || hardwareConcurrency <= 2) {
69
+ return 'low';
70
+ }
71
+
72
+ // High-end: ≥4GB RAM AND ≥4 CPU cores
73
+ if (deviceMemory >= 4 && hardwareConcurrency >= 4) {
74
+ return 'high';
75
+ }
76
+
77
+ // Medium: Everything else
78
+ return 'medium';
79
+ };
80
+
81
+ /**
82
+ * Get performance-based quality adjustments
83
+ *
84
+ * Further reduces quality parameters for low-end devices regardless of screen size.
85
+ * This ensures smooth performance on devices with limited resources.
86
+ *
87
+ * @param baseParams Base parameters from breakpoint
88
+ * @param performanceTier Device performance tier
89
+ * @returns Adjusted parameters
90
+ */
91
+ const applyPerformanceAdjustments = (
92
+ baseParams: GlassParams,
93
+ performanceTier: 'low' | 'medium' | 'high'
94
+ ): GlassParams => {
95
+ if (performanceTier === 'high') {
96
+ return baseParams; // No adjustment needed
97
+ }
98
+
99
+ const multiplier = performanceTier === 'low' ? 0.7 : 0.85;
100
+
101
+ return {
102
+ ...baseParams,
103
+ distortionOctaves: Math.max(2, Math.round((baseParams.distortionOctaves || 5) * multiplier)),
104
+ displacementScale: (baseParams.displacementScale || 1) * multiplier,
105
+ blurAmount: (baseParams.blurAmount || 1) * multiplier,
106
+ animationSpeed: (baseParams.animationSpeed || 1) * multiplier,
107
+ chromaticIntensity: (baseParams.chromaticIntensity || 1) * multiplier,
108
+ };
109
+ };
110
+
111
+ /**
112
+ * Debounce utility for resize events
113
+ *
114
+ * Prevents excessive recalculations during window resize.
115
+ *
116
+ * @param func Function to debounce
117
+ * @param wait Wait time in milliseconds
118
+ * @returns Debounced function
119
+ */
120
+ const useDebounce = <T extends (...args: any[]) => any>(
121
+ func: T,
122
+ wait: number
123
+ ): T => {
124
+ const timeoutRef = useRef<NodeJS.Timeout | null>(null);
125
+
126
+ useEffect(() => {
127
+ return () => {
128
+ if (timeoutRef.current) {
129
+ clearTimeout(timeoutRef.current);
130
+ }
131
+ };
132
+ }, []);
133
+
134
+ return useCallback((...args: Parameters<T>) => {
135
+ if (timeoutRef.current) {
136
+ clearTimeout(timeoutRef.current);
137
+ }
138
+ timeoutRef.current = setTimeout(() => {
139
+ func(...args);
140
+ }, wait);
141
+ }, [func, wait]) as T;
142
+ };
143
+
144
+ /**
145
+ * Hook options for responsive glass parameters
146
+ */
147
+ interface UseResponsiveGlassOptions {
148
+ /** Base glass parameters (before responsive scaling) */
149
+ baseParams: GlassParams;
150
+
151
+ /** Custom breakpoints (optional, uses defaults if not provided) */
152
+ breakpoints?: Record<string, ResponsiveBreakpoint>;
153
+
154
+ /** Enable/disable responsive system */
155
+ enabled?: boolean;
156
+
157
+ /** Enable performance-based adjustments */
158
+ enablePerformanceAdjustment?: boolean;
159
+
160
+ /** Debug mode - logs breakpoint changes */
161
+ debug?: boolean;
162
+ }
163
+
164
+ /**
165
+ * Return value from responsive glass hook
166
+ */
167
+ interface UseResponsiveGlassReturn {
168
+ /** Current responsive parameters based on breakpoint */
169
+ responsiveParams: GlassParams;
170
+
171
+ /** Current breakpoint name ('mobile', 'tablet', 'desktop', or 'custom') */
172
+ currentBreakpoint: string;
173
+
174
+ /** Current device performance tier */
175
+ performanceTier: 'low' | 'medium' | 'high';
176
+
177
+ /** Whether responsive system is active */
178
+ isActive: boolean;
179
+
180
+ /** Manually recalculate responsive parameters */
181
+ recalculate: () => void;
182
+ }
183
+
184
+ /**
185
+ * Calculate which breakpoint matches current screen width
186
+ *
187
+ * @param width Current screen width
188
+ * @param breakpoints Breakpoint definitions
189
+ * @returns Matching breakpoint name and params
190
+ */
191
+ const calculateBreakpoint = (
192
+ width: number,
193
+ breakpoints: Record<string, ResponsiveBreakpoint>
194
+ ): { name: string; params: GlassParams } => {
195
+ // Convert breakpoints to array and sort by minWidth descending
196
+ const sortedBreakpoints = Object.entries(breakpoints)
197
+ .filter(([_, bp]) => bp.minWidth !== undefined)
198
+ .sort((a, b) => (b[1].minWidth || 0) - (a[1].minWidth || 0));
199
+
200
+ // Find first breakpoint where width >= minWidth
201
+ for (const [name, bp] of sortedBreakpoints) {
202
+ if (width >= (bp.minWidth || 0)) {
203
+ return { name, params: bp.params };
204
+ }
205
+ }
206
+
207
+ // If no minWidth matched, check maxWidth breakpoints
208
+ const maxWidthBreakpoints = Object.entries(breakpoints)
209
+ .filter(([_, bp]) => bp.maxWidth !== undefined)
210
+ .sort((a, b) => (a[1].maxWidth || Infinity) - (b[1].maxWidth || Infinity));
211
+
212
+ for (const [name, bp] of maxWidthBreakpoints) {
213
+ if (width <= (bp.maxWidth || Infinity)) {
214
+ return { name, params: bp.params };
215
+ }
216
+ }
217
+
218
+ // Fallback to first available breakpoint
219
+ const entries = Object.entries(breakpoints);
220
+ if (entries.length === 0) {
221
+ // Ultimate fallback - return sensible defaults
222
+ return {
223
+ name: 'desktop',
224
+ params: { distortionOctaves: 5, displacementScale: 1, blurAmount: 1 }
225
+ };
226
+ }
227
+ const firstEntry = entries[0];
228
+ if (!firstEntry) {
229
+ return {
230
+ name: 'desktop',
231
+ params: { distortionOctaves: 5, displacementScale: 1, blurAmount: 1 }
232
+ };
233
+ }
234
+ const [fallbackName, fallbackBreakpoint] = firstEntry;
235
+ return { name: fallbackName, params: fallbackBreakpoint.params };
236
+ };
237
+
238
+ /**
239
+ * Merge base parameters with breakpoint parameters
240
+ *
241
+ * Applies multiplicative scaling for numeric values.
242
+ *
243
+ * @param baseParams Base glass parameters
244
+ * @param breakpointParams Breakpoint-specific parameters
245
+ * @returns Merged parameters
246
+ */
247
+ const mergeParams = (
248
+ baseParams: GlassParams,
249
+ breakpointParams: GlassParams
250
+ ): GlassParams => {
251
+ const result: GlassParams = { ...baseParams };
252
+
253
+ // Apply scaling for specific properties
254
+ const scaleProperties: (keyof GlassParams)[] = [
255
+ 'displacementScale',
256
+ 'blurAmount',
257
+ 'saturation',
258
+ 'aberrationIntensity',
259
+ 'animationSpeed',
260
+ 'chromaticIntensity',
261
+ ];
262
+
263
+ for (const prop of scaleProperties) {
264
+ if (breakpointParams[prop] !== undefined && baseParams[prop] !== undefined) {
265
+ (result as any)[prop] = (baseParams[prop] as number) * (breakpointParams[prop] as number);
266
+ }
267
+ }
268
+
269
+ // Override properties that should be set directly (not scaled)
270
+ const overrideProperties: (keyof GlassParams)[] = [
271
+ 'distortionOctaves',
272
+ 'distortionLacunarity',
273
+ 'distortionGain',
274
+ ];
275
+
276
+ for (const prop of overrideProperties) {
277
+ if (breakpointParams[prop] !== undefined) {
278
+ (result as any)[prop] = breakpointParams[prop];
279
+ }
280
+ }
281
+
282
+ return result;
283
+ };
284
+
285
+ /**
286
+ * Responsive Glass Parameters Hook
287
+ *
288
+ * Automatically adjusts glass effect parameters based on:
289
+ * 1. Screen size (mobile/tablet/desktop breakpoints)
290
+ * 2. Device performance (RAM and CPU detection)
291
+ * 3. Custom breakpoint configuration
292
+ *
293
+ * Features:
294
+ * - Debounced resize handling
295
+ * - Performance-based quality adjustment
296
+ * - Smooth parameter transitions
297
+ * - Debug mode for development
298
+ *
299
+ * @example
300
+ * ```typescript
301
+ * const { responsiveParams, currentBreakpoint } = useResponsiveGlass({
302
+ * baseParams: {
303
+ * distortionOctaves: 5,
304
+ * displacementScale: 20,
305
+ * blurAmount: 10,
306
+ * },
307
+ * debug: true,
308
+ * });
309
+ * ```
310
+ *
311
+ * @param options Hook configuration options
312
+ * @returns Responsive parameters and metadata
313
+ */
314
+ export function useResponsiveGlass({
315
+ baseParams,
316
+ breakpoints = DEFAULT_BREAKPOINTS,
317
+ enabled = true,
318
+ enablePerformanceAdjustment = true,
319
+ debug = false,
320
+ }: UseResponsiveGlassOptions): UseResponsiveGlassReturn {
321
+ const [responsiveParams, setResponsiveParams] = useState<GlassParams>(baseParams);
322
+ const [currentBreakpoint, setCurrentBreakpoint] = useState<string>('desktop');
323
+ const [performanceTier, setPerformanceTier] = useState<'low' | 'medium' | 'high'>('high');
324
+ const [isActive, setIsActive] = useState<boolean>(enabled);
325
+
326
+ // Use refs to prevent unnecessary re-creations
327
+ const baseParamsRef = useRef(baseParams);
328
+ const breakpointsRef = useRef(breakpoints);
329
+
330
+ // Update refs when props change
331
+ baseParamsRef.current = baseParams;
332
+ breakpointsRef.current = breakpoints;
333
+
334
+ /**
335
+ * Calculate and apply responsive parameters
336
+ */
337
+ const calculateParams = useCallback(() => {
338
+ if (!enabled || typeof window === 'undefined') {
339
+ setIsActive(false);
340
+ setResponsiveParams(baseParamsRef.current);
341
+ setCurrentBreakpoint('disabled');
342
+ return;
343
+ }
344
+
345
+ setIsActive(true);
346
+
347
+ // Get current screen width
348
+ const width = window.innerWidth;
349
+
350
+ // Determine current breakpoint
351
+ const { name, params: breakpointParams } = calculateBreakpoint(width, breakpointsRef.current);
352
+ setCurrentBreakpoint(name);
353
+
354
+ // Merge base params with breakpoint params
355
+ let mergedParams = mergeParams(baseParamsRef.current, breakpointParams);
356
+
357
+ // Apply performance adjustments if enabled
358
+ if (enablePerformanceAdjustment) {
359
+ const tier = detectDevicePerformanceTier();
360
+ setPerformanceTier(tier);
361
+ mergedParams = applyPerformanceAdjustments(mergedParams, tier);
362
+
363
+ if (debug) {
364
+ console.log('[useResponsiveGlass] Performance Tier:', tier);
365
+ }
366
+ }
367
+
368
+ setResponsiveParams(mergedParams);
369
+
370
+ if (debug) {
371
+ console.log('[useResponsiveGlass] Breakpoint:', {
372
+ name,
373
+ width,
374
+ params: mergedParams,
375
+ timestamp: new Date().toISOString(),
376
+ });
377
+ }
378
+ }, [enabled, enablePerformanceAdjustment, debug]);
379
+
380
+ /**
381
+ * Debounced parameter calculation for resize events
382
+ */
383
+ const debouncedCalculate = useDebounce(calculateParams, 200);
384
+
385
+ /**
386
+ * Handle window resize
387
+ */
388
+ useEffect(() => {
389
+ if (!enabled) return;
390
+
391
+ // Initial calculation
392
+ calculateParams();
393
+
394
+ // Listen for resize events
395
+ window.addEventListener('resize', debouncedCalculate);
396
+
397
+ // Cleanup
398
+ return () => {
399
+ window.removeEventListener('resize', debouncedCalculate);
400
+ };
401
+ // eslint-disable-next-line react-hooks/exhaustive-deps
402
+ }, [enabled]); // calculateParams and debouncedCalculate are stable via useCallback and refs
403
+
404
+ /**
405
+ * Manual recalculation function
406
+ */
407
+ const recalculate = useCallback(() => {
408
+ calculateParams();
409
+ }, [calculateParams]);
410
+
411
+ return {
412
+ responsiveParams,
413
+ currentBreakpoint,
414
+ performanceTier,
415
+ isActive,
416
+ recalculate,
417
+ };
418
+ }
419
+
420
+ /**
421
+ * Utility function to get default breakpoints
422
+ * Useful for documentation and debugging
423
+ */
424
+ export function getDefaultBreakpoints(): Record<string, ResponsiveBreakpoint> {
425
+ return { ...DEFAULT_BREAKPOINTS };
426
+ }
427
+
428
+ /**
429
+ * Utility function to create custom breakpoints
430
+ *
431
+ * @param customBreakpoints Partial breakpoint overrides
432
+ * @returns Complete breakpoint configuration
433
+ */
434
+ export function createBreakpoints(
435
+ customBreakpoints: Partial<Record<string, ResponsiveBreakpoint>>
436
+ ): Record<string, ResponsiveBreakpoint> {
437
+ return {
438
+ ...DEFAULT_BREAKPOINTS,
439
+ ...customBreakpoints,
440
+ } as Record<string, ResponsiveBreakpoint>;
441
+ }
@@ -249,6 +249,22 @@ export const useTooltip = ({
249
249
  };
250
250
  }, [isVisible, updatePosition]);
251
251
 
252
+ // Handle Escape key to close tooltip
253
+ useEffect(() => {
254
+ if (!isVisible) return undefined;
255
+
256
+ const handleKeyDown = (event: KeyboardEvent) => {
257
+ if (event.key === 'Escape') {
258
+ hideTooltip();
259
+ }
260
+ };
261
+
262
+ document.addEventListener('keydown', handleKeyDown);
263
+ return () => {
264
+ document.removeEventListener('keydown', handleKeyDown);
265
+ };
266
+ }, [isVisible, hideTooltip]);
267
+
252
268
  // Setup trigger props
253
269
  const triggerProps: React.HTMLAttributes<HTMLDivElement> = {
254
270
  'aria-describedby': isVisible ? tooltipId : undefined,
@@ -0,0 +1,66 @@
1
+ import { TypedButtonProps } from '../types/components';
2
+ import { TYPEDBUTTON } from '../constants/components';
3
+
4
+ /**
5
+ * TypedButton state and functionality
6
+ * @param initialProps - Initial typedbutton properties
7
+ * @returns TypedButton state and methods
8
+ */
9
+ export function useTypedButton(initialProps?: Partial<TypedButtonProps>) {
10
+ // Default typedbutton properties
11
+ const defaultProps: Partial<TypedButtonProps> = {
12
+ variant: 'primary',
13
+ size: 'md',
14
+ disabled: false,
15
+ ...initialProps,
16
+ };
17
+
18
+ /**
19
+ * Generate typedbutton class based on properties
20
+ * @param props - TypedButton properties
21
+ * @returns Class string
22
+ */
23
+ const generateClassNames = (props: Partial<TypedButtonProps> = {}): string => {
24
+ const {
25
+ variant = defaultProps.variant,
26
+ size = defaultProps.size,
27
+ disabled = defaultProps.disabled,
28
+ glass = defaultProps.glass,
29
+ className = '',
30
+ } = props;
31
+
32
+ const sizeClass = size === 'md' ? '' : `c-typedbutton--${size}`;
33
+ const disabledClass = disabled ? 'c-typedbutton--disabled' : '';
34
+ const glassClass = glass ? 'c-typedbutton--glass' : '';
35
+
36
+ return [
37
+ TYPEDBUTTON.BASE_CLASS,
38
+ `c-typedbutton--${variant}`,
39
+ sizeClass,
40
+ disabledClass,
41
+ glassClass,
42
+ className,
43
+ ]
44
+ .filter(Boolean)
45
+ .join(' ');
46
+ };
47
+
48
+ /**
49
+ * Handle typedbutton click with disabled check
50
+ * @param handler - Click handler function
51
+ * @returns Function that respects disabled state
52
+ */
53
+ const handleClick = (handler?: (event: React.MouseEvent<HTMLDivElement>) => void) => {
54
+ return (event: React.MouseEvent<HTMLDivElement>) => {
55
+ if (!defaultProps.disabled && handler) {
56
+ handler(event);
57
+ }
58
+ };
59
+ };
60
+
61
+ return {
62
+ defaultProps,
63
+ generateClassNames,
64
+ handleClick,
65
+ };
66
+ }
@@ -178,6 +178,34 @@ export interface IntegrationConfig {
178
178
  };
179
179
  }
180
180
 
181
+ /**
182
+ * Plugin Configuration
183
+ */
184
+ export interface PluginConfig {
185
+ name: string;
186
+ options?: Record<string, any>;
187
+ }
188
+
189
+ /**
190
+ * Token Provider Configuration
191
+ */
192
+ export interface TokenProviderConfig {
193
+ type: 'figma' | 'style-dictionary' | 'w3c' | string;
194
+ options?: Record<string, any>;
195
+ }
196
+
197
+ /**
198
+ * Token Engine Configuration
199
+ */
200
+ export interface TokenEngineConfig {
201
+ providers?: Record<string, TokenProviderConfig>;
202
+ sync?: {
203
+ pull?: boolean;
204
+ push?: boolean;
205
+ onBuild?: boolean;
206
+ };
207
+ }
208
+
181
209
  /**
182
210
  * Atomix Configuration Interface
183
211
  *
@@ -193,6 +221,40 @@ export interface AtomixConfig {
193
221
  */
194
222
  prefix?: string;
195
223
 
224
+ /**
225
+ * Plugins to extend CLI functionality
226
+ */
227
+ plugins?: (string | PluginConfig)[];
228
+
229
+ /**
230
+ * Universal Token Engine configuration
231
+ */
232
+ tokenEngine?: TokenEngineConfig;
233
+
234
+ /**
235
+ * AI-Assisted Scaffolding configuration
236
+ */
237
+ ai?: {
238
+ /** AI provider (default: 'openai') */
239
+ provider?: 'openai' | 'anthropic';
240
+ /** LLM model to use */
241
+ model?: string;
242
+ /** API key for the provider */
243
+ apiKey?: string;
244
+ };
245
+
246
+ /**
247
+ * Performance & Telemetry (Phase 4)
248
+ */
249
+ telemetry?: {
250
+ /** Enable local telemetry logging (default: false) */
251
+ enabled?: boolean;
252
+ /** Output path for telemetry logs (default: '.atomix/telemetry.json') */
253
+ path?: string;
254
+ /** Anonymize telemetry data (default: true) */
255
+ anonymize?: boolean;
256
+ };
257
+
196
258
  /**
197
259
  * Theme customization (Tailwind-like)
198
260
  *
@@ -268,8 +330,3 @@ export interface AtomixConfig {
268
330
  export function defineConfig(config: AtomixConfig): AtomixConfig {
269
331
  return config;
270
332
  }
271
-
272
- // Export loader functions
273
- // Loader functions removed to prevent bundling Node.js modules in browser
274
-
275
- export default AtomixConfig;
@@ -39,6 +39,16 @@ export const THEME_NAMING = {
39
39
  SPINNER_ELEMENT: 'spinner',
40
40
  };
41
41
 
42
+ export const TYPEDBUTTON = {
43
+ BASE_CLASS: 'c-typedbutton',
44
+ VARIANT_PREFIX: 'c-typedbutton--',
45
+ CLASSES: {
46
+ BASE: 'c-typedbutton',
47
+ DISABLED: 'c-typedbutton--disabled',
48
+ GLASS: 'c-typedbutton--glass',
49
+ },
50
+ };
51
+
42
52
  export const BUTTON = {
43
53
  BASE_CLASS: 'c-btn',
44
54
  ICON_CLASS: 'c-btn__icon',
@@ -1651,19 +1661,28 @@ export const ATOMIX_GLASS = {
1651
1661
  SHADER: 'c-atomix-glass--shader',
1652
1662
  },
1653
1663
  DEFAULTS: {
1654
- DISPLACEMENT_SCALE: 20,
1655
- BLUR_AMOUNT: 1,
1664
+ DISPLACEMENT_SCALE: 70,
1665
+ BLUR_AMOUNT: 0,
1656
1666
  SATURATION: 140,
1657
- ABERRATION_INTENSITY: 2.5,
1658
- ELASTICITY: 0.05,
1659
- CORNER_RADIUS: 16, // Default border-radius matching design system
1660
- PADDING: '0 0',
1667
+ ABERRATION_INTENSITY: 2,
1668
+ ELASTICITY: 0.15,
1669
+ CORNER_RADIUS: 20, // Default border-radius matching design system
1670
+ PADDING: '0',
1661
1671
  MODE: 'standard' as const,
1662
1672
  OVER_LIGHT: false as const,
1663
1673
  ENABLE_OVER_LIGHT_LAYERS: true,
1674
+ // Phase 1: Time-Based Animation System defaults
1675
+ WITH_TIME_ANIMATION: true as const,
1676
+ ANIMATION_SPEED: 1.0,
1677
+ // Phase 1: Multi-Layer Distortion System defaults
1678
+ WITH_MULTI_LAYER_DISTORTION: false as const,
1679
+ DISTORTION_OCTAVES: 5,
1680
+ DISTORTION_LACUNARITY: 2.0,
1681
+ DISTORTION_GAIN: 0.5,
1682
+ DISTORTION_QUALITY: 'high' as const,
1664
1683
  },
1665
1684
  CONSTANTS: {
1666
- ACTIVATION_ZONE: 350,
1685
+ ACTIVATION_ZONE: 200,
1667
1686
  LERP_FACTOR: 0.08,
1668
1687
  SMOOTHSTEP_POWER: 2.5,
1669
1688
  MIN_BLUR: 0.1,
@@ -1782,5 +1801,41 @@ export const ATOMIX_GLASS = {
1782
1801
  SATURATION: {
1783
1802
  HIGH_CONTRAST: 200, // Saturation value for high contrast mode
1784
1803
  },
1804
+
1805
+ // Phase 1: Animation System Constants
1806
+ ANIMATION: {
1807
+ // Breathing effect timing (in milliseconds)
1808
+ BREATHING_CYCLE: 2000, // 2-second breathing cycle
1809
+ // Flow animation speed
1810
+ FLOW_SPEED_X: 0.1, // Horizontal flow speed
1811
+ FLOW_SPEED_Y: 0.15, // Vertical flow speed
1812
+ // Wave propagation
1813
+ WAVE_SPEED: 0.05, // Radial wave speed
1814
+ WAVE_AMPLITUDE: 0.02, // Wave amplitude
1815
+ },
1816
+
1817
+ // Phase 1: Multi-Layer Distortion Quality Presets
1818
+ DISTORTION_QUALITY_PRESETS: {
1819
+ low: {
1820
+ octaves: 2,
1821
+ lacunarity: 2.0,
1822
+ gain: 0.5,
1823
+ },
1824
+ medium: {
1825
+ octaves: 4,
1826
+ lacunarity: 2.0,
1827
+ gain: 0.5,
1828
+ },
1829
+ high: {
1830
+ octaves: 5,
1831
+ lacunarity: 2.0,
1832
+ gain: 0.5,
1833
+ },
1834
+ ultra: {
1835
+ octaves: 7,
1836
+ lacunarity: 2.0,
1837
+ gain: 0.5,
1838
+ },
1839
+ } as const,
1785
1840
  },
1786
1841
  };